{
  "status": "Draft",
  "implementationStatus": "Proposed",
  "createdInTracker": false,
  "workItemPrefix": "AIFACTORY",
  "requiredTags": [
    "system:",
    "project:",
    "domain:",
    "type:",
    "route:",
    "slice:",
    "phase:"
  ],
  "buildOrder": {
    "derived": true,
    "phases": [
      {
        "id": "templates-and-libraries",
        "title": "Templates and libraries",
        "features": [
          "AIFACTORY-FEAT-090",
          "AIFACTORY-FEAT-096",
          "AIFACTORY-FEAT-097",
          "AIFACTORY-FEAT-098",
          "AIFACTORY-FEAT-099",
          "AIFACTORY-FEAT-153",
          "AIFACTORY-FEAT-154",
          "AIFACTORY-FEAT-155",
          "AIFACTORY-FEAT-157",
          "AIFACTORY-FEAT-158",
          "AIFACTORY-FEAT-156",
          "AIFACTORY-FEAT-159",
          "AIFACTORY-FEAT-161",
          "AIFACTORY-FEAT-162",
          "AIFACTORY-FEAT-163",
          "AIFACTORY-FEAT-100",
          "AIFACTORY-FEAT-172",
          "AIFACTORY-FEAT-171",
          "AIFACTORY-FEAT-175",
          "AIFACTORY-FEAT-183",
          "AIFACTORY-FEAT-160",
          "AIFACTORY-FEAT-176",
          "AIFACTORY-FEAT-177",
          "AIFACTORY-FEAT-180",
          "AIFACTORY-FEAT-178",
          "AIFACTORY-FEAT-181",
          "AIFACTORY-FEAT-184",
          "AIFACTORY-FEAT-174",
          "AIFACTORY-FEAT-173",
          "AIFACTORY-FEAT-185",
          "AIFACTORY-FEAT-167",
          "AIFACTORY-FEAT-168",
          "AIFACTORY-FEAT-169",
          "AIFACTORY-FEAT-164",
          "AIFACTORY-FEAT-166",
          "AIFACTORY-FEAT-170",
          "AIFACTORY-FEAT-179",
          "AIFACTORY-FEAT-182",
          "AIFACTORY-FEAT-186",
          "AIFACTORY-FEAT-165",
          "AIFACTORY-FEAT-104",
          "AIFACTORY-FEAT-105",
          "AIFACTORY-FEAT-106"
        ]
      },
      {
        "id": "factory",
        "title": "Factory code",
        "features": [
          "AIFACTORY-FEAT-088",
          "AIFACTORY-FEAT-089",
          "AIFACTORY-FEAT-091",
          "AIFACTORY-FEAT-092",
          "AIFACTORY-FEAT-093",
          "AIFACTORY-FEAT-094",
          "AIFACTORY-FEAT-138",
          "AIFACTORY-FEAT-001",
          "AIFACTORY-FEAT-002",
          "AIFACTORY-FEAT-004",
          "AIFACTORY-FEAT-005",
          "AIFACTORY-FEAT-006",
          "AIFACTORY-FEAT-008",
          "AIFACTORY-FEAT-011",
          "AIFACTORY-FEAT-012",
          "AIFACTORY-FEAT-014",
          "AIFACTORY-FEAT-015",
          "AIFACTORY-FEAT-017",
          "AIFACTORY-FEAT-018",
          "AIFACTORY-FEAT-019",
          "AIFACTORY-FEAT-020",
          "AIFACTORY-FEAT-021",
          "AIFACTORY-FEAT-022",
          "AIFACTORY-FEAT-028",
          "AIFACTORY-FEAT-029",
          "AIFACTORY-FEAT-030",
          "AIFACTORY-FEAT-032",
          "AIFACTORY-FEAT-033",
          "AIFACTORY-FEAT-034",
          "AIFACTORY-FEAT-041",
          "AIFACTORY-FEAT-046",
          "AIFACTORY-FEAT-060",
          "AIFACTORY-FEAT-061",
          "AIFACTORY-FEAT-064",
          "AIFACTORY-FEAT-062",
          "AIFACTORY-FEAT-065",
          "AIFACTORY-FEAT-082",
          "AIFACTORY-FEAT-083",
          "AIFACTORY-FEAT-084",
          "AIFACTORY-FEAT-085",
          "AIFACTORY-FEAT-187",
          "AIFACTORY-FEAT-107",
          "AIFACTORY-FEAT-108",
          "AIFACTORY-FEAT-109",
          "AIFACTORY-FEAT-110",
          "AIFACTORY-FEAT-111",
          "AIFACTORY-FEAT-112",
          "AIFACTORY-FEAT-139",
          "AIFACTORY-FEAT-189",
          "AIFACTORY-FEAT-188",
          "AIFACTORY-FEAT-042",
          "AIFACTORY-FEAT-043",
          "AIFACTORY-FEAT-044",
          "AIFACTORY-FEAT-045",
          "AIFACTORY-FEAT-047",
          "AIFACTORY-FEAT-048",
          "AIFACTORY-FEAT-049",
          "AIFACTORY-FEAT-050",
          "AIFACTORY-FEAT-113",
          "AIFACTORY-FEAT-114",
          "AIFACTORY-FEAT-115",
          "AIFACTORY-FEAT-116",
          "AIFACTORY-FEAT-147",
          "AIFACTORY-FEAT-134",
          "AIFACTORY-FEAT-152",
          "AIFACTORY-FEAT-140",
          "AIFACTORY-FEAT-013",
          "AIFACTORY-FEAT-066",
          "AIFACTORY-FEAT-072",
          "AIFACTORY-FEAT-073",
          "AIFACTORY-FEAT-074",
          "AIFACTORY-FEAT-075",
          "AIFACTORY-FEAT-076",
          "AIFACTORY-FEAT-077",
          "AIFACTORY-FEAT-078",
          "AIFACTORY-FEAT-079",
          "AIFACTORY-FEAT-080",
          "AIFACTORY-FEAT-081",
          "AIFACTORY-FEAT-101",
          "AIFACTORY-FEAT-141",
          "AIFACTORY-FEAT-007",
          "AIFACTORY-FEAT-055",
          "AIFACTORY-FEAT-056",
          "AIFACTORY-FEAT-057",
          "AIFACTORY-FEAT-058",
          "AIFACTORY-FEAT-063",
          "AIFACTORY-FEAT-067",
          "AIFACTORY-FEAT-068",
          "AIFACTORY-FEAT-069",
          "AIFACTORY-FEAT-070",
          "AIFACTORY-FEAT-071",
          "AIFACTORY-FEAT-102",
          "AIFACTORY-FEAT-117",
          "AIFACTORY-FEAT-118",
          "AIFACTORY-FEAT-119",
          "AIFACTORY-FEAT-120",
          "AIFACTORY-FEAT-121",
          "AIFACTORY-FEAT-148",
          "AIFACTORY-FEAT-142",
          "AIFACTORY-FEAT-023",
          "AIFACTORY-FEAT-024",
          "AIFACTORY-FEAT-025",
          "AIFACTORY-FEAT-026",
          "AIFACTORY-FEAT-027",
          "AIFACTORY-FEAT-031",
          "AIFACTORY-FEAT-035",
          "AIFACTORY-FEAT-036",
          "AIFACTORY-FEAT-037",
          "AIFACTORY-FEAT-103",
          "AIFACTORY-FEAT-122",
          "AIFACTORY-FEAT-123",
          "AIFACTORY-FEAT-124",
          "AIFACTORY-FEAT-149",
          "AIFACTORY-FEAT-143",
          "AIFACTORY-FEAT-086",
          "AIFACTORY-FEAT-087",
          "AIFACTORY-FEAT-125",
          "AIFACTORY-FEAT-126",
          "AIFACTORY-FEAT-127",
          "AIFACTORY-FEAT-128",
          "AIFACTORY-FEAT-129",
          "AIFACTORY-FEAT-130",
          "AIFACTORY-FEAT-131",
          "AIFACTORY-FEAT-132",
          "AIFACTORY-FEAT-133",
          "AIFACTORY-FEAT-135",
          "AIFACTORY-FEAT-136",
          "AIFACTORY-FEAT-150",
          "AIFACTORY-FEAT-151",
          "AIFACTORY-FEAT-144",
          "AIFACTORY-FEAT-009",
          "AIFACTORY-FEAT-051",
          "AIFACTORY-FEAT-052",
          "AIFACTORY-FEAT-053",
          "AIFACTORY-FEAT-054",
          "AIFACTORY-FEAT-145",
          "AIFACTORY-FEAT-010",
          "AIFACTORY-FEAT-016",
          "AIFACTORY-FEAT-038",
          "AIFACTORY-FEAT-039",
          "AIFACTORY-FEAT-040",
          "AIFACTORY-FEAT-146"
        ]
      }
    ],
    "stackRank": "feature ordinal x 100; children follow their feature; epics sit just before their first feature"
  },
  "scenarios": {
    "count": 880,
    "byKind": {
      "endpoint": 392,
      "event": 231,
      "route-class": 55,
      "step": 186,
      "outcome": 16
    },
    "traced": 631
  },
  "ratchet": {
    "coverageEnforced": [
      "agent-mesh",
      "component-extensions",
      "control-plane",
      "data-event",
      "devops-gitops",
      "engineering-readiness",
      "factory-assets",
      "factory-studio",
      "fleet-operations",
      "generated-saas",
      "governance",
      "integration",
      "knowledge",
      "marketplace",
      "model-compute",
      "observability",
      "outcome-verification",
      "runtime-cloud",
      "template-library",
      "tools-mcp"
    ],
    "pilotFeatures": [
      "agent-registry-service-complete",
      "agent-registry-service-publication",
      "agent-registry-service-thin",
      "agent-runtime-service",
      "agent-runtime-worker",
      "alert-rule-service",
      "approval-policy-service",
      "artifact-service",
      "audit-service-complete",
      "blueprint-service",
      "command-line-client",
      "command-line-client-commands",
      "component-agent-template",
      "component-agent-template-contract",
      "component-agent-template-factory-access",
      "component-agent-template-identity",
      "component-agent-template-release",
      "component-aiskills-library-template-skill-packages",
      "component-api-gateway-template",
      "component-api-library-template-factory-clients",
      "component-audit-factory-evidence",
      "component-auth-server-template-factory-tokens",
      "component-base-template-factory-profile",
      "component-base-template-findings",
      "component-base-template-product-profile",
      "component-blazor-mfe-library-template",
      "component-blazor-shell",
      "component-blazor-shell-template-studio",
      "component-compliance-factory-classifications",
      "component-documentation-template-factory-docs",
      "component-extensions-ai",
      "component-healthchecks-aggregator-engine-library",
      "component-healthchecks-aggregator-fleet-profile",
      "component-identity-template-factory-roles",
      "component-library-template-factory-profile",
      "component-mcp",
      "component-observability-factory-conventions",
      "component-platform-template-environment-stack",
      "component-saas-extensions",
      "component-saas-metering",
      "component-saas-metering-template",
      "component-saas-tenants",
      "component-saas-tenants-template",
      "component-uikit-factory-compositions",
      "component-worker-template-factory-profile",
      "component-workers-runtime-library",
      "connector-registry-service-deliveries",
      "connector-registry-service-thin",
      "context-builder-service-thin",
      "contracts-package",
      "control-plane-api",
      "cost-usage-service-complete",
      "dashboard-service",
      "data-event-foundations",
      "delivery-host",
      "durable-execution-spike",
      "envelope-registry-service",
      "environment-promotion-service",
      "environment-service",
      "execution-capacity-service-complete",
      "execution-capacity-service-thin",
      "feedback-service",
      "generation-recipe-service",
      "governance-host",
      "ia-cprovisioning-service",
      "integration-host",
      "integration-service-thin",
      "knowledge-host",
      "knowledge-ingestion-service-thin",
      "local-development-environment",
      "mcp-server-registry-service-thin",
      "model-gateway-host",
      "model-router-service",
      "observability-host",
      "owner-decisions",
      "pipeline-execution-service-complete",
      "pipeline-execution-service-thin",
      "policy-engine-service",
      "project-service",
      "quality-score-service-complete",
      "quality-score-service-thin",
      "release-service",
      "repository-and-pipeline-conventions",
      "repository-intelligence-service-thin",
      "retention-residency-service",
      "run-control-service",
      "runtime-cloud-host",
      "runtime-environment-service",
      "secret-broker-service",
      "slo-service",
      "store-profile-service",
      "studio-assets",
      "studio-bff",
      "studio-governance-administration",
      "studio-intelligence",
      "studio-notification-service",
      "studio-operations-usage",
      "studio-quality-releases",
      "studio-realtime-gateway",
      "studio-software-factory",
      "studio-workspace",
      "template-catalog-host",
      "template-registry-service",
      "tool-adapter-service",
      "tool-executor-host",
      "trusted-scope-chain",
      "typed-gateway-clients",
      "vector-memory-service-thin",
      "verify-deliver-it",
      "verify-generate-a-microservice",
      "verify-readiness",
      "verify-studio",
      "verify-trust-and-accountability",
      "wf-application-design",
      "wf-architecture-decomposition",
      "wf-behaviour-simulation",
      "wf-compliance-check",
      "wf-database-blueprint",
      "wf-debt-review",
      "wf-delivery-run",
      "wf-generate-product",
      "wf-infrastructure-plan",
      "wf-module-blueprints",
      "wf-observability-blueprint",
      "wf-pipeline-blueprint",
      "wf-plan-run",
      "wf-preview-environment",
      "wf-project-bootstrap",
      "wf-release",
      "wf-security-blueprint",
      "wf-test-plan",
      "wf-vision-to-blueprint",
      "workflow-engine-service"
    ],
    "final": true,
    "exemptions": [
      {
        "id": "SCN-McpServerRegistryService-002",
        "reason": "RegisterMcpServer is outside the thin scope (a static registry without MCP servers; no operation writes a server). Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-McpServerRegistryService-003",
        "reason": "DiscoverMcpCapabilities needs a registered server, the handshake and the CapabilityDiscovery worker, none of which the thin scope holds. Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-McpServerRegistryService-004",
        "reason": "ActivateMcpServer is a publication action on a registered server; the thin scope has no server and no write path. Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-McpServerRegistryService-005",
        "reason": "GetMcpCapabilities addresses a server by its id; the thin scope hosts only the three reads that address no server. Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-McpServerRegistryService-006",
        "reason": "RetireMcpServer is a publication action on a registered server; outside the thin scope. Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-McpServerRegistryService-009",
        "reason": "McpServerRegistered is written by registration, which the thin delivery does not have; its messaging profile declares no published event. Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-McpServerRegistryService-010",
        "reason": "McpServerStateChanged needs a state change of a server; the static registry has none. Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-McpServerRegistryService-011",
        "reason": "McpCapabilitiesDiscovered is written by discovery, which arrives with the complete registry. Completed by feature mcp-server-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-RepositoryIntelligenceService-001",
        "reason": "REST operation ListRepositoryIndexSets reads index sets; the thin delivery builds no index set and hosts no REST operation. Served by feature repository-intelligence-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-RepositoryIntelligenceService-002",
        "reason": "REST operation RebuildRepositoryIndexes rebuilds an index set from a snapshot; the thin delivery has no index and no snapshot. Served by feature repository-intelligence-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-RepositoryIntelligenceService-010",
        "reason": "Event RepositoryIndexed announces a Ready index set of the aggregate RepositoryIndexSet, which the thin delivery does not deliver; it publishes no event. Served by feature repository-intelligence-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-RepositoryIntelligenceService-011",
        "reason": "Event RepositoryIndexFailed announces a failed index build; the thin delivery builds no index and publishes no event. Served by feature repository-intelligence-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-001",
        "reason": "REST operation Search is the public hybrid retrieval; the thin delivery hosts no REST operation and no index exists. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-002",
        "reason": "REST operation QueryGraph is the public federated graph query; the thin delivery hosts no REST operation and holds no graph fact. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-003",
        "reason": "REST operation ListIndexRevisions reads the aggregate IndexRevision, which the thin delivery does not deliver. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-004",
        "reason": "REST operation RebuildIndexes rebuilds indexes from published snapshots; the thin delivery has no index and binds no vector backend. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-007",
        "reason": "Event IndexRevisionReady belongs to the aggregate IndexRevision; the thin delivery publishes no event. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-008",
        "reason": "Event IndexRevisionRetired belongs to the aggregate IndexRevision; the thin delivery publishes no event. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-009",
        "reason": "Event IndexDegraded needs a vector backend and its health probe; the thin delivery binds no backend. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-010",
        "reason": "Event GraphFactsUpdated belongs to the aggregate GraphFact and the worker GraphExtractor; the thin delivery holds no fact. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-VectorMemoryService-011",
        "reason": "Event RetrievalExecuted belongs to the aggregate RetrievalQuery; the thin delivery records no query and writes no outbox record, because its scope names the empty answer and nothing else. Served by feature vector-memory-service-complete (I5).",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ContextBuilderService-001",
        "reason": "ListContextSnapshots is not hosted by the thin delivery, which records no ContextSnapshot; it belongs to feature context-builder-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ContextBuilderService-002",
        "reason": "GetContextSnapshot is not hosted by the thin delivery, which records no snapshot, budget or provenance; it belongs to feature context-builder-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ContextBuilderService-004",
        "reason": "ContextAssembled is not published by the thin delivery, which records no ContextSnapshot and declares no published event; it belongs to feature context-builder-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-001",
        "reason": "RegisterSource is not hosted by the thin delivery, which registers no source; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-002",
        "reason": "ListSources is not hosted by the thin delivery, which holds no source; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-003",
        "reason": "SyncSource is not hosted by the thin delivery, which takes no snapshot; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-004",
        "reason": "DeleteSource is not hosted by the thin delivery, which holds no source to delete; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-005",
        "reason": "GetSnapshot is not hosted by the thin delivery, which has no pipeline and no snapshot; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-006",
        "reason": "SetCollection is not hosted by the thin delivery, which defines no collection; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-008",
        "reason": "SourceRegistered is not published by the thin delivery, which registers no source and declares no published event; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-009",
        "reason": "SourceStateChanged is not published by the thin delivery, which holds no source; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-010",
        "reason": "SourceDeleted is not published by the thin delivery, which deletes no source; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-011",
        "reason": "SourceSnapshotTaken is not published by the thin delivery, which takes no snapshot; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-012",
        "reason": "ChunksPublished is not published by the thin delivery, which ingests and embeds nothing; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-KnowledgeIngestionService-013",
        "reason": "SnapshotFailed is not published by the thin delivery, which has no pipeline stage that could fail; it belongs to feature knowledge-ingestion-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ConnectorRegistryService-005",
        "reason": "ReplayDelivery needs inbound deliveries, which the thin scope does not hold; delivered by feature connector-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ConnectorRegistryService-006",
        "reason": "Connectors.Deliver serves external-class tools and the first-outcome chain calls none (propose-change-set is shared-write); delivered by feature connector-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ConnectorRegistryService-009",
        "reason": "ConnectorDeprecated has no operation in the model and no use in the thin scope; delivered by feature connector-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ConnectorRegistryService-012",
        "reason": "DeliveryDispatched belongs to the Delivery aggregate; delivered by feature connector-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ConnectorRegistryService-013",
        "reason": "DeliveryFailed belongs to the Delivery aggregate; delivered by feature connector-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-ConnectorRegistryService-014",
        "reason": "DeliveryReplayed belongs to ReplayDelivery and the Delivery aggregate; delivered by feature connector-registry-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-IntegrationService-005",
        "reason": "RotateCredential is not needed for one Azure DevOps connection per project in the first outcome; delivered by feature integration-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-IntegrationService-006",
        "reason": "RevokeConnection and the Revoked state are outside the thin scope; until then a revoked secret reference is refused by the Secret Broker (fail closed); delivered by feature integration-service-complete in I5.",
        "completes_in": "I5"
      },
      {
        "id": "SCN-IntegrationService-011",
        "reason": "CredentialRotated is published by RotateCredential; delivered by feature integration-service-complete in I5.",
        "completes_in": "I5"
      }
    ]
  },
  "items": [
    {
      "id": "AIFACTORY-EPIC-001",
      "type": "epic",
      "parent": null,
      "title": "Control Plane (PF-01)",
      "sequence": "01",
      "description": "Everything that builds the Control Plane platform (PF-01): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Projects and scope, asset publication, run control and approvals, usage accounting, Factory tenancy and commerce. Done when: Every service of the platform has its complete delivery accepted (AgentCardService, AgentRegistryService, ControlPlaneApi, CostUsageService, EnvironmentService, FactoryCommercialService and 2 more), the platform gateway routes them under a trusted scope, and the outcome verification of I8 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (AgentCardService, AgentRegistryService, ControlPlaneApi, CostUsageService, EnvironmentService, FactoryCommercialService and 2 more), the platform gateway routes them under a trusted scope, and the outcome verification of I8 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-001",
        "AIFACTORY-FEAT-002",
        "AIFACTORY-FEAT-004",
        "AIFACTORY-FEAT-005",
        "AIFACTORY-FEAT-006",
        "AIFACTORY-FEAT-008",
        "AIFACTORY-FEAT-189",
        "AIFACTORY-FEAT-007",
        "AIFACTORY-FEAT-009",
        "AIFACTORY-FEAT-010"
      ],
      "stackRank": 5099,
      "titlePrefix": "[AIFACTORY-EPIC-001]",
      "number": 1
    },
    {
      "id": "AIFACTORY-FEAT-001",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "AgentRegistryService: thin delivery for the first outcome",
      "sequence": "01.01",
      "description": "AgentRegistryService is the service of bounded context BC-04 (Asset Publication). Publishes immutable releases of agents, skills, tools, workflows, policies and model profiles with their full dependency closure, hashes and evaluation evidence; serves release resolution to Run Control and release loading to the runtime (BC-04). In this increment it is delivered thin: Loads the seeded Draft releases of the six chain definitions and their nine agents by alias; no publication gate and no evaluation evidence. Its own repository is ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Delivers: AgentRegistryService (thin: Loads the seeded Draft releases of the six chain definitions and their nine agents by alias; no publication gate and no evaluation evidence.). Increment I1: Generate a microservice. Build order 51 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-053",
        "AIFACTORY-US-401",
        "AIFACTORY-US-402",
        "AIFACTORY-US-403"
      ],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5100,
      "titlePrefix": "[AIFACTORY-FEAT-001]",
      "number": 1
    },
    {
      "id": "AIFACTORY-US-053",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-001",
      "title": "AgentRegistryService answers the chain with its thin contract",
      "sequence": "01.01.01",
      "description": "As a platform admin, I want AgentRegistryService to answer the calls of the first-outcome chain with a well-formed result of its thin scope, so that the Asset Publication context has one owner that the rest of the Factory calls through its contract. This is the integration PBI of the thin delivery. The first outcome runs six workflow definitions (`vision-to-blueprint`, `architecture-decomposition`, `module-blueprints`, `application-design`, `database-blueprint` and `generate-product`) and the nine agents their steps name, on model profiles of model/model-profiles.yaml, and none of these definitions, agents and profiles is Published yet: the evaluation gate of ADR-0021 is built in the fourth increment, and until then the amendment of that decision lets a Draft workflow or agent release run only in the acceptance environment and in the projects a platform policy rule names as internal. The Draft allowance covers the model profile releases as well: the thin delivery seeds all eleven model profiles of model/model-profiles.yaml (`code-fast`, `code-agent`, `code-agent-strong`, `reasoning`, `reasoning-high`, `structured`, `vision`, `long-context`, `embedding`, `reranker` and `pii-local`) as Draft releases that are loadable by alias, and not only the five that the nine agents name (D123), and the approval of a model profile release by a Platform admin who is not its author becomes required with the complete delivery in I4 (D121). AgentRegistryService is therefore delivered thin, and the thin scope is exactly this: the service registers the seeded Draft releases of those six definitions, nine agents and eleven model profiles with their aliases and stores the authoring document of each in ArtifactService under a content reference the loaded release names (AIFACTORY-US-401, D121, D123), resolves an alias or a release id to one of them for RunControlService at submission (AIFACTORY-US-402) and streams the manifest and the closure content references of one of them to the runtime (AIFACTORY-US-403). Nothing else is served. The publication path arrives with feature `agent-registry-service-publication` in I2 (D140): the REST operations `ValidateRelease`, `SubmitRelease`, `PublishRelease`, `GetRelease`, `ListReleases` and `MoveAlias`, the events `AssetReleaseSubmitted` and `AssetReleasePublished`, the `ClosureResolver` worker, the publication approval and its handler `PublishOnApproval` of `ApprovalDecided`. `DeprecateRelease` and `RevokeRelease` with their events, the evaluation evidence and its gate, the learning release and the other consumed events arrive with feature `agent-registry-service-complete` in I4. The registry applies no waiver of its own, because the rule of the amendment is a policy rule and is evaluated where policy is evaluated. The repository ConnectSoft.AI.SoftwareFactory.AgentRegistryService is created and scaffolded in I0 by AIFACTORY-TASK-001 of feature repository-and-pipeline-conventions (D140) from the pinned base template package with `UseFactoryProfile`, and this feature starts from that scaffold, so token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again. The model names `release-manifest-v1` as the request and as the reply descriptor of both methods. docs/reference/schemas/release-manifest.schema.json describes a published release: it requires `publishedAt` and `publishedBy`, which a Draft release does not have, allows no additional property and has no shape for a request by alias or by release id. That conflict is an open point reported to the owner, and the thin delivery makes its contract checkable without deciding it. The proto request message of `ResolveRelease` names the asset kind, the asset id and the alias name, or the `releaseId`, and that of `LoadRelease` names the `releaseId`. The reply message carries the manifest, and the contract test compares, for a Draft release, the fields `releaseId`, `assetKind`, `assetId`, `version`, `state`, `closure` and `hash` with the schema and asserts that `publishedAt`, `publishedBy`, `evaluation` and `approval` are absent in state Draft. The reply names the hash `hash`, as the schema does; `manifestHash` is the name of the same value on the aggregate and in the table. The complete delivery fills the publication fields of the same reply message for a Published release, so it replaces the thin delivery without a change of the two messages. A caller without a workload identity is refused before any handler runs. Kind: behavior. Traces: services: AgentRegistryService; apis: AgentRegistryService/AssetPublication.ResolveRelease, AgentRegistryService/AssetPublication.LoadRelease; descriptors: release-manifest-v1; adrs: ADR-0015, ADR-0021, ADR-0028. Depends on: AIFACTORY-US-401, AIFACTORY-US-402, AIFACTORY-US-403, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-extensions-ai. Sources: model/services/control-plane/AgentRegistryService.yaml, model/backlog/features/control-plane.yaml, docs/architecture/adr/0021-quality-gates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.AgentRegistryService created and scaffolded in I0 by AIFACTORY-TASK-001 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AgentRegistryService --UseFactoryProfile true` from the pinned template package, when its pipeline runs, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/control-plane/AgentRegistryService.yaml).",
        "AC2: Given the seeded Draft releases of the six chain definitions, their nine agents and the eleven model profiles (D121, D123), when each alias is resolved through `AgentRegistryService/AssetPublication.ResolveRelease` and each release is loaded through `AgentRegistryService/AssetPublication.LoadRelease`, then all twenty-six answer with the reply message fixed by the contract test, whose fields `releaseId`, `assetKind`, `assetId`, `version`, `state` Draft, `closure` and `hash` match `release-manifest-v1` and whose `publishedAt`, `publishedBy`, `evaluation` and `approval` are absent, as AIFACTORY-US-402 and AIFACTORY-US-403 prove one by one (ADR-0021).",
        "AC3: Given the service descriptor of the thin delivery, when the contract test compares it with the hosted surface, then exactly `AgentRegistryService/AssetPublication.ResolveRelease` and `AgentRegistryService/AssetPublication.LoadRelease` are hosted, no REST operation of publication answers, the `OrleansMessaging` section declares no published event, and the test fails when an operation outside the thin scope stated in model/backlog/features/control-plane.yaml appears.",
        "AC4: Given a call without a workload identity or with a token that lacks the service scope, when it reaches either method, then it is refused before any handler runs and nothing is read (ADR-0015); given the service starts, when liveness and readiness are probed, then liveness answers and readiness is unready until `agent-registry-sql` is migrated, the identity authority is reachable and every seed entry is registered, so a failed seed loader never serves an empty registry that would answer NOT_FOUND to a caller (model/services/control-plane/AgentRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/backlog/features/control-plane.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-003",
        "AIFACTORY-TASK-697"
      ],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5101,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "apis": [
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "AgentRegistryService/AssetPublication.LoadRelease"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-401",
        "AIFACTORY-US-402",
        "AIFACTORY-US-403",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/backlog/features/control-plane.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-053]",
      "number": 53
    },
    {
      "id": "AIFACTORY-TASK-003",
      "type": "task",
      "parent": "AIFACTORY-US-053",
      "title": "Contract of the thin surface: service descriptor and proto of ResolveRelease and LoadRelease against release-manifest-v1",
      "sequence": "01.01.01.01",
      "description": "Contract of the thin surface: service descriptor and proto of ResolveRelease and LoadRelease against release-manifest-v1. Expected output: The service descriptor file of the repository lists exactly AssetPublication.ResolveRelease (no streaming) and AssetPublication.LoadRelease (server streaming), both internal and of class read. The proto fixes the request message of ResolveRelease (asset kind, asset id and alias name, or releaseId), the request message of LoadRelease (releaseId) and the reply message with the manifest; the manifest message of the LoadRelease stream names, beside the manifest fields, the content reference and the hash of the authoring document of the release (D121). A contract test with golden files compares, for a Draft release, the fields releaseId, assetKind, assetId, version, state, closure and hash of the reply with docs/reference/schemas/release-manifest.schema.json and asserts that publishedAt, publishedBy, evaluation and approval are absent in state Draft; it does not validate a Draft reply against the whole schema, which requires the publication fields, and that difference is the open point the PBI reports. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake and the complete delivery adds operations and fills the publication fields without changing the two request messages or the reply message.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file of the repository lists exactly AssetPublication.ResolveRelease (no streaming) and AssetPublication.LoadRelease (server streaming), both internal and of class read. The proto fixes the request message of ResolveRelease (asset kind, asset id and alias name, or releaseId), the request message of LoadRelease (releaseId) and the reply message with the manifest; the manifest message of the LoadRelease stream names, beside the manifest fields, the content reference and the hash of the authoring document of the release (D121). A contract test with golden files compares, for a Draft release, the fields releaseId, assetKind, assetId, version, state, closure and hash of the reply with docs/reference/schemas/release-manifest.schema.json and asserts that publishedAt, publishedBy, evaluation and approval are absent in state Draft; it does not validate a Draft reply against the whole schema, which requires the publication fields, and that difference is the open point the PBI reports. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake and the complete delivery adds operations and fills the publication fields without changing the two request messages or the reply message."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5101,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-003]",
      "number": 3
    },
    {
      "id": "AIFACTORY-TASK-697",
      "type": "task",
      "parent": "AIFACTORY-US-053",
      "title": "Verify agent-registry-service-thin-contract by running the declared command",
      "sequence": "01.01.01.02",
      "description": "Verify agent-registry-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-053, that is the scaffold, the twenty-six seeded releases answered by both methods (SCN-AgentRegistryService-008, SCN-AgentRegistryService-009), the thin surface, the golden files of the request and reply messages, readiness that stays unready until the seed is registered and the refusal of a caller without workload identity.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-053, that is the scaffold, the twenty-six seeded releases answered by both methods (SCN-AgentRegistryService-008, SCN-AgentRegistryService-009), the thin surface, the golden files of the request and reply messages, readiness that stays unready until the seed is registered and the refusal of a caller without workload identity."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-697]",
      "number": 697
    },
    {
      "id": "AIFACTORY-US-401",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-001",
      "title": "Register the seeded Draft releases of the six chain definitions, their nine agents and the eleven model profiles with their aliases and their authoring documents",
      "sequence": "01.01.02",
      "description": "As a platform admin, I want the Draft releases of the first-outcome chain registered in the registry store when the service starts, so that a run can pin an exact release of every definition and agent before the publication gate exists. Before the publication gate exists, the releases the first outcome runs are registered by a seed and not through `SubmitRelease` and `PublishRelease`. The seed set holds one manifest for each of the six workflow definitions of the chain (`vision-to-blueprint`, `architecture-decomposition`, `module-blueprints`, `application-design`, `database-blueprint`, `generate-product`) and for each of the nine agents their steps name (`vision-architect`, `enterprise-architect`, `domain-modeler`, `solution-architect`, `application-architect`, `database-engineer`, `microservice-generator`, `backend-developer`, `frontend-developer`). The owner decided that the thin registry seeds the model profiles as well (D121), and that it seeds all eleven profiles of model/model-profiles.yaml and not only the five that those agents name (D123), so the seed set also holds one manifest for each of `code-fast`, `code-agent`, `code-agent-strong`, `reasoning`, `reasoning-high`, `structured`, `vision`, `long-context`, `embedding`, `reranker` and `pii-local`, each of the asset kind ModelProfile, which makes twenty-six entries. ModelRouterService loads all eleven through the two read methods of this feature (D123). The Draft allowance covers these model profile releases, they are loadable by alias like the others, and the approval of a model profile release by a Platform admin who is not its author becomes required with the complete delivery in I4. The features of the definitions and of the agents author their Draft releases, in the repositories ConnectSoft.AI.SoftwareFactory.WorkflowEngineService and ConnectSoft.AI.SoftwareFactory.AgentTemplate, and feature `model-router-service` authors the eleven `model-profile-v1` documents and their seed entries; this PBI registers them. The loader reads the seed set from one configured location, the directory named by the configuration key `Publication:Seed:Path` of the thin delivery, a key the model does not list and that is removed with the loader by feature `agent-registry-service-complete`. The directory holds one JSON file per seed entry with two members: `manifest`, the Draft manifest with `releaseId`, `assetKind`, `assetId`, `version`, `state` Draft, `source` with repository, commit and path, `closure` and `hash`, and `alias`, the alias name the entry registers. Beside each entry file the directory holds the authoring document of that entry, which is the workflow definition, the agent definition or the `model-profile-v1` document its feature authored, under the file name that the last segment of `source.path` of the manifest gives. The decision does not say how the loader finds the authoring document of an entry, so that file name rule is what this PBI fixes, and it is reported to the owner. How the twenty-six authored manifests and their authoring documents reach that location (copied at build, packaged, or mounted at deployment) is an open point reported to the owner: the features that author them depend on this feature, so this PBI cannot depend on them without a cycle. Until it is decided, the acceptance suite proves the loader on the fixture set of AIFACTORY-TASK-1652, which has the same file shape. The thin delivery creates the three tables of the model in `agent-registry-sql`, the store this service owns: `AssetReleases`, `ReleaseClosure` and `ReleaseAliases`, with the tenant column on every row and the tenant row filter of the Factory profile. When the service starts, the seed loader writes each release in state Draft with its `releaseId` in the content-addressed form of the model, its source repository and commit and its `manifestHash`, one `ReleaseClosure` row per dependency with exact version and hash, and one `ReleaseAliases` row for the alias the seed entry names. The table requires `SubmittedBy`, the subject that submitted a candidate (D117); no member submitted a seeded release, so the loader records the workload identity of the service there, and a later submission through `SubmitRelease` replaces it with the subject that submits. The manifest document is stored through ArtifactService, the authority of `artifact-blob`, and its reference is kept in `ManifestRef`. The authoring document of the entry is stored through ArtifactService too, by its content hash, and the loaded release names its content reference (D121): `LoadRelease` delivers the content reference and the hash of the authoring document with the manifest message of the release (AIFACTORY-US-403), so a caller fetches the document from ArtifactService and compares its hash before it uses it. Storing is idempotent on the content hash, so a restart stores no document twice. The model lists `ManifestRef` on `AssetReleases` and no field for the reference of the authoring document, so where the release keeps that reference between the seed and the load is reported to the owner; this PBI fixes only that every loaded seeded release names it. The releases belong to the platform tenant, which the model defines for ConnectSoft-published assets and which every tenant can read. The loader is idempotent: a release whose `releaseId` and `manifestHash` are already registered is left as it is. A seed entry whose `hash` does not match its manifest, whose closure entry lacks a version or a hash, or whose authoring document is missing from the seed location fails the loader with the entry named, and no partial release stays registered for that entry. When ArtifactService is unavailable the loader fails fast. In both cases readiness stays unready until every seed entry is registered, so the service never serves an empty or partial registry that would answer NOT_FOUND, which an attempt takes as failure class permanent. The loader is retried in the running process with backoff, without a restart, and every failed attempt is logged with the entry or the dependency named; liveness keeps answering meanwhile. No release leaves Draft, no evaluation record and no approval is attached, and no event is published. Kind: enabling. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; workflows: vision-to-blueprint, architecture-decomposition, module-blueprints, application-design, database-blueprint, generate-product; agents: vision-architect, enterprise-architect, domain-modeler, solution-architect, application-architect, database-engineer, microservice-generator, backend-developer, frontend-developer; descriptors: release-manifest-v1, model-profile-v1; adrs: ADR-0021, ADR-0028. Depends on: feature:component-base-template-factory-profile, feature:artifact-service. Sources: model/services/control-plane/AgentRegistryService.yaml, model/model-profiles.yaml, model/backlog/features/control-plane.yaml, docs/reference/schemas/release-manifest.schema.json, docs/planes/control/services/agent-registry-service/index.md#data-model-and-storage.",
      "acceptanceCriteria": [
        "AC1: Given an empty `agent-registry-sql` and the seed set of twenty-six entries in the seed location the loader is configured with, each in the file shape AIFACTORY-TASK-002 states, when the service starts, then `AssetReleases` holds twenty-six `AgentRegistryService/AssetRelease` rows in state Draft owned by the platform tenant, six of the asset kind Workflow, nine of the kind Agent and eleven of the kind ModelProfile (D121, D123), each with `releaseId`, `sourceCommit`, `manifestHash` and `ManifestRef`, `ReleaseClosure` holds one row per dependency with exact version and hash, and `ReleaseAliases` holds the alias each seed entry names (model/services/control-plane/AgentRegistryService.yaml).",
        "AC2: Given the seed already registered, when the service starts again or two replicas start together, then no row is duplicated or changed and a release whose `releaseId` and `manifestHash` are already registered is left as it is (model/services/control-plane/AgentRegistryService.yaml).",
        "AC3: Given a seed entry whose `hash` does not match its manifest, whose closure entry lacks a version or a hash or whose authoring document is missing from the seed location, or an unavailable ArtifactService, when the loader runs, then it fails with the entry or the dependency named, no partial release stays registered for that entry, readiness stays unready until every seed entry is registered, and the loader is retried in the running process with backoff, without a restart, so that readiness turns ready once the entry is corrected or ArtifactService answers again (docs/reference/schemas/release-manifest.schema.json).",
        "AC4: Given the registered seed, when the tables and the outbox are inspected, then no `AgentRegistryService/AssetRelease` is InReview, Published or Deprecated, no `EvaluationRecordRef` and no `ApprovalId` is set and the outbox holds no record, because the thin delivery has no publication gate and no evaluation evidence (ADR-0021, model/backlog/features/control-plane.yaml).",
        "AC5: Given the registered seed, when the content held by the fake of ArtifactService is inspected, then it holds the authoring document of each of the twenty-six entries, a workflow definition, an agent definition or a `model-profile-v1` document, under the content reference the registered release names, the content under that reference has the hash the release states for it, and a second start stores no document twice (D121, model/services/control-plane/AgentRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/model-profiles.yaml",
        "model/backlog/features/control-plane.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/control/services/agent-registry-service/index.md#data-model-and-storage"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1651",
        "AIFACTORY-TASK-002",
        "AIFACTORY-TASK-1652",
        "AIFACTORY-TASK-1653"
      ],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5102,
      "kind": "enabling",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "workflows": [
          "vision-to-blueprint",
          "architecture-decomposition",
          "module-blueprints",
          "application-design",
          "database-blueprint",
          "generate-product"
        ],
        "agents": [
          "vision-architect",
          "enterprise-architect",
          "domain-modeler",
          "solution-architect",
          "application-architect",
          "database-engineer",
          "microservice-generator",
          "backend-developer",
          "frontend-developer"
        ],
        "descriptors": [
          "release-manifest-v1",
          "model-profile-v1"
        ],
        "adrs": [
          "ADR-0021",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/model-profiles.yaml",
        "model/backlog/features/control-plane.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/control/services/agent-registry-service/index.md#data-model-and-storage"
      ],
      "titlePrefix": "[AIFACTORY-US-401]",
      "number": 401
    },
    {
      "id": "AIFACTORY-TASK-1651",
      "type": "task",
      "parent": "AIFACTORY-US-401",
      "title": "Migration and read mappings of AssetReleases, ReleaseClosure and ReleaseAliases in agent-registry-sql",
      "sequence": "01.01.02.01",
      "description": "Migration and read mappings of AssetReleases, ReleaseClosure and ReleaseAliases in agent-registry-sql. Expected output: The three tables of model/services/control-plane/AgentRegistryService.yaml exist with their columns, keys, the unique index on tenant, asset kind, asset and version and the state index; the mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one. The write paths of publication are added by feature agent-registry-service-complete on the same tables.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The three tables of model/services/control-plane/AgentRegistryService.yaml exist with their columns, keys, the unique index on tenant, asset kind, asset and version and the state index; the mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one. The write paths of publication are added by feature agent-registry-service-complete on the same tables."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5102,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1651]",
      "number": 1651
    },
    {
      "id": "AIFACTORY-TASK-002",
      "type": "task",
      "parent": "AIFACTORY-US-401",
      "title": "Seed loader of the thin scope: twenty-six Draft releases with closure rows, aliases, manifest references and authoring documents",
      "sequence": "01.01.02.02",
      "description": "Seed loader of the thin scope: twenty-six Draft releases with closure rows, aliases, manifest references and authoring documents. Expected output: At start the loader reads the seed set from the directory named by the configuration key Publication:Seed:Path, one JSON file per entry with the members manifest (the Draft manifest with releaseId, assetKind, assetId, version, state Draft, source with repository, commit and path, closure and hash) and alias (the alias name the entry registers), and beside it the authoring document of the entry under the file name the last segment of source.path gives; it registers the Draft releases of the six chain definitions, their nine agents and the eleven model profiles of model/model-profiles.yaml, which are code-fast, code-agent, code-agent-strong, reasoning, reasoning-high, structured, vision, long-context, embedding, reranker and pii-local, in the platform tenant (D121, D123), stores each manifest through ArtifactService and keeps the reference in ManifestRef, stores the authoring document of each entry through ArtifactService by its content hash and keeps its content reference and hash so that the loaded release names them, records the workload identity of the service in SubmittedBy, which the table requires and no member supplies for a seeded release (D117), writes one closure row per dependency and the alias each seed entry names, is idempotent on releaseId and manifestHash across restarts and concurrent replicas, and fails with the entry named when a hash does not match, a closure entry is incomplete or the authoring document is missing; a readiness check reports unready until every seed entry is registered, and a failed run is retried in the running process with backoff, without a restart; it moves no release out of Draft and writes no outbox record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "At start the loader reads the seed set from the directory named by the configuration key Publication:Seed:Path, one JSON file per entry with the members manifest (the Draft manifest with releaseId, assetKind, assetId, version, state Draft, source with repository, commit and path, closure and hash) and alias (the alias name the entry registers), and beside it the authoring document of the entry under the file name the last segment of source.path gives; it registers the Draft releases of the six chain definitions, their nine agents and the eleven model profiles of model/model-profiles.yaml, which are code-fast, code-agent, code-agent-strong, reasoning, reasoning-high, structured, vision, long-context, embedding, reranker and pii-local, in the platform tenant (D121, D123), stores each manifest through ArtifactService and keeps the reference in ManifestRef, stores the authoring document of each entry through ArtifactService by its content hash and keeps its content reference and hash so that the loaded release names them, records the workload identity of the service in SubmittedBy, which the table requires and no member supplies for a seeded release (D117), writes one closure row per dependency and the alias each seed entry names, is idempotent on releaseId and manifestHash across restarts and concurrent replicas, and fails with the entry named when a hash does not match, a closure entry is incomplete or the authoring document is missing; a readiness check reports unready until every seed entry is registered, and a failed run is retried in the running process with backoff, without a restart; it moves no release out of Draft and writes no outbox record."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-002]",
      "number": 2
    },
    {
      "id": "AIFACTORY-TASK-1652",
      "type": "task",
      "parent": "AIFACTORY-US-401",
      "title": "Seed set fixture of twenty-six manifests with their authoring documents and of the broken entries for the acceptance suite",
      "sequence": "01.01.02.03",
      "description": "Seed set fixture of twenty-six manifests with their authoring documents and of the broken entries for the acceptance suite. Expected output: The acceptance suite holds a seed directory in the file shape of AIFACTORY-TASK-002 with one entry per chain definition, agent and model profile, twenty-six in all, each with its authoring document beside it, whose manifests carry the fields releaseId, assetKind, assetId, version, state Draft, source, closure and hash of docs/reference/schemas/release-manifest.schema.json and none of its publication fields, an entry with a wrong hash, an entry with a closure row without a hash and an entry without its authoring document, and a fake of ArtifactService that keeps what was stored under which content reference and can be switched to unavailable and back.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a seed directory in the file shape of AIFACTORY-TASK-002 with one entry per chain definition, agent and model profile, twenty-six in all, each with its authoring document beside it, whose manifests carry the fields releaseId, assetKind, assetId, version, state Draft, source, closure and hash of docs/reference/schemas/release-manifest.schema.json and none of its publication fields, an entry with a wrong hash, an entry with a closure row without a hash and an entry without its authoring document, and a fake of ArtifactService that keeps what was stored under which content reference and can be switched to unavailable and back."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1652]",
      "number": 1652
    },
    {
      "id": "AIFACTORY-TASK-1653",
      "type": "task",
      "parent": "AIFACTORY-US-401",
      "title": "Verify the seed registration through the acceptance suite",
      "sequence": "01.01.02.04",
      "description": "Verify the seed registration through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SeededDraftReleases\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-401: twenty-six Draft releases, eleven of them model profile releases, with closure, alias and manifest reference read from the configured seed location, the idempotent restart, the refused broken entries, readiness that stays unready while the loader fails and turns ready after its retry succeeds without a restart, the empty outbox, and the authoring document of every entry held by the fake of ArtifactService under the content reference its release names, with the hash the release states.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SeededDraftReleases\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-401: twenty-six Draft releases, eleven of them model profile releases, with closure, alias and manifest reference read from the configured seed location, the idempotent restart, the refused broken entries, readiness that stays unready while the loader fails and turns ready after its retry succeeds without a restart, the empty outbox, and the authoring document of every entry held by the fake of ArtifactService under the content reference its release names, with the hash the release states."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1653]",
      "number": 1653
    },
    {
      "id": "AIFACTORY-US-402",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-001",
      "title": "Resolve an alias or a release id to one immutable seeded release for Run Control at submission",
      "sequence": "01.01.03",
      "description": "As a requester, I want the release alias of my submission resolved to one exact release with its closure, so that my run pins what it will execute and a later alias move cannot change it. RunControlService resolves the release a run will pin when it accepts a submission: `run-submission-v1` names a release alias or a release id, and the internal gRPC method `AgentRegistryService/AssetPublication.ResolveRelease` turns it into one immutable release with its closure. The caller presents a workload token. Such a token carries service scopes and no tenant claim, so the service reads the tenant and project the caller forwards only when the token holds the service scope that names AgentRegistryService (ADR-0015). In the thin delivery the method answers for the seeded Draft releases only. The Draft releases of the eleven model profiles are among them and are resolved by alias like the others, under the Draft allowance that covers model profile releases until the complete delivery (D121, D123); the profile loader of ModelRouterService resolves them with its workload token (feature `model-router-service`). An alias is looked up in `ReleaseAliases` by asset kind, asset id and name among the releases the tenant of the caller can read, which are its own and those of the platform tenant, and is resolved to the release it points at when the call is made; a release id is looked up directly. The request message names the asset kind, the asset id and the alias name, or the `releaseId`. The reply message carries the manifest fields `releaseId`, `assetKind`, `assetId`, `version`, `state` Draft, `closure` with every entry at its exact version and hash, and `hash`, which is the name `release-manifest-v1` gives the value the aggregate holds as `manifestHash`; `publishedAt`, `publishedBy`, `evaluation` and `approval` are absent in state Draft, as the open point of AIFACTORY-US-053 records. The caller therefore pins the release id and never the alias. The reply states the state as it is and the registry applies no waiver: whether a Draft release may run is decided by the policy rule of the ADR-0021 amendment when policy is evaluated for the submission. The method is of class read and writes nothing. A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, a request that names neither an alias nor a release id with INVALID_ARGUMENT, and an alias or release that the tenant of the caller cannot read with NOT_FOUND, which is also the answer for a release of another tenant and never confirms that it exists. When `agent-registry-sql` is unavailable the call fails with UNAVAILABLE; the dependency is fail-fast for RunControlService, which then accepts no run. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/AssetPublication.ResolveRelease; descriptors: release-manifest-v1; adrs: ADR-0015, ADR-0021; requirements: FR-02; scenarios: SCN-AgentRegistryService-008. Depends on: AIFACTORY-US-401, feature:component-base-template-factory-profile. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/release-manifest.schema.json, docs/planes/control/services/agent-registry-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given the seeded Draft release of a chain definition and its alias, when RunControlService calls `AgentRegistryService/AssetPublication.ResolveRelease` with the asset kind, the asset id and the alias name under a workload token that holds the service scope, then the reply message carries exactly one release with the fields `releaseId`, `assetKind`, `assetId`, `version`, `state` Draft, `hash` and every `closure` entry with exact version and hash of `release-manifest-v1`, without `publishedAt`, `publishedBy`, `evaluation` and `approval`, the same reply is given for a request by `releaseId`, and nothing is written (SCN-AgentRegistryService-008).",
        "AC2: Given each of the twenty-six seeded releases, the eleven model profile releases among them (D121, D123), when its alias is resolved twice, then both replies name the same `releaseId` and the same `hash`, because no operation of the thin delivery moves an alias or changes a release (SCN-AgentRegistryService-008, model/backlog/features/control-plane.yaml).",
        "AC3: Given a caller without a workload identity, a token without the service scope, a request that names neither an alias nor a release id, or an alias or release id the tenant of the caller cannot read, when `AgentRegistryService/AssetPublication.ResolveRelease` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, a release of another tenant is answered NOT_FOUND exactly as an unknown one, and no state changes (SCN-AgentRegistryService-008, ADR-0015).",
        "AC4: Given `agent-registry-sql` is unavailable, when `AgentRegistryService/AssetPublication.ResolveRelease` is called, then the call fails with UNAVAILABLE and no partial manifest is returned, so the caller, for which the dependency is fail-fast, accepts no run on an unresolved release (SCN-AgentRegistryService-008, model/services/control-plane/RunControlService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/control/services/agent-registry-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1654",
        "AIFACTORY-TASK-1655"
      ],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5103,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/AssetPublication.ResolveRelease"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-401",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/control/services/agent-registry-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-402]",
      "number": 402
    },
    {
      "id": "AIFACTORY-TASK-1654",
      "type": "task",
      "parent": "AIFACTORY-US-402",
      "title": "ResolveRelease over the seeded releases with workload scope checks and the tenant row filter",
      "sequence": "01.01.03.01",
      "description": "ResolveRelease over the seeded releases with workload scope checks and the tenant row filter. Expected output: AssetPublication.ResolveRelease takes the request message of AIFACTORY-TASK-003 (asset kind, asset id and alias name, or releaseId), resolves it among the releases the forwarded tenant can read and returns the reply message with releaseId, assetKind, assetId, version, state, hash and the closure entries, without the publication fields for a Draft release; it reads the forwarded tenant and project only under the service scope, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND (also for a release of another tenant, ADR-0015) and UNAVAILABLE as the PBI states, and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "AssetPublication.ResolveRelease takes the request message of AIFACTORY-TASK-003 (asset kind, asset id and alias name, or releaseId), resolves it among the releases the forwarded tenant can read and returns the reply message with releaseId, assetKind, assetId, version, state, hash and the closure entries, without the publication fields for a Draft release; it reads the forwarded tenant and project only under the service scope, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND (also for a release of another tenant, ADR-0015) and UNAVAILABLE as the PBI states, and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1654]",
      "number": 1654
    },
    {
      "id": "AIFACTORY-TASK-1655",
      "type": "task",
      "parent": "AIFACTORY-US-402",
      "title": "Verify resolve-a-seeded-release-for-run-control through the acceptance suite",
      "sequence": "01.01.03.02",
      "description": "Verify resolve-a-seeded-release-for-run-control through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-402 over the twenty-six seeded releases, the two-tenant fixture and a stopped store.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-402 over the twenty-six seeded releases, the two-tenant fixture and a stopped store."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1655]",
      "number": 1655
    },
    {
      "id": "AIFACTORY-US-403",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-001",
      "title": "Stream the manifest and the closure content references of a seeded release to the runtime",
      "sequence": "01.01.04",
      "description": "As a requester, I want the runtime to load exactly the release my run pinned, so that every step of the run executes the definition and the agents that were resolved at submission. The runtime of the Agent Mesh loads a release by its id: WorkflowEngineService loads the release of a workflow definition and its closure, and AgentRuntimeService loads the release of an agent when an attempt starts. The profile loader of ModelRouterService loads the release of a model profile the same way (D121). Each caller calls the internal gRPC method `AgentRegistryService/AssetPublication.LoadRelease` with a workload token; the service reads the tenant and project the caller forwards only when the token holds the service scope that names AgentRegistryService (ADR-0015). The method is a server stream. The request message names the `releaseId`. The first message is the manifest of the release with the fields `releaseId`, `assetKind`, `assetId`, `version`, `state` and `hash` of `release-manifest-v1`, without the publication fields a Draft release does not have (the open point of AIFACTORY-US-053). Beside those fields the manifest message names the content reference and the hash of the authoring document of the release, which is the workflow definition, the agent definition or the model profile document that the seed loader stored through ArtifactService (AIFACTORY-US-401, D121), so the loaded release names where its own document is held. Then one message follows per closure entry with the kind, the asset id, the exact version, the hash and the content reference of that dependency, in the order of the manifest; the stream then completes. The content itself is never streamed by the registry: a reference names content held by ArtifactService, and the caller fetches it there. In the thin delivery the method serves the seeded Draft releases only and the manifest states `state` Draft. The method is of class read and writes nothing; loading the same release twice yields the same messages. A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, a request without a release id with INVALID_ARGUMENT, and a release id the tenant of the caller cannot read with NOT_FOUND, which is also the answer for a release of another tenant; an attempt that receives NOT_FOUND takes the failure class permanent. When the store becomes unavailable the stream ends with UNAVAILABLE and the caller, for which the dependency is fail-fast, discards what it received and loads again; a release is used only after its stream completed. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/AssetPublication.LoadRelease, AgentRegistryService/AssetPublication.ResolveRelease; descriptors: release-manifest-v1; adrs: ADR-0015; requirements: FR-02; scenarios: SCN-AgentRegistryService-009. Depends on: AIFACTORY-US-401, feature:component-base-template-factory-profile. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, docs/reference/schemas/release-manifest.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a seeded Draft release of an agent, when the runtime calls `AgentRegistryService/AssetPublication.LoadRelease` with its `releaseId` under a workload token that holds the service scope, then the stream delivers the manifest message with the fields `releaseId`, `assetKind`, `assetId`, `version`, `state` Draft and `hash` of `release-manifest-v1`, without `publishedAt`, `publishedBy`, `evaluation` and `approval`, and with the content reference and the hash of the authoring document of the release (D121), then one message per closure entry with exact version, hash and content reference in manifest order, and completes without writing anything (SCN-AgentRegistryService-009).",
        "AC2: Given the release of each of the six chain definitions, the nine agents and the eleven model profiles, when it is loaded twice, then both streams deliver the same messages, the `hash` of the streamed manifest equals the `hash` that `AgentRegistryService/AssetPublication.ResolveRelease` returned for the same release, and the content the fake of ArtifactService holds under the content reference the manifest message names is the authoring document of that release with the hash the message states (SCN-AgentRegistryService-009, D121).",
        "AC3: Given a caller without a workload identity, a token without the service scope, a request without a release id, or a release id the tenant of the caller cannot read, when `AgentRegistryService/AssetPublication.LoadRelease` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, a release of another tenant is answered NOT_FOUND exactly as an unknown one, and no message is streamed (SCN-AgentRegistryService-009, ADR-0015).",
        "AC4: Given the store becomes unavailable after the manifest was streamed, when the stream continues, then it ends with UNAVAILABLE without a completion, and a repeated call after recovery delivers the whole release from the manifest on (SCN-AgentRegistryService-009, model/services/control-plane/AgentRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1656",
        "AIFACTORY-TASK-1657"
      ],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5104,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/AssetPublication.LoadRelease",
          "AgentRegistryService/AssetPublication.ResolveRelease"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-009"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-401",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-403]",
      "number": 403
    },
    {
      "id": "AIFACTORY-TASK-1656",
      "type": "task",
      "parent": "AIFACTORY-US-403",
      "title": "LoadRelease server stream of the manifest and the closure content references",
      "sequence": "01.01.04.01",
      "description": "LoadRelease server stream of the manifest and the closure content references. Expected output: AssetPublication.LoadRelease takes the request message of AIFACTORY-TASK-003 (releaseId), streams the manifest message with releaseId, assetKind, assetId, version, state and hash, without the publication fields for a Draft release and with the content reference and the hash of the authoring document of the release that the seed loader stored through ArtifactService (D121), and then one message per closure entry with version, hash and content reference in manifest order, completes the stream, reads the forwarded tenant and project only under the service scope, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND (also for a release of another tenant, ADR-0015) before the first message and ends with UNAVAILABLE when the store fails during the stream.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "AssetPublication.LoadRelease takes the request message of AIFACTORY-TASK-003 (releaseId), streams the manifest message with releaseId, assetKind, assetId, version, state and hash, without the publication fields for a Draft release and with the content reference and the hash of the authoring document of the release that the seed loader stored through ArtifactService (D121), and then one message per closure entry with version, hash and content reference in manifest order, completes the stream, reads the forwarded tenant and project only under the service scope, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND (also for a release of another tenant, ADR-0015) before the first message and ends with UNAVAILABLE when the store fails during the stream."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1656]",
      "number": 1656
    },
    {
      "id": "AIFACTORY-TASK-1657",
      "type": "task",
      "parent": "AIFACTORY-US-403",
      "title": "Verify load-a-seeded-release-for-the-runtime through the acceptance suite",
      "sequence": "01.01.04.02",
      "description": "Verify load-a-seeded-release-for-the-runtime through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-403 over the twenty-six seeded releases, the authoring document each of them names in the fake of ArtifactService, the two-tenant fixture and a store stopped during the stream.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-403 over the twenty-six seeded releases, the authoring document each of them names in the fake of ArtifactService, the two-tenant fixture and a store stopped during the stream."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 51,
      "phase": "factory",
      "stackRank": 5104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1657]",
      "number": 1657
    },
    {
      "id": "AIFACTORY-FEAT-002",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "ControlPlaneApi: gateway delivery",
      "sequence": "01.02",
      "description": "ControlPlaneApi is the platform API gateway of bounded context BC-01 (Project & Environment). The API gateway of the Control Plane platform (ADR-0028): routes public REST and internal gRPC calls to the 7 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.ControlPlaneApi. Delivers: ControlPlaneApi (complete). Increment I1: Generate a microservice. Build order 52 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-054",
        "AIFACTORY-US-404",
        "AIFACTORY-US-405",
        "AIFACTORY-US-406",
        "AIFACTORY-US-407",
        "AIFACTORY-US-408"
      ],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5200,
      "titlePrefix": "[AIFACTORY-FEAT-002]",
      "number": 2
    },
    {
      "id": "AIFACTORY-US-054",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-002",
      "title": "ControlPlaneApi routes the calls of its platform under a trusted scope",
      "sequence": "01.02.01",
      "description": "As a platform admin, I want one gateway in front of the seven services of the Control Plane that validates tokens and scopes, so that no service of the platform is reachable except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the Control Plane gateway. ADR-0028 re-scopes the former composition host as the API gateway of its platform: ControlPlaneApi routes public REST and internal gRPC calls to the seven services the model lists under `deployment.fronts` (ProjectService, EnvironmentService, AgentRegistryService, AgentCardService, RunControlService, CostUsageService and FactoryCommercialService), validates tokens and scopes and owns no business state. The repository ConnectSoft.AI.SoftwareFactory.ControlPlaneApi is not created by this feature: the repository checklist of feature `repository-and-pipeline-conventions` created it in I0 (AIFACTORY-TASK-1514, after AIFACTORY-TASK-190 proved the checklist on the first repository), and this feature takes it as it stands. It is scaffolded from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform, which fixes persistence, messaging and the actor model to none: the gateway has no relational store, no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package; the gateway copies neither the accessor nor the token contract. The gateway forwards the user token to the fronted service unchanged and exchanges no token, and the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). The feature is delivered by five PBIs: the fronts file and the routes generated from it (AIFACTORY-US-404), token, tenant, project and scope on every read and sandbox route (AIFACTORY-US-405), the pass-through of a shared-write call with its idempotency key (AIFACTORY-US-406), the production, publication and spend routes whose gate stays in the fronted service (AIFACTORY-US-407), and health, modules, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-408). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. Where the path or a message field of a route names the project or the tenant, the gateway answers 403 for a project the token does not grant and 404 for another tenant itself and calls no service; where a route names only a resource id, the gateway forwards under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. Five of the seven services are delivered in the same increment. AgentCardService and FactoryCommercialService arrive in later increments, and so do the REST operations of AgentRegistryService: until then a route whose service is not deployed answers 503 with a problem response that names the service, and a route whose operation a thin delivery does not host returns the answer of that service unchanged. The gateway invents no response. Kind: enabling. Traces: services: ControlPlaneApi, ProjectService, EnvironmentService, AgentRegistryService, RunControlService, CostUsageService; apis: ControlPlaneApi/Health; adrs: ADR-0001, ADR-0015, ADR-0017, ADR-0028; requirements: FR-01. Depends on: AIFACTORY-US-404, AIFACTORY-US-405, AIFACTORY-US-406, AIFACTORY-US-407, AIFACTORY-US-408, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai. Sources: model/services/control-plane/ControlPlaneApi.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/control/services/control-plane-api/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ControlPlaneApi as the repository checklist of feature repository-and-pipeline-conventions created it in I0, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ControlPlaneApi --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/control-plane/ControlPlaneApi.yaml).",
        "AC2: Given a valid token for a route of each fronted service delivered in the increment, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with tenant, project and correlation id, the fronted service answers and the response returns unchanged, as AIFACTORY-US-405 to AIFACTORY-US-407 prove per route class (ADR-0015, FR-01).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, and no event of the model lists ControlPlaneApi as a consumer (ADR-0028, model/services/control-plane/ControlPlaneApi.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `ControlPlaneApi/Health` is probed and one replica is stopped, then health reports the identity platform and the fronted services, a replica stays in rotation while it can validate tokens, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/control-plane/ControlPlaneApi.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/services/control-plane-api/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-004",
        "AIFACTORY-TASK-1658",
        "AIFACTORY-TASK-698"
      ],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5201,
      "kind": "enabling",
      "traces": {
        "services": [
          "ControlPlaneApi",
          "ProjectService",
          "EnvironmentService",
          "AgentRegistryService",
          "RunControlService",
          "CostUsageService"
        ],
        "apis": [
          "ControlPlaneApi/Health"
        ],
        "adrs": [
          "ADR-0001",
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-404",
        "AIFACTORY-US-405",
        "AIFACTORY-US-406",
        "AIFACTORY-US-407",
        "AIFACTORY-US-408",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/services/control-plane-api/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-054]",
      "number": 54
    },
    {
      "id": "AIFACTORY-TASK-004",
      "type": "task",
      "parent": "AIFACTORY-US-054",
      "title": "Take the repository ConnectSoft.AI.SoftwareFactory.ControlPlaneApi as the repository checklist created it and confirm its scaffold of the Platform gateway role",
      "sequence": "01.02.01.01",
      "description": "Take the repository ConnectSoft.AI.SoftwareFactory.ControlPlaneApi as the repository checklist created it and confirm its scaffold of the Platform gateway role. Expected output: The repository is not created here and no second scaffold is run: the repository checklist of feature repository-and-pipeline-conventions created it in I0 (AIFACTORY-TASK-1514, after AIFACTORY-TASK-190 proved the checklist on the first repository), with the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ControlPlaneApi --UseFactoryProfile true --GatewayRole Platform` from the pinned template package as its first commit. This task takes the repository as it stands: it confirms that the pinned template package and the gateway role Platform of that commit are the ones this feature builds on, that the solution builds and that the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-005 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository is not created here and no second scaffold is run: the repository checklist of feature repository-and-pipeline-conventions created it in I0 (AIFACTORY-TASK-1514, after AIFACTORY-TASK-190 proved the checklist on the first repository), with the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ControlPlaneApi --UseFactoryProfile true --GatewayRole Platform` from the pinned template package as its first commit. This task takes the repository as it stands: it confirms that the pinned template package and the gateway role Platform of that commit are the ones this feature builds on, that the solution builds and that the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-005 is written."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-004]",
      "number": 4
    },
    {
      "id": "AIFACTORY-TASK-1658",
      "type": "task",
      "parent": "AIFACTORY-US-054",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "01.02.01.02",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 6, the ports https 7400 and grpc 7402, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/control-plane/ControlPlaneApi.yaml records them, and leaves ControlPlane:Host:FrontedServices at its modelled default, the seven service names of deployment.fronts (D117); the same image runs in the saas-default, hybrid and on-prem topologies with the identity authority of the profile (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 6, the ports https 7400 and grpc 7402, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/control-plane/ControlPlaneApi.yaml records them, and leaves ControlPlane:Host:FrontedServices at its modelled default, the seven service names of deployment.fronts (D117); the same image runs in the saas-default, hybrid and on-prem topologies with the identity authority of the profile (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5201,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1658]",
      "number": 1658
    },
    {
      "id": "AIFACTORY-TASK-698",
      "type": "task",
      "parent": "AIFACTORY-US-054",
      "title": "Verify control-plane-api-routes-its-platform by running the declared command",
      "sequence": "01.02.01.03",
      "description": "Verify control-plane-api-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-054, that is the repository taken as the checklist created it with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes ControlPlaneApi/Health on both, stops one instance and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-054, that is the repository taken as the checklist created it with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes ControlPlaneApi/Health on both, stops one instance and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-698]",
      "number": 698
    },
    {
      "id": "AIFACTORY-US-404",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-002",
      "title": "Control Plane fronts file: named clients and REST and gRPC routes of the seven fronted services, generated at build",
      "sequence": "01.02.02",
      "description": "As a platform admin, I want the route table of the Control Plane gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Control Plane. It lists the seven services of `deployment.fronts` in model/services/control-plane/ControlPlaneApi.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method, scope, side-effect class and idempotency. The REST operations are the public surface that StudioBff and the clients call; the gRPC methods are the internal surface the Agent Mesh calls through AgentRuntimeWorker for leases, outcomes, approval requests and release loading. Each route carries the scope and the side-effect class of its operation, which is what the route class PBIs of this feature enforce. A test lists the emitted route table against the file and against the service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `Health` and `ListModules`, transforms no payload and composes no response from two services: the response of a fronted service returns unchanged. The fronts file alone decides which routes are hosted, because the routes are generated from it at build. The option `ControlPlane:Host:FrontedServices` of the model is bound at startup and compared with the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable, so a change of the list is a new build and a new deployment. The modelled default of the option equals the service set of `deployment.fronts`, the seven service names (D117), so a gateway deployed without a value for the option starts with exactly the routes of the fronts file. Kind: enabling. Traces: services: ControlPlaneApi, ProjectService, EnvironmentService, AgentRegistryService, RunControlService, CostUsageService; adrs: ADR-0015, ADR-0028; requirements: FR-01. Depends on: feature:component-api-gateway-template. Sources: model/services/control-plane/ControlPlaneApi.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/planes/control/services/control-plane-api/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Control Plane, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, each with the scope, side-effect class and idempotency of the operation, and the route table test passes against model/services/control-plane/ControlPlaneApi.yaml and the service files it fronts (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `ControlPlane:Host:FrontedServices` at its default, which model/services/control-plane/ControlPlaneApi.yaml states as the seven services of `deployment.fronts`, when the gateway starts, then startup succeeds; given a value of the option that differs from the services of the fronts file, when the gateway starts, then startup fails with the differing name; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, which carries the token of the caller unchanged because the gateway exchanges no token, the tenant, the project, the correlation id and the trace context, and the response of the fake returns unchanged (ADR-0015, FR-01)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/control/services/control-plane-api/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-005",
        "AIFACTORY-TASK-1659",
        "AIFACTORY-TASK-1660"
      ],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5202,
      "kind": "enabling",
      "traces": {
        "services": [
          "ControlPlaneApi",
          "ProjectService",
          "EnvironmentService",
          "AgentRegistryService",
          "RunControlService",
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/control/services/control-plane-api/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-404]",
      "number": 404
    },
    {
      "id": "AIFACTORY-TASK-005",
      "type": "task",
      "parent": "AIFACTORY-US-404",
      "title": "Fronts file with the REST and gRPC operations of ProjectService, EnvironmentService, AgentRegistryService, AgentCardService, RunControlService, CostUsageService and FactoryCommercialService",
      "sequence": "01.02.02.01",
      "description": "Fronts file with the REST and gRPC operations of ProjectService, EnvironmentService, AgentRegistryService, AgentCardService, RunControlService, CostUsageService and FactoryCommercialService. Expected output: The fronts file lists the seven services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class and idempotency; the build emits the named clients, the routes and the route table; at startup the option ControlPlane:Host:FrontedServices, whose default is the seven service names of deployment.fronts (D117), is compared with the services of the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the seven services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class and idempotency; the build emits the named clients, the routes and the route table; at startup the option ControlPlane:Host:FrontedServices, whose default is the seven service names of deployment.fronts (D117), is compared with the services of the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-005]",
      "number": 5
    },
    {
      "id": "AIFACTORY-TASK-1659",
      "type": "task",
      "parent": "AIFACTORY-US-404",
      "title": "Fakes of the seven fronted services and the token matrix of the acceptance suite",
      "sequence": "01.02.02.02",
      "description": "Fakes of the seven fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake per fronted service that records the headers it received and answers a configured status, a switch that makes a fake stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience and a workload token with and without a service scope.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake per fronted service that records the headers it received and answers a configured status, a switch that makes a fake stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience and a workload token with and without a service scope."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5202,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1659]",
      "number": 1659
    },
    {
      "id": "AIFACTORY-TASK-1660",
      "type": "task",
      "parent": "AIFACTORY-US-404",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "01.02.02.03",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-404: one route per operation of model/services/control-plane/ControlPlaneApi.yaml and the service files it fronts, the failing builds, the start with the option at its default, the failing startup on an option value that differs from the fronts file, the 404 of an unknown path and one forwarded call per service and protocol.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-404: one route per operation of model/services/control-plane/ControlPlaneApi.yaml and the service files it fronts, the failing builds, the start with the option at its default, the failing startup on an option value that differs from the fronts file, the 404 of an unknown path and one forwarded call per service and protocol."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1660]",
      "number": 1660
    },
    {
      "id": "AIFACTORY-US-405",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-002",
      "title": "A read or sandbox route forwards a call only under a validated token, the tenant of the token, a granted project and the scope of its operation",
      "sequence": "01.02.03",
      "description": "As a requester, I want my read calls to reach the service only with the tenant, project and scope my token grants, so that I see what I am entitled to and nobody reads across a tenant or a project through the gateway. A caller reaches a read or sandbox operation of the Control Plane through the gateway: a requester reads a run or the environments of a project, an observer lists usage, an asset maintainer validates a release candidate, and a worker of the Agent Mesh streams a release over gRPC. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment on the audience of a user token); a client that calls two gateways requests two tokens. A workload presents a workload token, which carries service scopes, no audience of a user API and no tenant claim, and is admitted only on a route whose operation names a service scope the token holds. The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names. For a user token it takes the tenant from the `tid` claim and overwrites any tenant header of the caller, and it admits the project a route names in its path or in a message field only when the token holds a role claim for that project or the tenant-wide Platform admin role. A workload token carries no tenant claim, so the overwrite does not apply to it: for a workload token that holds the service scope the operation names, the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope (ADR-0015 amendment D114); for a workload token without the scope the answer is PERMISSION_DENIED and no fronted service is called. The scope is established once with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package and forwarded: the authorization header, the tenant in `X-Tenant-Id` on REST and `tenant-id` in gRPC metadata, the project header of the abstractions package, the correlation id and the trace context. The authorization header carries the user token itself: the gateway exchanges no token, and the fronted service validates the forwarded token again, accepts the audience of its own gateway, which is this one, and applies its own tenant filter (ADR-0015 amendment D117). For a read route the response is served by the fronted service with no side effect; for a sandbox route, which in this platform is `ValidateRelease` of AgentRegistryService, the service reports and changes no shared state. In this increment the sandbox route is proven against the fake of AgentRegistryService generated from the fronts entry, because `ValidateRelease` arrives with feature `agent-registry-service-publication` in I2 (D140). The gateway returns the response unchanged with the correlation id and keeps nothing of the call. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope of the operation 403. Where the path or a message field of the route names the project or the tenant, the gateway answers 403 for a token without a role in that project and 404, over gRPC NOT_FOUND, for another tenant itself. In each of these cases no fronted service is called, and the refusal is counted for the route and logged with the correlation id and without the token. Where the route names only a resource id, such as a run, a release or an environment, a gateway without business state cannot know the project or the tenant of the resource: it forwards the call under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. When the fronted service does not answer, the route answers 503 with a retry hint and the routes of the other services keep serving. Kind: behavior. Traces: services: ControlPlaneApi, ProjectService, EnvironmentService, AgentRegistryService, RunControlService, CostUsageService; adrs: ADR-0015, ADR-0028; requirements: FR-01, FUX-01, NFR-01; scenarios: SCN-ControlPlaneApi-005, SCN-ControlPlaneApi-006. Depends on: AIFACTORY-US-404, feature:component-api-gateway-template, feature:component-extensions-ai. Sources: model/services/control-plane/ControlPlaneApi.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/services/control-plane-api/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with the scope of a read operation and a role in the addressed project, when the read route is called, then the gateway forwards the call with the user token unchanged in the authorization header, without a token exchange, the tenant of the `tid` claim, the project header, the correlation id and the trace context, the fronted service, which accepts the audience of its own gateway, answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-ControlPlaneApi-005, ADR-0015, FR-01).",
        "AC2: Given the matrix of role, tenant and project of the acceptance suite, when read routes of ProjectService, EnvironmentService, RunControlService and CostUsageService are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope 403; where the path or a message field of the route names the project or the tenant, a token without a role in that project is answered 403 and another tenant 404 by the gateway itself, and in none of these cases a fronted service is called; where the route names only a resource id, the gateway forwards the call under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment D113) and the gateway returns that answer unchanged (SCN-ControlPlaneApi-005, ADR-0015).",
        "AC3: Given a valid user token and a tenant header of the caller that names another tenant, when a read route is called, then the header is overwritten with the `tid` claim before the call is forwarded; given a workload token, which carries no tenant claim, on an internal gRPC route, when the token holds the service scope the operation names, then the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope (ADR-0015 amendment D114), and when the token lacks that scope the answer is PERMISSION_DENIED and no fronted service is called; a resource outside the forwarded tenant is answered NOT_FOUND by the fronted service and that answer returns unchanged (SCN-ControlPlaneApi-005, ADR-0015).",
        "AC4: Given a token with `factory.assets.write`, when the sandbox route of AgentRegistryService is called, then the call is forwarded under the same token, tenant and scope rules, the gateway adds no gate of its own to the class and the answer of the service returns unchanged; the refusals apply as on a read route and no fronted service is called when the gateway refuses; in this increment the sandbox route is proven against the fake of AgentRegistryService generated from the fronts entry, because `ValidateRelease` arrives with feature agent-registry-service-publication in I2 (D140, SCN-ControlPlaneApi-006, model/services/control-plane/AgentRegistryService.yaml).",
        "AC5: Given a fronted service that does not answer, when one of its read routes is called, then the gateway answers 503 with a problem response that carries a retry hint and names the service and never its address, invents no response, and the read routes of the other services keep serving (SCN-ControlPlaneApi-005, model/services/control-plane/ControlPlaneApi.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/control-plane-api/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1661",
        "AIFACTORY-TASK-1662"
      ],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5203,
      "kind": "behavior",
      "traces": {
        "services": [
          "ControlPlaneApi",
          "ProjectService",
          "EnvironmentService",
          "AgentRegistryService",
          "RunControlService",
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "FUX-01",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-ControlPlaneApi-005",
          "SCN-ControlPlaneApi-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-404",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/control-plane-api/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-405]",
      "number": 405
    },
    {
      "id": "AIFACTORY-TASK-1661",
      "type": "task",
      "parent": "AIFACTORY-US-405",
      "title": "Issuer, audience, project parameter and workload scope configuration of the read and sandbox routes",
      "sequence": "01.02.03.01",
      "description": "Issuer, audience, project parameter and workload scope configuration of the read and sandbox routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route names the path or message field that addresses its project or tenant, or is marked as addressed by a resource id only, in which case the gateway checks token and scope and leaves the project role and the tenant of the resource to the fronted service; on a gRPC route the route names the service scope a workload token must hold; for a user token the tenant header is overwritten with the tid claim, and for a workload token that holds the service scope the tenant-id and project metadata of the caller are forwarded unchanged (ADR-0015 amendment D114), while a workload token without the scope is answered PERMISSION_DENIED before any call; the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header and the project header; the user token is forwarded unchanged in the authorization header and no token is exchanged, since the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117); refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route names the path or message field that addresses its project or tenant, or is marked as addressed by a resource id only, in which case the gateway checks token and scope and leaves the project role and the tenant of the resource to the fronted service; on a gRPC route the route names the service scope a workload token must hold; for a user token the tenant header is overwritten with the tid claim, and for a workload token that holds the service scope the tenant-id and project metadata of the caller are forwarded unchanged (ADR-0015 amendment D114), while a workload token without the scope is answered PERMISSION_DENIED before any call; the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header and the project header; the user token is forwarded unchanged in the authorization header and no token is exchanged, since the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117); refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1661]",
      "number": 1661
    },
    {
      "id": "AIFACTORY-TASK-1662",
      "type": "task",
      "parent": "AIFACTORY-US-405",
      "title": "Verify the read and sandbox routes through the acceptance suite",
      "sequence": "01.02.03.02",
      "description": "Verify the read and sandbox routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ControlPlaneApi-005|Scenario=SCN-ControlPlaneApi-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-405 over the matrix of role, tenant and project, the token received by the fake equal to the user token of the caller, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the overwritten tenant header of a user token, a workload token on a gRPC route with the service scope (tenant-id and project metadata forwarded unchanged) and without it (PERMISSION_DENIED and no call to the fake), the sandbox route against the fake of AgentRegistryService generated from the fronts entry and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ControlPlaneApi-005|Scenario=SCN-ControlPlaneApi-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-405 over the matrix of role, tenant and project, the token received by the fake equal to the user token of the caller, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the overwritten tenant header of a user token, a workload token on a gRPC route with the service scope (tenant-id and project metadata forwarded unchanged) and without it (PERMISSION_DENIED and no call to the fake), the sandbox route against the fake of AgentRegistryService generated from the fronts entry and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1662]",
      "number": 1662
    },
    {
      "id": "AIFACTORY-US-406",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-002",
      "title": "A shared-write route passes the idempotency key through and the gateway keeps nothing between calls",
      "sequence": "01.02.04",
      "description": "As a requester, I want a write I repeat after a failure to be applied once, so that a lost answer or a restarted gateway never creates a second project, environment or run. A shared-write operation changes state that others read: creating a project or an environment, setting a membership, submitting or cancelling a run, setting a budget. The caller sends it through the gateway under the token, tenant, project and scope rules of AIFACTORY-US-405. An operation whose model entry declares idempotency `key-header` is called with an `Idempotency-Key`; the gateway forwards the header unchanged and the fronted service applies the request once under its own rule: the same key with the same body returns the same result, the same key with a different body is a conflict, and that 409 returns to the caller unchanged. The gateway is no party to idempotency. It stores neither the key nor the result, keeps no session and no pending call, has no outbox and writes no event, so a gateway replica that crashes during a call loses nothing: the replica restarts, nothing is replayed, and the caller retries with the same key and receives from the service the result of the first application (failure mode of a gateway replica crash in the model). When the fronted service does not answer, the route answers 503 with a problem response that names the service and carries a retry hint, the other routes keep serving, and the caller retries with its key. A refusal by the gateway (401, 403 or, on a route whose path or message field names the project or the tenant, 404) reaches no fronted service, so it applies nothing. On a route that names only a resource id, such as the cancellation of a run, the gateway forwards under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing project role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged; the service has applied nothing. The answer to a decision a waiting attempt asks for is such a route: the Studio and the command-line client call `RunControlService/AnswerDecision` through the gateway with the user token of a member whose scope carries `factory.runs.operate`, the gateway forwards it under that token, and the 404, 409 and 503 of RunControlService return unchanged (D137). A missing key, an invalid body and every domain refusal are answers of the fronted service and return unchanged with the correlation id. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: ControlPlaneApi, ProjectService, EnvironmentService, RunControlService, CostUsageService; adrs: ADR-0015, ADR-0028; requirements: FR-03; scenarios: SCN-ControlPlaneApi-007. Depends on: AIFACTORY-US-404, AIFACTORY-US-405, feature:component-api-gateway-template. Sources: model/services/control-plane/ControlPlaneApi.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a valid token and a shared-write route whose operation declares idempotency `key-header`, when the call arrives with an `Idempotency-Key`, then the gateway forwards the request with the header unchanged, the fronted service applies it once and the response returns unchanged with the correlation id (SCN-ControlPlaneApi-007, ADR-0015).",
        "AC2: Given the same call repeated with the same key, and then with the same key and a different body, when both pass the gateway, then the first returns the result of the first application and the second returns the 409 of the fronted service unchanged; the gateway has stored neither the key nor a result (SCN-ControlPlaneApi-007, ADR-0028).",
        "AC3: Given a gateway replica stopped while a shared-write call is in flight, when the caller retries with the same key through another replica, then the fronted service returns the result of the one application, nothing is replayed by the gateway and no second state change exists (SCN-ControlPlaneApi-007, model/services/control-plane/ControlPlaneApi.yaml).",
        "AC4: Given a call without a token, a token that lacks the scope, or a fronted service that does not answer, when a shared-write route is called, then the answer is 401, 403 or 503 respectively; where the path or a message field of the route names the project or the tenant, a token without a role in that project is answered 403 and another tenant 404 by the gateway itself; a call the gateway refuses reaches no fronted service; where the route names only a resource id, the gateway forwards under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing project role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged; the 503 names the service and carries a retry hint while the other routes keep serving (SCN-ControlPlaneApi-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1663",
        "AIFACTORY-TASK-1664"
      ],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5204,
      "kind": "behavior",
      "traces": {
        "services": [
          "ControlPlaneApi",
          "ProjectService",
          "EnvironmentService",
          "RunControlService",
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-03"
        ],
        "scenarios": [
          "SCN-ControlPlaneApi-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-404",
        "AIFACTORY-US-405",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-406]",
      "number": 406
    },
    {
      "id": "AIFACTORY-TASK-1663",
      "type": "task",
      "parent": "AIFACTORY-US-406",
      "title": "Forwarded headers of a write route and a stateless call path",
      "sequence": "01.02.04.01",
      "description": "Forwarded headers of a write route and a stateless call path. Expected output: A shared-write route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "A shared-write route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1663]",
      "number": 1663
    },
    {
      "id": "AIFACTORY-TASK-1664",
      "type": "task",
      "parent": "AIFACTORY-US-406",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "01.02.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ControlPlaneApi-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-406 with a fake that applies a key once, a replica stopped during a call, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ControlPlaneApi-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-406 with a fake that applies a key once, a replica stopped during a call, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1664]",
      "number": 1664
    },
    {
      "id": "AIFACTORY-US-407",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-002",
      "title": "A production, publication or spend route is forwarded under its scope and the gate of the action stays in the fronted service",
      "sequence": "01.02.05",
      "description": "As a workspace admin, I want a gated action to be decided by the service that owns its state, with the gateway only checking who I am and what I may call, so that an approval or a budget is never decided twice or by a component that holds no state. Three side-effect classes of the model carry a gate beyond the scope: a production action, a publication and a spend. In the Control Plane the production routes are those of EnvironmentService and ProjectService (freezing and unfreezing an environment, closing, suspending and resuming a project), the publication routes are those of AgentRegistryService (submitting, publishing, deprecating and revoking a release, moving an alias) and the spend routes are those of FactoryCommercialService. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, admits the project a route names only when the token grants it, requires the scope the operation names (`factory.projects.admin`, `factory.assets.write`, `factory.assets.publish` or the scope of the spend operation) and forwards the call with the established scope. The gate itself is decided where the state is. EnvironmentService and ProjectService decide a production action and announce it by their events; AgentRegistryService publishes a release only after its gates and the publication approval and answers 412 when a precondition does not hold; the rules of the commands D117 added, the reason and the Workspace admin or Platform admin of `SuspendProject` and `ResumeProject` and the reason and the Platform admin of `DeprecateRelease` and `RevokeRelease`, are enforced by ProjectService and AgentRegistryService, and their routes are generated from the fronts file under these classes like every other route; the approval is requested from and decided in RunControlService; budgets and reservations are owned by CostUsageService. The gateway evaluates no approval, holds no approval reference, reads no budget and keeps no reservation, and it writes no audit evidence. Where a command leaves evidence of its own, the service that owns the command writes it in the transaction of the command, as AgentRegistryService does for a publication; where the service writes only its event, as EnvironmentService does with `EnvironmentStateChanged` for a freeze or an unfreeze, AuditService records the evidence from that event. The answer of the fronted service, including 409 and 412, returns unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. Where the path or a message field of a route names the project or the tenant, the gateway answers 403 for a token without a role in that project and 404 for another tenant itself and calls no service. The production routes this PBI proves, `FreezeEnvironment` and `UnfreezeEnvironment`, name only an `environmentId`, and so does every route addressed by a run, a release or an approval: a gateway without business state cannot resolve the project or the tenant of such an id, so it forwards the call under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. In this increment the production routes are proven against EnvironmentService and ProjectService; the publication and spend routes are proven against a fake fronted service generated from the fronts entry, because the REST operations of AgentRegistryService and the service FactoryCommercialService arrive in later increments with their own features. Kind: behavior. Traces: services: ControlPlaneApi, EnvironmentService, ProjectService, AgentRegistryService; adrs: ADR-0015, ADR-0028; requirements: FR-01, NFR-04; scenarios: SCN-ControlPlaneApi-003, SCN-ControlPlaneApi-004, SCN-ControlPlaneApi-008. Depends on: AIFACTORY-US-404, AIFACTORY-US-405, feature:component-api-gateway-template. Sources: model/services/control-plane/ControlPlaneApi.yaml, model/services/control-plane/EnvironmentService.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a token with `factory.projects.admin` and a role in the project of an environment, when the production route that freezes the environment is called, then the gateway forwards the call under the tenant of the token and the scope of the operation, because the route names only the `environmentId`; EnvironmentService resolves the project of the environment, decides the action and writes its event, and its answer returns unchanged with the correlation id; the gateway evaluates no approval and writes nothing (SCN-ControlPlaneApi-003, ADR-0028).",
        "AC2: Given a token with `factory.assets.publish`, when a publication route is called against the fake of AgentRegistryService that answers 200, 409 or 412, then the gateway forwards the call under the established scope and returns each answer unchanged, holding no approval reference of its own (SCN-ControlPlaneApi-004, ADR-0028, model/services/control-plane/AgentRegistryService.yaml).",
        "AC3: Given a token with the scope of a spend operation, when the spend route is called against a fake fronted service generated from the fronts entry, then the gateway forwards the call under the established scope and returns the answer unchanged; it reads no budget and holds no reservation (SCN-ControlPlaneApi-008, ADR-0028).",
        "AC4: Given a call without a token or with an expired token, or a token that lacks the scope of the operation, when a production, publication or spend route is called, then the gateway answers 401 or 403 and no fronted service is called; given a route whose path or message field names the project or the tenant, when the token grants no role in that project or the route addresses another tenant, then the gateway answers 403 or 404 itself and calls no service; given a route that names only a resource id, such as the `environmentId` of a freeze or the `releaseId` of a publication, when it is called, then the gateway forwards under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment D113) and the gateway returns that answer unchanged (SCN-ControlPlaneApi-003, SCN-ControlPlaneApi-004, SCN-ControlPlaneApi-008, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1665",
        "AIFACTORY-TASK-1666"
      ],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5205,
      "kind": "behavior",
      "traces": {
        "services": [
          "ControlPlaneApi",
          "EnvironmentService",
          "ProjectService",
          "AgentRegistryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-ControlPlaneApi-003",
          "SCN-ControlPlaneApi-004",
          "SCN-ControlPlaneApi-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-404",
        "AIFACTORY-US-405",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-407]",
      "number": 407
    },
    {
      "id": "AIFACTORY-TASK-1665",
      "type": "task",
      "parent": "AIFACTORY-US-407",
      "title": "Fakes of the publication and spend routes and the route class register of the gateway",
      "sequence": "01.02.05.01",
      "description": "Fakes of the publication and spend routes and the route class register of the gateway. Expected output: The acceptance suite holds a fake of the publication operations of AgentRegistryService that answers 200, 409 and 412 and a fake fronted service generated from the spend entry of the fronts file; a register test lists every route of class production, publication and spend from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval or a budget.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of the publication operations of AgentRegistryService that answers 200, 409 and 412 and a fake fronted service generated from the spend entry of the fronts file; a register test lists every route of class production, publication and spend from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval or a budget."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5205,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1665]",
      "number": 1665
    },
    {
      "id": "AIFACTORY-TASK-1666",
      "type": "task",
      "parent": "AIFACTORY-US-407",
      "title": "Verify the production, publication and spend routes through the acceptance suite",
      "sequence": "01.02.05.02",
      "description": "Verify the production, publication and spend routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ControlPlaneApi-003|Scenario=SCN-ControlPlaneApi-004|Scenario=SCN-ControlPlaneApi-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-407: each class forwarded under its scope, the answers 409 and 412 returned unchanged, the refusals of the gateway without a call to a fronted service, the 403 and the 404 of a fronted service on a route addressed by a resource id returned unchanged, and the register of gated routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ControlPlaneApi-003|Scenario=SCN-ControlPlaneApi-004|Scenario=SCN-ControlPlaneApi-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-407: each class forwarded under its scope, the answers 409 and 412 returned unchanged, the refusals of the gateway without a call to a fronted service, the 403 and the 404 of a fronted service on a route addressed by a resource id returned unchanged, and the register of gated routes."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1666]",
      "number": 1666
    },
    {
      "id": "AIFACTORY-US-408",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-002",
      "title": "Health, modules, limits and telemetry of the gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "01.02.06",
      "description": "As an operator, I want to see whether the gateway, the identity platform and each fronted service answer, and which services the gateway fronts, so that I can tell a failing service from a failing gateway and act on the right one. An operator, the Studio about page and the probes of the cluster read the state of the gateway through its two own operations. `ControlPlaneApi/Health` reports liveness and readiness of the gateway with the aggregated health of the seven services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. What the gateway does when it is unreachable is decided (D117, ADR-0015 amendment). While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe `ControlPlaneApi/Health` answers 200 with the health degraded and a detail that names the identity platform as unreachable, so the operator sees the failure in health while calls still pass. The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, `ControlPlaneApi/Health` answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency: when it does not answer, health reports it as unavailable in the detail, its routes answer 503 with a retry hint, and the routes of the other services keep serving. `ControlPlaneApi/ListModules` returns the services the gateway fronts with their versions and repositories to a caller whose scope carries `factory.meta.read`. The configuration platform is optional as well: it supplies feature flags and the runtime configuration of routes and rate limits when it is available, and when it is not, the gateway keeps the routes and limits of its own configuration. A call that exceeds the rate limit configured for its route is refused with 429. The gateway emits `connectsoft.factory.host.requests` with the dimensions service, route and status and `connectsoft.factory.host.request_duration` with service and route, the latency including the fronted service, and carries the trace context to the service; its logs never contain a token, a prompt, an artifact or a payload. A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed. The roles of the gateway are Observer, Operator and Platform admin. Kind: behavior. Traces: services: ControlPlaneApi; apis: ControlPlaneApi/Health, ControlPlaneApi/ListModules; adrs: ADR-0015, ADR-0017, ADR-0028; requirements: NFR-07, NFR-17; scenarios: SCN-ControlPlaneApi-001, SCN-ControlPlaneApi-002. Depends on: AIFACTORY-US-404, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/control-plane/ControlPlaneApi.yaml, docs/planes/control/services/control-plane-api/index.md#metrics-and-observability, docs/planes/control/services/control-plane-api/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and all fronted services reachable, when `ControlPlaneApi/Health` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the seven fronted services and of the identity platform (SCN-ControlPlaneApi-001, NFR-17).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `ControlPlaneApi/Health` is probed, then tokens that were already issued are validated with the cached key, readiness stays ready so the replica stays in rotation, and from the first failed probe health answers 200 with the health degraded and a detail that names the identity platform as unreachable, while liveness keeps answering 200; given no valid key remains, because none was cached or the cached keys expired, when calls arrive, then they are refused, readiness is unready so the replica leaves rotation, `ControlPlaneApi/Health` answers 503 with a problem response that names the identity platform and no state changes (SCN-ControlPlaneApi-001, model/services/control-plane/ControlPlaneApi.yaml).",
        "AC3: Given one fronted service does not answer, when `ControlPlaneApi/Health` and the routes are called, then health reports that service as unavailable in its detail, its routes answer 503 with a retry hint that names the service and the routes of the other services keep serving (SCN-ControlPlaneApi-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read`, when `ControlPlaneApi/ListModules` is called, then the response is 200 with the seven fronted services, each with its version and repository, as model/services/control-plane/ControlPlaneApi.yaml lists them under `deployment.fronts`; a call without a token is answered 401 and a token without the scope 403, and nothing is written (SCN-ControlPlaneApi-002).",
        "AC5: Given routed calls, a call above the rate limit of its route and an unavailable configuration platform, when the metrics and logs are read, then `connectsoft.factory.host.requests` counts every call by service, route and status, the call above the limit was refused with 429, `connectsoft.factory.host.request_duration` holds the latency by service and route, the gateway kept the routes and limits of its own configuration, and no log record holds a token or a payload (model/services/control-plane/ControlPlaneApi.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "docs/planes/control/services/control-plane-api/index.md#metrics-and-observability",
        "docs/planes/control/services/control-plane-api/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-006",
        "AIFACTORY-TASK-1667",
        "AIFACTORY-TASK-1668",
        "AIFACTORY-TASK-1669"
      ],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5206,
      "kind": "behavior",
      "traces": {
        "services": [
          "ControlPlaneApi"
        ],
        "apis": [
          "ControlPlaneApi/Health",
          "ControlPlaneApi/ListModules"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-07",
          "NFR-17"
        ],
        "scenarios": [
          "SCN-ControlPlaneApi-001",
          "SCN-ControlPlaneApi-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-404",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/control-plane/ControlPlaneApi.yaml",
        "docs/planes/control/services/control-plane-api/index.md#metrics-and-observability",
        "docs/planes/control/services/control-plane-api/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-408]",
      "number": 408
    },
    {
      "id": "AIFACTORY-TASK-006",
      "type": "task",
      "parent": "AIFACTORY-US-408",
      "title": "Health, modules and telemetry of the gateway",
      "sequence": "01.02.06.01",
      "description": "Health, modules and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the seven fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the modules operation lists the fronted services with version and repository under factory.meta.read; every routed call records connectsoft.factory.host.requests and connectsoft.factory.host.request_duration with their modelled dimensions and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the seven fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the modules operation lists the fronted services with version and repository under factory.meta.read; every routed call records connectsoft.factory.host.requests and connectsoft.factory.host.request_duration with their modelled dimensions and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-006]",
      "number": 6
    },
    {
      "id": "AIFACTORY-TASK-1667",
      "type": "task",
      "parent": "AIFACTORY-US-408",
      "title": "Rate limits per route from configuration and the degrade path of the configuration platform",
      "sequence": "01.02.06.02",
      "description": "Rate limits per route from configuration and the degrade path of the configuration platform. Expected output: Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it; when the configuration platform is available its route and limit values replace the local ones, and when it is not, the gateway keeps its own configuration and reports the configuration platform as an optional dependency in the health detail.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it; when the configuration platform is available its route and limit values replace the local ones, and when it is not, the gateway keeps its own configuration and reports the configuration platform as an optional dependency in the health detail."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1667]",
      "number": 1667
    },
    {
      "id": "AIFACTORY-TASK-1668",
      "type": "task",
      "parent": "AIFACTORY-US-408",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "01.02.06.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/control-plane/ControlPlaneApi.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117, NFR-17).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/control-plane/ControlPlaneApi.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117, NFR-17)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5206,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1668]",
      "number": 1668
    },
    {
      "id": "AIFACTORY-TASK-1669",
      "type": "task",
      "parent": "AIFACTORY-US-408",
      "title": "Verify health, modules, limits and telemetry through the acceptance suite",
      "sequence": "01.02.06.04",
      "description": "Verify health, modules, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ControlPlaneApi-001|Scenario=SCN-ControlPlaneApi-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-408 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, a call above its limit and the configuration platform stopped.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ControlPlaneApi-001|Scenario=SCN-ControlPlaneApi-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-408 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, a call above its limit and the configuration platform stopped."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 52,
      "phase": "factory",
      "stackRank": 5206,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1669]",
      "number": 1669
    },
    {
      "id": "AIFACTORY-FEAT-004",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "EnvironmentService: complete delivery",
      "sequence": "01.03",
      "description": "EnvironmentService is the service of bounded context BC-01 (Project & Environment). Owns the environments of a project (sandbox, dev, test, staging, production classes), their policy class, connections and the desired deployment references that Provisioning (BC-25) reconciles (BC-01). Its own repository is ConnectSoft.AI.SoftwareFactory.EnvironmentService. Delivers: EnvironmentService (complete). Increment I1: Generate a microservice. Build order 53 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-055",
        "AIFACTORY-US-409",
        "AIFACTORY-US-410",
        "AIFACTORY-US-411",
        "AIFACTORY-US-412",
        "AIFACTORY-US-413"
      ],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5300,
      "titlePrefix": "[AIFACTORY-FEAT-004]",
      "number": 4
    },
    {
      "id": "AIFACTORY-US-055",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-004",
      "title": "EnvironmentService serves its scope end to end",
      "sequence": "01.03.01",
      "description": "As a platform admin, I want EnvironmentService in place as the owner of the environments of a project, their policy class and their state, so that every other service reads the class and the state of an environment through one contract and its events. This is the integration PBI of EnvironmentService, the owner of the environments of a project in the bounded context Project and Environment. An environment is a named target inside a project with a policy class (Sandbox, Development, Test, Staging or Production), a state (Draft, Active, Frozen or Retired), a region, the connections a run may use from it and the reference to the desired deployment that the Runtime Cloud platform reconciles; the service never deploys anything. The repository ConnectSoft.AI.SoftwareFactory.EnvironmentService is created and scaffolded in I0 by AIFACTORY-TASK-010 of feature repository-and-pipeline-conventions (D140) from the pinned base template package with `UseFactoryProfile`, and this feature starts from that scaffold, so token validation, the seven role policies, the scope chain with its 401, 403 and 404 answers, the tenant row filter, the Orleans messaging profile with the service name `environment`, health, readiness and the telemetry wiring come from the profile. Every integration event of the service is written as the run event envelope of the contracts package to the Orleans outbox in the transaction of its command (ADR-0014). The feature is delivered by five PBIs: creating an environment and announcing it (AIFACTORY-US-409), reading the environments of a project and the policy class of one environment for a tool call (AIFACTORY-US-410), freezing and unfreezing (AIFACTORY-US-411), the state machine with all five transitions and the `EnvironmentStateChanged` event (AIFACTORY-US-412) and the inbox handlers for what other services announce about an environment (AIFACTORY-US-413). The public REST operations are reached through ControlPlaneApi and require `factory.projects.read` or `factory.projects.admin`; the gateway forwards the user token without exchanging it, and the service accepts the audience of its own gateway (ADR-0015 amendment D117); the internal gRPC method is called by workloads. An environment of another tenant is answered 404, over gRPC NOT_FOUND, the same answer as for an identifier that does not exist, and a missing scope or project right inside the tenant of the caller 403 (ADR-0015). The same holds for a project: a `projectId` that is unknown in the tenant of the token or belongs to another tenant, which only a caller with the tenant-wide Platform admin role can address past the scope chain, is answered 404 on the two project routes (ADR-0015 amendment D113), and the model names that 404 in the code lists of `CreateEnvironment` and `ListEnvironments` (D117). ProjectService is the one required dependency: the service confirms through it that the project exists, and when it is unavailable a command that needs it fails fast and writes nothing. RuntimeEnvironmentService is optional and reached by events only; when it sends no observed state the environment keeps its desired reference. Every other service reads the class and the state of an environment through this contract or from its events. Kind: behavior. Traces: services: EnvironmentService; aggregates: EnvironmentService/Environment; apis: EnvironmentService/CreateEnvironment, EnvironmentService/ListEnvironments, EnvironmentService/FreezeEnvironment, EnvironmentService/UnfreezeEnvironment, EnvironmentService/Environments.GetPolicyClass; events: EnvironmentService/EnvironmentCreated, EnvironmentService/EnvironmentStateChanged; adrs: ADR-0014, ADR-0015, ADR-0017, ADR-0028; requirements: FR-01, NFR-01. Depends on: AIFACTORY-US-409, AIFACTORY-US-410, AIFACTORY-US-411, AIFACTORY-US-412, AIFACTORY-US-413, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-extensions-ai, feature:contracts-package. Sources: model/services/control-plane/EnvironmentService.yaml, docs/planes/control/services/environment-service/index.md#purpose-and-responsibilities, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.EnvironmentService created and scaffolded in I0 by AIFACTORY-TASK-010 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentService --UseFactoryProfile true` from the pinned template package, when its pipeline runs, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/control-plane/EnvironmentService.yaml).",
        "AC2: Given the service descriptor of the repository, when the contract test compares it with the hosted surface, then `EnvironmentService/CreateEnvironment`, `EnvironmentService/ListEnvironments`, `EnvironmentService/FreezeEnvironment`, `EnvironmentService/UnfreezeEnvironment` and `EnvironmentService/Environments.GetPolicyClass` are hosted with the scope, side-effect class, idempotency and response codes of model/services/control-plane/EnvironmentService.yaml, the 404 of the two project routes for a project outside the tenant of the token among them, and the test fails on an endpoint the file does not name.",
        "AC3: Given environments of two tenants and a caller of one, when an operation addresses an environment of the other tenant, then the answer is 404, over gRPC NOT_FOUND, exactly as for an unknown identifier; given a caller without the scope or without a role in the project, when it calls, then the answer is 403; given no token, then 401; and in no case a state changes; a user token that ControlPlaneApi forwards unchanged, whose audience is that gateway, is accepted by the service without a token exchange (ADR-0015, NFR-01).",
        "AC4: Given the outbox of the service after the acceptance suite, when its records are read, then `EnvironmentService/EnvironmentCreated` and `EnvironmentService/EnvironmentStateChanged` are the only event types it holds, each written in the transaction of its command under the run event envelope with the tenant of the `EnvironmentService/Environment` (ADR-0014).",
        "AC5: Given the service starts, when liveness and readiness are probed, then readiness is unready until `environment-sql` is migrated, while the outbox check of the messaging profile is unhealthy and while the identity authority is unreachable, and `connectsoft.factory.environments.frozen` is emitted with the dimensions tenant and class while activities and log records carry tenant and project (ADR-0017, model/services/control-plane/EnvironmentService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/control/services/environment-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-013",
        "AIFACTORY-TASK-015",
        "AIFACTORY-TASK-700"
      ],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5301,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentService"
        ],
        "aggregates": [
          "EnvironmentService/Environment"
        ],
        "apis": [
          "EnvironmentService/CreateEnvironment",
          "EnvironmentService/ListEnvironments",
          "EnvironmentService/FreezeEnvironment",
          "EnvironmentService/UnfreezeEnvironment",
          "EnvironmentService/Environments.GetPolicyClass"
        ],
        "events": [
          "EnvironmentService/EnvironmentCreated",
          "EnvironmentService/EnvironmentStateChanged"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "NFR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-409",
        "AIFACTORY-US-410",
        "AIFACTORY-US-411",
        "AIFACTORY-US-412",
        "AIFACTORY-US-413",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-extensions-ai",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/control/services/environment-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-055]",
      "number": 55
    },
    {
      "id": "AIFACTORY-TASK-013",
      "type": "task",
      "parent": "AIFACTORY-US-055",
      "title": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 4 REST and 1 gRPC operations",
      "sequence": "01.03.01.01",
      "description": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 4 REST and 1 gRPC operations. Expected output: The service descriptor file lists CreateEnvironment, ListEnvironments, FreezeEnvironment, UnfreezeEnvironment and Environments.GetPolicyClass with scope, side-effect class, idempotency and response codes; the four REST routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code, the 404 of a project outside the tenant of the token on the two project routes among them, the Idempotency-Key filter of CreateEnvironment and the workload scope check of the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-409 to AIFACTORY-US-411, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists CreateEnvironment, ListEnvironments, FreezeEnvironment, UnfreezeEnvironment and Environments.GetPolicyClass with scope, side-effect class, idempotency and response codes; the four REST routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code, the 404 of a project outside the tenant of the token on the two project routes among them, the Idempotency-Key filter of CreateEnvironment and the workload scope check of the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-409 to AIFACTORY-US-411, not here."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5301,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-013]",
      "number": 13
    },
    {
      "id": "AIFACTORY-TASK-015",
      "type": "task",
      "parent": "AIFACTORY-US-055",
      "title": "Security, tenancy and telemetry of EnvironmentService",
      "sequence": "01.03.01.02",
      "description": "Security, tenancy and telemetry of EnvironmentService. Expected output: The scopes factory.projects.read and factory.projects.admin and the roles of the model are enforced per route, a user token forwarded by ControlPlaneApi is accepted with the audience of that gateway and no token is exchanged (ADR-0015 amendment D117), every query is tenant-filtered so an environment of another tenant is answered 404 (ADR-0015), the messaging-transport secret comes from a secret reference, readiness reports the store, the outbox and the identity authority, and connectsoft.factory.environments.frozen is created through the instrument helper of the observability library with tenant and class.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The scopes factory.projects.read and factory.projects.admin and the roles of the model are enforced per route, a user token forwarded by ControlPlaneApi is accepted with the audience of that gateway and no token is exchanged (ADR-0015 amendment D117), every query is tenant-filtered so an environment of another tenant is answered 404 (ADR-0015), the messaging-transport secret comes from a secret reference, readiness reports the store, the outbox and the identity authority, and connectsoft.factory.environments.frozen is created through the instrument helper of the observability library with tenant and class."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-015]",
      "number": 15
    },
    {
      "id": "AIFACTORY-TASK-700",
      "type": "task",
      "parent": "AIFACTORY-US-055",
      "title": "Verify environment-service-serves-its-scope by running the declared command",
      "sequence": "01.03.01.03",
      "description": "Verify environment-service-serves-its-scope by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-055, that is the scaffold, the hosted surface against the service descriptor, the two-tenant matrix with its 404, 403 and 401 answers, the two event types of the outbox and readiness.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-055, that is the scaffold, the hosted surface against the service descriptor, the two-tenant matrix with its 404, 403 and 401 answers, the two event types of the outbox and readiness."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-700]",
      "number": 700
    },
    {
      "id": "AIFACTORY-US-409",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-004",
      "title": "Create an environment of a project with its policy class and announce it",
      "sequence": "01.03.02",
      "description": "As a workspace admin, I want to create an environment of my project with a name, a policy class and a region, so that runs and tool calls that target it are governed by its class from the first call. A Workspace admin or a Platform admin, a caller whose scope carries `factory.projects.admin`, creates an environment of a project through the gateway route of `EnvironmentService/CreateEnvironment` with an `Idempotency-Key`. The tenant comes from the token and the project from the path, and the project is admitted into the scope only when the token holds a role claim for it or the tenant-wide Platform admin role; a project the token does not grant is refused with 403 and its existence is never confirmed. The body names the environment: its `name`, its `class`, one of Sandbox, Development, Test, Staging and Production, and its `region`, and it may name the connections usable from the environment and the reference to its desired deployment. The model names no 400 for the operation: which status an invalid body receives (a `class` outside the five values, a missing `name` or `region`, an unknown connection id) is an open point reported to the owner, and until it is decided the acceptance test fixes only that an invalid body writes no `Environment` and no outbox record. The service confirms through ProjectService that the project exists. A caller with the tenant-wide Platform admin role passes the scope chain for any `projectId`, so the service answers that check itself: when ProjectService reports that the project does not exist in the tenant of the token, which is also its answer for a project of another tenant, the call is answered 404, the same for the foreign and the unknown project, and nothing is written or published (ADR-0015 amendment D113); the model names this 404 in the code list of the operation (D117). When the project exists, the service writes the `Environment` in state Draft with its policy class and writes the `EnvironmentCreated` outbox record in the same transaction; the response is 201 with the environment and its location. The policy class is the most important output of the service: a tool call against a Production environment is raised to the production action class, so the class is fixed when the environment is created and travels in the event. Names are unique within a project: a second environment with the same name is refused with 409 by the invariant of the aggregate and the unique index of the table. A repeated call with the same key and the same body returns the same environment and changes nothing; the same key with a different body is refused with 409. When ProjectService is unavailable the call fails fast with a problem response and nothing is written. `EnvironmentCreated` carries `environmentId`, `projectId`, `tenantId` and `class` under the run event envelope of the contracts package, with the tenant and the project in the envelope; the dispatcher of the `environment` messaging profile publishes it on `projects.environments.v1.environment-created` and retries a transport outage with backoff. IaCProvisioningService, RuntimeEnvironmentService and StudioBff consume the event in their own increments and PBIs; this PBI proves what the publisher can prove. The option `Projects:Environments:DefaultClasses` is bound with its default; this PBI creates no environment on its own. Kind: behavior. Traces: services: EnvironmentService; aggregates: EnvironmentService/Environment; apis: EnvironmentService/CreateEnvironment; events: EnvironmentService/EnvironmentCreated; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-01, XL-01; scenarios: SCN-EnvironmentService-001, SCN-EnvironmentService-006. Depends on: feature:project-service, feature:contracts-package, feature:component-base-template-factory-profile. Sources: model/services/control-plane/EnvironmentService.yaml, docs/planes/control/services/environment-service/index.md#domain-model, docs/reference/schemas/run-event-envelope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.projects.admin` whose token grants the project of the path and a body that names `name`, `class` and `region`, when `EnvironmentService/CreateEnvironment` is called with an `Idempotency-Key`, then the response is 201 with the environment, the `EnvironmentService/Environment` exists in state Draft with its class in `environment-sql`, and the `EnvironmentService/EnvironmentCreated` outbox record is written in the same transaction (SCN-EnvironmentService-001, ADR-0014).",
        "AC2: Given the same call repeated with the same `Idempotency-Key` and the same body, when it arrives, then the same environment is returned and no second `EnvironmentService/Environment` and no second outbox record exists; given the same key with a different body, or a name already used by an environment of the project, when `EnvironmentService/CreateEnvironment` is called, then the answer is 409 and nothing is written (SCN-EnvironmentService-001, ADR-0014).",
        "AC3: Given a caller without `factory.projects.admin`, or a token that grants no role in the project of the path, when `EnvironmentService/CreateEnvironment` is called, then the answer is 403 with a problem response that never confirms whether the project exists; given a caller with the tenant-wide Platform admin role and a `projectId` that does not exist in the tenant of the token or belongs to another tenant, when it is called, then the answer is 404, the same for the foreign and the unknown project (ADR-0015 amendment D113); given ProjectService is unavailable, when it is called, then the call fails fast with a problem response; given an invalid body, for which the model names no status and the status is an open point reported to the owner, when it is called, then the test fixes only that nothing is written; in each case no `EnvironmentService/Environment` is written and nothing is published (SCN-EnvironmentService-001, ADR-0015).",
        "AC4: Given an environment was created, when the outbox dispatcher of the `environment` messaging profile publishes `EnvironmentService/EnvironmentCreated` on `projects.environments.v1.environment-created`, then the event is sent under the run event envelope with `environmentId`, `projectId`, `tenantId` and `class`, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-EnvironmentService-006, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/control/services/environment-service/index.md#domain-model",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-011",
        "AIFACTORY-TASK-012",
        "AIFACTORY-TASK-1670",
        "AIFACTORY-TASK-1671",
        "AIFACTORY-TASK-1672"
      ],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5302,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentService"
        ],
        "aggregates": [
          "EnvironmentService/Environment"
        ],
        "apis": [
          "EnvironmentService/CreateEnvironment"
        ],
        "events": [
          "EnvironmentService/EnvironmentCreated"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "XL-01"
        ],
        "scenarios": [
          "SCN-EnvironmentService-001",
          "SCN-EnvironmentService-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:project-service",
        "feature:contracts-package",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/control/services/environment-service/index.md#domain-model",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-409]",
      "number": 409
    },
    {
      "id": "AIFACTORY-TASK-011",
      "type": "task",
      "parent": "AIFACTORY-US-409",
      "title": "Domain model: Environment with its four states, five transitions and the invariants the aggregate enforces",
      "sequence": "01.03.02.01",
      "description": "Domain model: Environment with its four states, five transitions and the invariants the aggregate enforces. Expected output: The Environment aggregate holds the fields of the model, the transitions Activate, Freeze, Unfreeze and Retire (from Active and from Frozen) and no other, and the version token; each transition raises EnvironmentStateChanged with fromState, toState and the class of the environment; unit tests cover every transition, every rejected pair of states and the three invariants the aggregate enforces: a name is unique within a project (together with the unique index of AIFACTORY-TASK-012), a Frozen environment stays Frozen until it is unfrozen or retired, and every EnvironmentStateChanged announces the class of the environment beside its state (D117). The remaining invariant of the model, that a Production-class environment is not targeted by a run whose release is not Published, is not tested here, because the aggregate knows no run and no release state; RunControlService refuses such a run at submission (D117) and proves it in feature run-control-service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Environment aggregate holds the fields of the model, the transitions Activate, Freeze, Unfreeze and Retire (from Active and from Frozen) and no other, and the version token; each transition raises EnvironmentStateChanged with fromState, toState and the class of the environment; unit tests cover every transition, every rejected pair of states and the three invariants the aggregate enforces: a name is unique within a project (together with the unique index of AIFACTORY-TASK-012), a Frozen environment stays Frozen until it is unfrozen or retired, and every EnvironmentStateChanged announces the class of the environment beside its state (D117). The remaining invariant of the model, that a Production-class environment is not targeted by a run whose release is not Published, is not tested here, because the aggregate knows no run and no release state; RunControlService refuses such a run at submission (D117) and proves it in feature run-control-service."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-011]",
      "number": 11
    },
    {
      "id": "AIFACTORY-TASK-012",
      "type": "task",
      "parent": "AIFACTORY-US-409",
      "title": "Persistence in environment-sql: Environments and EnvironmentConnections with the tenant filter and the unique name index",
      "sequence": "01.03.02.02",
      "description": "Persistence in environment-sql: Environments and EnvironmentConnections with the tenant filter and the unique name index. Expected output: Mappings and migrations for the two modelled tables with the tenant column and row filter, the unique index on project and name and the row version as optimistic concurrency token; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the two modelled tables with the tenant column and row filter, the unique index on project and name and the row version as optimistic concurrency token; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5302,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-012]",
      "number": 12
    },
    {
      "id": "AIFACTORY-TASK-1670",
      "type": "task",
      "parent": "AIFACTORY-US-409",
      "title": "CreateEnvironment with the project check, the idempotency key and the EnvironmentCreated outbox record",
      "sequence": "01.03.02.03",
      "description": "CreateEnvironment with the project check, the idempotency key and the EnvironmentCreated outbox record. Expected output: The operation takes the tenant from the token and the project from the path, confirms the project through ProjectService (fail-fast), writes the Environment in state Draft and the EnvironmentCreated outbox record in one transaction and returns 201 with the location; the idempotent repeat, the 409 for a reused key with a different body and for a duplicate name, the 403 refusals, the 404 for a project that ProjectService reports as absent from the tenant of the token, the same for a foreign and an unknown project (ADR-0015 amendment D113), the failing ProjectService and an invalid body that writes no Environment and no outbox record are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "The operation takes the tenant from the token and the project from the path, confirms the project through ProjectService (fail-fast), writes the Environment in state Draft and the EnvironmentCreated outbox record in one transaction and returns 201 with the location; the idempotent repeat, the 409 for a reused key with a different body and for a duplicate name, the 403 refusals, the 404 for a project that ProjectService reports as absent from the tenant of the token, the same for a foreign and an unknown project (ADR-0015 amendment D113), the failing ProjectService and an invalid body that writes no Environment and no outbox record are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1670]",
      "number": 1670
    },
    {
      "id": "AIFACTORY-TASK-1671",
      "type": "task",
      "parent": "AIFACTORY-US-409",
      "title": "Contract of EnvironmentCreated against the run event envelope of the contracts package",
      "sequence": "01.03.02.04",
      "description": "Contract of EnvironmentCreated against the run event envelope of the contracts package. Expected output: A golden file fixes EnvironmentCreated on the topic projects.environments.v1.environment-created under run-event-envelope-v1 with environmentId, projectId, tenantId and class and with tenant and project in the envelope; a contract test fails when the serialised event differs from the file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "A golden file fixes EnvironmentCreated on the topic projects.environments.v1.environment-created under run-event-envelope-v1 with environmentId, projectId, tenantId and class and with tenant and project in the envelope; a contract test fails when the serialised event differs from the file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5302,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1671]",
      "number": 1671
    },
    {
      "id": "AIFACTORY-TASK-1672",
      "type": "task",
      "parent": "AIFACTORY-US-409",
      "title": "Verify create-an-environment through the acceptance suite",
      "sequence": "01.03.02.05",
      "description": "Verify create-an-environment through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentService-001|Scenario=SCN-EnvironmentService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-409, including the 404 of a Platform admin for a foreign and for an unknown project, the invalid body that writes nothing and the publication and payload of EnvironmentCreated; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentService-001|Scenario=SCN-EnvironmentService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-409, including the 404 of a Platform admin for a foreign and for an unknown project, the invalid body that writes nothing and the publication and payload of EnvironmentCreated; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1672]",
      "number": 1672
    },
    {
      "id": "AIFACTORY-US-410",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-004",
      "title": "List the environments of a project and return the policy class and state of one environment for a tool call",
      "sequence": "01.03.03",
      "description": "As an operator, I want to see the environments of my project with their class and state, and tool calls to be judged by the class and state the service holds, so that nobody acts on an assumed class or on a freeze that was already lifted. Two reads serve the two kinds of caller. A member of a project, a caller whose scope carries `factory.projects.read`, lists the environments of the project through the gateway route of `EnvironmentService/ListEnvironments`: the response is 200 with every environment of that project in the tenant of the caller, each with its name, class, state and region. The query runs under the tenant row filter and is bound to the project of the path, which is admitted only when the token grants it; environments of other projects and of other tenants never appear, and a project the token does not grant is refused with 403. A caller with the tenant-wide Platform admin role passes the scope chain for any `projectId`, so the service confirms the project through ProjectService as it does on creation: a `projectId` that does not exist in the tenant of the token or belongs to another tenant is answered 404, the same for the foreign and the unknown project, and when ProjectService is unavailable the read fails fast (ADR-0015 amendment D113); the model names this 404 in the code list of the operation (D117). A workload, ToolAdapterService before a tool call or PolicyEngineService when it raises the class of an action, asks for the class and the state of one environment through the internal gRPC method `EnvironmentService/Environments.GetPolicyClass` with an `execution-scope-v1` that names the tenant, the project and the environment. The caller presents a workload token, which carries no tenant claim, so the service reads the tenant and project it forwards only when the token holds the service scope that names EnvironmentService (ADR-0015). The model names `execution-scope-v1` as the request and as the reply descriptor of the method, and docs/reference/schemas/execution-scope.schema.json allows no additional property and has no field for an environment class or state, so the reply descriptor of the model cannot hold what the method exists to return. That conflict is an open point reported to the owner, and this PBI makes the reply checkable without deciding it: the proto reply message carries the scope fields `tenantId`, `projectId` and `environmentId` of the environment and beside them the fields `class` (EnvironmentClass) and `state` (EnvironmentState), and a contract test fixes the message by a golden file, so a later decision changes one message and one file. The class raises a shared-write against a Production environment to a production action, and the state lets the caller refuse a shared-write or production call against a Frozen environment. Both reads write nothing and answer from the committed state of `environment-sql`. Over gRPC a call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, a request without an environment with INVALID_ARGUMENT, and an environment that does not exist in the forwarded tenant with NOT_FOUND, which is also the answer for an environment of another tenant; an attempt that receives it takes the failure class permanent. Both callers treat this dependency as fail-fast: when the store is unavailable the method answers UNAVAILABLE and the caller does not guess a class. Kind: behavior. Traces: services: EnvironmentService; aggregates: EnvironmentService/Environment; apis: EnvironmentService/ListEnvironments, EnvironmentService/Environments.GetPolicyClass; descriptors: execution-scope-v1; adrs: ADR-0015; requirements: FR-01, FR-05, NFR-01; scenarios: SCN-EnvironmentService-002, SCN-EnvironmentService-005. Depends on: AIFACTORY-US-409, feature:component-base-template-factory-profile. Sources: model/services/control-plane/EnvironmentService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/governance/PolicyEngineService.yaml, docs/reference/schemas/execution-scope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given environments in two projects of one tenant and in another tenant, when a caller with `factory.projects.read` whose token grants the first project calls `EnvironmentService/ListEnvironments` for it, then the response is 200 with exactly the environments of that project, each with name, class, state and region, and nothing is written (SCN-EnvironmentService-002, ADR-0015).",
        "AC2: Given a caller without `factory.projects.read`, or a token that grants no role in the project of the path, when `EnvironmentService/ListEnvironments` is called, then the answer is 403 with a problem response that never confirms whether the project exists; given a caller with the tenant-wide Platform admin role and a `projectId` that does not exist in the tenant of the token or belongs to another tenant, when it is called, then the answer is 404, the same for the foreign and the unknown project (ADR-0015 amendment D113); in each case no state changes and nothing is published (SCN-EnvironmentService-002, ADR-0015).",
        "AC3: Given a Production environment in state Frozen and a workload token that holds the service scope, when `EnvironmentService/Environments.GetPolicyClass` is called with an `execution-scope-v1` that names the tenant, the project and the environment, then the reply carries the fields `class` Production and `state` Frozen of the reply message fixed by the contract test, beside the scope fields of that environment, and a call after the environment was unfrozen carries `state` Active (SCN-EnvironmentService-005, FR-05).",
        "AC4: Given a caller without a workload identity, a token without the service scope, a request without an environment, an environment of another tenant or an unavailable store, when `EnvironmentService/Environments.GetPolicyClass` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND or UNAVAILABLE respectively, the environment of another tenant is answered exactly as an unknown one, and no state changes (SCN-EnvironmentService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1673",
        "AIFACTORY-TASK-1674",
        "AIFACTORY-TASK-1675"
      ],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5303,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentService"
        ],
        "aggregates": [
          "EnvironmentService/Environment"
        ],
        "apis": [
          "EnvironmentService/ListEnvironments",
          "EnvironmentService/Environments.GetPolicyClass"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "FR-05",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-EnvironmentService-002",
          "SCN-EnvironmentService-005"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-409",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-410]",
      "number": 410
    },
    {
      "id": "AIFACTORY-TASK-1673",
      "type": "task",
      "parent": "AIFACTORY-US-410",
      "title": "ListEnvironments read model bound to the tenant and the granted project",
      "sequence": "01.03.03.01",
      "description": "ListEnvironments read model bound to the tenant and the granted project. Expected output: ListEnvironments returns the environments of the project of the path with name, class, state and region under the tenant row filter, admits the project only when the token grants it and answers 403 otherwise; for a caller with the tenant-wide Platform admin role it confirms the project through ProjectService (fail-fast) and answers 404 for a project that is absent from the tenant of the token, the same for a foreign and an unknown project (ADR-0015 amendment D113); environments of other projects and tenants never appear.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "ListEnvironments returns the environments of the project of the path with name, class, state and region under the tenant row filter, admits the project only when the token grants it and answers 403 otherwise; for a caller with the tenant-wide Platform admin role it confirms the project through ProjectService (fail-fast) and answers 404 for a project that is absent from the tenant of the token, the same for a foreign and an unknown project (ADR-0015 amendment D113); environments of other projects and tenants never appear."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1673]",
      "number": 1673
    },
    {
      "id": "AIFACTORY-TASK-1674",
      "type": "task",
      "parent": "AIFACTORY-US-410",
      "title": "Environments.GetPolicyClass with the workload scope check and the forwarded tenant",
      "sequence": "01.03.03.02",
      "description": "Environments.GetPolicyClass with the workload scope check and the forwarded tenant. Expected output: Environments.GetPolicyClass reads the tenant, project and environment of execution-scope-v1 only under the service scope of the workload token and answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND (also for an environment of another tenant, ADR-0015) and UNAVAILABLE as the PBI states; the proto reply message carries the scope fields tenantId, projectId and environmentId and beside them the fields class (EnvironmentClass) and state (EnvironmentState) from the committed state; a contract test fixes the request and the reply message by a golden file, the one place to change when the owner decides how the reply relates to execution-scope-v1, whose schema has no field for a class or a state; the proto of the method is published with the service descriptor.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Environments.GetPolicyClass reads the tenant, project and environment of execution-scope-v1 only under the service scope of the workload token and answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND (also for an environment of another tenant, ADR-0015) and UNAVAILABLE as the PBI states; the proto reply message carries the scope fields tenantId, projectId and environmentId and beside them the fields class (EnvironmentClass) and state (EnvironmentState) from the committed state; a contract test fixes the request and the reply message by a golden file, the one place to change when the owner decides how the reply relates to execution-scope-v1, whose schema has no field for a class or a state; the proto of the method is published with the service descriptor."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1674]",
      "number": 1674
    },
    {
      "id": "AIFACTORY-TASK-1675",
      "type": "task",
      "parent": "AIFACTORY-US-410",
      "title": "Verify the two reads through the acceptance suite",
      "sequence": "01.03.03.03",
      "description": "Verify the two reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentService-002|Scenario=SCN-EnvironmentService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-410 over the two-tenant and two-project fixture, a Platform admin token for a foreign and for an unknown project, the golden file of the reply message, a workload token with and without the service scope and a stopped store.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentService-002|Scenario=SCN-EnvironmentService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-410 over the two-tenant and two-project fixture, a Platform admin token for a foreign and for an unknown project, the golden file of the reply message, a workload token with and without the service scope and a stopped store."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1675]",
      "number": 1675
    },
    {
      "id": "AIFACTORY-US-411",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-004",
      "title": "Freeze an environment for an incident or a change freeze and lift the freeze",
      "sequence": "01.03.04",
      "description": "As a workspace admin, I want to freeze an environment and to lift the freeze when the incident or the change window is over, so that gated work against the environment stops at once and resumes without a run being lost. A freeze is the change-freeze or incident control of an environment. A caller whose scope carries `factory.projects.admin` and whose token grants the project of the environment freezes it through the gateway route of `EnvironmentService/FreezeEnvironment`: an Active environment moves to Frozen through the trigger `Freeze`, and the `EnvironmentStateChanged` outbox record with `fromState` Active, `toState` Frozen and the `class` of the environment (D117) is written in the same transaction; the response is 200 with the environment. `EnvironmentService/UnfreezeEnvironment` lifts it: a Frozen environment moves to Active through `Unfreeze` with its event in the same transaction; the invariant of the aggregate names a Workspace admin as the one who unfreezes, so `UnfreezeEnvironment` requires, beside the scope, the Workspace admin role for the project of the environment or the tenant-wide Platform admin role, and a caller that holds the scope with another role is answered 403. Both operations are of the production class and naturally idempotent: freezing an environment that is already Frozen, or unfreezing one that is already Active, returns 200, changes nothing and writes no second event. The gauge `connectsoft.factory.environments.frozen` rises by one with the dimensions tenant and class when an environment becomes Frozen and falls by one when it leaves Frozen, through `Unfreeze` here or through `Retire` in AIFACTORY-US-412. The service itself stops no run and no tool call: while the environment is Frozen, RunControlService holds the runs that target it and releases them when it is active again, and ToolAdapterService refuses shared-write and production calls that target it, each on the event and in its own PBI. The environment is addressed by `environmentId`. An environment that does not exist in the tenant of the caller is answered 404, which is also the answer for an environment of another tenant; a caller without the scope or without a role in the project of the environment is answered 403; an environment in a state that has no such transition, Draft or Retired, is answered 409, as is a call that loses the optimistic concurrency check against a concurrent change. A refused call changes nothing and publishes nothing. Kind: behavior. Traces: services: EnvironmentService; aggregates: EnvironmentService/Environment; apis: EnvironmentService/FreezeEnvironment, EnvironmentService/UnfreezeEnvironment; events: EnvironmentService/EnvironmentStateChanged; adrs: ADR-0014, ADR-0015; requirements: FR-05, NFR-04; scenarios: SCN-EnvironmentService-003, SCN-EnvironmentService-004. Depends on: AIFACTORY-US-409, AIFACTORY-US-412, feature:component-base-template-factory-profile. Sources: model/services/control-plane/EnvironmentService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/services/environment-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given an Active environment and a caller with `factory.projects.admin` whose token grants its project, when `EnvironmentService/FreezeEnvironment` is called, then the response is 200, the `EnvironmentService/Environment` is Frozen, the `EnvironmentService/EnvironmentStateChanged` outbox record with `fromState` Active, `toState` Frozen and the `class` of the environment is written in the same transaction and `connectsoft.factory.environments.frozen` rises by one for its tenant and class (SCN-EnvironmentService-003, ADR-0014).",
        "AC2: Given a Frozen environment, when `EnvironmentService/UnfreezeEnvironment` is called with `factory.projects.admin` by a Workspace admin of the project of the environment, or by a Platform admin, then the response is 200, the environment is Active, the `EnvironmentService/EnvironmentStateChanged` outbox record with `fromState` Frozen, `toState` Active and the `class` of the environment is written in the same transaction and the gauge falls by one (SCN-EnvironmentService-004, ADR-0014).",
        "AC3: Given an environment already Frozen, when `EnvironmentService/FreezeEnvironment` is repeated, and an environment already Active, when `EnvironmentService/UnfreezeEnvironment` is repeated, then each answers 200, the state is unchanged and no second outbox record is written (SCN-EnvironmentService-003, SCN-EnvironmentService-004).",
        "AC4: Given a caller without the scope or without a role in the project of the environment, an `environmentId` of another tenant or one that does not exist, a Draft or Retired environment, or a concurrent change that wins the version check, when either operation is called, then the answer is 403 for the missing scope or role, 404 for the foreign or unknown environment and 409 for the state or version conflict; given a caller that holds the scope but neither the Workspace admin role for the project of the environment nor the Platform admin role, when `EnvironmentService/UnfreezeEnvironment` is called, then the answer is 403; each refusal carries a problem response, the state is unchanged and nothing is published (SCN-EnvironmentService-003, SCN-EnvironmentService-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/environment-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1676",
        "AIFACTORY-TASK-1677"
      ],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5304,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentService"
        ],
        "aggregates": [
          "EnvironmentService/Environment"
        ],
        "apis": [
          "EnvironmentService/FreezeEnvironment",
          "EnvironmentService/UnfreezeEnvironment"
        ],
        "events": [
          "EnvironmentService/EnvironmentStateChanged"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-05",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-EnvironmentService-003",
          "SCN-EnvironmentService-004"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-409",
        "AIFACTORY-US-412",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/environment-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-411]",
      "number": 411
    },
    {
      "id": "AIFACTORY-TASK-1676",
      "type": "task",
      "parent": "AIFACTORY-US-411",
      "title": "FreezeEnvironment and UnfreezeEnvironment with their transitions, the outbox record and the frozen gauge",
      "sequence": "01.03.04.01",
      "description": "FreezeEnvironment and UnfreezeEnvironment with their transitions, the outbox record and the frozen gauge. Expected output: Both operations load the environment under the tenant row filter, apply the Freeze or Unfreeze transition of the aggregate with the version check, write EnvironmentStateChanged with fromState, toState and the class of the environment in the same transaction, move connectsoft.factory.environments.frozen with tenant and class, return 200 and the unchanged state on a natural repeat, and answer 403, 404 (also for an environment of another tenant, ADR-0015) and 409 as the PBI states; UnfreezeEnvironment admits, beside the scope, only the Workspace admin role for the project of the environment or the Platform admin role and answers 403 to any other role.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Both operations load the environment under the tenant row filter, apply the Freeze or Unfreeze transition of the aggregate with the version check, write EnvironmentStateChanged with fromState, toState and the class of the environment in the same transaction, move connectsoft.factory.environments.frozen with tenant and class, return 200 and the unchanged state on a natural repeat, and answer 403, 404 (also for an environment of another tenant, ADR-0015) and 409 as the PBI states; UnfreezeEnvironment admits, beside the scope, only the Workspace admin role for the project of the environment or the Platform admin role and answers 403 to any other role."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1676]",
      "number": 1676
    },
    {
      "id": "AIFACTORY-TASK-1677",
      "type": "task",
      "parent": "AIFACTORY-US-411",
      "title": "Verify freeze-and-unfreeze-an-environment through the acceptance suite",
      "sequence": "01.03.04.02",
      "description": "Verify freeze-and-unfreeze-an-environment through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentService-003|Scenario=SCN-EnvironmentService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-411, including the natural repeat, the gauge, the two-tenant fixture, an unfreeze by a caller that holds the scope without the Workspace admin or Platform admin role and two concurrent calls.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentService-003|Scenario=SCN-EnvironmentService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-411, including the natural repeat, the gauge, the two-tenant fixture, an unfreeze by a caller that holds the scope without the Workspace admin or Platform admin role and two concurrent calls."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1677]",
      "number": 1677
    },
    {
      "id": "AIFACTORY-US-412",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-004",
      "title": "Every state change of an environment is one modelled transition, announced once by EnvironmentStateChanged",
      "sequence": "01.03.05",
      "description": "As an operator, I want every change of the state of an environment to follow the modelled transitions and to be announced once with its old and new state, so that Run Control, the tool boundary and the audit trail act on the same sequence of states the service committed. The `Environment` aggregate has four states and five transitions: Draft to Active through `Activate`, Active to Frozen through `Freeze`, Frozen to Active through `Unfreeze`, and Active or Frozen to Retired through `Retire`. Retired is terminal, and Draft is where `CreateEnvironment` puts a new environment. The aggregate with exactly these transitions is built by AIFACTORY-TASK-011 of AIFACTORY-US-409, the first PBI that writes an `Environment`; this PBI delivers the commands that apply the transitions, the one event that announces a state change and the proof of the whole transition table. Every transition increments the version of the aggregate, is guarded by optimistic concurrency and writes one `EnvironmentStateChanged` record with `environmentId`, `tenantId`, `fromState`, `toState` and `class`, the policy class of the environment announced beside its state (D117), to the outbox in the same transaction as the state change, so publication is never the proof of a transition and a transition that rolls back leaves no event (ADR-0014). A request for a change the transition table does not hold, such as freezing a Draft environment or changing a Retired one, is rejected by the aggregate and changes nothing. `Freeze` and `Unfreeze` are reached through the REST operations of AIFACTORY-US-411. The model declares `Activate` and `Retire` as transitions and names no REST operation, command or handler that performs them, so this PBI delivers them as operations of the aggregate with their events and proves them at the level of the domain and the outbox; which caller performs them is an open point this PBI does not decide. The dispatcher of the `environment` messaging profile publishes the event on `projects.environments.v1.environment-state-changed` under the run event envelope of the contracts package with the tenant in the envelope, retries a transport outage with backoff and publishes each record once under its event id. The consumers act in their own PBIs: RunControlService holds the runs of a frozen environment, releases them when it is active again, fails every non-terminal run of a retired environment and keeps the announced state and, beside it, the announced class of the environment in its `GateStates`; ToolAdapterService refuses shared-write and production calls that target a Frozen environment; EnvironmentPromotionService gates promotions; StudioBff refreshes its view; AuditService records the change as evidence. A `Retire` from Frozen lowers `connectsoft.factory.environments.frozen` by one for the tenant and class of the environment. The aggregate of the model has four invariants. The service enforces three: names are unique within a project, a Frozen environment stays Frozen until it is unfrozen or retired, and every `EnvironmentStateChanged` announces the class of the environment beside its state (D117). The remaining one, that a Production-class environment cannot be targeted by a run whose release is not Published, cannot be enforced inside the aggregate, because the service knows no run and no release state. The service contributes the class: in the payload of `EnvironmentStateChanged` and of `EnvironmentCreated`, and through `EnvironmentService/Environments.GetPolicyClass`, which the model has PolicyEngineService call for class raising and ToolAdapterService call before a tool call. The refusal is made by RunControlService at submission, as its model states: it keeps the class that `EnvironmentStateChanged` announces beside the state of the environment in `GateStates`, and `SubmitRun` answers 409 with a problem body that names the gate when the run targets an environment of production class and its pinned release is not Published (D117). That refusal is proven by feature `run-control-service` and not here; this PBI proves that every state event carries the class. In the first increment every release is a seeded Draft, so a run of the first outcome that targets a Production-class environment meets this refusal. Kind: behavior. Traces: services: EnvironmentService; aggregates: EnvironmentService/Environment; events: EnvironmentService/EnvironmentStateChanged; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014; requirements: NFR-04; scenarios: SCN-EnvironmentService-007. Depends on: AIFACTORY-US-409, feature:contracts-package, feature:component-base-template-factory-profile. Sources: model/services/control-plane/EnvironmentService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/services/environment-service/index.md#domain-model, docs/reference/schemas/run-event-envelope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the `EnvironmentService/Environment` aggregate, when each of the five transitions of model/services/control-plane/EnvironmentService.yaml is applied from its source state (`Activate` from Draft, `Freeze` from Active, `Unfreeze` from Frozen, `Retire` from Active and from Frozen), then the state changes, the version increments and one `EnvironmentService/EnvironmentStateChanged` record with the matching `fromState` and `toState` and the `class` of the environment is written in the same transaction, and a `Retire` from Frozen lowers `connectsoft.factory.environments.frozen` by one for the tenant and class of the environment (SCN-EnvironmentService-007, ADR-0014).",
        "AC2: Given a pair of states that is not one of the five transitions, such as Draft to Frozen, Draft to Retired or Retired to Active, when the change is requested, then the aggregate rejects it, the state and the version are unchanged and no outbox record is written; given a transaction that rolls back after a transition, when the outbox is read, then neither the state change nor the record exists (SCN-EnvironmentService-007, ADR-0014).",
        "AC3: Given a committed transition, when the outbox dispatcher of the `environment` messaging profile publishes `EnvironmentService/EnvironmentStateChanged` on `projects.environments.v1.environment-state-changed`, then the event is sent under the run event envelope with `environmentId`, `tenantId`, `fromState`, `toState` and `class` and with the tenant in the envelope, so that the event of a Production environment states `class` Production on each of its transitions, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-EnvironmentService-007, ADR-0012).",
        "AC4: Given two concurrent transitions of one environment, when both commit, then one succeeds and the other fails the version check and writes nothing, so the sequence of `EnvironmentService/EnvironmentStateChanged` records of an environment is the sequence of its committed states (SCN-EnvironmentService-007, model/services/control-plane/EnvironmentService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/environment-service/index.md#domain-model",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1701",
        "AIFACTORY-TASK-1678",
        "AIFACTORY-TASK-1679"
      ],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5305,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentService"
        ],
        "aggregates": [
          "EnvironmentService/Environment"
        ],
        "events": [
          "EnvironmentService/EnvironmentStateChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "NFR-04"
        ],
        "scenarios": [
          "SCN-EnvironmentService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-409",
        "feature:contracts-package",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/environment-service/index.md#domain-model",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-412]",
      "number": 412
    },
    {
      "id": "AIFACTORY-TASK-1701",
      "type": "task",
      "parent": "AIFACTORY-US-412",
      "title": "Transition commands Activate and Retire with the outbox record of every transition and the frozen gauge",
      "sequence": "01.03.05.01",
      "description": "Transition commands Activate and Retire with the outbox record of every transition and the frozen gauge. Expected output: The application layer applies Activate and Retire as commands on the aggregate of AIFACTORY-TASK-011 under the tenant row filter and the version check, writes one EnvironmentStateChanged outbox record with fromState, toState and the class of the environment per committed transition in the same transaction, lowers connectsoft.factory.environments.frozen by one for tenant and class when Retire leaves Frozen, and hosts no REST route for the two commands, since the model names none; a rejected pair of states and a transaction that rolls back write no record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The application layer applies Activate and Retire as commands on the aggregate of AIFACTORY-TASK-011 under the tenant row filter and the version check, writes one EnvironmentStateChanged outbox record with fromState, toState and the class of the environment per committed transition in the same transaction, lowers connectsoft.factory.environments.frozen by one for tenant and class when Retire leaves Frozen, and hosts no REST route for the two commands, since the model names none; a rejected pair of states and a transaction that rolls back write no record."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5305,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1701]",
      "number": 1701
    },
    {
      "id": "AIFACTORY-TASK-1678",
      "type": "task",
      "parent": "AIFACTORY-US-412",
      "title": "Contract of EnvironmentStateChanged against the run event envelope of the contracts package",
      "sequence": "01.03.05.02",
      "description": "Contract of EnvironmentStateChanged against the run event envelope of the contracts package. Expected output: A golden file fixes EnvironmentStateChanged on the topic projects.environments.v1.environment-state-changed under run-event-envelope-v1 with environmentId, tenantId, fromState, toState and class (D117) and with the tenant in the envelope, once per transition; a contract test fails when the serialised event differs from the file or from docs/reference/schemas/run-event-envelope.schema.json.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "A golden file fixes EnvironmentStateChanged on the topic projects.environments.v1.environment-state-changed under run-event-envelope-v1 with environmentId, tenantId, fromState, toState and class (D117) and with the tenant in the envelope, once per transition; a contract test fails when the serialised event differs from the file or from docs/reference/schemas/run-event-envelope.schema.json."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5305,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1678]",
      "number": 1678
    },
    {
      "id": "AIFACTORY-TASK-1679",
      "type": "task",
      "parent": "AIFACTORY-US-412",
      "title": "Verify the state machine and the publication of EnvironmentStateChanged",
      "sequence": "01.03.05.03",
      "description": "Verify the state machine and the publication of EnvironmentStateChanged. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-EnvironmentService-007\"` and the unit tests of the aggregate; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-412: the five transitions with their records, the class of the environment in every record, the gauge after a Retire from Frozen, the rejected pairs, the rollback, the dispatch with a stopped transport and two concurrent transitions; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-EnvironmentService-007\"` and the unit tests of the aggregate; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-412: the five transitions with their records, the class of the environment in every record, the gauge after a Retire from Frozen, the rejected pairs, the rollback, the dispatch with a stopped transport and two concurrent transitions; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1679]",
      "number": 1679
    },
    {
      "id": "AIFACTORY-US-413",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-004",
      "title": "EnvironmentService handles once and inside the tenant what other services announce about an environment",
      "sequence": "01.03.06",
      "description": "As a platform admin, I want every event another service announces about an environment handled once and inside its tenant, and no handler registered before the increment that can prove it, so that a publisher of a later increment is served by the handlers built here, and a deletion order is executed and acknowledged only where the service that issues it exists. The model lists seven consumed events of EnvironmentService, and every one of them is published by a service of a later increment. EnvironmentPromotionService announces `PromotionCompleted` and `RollbackCompleted`, for which the handler `RecordCurrentRelease` records the release now running in the environment or the restored one. IaCProvisioningService announces `ProvisioningApplied`, for which `RecordProvisionedState` records the outputs of the applied provisioning on the environment. RuntimeEnvironmentService announces `ObservedStateChanged`, for which `RecordObservedHealth` keeps the last observed health of the environment. RetentionResidencyService announces `RetentionRuleChanged`, `DeletionOrderIssued` and `LegalHoldChanged`. For the first and the third, `ApplyRetentionRule` and `ApplyLegalHold` apply the retention period to the records the service owns and suspend or resume deletion and retention expiry for a held scope. The second is not handled in this increment (D119). The model gives its handler `ExecuteDeletionOrder` two duties, to delete the ordered scope from `environment-sql` and to acknowledge the order with a receipt through the operation AcknowledgeOrderTask of RetentionResidencyService, and it assigns that handler to I4: it is built and proven there together with RetentionResidencyService, the service that issues the order and receives the acknowledgement. This feature therefore registers no subscription and no handler for `DeletionOrderIssued`, builds no client of the acknowledgement operation and proves nothing against a fake of it. No governance order is left waiting by that, because before I4 no service exists that could issue one. What stays observable here is that nothing deletes an environment: the two retention handlers record the effective retention period and the hold for the rows of the tenant of the envelope and remove no row, so `ListEnvironments` keeps returning every environment of a project and `Environments.GetPolicyClass` keeps answering for each; the period and the hold they record are what `ExecuteDeletionOrder` reads when it arrives. The service registers the six subscriptions of this increment in the `OrleansMessaging` section of its own messaging profile with the service name `environment`. Its inbox deduplicates each delivery on the event id, and each handler reads the tenant from the envelope and never from the payload: a message without a tenant is not handled and goes to the poison handling of the profile, and a message for an environment that does not exist in that tenant is acknowledged without effect. A handler that fails is retried with backoff and poisoned at the attempt limit of the profile. The handlers are proven against contract fixtures of the six events built from the model, since no publisher exists yet; the publishers prove their side in their own features. The gateway consumes none of these events (ADR-0028 amendment on gateways and events). The `Environment` aggregate of the model has no field for the current release, the provisioned outputs or the observed health, so where the three recording handlers keep what they record is an open point this PBI does not decide: it delivers the subscriptions, the idempotent inbox, the tenant guard and the two retention handlers, and the recording follows the model once it names the fields; until then `RecordCurrentRelease`, `RecordProvisionedState` and `RecordObservedHealth` acknowledge their deliveries, leave the inbox record of the event id and change no row. The failure mode of the model stands: when the provisioning reconciler sends no observed state, the environment keeps its desired references and reconciliation resumes later. Kind: behavior. Traces: services: EnvironmentService; aggregates: EnvironmentService/Environment; apis: EnvironmentService/ListEnvironments, EnvironmentService/Environments.GetPolicyClass; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-409, AIFACTORY-US-410, feature:contracts-package, feature:component-base-template-factory-profile. Sources: model/services/control-plane/EnvironmentService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/planes/control/services/environment-service/index.md#messages, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the messaging profile of the service, when it starts, then the `OrleansMessaging` section declares one subscription with its handler for each of the six consumed events this increment handles, that is every consumed event of model/services/control-plane/EnvironmentService.yaml except `DeletionOrderIssued`, whose handler the model assigns to I4 with RetentionResidencyService (D119), it declares none for that event, startup fails when a consumed event listed in the service descriptor file of the repository has no subscription, and ControlPlaneApi subscribes to none of them (ADR-0028).",
        "AC2: Given a contract fixture of each of the six handled events under the run event envelope, when it is delivered twice with the same event id, then the inbox holds exactly one record of that event id, which is the proof of a handled delivery, the effect of the handler exists once and the second delivery is acknowledged without effect; `RecordCurrentRelease`, `RecordProvisionedState` and `RecordObservedHealth` acknowledge their deliveries and change no row until the model names the fields they record; given a fixture without a tenant in the envelope, when it is delivered, then it is not handled, leaves no handled inbox record and is poisoned with its reason (ADR-0014, ADR-0012).",
        "AC3: Given a `RetentionRuleChanged` fixture and a `LegalHoldChanged` fixture for a scope that holds environments of one tenant, when both are handled, then the effective retention period and the hold are recorded once per event id for the rows of that tenant, rows of another tenant are never touched and no row is deleted, so `EnvironmentService/ListEnvironments` still returns every environment of the scope and `EnvironmentService/Environments.GetPolicyClass` still answers for each; and given a `DeletionOrderIssued` message published on its topic, then the service holds no subscription for it, so nothing is handled, deleted or acknowledged in this increment, the handler `ExecuteDeletionOrder` with its deletion and its acknowledgement through AcknowledgeOrderTask being delivered and proven in I4 with RetentionResidencyService (D119, ADR-0015, model/services/control-plane/EnvironmentService.yaml).",
        "AC4: Given a handler that throws, when the delivery is retried, then it is retried with backoff and poisoned for this subscriber at the attempt limit of the profile, the other subscriptions keep delivering, and the `EnvironmentService/Environment` rows are unchanged by the failed deliveries (ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/control/services/environment-service/index.md#messages",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-014",
        "AIFACTORY-TASK-1680",
        "AIFACTORY-TASK-1681",
        "AIFACTORY-TASK-1682"
      ],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5306,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentService"
        ],
        "aggregates": [
          "EnvironmentService/Environment"
        ],
        "apis": [
          "EnvironmentService/ListEnvironments",
          "EnvironmentService/Environments.GetPolicyClass"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-409",
        "AIFACTORY-US-410",
        "feature:contracts-package",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/control/services/environment-service/index.md#messages",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-413]",
      "number": 413
    },
    {
      "id": "AIFACTORY-TASK-014",
      "type": "task",
      "parent": "AIFACTORY-US-413",
      "title": "Messaging wiring of the environment profile: outbox for 2 published events and inbox subscriptions for 6 of the 7 consumed events",
      "sequence": "01.03.06.01",
      "description": "Messaging wiring of the environment profile: outbox for 2 published events and inbox subscriptions for 6 of the 7 consumed events. Expected output: The OrleansMessaging section declares the service name environment, the two published events EnvironmentCreated and EnvironmentStateChanged with their topics and the six subscriptions this increment handles with their handlers, and none for DeletionOrderIssued, whose handler is delivered in I4 with RetentionResidencyService (D119); the outbox writer enlists in the unit of work of each command, the inbox deduplicates on the event id and each handler reads the tenant from the run event envelope and refuses a message without one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The OrleansMessaging section declares the service name environment, the two published events EnvironmentCreated and EnvironmentStateChanged with their topics and the six subscriptions this increment handles with their handlers, and none for DeletionOrderIssued, whose handler is delivered in I4 with RetentionResidencyService (D119); the outbox writer enlists in the unit of work of each command, the inbox deduplicates on the event id and each handler reads the tenant from the run event envelope and refuses a message without one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-014]",
      "number": 14
    },
    {
      "id": "AIFACTORY-TASK-1680",
      "type": "task",
      "parent": "AIFACTORY-US-413",
      "title": "Contract fixtures of the six consumed events this increment handles, built from the model",
      "sequence": "01.03.06.02",
      "description": "Contract fixtures of the six consumed events this increment handles, built from the model. Expected output: The acceptance suite holds one fixture per consumed event of model/services/control-plane/EnvironmentService.yaml that this increment handles, that is every one except DeletionOrderIssued, under run-event-envelope-v1 with the payload fields its producer declares in the model, a duplicate of each with the same event id and a variant without a tenant in the envelope; it holds no fake of the acknowledgement operation of RetentionResidencyService, because the deletion order and its acknowledgement are proven in I4 against the service itself (D119).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "The acceptance suite holds one fixture per consumed event of model/services/control-plane/EnvironmentService.yaml that this increment handles, that is every one except DeletionOrderIssued, under run-event-envelope-v1 with the payload fields its producer declares in the model, a duplicate of each with the same event id and a variant without a tenant in the envelope; it holds no fake of the acknowledgement operation of RetentionResidencyService, because the deletion order and its acknowledgement are proven in I4 against the service itself (D119)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5306,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1680]",
      "number": 1680
    },
    {
      "id": "AIFACTORY-TASK-1681",
      "type": "task",
      "parent": "AIFACTORY-US-413",
      "title": "Retention handlers: ApplyRetentionRule and ApplyLegalHold over the rows the service owns",
      "sequence": "01.03.06.03",
      "description": "Retention handlers: ApplyRetentionRule and ApplyLegalHold over the rows the service owns. Expected output: The two handlers apply the effective retention period to the rows of environment-sql and suspend or resume deletion and retention expiry for a held scope, inside the tenant of the envelope; each is idempotent on the event id, never touches rows of another tenant and deletes no row. ExecuteDeletionOrder is not built here: the deletion of an ordered scope and the acknowledgement of the order through AcknowledgeOrderTask of model/services/data-event/RetentionResidencyService.yaml are delivered and proven in I4 with RetentionResidencyService (D119), and until then the service registers no subscription for DeletionOrderIssued and holds no client of the acknowledgement operation.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "The two handlers apply the effective retention period to the rows of environment-sql and suspend or resume deletion and retention expiry for a held scope, inside the tenant of the envelope; each is idempotent on the event id, never touches rows of another tenant and deletes no row. ExecuteDeletionOrder is not built here: the deletion of an ordered scope and the acknowledgement of the order through AcknowledgeOrderTask of model/services/data-event/RetentionResidencyService.yaml are delivered and proven in I4 with RetentionResidencyService (D119), and until then the service registers no subscription for DeletionOrderIssued and holds no client of the acknowledgement operation."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1681]",
      "number": 1681
    },
    {
      "id": "AIFACTORY-TASK-1682",
      "type": "task",
      "parent": "AIFACTORY-US-413",
      "title": "Verify the inbox handlers against the contract fixtures",
      "sequence": "01.03.06.04",
      "description": "Verify the inbox handlers against the contract fixtures. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-413: the six subscriptions of this increment out of the seven consumed events of model/services/control-plane/EnvironmentService.yaml and none for DeletionOrderIssued, the duplicate delivery with its one inbox record, the three recording handlers that change no row, the message without a tenant, the retention rule and the legal hold recorded once inside the tenant with no environment deleted and both reads unchanged, a DeletionOrderIssued message that is neither handled nor acknowledged, and the poisoned delivery.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-413: the six subscriptions of this increment out of the seven consumed events of model/services/control-plane/EnvironmentService.yaml and none for DeletionOrderIssued, the duplicate delivery with its one inbox record, the three recording handlers that change no row, the message without a tenant, the retention rule and the legal hold recorded once inside the tenant with no environment deleted and both reads unchanged, a DeletionOrderIssued message that is neither handled nor acknowledged, and the poisoned delivery."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 53,
      "phase": "factory",
      "stackRank": 5306,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1682]",
      "number": 1682
    },
    {
      "id": "AIFACTORY-FEAT-005",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "ProjectService: complete delivery",
      "sequence": "01.04",
      "description": "ProjectService is the service of bounded context BC-01 (Project & Environment). Owns projects (workspaces) inside a tenant, their memberships and role assignments, source scope and project-level policy overrides; the scope ids every run carries (BC-01). Its own repository is ConnectSoft.AI.SoftwareFactory.ProjectService. Delivers: ProjectService (complete). Increment I1: Generate a microservice. Build order 54 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-056",
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "AIFACTORY-US-443",
        "AIFACTORY-US-444",
        "AIFACTORY-US-445",
        "AIFACTORY-US-1494",
        "AIFACTORY-US-446",
        "AIFACTORY-US-458",
        "AIFACTORY-US-447",
        "AIFACTORY-US-448",
        "AIFACTORY-US-449",
        "AIFACTORY-US-550"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5400,
      "titlePrefix": "[AIFACTORY-FEAT-005]",
      "number": 5
    },
    {
      "id": "AIFACTORY-US-056",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "ProjectService serves its scope end to end",
      "sequence": "01.04.01",
      "description": "As a platform admin, I want one service to own the projects of my tenant, who may act in each of them in which role, and what a run of a project may touch, so that every run, approval, usage record and artifact of the Factory carries a project scope that one owner answers for. This is the integration PBI of the feature: it proves that the behaviours of ProjectService work together on a deployed instance, in the order a tenant uses them. A Platform admin creates a project and becomes its first Workspace admin (AIFACTORY-US-443); the Workspace admin grants a project role to a second member (AIFACTORY-US-446) and the membership projection follows from the events of the Identity service (AIFACTORY-US-458); the Workspace admin delegates a role for a bounded period and revokes it (AIFACTORY-US-447), and sets what a run of the project may touch (AIFACTORY-US-448); a service with a workload identity resolves the roles and the source scope of a subject through `ProjectService/Projects.ResolveScope` (AIFACTORY-US-445), and the members who hold a role in the project are listed through `ProjectService/Projects.ListRoleHolders` (AIFACTORY-US-1494, D136); members list and read their projects (AIFACTORY-US-444); the Workspace admin suspends the project with a reason and resumes it (AIFACTORY-US-550); the Workspace admin closes the project and the off-boarding brings it to Closed once RunControlService has confirmed that its runs are settled and ArtifactService that its data was exported or deleted (AIFACTORY-US-449). The repository and the store come from AIFACTORY-US-441 and the hosted surface from AIFACTORY-US-442. The Identity service is the system of record of role assignments and delegations (ADR-0015 amendments of D114 and D115): the chain runs against an Identity service generated from the identity template with the Factory role catalogue, to which ProjectService writes with its own workload token and a named actor, and from whose events it keeps the `Memberships` and `Delegations` projection. The service is deployed as its own workload with its own store `project-sql` and its own messaging service name `project`, and it is reached through the routes of the platform gateway (ADR-0028). Every call carries a trusted tenant: a project of another tenant is answered 404 by every route and NOT_FOUND over gRPC, a missing scope inside the tenant of the caller 403. The five events of the service are written to the outbox in the transaction of the change they announce and published in the run event envelope of the contracts package. What this delivery does not hold is stated here and in the PBI it belongs to. The handlers of the three retention events are not built, because their producer RetentionResidencyService is first delivered in I4, and the legal-hold and deletion-order handlers are built in this repository in I4 by feature `retention-residency-service` (D137). No command of the model sets `policyOverrideRevision`: the field stays empty, the validation call to PolicyEngineService that the model lists as a required dependency is not built, and the aggregate enforces the fourth invariant as empty or validated. `budgetId` stays empty and the optional gRPC dependency on CostUsageService is not used: the budget of a project is opened by CostUsageService from `ProjectService/ProjectCreated`, CostUsageService has no method that creates a budget, and ProjectService consumes no event that would bring the budget id back. The points about `policyOverrideRevision` and `budgetId` are gaps of the model that are reported to the owner and are not decided in this feature. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Kind: behavior. Traces: services: ProjectService, ControlPlaneApi; aggregates: ProjectService/Project; apis: ProjectService/CreateProject, ProjectService/ListProjects, ProjectService/GetProject, ProjectService/SetMembership, ProjectService/Delegate, ProjectService/RevokeDelegation, ProjectService/SetSourceScope, ProjectService/CloseProject, ProjectService/SuspendProject, ProjectService/ResumeProject, ProjectService/Projects.ResolveScope, ProjectService/Projects.ListRoleHolders; events: ProjectService/ProjectCreated, ProjectService/ProjectStateChanged, ProjectService/MembershipChanged, ProjectService/DelegationChanged, ProjectService/SourceScopeChanged, RunControlService/ProjectRunsSettled, ArtifactService/ProjectDataOffboarded; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: FR-01, XL-01, XL-13, NFR-01. Relates: screens: project-overview, project-settings; nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, AIFACTORY-US-443, AIFACTORY-US-444, AIFACTORY-US-445, AIFACTORY-US-446, AIFACTORY-US-447, AIFACTORY-US-448, AIFACTORY-US-449, AIFACTORY-US-458, AIFACTORY-US-550, AIFACTORY-US-1494, feature:control-plane-api, feature:component-identity-template-factory-roles, feature:run-control-service, feature:artifact-service. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/services/project-service/index.md.",
      "acceptanceCriteria": [
        "AC1: Given ProjectService deployed from the repository of AIFACTORY-US-441 behind the platform gateway and an Identity service generated from the identity template with the Factory role catalogue, when a Platform admin calls `ProjectService/CreateProject` and then, as the Workspace admin of the new project, `ProjectService/SetMembership` for a second member with the role Reviewer, then `ProjectService/Projects.ResolveScope` for that member returns the role Reviewer, and `ProjectService/ProjectCreated` and `ProjectService/MembershipChanged` are each published once in the run event envelope (ADR-0015, FR-01).",
        "AC2: Given the same project, when the Workspace admin calls `ProjectService/SetSourceScope` with one repository and one tool, `ProjectService/Delegate` for a third member with an expiry and a reason, and then `ProjectService/RevokeDelegation`, then `ProjectService/Projects.ResolveScope` returns the stated source scope, returns the delegated role only between the grant and the revocation, and `ProjectService/SourceScopeChanged` and two `ProjectService/DelegationChanged` events are published (ADR-0015, XL-01).",
        "AC3: Given projects of two tenants, when a member of the first tenant calls `ProjectService/ListProjects` and addresses a project of the second tenant through `ProjectService/GetProject`, `ProjectService/SetMembership`, `ProjectService/SetSourceScope` and `ProjectService/CloseProject`, then the list holds projects of the first tenant only, every addressed call is answered 404, the same answer as for a project that does not exist, and a call without the scope of its route inside the own tenant is answered 403 (ADR-0015, NFR-01).",
        "AC4: Given the project of AC1 with an unexpired delegation, when the Workspace admin calls `ProjectService/CloseProject`, then the response is 202, `ProjectService/ProjectStateChanged` announces Closing, the delegation is revoked through the Identity service, the `ProjectService/Project` stays Closing until `RunControlService/ProjectRunsSettled` and `ArtifactService/ProjectDataOffboarded` have both arrived, and it then reaches Closed with a second `ProjectService/ProjectStateChanged` (XL-13).",
        "AC5: Given the acceptance suite of the repository, when it runs against the deployed instance, then each of the seventeen scenarios of model/scenarios/ProjectService.yaml is executed by at least one test that carries its scenario id, a filter that matches no test counts as a failure, and the suite passes."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1801",
        "AIFACTORY-TASK-701"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5401,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService",
          "ControlPlaneApi"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/CreateProject",
          "ProjectService/ListProjects",
          "ProjectService/GetProject",
          "ProjectService/SetMembership",
          "ProjectService/Delegate",
          "ProjectService/RevokeDelegation",
          "ProjectService/SetSourceScope",
          "ProjectService/CloseProject",
          "ProjectService/SuspendProject",
          "ProjectService/ResumeProject",
          "ProjectService/Projects.ResolveScope",
          "ProjectService/Projects.ListRoleHolders"
        ],
        "events": [
          "ProjectService/ProjectCreated",
          "ProjectService/ProjectStateChanged",
          "ProjectService/MembershipChanged",
          "ProjectService/DelegationChanged",
          "ProjectService/SourceScopeChanged",
          "RunControlService/ProjectRunsSettled",
          "ArtifactService/ProjectDataOffboarded"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "XL-01",
          "XL-13",
          "NFR-01"
        ]
      },
      "relates": {
        "screens": [
          "project-overview",
          "project-settings"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "AIFACTORY-US-443",
        "AIFACTORY-US-444",
        "AIFACTORY-US-445",
        "AIFACTORY-US-446",
        "AIFACTORY-US-447",
        "AIFACTORY-US-448",
        "AIFACTORY-US-449",
        "AIFACTORY-US-458",
        "AIFACTORY-US-550",
        "AIFACTORY-US-1494",
        "feature:control-plane-api",
        "feature:component-identity-template-factory-roles",
        "feature:run-control-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md"
      ],
      "titlePrefix": "[AIFACTORY-US-056]",
      "number": 56
    },
    {
      "id": "AIFACTORY-TASK-1801",
      "type": "task",
      "parent": "AIFACTORY-US-056",
      "title": "Deploy ProjectService as its own workload with its store, its messaging service name and its gateway routes",
      "sequence": "01.04.01.01",
      "description": "Deploy ProjectService as its own workload with its store, its messaging service name and its gateway routes. Expected output: ProjectService runs as its own workload from the manifests the template generates, with its own relational store `project-sql`, the messaging service name `project`, the transport credential read from the secret reference `messaging-transport`, the address of the Identity service and the workload credential it writes with; the ten REST routes are reachable through the platform gateway and readiness answers ready only after the store is migrated and the messaging profile has started (ADR-0028).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "ProjectService runs as its own workload from the manifests the template generates, with its own relational store `project-sql`, the messaging service name `project`, the transport credential read from the secret reference `messaging-transport`, the address of the Identity service and the workload credential it writes with; the ten REST routes are reachable through the platform gateway and readiness answers ready only after the store is migrated and the messaging profile has started (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5401,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1801]",
      "number": 1801
    },
    {
      "id": "AIFACTORY-TASK-701",
      "type": "task",
      "parent": "AIFACTORY-US-056",
      "title": "Verify project-service-serves-its-scope through the end-to-end chain of the acceptance suite",
      "sequence": "01.04.01.02",
      "description": "Verify project-service-serves-its-scope through the end-to-end chain of the acceptance suite. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build --filter \"Category=Acceptance\"` against the deployed instance and the generated Identity service; a filter that matches no test counts as a failure; the chain create, grant, delegate, set scope, resolve, read, suspend, resume and close passes, the close reaching Closed only after the confirmations of RunControlService and ArtifactService of the same environment, and every scenario id of model/scenarios/ProjectService.yaml is carried by at least one passing test, which proves AC1 to AC5 of AIFACTORY-US-056.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build --filter \"Category=Acceptance\"` against the deployed instance and the generated Identity service; a filter that matches no test counts as a failure; the chain create, grant, delegate, set scope, resolve, read, suspend, resume and close passes, the close reaching Closed only after the confirmations of RunControlService and ArtifactService of the same environment, and every scenario id of model/scenarios/ProjectService.yaml is carried by at least one passing test, which proves AC1 to AC5 of AIFACTORY-US-056."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-701]",
      "number": 701
    },
    {
      "id": "AIFACTORY-US-441",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "ProjectService repository: scaffolded from the base template with the Factory profile, with the Project aggregate and its store project-sql",
      "sequence": "01.04.02",
      "description": "The repository ConnectSoft.AI.SoftwareFactory.ProjectService is created and scaffolded in I0 by AIFACTORY-TASK-016 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold, made with the scaffold command of ADR-0028 and its amendment on the Factory profile switch (D114): `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ProjectService --UseFactoryProfile true`, from the template package at the version the gate of feature `component-base-template-factory-profile` published (AIFACTORY-US-230), after the findings of feature `component-base-template-findings` are closed (AIFACTORY-US-235). The generated output is committed unchanged and the repository records the version of the template package it was generated from. What the profile generates, that is the Orleans messaging profile with an outbox and an inbox of the service, the propagation of the trusted tenant and project scope, the role policies, the REST and gRPC hosts from a service descriptor, health and telemetry, is the work of the template feature; it is consumed by that version pin and is neither rewritten nor forked here. The run event envelope and the event type names come from the contracts package by a version pin as well. On that scaffold this PBI adds the domain and the store. The `Project` aggregate holds `projectId`, `tenantId`, `key`, `name`, `state`, `region`, the optional `policyOverrideRevision`, `retentionDays`, the optional `budgetId` and a `version`, with the entities `Membership`, `Delegation` and `SourceScopeEntry` and the value object `ProjectKey`, a lower-case key of 3 to 32 characters. The `region` of a project is the region of its tenant, whose source is the options `DataEvent:Stores:DefaultRegion` and `DataEvent:Stores:AllowedRegions`, bound by StoreProfileService in I4 (AIFACTORY-US-049); in I1 to I3 those two values are owner inputs of the I1 precondition register of AIFACTORY-US-1339 (D140). It enforces the invariants the aggregate can hold on its own: a key is unique within a tenant and immutable after creation, and `policyOverrideRevision` is empty or is set through an operation that demands a validation result. No command of the model calls that operation, so the field stays empty in this delivery, and so does `budgetId`, which nothing sets. The invariants that span services are enforced where they act: a membership or a delegation exists as a row only for a record the Identity service announced (AIFACTORY-US-458, AIFACTORY-US-447), and closing follows the off-boarding of AIFACTORY-US-449. The state machine has exactly five transitions: Active to Suspended (`Suspend`), Suspended to Active (`Resume`), Active to Closing and Suspended to Closing (`Close`), and Closing to Closed (`OffboardingCompleted`). The store `project-sql` is owned by this service alone, and this PBI migrates four of the five tables of the model, `Projects`, `Memberships`, `Delegations` and `SourceScopes`, with the unique index over tenant and key, the filtered index over grantee and expiry for unrevoked delegations, a row version on `Projects` and the tenant filter in every mapping. `Memberships` and `Delegations` are a projection of the records of the Identity service (ADR-0015 amendment of D114): no command writes them, only the inbox handlers of AIFACTORY-US-458 and AIFACTORY-US-447 do. The fifth table, the off-boarding journal `OffboardingJournal`, and the columns `ClosedBy` and `CloseRequestedAt` of the closing actor, which the model holds since D117, are added by the migration task of AIFACTORY-US-449. Nothing is observable for a caller yet; the routes and the messaging profile are hosted by AIFACTORY-US-442. Kind: enabling. Traces: services: ProjectService; aggregates: ProjectService/Project; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: NFR-01. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package. Sources: model/services/control-plane/ProjectService.yaml, model/template-parameters/connectsoft-base.yaml, model/stores.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/control/services/project-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-016 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ProjectService --UseFactoryProfile true` from the base template package at the version the gate of feature `component-base-template-factory-profile` published, when its pipeline runs, then the committed output equals the generated output, the solution builds in Release, the generated tests pass, a container image is published and the repository records the template version (ADR-0028, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given the `ProjectService/Project` aggregate, when its unit tests run, then a key outside 3 to 32 lower-case characters and a change of the key after creation are refused, `policyOverrideRevision` is accepted only empty or together with a validation result, as the fourth invariant of model/services/control-plane/ProjectService.yaml demands, the five transitions Active to Suspended, Suspended to Active, Active to Closing, Suspended to Closing and Closing to Closed are accepted, and every other transition, among them Closed to Active and Closing to Active, is refused.",
        "AC3: Given `project-sql` created by the migrations of the repository on an isolated test database, when the mapping tests run, then the tables `Projects`, `Memberships`, `Delegations` and `SourceScopes` exist with their keys and indexes, a second project with the same key in one tenant violates the unique index while the same key in another tenant is accepted, and a query made for one tenant never returns a row of another (ADR-0015, NFR-01)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/services/project-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-017",
        "AIFACTORY-TASK-018",
        "AIFACTORY-TASK-1802"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5402,
      "kind": "enabling",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/services/project-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-441]",
      "number": 441
    },
    {
      "id": "AIFACTORY-TASK-017",
      "type": "task",
      "parent": "AIFACTORY-US-441",
      "title": "Domain model: Project with Membership, Delegation, SourceScopeEntry and ProjectKey",
      "sequence": "01.04.02.01",
      "description": "Domain model: Project with Membership, Delegation, SourceScopeEntry and ProjectKey. Expected output: The Project aggregate with its entities and the ProjectKey value object enforces the key invariants of the model, accepts policyOverrideRevision only empty or together with a validation result, and exposes the operations Suspend, Resume, Close and OffboardingCompleted, which are the only transitions between Active, Suspended, Closing and Closed; unit tests cover the key rules, the override rule, each of the five transitions and the refusal of every other one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Project aggregate with its entities and the ProjectKey value object enforces the key invariants of the model, accepts policyOverrideRevision only empty or together with a validation result, and exposes the operations Suspend, Resume, Close and OffboardingCompleted, which are the only transitions between Active, Suspended, Closing and Closed; unit tests cover the key rules, the override rule, each of the five transitions and the refusal of every other one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-017]",
      "number": 17
    },
    {
      "id": "AIFACTORY-TASK-018",
      "type": "task",
      "parent": "AIFACTORY-US-441",
      "title": "Persistence in project-sql: Projects, Memberships, Delegations, SourceScopes",
      "sequence": "01.04.02.02",
      "description": "Persistence in project-sql: Projects, Memberships, Delegations, SourceScopes. Expected output: Mappings and migrations for these four tables of the model, the fifth, OffboardingJournal, being migrated by AIFACTORY-TASK-1845, with the unique index UX_Projects_Tenant_Key, the filtered index IX_Delegations_Grantee_Active, the row version of Projects and the tenant filter in every mapping; Memberships and Delegations are written by the projection handlers only; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for these four tables of the model, the fifth, OffboardingJournal, being migrated by AIFACTORY-TASK-1845, with the unique index UX_Projects_Tenant_Key, the filtered index IX_Delegations_Grantee_Active, the row version of Projects and the tenant filter in every mapping; Memberships and Delegations are written by the projection handlers only; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5402,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-018]",
      "number": 18
    },
    {
      "id": "AIFACTORY-TASK-1802",
      "type": "task",
      "parent": "AIFACTORY-US-441",
      "title": "Verify the scaffold, the Project aggregate and the store of ProjectService",
      "sequence": "01.04.02.03",
      "description": "Verify the scaffold, the Project aggregate and the store of ProjectService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the aggregate and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-441 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the aggregate and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-441 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1802]",
      "number": 1802
    },
    {
      "id": "AIFACTORY-US-442",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "ProjectService host: ten REST routes and two gRPC methods behind scope policies, the project messaging profile, the Identity contracts and write client, tenancy and telemetry",
      "sequence": "01.04.03",
      "description": "This PBI turns the scaffold of AIFACTORY-US-441 into a host on which the behaviour PBIs of the feature land. From the service descriptor the host exposes the ten REST operations of the model, `SuspendProject` and `ResumeProject` among them (D117), for the platform gateway (GW-03) and the two internal gRPC methods `Projects.ResolveScope` and `Projects.ListRoleHolders` (D136), with their contract documents, an OpenAPI document and a proto. Tokens are validated through the resource-server library the profile wires, and each route requires its scope: `factory.projects.read` for the two reads, `factory.projects.write` for creation, `factory.projects.admin` for memberships, source scope, close, suspend and resume, and `factory.projects.delegate` for the two delegation routes; each gRPC method requires a workload identity whose token holds the service scope that names ProjectService. The tenant comes from the token. Eight of the ten routes address a project by `projectId`, and such a route admits the call only when the role claims of the token name that project or carry a tenant-wide role; `CreateProject` and `ListProjects` address no project. A resource of another tenant is invisible under the tenant row filter and is answered 404, over gRPC NOT_FOUND, while a missing scope inside the tenant of the caller is answered 403 (ADR-0015 amendments of D113 and D114); the filter is wired here and the 404 is proven by the behaviour PBIs that read a project. Every modelled refusal code has a problem response. The two operations with a key-header idempotency rule, `CreateProject` and `Delegate`, pass an idempotency filter: the same `Idempotency-Key` with the same input returns the stored result, the same key with a different input is a conflict (ADR-0014 decision 3). The messaging profile of the service is named `project`: the outbox writer enlists in the unit of work of a command, the dispatcher publishes the five events of the model in the run event envelope of the contracts package with their routes declared in the `OrleansMessaging` section, and the inbox subscribes, with deduplication on the event id, to the assignment and delegation events of the Identity service and to the two confirmations of a closing project, `ProjectRunsSettled` of RunControlService and `ProjectDataOffboarded` of ArtifactService (D117); what each handler does is delivered by AIFACTORY-US-458, AIFACTORY-US-447 and AIFACTORY-US-449. The host also brings what every command that writes roles needs. The repository pins the ServiceModel package of the identity template at the version the gate AIFACTORY-US-243 of feature `component-identity-template-factory-roles` published and takes the role assignment and delegation requests, responses and events from it. That feature publishes contracts and no client for these writes, the only HTTP client it names being the claims client of the authorization server template, so the write client is built in this repository on the pinned contracts: it sends the workload token of ProjectService, names the acting member on every write and never forwards a user token (ADR-0015 amendment of D115). The options `Projects:Retention:DefaultRetentionDays`, `Projects:Delegation:MaxDelegationDays`, `Multitenancy:DeploymentKind` and `OrleansMessaging:ServiceName` are bound and validated at start, the transport credential is read from the secret reference `messaging-transport`, the metrics `connectsoft.factory.projects.active` and `connectsoft.factory.projects.delegations_active` are registered with the tenant dimension, and readiness reports the store, the messaging profile and the Identity service. The model also lists three consumed events of RetentionResidencyService (`RetentionRuleChanged`, `DeletionOrderIssued`, `LegalHoldChanged`). Their handlers are not part of this delivery: that service is first delivered in I4, and the owner decided that the legal-hold and deletion-order handlers of each owning service are built in its repository in I4 by feature `retention-residency-service` (D137), so nothing of a later increment is built against here. Kind: enabling. Traces: services: ProjectService; aggregates: ProjectService/Project; descriptors: run-event-envelope-v1, execution-scope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028; requirements: FR-01, NFR-01. Depends on: AIFACTORY-US-441, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-identity-template-factory-roles. Sources: model/services/control-plane/ProjectService.yaml, model/gateways.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/control/services/project-service/index.md#apis, docs/planes/control/services/project-service/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given the hosted service, when each of the ten REST operations of model/services/control-plane/ProjectService.yaml is called without a token and with a token that lacks the scope of the route, then the answers are 401 and 403 with a problem response; when one of the eight operations that address a `projectId` is called with a token of the tenant whose role claims neither name that project nor carry a tenant-wide role, then the answer is 403; a gRPC call without a workload identity or without the service scope is refused with Unauthenticated or PermissionDenied; no state changes (ADR-0015).",
        "AC2: Given an operation with the key-header idempotency rule, when two requests carry the same `Idempotency-Key` and the same input, then the second returns the stored result and the handler runs once; when the second carries a different input, then it is answered 409 (ADR-0014).",
        "AC3: Given a handler that changes a `ProjectService/Project` and publishes one of the five declared events, when its unit of work commits, then one outbox record in `run-event-envelope-v1` with event id, tenant id, project id, correlation id and payload is committed in the same transaction; when the unit of work rolls back, neither the change nor the record exists; a publish of an event the `OrleansMessaging` section does not declare throws (ADR-0012, ADR-0014).",
        "AC4: Given the service starts, when liveness and readiness are probed, then readiness answers ready only after `project-sql` is migrated and the messaging profile has started and names the dependency while it is unready, the four options of model/services/control-plane/ProjectService.yaml are bound and an invalid value stops the start with the key named, and traces and logs carry the tenant and project scope of the call (ADR-0015).",
        "AC5: Given the write client of the role assignment and delegation API built on the pinned ServiceModel contracts, when it sends a grant, a removal, a delegation or a revocation, then the request carries the workload token of ProjectService and the acting member and no user token, and an answer of the Identity service that the record already exists, a refused actor, a record that is not found and an unavailable service each come back as their own typed result, on which the commands of AIFACTORY-US-443, AIFACTORY-US-446, AIFACTORY-US-447 and AIFACTORY-US-449 decide (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/control/services/project-service/index.md#apis",
        "docs/planes/control/services/project-service/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-019",
        "AIFACTORY-TASK-020",
        "AIFACTORY-TASK-1813",
        "AIFACTORY-TASK-1843",
        "AIFACTORY-TASK-022",
        "AIFACTORY-TASK-1803"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5403,
      "kind": "enabling",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "NFR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-441",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-identity-template-factory-roles"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/control/services/project-service/index.md#apis",
        "docs/planes/control/services/project-service/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-442]",
      "number": 442
    },
    {
      "id": "AIFACTORY-TASK-019",
      "type": "task",
      "parent": "AIFACTORY-US-442",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 10 REST operations and 2 gRPC methods",
      "sequence": "01.04.03.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 10 REST operations and 2 gRPC methods. Expected output: The ten REST routes and the gRPC methods Projects.ResolveScope and Projects.ListRoleHolders are hosted from the service descriptor with token validation, scope enforcement per route, the workload identity and service scope check on each gRPC method, problem responses for every modelled refusal code, the Idempotency-Key filter of CreateProject and Delegate, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-443 to AIFACTORY-US-449, AIFACTORY-US-550 and AIFACTORY-US-1494, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The ten REST routes and the gRPC methods Projects.ResolveScope and Projects.ListRoleHolders are hosted from the service descriptor with token validation, scope enforcement per route, the workload identity and service scope check on each gRPC method, problem responses for every modelled refusal code, the Idempotency-Key filter of CreateProject and Delegate, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-443 to AIFACTORY-US-449, AIFACTORY-US-550 and AIFACTORY-US-1494, not here."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-019]",
      "number": 19
    },
    {
      "id": "AIFACTORY-TASK-020",
      "type": "task",
      "parent": "AIFACTORY-US-442",
      "title": "Messaging skeleton: outbox and inbox wiring of the project profile for 5 published events, the Identity events of the projection and the two confirmations of a closing project",
      "sequence": "01.04.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the project profile for 5 published events, the Identity events of the projection and the two confirmations of a closing project. Expected output: The outbox writer enlists in the unit of work and the dispatcher of the project messaging profile publishes ProjectCreated, ProjectStateChanged, MembershipChanged, DelegationChanged and SourceScopeChanged in the run event envelope of the pinned contracts package, each declared with its route in the OrleansMessaging section; the inbox subscribes, with deduplication on the event id, to the assignment and delegation events of the Identity service and to ProjectRunsSettled of RunControlService and ProjectDataOffboarded of ArtifactService; the three retention events of RetentionResidencyService are not subscribed in this delivery; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work and the dispatcher of the project messaging profile publishes ProjectCreated, ProjectStateChanged, MembershipChanged, DelegationChanged and SourceScopeChanged in the run event envelope of the pinned contracts package, each declared with its route in the OrleansMessaging section; the inbox subscribes, with deduplication on the event id, to the assignment and delegation events of the Identity service and to ProjectRunsSettled of RunControlService and ProjectDataOffboarded of ArtifactService; the three retention events of RetentionResidencyService are not subscribed in this delivery; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-020]",
      "number": 20
    },
    {
      "id": "AIFACTORY-TASK-1813",
      "type": "task",
      "parent": "AIFACTORY-US-442",
      "title": "Pin of the role and delegation contracts and events of the Identity service",
      "sequence": "01.04.03.03",
      "description": "Pin of the role and delegation contracts and events of the Identity service. Expected output: The repository pins the ServiceModel package of the identity template at the version the gate AIFACTORY-US-243 of feature component-identity-template-factory-roles published and takes from it the role assignment and delegation requests, responses and events; it copies no type, and the workload credential of ProjectService holds the service scope of the role writes.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The repository pins the ServiceModel package of the identity template at the version the gate AIFACTORY-US-243 of feature component-identity-template-factory-roles published and takes from it the role assignment and delegation requests, responses and events; it copies no type, and the workload credential of ProjectService holds the service scope of the role writes."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5403,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1813]",
      "number": 1813
    },
    {
      "id": "AIFACTORY-TASK-1843",
      "type": "task",
      "parent": "AIFACTORY-US-442",
      "title": "Write client of the role assignment and delegation API of the Identity service",
      "sequence": "01.04.03.04",
      "description": "Write client of the role assignment and delegation API of the Identity service. Expected output: An HTTP client of the role assignment and delegation write API of the Identity service, built in this repository on the pinned ServiceModel contracts because the identity feature publishes no client for these writes: it sends the workload token of ProjectService and names the acting member on every grant, removal, delegation and revocation, never forwards a user token, and returns a typed result for accepted, already exists, refused actor (403), not found (404) and unavailable; unit tests cover the 403, the 404, the conflict and the unavailable answer.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An HTTP client of the role assignment and delegation write API of the Identity service, built in this repository on the pinned ServiceModel contracts because the identity feature publishes no client for these writes: it sends the workload token of ProjectService and names the acting member on every grant, removal, delegation and revocation, never forwards a user token, and returns a typed result for accepted, already exists, refused actor (403), not found (404) and unavailable; unit tests cover the 403, the 404, the conflict and the unavailable answer."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1843]",
      "number": 1843
    },
    {
      "id": "AIFACTORY-TASK-022",
      "type": "task",
      "parent": "AIFACTORY-US-442",
      "title": "Security, tenancy and telemetry of ProjectService",
      "sequence": "01.04.03.05",
      "description": "Security, tenancy and telemetry of ProjectService. Expected output: The four scopes of the model are enforced, a route that addresses a projectId admits a call only when the role claims of the token name the project or carry a tenant-wide role, every query is tenant-filtered, the transport credential comes from the secret reference messaging-transport, the four options are bound and validated at start, readiness reports the store, the messaging profile and the Identity service, and the metrics connectsoft.factory.projects.active and connectsoft.factory.projects.delegations_active are registered with the tenant dimension under the observability conventions; the 404 that follows from the tenant filter is proven by the behaviour PBIs that read a project.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The four scopes of the model are enforced, a route that addresses a projectId admits a call only when the role claims of the token name the project or carry a tenant-wide role, every query is tenant-filtered, the transport credential comes from the secret reference messaging-transport, the four options are bound and validated at start, readiness reports the store, the messaging profile and the Identity service, and the metrics connectsoft.factory.projects.active and connectsoft.factory.projects.delegations_active are registered with the tenant dimension under the observability conventions; the 404 that follows from the tenant filter is proven by the behaviour PBIs that read a project."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-022]",
      "number": 22
    },
    {
      "id": "AIFACTORY-TASK-1803",
      "type": "task",
      "parent": "AIFACTORY-US-442",
      "title": "Verify the hosted surface of ProjectService with a two-tenant fixture",
      "sequence": "01.04.03.06",
      "description": "Verify the hosted surface of ProjectService with a two-tenant fixture. Expected output: Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every route without a token and without its scope, call the eight routes that address a projectId with a token that does not admit the project, repeat a keyed request with the same and with a different input, commit and roll back a publishing handler, probe readiness with the store stopped, and drive the write client against an Identity double that answers accepted, already exists, 403, 404 and unavailable, which proves AC1 to AC5 of AIFACTORY-US-442 (ADR-0015, ADR-0014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every route without a token and without its scope, call the eight routes that address a projectId with a token that does not admit the project, repeat a keyed request with the same and with a different input, commit and roll back a publishing handler, probe readiness with the store stopped, and drive the write client against an Identity double that answers accepted, already exists, 403, 404 and unavailable, which proves AC1 to AC5 of AIFACTORY-US-442 (ADR-0015, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1803]",
      "number": 1803
    },
    {
      "id": "AIFACTORY-US-443",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Create a project in the tenant of the caller with its first Workspace admin and announce it",
      "sequence": "01.04.04",
      "description": "As a platform admin, I want to create a project in my tenant and become its first Workspace admin, so that the people of the project can be given roles and its runs have a scope, a budget and a retention from the first day. A caller whose scope carries `factory.projects.write` creates a project through the gateway route of `ProjectService/CreateProject` with an `Idempotency-Key`. The tenant comes from the trusted scope of the authenticated context, never from the body (ADR-0015); the body names the `key`, a lower-case key of 3 to 32 characters that is unique within the tenant and immutable after creation, and the `name`. The caller becomes the first Workspace admin of the project. The Identity service is the system of record of role assignments (ADR-0015 amendments of D114 and D115), so the command writes to two systems, and its order and its failure branches are fixed here. First, everything ProjectService can decide alone is decided before the Identity service is called: the scope of the caller, the validation of the body, the idempotency filter and the uniqueness of the `key` in the tenant. Second, the `projectId` is derived deterministically from the tenant and the `Idempotency-Key`, so a repeat of the request, also after a crash, addresses the same project and the same assignment. Third, ProjectService writes the Workspace admin assignment of the caller for that `projectId` through the role assignment API of the Identity service with its own workload token and names the caller as the acting member; the user token of the caller is not forwarded. The Identity service decides from its own records whether that actor may manage assignments in the scope; a new project has no Workspace admin yet, so only a Platform admin of the tenant passes, as AIFACTORY-US-240 of feature `component-identity-template-factory-roles` delivers, and this PBI restates none of its rules. An answer of the Identity service that this same assignment already exists counts as accepted, which is the case of a repeat after a crash. Fourth, the `Project` is committed in state Active with the tenant of the trusted scope, `key`, `name`, the `region` of the tenant (ADR-0019), `retentionDays` from `Projects:Retention:DefaultRetentionDays` and no policy override, together with its `ProjectCreated` outbox record in one transaction, and the answer is 201 with the project. The region of the tenant is read through one tenant region reader whose source is the options `DataEvent:Stores:DefaultRegion` and `DataEvent:Stores:AllowedRegions`, bound by StoreProfileService in I4 (AIFACTORY-US-049); in I1 to I3 those two values are owner inputs of the I1 precondition register of AIFACTORY-US-1339, supplied by the owner before the I1 run (D140), and the acceptance suite supplies the value. The answer is 201 only when the project and the assignment both stand. When the Identity service refuses the actor the answer is 403, and when it is unavailable the command is rejected with 503 as the failure mode of the model states; nothing was written in either system. When the commit of the project fails after the Identity service accepted the assignment, because a concurrent request took the `key` or the store is unavailable, ProjectService removes the assignment again through the Identity service and answers the failure, 409 or 503, never 201. When that removal cannot be completed either, a repeat with the same `Idempotency-Key` converges after a transient failure, since it derives the same `projectId`, meets the assignment that exists and commits; an assignment left for a `projectId` that holds no project grants nothing, because every route answers 404 for it, and it is written to the operator log with its `projectId`. A repeated call with the same key and the same input returns the same project and changes nothing; the same `Idempotency-Key` with a different input, or a `key` that already exists in the tenant, is refused with 409 before the Identity service is called; a body that fails validation is refused with 400 and a caller without the scope with 403. `ProjectCreated` is published by the outbox dispatcher of the `project` messaging profile on `projects.projects.v1.project-created` in the run event envelope of the contracts package with `projectId`, `tenantId`, `key` and `region`; CostUsageService opens the default budget of the project, WorkflowEngineService correlates the signal, StudioBff refreshes its view and AuditService records the evidence in their own PBIs. The membership row of the creator appears in the projection when the assignment event of the Identity service is handled (AIFACTORY-US-458); that event can reach the inbox before the project is committed and is then redelivered until the project row exists. `connectsoft.factory.projects.active` rises by one for the tenant. Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/CreateProject; events: ProjectService/ProjectCreated; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019; requirements: FR-01, XL-01; scenarios: SCN-ProjectService-001, SCN-ProjectService-010. Relates: nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, feature:component-identity-template-factory-roles. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/services/project-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Platform admin of a tenant whose scope carries `factory.projects.write` and a valid body, when `ProjectService/CreateProject` is called with an `Idempotency-Key`, then the `projectId` is the value derived from the tenant and that key, the Identity service receives one Workspace admin assignment for that `projectId`, written with the workload token of ProjectService and naming the caller as actor, the response is 201, the `ProjectService/Project` is Active with the tenant of the trusted scope, the region the tenant region reader of the fixture supplies and `retentionDays` from `Projects:Retention:DefaultRetentionDays`, and the `ProjectService/ProjectCreated` outbox record is written in the same transaction as the project (SCN-ProjectService-001, ADR-0015).",
        "AC2: Given the same request repeated with the same `Idempotency-Key` and the same input, when it arrives at `ProjectService/CreateProject`, then the same project is returned and no second project, assignment or outbox record exists; given a different input under the same key, or a `key` another project of the tenant already uses, then the answer is 409 and the Identity service received no write, while the same `key` in another tenant is accepted; given a first attempt that stopped after the Identity service accepted the assignment and before the project was committed, when the request is repeated, then the same `projectId` is derived, the answer of the Identity service that the assignment already exists counts as accepted, and one project with one assignment stands (SCN-ProjectService-001, ADR-0014).",
        "AC3: Given a body whose `key` is not 3 to 32 lower-case characters, a caller without `factory.projects.write`, an actor the Identity service refuses because by its records the caller is not Platform admin of the tenant, or an Identity service that is unavailable, when `ProjectService/CreateProject` is called, then the answer is 400, 403, 403 or 503 respectively with a problem response, the first two are answered before the Identity service is called, no `ProjectService/Project` row and no assignment is written and nothing is published (SCN-ProjectService-001, ADR-0015).",
        "AC4: Given the Identity service accepted the assignment and the commit of the `ProjectService/Project` then fails, once because a concurrent request took the `key` and once because `project-sql` is unavailable, when `ProjectService/CreateProject` ends, then the Identity service received the removal of that assignment with the caller named as actor, the answer is 409 or 503 respectively and never 201, and no project row and no `ProjectService/ProjectCreated` record exists; when the removal fails as well, then the answer is the same failure and the assignment is named in the operator log with its `projectId` (SCN-ProjectService-001, ADR-0015).",
        "AC5: Given the project was created, when the outbox dispatcher of the `project` messaging profile publishes `ProjectService/ProjectCreated` on `projects.projects.v1.project-created`, then the event is sent in `run-event-envelope-v1` with `projectId`, `tenantId`, `key` and `region`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ProjectService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1804",
        "AIFACTORY-TASK-1805",
        "AIFACTORY-TASK-1806"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5404,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/CreateProject"
        ],
        "events": [
          "ProjectService/ProjectCreated"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-01",
          "XL-01"
        ],
        "scenarios": [
          "SCN-ProjectService-001",
          "SCN-ProjectService-010"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "feature:component-identity-template-factory-roles"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-443]",
      "number": 443
    },
    {
      "id": "AIFACTORY-TASK-1804",
      "type": "task",
      "parent": "AIFACTORY-US-443",
      "title": "CreateProject with the first Workspace admin assignment written through the Identity service, in a fixed order with its failure branches",
      "sequence": "01.04.04.01",
      "description": "CreateProject with the first Workspace admin assignment written through the Identity service, in a fixed order with its failure branches. Expected output: CreateProject checks the scope, the body, the idempotency filter and the uniqueness of the key in the tenant before it calls the Identity service, derives the projectId from the tenant and the Idempotency-Key, writes the Workspace admin assignment of the caller through the client of AIFACTORY-TASK-1843 with the workload token of ProjectService and the caller named as actor, counts the answer that this assignment already exists as accepted, and commits the Project in Active with the region from the tenant region reader, whose source is DataEvent:Stores DefaultRegion and AllowedRegions (owner inputs of the I1 precondition register of AIFACTORY-US-1339 in I1 to I3, bound by StoreProfileService in I4, D140), retentionDays and its ProjectCreated outbox record in one transaction; when that commit fails it removes the assignment through the Identity service and answers 409 or 503, and writes the projectId to the operator log when the removal fails; it answers 201 only when the project and the assignment both stand, 403 when the Identity service refuses the actor, 503 when it is unavailable, 400 for an invalid body and 409 for a key conflict or a reused idempotency key with another input, and connectsoft.factory.projects.active rises by one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "CreateProject checks the scope, the body, the idempotency filter and the uniqueness of the key in the tenant before it calls the Identity service, derives the projectId from the tenant and the Idempotency-Key, writes the Workspace admin assignment of the caller through the client of AIFACTORY-TASK-1843 with the workload token of ProjectService and the caller named as actor, counts the answer that this assignment already exists as accepted, and commits the Project in Active with the region from the tenant region reader, whose source is DataEvent:Stores DefaultRegion and AllowedRegions (owner inputs of the I1 precondition register of AIFACTORY-US-1339 in I1 to I3, bound by StoreProfileService in I4, D140), retentionDays and its ProjectCreated outbox record in one transaction; when that commit fails it removes the assignment through the Identity service and answers 409 or 503, and writes the projectId to the operator log when the removal fails; it answers 201 only when the project and the assignment both stand, 403 when the Identity service refuses the actor, 503 when it is unavailable, 400 for an invalid body and 409 for a key conflict or a reused idempotency key with another input, and connectsoft.factory.projects.active rises by one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1804]",
      "number": 1804
    },
    {
      "id": "AIFACTORY-TASK-1805",
      "type": "task",
      "parent": "AIFACTORY-US-443",
      "title": "Acceptance fixture of an Identity service generated from the identity template with the Factory role catalogue",
      "sequence": "01.04.04.02",
      "description": "Acceptance fixture of an Identity service generated from the identity template with the Factory role catalogue. Expected output: The acceptance suite starts an Identity service generated from the identity template at the version the gate of feature component-identity-template-factory-roles published, seeded with the Factory role catalogue, two tenants, a bootstrapped Platform admin, a tenant-wide Observer and further members in each, and a workload credential that holds the service scope of the role writes; the fixture can be stopped to prove the 503 path, can be stopped between two writes of one command, records every write it receives with its actor, and the suite supplies the region of each tenant through the tenant region reader and can make the commit of a project fail after the assignment was accepted.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The acceptance suite starts an Identity service generated from the identity template at the version the gate of feature component-identity-template-factory-roles published, seeded with the Factory role catalogue, two tenants, a bootstrapped Platform admin, a tenant-wide Observer and further members in each, and a workload credential that holds the service scope of the role writes; the fixture can be stopped to prove the 503 path, can be stopped between two writes of one command, records every write it receives with its actor, and the suite supplies the region of each tenant through the tenant region reader and can make the commit of a project fail after the assignment was accepted."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5404,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1805]",
      "number": 1805
    },
    {
      "id": "AIFACTORY-TASK-1806",
      "type": "task",
      "parent": "AIFACTORY-US-443",
      "title": "Verify create-a-project through the acceptance suite",
      "sequence": "01.04.04.03",
      "description": "Verify create-a-project through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-001|Scenario=SCN-ProjectService-010)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-443, that is the creation with its derived projectId, the assignment the Identity fixture received, the idempotent repeat, the repeat after an interrupted first attempt, the 400, 403, 409 and 503 refusals, the removal of the assignment after a failed commit, and the publication and payload of ProjectCreated; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-001|Scenario=SCN-ProjectService-010)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-443, that is the creation with its derived projectId, the assignment the Identity fixture received, the idempotent repeat, the repeat after an interrupted first attempt, the 400, 403, 409 and 503 refusals, the removal of the assignment after a failed commit, and the publication and payload of ProjectCreated; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1806]",
      "number": 1806
    },
    {
      "id": "AIFACTORY-US-444",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "List the projects a caller holds a role in and read one project with its members, delegations and source scope",
      "sequence": "01.04.05",
      "description": "As a requester, I want to see the projects I belong to and, for one of them, who holds which role and what its runs may touch, so that I pick the right project for my work and know who can decide in it. A caller whose scope carries `factory.projects.read` lists projects through `ProjectService/ListProjects` and reads one through `ProjectService/GetProject`. Both read `project-sql` only: the `Projects` rows and the `Memberships`, `Delegations` and `SourceScopes` rows of a project, of which `Memberships` and `Delegations` are the projection ProjectService keeps from the events of the Identity service (ADR-0015 amendment of D114). `ListProjects` returns the projects of the trusted tenant in which the caller holds a membership row or a delegation that is neither expired nor revoked, each with `projectId`, `key`, `name`, `state` and `region`, paged. Two roles are held for the whole tenant and come from the role claims of the token, never from a membership row (ADR-0015 decision 5): Platform admin, and Observer when it was assigned with the tenant scope, which the decision allows for a project or the tenant. A caller with either claim receives every project of the tenant from `ListProjects` and may read each of them through `GetProject`. For the tenant-wide Observer this stays read-only, because both routes are reads and the Observer role admits no command. `GetProject` returns one project with its state, region and retention, its memberships (subject, role, who granted it and when), its delegations (grantor, grantee, role, expiry, reason and revocation) and its source scope entries. Every query runs under the tenant row filter of the service, so a project of another tenant is never listed and is answered 404 when addressed, the same answer as for a `projectId` that does not exist; the response never confirms that the project exists (ADR-0015 amendment of D113). A caller without `factory.projects.read`, or a member of the tenant who holds neither a role in the addressed project nor one of the two tenant-wide roles by claim, is refused with 403. Neither read writes anything. When `project-sql` is unavailable or the token cannot be validated the call fails fast with a problem response. The summary of `GetProject` in the model also names environments. EnvironmentService owns them, and the project overview screen reads them through its own list beside `GetProject`, so this PBI returns no environment data. Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/ListProjects, ProjectService/GetProject; adrs: ADR-0015; requirements: FR-01, FUX-01; scenarios: SCN-ProjectService-002, SCN-ProjectService-003. Relates: screens: project-overview, project-settings; nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, model/ux/screens.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/services/project-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given three projects in the tenant of the caller and one in another tenant, where the caller holds a membership in the first and an unexpired, unrevoked delegation in the second, when `ProjectService/ListProjects` is called with a page cursor, then the response is 200 with exactly the first and the second project, each with `projectId`, `key`, `name`, `state` and `region`; a Platform admin of the tenant and an Observer assigned with the tenant scope, each by the role claims of the token and without any membership row, receive all three, and the project of the other tenant never appears (SCN-ProjectService-002, ADR-0015).",
        "AC2: Given a caller with `factory.projects.read` who holds a role in a project with two memberships, one delegation and two source scope entries, when `ProjectService/GetProject` is called, then the response is 200 with the state, region and retention of the `ProjectService/Project`, both memberships with `grantedBy` and `grantedAt`, the delegation with grantor, grantee, role, `expiresAt` and reason, and both entries, and nothing is written (SCN-ProjectService-003).",
        "AC3: Given a caller without `factory.projects.read`, a member of the tenant who holds neither a role in the addressed project nor a tenant-wide role by claim, or a `projectId` that exists only in another tenant, when `ProjectService/GetProject` is called, then the answer is 403, 403 or 404 respectively, the 404 being the same answer as for a `projectId` that does not exist, each with a problem response and no state change; given an Observer assigned with the tenant scope or a Platform admin, then the answer is 200 for every project of the tenant (SCN-ProjectService-003, ADR-0015).",
        "AC4: Given `project-sql` is unavailable, when `ProjectService/ListProjects` is called, then the call fails fast with a problem response and no state changes (SCN-ProjectService-002)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1807",
        "AIFACTORY-TASK-1808",
        "AIFACTORY-TASK-1809"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5405,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/ListProjects",
          "ProjectService/GetProject"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "FUX-01"
        ],
        "scenarios": [
          "SCN-ProjectService-002",
          "SCN-ProjectService-003"
        ]
      },
      "relates": {
        "screens": [
          "project-overview",
          "project-settings"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-444]",
      "number": 444
    },
    {
      "id": "AIFACTORY-TASK-1807",
      "type": "task",
      "parent": "AIFACTORY-US-444",
      "title": "Contract of the project list item and the project view",
      "sequence": "01.04.05.01",
      "description": "Contract of the project list item and the project view. Expected output: The OpenAPI document of the service holds the paged project list with projectId, key, name, state and region and the project view with state, region, retention, memberships, delegations and source scope entries, named after the fields of model/services/control-plane/ProjectService.yaml; the view holds no environment data.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service holds the paged project list with projectId, key, name, state and region and the project view with state, region, retention, memberships, delegations and source scope entries, named after the fields of model/services/control-plane/ProjectService.yaml; the view holds no environment data."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5405,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1807]",
      "number": 1807
    },
    {
      "id": "AIFACTORY-TASK-1808",
      "type": "task",
      "parent": "AIFACTORY-US-444",
      "title": "ListProjects and GetProject read model over project-sql with the tenant row filter and paging",
      "sequence": "01.04.05.02",
      "description": "ListProjects and GetProject read model over project-sql with the tenant row filter and paging. Expected output: ListProjects returns the projects of the trusted tenant in which the caller holds a membership row or a valid delegation, and every project of the tenant for a caller whose role claims carry Platform admin or an Observer assignment with the tenant scope, paged; GetProject returns the project view from the Projects, Memberships, Delegations and SourceScopes rows to a caller with a role in the project or with one of those two tenant-wide claims; both apply the tenant row filter so a project of another tenant is answered 404 like an unknown one, answer 403 for a missing scope or a caller without a role in the project and without a tenant-wide claim, and write nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "ListProjects returns the projects of the trusted tenant in which the caller holds a membership row or a valid delegation, and every project of the tenant for a caller whose role claims carry Platform admin or an Observer assignment with the tenant scope, paged; GetProject returns the project view from the Projects, Memberships, Delegations and SourceScopes rows to a caller with a role in the project or with one of those two tenant-wide claims; both apply the tenant row filter so a project of another tenant is answered 404 like an unknown one, answer 403 for a missing scope or a caller without a role in the project and without a tenant-wide claim, and write nothing."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1808]",
      "number": 1808
    },
    {
      "id": "AIFACTORY-TASK-1809",
      "type": "task",
      "parent": "AIFACTORY-US-444",
      "title": "Verify read-projects through the acceptance suite",
      "sequence": "01.04.05.03",
      "description": "Verify read-projects through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-002|Scenario=SCN-ProjectService-003)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-444 with projects of two tenants, a membership, a delegation, a Platform admin by claim and an Observer with the tenant scope by claim.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-002|Scenario=SCN-ProjectService-003)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-444 with projects of two tenants, a membership, a delegation, a Platform admin by claim and an Observer with the tenant scope by claim."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1809]",
      "number": 1809
    },
    {
      "id": "AIFACTORY-US-445",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Resolve the roles, the source scope and the policy context of a subject in a project for every service that asks",
      "sequence": "01.04.06",
      "description": "A service of the Factory with a workload identity calls the internal gRPC method `ProjectService/Projects.ResolveScope` at request time to build the trusted scope of a command: RunControlService calls it at submission and at decision time, and every module that accepts a command for a project may call it. The request is an `execution-scope-v1`, whose schema requires `tenantId`, `projectId`, `callerId`, `callerKind` and a `policyContext` with `policyRevision`. The subject whose roles are resolved is `callerId` when `callerKind` is user, and `delegatedUserId` when a workload or a partner agent acts on behalf of a user; a workload or a system caller without `delegatedUserId` holds no project role, because project roles are held by members. The workload token of the calling service carries the service scope that names ProjectService and no tenant claim, and ProjectService reads the forwarded tenant and project only because the token holds that service scope (ADR-0015 amendment of D114). The reply is the same `execution-scope-v1` completed from `project-sql` and valid against its schema. `tenantId`, `projectId`, `callerId`, `callerKind`, `delegatedUserId` and `environmentId` are returned as sent. `roles` holds the roles of the membership rows of the subject in the project together with the roles of the delegations to the subject that are neither revoked nor past `expiresAt` at the moment of the call. `sourceScope` holds the `repositories`, `documentCollections` and `toolIds` of the `SourceScopes` rows. `policyContext.region` is the region of the project, and `policyContext.policyRevision` is the value the caller sent, that is the platform revision it pinned. The schema has one `policyRevision` and no field for a project override, and no command of the model sets `policyOverrideRevision`, so at this increment the reply never carries an override; how an override travels once a command sets it is reported to the owner and not decided here. Validity of a delegation is decided at read, so an expired delegation contributes no role even before its expiry reached the projection. The two tenant-scope roles, Platform admin and an Observer assigned for the tenant, are never resolved from a row: they travel as role claims of the token of the subject, which the calling service already holds, and the reply adds nothing for them. The method answers for a project in any state, Active, Suspended, Closing or Closed: whether a run may start in the project is the gate RunControlService keeps in its `GateStates` from the state events of the project, not a refusal of this method. The method is of the read class: it writes nothing and publishes nothing. Its result is valid for the request it was resolved for; neither ProjectService nor a caller caches it across requests, because a cross-request cache would keep a revoked delegation effective longer than the audit says, as the service page states. A caller without a workload identity is refused with Unauthenticated, a workload token without the service scope with PermissionDenied, a request that fails validation against the schema with InvalidArgument, and an unknown project and a project of another tenant alike with NOT_FOUND, which never confirms that a foreign project exists (ADR-0015 amendments of D113 and D114). Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/Projects.ResolveScope; descriptors: execution-scope-v1; adrs: ADR-0015; requirements: FR-01, NFR-01; scenarios: SCN-ProjectService-009. Relates: nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, model/descriptors.yaml, docs/reference/schemas/execution-scope.schema.json, docs/planes/control/services/project-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a subject with a membership role and an unexpired, unrevoked delegated role in a project that has repository, document and tool entries and no policy override, when `ProjectService/Projects.ResolveScope` is called by a workload identity whose token holds the service scope, with an `execution-scope-v1` that names the subject as `callerId` with `callerKind` user and a `policyContext.policyRevision`, then the reply validates against docs/reference/schemas/execution-scope.schema.json, returns `callerId`, `callerKind` and that `policyRevision` as sent, carries both roles, the three lists of `sourceScope` and the region of the `ProjectService/Project`, and nothing is written or published; a workload caller that names the subject as `delegatedUserId` receives the same roles (SCN-ProjectService-009).",
        "AC2: Given a delegation to the subject that is past `expiresAt` although its expiry has not reached the projection yet, or one whose row carries `revokedAt`, when `ProjectService/Projects.ResolveScope` is called, then the role of that delegation is absent from `roles`; given a subject who is Platform admin or tenant-wide Observer by claim and holds no membership row, then `roles` of the reply holds no row-resolved role for that subject (SCN-ProjectService-009, ADR-0015).",
        "AC3: Given a caller without a workload identity, a workload token without the service scope, a request without `callerId`, `callerKind` or `policyContext.policyRevision`, an unknown project or a project of another tenant, when `ProjectService/Projects.ResolveScope` is called, then the call is refused with Unauthenticated, PermissionDenied, InvalidArgument, NOT_FOUND and NOT_FOUND respectively and no state changes (SCN-ProjectService-009, ADR-0015).",
        "AC4: Given two consecutive calls for the same subject and project between which a membership row of the projection changed, when the second `ProjectService/Projects.ResolveScope` is answered, then it reflects the change, which shows that no result is cached across requests, as docs/planes/control/services/project-service/index.md requires; given a project that is Closing or Closed, then the method answers as for an Active one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1810",
        "AIFACTORY-TASK-1811",
        "AIFACTORY-TASK-1812"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5406,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/Projects.ResolveScope"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-ProjectService-009"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-445]",
      "number": 445
    },
    {
      "id": "AIFACTORY-TASK-1810",
      "type": "task",
      "parent": "AIFACTORY-US-445",
      "title": "Contract of Projects.ResolveScope over the execution scope descriptor",
      "sequence": "01.04.06.01",
      "description": "Contract of Projects.ResolveScope over the execution scope descriptor. Expected output: The proto of the service declares Projects.ResolveScope with a request and a reply that match docs/reference/schemas/execution-scope.schema.json as model/descriptors.yaml records execution-scope-v1; the contract document states that the subject is callerId for callerKind user and delegatedUserId for a workload or a partner agent that acts for a user, that tenantId, projectId, callerId, callerKind, delegatedUserId and environmentId are returned as sent, that policyContext.policyRevision of the reply is the value the caller sent and policyContext.region the region of the project, that roles and sourceScope are filled from the store, and that the method answers for a project in any state; the type comes from the pinned contracts package and is not copied.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The proto of the service declares Projects.ResolveScope with a request and a reply that match docs/reference/schemas/execution-scope.schema.json as model/descriptors.yaml records execution-scope-v1; the contract document states that the subject is callerId for callerKind user and delegatedUserId for a workload or a partner agent that acts for a user, that tenantId, projectId, callerId, callerKind, delegatedUserId and environmentId are returned as sent, that policyContext.policyRevision of the reply is the value the caller sent and policyContext.region the region of the project, that roles and sourceScope are filled from the store, and that the method answers for a project in any state; the type comes from the pinned contracts package and is not copied."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5406,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1810]",
      "number": 1810
    },
    {
      "id": "AIFACTORY-TASK-1811",
      "type": "task",
      "parent": "AIFACTORY-US-445",
      "title": "ResolveScope from the membership and delegation projection with validity decided at read",
      "sequence": "01.04.06.02",
      "description": "ResolveScope from the membership and delegation projection with validity decided at read. Expected output: Projects.ResolveScope resolves the subject from callerId, callerKind and delegatedUserId, reads the membership rows, the delegations that are neither revoked nor past expiresAt at the call, the SourceScopes rows and the region of the project under the forwarded tenant, returns the policy revision the caller sent, resolves no tenant-scope role from a row, answers for a project in any state, admits the forwarded tenant and project only for a workload token with the service scope, caches nothing across requests, and answers Unauthenticated, PermissionDenied, InvalidArgument or NotFound, the gRPC status NOT_FOUND, for an unknown and for a foreign project alike.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Projects.ResolveScope resolves the subject from callerId, callerKind and delegatedUserId, reads the membership rows, the delegations that are neither revoked nor past expiresAt at the call, the SourceScopes rows and the region of the project under the forwarded tenant, returns the policy revision the caller sent, resolves no tenant-scope role from a row, answers for a project in any state, admits the forwarded tenant and project only for a workload token with the service scope, caches nothing across requests, and answers Unauthenticated, PermissionDenied, InvalidArgument or NotFound, the gRPC status NOT_FOUND, for an unknown and for a foreign project alike."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1811]",
      "number": 1811
    },
    {
      "id": "AIFACTORY-TASK-1812",
      "type": "task",
      "parent": "AIFACTORY-US-445",
      "title": "Verify resolve-execution-scope through the acceptance suite",
      "sequence": "01.04.06.03",
      "description": "Verify resolve-execution-scope through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-009\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-445 with a reply of a project without an override validated against docs/reference/schemas/execution-scope.schema.json, a user caller and a workload caller with delegatedUserId, a controlled clock for the expired delegation, a projection change between two calls and a Closed project.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-009\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-445 with a reply of a project without an override validated against docs/reference/schemas/execution-scope.schema.json, a user caller and a workload caller with delegatedUserId, a controlled clock for the expired delegation, a projection change between two calls and a Closed project."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5406,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1812]",
      "number": 1812
    },
    {
      "id": "AIFACTORY-US-1494",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "List the members of a project who hold a role, by membership or by a delegation in force, for the services that route approvals and notifications",
      "sequence": "01.04.07",
      "description": "Two services need to know who holds a role in a project rather than which roles one subject holds. ApprovalPolicyService needs the eligible approvers of a request when it routes it and the eligibility of a decider when the decision is taken, and StudioNotificationService needs the recipients of a notification addressed to a role of a project (D126, D136). The internal gRPC method `ProjectService/Projects.ListRoleHolders` answers them. It is of the read class and takes an `execution-scope-v1` that names the tenant, the project and the caller, with the role asked in `roles`; as a design choice of this PBI a request that names no role or more than one is refused with InvalidArgument. The method answers the members of the project who hold that role, each with its subject id and whether the role comes from a membership row or from a delegation, from the projection of memberships and delegations the service keeps from the events of the Identity service (AIFACTORY-US-458) and without a call to the Identity service. A delegation counts while it is in force, that is neither revoked nor past `expiresAt` at the moment of the call, decided at read as for `Projects.ResolveScope`, so an expired delegation names no holder even before its expiry reached the projection. A member who holds the role both ways is named once, by membership. The two tenant-scope roles, Platform admin and an Observer assigned for the tenant, travel as role claims of a token and are held in no row, so the method never lists them. A role nobody holds in the project is answered with an empty list. The method answers for a project in any state, Active, Suspended, Closing or Closed, because whether an approval may be decided or a notification sent is decided by the caller. The model declares no reply schema for the method; the contract document of this PBI fixes the reply members it names, and the missing descriptor is reported to the owner. The result is valid for the request it was resolved for and is cached across requests neither by ProjectService nor by a caller. The caller holds a workload identity whose token carries the service scope that names ProjectService, and ProjectService reads the forwarded tenant and project only for such a token (ADR-0015 amendment of D114). A caller without a workload identity is refused with Unauthenticated, a workload token without the service scope with PermissionDenied, and an unknown project and a project of another tenant alike with NOT_FOUND, which never confirms that a foreign project exists. The method writes nothing and publishes nothing. Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/Projects.ListRoleHolders; descriptors: execution-scope-v1; adrs: ADR-0015; requirements: FR-01, NFR-01; scenarios: SCN-ProjectService-017. Depends on: AIFACTORY-US-442, AIFACTORY-US-458. Sources: model/services/control-plane/ProjectService.yaml, model/services/governance/ApprovalPolicyService.yaml, docs/reference/schemas/execution-scope.schema.json, docs/planes/control/services/project-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a project with one member who holds the role Reviewer by membership, one who holds it by a delegation in force, one who holds it both ways and one who holds another role, when `ProjectService/Projects.ListRoleHolders` is called by a workload identity whose token holds the service scope, with an `execution-scope-v1` that names the project and the role Reviewer, then the reply names the first three members once each with the source of the role, membership for the third, does not name the fourth, and nothing is written or published; the `ProjectService/Project` is read from the projection without a call to the Identity service (SCN-ProjectService-017, D136).",
        "AC2: Given a delegation of the role that is past `expiresAt` although its expiry has not reached the projection yet, or one whose row carries `revokedAt`, when `ProjectService/Projects.ListRoleHolders` is called for that role, then its delegate is not named; given a subject who is Platform admin or tenant-wide Observer by claim only, then it is never named; given a role nobody holds, then the reply is an empty list; given a project that is Closing or Closed, then the method answers as for an Active one (SCN-ProjectService-017, ADR-0015).",
        "AC3: Given a caller without a workload identity, a workload token without the service scope, a request that names no role or more than one, an unknown project or a project of another tenant, when `ProjectService/Projects.ListRoleHolders` is called, then the call is refused with Unauthenticated, PermissionDenied, InvalidArgument, NOT_FOUND and NOT_FOUND respectively and no state changes (SCN-ProjectService-017, ADR-0015).",
        "AC4: Given two consecutive calls for the same role and project between which a membership row of the projection changed, when the second `ProjectService/Projects.ListRoleHolders` is answered, then it reflects the change, which shows that no result is cached across requests (SCN-ProjectService-017, docs/planes/control/services/project-service/index.md)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6073",
        "AIFACTORY-TASK-6074",
        "AIFACTORY-TASK-6075"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5407,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/Projects.ListRoleHolders"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-ProjectService-017"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-442",
        "AIFACTORY-US-458"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1494]",
      "number": 1494
    },
    {
      "id": "AIFACTORY-TASK-6073",
      "type": "task",
      "parent": "AIFACTORY-US-1494",
      "title": "Contract of Projects.ListRoleHolders with its request over the execution scope descriptor and its reply members",
      "sequence": "01.04.07.01",
      "description": "Contract of Projects.ListRoleHolders with its request over the execution scope descriptor and its reply members. Expected output: The proto of the service declares Projects.ListRoleHolders with a request that matches docs/reference/schemas/execution-scope.schema.json as model/descriptors.yaml records execution-scope-v1, the role asked carried in roles, and a reply that lists the holders, each with its subject id and the source of the role, membership or delegation; the contract document states that the reply is read from the projection, that a delegation counts while it is in force at the call, that tenant-scope roles are never listed and that the method answers for a project in any state, and names the missing reply descriptor as reported to the owner.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The proto of the service declares Projects.ListRoleHolders with a request that matches docs/reference/schemas/execution-scope.schema.json as model/descriptors.yaml records execution-scope-v1, the role asked carried in roles, and a reply that lists the holders, each with its subject id and the source of the role, membership or delegation; the contract document states that the reply is read from the projection, that a delegation counts while it is in force at the call, that tenant-scope roles are never listed and that the method answers for a project in any state, and names the missing reply descriptor as reported to the owner."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5407,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6073]",
      "number": 6073
    },
    {
      "id": "AIFACTORY-TASK-6074",
      "type": "task",
      "parent": "AIFACTORY-US-1494",
      "title": "ListRoleHolders from the membership and delegation projection with validity decided at read",
      "sequence": "01.04.07.02",
      "description": "ListRoleHolders from the membership and delegation projection with validity decided at read. Expected output: Projects.ListRoleHolders reads, under the forwarded tenant, the membership rows that hold the role asked in the project and the delegations of that role that are neither revoked nor past expiresAt at the call, names each holder once with membership preferred over delegation, lists no tenant-scope role, calls no Identity service, caches nothing across requests, admits the forwarded tenant and project only for a workload token with the service scope, and answers Unauthenticated, PermissionDenied, InvalidArgument for a request with no role or more than one, or NOT_FOUND for an unknown and for a foreign project alike.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Projects.ListRoleHolders reads, under the forwarded tenant, the membership rows that hold the role asked in the project and the delegations of that role that are neither revoked nor past expiresAt at the call, names each holder once with membership preferred over delegation, lists no tenant-scope role, calls no Identity service, caches nothing across requests, admits the forwarded tenant and project only for a workload token with the service scope, and answers Unauthenticated, PermissionDenied, InvalidArgument for a request with no role or more than one, or NOT_FOUND for an unknown and for a foreign project alike."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6074]",
      "number": 6074
    },
    {
      "id": "AIFACTORY-TASK-6075",
      "type": "task",
      "parent": "AIFACTORY-US-1494",
      "title": "Verify list-the-holders-of-a-role-in-a-project through the acceptance suite",
      "sequence": "01.04.07.03",
      "description": "Verify list-the-holders-of-a-role-in-a-project through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-017\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1494 with a projection of members who hold a role by membership, by delegation and both ways, a controlled clock for the expired delegation, a revoked delegation, a claim-only Platform admin, a role nobody holds, a Closed project, each refusal and a projection change between two calls.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-017\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1494 with a projection of members who hold a role by membership, by delegation and both ways, a controlled clock for the expired delegation, a revoked delegation, a claim-only Platform admin, a role nobody holds, a Closed project, each refusal and a projection change between two calls."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5407,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6075]",
      "number": 6075
    },
    {
      "id": "AIFACTORY-US-446",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Grant, change and remove the project roles of a member through the Identity service, one write at a time and convergent on repeat",
      "sequence": "01.04.08",
      "description": "As a workspace admin, I want to state which roles a member holds in my project, so that people can act in the project in the role they have and every change of access is recorded where roles are held. A Workspace admin whose scope carries `factory.projects.admin` states the roles a subject holds in a project through `ProjectService/SetMembership`, a PUT on the member the path addresses by `subjectId`. The body names the project roles the subject shall hold, taken from `MembershipRole` (Requester, Reviewer, AssetMaintainer, Operator, WorkspaceAdmin, Observer). A body that names Platform admin, which is tenant-wide and lives in the Identity service, or any other value outside `MembershipRole` is refused with 400 before the Identity service is called. ProjectService compares the stated roles with the membership projection of the subject and writes the difference through the role assignment API of the Identity service: a grant for each role the subject does not hold yet and a removal for each role that is no longer stated, so a statement without roles removes the subject from the project. The writes are sent one by one, grants before removals, each with the workload token of ProjectService and the caller named as the acting member; the user token of the caller is not forwarded (ADR-0015 amendment of D115). The Identity service is the system of record of role assignments (D114): it decides from its own records whether the actor is Workspace admin of the project or Platform admin, checks that the subject is a member of the tenant, stores the assignment and raises its event, as AIFACTORY-US-240 of feature `component-identity-template-factory-roles` delivers. ProjectService changes no membership row in the command; the projection and `MembershipChanged` follow from the events of the Identity service (AIFACTORY-US-458). The projection lags behind the system of record, so the computed difference can be stale, and the command is built to converge: the answer of the Identity service that a granted assignment already exists and its answer that a removed assignment is not found both count as accepted. The answer is 200 once every write was accepted. A repeat that states the roles the projection already holds sends nothing; a repeat that arrives before the events of the first statement were handled sends the same writes again, receives those two answers and is answered 200 as well. A statement is not atomic across its writes, and this PBI does not claim it is: when a later write fails, the answer is that failure, 503 for an unavailable Identity service or the refusal it gave, the writes accepted before it stand in the Identity service and reach the projection through their events, and the same PUT repeated converges on the stated set. A caller without the scope is refused with 403; an actor the Identity service refuses, whatever role the token states, is answered 403; a project of another tenant is answered 404 like one that does not exist, and so is a `subjectId` that is not a member of the tenant; when the Identity service is unavailable the command is rejected with 503. In none of these cases does ProjectService hold a membership row that the Identity service did not announce, because a row is written by the projection handler only. The model lists the codes 200, 400, 403, 404 and 503 for this route (D117), the 400 for an invalid role and the 503 for its own failure mode. Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/SetMembership; adrs: ADR-0015; requirements: FR-01, XL-01, XL-13; scenarios: SCN-ProjectService-004. Relates: screens: project-settings; nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, AIFACTORY-US-443, AIFACTORY-US-458, feature:component-identity-template-factory-roles. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/services/project-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin of a project whose scope carries `factory.projects.admin` and a subject who is a member of the tenant, when `ProjectService/SetMembership` states the role Reviewer for that subject, then the Identity service receives one grant written with the workload token of ProjectService and naming the caller as actor, the response is 200, and the command itself writes no `Memberships` row (SCN-ProjectService-004, ADR-0015).",
        "AC2: Given the subject holds the role Reviewer in the projection, when `ProjectService/SetMembership` states the role Operator only, then the Identity service receives a grant of Operator and then a removal of Reviewer; when it states no role, then it receives a removal of every role the subject holds in the project; when it states the roles the projection already holds, then it receives nothing; when the same PUT is repeated before the events of the first were handled, then the same writes are sent again, the answers that the assignment already exists and that the removed assignment is not found count as accepted, and the response is 200 (SCN-ProjectService-004).",
        "AC3: Given a statement that needs a grant and a removal and an Identity service that becomes unavailable after it accepted the grant, when `ProjectService/SetMembership` ends, then the answer is 503, the accepted grant stands in the Identity service and reaches the projection through its event, ProjectService holds no row that the Identity service did not announce, and the same PUT repeated after the Identity service is back sends the grant again, which counts as accepted, sends the removal and is answered 200 (SCN-ProjectService-004, ADR-0015).",
        "AC4: Given a body that names PlatformAdmin or another value outside `MembershipRole`, a caller without `factory.projects.admin`, an actor who by the records of the Identity service is neither Workspace admin of the project nor Platform admin although the token states the role, a project of another tenant, a `subjectId` that is not a member of the tenant, or an Identity service that is unavailable, when `ProjectService/SetMembership` is called, then the answer is 400, 403, 403, 404, 404 or 503 respectively with a problem response, the 400 is answered before the Identity service is called, no projection row changes and nothing is published (SCN-ProjectService-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1814",
        "AIFACTORY-TASK-1816"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5408,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/SetMembership"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "XL-01",
          "XL-13"
        ],
        "scenarios": [
          "SCN-ProjectService-004"
        ]
      },
      "relates": {
        "screens": [
          "project-settings"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "AIFACTORY-US-443",
        "AIFACTORY-US-458",
        "feature:component-identity-template-factory-roles"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-446]",
      "number": 446
    },
    {
      "id": "AIFACTORY-TASK-1814",
      "type": "task",
      "parent": "AIFACTORY-US-446",
      "title": "SetMembership writing grants and removals through the Identity service one by one with a named actor",
      "sequence": "01.04.08.01",
      "description": "SetMembership writing grants and removals through the Identity service one by one with a named actor. Expected output: SetMembership refuses with 400 a role outside MembershipRole before any call, compares the stated roles of the subject with the membership projection and sends one grant per new role and then one removal per role no longer stated through the client of AIFACTORY-TASK-1843, one by one, with the workload token of ProjectService and the caller named as actor; an answer that the assignment already exists on a grant and an answer of not found on a removal count as accepted; it writes no Memberships row, answers 200 when every write was accepted, stops at the first write that fails and answers 503 or the refusal while the accepted writes stand, so that the same PUT repeated converges on the stated set; it answers 403 without the scope or when the Identity service refuses the actor and 404 for a foreign or unknown project and for a subject outside the tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "SetMembership refuses with 400 a role outside MembershipRole before any call, compares the stated roles of the subject with the membership projection and sends one grant per new role and then one removal per role no longer stated through the client of AIFACTORY-TASK-1843, one by one, with the workload token of ProjectService and the caller named as actor; an answer that the assignment already exists on a grant and an answer of not found on a removal count as accepted; it writes no Memberships row, answers 200 when every write was accepted, stops at the first write that fails and answers 503 or the refusal while the accepted writes stand, so that the same PUT repeated converges on the stated set; it answers 403 without the scope or when the Identity service refuses the actor and 404 for a foreign or unknown project and for a subject outside the tenant."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1814]",
      "number": 1814
    },
    {
      "id": "AIFACTORY-TASK-1816",
      "type": "task",
      "parent": "AIFACTORY-US-446",
      "title": "Verify set-project-membership through the acceptance suite",
      "sequence": "01.04.08.02",
      "description": "Verify set-project-membership through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-004\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-446 against the Identity fixture of AIFACTORY-TASK-1805, including the writes it received with their actor and their order, a repeat before the events arrived, the fixture stopped between the grant and the removal with the convergent repeat, and the 400, 403, 404 and 503 refusals.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-004\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-446 against the Identity fixture of AIFACTORY-TASK-1805, including the writes it received with their actor and their order, a repeat before the events arrived, the fixture stopped between the grant and the removal with the convergent repeat, and the 400, 403, 404 and 503 refusals."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5408,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1816]",
      "number": 1816
    },
    {
      "id": "AIFACTORY-US-458",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Keep the membership projection from the assignment events of the Identity service and publish MembershipChanged after it changed",
      "sequence": "01.04.09",
      "description": "The `Memberships` rows of ProjectService are a projection of the role assignments the Identity service holds, the system of record (ADR-0015 amendment of D114). No command writes them. The inbox of the `project` messaging profile receives the assignment granted and assignment removed events of the Identity service, deduplicated on the event id, and the handler of this PBI applies them. A grant for a project scope writes the row of project, subject and role with `grantedBy` and `grantedAt` taken from the event, a removal deletes it, and the `MembershipChanged` outbox record with `projectId`, `tenantId`, `subjectId`, `role` and `change` is written in the transaction of that projection change. `MembershipChanged` is therefore published after the projection changed, on `projects.memberships.v1.membership-changed` in the run event envelope of the contracts package; ApprovalPolicyService re-evaluates eligibility, StudioBff refreshes its view and AuditService records the access change in their own PBIs. A change of role arrives as a grant and a removal and is announced as two events, each with its `change`. An event whose scope is the tenant changes no row and publishes nothing. That is how the two tenant-wide roles are held, Platform admin and an Observer assigned for the tenant: they travel as role claims of the token and are never a membership row (AIFACTORY-US-444, AIFACTORY-US-445). An event can overtake the project it belongs to. `CreateProject` writes the first Workspace admin assignment to the Identity service before it commits the project (AIFACTORY-US-443), so the event of that assignment can reach the inbox while `project-sql` holds no such project yet. Such an event is neither acknowledged nor dropped: the handler fails it, the inbox redelivers it with backoff until the project row exists, and when its retries are exhausted it is parked with the reason named, where an operator sees it and can release it. The events of an assignment whose project was never committed end the same way. A redelivery of an event that was already applied changes no row and writes no record. `Projects.ResolveScope` and the two reads return the projection as it stands, so a role is effective in the Factory from the moment its event was applied. Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; events: ProjectService/MembershipChanged; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-01, XL-01; scenarios: SCN-ProjectService-012. Relates: screens: project-settings; nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, feature:component-identity-template-factory-roles. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/services/project-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given the Identity service raised the assignment event of a grant for a project the store holds, when the inbox handler of ProjectService runs, then the projection row of project, subject and role exists with `grantedBy` and `grantedAt` from the event and the `ProjectService/MembershipChanged` outbox record is written in the same transaction; given the removal event of that assignment, then the row is deleted and a second record with its `change` is written; a redelivery of an applied event id changes no row and writes no record (SCN-ProjectService-012, ADR-0014).",
        "AC2: Given the assignment event of the first Workspace admin reaches the inbox before `project-sql` holds the project, when the handler runs, then the event is not acknowledged, no row and no `ProjectService/MembershipChanged` record is written and the inbox redelivers it; when the project row exists at a later delivery, then the membership row and the record are written once; given a project that is never committed, then the event is parked with the reason named after its retries are exhausted and no row exists (SCN-ProjectService-012, ADR-0012).",
        "AC3: Given an assignment event whose scope is the tenant, once for Platform admin and once for Observer, when the handler runs, then no `Memberships` row changes and no `ProjectService/MembershipChanged` record is written, because tenant-scope roles travel as claims (SCN-ProjectService-012, ADR-0015).",
        "AC4: Given a projection row changed, when the outbox dispatcher of the `project` messaging profile publishes `ProjectService/MembershipChanged` on `projects.memberships.v1.membership-changed`, then the event is sent in `run-event-envelope-v1` with `projectId`, `tenantId`, `subjectId`, `role` and `change`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ProjectService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1815",
        "AIFACTORY-TASK-1844"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5409,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "events": [
          "ProjectService/MembershipChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "XL-01"
        ],
        "scenarios": [
          "SCN-ProjectService-012"
        ]
      },
      "relates": {
        "screens": [
          "project-settings"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "feature:component-identity-template-factory-roles"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-458]",
      "number": 458
    },
    {
      "id": "AIFACTORY-TASK-1815",
      "type": "task",
      "parent": "AIFACTORY-US-458",
      "title": "Membership projection handler publishing MembershipChanged after the projection changed",
      "sequence": "01.04.09.01",
      "description": "Membership projection handler publishing MembershipChanged after the projection changed. Expected output: The inbox handler of the assignment granted and assignment removed events of the Identity service writes or deletes the Memberships row of project, subject and role with grantedBy and grantedAt from the event and writes the MembershipChanged outbox record in the same transaction, idempotently on the event id; an event for a tenant scope, which holds Platform admin and a tenant-wide Observer, changes no row; an event for a project the store does not hold is not acknowledged and is redelivered with backoff until the project row exists, and is parked with the reason named when its retries are exhausted.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The inbox handler of the assignment granted and assignment removed events of the Identity service writes or deletes the Memberships row of project, subject and role with grantedBy and grantedAt from the event and writes the MembershipChanged outbox record in the same transaction, idempotently on the event id; an event for a tenant scope, which holds Platform admin and a tenant-wide Observer, changes no row; an event for a project the store does not hold is not acknowledged and is redelivered with backoff until the project row exists, and is parked with the reason named when its retries are exhausted."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5409,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1815]",
      "number": 1815
    },
    {
      "id": "AIFACTORY-TASK-1844",
      "type": "task",
      "parent": "AIFACTORY-US-458",
      "title": "Verify the membership projection through the acceptance suite",
      "sequence": "01.04.09.02",
      "description": "Verify the membership projection through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-012\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-458 with the events of the Identity fixture of AIFACTORY-TASK-1805, including a redelivered event, an assignment event delivered before the project row exists and applied after it, an event parked for a project that is never committed, tenant-scope events of Platform admin and Observer, and the publication and payload of MembershipChanged; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ProjectService-012\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-458 with the events of the Identity fixture of AIFACTORY-TASK-1805, including a redelivered event, an assignment event delivered before the project row exists and applied after it, an event parked for a project that is never committed, tenant-scope events of Platform admin and Observer, and the publication and payload of MembershipChanged; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5409,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1844]",
      "number": 1844
    },
    {
      "id": "AIFACTORY-US-447",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Delegate the same or a lesser role for a bounded period, revoke it at any time and let it expire on its own",
      "sequence": "01.04.10",
      "description": "As a workspace admin, I want to hand one of my roles or a lesser one to another member for a bounded period with a reason, and to take it back at any time, so that work continues while I am away and every hand-over is recorded, limited and ends without anyone acting. A role holder whose scope carries `factory.projects.delegate` hands a role to another member through `ProjectService/Delegate` with an `Idempotency-Key`: the body names the grantee, the role, the expiry and a reason (D18). Before it calls anyone, ProjectService refuses with 400 a delegation without a reason, without an expiry, with an expiry later than `Projects:Delegation:MaxDelegationDays` from the moment of the call, or with a role outside `MembershipRole`, among them Platform admin, which a delegation never grants. It then writes the delegation through the delegation API of the Identity service, the system of record of delegations (ADR-0015 amendment of D114), with its own workload token and with the caller named as the acting member and grantor (D115). The Identity service decides from its own records, never from a role the request states, whether the grantor holds in that project the delegated role or a higher one under the order of the amendment: Observer is below every role; Requester, Reviewer, Asset maintainer and Operator are not comparable with each other and each is below Workspace admin; every role is below Platform admin. It also checks that the grantee is a member of the tenant, and a grantee who is not is answered 404, as in `SetMembership`. AIFACTORY-US-241 of feature `component-identity-template-factory-roles` delivers these rules and this PBI restates none of their internals. The answer is 201 with the `delegationId` the Identity service assigned; a repeat with the same key and the same input returns the same delegation, and the same key with a different input is refused with 409. `ProjectService/RevokeDelegation` ends a delegation immediately. ProjectService checks that the project of the path exists in the trusted tenant and then lets the Identity service resolve the delegation under that tenant and project. It does not look the delegation up in its own projection, which lags behind the system of record and may not hold a delegation yet that was granted a moment ago, so a revocation right after the 201 of `Delegate` works. The revocation is written with the workload token of ProjectService and the caller as actor; the Identity service admits the grantor, the Workspace admin of the project and a Platform admin, and the answer is 204. A revocation the Identity service answers as already revoked counts as accepted and is answered 204. The 404 for an unknown delegation, for a delegation of another project and for one of another tenant is the answer of the Identity service, passed on unchanged. ProjectService changes no `Delegations` row in either command. The inbox handlers of the grant, revocation and expiry events of the Identity service keep the `Delegations` projection (grantor, grantee, role, `expiresAt`, reason, `revokedAt`) and write the `DelegationChanged` outbox record in the transaction of each projection change, idempotently on the event id, so the event is published after the projection changed, on `projects.delegations.v1.delegation-changed` in the run event envelope with `delegationId`, `projectId`, `tenantId`, `granteeId`, `role` and `change`. The `DelegationExpiryReconciler` runs every ten minutes over projection rows past `expiresAt` whose `revokedAt` is empty, two tenants in parallel, with three attempts at a fixed backoff of 60 seconds: it announces the expiry by writing `DelegationChanged` once under the idempotency key `delegationId` plus `expiresAt`, so the reconciler and the expiry event of the Identity service never announce one expiry twice, whichever comes first. It writes nothing to the Identity service, where validity is decided when claims are read. `connectsoft.factory.projects.delegations_active` follows the unexpired, unrevoked rows per tenant. A caller without the scope is refused with 403, a grantor or a revoking actor the Identity service refuses with 403, a project of another tenant with 404 like one that does not exist, and an unavailable Identity service rejects the command with 503 and leaves no row. The model lists the codes 201, 400, 403, 404, 409 and 503 for `Delegate` (D117), and this PBI answers each of them. ApprovalPolicyService, StudioBff and AuditService consume `DelegationChanged` in their own PBIs. Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/Delegate, ProjectService/RevokeDelegation; events: ProjectService/DelegationChanged; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-01, XL-13; scenarios: SCN-ProjectService-005, SCN-ProjectService-006, SCN-ProjectService-013. Relates: screens: project-settings; nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, AIFACTORY-US-446, feature:component-identity-template-factory-roles. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/services/project-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin of a project whose scope carries `factory.projects.delegate`, when `ProjectService/Delegate` is called with a grantee of the tenant, the role Reviewer, an expiry within `Projects:Delegation:MaxDelegationDays`, a reason and an `Idempotency-Key`, then the Identity service receives one delegation written with the workload token of ProjectService and naming the caller as actor and grantor, and the response is 201 with the `delegationId`; a repeat with the same key and input returns the same delegation without a second write, and the same key with another input is answered 409 (SCN-ProjectService-005, ADR-0014).",
        "AC2: Given a body without a reason, without an expiry, with an expiry beyond `Projects:Delegation:MaxDelegationDays` or with a role outside `MembershipRole`, among them PlatformAdmin, when `ProjectService/Delegate` is called, then the answer is 400 with a problem response that names the rule and the Identity service is not called; given a caller without the scope, a grantor who by the records of the Identity service holds neither the delegated role nor a higher one under the order of ADR-0015 although the request states it, a grantee who is not a member of the tenant, a project of another tenant, or an unavailable Identity service, then the answer is 403, 403, 404, 404 or 503 respectively; no `Delegations` row is written and nothing is published (SCN-ProjectService-005).",
        "AC3: Given a valid delegation, when `ProjectService/RevokeDelegation` is called by its grantor, by the Workspace admin of the project or by a Platform admin, then the Identity service receives the revocation with the caller named as actor and the response is 204, also when the call follows the 201 of `ProjectService/Delegate` before the grant event reached the projection; a revocation the Identity service answers as already revoked is answered 204; any other actor is answered 403; and an unknown delegation and a delegation of another tenant alike are answered 404, which is the answer of the Identity service passed on (SCN-ProjectService-006, ADR-0015).",
        "AC4: Given the Identity service raised a grant, a revocation or an expiry event of a delegation, when the inbox handler runs, then the `Delegations` projection row is written or updated and the `ProjectService/DelegationChanged` outbox record with `change` is written in the same transaction, a redelivery of the event id changes nothing, and the dispatcher publishes the event on `projects.delegations.v1.delegation-changed` in `run-event-envelope-v1` with `delegationId`, `projectId`, `tenantId`, `granteeId` and `role`, retried with backoff on a transport outage without loss or duplicate (SCN-ProjectService-013, ADR-0012).",
        "AC5: Given a projection row past `expiresAt` with an empty `revokedAt` whose expiry event has not arrived, when the `DelegationExpiryReconciler` runs, then `ProjectService/DelegationChanged` announcing the expiry is written once under the key `delegationId` plus `expiresAt`, a later run and a late expiry event of the Identity service announce nothing more, nothing is written to the Identity service, and `connectsoft.factory.projects.delegations_active` falls by one (SCN-ProjectService-013)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1817",
        "AIFACTORY-TASK-1818",
        "AIFACTORY-TASK-1819",
        "AIFACTORY-TASK-1820"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5410,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/Delegate",
          "ProjectService/RevokeDelegation"
        ],
        "events": [
          "ProjectService/DelegationChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "XL-13"
        ],
        "scenarios": [
          "SCN-ProjectService-005",
          "SCN-ProjectService-006",
          "SCN-ProjectService-013"
        ]
      },
      "relates": {
        "screens": [
          "project-settings"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "AIFACTORY-US-446",
        "feature:component-identity-template-factory-roles"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/services/project-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-447]",
      "number": 447
    },
    {
      "id": "AIFACTORY-TASK-1817",
      "type": "task",
      "parent": "AIFACTORY-US-447",
      "title": "Delegate and RevokeDelegation writing through the Identity service with a named actor",
      "sequence": "01.04.10.01",
      "description": "Delegate and RevokeDelegation writing through the Identity service with a named actor. Expected output: Delegate answers 400, before the Identity service is called, for a body without a reason, without an expiry, with an expiry beyond Projects:Delegation:MaxDelegationDays or with a role outside MembershipRole, among them PlatformAdmin; it then writes the delegation through the client of AIFACTORY-TASK-1843 with the workload token of ProjectService and the caller named as actor and grantor and answers 201 with the delegationId, idempotent on the Idempotency-Key with 409 for another input, 403 when the Identity service refuses the grantor and 404 for a grantee outside the tenant; RevokeDelegation checks the project of the path in the trusted tenant, lets the Identity service resolve the delegation without requiring a projection row, writes the revocation with the caller named as actor and answers 204, also when the Identity service answers already revoked, and passes on its 403 and its 404; neither command writes a Delegations row, and an unavailable Identity service is answered 503.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Delegate answers 400, before the Identity service is called, for a body without a reason, without an expiry, with an expiry beyond Projects:Delegation:MaxDelegationDays or with a role outside MembershipRole, among them PlatformAdmin; it then writes the delegation through the client of AIFACTORY-TASK-1843 with the workload token of ProjectService and the caller named as actor and grantor and answers 201 with the delegationId, idempotent on the Idempotency-Key with 409 for another input, 403 when the Identity service refuses the grantor and 404 for a grantee outside the tenant; RevokeDelegation checks the project of the path in the trusted tenant, lets the Identity service resolve the delegation without requiring a projection row, writes the revocation with the caller named as actor and answers 204, also when the Identity service answers already revoked, and passes on its 403 and its 404; neither command writes a Delegations row, and an unavailable Identity service is answered 503."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5410,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1817]",
      "number": 1817
    },
    {
      "id": "AIFACTORY-TASK-1818",
      "type": "task",
      "parent": "AIFACTORY-US-447",
      "title": "Delegation projection handlers publishing DelegationChanged after the projection changed",
      "sequence": "01.04.10.02",
      "description": "Delegation projection handlers publishing DelegationChanged after the projection changed. Expected output: The inbox handlers of the delegation granted, revoked and expired events of the Identity service write the Delegations row with grantor, grantee, role, expiresAt and reason, set revokedAt on a revocation, and write the DelegationChanged outbox record with the change in the same transaction, idempotently on the event id; connectsoft.factory.projects.delegations_active follows the unexpired, unrevoked rows per tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The inbox handlers of the delegation granted, revoked and expired events of the Identity service write the Delegations row with grantor, grantee, role, expiresAt and reason, set revokedAt on a revocation, and write the DelegationChanged outbox record with the change in the same transaction, idempotently on the event id; connectsoft.factory.projects.delegations_active follows the unexpired, unrevoked rows per tenant."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5410,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1818]",
      "number": 1818
    },
    {
      "id": "AIFACTORY-TASK-1819",
      "type": "task",
      "parent": "AIFACTORY-US-447",
      "title": "DelegationExpiryReconciler announcing an expiry once",
      "sequence": "01.04.10.03",
      "description": "DelegationExpiryReconciler announcing an expiry once. Expected output: The worker runs on the schedule of the model every ten minutes over Delegations rows past expiresAt with an empty revokedAt, partitioned by tenant with two partitions in parallel and three attempts at a fixed backoff of 60 seconds, writes DelegationChanged for the expiry under the idempotency key delegationId plus expiresAt, shares that key with the handler of the expiry event of the Identity service so one expiry is announced once, and writes nothing to the Identity service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The worker runs on the schedule of the model every ten minutes over Delegations rows past expiresAt with an empty revokedAt, partitioned by tenant with two partitions in parallel and three attempts at a fixed backoff of 60 seconds, writes DelegationChanged for the expiry under the idempotency key delegationId plus expiresAt, shares that key with the handler of the expiry event of the Identity service so one expiry is announced once, and writes nothing to the Identity service."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5410,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1819]",
      "number": 1819
    },
    {
      "id": "AIFACTORY-TASK-1820",
      "type": "task",
      "parent": "AIFACTORY-US-447",
      "title": "Verify delegate-a-project-role through the acceptance suite",
      "sequence": "01.04.10.04",
      "description": "Verify delegate-a-project-role through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-005|Scenario=SCN-ProjectService-006|Scenario=SCN-ProjectService-013)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-447 against the Identity fixture of AIFACTORY-TASK-1805 with a controlled clock, including the four 400 refusals with PlatformAdmin as the role among them, a grantee who is not a member of the tenant answered 404, a refused pair of the role order, a revocation sent before the grant event reached the projection, the revocation by each admitted actor, the expiry announced once by the reconciler and by the event in either order, and the publication and payload of DelegationChanged; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-005|Scenario=SCN-ProjectService-006|Scenario=SCN-ProjectService-013)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-447 against the Identity fixture of AIFACTORY-TASK-1805 with a controlled clock, including the four 400 refusals with PlatformAdmin as the role among them, a grantee who is not a member of the tenant answered 404, a refused pair of the role order, a revocation sent before the grant event reached the projection, the revocation by each admitted actor, the expiry announced once by the reconciler and by the event in either order, and the publication and payload of DelegationChanged; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5410,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1820]",
      "number": 1820
    },
    {
      "id": "AIFACTORY-US-448",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Replace the repositories, document collections and tools a run of the project may touch and announce the change",
      "sequence": "01.04.11",
      "description": "As a workspace admin, I want to state which repositories, document collections and tools the runs of my project may touch, so that no run reads or changes a source the project did not admit. A Workspace admin whose scope carries `factory.projects.admin` replaces the source scope of a project through `ProjectService/SetSourceScope`, a PUT whose body is the complete list of entries. An entry has a `kind` (repository, documents or tool), a `reference` of at most 512 characters and, when credentials are needed, the `connectionId` of a connection of the integration context, which ProjectService stores as an opaque reference and does not resolve. The stated list replaces the `SourceScopes` rows of the project in one transaction: rows that are no longer stated are deleted, new ones are inserted, and the `SourceScopeChanged` outbox record with `projectId`, `tenantId` and the resulting `entries` is written in the same transaction (ADR-0014 decision 4). The event carries `entries` as a list of strings, so each entry is rendered in one documented form: its `kind` and its `reference` joined by a colon, the kind first; a kind never holds a colon, so the first colon separates the two. The `connectionId` is not published. The command is naturally idempotent: a PUT that states the set already stored changes no row and publishes nothing. The answer is 200 with the stored scope. From then on `Projects.ResolveScope` returns the new set (AIFACTORY-US-445); RunControlService uses it for runs accepted from now on while the snapshot a running run pinned is unchanged, and KnowledgeIngestionService registers or disables sources, each in its own PBI. The command also leaves evidence. `SourceScopeChanged` names no actor and AuditService does not consume it, so the Factory sink of the audit library, consumed by a version pin from feature `component-audit-factory-evidence`, writes an `audit-evidence-v1` record that names the actor, the project, the replaced set and the new set to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` in the run event envelope; a command that rolls back leaves no evidence (D115). Who may call is decided from the token: the route needs the scope, and the role claims of the token must name the caller Workspace admin of the project or Platform admin. This command writes no role, so it does not ask the Identity service as the membership commands do. A caller without the scope, or a member of the tenant who by those claims is neither, is refused with 403; a project of another tenant is answered 404 like one that does not exist (ADR-0015 amendment of D113); an entry with an unknown kind, an empty reference, a reference longer than 512 characters or a duplicate of kind and reference is refused with 400, and in every refusal no row changes and nothing is published. The model lists the codes 200, 400, 403 and 404 for this route (D117). Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/SetSourceScope; events: ProjectService/SourceScopeChanged; descriptors: run-event-envelope-v1, audit-evidence-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-01, XL-01; scenarios: SCN-ProjectService-007, SCN-ProjectService-014. Relates: screens: project-settings; nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, feature:component-audit-factory-evidence. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, model/services/governance/AuditService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/planes/control/services/project-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin whose scope carries `factory.projects.admin` and a project with two source scope entries, when `ProjectService/SetSourceScope` states three entries of which one is already stored, then the response is 200 with the three entries, the rows of the project are replaced in one transaction, and the `ProjectService/SourceScopeChanged` outbox record with the resulting `entries` is written in the same transaction (SCN-ProjectService-007, ADR-0014).",
        "AC2: Given the stored set of AC1, when `ProjectService/SetSourceScope` states the same three entries again, then the response is 200, no row changes and no outbox record is written (SCN-ProjectService-007).",
        "AC3: Given a caller without `factory.projects.admin`, a member of the tenant who by the role claims of the token is neither Workspace admin of the project nor Platform admin, a project of another tenant, or a body with an unknown kind, an empty reference or a duplicate entry, when `ProjectService/SetSourceScope` is called, then the answer is 403, 403, 404 or 400 respectively with a problem response, no `SourceScopes` row changes and nothing is published (SCN-ProjectService-007, ADR-0015).",
        "AC4: Given the source scope changed, when the outbox dispatcher of the `project` messaging profile publishes `ProjectService/SourceScopeChanged` on `projects.scope.v1.source-scope-changed`, then the event is sent in `run-event-envelope-v1` with `projectId`, `tenantId` and `entries`, each entry rendered as its kind and its reference joined by a colon and without its connection id, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ProjectService-014, ADR-0012).",
        "AC5: Given the command of AC1 commits, when its outbox is read, then it holds one `audit-evidence-v1` record in `run-event-envelope-v1` for the topic `audit.evidence.v1.evidence-submitted` that names the actor, the project, the replaced set and the new set, and a command that rolls back leaves neither rows nor evidence (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1821",
        "AIFACTORY-TASK-1822",
        "AIFACTORY-TASK-1823"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5411,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/SetSourceScope"
        ],
        "events": [
          "ProjectService/SourceScopeChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "XL-01"
        ],
        "scenarios": [
          "SCN-ProjectService-007",
          "SCN-ProjectService-014"
        ]
      },
      "relates": {
        "screens": [
          "project-settings"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-448]",
      "number": 448
    },
    {
      "id": "AIFACTORY-TASK-1821",
      "type": "task",
      "parent": "AIFACTORY-US-448",
      "title": "SetSourceScope replacing the entries of a project with SourceScopeChanged in one transaction",
      "sequence": "01.04.11.01",
      "description": "SetSourceScope replacing the entries of a project with SourceScopeChanged in one transaction. Expected output: SetSourceScope validates every entry (kind repository, documents or tool, a reference of at most 512 characters, no duplicate of kind and reference) and answers 400 for a body that fails, replaces the SourceScopes rows of the project and writes the SourceScopeChanged outbox record in one transaction, with each entry rendered as its kind and its reference joined by a colon and the connection id left out, changes nothing and publishes nothing when the stated set is the stored one, answers 200 with the stored scope, 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, and 404 for a foreign or unknown project; the contract document of the event states the string form of an entry.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "SetSourceScope validates every entry (kind repository, documents or tool, a reference of at most 512 characters, no duplicate of kind and reference) and answers 400 for a body that fails, replaces the SourceScopes rows of the project and writes the SourceScopeChanged outbox record in one transaction, with each entry rendered as its kind and its reference joined by a colon and the connection id left out, changes nothing and publishes nothing when the stated set is the stored one, answers 200 with the stored scope, 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, and 404 for a foreign or unknown project; the contract document of the event states the string form of an entry."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5411,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1821]",
      "number": 1821
    },
    {
      "id": "AIFACTORY-TASK-1822",
      "type": "task",
      "parent": "AIFACTORY-US-448",
      "title": "Evidence of a source scope change through the Factory sink of the audit library",
      "sequence": "01.04.11.02",
      "description": "Evidence of a source scope change through the Factory sink of the audit library. Expected output: The repository pins the audit library at the version feature component-audit-factory-evidence published and opens an audit scope in SetSourceScope, so that one audit-evidence-v1 record with the actor, the project, the replaced set and the new set is written to the outbox in the transaction of the command on the topic audit.evidence.v1.evidence-submitted in the run event envelope; the topic and the event type name are constants of the pinned contracts package.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The repository pins the audit library at the version feature component-audit-factory-evidence published and opens an audit scope in SetSourceScope, so that one audit-evidence-v1 record with the actor, the project, the replaced set and the new set is written to the outbox in the transaction of the command on the topic audit.evidence.v1.evidence-submitted in the run event envelope; the topic and the event type name are constants of the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5411,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1822]",
      "number": 1822
    },
    {
      "id": "AIFACTORY-TASK-1823",
      "type": "task",
      "parent": "AIFACTORY-US-448",
      "title": "Verify set-project-source-scope through the acceptance suite",
      "sequence": "01.04.11.03",
      "description": "Verify set-project-source-scope through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-007|Scenario=SCN-ProjectService-014)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-448, including the replaced rows, the unchanged repeat, the 400, 403 and 404 refusals, the evidence record in the outbox and the publication and payload of SourceScopeChanged with the string form of its entries; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-007|Scenario=SCN-ProjectService-014)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-448, including the replaced rows, the unchanged repeat, the 400, 403 and 404 refusals, the evidence record in the outbox and the publication and payload of SourceScopeChanged with the string form of its entries; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5411,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1823]",
      "number": 1823
    },
    {
      "id": "AIFACTORY-US-449",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Close a project through a journaled off-boarding that waits for the confirmations of its runs and of its data, and announce every state change of the project",
      "sequence": "01.04.12",
      "description": "As a workspace admin, I want to close a project and see when its off-boarding has really finished, so that its runs stop, delegated access ends and its data is exported or deleted as my tenant decided. A Workspace admin whose scope carries `factory.projects.admin` starts the off-boarding of a project through `ProjectService/CloseProject`, an operation of the production side-effect class. The project moves from Active or from Suspended to Closing (trigger `Close`); the member who closed it and the time of the close are recorded with the project in `closedBy` and `closeRequestedAt`, and the `ProjectStateChanged` outbox record with `fromState`, `toState` and the closing member in `changedBy` is written in the same transaction. The answer is 202: Closing is a real state because off-boarding is a procedure with external effects (XL-13). A project that is already Closing or Closed is refused with 409; a caller without the scope, or one who by the role claims of the token is neither Workspace admin of the project nor Platform admin, with 403; and a project of another tenant is answered 404 like one that does not exist (ADR-0015 amendment of D113). The `ProjectOffboardingWorker` is triggered by the `ProjectStateChanged` that announces Closing and by the two confirmations named below, one project at a time per tenant, and runs a journaled procedure. The journal is the table `OffboardingJournal` of the model, with one row per project and step that holds when the step completed or, for a step that failed, when and why; the table and the two columns of the closing actor are added by the migration task of this PBI. A restart resumes at the first step the journal does not hold as completed and repeats none. The worker is idempotent on `projectId` plus Closing and retries ten times with exponential backoff from 60 seconds. The owner decided that a project stays Closing until two other services have confirmed their part (D117), so the procedure has five journaled steps. First, the Closing announcement is confirmed as published. It is the signal on which RunControlService refuses new runs with 409 and cancels the open runs of the project, IntegrationService revokes the project grants, and ArtifactService and KnowledgeIngestionService export or delete the artifacts and sources of the project per tenant policy, each in its own PBI. Second, every delegation of the project that is neither revoked nor expired is revoked through the Identity service, written with the workload token of ProjectService and naming the recorded closing member as actor; the projection follows from the revocation events (AIFACTORY-US-447). When the Identity service refuses that actor, for example because the member lost the role after closing the project, the step fails, the journal names the step and the refusal, and the project stays Closing. Third, the confirmation of RunControlService: when `RunControlService/ProjectRunsSettled` arrives, the inbox handler `RecordRunsSettled` writes to the journal that no non-terminal run of the project remains. Fourth, the confirmation of ArtifactService: when `ArtifactService/ProjectDataOffboarded` arrives with the outcome exported or deleted, the inbox handler `RecordDataOffboarded` writes to the journal that the data of the project was exported or deleted. The two confirmations arrive in any order and may arrive before the revocations have finished; each handler is idempotent on the event id, writes its journal row once and ignores a confirmation for a project that is not Closing. Fifth, when the journal holds the four earlier steps as completed, the project moves from Closing to Closed (trigger `OffboardingCompleted`) with its `ProjectStateChanged` outbox record in the same transaction, and `connectsoft.factory.projects.active` falls by one. Until both confirmations are journaled the project stays Closing, however long that takes; the worker neither assumes a confirmation nor calls RunControlService or ArtifactService for it, because the model gives it these two events and no call. A project that stays Closing is the failure mode Off-boarding interrupted of the model: the worker resumes from the journal, and exhausted retries leave the project Closing with the failed step named in the journal, never Closed. The aggregate has two more transitions, Active to Suspended (trigger `Suspend`) and Suspended to Active (trigger `Resume`); the commands `SuspendProject` and `ResumeProject` that raise them are delivered by AIFACTORY-US-550, and each writes `ProjectStateChanged` in its transaction like the transitions of this PBI. `ProjectStateChanged` is published on `projects.projects.v1.project-state-changed` in the run event envelope with `projectId`, `tenantId`, `fromState` and `toState`, with `changedBy` when a member caused the transition and with the `reason` stated for a suspension or a resumption; RunControlService, IntegrationService, ArtifactService, KnowledgeIngestionService, StudioBff and AuditService consume it in their own PBIs. Kind: behavior. Traces: services: ProjectService, RunControlService, ArtifactService; aggregates: ProjectService/Project; apis: ProjectService/CloseProject; events: ProjectService/ProjectStateChanged, RunControlService/ProjectRunsSettled, ArtifactService/ProjectDataOffboarded; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019; requirements: FR-01, XL-13, NFR-03; scenarios: SCN-ProjectService-008, SCN-ProjectService-011. Relates: nfrs: NFR-03. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, AIFACTORY-US-447, feature:component-identity-template-factory-roles, feature:run-control-service, feature:artifact-service. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, model/services/control-plane/RunControlService.yaml, model/services/knowledge/ArtifactService.yaml, docs/planes/control/services/project-service/index.md#sagas-and-long-running-flows, docs/planes/control/services/project-service/index.md#failure-and-recovery, docs/architecture/data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin whose scope carries `factory.projects.admin` and a project that is Active or Suspended, when `ProjectService/CloseProject` is called, then the response is 202, the `ProjectService/Project` is Closing, the closing member and the time of the close are recorded with it, and the `ProjectService/ProjectStateChanged` outbox record with `fromState` and `toState` is written in the same transaction (SCN-ProjectService-008).",
        "AC2: Given a caller without `factory.projects.admin` or who by the role claims of the token is neither Workspace admin of the project nor Platform admin, a project of another tenant, or a project that is already Closing or Closed, when `ProjectService/CloseProject` is called, then the answer is 403, 404 or 409 respectively, the 404 being the same answer as for a project that does not exist, with a problem response and no state change (SCN-ProjectService-008, ADR-0015).",
        "AC3: Given a Closing project with two delegations that are neither revoked nor expired, when the `ProjectOffboardingWorker` runs and neither confirmation has arrived, then the off-boarding journal holds a completed row for the confirmed Closing announcement and one for the revocations, the Identity service received one revocation per delegation written with the workload token of ProjectService and naming the recorded closing member as actor, and the `ProjectService/Project` is still Closing; when `RunControlService/ProjectRunsSettled` and `ArtifactService/ProjectDataOffboarded` then arrive, in either order, then the handlers `RecordRunsSettled` and `RecordDataOffboarded` each write their journal row once, and only after both the project moves to Closed with a second `ProjectService/ProjectStateChanged` in the same transaction as the last journal row; a duplicate trigger or a redelivered confirmation has no second effect (SCN-ProjectService-008, SCN-ProjectService-011, XL-13).",
        "AC4: Given the worker stops after its first journaled step, the Identity service is unavailable during the second, the Identity service refuses the recorded closing actor, or only one of the two confirmations has arrived, when the worker runs again, then it resumes at the first step the journal does not hold as completed and repeats none, the journal names a failed step with its reason, a project without both confirmations stays Closing, and after its retries are exhausted the project is still Closing and never Closed, as the failure mode of docs/planes/control/services/project-service/index.md states (SCN-ProjectService-008, SCN-ProjectService-011).",
        "AC5: Given any of the five transitions of the `ProjectService/Project` (Active to Suspended, Suspended to Active, Active to Closing, Suspended to Closing, Closing to Closed), when the outbox dispatcher publishes `ProjectService/ProjectStateChanged` on `projects.projects.v1.project-state-changed`, then the outbox record was written in the transaction of the transition, the event is sent in `run-event-envelope-v1` with `projectId`, `tenantId`, `fromState` and `toState`, with `changedBy` when a member caused the transition and with the `reason` of a suspension or a resumption, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ProjectService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/control/services/project-service/index.md#sagas-and-long-running-flows",
        "docs/planes/control/services/project-service/index.md#failure-and-recovery",
        "docs/architecture/data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1845",
        "AIFACTORY-TASK-1824",
        "AIFACTORY-TASK-021",
        "AIFACTORY-TASK-2205",
        "AIFACTORY-TASK-2206",
        "AIFACTORY-TASK-1825"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5412,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService",
          "RunControlService",
          "ArtifactService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/CloseProject"
        ],
        "events": [
          "ProjectService/ProjectStateChanged",
          "RunControlService/ProjectRunsSettled",
          "ArtifactService/ProjectDataOffboarded"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-01",
          "XL-13",
          "NFR-03"
        ],
        "scenarios": [
          "SCN-ProjectService-008",
          "SCN-ProjectService-011"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "AIFACTORY-US-447",
        "feature:component-identity-template-factory-roles",
        "feature:run-control-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/control/services/project-service/index.md#sagas-and-long-running-flows",
        "docs/planes/control/services/project-service/index.md#failure-and-recovery",
        "docs/architecture/data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-449]",
      "number": 449
    },
    {
      "id": "AIFACTORY-TASK-1845",
      "type": "task",
      "parent": "AIFACTORY-US-449",
      "title": "Migration of the off-boarding journal and of the closing actor of a project",
      "sequence": "01.04.12.01",
      "description": "Migration of the off-boarding journal and of the closing actor of a project. Expected output: A migration of project-sql adds the table OffboardingJournal of the model, tenant-filtered and keyed by project and step with the time the step completed and, for a failed step, the time and the reason of the failure, and adds to Projects the nullable columns ClosedBy and CloseRequestedAt of the model for the member who closed the project and the time of the close; mapping tests on an isolated test database prove both.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration of project-sql adds the table OffboardingJournal of the model, tenant-filtered and keyed by project and step with the time the step completed and, for a failed step, the time and the reason of the failure, and adds to Projects the nullable columns ClosedBy and CloseRequestedAt of the model for the member who closed the project and the time of the close; mapping tests on an isolated test database prove both."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5412,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1845]",
      "number": 1845
    },
    {
      "id": "AIFACTORY-TASK-1824",
      "type": "task",
      "parent": "AIFACTORY-US-449",
      "title": "CloseProject and the ProjectStateChanged record of every transition of the project",
      "sequence": "01.04.12.02",
      "description": "CloseProject and the ProjectStateChanged record of every transition of the project. Expected output: CloseProject applies the trigger Close to an Active or a Suspended project, records the closing member and the time of the close in closedBy and closeRequestedAt and writes the ProjectStateChanged outbox record with fromState, toState and the closing member in changedBy in the same transaction, answers 202, 409 for a project that is Closing or Closed, 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, and 404 for a foreign or unknown project; every transition of the project writes ProjectStateChanged in its transaction, the commands that raise Suspend and Resume being delivered by AIFACTORY-TASK-2208 of AIFACTORY-US-550; connectsoft.factory.projects.active follows the projects that are not Closed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "CloseProject applies the trigger Close to an Active or a Suspended project, records the closing member and the time of the close in closedBy and closeRequestedAt and writes the ProjectStateChanged outbox record with fromState, toState and the closing member in changedBy in the same transaction, answers 202, 409 for a project that is Closing or Closed, 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, and 404 for a foreign or unknown project; every transition of the project writes ProjectStateChanged in its transaction, the commands that raise Suspend and Resume being delivered by AIFACTORY-TASK-2208 of AIFACTORY-US-550; connectsoft.factory.projects.active follows the projects that are not Closed."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5412,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1824]",
      "number": 1824
    },
    {
      "id": "AIFACTORY-TASK-021",
      "type": "task",
      "parent": "AIFACTORY-US-449",
      "title": "ProjectOffboardingWorker as a journaled procedure from Closing to Closed that waits for the two confirmations",
      "sequence": "01.04.12.03",
      "description": "ProjectOffboardingWorker as a journaled procedure from Closing to Closed that waits for the two confirmations. Expected output: The worker is triggered by the ProjectStateChanged that announces Closing and by ProjectRunsSettled and ProjectDataOffboarded, runs one project at a time per tenant, is idempotent on projectId plus Closing and retries ten times with exponential backoff from 60 seconds; it writes one row of the off-boarding journal of AIFACTORY-TASK-1845 per completed step of its own (the confirmed Closing announcement, the revocation of every unexpired delegation through the Identity service with the recorded closing member named as actor), reads the rows of the two confirmations that AIFACTORY-TASK-2205 writes, and applies OffboardingCompleted with its ProjectStateChanged record and the last journal row in one transaction only when the journal holds the announcement, the revocations, the confirmation of RunControlService and the confirmation of ArtifactService as completed; it resumes at the first step the journal does not hold as completed, writes the failed step with its reason when the Identity service is unavailable or refuses the recorded actor, leaves the project Closing while a confirmation is missing and when its retries are exhausted, and calls neither RunControlService nor ArtifactService; a duplicate trigger has no second effect.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The worker is triggered by the ProjectStateChanged that announces Closing and by ProjectRunsSettled and ProjectDataOffboarded, runs one project at a time per tenant, is idempotent on projectId plus Closing and retries ten times with exponential backoff from 60 seconds; it writes one row of the off-boarding journal of AIFACTORY-TASK-1845 per completed step of its own (the confirmed Closing announcement, the revocation of every unexpired delegation through the Identity service with the recorded closing member named as actor), reads the rows of the two confirmations that AIFACTORY-TASK-2205 writes, and applies OffboardingCompleted with its ProjectStateChanged record and the last journal row in one transaction only when the journal holds the announcement, the revocations, the confirmation of RunControlService and the confirmation of ArtifactService as completed; it resumes at the first step the journal does not hold as completed, writes the failed step with its reason when the Identity service is unavailable or refuses the recorded actor, leaves the project Closing while a confirmation is missing and when its retries are exhausted, and calls neither RunControlService nor ArtifactService; a duplicate trigger has no second effect."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5412,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-021]",
      "number": 21
    },
    {
      "id": "AIFACTORY-TASK-2205",
      "type": "task",
      "parent": "AIFACTORY-US-449",
      "title": "RecordRunsSettled and RecordDataOffboarded inbox handlers writing the two confirmations to the off-boarding journal",
      "sequence": "01.04.12.04",
      "description": "RecordRunsSettled and RecordDataOffboarded inbox handlers writing the two confirmations to the off-boarding journal. Expected output: The handler of ProjectRunsSettled writes the journal row of the confirmation of RunControlService and the handler of ProjectDataOffboarded writes the journal row of the confirmation of ArtifactService with the outcome exported or deleted, each for the Closing project the event names in the tenant of the event, once and idempotently on the event id; a confirmation for a project that is not Closing, or that is unknown in that tenant, writes nothing and is acknowledged; each written row triggers the ProjectOffboardingWorker.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The handler of ProjectRunsSettled writes the journal row of the confirmation of RunControlService and the handler of ProjectDataOffboarded writes the journal row of the confirmation of ArtifactService with the outcome exported or deleted, each for the Closing project the event names in the tenant of the event, once and idempotently on the event id; a confirmation for a project that is not Closing, or that is unknown in that tenant, writes nothing and is acknowledged; each written row triggers the ProjectOffboardingWorker."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5412,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2205]",
      "number": 2205
    },
    {
      "id": "AIFACTORY-TASK-2206",
      "type": "task",
      "parent": "AIFACTORY-US-449",
      "title": "Acceptance fixture publishing ProjectRunsSettled and ProjectDataOffboarded for a closing project",
      "sequence": "01.04.12.05",
      "description": "Acceptance fixture publishing ProjectRunsSettled and ProjectDataOffboarded for a closing project. Expected output: The acceptance suite publishes ProjectRunsSettled and ProjectDataOffboarded for a stated project and tenant through fixture publishers, in a stated order and with a stated outcome, and can withhold either, so that the waiting in Closing, both orders of arrival, a redelivery and a confirmation for a project that is not Closing are reproducible without RunControlService and ArtifactService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The acceptance suite publishes ProjectRunsSettled and ProjectDataOffboarded for a stated project and tenant through fixture publishers, in a stated order and with a stated outcome, and can withhold either, so that the waiting in Closing, both orders of arrival, a redelivery and a confirmation for a project that is not Closing are reproducible without RunControlService and ArtifactService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5412,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2206]",
      "number": 2206
    },
    {
      "id": "AIFACTORY-TASK-1825",
      "type": "task",
      "parent": "AIFACTORY-US-449",
      "title": "Verify close-a-project through the acceptance suite",
      "sequence": "01.04.12.06",
      "description": "Verify close-a-project through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-008|Scenario=SCN-ProjectService-011)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-449 against the Identity fixture of AIFACTORY-TASK-1805 and the fixture publishers of AIFACTORY-TASK-2206, including the recorded closing member, the 403, 404 and 409 refusals, the journal rows after a complete and after an interrupted run, the failed step named when the fixture refuses the recorded actor, the revocations the fixture received, the project that stays Closing with no confirmation and with one confirmation, the two confirmations in either order, a redelivered confirmation, and the publication and payload of ProjectStateChanged for each of the five transitions; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-008|Scenario=SCN-ProjectService-011)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-449 against the Identity fixture of AIFACTORY-TASK-1805 and the fixture publishers of AIFACTORY-TASK-2206, including the recorded closing member, the 403, 404 and 409 refusals, the journal rows after a complete and after an interrupted run, the failed step named when the fixture refuses the recorded actor, the revocations the fixture received, the project that stays Closing with no confirmation and with one confirmation, the two confirmations in either order, a redelivered confirmation, and the publication and payload of ProjectStateChanged for each of the five transitions; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5412,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1825]",
      "number": 1825
    },
    {
      "id": "AIFACTORY-US-550",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-005",
      "title": "Suspend an active project and resume a suspended one with a stated reason, and announce both with the actor and the reason",
      "sequence": "01.04.13",
      "description": "As a workspace admin, I want to suspend my project with a reason and to resume it later, so that no run starts or goes on in a project I had to stop, and everyone can see who stopped it and why. The owner decided that a project is suspended and resumed by command (D117), so the transitions Active to Suspended (trigger `Suspend`) and Suspended to Active (trigger `Resume`) of the `Project`, which the domain model of AIFACTORY-US-441 already enforces, are raised by two routes. A caller whose scope carries `factory.projects.admin` suspends a project through `ProjectService/SuspendProject`, a POST on the project of the path with a body that states a reason, and resumes it through `ProjectService/ResumeProject`, a POST with a reason as well. Both are operations of the production side-effect class with natural idempotency. Who may call is decided as for `CloseProject`: the route needs the scope, and the role claims of the token must name the caller Workspace admin of the project or Platform admin. The reason is required: a body without a reason, or with a blank one, is refused with 400. `SuspendProject` applies to an Active project only and `ResumeProject` to a Suspended one only; a project in any other state is refused with 409, which is also the answer to a repeated suspension of a project that is already Suspended and to a repeated resumption of one that is Active again. A caller without the scope, or one who by the role claims of the token is neither Workspace admin of the project nor Platform admin, is refused with 403, and a project of another tenant is answered 404 like one that does not exist (ADR-0015 amendment of D113). On success the project changes state and the `ProjectStateChanged` outbox record with `projectId`, `tenantId`, `fromState`, `toState`, the caller in `changedBy` and the stated `reason` is written in the same transaction, and the answer is 200 with the project. That event is also how the command is audited: it names the actor and the reason, and AuditService, which consumes `ProjectStateChanged`, records it as evidence in its own PBI; a command that is refused or rolls back writes no event. The event is published on `projects.projects.v1.project-state-changed` in the run event envelope. Its effect on runs belongs to RunControlService: on the announcement of Suspended its handler `GateRunsByProject` keeps the state in the table `GateStates`, from which `SubmitRun` refuses new runs of the project with 409 and a problem body that names the gate, and records a cancellation intent for every open run of the project; on the announcement of Active after a resumption new runs are accepted again, and the runs that were cancelled stay Cancelled, since a resumption restarts nothing. With these two routes the suspended-project gate of RunControlService is reachable on a deployed instance. A Suspended project is not being off-boarded: its delegations stay, nothing is exported or deleted, and it can be closed from Suspended through `CloseProject` (AIFACTORY-US-449). The model restricts no other route for a Suspended project, so memberships, delegations, the source scope and the reads answer as before, and `Projects.ResolveScope` answers for a project in any state (AIFACTORY-US-445). StudioBff, IntegrationService, ArtifactService and KnowledgeIngestionService also consume the event, to refresh a view or to act on Closing only, each in its own PBI. Kind: behavior. Traces: services: ProjectService; aggregates: ProjectService/Project; apis: ProjectService/SuspendProject, ProjectService/ResumeProject; events: ProjectService/ProjectStateChanged; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-01, NFR-01; scenarios: SCN-ProjectService-015, SCN-ProjectService-016. Relates: screens: project-settings; nfrs: NFR-01. Depends on: AIFACTORY-US-441, AIFACTORY-US-442, AIFACTORY-US-449. Sources: model/services/control-plane/ProjectService.yaml, model/scenarios/ProjectService.yaml, docs/planes/control/services/project-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin of an Active project whose scope carries `factory.projects.admin`, or a Platform admin, when `ProjectService/SuspendProject` is called with a reason, then the response is 200, the `ProjectService/Project` is Suspended, and the `ProjectService/ProjectStateChanged` outbox record with `fromState` Active, `toState` Suspended, the caller in `changedBy` and the stated `reason` is written in the same transaction (SCN-ProjectService-015).",
        "AC2: Given the Suspended project, when `ProjectService/ResumeProject` is called with a reason by a Workspace admin of the project or a Platform admin, then the response is 200, the project is Active again, and the `ProjectService/ProjectStateChanged` outbox record with `fromState` Suspended, `toState` Active, the caller in `changedBy` and the stated `reason` is written in the same transaction (SCN-ProjectService-016).",
        "AC3: Given a body without a reason or with a blank one, a caller without `factory.projects.admin` or who by the role claims of the token is neither Workspace admin of the project nor Platform admin, a project of another tenant, or a project that is not Active for `ProjectService/SuspendProject` or not Suspended for `ProjectService/ResumeProject`, when the route is called, then the answer is 400, 403, 404 or 409 respectively, the 404 being the same answer as for a project that does not exist, with a problem response, no state change and no event (SCN-ProjectService-015, SCN-ProjectService-016, ADR-0015).",
        "AC4: Given a project was suspended or resumed, when the outbox dispatcher of the `project` messaging profile publishes `ProjectService/ProjectStateChanged` on `projects.projects.v1.project-state-changed`, then the event is sent in `run-event-envelope-v1` with `projectId`, `tenantId`, `fromState`, `toState`, `changedBy` and `reason`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ProjectService-015, SCN-ProjectService-016, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2207",
        "AIFACTORY-TASK-2208",
        "AIFACTORY-TASK-2209"
      ],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5413,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService"
        ],
        "aggregates": [
          "ProjectService/Project"
        ],
        "apis": [
          "ProjectService/SuspendProject",
          "ProjectService/ResumeProject"
        ],
        "events": [
          "ProjectService/ProjectStateChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-ProjectService-015",
          "SCN-ProjectService-016"
        ]
      },
      "relates": {
        "screens": [
          "project-settings"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-441",
        "AIFACTORY-US-442",
        "AIFACTORY-US-449"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/ProjectService.yaml",
        "docs/planes/control/services/project-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-550]",
      "number": 550
    },
    {
      "id": "AIFACTORY-TASK-2207",
      "type": "task",
      "parent": "AIFACTORY-US-550",
      "title": "Contract of SuspendProject and ResumeProject and of the actor and the reason in ProjectStateChanged",
      "sequence": "01.04.13.01",
      "description": "Contract of SuspendProject and ResumeProject and of the actor and the reason in ProjectStateChanged. Expected output: The OpenAPI document of the service holds SuspendProject and ResumeProject, each a POST on the project of the path with a body that requires a reason, the answer 200 with the project and the answers 400, 403, 404 and 409 as problem responses, as model/services/control-plane/ProjectService.yaml lists them; the contract of ProjectStateChanged holds the optional fields changedBy and reason beside projectId, tenantId, fromState and toState.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service holds SuspendProject and ResumeProject, each a POST on the project of the path with a body that requires a reason, the answer 200 with the project and the answers 400, 403, 404 and 409 as problem responses, as model/services/control-plane/ProjectService.yaml lists them; the contract of ProjectStateChanged holds the optional fields changedBy and reason beside projectId, tenantId, fromState and toState."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5413,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2207]",
      "number": 2207
    },
    {
      "id": "AIFACTORY-TASK-2208",
      "type": "task",
      "parent": "AIFACTORY-US-550",
      "title": "SuspendProject and ResumeProject with a required reason and ProjectStateChanged in the transaction of the transition",
      "sequence": "01.04.13.02",
      "description": "SuspendProject and ResumeProject with a required reason and ProjectStateChanged in the transaction of the transition. Expected output: SuspendProject applies the trigger Suspend to an Active project and ResumeProject the trigger Resume to a Suspended one, each writing the ProjectStateChanged outbox record with fromState, toState, the caller in changedBy and the stated reason in the same transaction and answering 200 with the project; both answer 400 for a missing or blank reason, 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, 404 for a foreign or unknown project and 409 for a project in any other state, a repeated call included, and a refused command writes no event.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "SuspendProject applies the trigger Suspend to an Active project and ResumeProject the trigger Resume to a Suspended one, each writing the ProjectStateChanged outbox record with fromState, toState, the caller in changedBy and the stated reason in the same transaction and answering 200 with the project; both answer 400 for a missing or blank reason, 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, 404 for a foreign or unknown project and 409 for a project in any other state, a repeated call included, and a refused command writes no event."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5413,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2208]",
      "number": 2208
    },
    {
      "id": "AIFACTORY-TASK-2209",
      "type": "task",
      "parent": "AIFACTORY-US-550",
      "title": "Verify suspend-and-resume-a-project through the acceptance suite",
      "sequence": "01.04.13.03",
      "description": "Verify suspend-and-resume-a-project through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-015|Scenario=SCN-ProjectService-016)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-550 with projects of two tenants, including the suspension and the resumption by a Workspace admin and by a Platform admin, the 400 for a missing and for a blank reason, the 403, the 404 for a foreign project, the 409 for a repeated suspension, for a resumption of an Active project and for a Closing project, and the publication and payload of ProjectStateChanged with changedBy and reason; the refusal of new runs and the cancellation of open ones are proven by the suite of RunControlService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ProjectService-015|Scenario=SCN-ProjectService-016)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-550 with projects of two tenants, including the suspension and the resumption by a Workspace admin and by a Platform admin, the 400 for a missing and for a blank reason, the 403, the 404 for a foreign project, the 409 for a repeated suspension, for a resumption of an Active project and for a Closing project, and the publication and payload of ProjectStateChanged with changedBy and reason; the refusal of new runs and the cancellation of open ones are proven by the suite of RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 54,
      "phase": "factory",
      "stackRank": 5413,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2209]",
      "number": 2209
    },
    {
      "id": "AIFACTORY-FEAT-006",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "RunControlService: complete delivery",
      "sequence": "01.05",
      "description": "RunControlService is the service of bounded context BC-03 (Run Control). Single authority for run, step, attempt and lease state; commits every transition and its outbox record in one transaction (BC-03). Its own repository is ConnectSoft.AI.SoftwareFactory.RunControlService. Delivers: RunControlService (complete). Increment I1: Generate a microservice. Build order 55 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-005",
        "AIFACTORY-US-161",
        "AIFACTORY-US-162",
        "AIFACTORY-US-163",
        "AIFACTORY-US-164",
        "AIFACTORY-US-165",
        "AIFACTORY-US-166",
        "AIFACTORY-US-167",
        "AIFACTORY-US-168",
        "AIFACTORY-US-546",
        "AIFACTORY-US-547",
        "AIFACTORY-US-548",
        "AIFACTORY-US-656",
        "AIFACTORY-US-657",
        "AIFACTORY-US-658",
        "AIFACTORY-US-726",
        "AIFACTORY-US-1491",
        "AIFACTORY-US-1492",
        "AIFACTORY-US-1606",
        "AIFACTORY-US-1607"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5500,
      "titlePrefix": "[AIFACTORY-FEAT-006]",
      "number": 6
    },
    {
      "id": "AIFACTORY-US-005",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Submit a vision and receive a run",
      "sequence": "01.05.01",
      "description": "As a requester, I want to submit a vision brief for my project and receive a run I can follow, so that the Factory starts working on my product without anyone starting workflows by hand. A requester whose scope carries `factory.runs.write` submits a vision brief as `run-submission-v1` through the gateway route of `RunControlService/SubmitRun`, with an `Idempotency-Key`. The project of the run comes from the trusted scope of the authenticated context, never from the body (ADR-0015): `run-submission-v1` names a workflow, a release alias or release id and a model profile and may name an `environmentId`, the environment of the project the run targets, and the caller must be a member of the project the scope names. The service resolves the release alias to an immutable release through AgentRegistryService, evaluates the active policy revision through PolicyEngineService, pins `releaseId`, `policyRevision` and `snapshotId` on the `Run`, copies the optional `environmentId` of the submission to `Run.environmentId`, writes the resolved execution snapshot of the run (`resolved-execution-snapshot-v1`) to ArtifactService through `ArtifactService/Artifacts.Store`, once, and only then commits the run in state Accepted, with the reference and the hash of the stored snapshot in `snapshotRef` and `snapshotHash`, together with its `RunAccepted` outbox record in one transaction; in that transaction the release ids the snapshot names in `pinnedReleases`, the pinned release and every member of its closure, are written to the table `RunPinnedReleases`, through which the handler of a later revocation finds the runs whose pinned closure holds a revoked release (D125, AIFACTORY-US-736 of feature `agent-registry-service-complete`); the response is 202 with the run location. A run is never accepted without a stored snapshot (D121): when ArtifactService is unreachable the submission fails fast, nothing is committed or published, and the caller repeats it under the same `Idempotency-Key`; the store is idempotent on tenant and hash, so the repeat leaves one snapshot. A repeated submission under the same key and the same input hash returns the same run; a different input under the same key is refused as a conflict with 409; an invalid body is refused with 400, and so is a body that carries a parent field, `parentRunId` or `parentAttemptId`, because a parent is named only through the internal `RunControl.SubmitChildRun` (AIFACTORY-US-656, D121); a caller without the scope or who is not a member of the project is refused with 403. A service submits a run through the same route with a service token that holds the service scope `factory.runs.submit` and names the project of the submission, as QualityScoreService does for the evaluation task runs of its `SuiteRunner` (D131): the run records the submitting service in `submittingService` and the requester the token names in `requestedBy`, and it passes the same gates of the project, the environment and the release, the same budget reservation and the same spend approval as a run a user submitted; a service token that names another project or lacks the scope is refused with 403 and writes nothing. Five gates also answer 409, each with a problem body that names the gate: the project is suspended, closing or closed (`GateRunsByProject`), states a project reaches through `SuspendProject` and `CloseProject` of ProjectService; the alias points at a deprecated release (`BlockNewPins`); the release the submission would pin is Revoked, because a revoked release is never pinned (`ApplyRevocationPolicy`, D119), which is also the answer for as long as the alias of the submission points at a Revoked release: the alias stays in place, its resolution names the revoked release, and the answer stays 409 until an administrator moves the alias (D121); the environment that `environmentId` names is retired (`GateRunsByEnvironment`); or, the production gate, the environment that `environmentId` names is of production class and the release the submission pinned is not Published (D117). A gated submission writes no run and publishes nothing. The gates read the last announced state of the project, the release and the environment from the table `GateStates`, which those four inbox handlers keep from the events of ProjectService, AgentRegistryService and EnvironmentService; for an environment the row keeps the announced class beside the announced state, and the production gate compares that class with the state of the release that the resolution of the release at this submission returned. `SubmitRun` calls no other service to evaluate a gate, and a run without an `environmentId` is never gated by an environment. How a project, a release or an environment without a row in `GateStates` is treated is an open point of the model that the owner has not decided, and this PBI does not decide it. This PBI proves what the publisher can prove: the `RunAccepted` outbox record is written with the run and published under the canonical envelope, without the optional `parentRunId` that only the event of a child run carries (D121) and with the optional `submittingService` for a run a service submitted (D131); WorkflowEngineService starts the `vision-to-blueprint` workflow run, CostUsageService reserves the budget and AuditService records the submission as evidence from that event, which is the evidence path of a run submission (D135), in their own PBIs. Holding the accepted runs of a frozen environment, releasing them when it is active again and failing them when it is retired is the other half of `GateRunsByEnvironment` and is delivered by AIFACTORY-US-168. The requester follows the run through the Studio run detail or the CLI, which submits the brief from a file, prints the run identifier and watches the state until the run ends. Of the 26 consumed events of the model the feature registers the handlers of 18, among them `BindChangeProposal` of `ChangeProposalOpened` and `ChangeProposalMerged` (AIFACTORY-US-1606), `RefreshSourceScope` of `SourceScopeChanged` (AIFACTORY-US-1607) and `PinActivePolicyRevision` of `PolicyRevisionActivated`, which keeps the activated revision of a scope in `GateStates` for the runs accepted from then on while a running run keeps the revision it pinned (AIFACTORY-TASK-6671, D141). The handlers of five events whose producers arrive in I2 are built and proven in I2 in this repository by the features of those producers (D140): `SettleWaitingStep` of `PipelineRunCompleted` by feature `pipeline-execution-service-complete` (AIFACTORY-US-1608), `SettleWaitingStep` of `PromotionCompleted` and `PromotionFailed` by feature `environment-promotion-service` (AIFACTORY-US-1621), each looking up the waiting step directly by the `runId` and `stepRunId` the event echoes from the requesting step (D141), and `HoldDispatchOnQuota` of `QuotaExceeded` and `ResumeDispatchOnQuota` of `QuotaChanged` by feature `execution-capacity-service-complete` (AIFACTORY-US-1609, AIFACTORY-US-1610). The handlers of the three events of RetentionResidencyService, `DeletionOrderIssued`, `LegalHoldChanged` and `RetentionRuleChanged`, are built and proven in I4 in this repository by feature `retention-residency-service` (D121, D137, D140), and this feature registers none of these eight. The retention sweep of the recovery journal, which applies `RunControl:Journal RetentionDays` and the handler `ApplyRetentionRule`, therefore arrives with feature `retention-residency-service` in I4 (D140): until then the journal keeps every entry and no row of `RecoveryJournal` is deleted. The table `RecoveryJournal` is partitioned by the month of `OccurredAt` from its first migration; only a separate retention identity, used by that sweep (AIFACTORY-US-1459 of feature `retention-residency-service`), may drop whole partitions older than `RunControl:Journal RetentionDays`, and the service identity keeps DELETE denied, so the journal stays append-only for the service (D141). When the store `run-control-sql` is lost it is restored by the runbook of AIFACTORY-TASK-6514. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService, created in I0 by the repository checklist of feature `repository-and-pipeline-conventions` and taken here as it stands. Kind: behavior. Traces: services: RunControlService, ControlPlaneApi, ProjectService, AgentRegistryService, PolicyEngineService, ArtifactService; aggregates: RunControlService/Run; apis: RunControlService/SubmitRun, RunControlService/GetRun, ArtifactService/Artifacts.Store; events: RunControlService/RunAccepted; workflows: vision-to-blueprint; descriptors: run-submission-v1, run-accepted-v1, resolved-execution-snapshot-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024; requirements: FR-03, FUX-04, XL-03; scenarios: SCN-RunControlService-001, SCN-RunControlService-011. Relates: screens: run-submit, run-detail; nfrs: NFR-05. Depends on: feature:control-plane-api, feature:project-service, feature:agent-registry-service-thin, feature:policy-engine-service, feature:artifact-service, feature:repository-and-pipeline-conventions. Sources: model/services/control-plane/RunControlService.yaml, model/workflows/vision-to-blueprint.yaml, docs/reference/schemas/run-submission.schema.json, docs/reference/schemas/resolved-execution-snapshot.schema.json, docs/planes/control/services/run-control-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller whose trusted scope names a project the caller is a member of and a valid `run-submission-v1` body, when `RunControlService/SubmitRun` is called with an `Idempotency-Key`, then the response is 202 with `run-accepted-v1`, the `RunControlService/Run` is in state Accepted with `projectId` taken from the trusted scope, `releaseId`, `policyRevision` and `snapshotId` pinned and `environmentId` copied from the submission when the body names one, the resolved execution snapshot of the run was stored through `ArtifactService/Artifacts.Store` before the run was committed and the run keeps its reference and hash in `snapshotRef` and `snapshotHash` (D121), the release ids of `pinnedReleases` of the snapshot are written to `RunPinnedReleases` (D125), and the `RunControlService/RunAccepted` outbox record is written in the same transaction; given instead a service token that holds `factory.runs.submit` and names the project of the submission, then the run is accepted the same way, after the same gates, and records the submitting service in `submittingService` (SCN-RunControlService-001, ADR-0014, ADR-0015, D131).",
        "AC2: Given the same submission repeated with the same `Idempotency-Key` and the same input hash, when it arrives at `RunControlService/SubmitRun`, then the same run is returned and no second `RunControlService/Run` exists; given a submission whose snapshot cannot be stored because `ArtifactService/Artifacts.Store` fails, as when ArtifactService is unreachable, then the call fails fast, no `RunControlService/Run` is written and nothing is published, and the repeat under the same `Idempotency-Key` is accepted once the snapshot is stored, so that no run exists without a stored snapshot (SCN-RunControlService-001, D121).",
        "AC3: Given a different body under the same `Idempotency-Key`, an invalid body or a body that carries a parent field, `parentRunId` or `parentAttemptId` (D121), or a caller without `factory.runs.write` or not a member of the project in scope, or a service token that lacks `factory.runs.submit` or names another project (D131), when it arrives, then `RunControlService/SubmitRun` refuses with 409, 400 or 403 respectively; given a project that is suspended, closing or closed, an alias that points at a deprecated release, a release that is Revoked (D119), which includes an alias that points at a Revoked release for as long as an administrator has not moved it (D121), an `environmentId` that names a retired environment, or an `environmentId` that names an environment of production class while the pinned release is not Published, the state of the project, the release and the environment and the class of the environment read from `GateStates` without a call to another service and the state of the pinned release taken from its resolution at this submission, it refuses with 409 and a problem body that names the gate, and a submission without `environmentId` is never refused by an environment gate; no refusal writes a run or publishes anything (SCN-RunControlService-001).",
        "AC4: Given the run was accepted, when the outbox dispatcher of the `run-control` messaging profile publishes `RunControlService/RunAccepted` on `run-control.runs.v1.run-accepted`, then the event is sent under the canonical envelope with `runId`, `tenantId`, `projectId`, `workflowId`, `releaseId`, `policyRevision`, `modelProfileId` and `requestedBy`, without the optional `parentRunId`, which only the event of a child run carries (D121), and with the optional `submittingService` only for a run a service submitted (D131), and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-011, ADR-0012).",
        "AC5: Given the run has progressed, when I ask for it through `RunControlService/GetRun` or the CLI status and watch commands, then I see its state, its steps and the attempt of each step as the single truth of the run (FUX-04)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/reference/schemas/resolved-execution-snapshot.schema.json",
        "docs/planes/control/services/run-control-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-194",
        "AIFACTORY-TASK-1491",
        "AIFACTORY-TASK-2931",
        "AIFACTORY-TASK-195",
        "AIFACTORY-TASK-196",
        "AIFACTORY-TASK-702",
        "AIFACTORY-TASK-023",
        "AIFACTORY-TASK-024",
        "AIFACTORY-TASK-025",
        "AIFACTORY-TASK-026",
        "AIFACTORY-TASK-027",
        "AIFACTORY-TASK-6671",
        "AIFACTORY-TASK-028",
        "AIFACTORY-TASK-029",
        "AIFACTORY-TASK-6514"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "ControlPlaneApi",
          "ProjectService",
          "AgentRegistryService",
          "PolicyEngineService",
          "ArtifactService"
        ],
        "aggregates": [
          "RunControlService/Run"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "RunControlService/GetRun",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "RunControlService/RunAccepted"
        ],
        "workflows": [
          "vision-to-blueprint"
        ],
        "descriptors": [
          "run-submission-v1",
          "run-accepted-v1",
          "resolved-execution-snapshot-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "FR-03",
          "FUX-04",
          "XL-03"
        ],
        "scenarios": [
          "SCN-RunControlService-001",
          "SCN-RunControlService-011"
        ]
      },
      "relates": {
        "screens": [
          "run-submit",
          "run-detail"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "feature:control-plane-api",
        "feature:project-service",
        "feature:agent-registry-service-thin",
        "feature:policy-engine-service",
        "feature:artifact-service",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/reference/schemas/resolved-execution-snapshot.schema.json",
        "docs/planes/control/services/run-control-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-005]",
      "number": 5
    },
    {
      "id": "AIFACTORY-TASK-194",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "SubmitRun with idempotency and scope checks",
      "sequence": "01.05.01.01",
      "description": "SubmitRun with idempotency and scope checks. Expected output: The operation takes the project from the trusted scope, resolves the release alias, pins release, policy revision and snapshot, copies the optional environmentId of run-submission-v1 to the run, has the resolved execution snapshot stored before the commit (AIFACTORY-TASK-2931), persists the run and its RunAccepted outbox record in one transaction and returns 202 with the run location; the 400, 403 and 409 refusals, the 400 for a body that carries parentRunId or parentAttemptId among them (D121), the idempotent repeat and the five 409 gates (a suspended, closing or closed project, an alias at a deprecated release, a release that is Revoked, which is also the answer while the alias of the submission points at a Revoked release and until an administrator moves it (D121), a retired target environment, and a target environment of production class with a pinned release that is not Published), each answered with a problem body that names the gate, are covered by acceptance tests; the gates read GateStates without a call to another service, the production gate comparing the class GateStates keeps for the environment with the state of the release that the resolution at this submission returned; a submission without environmentId is never refused by an environment gate; a service token that holds the service scope factory.runs.submit and names the project of the submission is accepted beside the user token, the run keeps the submitting service in the nullable column SubmittingService of Runs and the requester the token names in RequestedBy, RunAccepted carries the optional submittingService, and a service token that names another project or lacks the scope is answered 403 (D131).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The operation takes the project from the trusted scope, resolves the release alias, pins release, policy revision and snapshot, copies the optional environmentId of run-submission-v1 to the run, has the resolved execution snapshot stored before the commit (AIFACTORY-TASK-2931), persists the run and its RunAccepted outbox record in one transaction and returns 202 with the run location; the 400, 403 and 409 refusals, the 400 for a body that carries parentRunId or parentAttemptId among them (D121), the idempotent repeat and the five 409 gates (a suspended, closing or closed project, an alias at a deprecated release, a release that is Revoked, which is also the answer while the alias of the submission points at a Revoked release and until an administrator moves it (D121), a retired target environment, and a target environment of production class with a pinned release that is not Published), each answered with a problem body that names the gate, are covered by acceptance tests; the gates read GateStates without a call to another service, the production gate comparing the class GateStates keeps for the environment with the state of the release that the resolution at this submission returned; a submission without environmentId is never refused by an environment gate; a service token that holds the service scope factory.runs.submit and names the project of the submission is accepted beside the user token, the run keeps the submitting service in the nullable column SubmittingService of Runs and the requester the token names in RequestedBy, RunAccepted carries the optional submittingService, and a service token that names another project or lacks the scope is answered 403 (D131)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-194]",
      "number": 194
    },
    {
      "id": "AIFACTORY-TASK-1491",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "BlockNewPins inbox handler and the GateStates rows the submission gates read",
      "sequence": "01.05.01.02",
      "description": "BlockNewPins inbox handler and the GateStates rows the submission gates read. Expected output: The handler of AssetReleaseDeprecated records the deprecated release in GateStates, idempotently on the event id, and the handler of AssetReleaseRevoked keeps the state Revoked of a revoked release there the same way, so that a revoked release is never pinned (D119); together with the project rows kept by GateRunsByProject (AIFACTORY-TASK-887) and the environment rows kept by GateRunsByEnvironment (AIFACTORY-TASK-890), which hold the announced class of the environment beside its state, GateStates holds the last announced state of each subject by tenant, subject kind and subject id with its announcedAt, and SubmitRun evaluates its five 409 gates from these rows and from the release state its own resolution returned.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The handler of AssetReleaseDeprecated records the deprecated release in GateStates, idempotently on the event id, and the handler of AssetReleaseRevoked keeps the state Revoked of a revoked release there the same way, so that a revoked release is never pinned (D119); together with the project rows kept by GateRunsByProject (AIFACTORY-TASK-887) and the environment rows kept by GateRunsByEnvironment (AIFACTORY-TASK-890), which hold the announced class of the environment beside its state, GateStates holds the last announced state of each subject by tenant, subject kind and subject id with its announcedAt, and SubmitRun evaluates its five 409 gates from these rows and from the release state its own resolution returned."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1491]",
      "number": 1491
    },
    {
      "id": "AIFACTORY-TASK-2931",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Resolved execution snapshot stored through Artifacts.Store before a run is accepted",
      "sequence": "01.05.01.03",
      "description": "Resolved execution snapshot stored through Artifacts.Store before a run is accepted. Expected output: Before SubmitRun or SubmitChildRun commits a run, the service builds the resolved-execution-snapshot-v1 document of the run as docs/reference/schemas/resolved-execution-snapshot.schema.json defines it, stores it once through a typed gRPC client of Artifacts.Store of ArtifactService and keeps the returned reference and the content hash in SnapshotRef and SnapshotHash of the run (D121); a failed store fails the call fast, commits nothing and publishes nothing; a repeat under the same idempotency key stores the same content under the same tenant and hash, so one snapshot exists for the run; the snapshot is never rewritten after acceptance and RunControlService writes no task contract; in the transaction that accepts the run, the release ids the snapshot names in pinnedReleases are written to the table RunPinnedReleases, keyed by run id and release id with the tenant and pinnedAt, for a child run as for any run (D125); a fake Artifacts.Store endpoint that records the call and can be made unavailable serves the acceptance suite.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Before SubmitRun or SubmitChildRun commits a run, the service builds the resolved-execution-snapshot-v1 document of the run as docs/reference/schemas/resolved-execution-snapshot.schema.json defines it, stores it once through a typed gRPC client of Artifacts.Store of ArtifactService and keeps the returned reference and the content hash in SnapshotRef and SnapshotHash of the run (D121); a failed store fails the call fast, commits nothing and publishes nothing; a repeat under the same idempotency key stores the same content under the same tenant and hash, so one snapshot exists for the run; the snapshot is never rewritten after acceptance and RunControlService writes no task contract; in the transaction that accepts the run, the release ids the snapshot names in pinnedReleases are written to the table RunPinnedReleases, keyed by run id and release id with the tenant and pinnedAt, for a child run as for any run (D125); a fake Artifacts.Store endpoint that records the call and can be made unavailable serves the acceptance suite."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2931]",
      "number": 2931
    },
    {
      "id": "AIFACTORY-TASK-195",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "GetRun read model with steps and attempts",
      "sequence": "01.05.01.04",
      "description": "GetRun read model with steps and attempts. Expected output: GetRun returns state, steps and attempts for the caller's trusted tenant and project scope only; ListRuns is delivered by AIFACTORY-TASK-861 of AIFACTORY-US-161.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "GetRun returns state, steps and attempts for the caller's trusted tenant and project scope only; ListRuns is delivered by AIFACTORY-TASK-861 of AIFACTORY-US-161."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-195]",
      "number": 195
    },
    {
      "id": "AIFACTORY-TASK-196",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "CLI commands submit, status and watch",
      "sequence": "01.05.01.05",
      "description": "CLI commands submit, status and watch. Expected output: The client submits a brief from a file, prints the run identifier and follows the state until it ends.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client submits a brief from a file, prints the run identifier and follows the state until it ends."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-196]",
      "number": 196
    },
    {
      "id": "AIFACTORY-TASK-702",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Verify submit-a-vision by running the declared command",
      "sequence": "01.05.01.06",
      "description": "Verify submit-a-vision by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-001|Scenario=SCN-RunControlService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-005, that is the acceptance, refusals and idempotent repeat of SubmitRun, the snapshot stored through the fake Artifacts.Store endpoint of AIFACTORY-TASK-2931 before the run is accepted, the rows of RunPinnedReleases written with the run, no run when that store fails, the run a service token with factory.runs.submit submits with its submittingService and the 403 of a service token that names another project, the 400 for a body that carries a parent field, the 409 that stays while the alias points at a Revoked release, and the publication and payload of RunAccepted without parentRunId; consumer handling is proven by the suites of WorkflowEngineService and CostUsageService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-001|Scenario=SCN-RunControlService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-005, that is the acceptance, refusals and idempotent repeat of SubmitRun, the snapshot stored through the fake Artifacts.Store endpoint of AIFACTORY-TASK-2931 before the run is accepted, the rows of RunPinnedReleases written with the run, no run when that store fails, the run a service token with factory.runs.submit submits with its submittingService and the 403 of a service token that names another project, the 400 for a body that carries a parent field, the 409 that stays while the alias points at a Revoked release, and the publication and payload of RunAccepted without parentRunId; consumer handling is proven by the suites of WorkflowEngineService and CostUsageService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-702]",
      "number": 702
    },
    {
      "id": "AIFACTORY-TASK-023",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Take the repository ConnectSoft.AI.SoftwareFactory.RunControlService as the repository checklist created it in I0",
      "sequence": "01.05.01.07",
      "description": "Take the repository ConnectSoft.AI.SoftwareFactory.RunControlService as the repository checklist created it in I0. Expected output: The repository is not created here. It was created in I0 by the repository checklist of feature `repository-and-pipeline-conventions`, which proves the checklist on this repository (AIFACTORY-TASK-190) and on a repository of a second kind (AIFACTORY-TASK-1514): its first commit is the unchanged output of the scaffold command with `UseFactoryProfile` and its pipeline is green from the shared steps. This feature takes the repository as it stands: the recorded template version is confirmed, the solution builds, the template tests pass in the repository pipeline, and the work of the feature is added on top without a second creation and without a second scaffold.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository is not created here. It was created in I0 by the repository checklist of feature `repository-and-pipeline-conventions`, which proves the checklist on this repository (AIFACTORY-TASK-190) and on a repository of a second kind (AIFACTORY-TASK-1514): its first commit is the unchanged output of the scaffold command with `UseFactoryProfile` and its pipeline is green from the shared steps. This feature takes the repository as it stands: the recorded template version is confirmed, the solution builds, the template tests pass in the repository pipeline, and the work of the feature is added on top without a second creation and without a second scaffold."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-023]",
      "number": 23
    },
    {
      "id": "AIFACTORY-TASK-024",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Domain model: Run, Step, Attempt, Lease, ApprovalRequest",
      "sequence": "01.05.01.08",
      "description": "Domain model: Run, Step, Attempt, Lease, ApprovalRequest. Expected output: Aggregates with their invariants and state transitions as modelled; unit tests cover every invariant and every transition.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Aggregates with their invariants and state transitions as modelled; unit tests cover every invariant and every transition."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-024]",
      "number": 24
    },
    {
      "id": "AIFACTORY-TASK-025",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Persistence in run-control-sql: Runs, CancellationIntents, RecoveryJournal, GateStates, RunPinnedReleases, Steps, Attempts, Leases, ApprovalRequests, ApprovalVotes",
      "sequence": "01.05.01.09",
      "description": "Persistence in run-control-sql: Runs, CancellationIntents, RecoveryJournal, GateStates, RunPinnedReleases, Steps, Attempts, Leases, ApprovalRequests, ApprovalVotes. Expected output: Mappings and migrations for the modelled tables with tenant filters and indexes; RecoveryJournal is created partitioned by the month of OccurredAt, and the service principal is denied UPDATE and DELETE on it, the drop of a whole partition being left to the separate retention identity of the sweep of feature retention-residency-service in I4 (D141); the tables ChangeProposalBindings and AnnouncedSourceScopes are created by AIFACTORY-TASK-6501 and AIFACTORY-TASK-6504 (D141); mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the modelled tables with tenant filters and indexes; RecoveryJournal is created partitioned by the month of OccurredAt, and the service principal is denied UPDATE and DELETE on it, the drop of a whole partition being left to the separate retention identity of the sweep of feature retention-residency-service in I4 (D141); the tables ChangeProposalBindings and AnnouncedSourceScopes are created by AIFACTORY-TASK-6501 and AIFACTORY-TASK-6504 (D141); mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-025]",
      "number": 25
    },
    {
      "id": "AIFACTORY-TASK-026",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 7 REST and 5 gRPC operations",
      "sequence": "01.05.01.10",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 7 REST and 5 gRPC operations. Expected output: The seven REST routes, AnswerDecision among them (D137), and the five gRPC methods, the internal SubmitChildRun among them (D119), are hosted with JWT validation, scope enforcement per route, problem responses for every modelled refusal code, the Idempotency-Key filter of SubmitRun, workload identity checks on the gRPC methods, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-005, AIFACTORY-US-161 to AIFACTORY-US-167, AIFACTORY-US-656, AIFACTORY-US-1491 and AIFACTORY-US-1492, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The seven REST routes, AnswerDecision among them (D137), and the five gRPC methods, the internal SubmitChildRun among them (D119), are hosted with JWT validation, scope enforcement per route, problem responses for every modelled refusal code, the Idempotency-Key filter of SubmitRun, workload identity checks on the gRPC methods, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-005, AIFACTORY-US-161 to AIFACTORY-US-167, AIFACTORY-US-656, AIFACTORY-US-1491 and AIFACTORY-US-1492, not here."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-026]",
      "number": 26
    },
    {
      "id": "AIFACTORY-TASK-027",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Messaging skeleton: outbox and inbox wiring of the run-control profile for 12 published and 18 of the 26 consumed events",
      "sequence": "01.05.01.11",
      "description": "Messaging skeleton: outbox and inbox wiring of the run-control profile for 12 published and 18 of the 26 consumed events. Expected output: The outbox writer enlists in the run transaction and the dispatcher of the run-control messaging profile publishes the 12 modelled events under the canonical envelope, ProjectRunsSettled and StepSettled among them; the inbox registers 18 of the 26 consumed events of the model with idempotency on the event id, SpendApprovalRequired and BudgetExceeded of CostUsageService, ChangeProposalOpened and ChangeProposalMerged of PipelineExecutionService and SourceScopeChanged of ProjectService among them; the handlers of PipelineRunCompleted, PromotionCompleted, PromotionFailed, QuotaChanged and QuotaExceeded are built, registered and proven in I2 in this repository by features pipeline-execution-service-complete, environment-promotion-service and execution-capacity-service-complete (D140), PromotionCompleted and PromotionFailed by AIFACTORY-US-1621 of feature environment-promotion-service (D141), and the handlers of DeletionOrderIssued, LegalHoldChanged and RetentionRuleChanged of RetentionResidencyService in I4 by feature retention-residency-service (D121, D137, D140), so this feature registers none of these eight; what each registered handler does is delivered by the behaviour PBIs of this feature, BindChangeProposal by AIFACTORY-US-1606 and RefreshSourceScope by AIFACTORY-US-1607, and PinActivePolicyRevision by AIFACTORY-TASK-6671 (D141).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the run transaction and the dispatcher of the run-control messaging profile publishes the 12 modelled events under the canonical envelope, ProjectRunsSettled and StepSettled among them; the inbox registers 18 of the 26 consumed events of the model with idempotency on the event id, SpendApprovalRequired and BudgetExceeded of CostUsageService, ChangeProposalOpened and ChangeProposalMerged of PipelineExecutionService and SourceScopeChanged of ProjectService among them; the handlers of PipelineRunCompleted, PromotionCompleted, PromotionFailed, QuotaChanged and QuotaExceeded are built, registered and proven in I2 in this repository by features pipeline-execution-service-complete, environment-promotion-service and execution-capacity-service-complete (D140), PromotionCompleted and PromotionFailed by AIFACTORY-US-1621 of feature environment-promotion-service (D141), and the handlers of DeletionOrderIssued, LegalHoldChanged and RetentionRuleChanged of RetentionResidencyService in I4 by feature retention-residency-service (D121, D137, D140), so this feature registers none of these eight; what each registered handler does is delivered by the behaviour PBIs of this feature, BindChangeProposal by AIFACTORY-US-1606 and RefreshSourceScope by AIFACTORY-US-1607, and PinActivePolicyRevision by AIFACTORY-TASK-6671 (D141)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-027]",
      "number": 27
    },
    {
      "id": "AIFACTORY-TASK-6671",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "PinActivePolicyRevision inbox handler of PolicyRevisionActivated",
      "sequence": "01.05.01.12",
      "description": "PinActivePolicyRevision inbox handler of PolicyRevisionActivated. Expected output: The inbox of the run-control profile registers PolicyRevisionActivated of PolicyEngineService with idempotency on the event id; PinActivePolicyRevision keeps the activated revision of its scope, a tenant or a project of the tenant, in GateStates under the subject kind policy-scope with the revision as its state and the time of the envelope, replacing it only with a newer activation; SubmitRun and SubmitChildRun pin that revision on a run accepted from then on and ask Policy.GetActiveRevision of PolicyEngineService only for a scope of which no activation was heard yet, both naming the same revision; a run already accepted keeps the revision it pinned, the handler moves no run, writes no RecoveryJournal entry and publishes nothing, and a revision of one tenant is never read for a run of another (D141).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The inbox of the run-control profile registers PolicyRevisionActivated of PolicyEngineService with idempotency on the event id; PinActivePolicyRevision keeps the activated revision of its scope, a tenant or a project of the tenant, in GateStates under the subject kind policy-scope with the revision as its state and the time of the envelope, replacing it only with a newer activation; SubmitRun and SubmitChildRun pin that revision on a run accepted from then on and ask Policy.GetActiveRevision of PolicyEngineService only for a scope of which no activation was heard yet, both naming the same revision; a run already accepted keeps the revision it pinned, the handler moves no run, writes no RecoveryJournal entry and publishes nothing, and a revision of one tenant is never read for a run of another (D141)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6671]",
      "number": 6671
    },
    {
      "id": "AIFACTORY-TASK-028",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Worker hosting skeleton: schedules, partitioning and retry policies of LeaseExpiryReconciler, ApprovalExpiryReconciler and RunDispatcher",
      "sequence": "01.05.01.13",
      "description": "Worker hosting skeleton: schedules, partitioning and retry policies of LeaseExpiryReconciler, ApprovalExpiryReconciler and RunDispatcher. Expected output: The three workers are hosted with their modelled triggers, retry policies, partitioning by tenant and idempotency keys, and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-163, AIFACTORY-US-164, AIFACTORY-US-165 and AIFACTORY-US-167.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three workers are hosted with their modelled triggers, retry policies, partitioning by tenant and idempotency keys, and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-163, AIFACTORY-US-164, AIFACTORY-US-165 and AIFACTORY-US-167."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-028]",
      "number": 28
    },
    {
      "id": "AIFACTORY-TASK-029",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Security, tenancy and telemetry of RunControlService",
      "sequence": "01.05.01.14",
      "description": "Security, tenancy and telemetry of RunControlService. Expected output: Scopes and roles of the model are enforced, the service scopes factory.runs.submit (D131) and factory.approvals.request (D129, D135) and the user scope factory.runs.operate (D137) among them, every query is tenant-filtered, secrets come from secret references, traces, metrics and health checks follow the observability conventions, and the seven metrics of the model are emitted with their dimensions, where connectsoft.factory.runs.active moves with every non-terminal state change with its tenant and state dimensions, connectsoft.factory.approvals.pending_age records the age of an approval request at its decision or its expiry with the dimensions tenant and actionClass, and connectsoft.factory.runs.outbox_backlog reports the number of unpublished outbox records with the dimension host, so that it rises while the transport is unavailable and falls back once publication succeeds (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, the service scopes factory.runs.submit (D131) and factory.approvals.request (D129, D135) and the user scope factory.runs.operate (D137) among them, every query is tenant-filtered, secrets come from secret references, traces, metrics and health checks follow the observability conventions, and the seven metrics of the model are emitted with their dimensions, where connectsoft.factory.runs.active moves with every non-terminal state change with its tenant and state dimensions, connectsoft.factory.approvals.pending_age records the age of an approval request at its decision or its expiry with the dimensions tenant and actionClass, and connectsoft.factory.runs.outbox_backlog reports the number of unpublished outbox records with the dimension host, so that it rises while the transport is unavailable and falls back once publication succeeds (D140)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-029]",
      "number": 29
    },
    {
      "id": "AIFACTORY-TASK-6514",
      "type": "task",
      "parent": "AIFACTORY-US-005",
      "title": "Recovery runbook of the failure mode Control store restore after loss",
      "sequence": "01.05.01.15",
      "description": "Recovery runbook of the failure mode Control store restore after loss. Expected output: The repository documentation holds the runbook of the failure mode Control store restore after loss of model/services/control-plane/RunControlService.yaml (D30, D140): readiness of the service stays unready while run-control-sql is unavailable; the store is restored from backup to a restore point within the recovery point of 15 minutes of transitions and within the recovery time of 240 minutes; the restore order is the run journal first, the table RecoveryJournal, then the approval requests with their votes, then the release rows that the gates keep in GateStates and RunPinnedReleases, then the outbox and the inbox; after the restore the LeaseExpiryReconciler reconciles every attempt that held an open lease at the loss as Uncertain and the runbook surfaces those runs to the operators, a step of class shared-write or above through the operator decision that the Uncertain outcome opens for the Operator of the project, so that no such attempt is retried automatically; the runbook names the evidence of each step, the restore point, the reconciled attempts and the operator decisions listed by ListApprovals; it holds no credential, connection string or secret value.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The repository documentation holds the runbook of the failure mode Control store restore after loss of model/services/control-plane/RunControlService.yaml (D30, D140): readiness of the service stays unready while run-control-sql is unavailable; the store is restored from backup to a restore point within the recovery point of 15 minutes of transitions and within the recovery time of 240 minutes; the restore order is the run journal first, the table RecoveryJournal, then the approval requests with their votes, then the release rows that the gates keep in GateStates and RunPinnedReleases, then the outbox and the inbox; after the restore the LeaseExpiryReconciler reconciles every attempt that held an open lease at the loss as Uncertain and the runbook surfaces those runs to the operators, a step of class shared-write or above through the operator decision that the Uncertain outcome opens for the Operator of the project, so that no such attempt is retried automatically; the runbook names the evidence of each step, the restore point, the reconciled attempts and the operator decisions listed by ListApprovals; it holds no credential, connection string or secret value."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5501,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-6514]",
      "number": 6514
    },
    {
      "id": "AIFACTORY-US-161",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Follow a run through its read model, its list and its state stream",
      "sequence": "01.05.02",
      "description": "As a requester, I want to read one run with its steps, attempts, lease and pending approvals, list the runs of my scope and watch a run change state, so that the run state I see in the Studio and the CLI is the single truth the service holds, never an assumed one. A caller whose scope carries `factory.runs.read` reads one run through `RunControlService/GetRun` and receives `run-view-v1`: the run state and version, the pinned release, policy revision and snapshot, the steps in ordinal order with the attempts of each, the current lease of the open attempt and the pending approval requests. The same caller lists runs through `RunControlService/ListRuns` and receives `run-list-v1`, paged, with state and freshness, filtered by the trusted tenant and the projects in scope (ADR-0015). Every query runs under the tenant row filter of the service, so a run of another tenant is never listed and is not found when addressed: the read answers 404, the same answer as for a `runId` that does not exist, and never confirms that the run exists (ADR-0015). A caller without the scope is refused with 403; nothing is written by any of these reads. A subscriber with a workload identity (StudioBff or a runtime worker, each in its own increment) opens the server stream `RunControlService/RunControl.WatchRun` with a `run-ref-v1` and receives one `run-event-v1` per run and approval state change of that run in commit order, until the run is terminal or the subscriber cancels; over gRPC the not-found answer is the status NOT_FOUND, given alike for an unknown run and for a run of another tenant (ADR-0015). Every transition of the `Run` between two states of `RunState` is announced by `RunControlService/RunStateChanged` with `fromState`, `toState` and `cause`, written in the same transaction as the transition and published under the canonical envelope; the views of StudioBff and DashboardService that consume it belong to their own PBIs. Kind: behavior. Traces: services: RunControlService; aggregates: RunControlService/Run, RunControlService/Step, RunControlService/Attempt; apis: RunControlService/GetRun, RunControlService/ListRuns, RunControlService/RunControl.WatchRun; events: RunControlService/RunStateChanged; descriptors: run-view-v1, run-list-v1, run-ref-v1, run-event-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-03, FUX-04; scenarios: SCN-RunControlService-002, SCN-RunControlService-003, SCN-RunControlService-010, SCN-RunControlService-012. Relates: screens: run-detail, my-work, project-overview; nfrs: NFR-05. Depends on: AIFACTORY-US-005. Sources: model/services/control-plane/RunControlService.yaml, model/descriptors.yaml, docs/planes/control/services/run-control-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.runs.read` and a run in the caller's tenant and project with steps, an open attempt under lease and a pending approval, when `RunControlService/GetRun` is called, then the response is 200 with `run-view-v1` carrying state, version, `releaseId`, `policyRevision`, `snapshotId`, the steps with their attempts, the current lease and the pending approval (SCN-RunControlService-002).",
        "AC2: Given a caller without `factory.runs.read`, or a `runId` that exists only in another tenant, when `RunControlService/GetRun` is called, then the response is 403 for the missing scope and 404 for the foreign run, the same answer as for a `runId` that does not exist, each with a problem response and no state change (SCN-RunControlService-002, ADR-0015).",
        "AC3: Given runs of several projects and tenants, when `RunControlService/ListRuns` is called with a page cursor, then the response is 200 with `run-list-v1` holding only the runs of the caller's trusted tenant and projects in scope, each with state and freshness, and runs of other tenants never appear (SCN-RunControlService-003, ADR-0015).",
        "AC4: Given a subscriber with a workload identity and a `run-ref-v1` of a run in its scope, when `RunControlService/RunControl.WatchRun` is called, then the stream delivers one `run-event-v1` per run and approval state change in commit order until the run is terminal, a caller without identity is refused with Unauthenticated, and an unknown run and a run of another tenant are both refused with the gRPC status NOT_FOUND, which never confirms that a foreign run exists (SCN-RunControlService-010, ADR-0015).",
        "AC5: Given the `RunControlService/Run` moved between two states through a modelled transition, when the outbox dispatcher publishes `RunControlService/RunStateChanged` on `run-control.runs.v1.run-state-changed`, then the outbox record was written in the same transaction as the transition, the event is sent under the canonical envelope with `runId`, `tenantId`, `fromState`, `toState` and `cause`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/descriptors.yaml",
        "docs/planes/control/services/run-control-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-861",
        "AIFACTORY-TASK-862",
        "AIFACTORY-TASK-863",
        "AIFACTORY-TASK-864"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5502,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Step",
          "RunControlService/Attempt"
        ],
        "apis": [
          "RunControlService/GetRun",
          "RunControlService/ListRuns",
          "RunControlService/RunControl.WatchRun"
        ],
        "events": [
          "RunControlService/RunStateChanged"
        ],
        "descriptors": [
          "run-view-v1",
          "run-list-v1",
          "run-ref-v1",
          "run-event-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-03",
          "FUX-04"
        ],
        "scenarios": [
          "SCN-RunControlService-002",
          "SCN-RunControlService-003",
          "SCN-RunControlService-010",
          "SCN-RunControlService-012"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "my-work",
          "project-overview"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-005"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/descriptors.yaml",
        "docs/planes/control/services/run-control-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-161]",
      "number": 161
    },
    {
      "id": "AIFACTORY-TASK-861",
      "type": "task",
      "parent": "AIFACTORY-US-161",
      "title": "GetRun and ListRuns read model with tenant row filter, paging and freshness",
      "sequence": "01.05.02.01",
      "description": "GetRun and ListRuns read model with tenant row filter, paging and freshness. Expected output: GetRun returns run-view-v1 with steps, attempts, current lease and pending approvals; ListRuns returns run-list-v1 paged with state and freshness; both apply the tenant row filter so a run of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015), and a missing scope is 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "GetRun returns run-view-v1 with steps, attempts, current lease and pending approvals; ListRuns returns run-list-v1 paged with state and freshness; both apply the tenant row filter so a run of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015), and a missing scope is 403."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-861]",
      "number": 861
    },
    {
      "id": "AIFACTORY-TASK-862",
      "type": "task",
      "parent": "AIFACTORY-US-161",
      "title": "WatchRun server stream fed from committed transitions",
      "sequence": "01.05.02.02",
      "description": "WatchRun server stream fed from committed transitions. Expected output: RunControl.WatchRun streams one run-event-v1 per run and approval state change in commit order and ends at the terminal state or when the caller cancels; callers without workload identity are refused with Unauthenticated, an invalid request with InvalidArgument, and an unknown run and a run of another tenant alike with NotFound, the gRPC status NOT_FOUND (ADR-0015).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "RunControl.WatchRun streams one run-event-v1 per run and approval state change in commit order and ends at the terminal state or when the caller cancels; callers without workload identity are refused with Unauthenticated, an invalid request with InvalidArgument, and an unknown run and a run of another tenant alike with NotFound, the gRPC status NOT_FOUND (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-862]",
      "number": 862
    },
    {
      "id": "AIFACTORY-TASK-863",
      "type": "task",
      "parent": "AIFACTORY-US-161",
      "title": "Contract of the run read model, the run list, the run reference and the stream item",
      "sequence": "01.05.02.03",
      "description": "Contract of the run read model, the run list, the run reference and the stream item. Expected output: The OpenAPI document and the proto of the service expose run-view-v1 and run-list-v1 matching docs/reference/schemas/resolved-execution-snapshot.schema.json, run-event-v1 matching docs/reference/schemas/run-event-envelope.schema.json and run-ref-v1 matching docs/reference/schemas/run-submission.schema.json, as model/descriptors.yaml records them.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The OpenAPI document and the proto of the service expose run-view-v1 and run-list-v1 matching docs/reference/schemas/resolved-execution-snapshot.schema.json, run-event-v1 matching docs/reference/schemas/run-event-envelope.schema.json and run-ref-v1 matching docs/reference/schemas/run-submission.schema.json, as model/descriptors.yaml records them."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5502,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-863]",
      "number": 863
    },
    {
      "id": "AIFACTORY-TASK-864",
      "type": "task",
      "parent": "AIFACTORY-US-161",
      "title": "Verify follow-a-run through the acceptance suite",
      "sequence": "01.05.02.04",
      "description": "Verify follow-a-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-002|Scenario=SCN-RunControlService-003|Scenario=SCN-RunControlService-010|Scenario=SCN-RunControlService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-161, including the publication and payload of RunStateChanged; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-002|Scenario=SCN-RunControlService-003|Scenario=SCN-RunControlService-010|Scenario=SCN-RunControlService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-161, including the publication and payload of RunStateChanged; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-864]",
      "number": 864
    },
    {
      "id": "AIFACTORY-US-162",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Cancel a run by recording intent, interrupting the lease holder and observing the settled state",
      "sequence": "01.05.03",
      "description": "As a requester, I want to cancel a run I no longer need and see when it has really stopped, so that the Factory stops spending on it without pretending that effects already made never happened. A caller whose scope carries `factory.runs.write` cancels a run of the caller's tenant and project through `RunControlService/CancelRun`. The service records a `CancellationIntent` with the actor and the reason first. A run still Accepted moves to Cancelled at once, and so does a Held run, which has no open attempt (trigger `CancelRequestedWhileHeld`); a Running or WaitingForApproval run moves to Cancelling. After the Cancelling transition and its `RunStateChanged` outbox record have committed, the service calls `AgentRuntimeService/Runtime.Interrupt` for the open attempt of the run; AgentRuntimeService stops the attempt at its next safe point and reports the observed termination through `RunControlService/RunControl.ReportAttemptOutcome`. The Interrupt call is fail-fast: when AgentRuntimeService is unavailable the call fails, the committed Cancelling state stands, and the open attempt is settled later by the lease holder's report or by the `LeaseExpiryReconciler`. The response is 202: the resulting state is observed, not assumed. A pending approval request of the run moves from Pending to Cancelled through the modelled trigger `RunCancelled`, no later than the run reaching Cancelled. When every attempt has settled the run moves from Cancelling to Cancelled and `RunControlService/RunCancelled` is published with `reason` and `requestedBy`; AgentRuntimeService, WorkflowEngineService, CostUsageService and GenerationRecipeService, which returns the recipe of a cancelled run to Approved (D123), consume it in their own PBIs, and AuditService consumes it as the cancellation evidence, with the recorded intent and the settled attempts. Completed external effects stay visible and are never rolled back silently. The inbox handler `GateRunsByProject` takes the same path when ProjectService announces through `ProjectService/ProjectStateChanged` that a project is Suspended, Closing or Closed: every open run of the project records a `CancellationIntent` with the handler as actor and follows the cancel transitions, idempotently on the event id; the handler also keeps the announced state of the project in the table `GateStates`, which the submission gate of AIFACTORY-US-005 reads. A project becomes Suspended through `SuspendProject` of ProjectService, so this path is reachable on a deployed instance (D117). For a Closing project the handler also announces, once no non-terminal run of the project remains, that its runs are settled (AIFACTORY-US-548), the handler `CancelRunOnBudgetExceeded` records the same kind of intent for a run whose usage took its budget over the limit (AIFACTORY-US-547), and a parent run that ends Failed or Cancelled records it for each of its open child runs (AIFACTORY-US-656, D119). A caller without the scope is refused with 403; a run of another tenant is answered 404, the same answer as for a run that does not exist (ADR-0015); a run already Completed, Failed or Cancelled is refused with 409; a repeated cancel of a run already Cancelling returns 202 and records no second intent. Every transition and its outbox record are committed in one transaction. Kind: behavior. Traces: services: RunControlService, AgentRuntimeService, ProjectService; aggregates: RunControlService/Run, RunControlService/ApprovalRequest; apis: RunControlService/CancelRun, AgentRuntimeService/Runtime.Interrupt; events: RunControlService/RunStateChanged, RunControlService/RunCancelled, ProjectService/ProjectStateChanged; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-10, FUX-07; scenarios: SCN-RunControlService-004, SCN-RunControlService-015. Relates: screens: run-detail; nfrs: NFR-05. Depends on: AIFACTORY-US-005, feature:agent-runtime-service, feature:project-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/planes/control/services/run-control-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running run of my tenant and project with an open attempt, when `RunControlService/CancelRun` is called with a reason, then the response is 202, a `CancellationIntent` is recorded, the `RunControlService/Run` moves to Cancelling with `RunControlService/RunStateChanged` written in the same transaction, and after that transaction commits `AgentRuntimeService/Runtime.Interrupt` is called for the open attempt; an unavailable AgentRuntimeService fails the call fast and leaves the Cancelling state standing (SCN-RunControlService-004).",
        "AC2: Given a run still Accepted, a Held run, or one that is WaitingForApproval, when `RunControlService/CancelRun` is called, then the Accepted run and the Held run move to Cancelled at once, the Held run through the trigger `CancelRequestedWhileHeld`, the waiting run moves to Cancelling, and its pending `RunControlService/ApprovalRequest` moves from Pending to Cancelled through the trigger `RunCancelled` no later than the run reaching Cancelled (SCN-RunControlService-004).",
        "AC3: Given a caller without `factory.runs.write`, a run of another tenant, or a run already Completed, Failed or Cancelled, when `RunControlService/CancelRun` is called, then the response is 403, 404 or 409 respectively, the 404 being the same answer as for a run that does not exist, with a problem response and no state change (SCN-RunControlService-004, ADR-0015).",
        "AC4: Given a Cancelling run whose last open attempt settles, or an Accepted or Held run cancelled at once, when the run moves to Cancelled and the outbox dispatcher publishes `RunControlService/RunCancelled` on `run-control.runs.v1.run-cancelled`, then the outbox record was written in the same transaction as the transition, the event is sent under the canonical envelope with `runId`, `tenantId`, `reason` and `requestedBy` from the intent, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-015, ADR-0012).",
        "AC5: Given `ProjectService/ProjectStateChanged` announces a project moved to Suspended, Closing or Closed, when the `GateRunsByProject` inbox handler runs, then every open run of that project records a `CancellationIntent` with the handler as actor and follows the cancel transitions of AC1 and AC2, and a redelivery of the same event id records no second intent (SCN-RunControlService-015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/services/run-control-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-865",
        "AIFACTORY-TASK-866",
        "AIFACTORY-TASK-887",
        "AIFACTORY-TASK-867",
        "AIFACTORY-TASK-868"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5503,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "AgentRuntimeService",
          "ProjectService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "RunControlService/CancelRun",
          "AgentRuntimeService/Runtime.Interrupt"
        ],
        "events": [
          "RunControlService/RunStateChanged",
          "RunControlService/RunCancelled",
          "ProjectService/ProjectStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "FUX-07"
        ],
        "scenarios": [
          "SCN-RunControlService-004",
          "SCN-RunControlService-015"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-005",
        "feature:agent-runtime-service",
        "feature:project-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/services/run-control-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-162]",
      "number": 162
    },
    {
      "id": "AIFACTORY-TASK-865",
      "type": "task",
      "parent": "AIFACTORY-US-162",
      "title": "CancelRun with cancellation intent, the Cancelling transitions and the Interrupt call to the lease holder",
      "sequence": "01.05.03.01",
      "description": "CancelRun with cancellation intent, the Cancelling transitions and the Interrupt call to the lease holder. Expected output: CancelRun records the CancellationIntent, applies CancelRequestedBeforeDispatch, CancelRequestedWhileHeld or CancelRequested in the same transaction as the RunStateChanged outbox record, moves the pending approval to Cancelled through RunCancelled, and after the commit of a Cancelling transition calls AgentRuntimeService/Runtime.Interrupt for the open attempt through the gRPC client with fail-fast handling (a failed call is logged, the Cancelling state stands and the attempt settles by report or lease expiry); 403, 404 and 409 refusals are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "CancelRun records the CancellationIntent, applies CancelRequestedBeforeDispatch, CancelRequestedWhileHeld or CancelRequested in the same transaction as the RunStateChanged outbox record, moves the pending approval to Cancelled through RunCancelled, and after the commit of a Cancelling transition calls AgentRuntimeService/Runtime.Interrupt for the open attempt through the gRPC client with fail-fast handling (a failed call is logged, the Cancelling state stands and the attempt settles by report or lease expiry); 403, 404 and 409 refusals are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-865]",
      "number": 865
    },
    {
      "id": "AIFACTORY-TASK-866",
      "type": "task",
      "parent": "AIFACTORY-US-162",
      "title": "Settle a Cancelling run to Cancelled and publish RunCancelled",
      "sequence": "01.05.03.02",
      "description": "Settle a Cancelling run to Cancelled and publish RunCancelled. Expected output: When the last open attempt of a Cancelling run settles, the run moves to Cancelled through AllAttemptsSettled and RunCancelled is written to the outbox with reason and requestedBy; a run cancelled at once from Accepted or Held writes RunCancelled in the transaction of that transition; completed external effects stay recorded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "When the last open attempt of a Cancelling run settles, the run moves to Cancelled through AllAttemptsSettled and RunCancelled is written to the outbox with reason and requestedBy; a run cancelled at once from Accepted or Held writes RunCancelled in the transaction of that transition; completed external effects stay recorded."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-866]",
      "number": 866
    },
    {
      "id": "AIFACTORY-TASK-887",
      "type": "task",
      "parent": "AIFACTORY-US-162",
      "title": "GateRunsByProject inbox handler cancelling the open runs of a suspended, closing or closed project",
      "sequence": "01.05.03.03",
      "description": "GateRunsByProject inbox handler cancelling the open runs of a suspended, closing or closed project. Expected output: The handler of ProjectStateChanged keeps the announced state of the project in GateStates for the submission gate of SubmitRun, records a CancellationIntent with the handler as actor for every open run of a suspended, closing or closed project, applies the cancel transitions through the same path as CancelRun, and is idempotent on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The handler of ProjectStateChanged keeps the announced state of the project in GateStates for the submission gate of SubmitRun, records a CancellationIntent with the handler as actor for every open run of a suspended, closing or closed project, applies the cancel transitions through the same path as CancelRun, and is idempotent on the event id."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-887]",
      "number": 887
    },
    {
      "id": "AIFACTORY-TASK-867",
      "type": "task",
      "parent": "AIFACTORY-US-162",
      "title": "CLI command cancel with the observed final state",
      "sequence": "01.05.03.04",
      "description": "CLI command cancel with the observed final state. Expected output: The client sends the cancel request, prints the 202 acknowledgement and, when asked to wait, follows the run until it reports Cancelled, Completed or Failed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client sends the cancel request, prints the 202 acknowledgement and, when asked to wait, follows the run until it reports Cancelled, Completed or Failed."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-867]",
      "number": 867
    },
    {
      "id": "AIFACTORY-TASK-868",
      "type": "task",
      "parent": "AIFACTORY-US-162",
      "title": "Verify cancel-a-run through the acceptance suite",
      "sequence": "01.05.03.05",
      "description": "Verify cancel-a-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-004|Scenario=SCN-RunControlService-015)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-162 with a fake Runtime.Interrupt endpoint recording the call, including the publication and payload of RunCancelled; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-004|Scenario=SCN-RunControlService-015)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-162 with a fake Runtime.Interrupt endpoint recording the call, including the publication and payload of RunCancelled; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-868]",
      "number": 868
    },
    {
      "id": "AIFACTORY-US-163",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Dispatch each step as an attempt under an exclusive lease with a fencing token",
      "sequence": "01.05.04",
      "description": "When WorkflowEngineService announces a step through `WorkflowEngineService/StepReady`, the inbox handler `CreateStepAndDispatch` creates the `Step` idempotently on the step run id. `StepReady` carries `actionClass`, the side-effect class of the step in the pinned workflow definition, and `idempotent`, true when that step declares an idempotency key; `CreateStepAndDispatch` copies them to `sideEffectClass` and `idempotent` of the `Step`; the retry rule and the Uncertain rule of AIFACTORY-US-164 read them from the `Step`. `StepReady` also carries the `stepRunId` of the engine and the optional `failurePolicy` the step declares in the pinned workflow definition (Retry, Compensate, Escalate or Fail), and the handler keeps both on the `Step` (D119): `stepRunId` is the id that `StepSettled` names (AIFACTORY-US-658), and `failurePolicy` settles whether a terminal failure of the step opens an operator decision (AIFACTORY-US-657). `StepReady` carries as well `taskContractRef` and `taskContractHash`, the reference and the hash of the task contract of the step (`agent-task-contract-v1`) that WorkflowEngineService stored in ArtifactService before it announced the step (D121). Both members are optional on `StepReady`: an agent or tool step carries them, and a Human step, which has no task contract, carries neither. The handler keeps them on the `Step`, and every attempt of the step, the first one and a retried one alike, takes them from the step, so that a retried attempt carries the same reference and the same hash; the `Step` of a Human step keeps neither, and its approval is opened in place of an attempt (D123). Once CostUsageService confirms the run budget through `CostUsageService/BudgetReserved`, after every recorded attempt outcome, and when `EnvironmentService/EnvironmentStateChanged` arrives, which is how a run released from Held is evaluated again, the `RunDispatcher` worker selects the next Pending step of a Running run that has no open attempt, creates the `Attempt` with the next number and its `Lease` with a new fencing token, moves the step to Dispatched and the run from Accepted to Running on the first dispatch, and writes `RunControlService/AttemptDispatched` in the same transaction; the worker is idempotent on step id plus attempt number, so a duplicate trigger dispatches nothing twice. A child run has no reservation of its own, so the `RunDispatcher` awaits no `BudgetReserved` for a run that carries `parentRunId` (AIFACTORY-US-656, D121): the first attempt of a child run is dispatched when `StepReady` announces its first step, the dispatcher selecting the child run that is still Accepted and whose first step is ready (D123). The fencing token of a new lease is strictly greater than any earlier token of the attempt, as the Lease invariant requires; as a design choice of this PBI it is also greater than every earlier token of the step, so the holder of a retried attempt's predecessor is fenced out. The dispatcher creates the lease in state Unclaimed with an empty `holder` and with `expiresAt` at its creation plus `RunControl:Leases:ClaimTimeoutSeconds`, and `AttemptDispatched` already carries `leaseId` and `fencingToken`. The task of the attempt is handed over by reference (D119): the `Attempt` keeps the reference and the hash of its task contract (`agent-task-contract-v1`) in `taskContractRef` and `taskContractHash`, and the `Run` keeps the reference and the hash of its resolved execution snapshot (`resolved-execution-snapshot-v1`) in `snapshotRef` and `snapshotHash` beside `snapshotId`. Each document has one writer (D121): WorkflowEngineService writes the task contract before it announces the step, and the reference and the hash the attempt keeps are the ones `StepReady` carried and the `Step` keeps; RunControlService writes the snapshot once, when it accepts the run (AIFACTORY-US-005), and writes no task contract itself. The task contract describes the step and no attempt: `attemptId`, the `stepId` of RunControlService and `snapshotId` are no required members of `agent-task-contract-v1`, and an attempt receives its ids and the reference of the snapshot in the answer of `AcquireLease` (D123). A runtime worker with a workload identity claims the lease on start through `RunControlService/RunControl.AcquireLease` and names in `acquire-lease-v1` the `leaseId` it saw in `AttemptDispatched`: the first call on the Unclaimed lease records the caller as `holder`, moves the lease to Claimed and replaces the claim-timeout `expiresAt` with the lease duration from `RunControl:Leases:DurationSeconds`, and the reply is `lease-v1` with the lease id, that expiry, the fencing token and the four values of the handoff, `taskContractRef`, `taskContractHash`, `snapshotRef` and `snapshotHash`. The reply carries references and hashes and never the content; the runtime reads both documents from ArtifactService by reference and verifies each hash in its own PBI. The reply also carries, in the required member `attemptToken` of `lease-v1`, a short-lived token bound to the run, the step and the attempt, which names them in the claims `run_id`, `step_id` and `attempt_id` beside the tenant claim `tid`; it is the proof that a model call of the attempt on the OpenAI-compatible route of ModelGatewayHost belongs to the run (D125). RunControlService issues no token itself, because the Authorization Server is the sole token issuer (ADR-0008, ADR-0015): when it grants the lease it obtains the token through a token exchange with its own workload identity, the token lives no longer than the lease, a renewal returns a token that lives no longer than the renewed lease, and the token is never written to a log, an event or a table. When the token exchange is not answered the claim fails fast, the lease stays Unclaimed and nothing is written, and the worker repeats the claim. A later call by the same holder renews the lease by extending its expiry and returns the same references and hashes; a call by any other caller is refused. A claim that names a lease other than the current lease of the attempt, a superseded one, as after the earlier lease expired unclaimed and the attempt was dispatched again, is refused with FailedPrecondition, the gRPC status FAILED_PRECONDITION (D121), and changes nothing, so a worker that acts on an old `AttemptDispatched` never takes over the newer lease. A lease nobody claimed by its claim timeout is Expired by the `LeaseExpiryReconciler` and the attempt is dispatched again without counting against `maxAttempts` (AIFACTORY-US-164). Exactly one current lease exists per attempt, only one non-terminal attempt exists per step, and no step is dispatched while the run is WaitingForApproval, Cancelling or Held (the environment gate of AIFACTORY-US-168); for that gate the dispatcher reads the announced state of the target environment from the table `GateStates` and calls no other service. A caller without workload identity, an invalid request, an unknown or settled attempt, or a lease claimed by another holder is refused with the matching gRPC status and nothing is written; an attempt of another tenant is answered like an unknown one, with the status NOT_FOUND (ADR-0015). Kind: behavior. Traces: services: RunControlService, WorkflowEngineService, CostUsageService, AgentRuntimeService, EnvironmentService; aggregates: RunControlService/Run, RunControlService/Step, RunControlService/Attempt, RunControlService/Lease; apis: RunControlService/RunControl.AcquireLease; events: RunControlService/AttemptDispatched, RunControlService/AttemptOutcomeRecorded, RunControlService/RunStateChanged, WorkflowEngineService/StepReady, CostUsageService/BudgetReserved, EnvironmentService/EnvironmentStateChanged; descriptors: acquire-lease-v1, lease-v1, agent-task-contract-v1, resolved-execution-snapshot-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024; requirements: FR-03, XL-06; scenarios: SCN-RunControlService-007, SCN-RunControlService-016. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-005, feature:workflow-engine-service, feature:cost-usage-service-complete, feature:agent-runtime-service, feature:environment-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/planes/control/services/run-control-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Running run with no open attempt and a Pending `RunControlService/Step` that `CreateStepAndDispatch` created with `sideEffectClass` copied from `actionClass` and `idempotent` copied from `idempotent` of `WorkflowEngineService/StepReady`, when the `RunDispatcher` runs after `CostUsageService/BudgetReserved`, after an `RunControlService/AttemptOutcomeRecorded` or after an `EnvironmentService/EnvironmentStateChanged` that released the run, then an `RunControlService/Attempt`, which takes from its step the `taskContractRef` and the `taskContractHash` that the step keeps from `WorkflowEngineService/StepReady` (D121, D123), and its `RunControlService/Lease` are created, the lease in state Unclaimed with an empty `holder`, `expiresAt` at its creation plus `RunControl:Leases:ClaimTimeoutSeconds` and a fencing token strictly greater than any earlier token of the attempt (Lease invariant) and, by the design choice of this PBI, than any earlier token of the step, the step is Dispatched, and `RunControlService/AttemptDispatched` is written in the same transaction with `runId`, `stepId`, `attemptId`, `leaseId`, `fencingToken`, `agentId` and `skillId` (SCN-RunControlService-016).",
        "AC2: Given the attempt was dispatched, when the outbox dispatcher publishes `RunControlService/AttemptDispatched` on `run-control.attempts.v1.attempt-dispatched`, then the event is sent under the canonical envelope with the payload of AC1, a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, and a duplicate dispatch trigger for the same step and attempt number creates no second attempt (SCN-RunControlService-016, ADR-0012).",
        "AC3: Given a runtime worker with a workload identity and a dispatched attempt whose `RunControlService/Lease` is Unclaimed (claim) or Claimed by that worker (renewal), when `RunControlService/RunControl.AcquireLease` is called with `acquire-lease-v1` naming the `leaseId` the worker saw in `RunControlService/AttemptDispatched`, then the first call records the worker's identity as `holder`, moves the lease to Claimed and replaces the claim-timeout `expiresAt` with the lease duration from `RunControl:Leases:DurationSeconds`, the reply carries `lease-v1` with the `leaseId`, that `expiresAt`, the `fencingToken`, the `taskContractRef` and `taskContractHash` the `RunControlService/Attempt` keeps for its `agent-task-contract-v1`, which are the ones `WorkflowEngineService/StepReady` carried for the step and the `RunControlService/Step` keeps, so that a retried attempt of the step gets the same reference and hash (D123), and the `snapshotRef` and `snapshotHash` the `RunControlService/Run` keeps for the `resolved-execution-snapshot-v1` that RunControlService stored when it accepted the run, and the `attemptToken` that the Authorization Server issued through the token exchange of RunControlService, bound to the run, the step and the attempt by the claims `run_id`, `step_id`, `attempt_id` and `tid` and living no longer than the lease (D125), and a later call by the same holder renews the lease by extending `expiresAt` and returns the same references and hashes with a token that lives no longer than the renewed lease (SCN-RunControlService-007, D119, D121, ADR-0015).",
        "AC4: Given a caller without workload identity, an invalid request, an unknown or settled attempt, an attempt of another tenant, a lease that another holder has claimed, or a claim that names a superseded lease, one that is no longer the current lease of the attempt, when `RunControlService/RunControl.AcquireLease` is called, then the call is refused with the matching gRPC status, the status NOT_FOUND for the unknown and for the foreign attempt alike and the status FAILED_PRECONDITION for the superseded lease (D121), and no lease is written or changed, the current lease of the attempt staying Unclaimed or with its holder (SCN-RunControlService-007, ADR-0015).",
        "AC5: Given a run that is WaitingForApproval, Cancelling or Held, or a step with an open attempt, when the `RunDispatcher` evaluates it, then no attempt is dispatched for that run or step, as the invariants of `RunControlService/Step` and the environment gate of `RunControlService/Run` require, the gate being read from `GateStates` without a call to another service; given a `WorkflowEngineService/StepReady` of a Human step, which carries neither `taskContractRef` nor `taskContractHash`, then the `RunControlService/Step` is created and keeps neither, and its approval is opened in place of an attempt; and given an Accepted child run, one that carries `parentRunId`, when `WorkflowEngineService/StepReady` announces its first step, then its first attempt is dispatched without a `CostUsageService/BudgetReserved` for it (SCN-RunControlService-016, ADR-0014, D123)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/services/run-control-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-869",
        "AIFACTORY-TASK-870",
        "AIFACTORY-TASK-871",
        "AIFACTORY-TASK-872"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5504,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "WorkflowEngineService",
          "CostUsageService",
          "AgentRuntimeService",
          "EnvironmentService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Step",
          "RunControlService/Attempt",
          "RunControlService/Lease"
        ],
        "apis": [
          "RunControlService/RunControl.AcquireLease"
        ],
        "events": [
          "RunControlService/AttemptDispatched",
          "RunControlService/AttemptOutcomeRecorded",
          "RunControlService/RunStateChanged",
          "WorkflowEngineService/StepReady",
          "CostUsageService/BudgetReserved",
          "EnvironmentService/EnvironmentStateChanged"
        ],
        "descriptors": [
          "acquire-lease-v1",
          "lease-v1",
          "agent-task-contract-v1",
          "resolved-execution-snapshot-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "FR-03",
          "XL-06"
        ],
        "scenarios": [
          "SCN-RunControlService-007",
          "SCN-RunControlService-016"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-005",
        "feature:workflow-engine-service",
        "feature:cost-usage-service-complete",
        "feature:agent-runtime-service",
        "feature:environment-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/services/run-control-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-163]",
      "number": 163
    },
    {
      "id": "AIFACTORY-TASK-869",
      "type": "task",
      "parent": "AIFACTORY-US-163",
      "title": "RunDispatcher worker and the StepReady and BudgetReserved inbox handlers",
      "sequence": "01.05.04.01",
      "description": "RunDispatcher worker and the StepReady and BudgetReserved inbox handlers. Expected output: CreateStepAndDispatch creates steps idempotently on the step run id, each with sideEffectClass copied from actionClass and idempotent copied from idempotent of the StepReady event and with the stepRunId and the failurePolicy the event carries kept on the step (D119); the handler also keeps on the step the optional taskContractRef and taskContractHash of StepReady, mapped to the nullable columns TaskContractRef and TaskContractHash of the table Steps, which an agent or tool step carries and a Human step does not (D123); ReleaseFirstStepOnReservation, the AttemptOutcomeRecorded trigger and the EnvironmentStateChanged trigger run the RunDispatcher, and for a child run, one that carries parentRunId and awaits no BudgetReserved, the StepReady of its first step runs it while the child is still Accepted (D123); the dispatcher creates the attempt with the taskContractRef and taskContractHash it takes from the step, the same for the first attempt and for every later attempt of the step, RunControlService writing no task contract itself (D121), and its lease, Unclaimed with an empty holder, expiresAt at its creation plus RunControl:Leases:ClaimTimeoutSeconds and the next fencing token, moves the step to Dispatched and the run to Running, and writes AttemptDispatched in the same transaction, idempotent on step id plus attempt number.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "CreateStepAndDispatch creates steps idempotently on the step run id, each with sideEffectClass copied from actionClass and idempotent copied from idempotent of the StepReady event and with the stepRunId and the failurePolicy the event carries kept on the step (D119); the handler also keeps on the step the optional taskContractRef and taskContractHash of StepReady, mapped to the nullable columns TaskContractRef and TaskContractHash of the table Steps, which an agent or tool step carries and a Human step does not (D123); ReleaseFirstStepOnReservation, the AttemptOutcomeRecorded trigger and the EnvironmentStateChanged trigger run the RunDispatcher, and for a child run, one that carries parentRunId and awaits no BudgetReserved, the StepReady of its first step runs it while the child is still Accepted (D123); the dispatcher creates the attempt with the taskContractRef and taskContractHash it takes from the step, the same for the first attempt and for every later attempt of the step, RunControlService writing no task contract itself (D121), and its lease, Unclaimed with an empty holder, expiresAt at its creation plus RunControl:Leases:ClaimTimeoutSeconds and the next fencing token, moves the step to Dispatched and the run to Running, and writes AttemptDispatched in the same transaction, idempotent on step id plus attempt number."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-869]",
      "number": 869
    },
    {
      "id": "AIFACTORY-TASK-870",
      "type": "task",
      "parent": "AIFACTORY-US-163",
      "title": "AcquireLease for the claim and the renewal of the lease created at dispatch",
      "sequence": "01.05.04.02",
      "description": "AcquireLease for the claim and the renewal of the lease created at dispatch. Expected output: RunControl.AcquireLease takes acquire-lease-v1 with the leaseId the caller saw in AttemptDispatched and claims the Unclaimed lease created at dispatch, so the first call records the caller as holder, moves the lease to Claimed and replaces the claim-timeout expiresAt with the lease duration from RunControl:Leases:DurationSeconds; a later call by the same holder renews the lease with a fresh expiry; every reply is lease-v1 with the fencing token and with taskContractRef and taskContractHash of the attempt and snapshotRef and snapshotHash of the run, references and hashes without the content (D119), and with the attemptToken that a typed client of the token exchange of the Authorization Server obtains with the workload identity of the service when the lease is granted or renewed, bound to the run, the step and the attempt by the claims run_id, step_id, attempt_id and tid and expiring no later than the lease, never logged, published or stored, while an unanswered exchange fails the claim fast and leaves the lease Unclaimed (D125); a claim that names a lease other than the current lease of the attempt, a superseded one, is refused with FailedPrecondition, the gRPC status FAILED_PRECONDITION (D121), and changes nothing; callers without workload identity, invalid requests, unknown or settled attempts and any caller other than the holder of a Claimed lease are refused with Unauthenticated, InvalidArgument, NotFound or FailedPrecondition, and an attempt of another tenant is answered NotFound, the gRPC status NOT_FOUND, like an unknown one (ADR-0015).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "RunControl.AcquireLease takes acquire-lease-v1 with the leaseId the caller saw in AttemptDispatched and claims the Unclaimed lease created at dispatch, so the first call records the caller as holder, moves the lease to Claimed and replaces the claim-timeout expiresAt with the lease duration from RunControl:Leases:DurationSeconds; a later call by the same holder renews the lease with a fresh expiry; every reply is lease-v1 with the fencing token and with taskContractRef and taskContractHash of the attempt and snapshotRef and snapshotHash of the run, references and hashes without the content (D119), and with the attemptToken that a typed client of the token exchange of the Authorization Server obtains with the workload identity of the service when the lease is granted or renewed, bound to the run, the step and the attempt by the claims run_id, step_id, attempt_id and tid and expiring no later than the lease, never logged, published or stored, while an unanswered exchange fails the claim fast and leaves the lease Unclaimed (D125); a claim that names a lease other than the current lease of the attempt, a superseded one, is refused with FailedPrecondition, the gRPC status FAILED_PRECONDITION (D121), and changes nothing; callers without workload identity, invalid requests, unknown or settled attempts and any caller other than the holder of a Claimed lease are refused with Unauthenticated, InvalidArgument, NotFound or FailedPrecondition, and an attempt of another tenant is answered NotFound, the gRPC status NOT_FOUND, like an unknown one (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-870]",
      "number": 870
    },
    {
      "id": "AIFACTORY-TASK-871",
      "type": "task",
      "parent": "AIFACTORY-US-163",
      "title": "Acceptance fixture of a fake runtime worker that claims attempts and renews leases",
      "sequence": "01.05.04.03",
      "description": "Acceptance fixture of a fake runtime worker that claims attempts and renews leases. Expected output: A test double subscribes to AttemptDispatched, claims the lease named by the event through AcquireLease with its workload identity, renews it and exposes the leases it holds, so the dispatch and lease scenarios run without AgentRuntimeService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "A test double subscribes to AttemptDispatched, claims the lease named by the event through AcquireLease with its workload identity, renews it and exposes the leases it holds, so the dispatch and lease scenarios run without AgentRuntimeService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-871]",
      "number": 871
    },
    {
      "id": "AIFACTORY-TASK-872",
      "type": "task",
      "parent": "AIFACTORY-US-163",
      "title": "Verify dispatch-attempts-under-lease through the acceptance suite",
      "sequence": "01.05.04.04",
      "description": "Verify dispatch-attempts-under-lease through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-007|Scenario=SCN-RunControlService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-163, including the publication and payload of AttemptDispatched, the references and hashes of the task contract and of the snapshot in lease-v1 on the claim and on the renewal, the attemptToken with its four claims and an expiry no later than the lease, obtained from a fake token exchange endpoint, and the claim that fails without a write while that endpoint does not answer (D125), the task contract reference and hash being the ones the StepReady of the step carried and the step keeps, also on a retried attempt (D123), the step of a Human step that keeps neither and gets no attempt, the first attempt of an Accepted child run dispatched on the StepReady of its first step without BudgetReserved, and the claim that names a superseded lease refused with FAILED_PRECONDITION without a change; consumer handling is proven by the suite of AgentRuntimeService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-007|Scenario=SCN-RunControlService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-163, including the publication and payload of AttemptDispatched, the references and hashes of the task contract and of the snapshot in lease-v1 on the claim and on the renewal, the attemptToken with its four claims and an expiry no later than the lease, obtained from a fake token exchange endpoint, and the claim that fails without a write while that endpoint does not answer (D125), the task contract reference and hash being the ones the StepReady of the step carried and the step keeps, also on a retried attempt (D123), the step of a Human step that keeps neither and gets no attempt, the first attempt of an Accepted child run dispatched on the StepReady of its first step without BudgetReserved, and the claim that names a superseded lease refused with FAILED_PRECONDITION without a change; consumer handling is proven by the suite of AgentRuntimeService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-872]",
      "number": 872
    },
    {
      "id": "AIFACTORY-US-164",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Record the outcome of an attempt exactly once, reported by the lease holder or reconciled on expiry",
      "sequence": "01.05.05",
      "description": "The holder of the current lease reports the single outcome of its attempt through `RunControlService/RunControl.ReportAttemptOutcome` with `attempt-outcome-v1`: the outcome (Succeeded, Failed, TimedOut, Cancelled or Uncertain), the failure class and the receipt hash. The service accepts the report only from the holder of the current lease and only once: the attempt is settled with `outcome`, `outcomeHash`, `failureClass` and `settledAt`, the lease moves to Released, and `RunControlService/AttemptOutcomeRecorded` with any `RunStateChanged` is written in the same transaction; the reply is `ack-v1` with the accepted outcome. Refusals follow one mapping: a caller without workload identity is refused with Unauthenticated; an invalid request with InvalidArgument; a report under a stale fencing token, because a newer lease exists, with FailedPrecondition and the report is audited; a second report for an attempt already settled is answered with `ack-v1` carrying the conflict outcome and is audited. Every refusal changes nothing. When a Claimed lease passes its expiry plus `RunControl:Leases:RenewalGraceSeconds` without an outcome, the `LeaseExpiryReconciler` moves the lease to Expired, marks the attempt TimedOut, or Uncertain when the `sideEffectClass` of the `Step` is shared-write or above, publishes `RunControlService/LeaseExpired` with the holder, and re-dispatches a TimedOut attempt whose number is below `maxAttempts` with a new fencing token; an Uncertain attempt of a side-effecting step is never retried automatically, whether or not the step declares an idempotency key: an Uncertain outcome on a step of class shared-write or above, reported by the holder or set by the reconciler, opens an operator decision for the Operator of the project, whatever failure policy the step declares, and the run waits for the choice (AIFACTORY-US-657, D119). An Uncertain outcome that the holder reports may mark the tool invocation whose effect is uncertain, in the optional member `uncertainToolInvocationId` of `attempt-outcome-v1`, and the operator decision it opens keeps that id (AIFACTORY-US-726, D123). An Unclaimed lease is a different case, because no worker ever started the attempt: its `expiresAt` was set at creation plus `RunControl:Leases:ClaimTimeoutSeconds`, and the renewal grace applies to Claimed leases only, so when that `expiresAt` passes without a claim the reconciler moves the lease to Expired without waiting for the grace, publishes `RunControlService/LeaseExpired` with an empty `holder`, which is an optional field of the payload, and the attempt is dispatched again under a new fencing token, without counting against `maxAttempts`. A Failed attempt is retried below `maxAttempts` only when its `failureClass` is transient and the `sideEffectClass` of the `Step` is read or sandbox, or shared-write when the `Step` is `idempotent`, that is when the step of the pinned workflow definition declares an idempotency key (ADR-0014): the `RunDispatcher` then dispatches the next attempt of the step with a new lease and fencing token. Both rules read `sideEffectClass` and `idempotent` from the `Step`, where `CreateStepAndDispatch` copied them from `actionClass` and `idempotent` of the `StepReady` event of WorkflowEngineService (AIFACTORY-US-163). Any other Failed attempt, and a TimedOut or retriable Failed attempt that reached `maxAttempts`, fails the step terminally: the step is settled Failed and announced by `StepSettled`, and RunControlService does not fail the run for it (D121). WorkflowEngineService applies the failure policy of the step and reports `WorkflowRunFailed`, and only on that report does the run fail (AIFACTORY-US-167): under Fail at once, under Compensate once the compensation finished, and under Retry the same way as under Fail, because a step settled Failed under the failure policy Retry has its attempts spent and RunControlService has already made every retry the rule allows (D123). When the `failurePolicy` the `Step` keeps from `StepReady` is Escalate, the step is not settled and the operator decision of AIFACTORY-US-657 is opened instead (D119); a retry the Operator chooses there dispatches one more attempt beyond `maxAttempts` (D121). A step that reaches its final state is announced once by `StepSettled`, which is what tells WorkflowEngineService that the step is settled; an attempt outcome alone settles no step for the engine (AIFACTORY-US-658). WorkflowEngineService, CostUsageService and SecretBrokerService consume the events in their own PBIs. Kind: behavior. Traces: services: RunControlService, AgentRuntimeService; aggregates: RunControlService/Attempt, RunControlService/Lease, RunControlService/Step; apis: RunControlService/RunControl.ReportAttemptOutcome; events: RunControlService/AttemptOutcomeRecorded, RunControlService/LeaseExpired, RunControlService/AttemptDispatched, RunControlService/RunStateChanged; descriptors: attempt-outcome-v1, ack-v1; adrs: ADR-0012, ADR-0014; requirements: FR-10, FUX-07, XL-06; scenarios: SCN-RunControlService-008, SCN-RunControlService-017, SCN-RunControlService-018. Relates: nfrs: NFR-05, NFR-06. Depends on: AIFACTORY-US-163. Sources: model/services/control-plane/RunControlService.yaml, docs/planes/control/services/run-control-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the holder of the current lease of an open attempt, when `RunControlService/RunControl.ReportAttemptOutcome` is called with `attempt-outcome-v1` carrying the outcome, failure class and receipt hash, then the reply is `ack-v1` accepted, the `RunControlService/Attempt` is settled with `outcome`, `outcomeHash`, `failureClass` and `settledAt`, the `RunControlService/Lease` moves to Released and `RunControlService/AttemptOutcomeRecorded` is written in the same transaction (SCN-RunControlService-008).",
        "AC2: Given a report to `RunControlService/RunControl.ReportAttemptOutcome` from a caller without workload identity, with an invalid request, under a stale fencing token, or for an attempt already settled, when it arrives, then the call is refused with Unauthenticated, InvalidArgument or FailedPrecondition respectively, the settled attempt is answered with `ack-v1` carrying the conflict outcome, the stale and the second report are audited, and no state changes in any of these cases (SCN-RunControlService-008, ADR-0014).",
        "AC3: Given the attempt was settled, when the outbox dispatcher publishes `RunControlService/AttemptOutcomeRecorded` on `run-control.attempts.v1.attempt-outcome-recorded`, then the outbox record was written in the same transaction as the settlement, the event is sent under the canonical envelope with `runId`, `stepId`, `attemptId`, `outcome`, `failureClass` and `outcomeHash`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-017, ADR-0012).",
        "AC4: Given a Claimed `RunControlService/Lease` whose `expiresAt` plus `RunControl:Leases:RenewalGraceSeconds` has passed without an outcome, when the `LeaseExpiryReconciler` runs, then the lease moves to Expired, the attempt is settled TimedOut, or Uncertain when the `sideEffectClass` of its step is shared-write or above, `RunControlService/LeaseExpired` is written in the same transaction and published with `attemptId`, `leaseId` and `holder`, a TimedOut attempt whose number is below `maxAttempts` is re-dispatched with a new fencing token, and an outcome later reported under the expired token is refused with FailedPrecondition and audited; given instead an Unclaimed lease whose `expiresAt`, its creation plus `RunControl:Leases:ClaimTimeoutSeconds`, has passed without a claim, then the lease moves to Expired without the renewal grace, which applies to Claimed leases only, `RunControlService/LeaseExpired` is written in the same transaction and published with `attemptId`, `leaseId` and an empty `holder`, and the attempt is dispatched again under a new fencing token without counting against `maxAttempts` (SCN-RunControlService-018, XL-06).",
        "AC5: Given a settled attempt whose number is below the `maxAttempts` of its `RunControlService/Step`, when the `RunDispatcher` evaluates the step after `RunControlService/AttemptOutcomeRecorded`, then a Failed attempt is retried with a new attempt, lease and fencing token only when its `failureClass` is transient and the `sideEffectClass` of the step is read or sandbox, or shared-write with `idempotent` true, both read from the step, any other Failed attempt fails the step terminally without a retry, which settles the step Failed and leaves the run Running until the engine reports its failure (AIFACTORY-US-167, D121), and an Uncertain attempt on a step whose `sideEffectClass` is shared-write or above is never retried automatically, idempotency key or not, and is surfaced to the Operator of the project through the operator decision that AIFACTORY-US-657 opens, as the invariants of `RunControlService/Attempt` require (SCN-RunControlService-017, SCN-RunControlService-018, FUX-07)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-873",
        "AIFACTORY-TASK-874",
        "AIFACTORY-TASK-875",
        "AIFACTORY-TASK-889",
        "AIFACTORY-TASK-876"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5505,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "AgentRuntimeService"
        ],
        "aggregates": [
          "RunControlService/Attempt",
          "RunControlService/Lease",
          "RunControlService/Step"
        ],
        "apis": [
          "RunControlService/RunControl.ReportAttemptOutcome"
        ],
        "events": [
          "RunControlService/AttemptOutcomeRecorded",
          "RunControlService/LeaseExpired",
          "RunControlService/AttemptDispatched",
          "RunControlService/RunStateChanged"
        ],
        "descriptors": [
          "attempt-outcome-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10",
          "FUX-07",
          "XL-06"
        ],
        "scenarios": [
          "SCN-RunControlService-008",
          "SCN-RunControlService-017",
          "SCN-RunControlService-018"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05",
          "NFR-06"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-163"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-164]",
      "number": 164
    },
    {
      "id": "AIFACTORY-TASK-873",
      "type": "task",
      "parent": "AIFACTORY-US-164",
      "title": "ReportAttemptOutcome guarded by the current lease and the fencing token",
      "sequence": "01.05.05.01",
      "description": "ReportAttemptOutcome guarded by the current lease and the fencing token. Expected output: RunControl.ReportAttemptOutcome settles the attempt once from the current lease holder, moves the lease to Released and writes AttemptOutcomeRecorded and RunStateChanged in one transaction; a missing workload identity is Unauthenticated, an invalid request InvalidArgument, a stale fencing token FailedPrecondition and audited, and a second report for a settled attempt is answered with ack-v1 carrying the conflict outcome and audited; every refusal changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "RunControl.ReportAttemptOutcome settles the attempt once from the current lease holder, moves the lease to Released and writes AttemptOutcomeRecorded and RunStateChanged in one transaction; a missing workload identity is Unauthenticated, an invalid request InvalidArgument, a stale fencing token FailedPrecondition and audited, and a second report for a settled attempt is answered with ack-v1 carrying the conflict outcome and audited; every refusal changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-873]",
      "number": 873
    },
    {
      "id": "AIFACTORY-TASK-874",
      "type": "task",
      "parent": "AIFACTORY-US-164",
      "title": "LeaseExpiryReconciler with TimedOut and Uncertain settlement and guarded retry",
      "sequence": "01.05.05.02",
      "description": "LeaseExpiryReconciler with TimedOut and Uncertain settlement and guarded retry. Expected output: The scheduled worker moves Claimed leases past expiresAt plus the renewal grace to Expired, settles the attempt TimedOut or Uncertain by the sideEffectClass of its step, publishes LeaseExpired, re-dispatches TimedOut attempts below maxAttempts with a new fencing token, never retries an Uncertain attempt of a shared-write step, with or without an idempotency key, and hands it to the operator decision of AIFACTORY-TASK-2646 (D119), and hands an attempt at maxAttempts to the terminal step failure of AIFACTORY-TASK-888, which settles the step and does not fail the run (D121); it moves an Unclaimed lease past its expiresAt (creation plus RunControl:Leases:ClaimTimeoutSeconds) to Expired without the renewal grace, which applies to Claimed leases only, publishes LeaseExpired for it with an empty holder, the optional field of the payload, and dispatches the attempt again under a new fencing token without counting against maxAttempts; it is idempotent on leaseId plus fencingToken.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The scheduled worker moves Claimed leases past expiresAt plus the renewal grace to Expired, settles the attempt TimedOut or Uncertain by the sideEffectClass of its step, publishes LeaseExpired, re-dispatches TimedOut attempts below maxAttempts with a new fencing token, never retries an Uncertain attempt of a shared-write step, with or without an idempotency key, and hands it to the operator decision of AIFACTORY-TASK-2646 (D119), and hands an attempt at maxAttempts to the terminal step failure of AIFACTORY-TASK-888, which settles the step and does not fail the run (D121); it moves an Unclaimed lease past its expiresAt (creation plus RunControl:Leases:ClaimTimeoutSeconds) to Expired without the renewal grace, which applies to Claimed leases only, publishes LeaseExpired for it with an empty holder, the optional field of the payload, and dispatches the attempt again under a new fencing token without counting against maxAttempts; it is idempotent on leaseId plus fencingToken."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-874]",
      "number": 874
    },
    {
      "id": "AIFACTORY-TASK-875",
      "type": "task",
      "parent": "AIFACTORY-US-164",
      "title": "Metrics and operator surfacing of expired leases and Uncertain attempts",
      "sequence": "01.05.05.03",
      "description": "Metrics and operator surfacing of expired leases and Uncertain attempts. Expected output: connectsoft.factory.leases.expired and connectsoft.factory.attempts.duration are emitted with their modelled dimensions, and Uncertain attempts that will not retry are listed for operators through the run read model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "connectsoft.factory.leases.expired and connectsoft.factory.attempts.duration are emitted with their modelled dimensions, and Uncertain attempts that will not retry are listed for operators through the run read model."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-875]",
      "number": 875
    },
    {
      "id": "AIFACTORY-TASK-889",
      "type": "task",
      "parent": "AIFACTORY-US-164",
      "title": "Retry rule of a Failed attempt in the RunDispatcher by failure class and side-effect class",
      "sequence": "01.05.05.04",
      "description": "Retry rule of a Failed attempt in the RunDispatcher by failure class and side-effect class. Expected output: After AttemptOutcomeRecorded the RunDispatcher dispatches the next attempt of a step whose last attempt Failed below maxAttempts only when the failureClass is transient and the sideEffectClass of the Step is read or sandbox, or shared-write with idempotent true; both values are read from the Step and from nowhere else; every other Failed attempt goes to the terminal step failure of AIFACTORY-TASK-888 without a retry, where the step is settled Failed and the run is left to the report of the engine (D121); the decision is idempotent on step id plus attempt number and unit tests cover each failure class against each side-effect class with and without the idempotent flag.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "After AttemptOutcomeRecorded the RunDispatcher dispatches the next attempt of a step whose last attempt Failed below maxAttempts only when the failureClass is transient and the sideEffectClass of the Step is read or sandbox, or shared-write with idempotent true; both values are read from the Step and from nowhere else; every other Failed attempt goes to the terminal step failure of AIFACTORY-TASK-888 without a retry, where the step is settled Failed and the run is left to the report of the engine (D121); the decision is idempotent on step id plus attempt number and unit tests cover each failure class against each side-effect class with and without the idempotent flag."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-889]",
      "number": 889
    },
    {
      "id": "AIFACTORY-TASK-876",
      "type": "task",
      "parent": "AIFACTORY-US-164",
      "title": "Verify record-attempt-outcome-once through the acceptance suite",
      "sequence": "01.05.05.05",
      "description": "Verify record-attempt-outcome-once through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-008|Scenario=SCN-RunControlService-017|Scenario=SCN-RunControlService-018)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-164, including the refusal mapping of ReportAttemptOutcome, the retry rule of a Failed attempt (a transient failure retried on a read or sandbox step and on a shared-write step with an idempotency key, never on a shared-write step without one), the Unclaimed lease expired after the claim timeout without the renewal grace and dispatched again without counting against maxAttempts, and the publication and payload of AttemptOutcomeRecorded and LeaseExpired, the latter with the holder of a Claimed lease and with an empty holder for an Unclaimed one; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-008|Scenario=SCN-RunControlService-017|Scenario=SCN-RunControlService-018)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-164, including the refusal mapping of ReportAttemptOutcome, the retry rule of a Failed attempt (a transient failure retried on a read or sandbox step and on a shared-write step with an idempotency key, never on a shared-write step without one), the Unclaimed lease expired after the claim timeout without the renewal grace and dispatched again without counting against maxAttempts, and the publication and payload of AttemptOutcomeRecorded and LeaseExpired, the latter with the holder of a Claimed lease and with an empty holder for an Unclaimed one; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-876]",
      "number": 876
    },
    {
      "id": "AIFACTORY-US-165",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Open a human approval bound to the exact proposal before a gated action",
      "sequence": "01.05.06",
      "description": "A runtime worker holding the current lease of an attempt whose step is gated asks for a human decision through `RunControlService/RunControl.RequestApproval` with `approval-request-v1`: the action class of the gated action, the hash of the exact artifact, diff, manifest or tool arguments, and the proposal kind. Every approval request names its subject as a kind and an id from the closed list run, provisioning-run, evaluation-run, asset-release and promotion, and `runId` is optional, present when the subject is a run or belongs to one (D129, D131, D135); a lease holder names the subject kind run with the id of its run, and its workload token holds the scope `factory.approvals.request`. A request for a subject that a service owns, made with the service identity of that service and moving no run, is delivered by AIFACTORY-US-1492. The service takes the approver rule the request supplies and resolves it through PolicyEngineService only when the request carries none (D141), sets the expiry from `RunControl:Approvals:DefaultExpiryHours` unless policy shortens it, opens the Pending `ApprovalRequest`, moves the run from Running to WaitingForApproval and writes `RunControlService/ApprovalRequested` and `RunControlService/RunStateChanged` in the same transaction; the reply is `approval-ref-v1` with the approval id and the expiry, and the `approval-expiry` reminder of the run grain is scheduled. The request carries `onExpiry` (fail or re-request) and `reRequestsLeft`, copied when the request is made from the `ApprovalRule` of ApprovalPolicyService that belongs to the policy revision the run pinned, `reRequestsLeft` from the `maxReRequests` of that rule. The request carries as well `quorum`, the number of eligible approvals it needs, copied from the quorum of the same rule (D127). While no approval rule is supplied, which is the case until ApprovalPolicyService arrives with the approval rules in I4 (D126, D127), the request carries `onExpiry` fail, `reRequestsLeft` 0 and `quorum` 1, so no re-request happens and one eligible approval decides it. The request is also accepted from a run that is WaitingForApproval when no request of the step is Pending, which is the case after the earlier request went Stale: the new Pending request is opened for the current proposal hash, `ApprovalRequested` is written and the run stays WaitingForApproval. After a ChangesRequested decision the run is Running again, so the lease holder regenerates the proposal and asks through the first path. A Human step announced by WorkflowEngineService opens its approval the same way from the inbox handler. Two Human steps are never announced and so open no approval here (D133): from I4 a Human step whose policy guard the policy answers with allow is recorded Skipped by the engine, which emits no `StepReady` for it, and a Human step that waits on the promotion gate of EnvironmentPromotionService advances on the `ApprovalDecided` of that promotion, whose request EnvironmentPromotionService makes for its own subject (AIFACTORY-US-1492). A run-level spend approval is not requested through this method: it is opened by the inbox handler of `SpendApprovalRequired` of CostUsageService, names no step, no lease and no fencing token, and its expiry always fails the run (AIFACTORY-US-546). An operator decision is not requested through it either: RunControlService opens that request itself, with the `kind` operator-decision, when a step fails terminally under the failure policy Escalate or an Uncertain outcome is recorded on a step of class shared-write or above, and an expired one is never requested again and fails the run (AIFACTORY-US-657, D119). A repeated request from the same attempt for the same proposal hash returns the existing reference. A caller without workload identity, an invalid request, a stale fencing token, an unavailable PolicyEngineService, or a request for another proposal hash while a request of the step is still Pending is refused with the matching gRPC status and no request is opened. The event is published under the canonical envelope; StudioBff, StudioNotificationService and AuditService consume it in their own PBIs. The `ApprovalExpiryReconciler` moves a request past its expiry to Expired and writes `ApprovalDecided` with state Expired. What follows is settled by the `onExpiry` and `reRequestsLeft` the expired request carries: when `onExpiry` is fail, or is re-request and `reRequestsLeft` is 0, the run moves from WaitingForApproval to Failed with failure class policy-denied; when `onExpiry` is re-request and `reRequestsLeft` is above 0, a new Pending request is opened for the same proposal hash with the same `onExpiry` and with `reRequestsLeft` counted down by one, and the run stays WaitingForApproval; a request made while no approval rule was supplied carries fail and fails the run the same way. A Pending request whose run fails for any other reason moves from Pending to Cancelled through the trigger `RunFailed` in the transaction of the run transition, and `ApprovalDecided` with state Cancelled is written with it; this covers the request of a WaitingForApproval run that is failed by a retired environment (AIFACTORY-US-168). Kind: behavior. Traces: services: RunControlService, PolicyEngineService, ApprovalPolicyService, AgentRuntimeService; aggregates: RunControlService/ApprovalRequest, RunControlService/Run, RunControlService/Step; apis: RunControlService/RunControl.RequestApproval; events: RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, RunControlService/RunStateChanged; descriptors: approval-request-v1, approval-ref-v1; adrs: ADR-0012, ADR-0014; requirements: FR-06, FUX-05; scenarios: SCN-RunControlService-009, SCN-RunControlService-019, SCN-RunControlService-020. Relates: screens: approvals-list; nfrs: NFR-04. Depends on: AIFACTORY-US-163, feature:policy-engine-service. Sources: model/services/control-plane/RunControlService.yaml, docs/planes/control/services/run-control-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a lease holder of an attempt on a step with gate approval in a Running run, when `RunControlService/RunControl.RequestApproval` is called with `approval-request-v1`, then the reply carries `approval-ref-v1` with `approvalId` and `expiresAt`, a Pending `RunControlService/ApprovalRequest` bound to the `proposalHash` exists with the `subjectKind` run, the `subjectId` and the `runId` of the run (D129, D135), its `approverRule` and `policyRevision` and with `onExpiry`, `reRequestsLeft` and `quorum` copied from the `ApprovalRule` when the request is made, fail, 0 and 1 while no approval rule is supplied (D127), and the run is WaitingForApproval with `RunControlService/RunStateChanged` and `RunControlService/ApprovalRequested` written in the same transaction; given a run already WaitingForApproval with no Pending request of the step, as after a Stale request, the call opens the new Pending request for the current `proposalHash`, writes `RunControlService/ApprovalRequested` and leaves the run WaitingForApproval (SCN-RunControlService-009).",
        "AC2: Given a caller without workload identity, an invalid request, a stale fencing token, an unavailable PolicyEngineService, or a different `proposalHash` while a request of the step is still Pending, when `RunControlService/RunControl.RequestApproval` is called, then the call is refused with the matching gRPC status, no `RunControlService/ApprovalRequest` is opened and the run keeps its state (SCN-RunControlService-009).",
        "AC3: Given the request was opened, when the outbox dispatcher publishes `RunControlService/ApprovalRequested` on `run-control.approvals.v1.approval-requested`, then the outbox record was written in the same transaction as the request, the event is sent under the canonical envelope with `approvalId`, `runId`, the `subjectKind` run and the `subjectId` (D129, D135), `stepId`, `tenantId`, `actionClass`, `proposalHash`, `approverRule` and `expiresAt` and without the optional `kind`, whose absence means approval (D119), and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-019, ADR-0012, FUX-05).",
        "AC4: Given a Pending `RunControlService/ApprovalRequest` whose `expiresAt` has passed, when the `ApprovalExpiryReconciler` runs, then the request becomes Expired and `RunControlService/ApprovalDecided` with state Expired is written in the same transaction; by the `onExpiry` and `reRequestsLeft` the expired request carries, the run either moves from WaitingForApproval to Failed with `RunControlService/RunStateChanged` and failure class policy-denied, when `onExpiry` is fail or `reRequestsLeft` is 0, or a new Pending request is opened for the same `proposalHash` with `reRequestsLeft` counted down by one and the run stays WaitingForApproval, when `onExpiry` is re-request and `reRequestsLeft` is above 0; a request made while no approval rule was supplied carries fail and fails the run the same way; a second run of the reconciler for the same `approvalId` and version changes nothing (SCN-RunControlService-020, FR-06).",
        "AC5: Given a Pending `RunControlService/ApprovalRequest` of a run that fails for a reason other than a decision on or the expiry of that request, as when the target environment of the WaitingForApproval run is retired, when the `RunControlService/Run` moves to Failed, then the request moves from Pending to Cancelled through the trigger `RunFailed` in the transaction of the run transition and `RunControlService/ApprovalDecided` with state Cancelled is written with it, so that no Pending request outlives its failed run (SCN-RunControlService-020, FR-06)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-877",
        "AIFACTORY-TASK-878",
        "AIFACTORY-TASK-1492",
        "AIFACTORY-TASK-879"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5506,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "PolicyEngineService",
          "ApprovalPolicyService",
          "AgentRuntimeService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "RunControlService/Run",
          "RunControlService/Step"
        ],
        "apis": [
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunStateChanged"
        ],
        "descriptors": [
          "approval-request-v1",
          "approval-ref-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-06",
          "FUX-05"
        ],
        "scenarios": [
          "SCN-RunControlService-009",
          "SCN-RunControlService-019",
          "SCN-RunControlService-020"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list"
        ],
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-163",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-165]",
      "number": 165
    },
    {
      "id": "AIFACTORY-TASK-877",
      "type": "task",
      "parent": "AIFACTORY-US-165",
      "title": "RequestApproval with approver rule resolution, expiry and the WaitingForApproval transition",
      "sequence": "01.05.06.01",
      "description": "RequestApproval with approver rule resolution, expiry and the WaitingForApproval transition. Expected output: RunControl.RequestApproval, under the scope factory.approvals.request, opens the Pending ApprovalRequest bound to the proposal hash with the subject kind run and the run id as subject id for a lease holder (D129, D135), resolves the approver rule through PolicyEngineService, sets the expiry, copies onExpiry, reRequestsLeft and quorum from the ApprovalRule onto the request when it is made (fail, 0 and 1 while no approval rule is supplied, D127), moves a Running run to WaitingForApproval with ApprovalRequested and RunStateChanged in one transaction, accepts the request from a WaitingForApproval run when no request of the step is Pending (after Stale) and then writes ApprovalRequested without a run transition, schedules the approval-expiry reminder and returns approval-ref-v1; repeats for the same proposal hash return the existing reference and another proposal hash while a request of the step is Pending is refused.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "RunControl.RequestApproval, under the scope factory.approvals.request, opens the Pending ApprovalRequest bound to the proposal hash with the subject kind run and the run id as subject id for a lease holder (D129, D135), resolves the approver rule through PolicyEngineService, sets the expiry, copies onExpiry, reRequestsLeft and quorum from the ApprovalRule onto the request when it is made (fail, 0 and 1 while no approval rule is supplied, D127), moves a Running run to WaitingForApproval with ApprovalRequested and RunStateChanged in one transaction, accepts the request from a WaitingForApproval run when no request of the step is Pending (after Stale) and then writes ApprovalRequested without a run transition, schedules the approval-expiry reminder and returns approval-ref-v1; repeats for the same proposal hash return the existing reference and another proposal hash while a request of the step is Pending is refused."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5506,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-877]",
      "number": 877
    },
    {
      "id": "AIFACTORY-TASK-878",
      "type": "task",
      "parent": "AIFACTORY-US-165",
      "title": "ApprovalExpiryReconciler moving overdue requests to Expired and failing or re-requesting by the onExpiry and reRequestsLeft fields of the request",
      "sequence": "01.05.06.02",
      "description": "ApprovalExpiryReconciler moving overdue requests to Expired and failing or re-requesting by the onExpiry and reRequestsLeft fields of the request. Expected output: The scheduled worker moves Pending requests past expiresAt to Expired and writes ApprovalDecided with state Expired, takes onExpiry (fail or re-request) and reRequestsLeft from the expired request, where they were copied from the ApprovalRule when the request was made, and either fails the run through ApprovalRejectedOrExpired with RunFailed carrying failure class policy-denied and RunStateChanged, when onExpiry is fail or reRequestsLeft is 0, or opens a new Pending request for the same proposal hash with the same onExpiry and reRequestsLeft counted down by one and leaves the run WaitingForApproval, when onExpiry is re-request and reRequestsLeft is above 0; a request made while no approval rule was supplied carries fail and fails the run the same way; it is idempotent on approvalId plus version.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The scheduled worker moves Pending requests past expiresAt to Expired and writes ApprovalDecided with state Expired, takes onExpiry (fail or re-request) and reRequestsLeft from the expired request, where they were copied from the ApprovalRule when the request was made, and either fails the run through ApprovalRejectedOrExpired with RunFailed carrying failure class policy-denied and RunStateChanged, when onExpiry is fail or reRequestsLeft is 0, or opens a new Pending request for the same proposal hash with the same onExpiry and reRequestsLeft counted down by one and leaves the run WaitingForApproval, when onExpiry is re-request and reRequestsLeft is above 0; a request made while no approval rule was supplied carries fail and fails the run the same way; it is idempotent on approvalId plus version."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5506,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-878]",
      "number": 878
    },
    {
      "id": "AIFACTORY-TASK-1492",
      "type": "task",
      "parent": "AIFACTORY-US-165",
      "title": "Pending approval request Cancelled through RunFailed when its run fails",
      "sequence": "01.05.06.03",
      "description": "Pending approval request Cancelled through RunFailed when its run fails. Expected output: Every transition of a run to Failed moves the Pending ApprovalRequest of that run, when one exists, to Cancelled through the trigger RunFailed in the transaction of the run transition and writes ApprovalDecided with state Cancelled; the failure of a WaitingForApproval run of a retired environment (AIFACTORY-TASK-891) takes this path; a request that already left Pending is not touched, and a redelivery of the cause changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Every transition of a run to Failed moves the Pending ApprovalRequest of that run, when one exists, to Cancelled through the trigger RunFailed in the transaction of the run transition and writes ApprovalDecided with state Cancelled; the failure of a WaitingForApproval run of a retired environment (AIFACTORY-TASK-891) takes this path; a request that already left Pending is not touched, and a redelivery of the cause changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5506,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1492]",
      "number": 1492
    },
    {
      "id": "AIFACTORY-TASK-879",
      "type": "task",
      "parent": "AIFACTORY-US-165",
      "title": "Verify request-an-approval through the acceptance suite",
      "sequence": "01.05.06.04",
      "description": "Verify request-an-approval through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-009|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-165, including the request accepted from WaitingForApproval after a Stale request, onExpiry and reRequestsLeft copied to the request when it is made (fail and 0 without a rule), the outcomes at expiry by those fields (fail with failure class policy-denied, re-request while reRequestsLeft is above 0 with the count going down and then fail, fail for a request made without a rule), the Pending request Cancelled through RunFailed when its run fails, and the publication and payload of ApprovalRequested and ApprovalDecided; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-009|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-165, including the request accepted from WaitingForApproval after a Stale request, onExpiry and reRequestsLeft copied to the request when it is made (fail and 0 without a rule), the outcomes at expiry by those fields (fail with failure class policy-denied, re-request while reRequestsLeft is above 0 with the count going down and then fail, fail for a request made without a rule), the Pending request Cancelled through RunFailed when its run fails, and the publication and payload of ApprovalRequested and ApprovalDecided; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5506,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-879]",
      "number": 879
    },
    {
      "id": "AIFACTORY-US-166",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Decide an approval on the exact proposal version with authority, expiry and conflict handling",
      "sequence": "01.05.07",
      "description": "As a reviewer, I want to see the approvals waiting for my roles and decide each on exactly the proposal I was shown, so that no stale, duplicate or unauthorized decision ever advances a run. A caller whose scope carries `factory.approvals.read` lists the pending and decided approval requests visible to the caller's roles through `RunControlService/ListApprovals` and receives `approval-list-v1` with action class, proposal hash, expiry, state and version; requests of other tenants never appear. A caller whose scope carries `factory.approvals.decide`, whose roles satisfy the approver rule of the request and who is not the requester of the run (D18 separation of duties) decides through `RunControlService/DecideApproval` with `approval-decision-v1`, quoting the request version and the proposal hash shown. The service records approve, reject or request changes on that exact version with `decidedBy`, `decidedAt` and the reason, and writes `RunControlService/ApprovalDecided` with the `RunStateChanged` of the run transition in the same transaction: an approval moves the request to Approved and the run from WaitingForApproval back to Running; a rejection moves the request to Rejected and terminates the run as Failed with failure class policy-denied; a request-changes decision moves the request to ChangesRequested (trigger `RequestChanges`) and returns the run from WaitingForApproval to Running (trigger `ChangesRequested`), and the reviewer's reason travels in `ApprovalDecided` as feedback for the lease holder, who regenerates the proposal and requests a new approval. An approve decision of an eligible approver on a request of `kind` approval is recorded as a vote in the table `ApprovalVotes`, one row per approver with the vote, the reason and the time (D127): the request stays Pending until its approve votes reach its `quorum` and is Approved by the vote that reaches it (trigger `QuorumReached`), one reject decision of an eligible approver ends it Rejected at once (trigger `EligibleApproverRejected`), and a second vote of the same approver on the same request is answered 409 and changes nothing. A vote that leaves the request Pending moves no run and publishes no `ApprovalDecided`. The quorum comes from the approval rule of the request, so a quorum above one arrives with the approval rules of ApprovalPolicyService in I4; until then every request carries the quorum one and the first eligible approve decision approves it, through the same vote path. A decision on a request whose subject is not a run moves no run and is announced to the service that owns the subject (AIFACTORY-US-1492). A spend approval, the run-level request of action class spend that is opened when the estimate of a run is above the spend threshold, is listed and decided through the same routes under the same authority rules; what its decision does to the run, back to Accepted on approval, Failed on rejection and a request-changes decision answered 409 (D119), is delivered by AIFACTORY-US-546. An operator decision, the request of `kind` operator-decision that RunControlService opens for the Operator of the project when a step fails under the failure policy Escalate or an Uncertain outcome is recorded on a step of class shared-write or above, is listed and decided through the same routes with one of the choices retry, compensate and fail; an approve, reject or request-changes decision on it, and a choice on a request of `kind` approval, are answered 409 and leave the request Pending, and what each choice does to the step and to the run is delivered by AIFACTORY-US-657 (D119). The finding that an operator decision on an uncertain tool effect carries, with the 400 for a decision without one and the 503 when ToolAdapterService does not answer the call that records it, is delivered by AIFACTORY-US-726 (D123). The separation of duties covers the requests of `kind` approval, a proposal and a spend, and not the operator decision: the member who requested a run may take the operator decision of that run, under the approver rule of the request like any other caller, and the act is audited (D121). A missing scope, an unsatisfied approver rule or the requester deciding a request of `kind` approval is refused with 403; an unknown request and a request of another tenant are both answered 404, so the response never confirms that a foreign request exists (ADR-0015); a version mismatch, a second decision or a Stale request is 409 and audited; a request past its expiry is 410. A request that was Cancelled with its run, through the trigger `RunCancelled` when the run was cancelled or through the trigger `RunFailed` when the run failed (AIFACTORY-US-165), is no longer Pending: a decision on it is refused with 409 like one on a decided request and never advances the run. A pending request becomes Stale when the proposal version it was bound to changes, announced by `PipelineExecutionService/ChangeProposalStateChanged`, `BlueprintService/BlueprintValidated` or `GenerationRecipeService/RecipeApproved`; after Stale the run stays WaitingForApproval until the lease holder requests a new approval for the current proposal hash through `RunControlService/RunControl.RequestApproval`, which is accepted from WaitingForApproval when no request of the step is Pending (AIFACTORY-US-165). AgentRuntimeService, WorkflowEngineService, AgentRegistryService and AuditService consume the decision in their own PBIs. Kind: behavior. Traces: services: RunControlService, PolicyEngineService, PipelineExecutionService, BlueprintService, GenerationRecipeService; aggregates: RunControlService/ApprovalRequest, RunControlService/Run; apis: RunControlService/DecideApproval, RunControlService/ListApprovals; events: RunControlService/ApprovalDecided, RunControlService/RunStateChanged, PipelineExecutionService/ChangeProposalStateChanged, BlueprintService/BlueprintValidated, GenerationRecipeService/RecipeApproved; descriptors: approval-decision-v1, approval-list-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-06, FUX-05, XL-05; scenarios: SCN-RunControlService-005, SCN-RunControlService-006, SCN-RunControlService-020. Relates: screens: approvals-list, approval-card; nfrs: NFR-04. Depends on: AIFACTORY-US-165, feature:pipeline-execution-service-thin, feature:blueprint-service, feature:generation-recipe-service. Sources: model/services/control-plane/RunControlService.yaml, docs/planes/control/services/run-control-service/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.approvals.read` and pending and decided requests across tenants, when `RunControlService/ListApprovals` is called, then the response is 200 with `approval-list-v1` holding only the requests of the caller's tenant visible to the caller's roles, each with `actionClass`, `proposalHash`, `expiresAt`, state and version (SCN-RunControlService-006).",
        "AC2: Given a reviewer whose roles satisfy the `approverRule` of a Pending `RunControlService/ApprovalRequest` and who did not request the run, when `RunControlService/DecideApproval` is called with `approval-decision-v1` quoting the current version and the `proposalHash`, then the response is 200, the request is Approved, Rejected or ChangesRequested with `decidedBy`, `decidedAt` and the reason, and `RunControlService/ApprovalDecided` and `RunControlService/RunStateChanged` are written in the same transaction, moving the run to Running on approval, to Failed with failure class policy-denied on rejection, and back to Running through the trigger `ChangesRequested` on a request-changes decision, whose reason `RunControlService/ApprovalDecided` carries as feedback for the lease holder; the approve decision is recorded as a vote in `ApprovalVotes`, and given a request whose `quorum` is two, then the first eligible approve vote leaves it Pending without `RunControlService/ApprovalDecided`, the second vote of another eligible approver approves it through `QuorumReached`, one reject vote of an eligible approver rejects it through `EligibleApproverRejected`, and a second vote of the same approver answers 409 (SCN-RunControlService-005, FR-06, D127).",
        "AC3: Given a caller without `factory.approvals.decide`, with roles that do not satisfy the rule, or who is the requester of the run and decides a request of `kind` approval, a proposal or a spend, when `RunControlService/DecideApproval` is called, then the response is 403 with a problem response, the request stays Pending and the run does not advance; the requester is refused for these requests only and may take the operator decision of the same run (SCN-RunControlService-005, ADR-0014, D121).",
        "AC4: Given an `approvalId` that is unknown or exists only in another tenant, a quoted version that no longer matches because a second decision was submitted concurrently, a request already decided, Cancelled with its cancelled or failed run through the trigger `RunCancelled` or `RunFailed`, or made Stale by `PipelineExecutionService/ChangeProposalStateChanged`, `BlueprintService/BlueprintValidated` or `GenerationRecipeService/RecipeApproved`, a decision that does not fit the kind of the request, that is request-changes on a spend approval, a choice of retry, compensate or fail on a request of kind approval, or approve, reject or request-changes on an operator decision (D119), or a request past `expiresAt`, when `RunControlService/DecideApproval` is called, then the response is 404 for the unknown or foreign request, 409 for the conflict and for the decision that does not fit, which leaves the request Pending, and 410 for the expired request, the refused duplicate, stale or expired decision is audited and nothing advances (SCN-RunControlService-005, XL-05, ADR-0015).",
        "AC5: Given the request left Pending through Approve, Reject, RequestChanges or ProposalChanged, when the outbox dispatcher publishes `RunControlService/ApprovalDecided` on `run-control.approvals.v1.approval-decided`, then the outbox record was written in the same transaction as the decision and the run transition it causes, the event is sent under the canonical envelope with `approvalId`, `runId`, `tenantId`, `state`, `decidedBy`, `reason`, `projectId`, `proposalKind` and `proposalHash`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-020, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-880",
        "AIFACTORY-TASK-881",
        "AIFACTORY-TASK-882",
        "AIFACTORY-TASK-883"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5507,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "PolicyEngineService",
          "PipelineExecutionService",
          "BlueprintService",
          "GenerationRecipeService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "RunControlService/Run"
        ],
        "apis": [
          "RunControlService/DecideApproval",
          "RunControlService/ListApprovals"
        ],
        "events": [
          "RunControlService/ApprovalDecided",
          "RunControlService/RunStateChanged",
          "PipelineExecutionService/ChangeProposalStateChanged",
          "BlueprintService/BlueprintValidated",
          "GenerationRecipeService/RecipeApproved"
        ],
        "descriptors": [
          "approval-decision-v1",
          "approval-list-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "XL-05"
        ],
        "scenarios": [
          "SCN-RunControlService-005",
          "SCN-RunControlService-006",
          "SCN-RunControlService-020"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list",
          "approval-card"
        ],
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-165",
        "feature:pipeline-execution-service-thin",
        "feature:blueprint-service",
        "feature:generation-recipe-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-166]",
      "number": 166
    },
    {
      "id": "AIFACTORY-TASK-880",
      "type": "task",
      "parent": "AIFACTORY-US-166",
      "title": "DecideApproval with eligibility, separation of duties, version check and the 403, 404, 409 and 410 refusals",
      "sequence": "01.05.07.01",
      "description": "DecideApproval with eligibility, separation of duties, version check and the 403, 404, 409 and 410 refusals. Expected output: DecideApproval records one decision (approve, reject or request changes) on the exact proposal hash and request version, checks the scope, the approver rule through PolicyEngineService and the requester exclusion, which covers the requests of kind approval, a proposal and a spend, and not an operator decision (D121), moves the request to Approved, Rejected or ChangesRequested and the run to Running, to Failed with failure class policy-denied or back to Running through ChangesRequested, writes ApprovalDecided with the reason and RunStateChanged in one transaction, and refuses with 403, 404 (an unknown request or one of another tenant), 409 or 410 as modelled, auditing every refused duplicate; a decision that does not fit the kind of the request, request-changes on a spend approval, a choice on a request of kind approval or approve, reject or request-changes on an operator decision, is answered 409 and leaves the request Pending (D119), while the effect of a choice on an operator decision is delivered by AIFACTORY-TASK-2647; every approve and reject decision on a request of kind approval is written as a vote to the table ApprovalVotes, keyed by approval id and voter, the request is Approved when its approve votes reach its quorum and Rejected by one reject vote of an eligible approver, a vote that leaves it Pending moves no run and writes no ApprovalDecided, and a second vote of the same approver is answered 409 (D127); unit tests cover the quorum one and the quorum two.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "DecideApproval records one decision (approve, reject or request changes) on the exact proposal hash and request version, checks the scope, the approver rule through PolicyEngineService and the requester exclusion, which covers the requests of kind approval, a proposal and a spend, and not an operator decision (D121), moves the request to Approved, Rejected or ChangesRequested and the run to Running, to Failed with failure class policy-denied or back to Running through ChangesRequested, writes ApprovalDecided with the reason and RunStateChanged in one transaction, and refuses with 403, 404 (an unknown request or one of another tenant), 409 or 410 as modelled, auditing every refused duplicate; a decision that does not fit the kind of the request, request-changes on a spend approval, a choice on a request of kind approval or approve, reject or request-changes on an operator decision, is answered 409 and leaves the request Pending (D119), while the effect of a choice on an operator decision is delivered by AIFACTORY-TASK-2647; every approve and reject decision on a request of kind approval is written as a vote to the table ApprovalVotes, keyed by approval id and voter, the request is Approved when its approve votes reach its quorum and Rejected by one reject vote of an eligible approver, a vote that leaves it Pending moves no run and writes no ApprovalDecided, and a second vote of the same approver is answered 409 (D127); unit tests cover the quorum one and the quorum two."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5507,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-880]",
      "number": 880
    },
    {
      "id": "AIFACTORY-TASK-881",
      "type": "task",
      "parent": "AIFACTORY-US-166",
      "title": "ListApprovals read model filtered by tenant and the caller's roles",
      "sequence": "01.05.07.02",
      "description": "ListApprovals read model filtered by tenant and the caller's roles. Expected output: ListApprovals returns approval-list-v1 with the pending and decided requests of the caller's tenant visible to the caller's roles, each with action class, proposal hash, expiry, state and version.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "ListApprovals returns approval-list-v1 with the pending and decided requests of the caller's tenant visible to the caller's roles, each with action class, proposal hash, expiry, state and version."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5507,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-881]",
      "number": 881
    },
    {
      "id": "AIFACTORY-TASK-882",
      "type": "task",
      "parent": "AIFACTORY-US-166",
      "title": "MarkApprovalStale inbox handlers for changed proposal versions",
      "sequence": "01.05.07.03",
      "description": "MarkApprovalStale inbox handlers for changed proposal versions. Expected output: The handlers of ChangeProposalStateChanged, BlueprintValidated and RecipeApproved move a pending request bound to the superseded version to Stale and write ApprovalDecided with state Stale, idempotently on the event id; the run stays WaitingForApproval until the lease holder requests a new approval for the current proposal hash, which RequestApproval accepts from WaitingForApproval (AIFACTORY-TASK-877).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The handlers of ChangeProposalStateChanged, BlueprintValidated and RecipeApproved move a pending request bound to the superseded version to Stale and write ApprovalDecided with state Stale, idempotently on the event id; the run stays WaitingForApproval until the lease holder requests a new approval for the current proposal hash, which RequestApproval accepts from WaitingForApproval (AIFACTORY-TASK-877)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5507,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-882]",
      "number": 882
    },
    {
      "id": "AIFACTORY-TASK-883",
      "type": "task",
      "parent": "AIFACTORY-US-166",
      "title": "Verify decide-an-approval through the acceptance suite",
      "sequence": "01.05.07.04",
      "description": "Verify decide-an-approval through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-006|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-166, including the request-changes decision, the votes of a request with the quorum one and, with a fake of the approval rule port that states a rule, the quorum two, the rejection by one vote and the second vote of the same approver answered 409, the 409 of a decision that does not fit the kind of the request, the Stale path fed by the three producer events and the publication and payload of ApprovalDecided; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-006|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-166, including the request-changes decision, the votes of a request with the quorum one and, with a fake of the approval rule port that states a rule, the quorum two, the rejection by one vote and the second vote of the same approver answered 409, the 409 of a decision that does not fit the kind of the request, the Stale path fed by the three producer events and the publication and payload of ApprovalDecided; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5507,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-883]",
      "number": 883
    },
    {
      "id": "AIFACTORY-US-167",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Settle a run as Completed or Failed from the report of the engine or a denied budget, leave a failed step to the failure policy the engine applies, and announce the terminal state",
      "sequence": "01.05.08",
      "description": "A run reaches its terminal state only through the single transition authority of RunControlService. When WorkflowEngineService reports `WorkflowEngineService/WorkflowRunCompleted`, the inbox handler `CompleteRun` moves the run from Running to Completed with the output reference and writes `RunControlService/RunCompleted` in the same transaction, with the hash of the outcome in `outcomeHash` and that reference in the optional `outputRef`, the reference of the outcome of the run in ArtifactService through which a parent reads the result of its child run (D121). When the engine reports `WorkflowEngineService/WorkflowRunFailed`, CostUsageService denies the budget reservation through `CostUsageService/BudgetReservationDenied`, or an approval is rejected or expires, the run moves to Failed and `RunControlService/RunFailed` is written with a failure class (transient, permanent, policy-denied, validation, cancellation or uncertain) and the reason. A run failed by a rejected or expired approval carries the failure class policy-denied, and so does a run failed by a denied budget or by a retired environment. A denied budget fails a run that is still Accepted and a run that is Held when the denial arrives: the handler `FailRunOnBudgetDenial` moves it from Accepted or from Held to Failed through the trigger `BudgetDenied` with failure class policy-denied, and `RunFailed` and `RunStateChanged` are written in the transaction of the transition. A step fails terminally in two cases: a Failed attempt that is not retriable, because its `failureClass` is not transient or the `sideEffectClass` of the `Step` is neither read nor sandbox nor shared-write with `idempotent` true, and a TimedOut or retriable Failed attempt whose number reached the `maxAttempts` of its step; the `Step` is then settled Failed and `StepSettled` announces it with the failure class of its last attempt (AIFACTORY-US-658). RunControlService does not fail the run for it: its own transition of a run from Running to Failed through `StepFailedTerminally` is withdrawn (D121). WorkflowEngineService applies the failure policy of the step and reports `WorkflowRunFailed`, under Fail at once, under Compensate once the compensation finished and under Retry like under Fail, since a step settled Failed under Retry has its attempts spent (D123), and the handler `FailRun` then moves the run from Running to Failed through the trigger `WorkflowRunFailed` with the failure class the engine reported; until that report the run stays Running. The run failures that no failure policy of a step decides stay with RunControlService (D121): a denied budget, a rejected or expired approval, a retired environment and the operator decision. The stop on `BudgetExceeded` is no run failure: the run it names follows the cancellation path and ends Cancelled with the reason budget-exceeded (AIFACTORY-US-547, D123). Nor is the stop of a run whose pinned closure holds a revoked release: under the in-flight policy drain or revoke the run ends Cancelled with the reason release-revoked, a run that waits for an approval being cancelled at once under drain and a run already Cancelling keeping the reason it has, and only the parent of such a child treats it as failed with the failure class policy-denied (D123, D125, AIFACTORY-US-736 of feature `agent-registry-service-complete`). One failure policy keeps the step open (D119): when the `failurePolicy` the `Step` keeps from `StepReady` is Escalate, the terminal failure does not settle the step; an operator decision is opened for the Operator of the project and the run waits in WaitingForApproval, and it reaches Failed only when the Operator chooses fail or the request expires, through `OperatorChoseFailOrDecisionExpired` (AIFACTORY-US-657). A step that reaches its final state is announced by `StepSettled` in the transaction of that move (AIFACTORY-US-658). A rejected or expired spend approval fails a run that is Held as it fails a waiting one (AIFACTORY-US-546), and a parent run that ends Failed cancels its open child runs (AIFACTORY-US-656). A non-terminal run whose target environment is retired also ends Failed, with failure class policy-denied, which AIFACTORY-US-168 delivers. Every transition appends an entry to the append-only `RecoveryJournal` and is announced by `RunStateChanged`; publication is never proof of a transition. A completed or failed run refuses any further transition. The terminal events are published under the canonical envelope; CostUsageService, ArtifactService, GenerationRecipeService and the services of later increments consume them in their own PBIs. Duplicate engine reports are handled idempotently through the inbox and change nothing. Kind: behavior. Traces: services: RunControlService, WorkflowEngineService, CostUsageService; aggregates: RunControlService/Run, RunControlService/Step, RunControlService/Attempt; events: RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunStateChanged, RunControlService/AttemptOutcomeRecorded, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, CostUsageService/BudgetReservationDenied; adrs: ADR-0012, ADR-0014; requirements: FR-03, FR-10, FUX-07; scenarios: SCN-RunControlService-013, SCN-RunControlService-014, SCN-RunControlService-017. Relates: screens: run-detail; nfrs: NFR-05, NFR-06. Depends on: AIFACTORY-US-163, AIFACTORY-US-164, feature:workflow-engine-service, feature:cost-usage-service-complete. Sources: model/services/control-plane/RunControlService.yaml, docs/planes/control/services/run-control-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a Running run whose workflow run the engine reports complete through `WorkflowEngineService/WorkflowRunCompleted`, when the `CompleteRun` handler runs, then the `RunControlService/Run` is Completed, a `RecoveryJournal` entry and `RunControlService/RunStateChanged` are written, and `RunControlService/RunCompleted` is written in the same transaction with `runId`, `tenantId`, `outcomeHash` and, when the report names an output reference, that reference in the optional `outputRef` (SCN-RunControlService-013, ADR-0014, D121).",
        "AC2: Given the run was completed, when the outbox dispatcher publishes `RunControlService/RunCompleted` on `run-control.runs.v1.run-completed`, then the event is sent under the canonical envelope with `runId`, `tenantId`, `outcomeHash` and the optional `outputRef`, which is absent when the run completed without an output reference (D121), a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, and a duplicate engine report changes nothing (SCN-RunControlService-013, ADR-0012).",
        "AC3: Given a Running run whose engine reports `WorkflowEngineService/WorkflowRunFailed`, as it does after it applied the failure policy of a step that was settled Failed (D121), or an Accepted or Held run whose budget reservation CostUsageService denies through `CostUsageService/BudgetReservationDenied`, when the `FailRun` or `FailRunOnBudgetDenial` handler runs, then the `RunControlService/Run` is Failed, the reported run leaving Running through the trigger `WorkflowRunFailed` and the denied run leaving Accepted or Held through the trigger `BudgetDenied`, and `RunControlService/RunFailed` with `failureClass` (the class the engine reported, policy-denied for the denied budget) and `reason` plus `RunControlService/RunStateChanged` are written in the transaction of the transition (SCN-RunControlService-014).",
        "AC4: Given the run failed, when the outbox dispatcher publishes `RunControlService/RunFailed` on `run-control.runs.v1.run-failed`, then the event is sent under the canonical envelope with `runId`, `tenantId`, `failureClass` and `reason`, the `failureClass` being policy-denied for a run failed by a denied budget, by a rejected or expired approval or by a retired environment, a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, and a Completed or Failed run refuses every later transition (SCN-RunControlService-014, FR-10).",
        "AC5: Given an attempt settled Failed that is not retriable, because its `failureClass` is not transient or the `sideEffectClass` of its step is neither read nor sandbox nor shared-write with `idempotent` true, or an attempt settled TimedOut or retriable Failed whose number equals the `maxAttempts` of its `RunControlService/Step`, when the `LeaseExpiryReconciler` or the `RunDispatcher` evaluates the step after `RunControlService/AttemptOutcomeRecorded` and the `failurePolicy` of the step is not Escalate, then the step is settled Failed, the `RunControlService/Run` stays Running and neither `RunControlService/RunFailed` nor `RunControlService/RunStateChanged` is written by this evaluation, the transition through `StepFailedTerminally` being withdrawn; when `WorkflowEngineService/WorkflowRunFailed` then arrives, the `FailRun` handler moves the run from Running to Failed through the trigger `WorkflowRunFailed` and writes `RunControlService/RunFailed` with the reported `failureClass` and `reason` plus `RunControlService/RunStateChanged` in one transaction; under the failure policy Escalate the step is not settled either and the run waits for the operator decision (SCN-RunControlService-014, SCN-RunControlService-017, D119, D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-884",
        "AIFACTORY-TASK-888",
        "AIFACTORY-TASK-885",
        "AIFACTORY-TASK-886"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5508,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "WorkflowEngineService",
          "CostUsageService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Step",
          "RunControlService/Attempt"
        ],
        "events": [
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunStateChanged",
          "RunControlService/AttemptOutcomeRecorded",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "CostUsageService/BudgetReservationDenied"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-03",
          "FR-10",
          "FUX-07"
        ],
        "scenarios": [
          "SCN-RunControlService-013",
          "SCN-RunControlService-014",
          "SCN-RunControlService-017"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ],
        "nfrs": [
          "NFR-05",
          "NFR-06"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-163",
        "AIFACTORY-US-164",
        "feature:workflow-engine-service",
        "feature:cost-usage-service-complete"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/run-control-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-167]",
      "number": 167
    },
    {
      "id": "AIFACTORY-TASK-884",
      "type": "task",
      "parent": "AIFACTORY-US-167",
      "title": "CompleteRun, FailRun and FailRunOnBudgetDenial inbox handlers",
      "sequence": "01.05.08.01",
      "description": "CompleteRun, FailRun and FailRunOnBudgetDenial inbox handlers. Expected output: The handlers of WorkflowRunCompleted, WorkflowRunFailed and BudgetReservationDenied move the run to Completed or Failed with the reported failure class, FailRun moving a Running run to Failed through the trigger WorkflowRunFailed, which after a failed step is the only path that fails the run (D121), and FailRunOnBudgetDenial moving an Accepted run and a Held run to Failed through BudgetDenied with failure class policy-denied, write RunCompleted, with the output reference of the report in the optional outputRef beside outcomeHash (D121), or RunFailed and RunStateChanged in one transaction, and are idempotent on the event id so a duplicate report changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The handlers of WorkflowRunCompleted, WorkflowRunFailed and BudgetReservationDenied move the run to Completed or Failed with the reported failure class, FailRun moving a Running run to Failed through the trigger WorkflowRunFailed, which after a failed step is the only path that fails the run (D121), and FailRunOnBudgetDenial moving an Accepted run and a Held run to Failed through BudgetDenied with failure class policy-denied, write RunCompleted, with the output reference of the report in the optional outputRef beside outcomeHash (D121), or RunFailed and RunStateChanged in one transaction, and are idempotent on the event id so a duplicate report changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5508,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-884]",
      "number": 884
    },
    {
      "id": "AIFACTORY-TASK-888",
      "type": "task",
      "parent": "AIFACTORY-US-167",
      "title": "Terminal step failure of a non-retriable or exhausted attempt that settles the step and leaves the run to the report of the engine",
      "sequence": "01.05.08.02",
      "description": "Terminal step failure of a non-retriable or exhausted attempt that settles the step and leaves the run to the report of the engine. Expected output: When the LeaseExpiryReconciler or the RunDispatcher finds a Failed attempt that is not retriable (a failureClass other than transient, or a Step whose sideEffectClass is neither read nor sandbox nor shared-write with idempotent true) or a TimedOut or retriable Failed attempt whose number equals the maxAttempts of its step, and the failurePolicy of the step is not Escalate, the step is settled Failed and the StepSettled record of AIFACTORY-TASK-2651 is written in the same transaction, and nothing else changes, so the run stays Running, no RunFailed and no RunStateChanged are written, and the state table of the run holds no transition StepFailedTerminally (D121); the run fails when WorkflowRunFailed of the engine arrives (AIFACTORY-TASK-884); under the failure policy Escalate the step is not settled and the evaluation hands the step to the operator decision of AIFACTORY-TASK-2646 (D119); the evaluation is idempotent on step id plus attempt number.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "When the LeaseExpiryReconciler or the RunDispatcher finds a Failed attempt that is not retriable (a failureClass other than transient, or a Step whose sideEffectClass is neither read nor sandbox nor shared-write with idempotent true) or a TimedOut or retriable Failed attempt whose number equals the maxAttempts of its step, and the failurePolicy of the step is not Escalate, the step is settled Failed and the StepSettled record of AIFACTORY-TASK-2651 is written in the same transaction, and nothing else changes, so the run stays Running, no RunFailed and no RunStateChanged are written, and the state table of the run holds no transition StepFailedTerminally (D121); the run fails when WorkflowRunFailed of the engine arrives (AIFACTORY-TASK-884); under the failure policy Escalate the step is not settled and the evaluation hands the step to the operator decision of AIFACTORY-TASK-2646 (D119); the evaluation is idempotent on step id plus attempt number."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5508,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-888]",
      "number": 888
    },
    {
      "id": "AIFACTORY-TASK-885",
      "type": "task",
      "parent": "AIFACTORY-US-167",
      "title": "Append-only RecoveryJournal migration",
      "sequence": "01.05.08.03",
      "description": "Append-only RecoveryJournal migration. Expected output: The RecoveryJournal table is created with its sequence, fromState, toState, cause and occurredAt columns and the tenant filter; UPDATE and DELETE are denied to the service principal so the journal is append-only, and every run transition appends an entry in the same transaction.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The RecoveryJournal table is created with its sequence, fromState, toState, cause and occurredAt columns and the tenant filter; UPDATE and DELETE are denied to the service principal so the journal is append-only, and every run transition appends an entry in the same transaction."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5508,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-885]",
      "number": 885
    },
    {
      "id": "AIFACTORY-TASK-886",
      "type": "task",
      "parent": "AIFACTORY-US-167",
      "title": "Verify settle-a-run through the acceptance suite",
      "sequence": "01.05.08.04",
      "description": "Verify settle-a-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-013|Scenario=SCN-RunControlService-014|Scenario=SCN-RunControlService-017)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-167, including the budget denial of an Accepted run and of a Held run, the terminal failure of a non-retriable or exhausted attempt that settles the step and leaves the run Running, the run failed only when WorkflowRunFailed is delivered after it, with the failure class of that report, the same failure under the failure policy Escalate that settles no step and fails no run, the failure class policy-denied on RunFailed for a denied budget and the publication and payload of RunCompleted, with and without outputRef, and of RunFailed; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-013|Scenario=SCN-RunControlService-014|Scenario=SCN-RunControlService-017)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-167, including the budget denial of an Accepted run and of a Held run, the terminal failure of a non-retriable or exhausted attempt that settles the step and leaves the run Running, the run failed only when WorkflowRunFailed is delivered after it, with the failure class of that report, the same failure under the failure policy Escalate that settles no step and fails no run, the failure class policy-denied on RunFailed for a denied budget and the publication and payload of RunCompleted, with and without outputRef, and of RunFailed; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5508,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-886]",
      "number": 886
    },
    {
      "id": "AIFACTORY-US-168",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Hold the runs of a frozen environment, release them when it is active again and fail them when it is retired",
      "sequence": "01.05.09",
      "description": "EnvironmentService announces every state change of an environment through `EnvironmentService/EnvironmentStateChanged` with `environmentId`, `tenantId`, `fromState`, `toState` and the `class` of the environment. The inbox handler `GateRunsByEnvironment` of RunControlService applies it to the runs of that tenant whose `environmentId` names the environment, idempotently on the event id, and keeps the last announced state of the environment and, beside it, the announced class in the table `GateStates`, which the dispatch gate and the submission gate read without a call to EnvironmentService; the class is what the production gate of `RunControlService/SubmitRun` compares with the state of the pinned release (AIFACTORY-US-005, D117). A run without an `environmentId` is never gated by an environment. When the environment becomes Frozen, a run that is still Accepted moves to Held through the trigger `EnvironmentFrozen`. A Running run is not interrupted: from the freeze on the `RunDispatcher` dispatches no new attempt for it, its open attempt settles first by the report of the lease holder or by lease reconciliation, and then the run moves to Held through `EnvironmentFrozenAfterOpenAttemptSettled`; a Running run without an open attempt is held at once. A run that is WaitingForApproval or Cancelling keeps its state, and when it is Running again while the environment is still Frozen it is held by the same rule. When the environment is Active again, a Held run that never had an attempt dispatched returns to Accepted (`EnvironmentActiveBeforeFirstDispatch`) and any other Held run returns to Running (`EnvironmentActiveAgain`), and the `RunDispatcher`, which `EnvironmentService/EnvironmentStateChanged` also triggers, evaluates the run again so the next Pending step is dispatched under AIFACTORY-US-163. A Held run can carry a run-level spend approval, because that approval is opened at once and can be decided while the run is Held (AIFACTORY-US-546, D119): when the environment is Active again such a run leaves Held for WaitingForApproval through `EnvironmentActiveWithSpendApprovalPending` while the request is still Pending, and for Accepted through `EnvironmentActiveBeforeFirstDispatch` when the request is already Approved, where its first attempt is dispatched once `BudgetReserved` has arrived; a request that ended Rejected or Expired has already failed the Held run. When the environment is Retired, every non-terminal run that targets it fails with failure class policy-denied. An Accepted run and a Held run move to Failed at once through `EnvironmentRetired`. A Running run is not interrupted: no new attempt is dispatched for it, and once its open attempt settled it moves to Failed through `EnvironmentRetiredAfterOpenAttemptSettled`; a Running run without an open attempt fails at once. A WaitingForApproval run moves to Failed through `EnvironmentRetired` once its open attempt settled, and its Pending approval request moves from Pending to Cancelled through the trigger `RunFailed` in the same transaction, with `RunControlService/ApprovalDecided` carrying state Cancelled (AIFACTORY-US-165). A Cancelling run has no transition for a retired environment in the state table and settles to Cancelled (AIFACTORY-US-162). With each of these failures `RunControlService/RunFailed` is written with failure class policy-denied and a reason that names the retired environment; from then on `RunControlService/SubmitRun` refuses a run that targets the environment with 409 (AIFACTORY-US-005). A Held run can be cancelled and moves to Cancelled at once (AIFACTORY-US-162), and a Held run whose budget reservation is denied meanwhile fails through `BudgetDenied` (AIFACTORY-US-167). Every transition appends a `RecoveryJournal` entry and writes `RunControlService/RunStateChanged` in the same transaction. A run without an `environmentId`, a run of another environment and a run in a terminal state are never touched. Kind: behavior. Traces: services: RunControlService, EnvironmentService; aggregates: RunControlService/Run, RunControlService/Attempt, RunControlService/ApprovalRequest; apis: RunControlService/SubmitRun; events: EnvironmentService/EnvironmentStateChanged, RunControlService/RunStateChanged, RunControlService/RunFailed, RunControlService/ApprovalDecided; adrs: ADR-0012, ADR-0014; requirements: FR-03, FR-10; scenarios: SCN-RunControlService-012, SCN-RunControlService-014. Relates: screens: run-detail; nfrs: NFR-05. Depends on: AIFACTORY-US-163, AIFACTORY-US-165, AIFACTORY-US-167, feature:environment-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/control-plane/EnvironmentService.yaml, docs/planes/control/services/run-control-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given an Accepted run whose `environmentId` names an environment, when `EnvironmentService/EnvironmentStateChanged` announces that the environment moved to Frozen and the `GateRunsByEnvironment` handler runs, then the announced state and the announced class of the environment are kept in `GateStates`, the `RunControlService/Run` moves from Accepted to Held through `EnvironmentFrozen`, a `RecoveryJournal` entry and `RunControlService/RunStateChanged` with `fromState`, `toState` and `cause` are written in the same transaction, and no attempt is dispatched for the run while it is Held, also when its budget reservation is confirmed meanwhile (SCN-RunControlService-012).",
        "AC2: Given a Running run of the frozen environment with an open attempt, when the freeze is applied, then the open attempt is not interrupted, the `RunDispatcher` dispatches no new `RunControlService/Attempt` for the run, and once the open attempt settles the run moves from Running to Held through `EnvironmentFrozenAfterOpenAttemptSettled` with `RunControlService/RunStateChanged` written in the same transaction; a Running run without an open attempt is held at once (SCN-RunControlService-012, ADR-0014).",
        "AC3: Given Held runs of an environment, when `EnvironmentService/EnvironmentStateChanged` announces that it is Active again, then a run that never had an attempt dispatched returns to Accepted through `EnvironmentActiveBeforeFirstDispatch`, unless its run-level spend approval is still Pending, in which case it moves to WaitingForApproval through `EnvironmentActiveWithSpendApprovalPending` (D119), and every other run returns to Running through `EnvironmentActiveAgain`, each with `RunControlService/RunStateChanged` written in the same transaction, and the `RunDispatcher`, which the same `EnvironmentService/EnvironmentStateChanged` triggers, evaluates the released runs so the next Pending step is dispatched (SCN-RunControlService-012).",
        "AC4: Given non-terminal runs that target an environment, when `EnvironmentService/EnvironmentStateChanged` announces that it is Retired, then every Accepted run and every Held run moves to Failed at once through `EnvironmentRetired`, a Running run gets no new `RunControlService/Attempt` and moves to Failed through `EnvironmentRetiredAfterOpenAttemptSettled` once its open attempt settled, or at once when it has none, a WaitingForApproval run moves to Failed through `EnvironmentRetired` once its open attempt settled and its Pending `RunControlService/ApprovalRequest` moves to Cancelled through the trigger `RunFailed` in the same transaction with `RunControlService/ApprovalDecided` carrying state Cancelled, `RunControlService/RunFailed` with `failureClass` policy-denied and a `reason` that names the retired environment plus `RunControlService/RunStateChanged` are written in the transaction of each transition, and a later `RunControlService/SubmitRun` that targets the environment is answered 409 with a problem body that names the gate (SCN-RunControlService-014).",
        "AC5: Given a redelivery of the same event id, a run without an `environmentId`, a run of another environment or tenant, or a run already Completed, Failed or Cancelled, when the `GateRunsByEnvironment` handler runs on `EnvironmentService/EnvironmentStateChanged`, then nothing changes for that run and no second transition or event is written (ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/control/services/run-control-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-890",
        "AIFACTORY-TASK-891",
        "AIFACTORY-TASK-892"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5509,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "EnvironmentService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Attempt",
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "RunControlService/SubmitRun"
        ],
        "events": [
          "EnvironmentService/EnvironmentStateChanged",
          "RunControlService/RunStateChanged",
          "RunControlService/RunFailed",
          "RunControlService/ApprovalDecided"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-03",
          "FR-10"
        ],
        "scenarios": [
          "SCN-RunControlService-012",
          "SCN-RunControlService-014"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-163",
        "AIFACTORY-US-165",
        "AIFACTORY-US-167",
        "feature:environment-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/control/services/run-control-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-168]",
      "number": 168
    },
    {
      "id": "AIFACTORY-TASK-890",
      "type": "task",
      "parent": "AIFACTORY-US-168",
      "title": "GateRunsByEnvironment inbox handler applying the frozen, active and retired states of an environment to the runs that target it",
      "sequence": "01.05.09.01",
      "description": "GateRunsByEnvironment inbox handler applying the frozen, active and retired states of an environment to the runs that target it. Expected output: The handler of EnvironmentStateChanged keeps the last announced state of the environment and, beside it, the class the event announces in GateStates, where the production gate of SubmitRun reads it, moves the Accepted runs of a frozen environment to Held through EnvironmentFrozen, returns Held runs to Accepted or Running when the environment is active again, a Held run whose run-level spend approval is still Pending going to WaitingForApproval through EnvironmentActiveWithSpendApprovalPending instead (D119), fails the Accepted and the Held runs of a retired environment at once through EnvironmentRetired with RunFailed carrying failure class policy-denied and a reason that names the environment, leaves its Running and WaitingForApproval runs to the settlement path of AIFACTORY-TASK-891, writes RunStateChanged and the RecoveryJournal entry in the transaction of each transition, never touches a run without environmentId, and is idempotent on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The handler of EnvironmentStateChanged keeps the last announced state of the environment and, beside it, the class the event announces in GateStates, where the production gate of SubmitRun reads it, moves the Accepted runs of a frozen environment to Held through EnvironmentFrozen, returns Held runs to Accepted or Running when the environment is active again, a Held run whose run-level spend approval is still Pending going to WaitingForApproval through EnvironmentActiveWithSpendApprovalPending instead (D119), fails the Accepted and the Held runs of a retired environment at once through EnvironmentRetired with RunFailed carrying failure class policy-denied and a reason that names the environment, leaves its Running and WaitingForApproval runs to the settlement path of AIFACTORY-TASK-891, writes RunStateChanged and the RecoveryJournal entry in the transaction of each transition, never touches a run without environmentId, and is idempotent on the event id."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5509,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-890]",
      "number": 890
    },
    {
      "id": "AIFACTORY-TASK-891",
      "type": "task",
      "parent": "AIFACTORY-US-168",
      "title": "Environment gate in the RunDispatcher, in the attempt settlement path and in SubmitRun",
      "sequence": "01.05.09.02",
      "description": "Environment gate in the RunDispatcher, in the attempt settlement path and in SubmitRun. Expected output: The RunDispatcher reads the announced state of the target environment from GateStates, calls no other service for the gate, and dispatches no attempt for a Held run or for a Running run whose target environment is frozen or retired; when the open attempt of such a Running run settles, the run moves to Held through EnvironmentFrozenAfterOpenAttemptSettled, or to Failed through EnvironmentRetiredAfterOpenAttemptSettled with RunFailed carrying failure class policy-denied, in the transaction of the settlement, and a Running run without an open attempt takes the same transition at once; a WaitingForApproval run of a retired environment moves to Failed through EnvironmentRetired once its open attempt settled, and its Pending approval request is Cancelled through RunFailed in the same transaction (AIFACTORY-TASK-1492); the dispatcher is also triggered by EnvironmentStateChanged, so a released run is evaluated again and its next Pending step is dispatched; SubmitRun reads the same GateStates row for the 409 refusal of a retired target environment (AIFACTORY-TASK-194).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The RunDispatcher reads the announced state of the target environment from GateStates, calls no other service for the gate, and dispatches no attempt for a Held run or for a Running run whose target environment is frozen or retired; when the open attempt of such a Running run settles, the run moves to Held through EnvironmentFrozenAfterOpenAttemptSettled, or to Failed through EnvironmentRetiredAfterOpenAttemptSettled with RunFailed carrying failure class policy-denied, in the transaction of the settlement, and a Running run without an open attempt takes the same transition at once; a WaitingForApproval run of a retired environment moves to Failed through EnvironmentRetired once its open attempt settled, and its Pending approval request is Cancelled through RunFailed in the same transaction (AIFACTORY-TASK-1492); the dispatcher is also triggered by EnvironmentStateChanged, so a released run is evaluated again and its next Pending step is dispatched; SubmitRun reads the same GateStates row for the 409 refusal of a retired target environment (AIFACTORY-TASK-194)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5509,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-891]",
      "number": 891
    },
    {
      "id": "AIFACTORY-TASK-892",
      "type": "task",
      "parent": "AIFACTORY-US-168",
      "title": "Verify hold-runs-by-environment through the acceptance suite",
      "sequence": "01.05.09.03",
      "description": "Verify hold-runs-by-environment through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-012|Scenario=SCN-RunControlService-014)\"`; a zero-match filter counts as a failure; the tests deliver EnvironmentStateChanged to the inbox and prove AC1 to AC5 of AIFACTORY-US-168, that is the hold of Accepted and Running runs, the release with the dispatcher triggered by the same event, the release of a Held run with a Pending spend approval to WaitingForApproval and of one with an Approved spend approval to Accepted, the failure with failure class policy-denied of the Accepted, Held, Running and WaitingForApproval runs of a retired environment, the Pending approval request of that WaitingForApproval run Cancelled through RunFailed, the gate state read from GateStates, the run without environmentId that is never gated and the idempotent redelivery; the publication of the event is proven by the suite of EnvironmentService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RunControlService-012|Scenario=SCN-RunControlService-014)\"`; a zero-match filter counts as a failure; the tests deliver EnvironmentStateChanged to the inbox and prove AC1 to AC5 of AIFACTORY-US-168, that is the hold of Accepted and Running runs, the release with the dispatcher triggered by the same event, the release of a Held run with a Pending spend approval to WaitingForApproval and of one with an Approved spend approval to Accepted, the failure with failure class policy-denied of the Accepted, Held, Running and WaitingForApproval runs of a retired environment, the Pending approval request of that WaitingForApproval run Cancelled through RunFailed, the gate state read from GateStates, the run without environmentId that is never gated and the idempotent redelivery; the publication of the event is proven by the suite of EnvironmentService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5509,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-892]",
      "number": 892
    },
    {
      "id": "AIFACTORY-US-546",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Hold an accepted run above the spend threshold for a run-level spend approval and dispatch it only after the approval and the reservation",
      "sequence": "01.05.10",
      "description": "As a reviewer, I want a run whose estimated cost is above the spend threshold of its project to wait for my decision before anything is reserved or dispatched, so that no run commits more than that threshold without a person other than its requester agreeing to the exact amount. When the estimate of an accepted run is above the spend threshold of its budget, CostUsageService reserves nothing and announces it through `CostUsageService/SpendApprovalRequired` with `runId`, `tenantId`, `projectId`, `estimatedUsd` and `thresholdUsd` (AIFACTORY-US-453 of feature `cost-usage-service-complete`). This PBI is the run control side of that decision of the owner (D117). A child run never comes here: it gets no reservation of its own, CostUsageService announces no `SpendApprovalRequired` for it, and no spend approval is opened for a child (AIFACTORY-US-656, D121). The inbox handler `OpenSpendApproval` opens a run-level `ApprovalRequest` for the run: it carries the action class spend and the estimate of the event in `estimatedUsd`, its proposal is of kind spend and its `proposalHash` binds the decision to exactly that estimate, and it names the run and no step, no lease and no fencing token, because an Accepted run has none. It is opened by the handler and not by a lease holder, so `RunControl.RequestApproval` takes no part in it. The approver rule is resolved through PolicyEngineService for the policy revision the run pinned and the expiry is set from `RunControl:Approvals:DefaultExpiryHours` unless policy shortens it, as for every approval request (AIFACTORY-US-165). In the same transaction the run moves from Accepted to WaitingForApproval through the trigger `SpendApprovalRequired`, an entry is appended to the `RecoveryJournal` and the `ApprovalRequested` and `RunStateChanged` outbox records are written; `ApprovalRequested` carries no `stepId` for this request. The handler is idempotent on the event id, and a run has at most one spend approval, so a second announcement for a run that already has one opens nothing. An unavailable PolicyEngineService fails the handler, nothing is written and the inbox retries the event. When the announcement arrives for a run that is Held by a frozen environment, the approval is opened at once in the same way and the run stays Held (D119): the Pending request and `ApprovalRequested` are written, and no run transition and no `RunStateChanged` are. The request can be decided while the run is Held. An approval leaves the run Held and writes `ApprovalDecided`, on which CostUsageService reserves the approved estimate at once, whatever the state of the run; the run proceeds when the approval is granted and the environment is active, so on the release it returns to Accepted, where its first attempt is dispatched once `BudgetReserved` has arrived, while a release that finds the request still Pending moves the run to WaitingForApproval through `EnvironmentActiveWithSpendApprovalPending` (AIFACTORY-US-168). A rejection or an expiry fails the Held run from Held through `ApprovalRejectedOrExpired`, exactly as it fails a waiting one. The request appears in `RunControlService/ListApprovals` like any other and is decided through `RunControlService/DecideApproval` under the rules of AIFACTORY-US-166: the scope `factory.approvals.decide`, the approver rule, the quoted version and proposal hash, and the separation of duties, under which the requester of the run is never eligible to decide and is refused with 403 (D18). An approval moves the request to Approved and returns the run from WaitingForApproval to Accepted through the trigger `SpendApprovalGranted`; `ApprovalDecided` is written with the proposal kind spend and the approved `estimatedUsd`, together with `RunStateChanged`, in the transaction of the decision. Nothing is dispatched on the approval alone: CostUsageService consumes `ApprovalDecided`, reserves the approved estimate and publishes `CostUsageService/BudgetReserved`, on which the `RunDispatcher` dispatches the first attempt as for any Accepted run (AIFACTORY-US-163); when the budget no longer covers the estimate it publishes `BudgetReservationDenied` instead and the run fails through `BudgetDenied` (AIFACTORY-US-167). A rejection moves the request to Rejected, and the `ApprovalExpiryReconciler` moves a request past its expiry to Expired; either fails the run from WaitingForApproval through `ApprovalRejectedOrExpired` with the failure class policy-denied, with `RunFailed`, `RunStateChanged` and `ApprovalDecided` written in one transaction. An expired spend approval is never requested again, whatever the on-expiry rule of an approval policy says for the approvals of steps. A request-changes decision does not apply to a spend approval, since no lease holder exists who could change the proposal: `DecideApproval` answers such a decision with 409 (D119), the request stays Pending and the run keeps its state, WaitingForApproval or Held. A run that waits for its spend approval can be cancelled (AIFACTORY-US-162), and its Pending request is then Cancelled through the trigger `RunCancelled`; the request of a run that fails for another reason is Cancelled through the trigger `RunFailed` (AIFACTORY-US-165). CostUsageService reads those outcomes from `ApprovalDecided` and has nothing to release, because nothing was reserved. The events are published under the canonical envelope; StudioBff, StudioNotificationService, AuditService and CostUsageService consume them in their own PBIs. Kind: behavior. Traces: services: RunControlService, CostUsageService, PolicyEngineService; aggregates: RunControlService/Run, RunControlService/ApprovalRequest; apis: RunControlService/DecideApproval, RunControlService/ListApprovals; events: CostUsageService/SpendApprovalRequired, CostUsageService/BudgetReserved, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, RunControlService/RunStateChanged, RunControlService/RunFailed; descriptors: approval-request-v1, approval-decision-v1; adrs: ADR-0012, ADR-0014; requirements: FR-06, FUX-05; scenarios: SCN-RunControlService-005, SCN-RunControlService-019, SCN-RunControlService-020. Relates: screens: approvals-list, approval-card; nfrs: NFR-04. Depends on: AIFACTORY-US-163, AIFACTORY-US-165, AIFACTORY-US-166, AIFACTORY-US-167, feature:cost-usage-service-complete, feature:policy-engine-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/control-plane/CostUsageService.yaml, docs/reference/schemas/approval.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given an Accepted run and `CostUsageService/SpendApprovalRequired` for it with `estimatedUsd` and `thresholdUsd`, when the `OpenSpendApproval` inbox handler runs, then a Pending `RunControlService/ApprovalRequest` exists for the run with the action class spend, the `estimatedUsd` of the event, an approver rule and an expiry and with no step, lease or fencing token, the `RunControlService/Run` is WaitingForApproval through the trigger `SpendApprovalRequired`, `RunControlService/ApprovalRequested` without a `stepId` and `RunControlService/RunStateChanged` are written in the same transaction, no attempt is dispatched, and a redelivery of the event or a second announcement for the same run opens no second request; given instead a run that is Held by a frozen environment, then the same Pending request and `RunControlService/ApprovalRequested` are written at once and the run stays Held, without a transition and without `RunControlService/RunStateChanged` (SCN-RunControlService-019, D119).",
        "AC2: Given that Pending spend approval and a reviewer whose roles satisfy its approver rule and who did not request the run, when `RunControlService/DecideApproval` approves it on the quoted version and proposal hash, then the request is Approved, the run returns from WaitingForApproval to Accepted through the trigger `SpendApprovalGranted`, `RunControlService/ApprovalDecided` with the proposal kind spend and the approved `estimatedUsd` and `RunControlService/RunStateChanged` are written in the same transaction, and the first attempt of the run is dispatched only after `CostUsageService/BudgetReserved` arrived for it; given the run is Held when the approval is decided, then the request is Approved and `RunControlService/ApprovalDecided` is written the same way, the run stays Held and nothing is dispatched, and its first attempt is dispatched only once the environment is active again and `CostUsageService/BudgetReserved` has arrived (SCN-RunControlService-005, FR-06, D119).",
        "AC3: Given the Pending spend approval, when `RunControlService/DecideApproval` rejects it, or its `expiresAt` passes and the `ApprovalExpiryReconciler` runs, then the request is Rejected or Expired, the run moves from WaitingForApproval, or from Held when it was Held at that moment (D119), to Failed through `ApprovalRejectedOrExpired`, `RunControlService/RunFailed` with the failure class policy-denied, `RunControlService/RunStateChanged` and `RunControlService/ApprovalDecided` are written in one transaction, no new request is opened for the expired one, and no attempt of the run was ever dispatched (SCN-RunControlService-020).",
        "AC4: Given the Pending spend approval, when the requester of the run calls `RunControlService/DecideApproval`, then the response is 403 with a problem response; when an eligible reviewer submits a request-changes decision, then the response is 409 with a problem response (D119); in both cases the request stays Pending, the run keeps its state, WaitingForApproval or Held, and nothing is published (SCN-RunControlService-005).",
        "AC5: Given the spend approval was opened or decided, when the outbox dispatcher publishes `RunControlService/ApprovalRequested` on `run-control.approvals.v1.approval-requested` or `RunControlService/ApprovalDecided` on `run-control.approvals.v1.approval-decided`, then the event is sent under the canonical envelope, the first with `approvalId`, `runId`, `tenantId`, the `actionClass` spend, `proposalHash`, `approverRule` and `expiresAt` and without a `stepId`, the second with `approvalId`, `runId`, `tenantId`, `state`, `projectId`, the `proposalKind` spend, `proposalHash` and `estimatedUsd`, and a transport outage is retried with backoff so that neither is lost or duplicated under its event id (SCN-RunControlService-019, SCN-RunControlService-020, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2191",
        "AIFACTORY-TASK-2192",
        "AIFACTORY-TASK-2193",
        "AIFACTORY-TASK-2194",
        "AIFACTORY-TASK-2195"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5510,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "CostUsageService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "RunControlService/DecideApproval",
          "RunControlService/ListApprovals"
        ],
        "events": [
          "CostUsageService/SpendApprovalRequired",
          "CostUsageService/BudgetReserved",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunStateChanged",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "approval-request-v1",
          "approval-decision-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-06",
          "FUX-05"
        ],
        "scenarios": [
          "SCN-RunControlService-005",
          "SCN-RunControlService-019",
          "SCN-RunControlService-020"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list",
          "approval-card"
        ],
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-163",
        "AIFACTORY-US-165",
        "AIFACTORY-US-166",
        "AIFACTORY-US-167",
        "feature:cost-usage-service-complete",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-546]",
      "number": 546
    },
    {
      "id": "AIFACTORY-TASK-2191",
      "type": "task",
      "parent": "AIFACTORY-US-546",
      "title": "Contract of the run-level spend approval in the approval request, the approval events and the approval list",
      "sequence": "01.05.10.01",
      "description": "Contract of the run-level spend approval in the approval request, the approval events and the approval list. Expected output: The contract documents of the service state, against the ApprovalRequest definition of docs/reference/schemas/approval.schema.json, that a spend approval carries the action class spend and a proposal of kind spend with estimatedUsd and carries no stepId, leaseId or fencingToken; that ApprovalRequested omits stepId for it and ApprovalDecided carries the proposal kind spend and estimatedUsd; and that a request-changes decision on it is answered 409 (D119).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The contract documents of the service state, against the ApprovalRequest definition of docs/reference/schemas/approval.schema.json, that a spend approval carries the action class spend and a proposal of kind spend with estimatedUsd and carries no stepId, leaseId or fencingToken; that ApprovalRequested omits stepId for it and ApprovalDecided carries the proposal kind spend and estimatedUsd; and that a request-changes decision on it is answered 409 (D119)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5510,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2191]",
      "number": 2191
    },
    {
      "id": "AIFACTORY-TASK-2192",
      "type": "task",
      "parent": "AIFACTORY-US-546",
      "title": "OpenSpendApproval inbox handler opening the run-level request and moving the run to WaitingForApproval",
      "sequence": "01.05.10.02",
      "description": "OpenSpendApproval inbox handler opening the run-level request and moving the run to WaitingForApproval. Expected output: The handler of SpendApprovalRequired opens one Pending ApprovalRequest per run with the action class spend, the estimatedUsd of the event, the proposal hash of the spend proposal, the approver rule resolved through PolicyEngineService for the pinned policy revision and the expiry from RunControl:Approvals:DefaultExpiryHours unless policy shortens it, with no step, lease or fencing token; it moves the Accepted run to WaitingForApproval through SpendApprovalRequired and writes the RecoveryJournal entry, ApprovalRequested without stepId and RunStateChanged in one transaction; for a run that is Held it opens the same request at once, writes ApprovalRequested and leaves the run Held without a transition (D119); it is idempotent on the event id, opens nothing for a run that already has a spend approval, and fails without a write when PolicyEngineService is unavailable, so the inbox retries.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The handler of SpendApprovalRequired opens one Pending ApprovalRequest per run with the action class spend, the estimatedUsd of the event, the proposal hash of the spend proposal, the approver rule resolved through PolicyEngineService for the pinned policy revision and the expiry from RunControl:Approvals:DefaultExpiryHours unless policy shortens it, with no step, lease or fencing token; it moves the Accepted run to WaitingForApproval through SpendApprovalRequired and writes the RecoveryJournal entry, ApprovalRequested without stepId and RunStateChanged in one transaction; for a run that is Held it opens the same request at once, writes ApprovalRequested and leaves the run Held without a transition (D119); it is idempotent on the event id, opens nothing for a run that already has a spend approval, and fails without a write when PolicyEngineService is unavailable, so the inbox retries."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5510,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2192]",
      "number": 2192
    },
    {
      "id": "AIFACTORY-TASK-2193",
      "type": "task",
      "parent": "AIFACTORY-US-546",
      "title": "Outcomes of a spend approval in DecideApproval and in the ApprovalExpiryReconciler",
      "sequence": "01.05.10.03",
      "description": "Outcomes of a spend approval in DecideApproval and in the ApprovalExpiryReconciler. Expected output: For a request of action class spend DecideApproval applies SpendApprovalGranted on approval, returning the run from WaitingForApproval to Accepted and writing ApprovalDecided with the proposal kind spend and estimatedUsd together with RunStateChanged, applies ApprovalRejectedOrExpired on rejection with RunFailed carrying the failure class policy-denied, answers a request-changes decision with 409 and leaves the request Pending (D119), and refuses the requester of the run with 403; when the run is Held at the decision, an approval writes ApprovalDecided and leaves the run Held, and a rejection fails it from Held through ApprovalRejectedOrExpired (D119); the ApprovalExpiryReconciler fails the run of an expired spend approval the same way, from WaitingForApproval or from Held, and never re-requests it; the RunDispatcher dispatches nothing for the run before BudgetReserved arrives.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "For a request of action class spend DecideApproval applies SpendApprovalGranted on approval, returning the run from WaitingForApproval to Accepted and writing ApprovalDecided with the proposal kind spend and estimatedUsd together with RunStateChanged, applies ApprovalRejectedOrExpired on rejection with RunFailed carrying the failure class policy-denied, answers a request-changes decision with 409 and leaves the request Pending (D119), and refuses the requester of the run with 403; when the run is Held at the decision, an approval writes ApprovalDecided and leaves the run Held, and a rejection fails it from Held through ApprovalRejectedOrExpired (D119); the ApprovalExpiryReconciler fails the run of an expired spend approval the same way, from WaitingForApproval or from Held, and never re-requests it; the RunDispatcher dispatches nothing for the run before BudgetReserved arrives."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5510,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2193]",
      "number": 2193
    },
    {
      "id": "AIFACTORY-TASK-2194",
      "type": "task",
      "parent": "AIFACTORY-US-546",
      "title": "Acceptance fixture publishing SpendApprovalRequired and BudgetReserved for a run",
      "sequence": "01.05.10.04",
      "description": "Acceptance fixture publishing SpendApprovalRequired and BudgetReserved for a run. Expected output: The acceptance suite publishes SpendApprovalRequired with a stated estimate and threshold for an accepted run and, after an approval, BudgetReserved or BudgetReservationDenied for it, through a fixture publisher, so that the waiting, the approval, the rejection, the expiry with a controlled clock and the dispatch after the reservation are reproducible without CostUsageService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite publishes SpendApprovalRequired with a stated estimate and threshold for an accepted run and, after an approval, BudgetReserved or BudgetReservationDenied for it, through a fixture publisher, so that the waiting, the approval, the rejection, the expiry with a controlled clock and the dispatch after the reservation are reproducible without CostUsageService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5510,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2194]",
      "number": 2194
    },
    {
      "id": "AIFACTORY-TASK-2195",
      "type": "task",
      "parent": "AIFACTORY-US-546",
      "title": "Verify approve-run-spend through the acceptance suite",
      "sequence": "01.05.10.05",
      "description": "Verify approve-run-spend through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Area=SpendApproval&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-546 with the fixture of AIFACTORY-TASK-2194, including the request opened once for a redelivered and for a second announcement, the run that is not dispatched between the approval and BudgetReserved, the rejection, the expiry without a re-request, the refused requester, the request-changes decision answered 409, the request opened at once for a Held run that stays Held, its approval and its rejection while Held, and the payload of ApprovalRequested without stepId and of ApprovalDecided with estimatedUsd; the reservation on the approval is proven by the suite of CostUsageService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Area=SpendApproval&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-546 with the fixture of AIFACTORY-TASK-2194, including the request opened once for a redelivered and for a second announcement, the run that is not dispatched between the approval and BudgetReserved, the rejection, the expiry without a re-request, the refused requester, the request-changes decision answered 409, the request opened at once for a Held run that stays Held, its approval and its rejection while Held, and the payload of ApprovalRequested without stepId and of ApprovalDecided with estimatedUsd; the reservation on the approval is proven by the suite of CostUsageService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5510,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2195]",
      "number": 2195
    },
    {
      "id": "AIFACTORY-US-547",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Cancel every run whose observed usage takes its budget over the limit or further above it, with the reason budget-exceeded",
      "sequence": "01.05.11",
      "description": "A run reserves before it spends, and CostUsageService also watches what it really spends: when recorded or settled usage takes `committedUsd` of a budget above `limitUsd`, it publishes `CostUsageService/BudgetExceeded` with `budgetId`, `tenantId`, `projectId`, `committedUsd`, `limitUsd` and, when the usage names one, the `runId` of the run whose usage crossed the limit (AIFACTORY-US-549 of feature `cost-usage-service-complete`). The owner decided that such an overrun stops the running run and is not only recorded (D117); this PBI is the run control side. The inbox handler `CancelRunOnBudgetExceeded` records a `CancellationIntent` for the run the event names, with the reason budget-exceeded and the actor system, and from there the run follows the cancellation path of `RunControlService/CancelRun` without any other difference (AIFACTORY-US-162). Only the run an event names is stopped (D119): the other running runs of the same budget are not cancelled by it, those that stay within their estimate keep their attempts and finish, and CostUsageService denies new reservations of the budget. The overrun does not end with the first run (D121): every run whose observed usage raises the committed amount of a budget that is already above its limit is named by a `BudgetExceeded` of its own and stopped the same way, the run that crossed the limit and every later one, each once. The run an event names may be a child run, whose usage counts on the reservation of its parent run: only the child is stopped, no intent is recorded for its parent, and the parent then sees a failed child, which AgentRuntimeService and WorkflowEngineService handle in their own PBIs (AIFACTORY-US-656, D121). CostUsageService publishes the event once per run, so later usage of a run that is already being cancelled announces nothing further. A run that is still Accepted or is Held moves to Cancelled at once. A Running or WaitingForApproval run moves to Cancelling, its `RunStateChanged` outbox record is written in the transaction of the transition, and after the commit `AgentRuntimeService/Runtime.Interrupt` is called for the open attempt, fail-fast, so that the attempt stops at its next safe point and reports its observed termination. A Pending approval request of the run is Cancelled through the trigger `RunCancelled`. When every attempt has settled the run moves to Cancelled and `RunControlService/RunCancelled` is published with the `reason` budget-exceeded and the `requestedBy` system from the intent. The run ends Cancelled and never Failed (D117, D123): a stop on `BudgetExceeded` is no run failure, no `RunFailed` is written for it, and only the parent of a stopped child run treats that child as failed, its delegation being set to failed and its step run of kind SubWorkflow to Failed with the failure class policy-denied and the reason budget-exceeded, because the model has no failure class of its own for a budget, and the failure policy of that step applying, in the PBIs of AgentRuntimeService and WorkflowEngineService. Completed external effects stay visible and are never rolled back silently, and the usage the run already caused stays recorded in CostUsageService, which settles the reservation on `RunCancelled` in its own PBI. The handler is idempotent on the event id. An event that names no run changes no run: it is the event CostUsageService publishes for a project when usage recorded outside a run, such as a model call outside a run, took the committed amount above the limit, and the handler ignores it, stops no run and records no cancellation intent; it is consumed and acknowledged, since the denial of the next reservation is the work of CostUsageService and the refusal of later calls outside a run is the work of ModelRouterService (D125). An event for a run that is already Completed, Failed or Cancelled changes nothing, which is the ordinary case of an overrun found at settlement, and an event for a run that is already Cancelling records no second intent. The run is looked up under the tenant of the event, so a run of another tenant is never touched. Nothing in this PBI denies a later run: a new run of the project is accepted as before, and CostUsageService denies its reservation while the budget is over its limit, which fails that run as policy-denied through `BudgetDenied` (AIFACTORY-US-167). Kind: behavior. Traces: services: RunControlService, CostUsageService, AgentRuntimeService; aggregates: RunControlService/Run, RunControlService/ApprovalRequest; apis: AgentRuntimeService/Runtime.Interrupt; events: CostUsageService/BudgetExceeded, RunControlService/RunStateChanged, RunControlService/RunCancelled; adrs: ADR-0012, ADR-0014; requirements: FR-10, FUX-07; scenarios: SCN-RunControlService-015. Relates: screens: run-detail; nfrs: NFR-05. Depends on: AIFACTORY-US-162, feature:cost-usage-service-complete, feature:agent-runtime-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/control-plane/CostUsageService.yaml, docs/planes/control/services/run-control-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running run with an open attempt and `CostUsageService/BudgetExceeded` naming its `runId`, when the `CancelRunOnBudgetExceeded` inbox handler runs, then a `CancellationIntent` with the reason budget-exceeded and the actor system is recorded, the `RunControlService/Run` moves to Cancelling with `RunControlService/RunStateChanged` written in the same transaction, and after that transaction commits `AgentRuntimeService/Runtime.Interrupt` is called for the open attempt; an unavailable AgentRuntimeService fails the call fast and leaves the Cancelling state standing (SCN-RunControlService-015).",
        "AC2: Given the event names a run that is still Accepted, a Held run, or a run that is WaitingForApproval, when the handler runs, then the Accepted run and the Held run move to Cancelled at once, the waiting run moves to Cancelling, and its Pending `RunControlService/ApprovalRequest` moves to Cancelled through the trigger `RunCancelled` no later than the run reaching Cancelled (SCN-RunControlService-015).",
        "AC3: Given the run of AC1 whose last open attempt settles, or a run cancelled at once, when the run moves to Cancelled and the outbox dispatcher publishes `RunControlService/RunCancelled` on `run-control.runs.v1.run-cancelled`, then the outbox record was written in the transaction of the transition, the event is sent under the canonical envelope with `runId`, `tenantId`, the `reason` budget-exceeded and the `requestedBy` system, the run is Cancelled and never Failed, so that no `RunFailed` record is written for it (D123), and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-015, ADR-0012).",
        "AC4: Given a redelivery of the same event id, an event without a `runId`, an event for a run that is already Completed, Failed or Cancelled, or an event for a run that is already Cancelling, when the `CancelRunOnBudgetExceeded` handler runs on `CostUsageService/BudgetExceeded`, then no run changes state, no second `CancellationIntent` is recorded and nothing is published; and given a second Running run of the same project and budget that the event does not name, when the handler cancels the named run, then that second run keeps its state and its open attempt and finishes (ADR-0012, FR-10, D119).",
        "AC5: Given two Running runs of the same budget and a first `CostUsageService/BudgetExceeded` that named and stopped one of them, when a later `CostUsageService/BudgetExceeded` names the second run, because its observed usage raised the committed amount of the budget further above its limit, then the handler records a `CancellationIntent` with the reason budget-exceeded and the actor system for that run as well and it follows the same cancel transitions, each named run being stopped once, while a third run of the budget that stays within its estimate is named by no event, keeps its state and finishes; and given an event that names a child run, then only that child is stopped, `RunControlService/RunCancelled` of the child carries the reason budget-exceeded, and no intent is recorded for its parent run (SCN-RunControlService-015, D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/planes/control/services/run-control-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2196",
        "AIFACTORY-TASK-2197"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5511,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "CostUsageService",
          "AgentRuntimeService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "AgentRuntimeService/Runtime.Interrupt"
        ],
        "events": [
          "CostUsageService/BudgetExceeded",
          "RunControlService/RunStateChanged",
          "RunControlService/RunCancelled"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10",
          "FUX-07"
        ],
        "scenarios": [
          "SCN-RunControlService-015"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-162",
        "feature:cost-usage-service-complete",
        "feature:agent-runtime-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/planes/control/services/run-control-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-547]",
      "number": 547
    },
    {
      "id": "AIFACTORY-TASK-2196",
      "type": "task",
      "parent": "AIFACTORY-US-547",
      "title": "CancelRunOnBudgetExceeded inbox handler recording the cancellation intent of the run a budget overrun names",
      "sequence": "01.05.11.01",
      "description": "CancelRunOnBudgetExceeded inbox handler recording the cancellation intent of the run a budget overrun names. Expected output: The handler of BudgetExceeded looks the run of the event up under the tenant of the event, records a CancellationIntent with the reason budget-exceeded and the actor system and applies the cancel transitions through the same path as CancelRun (AIFACTORY-TASK-865 and AIFACTORY-TASK-866), so that RunCancelled carries that reason and actor; it is idempotent on the event id, changes nothing for an event without runId, for a terminal run and for a run that is already Cancelling, and acknowledges the event in each of these cases; it touches no run other than the one the event names, so the other running runs of the budget finish (D119); every event is handled alike, so a second run that a later event names is stopped the same way and each named run is stopped once, and a named child run is stopped without an intent for its parent run (D121).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The handler of BudgetExceeded looks the run of the event up under the tenant of the event, records a CancellationIntent with the reason budget-exceeded and the actor system and applies the cancel transitions through the same path as CancelRun (AIFACTORY-TASK-865 and AIFACTORY-TASK-866), so that RunCancelled carries that reason and actor; it is idempotent on the event id, changes nothing for an event without runId, for a terminal run and for a run that is already Cancelling, and acknowledges the event in each of these cases; it touches no run other than the one the event names, so the other running runs of the budget finish (D119); every event is handled alike, so a second run that a later event names is stopped the same way and each named run is stopped once, and a named child run is stopped without an intent for its parent run (D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5511,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2196]",
      "number": 2196
    },
    {
      "id": "AIFACTORY-TASK-2197",
      "type": "task",
      "parent": "AIFACTORY-US-547",
      "title": "Verify cancel-run-on-budget-exceeded through the acceptance suite",
      "sequence": "01.05.11.02",
      "description": "Verify cancel-run-on-budget-exceeded through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Area=BudgetExceeded&Scenario=SCN-RunControlService-015\"`; a zero-match filter counts as a failure; the tests deliver BudgetExceeded to the inbox through a fixture publisher and prove AC1 to AC5 of AIFACTORY-US-547 with the fake Runtime.Interrupt endpoint that records the call, including the intent with the reason budget-exceeded and the actor system, the runs cancelled at once, the Pending approval request Cancelled, the payload of RunCancelled, the event without runId, the terminal run, the run already Cancelling, the redelivery, a second running run of the same budget that is left running while no event names it and is stopped once a later event names it, and a named child run stopped without an intent for its parent; the publication of BudgetExceeded is proven by the suite of CostUsageService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Area=BudgetExceeded&Scenario=SCN-RunControlService-015\"`; a zero-match filter counts as a failure; the tests deliver BudgetExceeded to the inbox through a fixture publisher and prove AC1 to AC5 of AIFACTORY-US-547 with the fake Runtime.Interrupt endpoint that records the call, including the intent with the reason budget-exceeded and the actor system, the runs cancelled at once, the Pending approval request Cancelled, the payload of RunCancelled, the event without runId, the terminal run, the run already Cancelling, the redelivery, a second running run of the same budget that is left running while no event names it and is stopped once a later event names it, and a named child run stopped without an intent for its parent; the publication of BudgetExceeded is proven by the suite of CostUsageService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5511,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2197]",
      "number": 2197
    },
    {
      "id": "AIFACTORY-US-548",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Announce once that no non-terminal run of a closing project remains, so that its off-boarding can complete",
      "sequence": "01.05.12",
      "description": "Closing a project is a procedure, and ProjectService keeps a project in Closing until two confirmations arrived: RunControlService confirms that no non-terminal run of the project remains, and ArtifactService confirms the export or the deletion of its data (D117; AIFACTORY-US-449 of feature `project-service`). This PBI delivers the first confirmation, the event `RunControlService/ProjectRunsSettled`. When ProjectService announces through `ProjectService/ProjectStateChanged` that a project moved to Closing, the inbox handler `GateRunsByProject` keeps the announced state in the table `GateStates`, from which `SubmitRun` refuses every new run of the project with 409 (AIFACTORY-US-005), and records a cancellation intent for every open run of the project (AIFACTORY-US-162). From then on no run of the project can appear and every run that exists moves towards a terminal state. `ProjectRunsSettled` is written at the moment the service can state that no run of the project is in a state other than Completed, Failed or Cancelled. That is the transaction of the handler when no such run is left once the handler has applied the intents, which includes a project that never had a run and a project whose open runs were all Accepted or Held and are cancelled at once, and otherwise the transaction in which the last open run of the project reaches its terminal state, which for a run that was Running or WaitingForApproval is Cancelled once its attempts settled. The check and the outbox record belong to that transaction, so the event is never written while a run of the project is still Accepted, Held, Running, WaitingForApproval or Cancelling, and it is not lost when the service stops between the last transition and the publication. The event is published once for the closing of a project: a redelivery of the announcement is absorbed by the inbox, and a terminal transition that is not the last one of the project writes nothing. It is published on `run-control.runs.v1.project-runs-settled` under the canonical envelope with `projectId` and `tenantId`; ProjectService records it in its off-boarding journal through its handler `RecordRunsSettled` in its own PBI. Nothing is announced for a project that is Suspended, whose open runs are cancelled the same way but which is not being off-boarded, nor for an Active project, and the announcement of Closed, which follows the confirmations, causes no further event. A run of another tenant or of another project never counts, because the check is made under the tenant of the event and for the `projectId` it names. Kind: behavior. Traces: services: RunControlService, ProjectService; aggregates: RunControlService/Run; events: RunControlService/ProjectRunsSettled, RunControlService/RunCancelled, ProjectService/ProjectStateChanged; adrs: ADR-0012, ADR-0014; requirements: FR-10, XL-13; scenarios: SCN-RunControlService-021. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-162, AIFACTORY-US-167, feature:project-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/control-plane/ProjectService.yaml, model/scenarios/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a project without a non-terminal run, when `ProjectService/ProjectStateChanged` announces that it moved to Closing and the `GateRunsByProject` inbox handler runs, then the announced state is kept in `GateStates` and the `RunControlService/ProjectRunsSettled` outbox record with `projectId` and `tenantId` is written in the transaction of the handler (SCN-RunControlService-021).",
        "AC2: Given a project with an Accepted run, a Running run with an open attempt and a run that is WaitingForApproval, when `ProjectService/ProjectStateChanged` announces Closing, then each of them records a cancellation intent and no `RunControlService/ProjectRunsSettled` record is written while one of them is not yet Completed, Failed or Cancelled; when the last of them reaches Cancelled after its attempts settled, then the record is written in the transaction of that transition, beside the `RunControlService/RunCancelled` record of that run; and given a project whose only open runs are Accepted or Held, then they are cancelled at once and the record is written in the transaction of the handler (SCN-RunControlService-021).",
        "AC3: Given the record was written, when the outbox dispatcher publishes `RunControlService/ProjectRunsSettled` on `run-control.runs.v1.project-runs-settled`, then the event is sent under the canonical envelope with `projectId` and `tenantId`, a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, and a redelivery of the Closing announcement publishes no second event for the project (SCN-RunControlService-021, ADR-0012).",
        "AC4: Given a project that `ProjectService/ProjectStateChanged` announced as Suspended, an Active project, or a second project of the tenant that is not closing, when the open runs of that project are cancelled or its last run reaches a terminal state, then no `RunControlService/ProjectRunsSettled` is written for it; and a run of another tenant or of another project neither delays nor triggers the event of the closing project (SCN-RunControlService-021, XL-13)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2198",
        "AIFACTORY-TASK-2199"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5512,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "ProjectService"
        ],
        "aggregates": [
          "RunControlService/Run"
        ],
        "events": [
          "RunControlService/ProjectRunsSettled",
          "RunControlService/RunCancelled",
          "ProjectService/ProjectStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10",
          "XL-13"
        ],
        "scenarios": [
          "SCN-RunControlService-021"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-162",
        "AIFACTORY-US-167",
        "feature:project-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/scenarios/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-548]",
      "number": 548
    },
    {
      "id": "AIFACTORY-TASK-2198",
      "type": "task",
      "parent": "AIFACTORY-US-548",
      "title": "ProjectRunsSettled written by GateRunsByProject and by the last terminal transition of a run of a closing project",
      "sequence": "01.05.12.01",
      "description": "ProjectRunsSettled written by GateRunsByProject and by the last terminal transition of a run of a closing project. Expected output: GateRunsByProject writes the ProjectRunsSettled outbox record in its transaction when the project it keeps as Closing in GateStates has, after the cancellation intents were applied, no run outside Completed, Failed and Cancelled; every transition of a run to a terminal state checks, in its own transaction, whether the project of the run is kept as Closing and whether another non-terminal run of it remains, and writes the record when none does; the record is written once per closing of a project, carries projectId and tenantId, and is never written for a project kept as Suspended or Active.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "GateRunsByProject writes the ProjectRunsSettled outbox record in its transaction when the project it keeps as Closing in GateStates has, after the cancellation intents were applied, no run outside Completed, Failed and Cancelled; every transition of a run to a terminal state checks, in its own transaction, whether the project of the run is kept as Closing and whether another non-terminal run of it remains, and writes the record when none does; the record is written once per closing of a project, carries projectId and tenantId, and is never written for a project kept as Suspended or Active."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5512,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2198]",
      "number": 2198
    },
    {
      "id": "AIFACTORY-TASK-2199",
      "type": "task",
      "parent": "AIFACTORY-US-548",
      "title": "Verify announce-settled-runs-of-a-closing-project through the acceptance suite",
      "sequence": "01.05.12.02",
      "description": "Verify announce-settled-runs-of-a-closing-project through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-021\"`; a zero-match filter counts as a failure; the tests deliver ProjectStateChanged to the inbox and prove AC1 to AC4 of AIFACTORY-US-548, that is the event of a project without runs, the event withheld until the last of three open runs is terminal, the event written by the handler for a project whose open runs are all cancelled at once, the single event after a redelivered announcement, no event for a Suspended project, and the publication and payload of ProjectRunsSettled; consumer handling is proven by the suite of ProjectService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-021\"`; a zero-match filter counts as a failure; the tests deliver ProjectStateChanged to the inbox and prove AC1 to AC4 of AIFACTORY-US-548, that is the event of a project without runs, the event withheld until the last of three open runs is terminal, the event written by the handler for a project whose open runs are all cancelled at once, the single event after a redelivered announcement, no event for a Suspended project, and the publication and payload of ProjectRunsSettled; consumer handling is proven by the suite of ProjectService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5512,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2199]",
      "number": 2199
    },
    {
      "id": "AIFACTORY-US-656",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Submit a child run under its parent run, on the reservation of that parent, and cancel the open child runs of a parent that ends Failed or Cancelled",
      "sequence": "01.05.13",
      "description": "A run can start another run: a supervisor attempt delegates a part of its work, and a workflow step of kind SubWorkflow runs a whole workflow as one step. The owner decided that both go through one internal operation of RunControlService, so that a child run is a run like any other and its state has the same single authority (D119). `RunControlService/RunControl.SubmitChildRun` is an internal gRPC method, called under a workload identity by AgentRuntimeService for a delegation and by WorkflowEngineService for a step of kind SubWorkflow; it has no gateway route. The request is `run-submission-v1`, the descriptor of the public submission, with the parent fields that it carries for a child submission only: `parentRunId` always, and `parentAttemptId` for a delegation, where it names the attempt of the parent that delegates. The child of a step of kind SubWorkflow has the run as parent and no parent attempt, so its submission carries no `parentAttemptId` (D121). The reply is `run-accepted-v1`. The child is written as a `Run` in state Accepted with `parentRunId` and, for a delegation, `parentAttemptId`, and inherits from its parent the tenant, the project, the policy revision and the pinned release closure: none of them is read from the body and nothing is resolved or evaluated anew for them, so a child always runs under what its parent was accepted with. As for every run, the resolved execution snapshot of the child is stored in ArtifactService before the child is accepted, and no child is accepted without a stored snapshot (AIFACTORY-US-005, D121). The `RunAccepted` outbox record is written in the same transaction and carries the `parentRunId` of the child, the optional field by which CostUsageService recognises a child run. A child run gets no reservation of its own (D121): CostUsageService reserves nothing for it, its usage is recorded with the child run id and counts on the reservation of the parent run, and RunControlService therefore waits for no `BudgetReserved` and opens no spend approval for a child, whose first attempt is dispatched when `StepReady` announces its first step (AIFACTORY-US-163, D123). In everything else the child is dispatched, held, approved and settled exactly as the other PBIs of this feature state for any run. When the usage of a child takes the budget over its limit, `BudgetExceeded` names the child, only the child is stopped, and its parent then sees a failed child (AIFACTORY-US-547). The release ids of the snapshot of the child are written to `RunPinnedReleases` under the child run id when the child is accepted, so that a revocation selects the child in its own right (D125); a child stopped by the in-flight policy drain or revoke ends Cancelled with the reason release-revoked, and its parent treats it as failed like a child stopped for a budget overrun, which AgentRuntimeService and WorkflowEngineService apply in their own PBIs (D125). The method is idempotent on the idempotency key of the submission, which is the step run id for a step of kind SubWorkflow and the delegation id for a delegation (D121): the same key with the same input returns the same child run and writes nothing, and the same key with another input is refused as a conflict. The outcome of a child reaches its caller through the terminal run events that exist, `RunCompleted`, `RunFailed` and `RunCancelled`, which carry the `runId` of the child, `RunCompleted` with the optional `outputRef` through which the parent reads the result of the child (AIFACTORY-US-167, D121); no further event announces it, and AgentRuntimeService and WorkflowEngineService match that id to the delegation or to the step run in their own PBIs. A parent never leaves a child behind: when a parent run ends Failed or Cancelled, a `CancellationIntent` with a reason that names the parent run and with the actor system is recorded for each of its open child runs, once per child, and each child follows the cancellation path of `CancelRun` (AIFACTORY-US-162). An Accepted or a Held child is Cancelled at once, a Running or a WaitingForApproval child moves to Cancelling and its open attempt is interrupted, and a child that has children of its own passes the cancellation on in the same way when it ends Cancelled. A parent that ends Completed cancels nothing. A caller without a workload identity is refused with Unauthenticated, an invalid request, one without `parentRunId` among them, with InvalidArgument, and a parent run that does not exist in the tenant of the caller with NOT_FOUND, which is also the answer for a parent of another tenant (ADR-0015). A submission under a parent that is already Completed, Failed, Cancelled or Cancelling is refused with FailedPrecondition, the gRPC status FAILED_PRECONDITION, and no child run exists (D121), because such a child could no longer be cancelled with its parent; as a design choice of this PBI a submission that names a `parentAttemptId` which is not an attempt of that parent is refused the same way. No refusal writes a run or publishes anything. A parent is named only here: the public `SubmitRun` answers 400 for a body that carries `parentRunId` or `parentAttemptId` (AIFACTORY-US-005, D121). Kind: behavior. Traces: services: RunControlService, AgentRuntimeService, WorkflowEngineService; aggregates: RunControlService/Run; apis: RunControlService/RunControl.SubmitChildRun, AgentRuntimeService/Runtime.Interrupt; events: RunControlService/RunAccepted, RunControlService/RunStateChanged, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled; descriptors: run-submission-v1, run-accepted-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-03, FR-10; scenarios: SCN-RunControlService-022. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-005, AIFACTORY-US-162, AIFACTORY-US-167, feature:agent-runtime-service, feature:workflow-engine-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, docs/reference/schemas/run-submission.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a Running parent run with an open attempt and a caller with the workload identity of AgentRuntimeService, when `RunControlService/RunControl.SubmitChildRun` is called with `run-submission-v1` naming `parentRunId` and `parentAttemptId`, then the reply is `run-accepted-v1`, a `RunControlService/Run` exists in state Accepted with `parentRunId` and `parentAttemptId` and with the tenant, the project, the policy revision and the pinned release closure of the parent, whatever the body states for them, its resolved execution snapshot was stored before it was committed, and the `RunControlService/RunAccepted` outbox record, which carries the `parentRunId` of the child, is written in the same transaction; a call by WorkflowEngineService for a step of kind SubWorkflow that names the parent run and no parent attempt is accepted the same way; no reservation is awaited for the child, so its first attempt is dispatched when `StepReady` announces its first step, without `BudgetReserved` (D123), and no spend approval is opened for it (SCN-RunControlService-022, ADR-0014, D121).",
        "AC2: Given a child submission repeated with the same idempotency key, which is the step run id for a step of kind SubWorkflow and the delegation id for a delegation (D121), and the same input, when it arrives at `RunControlService/RunControl.SubmitChildRun`, then the same child run is returned and no second `RunControlService/Run` and no second `RunControlService/RunAccepted` record exist; given the same key with another input, then the call is refused as a conflict and nothing is written (SCN-RunControlService-022).",
        "AC3: Given a caller without a workload identity, a request without `parentRunId`, a parent run that is unknown or belongs to another tenant, a parent run that is already Completed, Failed, Cancelled or Cancelling, or a `parentAttemptId` that is not an attempt of the parent, when `RunControlService/RunControl.SubmitChildRun` is called, then the call is refused with Unauthenticated, InvalidArgument, NOT_FOUND for the unknown and the foreign parent alike, or the status FAILED_PRECONDITION for the last two, the answer for a terminal or Cancelling parent being decided (D121), no run is written and nothing is published (SCN-RunControlService-022, ADR-0015).",
        "AC4: Given a parent run with an Accepted child, a Running child with an open attempt and a Completed child, when the parent moves to Failed or to Cancelled, then a `CancellationIntent` with a reason that names the parent run and with the actor system is recorded once for each of the two open children, the Accepted child is Cancelled at once, the Running child moves to Cancelling with `RunControlService/RunStateChanged` and its open attempt is interrupted through `AgentRuntimeService/Runtime.Interrupt` after the commit, the Completed child is not touched, and a repeated evaluation records no second intent; given a parent that ends Completed, then no intent is recorded for any child (ADR-0014).",
        "AC5: Given a child run that reaches a terminal state, when the outbox dispatcher publishes `RunControlService/RunCompleted`, `RunControlService/RunFailed` or `RunControlService/RunCancelled` for it, then the event is sent under the canonical envelope with the `runId` of the child, the `RunControlService/RunCompleted` of a child carrying the optional `outputRef` through which the parent reads its result (D121), the `RunControlService/RunCancelled` of a child cancelled with its parent carrying the reason that names the parent run and the `requestedBy` system, no further event announces the outcome of a child, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/reference/schemas/run-submission.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2641",
        "AIFACTORY-TASK-2642",
        "AIFACTORY-TASK-2643",
        "AIFACTORY-TASK-2644",
        "AIFACTORY-TASK-2645"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5513,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "AgentRuntimeService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "RunControlService/Run"
        ],
        "apis": [
          "RunControlService/RunControl.SubmitChildRun",
          "AgentRuntimeService/Runtime.Interrupt"
        ],
        "events": [
          "RunControlService/RunAccepted",
          "RunControlService/RunStateChanged",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled"
        ],
        "descriptors": [
          "run-submission-v1",
          "run-accepted-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-03",
          "FR-10"
        ],
        "scenarios": [
          "SCN-RunControlService-022"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-005",
        "AIFACTORY-US-162",
        "AIFACTORY-US-167",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/reference/schemas/run-submission.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-656]",
      "number": 656
    },
    {
      "id": "AIFACTORY-TASK-2641",
      "type": "task",
      "parent": "AIFACTORY-US-656",
      "title": "Contract of SubmitChildRun and of the parent fields of a child submission",
      "sequence": "01.05.13.01",
      "description": "Contract of SubmitChildRun and of the parent fields of a child submission. Expected output: The proto of the service holds RunControl.SubmitChildRun with the request run-submission-v1 and the reply run-accepted-v1, as model/services/control-plane/RunControlService.yaml names them; the contract document states, against docs/reference/schemas/run-submission.schema.json, that parentRunId and parentAttemptId are carried by a child submission only and that the public SubmitRun answers 400 for a body that carries either, that parentAttemptId is absent for the child of a step of kind SubWorkflow, that the idempotency key is the step run id for a step of kind SubWorkflow and the delegation id for a delegation, that RunAccepted carries the optional parentRunId for a child run (D121), that the tenant, the project, the policy revision and the release closure are inherited from the parent and ignored when sent, and which gRPC status answers each refusal, Unauthenticated, InvalidArgument, NOT_FOUND or FAILED_PRECONDITION, the last for a parent run that is terminal or Cancelling (D121).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The proto of the service holds RunControl.SubmitChildRun with the request run-submission-v1 and the reply run-accepted-v1, as model/services/control-plane/RunControlService.yaml names them; the contract document states, against docs/reference/schemas/run-submission.schema.json, that parentRunId and parentAttemptId are carried by a child submission only and that the public SubmitRun answers 400 for a body that carries either, that parentAttemptId is absent for the child of a step of kind SubWorkflow, that the idempotency key is the step run id for a step of kind SubWorkflow and the delegation id for a delegation, that RunAccepted carries the optional parentRunId for a child run (D121), that the tenant, the project, the policy revision and the release closure are inherited from the parent and ignored when sent, and which gRPC status answers each refusal, Unauthenticated, InvalidArgument, NOT_FOUND or FAILED_PRECONDITION, the last for a parent run that is terminal or Cancelling (D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5513,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2641]",
      "number": 2641
    },
    {
      "id": "AIFACTORY-TASK-2642",
      "type": "task",
      "parent": "AIFACTORY-US-656",
      "title": "SubmitChildRun accepting a child run under its parent with inherited scope, policy revision and release closure",
      "sequence": "01.05.13.02",
      "description": "SubmitChildRun accepting a child run under its parent with inherited scope, policy revision and release closure. Expected output: RunControl.SubmitChildRun checks the workload identity, looks the parent run up under the tenant of the caller, refuses a terminal or Cancelling parent with FAILED_PRECONDITION (D121) and a parentAttemptId that is not an attempt of the parent the same way, has the snapshot of the child stored before the commit and its pinnedReleases written to RunPinnedReleases under the child run id (AIFACTORY-TASK-2931, D125), and writes the child Run in state Accepted with ParentRunId and, for a delegation, ParentAttemptId, which are mapped with the index IX_Runs_Parent of the model, and with the tenant, the project, the policy revision and the release closure copied from the parent, together with its RunAccepted outbox record, which carries parentRunId, in one transaction; the same idempotency key, the step run id or the delegation id, with the same input returns the existing child and another input under that key is refused; every refusal writes nothing; a run with a parent waits for no BudgetReserved and gets no spend approval, so the RunDispatcher dispatches its first attempt when StepReady announces its first step (D121, D123).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "RunControl.SubmitChildRun checks the workload identity, looks the parent run up under the tenant of the caller, refuses a terminal or Cancelling parent with FAILED_PRECONDITION (D121) and a parentAttemptId that is not an attempt of the parent the same way, has the snapshot of the child stored before the commit and its pinnedReleases written to RunPinnedReleases under the child run id (AIFACTORY-TASK-2931, D125), and writes the child Run in state Accepted with ParentRunId and, for a delegation, ParentAttemptId, which are mapped with the index IX_Runs_Parent of the model, and with the tenant, the project, the policy revision and the release closure copied from the parent, together with its RunAccepted outbox record, which carries parentRunId, in one transaction; the same idempotency key, the step run id or the delegation id, with the same input returns the existing child and another input under that key is refused; every refusal writes nothing; a run with a parent waits for no BudgetReserved and gets no spend approval, so the RunDispatcher dispatches its first attempt when StepReady announces its first step (D121, D123)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5513,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2642]",
      "number": 2642
    },
    {
      "id": "AIFACTORY-TASK-2643",
      "type": "task",
      "parent": "AIFACTORY-US-656",
      "title": "Cancellation of the open child runs of a parent that ends Failed or Cancelled",
      "sequence": "01.05.13.03",
      "description": "Cancellation of the open child runs of a parent that ends Failed or Cancelled. Expected output: When a run that has child runs moves to Failed or to Cancelled, a CancellationIntent with a reason that names the parent run and with the actor system is recorded once for each child that is not Completed, Failed or Cancelled, and the cancel transitions are applied through the same path as CancelRun (AIFACTORY-TASK-865 and AIFACTORY-TASK-866), so that RunCancelled of the child carries that reason and actor; a child that is already Cancelling gets no second intent, a parent that ends Completed cancels nothing, and a child with children of its own passes the cancellation on when it ends Cancelled.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "When a run that has child runs moves to Failed or to Cancelled, a CancellationIntent with a reason that names the parent run and with the actor system is recorded once for each child that is not Completed, Failed or Cancelled, and the cancel transitions are applied through the same path as CancelRun (AIFACTORY-TASK-865 and AIFACTORY-TASK-866), so that RunCancelled of the child carries that reason and actor; a child that is already Cancelling gets no second intent, a parent that ends Completed cancels nothing, and a child with children of its own passes the cancellation on when it ends Cancelled."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5513,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2643]",
      "number": 2643
    },
    {
      "id": "AIFACTORY-TASK-2644",
      "type": "task",
      "parent": "AIFACTORY-US-656",
      "title": "Acceptance fixture of a parent run with child runs submitted under two workload identities",
      "sequence": "01.05.13.04",
      "description": "Acceptance fixture of a parent run with child runs submitted under two workload identities. Expected output: The acceptance suite submits child runs through a test client of RunControl.SubmitChildRun under the workload identity of AgentRuntimeService, with a parent attempt held by the fake runtime worker of AIFACTORY-TASK-871, and under the workload identity of WorkflowEngineService, without a parent attempt, and drives the parent to Completed, to Failed and to Cancelled, so that the inheritance, the idempotent repeat and the cancellation of open children are reproducible without either caller.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite submits child runs through a test client of RunControl.SubmitChildRun under the workload identity of AgentRuntimeService, with a parent attempt held by the fake runtime worker of AIFACTORY-TASK-871, and under the workload identity of WorkflowEngineService, without a parent attempt, and drives the parent to Completed, to Failed and to Cancelled, so that the inheritance, the idempotent repeat and the cancellation of open children are reproducible without either caller."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5513,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2644]",
      "number": 2644
    },
    {
      "id": "AIFACTORY-TASK-2645",
      "type": "task",
      "parent": "AIFACTORY-US-656",
      "title": "Verify submit-a-child-run through the acceptance suite",
      "sequence": "01.05.13.05",
      "description": "Verify submit-a-child-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-022\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-656 with the fixture of AIFACTORY-TASK-2644 and the fake Runtime.Interrupt endpoint that records the call, including the inherited tenant, project, policy revision and release closure against a body that states others, the child without a parent attempt, the snapshot of the child stored before it is accepted, RunAccepted with parentRunId, the first attempt of a child dispatched without BudgetReserved, the idempotent repeat under the step run id and under the delegation id and the conflict, each refusal with its status, FAILED_PRECONDITION under a terminal and under a Cancelling parent among them, the open children cancelled with a Failed and with a Cancelled parent, the Completed child left alone, no intent after a Completed parent, and the payload of the terminal events of a child; the handling of those events is proven by the suites of AgentRuntimeService and WorkflowEngineService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-022\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-656 with the fixture of AIFACTORY-TASK-2644 and the fake Runtime.Interrupt endpoint that records the call, including the inherited tenant, project, policy revision and release closure against a body that states others, the child without a parent attempt, the snapshot of the child stored before it is accepted, RunAccepted with parentRunId, the first attempt of a child dispatched without BudgetReserved, the idempotent repeat under the step run id and under the delegation id and the conflict, each refusal with its status, FAILED_PRECONDITION under a terminal and under a Cancelling parent among them, the open children cancelled with a Failed and with a Cancelled parent, the Completed child left alone, no intent after a Completed parent, and the payload of the terminal events of a child; the handling of those events is proven by the suites of AgentRuntimeService and WorkflowEngineService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5513,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2645]",
      "number": 2645
    },
    {
      "id": "AIFACTORY-US-657",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Open an operator decision when a step fails under Escalate or an outcome is Uncertain on a write step, and apply the choice retry, compensate or fail",
      "sequence": "01.05.14",
      "description": "As an operator, I want a step that failed under the failure policy Escalate, or whose outcome is uncertain on a step that writes, to wait for my choice of retry, compensate or fail, so that no side-effecting step is repeated or abandoned by a rule where a person has to judge what really happened. Two situations must not be settled by a rule: a step whose workflow definition says that its failure is escalated, and an attempt whose outcome is Uncertain on a step that writes, where an external effect may or may not have happened. The owner decided that in both the run waits for a person, the Operator of the project (D119). The model builds this with the approval machinery and not as an aggregate of its own: an operator decision is an `ApprovalRequest` of `kind` operator-decision. RunControlService opens it itself, never a lease holder, in two cases. The first is a step that fails terminally by the rules of AIFACTORY-US-164 and AIFACTORY-US-167 while the `failurePolicy` the `Step` keeps from `StepReady` is Escalate. The second is an Uncertain outcome recorded on a step whose `sideEffectClass` is shared-write or above, whatever failure policy the step declares, whether the holder reported it through `RunControlService/RunControl.ReportAttemptOutcome` or the `LeaseExpiryReconciler` set it for an expired lease. The request names the run and the step and no lease and no fencing token, its `proposalHash` is the `outcomeHash` of the attempt that caused it, its `approverRule` names the Operator of the project, and its expiry is set as for every approval request (AIFACTORY-US-165). In the transaction that records the cause the run moves from Running to WaitingForApproval through `OperatorDecisionRequested`, and the `ApprovalRequested` outbox record, which carries the `kind` operator-decision, and `RunStateChanged` are written. The step is not settled while the request is Pending, so no `StepSettled` is written and WorkflowEngineService keeps its step run open. A step has at most one Pending operator decision, and a redelivered or repeated cause opens no second one. The request is listed by `RunControlService/ListApprovals` and decided through `RunControlService/DecideApproval` under the scope, the version and the proposal hash rules of AIFACTORY-US-166, by a caller whose roles satisfy its approver rule. The requester of the run is not excluded here: the separation of duties covers the requests of `kind` approval, a proposal and a spend, and the member who requested the run may take the operator decision of that run, an act that is audited (D121). The decision is one of three choices, and the request keeps it in `choice`. The choice retry ends the request Approved, returns the run to Running through `OperatorChoseRetryOrCompensate` and dispatches a new attempt of the step under a new lease and fencing token. That attempt is one more beyond the declared maximum of the step: it is dispatched also when the attempts of the step reached `maxAttempts`, and when it fails terminally or ends Uncertain in its turn a new operator decision is opened, on which retry may be chosen again (D121). The choice compensate ends the request Approved and returns the run to Running through the same trigger, and it settles the step Failed, so `StepSettled` is written; WorkflowEngineService reads the choice on `ApprovalDecided` and runs the compensation in its own PBI. The choice fail ends the request Rejected, settles the step Failed and fails the run through `OperatorChoseFailOrDecisionExpired` with the failure class of the attempt that caused the request, which is uncertain for an Uncertain outcome (D121). An operator decision that passes its expiry is never requested again, whatever an approval policy says about re-requests: the `ApprovalExpiryReconciler` ends it Expired, the step is settled Failed and the run fails through the same trigger, with the failure class policy-denied (D121). These are run failures that RunControlService decides itself, without a report of the engine (AIFACTORY-US-167). `ApprovalDecided` is written in the transaction of each of these outcomes with the `proposalKind` operator-decision, the `choice` and the `stepRunId` of the engine, together with `RunStateChanged`, with `StepSettled` where the step is settled and with `RunFailed` where the run fails. An approve, reject or request-changes decision on an operator decision is answered 409 and leaves it Pending, and so is a choice on a request of `kind` approval. A caller whose roles do not satisfy the approver rule is refused with 403, and an unknown request and one of another tenant are both answered 404 (ADR-0015). A run that waits for an operator decision can be cancelled (AIFACTORY-US-162), which moves the Pending request to Cancelled through the trigger `RunCancelled`. An operator decision that an Uncertain outcome of a tool call caused carries one thing more, the finding of the Operator on the effect, applied or not-applied, which limits the choice retry and is recorded in ToolAdapterService; the outcome marks the tool invocation whose effect is uncertain and the request keeps its id (D123); that part is delivered by AIFACTORY-US-726 (D121). Kind: behavior. Traces: services: RunControlService, WorkflowEngineService; aggregates: RunControlService/ApprovalRequest, RunControlService/Run, RunControlService/Step, RunControlService/Attempt; apis: RunControlService/DecideApproval, RunControlService/ListApprovals, RunControlService/RunControl.ReportAttemptOutcome; events: RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, RunControlService/RunStateChanged, RunControlService/RunFailed, RunControlService/StepSettled, RunControlService/AttemptDispatched, RunControlService/AttemptOutcomeRecorded, WorkflowEngineService/StepReady; descriptors: approval-decision-v1, attempt-outcome-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-06, FR-10, FUX-05, FUX-07; scenarios: SCN-RunControlService-005, SCN-RunControlService-008, SCN-RunControlService-019, SCN-RunControlService-020. Relates: screens: approvals-list, approval-card, run-detail; nfrs: NFR-04. Depends on: AIFACTORY-US-164, AIFACTORY-US-165, AIFACTORY-US-166, AIFACTORY-US-167, AIFACTORY-US-658, feature:workflow-engine-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, docs/reference/schemas/approval.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a Running run and a `RunControlService/Step` whose `failurePolicy`, kept from `WorkflowEngineService/StepReady`, is Escalate, when its last attempt settles Failed and the failure is terminal, because it is not retriable or the attempt number reached `maxAttempts`, then a Pending `RunControlService/ApprovalRequest` of `kind` operator-decision exists that names the run and the step and no lease or fencing token, with a `proposalHash` equal to the `outcomeHash` of that attempt, an approver rule that names the Operator of the project and an expiry, the `RunControlService/Run` is WaitingForApproval through `OperatorDecisionRequested`, `RunControlService/ApprovalRequested` with the `kind` operator-decision and `RunControlService/RunStateChanged` are written in the same transaction, and neither `RunControlService/StepSettled` nor `RunControlService/RunFailed` is written (SCN-RunControlService-019, ADR-0014).",
        "AC2: Given a step whose `sideEffectClass` is shared-write or above and whose `failurePolicy` is not Escalate, when an Uncertain outcome is reported for its attempt through `RunControlService/RunControl.ReportAttemptOutcome`, or the `LeaseExpiryReconciler` settles the attempt of its expired Claimed lease as Uncertain, then the same Pending request of `kind` operator-decision is opened in the transaction that writes `RunControlService/AttemptOutcomeRecorded`, the run waits in WaitingForApproval, no new `RunControlService/Attempt` is dispatched for the step, and a repeated report or a second run of the reconciler opens no second request (SCN-RunControlService-008, FUX-07).",
        "AC3: Given the Pending operator decision and a caller whose roles satisfy its approver rule, who may be the member who requested the run, the act being audited (D121), when `RunControlService/DecideApproval` records the choice retry on the quoted version and proposal hash, then the request is Approved and keeps the `choice` retry, the run returns to Running through `OperatorChoseRetryOrCompensate`, a new attempt of the step is dispatched with `RunControlService/AttemptDispatched`, one more beyond `maxAttempts` when the declared maximum was reached, retry being open again on the operator decision that a later failure of the step opens (D121), and `RunControlService/ApprovalDecided` with the `proposalKind` operator-decision, the `choice` and the `stepRunId` plus `RunControlService/RunStateChanged` are written in the transaction of the decision; when the choice is compensate, then the request is Approved and the run returns to Running the same way, the step is settled Failed with `RunControlService/StepSettled` written in that transaction, and no new attempt of the step is dispatched (SCN-RunControlService-005, SCN-RunControlService-020).",
        "AC4: Given the Pending operator decision, when `RunControlService/DecideApproval` records the choice fail, then the request is Rejected and keeps the `choice` fail, the step is settled Failed and the run moves from WaitingForApproval to Failed through `OperatorChoseFailOrDecisionExpired`, with `RunControlService/ApprovalDecided`, `RunControlService/StepSettled`, `RunControlService/RunFailed` and `RunControlService/RunStateChanged` written in one transaction, `RunControlService/RunFailed` carrying the `failureClass` of the attempt that caused the request, which is uncertain for an Uncertain outcome; when instead its `expiresAt` passes and the `ApprovalExpiryReconciler` runs, then the request is Expired, the step and the run end the same way except that `RunControlService/RunFailed` carries the `failureClass` policy-denied, and no new request is opened whatever `onExpiry` and `reRequestsLeft` an approval policy would give (SCN-RunControlService-020, FR-06, D121).",
        "AC5: Given the Pending operator decision, when `RunControlService/DecideApproval` is called with an approve, a reject or a request-changes decision, then the response is 409; given a Pending request of `kind` approval, when a choice of retry, compensate or fail is submitted for it, then the response is 409; given a caller whose roles do not satisfy the approver rule of the operator decision, then the response is 403, and given an `approvalId` that is unknown or exists only in another tenant, then it is 404; in each case the request stays Pending, the run does not advance and nothing is published (SCN-RunControlService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2646",
        "AIFACTORY-TASK-2647",
        "AIFACTORY-TASK-2648",
        "AIFACTORY-TASK-2649",
        "AIFACTORY-TASK-2650"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5514,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "RunControlService/Run",
          "RunControlService/Step",
          "RunControlService/Attempt"
        ],
        "apis": [
          "RunControlService/DecideApproval",
          "RunControlService/ListApprovals",
          "RunControlService/RunControl.ReportAttemptOutcome"
        ],
        "events": [
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunStateChanged",
          "RunControlService/RunFailed",
          "RunControlService/StepSettled",
          "RunControlService/AttemptDispatched",
          "RunControlService/AttemptOutcomeRecorded",
          "WorkflowEngineService/StepReady"
        ],
        "descriptors": [
          "approval-decision-v1",
          "attempt-outcome-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "FR-10",
          "FUX-05",
          "FUX-07"
        ],
        "scenarios": [
          "SCN-RunControlService-005",
          "SCN-RunControlService-008",
          "SCN-RunControlService-019",
          "SCN-RunControlService-020"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list",
          "approval-card",
          "run-detail"
        ],
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-164",
        "AIFACTORY-US-165",
        "AIFACTORY-US-166",
        "AIFACTORY-US-167",
        "AIFACTORY-US-658",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-657]",
      "number": 657
    },
    {
      "id": "AIFACTORY-TASK-2646",
      "type": "task",
      "parent": "AIFACTORY-US-657",
      "title": "Operator decision opened by the outcome path for a terminal failure under Escalate and for an Uncertain outcome on a write step",
      "sequence": "01.05.14.01",
      "description": "Operator decision opened by the outcome path for a terminal failure under Escalate and for an Uncertain outcome on a write step. Expected output: The settlement of an attempt, in ReportAttemptOutcome, in the LeaseExpiryReconciler and in the terminal failure evaluation of AIFACTORY-TASK-888, opens one Pending ApprovalRequest of kind operator-decision per step when the step fails terminally under the failure policy Escalate or when the outcome is Uncertain on a step of class shared-write or above; the request names the run and the step, carries the outcome hash of the attempt as proposal hash and an approver rule that names the Operator of the project, and has no lease or fencing token; the run moves to WaitingForApproval through OperatorDecisionRequested and ApprovalRequested with the kind operator-decision, RunStateChanged and the RecoveryJournal entry are written in the transaction of the cause; the step is left unsettled and a repeated cause opens no second request; the tool invocation that an Uncertain outcome marks is kept on the request by AIFACTORY-TASK-3511 (D123).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The settlement of an attempt, in ReportAttemptOutcome, in the LeaseExpiryReconciler and in the terminal failure evaluation of AIFACTORY-TASK-888, opens one Pending ApprovalRequest of kind operator-decision per step when the step fails terminally under the failure policy Escalate or when the outcome is Uncertain on a step of class shared-write or above; the request names the run and the step, carries the outcome hash of the attempt as proposal hash and an approver rule that names the Operator of the project, and has no lease or fencing token; the run moves to WaitingForApproval through OperatorDecisionRequested and ApprovalRequested with the kind operator-decision, RunStateChanged and the RecoveryJournal entry are written in the transaction of the cause; the step is left unsettled and a repeated cause opens no second request; the tool invocation that an Uncertain outcome marks is kept on the request by AIFACTORY-TASK-3511 (D123)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5514,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2646]",
      "number": 2646
    },
    {
      "id": "AIFACTORY-TASK-2647",
      "type": "task",
      "parent": "AIFACTORY-US-657",
      "title": "Choices retry, compensate and fail of an operator decision in DecideApproval and its expiry in the ApprovalExpiryReconciler",
      "sequence": "01.05.14.02",
      "description": "Choices retry, compensate and fail of an operator decision in DecideApproval and its expiry in the ApprovalExpiryReconciler. Expected output: For a request of kind operator-decision DecideApproval accepts only the choices retry, compensate and fail from a caller whose roles satisfy its approver rule, the requester of the run not being excluded and the act being audited (D121), and keeps the choice on the request: retry ends it Approved, returns the run to Running through OperatorChoseRetryOrCompensate and has the RunDispatcher dispatch a new attempt of the step, one more beyond maxAttempts when the declared maximum was reached, and may be chosen again on a later operator decision of the step (D121); compensate ends it Approved, returns the run to Running and settles the step Failed; fail ends it Rejected, settles the step Failed and fails the run through OperatorChoseFailOrDecisionExpired with the failure class of the attempt that caused the request (D121); each writes ApprovalDecided with the proposal kind operator-decision, the choice and the stepRunId, RunStateChanged, StepSettled where the step is settled (AIFACTORY-TASK-2651) and RunFailed where the run fails, in one transaction; the ApprovalExpiryReconciler ends an expired operator decision Expired, settles the step Failed, fails the run through the same trigger with the failure class policy-denied (D121) and never re-requests it; the finding of a decision on an uncertain tool effect is delivered by AIFACTORY-TASK-2933 and AIFACTORY-TASK-2934.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "For a request of kind operator-decision DecideApproval accepts only the choices retry, compensate and fail from a caller whose roles satisfy its approver rule, the requester of the run not being excluded and the act being audited (D121), and keeps the choice on the request: retry ends it Approved, returns the run to Running through OperatorChoseRetryOrCompensate and has the RunDispatcher dispatch a new attempt of the step, one more beyond maxAttempts when the declared maximum was reached, and may be chosen again on a later operator decision of the step (D121); compensate ends it Approved, returns the run to Running and settles the step Failed; fail ends it Rejected, settles the step Failed and fails the run through OperatorChoseFailOrDecisionExpired with the failure class of the attempt that caused the request (D121); each writes ApprovalDecided with the proposal kind operator-decision, the choice and the stepRunId, RunStateChanged, StepSettled where the step is settled (AIFACTORY-TASK-2651) and RunFailed where the run fails, in one transaction; the ApprovalExpiryReconciler ends an expired operator decision Expired, settles the step Failed, fails the run through the same trigger with the failure class policy-denied (D121) and never re-requests it; the finding of a decision on an uncertain tool effect is delivered by AIFACTORY-TASK-2933 and AIFACTORY-TASK-2934."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5514,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2647]",
      "number": 2647
    },
    {
      "id": "AIFACTORY-TASK-2648",
      "type": "task",
      "parent": "AIFACTORY-US-657",
      "title": "Contract of the operator decision in the approval request, the approval decision and the two approval events",
      "sequence": "01.05.14.03",
      "description": "Contract of the operator decision in the approval request, the approval decision and the two approval events. Expected output: The contract documents of the service state, against docs/reference/schemas/approval.schema.json, that an ApprovalRequest carries kind approval or operator-decision and, for an operator decision, the choice retry, compensate or fail; that approval-decision-v1 takes approve, reject and request-changes for a request of kind approval and the three choices for one of kind operator-decision, every other pairing being answered 409; that ApprovalRequested carries the optional kind, whose absence means approval; and that ApprovalDecided carries the proposal kind operator-decision, the choice and the stepRunId for an operator decision; the finding of an operator decision on an uncertain tool effect is fixed by AIFACTORY-TASK-2932 (D121).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The contract documents of the service state, against docs/reference/schemas/approval.schema.json, that an ApprovalRequest carries kind approval or operator-decision and, for an operator decision, the choice retry, compensate or fail; that approval-decision-v1 takes approve, reject and request-changes for a request of kind approval and the three choices for one of kind operator-decision, every other pairing being answered 409; that ApprovalRequested carries the optional kind, whose absence means approval; and that ApprovalDecided carries the proposal kind operator-decision, the choice and the stepRunId for an operator decision; the finding of an operator decision on an uncertain tool effect is fixed by AIFACTORY-TASK-2932 (D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5514,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2648]",
      "number": 2648
    },
    {
      "id": "AIFACTORY-TASK-2649",
      "type": "task",
      "parent": "AIFACTORY-US-657",
      "title": "Acceptance fixture publishing StepReady with a failure policy and driving an attempt to a terminal failure or an Uncertain outcome",
      "sequence": "01.05.14.04",
      "description": "Acceptance fixture publishing StepReady with a failure policy and driving an attempt to a terminal failure or an Uncertain outcome. Expected output: The acceptance suite publishes StepReady through a fixture publisher with a stated failurePolicy, actionClass and idempotent flag and with the taskContractRef and taskContractHash the event carries (D121), and the fake runtime worker of AIFACTORY-TASK-871 reports a non-retriable Failed outcome, an Uncertain outcome or lets its lease expire under a controlled clock, so that the opening of an operator decision under Escalate and on a write step, each choice and the expiry are reproducible without WorkflowEngineService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite publishes StepReady through a fixture publisher with a stated failurePolicy, actionClass and idempotent flag and with the taskContractRef and taskContractHash the event carries (D121), and the fake runtime worker of AIFACTORY-TASK-871 reports a non-retriable Failed outcome, an Uncertain outcome or lets its lease expire under a controlled clock, so that the opening of an operator decision under Escalate and on a write step, each choice and the expiry are reproducible without WorkflowEngineService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5514,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2649]",
      "number": 2649
    },
    {
      "id": "AIFACTORY-TASK-2650",
      "type": "task",
      "parent": "AIFACTORY-US-657",
      "title": "Verify decide-a-failed-or-uncertain-step-as-operator through the acceptance suite",
      "sequence": "01.05.14.05",
      "description": "Verify decide-a-failed-or-uncertain-step-as-operator through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Area=OperatorDecision&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-008|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-657 with the fixture of AIFACTORY-TASK-2649, including the request opened under Escalate and for an Uncertain outcome reported by the holder and set by the reconciler, the step left unsettled while the request is Pending, the new attempt after retry, dispatched beyond maxAttempts and chosen a second time on the next operator decision of the step, the settled step after compensate, the failed run after fail, with the failure class of the causing attempt, and after the expiry without a re-request, with the failure class policy-denied, the operator decision taken by the member who requested the run, the 409 of a decision that does not fit the kind of the request, the 403 and the 404, and the payload of ApprovalRequested with its kind and of ApprovalDecided with the choice and the stepRunId; the compensation is proven by the suite of WorkflowEngineService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Area=OperatorDecision&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-008|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-657 with the fixture of AIFACTORY-TASK-2649, including the request opened under Escalate and for an Uncertain outcome reported by the holder and set by the reconciler, the step left unsettled while the request is Pending, the new attempt after retry, dispatched beyond maxAttempts and chosen a second time on the next operator decision of the step, the settled step after compensate, the failed run after fail, with the failure class of the causing attempt, and after the expiry without a re-request, with the failure class policy-denied, the operator decision taken by the member who requested the run, the 409 of a decision that does not fit the kind of the request, the 403 and the 404, and the payload of ApprovalRequested with its kind and of ApprovalDecided with the choice and the stepRunId; the compensation is proven by the suite of WorkflowEngineService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5514,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2650]",
      "number": 2650
    },
    {
      "id": "AIFACTORY-US-658",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Announce once that a step reached its final state, with the step run of the engine, the step id, the number of attempts, the failure class and the output reference",
      "sequence": "01.05.15",
      "description": "WorkflowEngineService plans a run and RunControlService executes its steps, so the engine has to learn when a step is over. An attempt outcome does not tell it: a failed attempt may be retried, an exhausted one fails the step, an Uncertain one waits for a person, and the rule that tells these apart lives in RunControlService alone. The owner decided that RunControlService says it explicitly (D119): the event `RunControlService/StepSettled` announces that a step reached its final state, and the engine treats no step as settled before it and holds no retry rule of its own. The event is written once per step, in the transaction that moves the `Step` to its final state, Succeeded, Failed, Skipped or Cancelled, whichever path makes that move: the report of a Succeeded attempt by the lease holder through `RunControl.ReportAttemptOutcome`, the terminal failure of a non-retriable or exhausted attempt found after a report or by the `LeaseExpiryReconciler` (AIFACTORY-US-167), or the choice compensate or fail of the Operator and the expiry of an operator decision (AIFACTORY-US-657). A step that ends Skipped or Cancelled is announced the same way with that final state. The payload carries `runId`, `tenantId`, the `stepRunId`, the `finalState`, the `attemptCount` and, when the final state is Failed, the `failureClass` of the last attempt of the step. It carries as well the `stepId` of RunControlService and, for a step whose settling attempt reported an output, the `outputRef` of that attempt, the reference of the output in ArtifactService; `outputRef` is absent when the step settled without an output (D121). `stepRunId` is the step run id of the engine: `CreateStepAndDispatch` keeps it on the `Step` when it creates the step from `StepReady` (AIFACTORY-US-163), and it is the key by which the engine finds its step run; the `stepId` beside it is the id under which RunControlService and the attempt events name the same step. A step that is not final writes nothing. An attempt that Failed and is retried, an attempt whose lease expired unclaimed and is dispatched again, and a step whose terminal failure or Uncertain outcome opened an operator decision that is still Pending all leave the step open, and the choice retry keeps it open with a new attempt. A step is settled once: its final state refuses every later transition, a duplicate report or a redelivered cause writes no second event, and the outbox record belongs to the transaction of the transition, so that neither an event without a settled step nor a settled step without an event can exist. The event is published on `run-control.steps.v1.step-settled` under the canonical envelope by the dispatcher of the `run-control` messaging profile; WorkflowEngineService records the final state of the step run and applies the failure policy of a step settled Failed through its handler `ApplyStepSettled` in its own PBI. For a failed step the event is all that RunControlService does: it settles the step and does not fail the run, the engine applies the failure policy, Fail or Compensate, and reports `WorkflowRunFailed`, and the run fails on that report (AIFACTORY-US-167, D121). `AttemptOutcomeRecorded` keeps being published for every attempt and keeps its other consumers; it no longer tells the engine that a step is over. Kind: behavior. Traces: services: RunControlService, WorkflowEngineService; aggregates: RunControlService/Step, RunControlService/Attempt; apis: RunControlService/RunControl.ReportAttemptOutcome; events: RunControlService/StepSettled, RunControlService/AttemptOutcomeRecorded, WorkflowEngineService/StepReady; adrs: ADR-0012, ADR-0014; requirements: FR-03, FR-10; scenarios: SCN-RunControlService-023. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-163, AIFACTORY-US-164, AIFACTORY-US-167, feature:workflow-engine-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a Running run and a dispatched `RunControlService/Step` that keeps the `stepRunId` of `WorkflowEngineService/StepReady`, when its attempt is reported Succeeded through `RunControlService/RunControl.ReportAttemptOutcome`, then the step is Succeeded and the `RunControlService/StepSettled` outbox record with `runId`, `tenantId`, that `stepRunId`, the `stepId` of the step, the `finalState` Succeeded, the `attemptCount`, no `failureClass` and, when the settling attempt reported an output with its outcome, the `outputRef` of that attempt is written in the transaction of the report, beside `RunControlService/AttemptOutcomeRecorded` (SCN-RunControlService-023, ADR-0014, D121).",
        "AC2: Given a step under a failure policy other than Escalate whose second attempt fails terminally, when the step moves to Failed, then `RunControlService/StepSettled` with the `finalState` Failed, the `attemptCount` 2 and the `failureClass` of that last attempt is written in the transaction that fails the step, and that transaction does not fail the run, which stays Running until the engine reports its failure (D121); given a Failed attempt that is retried, an attempt whose lease expired unclaimed and is dispatched again, or a step with a Pending operator decision, then no `RunControlService/StepSettled` is written while the step is open (SCN-RunControlService-023, FR-10).",
        "AC3: Given a settled step, when the outcome report is repeated, its cause is redelivered or the evaluation runs again, then no second `RunControlService/StepSettled` is written and the step keeps its final state; given a Pending operator decision on a step, when the Operator chooses compensate or fail or the request expires, then the step is settled Failed and exactly one `RunControlService/StepSettled` is written in the transaction of that decision, and when the Operator chooses retry, then none is written (SCN-RunControlService-023).",
        "AC4: Given the record was written, when the outbox dispatcher of the `run-control` messaging profile publishes `RunControlService/StepSettled` on `run-control.steps.v1.step-settled`, then the event is sent under the canonical envelope with `runId`, `tenantId`, `stepRunId`, `stepId`, `finalState`, `attemptCount`, for a Failed step `failureClass` and, for a step whose settling attempt reported an output, `outputRef` (D121), and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-023, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2651",
        "AIFACTORY-TASK-2652",
        "AIFACTORY-TASK-2653"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5515,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "RunControlService/Step",
          "RunControlService/Attempt"
        ],
        "apis": [
          "RunControlService/RunControl.ReportAttemptOutcome"
        ],
        "events": [
          "RunControlService/StepSettled",
          "RunControlService/AttemptOutcomeRecorded",
          "WorkflowEngineService/StepReady"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-03",
          "FR-10"
        ],
        "scenarios": [
          "SCN-RunControlService-023"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-163",
        "AIFACTORY-US-164",
        "AIFACTORY-US-167",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-658]",
      "number": 658
    },
    {
      "id": "AIFACTORY-TASK-2651",
      "type": "task",
      "parent": "AIFACTORY-US-658",
      "title": "StepSettled written in the transaction that moves a step to its final state",
      "sequence": "01.05.15.01",
      "description": "StepSettled written in the transaction that moves a step to its final state. Expected output: Every path that moves a Step to Succeeded, Failed, Skipped or Cancelled, that is the report of a Succeeded attempt, the terminal failure of AIFACTORY-TASK-888, the choice compensate or fail and the expiry of an operator decision (AIFACTORY-TASK-2647) and the settlement of a step as Skipped or Cancelled, writes the StepSettled outbox record in the same transaction with runId, tenantId, the stepRunId the step keeps from StepReady, the stepId of the step, the final state, the number of attempts, for a Failed step the failure class of its last attempt and, for a step whose settling attempt reported an output, the outputRef of that attempt (D121); a step that stays open writes none, and a final step refuses a later transition, so the record is written once per step.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Every path that moves a Step to Succeeded, Failed, Skipped or Cancelled, that is the report of a Succeeded attempt, the terminal failure of AIFACTORY-TASK-888, the choice compensate or fail and the expiry of an operator decision (AIFACTORY-TASK-2647) and the settlement of a step as Skipped or Cancelled, writes the StepSettled outbox record in the same transaction with runId, tenantId, the stepRunId the step keeps from StepReady, the stepId of the step, the final state, the number of attempts, for a Failed step the failure class of its last attempt and, for a step whose settling attempt reported an output, the outputRef of that attempt (D121); a step that stays open writes none, and a final step refuses a later transition, so the record is written once per step."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5515,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2651]",
      "number": 2651
    },
    {
      "id": "AIFACTORY-TASK-2652",
      "type": "task",
      "parent": "AIFACTORY-US-658",
      "title": "Contract of the StepSettled event against the canonical envelope",
      "sequence": "01.05.15.02",
      "description": "Contract of the StepSettled event against the canonical envelope. Expected output: A golden file fixes StepSettled on the topic run-control.steps.v1.step-settled under the canonical envelope with the payload fields runId, tenantId, stepRunId, stepId, finalState, attemptCount and the optional failureClass and outputRef of model/services/control-plane/RunControlService.yaml (D121), and a contract test fails when the serialised event differs from the file, lacks the stepId or carries a failureClass for a final state other than Failed.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "A golden file fixes StepSettled on the topic run-control.steps.v1.step-settled under the canonical envelope with the payload fields runId, tenantId, stepRunId, stepId, finalState, attemptCount and the optional failureClass and outputRef of model/services/control-plane/RunControlService.yaml (D121), and a contract test fails when the serialised event differs from the file, lacks the stepId or carries a failureClass for a final state other than Failed."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5515,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2652]",
      "number": 2652
    },
    {
      "id": "AIFACTORY-TASK-2653",
      "type": "task",
      "parent": "AIFACTORY-US-658",
      "title": "Verify announce-a-settled-step through the acceptance suite",
      "sequence": "01.05.15.03",
      "description": "Verify announce-a-settled-step through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-023\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-658 with the fixtures of AIFACTORY-TASK-871 and AIFACTORY-TASK-2649, including the event of a Succeeded step with its stepId and with the outputRef of the settling attempt, of a step Failed after two attempts with its failure class while the run stays Running, no event for a retried attempt, for a lease dispatched again and for a step with a Pending operator decision, one event after the choice compensate and after the choice fail, none after retry, no second event for a repeated report, and the publication and payload of StepSettled; the handling of the event is proven by the suite of WorkflowEngineService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-023\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-658 with the fixtures of AIFACTORY-TASK-871 and AIFACTORY-TASK-2649, including the event of a Succeeded step with its stepId and with the outputRef of the settling attempt, of a step Failed after two attempts with its failure class while the run stays Running, no event for a retried attempt, for a lease dispatched again and for a step with a Pending operator decision, one event after the choice compensate and after the choice fail, none after retry, no second event for a repeated report, and the publication and payload of StepSettled; the handling of the event is proven by the suite of WorkflowEngineService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5515,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2653]",
      "number": 2653
    },
    {
      "id": "AIFACTORY-US-726",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Take the finding of the Operator on an uncertain tool effect with the operator decision, refuse a retry unless the effect was not applied, and record the finding in ToolAdapterService",
      "sequence": "01.05.16",
      "description": "As an operator, I want to state, when I decide a step whose tool call ended with an uncertain effect, whether that effect was applied, and to be refused a retry unless it was not, so that a write is never repeated on top of an effect that already happened, and the tool service learns my finding without my acting in it. An Uncertain outcome on a step that writes often comes from a tool call whose effect could not be confirmed: ToolAdapterService settled the invocation Uncertain, the attempt ended Uncertain, waited for nothing, and RunControlService opened an operator decision for the Operator of the project (AIFACTORY-US-657). The outcome of such an attempt marks the tool invocation whose effect is uncertain, in the optional member `uncertainToolInvocationId` of `attempt-outcome-v1`, and the `ApprovalRequest` that RunControlService opens for it keeps that id in its own `uncertainToolInvocationId`; a request that keeps the id is the operator decision on an uncertain tool effect, and every other request keeps none (D123). The owner decided that the Operator judges the effect in one place, the operator decision of the run, and that no operator acts in the tool service directly (D121). The decision of an operator decision that an Uncertain outcome of a tool call caused therefore carries, in `approval-decision-v1`, a `finding` beside the choice: applied, when the Operator found from the tool receipt and the external evidence that the effect happened, or not-applied, when it did not. `RunControlService/DecideApproval` keeps the finding on the `ApprovalRequest`, in the field `finding` beside `choice`, and `ApprovalDecided` carries it. A decision on such a request always states a finding: a decision that carries none, whatever its choice, retry, compensate or fail, is answered 400, the request stays Pending and nothing is recorded (D123). The finding limits the choice. The choice retry is accepted only with the finding not-applied, because a retry repeats the write: a retry with the finding applied is answered 409, the request stays Pending and the run keeps waiting. The choices compensate and fail are taken with either finding, and every accepted choice does to the step and to the run what AIFACTORY-US-657 states. As part of the same act RunControlService records the finding in ToolAdapterService through `ToolAdapterService/ConfirmToolEffect`, the internal operation that takes the finding for one invocation under the scope `factory.tools.operate`, and it calls it for the invocation the request keeps in `uncertainToolInvocationId`; there the finding applied moves the Uncertain invocation to Observed and the finding not-applied moves it to Failed, in the PBIs of ToolAdapterService. RunControlService sends the call with a workload token that holds `factory.tools.operate` and names the Operator who decided as the user it acts for (D123). ToolAdapterService is a required fail-fast dependency of this act: when it does not answer the call, `DecideApproval` answers 503 and records nothing, so the request stays Pending with no choice and no finding, the run keeps waiting, no event is published and the Operator takes the decision again; the decision and the finding therefore never diverge (D123). ToolAdapterService answers a repeated `ConfirmToolEffect` with the same finding as it answered the first, so a decision taken again with the same finding after an unanswered call is recorded; when it answers 409, because the invocation already keeps another finding, `DecideApproval` answers 409 and records nothing, and the request stays Pending (D125). A refused decision records nothing there. An operator decision whose request keeps no invocation id, as the one opened for a terminal failure under the failure policy Escalate or for an Uncertain outcome that marks no tool invocation, takes no finding: its choices are not limited, `ApprovalDecided` carries none and ToolAdapterService is not called, and a decision on it that supplies a finding is answered 400 and records nothing (D125). The authority, the version and the proposal hash rules of the decision are those of AIFACTORY-US-166 and AIFACTORY-US-657, the requester of the run being allowed to take the operator decision. Kind: behavior. Traces: services: RunControlService, ToolAdapterService; aggregates: RunControlService/ApprovalRequest, RunControlService/Run, RunControlService/Step; apis: RunControlService/DecideApproval, RunControlService/RunControl.ReportAttemptOutcome, ToolAdapterService/ConfirmToolEffect; events: RunControlService/ApprovalDecided, RunControlService/RunStateChanged; descriptors: approval-decision-v1, attempt-outcome-v1; adrs: ADR-0012, ADR-0014; requirements: FR-06, FUX-05, FUX-07; scenarios: SCN-RunControlService-005, SCN-RunControlService-008, SCN-RunControlService-020. Relates: screens: approval-card; nfrs: NFR-04. Depends on: AIFACTORY-US-166, AIFACTORY-US-657, feature:tool-adapter-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/reference/schemas/approval.schema.json, docs/reference/schemas/attempt-outcome.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a Running run and a `RunControlService/Step` whose `sideEffectClass` is shared-write or above, when `RunControlService/RunControl.ReportAttemptOutcome` records an Uncertain outcome whose `attempt-outcome-v1` marks a tool invocation in `uncertainToolInvocationId`, then the Pending `RunControlService/ApprovalRequest` of `kind` operator-decision that is opened for the outcome keeps that id in `uncertainToolInvocationId`; given an Uncertain outcome that marks no tool invocation, or a terminal failure under the failure policy Escalate, then the request that is opened keeps none (SCN-RunControlService-008, D123).",
        "AC2: Given a Pending `RunControlService/ApprovalRequest` of `kind` operator-decision that keeps an `uncertainToolInvocationId` and a caller whose roles satisfy its approver rule, when `RunControlService/DecideApproval` records the choice retry with the finding not-applied on the quoted version and proposal hash, then the response is 200, the request is Approved and keeps the `choice` retry and the `finding` not-applied, the run returns to Running with a new attempt of the step, the finding is recorded through `ToolAdapterService/ConfirmToolEffect` for the invocation the request keeps, under a workload token that holds `factory.tools.operate` and names the Operator who decided as the user it acts for (D123), and `RunControlService/ApprovalDecided` with the `choice`, the `stepRunId` and the `finding` plus `RunControlService/RunStateChanged` are written in the transaction of the decision; when the choice compensate or the choice fail is recorded with the finding applied or with the finding not-applied, then the choice is applied as for any operator decision, the request keeps the `finding`, it is recorded through `ToolAdapterService/ConfirmToolEffect` the same way, and `RunControlService/ApprovalDecided` carries it beside the `choice` (SCN-RunControlService-005, SCN-RunControlService-020, D121).",
        "AC3: Given the same Pending request, when a decision that carries no finding is submitted to `RunControlService/DecideApproval` with the choice retry, compensate or fail, then the response is 400 with a problem response (D123); when the choice retry is submitted with the finding applied, then the response is 409; and when a decision that would be accepted is submitted while ToolAdapterService does not answer the call of `ToolAdapterService/ConfirmToolEffect`, then the response is 503 (D123); in each case the request stays Pending without a `choice` and without a `finding`, the run stays WaitingForApproval, no attempt is dispatched and nothing is published, `ToolAdapterService/ConfirmToolEffect` is not called for the 400 and for the 409, and the decision that was answered 503 is accepted when the Operator takes it again once ToolAdapterService answers (SCN-RunControlService-005, FUX-07).",
        "AC4: Given a Pending operator decision that keeps no `uncertainToolInvocationId`, as the one a terminal failure under the failure policy Escalate caused, when `RunControlService/DecideApproval` records the choice retry without a finding, then the choice is accepted, `RunControlService/ApprovalDecided` carries no `finding` and `ToolAdapterService/ConfirmToolEffect` is not called, while the same decision supplying a finding is answered 400 and records nothing (D125); and given a decision on an uncertain tool effect taken again with the same finding after an unanswered call, then it is recorded, while a `ToolAdapterService/ConfirmToolEffect` answered 409 because the invocation keeps another finding makes `RunControlService/DecideApproval` answer 409 with the request left Pending (SCN-RunControlService-005, SCN-RunControlService-020, FR-06, D125).",
        "AC5: Given the decision of AC1 or AC3 was recorded, when the outbox dispatcher publishes `RunControlService/ApprovalDecided` on `run-control.approvals.v1.approval-decided`, then the event is sent under the canonical envelope with `approvalId`, `runId`, `tenantId`, `state`, `projectId`, the `proposalKind` operator-decision, `proposalHash`, the `choice`, the `stepRunId` and the `finding`, applied or not-applied, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RunControlService-020, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/attempt-outcome.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2932",
        "AIFACTORY-TASK-2933",
        "AIFACTORY-TASK-3511",
        "AIFACTORY-TASK-2934",
        "AIFACTORY-TASK-2935",
        "AIFACTORY-TASK-2936"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5516,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "RunControlService/Run",
          "RunControlService/Step"
        ],
        "apis": [
          "RunControlService/DecideApproval",
          "RunControlService/RunControl.ReportAttemptOutcome",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "RunControlService/ApprovalDecided",
          "RunControlService/RunStateChanged"
        ],
        "descriptors": [
          "approval-decision-v1",
          "attempt-outcome-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "FUX-07"
        ],
        "scenarios": [
          "SCN-RunControlService-005",
          "SCN-RunControlService-008",
          "SCN-RunControlService-020"
        ]
      },
      "relates": {
        "screens": [
          "approval-card"
        ],
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-166",
        "AIFACTORY-US-657",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/attempt-outcome.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-726]",
      "number": 726
    },
    {
      "id": "AIFACTORY-TASK-2932",
      "type": "task",
      "parent": "AIFACTORY-US-726",
      "title": "Contract of the finding in the approval decision, the approval request and ApprovalDecided",
      "sequence": "01.05.16.01",
      "description": "Contract of the finding in the approval decision, the approval request and ApprovalDecided. Expected output: The contract documents of the service state, against docs/reference/schemas/approval.schema.json, that approval-decision-v1 carries the finding applied or not-applied for an operator decision that an Uncertain outcome of a tool call caused, that the ApprovalRequest keeps it in the field finding, that ApprovalDecided carries the optional finding for such a decision and none otherwise, and that the choice retry with the finding applied is answered 409 (D121); they state as well, against docs/reference/schemas/attempt-outcome.schema.json, that attempt-outcome-v1 carries the optional uncertainToolInvocationId on an Uncertain outcome, that the ApprovalRequest keeps it in the field uncertainToolInvocationId, that DecideApproval answers 400 for a decision without a finding on a request that keeps it, and that it answers 503 and records nothing when ToolAdapterService does not answer the call of ConfirmToolEffect (D123); a golden file fixes ApprovalDecided with and without the finding.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The contract documents of the service state, against docs/reference/schemas/approval.schema.json, that approval-decision-v1 carries the finding applied or not-applied for an operator decision that an Uncertain outcome of a tool call caused, that the ApprovalRequest keeps it in the field finding, that ApprovalDecided carries the optional finding for such a decision and none otherwise, and that the choice retry with the finding applied is answered 409 (D121); they state as well, against docs/reference/schemas/attempt-outcome.schema.json, that attempt-outcome-v1 carries the optional uncertainToolInvocationId on an Uncertain outcome, that the ApprovalRequest keeps it in the field uncertainToolInvocationId, that DecideApproval answers 400 for a decision without a finding on a request that keeps it, and that it answers 503 and records nothing when ToolAdapterService does not answer the call of ConfirmToolEffect (D123); a golden file fixes ApprovalDecided with and without the finding."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5516,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2932]",
      "number": 2932
    },
    {
      "id": "AIFACTORY-TASK-2933",
      "type": "task",
      "parent": "AIFACTORY-US-726",
      "title": "Finding of the Operator in DecideApproval with the retry rule and the Finding column of ApprovalRequests",
      "sequence": "01.05.16.02",
      "description": "Finding of the Operator in DecideApproval with the retry rule and the Finding column of ApprovalRequests. Expected output: For an operator decision on an uncertain tool effect, the request that keeps an uncertainToolInvocationId, DecideApproval takes the finding of approval-decision-v1 beside the choice, answers a decision without a finding with 400 whatever its choice (D123), answers the choice retry with the finding applied with 409 and leaves the request Pending in both cases, keeps the finding of an accepted decision on the ApprovalRequest, mapped to the nullable column Finding of the table ApprovalRequests, and writes it to ApprovalDecided in the transaction of the decision; an operator decision whose request keeps no invocation id takes no finding, its choices are not limited, and a decision on it that supplies a finding is answered 400 (D125); unit tests cover each choice against each finding and against a missing one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "For an operator decision on an uncertain tool effect, the request that keeps an uncertainToolInvocationId, DecideApproval takes the finding of approval-decision-v1 beside the choice, answers a decision without a finding with 400 whatever its choice (D123), answers the choice retry with the finding applied with 409 and leaves the request Pending in both cases, keeps the finding of an accepted decision on the ApprovalRequest, mapped to the nullable column Finding of the table ApprovalRequests, and writes it to ApprovalDecided in the transaction of the decision; an operator decision whose request keeps no invocation id takes no finding, its choices are not limited, and a decision on it that supplies a finding is answered 400 (D125); unit tests cover each choice against each finding and against a missing one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5516,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2933]",
      "number": 2933
    },
    {
      "id": "AIFACTORY-TASK-3511",
      "type": "task",
      "parent": "AIFACTORY-US-726",
      "title": "Invocation id of the uncertain tool effect kept on the operator decision, with the UncertainToolInvocationId column of ApprovalRequests",
      "sequence": "01.05.16.03",
      "description": "Invocation id of the uncertain tool effect kept on the operator decision, with the UncertainToolInvocationId column of ApprovalRequests. Expected output: ReportAttemptOutcome reads the optional uncertainToolInvocationId of attempt-outcome-v1 on an Uncertain outcome, and the operator decision that the outcome opens (AIFACTORY-TASK-2646) keeps it on the ApprovalRequest in the field uncertainToolInvocationId, mapped to the nullable column UncertainToolInvocationId of the table ApprovalRequests (D123); a request opened for an Uncertain outcome that marks no invocation, for a terminal failure under the failure policy Escalate, or for any approval keeps none; the id is the one the call of ConfirmToolEffect of AIFACTORY-TASK-2934 names; unit tests cover the outcome with and without the marker.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "ReportAttemptOutcome reads the optional uncertainToolInvocationId of attempt-outcome-v1 on an Uncertain outcome, and the operator decision that the outcome opens (AIFACTORY-TASK-2646) keeps it on the ApprovalRequest in the field uncertainToolInvocationId, mapped to the nullable column UncertainToolInvocationId of the table ApprovalRequests (D123); a request opened for an Uncertain outcome that marks no invocation, for a terminal failure under the failure policy Escalate, or for any approval keeps none; the id is the one the call of ConfirmToolEffect of AIFACTORY-TASK-2934 names; unit tests cover the outcome with and without the marker."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5516,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3511]",
      "number": 3511
    },
    {
      "id": "AIFACTORY-TASK-2934",
      "type": "task",
      "parent": "AIFACTORY-US-726",
      "title": "Typed client of ConfirmToolEffect recording the finding in ToolAdapterService as part of the decision",
      "sequence": "01.05.16.04",
      "description": "Typed client of ConfirmToolEffect recording the finding in ToolAdapterService as part of the decision. Expected output: DecideApproval records the finding of an accepted decision through a typed client of ConfirmToolEffect of ToolAdapterService, called with a workload token that holds factory.tools.operate and names the Operator who decided as the user it acts for (D123), and with the finding applied or not-applied and the reason of the decision for the invocation the request keeps in uncertainToolInvocationId (AIFACTORY-TASK-3511); a refused decision and an operator decision whose request keeps no invocation id call nothing; the call belongs to the act of the decision and is answered before the decision is committed: when ToolAdapterService does not answer it, DecideApproval answers 503 with a problem response and records nothing, so the request stays Pending with no choice and no finding, no event is written and the same decision can be taken again (D123); the repeat relies on the natural idempotency of ConfirmToolEffect, which answers a repeated call with the same finding as the first, and a 409 of ConfirmToolEffect, the answer for another finding than the one the invocation keeps, is returned by DecideApproval as 409 with nothing recorded (D125).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "DecideApproval records the finding of an accepted decision through a typed client of ConfirmToolEffect of ToolAdapterService, called with a workload token that holds factory.tools.operate and names the Operator who decided as the user it acts for (D123), and with the finding applied or not-applied and the reason of the decision for the invocation the request keeps in uncertainToolInvocationId (AIFACTORY-TASK-3511); a refused decision and an operator decision whose request keeps no invocation id call nothing; the call belongs to the act of the decision and is answered before the decision is committed: when ToolAdapterService does not answer it, DecideApproval answers 503 with a problem response and records nothing, so the request stays Pending with no choice and no finding, no event is written and the same decision can be taken again (D123); the repeat relies on the natural idempotency of ConfirmToolEffect, which answers a repeated call with the same finding as the first, and a 409 of ConfirmToolEffect, the answer for another finding than the one the invocation keeps, is returned by DecideApproval as 409 with nothing recorded (D125)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5516,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2934]",
      "number": 2934
    },
    {
      "id": "AIFACTORY-TASK-2935",
      "type": "task",
      "parent": "AIFACTORY-US-726",
      "title": "Acceptance fixture of a fake ConfirmToolEffect endpoint and of an operator decision on an uncertain tool effect",
      "sequence": "01.05.16.05",
      "description": "Acceptance fixture of a fake ConfirmToolEffect endpoint and of an operator decision on an uncertain tool effect. Expected output: The acceptance suite hosts a fake ConfirmToolEffect endpoint that records the invocation id, the finding and the token of every call, with the user the token names, and that can be stopped so that it does not answer; on the fixture of AIFACTORY-TASK-2649 the fake runtime worker reports an Uncertain outcome whose attempt-outcome-v1 marks one tool invocation in uncertainToolInvocationId, and one that marks none, so that the id kept on the request, the finding kept on the request, the refused decisions, the 503 of an unanswered call and the call to ToolAdapterService are reproducible without ToolAdapterService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite hosts a fake ConfirmToolEffect endpoint that records the invocation id, the finding and the token of every call, with the user the token names, and that can be stopped so that it does not answer; on the fixture of AIFACTORY-TASK-2649 the fake runtime worker reports an Uncertain outcome whose attempt-outcome-v1 marks one tool invocation in uncertainToolInvocationId, and one that marks none, so that the id kept on the request, the finding kept on the request, the refused decisions, the 503 of an unanswered call and the call to ToolAdapterService are reproducible without ToolAdapterService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5516,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2935]",
      "number": 2935
    },
    {
      "id": "AIFACTORY-TASK-2936",
      "type": "task",
      "parent": "AIFACTORY-US-726",
      "title": "Verify record-operator-finding-on-uncertain-tool-effect through the acceptance suite",
      "sequence": "01.05.16.06",
      "description": "Verify record-operator-finding-on-uncertain-tool-effect through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Area=OperatorFinding&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-008|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-726 with the fixture of AIFACTORY-TASK-2935, including the invocation id that an Uncertain outcome marks kept on the operator decision and none kept for an outcome without the marker, the retry accepted with the finding not-applied, the retry answered 409 with the finding applied, the 400 for retry, compensate and fail without a finding, compensate and fail with either finding, the finding kept on the request and carried by ApprovalDecided, the call to ConfirmToolEffect recorded once for an accepted decision, for the invocation the request keeps and under a workload token that names the Operator who decided, and never for a refused one, the 503 with the fake stopped, after which the request is still Pending with no choice and no finding and no event was written, the same decision accepted once the fake answers again, the 409 returned when the fake answers 409 for another finding, and the operator decision under Escalate that takes no finding and answers 400 when one is supplied (D125); the settlement of the invocation is proven by the suite of ToolAdapterService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Area=OperatorFinding&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-008|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-726 with the fixture of AIFACTORY-TASK-2935, including the invocation id that an Uncertain outcome marks kept on the operator decision and none kept for an outcome without the marker, the retry accepted with the finding not-applied, the retry answered 409 with the finding applied, the 400 for retry, compensate and fail without a finding, compensate and fail with either finding, the finding kept on the request and carried by ApprovalDecided, the call to ConfirmToolEffect recorded once for an accepted decision, for the invocation the request keeps and under a workload token that names the Operator who decided, and never for a refused one, the 503 with the fake stopped, after which the request is still Pending with no choice and no finding and no event was written, the same decision accepted once the fake answers again, the 409 returned when the fake answers 409 for another finding, and the operator decision under Escalate that takes no finding and answers 400 when one is supplied (D125); the settlement of the invocation is proven by the suite of ToolAdapterService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5516,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2936]",
      "number": 2936
    },
    {
      "id": "AIFACTORY-US-1491",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Answer the input or the escalation choice a waiting attempt asks for through the public route of Run Control and pass it to the attempt",
      "sequence": "01.05.17",
      "description": "As a member of the project who follows a run, I want to give the missing input or the escalation choice an agent asks for while its attempt waits, so that the attempt resumes on my answer without anyone calling the runtime directly. An attempt can stop inside its loop for a person in two cases that are no approval: the task lacks an input the requester holds, or the agent lays options before a human with a recommendation; AgentRuntimeService then keeps a decision request of kind Input or Escalation and the attempt waits in WaitingForDecision (AIFACTORY-US-466 of feature `agent-runtime-service`). The owner decided how a person answers it (D137): RunControlService has a public route, `RunControlService/AnswerDecision`, on `POST /factory/runs/{runId}/decisions/{decisionId}/answer`, which the Studio and the CLI call behind ControlPlaneApi with the user token of a member whose scope carries `factory.runs.operate`. The body names the answer, the input or the chosen option. The service looks the run up under the tenant row filter and the projects in the trusted scope, takes its open attempt and passes the answer to it through `AgentRuntimeService/Runtime.AnswerDecision` with the attempt, the decision and the answer, under its workload identity; the reply of the runtime decides the answer of the route. When the runtime acknowledges, the route answers 200; the decision request is answered and the attempt returns to Running in AgentRuntimeService, which announces it in its own PBI. RunControlService writes no state of its own for the answer and publishes no event, and the run keeps its state, because an attempt that waits for a decision of this kind keeps its lease and its run stays Running. The route is naturally idempotent: the same answer repeated for a decision already answered is acknowledged by the runtime without a second effect and answered 200 again, while another answer for a decision already answered is answered 409. An approval is never answered here: the decision of an approval goes through `RunControlService/DecideApproval` and reaches the attempt through `ApprovalDecided` (D137), so a decision of kind Approval named on this route is answered 409 and nothing is passed on. A run outside the trusted scope, a run of another tenant, a run without an open attempt and a decision the open attempt did not ask for are answered 404, the run of another tenant with the same answer as a run that does not exist (ADR-0015). A body without an answer is answered 400, and a caller without `factory.runs.operate` is answered 403. AgentRuntimeService is a required fail-fast dependency of the route: when it does not answer, the route answers 503 with a problem response that names it and records nothing, and the member answers again. No refusal changes state anywhere. Kind: behavior. Traces: services: RunControlService, AgentRuntimeService; aggregates: RunControlService/Run, RunControlService/Attempt; apis: RunControlService/AnswerDecision, RunControlService/DecideApproval, AgentRuntimeService/Runtime.AnswerDecision; adrs: ADR-0014, ADR-0015; requirements: FR-06, FUX-07; scenarios: SCN-RunControlService-024. Relates: screens: run-detail; nfrs: NFR-04. Depends on: AIFACTORY-US-163, feature:agent-runtime-service, feature:control-plane-api. Sources: model/services/control-plane/RunControlService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/planes/control/services/run-control-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Running run in the trusted scope whose open attempt waits for a decision of kind Input or Escalation and a member whose scope carries `factory.runs.operate`, when `RunControlService/AnswerDecision` is called with the answer, then `AgentRuntimeService/Runtime.AnswerDecision` is called once with the attempt, the decision and the answer under the workload identity of RunControlService, the response is 200 once the runtime acknowledged, the `RunControlService/Run` keeps its state and RunControlService writes no row and no outbox record for the answer (SCN-RunControlService-024, D137).",
        "AC2: Given the same answer repeated for the decision of AC1, when `RunControlService/AnswerDecision` is called again, then the response is 200 and the runtime applies nothing a second time; given another answer for that decision, then the response is 409; given a decision of kind Approval named on the route, then the response is 409, `AgentRuntimeService/Runtime.AnswerDecision` is not called, and the approval stays to be decided through `RunControlService/DecideApproval` (SCN-RunControlService-024, D137).",
        "AC3: Given a run of another tenant, a run outside the projects of the trusted scope, a run without an open attempt or a decision the open attempt did not ask for, when `RunControlService/AnswerDecision` is called, then the response is 404, the foreign run answered like a run that does not exist; given a body without an answer, then 400, and given a caller without `factory.runs.operate`, then 403; in each case nothing is passed to the attempt and no state changes (SCN-RunControlService-024, ADR-0015).",
        "AC4: Given AgentRuntimeService does not answer, when `RunControlService/AnswerDecision` is called with an answer that would be accepted, then the response is 503 with a problem response that names AgentRuntimeService, nothing is recorded, the attempt still waits, and the same call is accepted once AgentRuntimeService answers again (SCN-RunControlService-024, FUX-07)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/services/run-control-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6061",
        "AIFACTORY-TASK-6062",
        "AIFACTORY-TASK-6063",
        "AIFACTORY-TASK-6064"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5517,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "AgentRuntimeService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Attempt"
        ],
        "apis": [
          "RunControlService/AnswerDecision",
          "RunControlService/DecideApproval",
          "AgentRuntimeService/Runtime.AnswerDecision"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "FUX-07"
        ],
        "scenarios": [
          "SCN-RunControlService-024"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ],
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-163",
        "feature:agent-runtime-service",
        "feature:control-plane-api"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/services/run-control-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1491]",
      "number": 1491
    },
    {
      "id": "AIFACTORY-TASK-6061",
      "type": "task",
      "parent": "AIFACTORY-US-1491",
      "title": "AnswerDecision route passing the answer to the waiting attempt through Runtime.AnswerDecision",
      "sequence": "01.05.17.01",
      "description": "AnswerDecision route passing the answer to the waiting attempt through Runtime.AnswerDecision. Expected output: POST /factory/runs/{runId}/decisions/{decisionId}/answer is hosted under the user scope factory.runs.operate with the side-effect class shared-write and natural idempotency and is listed in the service descriptor file with the codes 200, 400, 403, 404, 409 and 503; it looks the run up under the tenant row filter and the projects of the trusted scope, takes its open attempt and calls Runtime.AnswerDecision of AgentRuntimeService through a typed gRPC client under the workload identity of the service with the attempt, the decision and the answer; it maps the acknowledgement to 200, NOT_FOUND to 404, FAILED_PRECONDITION for another answer of an answered decision to 409, a decision of kind Approval to 409 without a call, an unanswered call to 503 with a problem response naming AgentRuntimeService, and writes no row and no outbox record in any case (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "POST /factory/runs/{runId}/decisions/{decisionId}/answer is hosted under the user scope factory.runs.operate with the side-effect class shared-write and natural idempotency and is listed in the service descriptor file with the codes 200, 400, 403, 404, 409 and 503; it looks the run up under the tenant row filter and the projects of the trusted scope, takes its open attempt and calls Runtime.AnswerDecision of AgentRuntimeService through a typed gRPC client under the workload identity of the service with the attempt, the decision and the answer; it maps the acknowledgement to 200, NOT_FOUND to 404, FAILED_PRECONDITION for another answer of an answered decision to 409, a decision of kind Approval to 409 without a call, an unanswered call to 503 with a problem response naming AgentRuntimeService, and writes no row and no outbox record in any case (D137)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5517,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6061]",
      "number": 6061
    },
    {
      "id": "AIFACTORY-TASK-6062",
      "type": "task",
      "parent": "AIFACTORY-US-1491",
      "title": "CLI command answer for a waiting decision of a run",
      "sequence": "01.05.17.02",
      "description": "CLI command answer for a waiting decision of a run. Expected output: The client sends the answer of a member to the route AnswerDecision for a run id and a decision id, prints 200 as answered and prints the problem response of a 404, 409 or 503 unchanged.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client sends the answer of a member to the route AnswerDecision for a run id and a decision id, prints 200 as answered and prints the problem response of a 404, 409 or 503 unchanged."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5517,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6062]",
      "number": 6062
    },
    {
      "id": "AIFACTORY-TASK-6063",
      "type": "task",
      "parent": "AIFACTORY-US-1491",
      "title": "Acceptance fixture of a fake Runtime.AnswerDecision endpoint",
      "sequence": "01.05.17.03",
      "description": "Acceptance fixture of a fake Runtime.AnswerDecision endpoint. Expected output: The acceptance suite hosts a fake Runtime.AnswerDecision endpoint that records the attempt, the decision, the answer and the caller identity of every call, acknowledges a first answer and the same answer repeated, answers NOT_FOUND for a decision it does not hold and FAILED_PRECONDITION for another answer of an answered decision, and can be stopped so that it does not answer.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite hosts a fake Runtime.AnswerDecision endpoint that records the attempt, the decision, the answer and the caller identity of every call, acknowledges a first answer and the same answer repeated, answers NOT_FOUND for a decision it does not hold and FAILED_PRECONDITION for another answer of an answered decision, and can be stopped so that it does not answer."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5517,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6063]",
      "number": 6063
    },
    {
      "id": "AIFACTORY-TASK-6064",
      "type": "task",
      "parent": "AIFACTORY-US-1491",
      "title": "Verify answer-a-decision-an-attempt-asks-for through the acceptance suite",
      "sequence": "01.05.17.04",
      "description": "Verify answer-a-decision-an-attempt-asks-for through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-024\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1491 with the fixture of AIFACTORY-TASK-6063: the answer passed once with the workload identity of the service and answered 200 while the run keeps its state and nothing is written, the repeated answer answered 200, another answer and a decision of kind Approval answered 409, the 404 for a foreign run, a run outside the scope, a run without an open attempt and an unknown decision, the 400 and the 403, and the 503 with the fake stopped after which nothing is recorded and the same call is accepted once the fake answers; the resumption of the attempt is proven by the suite of AgentRuntimeService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RunControlService-024\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1491 with the fixture of AIFACTORY-TASK-6063: the answer passed once with the workload identity of the service and answered 200 while the run keeps its state and nothing is written, the repeated answer answered 200, another answer and a decision of kind Approval answered 409, the 404 for a foreign run, a run outside the scope, a run without an open attempt and an unknown decision, the 400 and the 403, and the 503 with the fake stopped after which nothing is recorded and the same call is accepted once the fake answers; the resumption of the attempt is proven by the suite of AgentRuntimeService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5517,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6064]",
      "number": 6064
    },
    {
      "id": "AIFACTORY-US-1492",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Open and decide the approval of a provisioning run, an evaluation run, an asset release or a promotion that the service owning it requests, and announce the decision to that service",
      "sequence": "01.05.18",
      "description": "As a reviewer, I want the approvals of a baseline provisioning, a waiver of a failed gate, the publication of a release and a production promotion to come to me in the same list and under the same rules as the approvals of a run, so that a decision on a subject that belongs to no run is still bound to the exact proposal and reaches the service that owns it. Not every approval belongs to a run. The owner decided that an approval request names its subject as a kind and an id from a closed list of five, run, provisioning-run, evaluation-run, asset-release and promotion, that `runId` is optional and present only when the subject is a run or belongs to one, and that the service that owns the subject receives the decision (D129, D131, D135). A service requests the approval of a subject it owns with its own service identity through `RunControlService/RunControl.RequestApproval`, whose workload token holds the scope `factory.approvals.request`: EnvironmentPromotionService for a promotion, IaCProvisioningService for a provisioning run, QualityScoreService for the waiver of a failed gate of an evaluation run and AgentRegistryService, the publisher of an asset release, for that release. The request `approval-request-v1` names the subject kind and id, the project of the subject where the subject has one, an asset release having none, the requester the service names, the action class, the proposal kind and the hash of the exact proposal. The service opens a Pending `ApprovalRequest` that keeps `subjectKind`, `subjectId`, `projectId`, the requesting service in `requestingService` and the named requester in `requestedBy`, takes the approver rule the requester supplies in the request and resolves it through PolicyEngineService for the active policy revision only when the request carries none (D141): for the publication of an asset release AgentRegistryService names the role by asset kind, a Reviewer who is not the submitter or a Platform admin for a ModelProfile release (D119, AIFACTORY-US-416 of feature `agent-registry-service-publication`), and RunControlService enforces that rule when the decision is taken; it copies `onExpiry`, `reRequestsLeft` and `quorum` from the approval rule when one is supplied, fail, 0 and 1 until the approval rules arrive in I4 (D127), sets the expiry as for every request, and writes `RunControlService/ApprovalRequested` with `subjectKind`, `subjectId` and `requestingService` and without `runId` and `stepId` when the subject belongs to no run; the reply is `approval-ref-v1`. Such a request names no step, no lease and no fencing token and moves no run state, and asks for none of them. As a design choice of this PBI a repeated request of the same service for the same subject and the same proposal hash while a request of that subject is Pending returns the existing reference, and a request for another proposal hash of a subject that has a Pending request is refused, as for a step. The request is listed by `RunControlService/ListApprovals` and decided through `RunControlService/DecideApproval` under the rules of AIFACTORY-US-166: the scope `factory.approvals.decide`, the approver rule, the quoted version and proposal hash, the votes up to the quorum, and the separation of duties, under which the requester the service named is never eligible to decide (D18, D135). The decision moves no run: `RunControlService/ApprovalDecided` is written with `subjectKind`, `subjectId`, `projectId`, the state and the proposal of the request and without `runId` when the subject belongs to no run, so that the owning service, which consumes the event, completes or refuses its own act in its own PBI. A request-changes decision returns the request ChangesRequested to its owner the same way, which opens a new request for a new proposal. The `ApprovalExpiryReconciler` moves such a request past its expiry to Expired and announces it through `ApprovalDecided` with state Expired, and it fails no run (D129, D135). A caller without workload identity is refused with Unauthenticated and a caller without the scope with PermissionDenied; a subject kind outside the closed list, a request without a subject id and a request of a service that names the subject kind run without being the lease holder of that run are refused with InvalidArgument; no refusal opens a request. Kind: behavior. Traces: services: RunControlService, PolicyEngineService; aggregates: RunControlService/ApprovalRequest, RunControlService/Run; apis: RunControlService/RunControl.RequestApproval, RunControlService/DecideApproval, RunControlService/ListApprovals, PolicyEngineService/Policy.Decide; events: RunControlService/ApprovalRequested, RunControlService/ApprovalDecided; descriptors: approval-request-v1, approval-ref-v1, approval-decision-v1; adrs: ADR-0012, ADR-0014; requirements: FR-06, FUX-05; scenarios: SCN-RunControlService-005, SCN-RunControlService-009, SCN-RunControlService-019, SCN-RunControlService-020. Relates: screens: approvals-list, approval-card; nfrs: NFR-04. Depends on: AIFACTORY-US-165, AIFACTORY-US-166, feature:policy-engine-service. Sources: model/services/control-plane/RunControlService.yaml, docs/reference/schemas/approval.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a caller with the service identity of IaCProvisioningService whose workload token holds `factory.approvals.request`, when `RunControlService/RunControl.RequestApproval` is called with `approval-request-v1` naming the subject kind provisioning-run, its id, its project, the requester, the action class and the proposal hash and no approver rule, then the reply carries `approval-ref-v1`, a Pending `RunControlService/ApprovalRequest` keeps `subjectKind`, `subjectId`, `projectId`, `requestingService`, `requestedBy`, the approver rule resolved through `PolicyEngineService/Policy.Decide`, the `quorum` 1 and no `runId`, step, lease or fencing token, no `RunControlService/Run` changes state, and `RunControlService/ApprovalRequested` is written in the same transaction; the subject kinds evaluation-run, asset-release and promotion are accepted the same way from QualityScoreService, AgentRegistryService and EnvironmentPromotionService; given the request of AgentRegistryService for an asset release that names the approver rule of its asset kind, Reviewer or, for a ModelProfile release, Platform admin, then the request keeps that rule and PolicyEngineService is not asked (SCN-RunControlService-009, D119, D129, D131, D135, D141).",
        "AC2: Given a caller without workload identity, a caller without `factory.approvals.request`, a subject kind outside the closed list, a request without a subject id, a request of a service that names the subject kind run, or another proposal hash for a subject with a Pending request, when `RunControlService/RunControl.RequestApproval` is called, then the call is refused with Unauthenticated, PermissionDenied, InvalidArgument or FailedPrecondition respectively and no request is opened; given the same request repeated for the same subject and proposal hash, then the existing `approval-ref-v1` is returned (SCN-RunControlService-009).",
        "AC3: Given the Pending request of AC1 and a reviewer whose roles satisfy its approver rule and who is not the requester the service named, when `RunControlService/DecideApproval` approves, rejects or requests changes on the quoted version and proposal hash, then the request is Approved, Rejected or ChangesRequested, no run moves, and `RunControlService/ApprovalDecided` with `subjectKind`, `subjectId`, `projectId`, `state` and `proposalHash` and without `runId` is written in the transaction of the decision; given the requester the service named, then the response is 403 and the request stays Pending (SCN-RunControlService-005, D18, D135).",
        "AC4: Given the Pending request of AC1 whose `expiresAt` has passed, when the `ApprovalExpiryReconciler` runs, then the request is Expired, `RunControlService/ApprovalDecided` with state Expired and the subject is written, and no `RunControlService/Run` is failed (SCN-RunControlService-020, D129).",
        "AC5: Given a request of a subject a service owns was opened or decided, when the outbox dispatcher publishes `RunControlService/ApprovalRequested` or `RunControlService/ApprovalDecided`, then each event is sent under the canonical envelope with `subjectKind`, `subjectId` and, for `RunControlService/ApprovalRequested`, `requestingService`, without `runId` and `stepId` for a subject that belongs to no run, and a transport outage is retried with backoff so neither is lost nor duplicated under its event id (SCN-RunControlService-019, SCN-RunControlService-020, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6065",
        "AIFACTORY-TASK-6066",
        "AIFACTORY-TASK-6067",
        "AIFACTORY-TASK-6068"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5518,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "RunControlService/Run"
        ],
        "apis": [
          "RunControlService/RunControl.RequestApproval",
          "RunControlService/DecideApproval",
          "RunControlService/ListApprovals",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "approval-request-v1",
          "approval-ref-v1",
          "approval-decision-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-06",
          "FUX-05"
        ],
        "scenarios": [
          "SCN-RunControlService-005",
          "SCN-RunControlService-009",
          "SCN-RunControlService-019",
          "SCN-RunControlService-020"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list",
          "approval-card"
        ],
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-165",
        "AIFACTORY-US-166",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1492]",
      "number": 1492
    },
    {
      "id": "AIFACTORY-TASK-6065",
      "type": "task",
      "parent": "AIFACTORY-US-1492",
      "title": "Contract of the subject of an approval request and of the two approval events",
      "sequence": "01.05.18.01",
      "description": "Contract of the subject of an approval request and of the two approval events. Expected output: The contract documents of the service state, against docs/reference/schemas/approval.schema.json, that approval-request-v1 names its subject as a kind and an id from the closed list run, provisioning-run, evaluation-run, asset-release and promotion, that runId is optional and present when the subject is a run or belongs to one, that requestingService names a service that requested the approval of a subject it owns, and that ApprovalRequested and ApprovalDecided carry subjectKind and subjectId and the optional runId (D129, D131, D135); a golden file fixes both events for a run and for a provisioning run.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The contract documents of the service state, against docs/reference/schemas/approval.schema.json, that approval-request-v1 names its subject as a kind and an id from the closed list run, provisioning-run, evaluation-run, asset-release and promotion, that runId is optional and present when the subject is a run or belongs to one, that requestingService names a service that requested the approval of a subject it owns, and that ApprovalRequested and ApprovalDecided carry subjectKind and subjectId and the optional runId (D129, D131, D135); a golden file fixes both events for a run and for a provisioning run."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5518,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6065]",
      "number": 6065
    },
    {
      "id": "AIFACTORY-TASK-6066",
      "type": "task",
      "parent": "AIFACTORY-US-1492",
      "title": "RequestApproval from the service that owns the subject, with the subject columns of ApprovalRequests",
      "sequence": "01.05.18.02",
      "description": "RequestApproval from the service that owns the subject, with the subject columns of ApprovalRequests. Expected output: RunControl.RequestApproval admits a workload token with factory.approvals.request from the service that owns the subject and opens a Pending ApprovalRequest with SubjectKind, SubjectId, ProjectId, RequestingService and RequestedBy, mapped to the columns of the table ApprovalRequests with the index IX_Approvals_Tenant_Subject, an empty RunId and StepId for a subject that belongs to no run, the approver rule the request supplies, resolved through PolicyEngineService only when the request carries none (D141), and onExpiry, reRequestsLeft and quorum from the rule (fail, 0 and 1 without one, D127); it moves no run, writes ApprovalRequested with the subject in the same transaction, returns the existing reference for a repeat with the same subject and proposal hash and refuses the cases of AC2 of AIFACTORY-US-1492 without a write.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "RunControl.RequestApproval admits a workload token with factory.approvals.request from the service that owns the subject and opens a Pending ApprovalRequest with SubjectKind, SubjectId, ProjectId, RequestingService and RequestedBy, mapped to the columns of the table ApprovalRequests with the index IX_Approvals_Tenant_Subject, an empty RunId and StepId for a subject that belongs to no run, the approver rule the request supplies, resolved through PolicyEngineService only when the request carries none (D141), and onExpiry, reRequestsLeft and quorum from the rule (fail, 0 and 1 without one, D127); it moves no run, writes ApprovalRequested with the subject in the same transaction, returns the existing reference for a repeat with the same subject and proposal hash and refuses the cases of AC2 of AIFACTORY-US-1492 without a write."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5518,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6066]",
      "number": 6066
    },
    {
      "id": "AIFACTORY-TASK-6067",
      "type": "task",
      "parent": "AIFACTORY-US-1492",
      "title": "Decision and expiry of a request whose subject is not a run",
      "sequence": "01.05.18.03",
      "description": "Decision and expiry of a request whose subject is not a run. Expected output: DecideApproval and the ApprovalExpiryReconciler apply to a request whose subject is not a run the rules of a request of kind approval, the votes and the separation of duties against the requester the service named included, move no run and write ApprovalDecided with subjectKind, subjectId, projectId, the state and the proposal and without runId in the transaction of the decision or the expiry; an expired request of such a subject fails no run (D129, D135).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "DecideApproval and the ApprovalExpiryReconciler apply to a request whose subject is not a run the rules of a request of kind approval, the votes and the separation of duties against the requester the service named included, move no run and write ApprovalDecided with subjectKind, subjectId, projectId, the state and the proposal and without runId in the transaction of the decision or the expiry; an expired request of such a subject fails no run (D129, D135)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5518,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6067]",
      "number": 6067
    },
    {
      "id": "AIFACTORY-TASK-6068",
      "type": "task",
      "parent": "AIFACTORY-US-1492",
      "title": "Verify approve-a-subject-a-service-owns through the acceptance suite",
      "sequence": "01.05.18.04",
      "description": "Verify approve-a-subject-a-service-owns through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Area=SubjectApproval&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-009|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1492 with test clients under the workload identities of IaCProvisioningService, QualityScoreService, AgentRegistryService and EnvironmentPromotionService: the request of each of the four subject kinds opened without a run, step or lease, the approver rule an asset-release request supplies kept without a call to PolicyEngineService and the rule of a request without one resolved through it (D141), each refusal, the repeat that returns the existing reference, the decision that moves no run and the 403 of the named requester, the expiry that fails no run, and the payload of both events with the subject and without runId; the handling of the decision is proven by the suites of the owning services.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Area=SubjectApproval&(Scenario=SCN-RunControlService-005|Scenario=SCN-RunControlService-009|Scenario=SCN-RunControlService-019|Scenario=SCN-RunControlService-020)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1492 with test clients under the workload identities of IaCProvisioningService, QualityScoreService, AgentRegistryService and EnvironmentPromotionService: the request of each of the four subject kinds opened without a run, step or lease, the approver rule an asset-release request supplies kept without a call to PolicyEngineService and the rule of a request without one resolved through it (D141), each refusal, the repeat that returns the existing reference, the decision that moves no run and the 403 of the named requester, the expiry that fails no run, and the payload of both events with the subject and without runId; the handling of the decision is proven by the suites of the owning services."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5518,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6068]",
      "number": 6068
    },
    {
      "id": "AIFACTORY-US-1606",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Bind an opened change proposal to the run that produced it and record its merged commit on that binding",
      "sequence": "01.05.19",
      "description": "As a reviewer, I want the change proposal that a run opened in the system of record bound to that run with its merged commit, so that an approval of the run names the exact proposal version and the pipeline run of the merged commit finds the run it belongs to. PipelineExecutionService announces through `PipelineExecutionService/ChangeProposalOpened` that the change set of a Factory run became a branch and a pull request in the system of record, with `proposalId`, `tenantId`, `projectId`, `runId`, `repository` and the optional `pullRequestRef`; in I1 the thin delivery publishes it when `Pipelines.RecordProposal` records the pull request that the tool `propose-change-set` opened (AIFACTORY-US-1278 of feature `pipeline-execution-service-thin`), and from I2 also for `OpenChangeProposal`. The inbox handler `BindChangeProposal` of RunControlService consumes it, idempotent on the event id, finds the `Run` that `runId` names under the tenant of the event and records the binding of the proposal to that run, with the proposal id, the repository and the pull request reference, so that an approval of the run can name the exact proposal version, which is the purpose the model gives the handler (D140). The same handler consumes `PipelineExecutionService/ChangeProposalMerged`, which carries `proposalId`, `tenantId`, `projectId`, `runId` and `mergedCommit` and which the complete delivery of PipelineExecutionService publishes from I2 (AIFACTORY-US-1282 of feature `pipeline-execution-service-complete`), and records the merged commit on the binding of that proposal. The handler `SettleWaitingStep` of I2 does not read the binding: it looks up the step that waits for a pipeline run directly by the `runId` and `stepRunId` that `PipelineRunCompleted` echoes from the requesting step (AIFACTORY-US-1608 of feature `pipeline-execution-service-complete`, D141). The binding is a record beside the run and not a transition of it: the handler moves no state of the run, writes no entry of the `RecoveryJournal` and publishes nothing, so it is written for a run in any state, a Completed run included, because a pull request is often merged after the run that proposed it has completed. A merge announced before the opening, as when the two events arrive out of order, writes the binding with the merged commit, and the opening completes it. An event that names a run of another tenant, which the tenant row filter does not find, or a run that does not exist writes nothing and completes; a redelivered event changes nothing. When `run-control-sql` does not answer, the handler fails, nothing is written and the inbox retries the event. The binding is the entity `ChangeProposalBinding` of the `Run`, kept in the table `ChangeProposalBindings` of `run-control-sql`, keyed by tenant, run and proposal with the repository, the pull request reference and the merged commit (model/services/control-plane/RunControlService.yaml, D141). Before I2 no `ChangeProposalMerged` is published, so the merge path is proven with fixture events of the pinned contracts package. Kind: behavior. Traces: services: RunControlService, PipelineExecutionService; aggregates: RunControlService/Run; events: PipelineExecutionService/ChangeProposalOpened, PipelineExecutionService/ChangeProposalMerged, RunControlService/RunStateChanged; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-07, XL-10. Depends on: AIFACTORY-US-005, feature:pipeline-execution-service-thin, feature:contracts-package. Sources: model/services/control-plane/RunControlService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a `RunControlService/Run` of tenant A, when `PipelineExecutionService/ChangeProposalOpened` names its `runId` with a `proposalId`, a `repository` and a `pullRequestRef` and `BindChangeProposal` handles it, then the binding of that proposal with its repository and pull request reference is recorded for the run, the run keeps its state and version, and no `RunControlService/RunStateChanged` and no other event is written; a redelivery under the same event id changes nothing (model/services/control-plane/RunControlService.yaml, ADR-0014).",
        "AC2: Given the binding of AC1 and the run already Completed, when `PipelineExecutionService/ChangeProposalMerged` names the same proposal with its `mergedCommit`, then the merged commit is recorded on the binding and nothing is published; given instead the merge arrives before the opening, then the binding is written with the merged commit and the later `PipelineExecutionService/ChangeProposalOpened` completes it with the repository and the pull request reference (model/services/devops-gitops/PipelineExecutionService.yaml).",
        "AC3: Given an event that names a run of tenant B while its tenant is A, or a run that does not exist, or `run-control-sql` stopped while the event arrives, when `PipelineExecutionService/ChangeProposalOpened` or `PipelineExecutionService/ChangeProposalMerged` is handled, then the first two write nothing and complete, and the last is retried by the inbox until the store answers and is applied once under its event id (ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6501",
        "AIFACTORY-TASK-6502",
        "AIFACTORY-TASK-6503"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5519,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "PipelineExecutionService"
        ],
        "aggregates": [
          "RunControlService/Run"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalOpened",
          "PipelineExecutionService/ChangeProposalMerged",
          "RunControlService/RunStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-07",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-005",
        "feature:pipeline-execution-service-thin",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1606]",
      "number": 1606
    },
    {
      "id": "AIFACTORY-TASK-6501",
      "type": "task",
      "parent": "AIFACTORY-US-1606",
      "title": "BindChangeProposal inbox handler of ChangeProposalOpened and ChangeProposalMerged with the proposal bindings of a run",
      "sequence": "01.05.19.01",
      "description": "BindChangeProposal inbox handler of ChangeProposalOpened and ChangeProposalMerged with the proposal bindings of a run. Expected output: The inbox of the run-control profile registers ChangeProposalOpened and ChangeProposalMerged with idempotency on the event id; BindChangeProposal finds the run under the tenant of the event and writes the binding, keyed by tenant, run id and proposal id with the repository, the pull request reference and the merged commit, in the table ChangeProposalBindings of run-control-sql with its index IX_ChangeProposalBindings_Tenant_MergedCommit, its migration and mapping test (D141), upserting so that a merge before the opening and the opening after it leave one complete row; it moves no run state, writes no RecoveryJournal entry and publishes nothing, writes the binding for a run in any state, and writes nothing for a run of another tenant or an unknown run.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox of the run-control profile registers ChangeProposalOpened and ChangeProposalMerged with idempotency on the event id; BindChangeProposal finds the run under the tenant of the event and writes the binding, keyed by tenant, run id and proposal id with the repository, the pull request reference and the merged commit, in the table ChangeProposalBindings of run-control-sql with its index IX_ChangeProposalBindings_Tenant_MergedCommit, its migration and mapping test (D141), upserting so that a merge before the opening and the opening after it leave one complete row; it moves no run state, writes no RecoveryJournal entry and publishes nothing, writes the binding for a run in any state, and writes nothing for a run of another tenant or an unknown run."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5519,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6501]",
      "number": 6501
    },
    {
      "id": "AIFACTORY-TASK-6502",
      "type": "task",
      "parent": "AIFACTORY-US-1606",
      "title": "Fixture change proposal events and runs of the binding suite",
      "sequence": "01.05.19.02",
      "description": "Fixture change proposal events and runs of the binding suite. Expected output: The acceptance suite holds fixture events ChangeProposalOpened and ChangeProposalMerged of two tenants, built from the event types of the pinned contracts package under the run event envelope, a Running and a Completed run to bind, a merge that arrives before its opening, and a switch that stops run-control-sql while an event arrives.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fixture events ChangeProposalOpened and ChangeProposalMerged of two tenants, built from the event types of the pinned contracts package under the run event envelope, a Running and a Completed run to bind, a merge that arrives before its opening, and a switch that stops run-control-sql while an event arrives."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5519,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6502]",
      "number": 6502
    },
    {
      "id": "AIFACTORY-TASK-6503",
      "type": "task",
      "parent": "AIFACTORY-US-1606",
      "title": "Verify bind-a-change-proposal-to-its-run through the acceptance suite",
      "sequence": "01.05.19.03",
      "description": "Verify bind-a-change-proposal-to-its-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=BindChangeProposal\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1606 with the fixture of AIFACTORY-TASK-6502: the binding of an opened proposal without a run transition or event, the merged commit recorded on the binding of a Completed run, the merge before the opening, the foreign and the unknown run, the redelivery and the retry while the store is stopped.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=BindChangeProposal\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1606 with the fixture of AIFACTORY-TASK-6502: the binding of an opened proposal without a run transition or event, the merged commit recorded on the binding of a Completed run, the merge before the opening, the foreign and the unknown run, the redelivery and the retry while the store is stopped."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5519,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6503]",
      "number": 6503
    },
    {
      "id": "AIFACTORY-US-1607",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-006",
      "title": "Take the source scope a project announces for every run accepted from then on and leave the snapshot of an accepted run unchanged",
      "sequence": "01.05.20",
      "description": "As a workspace administrator, I want a change of the source scope of my project to apply to the runs accepted after it, so that new runs touch only the sources I allow while a running run keeps the sources it was accepted with. ProjectService announces through `ProjectService/SourceScopeChanged` the set of sources a run of a project may touch, with `projectId`, `tenantId` and `entries`, each entry rendered as its kind, repository, documents or tool, and its reference, when a Workspace admin replaces the scope through `SetSourceScope` (AIFACTORY-US-448 of feature `project-service`). The inbox handler `RefreshSourceScope` of RunControlService consumes it, idempotent on the event id, and keeps the announced entries as the last announced source scope of that project in its tenant, replacing the entries kept before; an announcement older than the one kept, by the time of its envelope, changes nothing. From then on `SubmitRun` and `RunControl.SubmitChildRun` build the member `sources` of the resolved execution snapshot of a run they accept (`resolved-execution-snapshot-v1`) within the entries of that scope, before the snapshot is stored through `ArtifactService/Artifacts.Store` (AIFACTORY-TASK-2931), so a run accepted after the change touches only the sources of the new scope. A run accepted before the change keeps the snapshot it pinned: the snapshot is stored once, when the run is accepted, and never rewritten, so a Running run, its open attempt and a retried attempt read through `RunControl.AcquireLease` the reference and the hash of the snapshot that held at its acceptance (ADR-0014). The handler moves no run, writes no entry of the `RecoveryJournal` and publishes nothing, and, as for the gates, `SubmitRun` reads the kept scope and calls no other service for it. The scope of one tenant is never read for a run of another tenant (ADR-0015); a redelivered event changes nothing, and when `run-control-sql` does not answer the handler fails, nothing is written and the inbox retries the event. The announced scope is the entity `AnnouncedSourceScope` of the `Run`, kept in the table `AnnouncedSourceScopes` of `run-control-sql`, keyed by tenant and project with the entries and the time of the announcement (model/services/control-plane/RunControlService.yaml, D141); how a project for which no scope was announced yet is treated is, as for a subject without a row in `GateStates`, not stated by the model, and this PBI does not decide it. Kind: behavior. Traces: services: RunControlService, ProjectService, ArtifactService; aggregates: RunControlService/Run; apis: RunControlService/SubmitRun, RunControlService/RunControl.SubmitChildRun, RunControlService/RunControl.AcquireLease, ArtifactService/Artifacts.Store; events: ProjectService/SourceScopeChanged; descriptors: resolved-execution-snapshot-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-03, XL-03. Depends on: AIFACTORY-US-005, feature:project-service, feature:artifact-service. Sources: model/services/control-plane/RunControlService.yaml, model/services/control-plane/ProjectService.yaml, docs/reference/schemas/resolved-execution-snapshot.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a project of tenant A with a kept source scope of two entries, when `ProjectService/SourceScopeChanged` announces three entries for it and `RefreshSourceScope` handles it, then the kept scope of the project is the three entries, no `RunControlService/Run` changes state and nothing is published; given the same event redelivered or an announcement older than the kept one, then nothing changes (model/services/control-plane/RunControlService.yaml).",
        "AC2: Given the changed scope, when `RunControlService/SubmitRun` or `RunControlService/RunControl.SubmitChildRun` accepts a run of that project, then the `sources` of the `resolved-execution-snapshot-v1` stored through `ArtifactService/Artifacts.Store` lie within the three entries; given a run of the project accepted before the change and still Running, then its `snapshotRef` and `snapshotHash` are unchanged and `RunControlService/RunControl.AcquireLease` returns them for a later and for a retried attempt (ADR-0014).",
        "AC3: Given a scope announced for a project of tenant B and a run of tenant A submitted through `RunControlService/SubmitRun`, or `run-control-sql` stopped while `ProjectService/SourceScopeChanged` arrives, when the run is accepted or the event is handled, then the snapshot of the run of tenant A never names an entry of tenant B, and the stopped store leads to a retry by the inbox until it answers and to one application under the event id (ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/reference/schemas/resolved-execution-snapshot.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6504",
        "AIFACTORY-TASK-6505"
      ],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5520,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "ProjectService",
          "ArtifactService"
        ],
        "aggregates": [
          "RunControlService/Run"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "RunControlService/RunControl.SubmitChildRun",
          "RunControlService/RunControl.AcquireLease",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ProjectService/SourceScopeChanged"
        ],
        "descriptors": [
          "resolved-execution-snapshot-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-03",
          "XL-03"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-005",
        "feature:project-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/reference/schemas/resolved-execution-snapshot.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1607]",
      "number": 1607
    },
    {
      "id": "AIFACTORY-TASK-6504",
      "type": "task",
      "parent": "AIFACTORY-US-1607",
      "title": "RefreshSourceScope inbox handler and the sources of the snapshot of a newly accepted run",
      "sequence": "01.05.20.01",
      "description": "RefreshSourceScope inbox handler and the sources of the snapshot of a newly accepted run. Expected output: The inbox of the run-control profile registers SourceScopeChanged with idempotency on the event id; RefreshSourceScope keeps the announced entries of a project, keyed by tenant and project with the time of the announcement, in the table AnnouncedSourceScopes of run-control-sql with its migration and mapping test (D141), replaces them only with a newer announcement, moves no run and publishes nothing; the snapshot builder of AIFACTORY-TASK-2931 takes the member sources of resolved-execution-snapshot-v1 within the kept entries of the project of the run for SubmitRun and SubmitChildRun, reads them under the tenant row filter without a call to another service, and never rewrites the snapshot of a run already accepted.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox of the run-control profile registers SourceScopeChanged with idempotency on the event id; RefreshSourceScope keeps the announced entries of a project, keyed by tenant and project with the time of the announcement, in the table AnnouncedSourceScopes of run-control-sql with its migration and mapping test (D141), replaces them only with a newer announcement, moves no run and publishes nothing; the snapshot builder of AIFACTORY-TASK-2931 takes the member sources of resolved-execution-snapshot-v1 within the kept entries of the project of the run for SubmitRun and SubmitChildRun, reads them under the tenant row filter without a call to another service, and never rewrites the snapshot of a run already accepted."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5520,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6504]",
      "number": 6504
    },
    {
      "id": "AIFACTORY-TASK-6505",
      "type": "task",
      "parent": "AIFACTORY-US-1607",
      "title": "Verify take-the-announced-source-scope-for-new-runs through the acceptance suite",
      "sequence": "01.05.20.02",
      "description": "Verify take-the-announced-source-scope-for-new-runs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RefreshSourceScope\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1607 with fixture SourceScopeChanged events of two tenants, the fake Artifacts.Store endpoint of AIFACTORY-TASK-2931 that records the stored snapshot, a run accepted before and one accepted after the change, an older and a redelivered announcement and a switch that stops run-control-sql.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RefreshSourceScope\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1607 with fixture SourceScopeChanged events of two tenants, the fake Artifacts.Store endpoint of AIFACTORY-TASK-2931 that records the stored snapshot, a run accepted before and one accepted after the change, an older and a redelivered announcement and a switch that stops run-control-sql."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 55,
      "phase": "factory",
      "stackRank": 5520,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6505]",
      "number": 6505
    },
    {
      "id": "AIFACTORY-FEAT-008",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "CostUsageService: complete delivery",
      "sequence": "01.06",
      "description": "CostUsageService is the service of bounded context BC-05 (Usage Accounting). Owns budgets, reservations, usage records, pricing revisions and reconciliation; reserves before dispatch, settles observed usage, keeps unknown usage uncertain and feeds meters, budgets and billing (BC-05). It is delivered complete in the first outcome by owner decision (D80), so that every run reserves before it spends and stops at its budget cap. Its own repository is ConnectSoft.AI.SoftwareFactory.CostUsageService. Delivers: CostUsageService (complete). Increment I1: Generate a microservice. Build order 56 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-020",
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-452",
        "AIFACTORY-US-1495",
        "AIFACTORY-US-453",
        "AIFACTORY-US-454",
        "AIFACTORY-US-455",
        "AIFACTORY-US-459",
        "AIFACTORY-US-456",
        "AIFACTORY-US-457",
        "AIFACTORY-US-549",
        "AIFACTORY-US-737",
        "AIFACTORY-US-881"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5600,
      "titlePrefix": "[AIFACTORY-FEAT-008]",
      "number": 8
    },
    {
      "id": "AIFACTORY-US-020",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "A run reserves before it spends and stops at its cap",
      "sequence": "01.06.01",
      "description": "As a workspace administrator, I want to set a budget for a project and have every run reserve before it spends, so that a run stops at its cap instead of overspending, and I can trust the usage I am shown. This is the integration PBI of the feature: it proves on a deployed instance that the behaviours of CostUsageService work together along the life of a run, as the first outcome demands (D80). ProjectService announces a new project and the default budget of the project is opened; a Workspace admin sets its limit and its approval threshold, and a monthly budget follows the calendar month in UTC and carries the reservations that are still open at the month boundary into the new period with their estimates (AIFACTORY-US-452, D119); a Platform admin sets the budget of the tenant, and no project budget may exceed the budget of its tenant nor a tenant budget the platform limit (AIFACTORY-US-1495, D137). RunControlService accepts a run and CostUsageService reserves the estimated cost before anything is dispatched (AIFACTORY-US-453): `CostUsageService/BudgetReserved` lets RunControlService dispatch the first attempt, and `CostUsageService/BudgetReservationDenied` makes it fail an Accepted or a Held run as policy-denied. A run whose estimate is above the approval threshold gets no reservation at first: `CostUsageService/SpendApprovalRequired` makes RunControlService open a run-level spend approval, the run waits in WaitingForApproval, the reservation is made when the approval is granted, and a rejected or expired approval fails the run as policy-denied (D117); for a run that is Held by a frozen environment the approval is opened at once and can be decided while the run is Held, an approved one is reserved at once, and the run proceeds when the approval is granted and the environment is active (D119). That is the first half of what the title means: the cap is enforced at reservation, before the first dispatch, so a run whose estimate the budget cannot cover stops before it spends. The second half is the overrun: when the observed usage of a running run takes the committed amount of the budget above its limit, `CostUsageService/BudgetExceeded` is published, RunControlService records a cancellation intent for that run with the reason budget-exceeded, the run ends Cancelled with that reason and is no failed run (D123), and the next reservation against the budget is denied (AIFACTORY-US-549, D117); the event names the run whose usage crossed the limit and is published once per run, and only a named run is stopped (D119); every later run whose observed usage raises the committed amount of a budget that is above its limit is named once and stopped the same way, and the runs that stay within their estimate finish and settle (D121). A child run has no reservation of its own: nothing is reserved for it, its usage is recorded with the child run id and counts on the reservation of its parent run, and the run an overrun names may be a child run, which ends Cancelled like every stopped run and which only its parent treats as failed (AIFACTORY-US-737, D121, D123). While the run works, ModelRouterService and ToolAdapterService report what each call consumed and every receipt becomes exactly one usage record per meter, the input tokens and the output tokens of a model call on two meters, with unknown or unpriced usage kept uncertain and never refused (AIFACTORY-US-454). The usage of a model invocation that names no run, a model call outside a run, is recorded against the budget of its project without a reservation and counts in the committed amount of that budget (AIFACTORY-US-881, D123). When the run ends, the reservation is settled to the observed amount or released when the run was cancelled before dispatch (AIFACTORY-US-455); a reservation whose run never dispatched expires (AIFACTORY-US-459); estimated and uncertain records are confirmed later from late receipts, and unpriced ones are priced once a price exists (AIFACTORY-US-456); and the usage of the project and of the run is read through the gateway and the command-line client, while the Studio screens follow with StudioBff in I3 (AIFACTORY-US-457). The repository and the store come from AIFACTORY-US-450 and the hosted surface from AIFACTORY-US-451. The service is deployed as its own workload with its own store `cost-usage-sql` and its own messaging service name `cost-usage` (ADR-0028); its eight events are written to the outbox in the transaction of the change they announce and published in the run event envelope of the contracts package. A resource of another tenant is answered 404, over gRPC NOT_FOUND, and a missing scope inside the tenant of the caller 403. At this increment every usage fact is kept in `cost-usage-sql`. The model names the Factory Metering service as the meter store behind a typed client; that service arrives in I4 and is not required before it (D115, D117, feature `component-saas-metering`), so nothing here exports usage or references its client. The delivery states its other limits where they belong. The handlers of events whose producers arrive later are not built: the three retention events of RetentionResidencyService (I4), whose legal-hold and deletion-order handlers are built in this repository in I4 by feature `retention-residency-service` (D137), `SubscriptionChanged` of FactoryCommercialService (I7), and `QuotaExceeded`, `CapacityLeaseGranted` and `CapacityLeaseReleased`, which the complete ExecutionCapacityService publishes from I2. Four things remain inputs of the owner and are never invented here: the rule that estimates a run and its values, the limit and the period of the default budget of a new project, the platform limit no tenant budget may exceed (D137), and the unit, the factor and the prices of each meter. The values of `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod` and `Usage:Budgets:PlatformLimitUsd`, the section `Usage:Estimates` and the pricing revisions of the meters are entries of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140); the unit and the factor of each meter stay open rows of the register of AIFACTORY-US-379. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Kind: behavior. Traces: services: CostUsageService, RunControlService, ModelRouterService, ToolAdapterService; aggregates: CostUsageService/Budget, CostUsageService/Reservation, CostUsageService/UsageRecord; apis: CostUsageService/SetProjectBudget, CostUsageService/GetProjectUsage, CostUsageService/GetRunUsage, CostUsageService/Usage.Reserve, CostUsageService/Usage.RecordUsage; events: CostUsageService/BudgetReserved, CostUsageService/BudgetReservationDenied, CostUsageService/ReservationSettled, CostUsageService/UsageRecorded, CostUsageService/UsageReconciled, CostUsageService/BudgetUpdated, CostUsageService/SpendApprovalRequired, CostUsageService/BudgetExceeded; descriptors: usage-reservation-v1, usage-record-v1; adrs: ADR-0014, ADR-0020, ADR-0028; requirements: FR-09, XL-12, NFR-12. Relates: screens: usage-cost, project-overview; nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-452, AIFACTORY-US-453, AIFACTORY-US-454, AIFACTORY-US-455, AIFACTORY-US-456, AIFACTORY-US-457, AIFACTORY-US-459, AIFACTORY-US-549, AIFACTORY-US-737, AIFACTORY-US-881, AIFACTORY-US-1495, feature:run-control-service, feature:project-service, feature:model-router-service, feature:tool-adapter-service, feature:control-plane-api, feature:command-line-client. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, docs/architecture/adr/0020-commercial-model.md, docs/planes/control/services/cost-usage-service/index.md.",
      "acceptanceCriteria": [
        "AC1: Given a project whose budget was set through `CostUsageService/SetProjectBudget` and a run accepted by RunControlService whose estimate, computed by the configured estimator, fits the budget and the threshold, when the acceptance reaches CostUsageService, then a `CostUsageService/Reservation` is Reserved, `CostUsageService/BudgetReserved` is published and RunControlService dispatches the first attempt; given a second run whose estimate the budget cannot cover, then `CostUsageService/BudgetReservationDenied` is published and that run ends Failed with the failure class policy-denied without any attempt dispatched; given a third run whose estimate fits the budget and is above the threshold, then `CostUsageService/SpendApprovalRequired` is published, nothing is reserved and the run waits in WaitingForApproval, and after a reviewer who is not its requester approved the spend the reservation is Reserved, `CostUsageService/BudgetReserved` is published and the first attempt is dispatched (ADR-0014, XL-12).",
        "AC2: Given a model call and a tool call of the running run report their receipts, when the receipts reach CostUsageService through `CostUsageService/Usage.RecordUsage` or the receipt events, then one `CostUsageService/UsageRecord` per receipt and meter exists, the input tokens and the output tokens of the model call on their two meters, and `CostUsageService/UsageRecorded` is published once per record; when the run ends, then the reservation is Settled to the observed amount and `CostUsageService/ReservationSettled` is published; given a running run whose recorded usage takes `committedUsd` of the budget above `limitUsd`, then `CostUsageService/BudgetExceeded` is published once with its `runId`, that run ends Cancelled with the reason budget-exceeded, a second running run of the same budget that stays within its estimate is not stopped and settles, a third whose observed usage raises `committedUsd` further while it is above `limitUsd` is named once and stopped the same way, and the next reservation against the budget is Denied (FR-09, XL-12, D119, D121).",
        "AC3: Given a provider reports no usage for one call of the run, when the receipt is recorded and the run ends, then that record is Uncertain with no amount invented and `CostUsageService/ReservationSettled` carries `uncertain` true; when a later receipt for the same source reports the usage and the `ReconciliationWorker` applies it, then `CostUsageService/UsageReconciled` is published and the record is Reconciled, on the deployed instance and without a fixture source (FR-09, NFR-12).",
        "AC4: Given a finished run without uncertain records, when `CostUsageService/GetRunUsage` and `CostUsageService/GetProjectUsage` are read through the gateway and through the command-line client, then the usage of the run equals the sum of its receipts and the `settledUsd` of its reservation, and the project figures show it under the observed state (FR-09, XL-12).",
        "AC5: Given the acceptance suite of the repository, when it runs against the deployed instance, then each of the fourteen scenarios of model/scenarios/CostUsageService.yaml is executed by at least one test that carries its scenario id, a filter that matches no test counts as a failure, and the suite passes without a Metering service present."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/planes/control/services/cost-usage-service/index.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-313",
        "AIFACTORY-TASK-1826",
        "AIFACTORY-TASK-699"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5601,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "RunControlService",
          "ModelRouterService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/Reservation",
          "CostUsageService/UsageRecord"
        ],
        "apis": [
          "CostUsageService/SetProjectBudget",
          "CostUsageService/GetProjectUsage",
          "CostUsageService/GetRunUsage",
          "CostUsageService/Usage.Reserve",
          "CostUsageService/Usage.RecordUsage"
        ],
        "events": [
          "CostUsageService/BudgetReserved",
          "CostUsageService/BudgetReservationDenied",
          "CostUsageService/ReservationSettled",
          "CostUsageService/UsageRecorded",
          "CostUsageService/UsageReconciled",
          "CostUsageService/BudgetUpdated",
          "CostUsageService/SpendApprovalRequired",
          "CostUsageService/BudgetExceeded"
        ],
        "descriptors": [
          "usage-reservation-v1",
          "usage-record-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020",
          "ADR-0028"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-12"
        ]
      },
      "relates": {
        "screens": [
          "usage-cost",
          "project-overview"
        ],
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-452",
        "AIFACTORY-US-453",
        "AIFACTORY-US-454",
        "AIFACTORY-US-455",
        "AIFACTORY-US-456",
        "AIFACTORY-US-457",
        "AIFACTORY-US-459",
        "AIFACTORY-US-549",
        "AIFACTORY-US-737",
        "AIFACTORY-US-881",
        "AIFACTORY-US-1495",
        "feature:run-control-service",
        "feature:project-service",
        "feature:model-router-service",
        "feature:tool-adapter-service",
        "feature:control-plane-api",
        "feature:command-line-client"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/planes/control/services/cost-usage-service/index.md"
      ],
      "titlePrefix": "[AIFACTORY-US-020]",
      "number": 20
    },
    {
      "id": "AIFACTORY-TASK-313",
      "type": "task",
      "parent": "AIFACTORY-US-020",
      "title": "Budget and usage commands in the command-line client",
      "sequence": "01.06.01.01",
      "description": "Budget and usage commands in the command-line client. Expected output: The client sets the budget of a project through SetProjectBudget and shows the usage of a project and of a run through GetProjectUsage and GetRunUsage, by meter and by the five states with uncertain usage shown as uncertain, using the typed gateway client and the trusted scope of the signed-in user.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client sets the budget of a project through SetProjectBudget and shows the usage of a project and of a run through GetProjectUsage and GetRunUsage, by meter and by the five states with uncertain usage shown as uncertain, using the typed gateway client and the trusted scope of the signed-in user."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-313]",
      "number": 313
    },
    {
      "id": "AIFACTORY-TASK-1826",
      "type": "task",
      "parent": "AIFACTORY-US-020",
      "title": "Deploy CostUsageService as its own workload with its store, its messaging service name, its owner-supplied configuration and its gateway routes",
      "sequence": "01.06.01.02",
      "description": "Deploy CostUsageService as its own workload with its store, its messaging service name, its owner-supplied configuration and its gateway routes. Expected output: CostUsageService runs as its own workload from the manifests the template generates, with its own relational store `cost-usage-sql`, the messaging service name `cost-usage` and the transport credential read from the secret reference `messaging-transport`; the deployment sets the values the owner supplies for `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod`, `Usage:Budgets:PlatformLimitUsd` (D137) and the section `Usage:Estimates` and loads the pricing revisions of the owner, and readiness answers ready only after the store is migrated, the messaging profile has started and each of the meters `ModelInputTokens`, `ModelOutputTokens` and `ToolInvocations` has a pricing revision valid at that moment, so a deployment without prices takes no traffic; the four REST routes are reachable through the platform gateway; no Metering service is configured, since that service arrives in I4 and is not required before it (ADR-0028, D117).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "CostUsageService runs as its own workload from the manifests the template generates, with its own relational store `cost-usage-sql`, the messaging service name `cost-usage` and the transport credential read from the secret reference `messaging-transport`; the deployment sets the values the owner supplies for `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod`, `Usage:Budgets:PlatformLimitUsd` (D137) and the section `Usage:Estimates` and loads the pricing revisions of the owner, and readiness answers ready only after the store is migrated, the messaging profile has started and each of the meters `ModelInputTokens`, `ModelOutputTokens` and `ToolInvocations` has a pricing revision valid at that moment, so a deployment without prices takes no traffic; the four REST routes are reachable through the platform gateway; no Metering service is configured, since that service arrives in I4 and is not required before it (ADR-0028, D117)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5601,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1826]",
      "number": 1826
    },
    {
      "id": "AIFACTORY-TASK-699",
      "type": "task",
      "parent": "AIFACTORY-US-020",
      "title": "Verify run-budget-cap through the end-to-end chain of the acceptance suite",
      "sequence": "01.06.01.03",
      "description": "Verify run-budget-cap through the end-to-end chain of the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance\"` against the deployed instance with RunControlService, ModelRouterService and ToolAdapterService of the same environment; a filter that matches no test counts as a failure; the chain budget, reservation, denial at the cap, spend approval above the threshold, receipts, a running run stopped by a budget overrun, settlement, reconciliation from a late receipt and read passes and every scenario id of model/scenarios/CostUsageService.yaml is carried by at least one passing test, which proves AC1 to AC5 of AIFACTORY-US-020.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance\"` against the deployed instance with RunControlService, ModelRouterService and ToolAdapterService of the same environment; a filter that matches no test counts as a failure; the chain budget, reservation, denial at the cap, spend approval above the threshold, receipts, a running run stopped by a budget overrun, settlement, reconciliation from a late receipt and read passes and every scenario id of model/scenarios/CostUsageService.yaml is carried by at least one passing test, which proves AC1 to AC5 of AIFACTORY-US-020."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-699]",
      "number": 699
    },
    {
      "id": "AIFACTORY-US-450",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "CostUsageService repository: scaffolded from the base template with the Factory profile, with the Budget, Reservation and UsageRecord aggregates and the store cost-usage-sql",
      "sequence": "01.06.02",
      "description": "The repository ConnectSoft.AI.SoftwareFactory.CostUsageService is created and scaffolded in I0 by AIFACTORY-TASK-238 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold, made with the scaffold command of ADR-0028 and its amendment on the Factory profile switch (D114): `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.CostUsageService --UseFactoryProfile true`, from the template package at the version the gate of feature `component-base-template-factory-profile` published (AIFACTORY-US-230), after the findings of feature `component-base-template-findings` are closed (AIFACTORY-US-235). The generated output is committed unchanged and the repository records the version of the template package it was generated from. What the profile generates, that is the Orleans messaging profile with an outbox and an inbox of the service, the propagation of the trusted tenant and project scope, the role policies, the REST and gRPC hosts from a service descriptor, health and telemetry, is the work of the template feature; it is consumed by that version pin and is neither rewritten nor forked here, and the run event envelope and the descriptors `usage-reservation-v1` and `usage-record-v1` come from the contracts package by a version pin. On that scaffold this PBI adds the domain and the store. The `Budget` holds a limit for a project in a period (monthly or total), the start of the open period, the amount committed, which the model describes as reserved plus settled in the period, and the approval threshold. Its invariants are those of the model: `committedUsd` never exceeds `limitUsd` at reservation, where a reservation that would exceed it is Denied; only observed usage, recorded or settled, may take it above `limitUsd`, which publishes `BudgetExceeded`, and after such an overrun the next reservation of the budget is Denied (AIFACTORY-US-549); a monthly budget follows the calendar month in UTC, with a rollover that opens the new period and keeps the closed one (AIFACTORY-US-452); and the approval threshold of a project budget is never higher than the platform threshold. The `Reservation` holds the estimate for one run with its state, an optional `approvalId`, `expiresAt` and the time it was settled; it is created in Reserved or recorded as Denied, has exactly three transitions, Reserved to Settled (`RunTerminal`), Reserved to Released (`RunCancelledBeforeDispatch`) and Reserved to Expired (`ExpiryWithoutRun`), and at most one exists per run; for an estimate above the spend threshold none is written until the spend approval is granted, and it is then created in Reserved with its `approvalId` (AIFACTORY-US-453). The `UsageRecord` holds one metered quantity on one of the eight meters, the input tokens and the output tokens of a model call being two of them, with its dimensions, its status (Estimated, Reserved, Observed, Reconciled, Uncertain), the pricing revision it was priced with, and the receipt it came from; a record is created from a receipt exactly once per meter, uncertain usage is never zeroed, and a record whose quantity is unknown or for which no pricing revision is valid is Uncertain and holds no quantity or no revision, and no cost, until it is priced or reconciled. The store `cost-usage-sql` is owned by this service alone. This PBI migrates four of the six tables of the model, `Budgets`, `Reservations`, `UsageRecords` and `PricingRevisions`, with the unique index over tenant, project and period, the unique index over the run, the unique index over meter and source receipt and the index over tenant, project and time, and with the nullable quantity and pricing revision of a usage record; `UsageRecords` is retained seven years (D31) and partitioned by tenant and month as the service page states; `PricingRevisions` is platform-wide and carries no tenant filter, the three other tables carry it in every mapping. The two other tables are migrated where their behaviour is delivered: `BudgetPeriods`, the closed periods of a monthly budget, by AIFACTORY-US-452, and `LateReceipts`, the kept late receipts, together with the note on a reservation that an attempt outcome of its run was recorded, by AIFACTORY-US-454. The table `ChildRuns`, in which a child run is noted under the reservation its usage counts on, is migrated by AIFACTORY-US-737 (D121). The model names the Factory Metering service as the meter store behind a typed client and lists the metering library of the SaaS extensions; that service arrives in I4 and is not required before it (D115, D117), so this PBI references neither the client nor a meter store and binds no library as one. Kind: enabling. Traces: services: CostUsageService; aggregates: CostUsageService/Budget, CostUsageService/Reservation, CostUsageService/UsageRecord; descriptors: usage-reservation-v1, usage-record-v1; adrs: ADR-0015, ADR-0020, ADR-0028; requirements: NFR-01, NFR-12. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package. Sources: model/services/control-plane/CostUsageService.yaml, model/template-parameters/connectsoft-base.yaml, model/stores.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/control/services/cost-usage-service/index.md#domain-model, docs/reference/schemas/usage-record.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-238 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.CostUsageService --UseFactoryProfile true` from the base template package at the version the gate of feature `component-base-template-factory-profile` published, when its pipeline runs, then the committed output equals the generated output, the solution builds in Release, the generated tests pass, a container image is published and the repository records the template version (ADR-0028, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given the `CostUsageService/Budget`, `CostUsageService/Reservation` and `CostUsageService/UsageRecord` aggregates, when their unit tests run, then a reservation that would take `committedUsd` above `limitUsd` is Denied and leaves the budget unchanged, a threshold above the platform threshold is refused, a second reservation for one run and a second record for one meter and source receipt are refused, the reservation accepts only the transitions Reserved to Settled, Reserved to Released and Reserved to Expired, and a transition out of Settled, Released, Expired or Denied is refused, as model/services/control-plane/CostUsageService.yaml states.",
        "AC3: Given `cost-usage-sql` created by the migrations of the repository on an isolated test database, when the mapping tests run, then the tables `Budgets`, `Reservations`, `UsageRecords` and `PricingRevisions` exist with their keys and indexes, a usage record is stored and read back without a quantity and without a pricing revision, a second reservation for one run and a second usage record for one meter and source receipt each violate their unique index, a query made for one tenant never returns a budget, reservation or usage record of another, and a pricing revision is readable for every tenant (ADR-0015, NFR-01)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/services/cost-usage-service/index.md#domain-model",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-239",
        "AIFACTORY-TASK-240",
        "AIFACTORY-TASK-1827"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5602,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/Reservation",
          "CostUsageService/UsageRecord"
        ],
        "descriptors": [
          "usage-reservation-v1",
          "usage-record-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0020",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-01",
          "NFR-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/services/cost-usage-service/index.md#domain-model",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-450]",
      "number": 450
    },
    {
      "id": "AIFACTORY-TASK-239",
      "type": "task",
      "parent": "AIFACTORY-US-450",
      "title": "Domain model: Budget, Reservation, UsageRecord and PricingRevision",
      "sequence": "01.06.02.01",
      "description": "Domain model: Budget, Reservation, UsageRecord and PricingRevision. Expected output: The three aggregates and the PricingRevision entity enforce the invariants of the model as it words them; a reservation that would take committedUsd above limitUsd is Denied; the Reservation is created in Reserved or recorded as Denied and accepts only RunTerminal, RunCancelledBeforeDispatch and ExpiryWithoutRun out of Reserved; unit tests cover every invariant, each of the three transitions and the refusal of every other one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three aggregates and the PricingRevision entity enforce the invariants of the model as it words them; a reservation that would take committedUsd above limitUsd is Denied; the Reservation is created in Reserved or recorded as Denied and accepts only RunTerminal, RunCancelledBeforeDispatch and ExpiryWithoutRun out of Reserved; unit tests cover every invariant, each of the three transitions and the refusal of every other one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-239]",
      "number": 239
    },
    {
      "id": "AIFACTORY-TASK-240",
      "type": "task",
      "parent": "AIFACTORY-US-450",
      "title": "Persistence in cost-usage-sql: Budgets, Reservations, UsageRecords, PricingRevisions",
      "sequence": "01.06.02.02",
      "description": "Persistence in cost-usage-sql: Budgets, Reservations, UsageRecords, PricingRevisions. Expected output: Mappings and migrations for the tables Budgets, Reservations, UsageRecords and PricingRevisions with the columns the model lists, among them the start of the open period of a budget, the settlement time of a reservation and the nullable quantity and pricing revision of a usage record, and except the attempt outcome note of a reservation, which AIFACTORY-TASK-1849 adds; with the unique indexes UX_Budgets_Tenant_Project_Period, UX_Reservations_Run and UX_Usage_Meter_Receipt, the index IX_Usage_Tenant_Project_OccurredAt, the row version of Budgets, the partitioning of UsageRecords by tenant and month and the tenant filter in the mappings of the three tenant-scoped tables; PricingRevisions is platform-wide; BudgetPeriods and LateReceipts are migrated by AIFACTORY-TASK-2201 and AIFACTORY-TASK-1849, and ChildRuns by AIFACTORY-TASK-2974 (D121); mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the tables Budgets, Reservations, UsageRecords and PricingRevisions with the columns the model lists, among them the start of the open period of a budget, the settlement time of a reservation and the nullable quantity and pricing revision of a usage record, and except the attempt outcome note of a reservation, which AIFACTORY-TASK-1849 adds; with the unique indexes UX_Budgets_Tenant_Project_Period, UX_Reservations_Run and UX_Usage_Meter_Receipt, the index IX_Usage_Tenant_Project_OccurredAt, the row version of Budgets, the partitioning of UsageRecords by tenant and month and the tenant filter in the mappings of the three tenant-scoped tables; PricingRevisions is platform-wide; BudgetPeriods and LateReceipts are migrated by AIFACTORY-TASK-2201 and AIFACTORY-TASK-1849, and ChildRuns by AIFACTORY-TASK-2974 (D121); mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5602,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-240]",
      "number": 240
    },
    {
      "id": "AIFACTORY-TASK-1827",
      "type": "task",
      "parent": "AIFACTORY-US-450",
      "title": "Verify the scaffold, the aggregates and the store of CostUsageService",
      "sequence": "01.06.02.03",
      "description": "Verify the scaffold, the aggregates and the store of CostUsageService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the three aggregates and the mapping tests on an isolated database pass, a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, and the solution references no metering client, which proves AC1 to AC3 of AIFACTORY-US-450 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the three aggregates and the mapping tests on an isolated database pass, a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, and the solution references no metering client, which proves AC1 to AC3 of AIFACTORY-US-450 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1827]",
      "number": 1827
    },
    {
      "id": "AIFACTORY-US-451",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "CostUsageService host: four REST routes and two gRPC methods behind scope policies, the cost-usage messaging profile, tenancy and telemetry",
      "sequence": "01.06.03",
      "description": "This PBI turns the scaffold of AIFACTORY-US-450 into a host on which the behaviour PBIs of the feature land. From the service descriptor the host exposes the four REST operations of the model for the platform gateway (GW-03), `SetTenantBudget` among them (D137), and the internal gRPC methods `Usage.Reserve` and `Usage.RecordUsage`, with their contract documents, an OpenAPI document and a proto. Tokens are validated through the resource-server library the profile wires, and each route requires its scope: `factory.usage.read` for the two reads and `factory.usage.admin` for the two budget routes. The gRPC methods require a workload identity whose token holds the service scope that names CostUsageService: RunControlService for both methods, ModelRouterService and ToolAdapterService for `Usage.RecordUsage`. A workload token carries no tenant claim, and the service reads the tenant and project a workload forwards only because the token holds that service scope (ADR-0015 amendment of D114). The tenant of a user call comes from the token. Two routes address a project by `projectId`, one addresses a run and `SetTenantBudget` addresses the tenant of the token; a route that addresses a project or a run admits the call only when the role claims of the token name that project, or the project of that run, or carry a tenant-wide role. A resource of another tenant is invisible under the tenant row filter and is answered 404, over gRPC NOT_FOUND, while a missing scope inside the tenant of the caller is answered 403 (D113); the filter is wired here and the 404 is proven by the behaviour PBIs. Every modelled refusal code has a problem response. The messaging profile of the service is named `cost-usage`: the outbox writer enlists in the unit of work of a command, the dispatcher publishes the eight events of the model in the run event envelope of the contracts package with their routes declared in the `OrleansMessaging` section, and the inbox subscribes, with deduplication on the event id, to the consumed events whose publication is delivered up to this increment: `RunAccepted`, `RunCompleted`, `RunFailed`, `RunCancelled`, `AttemptOutcomeRecorded` and `ApprovalDecided` of RunControlService, `ProjectCreated` of ProjectService, `ModelInvoked` of ModelRouterService and `ToolInvoked` of ToolAdapterService. What each handler does is delivered by AIFACTORY-US-452 to AIFACTORY-US-455. The seven options of the model are bound and validated at start: `Usage:Thresholds:PlatformApprovalThresholdUsd`, `Usage:Reservations:ExpiryMinutes` and `OrleansMessaging:ServiceName`, which ship with a default, and `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod`, `Usage:Budgets:PlatformLimitUsd` and the section `Usage:Estimates`, which are inputs of the owner without a shipped value, so that a start without one of them is refused with the key named (D117, D137). The transport credential is read from the secret reference `messaging-transport`, and the metrics `connectsoft.factory.usage.cost_usd`, `connectsoft.factory.usage.uncertain_records` and `connectsoft.factory.usage.reservations_denied` are registered with their dimensions. Readiness reports the store, the messaging profile and the prices: it is not ready while one of the meters the receipts of this increment feed, `ModelInputTokens`, `ModelOutputTokens` and `ToolInvocations`, has no pricing revision valid at that moment, so a deployment without prices takes no traffic; a receipt that still finds no valid revision on a ready instance is stored as Uncertain and priced later, and is never refused (AIFACTORY-US-454). The delivery states its limits. The handlers of `RetentionRuleChanged`, `DeletionOrderIssued` and `LegalHoldChanged` (RetentionResidencyService, first delivered in I4, the deletion-order and legal-hold handlers being built in this repository by feature `retention-residency-service`, D137) and of `SubscriptionChanged` (FactoryCommercialService, I7) are not part of it. Neither are the handlers of `QuotaExceeded`, `CapacityLeaseGranted` and `CapacityLeaseReleased`: the thin ExecutionCapacityService of I1 publishes none of the three, and their publication is delivered with its complete delivery in I2. Readiness does not report a Metering service, which arrives in I4 and is not required before it (D115, D117). Kind: enabling. Traces: services: CostUsageService; aggregates: CostUsageService/Reservation; descriptors: run-event-envelope-v1, usage-reservation-v1, usage-record-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028; requirements: NFR-01, NFR-12. Depends on: AIFACTORY-US-450, feature:component-base-template-factory-profile, feature:contracts-package. Sources: model/services/control-plane/CostUsageService.yaml, model/gateways.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/control/services/cost-usage-service/index.md#apis, docs/planes/control/services/cost-usage-service/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given the hosted service, when each of the four REST operations of model/services/control-plane/CostUsageService.yaml is called without a token and with a token that lacks the scope of the route, then the answers are 401 and 403 with a problem response; when one of the two operations that address a `projectId` is called with a token whose role claims do not admit that project, or the run operation for a run whose project they do not admit, then the answer is 403; a gRPC call without a workload identity or without the service scope is refused with Unauthenticated or PermissionDenied, and ModelRouterService and ToolAdapterService are admitted to `Usage.RecordUsage` only; no state changes (ADR-0015).",
        "AC2: Given a handler that changes a `CostUsageService/Reservation` and publishes one of the eight declared events, when its unit of work commits, then one outbox record in `run-event-envelope-v1` with event id, tenant id, project id, run id where the event has one, correlation id and payload is committed in the same transaction; when the unit of work rolls back, neither the change nor the record exists; a publish of an event the `OrleansMessaging` section does not declare throws (ADR-0012, ADR-0014).",
        "AC3: Given the same event id delivered twice to the inbox of the `cost-usage` messaging profile, when it is dispatched, then the handler runs once and the second delivery has no effect; a handler that keeps failing is retried with backoff and never applied twice (ADR-0012).",
        "AC4: Given the service starts without any Metering service in its environment, when liveness and readiness are probed, then readiness answers ready only after `cost-usage-sql` is migrated, the messaging profile has started and each of the meters `ModelInputTokens`, `ModelOutputTokens` and `ToolInvocations` has a pricing revision valid at that moment, and it names what is missing while it is unready; the seven options of model/services/control-plane/CostUsageService.yaml are bound and a missing or invalid value, among them an absent default budget key, an absent platform limit or an absent section `Usage:Estimates`, stops the start with the key named; and traces and logs carry the tenant, project and run scope of the call (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/control/services/cost-usage-service/index.md#apis",
        "docs/planes/control/services/cost-usage-service/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-241",
        "AIFACTORY-TASK-242",
        "AIFACTORY-TASK-244",
        "AIFACTORY-TASK-1828"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5603,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "aggregates": [
          "CostUsageService/Reservation"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "usage-reservation-v1",
          "usage-record-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-01",
          "NFR-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-450",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/control/services/cost-usage-service/index.md#apis",
        "docs/planes/control/services/cost-usage-service/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-451]",
      "number": 451
    },
    {
      "id": "AIFACTORY-TASK-241",
      "type": "task",
      "parent": "AIFACTORY-US-451",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 4 REST operations and 2 gRPC methods",
      "sequence": "01.06.03.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 4 REST operations and 2 gRPC methods. Expected output: The four REST routes and the gRPC methods Usage.Reserve and Usage.RecordUsage are hosted from the service descriptor with token validation, scope enforcement per route, the workload identity and service scope check per gRPC method (RunControlService for both, ModelRouterService and ToolAdapterService for Usage.RecordUsage), problem responses for every modelled refusal code, and the OpenAPI and proto documents; which fields of usage-reservation-v1 and usage-record-v1 a caller sends and which the service assigns is fixed by the contract tasks AIFACTORY-TASK-1846 and AIFACTORY-TASK-1848, and the behaviour of each operation is delivered by AIFACTORY-US-452 to AIFACTORY-US-457 and AIFACTORY-US-1495, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The four REST routes and the gRPC methods Usage.Reserve and Usage.RecordUsage are hosted from the service descriptor with token validation, scope enforcement per route, the workload identity and service scope check per gRPC method (RunControlService for both, ModelRouterService and ToolAdapterService for Usage.RecordUsage), problem responses for every modelled refusal code, and the OpenAPI and proto documents; which fields of usage-reservation-v1 and usage-record-v1 a caller sends and which the service assigns is fixed by the contract tasks AIFACTORY-TASK-1846 and AIFACTORY-TASK-1848, and the behaviour of each operation is delivered by AIFACTORY-US-452 to AIFACTORY-US-457 and AIFACTORY-US-1495, not here."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-241]",
      "number": 241
    },
    {
      "id": "AIFACTORY-TASK-242",
      "type": "task",
      "parent": "AIFACTORY-US-451",
      "title": "Messaging skeleton: outbox and inbox wiring of the cost-usage profile for 8 published and 9 consumed events",
      "sequence": "01.06.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the cost-usage profile for 8 published and 9 consumed events. Expected output: The outbox writer enlists in the unit of work and the dispatcher of the cost-usage messaging profile publishes BudgetReserved, BudgetReservationDenied, SpendApprovalRequired, ReservationSettled, UsageRecorded, UsageReconciled, BudgetUpdated and BudgetExceeded in the run event envelope of the pinned contracts package, each declared with its route in the OrleansMessaging section; the inbox registers RunAccepted, RunCompleted, RunFailed, RunCancelled, AttemptOutcomeRecorded, ApprovalDecided, ProjectCreated, ModelInvoked and ToolInvoked with idempotency on the event id; the retention events, SubscriptionChanged, QuotaExceeded, CapacityLeaseGranted and CapacityLeaseReleased are not subscribed in this delivery; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work and the dispatcher of the cost-usage messaging profile publishes BudgetReserved, BudgetReservationDenied, SpendApprovalRequired, ReservationSettled, UsageRecorded, UsageReconciled, BudgetUpdated and BudgetExceeded in the run event envelope of the pinned contracts package, each declared with its route in the OrleansMessaging section; the inbox registers RunAccepted, RunCompleted, RunFailed, RunCancelled, AttemptOutcomeRecorded, ApprovalDecided, ProjectCreated, ModelInvoked and ToolInvoked with idempotency on the event id; the retention events, SubscriptionChanged, QuotaExceeded, CapacityLeaseGranted and CapacityLeaseReleased are not subscribed in this delivery; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-242]",
      "number": 242
    },
    {
      "id": "AIFACTORY-TASK-244",
      "type": "task",
      "parent": "AIFACTORY-US-451",
      "title": "Security, tenancy and telemetry of CostUsageService",
      "sequence": "01.06.03.03",
      "description": "Security, tenancy and telemetry of CostUsageService. Expected output: The two scopes of the model are enforced, a route that addresses a project or a run admits a call only when the role claims of the token admit that project, every query of a tenant-scoped table is tenant-filtered, the transport credential comes from the secret reference messaging-transport, the seven options of the model are bound and validated at start, the two default budget keys, the platform limit Usage:Budgets:PlatformLimitUsd and the section Usage:Estimates having no shipped value, readiness reports the store, the messaging profile and a valid pricing revision for the meters ModelInputTokens, ModelOutputTokens and ToolInvocations and no Metering service, and the metrics connectsoft.factory.usage.cost_usd, connectsoft.factory.usage.uncertain_records and connectsoft.factory.usage.reservations_denied are registered with their dimensions under the observability conventions; the 404 that follows from the tenant filter is proven by the behaviour PBIs.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two scopes of the model are enforced, a route that addresses a project or a run admits a call only when the role claims of the token admit that project, every query of a tenant-scoped table is tenant-filtered, the transport credential comes from the secret reference messaging-transport, the seven options of the model are bound and validated at start, the two default budget keys, the platform limit Usage:Budgets:PlatformLimitUsd and the section Usage:Estimates having no shipped value, readiness reports the store, the messaging profile and a valid pricing revision for the meters ModelInputTokens, ModelOutputTokens and ToolInvocations and no Metering service, and the metrics connectsoft.factory.usage.cost_usd, connectsoft.factory.usage.uncertain_records and connectsoft.factory.usage.reservations_denied are registered with their dimensions under the observability conventions; the 404 that follows from the tenant filter is proven by the behaviour PBIs."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-244]",
      "number": 244
    },
    {
      "id": "AIFACTORY-TASK-1828",
      "type": "task",
      "parent": "AIFACTORY-US-451",
      "title": "Verify the hosted surface of CostUsageService with a two-tenant fixture",
      "sequence": "01.06.03.04",
      "description": "Verify the hosted surface of CostUsageService with a two-tenant fixture. Expected output: Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every route without a token and without its scope, call the project routes and the run route with a token that does not admit the project, call both gRPC methods with each workload identity, commit and roll back a publishing handler, deliver one event id twice, and probe readiness with the store stopped and with a meter that has no valid pricing revision, which proves AC1 to AC4 of AIFACTORY-US-451 (ADR-0015, ADR-0012).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every route without a token and without its scope, call the project routes and the run route with a token that does not admit the project, call both gRPC methods with each workload identity, commit and roll back a publishing handler, deliver one event id twice, and probe readiness with the store stopped and with a meter that has no valid pricing revision, which proves AC1 to AC4 of AIFACTORY-US-451 (ADR-0015, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1828]",
      "number": 1828
    },
    {
      "id": "AIFACTORY-US-452",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Open the default budget of a new project, set its limit and approval threshold, announce every change, and roll a monthly budget over at the calendar month in UTC",
      "sequence": "01.06.04",
      "description": "As a workspace admin, I want every project to have a budget from the moment it exists, and to set its limit and the amount above which a run needs approval, so that the runs of my project cannot commit more than I allowed. A budget is the spending limit of a project with the amount already committed and the spend-approval threshold. At this increment a project has exactly one budget. It comes to exist without anyone acting: when ProjectService announces a new project through `ProjectService/ProjectCreated`, the inbox handler `OpenProjectBudget` creates the default `Budget` of the project, idempotently on the event id and on the rule that a project has one budget, with `committedUsd` zero, the approval threshold set to `Usage:Thresholds:PlatformApprovalThresholdUsd` and `periodStart` set to the first instant of the current calendar month in UTC for a monthly budget and to the instant of its creation for a total one, and writes `BudgetUpdated` in the same transaction. The limit and the period of that default budget are read from the two options of the model `Usage:Budgets:DefaultLimitUsd` and `Usage:Budgets:DefaultPeriod` (monthly or total). Their values are an input of the owner: none is shipped, a start without them is refused with the key named, and the deployment of AIFACTORY-TASK-1826 sets the values the owner supplies. A Workspace admin whose scope carries `factory.usage.admin` then sets the budget through `CostUsageService/SetProjectBudget`, a PUT whose body states the period (monthly or total), `limitUsd` and `approvalThresholdUsd`. The budget is addressed by the `projectId` of the path inside the trusted tenant, never by a tenant of the body (ADR-0015). The PUT changes the one budget of the project: a body that states another period than the stored one replaces the period of that budget and creates no second budget, so `Usage.Reserve` always reserves against the same row; a change to monthly sets `periodStart` to the first day of the current calendar month in UTC. The stored budget and the `BudgetUpdated` outbox record with `budgetId`, `tenantId`, `projectId` and `limitUsd` are committed in one transaction and the answer is 200 with the budget; a PUT that states the stored values changes nothing and publishes nothing. A new limit and a new threshold apply to reservations made from then on; reservations already Reserved keep their amount. The period is stored and returned. A monthly budget follows the calendar month in UTC (D117). The `BudgetRolloverWorker` runs at the first instant of every month, two tenants in parallel, with five attempts and exponential backoff from 60 seconds, over the monthly budgets whose `periodStart` lies before the first day of the current calendar month in UTC. For each of them it writes the closed period to the table `BudgetPeriods`, with its start, its end, its `limitUsd`, the `committedUsd` it closed with and the time of the closing, sets `periodStart` to the first day of the new month and resets `committedUsd`, all in one transaction and idempotent on `budgetId` plus `periodStart`, so a repeated trigger closes a period once and a worker that missed its trigger still opens the current month on its next run. The closed period is kept for reports and is never changed again, a total budget is never rolled over, and the worker publishes no event, as the model gives it none. Reservations that are still Reserved at the month boundary are carried into the new period with their estimates (D119): each stays Reserved with its estimate, and the reset leaves `committedUsd` of the new period at the sum of those estimates, and at zero when there is none. A reservation settled after the rollover is then corrected in the new period as always (AIFACTORY-US-455), and the `settledAt` of a reservation tells the period its settlement belongs to. The route answers 409 for the three requests that would break an invariant of the `Budget`: a threshold above the platform threshold, which a project may only lower (D21), a limit below the amount already committed, and a limit above the limit of the budget of its tenant, or above `Usage:Budgets:PlatformLimitUsd` when the tenant has no budget, because the owner decided that a project budget never exceeds the budget of its tenant (D137, AIFACTORY-US-1495); nothing is changed by a refused PUT. Who may call is decided from the token: the route needs the scope, and the role claims of the token must name the caller Workspace admin of the project or Platform admin. A caller without the scope, or a member of the tenant who by those claims is neither, is refused with 403; a project of another tenant is answered 404, the same answer as for a project without a budget in the tenant of the caller (ADR-0015 amendment of D113). `BudgetUpdated` is published on `usage-accounting.budgets.v1.budget-updated` in the run event envelope; StudioBff refreshes its budget view and AuditService records it as evidence in their own PBIs. The tenant-wide budget without a project is set through `CostUsageService/SetTenantBudget` and delivered by AIFACTORY-US-1495, which also holds the default budget of a new project to the ceiling of its tenant. The handler `ApplyEditionLimits`, which adjusts budget ceilings to the edition of a subscription, is not part of this delivery, because `SubscriptionChanged` is published by FactoryCommercialService from I7. Kind: behavior. Traces: services: CostUsageService, ProjectService; aggregates: CostUsageService/Budget, CostUsageService/Reservation; apis: CostUsageService/SetProjectBudget; events: CostUsageService/BudgetUpdated, ProjectService/ProjectCreated; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0020; requirements: FR-09, XL-12, NFR-12; scenarios: SCN-CostUsageService-003, SCN-CostUsageService-011. Relates: screens: project-settings, usage-cost; nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, feature:project-service. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, model/services/control-plane/ProjectService.yaml, docs/planes/control/services/cost-usage-service/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given `ProjectService/ProjectCreated` for a new project of a tenant, when the inbox handler `OpenProjectBudget` runs, then one `CostUsageService/Budget` exists for tenant and project with the period of `Usage:Budgets:DefaultPeriod`, the limit of `Usage:Budgets:DefaultLimitUsd`, `committedUsd` zero and the approval threshold of `Usage:Thresholds:PlatformApprovalThresholdUsd`, the `CostUsageService/BudgetUpdated` outbox record is written in the same transaction, and a redelivery of the event creates no second budget and no second record (SCN-CostUsageService-011).",
        "AC2: Given a Workspace admin whose scope carries `factory.usage.admin` and the budget of a project of the trusted tenant, when `CostUsageService/SetProjectBudget` states a limit above the committed amount and a threshold not above the platform threshold, then the response is 200 with the budget, the budget and the `CostUsageService/BudgetUpdated` outbox record are committed in one transaction, and the same PUT repeated changes nothing and writes no record; when the PUT states another period than the stored one, then the period of that budget is replaced and the project still has exactly one budget (SCN-CostUsageService-003).",
        "AC3: Given a threshold above `Usage:Thresholds:PlatformApprovalThresholdUsd`, a limit below the `committedUsd` of the budget, a limit above the limit of the budget of the tenant or, for a tenant without a budget, above `Usage:Budgets:PlatformLimitUsd` (D137), a caller without `factory.usage.admin` or who by the role claims of the token is neither Workspace admin of the project nor Platform admin, or a project of another tenant, when `CostUsageService/SetProjectBudget` is called, then the answer is 409, 409, 409, 403 or 404 respectively with a problem response, the `CostUsageService/Budget` is unchanged and nothing is published (SCN-CostUsageService-003, ADR-0015).",
        "AC4: Given a budget was opened or changed, when the outbox dispatcher of the `cost-usage` messaging profile publishes `CostUsageService/BudgetUpdated` on `usage-accounting.budgets.v1.budget-updated`, then the event is sent in `run-event-envelope-v1` with `budgetId`, `tenantId`, `projectId` and `limitUsd`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-CostUsageService-011, ADR-0012).",
        "AC5: Given a monthly `CostUsageService/Budget` whose `periodStart` lies in the previous calendar month in UTC, with settled usage and one reservation that is still Reserved, and a total budget, when the `BudgetRolloverWorker` runs at the first instant of the month, then the table `BudgetPeriods` holds one row for the closed month with its start, its end, its `limitUsd`, the `committedUsd` it closed with and the time of the closing, `periodStart` of the budget is the first day of the new month, the reservation is still Reserved with its estimate and is carried into the new period, so `committedUsd` holds that estimate only, the total budget is unchanged, nothing is published, and a second trigger for the same `budgetId` and `periodStart` changes nothing, as the worker and the rollover invariants of the `Budget` and of the `CostUsageService/Reservation` in model/services/control-plane/CostUsageService.yaml state (XL-12, D119)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1829",
        "AIFACTORY-TASK-1847",
        "AIFACTORY-TASK-1830",
        "AIFACTORY-TASK-2201",
        "AIFACTORY-TASK-2202",
        "AIFACTORY-TASK-1831"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5604,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "ProjectService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/Reservation"
        ],
        "apis": [
          "CostUsageService/SetProjectBudget"
        ],
        "events": [
          "CostUsageService/BudgetUpdated",
          "ProjectService/ProjectCreated"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-003",
          "SCN-CostUsageService-011"
        ]
      },
      "relates": {
        "screens": [
          "project-settings",
          "usage-cost"
        ],
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "feature:project-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-452]",
      "number": 452
    },
    {
      "id": "AIFACTORY-TASK-1829",
      "type": "task",
      "parent": "AIFACTORY-US-452",
      "title": "Contract of the budget body and the two configuration keys of the default budget",
      "sequence": "01.06.04.01",
      "description": "Contract of the budget body and the two configuration keys of the default budget. Expected output: The OpenAPI document of the service holds the budget with period, periodStart, limitUsd, committedUsd and approvalThresholdUsd as model/services/control-plane/CostUsageService.yaml names them; the options Usage:Budgets:DefaultLimitUsd (decimal) and Usage:Budgets:DefaultPeriod (monthly or total) of the model are documented on the options page of the repository without a shipped value and validated at start, where a missing or invalid value stops the start with the key named.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service holds the budget with period, periodStart, limitUsd, committedUsd and approvalThresholdUsd as model/services/control-plane/CostUsageService.yaml names them; the options Usage:Budgets:DefaultLimitUsd (decimal) and Usage:Budgets:DefaultPeriod (monthly or total) of the model are documented on the options page of the repository without a shipped value and validated at start, where a missing or invalid value stops the start with the key named."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5604,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1829]",
      "number": 1829
    },
    {
      "id": "AIFACTORY-TASK-1847",
      "type": "task",
      "parent": "AIFACTORY-US-452",
      "title": "Confirm the two default budget keys in the options of the CostUsageService model and on its generated service page",
      "sequence": "01.06.04.02",
      "description": "Confirm the two default budget keys in the options of the CostUsageService model and on its generated service page. Expected output: model/services/control-plane/CostUsageService.yaml lists Usage:Budgets:DefaultLimitUsd and Usage:Budgets:DefaultPeriod under options with their type, no default and a summary that their values are an owner input, as it does since D117; the generated options section of the service page shows both keys, and `python -I tools/docs_model validate` passes.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "model/services/control-plane/CostUsageService.yaml lists Usage:Budgets:DefaultLimitUsd and Usage:Budgets:DefaultPeriod under options with their type, no default and a summary that their values are an owner input, as it does since D117; the generated options section of the service page shows both keys, and `python -I tools/docs_model validate` passes."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5604,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1847]",
      "number": 1847
    },
    {
      "id": "AIFACTORY-TASK-1830",
      "type": "task",
      "parent": "AIFACTORY-US-452",
      "title": "OpenProjectBudget and SetProjectBudget with BudgetUpdated in the transaction of the change",
      "sequence": "01.06.04.03",
      "description": "OpenProjectBudget and SetProjectBudget with BudgetUpdated in the transaction of the change. Expected output: OpenProjectBudget creates the one Budget of a project on ProjectCreated, idempotently on the event id and on the rule that a project has one budget, with the limit and the period of the two default budget keys, the threshold of Usage:Thresholds:PlatformApprovalThresholdUsd and periodStart at the first instant of the current calendar month in UTC for a monthly budget and at its creation for a total one; SetProjectBudget updates period, limit and threshold of that budget in the trusted tenant, replacing its period when the body states another one, setting periodStart to the first day of the current calendar month in UTC on a change to monthly and never creating a second budget; both write the BudgetUpdated outbox record in the same transaction; SetProjectBudget answers 200, changes nothing for the stored values, 409 for a threshold above the platform threshold, a limit below committedUsd or a limit above the limit of the tenant budget, or above Usage:Budgets:PlatformLimitUsd for a tenant without one (D137), 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, and 404 for a foreign project or one without a budget.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "OpenProjectBudget creates the one Budget of a project on ProjectCreated, idempotently on the event id and on the rule that a project has one budget, with the limit and the period of the two default budget keys, the threshold of Usage:Thresholds:PlatformApprovalThresholdUsd and periodStart at the first instant of the current calendar month in UTC for a monthly budget and at its creation for a total one; SetProjectBudget updates period, limit and threshold of that budget in the trusted tenant, replacing its period when the body states another one, setting periodStart to the first day of the current calendar month in UTC on a change to monthly and never creating a second budget; both write the BudgetUpdated outbox record in the same transaction; SetProjectBudget answers 200, changes nothing for the stored values, 409 for a threshold above the platform threshold, a limit below committedUsd or a limit above the limit of the tenant budget, or above Usage:Budgets:PlatformLimitUsd for a tenant without one (D137), 403 for a missing scope or a caller who by the role claims of the token is neither Workspace admin of the project nor Platform admin, and 404 for a foreign project or one without a budget."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1830]",
      "number": 1830
    },
    {
      "id": "AIFACTORY-TASK-2201",
      "type": "task",
      "parent": "AIFACTORY-US-452",
      "title": "Migration of the closed periods of a monthly budget",
      "sequence": "01.06.04.04",
      "description": "Migration of the closed periods of a monthly budget. Expected output: A migration of cost-usage-sql adds the tenant-filtered table BudgetPeriods of the model, keyed by budget and period start, with the end of the period, its limit, the committed amount it closed with and the time of the closing; mapping tests on an isolated test database prove the table, its key, its reference to Budgets and its tenant filter.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration of cost-usage-sql adds the tenant-filtered table BudgetPeriods of the model, keyed by budget and period start, with the end of the period, its limit, the committed amount it closed with and the time of the closing; mapping tests on an isolated test database prove the table, its key, its reference to Budgets and its tenant filter."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5604,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-2201]",
      "number": 2201
    },
    {
      "id": "AIFACTORY-TASK-2202",
      "type": "task",
      "parent": "AIFACTORY-US-452",
      "title": "BudgetRolloverWorker opening the new period of a monthly budget and keeping the closed one",
      "sequence": "01.06.04.05",
      "description": "BudgetRolloverWorker opening the new period of a monthly budget and keeping the closed one. Expected output: The worker runs on the schedule of the model at the first instant of every month over the monthly budgets whose periodStart lies before the first day of the current calendar month in UTC, partitioned by tenant with two partitions in parallel and five attempts with exponential backoff from 60 seconds; under the row version of the Budget it writes the closed period with its start, end, limit, committed amount and closing time to BudgetPeriods, sets periodStart to the first day of the new month and resets committedUsd to the sum of the estimates of the reservations of the budget that are still Reserved, which stay Reserved and are carried into the new period with their estimates (D119), in one transaction and idempotent on budgetId plus periodStart; a total budget is skipped, no event is published, a duplicate trigger has no second effect and a run after a missed trigger opens the current month.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The worker runs on the schedule of the model at the first instant of every month over the monthly budgets whose periodStart lies before the first day of the current calendar month in UTC, partitioned by tenant with two partitions in parallel and five attempts with exponential backoff from 60 seconds; under the row version of the Budget it writes the closed period with its start, end, limit, committed amount and closing time to BudgetPeriods, sets periodStart to the first day of the new month and resets committedUsd to the sum of the estimates of the reservations of the budget that are still Reserved, which stay Reserved and are carried into the new period with their estimates (D119), in one transaction and idempotent on budgetId plus periodStart; a total budget is skipped, no event is published, a duplicate trigger has no second effect and a run after a missed trigger opens the current month."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2202]",
      "number": 2202
    },
    {
      "id": "AIFACTORY-TASK-1831",
      "type": "task",
      "parent": "AIFACTORY-US-452",
      "title": "Verify set-a-project-budget through the acceptance suite",
      "sequence": "01.06.04.06",
      "description": "Verify set-a-project-budget through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-003|Scenario=SCN-CostUsageService-011)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-452 with a fixture publisher of ProjectCreated and a controlled clock, including the redelivered event, the unchanged repeat, a PUT that replaces the period, the 403, 404 and 409 refusals, the 409 of a limit above the tenant limit and above the platform limit among them, the publication and payload of BudgetUpdated, and the rollover of a monthly budget across a month boundary in UTC with the closed period kept in BudgetPeriods, a Reserved reservation carried into the new period, a total budget left alone and a repeated trigger; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-003|Scenario=SCN-CostUsageService-011)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-452 with a fixture publisher of ProjectCreated and a controlled clock, including the redelivered event, the unchanged repeat, a PUT that replaces the period, the 403, 404 and 409 refusals, the 409 of a limit above the tenant limit and above the platform limit among them, the publication and payload of BudgetUpdated, and the rollover of a monthly budget across a month boundary in UTC with the closed period kept in BudgetPeriods, a Reserved reservation carried into the new period, a total budget left alone and a repeated trigger; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1831]",
      "number": 1831
    },
    {
      "id": "AIFACTORY-US-1495",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Set the budget of a tenant under the platform limit and hold every project budget of the tenant to it",
      "sequence": "01.06.05",
      "description": "As a platform admin, I want to set one budget for my whole tenant that no project budget may exceed, so that the projects of the tenant together stay inside what the tenant may spend, and the tenant inside what the platform allows. The owner decided that a project budget may not exceed the budget of its tenant and that a tenant budget may not exceed the budget of the platform, and that CostUsageService enforces both (D137). The platform limit is the option `Usage:Budgets:PlatformLimitUsd`, an input of the owner without a shipped value, so a start without it is refused with the key named. The ceiling of a tenant budget is the lower of that limit and the edition limit of the subscription of the tenant (D139); the edition limit is kept by `ApplyEditionLimits` from `SubscriptionChanged` of FactoryCommercialService, which arrives in I7, so up to then the ceiling is the platform limit, and this delivery proves that one. A caller whose scope carries `factory.usage.admin` and whose role claims name the Platform admin of the tenant sets the tenant-wide budget through `CostUsageService/SetTenantBudget`, a PUT on `/factory/budget` whose body states the period (monthly or total) and `limitUsd`. The tenant is the one the token names and never one of the body (ADR-0015); the route addresses no project and therefore answers no 404. The PUT creates the one `Budget` of the tenant without a project when none exists and changes it otherwise, never a second one; a monthly tenant budget has its `periodStart` at the first day of the current calendar month in UTC, as for a project budget. The budget and the `BudgetUpdated` outbox record with `budgetId`, `tenantId`, `limitUsd` and `committedUsd` and without `projectId` are committed in one transaction and the answer is 200 with the budget; a PUT that states the stored values changes nothing and publishes nothing. The route answers 409 and changes nothing for a limit above `Usage:Budgets:PlatformLimitUsd` and for a limit below the limit of a project budget of the tenant, so lowering the tenant limit never leaves a project above it; the problem response names the rule that was broken. The same ceiling holds on the project side: `CostUsageService/SetProjectBudget` answers 409 for a project limit above the limit of the tenant budget (AIFACTORY-US-452), and a project budget of a tenant without a tenant budget is held to the platform limit. Both checks read the other budget in the transaction of the change under its row version, so two concurrent changes, one to the tenant budget and one to a project budget, never leave a project limit above the limit of its tenant. As a design choice of this PBI the default budget that `OpenProjectBudget` opens for a new project takes the smaller of `Usage:Budgets:DefaultLimitUsd` and the ceiling of the tenant, its tenant budget or, without one, the platform limit, so a default never breaks the rule. The tenant budget is a ceiling of the limits of the project budgets: reservations and usage records count on the budget of their project, as the model gives a reservation one budget, so the committed amount of the tenant budget stays zero; that reading is reported to the owner. A caller without the scope, or with the scope and without the Platform admin role, such as the Workspace admin of a project, is refused with 403. `BudgetUpdated` is published on `usage-accounting.budgets.v1.budget-updated` in the run event envelope; StudioBff and AuditService handle it in their own PBIs. Kind: behavior. Traces: services: CostUsageService, ProjectService; aggregates: CostUsageService/Budget; apis: CostUsageService/SetTenantBudget, CostUsageService/SetProjectBudget; events: CostUsageService/BudgetUpdated, ProjectService/ProjectCreated; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0020; requirements: FR-09, NFR-12; scenarios: SCN-CostUsageService-003, SCN-CostUsageService-011, SCN-CostUsageService-014. Relates: screens: usage-cost; nfrs: NFR-12. Depends on: AIFACTORY-US-451, AIFACTORY-US-452, feature:project-service. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, docs/planes/control/services/cost-usage-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Platform admin whose scope carries `factory.usage.admin` and a tenant without a budget, when `CostUsageService/SetTenantBudget` states a period and a limit at or below `Usage:Budgets:PlatformLimitUsd` and at or above the limit of every project budget of the tenant, then the response is 200 with the budget, one `CostUsageService/Budget` of the tenant without a project exists, the `CostUsageService/BudgetUpdated` outbox record without `projectId` is written in the same transaction, a second PUT with other values changes that budget and creates no second one, and the same PUT repeated changes nothing and writes no record (SCN-CostUsageService-014, D137).",
        "AC2: Given a limit above `Usage:Budgets:PlatformLimitUsd`, or a limit below the limit of a project budget of the tenant, when `CostUsageService/SetTenantBudget` is called, then the answer is 409 with a problem response that names the rule, the tenant budget is unchanged and nothing is published; given a caller without `factory.usage.admin`, or with it and without the Platform admin role, then the answer is 403 and nothing changes (SCN-CostUsageService-014, ADR-0015).",
        "AC3: Given a tenant budget, when `CostUsageService/SetProjectBudget` states a project limit above its limit, then the answer is 409 and the project budget is unchanged; given a tenant without a budget, when it states a project limit above `Usage:Budgets:PlatformLimitUsd`, then the answer is 409; given a tenant budget change and a project budget change of the same tenant that run concurrently, when both have committed or been refused, then no project limit is above the tenant limit (SCN-CostUsageService-003, D137).",
        "AC4: Given a tenant budget whose limit is below `Usage:Budgets:DefaultLimitUsd`, when `ProjectService/ProjectCreated` announces a new project of the tenant and `OpenProjectBudget` opens its default budget, then the limit of that budget is the limit of the tenant budget; given a tenant without a budget and a default above the platform limit, then the limit is the platform limit (SCN-CostUsageService-011, D137).",
        "AC5: Given the service starts without `Usage:Budgets:PlatformLimitUsd`, when the options are validated, then the start is refused with the key named; given a committed tenant budget change, when the dispatcher of the `cost-usage` messaging profile publishes `CostUsageService/BudgetUpdated`, then it is sent in `run-event-envelope-v1` with `budgetId`, `tenantId`, `limitUsd` and `committedUsd` and without `projectId`, and a transport outage is retried with backoff so it is neither lost nor duplicated under its event id (SCN-CostUsageService-014, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6076",
        "AIFACTORY-TASK-6077",
        "AIFACTORY-TASK-6078",
        "AIFACTORY-TASK-6079"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5605,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "ProjectService"
        ],
        "aggregates": [
          "CostUsageService/Budget"
        ],
        "apis": [
          "CostUsageService/SetTenantBudget",
          "CostUsageService/SetProjectBudget"
        ],
        "events": [
          "CostUsageService/BudgetUpdated",
          "ProjectService/ProjectCreated"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-003",
          "SCN-CostUsageService-011",
          "SCN-CostUsageService-014"
        ]
      },
      "relates": {
        "screens": [
          "usage-cost"
        ],
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-451",
        "AIFACTORY-US-452",
        "feature:project-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1495]",
      "number": 1495
    },
    {
      "id": "AIFACTORY-TASK-6076",
      "type": "task",
      "parent": "AIFACTORY-US-1495",
      "title": "Contract of SetTenantBudget and of the platform limit option",
      "sequence": "01.06.05.01",
      "description": "Contract of SetTenantBudget and of the platform limit option. Expected output: The OpenAPI document of the service holds PUT /factory/budget under factory.usage.admin with the side-effect class shared-write, natural idempotency, a body with period and limitUsd and the codes 200, 403 and 409, and the options page of the repository documents Usage:Budgets:PlatformLimitUsd (decimal) without a shipped value, validated at start so that a missing or invalid value stops the start with the key named (D137).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service holds PUT /factory/budget under factory.usage.admin with the side-effect class shared-write, natural idempotency, a body with period and limitUsd and the codes 200, 403 and 409, and the options page of the repository documents Usage:Budgets:PlatformLimitUsd (decimal) without a shipped value, validated at start so that a missing or invalid value stops the start with the key named (D137)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5605,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6076]",
      "number": 6076
    },
    {
      "id": "AIFACTORY-TASK-6077",
      "type": "task",
      "parent": "AIFACTORY-US-1495",
      "title": "SetTenantBudget and the ceiling checks of the tenant and the project budget",
      "sequence": "01.06.05.02",
      "description": "SetTenantBudget and the ceiling checks of the tenant and the project budget. Expected output: SetTenantBudget admits a caller with factory.usage.admin and the Platform admin role, creates or changes the one Budget of the tenant of the token without a project, sets periodStart as for a project budget, writes BudgetUpdated without projectId in the same transaction, changes nothing on a repeat and answers 409 for a limit above Usage:Budgets:PlatformLimitUsd or below the limit of a project budget of the tenant and 403 otherwise as AIFACTORY-US-1495 states; SetProjectBudget answers 409 for a limit above the tenant limit, or above the platform limit for a tenant without a budget; each check reads the other budget in the transaction of the change under its row version, so concurrent changes never leave a project limit above its tenant limit (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "SetTenantBudget admits a caller with factory.usage.admin and the Platform admin role, creates or changes the one Budget of the tenant of the token without a project, sets periodStart as for a project budget, writes BudgetUpdated without projectId in the same transaction, changes nothing on a repeat and answers 409 for a limit above Usage:Budgets:PlatformLimitUsd or below the limit of a project budget of the tenant and 403 otherwise as AIFACTORY-US-1495 states; SetProjectBudget answers 409 for a limit above the tenant limit, or above the platform limit for a tenant without a budget; each check reads the other budget in the transaction of the change under its row version, so concurrent changes never leave a project limit above its tenant limit (D137)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6077]",
      "number": 6077
    },
    {
      "id": "AIFACTORY-TASK-6078",
      "type": "task",
      "parent": "AIFACTORY-US-1495",
      "title": "Default budget of a new project held to the ceiling of its tenant",
      "sequence": "01.06.05.03",
      "description": "Default budget of a new project held to the ceiling of its tenant. Expected output: OpenProjectBudget opens the default budget of a new project with the smaller of Usage:Budgets:DefaultLimitUsd and the limit of the tenant budget, or the platform limit for a tenant without one, so that a default budget never exceeds the ceiling of its tenant (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "OpenProjectBudget opens the default budget of a new project with the smaller of Usage:Budgets:DefaultLimitUsd and the limit of the tenant budget, or the platform limit for a tenant without one, so that a default budget never exceeds the ceiling of its tenant (D137)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6078]",
      "number": 6078
    },
    {
      "id": "AIFACTORY-TASK-6079",
      "type": "task",
      "parent": "AIFACTORY-US-1495",
      "title": "Verify set-the-tenant-budget-under-the-platform-limit through the acceptance suite",
      "sequence": "01.06.05.04",
      "description": "Verify set-the-tenant-budget-under-the-platform-limit through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenantBudget&(Scenario=SCN-CostUsageService-014|Scenario=SCN-CostUsageService-003|Scenario=SCN-CostUsageService-011)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1495: the tenant budget created and changed once with BudgetUpdated without projectId, the repeat, the 409 above the platform limit and below a project limit, the 403 of a Workspace admin, the 409 of a project limit above the tenant limit and above the platform limit, two concurrent changes, the default budget held to the ceiling and the start refused without the platform limit.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenantBudget&(Scenario=SCN-CostUsageService-014|Scenario=SCN-CostUsageService-003|Scenario=SCN-CostUsageService-011)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1495: the tenant budget created and changed once with BudgetUpdated without projectId, the repeat, the 409 above the platform limit and below a project limit, the 403 of a Workspace admin, the 409 of a project limit above the tenant limit and above the platform limit, two concurrent changes, the default budget held to the ceiling and the start refused without the platform limit."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6079]",
      "number": 6079
    },
    {
      "id": "AIFACTORY-US-453",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Reserve the estimated cost of an accepted run before dispatch, deny it at the budget limit, and above the approval threshold announce the required spend approval and reserve once it is granted",
      "sequence": "01.06.06",
      "description": "Every run reserves before it spends, except a child run, which has no reservation of its own and spends on the reservation of its parent run (D121). When RunControlService announces a run through `RunControlService/RunAccepted`, the inbox handler `ReserveForRun` estimates the cost of the run and reserves it against the budget of the project. For a `RunAccepted` that carries `parentRunId`, which marks a child run, the handler estimates and reserves nothing and publishes none of the three events of this PBI; it notes the child run under the reservation of the parent run, which AIFACTORY-US-737 delivers, and everything below concerns a run without a parent. The same command is exposed as the internal gRPC method `CostUsageService/Usage.Reserve`, whose request and reply are `usage-reservation-v1`; at this increment the event is the path that runs, since no PBI of RunControlService calls the method. Both paths are one command, idempotent on `runId`: the unique index over the run admits one reservation per run, and a second request for a run that has a reservation returns the outcome that exists and changes nothing. The descriptor is the same in both directions and requires fields a caller cannot know, so the contract of the method states who sets what. The caller sends `tenantId`, `projectId` and `runId`. `reservationId`, `budgetId`, `state`, `expiresAt` and `approvalId` are assigned by the service, and a value sent for them is ignored. `amount.estimatedCostUsd` is computed by the service: an `amount` the caller sends is not trusted, the service reserves its own estimate and returns it, whatever the caller sent. The estimate needs a rule, and the rule and its values are an input of the owner that is never invented here: `RunAccepted` carries the `workflowId` and the `modelProfileId` of the run and no limits, and the model holds the section `Usage:Estimates` as the place the estimator reads, without a default value. Until the owner gives the rule, the estimate comes from one estimator port with one configured implementation whose inputs are named: for the workflow and the model profile of the run it reads the expected quantity per meter from the configuration section `Usage:Estimates` and prices it with the pricing revision valid at the moment of the reservation. When the section holds no entry for that workflow and profile, or no pricing revision is valid, the estimator returns no estimate and never zero. The command has three outcomes. When the estimate fits, that is `committedUsd` plus the estimate does not exceed `limitUsd` and the estimate does not exceed `approvalThresholdUsd`, the `Reservation` is created in Reserved with `expiresAt` set from `Usage:Reservations:ExpiryMinutes`, `committedUsd` grows by the estimate and the `BudgetReserved` outbox record is written, all in one transaction. When the estimate would take `committedUsd` above `limitUsd`, which is always the case while observed usage holds the budget above its limit (AIFACTORY-US-549), or when no estimate is available, the reservation is recorded as Denied, the budget is unchanged, `BudgetReservationDenied` is written in the same transaction with the reason, `budget-exceeded` or `estimate-unavailable`, and `connectsoft.factory.usage.reservations_denied` is incremented with that reason, so a run that cannot be covered or cannot be estimated does not dispatch. When the estimate fits the limit and exceeds the threshold, the run needs a spend approval (D21), and the owner decided how it is obtained (D117): nothing is reserved, no reservation row is written, `committedUsd` is unchanged, and the `SpendApprovalRequired` outbox record is written with `runId`, `tenantId`, `projectId`, `estimatedUsd` and `thresholdUsd`; the gRPC reply names the outcome approval-required. The `state` enumeration of `usage-reservation-v1` holds no value for that outcome, so the proto reply carries the outcome beside the reservation, which is absent. A redelivered `RunAccepted` is absorbed by the inbox and announces nothing twice, and a repeated call of the method for such a run gives the outcome approval-required again, while RunControlService opens at most one spend approval per run. On the event RunControlService opens a run-level approval of the action class spend and the run waits in WaitingForApproval, or stays Held when a frozen environment holds it (AIFACTORY-US-546 of feature `run-control-service`). The estimate travels with that approval and no row waits in this service: `RunControlService/ApprovalDecided` carries the proposal kind spend and the `estimatedUsd` the decision authorizes, and the inbox handler `ReserveOnSpendApproval` consumes it. For an Approved spend approval the handler reserves the approved estimate like any other estimate: under the row version of the budget the limit is checked again, the `Reservation` is created in Reserved with its `approvalId` and its `expiresAt`, `committedUsd` grows and `BudgetReserved` is written in the same transaction, on which RunControlService dispatches the run it had returned to Accepted; when the budget no longer covers the estimate the reservation is recorded as Denied with `BudgetReservationDenied` and the reason `budget-exceeded`. The approved estimate is reserved as approved and is not estimated again, because the decision is bound to that amount. A spend approval may be decided while its run is Held by a frozen environment (D119): the handler does not look at the state of the run and reserves an Approved one at once, so the reservation exists when the environment is active again and the run is dispatched. For a Rejected or an Expired spend approval the handler releases nothing, because nothing was reserved, and publishes nothing; RunControlService fails that run as policy-denied on its own decision. A spend approval that ends Cancelled with its cancelled or failed run changes nothing either, and the decisions of other proposal kinds are ignored. The handler is idempotent on the event id and on `runId`, so a redelivered decision reserves once. Two reservations that race on one budget are serialised by the row version of the `Budget`: the loser is retried and the limit is never exceeded by a reservation. `BudgetReserved` is published on `usage-accounting.reservations.v1.budget-reserved` with `reservationId`, `runId`, `tenantId` and `estimatedUsd` and lets RunControlService dispatch the first attempt; `BudgetReservationDenied` is published on `usage-accounting.reservations.v1.budget-reservation-denied` with `runId`, `tenantId` and `reason` and makes RunControlService fail an Accepted or a Held run as policy-denied; `SpendApprovalRequired` is published on `usage-accounting.reservations.v1.spend-approval-required`. All three travel in the run event envelope and are handled by RunControlService, the first two also by StudioBff, in their own PBIs. Over gRPC a caller without a workload identity is refused with Unauthenticated, a workload token without the service scope with PermissionDenied, an invalid request with InvalidArgument, and a project or a run of another tenant is answered NOT_FOUND like an unknown one (ADR-0015 amendment of D114). Kind: behavior. Traces: services: CostUsageService, RunControlService; aggregates: CostUsageService/Budget, CostUsageService/Reservation; apis: CostUsageService/Usage.Reserve; events: CostUsageService/BudgetReserved, CostUsageService/BudgetReservationDenied, CostUsageService/SpendApprovalRequired, RunControlService/RunAccepted, RunControlService/ApprovalDecided; descriptors: usage-reservation-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0020; requirements: FR-09, XL-12, NFR-09, NFR-12; scenarios: SCN-CostUsageService-004, SCN-CostUsageService-006, SCN-CostUsageService-007, SCN-CostUsageService-012. Relates: nfrs: NFR-09, NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-452, feature:run-control-service. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/usage-record.schema.json, docs/reference/schemas/approval.schema.json, docs/planes/control/services/cost-usage-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a `CostUsageService/Budget` with room, an entry of `Usage:Estimates` for the workflow and the model profile of the run and a valid pricing revision, such that the estimate does not exceed the threshold, when `RunControlService/RunAccepted` is handled by `ReserveForRun` or `CostUsageService/Usage.Reserve` is called for the run, then a `CostUsageService/Reservation` is Reserved with the estimate the service computed and `expiresAt` from `Usage:Reservations:ExpiryMinutes`, `committedUsd` grows by the estimate, the `CostUsageService/BudgetReserved` outbox record is written in the same transaction, the gRPC reply is `usage-reservation-v1` with the state Reserved and the service estimate even when the caller sent another `amount`, and a second request for the same run returns the same reservation and changes nothing (SCN-CostUsageService-004).",
        "AC2: Given an estimate that would take `committedUsd` above `limitUsd`, when the run is reserved, then the reservation is recorded as Denied, the `CostUsageService/Budget` is unchanged, the `CostUsageService/BudgetReservationDenied` outbox record with the reason `budget-exceeded` is written in the same transaction and `connectsoft.factory.usage.reservations_denied` is incremented; given a run whose workflow and model profile have no entry in `Usage:Estimates`, then it is Denied the same way with the reason `estimate-unavailable` and never reserved with an estimate of zero; given two reservations that race on one budget whose room covers one of them, then one is Reserved, the other Denied, and `committedUsd` does not exceed `limitUsd` (SCN-CostUsageService-004, NFR-09).",
        "AC3: Given an estimate that fits the limit and exceeds `approvalThresholdUsd`, when the run is reserved through `ReserveForRun` or `CostUsageService/Usage.Reserve`, then no `CostUsageService/Reservation` is written, `committedUsd` is unchanged, the `CostUsageService/SpendApprovalRequired` outbox record with `runId`, `tenantId`, `projectId`, `estimatedUsd` and `thresholdUsd` is written, neither `CostUsageService/BudgetReserved` nor `CostUsageService/BudgetReservationDenied` is written, the gRPC reply names the outcome approval-required without a reservation, and a redelivery of the same `RunControlService/RunAccepted` writes no second record (SCN-CostUsageService-004, SCN-CostUsageService-012).",
        "AC4: Given `RunControlService/ApprovalDecided` with the proposal kind spend and the state Approved for a run without a reservation, whatever the state of that run and also while it is Held (D119), when the inbox handler `ReserveOnSpendApproval` runs, then a `CostUsageService/Reservation` is Reserved with the `estimatedUsd` of the event, its `approvalId` and `expiresAt` from `Usage:Reservations:ExpiryMinutes`, `committedUsd` grows by that estimate and the `CostUsageService/BudgetReserved` outbox record is written in the same transaction, or the reservation is recorded as Denied with `CostUsageService/BudgetReservationDenied` and the reason `budget-exceeded` when the budget no longer covers the estimate; given the state Rejected, Expired or Cancelled, or another proposal kind, then no reservation is written, the `CostUsageService/Budget` is unchanged and nothing is published; a redelivery of the event reserves nothing twice (SCN-CostUsageService-012, SCN-CostUsageService-006).",
        "AC5: Given a caller without a workload identity, a workload token without the service scope, a request without `tenantId`, `projectId` or `runId`, or a project or run of another tenant, when `CostUsageService/Usage.Reserve` is called, then the call is refused with Unauthenticated, PermissionDenied, InvalidArgument or NOT_FOUND respectively, no reservation is written and the budget is unchanged; and given a reservation was made or denied or a spend approval was required, when the outbox dispatcher of the `cost-usage` messaging profile publishes `CostUsageService/BudgetReserved` on `usage-accounting.reservations.v1.budget-reserved`, `CostUsageService/BudgetReservationDenied` on `usage-accounting.reservations.v1.budget-reservation-denied` or `CostUsageService/SpendApprovalRequired` on `usage-accounting.reservations.v1.spend-approval-required`, then the event is sent in `run-event-envelope-v1` with `reservationId`, `runId`, `tenantId` and `estimatedUsd`, with `runId`, `tenantId` and `reason`, or with `runId`, `tenantId`, `projectId`, `estimatedUsd` and `thresholdUsd`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-CostUsageService-004, SCN-CostUsageService-006, SCN-CostUsageService-007, SCN-CostUsageService-012, ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/usage-record.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/control/services/cost-usage-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1846",
        "AIFACTORY-TASK-310",
        "AIFACTORY-TASK-2200",
        "AIFACTORY-TASK-1832",
        "AIFACTORY-TASK-1833"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5606,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "RunControlService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/Reservation"
        ],
        "apis": [
          "CostUsageService/Usage.Reserve"
        ],
        "events": [
          "CostUsageService/BudgetReserved",
          "CostUsageService/BudgetReservationDenied",
          "CostUsageService/SpendApprovalRequired",
          "RunControlService/RunAccepted",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "usage-reservation-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-09",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-004",
          "SCN-CostUsageService-006",
          "SCN-CostUsageService-007",
          "SCN-CostUsageService-012"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-09",
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-452",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/usage-record.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/control/services/cost-usage-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-453]",
      "number": 453
    },
    {
      "id": "AIFACTORY-TASK-1846",
      "type": "task",
      "parent": "AIFACTORY-US-453",
      "title": "Contract of Usage.Reserve, input and assigned fields, the three outcomes and the denial reasons",
      "sequence": "01.06.06.01",
      "description": "Contract of Usage.Reserve, input and assigned fields, the three outcomes and the denial reasons. Expected output: The contract document and the proto of Usage.Reserve state, against the UsageReservation definition of docs/reference/schemas/usage-record.schema.json, that the caller sends tenantId, projectId and runId, that reservationId, budgetId, state, expiresAt and approvalId are assigned by the service and ignored when sent, and that amount.estimatedCostUsd is computed by the service and returned whatever amount the caller sent; the reply carries the outcome Reserved, Denied or approval-required beside the reservation, which is absent for approval-required; the outcome approval-required is announced by SpendApprovalRequired with runId, tenantId, projectId, estimatedUsd and thresholdUsd, and the reservation that follows an approval carries its approvalId; the reasons budget-exceeded and estimate-unavailable of BudgetReservationDenied are named; and the options page of the repository documents the section Usage:Estimates with its keys workflow and model profile and the expected quantity per meter, its values being an input of the owner.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The contract document and the proto of Usage.Reserve state, against the UsageReservation definition of docs/reference/schemas/usage-record.schema.json, that the caller sends tenantId, projectId and runId, that reservationId, budgetId, state, expiresAt and approvalId are assigned by the service and ignored when sent, and that amount.estimatedCostUsd is computed by the service and returned whatever amount the caller sent; the reply carries the outcome Reserved, Denied or approval-required beside the reservation, which is absent for approval-required; the outcome approval-required is announced by SpendApprovalRequired with runId, tenantId, projectId, estimatedUsd and thresholdUsd, and the reservation that follows an approval carries its approvalId; the reasons budget-exceeded and estimate-unavailable of BudgetReservationDenied are named; and the options page of the repository documents the section Usage:Estimates with its keys workflow and model profile and the expected quantity per meter, its values being an input of the owner."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5606,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1846]",
      "number": 1846
    },
    {
      "id": "AIFACTORY-TASK-310",
      "type": "task",
      "parent": "AIFACTORY-US-453",
      "title": "Budgets and reservations before dispatch as one command with three outcomes and a configured estimator",
      "sequence": "01.06.06.02",
      "description": "Budgets and reservations before dispatch as one command with three outcomes and a configured estimator. Expected output: ReserveForRun on RunAccepted and the gRPC method Usage.Reserve run one command that is idempotent on runId; a RunAccepted that carries parentRunId does not run this command and is handled as AIFACTORY-TASK-2975 states, since a child run gets no reservation of its own (D121); the estimator port has one configured implementation that reads the expected quantity per meter for the workflow and the model profile of the run from Usage:Estimates and prices it with the pricing revision valid at the reservation, and returns no estimate, never zero, when the entry or the revision is missing; under the row version of the Budget the command creates the Reservation in Reserved with expiresAt and the BudgetReserved outbox record while committedUsd grows, or records it as Denied with the BudgetReservationDenied outbox record, the reason budget-exceeded or estimate-unavailable and the denial metric, or, above the threshold, writes no reservation, leaves committedUsd unchanged, writes the SpendApprovalRequired outbox record with runId, tenantId, projectId, estimatedUsd and thresholdUsd and replies approval-required; a version conflict is retried so no reservation exceeds the limit.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "ReserveForRun on RunAccepted and the gRPC method Usage.Reserve run one command that is idempotent on runId; a RunAccepted that carries parentRunId does not run this command and is handled as AIFACTORY-TASK-2975 states, since a child run gets no reservation of its own (D121); the estimator port has one configured implementation that reads the expected quantity per meter for the workflow and the model profile of the run from Usage:Estimates and prices it with the pricing revision valid at the reservation, and returns no estimate, never zero, when the entry or the revision is missing; under the row version of the Budget the command creates the Reservation in Reserved with expiresAt and the BudgetReserved outbox record while committedUsd grows, or records it as Denied with the BudgetReservationDenied outbox record, the reason budget-exceeded or estimate-unavailable and the denial metric, or, above the threshold, writes no reservation, leaves committedUsd unchanged, writes the SpendApprovalRequired outbox record with runId, tenantId, projectId, estimatedUsd and thresholdUsd and replies approval-required; a version conflict is retried so no reservation exceeds the limit."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5606,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-310]",
      "number": 310
    },
    {
      "id": "AIFACTORY-TASK-2200",
      "type": "task",
      "parent": "AIFACTORY-US-453",
      "title": "ReserveOnSpendApproval inbox handler reserving the approved estimate of a spend approval",
      "sequence": "01.06.06.03",
      "description": "ReserveOnSpendApproval inbox handler reserving the approved estimate of a spend approval. Expected output: The handler of ApprovalDecided acts on the proposal kind spend only: for the state Approved it runs the reservation command with the estimatedUsd of the event instead of a new estimate, so that under the row version of the Budget the Reservation is created in Reserved with its approvalId and expiresAt and the BudgetReserved outbox record while committedUsd grows, or is recorded as Denied with BudgetReservationDenied and the reason budget-exceeded when the budget no longer covers the estimate; for Rejected, Expired and Cancelled it writes and publishes nothing, because nothing was reserved; it does not read the state of the run, so the approval of a run that is Held is reserved at once (D119); it ignores every other proposal kind and is idempotent on the event id and on runId.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The handler of ApprovalDecided acts on the proposal kind spend only: for the state Approved it runs the reservation command with the estimatedUsd of the event instead of a new estimate, so that under the row version of the Budget the Reservation is created in Reserved with its approvalId and expiresAt and the BudgetReserved outbox record while committedUsd grows, or is recorded as Denied with BudgetReservationDenied and the reason budget-exceeded when the budget no longer covers the estimate; for Rejected, Expired and Cancelled it writes and publishes nothing, because nothing was reserved; it does not read the state of the run, so the approval of a run that is Held is reserved at once (D119); it ignores every other proposal kind and is idempotent on the event id and on runId."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5606,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2200]",
      "number": 2200
    },
    {
      "id": "AIFACTORY-TASK-1832",
      "type": "task",
      "parent": "AIFACTORY-US-453",
      "title": "Acceptance fixtures of estimator entries, pricing revisions and publishers of RunAccepted and ApprovalDecided",
      "sequence": "01.06.06.04",
      "description": "Acceptance fixtures of estimator entries, pricing revisions and publishers of RunAccepted and ApprovalDecided. Expected output: The acceptance suite configures entries of Usage:Estimates and seeds pricing revisions so that a test fixes the estimate of a run through its workflow and model profile without replacing the estimator, leaves one workflow without an entry for the estimate-unavailable outcome, and publishes RunAccepted through a fixture publisher, so that the three outcomes of the command and the race of two reservations are reproducible; a second fixture publisher sends ApprovalDecided with the proposal kind spend, a stated estimatedUsd and the state Approved, Rejected, Expired or Cancelled, and with another proposal kind, so that the reservation on a granted spend approval is reproducible without RunControlService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The acceptance suite configures entries of Usage:Estimates and seeds pricing revisions so that a test fixes the estimate of a run through its workflow and model profile without replacing the estimator, leaves one workflow without an entry for the estimate-unavailable outcome, and publishes RunAccepted through a fixture publisher, so that the three outcomes of the command and the race of two reservations are reproducible; a second fixture publisher sends ApprovalDecided with the proposal kind spend, a stated estimatedUsd and the state Approved, Rejected, Expired or Cancelled, and with another proposal kind, so that the reservation on a granted spend approval is reproducible without RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5606,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1832]",
      "number": 1832
    },
    {
      "id": "AIFACTORY-TASK-1833",
      "type": "task",
      "parent": "AIFACTORY-US-453",
      "title": "Verify reserve-run-budget through the acceptance suite",
      "sequence": "01.06.06.05",
      "description": "Verify reserve-run-budget through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-004|Scenario=SCN-CostUsageService-006|Scenario=SCN-CostUsageService-007|Scenario=SCN-CostUsageService-012)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-453, including the idempotent second request, an amount sent by the caller that the service overrides, the denial for a missing estimate, two racing reservations, the approval-required outcome that reserves nothing and writes SpendApprovalRequired once, the reservation with its approvalId on an Approved spend approval, the denial when the budget no longer covers it, nothing written for a Rejected, Expired or Cancelled one, the gRPC refusals and the publication and payload of BudgetReserved, BudgetReservationDenied and SpendApprovalRequired; consumer handling is proven by the suite of RunControlService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-004|Scenario=SCN-CostUsageService-006|Scenario=SCN-CostUsageService-007|Scenario=SCN-CostUsageService-012)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-453, including the idempotent second request, an amount sent by the caller that the service overrides, the denial for a missing estimate, two racing reservations, the approval-required outcome that reserves nothing and writes SpendApprovalRequired once, the reservation with its approvalId on an Approved spend approval, the denial when the budget no longer covers it, nothing written for a Rejected, Expired or Cancelled one, the gRPC refusals and the publication and payload of BudgetReserved, BudgetReservationDenied and SpendApprovalRequired; consumer handling is proven by the suite of RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5606,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1833]",
      "number": 1833
    },
    {
      "id": "AIFACTORY-US-454",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Record each metered quantity from a model or tool receipt exactly once per meter, priced by revision, keep unknown or unpriced usage uncertain and keep a late receipt as its confirmation",
      "sequence": "01.06.07",
      "description": "ModelRouterService and ToolAdapterService, the only services that call model providers and execute tools, report what a call consumed, and CostUsageService turns each receipt into one usage record per meter. A receipt arrives on two paths that are one command: the internal gRPC method `CostUsageService/Usage.RecordUsage`, whose request is `usage-record-v1` and whose reply is `ack-v1`, called by ModelRouterService, ToolAdapterService and RunControlService with a workload identity; and the inbox handlers `RecordModelUsage` for `ModelRouterService/ModelInvoked` and `RecordToolUsage` for `ToolAdapterService/ToolInvoked`. The descriptor holds fields a caller cannot know, so the contract of the method states who sets what. The caller sends `tenantId`, `projectId`, the `runId` when the usage belongs to a run, the optional `stepId`, `attemptId` and `reservationId`, `meter`, `dimensions`, the `quantity` when it is known, `status` (observed, estimated or uncertain), `sourceReceipt` and `occurredAt`. `usageId`, `pricingRevision`, `estimatedCost`, `confirmedCost` and `reconciledAt` are assigned by the service: a `usageId` the caller sends is ignored, and the service prices by the revision of its own table that is valid at `occurredAt`, so a `pricingRevision` the caller sends is not stored and one that differs changes nothing. A request without `sourceReceipt`, on which the idempotency rests, with the status reserved or reconciled, with a meter outside the enumeration, or with the status observed or estimated and no `quantity` is refused with InvalidArgument. The command is idempotent on the receipt, since `sourceReceipt` is unique per meter. The same receipt with the same content, delivered by both paths or twice by one, yields one `UsageRecord` per meter and an accepted acknowledgement. A later receipt is not a duplicate: when a receipt arrives for a `sourceReceipt` whose stored record is Estimated or Uncertain and the new receipt reports the usage, it is kept as the confirmation of that record in the table `LateReceipts` and acknowledged as accepted; the stored record is not rewritten by the command, and the `ReconciliationWorker` applies the confirmation (AIFACTORY-US-456). A receipt with other content for a record that is Observed or Reconciled is acknowledged as a conflict and changes nothing. A record attributes one quantity on one meter to the trusted tenant, the project and, where the receipt names them, the run and the attempt, with the dimensions of the receipt (profile, provider, model, tool, pool), `occurredAt`, and the pricing revision valid at `occurredAt` for the meter and the dimension, from which `estimatedCostUsd` is computed; a past record keeps the revision it was priced with. The input tokens and the output tokens of a model call are two meters, each with its own pricing (D117): from `ModelInvoked` two records are written with the receipt of the invocation as their `sourceReceipt`, one on the meter `ModelInputTokens` with `inputTokens` as its quantity and one on the meter `ModelOutputTokens` with `outputTokens`, each priced by the revision of its own meter, while the `estimatedCostUsd` the event carries is not stored. From `ToolInvoked` one record of quantity one is written on the meter `ToolInvocations`, with the tool and the state of the invocation in the dimensions. The unit and the factor of each meter and whether a failed or cancelled invocation is metered are inputs of the owner and are not decided here. The status follows the receipt: usage the provider reported is recorded as Observed, estimated usage as Estimated, and a receipt with unknown usage as Uncertain. Usage that cannot be priced or whose quantity is unknown is stored and never refused (D117). A receipt that reports no quantity, that is a `usage-record-v1` with the status uncertain and no `quantity` or a `ModelInvoked` without the token count of a meter, is recorded as Uncertain without a quantity; one that carries an estimate keeps it as its quantity. A receipt whose meter and dimension have no pricing revision valid at `occurredAt` is recorded as Uncertain as well, whatever status it reports, with the quantity it carries and without a pricing revision. An Uncertain record has empty cost columns, no read and no event presents it as observed or as zero, and it is priced or reconciled later by the `ReconciliationWorker`, from a late receipt for its quantity and from a pricing revision valid at its `occurredAt` once one exists (AIFACTORY-US-456). No receipt is refused and no event is left unacknowledged for a missing price or a missing quantity, so ModelRouterService and ToolAdapterService need not keep and repeat a receipt. `connectsoft.factory.usage.uncertain_records` rises for an Uncertain record and `connectsoft.factory.usage.cost_usd` counts the cost by meter and status. The record and its `UsageRecorded` outbox record are written in one transaction, and the event is published on `usage-accounting.usage.v1.usage-recorded` in the run event envelope with `usageId`, `tenantId`, `projectId`, `meter`, `status` and the `quantity`, which is absent for an Uncertain record whose quantity is unknown; DashboardService projects it in its own PBI and FactoryCommercialService accumulates meters once it is delivered in I7. A record also counts against the budget where AIFACTORY-US-549, AIFACTORY-US-455 and AIFACTORY-US-459 state it: when the observed cost of a run exceeds the estimate of its Reserved reservation, and when the reservation of its run is no longer Reserved. The usage of a child run is recorded like any other usage, with the child run id as its `runId`, and counts on the reservation of the parent run, because a child run has no reservation of its own (D121, AIFACTORY-US-737). A record may also name no run (D123): `runId` is optional in `usage-record-v1` and in `ModelInvoked`, the receipt of a model call outside a run carries the tenant and the project and neither a run nor an attempt, and its record is written like any other, without a run; how that usage counts against the budget of its project without a reservation is delivered by AIFACTORY-US-881. The model gives the handler `RecordAttemptUsage` the purpose to record usage from the attempt receipt and to note on the reservation of the run the time the first attempt outcome was recorded. `RunControlService/AttemptOutcomeRecorded` names the run, the step, the attempt, the outcome and the hash of the receipt and carries no metered quantity, so the handler creates no usage record; it sets `attemptOutcomeNotedAt` of the reservation, the one fact about dispatch the service receives, which the release and the expiry of a reservation read. That the first half of that purpose has no payload to act on is reported to the owner. The handler `RecordCapacityUsage` is not part of this delivery. `CapacityLeaseGranted` and `CapacityLeaseReleased` are published by the complete ExecutionCapacityService of I2 and not by its thin delivery of I1; they carry `holderKind` and `holderId` and no `projectId`, although a usage record requires one; and the meter and the factor of a lease are an owner input. Like `QuotaExceeded` they are not subscribed here. The receipts that reach the service at this increment feed the meters `ModelInputTokens`, `ModelOutputTokens` and `ToolInvocations`, and `SandboxMinutes` when ToolAdapterService reports it through the method; the model names no source for `RunsAccepted`, `RunsCompleted`, `StorageGb` and `ProductCapacity`, and nothing is recorded on them. The prices of `PricingRevisions` are an owner input, an entry of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140): the table is platform-wide, has no route in the model, and is loaded from a versioned seed that ships without production values. A deployment without prices takes no traffic, because readiness is not ready while a meter in use has no valid revision (AIFACTORY-US-451); a receipt that still finds none is stored as Uncertain, as stated above. All usage stays in `cost-usage-sql`; the Factory Metering service that the model names as the meter store arrives in I4 and is not required before it, feature `component-saas-metering` exports these records from then on, and nothing is exported here (D115, D117). Over gRPC a caller without a workload identity is refused with Unauthenticated, a workload token without the service scope with PermissionDenied, and a project of another tenant with NOT_FOUND. Kind: behavior. Traces: services: CostUsageService, ModelRouterService, ToolAdapterService, RunControlService; aggregates: CostUsageService/UsageRecord, CostUsageService/Reservation; apis: CostUsageService/Usage.RecordUsage; events: CostUsageService/UsageRecorded, ModelRouterService/ModelInvoked, ToolAdapterService/ToolInvoked, RunControlService/AttemptOutcomeRecorded; descriptors: usage-record-v1, ack-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0020; requirements: FR-09, FUX-08, NFR-12; scenarios: SCN-CostUsageService-005, SCN-CostUsageService-009. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, feature:model-router-service, feature:tool-adapter-service, feature:run-control-service. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, model/services/model-compute/ModelRouterService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/reference/schemas/usage-record.schema.json, docs/architecture/adr/0020-commercial-model.md.",
      "acceptanceCriteria": [
        "AC1: Given a model receipt with reported usage for a run of a tenant and project and pricing revisions valid at its `occurredAt`, when `CostUsageService/Usage.RecordUsage` is called by ModelRouterService with `usage-record-v1`, or `ModelRouterService/ModelInvoked` is handled, then one `CostUsageService/UsageRecord` exists per meter with tenant, project, run, attempt, dimensions, the status Observed, the pricing revision of the service and the `estimatedCostUsd` computed from it; the event yields two records with its receipt as their `sourceReceipt`, one on the meter `ModelInputTokens` with `inputTokens` as its quantity and one on the meter `ModelOutputTokens` with `outputTokens`, each priced by the revision of its own meter; a `usageId` or `pricingRevision` the caller sent is not stored, one `CostUsageService/UsageRecorded` outbox record per usage record is written in the same transaction, and the gRPC reply is `ack-v1` (SCN-CostUsageService-005).",
        "AC2: Given the receipt of AC1 was recorded, when the same receipt with the same content arrives again by either path, then no second record and no second outbox record exist and the acknowledgement is accepted, and other content for that Observed record is acknowledged as a conflict and changes nothing; given a stored record that is Uncertain and a later receipt for its `sourceReceipt` that reports the usage, then the receipt is kept as the confirmation of that record, the record is not rewritten and the acknowledgement is accepted; given `ToolAdapterService/ToolInvoked` for a tool call, then one record of quantity one exists on the meter `ToolInvocations`; given `RunControlService/AttemptOutcomeRecorded`, then no usage record is created and the reservation of the run notes that an attempt outcome was recorded (SCN-CostUsageService-005).",
        "AC3: Given a receipt whose provider reported no usage, when it is recorded with the status uncertain and without a `quantity`, or `ModelRouterService/ModelInvoked` arrives without a token count, then the `CostUsageService/UsageRecord` is Uncertain and holds no quantity and empty cost columns, `CostUsageService/UsageRecorded` carries the status Uncertain and no `quantity`, and `connectsoft.factory.usage.uncertain_records` rises by one; given such a receipt that carries an estimate, then the record stores it as its quantity; given a receipt with estimated usage, then the status is Estimated; given a receipt with reported usage whose meter and dimension have no pricing revision valid at `occurredAt`, then the record is Uncertain with its quantity, without a pricing revision and without a cost, the call is acknowledged as accepted and the event is acknowledged, so that no receipt is refused for a missing price and no record is written with a quantity or a cost of zero (SCN-CostUsageService-005, FR-09).",
        "AC4: Given a caller without a workload identity, a workload token without the service scope, a request that fails validation, names an unknown meter, has no `sourceReceipt` or states the status observed or estimated without a `quantity`, or a project of another tenant, when `CostUsageService/Usage.RecordUsage` is called, then the call is refused with Unauthenticated, PermissionDenied, InvalidArgument or NOT_FOUND respectively, no record is written and nothing is published; a missing pricing revision and an unknown quantity of an uncertain receipt are never among the refusals (SCN-CostUsageService-005, ADR-0015).",
        "AC5: Given a usage record was created, when the outbox dispatcher of the `cost-usage` messaging profile publishes `CostUsageService/UsageRecorded` on `usage-accounting.usage.v1.usage-recorded`, then the event is sent in `run-event-envelope-v1` with `usageId`, `tenantId`, `projectId`, `meter`, `status` and the `quantity`, which is absent for an Uncertain record whose quantity is unknown, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-CostUsageService-009, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/reference/schemas/usage-record.schema.json",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1848",
        "AIFACTORY-TASK-1849",
        "AIFACTORY-TASK-311",
        "AIFACTORY-TASK-1834",
        "AIFACTORY-TASK-1835"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5607,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "ModelRouterService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "CostUsageService/UsageRecord",
          "CostUsageService/Reservation"
        ],
        "apis": [
          "CostUsageService/Usage.RecordUsage"
        ],
        "events": [
          "CostUsageService/UsageRecorded",
          "ModelRouterService/ModelInvoked",
          "ToolAdapterService/ToolInvoked",
          "RunControlService/AttemptOutcomeRecorded"
        ],
        "descriptors": [
          "usage-record-v1",
          "ack-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "FUX-08",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-005",
          "SCN-CostUsageService-009"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "feature:model-router-service",
        "feature:tool-adapter-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/reference/schemas/usage-record.schema.json",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "titlePrefix": "[AIFACTORY-US-454]",
      "number": 454
    },
    {
      "id": "AIFACTORY-TASK-1848",
      "type": "task",
      "parent": "AIFACTORY-US-454",
      "title": "Contract of Usage.RecordUsage, input and assigned fields, statuses and the acknowledgement",
      "sequence": "01.06.07.01",
      "description": "Contract of Usage.RecordUsage, input and assigned fields, statuses and the acknowledgement. Expected output: The contract document and the proto of Usage.RecordUsage state, against the UsageRecord definition of docs/reference/schemas/usage-record.schema.json, that the caller sends tenantId, projectId, the runId when the usage belongs to a run, which the descriptor makes optional (D123), the optional stepId, attemptId and reservationId, meter, dimensions, status, sourceReceipt and occurredAt and the quantity when it is known, that the quantity may be absent only with the status uncertain, that usageId, pricingRevision, estimatedCost, confirmedCost and reconciledAt are assigned by the service and ignored when sent, that only the statuses observed, estimated and uncertain are accepted, that a request without sourceReceipt is invalid, how the eight meter names of the descriptor map to the Meter enumeration, model.input-tokens and model.output-tokens being two meters, that a receipt without a valid pricing revision is accepted and stored as uncertain, and that ack-v1 answers accepted for a new record, a duplicate and a kept late receipt and conflict for other content of an Observed or Reconciled record.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The contract document and the proto of Usage.RecordUsage state, against the UsageRecord definition of docs/reference/schemas/usage-record.schema.json, that the caller sends tenantId, projectId, the runId when the usage belongs to a run, which the descriptor makes optional (D123), the optional stepId, attemptId and reservationId, meter, dimensions, status, sourceReceipt and occurredAt and the quantity when it is known, that the quantity may be absent only with the status uncertain, that usageId, pricingRevision, estimatedCost, confirmedCost and reconciledAt are assigned by the service and ignored when sent, that only the statuses observed, estimated and uncertain are accepted, that a request without sourceReceipt is invalid, how the eight meter names of the descriptor map to the Meter enumeration, model.input-tokens and model.output-tokens being two meters, that a receipt without a valid pricing revision is accepted and stored as uncertain, and that ack-v1 answers accepted for a new record, a duplicate and a kept late receipt and conflict for other content of an Observed or Reconciled record."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5607,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1848]",
      "number": 1848
    },
    {
      "id": "AIFACTORY-TASK-1849",
      "type": "task",
      "parent": "AIFACTORY-US-454",
      "title": "Migration of the kept late receipts and of the attempt outcome note of a reservation",
      "sequence": "01.06.07.02",
      "description": "Migration of the kept late receipts and of the attempt outcome note of a reservation. Expected output: A migration of cost-usage-sql adds the tenant-filtered table LateReceipts of the model, keyed by usage record and receipt reference, with the reported quantity, the time it was received and the time it was applied, and adds to Reservations the nullable column AttemptOutcomeNotedAt of the model with the time the first attempt outcome of the run was recorded; mapping tests on an isolated test database prove both.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration of cost-usage-sql adds the tenant-filtered table LateReceipts of the model, keyed by usage record and receipt reference, with the reported quantity, the time it was received and the time it was applied, and adds to Reservations the nullable column AttemptOutcomeNotedAt of the model with the time the first attempt outcome of the run was recorded; mapping tests on an isolated test database prove both."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5607,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1849]",
      "number": 1849
    },
    {
      "id": "AIFACTORY-TASK-311",
      "type": "task",
      "parent": "AIFACTORY-US-454",
      "title": "Usage records from model and tool receipts, once per receipt and meter, with duplicates, late receipts and unknown usage told apart",
      "sequence": "01.06.07.03",
      "description": "Usage records from model and tool receipts, once per receipt and meter, with duplicates, late receipts and unknown usage told apart. Expected output: Usage.RecordUsage and the handlers RecordModelUsage and RecordToolUsage run one command that creates the UsageRecord with tenant, project, the run and the attempt where the receipt names them, meter, dimensions, quantity, the status the receipt reports, the pricing revision valid at occurredAt and its estimated cost, together with the UsageRecorded outbox record in one transaction, idempotent on meter plus source receipt; from ModelInvoked two records are written under the receipt of the invocation, one on ModelInputTokens with inputTokens and one on ModelOutputTokens with outputTokens, each priced by the revision of its own meter, and the cost of the event is not stored; from ToolInvoked the quantity is one; a receipt without a quantity is stored as Uncertain without one, a receipt without a valid pricing revision is stored as Uncertain with its quantity and without a revision, both with empty cost columns, and neither is refused, left unacknowledged or written as zero; the same content again changes nothing, a later receipt that reports the usage of an Estimated or Uncertain record is written to the table LateReceipts of AIFACTORY-TASK-1849, other content for an Observed or Reconciled record is a conflict; RecordAttemptUsage sets attemptOutcomeNotedAt of the reservation of the run and creates no record; the cost and uncertain metrics follow the records.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Usage.RecordUsage and the handlers RecordModelUsage and RecordToolUsage run one command that creates the UsageRecord with tenant, project, the run and the attempt where the receipt names them, meter, dimensions, quantity, the status the receipt reports, the pricing revision valid at occurredAt and its estimated cost, together with the UsageRecorded outbox record in one transaction, idempotent on meter plus source receipt; from ModelInvoked two records are written under the receipt of the invocation, one on ModelInputTokens with inputTokens and one on ModelOutputTokens with outputTokens, each priced by the revision of its own meter, and the cost of the event is not stored; from ToolInvoked the quantity is one; a receipt without a quantity is stored as Uncertain without one, a receipt without a valid pricing revision is stored as Uncertain with its quantity and without a revision, both with empty cost columns, and neither is refused, left unacknowledged or written as zero; the same content again changes nothing, a later receipt that reports the usage of an Estimated or Uncertain record is written to the table LateReceipts of AIFACTORY-TASK-1849, other content for an Observed or Reconciled record is a conflict; RecordAttemptUsage sets attemptOutcomeNotedAt of the reservation of the run and creates no record; the cost and uncertain metrics follow the records."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5607,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-311]",
      "number": 311
    },
    {
      "id": "AIFACTORY-TASK-1834",
      "type": "task",
      "parent": "AIFACTORY-US-454",
      "title": "Versioned seed of PricingRevisions without production values",
      "sequence": "01.06.07.04",
      "description": "Versioned seed of PricingRevisions without production values. Expected output: A migration step loads PricingRevisions from a versioned seed file with revision, meter, dimension key, unit price and validity, refuses two revisions of one meter and dimension whose validity overlaps, and never changes a revision a usage record already names; the seed of the repository holds test revisions only, the input tokens and the output tokens of a model call having revisions of their own, and the production prices and the unit and the factor of each meter are entered by the owner.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "A migration step loads PricingRevisions from a versioned seed file with revision, meter, dimension key, unit price and validity, refuses two revisions of one meter and dimension whose validity overlaps, and never changes a revision a usage record already names; the seed of the repository holds test revisions only, the input tokens and the output tokens of a model call having revisions of their own, and the production prices and the unit and the factor of each meter are entered by the owner."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5607,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1834]",
      "number": 1834
    },
    {
      "id": "AIFACTORY-TASK-1835",
      "type": "task",
      "parent": "AIFACTORY-US-454",
      "title": "Verify record-metered-usage through the acceptance suite",
      "sequence": "01.06.07.05",
      "description": "Verify record-metered-usage through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-005|Scenario=SCN-CostUsageService-009)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-454 with fixture publishers of ModelInvoked, ToolInvoked and AttemptOutcomeRecorded, including one receipt delivered by both paths, the two token records of one model call, a conflicting repeat, a late receipt kept for an Uncertain record, an unknown-usage receipt with and without an estimate, an unpriced receipt stored as Uncertain and acknowledged, the gRPC refusals and the publication and payload of UsageRecorded with and without a quantity; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-005|Scenario=SCN-CostUsageService-009)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-454 with fixture publishers of ModelInvoked, ToolInvoked and AttemptOutcomeRecorded, including one receipt delivered by both paths, the two token records of one model call, a conflicting repeat, a late receipt kept for an Uncertain record, an unknown-usage receipt with and without an estimate, an unpriced receipt stored as Uncertain and acknowledged, the gRPC refusals and the publication and payload of UsageRecorded with and without a quantity; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5607,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1835]",
      "number": 1835
    },
    {
      "id": "AIFACTORY-US-455",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Settle the reservation of a run at its terminal state, release it when the run was cancelled before dispatch, and keep the budget true for usage that arrives afterwards",
      "sequence": "01.06.08",
      "description": "A reservation is an amount held before dispatch; this PBI brings it to rest when the run ends. When RunControlService announces the terminal state of a run through `RunControlService/RunCompleted` or `RunControlService/RunFailed`, the inbox handler `SettleReservation` moves the reservation from Reserved to Settled (trigger `RunTerminal`): `settledUsd` becomes the sum of the cost of the usage records of the run, where the cost of a record is its confirmed cost when it has one and its estimated cost otherwise, `settledAt` is set, `committedUsd` of the budget is corrected from the amount counted for the run, which is its estimate or its observed cost where that already exceeded the estimate (AIFACTORY-US-549), to the settled amount, and the `ReservationSettled` outbox record is written with `reservationId`, `runId`, `tenantId`, `settledUsd` and `uncertain`, all in one transaction. `uncertain` is true when at least one usage record of the run is Uncertain or Estimated at settlement; the settled amount then counts what is known and invents nothing for the rest, and reconciliation confirms the records later (AIFACTORY-US-456). Settlement is idempotent on the set of receipts settled: a redelivered terminal event changes nothing and publishes nothing. Settlement records what was observed, also when it exceeds the estimate. The invariant of the `Budget` holds the limit at reservation and lets only observed usage, recorded or settled, take `committedUsd` above `limitUsd` (D117). A run that spends more than its estimate while it runs is counted and stopped as AIFACTORY-US-549 states: the usage record that takes the budget above its limit writes `BudgetExceeded`, and RunControlService cancels the run. Settlement never hides observed cost: an overrun is stored unchanged, a settlement that itself raises `committedUsd` and leaves it above `limitUsd` writes `BudgetExceeded` with the `runId` of the settled run in the same transaction, unless the event was already written for that run, since it is published once per run (D119), and the next reservation against that budget is Denied. A receipt that arrives after settlement is still recorded (AIFACTORY-US-454). The settled reservation is not reopened and `ReservationSettled` is not published again, because the `Reservation` has no transition out of Settled, but the budget stays true: the cost of a usage record created for a run whose reservation is no longer Reserved is added to `committedUsd` of the budget in the transaction of that record. The same correction is made for a confirmation applied after settlement (AIFACTORY-US-456) and for the usage of a run whose reservation was Released or Expired (AIFACTORY-US-459). When `RunControlService/RunCancelled` arrives, `SettleOrRelease` decides from what the service holds for the run. A run with no usage record and no noted attempt outcome was cancelled before dispatch as far as the service can know, so its reservation moves from Reserved to Released (trigger `RunCancelledBeforeDispatch`) and the whole estimate returns to the budget; a run with a usage record or with the note of `RecordAttemptUsage` is settled like a terminal run and never released. A release is announced like an expiry: `ReservationSettled` is written with a `settledUsd` of zero and `uncertain` false in the transaction of the release. The model does not say that a release is silent, the aggregate lists `ReservationSettled` among the events of the reservation, and StudioBff and DashboardService learn of a reservation through events only, so a silent release would leave their views at Reserved; the state Released itself is read through `GetRunUsage`. `committedUsd` is described by the model as reserved plus settled in the period. A monthly budget is rolled over at the calendar month in UTC by the `BudgetRolloverWorker` (AIFACTORY-US-452, D117), which carries a reservation that is still Reserved into the new period with its estimate (D119), so a settlement after the rollover corrects the budget of the new period, and the `settledAt` of the reservation tells the period the settlement belongs to. A terminal event for a run whose reservation is Denied, Released, Expired or already Settled moves no reservation. The terminal events of a child run settle and release nothing, because a child run has no reservation; its usage is settled with the reservation of the parent run, whose `settledUsd` then counts the usage records of the parent run and of the child runs noted under that reservation (D121, AIFACTORY-US-737). `ReservationSettled` is published on `usage-accounting.reservations.v1.reservation-settled` in the run event envelope; StudioBff and DashboardService handle it in their own PBIs and FactoryCommercialService accumulates the run cost once it is delivered in I7. Kind: behavior. Traces: services: CostUsageService, RunControlService; aggregates: CostUsageService/Reservation, CostUsageService/Budget, CostUsageService/UsageRecord; events: CostUsageService/ReservationSettled, CostUsageService/BudgetExceeded, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0020; requirements: FR-09, XL-12, NFR-12; scenarios: SCN-CostUsageService-008. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-453, AIFACTORY-US-454, feature:run-control-service. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/services/cost-usage-service/index.md#domain-model, docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Reserved `CostUsageService/Reservation` of a run with three Observed usage records, when `RunControlService/RunCompleted` or `RunControlService/RunFailed` is handled by `SettleReservation`, then the reservation is Settled with `settledUsd` equal to the sum of the cost of the three records, `committedUsd` of the `CostUsageService/Budget` is corrected from the estimate to that sum, the `CostUsageService/ReservationSettled` outbox record with `uncertain` false is written in the same transaction, and a redelivery of the event changes nothing and writes no record (SCN-CostUsageService-008).",
        "AC2: Given the run of AC1 with one further `CostUsageService/UsageRecord` in the status Uncertain, when the run is settled, then `settledUsd` counts the three known records only, nothing is invented for the uncertain one, and `CostUsageService/ReservationSettled` carries `uncertain` true; given observed records whose sum exceeds the estimate so far that `committedUsd` is above `limitUsd`, then the observed sum is stored unchanged at settlement, `CostUsageService/BudgetExceeded` was written by the write that took the amount above the limit, and the next reservation against that budget is Denied (SCN-CostUsageService-008, FR-09).",
        "AC3: Given `RunControlService/RunCancelled` for a run for which the service holds no usage record and no noted attempt outcome, when `SettleOrRelease` runs, then the reservation is Released, the whole estimate returns to `committedUsd`, and `CostUsageService/ReservationSettled` with a `settledUsd` of zero and `uncertain` false is written in the same transaction; given the same event for a run with a usage record or with a noted attempt outcome, then the reservation is Settled as in AC1 and never Released (SCN-CostUsageService-008).",
        "AC4: Given a Settled reservation, when a further receipt of its run is recorded, then the `CostUsageService/UsageRecord` is created, the reservation stays Settled with its `settledUsd`, no second `CostUsageService/ReservationSettled` is written, and `committedUsd` of the `CostUsageService/Budget` grows by the cost of that record in the transaction of the record (SCN-CostUsageService-008, XL-12).",
        "AC5: Given a reservation was settled or released, when the outbox dispatcher of the `cost-usage` messaging profile publishes `CostUsageService/ReservationSettled` on `usage-accounting.reservations.v1.reservation-settled`, then the event is sent in `run-event-envelope-v1` with `reservationId`, `runId`, `tenantId`, `settledUsd` and `uncertain`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-CostUsageService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#domain-model",
        "docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1836",
        "AIFACTORY-TASK-1850",
        "AIFACTORY-TASK-1837"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5608,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "RunControlService"
        ],
        "aggregates": [
          "CostUsageService/Reservation",
          "CostUsageService/Budget",
          "CostUsageService/UsageRecord"
        ],
        "events": [
          "CostUsageService/ReservationSettled",
          "CostUsageService/BudgetExceeded",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-008"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-453",
        "AIFACTORY-US-454",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#domain-model",
        "docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-455]",
      "number": 455
    },
    {
      "id": "AIFACTORY-TASK-1836",
      "type": "task",
      "parent": "AIFACTORY-US-455",
      "title": "SettleReservation and SettleOrRelease on the terminal events of a run",
      "sequence": "01.06.08.01",
      "description": "SettleReservation and SettleOrRelease on the terminal events of a run. Expected output: SettleReservation on RunCompleted and RunFailed moves the Reserved reservation to Settled with settledUsd as the sum of the cost of the usage records of the run, confirmed cost before estimated cost, sets settledAt, corrects committedUsd of the budget from the amount counted for the run to the observed sum also when it exceeds limitUsd, in which case the BudgetExceeded record of AIFACTORY-TASK-2203 is written when the settlement itself raised the amount and none was written for the run before (D119), and writes the ReservationSettled outbox record with uncertain true while a record of the run is Uncertain or Estimated, all in one transaction and idempotent on the set of receipts settled; SettleOrRelease on RunCancelled releases the reservation, returns the estimate and writes ReservationSettled with a settledUsd of zero when the service holds no usage record and no attempt outcome note of the run, and settles it otherwise; a reservation that is not Reserved is left unchanged; the usage records of the child runs noted under a reservation count in its settledUsd and as usage of that reservation, and a terminal event of a child run moves no reservation, as AIFACTORY-TASK-2976 delivers (D121).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "SettleReservation on RunCompleted and RunFailed moves the Reserved reservation to Settled with settledUsd as the sum of the cost of the usage records of the run, confirmed cost before estimated cost, sets settledAt, corrects committedUsd of the budget from the amount counted for the run to the observed sum also when it exceeds limitUsd, in which case the BudgetExceeded record of AIFACTORY-TASK-2203 is written when the settlement itself raised the amount and none was written for the run before (D119), and writes the ReservationSettled outbox record with uncertain true while a record of the run is Uncertain or Estimated, all in one transaction and idempotent on the set of receipts settled; SettleOrRelease on RunCancelled releases the reservation, returns the estimate and writes ReservationSettled with a settledUsd of zero when the service holds no usage record and no attempt outcome note of the run, and settles it otherwise; a reservation that is not Reserved is left unchanged; the usage records of the child runs noted under a reservation count in its settledUsd and as usage of that reservation, and a terminal event of a child run moves no reservation, as AIFACTORY-TASK-2976 delivers (D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5608,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1836]",
      "number": 1836
    },
    {
      "id": "AIFACTORY-TASK-1850",
      "type": "task",
      "parent": "AIFACTORY-US-455",
      "title": "Budget correction for usage recorded after the reservation of its run came to rest",
      "sequence": "01.06.08.02",
      "description": "Budget correction for usage recorded after the reservation of its run came to rest. Expected output: The command that creates a usage record adds the cost of the record to committedUsd of the budget of the project, in the transaction of the record and under the row version of the Budget, when the reservation of the run is Settled, Released or Expired; the reservation keeps its state and its settledUsd and no second ReservationSettled is written; a record whose run has a Reserved reservation changes the budget only by the excess over the estimate that AIFACTORY-TASK-2203 counts, and a record whose run has no reservation and is not noted as a child run changes no budget, while a record of a child run counts on the reservation of its parent run as AIFACTORY-TASK-2976 states (D121); a correction that leaves committedUsd above limitUsd writes the BudgetExceeded record of AIFACTORY-TASK-2203, once per run (D119); unit and acceptance tests cover each of the three rest states.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The command that creates a usage record adds the cost of the record to committedUsd of the budget of the project, in the transaction of the record and under the row version of the Budget, when the reservation of the run is Settled, Released or Expired; the reservation keeps its state and its settledUsd and no second ReservationSettled is written; a record whose run has a Reserved reservation changes the budget only by the excess over the estimate that AIFACTORY-TASK-2203 counts, and a record whose run has no reservation and is not noted as a child run changes no budget, while a record of a child run counts on the reservation of its parent run as AIFACTORY-TASK-2976 states (D121); a correction that leaves committedUsd above limitUsd writes the BudgetExceeded record of AIFACTORY-TASK-2203, once per run (D119); unit and acceptance tests cover each of the three rest states."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5608,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1850]",
      "number": 1850
    },
    {
      "id": "AIFACTORY-TASK-1837",
      "type": "task",
      "parent": "AIFACTORY-US-455",
      "title": "Verify settle-a-reservation through the acceptance suite",
      "sequence": "01.06.08.03",
      "description": "Verify settle-a-reservation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-008&Area=Settlement\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-455 with fixture publishers of RunCompleted, RunFailed and RunCancelled, including the corrected committedUsd of the budget, a settlement above the limit followed by a denied reservation, a redelivered terminal event, the release with its event, a cancelled run with a noted attempt outcome that is settled, a receipt recorded after settlement, and the publication and payload of ReservationSettled; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-008&Area=Settlement\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-455 with fixture publishers of RunCompleted, RunFailed and RunCancelled, including the corrected committedUsd of the budget, a settlement above the limit followed by a denied reservation, a redelivered terminal event, the release with its event, a cancelled run with a noted attempt outcome that is settled, a receipt recorded after settlement, and the publication and payload of ReservationSettled; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5608,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1837]",
      "number": 1837
    },
    {
      "id": "AIFACTORY-US-459",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Expire the reservation of a run that never dispatched, never expire one of a run that spent, and count the usage of a run that spends after its reservation came to rest",
      "sequence": "01.06.09",
      "description": "A reservation whose run never dispatches would hold budget without end; the `ReservationExpiryWorker` frees it. The worker runs every fifteen minutes, two tenants in parallel, with three attempts at a fixed backoff of 60 seconds. The model gives its input as Reserved reservations past `expiresAt` without a dispatched attempt. CostUsageService does not hold that fact: it does not consume `AttemptDispatched` of RunControlService, and nothing else tells it that an attempt was dispatched. This PBI does not replace the missing fact by a rule presented as certain; it states what the service can know and what follows when that is not enough. What the service holds for a run is its usage records and the note of `RecordAttemptUsage` that an attempt outcome was recorded (AIFACTORY-US-454). A Reserved reservation of a run with a usage record or with that note is never expired and never released, however old it is: the run did dispatch, and its reservation comes to rest only through the terminal event of the run (AIFACTORY-US-455). A usage record of a child run counts on the reservation of its parent run (D121, AIFACTORY-US-737), so a reservation under which a child run has a usage record is never expired and never released either. A Reserved reservation past `expiresAt` of a run with neither is moved to Expired (trigger `ExpiryWithoutRun`): the estimate returns to `committedUsd` of the budget and `ReservationSettled`, the output event of the worker in the model, is written with a `settledUsd` of zero and `uncertain` false, in one transaction and idempotent on `reservationId` plus `expiresAt`. That judgement can be wrong in two cases the service cannot see: a run whose first attempt was dispatched and has reported neither a receipt nor an outcome when `expiresAt` passes, and a run that was Held after `BudgetReserved` for longer than `Usage:Reservations:ExpiryMinutes` and is dispatched later. RunControlService does not learn of the expiry either, since it does not consume `ReservationSettled`, so such a run goes on. The branch in which a run spends although its reservation is Expired or Released is therefore part of this PBI. The usage records of that run are recorded as always, and the cost of each is added to `committedUsd` of the budget of the project in the transaction of the record, exactly as for a record that arrives after settlement, so the cost of a run that really spent reaches the budget and the cap of the first outcome (D80) is not bypassed for the next reservation. When that cost takes `committedUsd` above `limitUsd`, `BudgetExceeded` names the run and RunControlService cancels it with the reason budget-exceeded (AIFACTORY-US-549, D117), so such a run is stopped at the limit like any other. The terminal event of such a run moves no reservation, because the `Reservation` has no transition out of Expired or Released, and writes no second `ReservationSettled`; its usage is visible through the usage records, `UsageRecorded` and `GetRunUsage`. A confirmation applied later corrects the budget the same way (AIFACTORY-US-456). The two missing signals, a dispatch fact for CostUsageService and an expiry signal for RunControlService, are reported to the owner and are not decided here. `ReservationSettled` is published on `usage-accounting.reservations.v1.reservation-settled` in the run event envelope; StudioBff and DashboardService handle it in their own PBIs. Kind: behavior. Traces: services: CostUsageService, RunControlService; aggregates: CostUsageService/Reservation, CostUsageService/Budget, CostUsageService/UsageRecord; events: CostUsageService/ReservationSettled, CostUsageService/UsageRecorded, RunControlService/RunCancelled; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0020; requirements: FR-09, XL-12, NFR-12; scenarios: SCN-CostUsageService-008. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-453, AIFACTORY-US-454, AIFACTORY-US-455, feature:run-control-service. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Reserved `CostUsageService/Reservation` past `expiresAt` for whose run the service holds no usage record and no noted attempt outcome, when the `ReservationExpiryWorker` runs, then the reservation is Expired, the estimate returns to `committedUsd` of the `CostUsageService/Budget`, `CostUsageService/ReservationSettled` with a `settledUsd` of zero and `uncertain` false is written once in the same transaction under the key `reservationId` plus `expiresAt`, and a duplicate trigger has no second effect (SCN-CostUsageService-008).",
        "AC2: Given a Reserved reservation past `expiresAt` of a run with a `CostUsageService/UsageRecord`, and one of a run whose attempt outcome was noted, when the `ReservationExpiryWorker` runs, then both stay Reserved with their estimate in `committedUsd`; when `RunControlService/RunCancelled` then arrives for either run, then the reservation is Settled and not Released (SCN-CostUsageService-008).",
        "AC3: Given a reservation that is Expired, and one that is Released, when a receipt of its run is recorded, then the `CostUsageService/UsageRecord` and its `CostUsageService/UsageRecorded` record are written and `committedUsd` of the `CostUsageService/Budget` grows by the cost of the record in the same transaction; when the terminal event of that run arrives, then the reservation keeps its state, no second `CostUsageService/ReservationSettled` is written and `committedUsd` still holds the cost of those records, so the next reservation is judged against it (SCN-CostUsageService-008, XL-12).",
        "AC4: Given the store fails while the `ReservationExpiryWorker` expires the reservations of two tenants, when the worker retries with three attempts at a fixed backoff of 60 seconds, then each reservation is expired once and each `CostUsageService/ReservationSettled` is published once on `usage-accounting.reservations.v1.reservation-settled` in `run-event-envelope-v1`, neither lost nor duplicated under its event id (SCN-CostUsageService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-243",
        "AIFACTORY-TASK-1851"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5609,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "RunControlService"
        ],
        "aggregates": [
          "CostUsageService/Reservation",
          "CostUsageService/Budget",
          "CostUsageService/UsageRecord"
        ],
        "events": [
          "CostUsageService/ReservationSettled",
          "CostUsageService/UsageRecorded",
          "RunControlService/RunCancelled"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-008"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-453",
        "AIFACTORY-US-454",
        "AIFACTORY-US-455",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-459]",
      "number": 459
    },
    {
      "id": "AIFACTORY-TASK-243",
      "type": "task",
      "parent": "AIFACTORY-US-459",
      "title": "ReservationExpiryWorker expiring the reservation of a run for which the service holds no sign of dispatch",
      "sequence": "01.06.09.01",
      "description": "ReservationExpiryWorker expiring the reservation of a run for which the service holds no sign of dispatch. Expected output: The worker runs on the schedule of the model every fifteen minutes over Reserved reservations past expiresAt for whose run the service holds no usage record and no attempt outcome note, partitioned by tenant with two partitions in parallel and three attempts at a fixed backoff of 60 seconds; it moves each to Expired, returns the estimate to the budget and writes ReservationSettled with a settledUsd of zero in one transaction, idempotent on reservationId plus expiresAt; a reservation of a run with a usage record or with the note is skipped however old it is, and so is a reservation under which a child run noted in ChildRuns has a usage record (D121); a duplicate trigger has no second effect.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The worker runs on the schedule of the model every fifteen minutes over Reserved reservations past expiresAt for whose run the service holds no usage record and no attempt outcome note, partitioned by tenant with two partitions in parallel and three attempts at a fixed backoff of 60 seconds; it moves each to Expired, returns the estimate to the budget and writes ReservationSettled with a settledUsd of zero in one transaction, idempotent on reservationId plus expiresAt; a reservation of a run with a usage record or with the note is skipped however old it is, and so is a reservation under which a child run noted in ChildRuns has a usage record (D121); a duplicate trigger has no second effect."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5609,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-243]",
      "number": 243
    },
    {
      "id": "AIFACTORY-TASK-1851",
      "type": "task",
      "parent": "AIFACTORY-US-459",
      "title": "Verify expire-a-stale-reservation through the acceptance suite",
      "sequence": "01.06.09.02",
      "description": "Verify expire-a-stale-reservation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-008&Area=Expiry\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-459 with a controlled clock, including the expiry with its event, a reservation of a run with a usage record and one with a noted attempt outcome that stay Reserved, receipts recorded for a run whose reservation is Expired and for one whose reservation is Released with committedUsd corrected through AIFACTORY-TASK-1850, the terminal event of such a run, and a store failure during the worker; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-008&Area=Expiry\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-459 with a controlled clock, including the expiry with its event, a reservation of a run with a usage record and one with a noted attempt outcome that stay Reserved, receipts recorded for a run whose reservation is Expired and for one whose reservation is Released with committedUsd corrected through AIFACTORY-TASK-1850, the terminal event of such a run, and a store failure during the worker; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5609,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1851]",
      "number": 1851
    },
    {
      "id": "AIFACTORY-US-456",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Confirm estimated and uncertain usage from late receipts, keep the port for provider statements, and announce each confirmation",
      "sequence": "01.06.10",
      "description": "Unknown usage stays unknown until evidence confirms it (FR-09). The `ReconciliationWorker` runs every hour over the usage records in the status Estimated or Uncertain that are older than one hour, two tenants in parallel, with five attempts and exponential backoff from 60 seconds. For each record it asks one confirmation port, keyed by `usageId` and a statement reference, for the confirmation the invariant of the model names: a later receipt or a line of a provider statement. The first of the two is delivered here and works on a deployed instance. A late receipt reaches the service through `CostUsageService/Usage.RecordUsage` or the receipt events and is kept by that command as the confirmation of the record it belongs to (AIFACTORY-US-454); the late-receipt source of the port reads those kept receipts, takes the reference of the receipt as the statement reference and computes the confirmed cost from the reported quantity and the pricing revision the record was priced with, or, for a record that was stored without one, the revision valid at its `occurredAt` once it exists. The second is not delivered. The model lists no route, no table and no consumed event for a provider statement, and the service page lists the import of provider statements per provider among the later capabilities; the port is the place where such an adapter lands, none is built or invented here, and that is reported to the owner. When a confirmation is found, the record gets its `confirmedCostUsd`, moves to the status Reconciled and keeps its pricing revision, its quantity and its estimate, the `UsageReconciled` outbox record with `usageId`, `tenantId` and `confirmedCostUsd` is written in the same transaction, the kept receipt is marked as applied, `connectsoft.factory.usage.uncertain_records` falls for a record that was Uncertain, and `connectsoft.factory.usage.cost_usd` counts the confirmed cost under the reconciled status. An Uncertain record that was stored without a price is priced by the same worker (D117): once a pricing revision valid at its `occurredAt` exists for its meter and dimension and the record holds a quantity, from its receipt or from an applied late receipt, the worker sets the pricing revision, computes the cost from the quantity, sets `confirmedCostUsd`, moves the record to Reconciled and writes `UsageReconciled` in the same transaction, with the pricing revision as the reference of what confirmed it; a record that still has no quantity or no valid revision stays Uncertain. The worker is idempotent on `usageId` plus the statement reference, so the same confirmation applied twice confirms once. A confirmation never reopens a reservation, but it keeps the budget true: when the reservation of the run of the record is no longer Reserved, `committedUsd` of the budget is corrected in the same transaction by the difference between the confirmed cost and the cost counted for the record so far, which is its estimated cost or nothing for a record that was Uncertain; while the reservation is still Reserved nothing is corrected, because settlement will sum the confirmed cost (AIFACTORY-US-455). A record without a confirmation is left as it is: it is never zeroed, never guessed and never aged out, and it stays visible as uncertain in every usage read (AIFACTORY-US-457). The corrected cost travels in `UsageReconciled`, which is published on `usage-accounting.usage.v1.usage-reconciled` in the run event envelope; DashboardService projects it in its own PBI and FactoryCommercialService adjusts meters once it is delivered in I7. Kind: behavior. Traces: services: CostUsageService; aggregates: CostUsageService/UsageRecord, CostUsageService/Budget; events: CostUsageService/UsageReconciled; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0020; requirements: FR-09, FUX-08, XL-12, NFR-12; scenarios: SCN-CostUsageService-010. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-454, AIFACTORY-US-455. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs, docs/planes/control/services/cost-usage-service/index.md#failure-and-recovery, docs/planes/control/services/cost-usage-service/index.md#later-capabilities.",
      "acceptanceCriteria": [
        "AC1: Given a `CostUsageService/UsageRecord` in the status Uncertain that is older than one hour and a later receipt for its `sourceReceipt` that reports the usage and was kept by `Usage.RecordUsage`, when the `ReconciliationWorker` runs on an instance without any fixture source, then the record has its `confirmedCostUsd`, computed from the reported quantity and the pricing revision of the record, the status Reconciled and its unchanged pricing revision and estimate, the `CostUsageService/UsageReconciled` outbox record is written in the same transaction, the kept receipt is marked as applied, and `connectsoft.factory.usage.uncertain_records` falls by one (SCN-CostUsageService-010).",
        "AC2: Given an Estimated record of a run whose reservation is Settled, when a confirmation with a statement reference is applied through the confirmation port, then `committedUsd` of the budget is corrected in the same transaction by the difference between the confirmed and the estimated cost, the reservation keeps its state and its `settledUsd`, and `CostUsageService/UsageReconciled` is written; given the same for a record whose run still has a Reserved reservation, then no budget amount changes (SCN-CostUsageService-010, XL-12).",
        "AC3: Given a confirmation was applied, when the same late receipt or the same statement is offered again or the worker is triggered twice, then the record is confirmed once and no second `CostUsageService/UsageReconciled` is written, because the worker is idempotent on `usageId` plus the statement reference; given an Uncertain record that holds a quantity and was stored without a pricing revision, when a revision valid at its `occurredAt` has been loaded and the worker runs, then the record gets that revision and its `confirmedCostUsd`, moves to Reconciled and `CostUsageService/UsageReconciled` is written once, while a record that still has no valid revision stays Uncertain (SCN-CostUsageService-010).",
        "AC4: Given an Estimated or Uncertain record without a confirmation, a record younger than one hour, or a confirmation source that fails, when the `ReconciliationWorker` runs, then the record keeps its status, quantity and cost, is never written as zero, and a failing source is retried five times with exponential backoff without changing the record (SCN-CostUsageService-010, FR-09).",
        "AC5: Given a record was reconciled, when the outbox dispatcher of the `cost-usage` messaging profile publishes `CostUsageService/UsageReconciled` on `usage-accounting.usage.v1.usage-reconciled`, then the event is sent in `run-event-envelope-v1` with `usageId`, `tenantId` and `confirmedCostUsd`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-CostUsageService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs",
        "docs/planes/control/services/cost-usage-service/index.md#failure-and-recovery",
        "docs/planes/control/services/cost-usage-service/index.md#later-capabilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-312",
        "AIFACTORY-TASK-1852",
        "AIFACTORY-TASK-1838",
        "AIFACTORY-TASK-1839"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5610,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "aggregates": [
          "CostUsageService/UsageRecord",
          "CostUsageService/Budget"
        ],
        "events": [
          "CostUsageService/UsageReconciled"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "FUX-08",
          "XL-12",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-010"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-454",
        "AIFACTORY-US-455"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#workers-and-jobs",
        "docs/planes/control/services/cost-usage-service/index.md#failure-and-recovery",
        "docs/planes/control/services/cost-usage-service/index.md#later-capabilities"
      ],
      "titlePrefix": "[AIFACTORY-US-456]",
      "number": 456
    },
    {
      "id": "AIFACTORY-TASK-312",
      "type": "task",
      "parent": "AIFACTORY-US-456",
      "title": "ReconciliationWorker confirming estimated and uncertain usage through a confirmation port",
      "sequence": "01.06.10.01",
      "description": "ReconciliationWorker confirming estimated and uncertain usage through a confirmation port. Expected output: The worker runs on the schedule of the model every hour over usage records in Estimated or Uncertain older than one hour, partitioned by tenant with two partitions in parallel and five attempts with exponential backoff from 60 seconds; it asks the confirmation port for each record, sets confirmedCostUsd and the status Reconciled, writes the UsageReconciled outbox record and, when the reservation of the run is Settled, Released or Expired, corrects committedUsd of the budget by the difference between the confirmed cost and the cost counted so far, all in one transaction and idempotent on usageId plus the statement reference; an Uncertain record stored without a price is priced, with the pricing revision as the reference of the confirmation, once a revision valid at its occurredAt exists and it holds a quantity; a record without a confirmation is left unchanged and never zeroed, and the uncertain and cost metrics follow each confirmation.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The worker runs on the schedule of the model every hour over usage records in Estimated or Uncertain older than one hour, partitioned by tenant with two partitions in parallel and five attempts with exponential backoff from 60 seconds; it asks the confirmation port for each record, sets confirmedCostUsd and the status Reconciled, writes the UsageReconciled outbox record and, when the reservation of the run is Settled, Released or Expired, corrects committedUsd of the budget by the difference between the confirmed cost and the cost counted so far, all in one transaction and idempotent on usageId plus the statement reference; an Uncertain record stored without a price is priced, with the pricing revision as the reference of the confirmation, once a revision valid at its occurredAt exists and it holds a quantity; a record without a confirmation is left unchanged and never zeroed, and the uncertain and cost metrics follow each confirmation."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5610,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-312]",
      "number": 312
    },
    {
      "id": "AIFACTORY-TASK-1852",
      "type": "task",
      "parent": "AIFACTORY-US-456",
      "title": "Late-receipt source of the confirmation port",
      "sequence": "01.06.10.02",
      "description": "Late-receipt source of the confirmation port. Expected output: A source of the confirmation port that reads the kept late receipts of AIFACTORY-TASK-1849 for a usage record, returns the reference of the receipt as the statement reference and the confirmed cost computed from the reported quantity and the pricing revision the record was priced with, or the revision valid at its occurredAt for a record that was stored without one, and marks the kept receipt as applied in the transaction of the confirmation; it is registered in the deployed service, so an Uncertain record is reconciled from a late receipt without any fixture; no provider statement adapter is registered.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "A source of the confirmation port that reads the kept late receipts of AIFACTORY-TASK-1849 for a usage record, returns the reference of the receipt as the statement reference and the confirmed cost computed from the reported quantity and the pricing revision the record was priced with, or the revision valid at its occurredAt for a record that was stored without one, and marks the kept receipt as applied in the transaction of the confirmation; it is registered in the deployed service, so an Uncertain record is reconciled from a late receipt without any fixture; no provider statement adapter is registered."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5610,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1852]",
      "number": 1852
    },
    {
      "id": "AIFACTORY-TASK-1838",
      "type": "task",
      "parent": "AIFACTORY-US-456",
      "title": "Acceptance fixture of a statement source behind the confirmation port",
      "sequence": "01.06.10.03",
      "description": "Acceptance fixture of a statement source behind the confirmation port. Expected output: The acceptance suite can register a second source behind the port that returns, for a usage id, a confirmed cost with a statement reference a test states, returns nothing for other records and can be made to fail, so that a statement confirmation, a repeated statement, a missing confirmation and a failing source are reproducible with a controlled clock; the tests of the late-receipt path run without it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The acceptance suite can register a second source behind the port that returns, for a usage id, a confirmed cost with a statement reference a test states, returns nothing for other records and can be made to fail, so that a statement confirmation, a repeated statement, a missing confirmation and a failing source are reproducible with a controlled clock; the tests of the late-receipt path run without it."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5610,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1838]",
      "number": 1838
    },
    {
      "id": "AIFACTORY-TASK-1839",
      "type": "task",
      "parent": "AIFACTORY-US-456",
      "title": "Verify reconcile-uncertain-usage through the acceptance suite",
      "sequence": "01.06.10.04",
      "description": "Verify reconcile-uncertain-usage through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-010\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-456, including an Uncertain record reconciled from a kept late receipt without a fixture source, the budget corrected for a record of a settled run and untouched for a run still Reserved, the confirmation applied twice, an unpriced Uncertain record priced after its revision was loaded, the record left uncertain and the publication and payload of UsageReconciled; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-010\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-456, including an Uncertain record reconciled from a kept late receipt without a fixture source, the budget corrected for a record of a settled run and untouched for a run still Reserved, the confirmation applied twice, an unpriced Uncertain record priced after its revision was loaded, the record left uncertain and the publication and payload of UsageReconciled; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5610,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1839]",
      "number": 1839
    },
    {
      "id": "AIFACTORY-US-457",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Read the usage of a project by meter and state and the usage records and reservation of one run",
      "sequence": "01.06.11",
      "description": "As an observer, I want to see what a project and a single run have reserved, used and still owe an answer on, so that I can trust the figures, including the part that is still uncertain. A caller whose scope carries `factory.usage.read` reads usage through two routes. `CostUsageService/GetProjectUsage` returns the usage of the project the path addresses for a period: per meter, the quantity and the cost in each of the five states the service shows as such, estimated, reserved, observed, reconciled and uncertain (FUX-08), together with the limits of the project, that is the `limitUsd`, `committedUsd` and `approvalThresholdUsd` of its budget. The reserved figure is the estimate of the reservations that are still Reserved; the other four are sums over the usage records by status. Uncertain usage is shown as uncertain: a quantity it holds is marked as not confirmed, a record without a quantity shows none, it has no cost, and it is never folded into another state or shown as observed or as zero. `CostUsageService/GetRunUsage` returns the usage records of one run, each with meter, dimensions, quantity, status, pricing revision, estimated and confirmed cost and source receipt, and the reservation of the run with its state, among them Released and Expired, its estimate, its settled amount and its approval reference. Both routes read `cost-usage-sql` under the tenant row filter and write nothing. A caller without the scope, or a member of the tenant whose role claims do not admit the project, is refused with 403. A run of another tenant is answered 404, the same answer as for a `runId` the service holds nothing for, and a project of another tenant is answered 404 as well, the same answer as for a project without a budget in the tenant of the caller, so no response confirms that a foreign resource exists (ADR-0015 amendment of D113). A project of the caller without usage in the period answers 200 with empty figures. When `cost-usage-sql` is unavailable or the token cannot be validated the call fails fast with a problem response. At this increment the routes are read through the platform gateway and by the command-line client; the project overview and the usage and cost screens of the Studio read them once StudioBff is delivered in I3. The figures come from the usage records of this service alone at this increment, since the Metering service and its export arrive in I4. Kind: behavior. Traces: services: CostUsageService; aggregates: CostUsageService/Budget, CostUsageService/Reservation, CostUsageService/UsageRecord; apis: CostUsageService/GetProjectUsage, CostUsageService/GetRunUsage; adrs: ADR-0015, ADR-0020; requirements: FR-09, FUX-08, XL-12; scenarios: SCN-CostUsageService-001, SCN-CostUsageService-002. Relates: screens: project-overview, usage-cost; nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-454, AIFACTORY-US-455. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, model/ux/screens.yaml, docs/planes/control/services/cost-usage-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a project with a budget, one Reserved reservation and usage records in the statuses Observed, Estimated, Uncertain and Reconciled on two meters, when `CostUsageService/GetProjectUsage` is called for a period by a caller with `factory.usage.read`, then the response is 200 with, per meter, quantity and cost in each of the five states, the reserved figure taken from the Reserved `CostUsageService/Reservation`, the uncertain usage shown as uncertain, with a quantity it holds marked as not confirmed and none shown for a record without one, and never as observed or as zero, and the `limitUsd`, `committedUsd` and `approvalThresholdUsd` of the `CostUsageService/Budget`; nothing is written (SCN-CostUsageService-001, FUX-08).",
        "AC2: Given a run with a settled reservation and three usage records, when `CostUsageService/GetRunUsage` is called, then the response is 200 with each `CostUsageService/UsageRecord` (meter, dimensions, quantity, status, pricing revision, estimated and confirmed cost, source receipt) and the reservation with its state, `estimatedUsd`, `settledUsd` and `approvalId`; for a settled run without uncertain records and without a receipt recorded after settlement the sum of the cost of its records equals `settledUsd` (SCN-CostUsageService-002, FR-09).",
        "AC3: Given a caller without `factory.usage.read`, a member of the tenant whose role claims do not admit the project, a run of another tenant, or a project of another tenant, when `CostUsageService/GetRunUsage` or `CostUsageService/GetProjectUsage` is called, then the answer is 403, 403, 404 or 404 respectively, each 404 being the same answer as for a resource that does not exist, with a problem response and no state change; a project of the caller without usage in the period answers 200 with empty figures (SCN-CostUsageService-001, SCN-CostUsageService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/ux/screens.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1840",
        "AIFACTORY-TASK-1841",
        "AIFACTORY-TASK-1842"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5611,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/Reservation",
          "CostUsageService/UsageRecord"
        ],
        "apis": [
          "CostUsageService/GetProjectUsage",
          "CostUsageService/GetRunUsage"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "FUX-08",
          "XL-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-001",
          "SCN-CostUsageService-002"
        ]
      },
      "relates": {
        "screens": [
          "project-overview",
          "usage-cost"
        ],
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-454",
        "AIFACTORY-US-455"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/ux/screens.yaml",
        "docs/planes/control/services/cost-usage-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-457]",
      "number": 457
    },
    {
      "id": "AIFACTORY-TASK-1840",
      "type": "task",
      "parent": "AIFACTORY-US-457",
      "title": "Contract of the project usage view and the run usage view",
      "sequence": "01.06.11.01",
      "description": "Contract of the project usage view and the run usage view. Expected output: The OpenAPI document of the service holds the project usage view with, per meter, quantity and cost in the states estimated, reserved, observed, reconciled and uncertain, a mark that a quantity of uncertain usage is not confirmed and may be absent, and the limit, committed amount and threshold of the budget, and the run usage view with the usage records and the reservation of the run in any of its five states, named after the fields of model/services/control-plane/CostUsageService.yaml and docs/reference/schemas/usage-record.schema.json.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service holds the project usage view with, per meter, quantity and cost in the states estimated, reserved, observed, reconciled and uncertain, a mark that a quantity of uncertain usage is not confirmed and may be absent, and the limit, committed amount and threshold of the budget, and the run usage view with the usage records and the reservation of the run in any of its five states, named after the fields of model/services/control-plane/CostUsageService.yaml and docs/reference/schemas/usage-record.schema.json."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5611,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1840]",
      "number": 1840
    },
    {
      "id": "AIFACTORY-TASK-1841",
      "type": "task",
      "parent": "AIFACTORY-US-457",
      "title": "GetProjectUsage and GetRunUsage read model over cost-usage-sql with the tenant row filter",
      "sequence": "01.06.11.02",
      "description": "GetProjectUsage and GetRunUsage read model over cost-usage-sql with the tenant row filter. Expected output: GetProjectUsage sums the usage records of the project and period by meter and status, takes the reserved figure from the reservations still Reserved and returns the limits of the budget; GetRunUsage returns the usage records and the reservation of the run; both apply the tenant row filter so a foreign run or project is answered 404 like an unknown one, answer 403 for a missing scope or a project the role claims of the token do not admit, show uncertain usage as uncertain, with a quantity it holds marked as not confirmed and none for a record without one, and write nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "GetProjectUsage sums the usage records of the project and period by meter and status, takes the reserved figure from the reservations still Reserved and returns the limits of the budget; GetRunUsage returns the usage records and the reservation of the run; both apply the tenant row filter so a foreign run or project is answered 404 like an unknown one, answer 403 for a missing scope or a project the role claims of the token do not admit, show uncertain usage as uncertain, with a quantity it holds marked as not confirmed and none for a record without one, and write nothing."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5611,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1841]",
      "number": 1841
    },
    {
      "id": "AIFACTORY-TASK-1842",
      "type": "task",
      "parent": "AIFACTORY-US-457",
      "title": "Verify read-usage through the acceptance suite",
      "sequence": "01.06.11.03",
      "description": "Verify read-usage through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-001|Scenario=SCN-CostUsageService-002)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-457 with usage of two tenants, records in every status and a settled run whose record costs sum to settledUsd.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-CostUsageService-001|Scenario=SCN-CostUsageService-002)\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-457 with usage of two tenants, records in every status and a settled run whose record costs sum to settledUsd."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5611,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1842]",
      "number": 1842
    },
    {
      "id": "AIFACTORY-US-549",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Count the observed cost of a run above its estimate against the budget, announce a budget overrun so that the run is stopped, and deny the next reservation",
      "sequence": "01.06.12",
      "description": "A reservation holds the estimate of a run, and the cap of a budget is enforced where a reservation is made. What a run really spends can still exceed its estimate, and the owner decided that such an overrun stops the running run and is not only recorded (D117). The invariants of the `Budget` in the model say it this way: `committedUsd` never exceeds `limitUsd` at reservation; only observed usage, recorded or settled, may take it above `limitUsd`, and that publishes `BudgetExceeded` and stops the run of that usage; and after such an overrun the next reservation of the budget is Denied. The owner then fixed the reach of the stop (D119, D121): `BudgetExceeded` names the run whose usage crossed the limit and is published once per run; only a named run is stopped; every run whose observed usage raises `committedUsd` of a budget that is above `limitUsd`, the run that crossed the limit and every later one, is named once and stopped; the runs that stay within their estimate finish and settle; and new reservations of the budget are denied. The run the event names may be a child run, whose usage counts on the reservation of its parent run (AIFACTORY-US-737): only that child run is stopped, it ends Cancelled with the reason budget-exceeded like every stopped run, and only its parent treats it as a failed child (D123). This PBI delivers that on the side of CostUsageService; RunControlService records the cancellation intent of the run in its own PBI (AIFACTORY-US-547 of feature `run-control-service`). For observed usage to reach the budget while a run is still running, the cost of its usage records has to count before settlement. The model describes `committedUsd` as reserved plus settled in the period and does not say how the usage of a run whose reservation is still Reserved counts, so this PBI states the rule it applies and reports it to the owner for confirmation: a run with a Reserved reservation counts in `committedUsd` with the larger of its estimate and the cost of its usage records so far. As long as the observed cost stays within the estimate a usage record changes no budget, because the estimate already holds that room. When a usage record takes the sum of the cost of the records of its run above the estimate, the part above the estimate that was not yet counted is added to `committedUsd` of the budget, in the transaction of the record and under the row version of the `Budget`. The cost of a record is its confirmed cost when it has one and its estimated cost otherwise; an Uncertain record has no cost and adds nothing until it is priced or reconciled. Two other writes raise `committedUsd` by observed usage and are delivered where they belong, the settlement of a reservation (AIFACTORY-US-455) and a usage record of a run whose reservation is Settled, Released or Expired (AIFACTORY-US-455, AIFACTORY-US-459); settlement corrects the amount counted for the run, its estimate or its observed cost where that already exceeded the estimate, to the settled sum. Whenever one of these writes, the excess of a running run, a settlement or a record after the reservation came to rest, raises `committedUsd` and leaves it above `limitUsd`, the `BudgetExceeded` outbox record is written in the same transaction with `budgetId`, `tenantId`, `projectId`, `committedUsd`, `limitUsd` and the `runId` of the run of that usage; `runId` is absent when the usage names no run, which is the usage of an invocation outside a run that AIFACTORY-US-881 counts against the budget of its project (D123). The event is published on `usage-accounting.budgets.v1.budget-exceeded` in the run event envelope. RunControlService consumes it and records a cancellation intent for the run with the reason budget-exceeded, so that the run follows the cancellation path and ends Cancelled with that reason; the stop is no run failure and the run is never Failed (D123). A run that is already terminal is left as it is there. A write that does not raise `committedUsd`, and a write that leaves it at or below the limit, publishes nothing, so a run that stays within its estimate is never stopped by the overrun of another run: the running runs of the budget that stay within their estimates keep their reservations, finish and settle as always. The event is published once per run (D119): a further write of observed usage for a run that already has one, as the later records of a run that is being cancelled, still raises `committedUsd` and writes no second event. A second run that takes its own cost above its own estimate while the budget is already above the limit is a run whose observed usage raised the committed amount of a budget that is above its limit, so it is named once and stopped too, and so is every later run of that kind (D121). The overrun itself is never hidden: the observed cost stays in `committedUsd`, and while the amount is above the limit every reservation against the budget is Denied with `BudgetReservationDenied` and the reason `budget-exceeded` (AIFACTORY-US-453), until the limit is raised through `SetProjectBudget` or the rollover of a monthly budget opens a new period (AIFACTORY-US-452). The confirmation of a record by the `ReconciliationWorker` corrects the budget as AIFACTORY-US-456 states and publishes `UsageReconciled` only, since the model lists `BudgetExceeded` as a result of recording and of settlement and not of reconciliation. Kind: behavior. Traces: services: CostUsageService, RunControlService; aggregates: CostUsageService/Budget, CostUsageService/Reservation, CostUsageService/UsageRecord; apis: CostUsageService/Usage.RecordUsage, CostUsageService/Usage.Reserve, CostUsageService/SetProjectBudget; events: CostUsageService/BudgetExceeded, CostUsageService/BudgetReservationDenied; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0020; requirements: FR-09, XL-12, NFR-12; scenarios: SCN-CostUsageService-013. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-453, AIFACTORY-US-454, AIFACTORY-US-455, feature:run-control-service. Sources: model/services/control-plane/CostUsageService.yaml, model/scenarios/CostUsageService.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run with a Reserved `CostUsageService/Reservation` and usage records whose cost stays within its estimate, when a further `CostUsageService/UsageRecord` of the run is recorded and the sum is still within the estimate, then `committedUsd` of the `CostUsageService/Budget` is unchanged and no `CostUsageService/BudgetExceeded` is written; when a record takes the sum above the estimate, then `committedUsd` grows by the part above the estimate that was not yet counted, in the transaction of the record, and an Uncertain record, which has no cost, adds nothing (SCN-CostUsageService-013, XL-12).",
        "AC2: Given that growth takes `committedUsd` above `limitUsd`, when the transaction of the record commits, then the `CostUsageService/BudgetExceeded` outbox record with `budgetId`, `tenantId`, `projectId`, the `runId` of the run of that record, `committedUsd` and `limitUsd` is committed with it; given a usage record of a run whose reservation is Settled, Released or Expired, or a settlement, that raises `committedUsd` and leaves it above `limitUsd`, then the record is written the same way; given a write that does not raise `committedUsd` or leaves it at or below `limitUsd`, then nothing is written; given a further write of observed usage for a run that already has its `CostUsageService/BudgetExceeded` record, then `committedUsd` grows and no second record is written for that run; and given a second run of the budget with a Reserved `CostUsageService/Reservation` whose usage stays within its estimate, then no record names it and it settles as always; and given a second run whose usage record takes its own cost above its own estimate while `committedUsd` is already above `limitUsd`, then a `CostUsageService/BudgetExceeded` record names that run too, once (SCN-CostUsageService-013, D119, D121).",
        "AC3: Given a budget whose `committedUsd` is above `limitUsd`, when the next run of the project is reserved through `ReserveForRun` or `CostUsageService/Usage.Reserve`, then its reservation is Denied with `CostUsageService/BudgetReservationDenied` and the reason `budget-exceeded`, and the same holds for an Approved spend approval; when the limit is raised through `CostUsageService/SetProjectBudget` above the committed amount, or the rollover of a monthly budget opened a new period, then a reservation that fits is Reserved again (SCN-CostUsageService-013, FR-09).",
        "AC4: Given the record was written, when the outbox dispatcher of the `cost-usage` messaging profile publishes `CostUsageService/BudgetExceeded` on `usage-accounting.budgets.v1.budget-exceeded`, then the event is sent in `run-event-envelope-v1` with `budgetId`, `tenantId`, `projectId`, `runId`, `committedUsd` and `limitUsd`, `runId` being absent when the usage names no run, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-CostUsageService-013, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2203",
        "AIFACTORY-TASK-2204"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5612,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "RunControlService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/Reservation",
          "CostUsageService/UsageRecord"
        ],
        "apis": [
          "CostUsageService/Usage.RecordUsage",
          "CostUsageService/Usage.Reserve",
          "CostUsageService/SetProjectBudget"
        ],
        "events": [
          "CostUsageService/BudgetExceeded",
          "CostUsageService/BudgetReservationDenied"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-12"
        ],
        "scenarios": [
          "SCN-CostUsageService-013"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-453",
        "AIFACTORY-US-454",
        "AIFACTORY-US-455",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-549]",
      "number": 549
    },
    {
      "id": "AIFACTORY-TASK-2203",
      "type": "task",
      "parent": "AIFACTORY-US-549",
      "title": "Excess of a running run counted against the budget and BudgetExceeded written by every write of observed usage that leaves the budget above its limit",
      "sequence": "01.06.12.01",
      "description": "Excess of a running run counted against the budget and BudgetExceeded written by every write of observed usage that leaves the budget above its limit. Expected output: The command that creates a usage record adds to committedUsd of the budget of the project, in the transaction of the record and under the row version of the Budget, the part of the cost of the records of the run above the estimate of its Reserved reservation that was not yet counted, so that such a run counts with the larger of its estimate and its observed cost; a record within the estimate and an Uncertain record change no budget; the three writes of observed usage, this excess, the settlement of AIFACTORY-TASK-1836 and the correction of AIFACTORY-TASK-1850, write the BudgetExceeded outbox record with budgetId, tenantId, projectId, the runId of the usage when it names a run, committedUsd and limitUsd whenever they raise committedUsd and leave it above limitUsd, and write nothing otherwise; the record is written once per run, so a later write of observed usage for a run that already has one raises committedUsd and writes none, and no write touches the reservation of another run (D119); a second run whose own excess raises committedUsd while it is above limitUsd gets its own record, once, and so does every later one, while a run within its estimate gets none (D121); for the usage of a child run the estimate compared is that of the reservation of its parent run and the record names the child run, as AIFACTORY-TASK-2976 delivers; a reservation against a budget above its limit is Denied with the reason budget-exceeded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The command that creates a usage record adds to committedUsd of the budget of the project, in the transaction of the record and under the row version of the Budget, the part of the cost of the records of the run above the estimate of its Reserved reservation that was not yet counted, so that such a run counts with the larger of its estimate and its observed cost; a record within the estimate and an Uncertain record change no budget; the three writes of observed usage, this excess, the settlement of AIFACTORY-TASK-1836 and the correction of AIFACTORY-TASK-1850, write the BudgetExceeded outbox record with budgetId, tenantId, projectId, the runId of the usage when it names a run, committedUsd and limitUsd whenever they raise committedUsd and leave it above limitUsd, and write nothing otherwise; the record is written once per run, so a later write of observed usage for a run that already has one raises committedUsd and writes none, and no write touches the reservation of another run (D119); a second run whose own excess raises committedUsd while it is above limitUsd gets its own record, once, and so does every later one, while a run within its estimate gets none (D121); for the usage of a child run the estimate compared is that of the reservation of its parent run and the record names the child run, as AIFACTORY-TASK-2976 delivers; a reservation against a budget above its limit is Denied with the reason budget-exceeded."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5612,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2203]",
      "number": 2203
    },
    {
      "id": "AIFACTORY-TASK-2204",
      "type": "task",
      "parent": "AIFACTORY-US-549",
      "title": "Verify announce-a-budget-overrun through the acceptance suite",
      "sequence": "01.06.12.02",
      "description": "Verify announce-a-budget-overrun through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-013\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-549 with fixture publishers of ModelInvoked and of the terminal events of a run, including records within the estimate that change no budget, the excess counted once, the BudgetExceeded record with the runId of the run that crossed the limit, no second record for further usage of that run, a second run within its estimate that is not named and settles, a further run that goes above its own estimate while the budget is above its limit and is named once too, a record after an Expired reservation that crosses the limit, the denied next reservation, a reservation that fits again after the limit was raised, and the publication and payload of BudgetExceeded; the cancellation of the run is proven by the suite of RunControlService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-CostUsageService-013\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-549 with fixture publishers of ModelInvoked and of the terminal events of a run, including records within the estimate that change no budget, the excess counted once, the BudgetExceeded record with the runId of the run that crossed the limit, no second record for further usage of that run, a second run within its estimate that is not named and settles, a further run that goes above its own estimate while the budget is above its limit and is named once too, a record after an Expired reservation that crosses the limit, the denied next reservation, a reservation that fits again after the limit was raised, and the publication and payload of BudgetExceeded; the cancellation of the run is proven by the suite of RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5612,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2204]",
      "number": 2204
    },
    {
      "id": "AIFACTORY-US-737",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Reserve nothing for a child run, record its usage with the child run id and count it on the reservation of the parent run",
      "sequence": "01.06.13",
      "description": "A run may start child runs: AgentRuntimeService submits one for a delegation and WorkflowEngineService one for a step of kind SubWorkflow, both through the internal operation `SubmitChildRun` of RunControlService. The owner decided how such a run is paid for (D121): a child run has no reservation of its own; its usage is recorded with the child run id and counts on the reservation of the parent run; and `BudgetExceeded` names the run whose usage crossed the limit, which may be a child run. This PBI delivers that in CostUsageService. RunControlService marks a child run by the optional `parentRunId` of `RunControlService/RunAccepted`, which is present only for a run accepted through `SubmitChildRun`, and it waits for no `BudgetReserved` and opens no spend approval for a child run. When the inbox handler `ReserveForRun` receives a `RunAccepted` that carries `parentRunId`, it estimates nothing and reserves nothing: no `Reservation` row is written for the child run, `committedUsd` of the budget is unchanged, and none of `BudgetReserved`, `BudgetReservationDenied` and `SpendApprovalRequired` is published. The handler notes the child run in the table `ChildRuns` of the model instead, with `childRunId`, `parentRunId`, the tenant, `notedAt` and the `reservationId` its usage counts on. That is the reservation of the parent run, and for the child of a child run it is the reservation its parent counts on, read from the `ChildRuns` row of that parent, so every run of a tree counts on the one reservation of its root. The note is idempotent on `childRunId`, and a redelivered event writes nothing. The row requires a reservation id, so a child run is noted only under a reservation that exists. When the service holds neither a reservation nor a `ChildRuns` row for the run that `parentRunId` names, which can happen when the events of a tree arrive out of order, the handler does not acknowledge the delivery and the inbox redelivers it with backoff; the model does not state that case, and it is reported to the owner. From then on the usage of the child run is recorded as AIFACTORY-US-454 states, one `UsageRecord` per receipt and meter with the child run id as its `runId`, by `Usage.RecordUsage` and by the handlers of the receipt events alike, and it counts on the reservation of the parent run. Wherever the cost of the usage records of a run is compared with the estimate of its Reserved reservation (AIFACTORY-US-549), the cost compared is that of the records of the run of the reservation and of every child run noted under it, taken together. As long as that sum stays within the estimate, a record of a child run changes no budget, because the estimate of the parent run already holds that room. When a record takes the sum above the estimate, the part above the estimate that was not yet counted is added to `committedUsd` in the transaction of the record. When the reservation is no longer Reserved, the cost of the record is added in full, as for any record that arrives after its reservation came to rest (AIFACTORY-US-455). A usage record of a child run that arrives before its note is recorded and changes no budget, having no reservation to count on yet; the handler that writes the note then counts the cost of the records the child run already has, by the same rule and in the transaction of the note. When one of these writes raises `committedUsd` and leaves it above `limitUsd`, `BudgetExceeded` is written with the `runId` of the run of that usage, so it names the child run when the usage is that of the child run, once per run; RunControlService stops only the run the event names, which ends Cancelled with the reason budget-exceeded and is no failed run, and only the parent run treats that child as failed (D123). A write for the usage of a child run never names the parent run. The terminal events of a child run, `RunCompleted`, `RunFailed` and `RunCancelled`, settle and release nothing, because the child run has no reservation: the handlers acknowledge them without effect. The usage of the child run is settled with the reservation of the parent run: when the terminal event of the parent run arrives, `settledUsd` is the sum of the cost of the usage records of the parent run and of the child runs noted under the reservation, and `uncertain` is true while one of those records is Uncertain or Estimated. A usage record of a child run also counts as usage of that reservation where a release or an expiry is decided, so the reservation of a parent run whose child run has spent is neither released by `SettleOrRelease` nor expired by the `ReservationExpiryWorker` (AIFACTORY-US-455, AIFACTORY-US-459). Three points the decision and the model leave unsaid are reported to the owner and not decided here: what the handler `RecordAttemptUsage` notes for the attempt outcome of a child run, which has no reservation, so this delivery leaves the reservation of the parent run unchanged for it; what `GetRunUsage` returns as the reservation of a child run, so the read of AIFACTORY-US-457 is unchanged and returns the usage records of the child run without a reservation; and what `Usage.Reserve` answers for the run id of a child run, since its request names no parent. The table `ChildRuns` is migrated here with its index on the reservation and carries the tenant filter in its mapping. Kind: behavior. Traces: services: CostUsageService, RunControlService; aggregates: CostUsageService/Budget, CostUsageService/Reservation, CostUsageService/UsageRecord; apis: CostUsageService/Usage.RecordUsage; events: RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled, CostUsageService/BudgetReserved, CostUsageService/BudgetReservationDenied, CostUsageService/SpendApprovalRequired, CostUsageService/UsageRecorded, CostUsageService/BudgetExceeded, CostUsageService/ReservationSettled; descriptors: usage-record-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0020; requirements: FR-09, XL-12, NFR-12. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-453, AIFACTORY-US-454, AIFACTORY-US-455, AIFACTORY-US-459, AIFACTORY-US-549, feature:run-control-service. Sources: model/services/control-plane/CostUsageService.yaml, model/services/control-plane/RunControlService.yaml, model/scenarios/CostUsageService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a parent run with a Reserved `CostUsageService/Reservation`, when `RunControlService/RunAccepted` with the `parentRunId` of that run is handled by `ReserveForRun`, then no reservation is written for the child run, `committedUsd` of the `CostUsageService/Budget` is unchanged, none of `CostUsageService/BudgetReserved`, `CostUsageService/BudgetReservationDenied` and `CostUsageService/SpendApprovalRequired` is written, and one `ChildRuns` row holds `childRunId`, `parentRunId` and the `reservationId` of the parent run; given a child of that child run, then its row holds the same `reservationId`; and a redelivery of either event writes nothing (D121, model/services/control-plane/CostUsageService.yaml).",
        "AC2: Given a child run noted under the reservation of its parent run, when a receipt of the child run is recorded through `CostUsageService/Usage.RecordUsage` or a receipt event, then one `CostUsageService/UsageRecord` per meter exists with the child run id as its `runId` and `CostUsageService/UsageRecorded` is written once per record; while the cost of the records of the parent run and of its child runs together stays within the estimate of the reservation, `committedUsd` is unchanged; when a record of the child run takes that sum above the estimate, then `committedUsd` grows by the part above the estimate that was not yet counted, in the transaction of the record (D121, XL-12).",
        "AC3: Given that growth leaves `committedUsd` above `limitUsd`, when the transaction of the record of the child run commits, then one `CostUsageService/BudgetExceeded` outbox record with the `runId` of the child run is committed with it, no record names the parent run, and a further usage record of the child run raises `committedUsd` and writes no second record; given a later usage record of the parent run that raises `committedUsd` while it is above `limitUsd`, then a record names the parent run, once (D121, model/services/control-plane/CostUsageService.yaml).",
        "AC4: Given a child run with usage records, when `RunControlService/RunCompleted`, `RunControlService/RunFailed` or `RunControlService/RunCancelled` of the child run is handled, then no reservation changes its state and no `CostUsageService/ReservationSettled` is written; when the terminal event of the parent run is handled, then its reservation is Settled with `settledUsd` equal to the sum of the cost of the usage records of the parent run and of its child runs, and `CostUsageService/ReservationSettled` is written once, with `uncertain` true while one of those records is Uncertain or Estimated; and given a parent run without usage records of its own whose child run has one, when the `ReservationExpiryWorker` runs past `expiresAt`, then the reservation stays Reserved, and when `RunControlService/RunCancelled` of the parent run arrives, then it is Settled and not Released (D121, FR-09).",
        "AC5: Given `RunControlService/RunAccepted` of a child run whose parent run has neither a reservation nor a `ChildRuns` row yet, when it is handled, then nothing is written and the delivery is not acknowledged, and after the reservation of the parent run exists the redelivered event writes the note once; given usage records of a child run that were recorded before its note, when the note is written, then their cost is counted on the reservation of the parent run in the transaction of the note by the rule of AC2 (model/services/control-plane/CostUsageService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2974",
        "AIFACTORY-TASK-2975",
        "AIFACTORY-TASK-2976",
        "AIFACTORY-TASK-2977",
        "AIFACTORY-TASK-2978"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5613,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "RunControlService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/Reservation",
          "CostUsageService/UsageRecord"
        ],
        "apis": [
          "CostUsageService/Usage.RecordUsage"
        ],
        "events": [
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled",
          "CostUsageService/BudgetReserved",
          "CostUsageService/BudgetReservationDenied",
          "CostUsageService/SpendApprovalRequired",
          "CostUsageService/UsageRecorded",
          "CostUsageService/BudgetExceeded",
          "CostUsageService/ReservationSettled"
        ],
        "descriptors": [
          "usage-record-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-12"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-453",
        "AIFACTORY-US-454",
        "AIFACTORY-US-455",
        "AIFACTORY-US-459",
        "AIFACTORY-US-549",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/CostUsageService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-737]",
      "number": 737
    },
    {
      "id": "AIFACTORY-TASK-2974",
      "type": "task",
      "parent": "AIFACTORY-US-737",
      "title": "Migration and mapping of the table ChildRuns in cost-usage-sql",
      "sequence": "01.06.13.01",
      "description": "Migration and mapping of the table ChildRuns in cost-usage-sql. Expected output: The table ChildRuns of model/services/control-plane/CostUsageService.yaml exists with the columns ChildRunId as key, TenantId, ParentRunId, ReservationId as a foreign key to Reservations and NotedAt, and with the index IX_ChildRuns_Reservation; its mapping carries the tenant filter of the Factory profile; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The table ChildRuns of model/services/control-plane/CostUsageService.yaml exists with the columns ChildRunId as key, TenantId, ParentRunId, ReservationId as a foreign key to Reservations and NotedAt, and with the index IX_ChildRuns_Reservation; its mapping carries the tenant filter of the Factory profile; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5613,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-2974]",
      "number": 2974
    },
    {
      "id": "AIFACTORY-TASK-2975",
      "type": "task",
      "parent": "AIFACTORY-US-737",
      "title": "ReserveForRun noting a child run under the reservation of its parent run and reserving nothing for it",
      "sequence": "01.06.13.02",
      "description": "ReserveForRun noting a child run under the reservation of its parent run and reserving nothing for it. Expected output: For a RunAccepted that carries parentRunId the handler ReserveForRun runs no estimate and no reservation command, writes no Reservation row and none of BudgetReserved, BudgetReservationDenied and SpendApprovalRequired, and writes one ChildRuns row with childRunId, parentRunId, the tenant, notedAt and the reservationId of the parent run, or the reservationId of the ChildRuns row of the parent run when the parent run is itself a child run; the note is idempotent on childRunId; when the service holds neither a reservation nor a ChildRuns row for the parent run the handler writes nothing and does not acknowledge the delivery, so the inbox redelivers it with backoff; in the transaction of the note the cost of usage records the child run already has is counted by the rule of AIFACTORY-TASK-2976 (D121).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "For a RunAccepted that carries parentRunId the handler ReserveForRun runs no estimate and no reservation command, writes no Reservation row and none of BudgetReserved, BudgetReservationDenied and SpendApprovalRequired, and writes one ChildRuns row with childRunId, parentRunId, the tenant, notedAt and the reservationId of the parent run, or the reservationId of the ChildRuns row of the parent run when the parent run is itself a child run; the note is idempotent on childRunId; when the service holds neither a reservation nor a ChildRuns row for the parent run the handler writes nothing and does not acknowledge the delivery, so the inbox redelivers it with backoff; in the transaction of the note the cost of usage records the child run already has is counted by the rule of AIFACTORY-TASK-2976 (D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5613,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2975]",
      "number": 2975
    },
    {
      "id": "AIFACTORY-TASK-2976",
      "type": "task",
      "parent": "AIFACTORY-US-737",
      "title": "Usage of a child run counted, announced and settled on the reservation of its parent run",
      "sequence": "01.06.13.03",
      "description": "Usage of a child run counted, announced and settled on the reservation of its parent run. Expected output: The command that creates a usage record resolves the reservation a run counts on, its own or, for a run noted in ChildRuns, the one of that row, and applies the rules of AIFACTORY-TASK-2203 and AIFACTORY-TASK-1850 to it with the cost of the records of the run of the reservation and of every child run noted under it taken together, so that a record of a child run within the estimate changes no budget, the uncounted part above the estimate is added to committedUsd in the transaction of the record, and a record under a reservation that is no longer Reserved is added in full; the BudgetExceeded outbox record carries the runId of the run of the usage, the child run for the usage of a child run, once per run; SettleReservation and SettleOrRelease move no reservation on a terminal event of a child run, sum the usage records of the parent run and of its noted child runs into settledUsd and into the uncertain flag when the parent run ends, and treat a usage record of a noted child run as usage of the reservation, as the ReservationExpiryWorker does (D121).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The command that creates a usage record resolves the reservation a run counts on, its own or, for a run noted in ChildRuns, the one of that row, and applies the rules of AIFACTORY-TASK-2203 and AIFACTORY-TASK-1850 to it with the cost of the records of the run of the reservation and of every child run noted under it taken together, so that a record of a child run within the estimate changes no budget, the uncounted part above the estimate is added to committedUsd in the transaction of the record, and a record under a reservation that is no longer Reserved is added in full; the BudgetExceeded outbox record carries the runId of the run of the usage, the child run for the usage of a child run, once per run; SettleReservation and SettleOrRelease move no reservation on a terminal event of a child run, sum the usage records of the parent run and of its noted child runs into settledUsd and into the uncertain flag when the parent run ends, and treat a usage record of a noted child run as usage of the reservation, as the ReservationExpiryWorker does (D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5613,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2976]",
      "number": 2976
    },
    {
      "id": "AIFACTORY-TASK-2977",
      "type": "task",
      "parent": "AIFACTORY-US-737",
      "title": "Acceptance fixtures of a run tree with child runs, their receipts and their terminal events",
      "sequence": "01.06.13.04",
      "description": "Acceptance fixtures of a run tree with child runs, their receipts and their terminal events. Expected output: The acceptance suite holds a fixture publisher that sends RunAccepted with a parentRunId for a child run and for the child of a child run, in order and out of order, receipts that name the child run id through Usage.RecordUsage and through the receipt events with costs that stay within and that exceed the estimate of the reservation of the parent run, and RunCompleted, RunFailed and RunCancelled for a child run and for its parent run, so that the note, the counting, the BudgetExceeded record that names the child run and the settlement of the parent run are reproducible without RunControlService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fixture publisher that sends RunAccepted with a parentRunId for a child run and for the child of a child run, in order and out of order, receipts that name the child run id through Usage.RecordUsage and through the receipt events with costs that stay within and that exceed the estimate of the reservation of the parent run, and RunCompleted, RunFailed and RunCancelled for a child run and for its parent run, so that the note, the counting, the BudgetExceeded record that names the child run and the settlement of the parent run are reproducible without RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5613,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2977]",
      "number": 2977
    },
    {
      "id": "AIFACTORY-TASK-2978",
      "type": "task",
      "parent": "AIFACTORY-US-737",
      "title": "Verify count-child-run-usage-on-the-parent-reservation through the acceptance suite",
      "sequence": "01.06.13.05",
      "description": "Verify count-child-run-usage-on-the-parent-reservation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ChildRunUsage\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-737: no reservation and none of the three reservation events for a RunAccepted with parentRunId, the ChildRuns row of a child run and of the child of a child run on the reservation of the root, the redelivery that writes nothing, usage recorded with the child run id that changes no budget within the estimate of the parent run and raises committedUsd above it, CostUsageService/BudgetExceeded naming the child run once and the parent run only for its own usage, terminal events of a child run that move no reservation, the settlement of the parent run over its own usage and that of its child runs, a parent reservation with child usage that is neither released nor expired, the unacknowledged note of a child run whose parent run is not known yet and the cost of earlier records counted when the note is written; the stop of the named run is proven by the suite of RunControlService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ChildRunUsage\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-737: no reservation and none of the three reservation events for a RunAccepted with parentRunId, the ChildRuns row of a child run and of the child of a child run on the reservation of the root, the redelivery that writes nothing, usage recorded with the child run id that changes no budget within the estimate of the parent run and raises committedUsd above it, CostUsageService/BudgetExceeded naming the child run once and the parent run only for its own usage, terminal events of a child run that move no reservation, the settlement of the parent run over its own usage and that of its child runs, a parent reservation with child usage that is neither released nor expired, the unacknowledged note of a child run whose parent run is not known yet and the cost of earlier records counted when the note is written; the stop of the named run is proven by the suite of RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5613,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2978]",
      "number": 2978
    },
    {
      "id": "AIFACTORY-US-881",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-008",
      "title": "Record the usage of an invocation that names no run against the budget of its project, without a reservation, and count it in the committed amount",
      "sequence": "01.06.14",
      "description": "Not every model call belongs to a run. ModelRouterService serves the calls of the OpenAI-compatible route of the model gateway, and such a call is of one of two kinds (D123). A run-bound call carries the run and the attempt of its token, and its usage counts on the reservation of the run as AIFACTORY-US-454 and AIFACTORY-US-549 state. A call outside a run names no run and no attempt, and its receipt carries the tenant and the project the caller named. The owner decided how the second kind is paid for (D123), and the model of CostUsageService states it: the usage of an invocation that names no run is recorded against the budget of its project without a reservation, and it counts in `committedUsd` of that budget. This PBI delivers that. The receipt reaches the service on the two paths of AIFACTORY-US-454, which stay one command: `CostUsageService/Usage.RecordUsage` with a `usage-record-v1` that carries no `runId`, which the descriptor makes optional, and the inbox handler `RecordModelUsage` for a `ModelRouterService/ModelInvoked` whose `runId` and `attemptId` are absent. The record is written as AIFACTORY-US-454 states, once per receipt and meter, the input tokens and the output tokens of the call on their two meters, each priced by the revision valid at `occurredAt`, with its `UsageRecorded` outbox record in the same transaction. It carries the tenant and the project and neither a run nor an attempt, so the column `RunId` of `UsageRecords` stays empty, and it belongs to no reservation, so the request carries no `reservationId`. Nothing is estimated or reserved for the call: no `Reservation` row is written, none of `BudgetReserved`, `BudgetReservationDenied` and `SpendApprovalRequired` is published, and no spend approval is asked for. The cost of the record is instead added to `committedUsd` of the budget of the project in the transaction of the record and under the row version of the `Budget`, in full, because no estimate holds room for it. The cost of a record is its confirmed cost when it has one and its estimated cost otherwise; an Uncertain record has no cost and adds nothing until it is priced or reconciled. When the `ReconciliationWorker` confirms or prices such a record (AIFACTORY-US-456), `committedUsd` is corrected in the transaction of the confirmation by the difference between the confirmed cost and the cost counted for the record so far, because no settlement will ever sum it. No terminal event of a run touches the record, no settlement counts it, and the `ReservationExpiryWorker` has nothing to expire for it. The rollover of a monthly budget (AIFACTORY-US-452) closes the period with the amount that holds this usage in `BudgetPeriods` and opens the new period with the estimates of the reservations still Reserved only, so usage outside a run counts in the period in which it was recorded. The usage is read with the figures of its project through `GetProjectUsage`, by meter and state like any other record (AIFACTORY-US-457), and no read of a run returns it. `Usage.RecordUsage` records what was consumed also when the budget is already above its limit, since the consumption has happened and no receipt is refused; this service offers no check before a call outside a run, and none is added here. The budget still holds its limit for what comes next. When a record outside a run raises `committedUsd` and leaves it above `limitUsd`, the `BudgetExceeded` outbox record is written in the same transaction with `budgetId`, `tenantId`, `projectId`, `committedUsd` and `limitUsd` and without a `runId`, which the model makes optional for exactly this case. The event names no run, so no run is stopped by it, and from then on every reservation against the budget is Denied with the reason `budget-exceeded` until the limit is raised or a new period opens (AIFACTORY-US-549, AIFACTORY-US-453). The model states the rule of one event per run for runs only. For usage outside a run this PBI writes the event when a write takes `committedUsd` from at or below `limitUsd` to above it and writes none for further usage outside a run while the amount stays above the limit, because there is no run to name; that reading is reported to the owner. A running run of the same budget is named by no such event and is stopped only by its own usage, as AIFACTORY-US-549 states. Over gRPC the refusals of AIFACTORY-US-454 hold unchanged, a project of another tenant being answered NOT_FOUND. Kind: behavior. Traces: services: CostUsageService, ModelRouterService; aggregates: CostUsageService/Budget, CostUsageService/UsageRecord, CostUsageService/Reservation; apis: CostUsageService/Usage.RecordUsage, CostUsageService/Usage.Reserve, CostUsageService/GetProjectUsage, CostUsageService/GetRunUsage; events: ModelRouterService/ModelInvoked, CostUsageService/UsageRecorded, CostUsageService/BudgetExceeded, CostUsageService/BudgetReserved, CostUsageService/BudgetReservationDenied, CostUsageService/SpendApprovalRequired; descriptors: usage-record-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0020; requirements: FR-09, XL-12, NFR-12. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-450, AIFACTORY-US-451, AIFACTORY-US-452, AIFACTORY-US-453, AIFACTORY-US-454, AIFACTORY-US-456, AIFACTORY-US-457, AIFACTORY-US-549, feature:model-router-service. Sources: model/services/control-plane/CostUsageService.yaml, model/services/model-compute/ModelRouterService.yaml, model/scenarios/CostUsageService.yaml, docs/reference/schemas/usage-record.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a project with a `CostUsageService/Budget` and pricing revisions valid at `occurredAt`, when `CostUsageService/Usage.RecordUsage` is called by ModelRouterService with a `usage-record-v1` that carries no `runId`, or `ModelRouterService/ModelInvoked` without `runId` and `attemptId` is handled, then one `CostUsageService/UsageRecord` per meter exists with the tenant, the project, no run and no attempt, one `CostUsageService/UsageRecorded` outbox record per usage record is written in the same transaction, and `committedUsd` of the budget of the project has grown by the cost of those records in that transaction (D123, model/services/control-plane/CostUsageService.yaml).",
        "AC2: Given that receipt was recorded, when the tables and the outbox are inspected, then no `CostUsageService/Reservation` exists for it and none of `CostUsageService/BudgetReserved`, `CostUsageService/BudgetReservationDenied` and `CostUsageService/SpendApprovalRequired` was written; when the same receipt arrives again by either path, then no record is added and `committedUsd` is unchanged; given an Uncertain record outside a run, then it adds nothing to `committedUsd`; and when the `ReconciliationWorker` confirms a record outside a run, then `committedUsd` is corrected by the difference between the confirmed cost and the cost counted for the record so far, in the transaction of the confirmation (D123, FR-09).",
        "AC3: Given a budget whose `committedUsd` is at or below `limitUsd`, when a usage record outside a run raises it above `limitUsd`, then one `CostUsageService/BudgetExceeded` outbox record with `budgetId`, `tenantId`, `projectId`, `committedUsd` and `limitUsd` and without `runId` is committed with the record; a running run of the same budget that stays within its estimate is named by no record and settles as always; further usage outside a run raises `committedUsd` and writes no further record while the amount stays above the limit; and the next reservation of the project through `ReserveForRun` or `CostUsageService/Usage.Reserve` is Denied with `CostUsageService/BudgetReservationDenied` and the reason `budget-exceeded` (D123, XL-12).",
        "AC4: Given usage records outside a run and usage records of a run in one project, when `CostUsageService/GetProjectUsage` is read, then its figures by meter and state hold both and `committedUsd` holds the cost of the records outside a run; when `CostUsageService/GetRunUsage` is read for that run, then it returns the records of the run only; when the terminal event of that run is handled and when the `ReservationExpiryWorker` runs, then no record outside a run is settled, released or expired; and when the monthly budget rolls over, then the closed period in `BudgetPeriods` holds the amount with that usage and the new period starts without it (D123, model/services/control-plane/CostUsageService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3552",
        "AIFACTORY-TASK-3553",
        "AIFACTORY-TASK-3554",
        "AIFACTORY-TASK-3555",
        "AIFACTORY-TASK-3556"
      ],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5614,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "ModelRouterService"
        ],
        "aggregates": [
          "CostUsageService/Budget",
          "CostUsageService/UsageRecord",
          "CostUsageService/Reservation"
        ],
        "apis": [
          "CostUsageService/Usage.RecordUsage",
          "CostUsageService/Usage.Reserve",
          "CostUsageService/GetProjectUsage",
          "CostUsageService/GetRunUsage"
        ],
        "events": [
          "ModelRouterService/ModelInvoked",
          "CostUsageService/UsageRecorded",
          "CostUsageService/BudgetExceeded",
          "CostUsageService/BudgetReserved",
          "CostUsageService/BudgetReservationDenied",
          "CostUsageService/SpendApprovalRequired"
        ],
        "descriptors": [
          "usage-record-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09",
          "XL-12",
          "NFR-12"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-450",
        "AIFACTORY-US-451",
        "AIFACTORY-US-452",
        "AIFACTORY-US-453",
        "AIFACTORY-US-454",
        "AIFACTORY-US-456",
        "AIFACTORY-US-457",
        "AIFACTORY-US-549",
        "feature:model-router-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/scenarios/CostUsageService.yaml",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-881]",
      "number": 881
    },
    {
      "id": "AIFACTORY-TASK-3552",
      "type": "task",
      "parent": "AIFACTORY-US-881",
      "title": "Contract of Usage.RecordUsage for a usage record that names no run",
      "sequence": "01.06.14.01",
      "description": "Contract of Usage.RecordUsage for a usage record that names no run. Expected output: The contract document and the proto of Usage.RecordUsage state, against the UsageRecord definition of docs/reference/schemas/usage-record.schema.json, that runId is optional (D123), that a request without runId carries no attemptId and no reservationId, that such usage is counted against the budget of its project without a reservation, and that ack-v1 answers it as it answers any record; the golden files of the contract test hold a request with a run and a request without one, and the consumer test of ModelInvoked reads an event of the pinned contracts package whose runId and attemptId are absent.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The contract document and the proto of Usage.RecordUsage state, against the UsageRecord definition of docs/reference/schemas/usage-record.schema.json, that runId is optional (D123), that a request without runId carries no attemptId and no reservationId, that such usage is counted against the budget of its project without a reservation, and that ack-v1 answers it as it answers any record; the golden files of the contract test hold a request with a run and a request without one, and the consumer test of ModelInvoked reads an event of the pinned contracts package whose runId and attemptId are absent."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5614,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3552]",
      "number": 3552
    },
    {
      "id": "AIFACTORY-TASK-3553",
      "type": "task",
      "parent": "AIFACTORY-US-881",
      "title": "Nullable RunId of UsageRecords in the migration and the mapping",
      "sequence": "01.06.14.02",
      "description": "Nullable RunId of UsageRecords in the migration and the mapping. Expected output: The column RunId of UsageRecords in cost-usage-sql is nullable, as model/services/control-plane/CostUsageService.yaml lists it (D123), the mapping of UsageRecord reads and writes a record without a run and without an attempt, and the reads that select the usage of one run never return a record without a run; mapping tests on an isolated test database prove a record with a run and a record without one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The column RunId of UsageRecords in cost-usage-sql is nullable, as model/services/control-plane/CostUsageService.yaml lists it (D123), the mapping of UsageRecord reads and writes a record without a run and without an attempt, and the reads that select the usage of one run never return a record without a run; mapping tests on an isolated test database prove a record with a run and a record without one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5614,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-3553]",
      "number": 3553
    },
    {
      "id": "AIFACTORY-TASK-3554",
      "type": "task",
      "parent": "AIFACTORY-US-881",
      "title": "Usage outside a run counted against the budget of its project without a reservation",
      "sequence": "01.06.14.03",
      "description": "Usage outside a run counted against the budget of its project without a reservation. Expected output: The command of AIFACTORY-TASK-311 that creates a usage record accepts a receipt without a run from Usage.RecordUsage and from the handler RecordModelUsage, writes the record with tenant, project and neither run nor attempt together with its UsageRecorded outbox record, resolves no reservation and writes none, and adds the cost of the record in full to committedUsd of the budget of the project in the same transaction and under the row version of the Budget; an Uncertain record adds nothing; the same receipt again changes nothing; the confirmation of such a record by the ReconciliationWorker corrects committedUsd by the difference between the confirmed cost and the cost counted so far, in the transaction of the confirmation; a write that takes committedUsd from at or below limitUsd to above it writes the BudgetExceeded outbox record with budgetId, tenantId, projectId, committedUsd and limitUsd and without runId, and further usage outside a run writes none while the amount stays above the limit; settlement, release and expiry never select a record without a run, and a reservation against a budget above its limit is Denied with the reason budget-exceeded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The command of AIFACTORY-TASK-311 that creates a usage record accepts a receipt without a run from Usage.RecordUsage and from the handler RecordModelUsage, writes the record with tenant, project and neither run nor attempt together with its UsageRecorded outbox record, resolves no reservation and writes none, and adds the cost of the record in full to committedUsd of the budget of the project in the same transaction and under the row version of the Budget; an Uncertain record adds nothing; the same receipt again changes nothing; the confirmation of such a record by the ReconciliationWorker corrects committedUsd by the difference between the confirmed cost and the cost counted so far, in the transaction of the confirmation; a write that takes committedUsd from at or below limitUsd to above it writes the BudgetExceeded outbox record with budgetId, tenantId, projectId, committedUsd and limitUsd and without runId, and further usage outside a run writes none while the amount stays above the limit; settlement, release and expiry never select a record without a run, and a reservation against a budget above its limit is Denied with the reason budget-exceeded."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5614,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3554]",
      "number": 3554
    },
    {
      "id": "AIFACTORY-TASK-3555",
      "type": "task",
      "parent": "AIFACTORY-US-881",
      "title": "Acceptance fixtures of receipts that name no run",
      "sequence": "01.06.14.04",
      "description": "Acceptance fixtures of receipts that name no run. Expected output: The acceptance suite holds a fixture publisher that sends ModelInvoked without runId and attemptId for a stated tenant and project, built from the pinned contracts package, and requests of Usage.RecordUsage without runId, with reported, estimated and unknown usage and with costs that stay below and that cross the limit of the budget of the project, beside the receipts of a run of the same project, so that the counting, the BudgetExceeded record without a run and the reads are reproducible without ModelRouterService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fixture publisher that sends ModelInvoked without runId and attemptId for a stated tenant and project, built from the pinned contracts package, and requests of Usage.RecordUsage without runId, with reported, estimated and unknown usage and with costs that stay below and that cross the limit of the budget of the project, beside the receipts of a run of the same project, so that the counting, the BudgetExceeded record without a run and the reads are reproducible without ModelRouterService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5614,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3555]",
      "number": 3555
    },
    {
      "id": "AIFACTORY-TASK-3556",
      "type": "task",
      "parent": "AIFACTORY-US-881",
      "title": "Verify record-usage-outside-a-run through the acceptance suite",
      "sequence": "01.06.14.05",
      "description": "Verify record-usage-outside-a-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=UsageOutsideARun\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-881: a receipt without a run recorded by both paths with no run and no attempt, committedUsd grown by its cost in the transaction of the record, no reservation and none of the three reservation events, the repeated receipt that changes nothing, an Uncertain record that adds nothing and its confirmation that corrects the budget, CostUsageService/BudgetExceeded written once without a runId when the limit is crossed and not again while the amount stays above it, a running run of the same budget that is not named, the denied next reservation, GetProjectUsage holding the usage and GetRunUsage not returning it, and a rollover that keeps the usage in the closed period.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=UsageOutsideARun\"`; a filter that matches no test counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-881: a receipt without a run recorded by both paths with no run and no attempt, committedUsd grown by its cost in the transaction of the record, no reservation and none of the three reservation events, the repeated receipt that changes nothing, an Uncertain record that adds nothing and its confirmation that corrects the budget, CostUsageService/BudgetExceeded written once without a runId when the limit is crossed and not again while the amount stays above it, a running run of the same budget that is not named, the denied next reservation, GetProjectUsage holding the usage and GetRunUsage not returning it, and a rollover that keeps the usage in the closed period."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 56,
      "phase": "factory",
      "stackRank": 5614,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3556]",
      "number": 3556
    },
    {
      "id": "AIFACTORY-FEAT-189",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "AgentRegistryService: the publication path of releases from I2",
      "sequence": "01.07",
      "description": "The owner decided that the publication of releases moves before I4 (D140), so that the workflow definitions and agents of I2 and later increments become loadable as Published releases instead of growing the seed of the thin delivery. This feature delivers the publication path of AgentRegistryService in I2: validating and submitting a release candidate with its dependency closure, the closure resolver, the publication approval by a Reviewer who is not the submitter through Run Control with the subject asset release, publishing on the approval, the reads of releases and the move of an alias. The evaluation verdict, deprecation, revocation, the learning release and the remaining consumers stay with the complete delivery in I4. Repository ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Delivers: AgentRegistryService (thin: ValidateRelease, SubmitRelease, PublishRelease, GetRelease, ListReleases and MoveAlias, the events AssetReleaseSubmitted and AssetReleasePublished, the worker ClosureResolver and the handler PublishOnApproval of ApprovalDecided; the publication approval names the subject asset release (D135); no evaluation verdict is required before I4.). Depends on: AIFACTORY-FEAT-001, AIFACTORY-FEAT-006. Increment I2: Deliver it. Build order 92 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1561",
        "AIFACTORY-US-414",
        "AIFACTORY-US-415",
        "AIFACTORY-US-416",
        "AIFACTORY-US-418",
        "AIFACTORY-US-419"
      ],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9200,
      "titlePrefix": "[AIFACTORY-FEAT-189]",
      "number": 189
    },
    {
      "id": "AIFACTORY-US-1561",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-189",
      "title": "A workflow definition and its agent are submitted, published by a Reviewer who is not the submitter, and resolved and loaded by alias",
      "sequence": "01.07.01",
      "description": "As an asset maintainer, I want to take a workflow definition and the agent it runs from a commit to Published releases that a Reviewer approved, so that the runs of I2 and of later increments pin Published releases instead of growing the seed of the first outcome. This is the integration PBI of the feature. The owner decided that the publication of releases moves before I4 (D140): the seed of the thin delivery stays the twenty-six Draft releases of I1, and every workflow definition and agent of a workflow feature of I2, I3 or I4, with any new skill, tool and model profile release it needs, is submitted and published through this path in its own feature, so that its runs pin the Published release. An agent that several workflow features extend with skills gets a new version per feature: the first feature in build order submits version 1, each later feature submits a new version with the skills it adds, the alias latest moves to each new Published version, and each run pins the version it was published with (D141). This PBI proves the path end to end on a deployed estate with one workflow definition and the agent it runs. An asset maintainer validates the agent candidate without side effect (AIFACTORY-US-414) and submits it from its source commit (AIFACTORY-US-415); the `ClosureResolver` worker resolves its closure and computes its hash; the service requests the publication approval through `RunControl.RequestApproval` of RunControlService with its own service identity, the subject kind asset-release and the release id as subject id (D135, D140); a Reviewer who is not the submitter decides it, and the handler `PublishOnApproval` moves the release to Published on the `ApprovalDecided` that grants it (AIFACTORY-US-416). The workflow definition, whose closure names the Published agent release, follows the same way, and the maintainer moves the alias of each to its Published release (AIFACTORY-US-419). RunControlService then resolves the workflow alias through `AssetPublication.ResolveRelease` to the Published release at submission and pins it, and WorkflowEngineService and AgentRuntimeService load the pinned releases through `AssetPublication.LoadRelease`. Both methods come from the thin delivery, their contract does not change and their callers are not rebuilt; a Published release carries `publishedAt`, `publishedBy` and `approval`, and `evaluation` stays absent. No evaluation verdict is required before I4, because no evaluation suite is delivered before the complete QualityScoreService of I4; the option `Publication:Gates:RequireEvaluation` takes effect with the complete delivery, which also publishes the seeded releases through the gate and resubmits as a new version, through the gate, a release published before I4 without an evaluation record where a suite exists (D140). A ModelProfile release is approved by a Platform admin who is not its author, a release of every other kind by a Reviewer who is not its author (D119). Releases are read with their manifest, closure and aliases (AIFACTORY-US-418). Deprecation, revocation, the learning release, the evaluation evidence and the remaining consumers stay with feature `agent-registry-service-complete` in I4. The six REST operations of this feature are reached through ControlPlaneApi under `factory.assets.read`, `factory.assets.write` or `factory.assets.publish`; the gateway forwards the user token without exchanging it and the service accepts the audience of its own gateway (ADR-0015 amendment D117); a release of another tenant is answered 404, over gRPC NOT_FOUND, and a missing scope inside the tenant of the caller 403 (ADR-0015). A publication writes `AssetReleasePublished` and an `audit-evidence-v1` record of action `release-published` to the outbox in the transaction of the command (D115). Manifests never contain secrets. Kind: behavior. Traces: services: AgentRegistryService, RunControlService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/ValidateRelease, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease, AgentRegistryService/GetRelease, AgentRegistryService/ListReleases, AgentRegistryService/MoveAlias, AgentRegistryService/AssetPublication.ResolveRelease, AgentRegistryService/AssetPublication.LoadRelease, RunControlService/RunControl.RequestApproval; events: AgentRegistryService/AssetReleaseSubmitted, AgentRegistryService/AssetReleasePublished, RunControlService/ApprovalDecided; descriptors: release-manifest-v1, approval-request-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0021, ADR-0028; requirements: FR-02, XL-15. Depends on: AIFACTORY-US-414, AIFACTORY-US-415, AIFACTORY-US-416, AIFACTORY-US-418, AIFACTORY-US-419, feature:agent-registry-service-thin, feature:run-control-service, feature:component-base-template-factory-profile, feature:component-audit-factory-evidence, feature:contracts-package. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries, docs/planes/control/registries.md, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given an agent and a workflow definition whose closure names that agent, both at a source commit, and an asset maintainer A, when A validates and submits the agent through `AgentRegistryService/ValidateRelease` and `AgentRegistryService/SubmitRelease`, its closure is resolved, and the publication approval requested through `RunControlService/RunControl.RequestApproval` with the subject kind asset-release and the release id is granted by a Reviewer B who is not A, and the same follows for the workflow definition, then both `AgentRegistryService/AssetRelease` rows are Published through `RunControlService/ApprovalDecided` with `publishedAt`, `publishedBy` and `approvalId`, one `AgentRegistryService/AssetReleasePublished` outbox record and one `audit-evidence-v1` record of action `release-published` are written for each, and neither release carries an evaluation record (D135, D140, ADR-0021).",
        "AC2: Given the two Published releases of AC1, when A moves the alias stable of each through `AgentRegistryService/MoveAlias` and a requester submits a run of the workflow by that alias, then RunControlService resolves the alias through `AgentRegistryService/AssetPublication.ResolveRelease` to the Published workflow release with its closure and pins its release id, WorkflowEngineService and AgentRuntimeService load the workflow definition and the agent by release id through `AgentRegistryService/AssetPublication.LoadRelease`, and the request and reply messages are those the contract test of the thin delivery fixes, so no caller is rebuilt (FR-02, XL-15).",
        "AC3: Given an agent candidate submitted by A whose publication approval names A as `decidedBy`, or a ModelProfile candidate whose approval was given by a Reviewer and not by a Platform admin, when `RunControlService/ApprovalDecided` is handled or `AgentRegistryService/PublishRelease` is called, then the release is not published, it stays InReview and `connectsoft.factory.releases.blocked` is incremented with the reason; the seeded Draft releases of the thin delivery are still resolved by alias under the Draft allowance, since the complete delivery publishes them through the gate (D119, D140, ADR-0021).",
        "AC4: Given the service descriptor of the repository, when the contract test compares it with the hosted surface, then `AgentRegistryService/ValidateRelease`, `AgentRegistryService/SubmitRelease`, `AgentRegistryService/PublishRelease`, `AgentRegistryService/GetRelease`, `AgentRegistryService/ListReleases` and `AgentRegistryService/MoveAlias` are hosted with their scope, side-effect class, idempotency and response codes beside the two gRPC methods of the thin delivery, and the outbox holds only `AgentRegistryService/AssetReleaseSubmitted`, `AgentRegistryService/AssetReleasePublished` and the `audit-evidence-v1` record of a publication; given releases of two tenants and of the platform tenant, a release of the other tenant is answered 404, a missing scope 403, and a user token that ControlPlaneApi forwards unchanged is accepted without a token exchange (ADR-0014, ADR-0015).",
        "AC5: Given the service starts, when readiness is probed, then it is unready until `agent-registry-sql` is migrated, while the outbox check of the messaging profile is unhealthy and while the identity authority is unreachable, and `connectsoft.factory.releases.published` and `connectsoft.factory.releases.blocked` are emitted with the dimensions of model/services/control-plane/AgentRegistryService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries",
        "docs/planes/control/registries.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-366",
        "AIFACTORY-TASK-369",
        "AIFACTORY-TASK-6347",
        "AIFACTORY-TASK-6348"
      ],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9201,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService",
          "RunControlService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/ValidateRelease",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease",
          "AgentRegistryService/GetRelease",
          "AgentRegistryService/ListReleases",
          "AgentRegistryService/MoveAlias",
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "AgentRegistryService/AssetPublication.LoadRelease",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "AgentRegistryService/AssetReleaseSubmitted",
          "AgentRegistryService/AssetReleasePublished",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "release-manifest-v1",
          "approval-request-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ],
        "requirements": [
          "FR-02",
          "XL-15"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-414",
        "AIFACTORY-US-415",
        "AIFACTORY-US-416",
        "AIFACTORY-US-418",
        "AIFACTORY-US-419",
        "feature:agent-registry-service-thin",
        "feature:run-control-service",
        "feature:component-base-template-factory-profile",
        "feature:component-audit-factory-evidence",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries",
        "docs/planes/control/registries.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1561]",
      "number": 1561
    },
    {
      "id": "AIFACTORY-TASK-366",
      "type": "task",
      "parent": "AIFACTORY-US-1561",
      "title": "API hosting of the publication path: service descriptor, REST hosts, scope policies and problem responses of the six REST operations",
      "sequence": "01.07.01.01",
      "description": "API hosting of the publication path: service descriptor, REST hosts, scope policies and problem responses of the six REST operations. Expected output: The service descriptor file lists the six REST operations of the publication path, ValidateRelease, SubmitRelease, PublishRelease, GetRelease, ListReleases and MoveAlias, beside the two gRPC methods of the thin delivery, with scope, side-effect class, idempotency and response codes; the routes are hosted with the scope policy of each route, problem responses for every modelled refusal code and the Idempotency-Key filter of SubmitRelease; DeprecateRelease and RevokeRelease join the descriptor and the hosts with the complete delivery in I4 (D140); the behaviour of each operation is delivered by AIFACTORY-US-414 to AIFACTORY-US-419, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists the six REST operations of the publication path, ValidateRelease, SubmitRelease, PublishRelease, GetRelease, ListReleases and MoveAlias, beside the two gRPC methods of the thin delivery, with scope, side-effect class, idempotency and response codes; the routes are hosted with the scope policy of each route, problem responses for every modelled refusal code and the Idempotency-Key filter of SubmitRelease; DeprecateRelease and RevokeRelease join the descriptor and the hosts with the complete delivery in I4 (D140); the behaviour of each operation is delivered by AIFACTORY-US-414 to AIFACTORY-US-419, not here."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9201,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-366]",
      "number": 366
    },
    {
      "id": "AIFACTORY-TASK-369",
      "type": "task",
      "parent": "AIFACTORY-US-1561",
      "title": "Security, tenancy and telemetry of the publication path of AgentRegistryService",
      "sequence": "01.07.01.02",
      "description": "Security, tenancy and telemetry of the publication path of AgentRegistryService. Expected output: The scopes factory.assets.read, factory.assets.write and factory.assets.publish and the roles of the model are enforced per route of the publication path, a user token forwarded by ControlPlaneApi is accepted with the audience of that gateway and no token is exchanged (ADR-0015 amendment D117), every query is tenant-filtered with the platform tenant readable by every tenant, so a release of another tenant is answered 404 (ADR-0015), the manifest-signing-key and messaging-transport secrets come from secret references, readiness reports the store, the outbox and the identity authority, and the two release counters are created through the instrument helper of the observability library; the Platform admin role of DeprecateRelease and RevokeRelease is enforced with those routes in I4.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The scopes factory.assets.read, factory.assets.write and factory.assets.publish and the roles of the model are enforced per route of the publication path, a user token forwarded by ControlPlaneApi is accepted with the audience of that gateway and no token is exchanged (ADR-0015 amendment D117), every query is tenant-filtered with the platform tenant readable by every tenant, so a release of another tenant is answered 404 (ADR-0015), the manifest-signing-key and messaging-transport secrets come from secret references, readiness reports the store, the outbox and the identity authority, and the two release counters are created through the instrument helper of the observability library; the Platform admin role of DeprecateRelease and RevokeRelease is enforced with those routes in I4."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-369]",
      "number": 369
    },
    {
      "id": "AIFACTORY-TASK-6347",
      "type": "task",
      "parent": "AIFACTORY-US-1561",
      "title": "Contract of AssetReleaseSubmitted and AssetReleasePublished against the run event envelope of the contracts package",
      "sequence": "01.07.01.03",
      "description": "Contract of AssetReleaseSubmitted and AssetReleasePublished against the run event envelope of the contracts package. Expected output: Golden files fix AssetReleaseSubmitted and AssetReleasePublished on their topics under run-event-envelope-v1 with the payload fields of model/services/control-plane/AgentRegistryService.yaml and the tenant in the envelope; a contract test fails when a serialised event differs from its file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Golden files fix AssetReleaseSubmitted and AssetReleasePublished on their topics under run-event-envelope-v1 with the payload fields of model/services/control-plane/AgentRegistryService.yaml and the tenant in the envelope; a contract test fails when a serialised event differs from its file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9201,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6347]",
      "number": 6347
    },
    {
      "id": "AIFACTORY-TASK-6348",
      "type": "task",
      "parent": "AIFACTORY-US-1561",
      "title": "Verify the publication path of a workflow definition and its agent on the deployed estate",
      "sequence": "01.07.01.04",
      "description": "Verify the publication path of a workflow definition and its agent on the deployed estate. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=PublicationPath\"` in the pipeline of the repository against the deployed RunControlService, WorkflowEngineService and AgentRuntimeService; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1561: an agent and a workflow definition submitted by one maintainer and published on the approval of a Reviewer who is not that maintainer, with no evaluation record, the aliases moved and the workflow alias resolved to its Published release and loaded with its agent by release id without a rebuilt caller, the publication refused for an approval by the submitter and for a ModelProfile release approved by a Reviewer, the seeded Draft releases still served, the hosted surface against the service descriptor, the two-tenant matrix with the platform tenant and readiness with the two counters.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=PublicationPath\"` in the pipeline of the repository against the deployed RunControlService, WorkflowEngineService and AgentRuntimeService; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1561: an agent and a workflow definition submitted by one maintainer and published on the approval of a Reviewer who is not that maintainer, with no evaluation record, the aliases moved and the workflow alias resolved to its Published release and loaded with its agent by release id without a rebuilt caller, the publication refused for an approval by the submitter and for a ModelProfile release approved by a Reviewer, the seeded Draft releases still served, the hosted surface against the service descriptor, the two-tenant matrix with the platform tenant and readiness with the two counters."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6348]",
      "number": 6348
    },
    {
      "id": "AIFACTORY-US-414",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-189",
      "title": "Validate a release candidate and report missing, unreviewed or incompatible dependencies without publishing",
      "sequence": "01.07.02",
      "description": "As an asset maintainer, I want to learn what blocks my candidate before I submit it, so that I fix a missing or unpublished dependency without opening a review that cannot pass. An asset maintainer, a caller whose scope carries `factory.assets.write`, asks whether a candidate could be published before submitting it. `AgentRegistryService/ValidateRelease` takes a candidate body in the shape of `release-manifest-v1` that carries `assetKind`, `assetId`, `version` and `source` with repository, commit and path. The publication fields of the descriptor (`publishedAt`, `publishedBy`, `evaluation`, `approval`, `signature` and `revocation`) are absent on a candidate, and so are `state`, `closure` and `hash`, which the service computes. The descriptor requires fields a candidate cannot supply, the open point the thin delivery already reports to the owner, so the validation of a body checks the candidate fields and not the whole schema. The operation reads the asset sources at that commit through `ext-azure-devops`, resolves the dependency closure from Git and the registry and reports, without publishing anything, every dependency with its exact version and hash and every dependency that is missing, unreviewed, which means not Published, or incompatible with the declared runtime adapter. The closure follows the asset kind: an agent pulls its skills, their tools and MCP servers, a workflow pulls its agents, and each pulls the policy bundle and the model profile it names. The operation is of class sandbox: it creates no release, writes no row and no blob, publishes no event and requests no approval, so it can be repeated at will. Two calls with the same inputs return the same report and the same manifest hash, and one changed dependency changes the hash. The resolver that computes the closure and the hashes is the one the `ClosureResolver` worker runs after a submission, so a candidate that validates clean resolves the same way when it is submitted. The response is 200 whether or not findings exist, because the findings are the answer. A body that lacks a candidate field or carries a publication field is refused with 400 and a caller without the scope with 403. The source system is a required, fail-fast dependency: when the commit cannot be read, the call fails fast with a problem response that names the dependency and nothing is reported as resolved. Dependencies are looked up only among the releases the tenant of the caller can read, its own and those of the platform tenant; a dependency that exists only in another tenant is reported as missing and never confirmed. The owner moved this operation to the publication path of I2 (D140), so the workflow features of I2 and later validate their definitions and agents before they submit them. The command-line client and the Studio call the operation through the gateway. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/ValidateRelease; descriptors: release-manifest-v1; adrs: ADR-0015, ADR-0021; requirements: FR-02, FUX-02, NFR-02; scenarios: SCN-AgentRegistryService-001. Depends on: feature:agent-registry-service-thin, feature:component-base-template-factory-profile. Sources: model/services/control-plane/AgentRegistryService.yaml, docs/planes/control/registries.md, docs/reference/schemas/release-manifest.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a candidate whose dependencies are all Published and compatible, when `AgentRegistryService/ValidateRelease` is called by a caller with `factory.assets.write`, then the response is 200 with every dependency named with exact version and hash and no finding, and no release, row, event or approval request exists afterwards (SCN-AgentRegistryService-001, FR-02).",
        "AC2: Given a candidate with one dependency that does not exist, one that is not Published and one that is incompatible with the declared runtime adapter, when `AgentRegistryService/ValidateRelease` is called, then the response is 200 and the report names each of the three with its kind, asset id and finding; a dependency that exists only in another tenant is reported as missing (SCN-AgentRegistryService-001, ADR-0015).",
        "AC3: Given the same inputs validated twice and then once more with one dependency moved to another version, when the three reports are compared, then the first two carry the same manifest hash and the third a different one (SCN-AgentRegistryService-001, model/services/control-plane/AgentRegistryService.yaml).",
        "AC4: Given a body that lacks `assetKind`, `assetId`, `version` or `source` with repository, commit and path or that carries a publication field such as `publishedAt`, a caller without `factory.assets.write`, or a source commit that cannot be read because `ext-azure-devops` is unavailable, when `AgentRegistryService/ValidateRelease` is called, then the answer is 400, 403 or a fail-fast problem response that names the dependency respectively, and nothing is written (SCN-AgentRegistryService-001)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/registries.md",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-540",
        "AIFACTORY-TASK-1683",
        "AIFACTORY-TASK-1684"
      ],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9202,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/ValidateRelease"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "FUX-02",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-001"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:agent-registry-service-thin",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/registries.md",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-414]",
      "number": 414
    },
    {
      "id": "AIFACTORY-TASK-540",
      "type": "task",
      "parent": "AIFACTORY-US-414",
      "title": "Closure resolver with hashes",
      "sequence": "01.07.02.01",
      "description": "Closure resolver with hashes. Expected output: The resolver reads the asset sources at a commit through ext-azure-devops, walks the dependencies of a candidate by asset kind among the releases the tenant can read, records each with exact version and hash, computes the manifestHash so that the same inputs give the same hash and a changed dependency a different one, and reports a missing, unpublished or incompatible dependency by kind and asset id; ValidateRelease and the ClosureResolver worker share it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The resolver reads the asset sources at a commit through ext-azure-devops, walks the dependencies of a candidate by asset kind among the releases the tenant can read, records each with exact version and hash, computes the manifestHash so that the same inputs give the same hash and a changed dependency a different one, and reports a missing, unpublished or incompatible dependency by kind and asset id; ValidateRelease and the ClosureResolver worker share it."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-540]",
      "number": 540
    },
    {
      "id": "AIFACTORY-TASK-1683",
      "type": "task",
      "parent": "AIFACTORY-US-414",
      "title": "ValidateRelease as a sandbox operation over the resolver",
      "sequence": "01.07.02.02",
      "description": "ValidateRelease as a sandbox operation over the resolver. Expected output: ValidateRelease validates the candidate fields of the body (assetKind, assetId, version and source with repository, commit and path, and no publication field of release-manifest-v1), runs the resolver and returns 200 with the report of resolved dependencies and findings; it writes no row, no blob and no outbox record, answers 400 and 403 as modelled and fails fast with a problem response that names ext-azure-devops when the commit cannot be read.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "ValidateRelease validates the candidate fields of the body (assetKind, assetId, version and source with repository, commit and path, and no publication field of release-manifest-v1), runs the resolver and returns 200 with the report of resolved dependencies and findings; it writes no row, no blob and no outbox record, answers 400 and 403 as modelled and fails fast with a problem response that names ext-azure-devops when the commit cannot be read."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1683]",
      "number": 1683
    },
    {
      "id": "AIFACTORY-TASK-1684",
      "type": "task",
      "parent": "AIFACTORY-US-414",
      "title": "Verify validate-a-release-candidate through the acceptance suite",
      "sequence": "01.07.02.03",
      "description": "Verify validate-a-release-candidate through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-414 with a fake of the source system, a clean candidate, the three kinds of finding, the repeated hash and the stopped source system.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-414 with a fake of the source system, a clean candidate, the three kinds of finding, the repeated hash and the stopped source system."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1684]",
      "number": 1684
    },
    {
      "id": "AIFACTORY-US-415",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-189",
      "title": "Submit a release candidate from a source commit into review and resolve its closure",
      "sequence": "01.07.03",
      "description": "As an asset maintainer, I want to submit a candidate from a commit and have its closure resolved before its publication approval is requested, so that the review of my release runs on exactly the content and dependencies of that commit. An asset maintainer with `factory.assets.write` submits a candidate through `AgentRegistryService/SubmitRelease` with an `Idempotency-Key`. The body is a candidate in the shape of `release-manifest-v1`: it carries `assetKind`, `assetId`, `version`, `source` with repository, commit and path and the `hash` that `ValidateRelease` reported for these inputs. The publication fields of the descriptor (`publishedAt`, `publishedBy`, `evaluation`, `approval`, `signature` and `revocation`) are absent on a candidate, and a body that lacks a candidate field or carries a publication field is refused with 400. The model does not say which step computes the hash that the row and the event carry at the 202, although `ManifestHash` and `ManifestRef` are not nullable and the closure is resolved afterwards. That is an open point reported to the owner, and this PBI fixes the following so that it is checkable. The command stores the submitted candidate manifest through ArtifactService, a fail-fast call, keeps its reference in `ManifestRef` and the submitted hash in `manifestHash`, records the subject of the caller in `submittedBy`, the author from whom no approval of the release may come (D117), creates the `AssetRelease` as an InReview candidate (transition `SubmitForReview`) with its release id in the form kind, asset, version and hash, and writes the `AssetReleaseSubmitted` outbox record in the same transaction; the response is 202 with the release location, because the closure and the publication approval follow. A version that exists in the tenant as a Draft release, whether a candidate returned by `RejectedOrChanged` or by `ApprovalExpiredStaleOrCancelled` or a seeded Draft release of the thin delivery, is no conflict: the existing release moves to InReview through `SubmitForReview` with the submitted source commit and hash and with the subject of this submission in `submittedBy`, one `AssetReleaseSubmitted` record is written and no second row exists under the unique index on tenant, asset kind, asset and version. When the submitted hash equals the hash of the existing row the release id is kept; when it differs, the model says that a changed dependency changes the release id, and how the row, its closure rows and the aliases that point at it move to the new id is an open point reported to the owner, which also covers a resubmission that corrects the hash of an InReview candidate. The event triggers the `ClosureResolver` worker of the service: it resolves the dependency closure from Git and the registry and computes the hash with the resolver of AIFACTORY-TASK-540. When the computed hash equals `manifestHash`, it writes one `ReleaseClosure` row per dependency, stores the resolved manifest through ArtifactService and points `ManifestRef` at it, and the publication approval is then requested as AIFACTORY-US-416 states. When it differs, the computed hash is the authoritative one and the submitted hash is not accepted: the candidate stays InReview with a blocking finding that names both hashes, `connectsoft.factory.releases.blocked` is incremented with the reason, no closure row is written and no approval is requested for the candidate until the maintainer resubmits with the hash the resolver reports. The worker runs at most four candidates in parallel, partitioned by tenant, is idempotent on release id and source commit, and retries with exponential backoff up to five attempts. The owner moved the publication path to I2 (D140): before I4 no evaluation suite exists, no evaluation runs on a submission and none is awaited; from I4 QualityScoreService also consumes the event and evaluates the candidate where an evaluation suite exists for its asset kind (D117), and the complete delivery attaches its verdict. When the source commit stays unreachable after the retries, the candidate stays InReview with a blocking finding that names the commit, the same counter is incremented, and the maintainer resubmits, which announces the candidate again and lets the resolver run on it. A repeated submission with the same key and the same body returns the same release and changes nothing; the same key with a different body is refused with 409, and so is a submission for a version that already exists in the tenant as a Published or Deprecated release, because a Published release is immutable and a change is a new version. A caller without the scope is refused with 403, and when ArtifactService is unavailable the call fails fast and nothing is written. `AssetReleaseSubmitted` carries `releaseId`, `tenantId`, `assetKind`, `assetId`, `version` and `manifestHash` under the run event envelope of the contracts package; the dispatcher of the `agent-registry` messaging profile publishes it on `asset-publication.releases.v1.asset-release-submitted` and retries a transport outage with backoff. This PBI also holds the aggregate, the write mappings of the three tables and the messaging profile of the service, on which every write operation of the feature relies. The release commands of the command-line client are delivered and proven with AIFACTORY-US-419. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/SubmitRelease; events: AgentRegistryService/AssetReleaseSubmitted; descriptors: release-manifest-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0021; requirements: FR-02, XL-02; scenarios: SCN-AgentRegistryService-002, SCN-AgentRegistryService-010. Depends on: AIFACTORY-US-414, feature:artifact-service, feature:contracts-package, feature:component-base-template-factory-profile. Sources: model/services/control-plane/AgentRegistryService.yaml, docs/planes/control/services/agent-registry-service/index.md#sagas-and-long-running-flows, docs/reference/schemas/release-manifest.schema.json, docs/reference/schemas/run-event-envelope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.assets.write` and a candidate body with `assetKind`, `assetId`, `version`, `source` and `hash`, when `AgentRegistryService/SubmitRelease` is called with an `Idempotency-Key`, then the response is 202 with the release location, the submitted candidate manifest is stored through ArtifactService with its reference in `ManifestRef`, the `AgentRegistryService/AssetRelease` is InReview with `releaseId`, `sourceCommit`, the submitted hash as `manifestHash` and the subject of the caller as `submittedBy`, and the `AgentRegistryService/AssetReleaseSubmitted` outbox record is written in the same transaction; when ArtifactService is unavailable the call fails fast and nothing is written (SCN-AgentRegistryService-002, ADR-0014).",
        "AC2: Given the same submission repeated with the same key and body, when it arrives, then the same release is returned and no second release or outbox record exists; given a release of that tenant, asset and version in state Draft, when `AgentRegistryService/SubmitRelease` is called, then that release moves to InReview through `SubmitForReview` with the submitted source commit and hash and the subject of this submission as `submittedBy`, one `AgentRegistryService/AssetReleaseSubmitted` record is written and no second row exists; given the same key with a different body, a version of the asset that is already Published or Deprecated, a body that lacks a candidate field or carries a publication field, or a caller without the scope, when it is called, then the answer is 409, 409, 400 or 403 respectively and nothing is written or published (SCN-AgentRegistryService-002, ADR-0015).",
        "AC3: Given an InReview candidate announced by `AgentRegistryService/AssetReleaseSubmitted`, when the `ClosureResolver` worker runs and the hash it computes equals the `manifestHash` of the candidate, then `ReleaseClosure` holds every dependency with exact version and hash, the resolved manifest is stored through ArtifactService with `ManifestRef` pointing at it, and a duplicate trigger for the same release id and source commit has no second effect; when the computed hash differs, then the candidate stays InReview with a blocking finding that names both hashes, `connectsoft.factory.releases.blocked` is incremented with its reason, no closure row is written and no approval is requested for it (SCN-AgentRegistryService-010, model/services/control-plane/AgentRegistryService.yaml).",
        "AC4: Given the source commit stays unreachable, when the worker has retried five times with exponential backoff, then the candidate stays InReview with a blocking finding that names the commit, `connectsoft.factory.releases.blocked` is incremented with its reason, and a resubmission by the maintainer lets the resolver run again (SCN-AgentRegistryService-002, model/services/control-plane/AgentRegistryService.yaml).",
        "AC5: Given a committed submission, when the dispatcher of the `agent-registry` messaging profile publishes `AgentRegistryService/AssetReleaseSubmitted` on `asset-publication.releases.v1.asset-release-submitted`, then the event is sent under the run event envelope with `releaseId`, `tenantId`, `assetKind`, `assetId`, `version` and `manifestHash`, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-AgentRegistryService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#sagas-and-long-running-flows",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-364",
        "AIFACTORY-TASK-365",
        "AIFACTORY-TASK-6346",
        "AIFACTORY-TASK-1685",
        "AIFACTORY-TASK-368",
        "AIFACTORY-TASK-1686"
      ],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9203,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/SubmitRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleaseSubmitted"
        ],
        "descriptors": [
          "release-manifest-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "XL-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-002",
          "SCN-AgentRegistryService-010"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-414",
        "feature:artifact-service",
        "feature:contracts-package",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#sagas-and-long-running-flows",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-415]",
      "number": 415
    },
    {
      "id": "AIFACTORY-TASK-364",
      "type": "task",
      "parent": "AIFACTORY-US-415",
      "title": "Domain model: AssetRelease with the transitions and invariants of the publication path",
      "sequence": "01.07.03.01",
      "description": "Domain model: AssetRelease with the transitions and invariants of the publication path. Expected output: The AssetRelease aggregate holds the fields, the ClosureEntry and Alias entities and the Signature value object of the model, among them submittedBy, withdrawalReason, inFlightPolicy and finding (D117), the transitions SubmitForReview (from a new candidate and from an existing Draft release), GatesPassedAndApproved, RejectedOrChanged and ApprovalExpiredStaleOrCancelled, and the invariants of the publication path: blocked publication on an incomplete closure, a stable manifestHash, immutability of a Published release, Published for every asset kind only with an approval by someone other than submittedBy under the role the asset kind requires, and the return from InReview to Draft with a finding when the publication approval ends Expired, Stale or Cancelled; no evaluation verdict is required before I4 (D140), and the transitions Deprecate and Revoke with their reason and in-flight policy and the evidence invariant of ADR-0021 are added by the complete delivery in I4 (AIFACTORY-TASK-541, AIFACTORY-TASK-6342); unit tests cover every transition, every rejected pair of states and every invariant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The AssetRelease aggregate holds the fields, the ClosureEntry and Alias entities and the Signature value object of the model, among them submittedBy, withdrawalReason, inFlightPolicy and finding (D117), the transitions SubmitForReview (from a new candidate and from an existing Draft release), GatesPassedAndApproved, RejectedOrChanged and ApprovalExpiredStaleOrCancelled, and the invariants of the publication path: blocked publication on an incomplete closure, a stable manifestHash, immutability of a Published release, Published for every asset kind only with an approval by someone other than submittedBy under the role the asset kind requires, and the return from InReview to Draft with a finding when the publication approval ends Expired, Stale or Cancelled; no evaluation verdict is required before I4 (D140), and the transitions Deprecate and Revoke with their reason and in-flight policy and the evidence invariant of ADR-0021 are added by the complete delivery in I4 (AIFACTORY-TASK-541, AIFACTORY-TASK-6342); unit tests cover every transition, every rejected pair of states and every invariant."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-364]",
      "number": 364
    },
    {
      "id": "AIFACTORY-TASK-365",
      "type": "task",
      "parent": "AIFACTORY-US-415",
      "title": "Persistence in agent-registry-sql: write mappings of AssetReleases, ReleaseClosure and ReleaseAliases",
      "sequence": "01.07.03.02",
      "description": "Persistence in agent-registry-sql: write mappings of AssetReleases, ReleaseClosure and ReleaseAliases. Expected output: No schema is added: on the three tables the thin delivery created (AIFACTORY-TASK-1651) the mappings are completed for writes, that is the evaluation record reference, the approval and publication fields, the columns SubmittedBy, WithdrawalReason, InFlightPolicy and Finding of the model (D117), the alias rows with movedAt and movedBy and the row version as optimistic concurrency token, all under the tenant row filter with the platform tenant readable by every tenant; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "No schema is added: on the three tables the thin delivery created (AIFACTORY-TASK-1651) the mappings are completed for writes, that is the evaluation record reference, the approval and publication fields, the columns SubmittedBy, WithdrawalReason, InFlightPolicy and Finding of the model (D117), the alias rows with movedAt and movedBy and the row version as optimistic concurrency token, all under the tenant row filter with the platform tenant readable by every tenant; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-365]",
      "number": 365
    },
    {
      "id": "AIFACTORY-TASK-6346",
      "type": "task",
      "parent": "AIFACTORY-US-415",
      "title": "Messaging wiring of the agent-registry profile for the publication path: outbox for two published events and the inbox subscription of ApprovalDecided",
      "sequence": "01.07.03.03",
      "description": "Messaging wiring of the agent-registry profile for the publication path: outbox for two published events and the inbox subscription of ApprovalDecided. Expected output: The OrleansMessaging section declares the service name agent-registry, the published events AssetReleaseSubmitted and AssetReleasePublished with their topics and the subscription of ApprovalDecided of RunControlService with its handler PublishOnApproval (D140); the outbox writer enlists in the unit of work of each command, the inbox deduplicates on the event id and the handler reads the tenant from the run event envelope and refuses a message without one; the other published events and subscriptions of the model join the same section with the complete delivery in I4 (AIFACTORY-TASK-367).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The OrleansMessaging section declares the service name agent-registry, the published events AssetReleaseSubmitted and AssetReleasePublished with their topics and the subscription of ApprovalDecided of RunControlService with its handler PublishOnApproval (D140); the outbox writer enlists in the unit of work of each command, the inbox deduplicates on the event id and the handler reads the tenant from the run event envelope and refuses a message without one; the other published events and subscriptions of the model join the same section with the complete delivery in I4 (AIFACTORY-TASK-367)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6346]",
      "number": 6346
    },
    {
      "id": "AIFACTORY-TASK-1685",
      "type": "task",
      "parent": "AIFACTORY-US-415",
      "title": "SubmitRelease with the idempotency key and the AssetReleaseSubmitted outbox record",
      "sequence": "01.07.03.04",
      "description": "SubmitRelease with the idempotency key and the AssetReleaseSubmitted outbox record. Expected output: The operation validates the candidate fields of the body (assetKind, assetId, version, source with repository, commit and path, hash, and no publication field), stores the submitted candidate manifest through ArtifactService (fail-fast) and keeps its reference in ManifestRef and the submitted hash in manifestHash, records the subject of the caller in submittedBy (D117), creates the InReview candidate with releaseId and source repository and commit and writes AssetReleaseSubmitted in one transaction, returns 202 with the location and returns the same release for the same key and body. A version that exists as a Draft release in the tenant moves to InReview through SubmitForReview with the submitted source commit and hash and the subject of this submission in submittedBy, with one AssetReleaseSubmitted record and no second row; the release id is kept when the hash is unchanged, and the case of a changed hash is the open point the PBI reports. The operation answers 409 for a reused key with a different body and for a version that is already Published or Deprecated, 400 and 403 as modelled; a resubmission of an InReview candidate with a blocking finding announces it again.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The operation validates the candidate fields of the body (assetKind, assetId, version, source with repository, commit and path, hash, and no publication field), stores the submitted candidate manifest through ArtifactService (fail-fast) and keeps its reference in ManifestRef and the submitted hash in manifestHash, records the subject of the caller in submittedBy (D117), creates the InReview candidate with releaseId and source repository and commit and writes AssetReleaseSubmitted in one transaction, returns 202 with the location and returns the same release for the same key and body. A version that exists as a Draft release in the tenant moves to InReview through SubmitForReview with the submitted source commit and hash and the subject of this submission in submittedBy, with one AssetReleaseSubmitted record and no second row; the release id is kept when the hash is unchanged, and the case of a changed hash is the open point the PBI reports. The operation answers 409 for a reused key with a different body and for a version that is already Published or Deprecated, 400 and 403 as modelled; a resubmission of an InReview candidate with a blocking finding announces it again."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1685]",
      "number": 1685
    },
    {
      "id": "AIFACTORY-TASK-368",
      "type": "task",
      "parent": "AIFACTORY-US-415",
      "title": "Worker: ClosureResolver triggered by AssetReleaseSubmitted",
      "sequence": "01.07.03.05",
      "description": "Worker: ClosureResolver triggered by AssetReleaseSubmitted. Expected output: The worker runs on AssetReleaseSubmitted for InReview candidates without a resolved closure, at most four in parallel and partitioned by tenant, with exponential retry of five attempts and a backoff of 30 seconds and the idempotency key releaseId and sourceCommit; it computes the hash with the shared resolver and, when it equals the manifestHash the command wrote, writes the ReleaseClosure rows, stores the resolved manifest through ArtifactService and points ManifestRef at it, after which the publication approval is requested (AIFACTORY-TASK-1687); when the computed hash differs it writes no closure row, leaves the candidate InReview with a blocking finding that names both hashes and increments connectsoft.factory.releases.blocked, so that no approval is requested for the candidate; after exhausted retries on an unreachable commit it leaves the candidate InReview with a blocking finding and increments the same counter; a duplicate trigger has no second effect.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The worker runs on AssetReleaseSubmitted for InReview candidates without a resolved closure, at most four in parallel and partitioned by tenant, with exponential retry of five attempts and a backoff of 30 seconds and the idempotency key releaseId and sourceCommit; it computes the hash with the shared resolver and, when it equals the manifestHash the command wrote, writes the ReleaseClosure rows, stores the resolved manifest through ArtifactService and points ManifestRef at it, after which the publication approval is requested (AIFACTORY-TASK-1687); when the computed hash differs it writes no closure row, leaves the candidate InReview with a blocking finding that names both hashes and increments connectsoft.factory.releases.blocked, so that no approval is requested for the candidate; after exhausted retries on an unreachable commit it leaves the candidate InReview with a blocking finding and increments the same counter; a duplicate trigger has no second effect."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-368]",
      "number": 368
    },
    {
      "id": "AIFACTORY-TASK-1686",
      "type": "task",
      "parent": "AIFACTORY-US-415",
      "title": "Verify submit-a-release-candidate through the acceptance suite",
      "sequence": "01.07.03.06",
      "description": "Verify submit-a-release-candidate through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-002|Scenario=SCN-AgentRegistryService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-415, including the candidate manifest stored at submission, the submission of a version that exists as a Draft release, the worker with a duplicate trigger, with a computed hash that differs from the submitted one and with an unreachable commit, and the publication and payload of AssetReleaseSubmitted; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-002|Scenario=SCN-AgentRegistryService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-415, including the candidate manifest stored at submission, the submission of a version that exists as a Draft release, the worker with a duplicate trigger, with a computed hash that differs from the submitted one and with an unreachable commit, and the publication and payload of AssetReleaseSubmitted; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1686]",
      "number": 1686
    },
    {
      "id": "AIFACTORY-US-416",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-189",
      "title": "Publish a release only with a complete closure and the approval its asset kind requires, requested through Run Control for the asset release",
      "sequence": "01.07.04",
      "description": "As a reviewer, I want a release to become Published only on the exact manifest I approved, so that Published means reviewed and nobody publishes their own work. A release reaches Published only with a second pair of eyes (ADR-0021, D117). The approval rule holds for every asset kind: the publication approval is granted by someone other than the subject that submitted the candidate, which the release keeps in `submittedBy`. Who approves depends on the asset kind (D119): a ModelProfile release is approved by a Platform admin who is not its author, the role ADR-0021 decision 1 names, and a release of every other asset kind by a Reviewer who is not its author; an approval from anyone else does not count. `ApprovalDecided` names the decider and not the role, so the role is bound by the approver rule of the approval request, which names the role the asset kind requires and which RunControlService enforces when the decision is taken. The owner moved this path to I2 (D140), and no evaluation verdict is required for a publication before I4, because no evaluation suite is delivered before the complete QualityScoreService of I4. The service therefore requests the publication approval as soon as the `ClosureResolver` worker has resolved the closure of a candidate without a blocking finding, for every asset kind. The evaluation evidence of ADR-0021, the handler `RecordEvaluationEvidence` and the option `Publication:Gates:RequireEvaluation`, under which a candidate of a kind with a suite waits for its verdict, take effect with the complete delivery in I4 (feature `agent-registry-service-complete`). The owner decided that an approval request names its subject as a kind and an id from a closed list, that `runId` is optional and that the service that owns the subject receives the decision (D135): AgentRegistryService, the publisher of the release, requests the publication approval through `RunControl.RequestApproval` of RunControlService with its own service identity, whose workload token holds `factory.approvals.request`, and the request is bound to no run, no step and no lease (AIFACTORY-US-1492 of feature `run-control-service`, D140). The registry supplies the subject kind asset-release with the release id as subject id, `actionClass` publication, the proposal kind release, the proposal hash equal to the `manifestHash` of the candidate, the tenant, the `submittedBy` of the release as the requester and the approver rule that names the role the asset kind requires; a release carries no project, so the request names none. RunControlService announces the decision as `ApprovalDecided` with its state, `decidedBy` and the subject kind asset-release and the release id, without `runId`, and the inbox handler `PublishOnApproval` acts on it once per event id. A caller whose scope carries `factory.assets.publish` reaches the same transition through `AgentRegistryService/PublishRelease`, which is an approval-gated action. Both paths apply one rule, the transition `GatesPassedAndApproved`: every closure entry is present, Published and compatible with the declared runtime adapter, and the publication approval is granted for exactly this `manifestHash` by a `decidedBy` that differs from the `submittedBy` of the release, whatever its asset kind, under the role the asset kind requires, Platform admin for a ModelProfile release and Reviewer for every other kind (D119). When the rule holds, the release moves from InReview to Published with `publishedAt`, `publishedBy` and `approvalId`, the signature over the manifest hash is recorded when `Publication:Signing:KeyId` names a key, and two outbox records are written in the transaction of the command: `AssetReleasePublished` and an `audit-evidence-v1` record of action `release-published` that names the actor, the release as subject with its `manifestHash` and the outcome, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope (D115); a command that rolls back leaves no evidence. `connectsoft.factory.releases.published` is incremented and the release is immutable from then on. When the rule does not hold, `PublishRelease` answers 412 with a problem body that names the failing gate, `PublishOnApproval` does not publish, `connectsoft.factory.releases.blocked` is incremented with the reason and the release stays InReview. Of the six outcomes `ApprovalDecided` announces, only an approval publishes. A rejection and a request for changes return the candidate to Draft through `RejectedOrChanged`. An expired, stale or cancelled request returns the candidate to Draft through `ApprovalExpiredStaleOrCancelled` with a `finding` that names the outcome (D117); the maintainer submits it again from Draft, as AIFACTORY-US-415 states for a version that exists as a Draft release, and a new approval is requested once its closure is resolved. A release of another tenant or an unknown one is answered 404, a caller without the scope 403, a release that is Draft, Deprecated or Revoked 409, since a revoked release is never published again (D119), and a repeated call for a release that is already Published returns 200 and changes nothing. RunControlService is a fail-fast dependency: when it is unavailable the approval request fails, it is retried with backoff and the release stays InReview meanwhile. Kind: behavior. Traces: services: AgentRegistryService, RunControlService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/PublishRelease, RunControlService/RunControl.RequestApproval; events: AgentRegistryService/AssetReleasePublished, RunControlService/ApprovalDecided; descriptors: release-manifest-v1, approval-request-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0021; requirements: FR-02, FUX-10, NFR-11, XL-02, XL-08; scenarios: SCN-AgentRegistryService-003, SCN-AgentRegistryService-011. Depends on: AIFACTORY-US-415, feature:run-control-service, feature:component-audit-factory-evidence, feature:contracts-package. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/control-plane/RunControlService.yaml, docs/architecture/quality-gates.md, docs/planes/control/services/agent-registry-service/index.md#sagas-and-long-running-flows, docs/reference/schemas/audit-evidence.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given an InReview release of any asset kind whose closure the `ClosureResolver` worker resolved without a blocking finding, when the worker completes, then the publication approval is requested once through `RunControlService/RunControl.RequestApproval` with `actionClass` publication, the proposal kind release, the proposal hash equal to the `manifestHash`, the subject kind asset-release with the release id, `submittedBy` as the requester and the approver rule of the role the asset kind requires, under the service identity of AgentRegistryService and without a run, step or lease, and without waiting for an evaluation verdict (D135, D140); a candidate with a blocking finding requests none; an unavailable RunControlService is retried with backoff and the release stays InReview (SCN-AgentRegistryService-003, ADR-0021).",
        "AC2: Given an InReview release with a complete and compatible closure and a publication approval granted for its `manifestHash` by someone other than its `submittedBy` (D117), in two cases, an agent release approved by a Reviewer and a ModelProfile release approved by a Platform admin (D119), neither of which carries an evaluation record (D140), when `AgentRegistryService/PublishRelease` is called by a caller with `factory.assets.publish` or `RunControlService/ApprovalDecided` grants the approval, then the `AgentRegistryService/AssetRelease` is Published with `publishedAt`, `publishedBy` and `approvalId`, the `AgentRegistryService/AssetReleasePublished` outbox record is written, and an `audit-evidence-v1` record of action `release-published` that names the actor, the release as subject with its `manifestHash` and the outcome is written to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope; a command that rolls back leaves no evidence (D115); `connectsoft.factory.releases.published` is incremented (SCN-AgentRegistryService-003, ADR-0014, ADR-0021).",
        "AC3: Given a release with a missing, unpublished or incompatible closure entry, without a granted approval for its `manifestHash`, or, for any asset kind, with a granting decision whose `decidedBy` equals the `submittedBy` of the release or whose approval was not given under the role its asset kind requires, Platform admin for a ModelProfile release and Reviewer for every other kind (D119), when `AgentRegistryService/PublishRelease` is called, then the answer is 412 with a problem body that names the failing gate, and when `RunControlService/ApprovalDecided` grants an approval for it, then `PublishOnApproval` does not publish; in each case the release stays InReview, nothing is published and `connectsoft.factory.releases.blocked` is incremented with the reason (SCN-AgentRegistryService-003, NFR-11).",
        "AC4: Given a caller without `factory.assets.publish`, a release of another tenant or an unknown one, or a release that is Draft, Deprecated or Revoked, when `AgentRegistryService/PublishRelease` is called, then the answer is 403, 404 or 409 respectively and nothing changes; given a release already Published, when the call is repeated, then it returns 200 and writes no second event; given a `RunControlService/ApprovalDecided` whose state is Rejected or ChangesRequested, when it is handled, then the candidate returns to Draft through `RejectedOrChanged`; given one whose state is Expired, Stale or Cancelled, when it is handled, then the candidate returns to Draft through `ApprovalExpiredStaleOrCancelled` with a `finding` that names the state (D117); none of these five states publishes the release and each delivery is acknowledged once per event id (SCN-AgentRegistryService-003, ADR-0015).",
        "AC5: Given a committed publication, when the dispatcher of the `agent-registry` messaging profile publishes `AgentRegistryService/AssetReleasePublished` on `asset-publication.releases.v1.asset-release-published`, then the event is sent under the run event envelope with `releaseId`, `tenantId`, `assetKind`, `assetId`, `version` and `manifestHash`, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-AgentRegistryService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/quality-gates.md",
        "docs/planes/control/services/agent-registry-service/index.md#sagas-and-long-running-flows",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1687",
        "AIFACTORY-TASK-1688",
        "AIFACTORY-TASK-1689"
      ],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9204,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService",
          "RunControlService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/PublishRelease",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "release-manifest-v1",
          "approval-request-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "FUX-10",
          "NFR-11",
          "XL-02",
          "XL-08"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-003",
          "SCN-AgentRegistryService-011"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-415",
        "feature:run-control-service",
        "feature:component-audit-factory-evidence",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/quality-gates.md",
        "docs/planes/control/services/agent-registry-service/index.md#sagas-and-long-running-flows",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-416]",
      "number": 416
    },
    {
      "id": "AIFACTORY-TASK-1687",
      "type": "task",
      "parent": "AIFACTORY-US-416",
      "title": "Inbox handler PublishOnApproval and the publication approval request after the closure is resolved",
      "sequence": "01.07.04.01",
      "description": "Inbox handler PublishOnApproval and the publication approval request after the closure is resolved. Expected output: When the ClosureResolver worker has resolved the closure of a candidate without a blocking finding, the service requests the publication approval from RunControlService through RunControl.RequestApproval with actionClass publication, proposal kind release, proposal hash equal to the manifestHash, the subject kind asset-release with the release id, submittedBy as the requester and the approver rule of the role the asset kind requires, under the service identity of the registry with the scope factory.approvals.request and without a run, step or lease (D135, D140; fail-fast, retried with backoff while the release stays InReview), for every asset kind and without waiting for an evaluation verdict, since no evaluation suite exists before I4 (D140); the request waits on a passed or waived verdict for the kinds with a suite only from the complete delivery (AIFACTORY-TASK-6341). PublishOnApproval handles every state of ApprovalDecided once per event id: Approved applies GatesPassedAndApproved after checking, for every asset kind, that decidedBy differs from submittedBy and that the approval was given under the role the kind requires, Platform admin for a ModelProfile release and Reviewer for every other kind (D119), and it does not publish and increments connectsoft.factory.releases.blocked when a check fails; Rejected and ChangesRequested apply RejectedOrChanged; Expired, Stale and Cancelled apply ApprovalExpiredStaleOrCancelled, which returns the candidate to Draft with a finding that names the state (D117); the handler reads the tenant from the envelope.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "When the ClosureResolver worker has resolved the closure of a candidate without a blocking finding, the service requests the publication approval from RunControlService through RunControl.RequestApproval with actionClass publication, proposal kind release, proposal hash equal to the manifestHash, the subject kind asset-release with the release id, submittedBy as the requester and the approver rule of the role the asset kind requires, under the service identity of the registry with the scope factory.approvals.request and without a run, step or lease (D135, D140; fail-fast, retried with backoff while the release stays InReview), for every asset kind and without waiting for an evaluation verdict, since no evaluation suite exists before I4 (D140); the request waits on a passed or waived verdict for the kinds with a suite only from the complete delivery (AIFACTORY-TASK-6341). PublishOnApproval handles every state of ApprovalDecided once per event id: Approved applies GatesPassedAndApproved after checking, for every asset kind, that decidedBy differs from submittedBy and that the approval was given under the role the kind requires, Platform admin for a ModelProfile release and Reviewer for every other kind (D119), and it does not publish and increments connectsoft.factory.releases.blocked when a check fails; Rejected and ChangesRequested apply RejectedOrChanged; Expired, Stale and Cancelled apply ApprovalExpiredStaleOrCancelled, which returns the candidate to Draft with a finding that names the state (D117); the handler reads the tenant from the envelope."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1687]",
      "number": 1687
    },
    {
      "id": "AIFACTORY-TASK-1688",
      "type": "task",
      "parent": "AIFACTORY-US-416",
      "title": "PublishRelease with the gate rule, the signature, the audit evidence and the two counters",
      "sequence": "01.07.04.02",
      "description": "PublishRelease with the gate rule, the signature, the audit evidence and the two counters. Expected output: PublishRelease applies the same GatesPassedAndApproved rule: the complete and compatible closure and, for every asset kind, the check that decidedBy differs from submittedBy (D117) and that the approval was given under the role the kind requires, Platform admin for a ModelProfile release and Reviewer for every other kind (D119); the evidence check of ADR-0021 is added by the complete delivery in I4 (AIFACTORY-TASK-6342, D140); it answers 409 for a release that is Draft, Deprecated or Revoked, a revoked release never being published again (D119); in the transaction of the publication it writes AssetReleasePublished and, through the Factory sink of the audit library pinned from feature component-audit-factory-evidence, an audit-evidence-v1 record of action release-published with the actor, the release as subject with its manifestHash and the outcome, on the topic audit.evidence.v1.evidence-submitted under the run event envelope, so that a rollback leaves no evidence (D115); it records the signature over the manifest hash when Publication:Signing:KeyId names a key, increments connectsoft.factory.releases.published, answers 412 with the failing gate named and increments connectsoft.factory.releases.blocked, and answers 403, 404 (also for a release of another tenant, ADR-0015) and 409 as modelled; a repeat on a Published release returns 200 without a second event.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "PublishRelease applies the same GatesPassedAndApproved rule: the complete and compatible closure and, for every asset kind, the check that decidedBy differs from submittedBy (D117) and that the approval was given under the role the kind requires, Platform admin for a ModelProfile release and Reviewer for every other kind (D119); the evidence check of ADR-0021 is added by the complete delivery in I4 (AIFACTORY-TASK-6342, D140); it answers 409 for a release that is Draft, Deprecated or Revoked, a revoked release never being published again (D119); in the transaction of the publication it writes AssetReleasePublished and, through the Factory sink of the audit library pinned from feature component-audit-factory-evidence, an audit-evidence-v1 record of action release-published with the actor, the release as subject with its manifestHash and the outcome, on the topic audit.evidence.v1.evidence-submitted under the run event envelope, so that a rollback leaves no evidence (D115); it records the signature over the manifest hash when Publication:Signing:KeyId names a key, increments connectsoft.factory.releases.published, answers 412 with the failing gate named and increments connectsoft.factory.releases.blocked, and answers 403, 404 (also for a release of another tenant, ADR-0015) and 409 as modelled; a repeat on a Published release returns 200 without a second event."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1688]",
      "number": 1688
    },
    {
      "id": "AIFACTORY-TASK-1689",
      "type": "task",
      "parent": "AIFACTORY-US-416",
      "title": "Verify publish-a-release-under-gates-and-approval through the acceptance suite",
      "sequence": "01.07.04.03",
      "description": "Verify publish-a-release-under-gates-and-approval through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-003|Scenario=SCN-AgentRegistryService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-416 against a fake of RunControl.RequestApproval and fixtures of ApprovalDecided: the approval request with the subject kind asset-release made once the closure is resolved and none for a candidate with a blocking finding, both paths to Published for an agent release and for a ModelProfile release without an evaluation record, the evidence record on the topic audit.evidence.v1.evidence-submitted and none after a rollback, each failing gate with its 412, the subject in submittedBy as approver refused on both paths, a ModelProfile release approved by a Reviewer and an agent release approved outside the Reviewer role not published, the 409 of a Draft release, the six states of ApprovalDecided with the return to Draft and its finding for Expired, Stale and Cancelled, the refusals and the publication and payload of AssetReleasePublished; releases in the states Deprecated and Revoked, which the complete delivery of I4 produces, are written by a fixture of the store; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-003|Scenario=SCN-AgentRegistryService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-416 against a fake of RunControl.RequestApproval and fixtures of ApprovalDecided: the approval request with the subject kind asset-release made once the closure is resolved and none for a candidate with a blocking finding, both paths to Published for an agent release and for a ModelProfile release without an evaluation record, the evidence record on the topic audit.evidence.v1.evidence-submitted and none after a rollback, each failing gate with its 412, the subject in submittedBy as approver refused on both paths, a ModelProfile release approved by a Reviewer and an agent release approved outside the Reviewer role not published, the 409 of a Draft release, the six states of ApprovalDecided with the return to Draft and its finding for Expired, Stale and Cancelled, the refusals and the publication and payload of AssetReleasePublished; releases in the states Deprecated and Revoked, which the complete delivery of I4 produces, are written by a fixture of the store; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1689]",
      "number": 1689
    },
    {
      "id": "AIFACTORY-US-418",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-189",
      "title": "Read one release with its manifest, closure, evidence and aliases, and list the releases of the tenant",
      "sequence": "01.07.05",
      "description": "As an observer, I want to read a release with its closure, its approval, its evidence where it has some and its aliases, and to list releases by kind, asset and state, so that I can see why a release is allowed to run and which one an alias selects. A caller whose scope carries `factory.assets.read`, an observer, a reviewer before a decision or the Studio asset views, reads releases through two operations, which the owner moved to the publication path of I2 (D140). `AgentRegistryService/GetRelease` returns one release addressed by `releaseId`: its manifest as `release-manifest-v1`, the closure entries with exact version and hash, the evaluation record reference with its verdict where the release carries one, the approval and the aliases that point at the release. A release published before I4 carries no evaluation record, because no evaluation verdict is required before I4, and the read returns it without one (D140). The read also returns what the release keeps about its withdrawal and about a return to Draft (D119): the reason of a deprecation or a revocation in `withdrawalReason`, the in-flight policy in `inFlightPolicy` and the `finding` recorded when a candidate returned to Draft. `AgentRegistryService/ListReleases` returns the releases the caller can read, filtered by asset kind, asset and state, each with kind, asset, version and state. Both run under the tenant row filter of the service: a caller reads the releases of its own tenant and those of the platform tenant, which holds the assets ConnectSoft publishes and is readable by every tenant; a release of another tenant never appears in a list and is answered 404 when addressed, the same answer as for a release id that does not exist, so the response never confirms that it exists (ADR-0015). A caller without the scope is refused with 403. A Deprecated release and a Revoked release stay readable with their manifest unchanged, and the state shown, Revoked among them, is the committed state of `agent-registry-sql`. An alias that points at a release when it is revoked stays in place and visible (D121): the read of the Revoked release returns that alias among its aliases until an administrator moves it. Deprecation and revocation arrive with the complete delivery in I4, so the suite of this feature writes releases in those states through a fixture of the store. The manifest and the evaluation record are blobs held by ArtifactService and referenced by hash; the read returns the stored manifest and the reference of the record and never a secret, because manifests contain none. Both operations are of class read and write nothing. When the store is unavailable the call fails fast with a problem response. For a release that is not Published yet, a Draft or an InReview candidate, the read returns the manifest without the publication fields of the descriptor, as the contract of the thin delivery fixes it. The write mappings of the three tables are completed by AIFACTORY-TASK-365 of AIFACTORY-US-415, the first PBI that writes an `AssetRelease`; this PBI only reads. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/GetRelease, AgentRegistryService/ListReleases; descriptors: release-manifest-v1; adrs: ADR-0015; requirements: FR-02, FUX-02, FUX-10; scenarios: SCN-AgentRegistryService-005, SCN-AgentRegistryService-006. Depends on: AIFACTORY-US-415, feature:agent-registry-service-thin, feature:component-base-template-factory-profile. Sources: model/services/control-plane/AgentRegistryService.yaml, docs/planes/control/services/agent-registry-service/index.md#data-model-and-storage, docs/reference/schemas/release-manifest.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a Published release with closure, approval and two aliases and no evaluation record (D140), and one whose evaluation record reference and verdict a fixture of the store wrote, when a caller with `factory.assets.read` calls `AgentRegistryService/GetRelease`, then the response is 200 with the manifest as `release-manifest-v1`, every closure entry with exact version and hash, the approval and both aliases, the first without an evaluation record and the second with its reference and verdict, and nothing is written (SCN-AgentRegistryService-005, FUX-02).",
        "AC2: Given a caller without `factory.assets.read`, or a `releaseId` that exists only in another tenant or not at all, when `AgentRegistryService/GetRelease` is called, then the answer is 403 for the missing scope and 404 for the foreign and for the unknown release alike, with a problem response and no state change (SCN-AgentRegistryService-005, ADR-0015).",
        "AC3: Given releases of the tenant of the caller, of the platform tenant and of another tenant in several states, when `AgentRegistryService/ListReleases` is called with filters on asset kind, asset and state, then the response is 200 with only the matching releases of the own tenant and of the platform tenant, each with kind, asset, version and state, and a release of the other tenant never appears (SCN-AgentRegistryService-006, ADR-0015).",
        "AC4: Given `agent-registry-sql` is unavailable or the identity platform cannot validate the token, when `AgentRegistryService/ListReleases` is called, then the call fails fast with a problem response and no state changes; given a Deprecated release, when it is read or listed, then it is returned with state Deprecated and its manifest unchanged; given a Revoked release, when `AgentRegistryService/GetRelease` is called, then it is returned with the state Revoked, the `withdrawalReason` and the `inFlightPolicy` it keeps, every alias that still points at it (D121) and its manifest unchanged, and given a candidate that returned to Draft after an expired, stale or cancelled approval, then the read returns its `finding` (SCN-AgentRegistryService-005, SCN-AgentRegistryService-006, model/services/control-plane/AgentRegistryService.yaml, D119)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#data-model-and-storage",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1692",
        "AIFACTORY-TASK-1693"
      ],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9205,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/GetRelease",
          "AgentRegistryService/ListReleases"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-02",
          "FUX-02",
          "FUX-10"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-005",
          "SCN-AgentRegistryService-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-415",
        "feature:agent-registry-service-thin",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#data-model-and-storage",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-418]",
      "number": 418
    },
    {
      "id": "AIFACTORY-TASK-1692",
      "type": "task",
      "parent": "AIFACTORY-US-418",
      "title": "GetRelease and ListReleases read model with the tenant row filter and the platform tenant",
      "sequence": "01.07.05.01",
      "description": "GetRelease and ListReleases read model with the tenant row filter and the platform tenant. Expected output: GetRelease returns the manifest as release-manifest-v1 with closure, the evaluation record reference and verdict where the release carries one, approval and aliases, and with the withdrawalReason, the inFlightPolicy and the finding the release keeps (D119); a release published before I4 is returned without an evaluation record (D140); the aliases of a Revoked release include every alias that still points at it, since such an alias stays in place and visible until an administrator moves it (D121); ListReleases returns the releases filtered by asset kind, asset and state; both read the own tenant and the platform tenant only, so a release of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015), and a missing scope is 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "GetRelease returns the manifest as release-manifest-v1 with closure, the evaluation record reference and verdict where the release carries one, approval and aliases, and with the withdrawalReason, the inFlightPolicy and the finding the release keeps (D119); a release published before I4 is returned without an evaluation record (D140); the aliases of a Revoked release include every alias that still points at it, since such an alias stays in place and visible until an administrator moves it (D121); ListReleases returns the releases filtered by asset kind, asset and state; both read the own tenant and the platform tenant only, so a release of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015), and a missing scope is 403."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1692]",
      "number": 1692
    },
    {
      "id": "AIFACTORY-TASK-1693",
      "type": "task",
      "parent": "AIFACTORY-US-418",
      "title": "Verify read-releases-with-closure-and-evidence through the acceptance suite",
      "sequence": "01.07.05.02",
      "description": "Verify read-releases-with-closure-and-evidence through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-005|Scenario=SCN-AgentRegistryService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-418 over the two-tenant fixture with the platform tenant, a Published release without an evaluation record and one with a record written by a fixture of the store, a Deprecated release, a Revoked release read with its reason, its in-flight policy and the alias that still points at it, both written by a fixture of the store, a Draft candidate read with its finding and a stopped store.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-005|Scenario=SCN-AgentRegistryService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-418 over the two-tenant fixture with the platform tenant, a Published release without an evaluation record and one with a record written by a fixture of the store, a Deprecated release, a Revoked release read with its reason, its in-flight policy and the alias that still points at it, both written by a fixture of the store, a Draft candidate read with its finding and a stopped store."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1693]",
      "number": 1693
    },
    {
      "id": "AIFACTORY-US-419",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-189",
      "title": "Point an alias at a Published release without touching the runs that were already accepted",
      "sequence": "01.07.06",
      "description": "As an asset maintainer, I want to move an alias such as stable to a newly published release, so that new submissions pick up the new release while every accepted run keeps the one it pinned. An alias is a mutable name of an asset, such as latest or stable, that points at one release; a submission may name the alias, and Run Control resolves it to the release id when it accepts the run. The owner moved this operation to the publication path of I2 (D140), so the workflow features of I2 and later point the aliases of their definitions and agents at their Published releases. A caller whose scope carries `factory.assets.publish` points an alias at a release through `AgentRegistryService/MoveAlias`, addressed by asset kind, asset id and alias name, with the target release in the body. The service checks that the release exists in the tenant of the caller, belongs to the addressed asset and is Published, and then creates the alias or moves it, recording `movedAt` and `movedBy`; the response is 200. An alias is never pointed at a Draft, InReview, Deprecated or Revoked release: such a target is refused with 409, and a revoked release is never aliased again (D119). An alias that already points at a release when that release is revoked is another case (D121): the revocation leaves it in place and visible, `AssetPublication.ResolveRelease` through it answers FAILED_PRECONDITION naming the revoked release and SubmitRun of RunControlService answers 409, and that lasts until an administrator moves the alias to a Published release through this operation. That move is an ordinary move: it is refused only as any move is, and from its commit the alias resolves to the new release. Revocation arrives with the complete delivery in I4, so the suite of this feature writes Deprecated and Revoked releases, and an alias left on a Revoked release, through a fixture of the store. Moving an alias changes what later submissions resolve and nothing else. A run that was accepted before the move keeps the release id it pinned, because the alias selects a release at submission only; the registry changes no run and publishes no event for an alias. Two concurrent moves of the same alias are decided by the version conflict the model names: the first commits, the second is rejected with 409 and the caller reads the alias again. A repeated call that names the release the alias already points at returns 200 and changes nothing. A caller without the scope is answered 403; an asset or a release that does not exist in the tenant of the caller is answered 404, which is also the answer for an asset or a release of another tenant. From the moment the move commits, `AgentRegistryService/AssetPublication.ResolveRelease` resolves the alias to the new release. This PBI is the last whose route the command-line client calls, so it also delivers the release commands of the client in ConnectSoft.AI.SoftwareFactory.Cli: validate, submit, publish and move an alias, each through the gateway route of its operation. A command sends the modelled request, with an `Idempotency-Key` on a submission, prints the release id and the state, and for a validation the report with its findings, and exits with a non-zero code on 400, 403, 404, 409 and 412; the commands are proven in the repository of the client against a fake of the gateway. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/MoveAlias, AgentRegistryService/AssetPublication.ResolveRelease, AgentRegistryService/ValidateRelease, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; adrs: ADR-0015; requirements: FR-02; scenarios: SCN-AgentRegistryService-007. Depends on: AIFACTORY-US-414, AIFACTORY-US-415, AIFACTORY-US-416, AIFACTORY-US-418, feature:command-line-client. Sources: model/services/control-plane/AgentRegistryService.yaml, docs/planes/control/registries.md, docs/planes/control/services/agent-registry-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given a Published release of an asset and a caller with `factory.assets.publish`, when `AgentRegistryService/MoveAlias` is called for an alias of that asset with the release as target, then the response is 200, `ReleaseAliases` points the alias at the release with `movedAt` and `movedBy`, and `AgentRegistryService/AssetPublication.ResolveRelease` resolves the alias to that release from then on; given an alias that points at a Revoked release, which the revocation left in place (D121), when the same call names a Published release of that asset as target, then the response is 200 and the alias resolves to that release again (SCN-AgentRegistryService-007, FR-02).",
        "AC2: Given a run accepted while the alias pointed at the earlier release, when the alias is moved, then the release id the run pinned is unchanged and loading it returns the earlier release, and the registry writes no outbox record for the move (SCN-AgentRegistryService-007, docs/planes/control/registries.md).",
        "AC3: Given a target release that is Draft, InReview, Deprecated or Revoked (D119), or two concurrent moves of the same alias, when `AgentRegistryService/MoveAlias` is called, then the target that is not Published is refused with 409, the first concurrent move commits and the second is rejected with 409, and the alias points at exactly one Published release (SCN-AgentRegistryService-007, model/services/control-plane/AgentRegistryService.yaml).",
        "AC4: Given a caller without `factory.assets.publish`, or an asset or release of another tenant or an unknown one, when `AgentRegistryService/MoveAlias` is called, then the answer is 403 or 404 respectively and the alias is unchanged; given a repeated call that names the release the alias already points at, when it arrives, then it returns 200 and changes nothing (SCN-AgentRegistryService-007, ADR-0015).",
        "AC5: Given the gateway routes of `AgentRegistryService/ValidateRelease`, `AgentRegistryService/SubmitRelease`, `AgentRegistryService/PublishRelease` and `AgentRegistryService/MoveAlias`, when each release command of the command-line client runs against a fake of the gateway, then it sends the modelled request, with an `Idempotency-Key` on a submission, prints the release id and the state, and for a validation the report with its findings, and exits with a non-zero code on 400, 403, 404, 409 and 412 (model/services/control-plane/AgentRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/registries.md",
        "docs/planes/control/services/agent-registry-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1694",
        "AIFACTORY-TASK-542",
        "AIFACTORY-TASK-1695",
        "AIFACTORY-TASK-1702"
      ],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9206,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/MoveAlias",
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "AgentRegistryService/ValidateRelease",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-414",
        "AIFACTORY-US-415",
        "AIFACTORY-US-416",
        "AIFACTORY-US-418",
        "feature:command-line-client"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/registries.md",
        "docs/planes/control/services/agent-registry-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-419]",
      "number": 419
    },
    {
      "id": "AIFACTORY-TASK-1694",
      "type": "task",
      "parent": "AIFACTORY-US-419",
      "title": "MoveAlias with the Published check and the version conflict of concurrent moves",
      "sequence": "01.07.06.01",
      "description": "MoveAlias with the Published check and the version conflict of concurrent moves. Expected output: MoveAlias creates or moves the alias of the addressed asset to a Published release of that asset with movedAt and movedBy, refuses a target that is not Published and the losing one of two concurrent moves with 409, moves an alias that points at a Revoked release to a Published one like any other alias (D121), returns 200 without a change on a repeat, answers 403 and 404 (also for an asset or release of another tenant, ADR-0015) as modelled, and writes no outbox record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "MoveAlias creates or moves the alias of the addressed asset to a Published release of that asset with movedAt and movedBy, refuses a target that is not Published and the losing one of two concurrent moves with 409, moves an alias that points at a Revoked release to a Published one like any other alias (D121), returns 200 without a change on a repeat, answers 403 and 404 (also for an asset or release of another tenant, ADR-0015) as modelled, and writes no outbox record."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1694]",
      "number": 1694
    },
    {
      "id": "AIFACTORY-TASK-542",
      "type": "task",
      "parent": "AIFACTORY-US-419",
      "title": "Release commands in the command-line client",
      "sequence": "01.07.06.02",
      "description": "Release commands in the command-line client. Expected output: The client validates, submits and publishes a release and moves an alias through the gateway routes of ValidateRelease, SubmitRelease, PublishRelease and MoveAlias, sends an Idempotency-Key with a submission, prints the report of a validation with its findings and the release id and state after each command, and exits with a non-zero code on 400, 403, 404, 409 and 412.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client validates, submits and publishes a release and moves an alias through the gateway routes of ValidateRelease, SubmitRelease, PublishRelease and MoveAlias, sends an Idempotency-Key with a submission, prints the report of a validation with its findings and the release id and state after each command, and exits with a non-zero code on 400, 403, 404, 409 and 412."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-542]",
      "number": 542
    },
    {
      "id": "AIFACTORY-TASK-1695",
      "type": "task",
      "parent": "AIFACTORY-US-419",
      "title": "Verify move-an-alias-to-a-published-release through the acceptance suite",
      "sequence": "01.07.06.03",
      "description": "Verify move-an-alias-to-a-published-release through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-419, including a run that keeps its pinned release across a move, two concurrent moves and an alias moved from a Revoked release, written by a fixture of the store, to a Published one.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-419, including a run that keeps its pinned release across a move, two concurrent moves and an alias moved from a Revoked release, written by a fixture of the store, to a Published one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9206,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1695]",
      "number": 1695
    },
    {
      "id": "AIFACTORY-TASK-1702",
      "type": "task",
      "parent": "AIFACTORY-US-419",
      "title": "Verify the release commands of the command-line client against a fake of the gateway",
      "sequence": "01.07.06.04",
      "description": "Verify the release commands of the command-line client against a fake of the gateway. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReleaseCommands\"` in ConnectSoft.AI.SoftwareFactory.Cli; a zero-match filter counts as a failure; the tests prove AC5 of AIFACTORY-US-419 against a fake of the gateway routes of AgentRegistryService/ValidateRelease, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease and AgentRegistryService/MoveAlias: the modelled request of each command, the Idempotency-Key of a submission, the printed release id and state, the printed findings of a validation and a non-zero exit code on 400, 403, 404, 409 and 412.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReleaseCommands\"` in ConnectSoft.AI.SoftwareFactory.Cli; a zero-match filter counts as a failure; the tests prove AC5 of AIFACTORY-US-419 against a fake of the gateway routes of AgentRegistryService/ValidateRelease, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease and AgentRegistryService/MoveAlias: the modelled request of each command, the Idempotency-Key of a submission, the printed release id and state, the printed findings of a validation and a non-zero exit code on 400, 403, 404, 409 and 412."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 92,
      "phase": "factory",
      "stackRank": 9206,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1702]",
      "number": 1702
    },
    {
      "id": "AIFACTORY-FEAT-007",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "AgentRegistryService: complete delivery",
      "sequence": "01.08",
      "description": "AgentRegistryService is the service of bounded context BC-04 (Asset Publication). Publishes immutable releases of agents, skills, tools, workflows, policies and model profiles with their full dependency closure, hashes and evaluation evidence; serves release resolution to Run Control and release loading to the runtime (BC-04). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Delivers: AgentRegistryService (complete). Depends on: AIFACTORY-FEAT-001, AIFACTORY-FEAT-189. Increment I4: Trust and accountability. Build order 124 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-042",
        "AIFACTORY-US-1562",
        "AIFACTORY-US-417",
        "AIFACTORY-US-420",
        "AIFACTORY-US-421",
        "AIFACTORY-US-536",
        "AIFACTORY-US-736",
        "AIFACTORY-US-1493"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12400,
      "titlePrefix": "[AIFACTORY-FEAT-007]",
      "number": 7
    },
    {
      "id": "AIFACTORY-US-042",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "A published release is immutable, carries its whole closure and, from I4, its evaluation evidence wherever a suite exists",
      "sequence": "01.08.01",
      "description": "As an asset maintainer, I want my releases published with their evaluation evidence where a suite exists and taken out of use only with a stated policy, so that a run that pins a release always executes exactly what was evaluated and approved. This is the integration PBI of the complete delivery. The publication path, from a commit in Git to a Published release with its whole closure approved by someone who is not its author, is delivered in I2 by feature `agent-registry-service-publication` (D140); this feature completes the service on the same contract, so that a run that pins a release always executes exactly what was evaluated wherever evaluation can exist. This PBI proves on a deployed estate that the parts of the complete delivery work together. With the complete QualityScoreService of I4, a candidate of an asset kind that has an evaluation suite carries a passed evaluation record or a recorded waiver before it is published, and `Publication:Gates:RequireEvaluation` takes effect (ADR-0021, D117, D140, AIFACTORY-US-1562). The twenty-six seeded Draft releases of the thin delivery are published through that gate and the seed is retired, and a release published before I4 without an evaluation record, of a kind for which a suite exists, is resubmitted through the gate as a new version while the earlier release stays immutable and loadable by its id (AIFACTORY-US-421, D140). A Published release is deprecated, and a Published or a Deprecated release is revoked, by a Platform admin with a required reason and an in-flight policy for the runs that pinned it (AIFACTORY-US-417 for the deprecation and the revocation of the aggregate, AIFACTORY-US-536 for the REST command `RevokeRelease`); a revoked release is in the state Revoked and is never pinned, aliased or published again (D119). An alias that points at a release when it is revoked stays in place and visible, and a resolution through it, or by the id of the Revoked release, answers FAILED_PRECONDITION naming the revoked release until an administrator moves the alias (D121, D123). RunControlService refuses new runs on a Deprecated or a Revoked release and applies the stated in-flight policy to every run that is not terminal and whose pinned release closure holds the revoked release, child runs included: finish lets the runs continue to their end, drain lets the step that is running finish, dispatches no further step and ends the run Cancelled with the reason release-revoked, and revoke cancels the run at once with the same reason while the runtime interrupts its attempt (D123, AIFACTORY-US-736). The service opens the Draft release of an accepted learning proposal and announces it with `LearningReleaseOpened` (AIFACTORY-US-1493, D131), and handles what other services announce about releases (AIFACTORY-US-420). A deprecation and a revocation each leave an `audit-evidence-v1` record that is written to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope, from which AuditService appends it with its command `SubmitEvidence` (D115, D117). The two REST commands of the Platform admin are reached through ControlPlaneApi under `factory.assets.publish`; a release of another tenant is answered 404, and a caller with the scope but without the Platform admin role 403 (ADR-0015). Manifests never contain secrets. Kind: behavior. Traces: services: AgentRegistryService, RunControlService, QualityScoreService, FeedbackService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease, AgentRegistryService/DeprecateRelease, AgentRegistryService/RevokeRelease, AgentRegistryService/AssetPublication.ResolveRelease, AgentRegistryService/AssetPublication.LoadRelease, RunControlService/SubmitRun; events: QualityScoreService/EvaluationCompleted, AgentRegistryService/AssetReleaseDeprecated, AgentRegistryService/AssetReleaseRevoked, FeedbackService/LearningProposalDecided, AgentRegistryService/LearningReleaseOpened; descriptors: release-manifest-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0021, ADR-0028; requirements: FR-02. Depends on: AIFACTORY-US-1562, AIFACTORY-US-1493, AIFACTORY-US-417, AIFACTORY-US-420, AIFACTORY-US-421, AIFACTORY-US-536, AIFACTORY-US-736, feature:agent-registry-service-publication, feature:run-control-service, feature:quality-score-service-complete, feature:feedback-service, feature:component-base-template-factory-profile, feature:component-audit-factory-evidence, feature:contracts-package. Sources: model/services/control-plane/AgentRegistryService.yaml, docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries, docs/planes/control/registries.md, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given an agent candidate of a kind with an evaluation suite submitted through `AgentRegistryService/SubmitRelease` on the deployed estate, when QualityScoreService announces `QualityScoreService/EvaluationCompleted` with the verdict passed and a Reviewer who is not the submitter grants the publication approval, then the `AgentRegistryService/AssetRelease` is Published with its evaluation record reference and its approval; given a second candidate of that kind whose verdict is failed, when `AgentRegistryService/PublishRelease` is called, then the answer is 412 with the failing gate named and nothing is published (ADR-0021, D140).",
        "AC2: Given a release Published before I4 without an evaluation record, of a kind for which a suite exists, when any operation tries to change its content, then the change is refused and its manifest is unchanged, and when it is resubmitted through the gate as a new version, then a new release id is Published with its evaluation record and the earlier release is still streamed by its id through `AgentRegistryService/AssetPublication.LoadRelease` (FR-02, D140).",
        "AC3: Given a Published release that a non-terminal run pinned and a second Published release, when a Platform admin deprecates the second through `AgentRegistryService/DeprecateRelease` and revokes the first through `AgentRegistryService/RevokeRelease` with the in-flight policy revoke, then `AgentRegistryService/AssetReleaseDeprecated` and `AgentRegistryService/AssetReleaseRevoked` are published under the run event envelope with an `audit-evidence-v1` record each, the pinned run ends Cancelled with the reason release-revoked, `RunControlService/SubmitRun` answers 409 for both releases, and `AgentRegistryService/AssetPublication.ResolveRelease` answers FAILED_PRECONDITION naming the revoked release, by its id and through its alias (D119, D121, D123).",
        "AC4: Given `FeedbackService/LearningProposalDecided` with the state Accepted for an asset of the tenant, when the service handles it, then one Draft `AgentRegistryService/AssetRelease` keeps the proposal id, `AgentRegistryService/LearningReleaseOpened` announces its release id with the proposal id, and that release reaches Published only through `AgentRegistryService/SubmitRelease` and the gate (D131, ADR-0021).",
        "AC5: Given the service descriptor of the repository and an empty store, when the contract test compares it with the hosted surface and the service starts, then the eight REST operations and the two gRPC methods of model/services/control-plane/AgentRegistryService.yaml are hosted with their scope, side-effect class, idempotency and response codes, the outbox holds only the five event types of the aggregate and the `audit-evidence-v1` records of a publication, a deprecation and a revocation, and the service registers no release by itself (ADR-0014, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries",
        "docs/planes/control/registries.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-696"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12401,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService",
          "RunControlService",
          "QualityScoreService",
          "FeedbackService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease",
          "AgentRegistryService/DeprecateRelease",
          "AgentRegistryService/RevokeRelease",
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "AgentRegistryService/AssetPublication.LoadRelease",
          "RunControlService/SubmitRun"
        ],
        "events": [
          "QualityScoreService/EvaluationCompleted",
          "AgentRegistryService/AssetReleaseDeprecated",
          "AgentRegistryService/AssetReleaseRevoked",
          "FeedbackService/LearningProposalDecided",
          "AgentRegistryService/LearningReleaseOpened"
        ],
        "descriptors": [
          "release-manifest-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ],
        "requirements": [
          "FR-02"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1562",
        "AIFACTORY-US-1493",
        "AIFACTORY-US-417",
        "AIFACTORY-US-420",
        "AIFACTORY-US-421",
        "AIFACTORY-US-536",
        "AIFACTORY-US-736",
        "feature:agent-registry-service-publication",
        "feature:run-control-service",
        "feature:quality-score-service-complete",
        "feature:feedback-service",
        "feature:component-base-template-factory-profile",
        "feature:component-audit-factory-evidence",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries",
        "docs/planes/control/registries.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-042]",
      "number": 42
    },
    {
      "id": "AIFACTORY-TASK-696",
      "type": "task",
      "parent": "AIFACTORY-US-042",
      "title": "Verify immutable-release-with-closure by running the declared command on the deployed estate",
      "sequence": "01.08.01.01",
      "description": "Verify immutable-release-with-closure by running the declared command on the deployed estate. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=CompleteDelivery\"` in the pipeline of the repository against the deployed QualityScoreService, RunControlService and FeedbackService; a zero-match filter counts as a failure; the run passes and proves AC1 to AC5 of AIFACTORY-US-042, that is a release published with its evaluation record and a failed candidate refused with 412, a release published before I4 left unchanged and resubmitted as a new version, a deprecation and a revocation with their events, their evidence, the cancelled pinned run and the refused submissions and resolutions, the Draft release of an accepted learning proposal published through the gate, and the hosted surface of the complete service against the service descriptor with no release registered on an empty store.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=CompleteDelivery\"` in the pipeline of the repository against the deployed QualityScoreService, RunControlService and FeedbackService; a zero-match filter counts as a failure; the run passes and proves AC1 to AC5 of AIFACTORY-US-042, that is a release published with its evaluation record and a failed candidate refused with 412, a release published before I4 left unchanged and resubmitted as a new version, a deprecation and a revocation with their events, their evidence, the cancelled pinned run and the refused submissions and resolutions, the Draft release of an accepted learning proposal published through the gate, and the hosted surface of the complete service against the service descriptor with no release registered on an empty store."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-696]",
      "number": 696
    },
    {
      "id": "AIFACTORY-US-1562",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "Attach the evaluation evidence to a candidate and publish a release of a kind with a suite only with a passed verdict or a recorded waiver",
      "sequence": "01.08.02",
      "description": "As a reviewer, I want a candidate of an asset kind that has an evaluation suite to reach my approval only with its verdict attached and to be published only with its evidence, so that from I4 Published means evidenced wherever evidence can exist. The publication path of I2, feature `agent-registry-service-publication`, publishes a release on its closure and its approval, because no evaluation suite exists before the complete QualityScoreService of I4 (D140). This PBI adds the evaluation gate of ADR-0021 with the complete delivery, and with it the option `Publication:Gates:RequireEvaluation` takes effect (D140). The evidence rule holds only where an evaluation suite exists for the asset kind: an agent, skill or workflow release needs a passed evaluation record or a recorded waiver (ADR-0021 decision 2) and a ModelProfile release its capability scorecard (ADR-0021 decision 1), while a release of a kind for which no suite exists keeps the path of I2 and is published on its closure and its approval alone (D117). After a submission, QualityScoreService evaluates a candidate with the suite of its kind, where one exists, and announces `QualityScoreService/EvaluationCompleted` with the target release, the verdict, the evidence reference and its `kind`. The inbox handler `RecordEvaluationEvidence` attaches the verdict and `evaluationRecordRef` to the InReview release the event names, idempotently on the event id, when the `kind` is `release-gate` or, for a ModelProfile release, `capability-suite`, whose record is the scorecard. A failed or inconclusive verdict is attached and requests no approval, and an event of another `kind`, for a release that is not InReview or for a release outside the tenant of the envelope is acknowledged without effect, because a Published release is immutable. From this delivery a candidate of a kind with a suite no longer has its publication approval requested when its closure is resolved: the request of the publication path, through `RunControl.RequestApproval` of RunControlService with the subject kind asset-release and the release id (D135, D140), is made when the verdict is passed or waived, the closure is resolved and no blocking finding is open, as the sequence on the service page shows (D21). How the registry learns that no suite exists for a kind is not stated by the model and is reported to the owner; the fixture of the acceptance suite states it per kind. The rule `GatesPassedAndApproved` of `PublishRelease` and of `PublishOnApproval` gains the evidence check: where a suite exists for the asset kind, its evidence exists while `Publication:Gates:RequireEvaluation` is true, and otherwise `PublishRelease` answers 412 naming the evidence gate, `PublishOnApproval` does not publish and `connectsoft.factory.releases.blocked` is incremented with the reason. The gate checks only the evidence this service recorded itself through `RecordEvaluationEvidence`; `PublishRelease` and `PublishOnApproval` make no synchronous call to QualityScoreService, whose `Evaluation.GetVerdict` is not read at the gate (D141). A release published before I4 without an evaluation record for a kind with a suite stays Published and immutable; it is resubmitted through this gate as a new version by AIFACTORY-US-421 (D140). Kind: behavior. Traces: services: AgentRegistryService, QualityScoreService, RunControlService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/PublishRelease, AgentRegistryService/GetRelease, RunControlService/RunControl.RequestApproval; events: QualityScoreService/EvaluationCompleted, RunControlService/ApprovalDecided; descriptors: release-manifest-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0021; requirements: FR-02, NFR-11, XL-08. Depends on: feature:agent-registry-service-publication, feature:quality-score-service-complete, feature:run-control-service, feature:contracts-package. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/observability/QualityScoreService.yaml, docs/architecture/quality-gates.md, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given an InReview release of a kind with a suite whose closure is resolved without a blocking finding, when `QualityScoreService/EvaluationCompleted` of kind `release-gate` with the verdict passed arrives for it, then `RecordEvaluationEvidence` attaches the verdict and `evaluationRecordRef` once per event id and only then the publication approval is requested through `RunControlService/RunControl.RequestApproval` with the subject kind asset-release and the release id (D135, D140); given a ModelProfile release, then the event of kind `capability-suite` attaches its scorecard the same way (ADR-0021).",
        "AC2: Given a failed or inconclusive verdict, an event of another `kind`, an event for a release that is not InReview, or one for a release outside the tenant of the envelope, when `QualityScoreService/EvaluationCompleted` is handled, then the failed or inconclusive verdict is attached and requests no approval and the other three are acknowledged without effect; given a candidate of a kind for which the fixture holds no suite, then its approval is requested as soon as its closure is resolved, as in the publication path (D117, ADR-0021).",
        "AC3: Given `Publication:Gates:RequireEvaluation` true and an approved InReview release of a kind with a suite without a passed evaluation record or a recorded waiver, when `AgentRegistryService/PublishRelease` is called or `RunControlService/ApprovalDecided` grants its approval, then the answer is 412 naming the evidence gate, decided on the evidence recorded by `RecordEvaluationEvidence` with no synchronous call to QualityScoreService (D141), `PublishOnApproval` does not publish, the release stays InReview and `connectsoft.factory.releases.blocked` is incremented with the reason; given the same release with a passed record or a recorded waiver, then it is Published with its `evaluationRecordRef` (ADR-0021, model/services/control-plane/AgentRegistryService.yaml).",
        "AC4: Given the service started with `Publication:Gates:RequireEvaluation` false, when the release of AC3 without evidence is published, then it is Published on its closure and its approval; given a release Published before I4 without an evaluation record, when `AgentRegistryService/GetRelease` is called after the gate is active, then it is returned unchanged with no evaluation record (D140, FR-02)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/quality-gates.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6341",
        "AIFACTORY-TASK-6342",
        "AIFACTORY-TASK-6343"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12402,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService",
          "QualityScoreService",
          "RunControlService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/PublishRelease",
          "AgentRegistryService/GetRelease",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "QualityScoreService/EvaluationCompleted",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "release-manifest-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "NFR-11",
          "XL-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:agent-registry-service-publication",
        "feature:quality-score-service-complete",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/quality-gates.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1562]",
      "number": 1562
    },
    {
      "id": "AIFACTORY-TASK-6341",
      "type": "task",
      "parent": "AIFACTORY-US-1562",
      "title": "Inbox handler RecordEvaluationEvidence and the approval request on a passed or waived verdict",
      "sequence": "01.08.02.01",
      "description": "Inbox handler RecordEvaluationEvidence and the approval request on a passed or waived verdict. Expected output: RecordEvaluationEvidence, subscribed to EvaluationCompleted of QualityScoreService in the messaging profile, attaches the verdict and the evidence reference to the InReview release the event names, once per event id, for the kind release-gate and, for a ModelProfile release, capability-suite; it acknowledges without effect an event of another kind, for a release that is not InReview or for a release outside the tenant of the envelope; for a candidate of a kind with a suite the publication approval request of AIFACTORY-TASK-1687, with the subject kind asset-release and the release id (D135, D140), is made on a passed or waived verdict of a candidate with a resolved closure and no blocking finding instead of on the resolution of its closure, a failed or inconclusive verdict requests none, and a candidate of a kind without a suite keeps the request on the resolution of its closure (D117).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "RecordEvaluationEvidence, subscribed to EvaluationCompleted of QualityScoreService in the messaging profile, attaches the verdict and the evidence reference to the InReview release the event names, once per event id, for the kind release-gate and, for a ModelProfile release, capability-suite; it acknowledges without effect an event of another kind, for a release that is not InReview or for a release outside the tenant of the envelope; for a candidate of a kind with a suite the publication approval request of AIFACTORY-TASK-1687, with the subject kind asset-release and the release id (D135, D140), is made on a passed or waived verdict of a candidate with a resolved closure and no blocking finding instead of on the resolution of its closure, a failed or inconclusive verdict requests none, and a candidate of a kind without a suite keeps the request on the resolution of its closure (D117)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6341]",
      "number": 6341
    },
    {
      "id": "AIFACTORY-TASK-6342",
      "type": "task",
      "parent": "AIFACTORY-US-1562",
      "title": "Evidence check of GatesPassedAndApproved under the option Publication:Gates:RequireEvaluation",
      "sequence": "01.08.02.02",
      "description": "Evidence check of GatesPassedAndApproved under the option Publication:Gates:RequireEvaluation. Expected output: The option Publication:Gates:RequireEvaluation is bound with its default true and read at start (D140); the domain model of AIFACTORY-TASK-364 gains the invariant that a release of a kind with a suite is Published only with a passed evaluation record or a recorded waiver while the option is true (ADR-0021 decisions 1 and 2), checked on the evidence RecordEvaluationEvidence recorded and with no synchronous call to QualityScoreService (D141); PublishRelease answers 412 naming the evidence gate and PublishOnApproval does not publish when the evidence is missing, both increment connectsoft.factory.releases.blocked with the reason, and a Published release keeps the evaluationRecordRef it was published with.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The option Publication:Gates:RequireEvaluation is bound with its default true and read at start (D140); the domain model of AIFACTORY-TASK-364 gains the invariant that a release of a kind with a suite is Published only with a passed evaluation record or a recorded waiver while the option is true (ADR-0021 decisions 1 and 2), checked on the evidence RecordEvaluationEvidence recorded and with no synchronous call to QualityScoreService (D141); PublishRelease answers 412 naming the evidence gate and PublishOnApproval does not publish when the evidence is missing, both increment connectsoft.factory.releases.blocked with the reason, and a Published release keeps the evaluationRecordRef it was published with."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6342]",
      "number": 6342
    },
    {
      "id": "AIFACTORY-TASK-6343",
      "type": "task",
      "parent": "AIFACTORY-US-1562",
      "title": "Verify the evaluation evidence and its gate through the acceptance suite",
      "sequence": "01.08.02.03",
      "description": "Verify the evaluation evidence and its gate through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=EvaluationGate\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1562 with contract fixtures of QualityScoreService/EvaluationCompleted and a fake of RunControl.RequestApproval: the verdict attached once per event id and the approval requested only after a passed verdict, the scorecard of a ModelProfile release, the failed verdict and the three events acknowledged without effect, the kind without a suite requested on its closure, the 412 of the evidence gate and the refusal of PublishOnApproval with the counter, the publication with a record or a waiver, the option set to false and a release published before I4 read unchanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=EvaluationGate\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1562 with contract fixtures of QualityScoreService/EvaluationCompleted and a fake of RunControl.RequestApproval: the verdict attached once per event id and the approval requested only after a passed verdict, the scorecard of a ModelProfile release, the failed verdict and the three events acknowledged without effect, the kind without a suite requested on its closure, the 412 of the evidence gate and the refusal of PublishOnApproval with the counter, the publication with a record or a waiver, the option set to false and a release published before I4 read unchanged."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6343]",
      "number": 6343
    },
    {
      "id": "AIFACTORY-US-417",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "Deprecate a Published release with a reason and an in-flight policy and revoke one for a security or policy reason, as a Platform admin",
      "sequence": "01.08.03",
      "description": "As a platform admin, I want to take a release out of use with a stated reason and a stated policy for the runs that already pinned it, so that no new run pins it and no running run is silently moved to another release. A Published release leaves use in two ways, and neither repoints a run silently. Both are commands of the Platform admin with a required reason (D117). A caller whose scope carries `factory.assets.publish` and who holds the Platform admin role deprecates a Published release through `AgentRegistryService/DeprecateRelease` with a reason and an in-flight policy, which says what happens to runs that already pinned the release: finish, drain or revoke, as the service page names them. These are the values of the model and of the event, as model/services/agent-mesh/AgentRuntimeService.yaml lists them, and `release-manifest-v1` names the same three for `revocation.inFlightPolicy` (D121). The release moves from Published to Deprecated through `Deprecate` and keeps the reason in `withdrawalReason` and the policy in `inFlightPolicy`, and two outbox records are written in the transaction of the command: `AssetReleaseDeprecated` with `releaseId`, `tenantId` and `inFlightPolicy`, and, because the command is audited, an `audit-evidence-v1` record that names the Platform admin as actor, the release as subject with its `manifestHash`, the reason and the outcome, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope (D115); the response is 200. The `action` values of `audit-evidence-v1` name `release-published` and `release-revoked` and none for a deprecation, which is reported to the owner as a correction of the descriptor; the acceptance test fixes the other members of the record. Deprecation keeps the manifest readable: the release can still be read and loaded by its id for the runs that pinned it, and it is immutable as before, so the stored manifest is not changed by a deprecation or a revocation. On the event RunControlService refuses new runs that would pin the release with 409 while runs already pinned continue, AgentRuntimeService applies the in-flight policy to running attempts and AgentCardService withdraws the card, each in its own PBI. A revocation is the security or policy action: a Platform admin withdraws a Published or a Deprecated release for a stated reason with the in-flight policy for the runs pinned to it, the release moves to the state Revoked through the transition `Revoke`, from Published or from Deprecated, and keeps the reason and the policy the revocation states (D119). No transition leaves Revoked, and a revoked release is never pinned, aliased or published again: `ResolveRelease` resolves no alias and no release id to it for a new pin (AIFACTORY-US-421), `MoveAlias` refuses it (AIFACTORY-US-419) and `PublishRelease` answers 409 (AIFACTORY-US-416). The revocation moves and removes no alias: an alias that points at the release stays in place and visible, and a resolution through it answers FAILED_PRECONDITION naming the revoked release until an administrator moves the alias (D121, AIFACTORY-US-421). With the revocation two outbox records are written in the transaction of the command: `AssetReleaseRevoked` with `releaseId`, `tenantId`, `reason` and `inFlightPolicy`, and an `audit-evidence-v1` record of action `release-revoked` that names the actor, the release as subject with its `manifestHash`, the reason and the outcome, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope (D115); a command that rolls back leaves no evidence. On that event RunControlService applies the stated in-flight policy to every run that is not terminal and whose pinned release closure holds the revoked release, child runs included, where finish lets the runs continue to their end, drain lets the step that is running finish, dispatches no further step and ends the run Cancelled with the reason release-revoked, and revoke cancels the run at once with the same reason (D123, AIFACTORY-US-736); AgentRuntimeService interrupts the running attempts of those runs under revoke, lets them finish under drain and does nothing under finish, AgentCardService withdraws the card and AuditService records the evidence. This PBI delivers the revocation of the aggregate with its event and its evidence and proves it at the level of the domain and the outbox; the REST command `RevokeRelease` that performs it, with its request, its refusals and its repeat, is delivered and proven by AIFACTORY-US-536. For `DeprecateRelease` a body without a reason or with an in-flight policy other than finish, drain or revoke is answered 400, a caller without the scope or with the scope and without the Platform admin role 403, a release of another tenant or an unknown one 404 and a release that is Draft, InReview or Revoked 409, and a repeated call for a release already Deprecated returns 200 and writes no second event and no second evidence. Both events are published under the run event envelope of the contracts package by the dispatcher of the `agent-registry` messaging profile, which retries a transport outage with backoff. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/DeprecateRelease, AgentRegistryService/GetRelease, AgentRegistryService/AssetPublication.LoadRelease; events: AgentRegistryService/AssetReleaseDeprecated, AgentRegistryService/AssetReleaseRevoked; descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-02, NFR-02; scenarios: SCN-AgentRegistryService-004, SCN-AgentRegistryService-012, SCN-AgentRegistryService-013. Depends on: feature:agent-registry-service-publication, feature:component-audit-factory-evidence, feature:contracts-package. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries, docs/planes/control/registries.md, docs/architecture/quality-gates.md, model/services/agent-mesh/AgentRuntimeService.yaml, docs/reference/schemas/release-manifest.schema.json, docs/reference/schemas/audit-evidence.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a Published release and a Platform admin whose scope carries `factory.assets.publish`, when `AgentRegistryService/DeprecateRelease` is called with a reason and an in-flight policy, then the response is 200, the `AgentRegistryService/AssetRelease` is Deprecated and keeps the reason in `withdrawalReason` and the policy in `inFlightPolicy`, its manifest stays readable and unchanged, and the `AgentRegistryService/AssetReleaseDeprecated` outbox record with `releaseId`, `tenantId` and `inFlightPolicy` and an `audit-evidence-v1` record that names the actor, the release as subject with its `manifestHash`, the reason and the outcome are written in the same transaction; a command that rolls back leaves neither (SCN-AgentRegistryService-004, ADR-0014).",
        "AC2: Given a body without a reason or with an in-flight policy other than finish, drain or revoke, a caller without the scope or with the scope and without the Platform admin role, a release of another tenant or an unknown one, or a release that is Draft, InReview or Revoked, when `AgentRegistryService/DeprecateRelease` is called, then the answer is 400, 403, 404 or 409 respectively and nothing changes; given a release already Deprecated, when the call is repeated, then it returns 200 and writes no second event and no second evidence (SCN-AgentRegistryService-004, ADR-0015).",
        "AC3: Given a committed deprecation, when the dispatcher publishes `AgentRegistryService/AssetReleaseDeprecated` on `asset-publication.releases.v1.asset-release-deprecated`, then the event is sent under the run event envelope with `releaseId`, `tenantId` and `inFlightPolicy`, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-AgentRegistryService-012, ADR-0012).",
        "AC4: Given a Published release, and likewise a Deprecated one, revoked by a Platform admin with a reason and an in-flight policy, when the revocation commits, then the release is in the state Revoked through `Revoke`, which no transition leaves (D119), and keeps the reason in `withdrawalReason` and the policy in `inFlightPolicy`, the `AgentRegistryService/AssetReleaseRevoked` outbox record with `releaseId`, `tenantId`, `reason` and `inFlightPolicy` is written, and an `audit-evidence-v1` record of action `release-revoked` that names the actor, the release as subject with its `manifestHash`, the reason and the outcome is written to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope; a command that rolls back leaves no evidence (D115); the stored manifest is unchanged, and an alias that pointed at the release still points at it, since a revocation changes and removes no row of `ReleaseAliases` (D121); the dispatcher publishes the event on `asset-publication.releases.v1.asset-release-revoked` under the run event envelope and retries a transport outage without loss or duplicate (SCN-AgentRegistryService-013, ADR-0012, ADR-0014).",
        "AC5: Given a Deprecated release that a run pinned earlier, when it is read through `AgentRegistryService/GetRelease` or loaded by its release id through `AgentRegistryService/AssetPublication.LoadRelease`, then the same manifest and closure are returned as before the deprecation, because the registry never repoints a pinned run (FR-02, docs/planes/control/registries.md)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries",
        "docs/planes/control/registries.md",
        "docs/architecture/quality-gates.md",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-541",
        "AIFACTORY-TASK-1690",
        "AIFACTORY-TASK-1691"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12403,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/DeprecateRelease",
          "AgentRegistryService/GetRelease",
          "AgentRegistryService/AssetPublication.LoadRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleaseDeprecated",
          "AgentRegistryService/AssetReleaseRevoked"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-02",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-004",
          "SCN-AgentRegistryService-012",
          "SCN-AgentRegistryService-013"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:agent-registry-service-publication",
        "feature:component-audit-factory-evidence",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#context-and-boundaries",
        "docs/planes/control/registries.md",
        "docs/architecture/quality-gates.md",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-417]",
      "number": 417
    },
    {
      "id": "AIFACTORY-TASK-541",
      "type": "task",
      "parent": "AIFACTORY-US-417",
      "title": "Immutability, deprecation and revocation of a Published release",
      "sequence": "01.08.03.01",
      "description": "Immutability, deprecation and revocation of a Published release. Expected output: The transitions Deprecate and Revoke are added to the domain model of AIFACTORY-TASK-364 with the invariant that a deprecation and a revocation keep a reason and the revocation also its in-flight policy, and DeprecateRelease is hosted on POST /factory/asset-releases/{releaseId}/deprecate under factory.assets.publish and listed in the service descriptor file with the codes 200, 400, 403, 404 and 409, beside the publication path of I2 (D140); Published content cannot change; DeprecateRelease admits only a caller with the Platform admin role, requires a reason and an in-flight policy, applies the Deprecate transition, keeps the reason in withdrawalReason and the policy in inFlightPolicy and writes, in the same transaction, AssetReleaseDeprecated and, through the Factory sink of the audit library pinned from feature component-audit-factory-evidence, an audit-evidence-v1 record with the actor, the release as subject with its manifestHash, the reason and the outcome (D115, D117), whose action value follows the correction of the descriptor the PBI reports; it returns 200 without a second event or evidence on a repeat and answers 400, 403, 404 (also for a release of another tenant, ADR-0015) and 409 as modelled, the 409 also for a Revoked release; the revocation of the aggregate moves a Published or a Deprecated release to the state Revoked through Revoke with a reason and an in-flight policy (D119), keeps both on the release, allows no transition out of Revoked and writes, in the transaction of the command, AssetReleaseRevoked and, through the same sink, an audit-evidence-v1 record of action release-revoked with the actor, the release as subject with its manifestHash, the reason and the outcome, on the topic audit.evidence.v1.evidence-submitted under the run event envelope (D115); the REST command RevokeRelease over it is delivered by AIFACTORY-US-536; the in-flight policy takes the values finish, drain and revoke of model/services/agent-mesh/AgentRuntimeService.yaml, the stored manifest is not changed by a deprecation or a revocation, and a revocation changes and removes no alias row, so an alias that points at the revoked release stays in place (D121).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The transitions Deprecate and Revoke are added to the domain model of AIFACTORY-TASK-364 with the invariant that a deprecation and a revocation keep a reason and the revocation also its in-flight policy, and DeprecateRelease is hosted on POST /factory/asset-releases/{releaseId}/deprecate under factory.assets.publish and listed in the service descriptor file with the codes 200, 400, 403, 404 and 409, beside the publication path of I2 (D140); Published content cannot change; DeprecateRelease admits only a caller with the Platform admin role, requires a reason and an in-flight policy, applies the Deprecate transition, keeps the reason in withdrawalReason and the policy in inFlightPolicy and writes, in the same transaction, AssetReleaseDeprecated and, through the Factory sink of the audit library pinned from feature component-audit-factory-evidence, an audit-evidence-v1 record with the actor, the release as subject with its manifestHash, the reason and the outcome (D115, D117), whose action value follows the correction of the descriptor the PBI reports; it returns 200 without a second event or evidence on a repeat and answers 400, 403, 404 (also for a release of another tenant, ADR-0015) and 409 as modelled, the 409 also for a Revoked release; the revocation of the aggregate moves a Published or a Deprecated release to the state Revoked through Revoke with a reason and an in-flight policy (D119), keeps both on the release, allows no transition out of Revoked and writes, in the transaction of the command, AssetReleaseRevoked and, through the same sink, an audit-evidence-v1 record of action release-revoked with the actor, the release as subject with its manifestHash, the reason and the outcome, on the topic audit.evidence.v1.evidence-submitted under the run event envelope (D115); the REST command RevokeRelease over it is delivered by AIFACTORY-US-536; the in-flight policy takes the values finish, drain and revoke of model/services/agent-mesh/AgentRuntimeService.yaml, the stored manifest is not changed by a deprecation or a revocation, and a revocation changes and removes no alias row, so an alias that points at the revoked release stays in place (D121)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-541]",
      "number": 541
    },
    {
      "id": "AIFACTORY-TASK-1690",
      "type": "task",
      "parent": "AIFACTORY-US-417",
      "title": "Contract of AssetReleaseDeprecated and AssetReleaseRevoked against the run event envelope of the contracts package",
      "sequence": "01.08.03.02",
      "description": "Contract of AssetReleaseDeprecated and AssetReleaseRevoked against the run event envelope of the contracts package. Expected output: Beside the golden files of AssetReleaseSubmitted and AssetReleasePublished of the publication path (AIFACTORY-TASK-6347, D140), golden files fix AssetReleaseDeprecated and AssetReleaseRevoked on their topics under run-event-envelope-v1 with the payload fields of model/services/control-plane/AgentRegistryService.yaml and the tenant in the envelope; a contract test fails when a serialised event differs from its file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Beside the golden files of AssetReleaseSubmitted and AssetReleasePublished of the publication path (AIFACTORY-TASK-6347, D140), golden files fix AssetReleaseDeprecated and AssetReleaseRevoked on their topics under run-event-envelope-v1 with the payload fields of model/services/control-plane/AgentRegistryService.yaml and the tenant in the envelope; a contract test fails when a serialised event differs from its file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12403,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1690]",
      "number": 1690
    },
    {
      "id": "AIFACTORY-TASK-1691",
      "type": "task",
      "parent": "AIFACTORY-US-417",
      "title": "Verify deprecate-and-revoke-a-release through the acceptance suite",
      "sequence": "01.08.03.03",
      "description": "Verify deprecate-and-revoke-a-release through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-004|Scenario=SCN-AgentRegistryService-012|Scenario=SCN-AgentRegistryService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-417, including a deprecation by a Platform admin with its reason and policy kept on the release, the 400 of a missing reason and the 403 of a caller that holds the scope without the Platform admin role, the publication and payload of both events, a revocation from Published and one from Deprecated that both end in the state Revoked, an alias that still points at the release after its revocation, the 409 of a deprecation of a Revoked release, the evidence record of a deprecation and of a revocation on the topic audit.evidence.v1.evidence-submitted and none after a rollback; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRegistryService-004|Scenario=SCN-AgentRegistryService-012|Scenario=SCN-AgentRegistryService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-417, including a deprecation by a Platform admin with its reason and policy kept on the release, the 400 of a missing reason and the 403 of a caller that holds the scope without the Platform admin role, the publication and payload of both events, a revocation from Published and one from Deprecated that both end in the state Revoked, an alias that still points at the release after its revocation, the 409 of a deprecation of a Revoked release, the evidence record of a deprecation and of a revocation on the topic audit.evidence.v1.evidence-submitted and none after a rollback; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1691]",
      "number": 1691
    },
    {
      "id": "AIFACTORY-US-420",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "AgentRegistryService handles once and inside the tenant what other services announce about releases",
      "sequence": "01.08.04",
      "description": "As a platform admin, I want every event another service announces about releases handled once and inside its tenant, so that a blueprint, a marketplace installation, an entitlement and a retention rule reach the registry once. Besides the two events of the publication gate, the model lists eight consumed events of AgentRegistryService. BlueprintService announces `BlueprintSubmitted`, for which the handler `OpenReleaseCandidate` opens a release candidate for the submitted blueprint version. FeedbackService announces `LearningProposalDecided`, for which the same handler opens the Draft release of an accepted learning proposal through the command `OpenLearningRelease` and announces it with `LearningReleaseOpened`; that path is delivered by AIFACTORY-US-1493 (D131). MarketplaceCatalogService announces `ListingInstalled` and `ListingRemoved`: `RegisterInstalledRelease` makes the releases of the installed listing available to the tenant, and `WithdrawInstalledRelease` withdraws the releases of the removed installation from the tenant so that no new run may pin them. LicenseService announces `EntitlementStateChanged`, for which `ApplyEntitlementState` suspends or restores the use by the tenant of the releases that come from a marketplace listing. RetentionResidencyService announces `RetentionRuleChanged`, for which `ApplyRetentionRule` applies the effective retention period to the records the service owns in the store class of the rule. RetentionResidencyService also announces `DeletionOrderIssued` and `LegalHoldChanged`; the owner decided that their handlers `ExecuteDeletionOrder` and `ApplyLegalHold`, with the deletion of an ordered scope, its receipt through `AcknowledgeOrderTask` and the suspension of deletion and expiry for a held scope, are built in this repository in I4 by feature `retention-residency-service`, one PBI per group of owning services, and proven by its deletion and hold scenarios (D137); this PBI delivers neither handler. The service registers the six subscriptions of this PBI, beside those of `ApprovalDecided` and `EvaluationCompleted`, in the `OrleansMessaging` section of its own messaging profile with the service name `agent-registry`, and the two retention subscriptions join the same section with their handlers. Its inbox deduplicates each delivery on the event id, and each handler reads the tenant from the envelope and never from the payload, so a message without a tenant is not handled and is poisoned with its reason. A candidate opened by `OpenReleaseCandidate` enters the same lifecycle as a submitted one and is published only through the gate of AIFACTORY-US-416; a handler never publishes a release, and a release of another tenant is never touched. The publishers of the retention and blueprint events are delivered in this increment or an earlier one; MarketplaceCatalogService and LicenseService arrive in a later increment, so their three handlers are proven against contract fixtures built from the model and the publishers prove their side in their own features. The model has no table or field for the availability of an installed release to a tenant or for its suspension, so where the three marketplace and entitlement handlers keep it is an open point this PBI does not decide: it delivers their subscriptions, the idempotent inbox and the tenant guard, and the handlers follow the model once it names the fields. The gateway consumes none of these events (ADR-0028 amendment on gateways and events). Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; events: RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged, BlueprintService/BlueprintSubmitted, AgentRegistryService/LearningReleaseOpened; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0021, ADR-0028. Depends on: AIFACTORY-US-1562, feature:agent-registry-service-publication, feature:contracts-package, feature:retention-residency-service, feature:blueprint-service. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/planes/control/services/agent-registry-service/index.md#messages, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the messaging profile, when the service starts, then the `OrleansMessaging` section declares one subscription with its handler for each of the ten consumed events of model/services/control-plane/AgentRegistryService.yaml other than `RetentionResidencyService/DeletionOrderIssued` and `RetentionResidencyService/LegalHoldChanged`, whose handlers feature `retention-residency-service` builds in this repository (D137), and the five published events with their topics, `AgentRegistryService/LearningReleaseOpened` among them (D131); startup fails when a consumed event listed in the service descriptor file of the repository has no subscription, and ControlPlaneApi subscribes to none of them (ADR-0028).",
        "AC2: Given a `BlueprintService/BlueprintSubmitted` event, when `OpenReleaseCandidate` handles it, then one `AgentRegistryService/AssetRelease` candidate exists per event id in a state before Published, a second delivery of the same event opens no second candidate, and no release is Published by a handler (ADR-0014, ADR-0021).",
        "AC3: Given a `RetentionResidencyService/RetentionRuleChanged` for the store class of the records the service owns in one tenant, when `ApplyRetentionRule` handles it, then the effective retention period of the rule applies to those records of that tenant, no record of another tenant is touched and a second delivery of the same event changes nothing (ADR-0015, model/services/control-plane/AgentRegistryService.yaml).",
        "AC4: Given a delivery without a tenant in the envelope, a duplicate delivery and a handler that throws, when they arrive, then the first is poisoned with its reason, the second is acknowledged without effect, and the third is retried with backoff and poisoned at the attempt limit of the profile while the other subscriptions keep delivering (ADR-0012, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#messages",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-367",
        "AIFACTORY-TASK-1696",
        "AIFACTORY-TASK-1697",
        "AIFACTORY-TASK-1698"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12404,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged",
          "BlueprintService/BlueprintSubmitted",
          "AgentRegistryService/LearningReleaseOpened"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1562",
        "feature:agent-registry-service-publication",
        "feature:contracts-package",
        "feature:retention-residency-service",
        "feature:blueprint-service"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/control/services/agent-registry-service/index.md#messages",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-420]",
      "number": 420
    },
    {
      "id": "AIFACTORY-TASK-367",
      "type": "task",
      "parent": "AIFACTORY-US-420",
      "title": "Messaging wiring of the agent-registry profile: outbox for 5 published events and inbox subscriptions for 8 of the 10 consumed events",
      "sequence": "01.08.04.01",
      "description": "Messaging wiring of the agent-registry profile: outbox for 5 published events and inbox subscriptions for 8 of the 10 consumed events. Expected output: On the OrleansMessaging section that the publication path wired in I2 with AssetReleaseSubmitted, AssetReleasePublished and the subscription of ApprovalDecided (AIFACTORY-TASK-6346, D140), the section declares the service name agent-registry, the five published events AssetReleaseSubmitted, AssetReleasePublished, AssetReleaseDeprecated, AssetReleaseRevoked and LearningReleaseOpened with their topics (D131) and the subscriptions of the model with their handlers other than those of DeletionOrderIssued and LegalHoldChanged, which feature retention-residency-service adds in this repository (D137); the outbox writer enlists in the unit of work of each command, the inbox deduplicates on the event id and each handler reads the tenant from the run event envelope and refuses a message without one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "On the OrleansMessaging section that the publication path wired in I2 with AssetReleaseSubmitted, AssetReleasePublished and the subscription of ApprovalDecided (AIFACTORY-TASK-6346, D140), the section declares the service name agent-registry, the five published events AssetReleaseSubmitted, AssetReleasePublished, AssetReleaseDeprecated, AssetReleaseRevoked and LearningReleaseOpened with their topics (D131) and the subscriptions of the model with their handlers other than those of DeletionOrderIssued and LegalHoldChanged, which feature retention-residency-service adds in this repository (D137); the outbox writer enlists in the unit of work of each command, the inbox deduplicates on the event id and each handler reads the tenant from the run event envelope and refuses a message without one."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-367]",
      "number": 367
    },
    {
      "id": "AIFACTORY-TASK-1696",
      "type": "task",
      "parent": "AIFACTORY-US-420",
      "title": "Contract fixtures of the consumed events of the marketplace, licence, retention, learning and blueprint publishers",
      "sequence": "01.08.04.02",
      "description": "Contract fixtures of the consumed events of the marketplace, licence, retention, learning and blueprint publishers. Expected output: The acceptance suite holds one fixture per consumed event of model/services/control-plane/AgentRegistryService.yaml under run-event-envelope-v1 with the payload fields its producer declares in the model, a duplicate of each with the same event id and a variant without a tenant in the envelope.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The acceptance suite holds one fixture per consumed event of model/services/control-plane/AgentRegistryService.yaml under run-event-envelope-v1 with the payload fields its producer declares in the model, a duplicate of each with the same event id and a variant without a tenant in the envelope."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12404,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1696]",
      "number": 1696
    },
    {
      "id": "AIFACTORY-TASK-1697",
      "type": "task",
      "parent": "AIFACTORY-US-420",
      "title": "Handlers OpenReleaseCandidate for a submitted blueprint and ApplyRetentionRule",
      "sequence": "01.08.04.03",
      "description": "Handlers OpenReleaseCandidate for a submitted blueprint and ApplyRetentionRule. Expected output: OpenReleaseCandidate opens one release candidate per submitted blueprint version, idempotently on the event id and never past the gate, and passes an accepted learning proposal to the command OpenLearningRelease of AIFACTORY-US-1493; ApplyRetentionRule applies the effective retention period of the rule to the rows and manifest references the service owns in the store class of the rule, inside the tenant of the envelope; the deletion and hold handlers are not part of this task (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "OpenReleaseCandidate opens one release candidate per submitted blueprint version, idempotently on the event id and never past the gate, and passes an accepted learning proposal to the command OpenLearningRelease of AIFACTORY-US-1493; ApplyRetentionRule applies the effective retention period of the rule to the rows and manifest references the service owns in the store class of the rule, inside the tenant of the envelope; the deletion and hold handlers are not part of this task (D137)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1697]",
      "number": 1697
    },
    {
      "id": "AIFACTORY-TASK-1698",
      "type": "task",
      "parent": "AIFACTORY-US-420",
      "title": "Verify the inbox handlers against the contract fixtures",
      "sequence": "01.08.04.04",
      "description": "Verify the inbox handlers against the contract fixtures. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-420: the subscriptions of model/services/control-plane/AgentRegistryService.yaml other than those of DeletionOrderIssued and LegalHoldChanged and the five published events, the blueprint candidate opened once, the retention rule applied inside its tenant once, the message without a tenant and the poisoned delivery.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-420: the subscriptions of model/services/control-plane/AgentRegistryService.yaml other than those of DeletionOrderIssued and LegalHoldChanged and the five published events, the blueprint candidate opened once, the retention rule applied inside its tenant once, the message without a tenant and the poisoned delivery."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1698]",
      "number": 1698
    },
    {
      "id": "AIFACTORY-US-421",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "Resolution and loading serve releases that passed the gate, the seeded Draft releases are published through it and the releases published before I4 without evaluation are resubmitted",
      "sequence": "01.08.05",
      "description": "As a platform admin, I want the seeded Draft releases of the first outcome and the releases published before I4 without an evaluation record taken through the gate, and the seed removed, so that every release a run can pin was evaluated where a suite exists and approved, with no exception left in the registry. The thin delivery of the first outcome resolved and loaded seeded Draft releases, under the amendment of ADR-0021 that lets a Draft workflow or agent release run only in the acceptance environment and in internal projects until the evaluation gate exists, and that removes the rule when the gate is delivered. This PBI makes the registry side of that removal true. The twenty-six seeded releases of the six chain definitions, their nine agents and the eleven model profiles of model/model-profiles.yaml that the thin delivery seeds (D121, D123) pass the gate like any candidate: each is submitted from its Draft row, which moves that row to InReview without a second row as AIFACTORY-US-415 states for a version that exists as a Draft release, its closure is resolved, it is evaluated, approved by someone who is not the author, a Reviewer for a workflow or an agent release and a Platform admin for a model profile release, and published, and its alias is moved to the Published release. The owner decided that the publication path is delivered in I2 (D140), so the releases of the workflow features of I2, I3 and I4 were published before this delivery on their closure and their approval, without an evaluation verdict. A release published before I4 without an evaluation record, of an asset kind for which an evaluation suite exists from this delivery, is resubmitted through the evaluation gate as a new version with a new release id, and the gate checks the evidence the registry recorded itself from `EvaluationCompleted` through `RecordEvaluationEvidence` of AIFACTORY-US-1562, with no synchronous call to QualityScoreService (D141): the Published release itself stays immutable and loadable by its id for the runs that pinned it, the new version is evaluated, approved and published like any candidate, and the aliases that pointed at the earlier release are moved to it (D140). A release of a kind without a suite keeps its publication of I2. For the eleven model profile releases, which were loadable by alias as Draft releases in the thin delivery, the approval by a Platform admin who is not the author becomes required with this delivery (D121). After that the seed loader, the fakes and the static answers of the first outcome are deleted from the service, and the service registers no release by itself. From then on `AgentRegistryService/AssetPublication.ResolveRelease` resolves an alias to a Published release, since an alias can only be moved to one, and `AgentRegistryService/AssetPublication.LoadRelease` streams the manifest and the closure content references of the release a run pinned, also when that release was deprecated meanwhile, because deprecation keeps the manifest readable. The contract of the two methods does not change: the request messages and the reply message that the contract test of the thin delivery fixes are kept, a Published release now carries the publication fields `publishedAt`, `publishedBy`, `evaluation` and `approval` and validates against `release-manifest-v1` in full, the statuses for a missing workload identity, a missing service scope, an invalid request and a release of another tenant are those of the thin delivery, and the callers RunControlService, WorkflowEngineService and AgentRuntimeService are not rebuilt. Whether a new run may pin a Deprecated release is not decided by the registry: RunControlService refuses it on `AssetReleaseDeprecated`. A Revoked release is different (D119): the registry itself never resolves it for a new pin, by its release id or through an alias. The owner decided what happens to an alias that points at a release when it is revoked (D121): the revocation neither moves nor removes it, so the alias stays in place and visible, and `AssetPublication.ResolveRelease` through that alias resolves nothing and answers FAILED_PRECONDITION with a status message that names the revoked release, until an administrator moves the alias to a Published release through `MoveAlias` (AIFACTORY-US-419). The answer tells the caller that the alias exists and that its release was withdrawn, which NOT_FOUND would hide; RunControlService accepts no run on it and answers `SubmitRun` with 409 naming the gate for as long as the alias points there. A resolution by the release id of a Revoked release answers the same way, FAILED_PRECONDITION with a status message that names the revoked release, as the owner decided (D123). `AssetPublication.LoadRelease` keeps streaming the unchanged manifest of a Revoked release by release id for the runs that pinned it before the revocation, to which RunControlService applies the stated in-flight policy (AIFACTORY-US-736, D123). The policy rule that waived Draft releases is removed by the feature that owns policy; this PBI guarantees that no alias points at a Draft release once it is gone. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/AssetPublication.ResolveRelease, AgentRegistryService/AssetPublication.LoadRelease; descriptors: release-manifest-v1; adrs: ADR-0015, ADR-0021; requirements: FR-02, XL-15. Depends on: AIFACTORY-US-1562, feature:agent-registry-service-publication, feature:agent-registry-service-thin. Sources: model/services/control-plane/AgentRegistryService.yaml, model/backlog/features/control-plane.yaml, docs/architecture/adr/0021-quality-gates.md, docs/planes/control/registries.md.",
      "acceptanceCriteria": [
        "AC1: Given the twenty-six seeded Draft releases of the thin delivery, the eleven model profile releases among them (D121, D123), when each has been submitted from its Draft row, which moves that row to InReview without a second row as AC2 of AIFACTORY-US-415 states, and has been evaluated, approved by someone who is not its author, a Platform admin for each model profile release and a Reviewer for every other one, and published through the gate and its alias moved, then `AgentRegistryService/AssetPublication.ResolveRelease` resolves each alias to a Published release with an evaluation record reference, recorded by `RecordEvaluationEvidence` and checked at the gate without a synchronous call (D141), and an approval, and no alias points at a Draft release; given a release Published before I4 without an evaluation record, of a kind for which a suite exists, when it is resubmitted through the gate as a new version, then the new version is Published with an evaluation record reference, its aliases resolve to it, and the earlier release is unchanged and still loadable by its id (D140, ADR-0021, model/backlog/features/control-plane.yaml).",
        "AC2: Given the seed loader, the fakes and the static answers of the first outcome are deleted, when the service starts on an empty store, then it registers no release by itself, and the contract test shows `AgentRegistryService/AssetPublication.ResolveRelease` and `AgentRegistryService/AssetPublication.LoadRelease` with their request and reply messages unchanged, and the reply for a Published release validates against `release-manifest-v1` in full (model/services/control-plane/AgentRegistryService.yaml).",
        "AC3: Given a run that pinned a release which is now Deprecated, when the runtime loads it by release id through `AgentRegistryService/AssetPublication.LoadRelease`, then the stream delivers the same manifest and closure content references as before the deprecation (FR-02, docs/planes/control/registries.md).",
        "AC4: Given the callers RunControlService, WorkflowEngineService and AgentRuntimeService built against the thin delivery, when they run against the complete service, then resolution and loading succeed without a rebuild of the callers and a release of another tenant is still answered NOT_FOUND (ADR-0015, XL-15).",
        "AC5: Given a Revoked release and an alias that pointed at it when it was revoked, when `AgentRegistryService/AssetPublication.ResolveRelease` is called with that alias, then the call answers FAILED_PRECONDITION with a status message that names the revoked release, no release is returned for a new pin, nothing is written and the alias still points at the revoked release in `ReleaseAliases` (D121); when it is called with the release id of the Revoked release, then it answers FAILED_PRECONDITION with a status message that names the revoked release as well and no release is returned (D123); when the alias has been moved to a Published release, then the same call resolves it to that release; when a run that pinned the release before its revocation loads it by release id through `AgentRegistryService/AssetPublication.LoadRelease`, then the stream delivers the same manifest and closure content references as before the revocation (FR-02, model/services/control-plane/AgentRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/backlog/features/control-plane.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/control/registries.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-370",
        "AIFACTORY-TASK-1699",
        "AIFACTORY-TASK-6344",
        "AIFACTORY-TASK-2654",
        "AIFACTORY-TASK-1700"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12405,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "AgentRegistryService/AssetPublication.LoadRelease"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "XL-15"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1562",
        "feature:agent-registry-service-publication",
        "feature:agent-registry-service-thin"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/backlog/features/control-plane.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/control/registries.md"
      ],
      "titlePrefix": "[AIFACTORY-US-421]",
      "number": 421
    },
    {
      "id": "AIFACTORY-TASK-370",
      "type": "task",
      "parent": "AIFACTORY-US-421",
      "title": "Retire the thin scope and the stubs of AgentRegistryService",
      "sequence": "01.08.05.01",
      "description": "Retire the thin scope and the stubs of AgentRegistryService. Expected output: Callers run against the complete service; the seed loader with its configuration key Publication:Seed:Path and its readiness check, the fakes and the static answers of the first outcome are deleted, the service registers no release by itself, and the contract test of the request and reply messages of AssetPublication.ResolveRelease and AssetPublication.LoadRelease passes unchanged, with the reply of a Published release validating against release-manifest-v1 in full.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Callers run against the complete service; the seed loader with its configuration key Publication:Seed:Path and its readiness check, the fakes and the static answers of the first outcome are deleted, the service registers no release by itself, and the contract test of the request and reply messages of AssetPublication.ResolveRelease and AssetPublication.LoadRelease passes unchanged, with the reply of a Published release validating against release-manifest-v1 in full."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-370]",
      "number": 370
    },
    {
      "id": "AIFACTORY-TASK-1699",
      "type": "task",
      "parent": "AIFACTORY-US-421",
      "title": "Publish the twenty-six seeded releases through the gate and move their aliases",
      "sequence": "01.08.05.02",
      "description": "Publish the twenty-six seeded releases through the gate and move their aliases. Expected output: A migration runbook and its script submit the releases of the six chain definitions, their nine agents and the eleven model profiles from their source commits, each onto its seeded Draft row (AC2 of AIFACTORY-US-415), wait for closure and evaluation, leave the publication approval to a Reviewer who is not the author and, for the eleven model profile releases, to a Platform admin who is not the author (D121, D123), move each alias to the Published release and report every release with its evaluation record reference and approval; a release that fails a gate is listed with the gate and keeps its Draft seed until it passes.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "A migration runbook and its script submit the releases of the six chain definitions, their nine agents and the eleven model profiles from their source commits, each onto its seeded Draft row (AC2 of AIFACTORY-US-415), wait for closure and evaluation, leave the publication approval to a Reviewer who is not the author and, for the eleven model profile releases, to a Platform admin who is not the author (D121, D123), move each alias to the Published release and report every release with its evaluation record reference and approval; a release that fails a gate is listed with the gate and keeps its Draft seed until it passes."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12405,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1699]",
      "number": 1699
    },
    {
      "id": "AIFACTORY-TASK-6344",
      "type": "task",
      "parent": "AIFACTORY-US-421",
      "title": "Resubmit as new versions through the gate the releases published before I4 without an evaluation record",
      "sequence": "01.08.05.03",
      "description": "Resubmit as new versions through the gate the releases published before I4 without an evaluation record. Expected output: A migration runbook and its script list every Published release of the tenants and of the platform tenant that carries no evaluation record and whose asset kind has an evaluation suite from this delivery, submit for each a new version from its source commit through SubmitRelease, wait for closure, evaluation and the approval of a Reviewer who is not the author, or of a Platform admin for a ModelProfile release, move each alias that pointed at the earlier release to the new Published version and report every pair of releases with the evaluation record reference of the new one; the earlier release stays Published, immutable and loadable by its id for the runs that pinned it (D140); a new version that fails a gate is listed with the gate and the alias keeps pointing at the earlier release until it passes.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "A migration runbook and its script list every Published release of the tenants and of the platform tenant that carries no evaluation record and whose asset kind has an evaluation suite from this delivery, submit for each a new version from its source commit through SubmitRelease, wait for closure, evaluation and the approval of a Reviewer who is not the author, or of a Platform admin for a ModelProfile release, move each alias that pointed at the earlier release to the new Published version and report every pair of releases with the evaluation record reference of the new one; the earlier release stays Published, immutable and loadable by its id for the runs that pinned it (D140); a new version that fails a gate is listed with the gate and the alias keeps pointing at the earlier release until it passes."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12405,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-6344]",
      "number": 6344
    },
    {
      "id": "AIFACTORY-TASK-2654",
      "type": "task",
      "parent": "AIFACTORY-US-421",
      "title": "ResolveRelease never resolving a Revoked release for a new pin",
      "sequence": "01.08.05.04",
      "description": "ResolveRelease never resolving a Revoked release for a new pin. Expected output: AssetPublication.ResolveRelease returns no release when the release id it is given, or the release an alias points at, is in the state Revoked, so that RunControlService accepts no run on a revoked release (D119); a resolution through an alias that points at a Revoked release answers FAILED_PRECONDITION with a status message that names the revoked release and leaves the alias in place, until the alias is moved to a Published release (D121); a resolution by the release id of a Revoked release answers the same way, FAILED_PRECONDITION with a status message that names the revoked release (D123); the refusal writes nothing, a release of another tenant is still answered NOT_FOUND, and AssetPublication.LoadRelease keeps streaming a Revoked release by its release id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "AssetPublication.ResolveRelease returns no release when the release id it is given, or the release an alias points at, is in the state Revoked, so that RunControlService accepts no run on a revoked release (D119); a resolution through an alias that points at a Revoked release answers FAILED_PRECONDITION with a status message that names the revoked release and leaves the alias in place, until the alias is moved to a Published release (D121); a resolution by the release id of a Revoked release answers the same way, FAILED_PRECONDITION with a status message that names the revoked release (D123); the refusal writes nothing, a release of another tenant is still answered NOT_FOUND, and AssetPublication.LoadRelease keeps streaming a Revoked release by its release id."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2654]",
      "number": 2654
    },
    {
      "id": "AIFACTORY-TASK-1700",
      "type": "task",
      "parent": "AIFACTORY-US-421",
      "title": "Verify resolution and loading after the gate",
      "sequence": "01.08.05.05",
      "description": "Verify resolution and loading after the gate. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ResolveAndLoadAfterTheGate\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-421: every alias on a Published release, a release published before I4 without an evaluation record resubmitted as a new version whose aliases move to it while the earlier release stays loadable by its id (D140), an empty store after start, a Deprecated release still loadable by its id, an alias of a Revoked release that stays in place and whose resolution answers FAILED_PRECONDITION naming the release until the alias is moved to a Published one, a Revoked release whose resolution by its id answers FAILED_PRECONDITION naming it and that is still loadable by its id, and the unchanged contract of the two gRPC methods against release-manifest-v1.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ResolveAndLoadAfterTheGate\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-421: every alias on a Published release, a release published before I4 without an evaluation record resubmitted as a new version whose aliases move to it while the earlier release stays loadable by its id (D140), an empty store after start, a Deprecated release still loadable by its id, an alias of a Revoked release that stays in place and whose resolution answers FAILED_PRECONDITION naming the release until the alias is moved to a Published one, a Revoked release whose resolution by its id answers FAILED_PRECONDITION naming it and that is still loadable by its id, and the unchanged contract of the two gRPC methods against release-manifest-v1."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1700]",
      "number": 1700
    },
    {
      "id": "AIFACTORY-US-536",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "Revoke a release as a Platform admin with a required reason and the in-flight policy for the runs pinned to it",
      "sequence": "01.08.06",
      "description": "As a platform admin, I want to revoke a release for a security or policy reason and to state what happens to the runs that already pinned it, so that a compromised or forbidden release stops being used at once and the act is on record with its reason. A revocation is the security or policy action on a release, and D117 makes it a REST command of the Platform admin. A caller whose scope carries `factory.assets.publish` and who holds the Platform admin role revokes a release through the gateway route of `AgentRegistryService/RevokeRelease`, addressed by `releaseId`. The body carries two required members: the `reason`, a security or policy reason, and the `inFlightPolicy` for the runs that already pinned the release, one of finish, drain or revoke, the values model/services/agent-mesh/AgentRuntimeService.yaml lists. The command applies the revocation of the aggregate that AIFACTORY-US-417 delivers. A Published release and a Deprecated release move to the state Revoked through the transition `Revoke` and keep the reason in `withdrawalReason` and the policy in `inFlightPolicy`, those the revocation states (D119). No transition leaves Revoked, and a revoked release is never pinned, aliased or published again. Two outbox records are written in the transaction of the command: `AssetReleaseRevoked` with `releaseId`, `tenantId`, `reason` and `inFlightPolicy`, and an `audit-evidence-v1` record of action `release-revoked` that names the Platform admin as actor, the release as subject with its `manifestHash`, the reason and the outcome, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope (D115). The response is 200 with the release. The stored manifest is not changed, so the release stays readable and loadable by its id, and the registry repoints no run and moves no alias: an alias that points at the release stays in place and visible, and a resolution through it answers FAILED_PRECONDITION naming the revoked release until an administrator moves the alias (D121, AIFACTORY-US-421). On the event RunControlService applies the stated policy to every run that is not terminal and whose pinned release closure holds the release, child runs included: under finish the runs continue to their end, under drain the step that is running finishes, no further step is dispatched and the run ends Cancelled with the reason release-revoked, and under revoke the run is cancelled at once with the same reason (D123, AIFACTORY-US-736). AgentRuntimeService interrupts the running attempts of those runs under revoke, lets them finish under drain and does nothing under finish, AgentCardService withdraws the card and AuditService records the evidence, each in its own PBI. The operation is naturally idempotent: a repeated call that names the reason and the policy the release already keeps returns 200, changes nothing and writes no second event and no second evidence. A body without a reason, without an in-flight policy or with a policy outside the three values is refused with 400. A caller without the scope, or with the scope and without the Platform admin role, such as a Reviewer or an asset maintainer, is refused with 403. A release that does not exist in the tenant of the caller is answered 404, which is also the answer for a release of another tenant (ADR-0015). A release that is Draft or InReview is answered 409, because the model holds the transition `Revoke` from Published and from Deprecated only (D119). A release that is already Revoked and is named with another reason or another policy is answered 409 too, because no transition leaves Revoked and the reason and the policy of a revocation are not rewritten. A refused call changes nothing and publishes nothing, and a command that rolls back leaves no state change, no event and no evidence. The route of the command is generated from the fronts file of ControlPlaneApi under the publication route class; the gateway forwards the user token and decides nothing about the revocation. Kind: behavior. Traces: services: AgentRegistryService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/RevokeRelease; events: AgentRegistryService/AssetReleaseRevoked; descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015; requirements: FR-02, NFR-02; scenarios: SCN-AgentRegistryService-014. Depends on: AIFACTORY-US-417, feature:component-audit-factory-evidence, feature:contracts-package. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/planes/control/registries.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/reference/schemas/audit-evidence.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a Published release, and likewise a Deprecated one, and a Platform admin whose scope carries `factory.assets.publish`, when `AgentRegistryService/RevokeRelease` is called with a `reason` and an `inFlightPolicy` of finish, drain or revoke, then the response is 200, the `AgentRegistryService/AssetRelease` is in the state Revoked through `Revoke` (D119) and keeps the reason in `withdrawalReason` and the policy in `inFlightPolicy`, its stored manifest is unchanged, and the `AgentRegistryService/AssetReleaseRevoked` outbox record with `releaseId`, `tenantId`, `reason` and `inFlightPolicy` and an `audit-evidence-v1` record of action `release-revoked` that names the actor, the release as subject with its `manifestHash`, the reason and the outcome are written in the transaction of the command (SCN-AgentRegistryService-014, ADR-0014).",
        "AC2: Given a body without a `reason`, without an `inFlightPolicy` or with a policy other than finish, drain or revoke, when `AgentRegistryService/RevokeRelease` is called, then the answer is 400 with a problem response that names the member; given a caller without `factory.assets.publish`, or with the scope and without the Platform admin role, then the answer is 403; given a `releaseId` of another tenant or one that does not exist, then the answer is 404 for both alike; in each case the release keeps its state and no event and no evidence is written (SCN-AgentRegistryService-014, ADR-0015).",
        "AC3: Given a Draft or an InReview release, when `AgentRegistryService/RevokeRelease` is called, then the answer is 409; given a release this command already revoked, when the call is repeated with the same reason and policy, then it returns 200, changes nothing and writes no second outbox record and no second evidence; given a Revoked release named with another reason or another policy, then the answer is 409, because model/services/control-plane/AgentRegistryService.yaml holds the transition `Revoke` from Published and from Deprecated and none out of Revoked (SCN-AgentRegistryService-014, D119).",
        "AC4: Given a revocation whose transaction rolls back after the transition, when the store and the outbox are read, then the release is still in the state it had, Published or Deprecated, and neither `AgentRegistryService/AssetReleaseRevoked` nor an evidence record exists; given a committed revocation, when the release is read from the store by its id, then its manifest and closure are the ones it had before, so a run that pinned it is repointed by nobody (SCN-AgentRegistryService-014, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/registries.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2151",
        "AIFACTORY-TASK-2152"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12406,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/RevokeRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleaseRevoked"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-02",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-014"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-417",
        "feature:component-audit-factory-evidence",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/registries.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-536]",
      "number": 536
    },
    {
      "id": "AIFACTORY-TASK-2151",
      "type": "task",
      "parent": "AIFACTORY-US-536",
      "title": "RevokeRelease as a REST command of the Platform admin with the required reason, the in-flight policy and the natural repeat",
      "sequence": "01.08.06.01",
      "description": "RevokeRelease as a REST command of the Platform admin with the required reason, the in-flight policy and the natural repeat. Expected output: RevokeRelease is hosted on POST /factory/asset-releases/{releaseId}/revoke under factory.assets.publish with the side-effect class publication and natural idempotency and is listed in the service descriptor file with the codes 200, 400, 403, 404 and 409; it admits only a caller with the Platform admin role, validates the reason and the inFlightPolicy (finish, drain or revoke), applies the revocation of the aggregate of AIFACTORY-TASK-541 to a Published or a Deprecated release, which ends in the state Revoked (D119), so that the release keeps the reason and the policy and AssetReleaseRevoked and the audit-evidence-v1 record of action release-revoked are written in the transaction of the command (D115), returns 200 without a second event or evidence on a repeat with the same reason and policy, and answers 400, 403, 404 (also for a release of another tenant, ADR-0015) and 409 as AIFACTORY-US-536 states.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "RevokeRelease is hosted on POST /factory/asset-releases/{releaseId}/revoke under factory.assets.publish with the side-effect class publication and natural idempotency and is listed in the service descriptor file with the codes 200, 400, 403, 404 and 409; it admits only a caller with the Platform admin role, validates the reason and the inFlightPolicy (finish, drain or revoke), applies the revocation of the aggregate of AIFACTORY-TASK-541 to a Published or a Deprecated release, which ends in the state Revoked (D119), so that the release keeps the reason and the policy and AssetReleaseRevoked and the audit-evidence-v1 record of action release-revoked are written in the transaction of the command (D115), returns 200 without a second event or evidence on a repeat with the same reason and policy, and answers 400, 403, 404 (also for a release of another tenant, ADR-0015) and 409 as AIFACTORY-US-536 states."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2151]",
      "number": 2151
    },
    {
      "id": "AIFACTORY-TASK-2152",
      "type": "task",
      "parent": "AIFACTORY-US-536",
      "title": "Verify revoke-a-release-as-platform-admin through the acceptance suite",
      "sequence": "01.08.06.02",
      "description": "Verify revoke-a-release-as-platform-admin through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-014\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-536: a revocation by a Platform admin with its reason and policy kept on the release, the event and the evidence record in one transaction and none after a rollback, the 400 of a missing reason and of a missing or unknown policy, the 403 of a Reviewer and of an asset maintainer who hold the scope, the 404 of a foreign and of an unknown release, the revocation of a Deprecated release that ends in the state Revoked, the 409 of a Draft, an InReview and a differently named Revoked release, and the repeat without a second event.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-014\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-536: a revocation by a Platform admin with its reason and policy kept on the release, the event and the evidence record in one transaction and none after a rollback, the 400 of a missing reason and of a missing or unknown policy, the 403 of a Reviewer and of an asset maintainer who hold the scope, the 404 of a foreign and of an unknown release, the revocation of a Deprecated release that ends in the state Revoked, the 409 of a Draft, an InReview and a differently named Revoked release, and the repeat without a second event."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12406,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2152]",
      "number": 2152
    },
    {
      "id": "AIFACTORY-US-736",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "RunControlService applies the in-flight policy of a revocation to the runs that already pinned the revoked release",
      "sequence": "01.08.07",
      "description": "As a platform admin, I want the in-flight policy I state with a revocation applied to the runs that already pinned the release, so that a revoked release stops being used in the way the revocation says and no run is silently moved to another release. A revocation states an in-flight policy for the runs that already pinned the release, one of finish, drain or revoke (AIFACTORY-US-536), and `AssetReleaseRevoked` carries it with `releaseId`, `tenantId`, `reason` and `inFlightPolicy`. The registry repoints no run and stops none: the service that owns the runs acts on the event. This PBI delivers that act, the part of the inbox handler `ApplyRevocationPolicy` of RunControlService that concerns the runs already pinned, in the repository ConnectSoft.AI.SoftwareFactory.RunControlService. It belongs to this feature because the event is first published by the complete registry; before it the handler has no publisher. The other part of the same handler is delivered with feature `run-control-service`: it keeps the state Revoked of the release in `GateStates`, so that `SubmitRun` refuses a run that would pin it with 409 (AIFACTORY-TASK-1491), and that answer also holds while the alias of a submission points at the revoked release, until an administrator moves the alias (D121). The owner decided what each of the three values does to a run (D123), the model of RunControlService states it with its transitions and triggers, and this PBI delivers exactly that. The handler consumes `AssetReleaseRevoked` in the inbox of the service, once per event id and inside the tenant of the envelope. The policy covers every run of that tenant that is not terminal, that is neither Completed nor Failed nor Cancelled, and whose pinned release closure holds the revoked release. That is a run whose `releaseId` is the revoked release, a run whose pinned release only has the revoked release in its closure, and a child run, which inherits the pinned release closure of its parent (D119) and is selected in its own right. Under finish nothing changes: the selected runs continue to their end, no cancellation intent is recorded and nothing is published for them. Under drain the step that is running finishes, no further step is dispatched, and the run then follows the cancellation path and ends Cancelled with the reason release-revoked: a Running run moves to Cancelling through the trigger `ReleaseRevokedAfterRunningStepSettled` once its running step has settled and to Cancelled through `AllAttemptsSettled`, while a run in which no step is running, Accepted or Held, has nothing to finish and takes the cancellation path at once, by the transitions the model holds from Accepted and from Held to Cancelled. Under revoke the run follows the cancellation path at once and ends Cancelled with the same reason: an Accepted run moves to Cancelled through `ReleaseRevokedBeforeDispatch`, a Held run through `ReleaseRevokedWhileHeld`, and a Running or a WaitingForApproval run moves to Cancelling through `ReleaseRevoked` and to Cancelled once all its attempts have settled, and an attempt that is open is interrupted as for `CancelRun`. For drain and for revoke the handler records a cancellation intent with the reason release-revoked and the actor system, as for a stop on `BudgetExceeded`, and `RunCancelled` carries that reason; the run is Cancelled and never Failed. A run that is already Cancelling keeps the intent and the reason it has, because the model holds no revocation transition out of Cancelling. The work on a running attempt is divided with AgentRuntimeService, whose handler `ApplyInFlightPolicy` consumes the same event and is delivered by feature `agent-runtime-service`: under revoke the runtime interrupts the running attempt, which ends Cancelled with the failure class cancellation, under drain it lets the attempt finish, under finish it does nothing, and in every case it keeps the manifest the attempt already loaded. RunControlService owns the run, which means the selection, the cancellation intent, the transitions, the stop of dispatch under drain and the settlement of the attempts. Whatever the policy, no run is repointed: the pinned `releaseId`, the policy revision and the snapshot of a run never change, the manifest of the revoked release stays loadable by its release id for as long as a pinned run needs it (AIFACTORY-US-421), and every state change of a run is committed in the same transaction as its outbox record. A run whose pinned closure does not hold the revoked release, a terminal run and a run of another tenant are not touched, and a redelivered event applies nothing twice. The selection reads the table `RunPinnedReleases`, in which RunControlService keeps, at acceptance, one row per release of the pinned closure of a run, the release id of every closure member that `resolved-execution-snapshot-v1` names, and a child run its own rows (D125, AIFACTORY-US-005 and AIFACTORY-US-656 of feature `run-control-service`); the handler finds the runs of the revoked release by that table under the tenant row filter. A run that waits in WaitingForApproval under drain has no step running and takes the transition `ReleaseRevoked` to Cancelling at once, and a run already Cancelling keeps the reason it has, as the owner decided (D125). The handling is proven in the suite of RunControlService with events built from the pinned contracts package, and once against the publishing registry. Kind: behavior. Traces: services: AgentRegistryService, RunControlService; aggregates: AgentRegistryService/AssetRelease, RunControlService/Run; apis: AgentRegistryService/RevokeRelease, AgentRegistryService/AssetPublication.LoadRelease, RunControlService/SubmitRun, RunControlService/CancelRun; events: AgentRegistryService/AssetReleaseRevoked, RunControlService/RunCancelled; descriptors: run-event-envelope-v1; adrs: ADR-0014, ADR-0015; requirements: FR-02, NFR-02. Depends on: AIFACTORY-US-421, AIFACTORY-US-536, feature:run-control-service, feature:contracts-package. Sources: model/services/control-plane/RunControlService.yaml, model/services/control-plane/AgentRegistryService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/planes/control/registries.md.",
      "acceptanceCriteria": [
        "AC1: Given, in one tenant, a non-terminal run whose `releaseId` is a release, a non-terminal run whose pinned release closure holds that release without pinning it, an open child run that inherited that closure from its parent, a run whose pinned closure does not hold the release and a Completed run pinned to the release, and a run of another tenant pinned to it, when `AgentRegistryService/AssetReleaseRevoked` for that release and tenant is handled by `ApplyRevocationPolicy`, then exactly the first three `RunControlService/Run` rows are selected and the `inFlightPolicy` of the event is applied to each of them, the other three runs are unchanged, and a redelivery of the event under the same event id selects and applies nothing again (D123, model/services/control-plane/RunControlService.yaml).",
        "AC2: Given each of the three policies finish, drain and revoke, when the handler has applied it to a pinned run, then the `releaseId`, the `policyRevision` and the `snapshotId` of the run are the ones it pinned at acceptance, the revoked release is still streamed by its release id through `AgentRegistryService/AssetPublication.LoadRelease`, and every state change of a run was committed with its outbox record in one transaction, so that no run is repointed and no transition is announced without being committed (model/services/control-plane/RunControlService.yaml, FR-02).",
        "AC3: Given the policy finish, when the event is handled, then every selected `RunControlService/Run` keeps its state and continues to its end, no cancellation intent is recorded and nothing is written to the outbox for it; given the policy drain and a Running run with a step that is running, then that step finishes, no further step is dispatched, a cancellation intent with the reason release-revoked and the actor system is recorded, the run moves to Cancelling through `ReleaseRevokedAfterRunningStepSettled` once the step has settled and ends Cancelled, and `RunControlService/RunCancelled` carries the reason release-revoked; given the policy drain and an Accepted or a Held run, then the run is Cancelled at once with the same intent and reason and no attempt is dispatched for it; no drained run ends Failed (D123, model/services/control-plane/RunControlService.yaml).",
        "AC4: Given the policy revoke, when the event is handled, then a cancellation intent with the reason release-revoked and the actor system is recorded for every selected run, an Accepted run moves to Cancelled through `ReleaseRevokedBeforeDispatch`, a Held run through `ReleaseRevokedWhileHeld`, and a Running or a WaitingForApproval run moves to Cancelling through `ReleaseRevoked`, its open attempt is interrupted as for `RunControlService/CancelRun`, and it ends Cancelled once all its attempts have settled; `RunControlService/RunCancelled` is written once per run with the reason release-revoked, a parent run and its child run that were both selected each end Cancelled with that reason, a run that was already Cancelling gets no second intent, and no revoked run ends Failed (D123, model/services/control-plane/RunControlService.yaml).",
        "AC5: Given a Published release that a non-terminal run pinned, when a Platform admin revokes it through `AgentRegistryService/RevokeRelease` with the in-flight policy revoke, then `AgentRegistryService/AssetReleaseRevoked` reaches `ApplyRevocationPolicy` of RunControlService once, that run ends Cancelled with the reason release-revoked, and `RunControlService/SubmitRun` for that release, by its release id or through an alias that still points at it, answers 409 with a problem body that names the gate (D119, D121, D123, model/services/control-plane/RunControlService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/registries.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2971",
        "AIFACTORY-TASK-3551",
        "AIFACTORY-TASK-2972",
        "AIFACTORY-TASK-2973"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12407,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService",
          "RunControlService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease",
          "RunControlService/Run"
        ],
        "apis": [
          "AgentRegistryService/RevokeRelease",
          "AgentRegistryService/AssetPublication.LoadRelease",
          "RunControlService/SubmitRun",
          "RunControlService/CancelRun"
        ],
        "events": [
          "AgentRegistryService/AssetReleaseRevoked",
          "RunControlService/RunCancelled"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-02",
          "NFR-02"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-421",
        "AIFACTORY-US-536",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/control/registries.md"
      ],
      "titlePrefix": "[AIFACTORY-US-736]",
      "number": 736
    },
    {
      "id": "AIFACTORY-TASK-2971",
      "type": "task",
      "parent": "AIFACTORY-US-736",
      "title": "Selection of the runs whose pinned closure holds the revoked release and policy dispatch of the inbox handler ApplyRevocationPolicy",
      "sequence": "01.08.07.01",
      "description": "Selection of the runs whose pinned closure holds the revoked release and policy dispatch of the inbox handler ApplyRevocationPolicy. Expected output: In ConnectSoft.AI.SoftwareFactory.RunControlService the handler of AssetReleaseRevoked, beside the GateStates row it keeps (AIFACTORY-TASK-1491), selects the runs of the tenant of the envelope that are not terminal and whose pinned release closure holds the revoked release, which are the runs that pinned it, the runs whose pinned release has it in its closure and the child runs that inherited such a closure, each selected in its own right (D123), and hands each of them to one policy component with a branch for each of finish, drain and revoke, whose effects AIFACTORY-TASK-3551 delivers; the runs are found through the table RunPinnedReleases under the tenant row filter, by the release id the event names (D125); the handler is idempotent on the event id, touches no run of another tenant, no terminal run and no run whose pinned closure does not hold the release, never changes the releaseId, the policyRevision or the snapshotId of a run, and commits every state change of a run with its outbox record in one transaction.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "In ConnectSoft.AI.SoftwareFactory.RunControlService the handler of AssetReleaseRevoked, beside the GateStates row it keeps (AIFACTORY-TASK-1491), selects the runs of the tenant of the envelope that are not terminal and whose pinned release closure holds the revoked release, which are the runs that pinned it, the runs whose pinned release has it in its closure and the child runs that inherited such a closure, each selected in its own right (D123), and hands each of them to one policy component with a branch for each of finish, drain and revoke, whose effects AIFACTORY-TASK-3551 delivers; the runs are found through the table RunPinnedReleases under the tenant row filter, by the release id the event names (D125); the handler is idempotent on the event id, touches no run of another tenant, no terminal run and no run whose pinned closure does not hold the release, never changes the releaseId, the policyRevision or the snapshotId of a run, and commits every state change of a run with its outbox record in one transaction."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2971]",
      "number": 2971
    },
    {
      "id": "AIFACTORY-TASK-3551",
      "type": "task",
      "parent": "AIFACTORY-US-736",
      "title": "Branches finish, drain and revoke of the in-flight policy: the cancellation intent with the reason release-revoked, the revocation transitions of the run and the stop of dispatch under drain",
      "sequence": "01.08.07.02",
      "description": "Branches finish, drain and revoke of the in-flight policy: the cancellation intent with the reason release-revoked, the revocation transitions of the run and the stop of dispatch under drain. Expected output: The policy component applies to a selected run the effect model/services/control-plane/RunControlService.yaml states for each value (D123): finish changes nothing and the run continues to its end; drain records a cancellation intent with the reason release-revoked and the actor system, lets the step that is running finish, makes the dispatcher dispatch no further step of the run, moves a Running run to Cancelling through ReleaseRevokedAfterRunningStepSettled once that step has settled and cancels an Accepted or a Held run at once; revoke records the same intent and moves an Accepted run to Cancelled through ReleaseRevokedBeforeDispatch, a Held run through ReleaseRevokedWhileHeld and a Running or a WaitingForApproval run to Cancelling through ReleaseRevoked, requesting the interruption of an open attempt as CancelRun does; Cancelling ends in Cancelled through AllAttemptsSettled, RunCancelled is written once per run with the reason release-revoked, no stopped run ends Failed, a run that is already Cancelling gets no second intent, a run in WaitingForApproval under drain takes the transition ReleaseRevoked at once and a run already Cancelling keeps its reason (D125), and every transition is committed with its outbox record in one transaction.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The policy component applies to a selected run the effect model/services/control-plane/RunControlService.yaml states for each value (D123): finish changes nothing and the run continues to its end; drain records a cancellation intent with the reason release-revoked and the actor system, lets the step that is running finish, makes the dispatcher dispatch no further step of the run, moves a Running run to Cancelling through ReleaseRevokedAfterRunningStepSettled once that step has settled and cancels an Accepted or a Held run at once; revoke records the same intent and moves an Accepted run to Cancelled through ReleaseRevokedBeforeDispatch, a Held run through ReleaseRevokedWhileHeld and a Running or a WaitingForApproval run to Cancelling through ReleaseRevoked, requesting the interruption of an open attempt as CancelRun does; Cancelling ends in Cancelled through AllAttemptsSettled, RunCancelled is written once per run with the reason release-revoked, no stopped run ends Failed, a run that is already Cancelling gets no second intent, a run in WaitingForApproval under drain takes the transition ReleaseRevoked at once and a run already Cancelling keeps its reason (D125), and every transition is committed with its outbox record in one transaction."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3551]",
      "number": 3551
    },
    {
      "id": "AIFACTORY-TASK-2972",
      "type": "task",
      "parent": "AIFACTORY-US-736",
      "title": "Fixture publisher of AssetReleaseRevoked and runs whose pinned closure holds the release in every non-terminal state",
      "sequence": "01.08.07.03",
      "description": "Fixture publisher of AssetReleaseRevoked and runs whose pinned closure holds the release in every non-terminal state. Expected output: The acceptance suite of ConnectSoft.AI.SoftwareFactory.RunControlService holds a fixture publisher that sends AssetReleaseRevoked under run-event-envelope-v1 from the pinned contracts package with a stated releaseId, tenantId, reason and inFlightPolicy of finish, drain or revoke, and a fixture that creates runs in the states Accepted, Running, WaitingForApproval, Held and Cancelling that pinned that release, a run whose pinned release has it in its closure only, a parent run with an open child run that inherited the closure, a Completed run pinned to it, a run whose pinned closure does not hold it and a run of another tenant; the fixture lets the running step of a run settle and an open attempt report its outcome on demand, so that the drain and the interruption are reproducible without AgentRuntimeService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite of ConnectSoft.AI.SoftwareFactory.RunControlService holds a fixture publisher that sends AssetReleaseRevoked under run-event-envelope-v1 from the pinned contracts package with a stated releaseId, tenantId, reason and inFlightPolicy of finish, drain or revoke, and a fixture that creates runs in the states Accepted, Running, WaitingForApproval, Held and Cancelling that pinned that release, a run whose pinned release has it in its closure only, a parent run with an open child run that inherited the closure, a Completed run pinned to it, a run whose pinned closure does not hold it and a run of another tenant; the fixture lets the running step of a run settle and an open attempt report its outcome on demand, so that the drain and the interruption are reproducible without AgentRuntimeService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12407,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2972]",
      "number": 2972
    },
    {
      "id": "AIFACTORY-TASK-2973",
      "type": "task",
      "parent": "AIFACTORY-US-736",
      "title": "Verify the application of the in-flight policy to pinned runs through the acceptance suite of RunControlService",
      "sequence": "01.08.07.04",
      "description": "Verify the application of the in-flight policy to pinned runs through the acceptance suite of RunControlService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RevocationInFlightPolicy\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-736: the selection of exactly the non-terminal runs whose pinned closure holds the revoked release, child runs included, the redelivery that applies nothing twice, the pinned releaseId, policyRevision and snapshotId unchanged under each of the three policies, runs that continue to their end under finish, a Running run that finishes its running step, dispatches no further step and ends Cancelled under drain, Accepted and Held runs cancelled at once, the transitions of revoke from Accepted, Held, Running and WaitingForApproval with the open attempt interrupted, RunCancelled with the reason release-revoked and no stopped run ended Failed, and, against a registry that publishes AgentRegistryService/AssetReleaseRevoked after RevokeRelease, the handler reached once, the pinned run ended Cancelled and SubmitRun answered 409 for the release id and for an alias that still points at the revoked release.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RevocationInFlightPolicy\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-736: the selection of exactly the non-terminal runs whose pinned closure holds the revoked release, child runs included, the redelivery that applies nothing twice, the pinned releaseId, policyRevision and snapshotId unchanged under each of the three policies, runs that continue to their end under finish, a Running run that finishes its running step, dispatches no further step and ends Cancelled under drain, Accepted and Held runs cancelled at once, the transitions of revoke from Accepted, Held, Running and WaitingForApproval with the open attempt interrupted, RunCancelled with the reason release-revoked and no stopped run ended Failed, and, against a registry that publishes AgentRegistryService/AssetReleaseRevoked after RevokeRelease, the handler reached once, the pinned run ended Cancelled and SubmitRun answered 409 for the release id and for an alias that still points at the revoked release."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12407,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2973]",
      "number": 2973
    },
    {
      "id": "AIFACTORY-US-1493",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-007",
      "title": "Open the Draft release of an accepted learning proposal and announce its release id to FeedbackService",
      "sequence": "01.08.08",
      "description": "As an asset maintainer, I want an accepted learning proposal to become a Draft release of its target asset in the registry, so that I review and submit the change it proposes through the same gate as every other release, and the proposal knows which release came out of it. An asset maintainer accepts a learning proposal in FeedbackService, which announces `LearningProposalDecided` with the proposal id, the state, the target asset, the version the proposal starts from and the reference of the proposal text and diff. The owner decided that AgentRegistryService, the owner of releases, opens the Draft release of an accepted proposal itself when it consumes that event and announces the release id, and that FeedbackService records the resulting release from that announcement and no longer calls the registry to open a release (D131). The handler `OpenReleaseCandidate` passes an event with the state Accepted to the command `OpenLearningRelease` of the `AssetRelease` aggregate inside the tenant of the envelope. The command opens one Draft release of the target asset that keeps the proposal id in `learningProposalId` and the reference of the proposal text and diff, and writes in the same transaction the outbox record `LearningReleaseOpened` with `releaseId`, `tenantId`, `proposalId`, `assetKind`, `assetId` and `version`. The asset kind is that of the releases of the target asset the tenant can read. The model does not state which version the Draft release takes after the version the proposal starts from; that is reported to the owner, and the acceptance suite fixes it in its fixture. The command is idempotent on the proposal id: the unique index `UX_Releases_Tenant_LearningProposal` on tenant and proposal keeps one Draft release per proposal, and a repeated event opens none and announces the same release id again, so FeedbackService, which records it once per proposal, can rely on a redelivery. A rejected proposal opens nothing and announces nothing. An accepted proposal without a target asset, or whose target asset has no release the tenant can read, opens nothing and is poisoned with its reason. The Draft release enters the lifecycle of every candidate: the maintainer submits it from Draft as AIFACTORY-US-415 states for a version that exists as a Draft release, and it is published only through the gate of AIFACTORY-US-416; no handler publishes it. A release of another tenant is never touched. The dispatcher of the `agent-registry` messaging profile publishes `LearningReleaseOpened` on `asset-publication.releases.v1.learning-release-opened` under the run event envelope of the contracts package and retries a transport outage with backoff. Kind: behavior. Traces: services: AgentRegistryService, FeedbackService; aggregates: AgentRegistryService/AssetRelease; apis: AgentRegistryService/SubmitRelease; events: FeedbackService/LearningProposalDecided, AgentRegistryService/LearningReleaseOpened; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0021; requirements: FR-02; scenarios: SCN-AgentRegistryService-015. Depends on: feature:agent-registry-service-publication, feature:feedback-service, feature:contracts-package. Sources: model/services/control-plane/AgentRegistryService.yaml, model/services/observability/FeedbackService.yaml, docs/reference/schemas/run-event-envelope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a `FeedbackService/LearningProposalDecided` event with the state Accepted for a target asset whose releases the tenant can read, when `OpenReleaseCandidate` handles it, then one Draft `AgentRegistryService/AssetRelease` of that asset exists in the tenant of the envelope with the proposal id in `learningProposalId`, and the `AgentRegistryService/LearningReleaseOpened` outbox record with `releaseId`, `tenantId`, `proposalId`, `assetKind`, `assetId` and `version` is written in the same transaction (SCN-AgentRegistryService-015, D131, ADR-0014).",
        "AC2: Given the event of AC1 delivered again, or another event for the same proposal, when it is handled, then no second release exists for the proposal under `UX_Releases_Tenant_LearningProposal` and the same release id is announced again; given a `FeedbackService/LearningProposalDecided` with the state Rejected, then no release is opened and nothing is announced; given an accepted proposal without a target asset or whose target asset has no release the tenant can read, then nothing is opened and the delivery is poisoned with its reason (SCN-AgentRegistryService-015, D131).",
        "AC3: Given the Draft release of AC1, when the asset maintainer submits it through `AgentRegistryService/SubmitRelease`, then it moves to InReview without a second row as AIFACTORY-US-415 states and is published only through the gate of AIFACTORY-US-416; no handler publishes it, and no release of another tenant changes (ADR-0015, ADR-0021).",
        "AC4: Given a committed opening, when the dispatcher of the `agent-registry` messaging profile publishes `AgentRegistryService/LearningReleaseOpened` on `asset-publication.releases.v1.learning-release-opened`, then the event is sent under the run event envelope with its six payload fields and the tenant of the release in the envelope, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-AgentRegistryService-015, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/observability/FeedbackService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6069",
        "AIFACTORY-TASK-6070",
        "AIFACTORY-TASK-6071",
        "AIFACTORY-TASK-6072"
      ],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12408,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRegistryService",
          "FeedbackService"
        ],
        "aggregates": [
          "AgentRegistryService/AssetRelease"
        ],
        "apis": [
          "AgentRegistryService/SubmitRelease"
        ],
        "events": [
          "FeedbackService/LearningProposalDecided",
          "AgentRegistryService/LearningReleaseOpened"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02"
        ],
        "scenarios": [
          "SCN-AgentRegistryService-015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:agent-registry-service-publication",
        "feature:feedback-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/observability/FeedbackService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1493]",
      "number": 1493
    },
    {
      "id": "AIFACTORY-TASK-6069",
      "type": "task",
      "parent": "AIFACTORY-US-1493",
      "title": "OpenLearningRelease with the learningProposalId column and its unique index",
      "sequence": "01.08.08.01",
      "description": "OpenLearningRelease with the learningProposalId column and its unique index. Expected output: The command OpenLearningRelease of the AssetRelease aggregate opens one Draft release of the target asset of an accepted proposal inside the tenant of the envelope, keeps the proposal id in LearningProposalId and the reference of the proposal text and diff, takes the asset kind of the releases of the target asset the tenant can read and writes LearningReleaseOpened in the same transaction; the column LearningProposalId and the filtered unique index UX_Releases_Tenant_LearningProposal are added to AssetReleases; a repeat for the same proposal opens nothing and writes LearningReleaseOpened again with the same release id (D131).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The command OpenLearningRelease of the AssetRelease aggregate opens one Draft release of the target asset of an accepted proposal inside the tenant of the envelope, keeps the proposal id in LearningProposalId and the reference of the proposal text and diff, takes the asset kind of the releases of the target asset the tenant can read and writes LearningReleaseOpened in the same transaction; the column LearningProposalId and the filtered unique index UX_Releases_Tenant_LearningProposal are added to AssetReleases; a repeat for the same proposal opens nothing and writes LearningReleaseOpened again with the same release id (D131)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6069]",
      "number": 6069
    },
    {
      "id": "AIFACTORY-TASK-6070",
      "type": "task",
      "parent": "AIFACTORY-US-1493",
      "title": "OpenReleaseCandidate passing an accepted learning proposal to OpenLearningRelease",
      "sequence": "01.08.08.02",
      "description": "OpenReleaseCandidate passing an accepted learning proposal to OpenLearningRelease. Expected output: The handler of LearningProposalDecided reads the tenant from the envelope, passes an event with the state Accepted to OpenLearningRelease, acknowledges a Rejected proposal without effect and poisons with its reason an accepted proposal without a target asset or whose target asset has no release the tenant can read; it never publishes a release.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "The handler of LearningProposalDecided reads the tenant from the envelope, passes an event with the state Accepted to OpenLearningRelease, acknowledges a Rejected proposal without effect and poisons with its reason an accepted proposal without a target asset or whose target asset has no release the tenant can read; it never publishes a release."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6070]",
      "number": 6070
    },
    {
      "id": "AIFACTORY-TASK-6071",
      "type": "task",
      "parent": "AIFACTORY-US-1493",
      "title": "Contract of LearningReleaseOpened against the run event envelope of the contracts package",
      "sequence": "01.08.08.03",
      "description": "Contract of LearningReleaseOpened against the run event envelope of the contracts package. Expected output: A golden file fixes LearningReleaseOpened on asset-publication.releases.v1.learning-release-opened under run-event-envelope-v1 with releaseId, tenantId, proposalId, assetKind, assetId and version and the tenant in the envelope; a contract test fails when a serialised event differs from its file or from docs/reference/schemas/run-event-envelope.schema.json.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "A golden file fixes LearningReleaseOpened on asset-publication.releases.v1.learning-release-opened under run-event-envelope-v1 with releaseId, tenantId, proposalId, assetKind, assetId and version and the tenant in the envelope; a contract test fails when a serialised event differs from its file or from docs/reference/schemas/run-event-envelope.schema.json."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12408,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6071]",
      "number": 6071
    },
    {
      "id": "AIFACTORY-TASK-6072",
      "type": "task",
      "parent": "AIFACTORY-US-1493",
      "title": "Verify open-the-draft-release-of-an-accepted-learning-proposal through the acceptance suite",
      "sequence": "01.08.08.04",
      "description": "Verify open-the-draft-release-of-an-accepted-learning-proposal through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-015\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1493 with contract fixtures of LearningProposalDecided: the Draft release opened once with its proposal id and the event in the same transaction, the redelivery that opens nothing and announces the same release id, the rejected proposal, the poisoned proposal without a readable target asset, the submission from Draft through the gate, and the publication and payload of LearningReleaseOpened; the recording of the resulting release is proven by the suite of FeedbackService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRegistryService-015\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1493 with contract fixtures of LearningProposalDecided: the Draft release opened once with its proposal id and the event in the same transaction, the redelivery that opens nothing and announces the same release id, the rejected proposal, the poisoned proposal without a readable target asset, the submission from Draft through the gate, and the publication and payload of LearningReleaseOpened; the recording of the resulting release is proven by the suite of FeedbackService."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 124,
      "phase": "factory",
      "stackRank": 12408,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6072]",
      "number": 6072
    },
    {
      "id": "AIFACTORY-FEAT-009",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "FactoryCommercialService: complete delivery",
      "sequence": "01.09",
      "description": "FactoryCommercialService is the service of bounded context BC-34 (Factory Commercial). Factory editions, plans, subscriptions, invoices and meters for the Factory's own tenants, implemented by extending the SaaS ProductsCatalog, Entitlements, Billing and Metering templates (BC-34, ADR-0020). Its own repository is ConnectSoft.AI.SoftwareFactory.FactoryCommercialService. Delivers: FactoryCommercialService (complete). Increment I7: Operate and commercialise. Build order 174 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/FactoryCommercialService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 174,
      "phase": "factory",
      "stackRank": 17400,
      "titlePrefix": "[AIFACTORY-FEAT-009]",
      "number": 9
    },
    {
      "id": "AIFACTORY-FEAT-010",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-001",
      "title": "AgentCardService: complete delivery",
      "sequence": "01.10",
      "description": "AgentCardService is the service of bounded context BC-04 (Asset Publication). Projects Published agent releases into A2A agent cards, serves discovery to partner agents and maps inbound A2A tasks onto runs (ADR-0023, BC-04). Its own repository is ConnectSoft.AI.SoftwareFactory.AgentCardService. Delivers: AgentCardService (complete). Increment I8: Expansion. Build order 180 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/control-plane/AgentCardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:control-plane",
        "type:feature",
        "route:backend-developer",
        "slice:i8-expansion",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 180,
      "phase": "factory",
      "stackRank": 18000,
      "titlePrefix": "[AIFACTORY-FEAT-010]",
      "number": 10
    },
    {
      "id": "AIFACTORY-EPIC-002",
      "type": "epic",
      "parent": null,
      "title": "Agent Mesh (PF-02)",
      "sequence": "02",
      "description": "Everything that builds the Agent Mesh platform (PF-02): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). The runtime worker that executes attempts against immutable releases, the workflow engine and release loading. Done when: Every service of the platform has its complete delivery accepted (AgentRuntimeService, AgentRuntimeWorker, WorkflowEngineService), the platform gateway routes them under a trusted scope, and the outcome verification of I3 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (AgentRuntimeService, AgentRuntimeWorker, WorkflowEngineService), the platform gateway routes them under a trusted scope, and the outcome verification of I3 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-011",
        "AIFACTORY-FEAT-012",
        "AIFACTORY-FEAT-013"
      ],
      "stackRank": 5699,
      "titlePrefix": "[AIFACTORY-EPIC-002]",
      "number": 2
    },
    {
      "id": "AIFACTORY-FEAT-011",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-002",
      "title": "AgentRuntimeService: complete delivery",
      "sequence": "02.01",
      "description": "AgentRuntimeService is the service of bounded context BC-06 (Execution). Executes one attempt of one step under a lease from Run Control — loads the pinned release, assembles context, runs the plan-call-observe-verify loop on the Microsoft Agent Framework adapter, checkpoints before every gated call, asks for human decisions, delegates sub-agents and reports exactly one outcome (BC-06). Its own repository is ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Delivers: AgentRuntimeService (complete). Increment I1: Generate a microservice. Build order 57 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-007",
        "AIFACTORY-US-460",
        "AIFACTORY-US-461",
        "AIFACTORY-US-462",
        "AIFACTORY-US-463",
        "AIFACTORY-US-464",
        "AIFACTORY-US-465",
        "AIFACTORY-US-466",
        "AIFACTORY-US-467",
        "AIFACTORY-US-468",
        "AIFACTORY-US-469",
        "AIFACTORY-US-470",
        "AIFACTORY-US-471"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5700,
      "titlePrefix": "[AIFACTORY-FEAT-011]",
      "number": 11
    },
    {
      "id": "AIFACTORY-US-007",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "An agent step runs on a model profile and leaves a receipt",
      "sequence": "02.01.01",
      "description": "As a requester, I want the vision architect to clarify my intent and draft the Vision Blueprint on the model profile of its role, so that I get a first blueprint and can see which model produced it at what cost. This is the integration PBI of the feature: it proves on a deployed instance that an attempt of the first workflow runs end to end. A requester submitted a vision brief; Run Control dispatched the step `clarify-intent` of `vision-to-blueprint`, and later `draft-vision`, to the agent `vision-architect`. AgentRuntimeService, the attempt-runtime silo kind of the Agent Mesh cluster (ADR-0024, ADR-0028), claims the lease of the dispatched attempt (AIFACTORY-US-464), loads and verifies the pinned release (AIFACTORY-US-463), receives the context package of the pinned artifacts from the thin ContextBuilderService, runs the loop on the Microsoft Agent Framework adapter with a checkpoint before every gated call (AIFACTORY-US-465), and reports exactly one outcome with its hash and the fencing token of the lease (AIFACTORY-US-467). Every model call goes through the model gateway with the Factory model client of the pinned AI libraries: `ModelRouterService/ModelGateway.ResolveRoutePlan` resolves the pinned profile and `ModelRouterService/ModelGateway.Invoke` returns the completion with an invocation receipt that names the profile, the actual model, the token usage and the run and attempt; the runtime keeps the receipt reference on the call record and never the prompt or the completion. Every tool call, in this chain the read tools `knowledge-search`, `graph-query`, `list-files` and `read-range`, goes through the tool gateway with a policy decision id and the fencing token. When the provider of the profile fails, the fallback chain of the profile is applied by ModelRouterService and the receipt says which model answered; the runtime neither picks a provider nor repeats a call outside the profile. The repository and its store come from AIFACTORY-US-460, the hosted surface from AIFACTORY-US-461 and the workers from AIFACTORY-US-462; human decisions (AIFACTORY-US-466), interruption (AIFACTORY-US-468), lease keeping and recovery (AIFACTORY-US-469), delegation (AIFACTORY-US-470) and the timeline reads (AIFACTORY-US-471) complete the delivery. The runtime completes, fails or cancels nothing on its own authority: it reports an attempt outcome and Run Control records the truth (ADR-0024 decision 5). In I1 the releases are the seeded Draft releases the thin AgentRegistryService serves, which run under the waiver of the amendment of ADR-0021, and the context is the pass-through package of the thin ContextBuilderService. Every model call of the two steps passes ModelGatewayHost, the model gateway in front of ModelRouterService, and the usage of each receipt is recorded for the run by CostUsageService from `ModelRouterService/ModelInvoked`, which this PBI reads back through `CostUsageService/GetRunUsage`. The task contract (`agent-task-contract-v1`) and the content of the snapshot (`resolved-execution-snapshot-v1`) of each attempt are written before the attempt exists and never by the runtime (decision D121): WorkflowEngineService stores the task contract of a step in ArtifactService when it announces the step ready, and `WorkflowEngineService/StepReady` carries its reference and its hash, which RunControlService copies to each attempt of the step; RunControlService stores the snapshot once, when it accepts the run. The task contract describes the step and no attempt, so every attempt of a step reads the same contract and takes its ids and the reference of its snapshot from the lease answer (decision D123). The answer of `RunControlService/RunControl.AcquireLease` carries a reference and a hash for each, and the service reads their content from ArtifactService and verifies the hash before the loop starts (AIFACTORY-US-464, decision D119). AC1 is therefore proven on the deployed instance with the contracts of `clarify-intent` and `draft-vision` that the deployed WorkflowEngineService stored and with the snapshot that RunControlService stored, read by the references of their lease answers, and no seeded source stands in for them. An attempt whose task contract or snapshot cannot be read, or whose content does not match its hash, ends Failed before it runs with the reason and never runs on defaults. A delegation submits its child run through the child run operation of RunControlService (AIFACTORY-US-470); the two steps of this PBI delegate nothing. What this delivery does not hold is stated in the PBI it belongs to and reported to the owner: the proof of the three release event handlers against a publishing registry, because the thin registry of I1 publishes no release event; the handling of the nine events by their consumers (StudioBff, DashboardService, QualityScoreService, MemoryPromotionService, StudioNotificationService, AuditService), which each consumer proves in its own suite; and the platform gateway AgentRuntimeWorker, which fronts the service from I3. The handler of `DeletionOrderIssued` is built and proven in I4 with RetentionResidencyService, and this feature registers none (decision D119). Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Kind: behavior. Traces: services: AgentRuntimeService, RunControlService, ModelRouterService, ModelGatewayHost, ToolAdapterService, ContextBuilderService, CostUsageService, ArtifactService, WorkflowEngineService; aggregates: AgentRuntimeService/ExecutionAttempt, AgentRuntimeService/LoadedRelease, ModelRouterService/InvocationReceipt, ModelRouterService/RoutePlan; apis: RunControlService/RunControl.AcquireLease, ModelRouterService/ModelGateway.ResolveRoutePlan, ModelRouterService/ModelGateway.Invoke, CostUsageService/GetRunUsage; events: AgentRuntimeService/AttemptStarted, AgentRuntimeService/AttemptOutcomeReported, ModelRouterService/ModelInvoked, WorkflowEngineService/StepReady; steps: vision-to-blueprint/clarify-intent, vision-to-blueprint/draft-vision; agents: vision-architect; tools: knowledge-search, graph-query, list-files, read-range; adrs: ADR-0014, ADR-0021, ADR-0022, ADR-0024, ADR-0028; requirements: FR-03, FR-05, XL-04. Relates: screens: run-detail, run-timeline. Depends on: AIFACTORY-US-460, AIFACTORY-US-461, AIFACTORY-US-462, AIFACTORY-US-463, AIFACTORY-US-464, AIFACTORY-US-465, AIFACTORY-US-466, AIFACTORY-US-467, AIFACTORY-US-468, AIFACTORY-US-469, AIFACTORY-US-470, AIFACTORY-US-471, feature:run-control-service, feature:workflow-engine-service, feature:agent-registry-service-thin, feature:model-router-service, feature:model-gateway-host, feature:cost-usage-service-complete, feature:tool-adapter-service, feature:context-builder-service-thin, feature:artifact-service, feature:wf-vision-to-blueprint. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/workflows/vision-to-blueprint.yaml, docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#purpose-and-responsibilities, docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given the step `vision-to-blueprint/clarify-intent` dispatched to `vision-architect` for a seeded brief, when the attempt runs on the deployed service, then the agent receives exactly the inputs the workflow definition maps, from the task contract that WorkflowEngineService stored before it announced the step through `WorkflowEngineService/StepReady` and that the service read from ArtifactService by the reference of the answer of `RunControlService/RunControl.AcquireLease` and verified against its hash, and the context package of its pinned artifacts, `AgentRuntimeService/AttemptStarted` is published once with `attemptId`, `runId`, `stepId`, `tenantId`, `releaseId`, `snapshotId` and `fencingToken`, and exactly one `AgentRuntimeService/AttemptOutcomeReported` with state Succeeded follows (ADR-0024).",
        "AC2: Given the agent calls the model, when `ModelRouterService/ModelGateway.Invoke` returns, then the call passed ModelGatewayHost and no other path, the invocation receipt names the profile, the actual model, the token usage and the run and attempt identifiers, `ModelRouterService/ModelInvoked` is published by the router, `CostUsageService/GetRunUsage` shows the usage of the receipt recorded for the run by CostUsageService, and the call record of the `AgentRuntimeService/ExecutionAttempt` holds the request hash and the receipt reference and neither prompt nor completion text (ADR-0014).",
        "AC3: Given the agent uses one of the read tools `knowledge-search`, `graph-query`, `list-files` or `read-range`, when the tool executes, then the call went through the tool gateway with a policy decision id and the fencing token of the lease and is a call record of the attempt with its receipt reference; no tool ran inside the host (ADR-0022, FR-05).",
        "AC4: Given the provider of the pinned profile fails and the profile has a fallback chain, when the model is called after `ModelRouterService/ModelGateway.ResolveRoutePlan`, then the fallback is applied by ModelRouterService, the receipt says which model answered, and the attempt neither selected a provider nor repeated the call outside the profile (XL-04, model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC5: Given the step `vision-to-blueprint/draft-vision` dispatched after the first step succeeded, when its attempt ends, then one outcome was reported under the fencing token of its lease, Run Control recorded it, and the `AgentRuntimeService/ExecutionAttempt` and its `AgentRuntimeService/LoadedRelease` show which release ran against which adapter version (ADR-0024, FR-03)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#purpose-and-responsibilities",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-202",
        "AIFACTORY-TASK-1853",
        "AIFACTORY-TASK-658"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5701,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "RunControlService",
          "ModelRouterService",
          "ModelGatewayHost",
          "ToolAdapterService",
          "ContextBuilderService",
          "CostUsageService",
          "ArtifactService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt",
          "AgentRuntimeService/LoadedRelease",
          "ModelRouterService/InvocationReceipt",
          "ModelRouterService/RoutePlan"
        ],
        "apis": [
          "RunControlService/RunControl.AcquireLease",
          "ModelRouterService/ModelGateway.ResolveRoutePlan",
          "ModelRouterService/ModelGateway.Invoke",
          "CostUsageService/GetRunUsage"
        ],
        "events": [
          "AgentRuntimeService/AttemptStarted",
          "AgentRuntimeService/AttemptOutcomeReported",
          "ModelRouterService/ModelInvoked",
          "WorkflowEngineService/StepReady"
        ],
        "steps": [
          "vision-to-blueprint/clarify-intent",
          "vision-to-blueprint/draft-vision"
        ],
        "agents": [
          "vision-architect"
        ],
        "tools": [
          "knowledge-search",
          "graph-query",
          "list-files",
          "read-range"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0021",
          "ADR-0022",
          "ADR-0024",
          "ADR-0028"
        ],
        "requirements": [
          "FR-03",
          "FR-05",
          "XL-04"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "run-timeline"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-460",
        "AIFACTORY-US-461",
        "AIFACTORY-US-462",
        "AIFACTORY-US-463",
        "AIFACTORY-US-464",
        "AIFACTORY-US-465",
        "AIFACTORY-US-466",
        "AIFACTORY-US-467",
        "AIFACTORY-US-468",
        "AIFACTORY-US-469",
        "AIFACTORY-US-470",
        "AIFACTORY-US-471",
        "feature:run-control-service",
        "feature:workflow-engine-service",
        "feature:agent-registry-service-thin",
        "feature:model-router-service",
        "feature:model-gateway-host",
        "feature:cost-usage-service-complete",
        "feature:tool-adapter-service",
        "feature:context-builder-service-thin",
        "feature:artifact-service",
        "feature:wf-vision-to-blueprint"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#purpose-and-responsibilities",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-007]",
      "number": 7
    },
    {
      "id": "AIFACTORY-TASK-202",
      "type": "task",
      "parent": "AIFACTORY-US-007",
      "title": "Acceptance fixture of the vision architect steps with a seeded brief, the expected task contracts and scripted provider answers",
      "sequence": "02.01.01.01",
      "description": "Acceptance fixture of the vision architect steps with a seeded brief, the expected task contracts and scripted provider answers. Expected output: The acceptance suite holds a seeded vision brief, the `vision-architect` release as feature wf-vision-to-blueprint authors it and the thin registry serves it, never a copy of its instructions, the expected documents of the task handoff, that is one `agent-task-contract-v1` and one `resolved-execution-snapshot-v1` for each of the skills `vision-architect-clarification` and `vision-architect-author-the-vision-blueprint-document`, built from the input mappings, the limits and the validation of model/workflows/vision-to-blueprint.yaml and used only to compare with what the service read from ArtifactService by the references of the lease answer, never as a source the service reads, and a scripted provider behind the model gateway with two scripts: one yields a schema-valid draft for `clarify-intent` and `draft-vision`, the other fails the first provider once so that the fallback of the profile answers.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a seeded vision brief, the `vision-architect` release as feature wf-vision-to-blueprint authors it and the thin registry serves it, never a copy of its instructions, the expected documents of the task handoff, that is one `agent-task-contract-v1` and one `resolved-execution-snapshot-v1` for each of the skills `vision-architect-clarification` and `vision-architect-author-the-vision-blueprint-document`, built from the input mappings, the limits and the validation of model/workflows/vision-to-blueprint.yaml and used only to compare with what the service read from ArtifactService by the references of the lease answer, never as a source the service reads, and a scripted provider behind the model gateway with two scripts: one yields a schema-valid draft for `clarify-intent` and `draft-vision`, the other fails the first provider once so that the fallback of the profile answers."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5701,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-202]",
      "number": 202
    },
    {
      "id": "AIFACTORY-TASK-1853",
      "type": "task",
      "parent": "AIFACTORY-US-007",
      "title": "Deployment values of the attempt-runtime silo: replica range, silo kind, pool, workload identity and secret references",
      "sequence": "02.01.01.02",
      "description": "Deployment values of the attempt-runtime silo: replica range, silo kind, pool, workload identity and secret references. Expected output: The deployment manifest of the service states the replica range 2 to 20, the cluster id and the silo kind name of the attempt-runtime kind, `Runtime:Host:PoolId`, `Runtime:Host:MaxConcurrentAttempts`, `Runtime:Adapter:Kind` maf, the workload identity of `ConnectSoftIdentityPlatform:WorkloadIdentity`, `OrleansMessaging:ServiceName` agent-runtime and the secret references `messaging-transport` and `workload-identity-key`, as model/services/agent-mesh/AgentRuntimeService.yaml records them; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The deployment manifest of the service states the replica range 2 to 20, the cluster id and the silo kind name of the attempt-runtime kind, `Runtime:Host:PoolId`, `Runtime:Host:MaxConcurrentAttempts`, `Runtime:Adapter:Kind` maf, the workload identity of `ConnectSoftIdentityPlatform:WorkloadIdentity`, `OrleansMessaging:ServiceName` agent-runtime and the secret references `messaging-transport` and `workload-identity-key`, as model/services/agent-mesh/AgentRuntimeService.yaml records them; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5701,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1853]",
      "number": 1853
    },
    {
      "id": "AIFACTORY-TASK-658",
      "type": "task",
      "parent": "AIFACTORY-US-007",
      "title": "Verify agent-step-with-receipt by running the declared command",
      "sequence": "02.01.01.03",
      "description": "Verify agent-step-with-receipt by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AgentStepWithReceipt\"` against the deployed service with Run Control, WorkflowEngineService, ArtifactService, the thin registry, the thin context builder, the model gateway with the scripted provider, CostUsageService and the tool gateway; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-007, that is the mapped inputs and the context package, the receipt of `ModelRouterService/ModelGateway.Invoke` on the call record with its usage read back through `CostUsageService/GetRunUsage`, the governed read tool call, the fallback named by the receipt and the single reported outcome of each step. AC1 is proven with the task contract of each step, stored by the deployed WorkflowEngineService before its `WorkflowEngineService/StepReady`, and the snapshot of the run, stored by Run Control when it accepted the run, both read from ArtifactService by the references of the answer of `RunControlService/RunControl.AcquireLease` and verified against its hashes (AIFACTORY-TASK-1896), and the content read equals the expected documents of AIFACTORY-TASK-202; the runtime writes neither document and no seeded contract source is bound.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AgentStepWithReceipt\"` against the deployed service with Run Control, WorkflowEngineService, ArtifactService, the thin registry, the thin context builder, the model gateway with the scripted provider, CostUsageService and the tool gateway; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-007, that is the mapped inputs and the context package, the receipt of `ModelRouterService/ModelGateway.Invoke` on the call record with its usage read back through `CostUsageService/GetRunUsage`, the governed read tool call, the fallback named by the receipt and the single reported outcome of each step. AC1 is proven with the task contract of each step, stored by the deployed WorkflowEngineService before its `WorkflowEngineService/StepReady`, and the snapshot of the run, stored by Run Control when it accepted the run, both read from ArtifactService by the references of the answer of `RunControlService/RunControl.AcquireLease` and verified against its hashes (AIFACTORY-TASK-1896), and the content read equals the expected documents of AIFACTORY-TASK-202; the runtime writes neither document and no seeded contract source is bound."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-658]",
      "number": 658
    },
    {
      "id": "AIFACTORY-US-460",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "AgentRuntimeService repository: the attempt-runtime host as the durability spike created it, with the ExecutionAttempt and LoadedRelease aggregates and the store agent-runtime-sql",
      "sequence": "02.01.02",
      "description": "The repository ConnectSoft.AI.SoftwareFactory.AgentRuntimeService is not created here. It was created once, in I0, by AIFACTORY-TASK-146 of feature `durable-execution-spike` with `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime`, and this feature takes it as it stands. The first task confirms what it takes: the committed product solution equals a fresh generation of the attempt-runtime host kind from the agent template package at the version the publication gate of feature `component-agent-template-release` published (AIFACTORY-US-150); when the spike generated from an earlier package, the solution is regenerated at that version and the difference is committed as one change. The repository records the template version. What the host kind generates is the work of the template features and is consumed by that pin, never rewritten or forked here: the silo-kind configuration of one Orleans cluster with the cluster id and the silo kind name (feature `component-agent-template`), the single execution port with the Factory scope on every entry, the agent identity (feature `component-agent-template-identity`), the `FactoryAgentBase` and the mapping of its lifecycle stages onto the attempt events of this service (feature `component-agent-template-contract`), and the model client through the model gateway, the tool client through the tool gateway and the Orleans messaging profile with outbox and inbox as the default of the host kind (feature `component-agent-template-factory-access`). The base template arrives through the submodule of the agent template with its Factory profile and its closed findings (features `component-base-template-factory-profile` and `component-base-template-findings`): scope propagation, role policies, the descriptor surface, health and telemetry. The agent template takes no `UseFactoryProfile` switch: it selects its Factory shape with `--agent-host-kind`, so the scaffold command of AIFACTORY-TASK-146, which carries the host kind only, is the complete command (decision D119); the boolean `UseFactoryProfile` of the amendment of ADR-0028 belongs to the templates that take it, the gateway template of AgentRuntimeWorker among them. The run event envelope and the event type names come from the contracts package by a version pin as well. The spike folder with its `WorkflowRunGrain` and `AttemptGrain`, which lives outside the product solution, is removed in the change that adds the product `AttemptGrain`, as the spike PBI states. On that host this PBI adds the domain and the store. The `ExecutionAttempt` aggregate holds the attempt, run, step, tenant, project and optional environment identifiers, the lease id and the fencing token, the snapshot id, the release, agent and model profile ids, `state`, `phase`, `correctionCount`, `maxCorrections`, the last checkpoint, the context snapshot reference, `outcomeHash`, the time cancellation was observed, start and end times and a `version`, with the entities `Checkpoint`, `CallRecord`, `DecisionRequest` and `SubAgentDelegation` and the value object `AttemptLimits`. It enforces the invariants an aggregate can hold alone: `correctionCount` never exceeds `maxCorrections`; exactly one outcome is recorded, a repeat with the same `outcomeHash` is the same outcome and a different one is refused; after cancellation is observed no call record of kind Model or Tool is opened; the sequence of a checkpoint and of a call is unique within the attempt. The invariants that need another service (the lease, the policy decision, the checkpoint before a gated call) are enforced where they act, in the behaviour PBIs. The state machine accepts the twenty-two transitions of the model. Three of them, Running, WaitingForTool and WaitingForDecision to Cancelled under the trigger `ReleaseRevokedWithPolicyRevoke`, end an attempt that a revocation with the in-flight policy revoke interrupted (decision D123, AIFACTORY-US-463). Four of them let an attempt leave Claimed and Paused for a terminal state (decision D119). Claimed to Failed under the trigger `StartFailed`: the release was rejected, the context stayed unavailable, or the task contract or the snapshot could not be read or did not match its hash before the start. Claimed to Cancelled, Paused to Cancelled and Paused to Uncertain under the trigger `OrphanReconciled`: the lease is gone, and the attempt is settled Uncertain when a call was in flight and Cancelled otherwise. Two statements of the same model still need more than the table lists: the handler of `RunCancelled` settles the attempts of a cancelled run, and the orphan reconciler settles any non-terminal attempt. The aggregate therefore accepts two modelled triggers on transitions the table lists under another trigger, and one transition the table does not list. `CancellationObserved` is accepted on Claimed to Cancelled and on Paused to Cancelled: an interruption reached an attempt that had not started or that was paused. `OrphanReconciled` is accepted on the three modelled transitions to Cancelled from Running, WaitingForTool and WaitingForDecision, because an attempt that is abandoned or orphaned observed no cancellation. Running to Uncertain under the trigger `EffectUnconfirmed` of the model is the one transition beyond the table: the lease is gone while a call record of the Running attempt is open. A WaitingForDecision attempt has no call in flight and never moves to Uncertain. The unit tests name the two further triggers and the one transition as additions that await the model, every other transition is refused, and the three additions are reported to the owner as a correction of the table. The `LoadedRelease` aggregate holds `releaseId`, `tenantId`, `manifestHash`, `adapterVersion`, `contentRefs`, `state` (Verified, Rejected or Revoked), `verifiedAt` and the optional `inFlightPolicy`; it is usable only in state Verified and never deletes a manifest that attempts loaded. The store `agent-runtime-sql` is owned by this service alone (ADR-0028 decision 5) and holds the six tables of the model, `ExecutionAttempts`, `Checkpoints`, `CallRecords`, `DecisionRequests`, `SubAgentDelegations` and `LoadedReleases`, with the unique index over the lease, the unique indexes over attempt and sequence of checkpoints and call records, the unique index over the child run of a delegation, the composite key of release and adapter version, the row version of `ExecutionAttempts` and the tenant filter in every mapping; a prompt, a completion or a tool payload is a column of no table. Nothing is observable for a caller yet; the surface is hosted by AIFACTORY-US-461. Kind: enabling. Traces: services: AgentRuntimeService; aggregates: AgentRuntimeService/ExecutionAttempt, AgentRuntimeService/LoadedRelease; adrs: ADR-0015, ADR-0024, ADR-0028; requirements: FR-03, NFR-05. Depends on: feature:durable-execution-spike, feature:component-agent-template, feature:component-agent-template-identity, feature:component-agent-template-contract, feature:component-agent-template-factory-access, feature:component-agent-template-release, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/template-parameters/connectsoft-ai-agent.yaml, model/stores.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/durability-spike.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given the repository as AIFACTORY-TASK-146 created it and the agent template package at the published version, when a fresh `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime` is compared with the committed product solution and the pipeline runs, then the committed solution equals the generation plus the files this feature added, the solution builds in Release, the generated tests pass, a container image is published, the repository records the template version, and the spike folder is absent once the product `AttemptGrain` exists (ADR-0028, ADR-0024, model/template-parameters/connectsoft-ai-agent.yaml).",
        "AC2: Given the `AgentRuntimeService/ExecutionAttempt` aggregate, when its unit tests run, then each of the twenty-two transitions of model/services/agent-mesh/AgentRuntimeService.yaml is accepted, among them Claimed to Failed under `StartFailed`, Claimed to Cancelled, Paused to Cancelled and Paused to Uncertain under `OrphanReconciled` and Running, WaitingForTool and WaitingForDecision to Cancelled under `ReleaseRevokedWithPolicyRevoke`, the three additions are accepted and marked as additions, that is `CancellationObserved` on Claimed to Cancelled and on Paused to Cancelled, `OrphanReconciled` on the three modelled transitions to Cancelled from Running, WaitingForTool and WaitingForDecision, and Running to Uncertain under `EffectUnconfirmed`, every other transition is refused, WaitingForDecision to Uncertain among them, a `correctionCount` above `maxCorrections` is refused, a second outcome with another `outcomeHash` is refused while the same hash is the same outcome, and no call record of kind Model or Tool opens after cancellation was observed.",
        "AC3: Given the `AgentRuntimeService/LoadedRelease` aggregate, when its unit tests run, then a release is usable only in state Verified, a rejection keeps its explicit reason, and a revocation sets the in-flight policy and keeps the manifest hash and the content references that attempts already loaded (docs/planes/agent-runtime/release-loading.md).",
        "AC4: Given `agent-runtime-sql` created by the migrations of the repository on an isolated test database, when the mapping tests run, then the six tables exist with their keys and indexes, a second attempt row for one lease violates the unique index over the lease, a repeated sequence of a checkpoint or a call within one attempt violates its unique index, a query made for one tenant never returns a row of another, and no column holds a prompt, a completion or a tool payload (ADR-0015, docs/planes/agent-runtime/security.md)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-030",
        "AIFACTORY-TASK-031",
        "AIFACTORY-TASK-032",
        "AIFACTORY-TASK-1854"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5702,
      "kind": "enabling",
      "traces": {
        "services": [
          "AgentRuntimeService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt",
          "AgentRuntimeService/LoadedRelease"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ],
        "requirements": [
          "FR-03",
          "NFR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:durable-execution-spike",
        "feature:component-agent-template",
        "feature:component-agent-template-identity",
        "feature:component-agent-template-contract",
        "feature:component-agent-template-factory-access",
        "feature:component-agent-template-release",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-460]",
      "number": 460
    },
    {
      "id": "AIFACTORY-TASK-030",
      "type": "task",
      "parent": "AIFACTORY-US-460",
      "title": "Take the repository ConnectSoft.AI.SoftwareFactory.AgentRuntimeService as the durability spike created it and align it with the published agent template package",
      "sequence": "02.01.02.01",
      "description": "Take the repository ConnectSoft.AI.SoftwareFactory.AgentRuntimeService as the durability spike created it and align it with the published agent template package. Expected output: The repository that AIFACTORY-TASK-146 of feature durable-execution-spike created is taken as it stands and is not created again; its product solution is compared with a fresh `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime` from the package version the gate AIFACTORY-US-150 published and is regenerated in one committed change when it differs; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image; the spike folder is removed in the change that adds the product AttemptGrain.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository that AIFACTORY-TASK-146 of feature durable-execution-spike created is taken as it stands and is not created again; its product solution is compared with a fresh `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime` from the package version the gate AIFACTORY-US-150 published and is regenerated in one committed change when it differs; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image; the spike folder is removed in the change that adds the product AttemptGrain."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-030]",
      "number": 30
    },
    {
      "id": "AIFACTORY-TASK-031",
      "type": "task",
      "parent": "AIFACTORY-US-460",
      "title": "Domain model: ExecutionAttempt with Checkpoint, CallRecord, DecisionRequest, SubAgentDelegation and AttemptLimits, and LoadedRelease",
      "sequence": "02.01.02.02",
      "description": "Domain model: ExecutionAttempt with Checkpoint, CallRecord, DecisionRequest, SubAgentDelegation and AttemptLimits, and LoadedRelease. Expected output: The ExecutionAttempt aggregate with its four entities and the AttemptLimits value object enforces the correction bound, the single outcome idempotent on outcomeHash, the stop of Model and Tool calls after an observed cancellation and the unique sequences; it accepts the twenty-two transitions of the model, Claimed to Failed under StartFailed, Claimed to Cancelled, Paused to Cancelled and Paused to Uncertain under OrphanReconciled and the three transitions to Cancelled from Running, WaitingForTool and WaitingForDecision under ReleaseRevokedWithPolicyRevoke among them, and the three additions one by one, CancellationObserved on Claimed to Cancelled and on Paused to Cancelled, OrphanReconciled as a further trigger of the three modelled transitions to Cancelled from Running, WaitingForTool and WaitingForDecision, and Running to Uncertain under EffectUnconfirmed, and refuses every other; the LoadedRelease aggregate is usable only when Verified and keeps what attempts loaded; unit tests cover every invariant, each transition, each addition and the refusals.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The ExecutionAttempt aggregate with its four entities and the AttemptLimits value object enforces the correction bound, the single outcome idempotent on outcomeHash, the stop of Model and Tool calls after an observed cancellation and the unique sequences; it accepts the twenty-two transitions of the model, Claimed to Failed under StartFailed, Claimed to Cancelled, Paused to Cancelled and Paused to Uncertain under OrphanReconciled and the three transitions to Cancelled from Running, WaitingForTool and WaitingForDecision under ReleaseRevokedWithPolicyRevoke among them, and the three additions one by one, CancellationObserved on Claimed to Cancelled and on Paused to Cancelled, OrphanReconciled as a further trigger of the three modelled transitions to Cancelled from Running, WaitingForTool and WaitingForDecision, and Running to Uncertain under EffectUnconfirmed, and refuses every other; the LoadedRelease aggregate is usable only when Verified and keeps what attempts loaded; unit tests cover every invariant, each transition, each addition and the refusals."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-031]",
      "number": 31
    },
    {
      "id": "AIFACTORY-TASK-032",
      "type": "task",
      "parent": "AIFACTORY-US-460",
      "title": "Persistence in agent-runtime-sql: ExecutionAttempts, Checkpoints, CallRecords, DecisionRequests, SubAgentDelegations, LoadedReleases",
      "sequence": "02.01.02.03",
      "description": "Persistence in agent-runtime-sql: ExecutionAttempts, Checkpoints, CallRecords, DecisionRequests, SubAgentDelegations, LoadedReleases. Expected output: Mappings and migrations for the six modelled tables with UX_Attempts_Lease, IX_Attempts_Run_Step, IX_Attempts_Tenant_State, UX_Checkpoints_Attempt_Sequence, UX_Calls_Attempt_Sequence, UX_Delegations_ChildRun, the composite key of LoadedReleases, the row version of ExecutionAttempts and the tenant filter in every mapping; no table has a column for prompt, completion or tool payload text; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the six modelled tables with UX_Attempts_Lease, IX_Attempts_Run_Step, IX_Attempts_Tenant_State, UX_Checkpoints_Attempt_Sequence, UX_Calls_Attempt_Sequence, UX_Delegations_ChildRun, the composite key of LoadedReleases, the row version of ExecutionAttempts and the tenant filter in every mapping; no table has a column for prompt, completion or tool payload text; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5702,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-032]",
      "number": 32
    },
    {
      "id": "AIFACTORY-TASK-1854",
      "type": "task",
      "parent": "AIFACTORY-US-460",
      "title": "Verify the taken repository, the two aggregates and the store of AgentRuntimeService",
      "sequence": "02.01.02.04",
      "description": "Verify the taken repository, the two aggregates and the store of AgentRuntimeService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the two aggregates and the mapping tests on an isolated database pass, and a diff of the committed product solution against a fresh generation at the recorded template version shows only the files this feature added, which proves AC1 to AC4 of AIFACTORY-US-460 (ADR-0028, ADR-0024).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the two aggregates and the mapping tests on an isolated database pass, and a diff of the committed product solution against a fresh generation at the recorded template version shows only the files this feature added, which proves AC1 to AC4 of AIFACTORY-US-460 (ADR-0028, ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1854]",
      "number": 1854
    },
    {
      "id": "AIFACTORY-US-461",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "AgentRuntimeService host: three REST routes and three gRPC methods behind scope policies, the agent-runtime messaging profile, tenancy, audit evidence and telemetry",
      "sequence": "02.01.03",
      "description": "This PBI turns the host of AIFACTORY-US-460 into the surface on which the behaviour PBIs of the feature land. From the service descriptor the host exposes the three REST operations of the model for the platform route (GW-03), `GetAttemptTimeline` and `ListCheckpoints` under `factory.runs.read` and `GetLoadedRelease` under `factory.assets.read`, and the gRPC service `Runtime` with the methods `Interrupt`, `AnswerDecision` and `WatchAttempt`, each with its contract document, an OpenAPI document and a proto. A user token is validated through the resource-server library the profile wires, with the audience of the gateway of the platform, AgentRuntimeWorker, which forwards the user token unchanged (ADR-0015 amendment on the forwarded user token), and must hold the scope of the route; the tenant comes from the token. A gRPC method requires a workload identity whose token holds the service scope that names AgentRuntimeService; a workload token carries service scopes and no tenant claim, so the service reads the tenant and the project a workload forwards only under that scope (ADR-0015 amendment of D114). An attempt or a release of another tenant is invisible under the tenant row filter and is answered 404, over gRPC NOT_FOUND, the same answer as for an identifier that does not exist; a missing scope inside the tenant of the caller, and a caller whose token grants no role in the project of the attempt, is answered 403, over gRPC PERMISSION_DENIED (ADR-0015 amendment of D113). Every modelled refusal code has a problem response. In I1 the surface is reached on the internal address of the service; the platform gateway AgentRuntimeWorker fronts it from I3 (feature `agent-runtime-worker`) and changes nothing of it. The messaging profile of the service is named `agent-runtime` (`OrleansMessaging:ServiceName`), and its inbox and outbox belong to this service alone (ADR-0028). The outbox writer enlists in the transaction of the grain transition or the command that raises an event, and the dispatcher publishes the nine events of the model in the run event envelope of the pinned contracts package, with event id, schema version, tenant, project, run, step and attempt, correlation id and producer, each declared with its topic in the `OrleansMessaging` section. The same section declares one topic beside the nine of the model, `audit.evidence.v1.evidence-submitted`, on which the audit evidence event of this service is published; a publish of any other event is refused. The host emits no attempt event beyond the seven the model gives the `ExecutionAttempt` (`AttemptStarted`, `AttemptPhaseChanged`, `AttemptCheckpointed`, `AttemptDecisionRequested`, `AttemptCancellationObserved`, `AttemptOutcomeReported` and `SubAgentDelegated`) and the two of the `LoadedRelease` (`ReleaseLoaded` and `ReleaseLoadRejected`): the lifecycle publisher of the template maps the stages of the library base onto these names, and no event of the unmapped library family leaves the host. The inbox subscribes, with deduplication on the event id, to `AttemptDispatched`, `ApprovalDecided`, `RunCompleted`, `RunFailed`, `RunCancelled` and `LeaseExpired` of RunControlService, to `AssetReleasePublished`, `AssetReleaseDeprecated` and `AssetReleaseRevoked` of AgentRegistryService and to `ToolEffectUncertain` of ToolAdapterService; `RunCancelled` reaches two handlers, the one that settles the attempts of a cancelled run and the one that settles the delegation of a cancelled child run, and what each handler does is delivered by the behaviour PBIs. The handler of the eleventh consumed event of the model, `DeletionOrderIssued` of RetentionResidencyService, is built and proven in I4 in this repository by feature `retention-residency-service`, and this feature registers none (decisions D119 and D137). Audit evidence is an event: where a PBI of this feature records evidence, the Factory sink of the pinned audit library (feature `component-audit-factory-evidence`) writes an `audit-evidence-v1` record to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` with the event type `AuditEvidenceSubmitted`. Telemetry follows the single registration of feature `component-observability-factory-conventions`: tenant and project are on metrics by default, run, step and attempt are on activities and log records, and `connectsoft.factory.agent_id` is written while the execution port holds the trace context call for the attempt; a prompt, a completion or a tool payload is on no span and in no log record. The eleven metrics of the model are registered in two groups. The eight attempt and release metrics (`attempts_active`, `attempt_duration`, `calls`, `corrections`, `checkpoints_written`, `decisions_waiting`, `uncertain_outcomes` and `release_load_rejected` under `connectsoft.factory.runtime`) carry tenant and project by default beside their modelled dimensions. The three host-level metrics describe the host and no tenant and carry exactly their modelled dimensions: `connectsoft.factory.runtime.attempt_slots` pool and replica, `connectsoft.factory.runtime.inbox_lag` service and `connectsoft.factory.runtime.control_plane_rtt` method. Beyond the metrics, the ten options are bound and validated at start, the transport credential and the workload identity key are read from the secret references `messaging-transport` and `workload-identity-key`, and readiness reports the store, the silo, the messaging profile and the required dependencies. Kind: enabling. Traces: services: AgentRuntimeService; aggregates: AgentRuntimeService/ExecutionAttempt, AgentRuntimeService/LoadedRelease; apis: AgentRuntimeService/GetAttemptTimeline, AgentRuntimeService/ListCheckpoints, AgentRuntimeService/GetLoadedRelease, AgentRuntimeService/Runtime.Interrupt, AgentRuntimeService/Runtime.AnswerDecision, AgentRuntimeService/Runtime.WatchAttempt; descriptors: run-event-envelope-v1, audit-evidence-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028; requirements: FR-03, NFR-05. Depends on: AIFACTORY-US-460, feature:component-base-template-factory-profile, feature:component-agent-template-contract, feature:component-agent-template-factory-access, feature:contracts-package, feature:component-observability-factory-conventions, feature:component-audit-factory-evidence. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/gateways.yaml, model/services/governance/AuditService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#apis, docs/planes/agent-runtime/services/agent-runtime-service/index.md#messages, docs/planes/agent-runtime/observability.md.",
      "acceptanceCriteria": [
        "AC1: Given the hosted service, when `AgentRuntimeService/GetAttemptTimeline`, `AgentRuntimeService/ListCheckpoints` and `AgentRuntimeService/GetLoadedRelease` are each called without a token and with a token that lacks the scope of the route, then the answers are 401 and 403 with a problem response; when `AgentRuntimeService/Runtime.Interrupt`, `AgentRuntimeService/Runtime.AnswerDecision` or `AgentRuntimeService/Runtime.WatchAttempt` is called without a workload identity or with a workload token that lacks the service scope, then the call is refused with UNAUTHENTICATED or PERMISSION_DENIED; no state changes (ADR-0015).",
        "AC2: Given a transition of the `AgentRuntimeService/ExecutionAttempt` or a command on the `AgentRuntimeService/LoadedRelease` that raises one of the nine declared events, when its transaction commits, then one outbox record in `run-event-envelope-v1` with event id, tenant id, project id, run id, step id and attempt id where they apply, correlation id and payload is committed with it; when the transaction rolls back, neither the change nor the record exists; the `OrleansMessaging` section declares the nine topics of the model and, for the audit evidence event of AC5, `audit.evidence.v1.evidence-submitted`, a publish of an event the section does not declare throws, and the dispatcher retries a transport outage with backoff without losing or duplicating a record under its event id (ADR-0012, ADR-0014).",
        "AC3: Given the inbox of the `agent-runtime` profile, when one of the ten subscribed events is delivered twice with the same event id, then each of its handlers runs once; a message without the tenant and project scope of the envelope is dead-lettered and no handler runs; `DeletionOrderIssued` has no subscription (ADR-0014, model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC4: Given the service starts, when liveness and readiness are probed, then readiness answers ready only after `agent-runtime-sql` is migrated, the silo joined the cluster and the messaging profile started, and names the dependency while it is unready; the ten options of model/services/agent-mesh/AgentRuntimeService.yaml are bound and an invalid value stops the start with the key named; the eleven metrics are registered, the eight attempt and release metrics with tenant and project beside their modelled dimensions and `connectsoft.factory.runtime.attempt_slots`, `connectsoft.factory.runtime.inbox_lag` and `connectsoft.factory.runtime.control_plane_rtt` with exactly their modelled dimensions and no tenant; activities and log records of an attempt carry run, step, attempt and `connectsoft.factory.agent_id` and no prompt, completion or tool payload (ADR-0015, docs/planes/agent-runtime/observability.md).",
        "AC5: Given a command that records audit evidence, when its transaction commits, then one `audit-evidence-v1` record is in the outbox with the event type `AuditEvidenceSubmitted` for the topic `audit.evidence.v1.evidence-submitted`, with tenant and actor from the trusted scope, and a rollback leaves none (ADR-0014, model/services/governance/AuditService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/gateways.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#apis",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#messages",
        "docs/planes/agent-runtime/observability.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-033",
        "AIFACTORY-TASK-034",
        "AIFACTORY-TASK-036",
        "AIFACTORY-TASK-1855"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5703,
      "kind": "enabling",
      "traces": {
        "services": [
          "AgentRuntimeService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt",
          "AgentRuntimeService/LoadedRelease"
        ],
        "apis": [
          "AgentRuntimeService/GetAttemptTimeline",
          "AgentRuntimeService/ListCheckpoints",
          "AgentRuntimeService/GetLoadedRelease",
          "AgentRuntimeService/Runtime.Interrupt",
          "AgentRuntimeService/Runtime.AnswerDecision",
          "AgentRuntimeService/Runtime.WatchAttempt"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-03",
          "NFR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-460",
        "feature:component-base-template-factory-profile",
        "feature:component-agent-template-contract",
        "feature:component-agent-template-factory-access",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/gateways.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#apis",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#messages",
        "docs/planes/agent-runtime/observability.md"
      ],
      "titlePrefix": "[AIFACTORY-US-461]",
      "number": 461
    },
    {
      "id": "AIFACTORY-TASK-033",
      "type": "task",
      "parent": "AIFACTORY-US-461",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 3 REST operations and 3 gRPC methods",
      "sequence": "02.01.03.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 3 REST operations and 3 gRPC methods. Expected output: The three REST routes GetAttemptTimeline, ListCheckpoints and GetLoadedRelease and the gRPC methods Runtime.Interrupt, Runtime.AnswerDecision and Runtime.WatchAttempt are hosted from the service descriptor with token validation, scope enforcement per route, the workload identity and service scope check on every gRPC method, problem responses for the modelled codes 403 and 404, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-463, AIFACTORY-US-466, AIFACTORY-US-468 and AIFACTORY-US-471, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three REST routes GetAttemptTimeline, ListCheckpoints and GetLoadedRelease and the gRPC methods Runtime.Interrupt, Runtime.AnswerDecision and Runtime.WatchAttempt are hosted from the service descriptor with token validation, scope enforcement per route, the workload identity and service scope check on every gRPC method, problem responses for the modelled codes 403 and 404, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-463, AIFACTORY-US-466, AIFACTORY-US-468 and AIFACTORY-US-471, not here."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-033]",
      "number": 33
    },
    {
      "id": "AIFACTORY-TASK-034",
      "type": "task",
      "parent": "AIFACTORY-US-461",
      "title": "Messaging skeleton: outbox and inbox wiring of the agent-runtime profile for 9 published and 10 subscribed events",
      "sequence": "02.01.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the agent-runtime profile for 9 published and 10 subscribed events. Expected output: The outbox writer enlists in the transaction of a grain transition or a command and the dispatcher of the agent-runtime messaging profile publishes AttemptStarted, AttemptPhaseChanged, AttemptCheckpointed, AttemptDecisionRequested, AttemptCancellationObserved, AttemptOutcomeReported, SubAgentDelegated, ReleaseLoaded and ReleaseLoadRejected in the run event envelope of the pinned contracts package, each declared with its topic in the OrleansMessaging section, which also declares the topic audit.evidence.v1.evidence-submitted of the audit evidence event beside the nine topics of the model; the lifecycle publisher maps the library stages onto these names and emits no other attempt event; the inbox subscribes to AttemptDispatched, ApprovalDecided, RunCompleted, RunFailed, RunCancelled, LeaseExpired, AssetReleasePublished, AssetReleaseDeprecated, AssetReleaseRevoked and ToolEffectUncertain with deduplication on the event id, RunCancelled with its two handlers; DeletionOrderIssued is not subscribed, its handler being built in I4 with RetentionResidencyService; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of a grain transition or a command and the dispatcher of the agent-runtime messaging profile publishes AttemptStarted, AttemptPhaseChanged, AttemptCheckpointed, AttemptDecisionRequested, AttemptCancellationObserved, AttemptOutcomeReported, SubAgentDelegated, ReleaseLoaded and ReleaseLoadRejected in the run event envelope of the pinned contracts package, each declared with its topic in the OrleansMessaging section, which also declares the topic audit.evidence.v1.evidence-submitted of the audit evidence event beside the nine topics of the model; the lifecycle publisher maps the library stages onto these names and emits no other attempt event; the inbox subscribes to AttemptDispatched, ApprovalDecided, RunCompleted, RunFailed, RunCancelled, LeaseExpired, AssetReleasePublished, AssetReleaseDeprecated, AssetReleaseRevoked and ToolEffectUncertain with deduplication on the event id, RunCancelled with its two handlers; DeletionOrderIssued is not subscribed, its handler being built in I4 with RetentionResidencyService; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-034]",
      "number": 34
    },
    {
      "id": "AIFACTORY-TASK-036",
      "type": "task",
      "parent": "AIFACTORY-US-461",
      "title": "Security, tenancy, audit evidence sink and telemetry of AgentRuntimeService",
      "sequence": "02.01.03.03",
      "description": "Security, tenancy, audit evidence sink and telemetry of AgentRuntimeService. Expected output: The two scopes of the model are enforced, a route that addresses an attempt admits a call only when the token grants a role in the project of the attempt, every query is tenant-filtered, the tenant and project of a workload are read only under the service scope, the transport credential and the workload identity key come from the secret references messaging-transport and workload-identity-key, the ten options are bound and validated at start, readiness reports the store, the silo, the messaging profile and the required dependencies, the Factory sink of the pinned audit library writes audit-evidence-v1 records to the outbox, and the eleven metrics are registered through the single observability registration, the eight attempt and release metrics with tenant and project beside their modelled dimensions and the three host-level metrics attempt_slots, inbox_lag and control_plane_rtt with exactly their modelled dimensions, with run, step, attempt and connectsoft.factory.agent_id on activities and log records; the 404 that follows from the tenant filter is proven by the behaviour PBIs that read an attempt or a release.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two scopes of the model are enforced, a route that addresses an attempt admits a call only when the token grants a role in the project of the attempt, every query is tenant-filtered, the tenant and project of a workload are read only under the service scope, the transport credential and the workload identity key come from the secret references messaging-transport and workload-identity-key, the ten options are bound and validated at start, readiness reports the store, the silo, the messaging profile and the required dependencies, the Factory sink of the pinned audit library writes audit-evidence-v1 records to the outbox, and the eleven metrics are registered through the single observability registration, the eight attempt and release metrics with tenant and project beside their modelled dimensions and the three host-level metrics attempt_slots, inbox_lag and control_plane_rtt with exactly their modelled dimensions, with run, step, attempt and connectsoft.factory.agent_id on activities and log records; the 404 that follows from the tenant filter is proven by the behaviour PBIs that read an attempt or a release."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-036]",
      "number": 36
    },
    {
      "id": "AIFACTORY-TASK-1855",
      "type": "task",
      "parent": "AIFACTORY-US-461",
      "title": "Verify the hosted surface of AgentRuntimeService with a two-tenant fixture",
      "sequence": "02.01.03.04",
      "description": "Verify the hosted surface of AgentRuntimeService with a two-tenant fixture. Expected output: Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every REST route without a token and without its scope and every gRPC method without a workload identity and without the service scope, commit and roll back a transition that publishes, deliver a subscribed event twice and one without scope, probe readiness with the store stopped, read the telemetry of one attempt and commit and roll back a command that records evidence, which proves AC1 to AC5 of AIFACTORY-US-461 (ADR-0015, ADR-0014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every REST route without a token and without its scope and every gRPC method without a workload identity and without the service scope, commit and roll back a transition that publishes, deliver a subscribed event twice and one without scope, probe readiness with the store stopped, read the telemetry of one attempt and commit and roll back a command that records evidence, which proves AC1 to AC5 of AIFACTORY-US-461 (ADR-0015, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1855]",
      "number": 1855
    },
    {
      "id": "AIFACTORY-US-462",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "AgentRuntimeService workers: the four jobs of the model on the Workers.Runtime engine with scoped idempotency, failed work, the singleton lease and the checkpoint compactor",
      "sequence": "02.01.04",
      "description": "The model gives AgentRuntimeService four workers: `LeaseHeartbeat` on a timer of 15 seconds, `OrphanedAttemptReconciler` every two minutes, `CheckpointCompactor` once a night and `ReleaseCacheWarmer` on the event `AssetReleasePublished`. They run inside the deployable of the service (ADR-0028), not in a host of their own, and they are not written as four private loops: the host registers the worker engine `ConnectSoft.Workers.Runtime` at the version feature `component-workers-runtime-library` published, the way its guide shows for a service on the base template, with drain wired to the stop of the host, the idempotency and failed-work stores on `agent-runtime-sql` and the singleton lease, so that two replicas never run the same job instance. The tables of the engine are created by a migration of this repository from the schema script of the engine in its scoped shape: a processed-message row and a failed-work row carry tenant and project, with run, step and attempt where the work has them, and the key of a processed message is tenant, project and message id, as the Factory profile of the worker template defines it (ADR-0028 amendment of D114); the same message id of a second tenant is therefore stored and not rejected. The service is scaffolded from the agent template and not from the worker template, so it consumes no generated code of feature `component-worker-template-factory-profile`: what it consumes from that feature is the definition the feature proves on a generated worker, the migration that keys processed messages by tenant, project and message id and the role rule of the worker operations, which the migration of this repository reproduces on the scoped key option of the engine. Each job is registered with the trigger, the retry policy, the idempotency key and the partitioning the model states. `LeaseHeartbeat` has three fixed attempts five seconds apart, the key lease id plus renewal sequence and one run at a time per attempt. `OrphanedAttemptReconciler` has five exponential attempts from 30 seconds, the key attempt id plus outcome hash and two parallel runs partitioned by tenant. `CheckpointCompactor` has three fixed attempts 300 seconds apart, the key checkpoint id and one run at a time per tenant. `ReleaseCacheWarmer` has five exponential attempts from 30 seconds, the key release id plus adapter version and two parallel runs partitioned by tenant. A trigger repeated under the same key has no second effect, and work that exhausts its retries leaves one open failed-work record with its scope. The periodic jobs tick only under the SQL lease provider. Run and attempt state never moves into the engine: the attempt lives in `AttemptGrain` (ADR-0024), and the two reminders of the grain, `call-timeout` and `attempt-budget`, are grain reminders and no jobs of the engine. What three of the jobs do belongs to behaviour PBIs: lease renewal and orphan settlement to AIFACTORY-US-469 and release warming to AIFACTORY-US-463. This PBI delivers the fourth, which has no caller and publishes no event: `CheckpointCompactor` deletes the superseded checkpoint rows of terminal attempts after the retention window and keeps the last checkpoint of every attempt and every checkpoint referenced by evidence. The model names no window for checkpoints and none of the ten options holds one. It states a retention for the table `ExecutionAttempts` only, one year by default under the retention of the project, and this delivery takes that value from model/services/agent-mesh/AgentRuntimeService.yaml as the fixed default window of the compactor; the value of a project arrives with RetentionResidencyService, which is delivered in a later increment, and the missing window and its missing option are reported to the owner. The model names no operation of ArtifactService that deletes the blob a checkpoint row referenced, so the compactor deletes rows only, the blob is left to the retention of the artifact store, and the gap is reported to the owner. The worker operations follow the amendment of ADR-0015 on worker operations: the job catalog, the triggers and failed work without a scope need the Platform admin role, and an Operator sees and replays only the failed work of own projects, a row of another tenant being answered 404. The model lists no operation of AgentRuntimeService that serves the job catalog or the failed work, and the engine package holds no operations surface, so this delivery exposes none and proves the rule on the rows: every failed-work row of an attempt carries its tenant and project. Which surface an operator uses to list and replay the failed work of this service is reported to the owner. Kind: enabling. Traces: services: AgentRuntimeService; aggregates: AgentRuntimeService/ExecutionAttempt; adrs: ADR-0015, ADR-0024, ADR-0028; requirements: NFR-06. Depends on: AIFACTORY-US-461, feature:component-workers-runtime-library, feature:component-worker-template-factory-profile. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/components.yaml, docs/planes/agent-runtime/workers.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#workers-and-jobs, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given the engine registered in the host, when the service starts on an isolated database, then the tables of the engine exist in `agent-runtime-sql` in the scoped shape with the processed-message key of tenant, project and message id, the four jobs of model/services/agent-mesh/AgentRuntimeService.yaml are in the catalog with their triggers, retry policies, idempotency keys and partitioning, and a periodic job without the SQL lease provider stops the start (ADR-0028, docs/planes/agent-runtime/workers.md).",
        "AC2: Given two replicas and the conformance suite of the engine, when the suite runs against the registration, then a stop request drains in-flight work, a singleton job runs once, a trigger repeated under its idempotency key has no second effect, the same message id of a second tenant is processed and not rejected, and exhausted retries leave one open failed-work record that carries tenant and project (ADR-0015, ADR-0024).",
        "AC3: Given terminal attempts of two tenants with checkpoints older and younger than the fixed default window of one year, which is the retention the model states for `ExecutionAttempts`, when `CheckpointCompactor` runs twice, then the superseded checkpoint rows older than the window are deleted, the last checkpoint of every `AgentRuntimeService/ExecutionAttempt` and every checkpoint referenced by evidence remain, checkpoints of non-terminal attempts are untouched, no event is published, and the second run deletes nothing more (model/services/agent-mesh/AgentRuntimeService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/components.yaml",
        "docs/planes/agent-runtime/workers.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#workers-and-jobs",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-035",
        "AIFACTORY-TASK-1856",
        "AIFACTORY-TASK-1857",
        "AIFACTORY-TASK-1858"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5704,
      "kind": "enabling",
      "traces": {
        "services": [
          "AgentRuntimeService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-461",
        "feature:component-workers-runtime-library",
        "feature:component-worker-template-factory-profile"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/components.yaml",
        "docs/planes/agent-runtime/workers.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#workers-and-jobs",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-462]",
      "number": 462
    },
    {
      "id": "AIFACTORY-TASK-035",
      "type": "task",
      "parent": "AIFACTORY-US-462",
      "title": "Worker hosting: LeaseHeartbeat, OrphanedAttemptReconciler, CheckpointCompactor and ReleaseCacheWarmer registered on the Workers.Runtime engine",
      "sequence": "02.01.04.01",
      "description": "Worker hosting: LeaseHeartbeat, OrphanedAttemptReconciler, CheckpointCompactor and ReleaseCacheWarmer registered on the Workers.Runtime engine. Expected output: The host registers the pinned ConnectSoft.Workers.Runtime engine with drain on host stop, the idempotency and failed-work stores on agent-runtime-sql and the singleton lease under the SQL lease provider; the four jobs are in the catalog with the modelled triggers (timer of 15 seconds, every two minutes, nightly, the event AssetReleasePublished), retry policies, idempotency keys and partitioning, and a duplicate trigger has no second effect; what LeaseHeartbeat, OrphanedAttemptReconciler and ReleaseCacheWarmer do is delivered by AIFACTORY-US-469 and AIFACTORY-US-463.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The host registers the pinned ConnectSoft.Workers.Runtime engine with drain on host stop, the idempotency and failed-work stores on agent-runtime-sql and the singleton lease under the SQL lease provider; the four jobs are in the catalog with the modelled triggers (timer of 15 seconds, every two minutes, nightly, the event AssetReleasePublished), retry policies, idempotency keys and partitioning, and a duplicate trigger has no second effect; what LeaseHeartbeat, OrphanedAttemptReconciler and ReleaseCacheWarmer do is delivered by AIFACTORY-US-469 and AIFACTORY-US-463."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-035]",
      "number": 35
    },
    {
      "id": "AIFACTORY-TASK-1856",
      "type": "task",
      "parent": "AIFACTORY-US-462",
      "title": "Engine tables in agent-runtime-sql from the schema script of the engine in the scoped shape",
      "sequence": "02.01.04.02",
      "description": "Engine tables in agent-runtime-sql from the schema script of the engine in the scoped shape. Expected output: A migration of the repository applies the idempotent schema script of the pinned engine under the schema name of the service in the scoped shape: the processed-message, failed-work, lease and job tables exist, processed messages are keyed by tenant, project and message id, and failed work carries tenant, project, run, step and attempt; the migration test runs on an isolated database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "A migration of the repository applies the idempotent schema script of the pinned engine under the schema name of the service in the scoped shape: the processed-message, failed-work, lease and job tables exist, processed messages are keyed by tenant, project and message id, and failed work carries tenant, project, run, step and attempt; the migration test runs on an isolated database."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5704,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1856]",
      "number": 1856
    },
    {
      "id": "AIFACTORY-TASK-1857",
      "type": "task",
      "parent": "AIFACTORY-US-462",
      "title": "CheckpointCompactor over superseded checkpoints of terminal attempts",
      "sequence": "02.01.04.03",
      "description": "CheckpointCompactor over superseded checkpoints of terminal attempts. Expected output: The job selects the checkpoints of terminal attempts older than the retention window per tenant, the window being the fixed default of one year that model/services/agent-mesh/AgentRuntimeService.yaml states as the retention of ExecutionAttempts and no option of the service, deletes the superseded rows, keeps the last checkpoint of every attempt and every checkpoint referenced by evidence, deletes no blob because the model names no delete operation of ArtifactService, publishes nothing and is idempotent on the checkpoint id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The job selects the checkpoints of terminal attempts older than the retention window per tenant, the window being the fixed default of one year that model/services/agent-mesh/AgentRuntimeService.yaml states as the retention of ExecutionAttempts and no option of the service, deletes the superseded rows, keeps the last checkpoint of every attempt and every checkpoint referenced by evidence, deletes no blob because the model names no delete operation of ArtifactService, publishes nothing and is idempotent on the checkpoint id."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1857]",
      "number": 1857
    },
    {
      "id": "AIFACTORY-TASK-1858",
      "type": "task",
      "parent": "AIFACTORY-US-462",
      "title": "Verify the worker registration, the scoped engine tables and the compactor",
      "sequence": "02.01.04.04",
      "description": "Verify the worker registration, the scoped engine tables and the compactor. Expected output: Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Workers\"` with two replicas on an isolated database; a filter that matches no test counts as a failure; the catalog test, the conformance suite of the engine with a second tenant and the compactor test over two tenants pass and prove AC1 to AC3 of AIFACTORY-US-462 (ADR-0024, model/services/agent-mesh/AgentRuntimeService.yaml).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Workers\"` with two replicas on an isolated database; a filter that matches no test counts as a failure; the catalog test, the conformance suite of the engine with a second tenant and the compactor test over two tenants pass and prove AC1 to AC3 of AIFACTORY-US-462 (ADR-0024, model/services/agent-mesh/AgentRuntimeService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1858]",
      "number": 1858
    },
    {
      "id": "AIFACTORY-US-463",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Load a release once per adapter version, verify its hashes and its compatibility, and apply the in-flight policy when it is deprecated or revoked",
      "sequence": "02.01.05",
      "description": "As an asset maintainer, I want the runtime to run a release only after it verified the manifest against its content and against the adapter of the worker, so that an attempt executes exactly what was released, and a release that does not match fails with a reason and never runs degraded. Publication belongs to the Control plane; the runtime consumes releases, keeps a read model and has no write path to publication. The command `LoadRelease` fetches the release an attempt pinned through `AgentRegistryService/AssetPublication.LoadRelease` with the workload token of the service: a server stream that delivers the manifest of `release-manifest-v1` and then one message per closure entry with kind, asset id, exact version, hash and content reference; a release is used only after its stream completed. The loader verifies the hash of every element (agent instructions, skill contents, tool descriptors, workflow definition, policy revision, model profile requirement), fetching content by its reference from ArtifactService, and checks the runtime compatibility the manifest declares against this worker: the adapter version, the checkpoint format derived from `Runtime:Adapter:Kind` and the tool schema versions. A release that passes becomes a `LoadedRelease` row in state Verified, keyed by release id and adapter version, with `manifestHash`, the content references and `verifiedAt`, and `ReleaseLoaded` is written in the same transaction. A hash mismatch or an unsatisfied compatibility writes the row in state Rejected and `ReleaseLoadRejected` with the explicit `reason` in the same transaction; the counter `connectsoft.factory.runtime.release_load_rejected` moves, AuditService records the event as evidence in its own PBI, and every attempt of that release fails with the reason and never runs on a degraded release. Loading is idempotent on release id plus adapter version: a second load of a Verified release reads the row, calls nobody and publishes nothing. The registry is a fail-fast dependency: when it is unavailable, or its stream ends without completion, what was received is discarded, no row is written and the caller repeats the load. NOT_FOUND, the answer of the registry for an unknown release and for a release of another tenant alike, gives the waiting attempt the failure class permanent (ADR-0015 amendment of D114). The model states an explicit reason for a rejected release and no failure class; the class a hash mismatch or an incompatible adapter carries is reported to the owner, and until it is decided the suite asserts the outcome and the reason. The invariant of the read model speaks of a Published release. In I1 the thin AgentRegistryService serves only the seeded Draft releases, which run under the waiver of the amendment of ADR-0021; the loader verifies them the same way, records what the manifest states and adds no gate of its own, because the waiver is a policy decision of the run and not of the loader. A load is triggered two ways. An attempt that is being claimed has its release loaded when no Verified row exists for the adapter version of the replica (AIFACTORY-US-464). The worker `ReleaseCacheWarmer` loads a release before its first dispatch when `AssetReleasePublished` arrives for an agent or a workflow, through the inbox handler `WarmReleaseCache`, idempotent on release id plus adapter version, with five exponential retries. `AssetReleaseDeprecated` and `AssetReleaseRevoked` reach the handler `ApplyInFlightPolicy`: it records the in-flight policy of the event (finish, drain or revoke) on the row and moves a revoked release to Revoked so that no new attempt loads it. What a revocation does to work in flight is decided (decision D123). The handler applies the in-flight policy of `AssetReleaseRevoked` to the running attempts of every run whose pinned release closure holds the revoked release, not only to the attempts that pinned that release themselves. Under revoke each of those attempts is interrupted through the path of AIFACTORY-US-468: it stops at the next safe point, moves from Running, WaitingForTool or WaitingForDecision to Cancelled under the trigger `ReleaseRevokedWithPolicyRevoke` and reports its single outcome Cancelled with the failure class cancellation. Under drain the running attempt finishes and reports its own outcome, and the runtime interrupts nothing; cancelling the run after the step that is running belongs to RunControlService. Under finish nothing is done to an attempt. In every case the manifest and the content references that attempts already loaded are kept and never deleted. The handler is idempotent on the event id, so a redelivered revocation interrupts no attempt twice. The owner decided how the revoked release is found (D125): the resolved execution snapshot of a run names in `pinnedReleases` the release id of the pinned release and of every member of its closure, so the handler selects the running attempts whose snapshot names the `releaseId` of the event; the suite proves the three policies on a run that pinned the revoked release itself and on a run whose snapshot names it only as a closure member. The thin registry of I1 publishes none of these three events: `AssetReleasePublished` arrives with feature `agent-registry-service-publication` in I2 (D140), and `AssetReleaseDeprecated` and `AssetReleaseRevoked` arrive with feature `agent-registry-service-complete` in I4; the two handlers are delivered here and proven with events built from the pinned contracts package, and their proof against the publishing registry belongs to the increment that publishes each event. A caller whose scope carries `factory.assets.read` reads what this worker verified through `GetLoadedRelease`: for each adapter version the release id, the manifest hash, the state, the time of verification and the in-flight policy. A token without the scope is answered 403; a release that was never loaded and a release of another tenant are both answered 404; nothing is written. Kind: behavior. Traces: services: AgentRuntimeService, AgentRegistryService, ArtifactService; aggregates: AgentRuntimeService/LoadedRelease, AgentRuntimeService/ExecutionAttempt; apis: AgentRuntimeService/GetLoadedRelease, AgentRegistryService/AssetPublication.LoadRelease; events: AgentRuntimeService/ReleaseLoaded, AgentRuntimeService/ReleaseLoadRejected, AgentRegistryService/AssetReleasePublished, AgentRegistryService/AssetReleaseDeprecated, AgentRegistryService/AssetReleaseRevoked; descriptors: release-manifest-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0021, ADR-0024; requirements: NFR-11, NFR-13; scenarios: SCN-AgentRuntimeService-003, SCN-AgentRuntimeService-014, SCN-AgentRuntimeService-015. Relates: screens: release-detail. Depends on: AIFACTORY-US-461, AIFACTORY-US-462, feature:agent-registry-service-thin, feature:artifact-service. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/planes/agent-runtime/release-loading.md#rules, docs/reference/schemas/release-manifest.schema.json, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given a release whose stream from `AgentRegistryService/AssetPublication.LoadRelease` completed and whose hashes and compatibility hold, when `LoadRelease` runs, then an `AgentRuntimeService/LoadedRelease` in state Verified exists for release id and adapter version and `AgentRuntimeService/ReleaseLoaded` is written in the same transaction and published on `execution.releases.v1.release-loaded` in the run event envelope with `releaseId`, `tenantId`, `manifestHash` and `adapterVersion`; a second load of the same release and adapter version calls nobody and publishes nothing, and a transport outage is retried with backoff without loss or duplicate under the event id (SCN-AgentRuntimeService-014, ADR-0012).",
        "AC2: Given a manifest with a hash that does not match its content, or a compatibility this worker does not satisfy, when `LoadRelease` runs, then the row is written in state Rejected, `AgentRuntimeService/ReleaseLoadRejected` is written in the same transaction and published on `execution.releases.v1.release-load-rejected` with `releaseId`, `tenantId`, `reason` and `adapterVersion`, `connectsoft.factory.runtime.release_load_rejected` counts it by reason, and an attempt of that release fails with the reason and never runs (SCN-AgentRuntimeService-015, docs/planes/agent-runtime/release-loading.md).",
        "AC3: Given the registry is unavailable, its stream ends without completion, or it answers NOT_FOUND, when `LoadRelease` runs, then in the first two cases nothing received is used, no `AgentRuntimeService/LoadedRelease` row is written and the caller repeats the load, and in the third the waiting attempt fails with the failure class permanent, the same for an unknown release and for a release of another tenant (ADR-0015, model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC4: Given a caller with `factory.assets.read` and a release this worker loaded, when `AgentRuntimeService/GetLoadedRelease` is called, then the response is 200 with release id, manifest hash, adapter version, state, verification time and in-flight policy; a token without the scope is answered 403, a release never loaded and a release of another tenant are both answered 404 with a problem response, and nothing is written (SCN-AgentRuntimeService-003, ADR-0015).",
        "AC5: Given `AgentRegistryService/AssetReleasePublished`, `AgentRegistryService/AssetReleaseDeprecated` and `AgentRegistryService/AssetReleaseRevoked` built from the pinned contracts package, when each is delivered, the first twice, then `ReleaseCacheWarmer` loads the published release once under the key release id plus adapter version, `ApplyInFlightPolicy` records the in-flight policy on the row, a revoked release is in state Revoked and is loaded by no new attempt, and the policy of `AssetReleaseRevoked` is applied to the running attempts of every run whose pinned release closure holds the revoked release: under revoke each such attempt is interrupted, ends Cancelled under `ReleaseRevokedWithPolicyRevoke` and reports one outcome with the failure class cancellation, under drain it finishes with its own outcome, under finish nothing changes for it, an attempt of a run whose closure does not hold the release is untouched, a redelivered event interrupts nothing twice, and the manifest hash and the content references stay in every case (ADR-0021, model/services/agent-mesh/AgentRuntimeService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/agent-runtime/release-loading.md#rules",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1859",
        "AIFACTORY-TASK-1860",
        "AIFACTORY-TASK-1861",
        "AIFACTORY-TASK-1862"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5705,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "AgentRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "AgentRuntimeService/LoadedRelease",
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "AgentRuntimeService/GetLoadedRelease",
          "AgentRegistryService/AssetPublication.LoadRelease"
        ],
        "events": [
          "AgentRuntimeService/ReleaseLoaded",
          "AgentRuntimeService/ReleaseLoadRejected",
          "AgentRegistryService/AssetReleasePublished",
          "AgentRegistryService/AssetReleaseDeprecated",
          "AgentRegistryService/AssetReleaseRevoked"
        ],
        "descriptors": [
          "release-manifest-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021",
          "ADR-0024"
        ],
        "requirements": [
          "NFR-11",
          "NFR-13"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-003",
          "SCN-AgentRuntimeService-014",
          "SCN-AgentRuntimeService-015"
        ]
      },
      "relates": {
        "screens": [
          "release-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-461",
        "AIFACTORY-US-462",
        "feature:agent-registry-service-thin",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/planes/agent-runtime/release-loading.md#rules",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-463]",
      "number": 463
    },
    {
      "id": "AIFACTORY-TASK-1859",
      "type": "task",
      "parent": "AIFACTORY-US-463",
      "title": "Release loader with hash and compatibility verification, the LoadedRelease read model and GetLoadedRelease",
      "sequence": "02.01.05.01",
      "description": "Release loader with hash and compatibility verification, the LoadedRelease read model and GetLoadedRelease. Expected output: The command LoadRelease streams the manifest and the closure through AssetPublication.LoadRelease under the workload token, uses a release only after the stream completed, verifies every hash against the content fetched from ArtifactService and the declared compatibility against the adapter version, checkpoint format and tool schema versions of the worker, writes the row Verified with ReleaseLoaded or Rejected with ReleaseLoadRejected and its reason in one transaction, is idempotent on release id plus adapter version, writes nothing when the registry is unavailable and maps NOT_FOUND to the failure class permanent; GetLoadedRelease returns the rows of a release under the tenant filter with 403 for a missing scope and 404 for an unknown or foreign release.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The command LoadRelease streams the manifest and the closure through AssetPublication.LoadRelease under the workload token, uses a release only after the stream completed, verifies every hash against the content fetched from ArtifactService and the declared compatibility against the adapter version, checkpoint format and tool schema versions of the worker, writes the row Verified with ReleaseLoaded or Rejected with ReleaseLoadRejected and its reason in one transaction, is idempotent on release id plus adapter version, writes nothing when the registry is unavailable and maps NOT_FOUND to the failure class permanent; GetLoadedRelease returns the rows of a release under the tenant filter with 403 for a missing scope and 404 for an unknown or foreign release."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1859]",
      "number": 1859
    },
    {
      "id": "AIFACTORY-TASK-1860",
      "type": "task",
      "parent": "AIFACTORY-US-463",
      "title": "Inbox handlers WarmReleaseCache and ApplyInFlightPolicy with the ReleaseCacheWarmer job",
      "sequence": "02.01.05.02",
      "description": "Inbox handlers WarmReleaseCache and ApplyInFlightPolicy with the ReleaseCacheWarmer job. Expected output: WarmReleaseCache hands AssetReleasePublished of an agent or a workflow to the ReleaseCacheWarmer job, which loads the release once under the key release id plus adapter version with five exponential retries; ApplyInFlightPolicy records finish, drain or revoke on the row for AssetReleaseDeprecated and AssetReleaseRevoked, moves a revoked release to Revoked and, idempotently on the event id, applies the policy of AssetReleaseRevoked to the running attempts of every run whose pinned release closure holds the revoked release, found as the attempts whose resolved execution snapshot names the releaseId of the event in pinnedReleases (D125): under revoke it interrupts each of them through the interruption path of AIFACTORY-US-468, so that the attempt ends Cancelled under ReleaseRevokedWithPolicyRevoke with the failure class cancellation, under drain it lets the attempt finish and under finish it does nothing; nothing an attempt loaded is deleted.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "WarmReleaseCache hands AssetReleasePublished of an agent or a workflow to the ReleaseCacheWarmer job, which loads the release once under the key release id plus adapter version with five exponential retries; ApplyInFlightPolicy records finish, drain or revoke on the row for AssetReleaseDeprecated and AssetReleaseRevoked, moves a revoked release to Revoked and, idempotently on the event id, applies the policy of AssetReleaseRevoked to the running attempts of every run whose pinned release closure holds the revoked release, found as the attempts whose resolved execution snapshot names the releaseId of the event in pinnedReleases (D125): under revoke it interrupts each of them through the interruption path of AIFACTORY-US-468, so that the attempt ends Cancelled under ReleaseRevokedWithPolicyRevoke with the failure class cancellation, under drain it lets the attempt finish and under finish it does nothing; nothing an attempt loaded is deleted."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1860]",
      "number": 1860
    },
    {
      "id": "AIFACTORY-TASK-1861",
      "type": "task",
      "parent": "AIFACTORY-US-463",
      "title": "Fake registry with valid, mismatching and incompatible manifests and release events from the contracts package",
      "sequence": "02.01.05.03",
      "description": "Fake registry with valid, mismatching and incompatible manifests and release events from the contracts package. Expected output: The acceptance suite holds a fake of AssetPublication.LoadRelease that streams a valid release, a release with one wrong hash, a release with an unsatisfied compatibility, a stream that ends without completion and a NOT_FOUND, content for each reference in a fake of ArtifactService, and AssetReleasePublished, AssetReleaseDeprecated and AssetReleaseRevoked events built from the pinned contracts package for two tenants, the revocation once with each in-flight policy, finish, drain and revoke, together with running attempts of a run that pinned the revoked release, of a run whose snapshot names it in pinnedReleases as a closure member (D125) and of a run whose snapshot does not name it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of AssetPublication.LoadRelease that streams a valid release, a release with one wrong hash, a release with an unsatisfied compatibility, a stream that ends without completion and a NOT_FOUND, content for each reference in a fake of ArtifactService, and AssetReleasePublished, AssetReleaseDeprecated and AssetReleaseRevoked events built from the pinned contracts package for two tenants, the revocation once with each in-flight policy, finish, drain and revoke, together with running attempts of a run that pinned the revoked release, of a run whose snapshot names it in pinnedReleases as a closure member (D125) and of a run whose snapshot does not name it."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5705,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1861]",
      "number": 1861
    },
    {
      "id": "AIFACTORY-TASK-1862",
      "type": "task",
      "parent": "AIFACTORY-US-463",
      "title": "Verify release loading, rejection, the read and the in-flight policy",
      "sequence": "02.01.05.04",
      "description": "Verify release loading, rejection, the read and the in-flight policy. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-003|Scenario=SCN-AgentRuntimeService-014|Scenario=SCN-AgentRuntimeService-015)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-463: the Verified row with ReleaseLoaded and the silent second load, the Rejected row with ReleaseLoadRejected and its reason, the discarded incomplete stream, the permanent class after NOT_FOUND, the 200, 403 and 404 of GetLoadedRelease over two tenants, the single warm load of a published release, the Revoked state, the attempt interrupted under revoke that ends Cancelled with the failure class cancellation, the attempt that finishes under drain, the attempt left alone under finish, the attempt of a run whose closure does not hold the release left alone under every policy, and the redelivered revocation that interrupts nothing twice.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-003|Scenario=SCN-AgentRuntimeService-014|Scenario=SCN-AgentRuntimeService-015)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-463: the Verified row with ReleaseLoaded and the silent second load, the Rejected row with ReleaseLoadRejected and its reason, the discarded incomplete stream, the permanent class after NOT_FOUND, the 200, 403 and 404 of GetLoadedRelease over two tenants, the single warm load of a published release, the Revoked state, the attempt interrupted under revoke that ends Cancelled with the failure class cancellation, the attempt that finishes under drain, the attempt left alone under finish, the attempt of a run whose closure does not hold the release left alone under every policy, and the redelivered revocation that interrupts nothing twice."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1862]",
      "number": 1862
    },
    {
      "id": "AIFACTORY-US-464",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Claim a dispatched attempt under its lease, build its context and start the loop once",
      "sequence": "02.01.06",
      "description": "Work reaches the runtime one way only: `RunControlService/AttemptDispatched` arrives in the inbox of the `agent-runtime` profile with `runId`, `stepId`, `attemptId`, `leaseId`, `fencingToken`, `agentId` and the optional `skillId`, in the run event envelope that carries the trusted tenant and project. The handler `ClaimAndStart` is idempotent on the event id and on the attempt: a redelivery finds the attempt row and starts nothing twice. It activates the `AttemptGrain` of the attempt, which serialises everything that follows, and claims the lease through `RunControlService/RunControl.AcquireLease` with `acquire-lease-v1`, naming the attempt, the `leaseId` it saw in the event and, as `holder`, the value of `ConnectSoftIdentityPlatform:WorkloadIdentity`. That value is the one identity of the service and the same on every replica: exclusivity between replicas comes from the single activation of the `AttemptGrain` and from the fencing token, never from a holder per replica, and a grain that re-activates on another replica renews the lease the first one claimed (AIFACTORY-US-469). The dispatcher created the lease Unclaimed; this first call moves it to Claimed and starts its clock, and the reply `lease-v1` carries the lease id, the expiry, the fencing token, the `snapshotId` and, for the task handoff, `taskContractRef`, `taskContractHash`, `snapshotRef` and `snapshotHash`. It also carries `attemptToken`, a short-lived token bound to the run, the step and the attempt that the Authorization Server issued and that lives no longer than the lease (D125): the runtime hands it to the attempt, which presents it on the OpenAI-compatible route of the model gateway as the proof that its model call belongs to the run, keeps it in memory only and never writes it to a row, a checkpoint, a log or a trace. The attempt row is written in state Claimed with phase Resolving and with the lease id and the fencing token of the reply; the fencing token from then on accompanies every outbound call and the outcome report. When the lease was already claimed by another holder the call is refused and the handler stops without a row: the other holder runs the attempt. When Run Control answers NOT_FOUND, which is its answer for an unknown attempt and for an attempt of another tenant alike, the handler stops and nothing is written. When Run Control is unreachable the handler fails fast and the inbox redelivers; a lease nobody claimed within `RunControl:Leases:ClaimTimeoutSeconds` is expired by Run Control and the same attempt is dispatched again under a new Unclaimed lease. Because the claim names the lease the handler saw, a claim made from the stale `AttemptDispatched` names a superseded lease: Run Control answers FAILED_PRECONDITION and changes nothing (decisions D119 and D121), the handler stops and writes no row, and the second `AttemptDispatched`, which names the current lease, is claimed and starts the attempt once. The attempt needs its task contract (`agent-task-contract-v1`: objective, inputs, allowed tools, model profile, expected output, validation and limits) and the content of its snapshot (`resolved-execution-snapshot-v1`: release, policy revision, model profile and limits). Neither document travels in the dispatch event or in the reply: the reply carries a reference and a hash for the task contract of the attempt and for the resolved execution snapshot of the run (decision D119, amendment of ADR-0014). The runtime writes neither document (decision D121): WorkflowEngineService stored the task contract in ArtifactService when it announced the step ready, and the reference and the hash of the reply are the ones `StepReady` carried for the step and Run Control copied to the attempt; RunControlService stored the snapshot once, when it accepted the run. The task contract describes the step and no attempt (decision D123): `attemptId`, the `stepId` of RunControlService and `snapshotId` are no required members of `agent-task-contract-v1` and the runtime expects none of them in the document; the attempt takes its ids and the reference of its snapshot from the answer of `AcquireLease`, and a retried attempt of the step reads the same contract under the same reference and hash. The handler reads both through the task contract port of the service, whose one binding fetches the content from ArtifactService by reference through `ArtifactService/Artifacts.Fetch` under the workload token of the service, hashes what it read, compares the result with the hash of the reply and validates each document against its schema; the acceptance suite runs the same binding against a fake of ArtifactService and binds no fixture to the port. `releaseId`, `modelProfileId`, the limits and `maxCorrections` of the attempt row come from the two documents. Content that does not match its hash is never used: an attempt whose task contract or snapshot does not match its hash, fails its schema, or cannot be read because ArtifactService holds nothing under the reference or does not answer, ends Failed before it runs (trigger `StartFailed`) with the reason and never runs on defaults. With the contract in hand the grain passes the phases LoadingRelease and BuildingContext: it has the release loaded and verified (AIFACTORY-US-463) and asks `ContextBuilderService/ContextAssembly.Assemble` for the context of the step within `Runtime:Context:MaxContextTokens`; in I1 the thin ContextBuilderService passes the pinned artifacts of the step through as its context package, without budget, ranking or provenance. The limits of the attempt (`AttemptLimits`) and `maxCorrections` come from the contract, and `Runtime:Attempts:DefaultMaxCorrections` applies when the contract sets none. When release and context are ready the grain writes the first checkpoint, moves the attempt from Claimed to Running (trigger `ReleaseLoadedAndContextBuilt`) and writes `AttemptStarted` with `attemptId`, `runId`, `stepId`, `tenantId`, `releaseId`, `snapshotId` and `fencingToken` in the same transaction; the claim latency objective of the model, from dispatch to `AttemptStarted` within 5 seconds at the 95th percentile, is measured from the two timestamps. Two further failures end an attempt before it runs. A rejected release ends it Failed with the reason of the rejection. An unavailable ContextBuilderService, a dependency of the degrade kind, is retried within the budget of the attempt and ends it Failed with the failure class transient when the budget is exhausted. Both report their outcome as AIFACTORY-US-467 specifies and use the transition Claimed to Failed under the trigger `StartFailed` of the model, as does the attempt whose task contract or snapshot cannot be used. `Runtime:Host:MaxConcurrentAttempts` bounds the attempts one replica executes at once and the free slots are published as `connectsoft.factory.runtime.attempt_slots`; the registration of that capacity with the execution capacity pool named by `Runtime:Host:PoolId` is an optional dependency of the degrade kind, and its absence blocks no claim. Kind: behavior. Traces: services: AgentRuntimeService, RunControlService, ContextBuilderService, ArtifactService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: RunControlService/RunControl.AcquireLease, ContextBuilderService/ContextAssembly.Assemble, ArtifactService/Artifacts.Fetch; events: AgentRuntimeService/AttemptStarted, RunControlService/AttemptDispatched; descriptors: acquire-lease-v1, lease-v1, agent-task-contract-v1, resolved-execution-snapshot-v1, context-package-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024; requirements: FR-03, FR-07; scenarios: SCN-AgentRuntimeService-007. Depends on: AIFACTORY-US-461, AIFACTORY-US-463, feature:run-control-service, feature:context-builder-service-thin, feature:artifact-service. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/attempt-outcome.schema.json, docs/reference/schemas/agent-task-contract.schema.json, docs/reference/schemas/resolved-execution-snapshot.schema.json, docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a dispatched attempt whose lease is Unclaimed, when `RunControlService/AttemptDispatched` is handled by `ClaimAndStart`, then `RunControlService/RunControl.AcquireLease` is called once with the `leaseId` of the event and the value of `ConnectSoftIdentityPlatform:WorkloadIdentity` as `holder`, the same value on every replica, the `AgentRuntimeService/ExecutionAttempt` is written in state Claimed with the lease id and the fencing token of `lease-v1`, its task contract and snapshot content are read through `ArtifactService/Artifacts.Fetch` by the references of `lease-v1` and match the hashes of `lease-v1`, a task contract that describes the step and carries no `attemptId`, no `stepId` of RunControlService and no `snapshotId` is accepted, the ids of the attempt and the reference of its snapshot being taken from `lease-v1`, a second attempt of the same step reads the same contract, and after the release is verified and `ContextBuilderService/ContextAssembly.Assemble` returned the context package the attempt moves to Running with its first checkpoint and `AgentRuntimeService/AttemptStarted` written in the same transaction (SCN-AgentRuntimeService-007, ADR-0024).",
        "AC2: Given the attempt started, when the outbox dispatcher publishes `AgentRuntimeService/AttemptStarted` on `execution.attempts.v1.attempt-started`, then the event is sent in the run event envelope with `attemptId`, `runId`, `stepId`, `tenantId`, `releaseId`, `snapshotId` and `fencingToken`, a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, and a redelivered `RunControlService/AttemptDispatched` starts no second attempt and publishes no second event (SCN-AgentRuntimeService-007, ADR-0012).",
        "AC3: Given a lease already claimed by another holder, an attempt for which Run Control answers NOT_FOUND, or an unreachable Run Control, when `ClaimAndStart` runs, then in the first two cases the handler stops, no attempt row exists and no event is published, and in the third the handler fails fast and the inbox redelivers; given the lease expired Unclaimed and the same attempt was dispatched again under a new lease, when the claim of the first `RunControlService/AttemptDispatched` arrives late, then it names the superseded lease, Run Control answers FAILED_PRECONDITION and nothing changes, no row is written for it, and the claim of the second dispatch event, which names the current lease, starts the attempt once with the lease id and the fencing token of its reply `lease-v1` (SCN-AgentRuntimeService-007, ADR-0015).",
        "AC4: Given a claimed attempt whose release is rejected, whose context assembly stays unavailable until the budget of the attempt is exhausted, or whose task contract or snapshot cannot be read from ArtifactService or does not match the hash of `lease-v1`, when the grain gives up, then no `AgentRuntimeService/AttemptStarted` is written, the attempt ends Failed under `StartFailed` with the reason, in the second case with the failure class transient, content that does not match its hash is never used, no default stands in for a missing contract, and its single outcome is reported (FR-07, model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC5: Given a `lease-v1` answer of `RunControlService/RunControl.AcquireLease` that carries an `attemptToken`, when the `AgentRuntimeService/ExecutionAttempt` runs and makes a model call, then the attempt presents that token on the OpenAI-compatible route of the model gateway, and the token appears in no row, no checkpoint, no log record and no trace span the service writes, the logs and traces of the attempt being searched for its value by the test (D125, model/services/agent-mesh/AgentRuntimeService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/reference/schemas/resolved-execution-snapshot.schema.json",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-200",
        "AIFACTORY-TASK-1896",
        "AIFACTORY-TASK-1863",
        "AIFACTORY-TASK-1864"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5706,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "RunControlService",
          "ContextBuilderService",
          "ArtifactService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "RunControlService/RunControl.AcquireLease",
          "ContextBuilderService/ContextAssembly.Assemble",
          "ArtifactService/Artifacts.Fetch"
        ],
        "events": [
          "AgentRuntimeService/AttemptStarted",
          "RunControlService/AttemptDispatched"
        ],
        "descriptors": [
          "acquire-lease-v1",
          "lease-v1",
          "agent-task-contract-v1",
          "resolved-execution-snapshot-v1",
          "context-package-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "FR-03",
          "FR-07"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-461",
        "AIFACTORY-US-463",
        "feature:run-control-service",
        "feature:context-builder-service-thin",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/reference/schemas/resolved-execution-snapshot.schema.json",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-464]",
      "number": 464
    },
    {
      "id": "AIFACTORY-TASK-200",
      "type": "task",
      "parent": "AIFACTORY-US-464",
      "title": "ClaimAndStart with the AttemptGrain, the lease claim, the context and the first checkpoint",
      "sequence": "02.01.06.01",
      "description": "ClaimAndStart with the AttemptGrain, the lease claim, the context and the first checkpoint. Expected output: The inbox handler ClaimAndStart activates the AttemptGrain, claims the lease through RunControl.AcquireLease with the leaseId of the event and the value of ConnectSoftIdentityPlatform:WorkloadIdentity as holder, the same on every replica, writes the attempt Claimed with the lease id and the fencing token of the reply lease-v1, reads the task contract and the snapshot through the task contract port by the references of the reply and uses them only when they match its hashes (AIFACTORY-TASK-1896), has the release loaded, asks ContextAssembly.Assemble for the context within Runtime:Context:MaxContextTokens, writes the first checkpoint and moves the attempt to Running with AttemptStarted in one transaction; it hands the attemptToken of the reply to the attempt in memory for its model calls and writes it to no row, checkpoint, log or trace, a redaction filter of the logging pipeline removing the member wherever lease-v1 is logged (D125); a redelivery, a lease claimed by another holder and a NOT_FOUND start nothing, a claim made from a stale dispatch event names a superseded lease, is answered FAILED_PRECONDITION by Run Control and writes no row, the dispatch event of the current lease then starts the attempt once, an unreachable Run Control fails fast, and a rejected release, an exhausted context retry, or a task contract or a snapshot that cannot be read or does not match its hash ends the attempt Failed under StartFailed with its reason.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The inbox handler ClaimAndStart activates the AttemptGrain, claims the lease through RunControl.AcquireLease with the leaseId of the event and the value of ConnectSoftIdentityPlatform:WorkloadIdentity as holder, the same on every replica, writes the attempt Claimed with the lease id and the fencing token of the reply lease-v1, reads the task contract and the snapshot through the task contract port by the references of the reply and uses them only when they match its hashes (AIFACTORY-TASK-1896), has the release loaded, asks ContextAssembly.Assemble for the context within Runtime:Context:MaxContextTokens, writes the first checkpoint and moves the attempt to Running with AttemptStarted in one transaction; it hands the attemptToken of the reply to the attempt in memory for its model calls and writes it to no row, checkpoint, log or trace, a redaction filter of the logging pipeline removing the member wherever lease-v1 is logged (D125); a redelivery, a lease claimed by another holder and a NOT_FOUND start nothing, a claim made from a stale dispatch event names a superseded lease, is answered FAILED_PRECONDITION by Run Control and writes no row, the dispatch event of the current lease then starts the attempt once, an unreachable Run Control fails fast, and a rejected release, an exhausted context retry, or a task contract or a snapshot that cannot be read or does not match its hash ends the attempt Failed under StartFailed with its reason."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-200]",
      "number": 200
    },
    {
      "id": "AIFACTORY-TASK-1896",
      "type": "task",
      "parent": "AIFACTORY-US-464",
      "title": "Task handoff read: the task contract and the snapshot from ArtifactService by the references of the lease answer, verified against their hashes",
      "sequence": "02.01.06.02",
      "description": "Task handoff read: the task contract and the snapshot from ArtifactService by the references of the lease answer, verified against their hashes. Expected output: The one binding of the task contract port fetches the agent-task-contract-v1 and the resolved-execution-snapshot-v1 of an attempt from ArtifactService through Artifacts.Fetch by taskContractRef and snapshotRef of the reply lease-v1 under the workload token of the service, hashes the content, compares it with taskContractHash and snapshotHash and validates both documents against their schemas, where the task contract describes the step and needs no attemptId, no stepId of RunControlService and no snapshotId, the ids of the attempt and the reference of its snapshot coming from the reply lease-v1; a mismatch, a schema failure, a reference under which ArtifactService holds nothing and an ArtifactService that does not answer end the attempt Failed under StartFailed with the reason, and content that does not match its hash is never used; no seeded source and no second binding exists, no option selects the binding, and a test proves the verified read, the mismatch, the schema refusal and the missing reference.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The one binding of the task contract port fetches the agent-task-contract-v1 and the resolved-execution-snapshot-v1 of an attempt from ArtifactService through Artifacts.Fetch by taskContractRef and snapshotRef of the reply lease-v1 under the workload token of the service, hashes the content, compares it with taskContractHash and snapshotHash and validates both documents against their schemas, where the task contract describes the step and needs no attemptId, no stepId of RunControlService and no snapshotId, the ids of the attempt and the reference of its snapshot coming from the reply lease-v1; a mismatch, a schema failure, a reference under which ArtifactService holds nothing and an ArtifactService that does not answer end the attempt Failed under StartFailed with the reason, and content that does not match its hash is never used; no seeded source and no second binding exists, no option selects the binding, and a test proves the verified read, the mismatch, the schema refusal and the missing reference."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1896]",
      "number": 1896
    },
    {
      "id": "AIFACTORY-TASK-1863",
      "type": "task",
      "parent": "AIFACTORY-US-464",
      "title": "Fakes of Run Control, the context builder and the artifact store for the claim and the task handoff",
      "sequence": "02.01.06.03",
      "description": "Fakes of Run Control, the context builder and the artifact store for the claim and the task handoff. Expected output: The acceptance suite holds a fake of RunControl.AcquireLease that claims an Unclaimed lease for the leaseId the claim names and answers lease-v1 with taskContractRef, taskContractHash, snapshotRef, snapshotHash and a recognisable attemptToken (D125), refuses a second holder, answers NOT_FOUND, can be stopped and can expire an Unclaimed lease and dispatch the same attempt again, after which a claim that names the superseded lease is answered FAILED_PRECONDITION and a claim that names the new lease is answered with lease-v1, a fake of ContextAssembly.Assemble that returns the pinned artifacts as a context package or stays unavailable, AttemptDispatched events built from the pinned contracts package, and a fake of Artifacts.Fetch that holds the agent-task-contract-v1 of a step, written without attemptId, stepId and snapshotId and returned under the same reference for every attempt of the step, and the snapshot content under the references of the fake lease answer and can return content that does not match the hash, hold nothing under a reference or be stopped.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of RunControl.AcquireLease that claims an Unclaimed lease for the leaseId the claim names and answers lease-v1 with taskContractRef, taskContractHash, snapshotRef, snapshotHash and a recognisable attemptToken (D125), refuses a second holder, answers NOT_FOUND, can be stopped and can expire an Unclaimed lease and dispatch the same attempt again, after which a claim that names the superseded lease is answered FAILED_PRECONDITION and a claim that names the new lease is answered with lease-v1, a fake of ContextAssembly.Assemble that returns the pinned artifacts as a context package or stays unavailable, AttemptDispatched events built from the pinned contracts package, and a fake of Artifacts.Fetch that holds the agent-task-contract-v1 of a step, written without attemptId, stepId and snapshotId and returned under the same reference for every attempt of the step, and the snapshot content under the references of the fake lease answer and can return content that does not match the hash, hold nothing under a reference or be stopped."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5706,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1863]",
      "number": 1863
    },
    {
      "id": "AIFACTORY-TASK-1864",
      "type": "task",
      "parent": "AIFACTORY-US-464",
      "title": "Verify the claim, the task handoff, the start and the failures before the start",
      "sequence": "02.01.06.04",
      "description": "Verify the claim, the task handoff, the start and the failures before the start. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRuntimeService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-464: the single claim that names the lease of the event, the Claimed row, the task contract and the snapshot read by the references of the reply and matching its hashes, the step contract without attemptId, stepId and snapshotId accepted and read again by a second attempt of the step, the first checkpoint and AttemptStarted in one transaction, the payload and the retry of the publication, the redelivered dispatch, the lease of another holder, the NOT_FOUND, the unreachable Run Control, the redispatched lease, where a late claim of the first dispatch event names the superseded lease, is answered FAILED_PRECONDITION and writes no row and the second dispatch event starts the attempt once, the holder value read from ConnectSoftIdentityPlatform:WorkloadIdentity, and the attempt that fails before it runs for a rejected release, an exhausted context retry, content that does not match its hash and a reference under which the artifact store holds nothing, and the attemptToken of the fake lease answer presented on the model call of the attempt and found in no row, checkpoint, log record or trace span.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRuntimeService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-464: the single claim that names the lease of the event, the Claimed row, the task contract and the snapshot read by the references of the reply and matching its hashes, the step contract without attemptId, stepId and snapshotId accepted and read again by a second attempt of the step, the first checkpoint and AttemptStarted in one transaction, the payload and the retry of the publication, the redelivered dispatch, the lease of another holder, the NOT_FOUND, the unreachable Run Control, the redispatched lease, where a late claim of the first dispatch event names the superseded lease, is answered FAILED_PRECONDITION and writes no row and the second dispatch event starts the attempt once, the holder value read from ConnectSoftIdentityPlatform:WorkloadIdentity, and the attempt that fails before it runs for a rejected release, an exhausted context retry, content that does not match its hash and a reference under which the artifact store holds nothing, and the attemptToken of the fake lease answer presented on the model call of the attempt and found in no row, checkpoint, log record or trace span."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5706,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1864]",
      "number": 1864
    },
    {
      "id": "AIFACTORY-US-465",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Run the plan, call, observe and verify loop with a checkpoint before every gated call and bounded self-correction",
      "sequence": "02.01.07",
      "description": "A Running attempt executes the loop of the service on the execution adapter, the Microsoft Agent Framework under `Runtime:Adapter:Kind` maf, in-process under its `AttemptGrain` and through the single execution port of the host. The loop moves through the phases Planning, Calling, Observing, Verifying, Correcting, Checkpointing and Reporting, and every move writes `AttemptPhaseChanged` with `phase` and `state` in the transaction of the transition. A model call goes through the model gateway with the Factory model client of the pinned AI libraries (feature `component-extensions-ai`): `ModelRouterService/ModelGateway.Invoke` is called with the pinned model profile, the scope of the attempt and the fencing token and returns the completion with its invocation receipt. The runtime never names a provider or a model; when the gateway is degraded the fallback chain of the profile applies inside ModelRouterService, and when the chain is exhausted the attempt ends Failed with the failure class transient. A tool call goes through the tool gateway with the Factory tool client. The grain first asks `PolicyEngineService/Policy.Decide` for the decision on the proposed call; a call to a tool outside the allowed tools of the task contract, or a call with a denied decision, is never sent and is a call record with the status failed and the reason of the refusal, which the agent receives as its observation; an allowed call is issued through `ToolAdapterService/ToolExecutor.Invoke` with the policy decision id and the fencing token. The runtime opens no connection to an external system itself and executes no tool in the host (ADR-0022). Every call is a `CallRecord` with its sequence, kind, target, request hash, policy decision id and, once observed, the receipt reference and the status issued, observed, uncertain or failed; a prompt, a completion or a tool payload is stored nowhere in `agent-runtime-sql`. Issuing a tool call moves the attempt from Running to WaitingForTool (trigger `ToolCallIssued`) and the observed result moves it back to Running (trigger `ToolResultObserved`). A tool call that the tool gateway reports as failed is an observation and no terminal error: its call record holds the status failed with the receipt reference, the attempt returns to Running, a checkpoint follows, and the agent plans again within its budgets. A checkpoint is written before every gated call, that is every call of class shared-write or above, after every observed outcome, and in addition every `Runtime:Attempts:CheckpointEveryCalls` calls: the adapter state is stored through ArtifactService as an opaque blob, the `Checkpoint` row records sequence, phase, the blob reference, the adapter version and its hash, and `AttemptCheckpointed` with `checkpointId`, `sequence` and `adapterVersion` is written in the same transaction; the objective of the model for a checkpoint write is 500 milliseconds at the 95th percentile. ArtifactService, PolicyEngineService and ToolAdapterService are fail-fast dependencies, and the grain does not wait for one of them. Without the checkpoint or without the decision the gated call is not issued, and without the tool gateway no tool call is. The proposed call is a call record with the status failed and a reason that names the unavailable dependency, and the attempt ends Failed (trigger `CorrectionsExhaustedOrTerminalError`) with that reason; the terminal state is committed without a further checkpoint. The model names no failure class for an unavailable fail-fast dependency; the class decides whether Run Control retries the attempt, so it is reported to the owner, and until it is decided the suite asserts the state and the reason only. When the agent produced its output, the output is verified against the expected output and the validation of the task contract. A failed verification starts a correction with the validator feedback and counts `correctionCount`; when the count reaches `maxCorrections` the attempt ends Failed with the failure class validation and the feedback attached, never as a silent success. The limits of the attempt are enforced by the grain, and each has one observable result. When `maxModelCalls` or `maxToolCalls` is reached, the next call of that kind is not issued and the attempt ends Failed (trigger `CorrectionsExhaustedOrTerminalError`) with a reason that names the exhausted budget; the model names no failure class for it, which is reported to the owner, and the suite asserts the state and the reason. When the reminder `call-timeout` fires for a model call, the call is abandoned, its call record is failed with the reason, and the attempt ends Failed with the failure class transient, which is the recovery the model states for a degraded model gateway, detected by invocation errors and latency. When it fires for a tool call, the call is interrupted through `ToolAdapterService/ToolExecutor.Interrupt` and settled by its receipt: observed when the receipt confirms the effect or its absence, upon which the loop continues with that observation, and uncertain when the effect cannot be confirmed, upon which the attempt moves to Uncertain (trigger `EffectUnconfirmed`). The reminder `attempt-budget` moves a Running attempt to TimedOut (trigger `AttemptBudgetExceeded`) when `maxMinutes` elapse. An exception the adapter does not handle never leaves the attempt without an end: ADR-0014 decision 2 requires the exception path to emit a terminal Failed, so the grain ends the attempt Failed through the same trigger with the reason and a diagnostics reference in the error of the receipt, without prompt or payload text; the class of an unexpected adapter error is not named by the model either and is reported with the two above. When ToolAdapterService announces `ToolEffectUncertain` for a call of the attempt, the handler `SuspendOnUncertainEffect` settles the call record as uncertain and the attempt moves from WaitingForTool to Uncertain (trigger `EffectUnconfirmed`): the runtime retries nothing, `connectsoft.factory.runtime.uncertain_outcomes` counts it, the outcome Uncertain is reported as it is, and the runtime waits for nothing itself: for a step of class shared-write or above RunControlService opens the operator decision for the Operator of the project, who records the finding on the effect there, applied or not-applied, and chooses retry, compensate or fail; RunControlService records that finding in ToolAdapterService and refuses the choice retry unless the finding is not-applied, and the runtime records no finding and confirms no effect itself (decisions D119 and D121). So that the operator decision knows which effect is in question, the reported outcome marks the tool invocation whose effect is uncertain: the `invocationId` of the event is written to the optional member `uncertainToolInvocationId` of `attempt-outcome-v1`, and RunControlService keeps that id on the operator decision it opens (decision D123). A gated call that needs a human approval stops the loop as AIFACTORY-US-466 specifies; the verified output, the failure, the timeout and the uncertain settlement are reported as AIFACTORY-US-467 specifies. Kind: behavior. Traces: services: AgentRuntimeService, ModelRouterService, ToolAdapterService, PolicyEngineService, ArtifactService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: ModelRouterService/ModelGateway.Invoke, ToolAdapterService/ToolExecutor.Invoke, ToolAdapterService/ToolExecutor.Interrupt, PolicyEngineService/Policy.Decide; events: AgentRuntimeService/AttemptPhaseChanged, AgentRuntimeService/AttemptCheckpointed, ToolAdapterService/ToolEffectUncertain; descriptors: model-invocation-v1, tool-invocation-v1, policy-decision-v1, agent-task-contract-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0022, ADR-0024; requirements: FR-05, NFR-05, XL-04, XL-06; scenarios: SCN-AgentRuntimeService-008, SCN-AgentRuntimeService-009. Depends on: AIFACTORY-US-464, feature:component-extensions-ai, feature:component-agent-template-factory-access, feature:model-router-service, feature:model-gateway-host, feature:tool-adapter-service, feature:tool-executor-host, feature:policy-engine-service, feature:artifact-service. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/security.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a Running attempt, when the loop moves between phases, then each move writes `AgentRuntimeService/AttemptPhaseChanged` in the transaction of the transition and the dispatcher publishes it on `execution.attempts.v1.attempt-phase-changed` in the run event envelope with `attemptId`, `runId`, `tenantId`, `phase` and `state`, retried with backoff on a transport outage without loss or duplicate under its event id (SCN-AgentRuntimeService-008, ADR-0012).",
        "AC2: Given a model call and a tool call of the attempt, when they are issued, then the model call went through `ModelRouterService/ModelGateway.Invoke` with the pinned profile and the fencing token and its receipt reference is on the call record, the tool call was preceded by `PolicyEngineService/Policy.Decide` and went through `ToolAdapterService/ToolExecutor.Invoke` with the policy decision id and the fencing token, the `AgentRuntimeService/ExecutionAttempt` moved to WaitingForTool and back to Running, a call to a tool outside the allowed tools or with a denied decision was never sent and is a call record with the status failed and the reason of the refusal, a tool call the gateway reported as failed is a call record with the status failed and its receipt reference after which the loop continued, and no prompt, completion or tool payload is stored (ADR-0022, FR-05).",
        "AC3: Given a call of class shared-write or above is about to be issued, or an outcome was observed, when the grain proceeds, then a checkpoint with the next sequence, the phase, the blob reference, the adapter version and its hash exists before the call leaves, `AgentRuntimeService/AttemptCheckpointed` is written in the same transaction and published on `execution.attempts.v1.attempt-checkpointed` with `attemptId`, `runId`, `tenantId`, `checkpointId`, `sequence` and `adapterVersion`; when ArtifactService, PolicyEngineService or ToolAdapterService is unavailable the call is not issued, it is a call record with the status failed and a reason that names the dependency, and the attempt ends Failed with that reason and reports its single outcome (SCN-AgentRuntimeService-009, ADR-0024).",
        "AC4: Given an output that fails its verification, when corrections reach `maxCorrections`, then the attempt ends Failed with the failure class validation and the validator feedback attached and never Succeeded; given the model gateway exhausted the fallback chain of the profile, or `call-timeout` fired for a model call, then the attempt ends Failed with the failure class transient; given `maxModelCalls` or `maxToolCalls` is reached, or the adapter throws an exception it does not handle, then no further call is issued and the attempt ends Failed with a reason that names the cause; given `call-timeout` fired for a tool call, then the call is interrupted through `ToolAdapterService/ToolExecutor.Interrupt` and the loop continues when its receipt confirms the effect or its absence, while the attempt moves to Uncertain when it does not; given `maxMinutes` elapse, then the reminder `attempt-budget` moves the attempt to TimedOut (XL-04, ADR-0014, model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC5: Given a tool call in flight for which `ToolAdapterService/ToolEffectUncertain` arrives, when `SuspendOnUncertainEffect` handles it, then the call record is uncertain, the attempt moves from WaitingForTool to Uncertain, no model or tool call follows, `connectsoft.factory.runtime.uncertain_outcomes` counts it, the runtime retries nothing, its single outcome Uncertain is reported with the `invocationId` of the event in `uncertainToolInvocationId` of `attempt-outcome-v1`, and the attempt is terminal and waits for no operator, the operator decision for the step being opened by Run Control and never by the runtime, and the finding on the effect being recorded there by the Operator and never by the runtime (XL-06, docs/planes/agent-runtime/services/agent-runtime-service/index.md)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/security.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-201",
        "AIFACTORY-TASK-1865",
        "AIFACTORY-TASK-1866",
        "AIFACTORY-TASK-1867"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5707,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "ModelRouterService",
          "ToolAdapterService",
          "PolicyEngineService",
          "ArtifactService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "ModelRouterService/ModelGateway.Invoke",
          "ToolAdapterService/ToolExecutor.Invoke",
          "ToolAdapterService/ToolExecutor.Interrupt",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "AgentRuntimeService/AttemptPhaseChanged",
          "AgentRuntimeService/AttemptCheckpointed",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "model-invocation-v1",
          "tool-invocation-v1",
          "policy-decision-v1",
          "agent-task-contract-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0022",
          "ADR-0024"
        ],
        "requirements": [
          "FR-05",
          "NFR-05",
          "XL-04",
          "XL-06"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-008",
          "SCN-AgentRuntimeService-009"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-464",
        "feature:component-extensions-ai",
        "feature:component-agent-template-factory-access",
        "feature:model-router-service",
        "feature:model-gateway-host",
        "feature:tool-adapter-service",
        "feature:tool-executor-host",
        "feature:policy-engine-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/security.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-465]",
      "number": 465
    },
    {
      "id": "AIFACTORY-TASK-201",
      "type": "task",
      "parent": "AIFACTORY-US-465",
      "title": "Model and tool calls of the attempt through the Factory clients with receipts, policy decisions and the fencing token",
      "sequence": "02.01.07.01",
      "description": "Model and tool calls of the attempt through the Factory clients with receipts, policy decisions and the fencing token. Expected output: The execution port issues every model call through the Factory model client of the pinned AI libraries to ModelGateway.Invoke with the pinned profile, the scope of the attempt and the fencing token, and every tool call through the Factory tool client to ToolExecutor.Invoke after Policy.Decide, with the policy decision id and the fencing token; each call is a CallRecord with request hash, policy decision id, receipt reference and status; a call to a tool outside the allowed tools or with a denied decision is never sent and is a CallRecord with the status failed and the reason of the refusal; a tool call the gateway reports as failed is a CallRecord with the status failed and its receipt reference, and the loop continues with it as the observation; the profile resolution, the provider call and the fallback stay with ModelRouterService and are not repeated here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The execution port issues every model call through the Factory model client of the pinned AI libraries to ModelGateway.Invoke with the pinned profile, the scope of the attempt and the fencing token, and every tool call through the Factory tool client to ToolExecutor.Invoke after Policy.Decide, with the policy decision id and the fencing token; each call is a CallRecord with request hash, policy decision id, receipt reference and status; a call to a tool outside the allowed tools or with a denied decision is never sent and is a CallRecord with the status failed and the reason of the refusal; a tool call the gateway reports as failed is a CallRecord with the status failed and its receipt reference, and the loop continues with it as the observation; the profile resolution, the provider call and the fallback stay with ModelRouterService and are not repeated here."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5707,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-201]",
      "number": 201
    },
    {
      "id": "AIFACTORY-TASK-1865",
      "type": "task",
      "parent": "AIFACTORY-US-465",
      "title": "Loop phases, checkpoints, verification with bounded correction and the limits of the attempt in the AttemptGrain",
      "sequence": "02.01.07.02",
      "description": "Loop phases, checkpoints, verification with bounded correction and the limits of the attempt in the AttemptGrain. Expected output: The AttemptGrain drives the phases Planning to Reporting on the Agent Framework adapter with AttemptPhaseChanged on every move, writes a checkpoint through ArtifactService before every gated call, after every observed outcome and every Runtime:Attempts:CheckpointEveryCalls calls with AttemptCheckpointed in the same transaction, verifies the output against the task contract, corrects up to maxCorrections and then fails with the class validation, and settles a call as uncertain and the attempt as Uncertain when SuspendOnUncertainEffect receives ToolEffectUncertain, after which the attempt reports that outcome with the invocationId of the event in uncertainToolInvocationId, waits for nothing and holds no request for the operator decision that Run Control opens. Each failure branch has one result: when ArtifactService, PolicyEngineService or ToolAdapterService is unavailable the call is not issued, it is a CallRecord with the status failed and a reason that names the dependency, and the attempt ends Failed under CorrectionsExhaustedOrTerminalError with that reason; a reached maxModelCalls or maxToolCalls issues no further call and ends the attempt Failed with a reason that names the budget; call-timeout on a model call abandons the call and ends the attempt Failed with the class transient; call-timeout on a tool call interrupts it through ToolExecutor.Interrupt and continues the loop when the receipt confirms the effect or its absence, or moves the attempt to Uncertain; attempt-budget moves the attempt to TimedOut; an exception the adapter does not handle ends the attempt Failed with the reason and a diagnostics reference and never leaves it without an outcome.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The AttemptGrain drives the phases Planning to Reporting on the Agent Framework adapter with AttemptPhaseChanged on every move, writes a checkpoint through ArtifactService before every gated call, after every observed outcome and every Runtime:Attempts:CheckpointEveryCalls calls with AttemptCheckpointed in the same transaction, verifies the output against the task contract, corrects up to maxCorrections and then fails with the class validation, and settles a call as uncertain and the attempt as Uncertain when SuspendOnUncertainEffect receives ToolEffectUncertain, after which the attempt reports that outcome with the invocationId of the event in uncertainToolInvocationId, waits for nothing and holds no request for the operator decision that Run Control opens. Each failure branch has one result: when ArtifactService, PolicyEngineService or ToolAdapterService is unavailable the call is not issued, it is a CallRecord with the status failed and a reason that names the dependency, and the attempt ends Failed under CorrectionsExhaustedOrTerminalError with that reason; a reached maxModelCalls or maxToolCalls issues no further call and ends the attempt Failed with a reason that names the budget; call-timeout on a model call abandons the call and ends the attempt Failed with the class transient; call-timeout on a tool call interrupts it through ToolExecutor.Interrupt and continues the loop when the receipt confirms the effect or its absence, or moves the attempt to Uncertain; attempt-budget moves the attempt to TimedOut; an exception the adapter does not handle ends the attempt Failed with the reason and a diagnostics reference and never leaves it without an outcome."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5707,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1865]",
      "number": 1865
    },
    {
      "id": "AIFACTORY-TASK-1866",
      "type": "task",
      "parent": "AIFACTORY-US-465",
      "title": "Scripted agent, scripted model gateway and fakes of the tool gateway, the policy engine and the artifact store",
      "sequence": "02.01.07.03",
      "description": "Scripted agent, scripted model gateway and fakes of the tool gateway, the policy engine and the artifact store. Expected output: The acceptance suite holds a scripted agent of the Agent Framework, a fake of ModelGateway.Invoke that answers from a script, fails or exhausts its fallback, a scripted agent step that throws an exception the adapter does not handle, a fake of ModelGateway.Invoke that does not answer within the call budget, a fake of ToolExecutor.Invoke for a read tool and a shared-write tool that can leave a call in flight, report a call as failed or be stopped, with a fake of ToolExecutor.Interrupt whose receipt confirms or cannot confirm the effect, a fake of Policy.Decide that allows, denies or is stopped, a fake of the artifact store that can be stopped, and ToolEffectUncertain events built from the pinned contracts package.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a scripted agent of the Agent Framework, a fake of ModelGateway.Invoke that answers from a script, fails or exhausts its fallback, a scripted agent step that throws an exception the adapter does not handle, a fake of ModelGateway.Invoke that does not answer within the call budget, a fake of ToolExecutor.Invoke for a read tool and a shared-write tool that can leave a call in flight, report a call as failed or be stopped, with a fake of ToolExecutor.Interrupt whose receipt confirms or cannot confirm the effect, a fake of Policy.Decide that allows, denies or is stopped, a fake of the artifact store that can be stopped, and ToolEffectUncertain events built from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5707,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1866]",
      "number": 1866
    },
    {
      "id": "AIFACTORY-TASK-1867",
      "type": "task",
      "parent": "AIFACTORY-US-465",
      "title": "Verify the loop, its checkpoints, the correction bound and the uncertain effect",
      "sequence": "02.01.07.04",
      "description": "Verify the loop, its checkpoints, the correction bound and the uncertain effect. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-008|Scenario=SCN-AgentRuntimeService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-465: one AttemptPhaseChanged per move, the model call with its receipt, the tool call after its policy decision, the refused call as a call record with the status failed, the tool call reported as failed after which the loop continues, the checkpoint that precedes every gated call with AttemptCheckpointed, the call withheld and the attempt Failed with its reason while the artifact store, the policy engine or the tool gateway is stopped, the validation failure at maxCorrections, the transient failure after an exhausted fallback and after a model call that exceeded its budget, the attempt Failed with its reason at maxModelCalls, at maxToolCalls and after an unhandled exception of the adapter, the tool call that exceeded its budget with a confirmed and with an unconfirmed receipt, the timeout of the attempt and the Uncertain settlement; for the three causes whose failure class the model does not name the tests assert the state and the reason only.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-008|Scenario=SCN-AgentRuntimeService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-465: one AttemptPhaseChanged per move, the model call with its receipt, the tool call after its policy decision, the refused call as a call record with the status failed, the tool call reported as failed after which the loop continues, the checkpoint that precedes every gated call with AttemptCheckpointed, the call withheld and the attempt Failed with its reason while the artifact store, the policy engine or the tool gateway is stopped, the validation failure at maxCorrections, the transient failure after an exhausted fallback and after a model call that exceeded its budget, the attempt Failed with its reason at maxModelCalls, at maxToolCalls and after an unhandled exception of the adapter, the tool call that exceeded its budget with a confirmed and with an unconfirmed receipt, the timeout of the attempt and the Uncertain settlement; for the three causes whose failure class the model does not name the tests assert the state and the reason only."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5707,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1867]",
      "number": 1867
    },
    {
      "id": "AIFACTORY-US-466",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Stop for a human decision: an approval bound to the exact proposal, a missing input or an escalation, and resume, fail or expire on the answer",
      "sequence": "02.01.08",
      "description": "As a reviewer, I want an attempt to stop before a gated action and wait for my decision on the exact proposal, or for the input and the choice it asks for, so that nothing I did not decide is executed and an attempt that nobody answers ends instead of waiting for ever. An attempt stops for a human in three cases, the three values of `DecisionKind`. Approval: the policy decision for a proposed call requires a human approval, which is the case for calls of class shared-write, external, production, publication and spend above the threshold. The grain writes a checkpoint, asks Run Control through `RunControlService/RunControl.RequestApproval` with `approval-request-v1`, which carries the action class, the proposal kind and the hash of the exact proposal under the fencing token of the lease, and receives `approval-ref-v1` with the approval id. The approval is owned by Run Control; the runtime decides nothing and only references it. Input: the task cannot proceed without information the requester holds. Escalation: the agent cannot choose between options and lays them before a human with a recommendation. This kind is a request the agent raises inside a running attempt; the failure policy Escalate of a step is another matter, settled in Run Control after the attempt reported its outcome, and the runtime waits for nothing there (decision D119). In each case the grain adds a `DecisionRequest` with its kind, the status pending and, by kind, the approval id and the proposal hash or the options and the recommendation, moves the attempt from Running to WaitingForDecision (trigger `DecisionRequested`) and writes `AttemptDecisionRequested` with `decisionId`, `kind` and the optional `approvalId` in the same transaction; `connectsoft.factory.runtime.decisions_waiting` counts the waiting attempt by kind, and the lease is renewed while the attempt waits. The answers arrive two ways. An approval is answered by `RunControlService/ApprovalDecided` in the inbox, handler `ResumeAfterApproval`. The event carries one of the states of `ApprovalState`, and the handler has one branch for each state a decided request can carry. An event whose `approvalId` matches no pending decision request of this service is acknowledged and changes nothing; that is the case for a request whose subject is not a run, a provisioning run, an evaluation run, an asset release or a promotion, which a service that owns the subject requested (D129, D131, D135), for a run-level spend approval, which Run Control opens itself and which names no step and no lease, and for an operator decision, which Run Control opens itself for a step that failed terminally under the failure policy Escalate or for an Uncertain outcome on a step of class shared-write or above and which names no lease (decision D119); the choice retry of the Operator reaches the runtime only as a new `AttemptDispatched`. Approved, for the proposal hash of the pending request: the request is marked answered, the attempt moves back to Running (trigger `DecisionReceived`) and the gated call is issued from the checkpoint. A decision that names another proposal hash than the pending request never releases the call. Rejected: the request is marked answered and the attempt ends Failed (trigger `DecisionRejectedOrExpired`) with the failure class policy-denied, the class the amendment of ADR-0014 gives a run failed by a rejected or expired approval. Expired: the request is marked expired and the attempt ends Failed through the same trigger with the same class. Run Control settles an expired request by the on-expiry rule of the approval policy, fail or re-request. Until ApprovalPolicyService, which is delivered with the approval rules in I4, supplies a rule, every request carries `onExpiry` fail, so in this delivery an expired approval always fails the run and the attempt with it. `ApprovalDecided` does not tell the runtime whether Run Control reopened an expired request under a new approval id; that gap is reported to the owner, because once a rule allows a re-request the runtime would otherwise fail an attempt whose run still waits. ChangesRequested: the request is marked answered, the attempt returns to Running (trigger `DecisionReceived`) with the reason of the reviewer as feedback and without releasing the call, the agent regenerates the proposal, and the grain asks for a new approval with the new hash, which opens a new decision request. Stale: the proposal the request was bound to changed, and Run Control keeps the run WaitingForApproval until the lease holder asks again. The runtime is that lease holder, and nothing else would end the wait, so the grain stays WaitingForDecision, calls `RunControlService/RunControl.RequestApproval` again for the current proposal hash and replaces `approvalId` and `proposalHash` of the pending request with the new reference; no call is released. Cancelled: Run Control cancels a pending request when the run was cancelled or when it failed for another reason. `ResumeAfterApproval` closes the decision request, releases no call and ends nothing: the attempt does not end Failed and carries no class policy-denied, because the amendment of ADR-0014 gives that class to a rejected or expired approval and to a retired environment and not to a cancellation. The attempt of a cancelled run is settled by the interruption path of AIFACTORY-US-468, through `Runtime.Interrupt` or `RunCancelled`, as Cancelled with the class cancellation, whichever of the two events arrives first. When the request was cancelled because the run failed for another reason, the model names no outcome for the attempt: it stays WaitingForDecision until the interrupt or the expiry of its lease (AIFACTORY-US-469) settles it, and the point is reported to the owner. The status of a `DecisionRequest` in the model is pending, answered or expired and has no value for a cancelled approval; the closed request is stored as expired, and the missing value is reported. An input or an escalation choice is delivered through the internal gRPC method `Runtime.AnswerDecision`, of class shared-write, by a service with a workload identity whose token holds the service scope that names AgentRuntimeService: the request names the attempt, the decision and the answer, the grain marks the request answered with `answeredAt`, the attempt returns to Running and the reply is `ack-v1`. The method is applied once: the same answer repeated for a decision already answered is acknowledged without a second effect, and a different answer is refused with FAILED_PRECONDITION. A call without workload identity is refused with UNAUTHENTICATED and without the service scope with PERMISSION_DENIED; an invalid request, and an answer for a decision of kind Approval, which arrives through `ApprovalDecided` only, with INVALID_ARGUMENT; an unknown attempt or decision and one of another tenant with NOT_FOUND (ADR-0015); an answer for an attempt that is not WaitingForDecision with FAILED_PRECONDITION. No refusal changes state. An input or an escalation that nobody answers within `Runtime:Decisions:InputTimeoutMinutes`, 1440 by default, is marked expired and the attempt ends Failed through the same trigger; the model names no failure class for an expired input, which is reported to the owner. Decision requests are audited (docs/planes/agent-runtime/security.md): the model lists no AuditService consumer of `AttemptDecisionRequested`, so the transaction that opens a request also writes an `audit-evidence-v1` record through the sink of AIFACTORY-US-461, and the difference between the page and the model is reported. The owner decided who delivers the answer of a requester (D137): RunControlService calls `Runtime.AnswerDecision` for its public route `RunControlService/AnswerDecision`, which a member holding the user scope `factory.runs.operate` calls behind ControlPlaneApi and through which the Studio answers, and RunControlService passes on only the answer of an input or an escalation, never an approval. The model still gives the method the approval schema as request, which has no member for an input or a choice, so the proto of this PBI names attempt, decision and answer and the descriptor is reported to the owner. StudioBff, StudioNotificationService and DashboardService consume the event in their own PBIs. Kind: behavior. Traces: services: AgentRuntimeService, RunControlService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: AgentRuntimeService/Runtime.AnswerDecision, RunControlService/RunControl.RequestApproval; events: AgentRuntimeService/AttemptDecisionRequested, RunControlService/ApprovalDecided; descriptors: approval-request-v1, approval-ref-v1, ack-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-06, FUX-05, XL-05; scenarios: SCN-AgentRuntimeService-005, SCN-AgentRuntimeService-010. Relates: screens: approval-card, run-timeline. Depends on: AIFACTORY-US-465, feature:run-control-service, feature:policy-engine-service, feature:component-audit-factory-evidence. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/approval.schema.json, docs/planes/agent-runtime/security.md#audit, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a Running attempt whose proposed call needs an approval, when the grain calls `RunControlService/RunControl.RequestApproval` with `approval-request-v1`, then a checkpoint exists before the request, a pending decision request of kind Approval holds the `approvalId` of `approval-ref-v1` and the proposal hash, the `AgentRuntimeService/ExecutionAttempt` is WaitingForDecision and `AgentRuntimeService/AttemptDecisionRequested` is written in the same transaction; a missing input and an escalation open a request of kind Input or Escalation the same way without calling Run Control (SCN-AgentRuntimeService-010, FR-06).",
        "AC2: Given a decision request was opened, when the outbox dispatcher publishes `AgentRuntimeService/AttemptDecisionRequested` on `execution.attempts.v1.attempt-decision-requested`, then the event is sent in the run event envelope with `attemptId`, `runId`, `tenantId`, `decisionId`, `kind` and, for an approval, `approvalId`, a transport outage is retried with backoff without loss or duplicate under its event id, and one `audit-evidence-v1` record of the request was written in the transaction that opened it (SCN-AgentRuntimeService-010, ADR-0012).",
        "AC3: Given an attempt waiting for an approval, when `RunControlService/ApprovalDecided` arrives, then state Approved for the proposal hash of the pending request returns the attempt to Running and the gated call is issued from the checkpoint; state Rejected, and state Expired, which in this delivery always belongs to a request with `onExpiry` fail because no approval rule exists yet, end the attempt Failed with the failure class policy-denied; a decision for another proposal hash releases nothing; an event whose `approvalId` matches no pending decision request of this service, such as a run-level spend approval or an operator decision that Run Control opened for the step, is acknowledged and changes nothing; and a redelivered event has no second effect (FUX-05, ADR-0014).",
        "AC4: Given an attempt waiting for an approval, when `RunControlService/ApprovalDecided` arrives with state ChangesRequested, Stale or Cancelled, then on ChangesRequested the attempt returns to Running with the reason as feedback, no call is released and a new approval is requested through `RunControlService/RunControl.RequestApproval` with the hash of the regenerated proposal; on Stale the attempt stays WaitingForDecision, `RunControlService/RunControl.RequestApproval` is called again for the current proposal hash and the pending request holds the new `approvalId` and `proposalHash`; on Cancelled the decision request is closed, no call is released, the attempt neither ends Failed nor carries the class policy-denied, and it stays WaitingForDecision without an outcome until the interruption path or the expiry of its lease settles it; that a cancelled run then ends the attempt Cancelled with the class cancellation is proven by AIFACTORY-US-468 (FR-06, model/services/control-plane/RunControlService.yaml).",
        "AC5: Given an attempt waiting for an input or an escalation and a caller with a workload identity and the service scope, when `AgentRuntimeService/Runtime.AnswerDecision` is called with the attempt, the decision and the answer, then the reply is `ack-v1`, the decision request is answered with `answeredAt`, the attempt is Running and the same answer repeated is acknowledged without a second effect; a call without workload identity, without the service scope, with an invalid request or for a decision of kind Approval, for an unknown attempt or one of another tenant, with a different answer for an answered decision or for an attempt that is not WaitingForDecision is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND or FAILED_PRECONDITION respectively and changes no state; and a request nobody answers within `Runtime:Decisions:InputTimeoutMinutes` is expired and the attempt ends Failed (SCN-AgentRuntimeService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/agent-runtime/security.md#audit",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1868",
        "AIFACTORY-TASK-1869",
        "AIFACTORY-TASK-1870"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5708,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "RunControlService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "AgentRuntimeService/Runtime.AnswerDecision",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "AgentRuntimeService/AttemptDecisionRequested",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "approval-request-v1",
          "approval-ref-v1",
          "ack-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "XL-05"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-005",
          "SCN-AgentRuntimeService-010"
        ]
      },
      "relates": {
        "screens": [
          "approval-card",
          "run-timeline"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-465",
        "feature:run-control-service",
        "feature:policy-engine-service",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/agent-runtime/security.md#audit",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-466]",
      "number": 466
    },
    {
      "id": "AIFACTORY-TASK-1868",
      "type": "task",
      "parent": "AIFACTORY-US-466",
      "title": "Decision requests of the three kinds with the approval request to Run Control and ResumeAfterApproval",
      "sequence": "02.01.08.01",
      "description": "Decision requests of the three kinds with the approval request to Run Control and ResumeAfterApproval. Expected output: The grain opens a DecisionRequest of kind Approval, Input or Escalation, for an approval after a checkpoint and RunControl.RequestApproval with the action class, the proposal kind and the proposal hash, moves the attempt to WaitingForDecision with AttemptDecisionRequested and an audit-evidence-v1 record in one transaction, and the inbox handler ResumeAfterApproval has one branch per state of ApprovalDecided: Approved for the pending proposal hash returns the attempt to Running and releases the gated call from the checkpoint; Rejected and Expired end it Failed with the class policy-denied, and no other state does; ChangesRequested returns it to Running with the reason as feedback, releases nothing and leads to a new RunControl.RequestApproval with the hash of the regenerated proposal; Stale keeps it WaitingForDecision, calls RunControl.RequestApproval again for the current proposal hash and replaces approvalId and proposalHash of the pending request; Cancelled closes the decision request, releases nothing and ends nothing, the attempt being settled by the interruption path of AIFACTORY-US-468 or by the expiry of its lease; a decision for another hash releases nothing, and an event whose approvalId matches no pending request of this service is acknowledged without a change.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The grain opens a DecisionRequest of kind Approval, Input or Escalation, for an approval after a checkpoint and RunControl.RequestApproval with the action class, the proposal kind and the proposal hash, moves the attempt to WaitingForDecision with AttemptDecisionRequested and an audit-evidence-v1 record in one transaction, and the inbox handler ResumeAfterApproval has one branch per state of ApprovalDecided: Approved for the pending proposal hash returns the attempt to Running and releases the gated call from the checkpoint; Rejected and Expired end it Failed with the class policy-denied, and no other state does; ChangesRequested returns it to Running with the reason as feedback, releases nothing and leads to a new RunControl.RequestApproval with the hash of the regenerated proposal; Stale keeps it WaitingForDecision, calls RunControl.RequestApproval again for the current proposal hash and replaces approvalId and proposalHash of the pending request; Cancelled closes the decision request, releases nothing and ends nothing, the attempt being settled by the interruption path of AIFACTORY-US-468 or by the expiry of its lease; a decision for another hash releases nothing, and an event whose approvalId matches no pending request of this service is acknowledged without a change."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5708,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1868]",
      "number": 1868
    },
    {
      "id": "AIFACTORY-TASK-1869",
      "type": "task",
      "parent": "AIFACTORY-US-466",
      "title": "Runtime.AnswerDecision applied once and the expiry of an unanswered input or escalation",
      "sequence": "02.01.08.02",
      "description": "Runtime.AnswerDecision applied once and the expiry of an unanswered input or escalation. Expected output: The gRPC method Runtime.AnswerDecision, called by RunControlService for its public route AnswerDecision (D137), marks a pending Input or Escalation request answered with answeredAt, returns the attempt to Running and replies ack-v1; the same answer repeated has no second effect; the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND and FAILED_PRECONDITION change nothing; a request unanswered after Runtime:Decisions:InputTimeoutMinutes is marked expired and the attempt ends Failed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The gRPC method Runtime.AnswerDecision, called by RunControlService for its public route AnswerDecision (D137), marks a pending Input or Escalation request answered with answeredAt, returns the attempt to Running and replies ack-v1; the same answer repeated has no second effect; the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND and FAILED_PRECONDITION change nothing; a request unanswered after Runtime:Decisions:InputTimeoutMinutes is marked expired and the attempt ends Failed."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5708,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1869]",
      "number": 1869
    },
    {
      "id": "AIFACTORY-TASK-1870",
      "type": "task",
      "parent": "AIFACTORY-US-466",
      "title": "Verify the decision requests, the two answer paths and the expiry",
      "sequence": "02.01.08.03",
      "description": "Verify the decision requests, the two answer paths and the expiry. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-005|Scenario=SCN-AgentRuntimeService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-466 with a fake of RunControl.RequestApproval that records every request and ApprovalDecided events of each of the six decided states, for the pending proposal hash, for another proposal hash and for an approval id this service never requested: the three kinds of request, the published event and its evidence record, the attempt resumed on Approved, the attempt Failed with policy-denied on Rejected and on Expired, the second approval request with the new hash after ChangesRequested, the repeated approval request and the replaced approvalId and proposalHash after Stale, the Cancelled case, in which the request is closed, no call is released and the attempt is neither Failed nor policy-denied and stays WaitingForDecision without an outcome, its settlement as Cancelled with the class cancellation being proven by AIFACTORY-TASK-1875, the unmatched approval id that changes nothing, the answered input, the repeated answer, each refusal of Runtime.AnswerDecision over two tenants and the expired input request.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-005|Scenario=SCN-AgentRuntimeService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-466 with a fake of RunControl.RequestApproval that records every request and ApprovalDecided events of each of the six decided states, for the pending proposal hash, for another proposal hash and for an approval id this service never requested: the three kinds of request, the published event and its evidence record, the attempt resumed on Approved, the attempt Failed with policy-denied on Rejected and on Expired, the second approval request with the new hash after ChangesRequested, the repeated approval request and the replaced approvalId and proposalHash after Stale, the Cancelled case, in which the request is closed, no call is released and the attempt is neither Failed nor policy-denied and stays WaitingForDecision without an outcome, its settlement as Cancelled with the class cancellation being proven by AIFACTORY-TASK-1875, the unmatched approval id that changes nothing, the answered input, the repeated answer, each refusal of Runtime.AnswerDecision over two tenants and the expired input request."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5708,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1870]",
      "number": 1870
    },
    {
      "id": "AIFACTORY-US-467",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Report exactly one outcome per attempt with its hash, its failure class and the fencing token, and take the answer of Run Control as final",
      "sequence": "02.01.09",
      "description": "An attempt ends with one report and nothing else. When the loop has a verified output (trigger `OutputVerified`, state Succeeded), when corrections are exhausted or a terminal error occurred (trigger `CorrectionsExhaustedOrTerminalError`, state Failed), when the budget of the attempt elapsed (trigger `AttemptBudgetExceeded`, state TimedOut), when cancellation was observed (state Cancelled, AIFACTORY-US-468) or when an effect stayed unconfirmed (state Uncertain), the command `ReportOutcome` builds `attempt-outcome-v1`: the attempt id, the lease id, the fencing token, the outcome, the failure class where the outcome has one and the receipt with its hash, the artifacts the attempt stored through ArtifactService, the receipt ids of its model and tool invocations, the usage and the last checkpoint reference. An outcome Uncertain that a tool call caused also marks the tool invocation whose effect is uncertain, in the optional member `uncertainToolInvocationId`, so that the operator decision of RunControlService keeps that invocation id (decision D123); every other outcome leaves the member out. The grain commits the terminal state, `outcomeHash` and `endedAt` and writes `AttemptOutcomeReported` with `state`, the optional `failureClass`, `outcomeHash`, `corrections`, `modelCalls` and `toolCalls` in one transaction, and then calls `RunControlService/RunControl.ReportAttemptOutcome` under its workload identity. Run Control accepts an outcome once and only from the holder of the current lease with its fencing token and records the authoritative `AttemptOutcomeRecorded`; the event of this service is the timeline of the runtime and never the truth of the run (ADR-0024 decision 5). The failure class is one of the six values of the contract, and this PBI binds each value to an outcome in one table. `attempt-outcome-v1` lists the six values without binding them to an outcome, and the amendment of ADR-0014 speaks of the class of a Failed attempt; the reading taken here, used in every PBI of the feature and reported to the owner, is that a Failed attempt carries one of transient, permanent, policy-denied or validation wherever the model names its class, a Cancelled attempt carries cancellation, an Uncertain attempt carries uncertain, and a Succeeded or TimedOut attempt carries none. For a Failed attempt the class is transient when the model gateway exhausted the fallback chain, when a model call exceeded its budget or when the context assembly stayed unavailable within the budget; validation when corrections were exhausted; policy-denied when an approval was rejected or expired, and never when it was cancelled; and permanent when a dependency answered NOT_FOUND for a resource the attempt addressed, which is also its answer for a resource of another tenant (ADR-0015 amendment of D114). Seven causes end an attempt Failed for which the model names no class: an unavailable fail-fast dependency (ArtifactService, PolicyEngineService or ToolAdapterService), a reached `maxModelCalls` or `maxToolCalls`, an exception the adapter does not handle, a rejected release, a task contract or a snapshot that cannot be read or does not match its hash, an input or an escalation nobody answered in time, and a checkpoint that is incompatible at resume. Each is a row of the table with its reason and with the class left to the owner; until the owner decides, the report of such an attempt carries the reason in the error of the receipt, and the suite asserts the state and the reason only. The runtime never retries an attempt. Run Control retries a Failed attempt only when its class is transient and the step is of class read or sandbox, or of class shared-write with a declared idempotency key (ADR-0014 amendment of D114), so a wrong class would repeat or block an effect, and each class has a test. Nor does the runtime wait for a human after its report. When a step fails terminally under the failure policy Escalate, and when an Uncertain outcome is recorded on a step of class shared-write or above, RunControlService opens an operator decision for the Operator of the project, who chooses retry, compensate or fail (decision D119); for an Uncertain outcome of a tool call the Operator records the finding on the effect there, applied or not-applied, and RunControlService records it in ToolAdapterService (decision D121). The runtime reports such an attempt exactly as any other, Failed with its class or Uncertain with the class uncertain, softens neither into another outcome, holds no decision request for the operator decision, and learns of the choice retry only as a new `AttemptDispatched`. The report is idempotent on the outcome hash: a repeated `ReportOutcome` with the same hash sends the same report again and writes no second event, and a different outcome for an attempt that already holds one is refused by the aggregate. Run Control is a fail-fast dependency: when the call fails, the committed outcome stands and the report is repeated with the same hash until it is answered or the lease is gone; no outcome is invented and none is changed. The answers of Run Control are final for the runtime. `ack-v1` accepted closes the attempt. FAILED_PRECONDITION, its answer to a stale fencing token because a newer lease exists, and `ack-v1` carrying the conflict outcome, its answer for an attempt it already settled, both mean that the truth was recorded without this report: the grain stops repeating, keeps its own row as the timeline of what it did and logs the difference with the attempt id. NOT_FOUND ends the repetition as well. The failure mode of the model for a checkpoint that is incompatible after an adapter upgrade names a failure class infrastructure, which is no value of `attempt-outcome-v1`; such an attempt is reported Failed with its reason and is one of the seven rows above whose class awaits the owner. MemoryPromotionService, DashboardService and QualityScoreService consume the event in their own PBIs. Kind: behavior. Traces: services: AgentRuntimeService, RunControlService, ArtifactService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: RunControlService/RunControl.ReportAttemptOutcome; events: AgentRuntimeService/AttemptOutcomeReported; descriptors: attempt-outcome-v1, ack-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024; requirements: FR-03, FUX-07, XL-06; scenarios: SCN-AgentRuntimeService-012. Depends on: AIFACTORY-US-465, feature:run-control-service, feature:artifact-service. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/attempt-outcome.schema.json, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running attempt whose output was verified, when `ReportOutcome` runs, then the `AgentRuntimeService/ExecutionAttempt` is Succeeded with `outcomeHash` and `endedAt`, `AgentRuntimeService/AttemptOutcomeReported` is written in the same transaction, and `RunControlService/RunControl.ReportAttemptOutcome` is called with `attempt-outcome-v1` carrying the lease id, the fencing token, the outcome and the receipt hash and answers `ack-v1` accepted (SCN-AgentRuntimeService-012, ADR-0024).",
        "AC2: Given the outcome was committed, when the outbox dispatcher publishes `AgentRuntimeService/AttemptOutcomeReported` on `execution.attempts.v1.attempt-outcome-reported`, then the event is sent in the run event envelope with `attemptId`, `runId`, `tenantId`, `state`, the optional `failureClass`, `outcomeHash`, `corrections`, `modelCalls` and `toolCalls`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AgentRuntimeService-012, ADR-0012).",
        "AC3: Given attempts that end for each cause of the class table, when they report, then a Failed attempt carries transient for an exhausted model gateway, a model call beyond its budget or an exhausted context assembly, validation for exhausted corrections, policy-denied for a rejected or expired approval and permanent after NOT_FOUND from a dependency; a Cancelled attempt carries cancellation, an Uncertain attempt carries uncertain and, when a tool call caused it, the id of that tool invocation in `uncertainToolInvocationId`, and a Succeeded or TimedOut report carries none; and an attempt Failed by an unavailable fail-fast dependency, a reached call budget, an unhandled exception of the adapter, a rejected release, a task contract or a snapshot that cannot be read or does not match its hash, an unanswered input or an incompatible checkpoint reports the state Failed with its reason in the error of the receipt, its class being the row the owner decides; every attempt of the table is terminal once it reported and waits for no operator, also when Run Control then opens an operator decision for its step (ADR-0014, ADR-0015).",
        "AC4: Given a committed outcome, when `ReportOutcome` is repeated with the same hash, when Run Control is unreachable, and when another outcome is attempted, then the same report is sent again without a second `AgentRuntimeService/AttemptOutcomeReported`, the report is repeated with the same hash after Run Control recovered, and the different outcome is refused by the aggregate (SCN-AgentRuntimeService-012, FR-03).",
        "AC5: Given `RunControlService/RunControl.ReportAttemptOutcome` answers FAILED_PRECONDITION for a stale fencing token, `ack-v1` with the conflict outcome for a settled attempt, or NOT_FOUND, when the answer arrives, then the grain stops repeating the report, changes nothing of its committed outcome and logs the difference with the attempt id (XL-06, model/services/control-plane/RunControlService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1871",
        "AIFACTORY-TASK-1872"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5709,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "RunControlService",
          "ArtifactService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "RunControlService/RunControl.ReportAttemptOutcome"
        ],
        "events": [
          "AgentRuntimeService/AttemptOutcomeReported"
        ],
        "descriptors": [
          "attempt-outcome-v1",
          "ack-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "FR-03",
          "FUX-07",
          "XL-06"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-012"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-465",
        "feature:run-control-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-467]",
      "number": 467
    },
    {
      "id": "AIFACTORY-TASK-1871",
      "type": "task",
      "parent": "AIFACTORY-US-467",
      "title": "ReportOutcome with the outcome hash, the failure class mapping and the handling of every answer of Run Control",
      "sequence": "02.01.09.01",
      "description": "ReportOutcome with the outcome hash, the failure class mapping and the handling of every answer of Run Control. Expected output: The command ReportOutcome builds attempt-outcome-v1 with lease id, fencing token, outcome, failure class and the receipt with its hash, artifacts, invocation receipt ids, usage and checkpoint reference and, on an Uncertain outcome that a tool call caused, the id of that tool invocation in uncertainToolInvocationId, commits the terminal state with outcomeHash and AttemptOutcomeReported in one transaction and then calls RunControl.ReportAttemptOutcome; the mapping of causes to failure classes is one table with a test per row: for a Failed attempt transient (exhausted fallback chain, model call beyond its budget, exhausted context assembly), validation (exhausted corrections), policy-denied (rejected or expired approval, never a cancelled one) and permanent (NOT_FOUND of a dependency), cancellation for a Cancelled attempt, uncertain for an Uncertain attempt, none for Succeeded and TimedOut, and seven rows whose class awaits the owner and whose report carries the reason in the error of the receipt (unavailable ArtifactService, PolicyEngineService or ToolAdapterService, reached maxModelCalls or maxToolCalls, unhandled exception of the adapter, rejected release, task contract or snapshot that cannot be read or does not match its hash, unanswered input or escalation, incompatible checkpoint); a repeat with the same hash sends the same report and writes no second event; an unreachable Run Control is retried with the same hash; FAILED_PRECONDITION, the conflict outcome and NOT_FOUND stop the repetition without changing the committed outcome.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The command ReportOutcome builds attempt-outcome-v1 with lease id, fencing token, outcome, failure class and the receipt with its hash, artifacts, invocation receipt ids, usage and checkpoint reference and, on an Uncertain outcome that a tool call caused, the id of that tool invocation in uncertainToolInvocationId, commits the terminal state with outcomeHash and AttemptOutcomeReported in one transaction and then calls RunControl.ReportAttemptOutcome; the mapping of causes to failure classes is one table with a test per row: for a Failed attempt transient (exhausted fallback chain, model call beyond its budget, exhausted context assembly), validation (exhausted corrections), policy-denied (rejected or expired approval, never a cancelled one) and permanent (NOT_FOUND of a dependency), cancellation for a Cancelled attempt, uncertain for an Uncertain attempt, none for Succeeded and TimedOut, and seven rows whose class awaits the owner and whose report carries the reason in the error of the receipt (unavailable ArtifactService, PolicyEngineService or ToolAdapterService, reached maxModelCalls or maxToolCalls, unhandled exception of the adapter, rejected release, task contract or snapshot that cannot be read or does not match its hash, unanswered input or escalation, incompatible checkpoint); a repeat with the same hash sends the same report and writes no second event; an unreachable Run Control is retried with the same hash; FAILED_PRECONDITION, the conflict outcome and NOT_FOUND stop the repetition without changing the committed outcome."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1871]",
      "number": 1871
    },
    {
      "id": "AIFACTORY-TASK-1872",
      "type": "task",
      "parent": "AIFACTORY-US-467",
      "title": "Verify the single outcome, its failure classes and the answers of Run Control",
      "sequence": "02.01.09.02",
      "description": "Verify the single outcome, its failure classes and the answers of Run Control. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRuntimeService-012\"`; a zero-match filter counts as a failure; with a fake of RunControl.ReportAttemptOutcome that accepts, is stopped, answers FAILED_PRECONDITION, the conflict outcome and NOT_FOUND, the tests prove AC1 to AC5 of AIFACTORY-US-467: the committed outcome with its event, the payload and the retry of the publication, one case per row of the class table, among them a Cancelled attempt with cancellation, an Uncertain attempt with uncertain and with the id of the uncertain tool invocation in uncertainToolInvocationId, a Succeeded and a TimedOut attempt without a class and, asserted by state and reason only, the unavailable fail-fast dependency, the reached call budget and the unhandled exception of the adapter, the repeat with the same hash, the refused second outcome and the end of the repetition on each final answer.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRuntimeService-012\"`; a zero-match filter counts as a failure; with a fake of RunControl.ReportAttemptOutcome that accepts, is stopped, answers FAILED_PRECONDITION, the conflict outcome and NOT_FOUND, the tests prove AC1 to AC5 of AIFACTORY-US-467: the committed outcome with its event, the payload and the retry of the publication, one case per row of the class table, among them a Cancelled attempt with cancellation, an Uncertain attempt with uncertain and with the id of the uncertain tool invocation in uncertainToolInvocationId, a Succeeded and a TimedOut attempt without a class and, asserted by state and reason only, the unavailable fail-fast dependency, the reached call budget and the unhandled exception of the adapter, the repeat with the same hash, the refused second outcome and the end of the repetition on each final answer."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1872]",
      "number": 1872
    },
    {
      "id": "AIFACTORY-US-468",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Observe an interruption: stop at the next safe point, settle the calls in flight and report the observed termination",
      "sequence": "02.01.10",
      "description": "As a requester, I want an attempt of a run I cancelled to stop at once and to tell me which effects it could not confirm, so that the Factory stops spending on the run and never pretends that an effect already made did not happen. Cancellation is two facts, the request and the observed termination (ADR-0014 decision 2). Run Control records the intent and asks the lease holder to stop through the internal gRPC method `Runtime.Interrupt`, of class shared-write, after its own Cancelling transition committed; the same path is taken inside the service when a release is revoked with the in-flight policy revoke (AIFACTORY-US-463). The caller presents a workload identity whose token holds the service scope that names AgentRuntimeService, and the request names the attempt and the reason, cancellation or revocation. The method records the request on the attempt and answers `ack-v1` at once; it does not wait for the stop. The command `Interrupt` takes effect at the next safe point of the grain: the cancellation token of the execution port is signalled, the loop stops within the cancellation budget of the host options, and after cancellation is observed no further model or tool call is made. A call in flight is settled: a model call is abandoned; a tool call is interrupted through `ToolAdapterService/ToolExecutor.Interrupt` and settles as observed when its receipt confirms the effect or its absence, and as uncertain when the effect cannot be confirmed. The grain sets `cancellationObservedAt`, moves the attempt from Running, WaitingForTool or WaitingForDecision to Cancelled (trigger `CancellationObserved`, and trigger `ReleaseRevokedWithPolicyRevoke` when the interruption comes from a revocation with the in-flight policy revoke, decision D123), or from WaitingForTool to Uncertain when a call stayed uncertain (trigger `EffectUnconfirmed`), and writes `AttemptCancellationObserved` with `uncertainCalls`, the number of calls it could not confirm, in the same transaction. The outcome Cancelled with the failure class cancellation, or the outcome Uncertain with the class uncertain, is then reported once as AIFACTORY-US-467 specifies. An attempt that waits for an approval is settled the same way whichever event of a cancelled run arrives first: when `ApprovalDecided` with the state Cancelled closed its decision request before the interrupt arrived (AIFACTORY-US-466), the attempt is still WaitingForDecision and ends Cancelled with the class cancellation, never Failed and never policy-denied. Completed effects stay visible with their receipts and are never rolled back silently. The request is applied once: a repeated `Runtime.Interrupt` for an attempt whose interruption is already recorded, or that is already terminal, is acknowledged with `ack-v1` and changes nothing. A call without workload identity is refused with UNAUTHENTICATED, without the service scope with PERMISSION_DENIED, an invalid request with INVALID_ARGUMENT, and an unknown attempt and an attempt of another tenant alike with NOT_FOUND (ADR-0015); no refusal changes state. For its caller the method is fail-fast: when this service is unavailable, the Cancelling state of Run Control stands and the attempt is settled later by this path or by the expiry of its lease. One event leads to the same observation without the method: `RunCancelled` of RunControlService, handler `ObserveCancellation`, settles every attempt of the cancelled run that this service still holds as non-terminal the same way and leaves terminal attempts as they are. An attempt may leave Claimed and Paused for a terminal state (decision D119): a cancellation that reaches an attempt still Claimed or Paused settles it through the transitions Claimed to Cancelled and Paused to Cancelled of the model, which the aggregate of AIFACTORY-US-460 accepts under the trigger `CancellationObserved`. Cancellation observations are audited (docs/planes/agent-runtime/security.md): the model lists no AuditService consumer of `AttemptCancellationObserved`, so the transaction of the observation also writes an `audit-evidence-v1` record through the sink of AIFACTORY-US-461, and the difference between the page and the model is reported. The model gives `Runtime.Interrupt` the request schema of the attempt outcome, which has no member for an interrupt request; the proto of this PBI names the attempt and the reason, and the schema is reported to the owner. StudioBff and DashboardService consume the event in their own PBIs. Kind: behavior. Traces: services: AgentRuntimeService, RunControlService, ToolAdapterService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: AgentRuntimeService/Runtime.Interrupt, ToolAdapterService/ToolExecutor.Interrupt; events: AgentRuntimeService/AttemptCancellationObserved, RunControlService/RunCancelled, RunControlService/ApprovalDecided; descriptors: ack-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-10, FUX-07, XL-06; scenarios: SCN-AgentRuntimeService-004, SCN-AgentRuntimeService-011. Relates: screens: run-detail, run-timeline. Depends on: AIFACTORY-US-465, AIFACTORY-US-466, AIFACTORY-US-467, feature:run-control-service, feature:tool-adapter-service, feature:component-audit-factory-evidence. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/agent-runtime/security.md#audit, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given a Running attempt and a caller with a workload identity and the service scope, when `AgentRuntimeService/Runtime.Interrupt` is called, then the reply is `ack-v1` before the stop, the request is recorded on the `AgentRuntimeService/ExecutionAttempt`, the loop stops within the cancellation budget, no model or tool call is made after the observation, the attempt is Cancelled with `cancellationObservedAt` and `AgentRuntimeService/AttemptCancellationObserved` is written in the same transaction (SCN-AgentRuntimeService-004, ADR-0014).",
        "AC2: Given an attempt WaitingForTool with a call in flight, when the interruption is observed, then the call is interrupted through `ToolAdapterService/ToolExecutor.Interrupt`, settles as observed when its receipt confirms the effect or its absence and the attempt is Cancelled, or settles as uncertain and the attempt is Uncertain with `uncertainCalls` counting it; an attempt WaitingForDecision is Cancelled, also when `RunControlService/ApprovalDecided` with the state Cancelled closed its decision request before the interrupt arrived; in each case one outcome is reported, Cancelled with the failure class cancellation or Uncertain with the class uncertain and never Failed with policy-denied (SCN-AgentRuntimeService-004, XL-06).",
        "AC3: Given the interruption was observed, when the outbox dispatcher publishes `AgentRuntimeService/AttemptCancellationObserved` on `execution.attempts.v1.attempt-cancellation-observed`, then the event is sent in the run event envelope with `attemptId`, `runId`, `tenantId` and `uncertainCalls`, a transport outage is retried with backoff without loss or duplicate under its event id, and one `audit-evidence-v1` record of the observation was written in the same transaction (SCN-AgentRuntimeService-011, ADR-0012).",
        "AC4: Given a call to `AgentRuntimeService/Runtime.Interrupt` without workload identity, without the service scope, with an invalid request, or for an unknown attempt or an attempt of another tenant, when it arrives, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively and no state changes; given the same request repeated, or a request for a terminal attempt, then it is acknowledged with `ack-v1` and nothing changes (SCN-AgentRuntimeService-004, ADR-0015).",
        "AC5: Given `RunControlService/RunCancelled` for a run of which this service holds one non-terminal and one terminal attempt, when `ObserveCancellation` handles it twice, then the non-terminal attempt is settled once as in AC1, the terminal attempt is unchanged and the redelivery has no second effect (SCN-AgentRuntimeService-011, FR-10)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/agent-runtime/security.md#audit",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1873",
        "AIFACTORY-TASK-1874",
        "AIFACTORY-TASK-1875"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5710,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "RunControlService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "AgentRuntimeService/Runtime.Interrupt",
          "ToolAdapterService/ToolExecutor.Interrupt"
        ],
        "events": [
          "AgentRuntimeService/AttemptCancellationObserved",
          "RunControlService/RunCancelled",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "ack-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "FUX-07",
          "XL-06"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-004",
          "SCN-AgentRuntimeService-011"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "run-timeline"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-465",
        "AIFACTORY-US-466",
        "AIFACTORY-US-467",
        "feature:run-control-service",
        "feature:tool-adapter-service",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/agent-runtime/security.md#audit",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-468]",
      "number": 468
    },
    {
      "id": "AIFACTORY-TASK-1873",
      "type": "task",
      "parent": "AIFACTORY-US-468",
      "title": "Runtime.Interrupt and the Interrupt command with settlement of the calls in flight",
      "sequence": "02.01.10.01",
      "description": "Runtime.Interrupt and the Interrupt command with settlement of the calls in flight. Expected output: The gRPC method Runtime.Interrupt records the request and replies ack-v1 at once, is applied once and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND without a change; the command Interrupt signals the cancellation token of the execution port, stops the loop within the cancellation budget, interrupts a tool call in flight through ToolExecutor.Interrupt, settles each call as observed or uncertain, sets cancellationObservedAt, moves the attempt to Cancelled or Uncertain and writes AttemptCancellationObserved with uncertainCalls and an audit-evidence-v1 record in one transaction, after which the outcome is reported once.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The gRPC method Runtime.Interrupt records the request and replies ack-v1 at once, is applied once and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND without a change; the command Interrupt signals the cancellation token of the execution port, stops the loop within the cancellation budget, interrupts a tool call in flight through ToolExecutor.Interrupt, settles each call as observed or uncertain, sets cancellationObservedAt, moves the attempt to Cancelled or Uncertain and writes AttemptCancellationObserved with uncertainCalls and an audit-evidence-v1 record in one transaction, after which the outcome is reported once."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1873]",
      "number": 1873
    },
    {
      "id": "AIFACTORY-TASK-1874",
      "type": "task",
      "parent": "AIFACTORY-US-468",
      "title": "Inbox handler ObserveCancellation for the attempts of a cancelled run",
      "sequence": "02.01.10.02",
      "description": "Inbox handler ObserveCancellation for the attempts of a cancelled run. Expected output: The handler of RunCancelled finds the attempts of the run that this service holds as non-terminal, settles each through the Interrupt command, leaves terminal attempts unchanged and is idempotent on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The handler of RunCancelled finds the attempts of the run that this service holds as non-terminal, settles each through the Interrupt command, leaves terminal attempts unchanged and is idempotent on the event id."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1874]",
      "number": 1874
    },
    {
      "id": "AIFACTORY-TASK-1875",
      "type": "task",
      "parent": "AIFACTORY-US-468",
      "title": "Verify the interruption, the settled calls and the observation event",
      "sequence": "02.01.10.03",
      "description": "Verify the interruption, the settled calls and the observation event. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-004|Scenario=SCN-AgentRuntimeService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-468 with a tool fake that confirms or cannot confirm a call in flight: the immediate ack-v1, the stop within the budget, the Cancelled and the Uncertain settlement with uncertainCalls, the attempt that waits for an approval and receives ApprovalDecided with the state Cancelled before Runtime.Interrupt, which ends Cancelled with the class cancellation and never Failed with policy-denied, the published event with its evidence record, each refusal over two tenants, the repeated request and the RunCancelled event delivered twice.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-004|Scenario=SCN-AgentRuntimeService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-468 with a tool fake that confirms or cannot confirm a call in flight: the immediate ack-v1, the stop within the budget, the Cancelled and the Uncertain settlement with uncertainCalls, the attempt that waits for an approval and receives ApprovalDecided with the state Cancelled before Runtime.Interrupt, which ends Cancelled with the class cancellation and never Failed with policy-denied, the published event with its evidence record, each refusal over two tenants, the repeated request and the RunCancelled event delivered twice."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5710,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1875]",
      "number": 1875
    },
    {
      "id": "AIFACTORY-US-469",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Keep the lease while an attempt works, pause without the control plane, recover after a replica crash and settle attempts whose lease is gone",
      "sequence": "02.01.11",
      "description": "As an operator, I want an attempt to keep its lease while it works, to pause when the control plane is away and to be settled when its lease or its replica is gone, so that no attempt runs without a lease, no outcome is invented and an effect that cannot be confirmed is shown to me before anything is repeated. A lease is a time-boxed right, and the runtime keeps it only by renewing it. The worker `LeaseHeartbeat` runs every 15 seconds over the attempts in Running, WaitingForTool, WaitingForDecision or Paused and renews each lease through `RunControlService/RunControl.AcquireLease`, naming the lease and as the holder that claimed it, with three fixed retries five seconds apart and the idempotency key lease id plus renewal sequence, one renewal at a time per attempt; Run Control extends the expiry for the same holder and refuses any other caller. The holder is the value of `ConnectSoftIdentityPlatform:WorkloadIdentity`, the one identity of the service and the same on every replica, so any replica renews the lease another replica claimed; exclusivity between replicas comes from the single activation of the `AttemptGrain` and from the fencing token. The worker input of the model lists Paused beside Running, WaitingForTool and WaitingForDecision (decision D119): the trigger `LeaseRenewed` moves a Paused attempt back to Running, which needs a renewal, so the heartbeat keeps renewing the lease of a Paused attempt. The heartbeat renews through the `AttemptGrain` of each attempt, and that call is what activates the grain again on a surviving replica after a crash. The round trip is recorded as `connectsoft.factory.runtime.control_plane_rtt`, and the objective of the model for renewal success is 99.9 percent over one hour. When the renewals of an attempt fail because the Control plane is unreachable, the attempt pauses at its next checkpoint: it moves from Running to Paused (trigger `ControlPlaneUnreachable`), `AttemptPhaseChanged` announces the state, and no model or tool call is issued while it is Paused. A renewal that succeeds again moves it back to Running (trigger `LeaseRenewed`) and the loop continues from the checkpoint. When the Control plane stays away past the lease and its renewal grace, Run Control reconciles the attempt on its side; the runtime invents no outcome for it. `LeaseExpired` of RunControlService, handler `AbandonAttempt`, tells the runtime that the Control plane reclaimed a lease. When the event names an attempt this service holds as non-terminal, the grain stops work at once, makes no further model or tool call and settles its row without a lease, as Uncertain when a call was in flight and otherwise as Cancelled; it sends no report under the expired fencing token, because Run Control already settled the attempt and would refuse the report. A renewal that Run Control refuses because the lease is no longer held by this service, or answers with FAILED_PRECONDITION because the lease it names is superseded (decision D121), is treated the same way. An event for a lease that expired Unclaimed carries an empty `holder` and names an attempt this service never started, so the handler has nothing to stop. A replica crash is detected by Orleans membership and by lease expiry. The `AttemptGrain` of an attempt whose lease is still valid re-activates on another replica when the heartbeat of a surviving replica calls it for the next renewal, renews the lease under the same holder, and resumes from its last checkpoint when the adapter version and the checkpoint format of that checkpoint are compatible with the replica; work since the last checkpoint is lost, and a step completed before the checkpoint is not executed again. When the checkpoint is not compatible, which is the case after an adapter upgrade, the attempt is not resumed: it ends Failed with the reason, and Run Control starts a new attempt from the step input when its retry rule allows it. The worker `OrphanedAttemptReconciler` runs every two minutes over the non-terminal attempts that have neither a live grain nor a valid lease, partitioned by tenant with five exponential retries. It settles an attempt with an open call record as Uncertain and any other as Cancelled, writes `AttemptOutcomeReported` and reports through the path of AIFACTORY-US-467 under the idempotency key attempt id plus outcome hash, so a second pass reports nothing twice. The runtime retries nothing and waits for nothing after that report: for an Uncertain outcome on a step of class shared-write or above RunControlService opens an operator decision, and the Operator of the project records the finding on the effect there, applied or not-applied, before anything is repeated; RunControlService records the finding in ToolAdapterService and refuses the choice retry unless the finding is not-applied (decisions D119 and D121). Settling without a lease uses the trigger `OrphanReconciled` of the model, under which an attempt leaves Claimed for Cancelled and Paused for Cancelled or Uncertain (decision D119), and the additions of AIFACTORY-US-460: the same trigger to Cancelled from Running, WaitingForTool and WaitingForDecision, and Running to Uncertain under `EffectUnconfirmed`. The jobs run on the engine registration of AIFACTORY-US-462. Kind: behavior. Traces: services: AgentRuntimeService, RunControlService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: RunControlService/RunControl.AcquireLease; events: AgentRuntimeService/AttemptPhaseChanged, AgentRuntimeService/AttemptOutcomeReported, RunControlService/LeaseExpired; descriptors: acquire-lease-v1, lease-v1; adrs: ADR-0014, ADR-0024; requirements: FR-10, NFR-06, XL-06. Depends on: AIFACTORY-US-462, AIFACTORY-US-465, AIFACTORY-US-467, feature:run-control-service. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/agent-runtime/workers.md, docs/planes/agent-runtime/durability-spike.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given attempts in Running, WaitingForTool, WaitingForDecision and Paused, when `LeaseHeartbeat` ticks, then each lease is renewed once through `RunControlService/RunControl.AcquireLease` with the value of `ConnectSoftIdentityPlatform:WorkloadIdentity` as `holder`, the same value on every replica, a tick repeated under the same renewal sequence renews nothing twice, and the round trip is recorded as `connectsoft.factory.runtime.control_plane_rtt` (model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC2: Given a Running attempt whose renewals fail because Run Control is unreachable, when it reaches its next checkpoint, then the `AgentRuntimeService/ExecutionAttempt` is Paused, `AgentRuntimeService/AttemptPhaseChanged` carries the state, no model or tool call is issued while it is Paused, the heartbeat keeps trying to renew the lease of the Paused attempt, a renewal that succeeds moves it back to Running, and no outcome is reported for an attempt that only paused (FR-10).",
        "AC3: Given `RunControlService/LeaseExpired` for an attempt this service holds as non-terminal, when `AbandonAttempt` handles it, then the grain stops without a further call, the row is settled Uncertain when a call was in flight and otherwise Cancelled, no report is sent under the expired fencing token, and an event with an empty `holder` for an attempt that never started changes nothing (XL-06, ADR-0014).",
        "AC4: Given a replica killed in the middle of a loop while the lease is valid, when the renewal call of `LeaseHeartbeat` re-activates the `AttemptGrain` on the surviving replica, then that replica renews the lease through `RunControlService/RunControl.AcquireLease` under the same `holder` and is not refused, and the grain resumes from the last checkpoint without executing a completed step again when the adapter version and the checkpoint format are compatible, and ends the attempt Failed with the reason without resuming when they are not (ADR-0024, NFR-06).",
        "AC5: Given three non-terminal attempts without a live grain and without a valid lease, a Claimed one, a Paused one and a Running one with an open call record, when `OrphanedAttemptReconciler` runs twice, then the Claimed and the Paused attempt are settled Cancelled and the third Uncertain, `AgentRuntimeService/AttemptOutcomeReported` is written once for each and each is reported once under attempt id plus outcome hash (docs/planes/agent-runtime/services/agent-runtime-service/index.md)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/agent-runtime/workers.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1876",
        "AIFACTORY-TASK-1877",
        "AIFACTORY-TASK-1878",
        "AIFACTORY-TASK-1879"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5711,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "RunControlService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "RunControlService/RunControl.AcquireLease"
        ],
        "events": [
          "AgentRuntimeService/AttemptPhaseChanged",
          "AgentRuntimeService/AttemptOutcomeReported",
          "RunControlService/LeaseExpired"
        ],
        "descriptors": [
          "acquire-lease-v1",
          "lease-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FR-10",
          "NFR-06",
          "XL-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-462",
        "AIFACTORY-US-465",
        "AIFACTORY-US-467",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/agent-runtime/workers.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-469]",
      "number": 469
    },
    {
      "id": "AIFACTORY-TASK-1876",
      "type": "task",
      "parent": "AIFACTORY-US-469",
      "title": "LeaseHeartbeat with renewal as holder and the pause and resume of an attempt",
      "sequence": "02.01.11.01",
      "description": "LeaseHeartbeat with renewal as holder and the pause and resume of an attempt. Expected output: The job LeaseHeartbeat renews the lease of every attempt in Running, WaitingForTool, WaitingForDecision or Paused through RunControl.AcquireLease, through the AttemptGrain of the attempt, with the value of ConnectSoftIdentityPlatform:WorkloadIdentity as holder, the same on every replica, under the key lease id plus renewal sequence and records connectsoft.factory.runtime.control_plane_rtt; after failed renewals the grain moves the attempt to Paused at its next checkpoint with AttemptPhaseChanged and issues no call, the heartbeat keeps renewing the lease of the Paused attempt, and a renewal that succeeds moves it back to Running.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The job LeaseHeartbeat renews the lease of every attempt in Running, WaitingForTool, WaitingForDecision or Paused through RunControl.AcquireLease, through the AttemptGrain of the attempt, with the value of ConnectSoftIdentityPlatform:WorkloadIdentity as holder, the same on every replica, under the key lease id plus renewal sequence and records connectsoft.factory.runtime.control_plane_rtt; after failed renewals the grain moves the attempt to Paused at its next checkpoint with AttemptPhaseChanged and issues no call, the heartbeat keeps renewing the lease of the Paused attempt, and a renewal that succeeds moves it back to Running."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5711,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1876]",
      "number": 1876
    },
    {
      "id": "AIFACTORY-TASK-1877",
      "type": "task",
      "parent": "AIFACTORY-US-469",
      "title": "AbandonAttempt, resume from a compatible checkpoint and the OrphanedAttemptReconciler",
      "sequence": "02.01.11.02",
      "description": "AbandonAttempt, resume from a compatible checkpoint and the OrphanedAttemptReconciler. Expected output: The inbox handler AbandonAttempt stops the grain of an attempt whose lease expired and settles the row as Uncertain or Cancelled under OrphanReconciled without a report, as does a renewal refused because the lease is no longer held by this service or is superseded; the renewal call of the heartbeat is what re-activates the AttemptGrain of a crashed replica on a surviving one, which renews the lease under the same holder; the re-activated AttemptGrain resumes from the last checkpoint only when adapter version and checkpoint format are compatible and otherwise ends the attempt Failed with the reason; the job OrphanedAttemptReconciler settles non-terminal attempts without a live grain and a valid lease, Claimed and Paused ones included, as Uncertain or Cancelled, writes AttemptOutcomeReported and reports once under attempt id plus outcome hash.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The inbox handler AbandonAttempt stops the grain of an attempt whose lease expired and settles the row as Uncertain or Cancelled under OrphanReconciled without a report, as does a renewal refused because the lease is no longer held by this service or is superseded; the renewal call of the heartbeat is what re-activates the AttemptGrain of a crashed replica on a surviving one, which renews the lease under the same holder; the re-activated AttemptGrain resumes from the last checkpoint only when adapter version and checkpoint format are compatible and otherwise ends the attempt Failed with the reason; the job OrphanedAttemptReconciler settles non-terminal attempts without a live grain and a valid lease, Claimed and Paused ones included, as Uncertain or Cancelled, writes AttemptOutcomeReported and reports once under attempt id plus outcome hash."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5711,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1877]",
      "number": 1877
    },
    {
      "id": "AIFACTORY-TASK-1878",
      "type": "task",
      "parent": "AIFACTORY-US-469",
      "title": "Harness that runs two silo processes, kills one and stops Run Control",
      "sequence": "02.01.11.03",
      "description": "Harness that runs two silo processes, kills one and stops Run Control. Expected output: The acceptance suite starts two replicas of the service as separate processes against an isolated database, kills one without a graceful stop at a chosen step of a scripted loop, plants a checkpoint whose adapter version the replica does not accept, stops and restarts the fake of Run Control, and builds LeaseExpired events with and without a holder from the pinned contracts package.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The acceptance suite starts two replicas of the service as separate processes against an isolated database, kills one without a graceful stop at a chosen step of a scripted loop, plants a checkpoint whose adapter version the replica does not accept, stops and restarts the fake of Run Control, and builds LeaseExpired events with and without a holder from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5711,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1878]",
      "number": 1878
    },
    {
      "id": "AIFACTORY-TASK-1879",
      "type": "task",
      "parent": "AIFACTORY-US-469",
      "title": "Verify lease renewal, pause, abandonment, recovery and orphan settlement",
      "sequence": "02.01.11.04",
      "description": "Verify lease renewal, pause, abandonment, recovery and orphan settlement. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=LeaseAndRecovery\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-469 against `RunControlService/RunControl.AcquireLease` and `RunControlService/LeaseExpired`: one renewal per tick with the holder value of ConnectSoftIdentityPlatform:WorkloadIdentity, the Paused attempt that issues no call, whose lease the heartbeat keeps renewing and which resumes, the abandoned attempt without a report, the surviving replica that renews the lease of the resumed attempt under the same holder and is not refused, the resume from a compatible checkpoint and the refusal of an incompatible one, and the three orphaned attempts, a Claimed and a Paused one among them, settled and reported once.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=LeaseAndRecovery\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-469 against `RunControlService/RunControl.AcquireLease` and `RunControlService/LeaseExpired`: one renewal per tick with the holder value of ConnectSoftIdentityPlatform:WorkloadIdentity, the Paused attempt that issues no call, whose lease the heartbeat keeps renewing and which resumes, the abandoned attempt without a report, the surviving replica that renews the lease of the resumed attempt under the same holder and is not refused, the resume from a compatible checkpoint and the refusal of an incompatible one, and the three orphaned attempts, a Claimed and a Paused one among them, settled and reported once."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5711,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1879]",
      "number": 1879
    },
    {
      "id": "AIFACTORY-US-470",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Delegate a sub-agent as a child run within the depth limit and announce the delegation",
      "sequence": "02.01.12",
      "description": "A supervisor attempt may hand a part of its task to another agent when its task contract and its release allow it. A delegation is not a call from agent to agent inside the attempt: the child is a run of its own, under the same tenant and project scope and the same approval semantics as its parent, and inside one runtime worker the handoff stays a step of the flow and never an A2A call (ADR-0023 decision 1). The execution port of the host raises the delegation. The grain checks the depth of the new child against the limit of the attempt, `maxSubAgentDepth` of `AttemptLimits`, with `Runtime:Attempts:MaxSubAgentDepth`, 2 by default, as its bound, and refuses a delegation beyond it as a failed call on the timeline without submitting anything. An allowed delegation submits its child run through `RunControlService/RunControl.SubmitChildRun`, the internal child run operation of Run Control (decision D119), under the workload identity of the service: the request `run-submission-v1` carries the run of the attempt as `parentRunId` and the attempt as `parentAttemptId`, and the reply `run-accepted-v1` names the child run. The child inherits the tenant, the project, the policy revision and the pinned release closure of its parent; the runtime sets none of them. The child gets no reservation of its own: its usage is recorded with the child run id and counts on the reservation of the parent run, and the submission waits for no budget reservation and opens no spend approval (decision D121). The operation is of class shared-write and returns the same child run for the same idempotency key with the same input, so a submission repeated after a lost answer creates no second child; the idempotency key of a delegation is the `delegationId` (decision D121). The accepted delegation is recorded as a `CallRecord` of kind SubAgent with the child agent as target and as a `SubAgentDelegation` with `delegationId`, `childRunId`, `childAgentId`, `purpose`, `depth` and the status submitted, and `SubAgentDelegated` with `childRunId`, `childAgentId` and `depth` is written in the same transaction. A child run id is unique among delegations, so a delegation recorded twice is one. Run Control is a fail-fast dependency of the service. A submission it refuses is a call record with the status failed and the reason of the refusal: no delegation is recorded, no event is written, and the supervisor continues with that observation. Under a parent run that is terminal or Cancelling Run Control answers FAILED_PRECONDITION and no child run exists (decision D121); the runtime treats that answer as such a refusal. A submission that gets no answer is repeated under the same key until it is answered or the reminder `call-timeout` fires, upon which the call record is failed with the reason. One point of the contract is reported to the owner: `run-submission-v1` names a workflow and has no member for the child agent or the purpose of a delegation. The agent never spawns an agent outside the scope of its parent run, and the runtime never executes the child inside the parent attempt. While the child runs, the parent attempt keeps its lease and its limits. The outcome of the child returns by event, and the grain follows no stream: `RunCompleted`, `RunFailed` and `RunCancelled` of RunControlService reach the inbox handler `SettleDelegation`, which finds the delegation by its child run id, sets it to completed, failed or cancelled and returns the outcome of a completed child or the failure of a failed one to the waiting supervisor attempt. The outcome of a completed child is read through the optional `outputRef` of `RunCompleted`, the reference of the outcome of the child run in ArtifactService beside its hash in `outcomeHash` (decision D121). A child run stopped for an overrun of its budget arrives as `RunCancelled` with the reason budget-exceeded and is a failed child: its delegation is set to failed, not to cancelled, and the supervisor attempt observes a failure (decision D121); a child run stopped because a release of its pinned closure was revoked arrives with the reason release-revoked and is a failed child in the same way (decision D125). The stopped run itself ends Cancelled and not Failed, and only its parent treats it as failed (decision D123). The result is observed like the result of a call, and a checkpoint follows it. A terminal run event that names no child run of a delegation of this service changes nothing in this handler, a redelivered event has no second effect, and `RunCancelled` reaches this handler beside `ObserveCancellation` of AIFACTORY-US-468. A parent run that ends Failed or Cancelled has its open child runs cancelled by Run Control, which owns their runs; the runtime cancels no child itself. StudioBff and DashboardService consume the event in their own PBIs. Kind: behavior. Traces: services: AgentRuntimeService, RunControlService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: RunControlService/RunControl.SubmitChildRun; events: AgentRuntimeService/SubAgentDelegated, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled; descriptors: run-submission-v1, run-accepted-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0023, ADR-0024; scenarios: SCN-AgentRuntimeService-013. Depends on: AIFACTORY-US-465, feature:run-control-service. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/run-submission.schema.json, docs/architecture/adr/0023-a2a-interoperability.md, docs/planes/agent-runtime/security.md.",
      "acceptanceCriteria": [
        "AC1: Given a supervisor attempt whose depth is below the limit, when its agent delegates, then `RunControlService/RunControl.SubmitChildRun` is called once with `run-submission-v1` carrying the run of the attempt as `parentRunId` and the attempt as `parentAttemptId`, under the `delegationId` as idempotency key, a call record of kind SubAgent and a delegation with the child run id of `run-accepted-v1` and the status submitted exist on the `AgentRuntimeService/ExecutionAttempt` and `AgentRuntimeService/SubAgentDelegated` is written in the same transaction with `attemptId`, `runId`, `tenantId`, `childRunId`, `childAgentId` and `depth` (SCN-AgentRuntimeService-013, ADR-0023).",
        "AC2: Given the delegation was recorded, when the outbox dispatcher publishes `AgentRuntimeService/SubAgentDelegated` on `execution.attempts.v1.sub-agent-delegated`, then the event is sent in the run event envelope with the payload of AC1 and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AgentRuntimeService-013, ADR-0012).",
        "AC3: Given a delegation that would exceed `Runtime:Attempts:MaxSubAgentDepth` or the `maxSubAgentDepth` of the attempt, when it is raised, then it is refused and recorded as a failed call, no child run is submitted and no event is written; given `RunControlService/RunControl.SubmitChildRun` refuses the submission, as it does with FAILED_PRECONDITION under a parent run that is terminal or Cancelling, when a delegation is raised, then it is a call record with the status failed and the reason of the refusal, no child run exists, no delegation is recorded and no event is written; given a submission repeated under the same idempotency key, the `delegationId`, after a lost answer, or the same child run recorded twice, then the same child run is returned and one delegation exists (SCN-AgentRuntimeService-013, model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC4: Given a submitted child run, when `RunControlService/RunCompleted`, `RunControlService/RunFailed` or `RunControlService/RunCancelled` names it and `SettleDelegation` handles the event, the first twice, then the delegation is completed, failed or cancelled, the result of a completed child is read through the `outputRef` of `RunCompleted`, a `RunCancelled` with the reason budget-exceeded or release-revoked (D125) sets the delegation to failed and the supervisor observes a failed child, although the child run itself ended Cancelled, a checkpoint follows the observation, the parent loop continues with the result or the failure of the child, the redelivery has no second effect, and a terminal run event that names no child run of this service changes no delegation (ADR-0024, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "docs/planes/agent-runtime/security.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1880",
        "AIFACTORY-TASK-1881",
        "AIFACTORY-TASK-1882"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5712,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "RunControlService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "RunControlService/RunControl.SubmitChildRun"
        ],
        "events": [
          "AgentRuntimeService/SubAgentDelegated",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled"
        ],
        "descriptors": [
          "run-submission-v1",
          "run-accepted-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0023",
          "ADR-0024"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-013"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-465",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "docs/planes/agent-runtime/security.md"
      ],
      "titlePrefix": "[AIFACTORY-US-470]",
      "number": 470
    },
    {
      "id": "AIFACTORY-TASK-1880",
      "type": "task",
      "parent": "AIFACTORY-US-470",
      "title": "Delegation in the AttemptGrain with the depth limit, the child run submission and the settlement of the child",
      "sequence": "02.01.12.01",
      "description": "Delegation in the AttemptGrain with the depth limit, the child run submission and the settlement of the child. Expected output: The grain refuses a delegation beyond maxSubAgentDepth as a failed call, submits an allowed one through RunControl.SubmitChildRun with run-submission-v1 carrying the run of the attempt as parentRunId and the attempt as parentAttemptId under the delegationId as idempotency key, records the accepted one as a CallRecord of kind SubAgent and a SubAgentDelegation with the child run id of run-accepted-v1 and the status submitted, writes SubAgentDelegated in the same transaction, records a refused submission as a failed call with its reason without a delegation or an event, the FAILED_PRECONDITION of a parent run that is terminal or Cancelling among the refusals, sets no budget and asks for no reservation for the child, and repeats an unanswered one under the same key until the call budget is exhausted; the inbox handler SettleDelegation finds the delegation of the child run that RunCompleted, RunFailed or RunCancelled names, sets it to completed, failed or cancelled, sets the delegation of a child that RunCancelled names with the reason budget-exceeded or release-revoked (D125) to failed, returns the outcome, read through the outputRef of RunCompleted, or the failure to the waiting supervisor attempt, after which a checkpoint is written, ignores a run that is no child of this service and is idempotent on the event id; a child run id recorded twice is one delegation.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The grain refuses a delegation beyond maxSubAgentDepth as a failed call, submits an allowed one through RunControl.SubmitChildRun with run-submission-v1 carrying the run of the attempt as parentRunId and the attempt as parentAttemptId under the delegationId as idempotency key, records the accepted one as a CallRecord of kind SubAgent and a SubAgentDelegation with the child run id of run-accepted-v1 and the status submitted, writes SubAgentDelegated in the same transaction, records a refused submission as a failed call with its reason without a delegation or an event, the FAILED_PRECONDITION of a parent run that is terminal or Cancelling among the refusals, sets no budget and asks for no reservation for the child, and repeats an unanswered one under the same key until the call budget is exhausted; the inbox handler SettleDelegation finds the delegation of the child run that RunCompleted, RunFailed or RunCancelled names, sets it to completed, failed or cancelled, sets the delegation of a child that RunCancelled names with the reason budget-exceeded or release-revoked (D125) to failed, returns the outcome, read through the outputRef of RunCompleted, or the failure to the waiting supervisor attempt, after which a checkpoint is written, ignores a run that is no child of this service and is idempotent on the event id; a child run id recorded twice is one delegation."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5712,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1880]",
      "number": 1880
    },
    {
      "id": "AIFACTORY-TASK-1881",
      "type": "task",
      "parent": "AIFACTORY-US-470",
      "title": "Fake of the child run submission and terminal run events of a child run",
      "sequence": "02.01.12.02",
      "description": "Fake of the child run submission and terminal run events of a child run. Expected output: The acceptance suite holds a fake of RunControl.SubmitChildRun that answers run-accepted-v1 with a child run id, returns the same child run for the same idempotency key, records what was submitted with its idempotency key, can refuse a submission, with FAILED_PRECONDITION for a parent run that is terminal or Cancelling among its refusals, and can be stopped, and RunCompleted events with an outputRef, RunFailed events and RunCancelled events, one of them with the reason budget-exceeded and with the reason release-revoked, built from the pinned contracts package for a child run of a delegation and for a run that is no child.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of RunControl.SubmitChildRun that answers run-accepted-v1 with a child run id, returns the same child run for the same idempotency key, records what was submitted with its idempotency key, can refuse a submission, with FAILED_PRECONDITION for a parent run that is terminal or Cancelling among its refusals, and can be stopped, and RunCompleted events with an outputRef, RunFailed events and RunCancelled events, one of them with the reason budget-exceeded and with the reason release-revoked, built from the pinned contracts package for a child run of a delegation and for a run that is no child."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5712,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1881]",
      "number": 1881
    },
    {
      "id": "AIFACTORY-TASK-1882",
      "type": "task",
      "parent": "AIFACTORY-US-470",
      "title": "Verify the delegation, its depth limit and the observed child",
      "sequence": "02.01.12.03",
      "description": "Verify the delegation, its depth limit and the observed child. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRuntimeService-013\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-470: the submission through RunControl.SubmitChildRun with the run and the attempt as parent and the delegationId as idempotency key, the recorded delegation with SubAgentDelegated in one transaction, its payload and the retry of the publication, the refused delegation beyond the depth limit, the submission Run Control refuses recorded as a failed call with its reason, the FAILED_PRECONDITION of a terminal and of a Cancelling parent run among them, the same child run for a submission repeated under its key and the single delegation for a repeated child run id, and the completed, the failed and the cancelled child settled by RunCompleted, RunFailed and RunCancelled, the result of the completed child read through the outputRef of RunCompleted, the child stopped with the reason budget-exceeded and one with the reason release-revoked settled as failed delegations, a redelivered event and a terminal event of a run that is no child.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AgentRuntimeService-013\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-470: the submission through RunControl.SubmitChildRun with the run and the attempt as parent and the delegationId as idempotency key, the recorded delegation with SubAgentDelegated in one transaction, its payload and the retry of the publication, the refused delegation beyond the depth limit, the submission Run Control refuses recorded as a failed call with its reason, the FAILED_PRECONDITION of a terminal and of a Cancelling parent run among them, the same child run for a submission repeated under its key and the single delegation for a repeated child run id, and the completed, the failed and the cancelled child settled by RunCompleted, RunFailed and RunCancelled, the result of the completed child read through the outputRef of RunCompleted, the child stopped with the reason budget-exceeded and one with the reason release-revoked settled as failed delegations, a redelivered event and a terminal event of a run that is no child."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5712,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1882]",
      "number": 1882
    },
    {
      "id": "AIFACTORY-US-471",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-011",
      "title": "Read the timeline and the checkpoints of an attempt and watch its phases, by hash and reference and never by content",
      "sequence": "02.01.13",
      "description": "As an operator, I want to read what an attempt did, call by call and checkpoint by checkpoint, and to watch it while it runs, so that I can explain an outcome and decide on a resume from recorded facts and never from the content of a prompt. A caller whose scope carries `factory.runs.read` reads one attempt through `GetAttemptTimeline`: the identity of the attempt (run, step, release, agent and model profile), its state and phase, the phases it passed, its checkpoints, every call with sequence, kind, target, request hash, policy decision id, receipt reference, status and times, its decision requests with kind, status and approval id, its delegations, and its outcome with the outcome hash. Calls are shown by hash and receipt reference and never by content: the service stores no prompt, no completion and no tool payload, so the response cannot hold one. The same caller lists the checkpoints of the attempt through `ListCheckpoints`, in sequence order, each with sequence, phase, adapter version, hash and creation time and without the adapter state, which stays an opaque blob; an operator reads the list before deciding whether an attempt can be resumed. Both are operations of class read with natural idempotency and write nothing. Every query runs under the tenant row filter: an attempt of another tenant is answered 404, the same answer as for an attempt id that does not exist, and the answer never confirms that the attempt exists; a token without the scope, and a caller whose token grants no role in the project of the attempt, is answered 403 (ADR-0015 amendments of D113 and D114). The Studio reads both through the platform route (GW-03). A subscriber with a workload identity whose token holds the service scope that names AgentRuntimeService opens the internal server stream `Runtime.WatchAttempt` for one attempt and receives the phase changes and the checkpoints of that attempt in commit order, each as a `run-event-envelope-v1`, until the attempt is terminal or the subscriber cancels. The stream is of class read and changes nothing. The model does not say whether the stream first replays what was committed before the subscription; this PBI starts at the subscription and leaves the past to the timeline, and the point is reported. A caller without workload identity is refused with UNAUTHENTICATED, without the service scope with PERMISSION_DENIED, an invalid request with INVALID_ARGUMENT, and an unknown attempt and an attempt of another tenant alike with NOT_FOUND. The summary of the model names the Studio BFF as the receiver of the stream while its inbound dependencies name RunControlService for it; the method admits any workload that holds the service scope, and the difference is reported to the owner. A read returns what was committed: the timeline of the runtime is never the truth of the run, which Run Control holds. Kind: behavior. Traces: services: AgentRuntimeService; aggregates: AgentRuntimeService/ExecutionAttempt; apis: AgentRuntimeService/GetAttemptTimeline, AgentRuntimeService/ListCheckpoints, AgentRuntimeService/Runtime.WatchAttempt; descriptors: run-event-envelope-v1; adrs: ADR-0015, ADR-0028; requirements: FR-03, FUX-04; scenarios: SCN-AgentRuntimeService-001, SCN-AgentRuntimeService-002, SCN-AgentRuntimeService-006. Relates: screens: run-timeline, run-detail. Depends on: AIFACTORY-US-461, AIFACTORY-US-465. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/agent-runtime/security.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.runs.read` and a role in the project of an attempt that has checkpoints, calls, a decision request and an outcome, when `AgentRuntimeService/GetAttemptTimeline` is called, then the response is 200 with state, phase, the checkpoints, every call by request hash and receipt reference, the decision requests, the delegations and the outcome with its hash, and no field holds a prompt, a completion or a tool payload (SCN-AgentRuntimeService-001, FUX-04).",
        "AC2: Given the same caller, when `AgentRuntimeService/ListCheckpoints` is called, then the response is 200 with the checkpoints of the attempt in sequence order, each with sequence, phase, adapter version, hash and creation time and without the adapter state (SCN-AgentRuntimeService-002).",
        "AC3: Given a token without `factory.runs.read`, a token that grants no role in the project of the attempt, an attempt id that does not exist, or an attempt of another tenant, when either read is called, then the answers are 403, 403, 404 and 404, the foreign attempt answered exactly as the unknown one, each with a problem response and no state change (SCN-AgentRuntimeService-001, SCN-AgentRuntimeService-002, ADR-0015).",
        "AC4: Given a subscriber with a workload identity and the service scope, when `AgentRuntimeService/Runtime.WatchAttempt` is opened for a running attempt, then each later phase change and checkpoint arrives once and in commit order as `run-event-envelope-v1` until the attempt is terminal, the stream ends then or when the subscriber cancels, and nothing is written (SCN-AgentRuntimeService-006).",
        "AC5: Given a call to `AgentRuntimeService/Runtime.WatchAttempt` without workload identity, without the service scope, with an invalid request, or for an unknown attempt or an attempt of another tenant, when it arrives, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, the foreign attempt exactly as the unknown one, and no stream is opened (SCN-AgentRuntimeService-006, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/security.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1883",
        "AIFACTORY-TASK-1884",
        "AIFACTORY-TASK-1885"
      ],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5713,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService"
        ],
        "aggregates": [
          "AgentRuntimeService/ExecutionAttempt"
        ],
        "apis": [
          "AgentRuntimeService/GetAttemptTimeline",
          "AgentRuntimeService/ListCheckpoints",
          "AgentRuntimeService/Runtime.WatchAttempt"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-03",
          "FUX-04"
        ],
        "scenarios": [
          "SCN-AgentRuntimeService-001",
          "SCN-AgentRuntimeService-002",
          "SCN-AgentRuntimeService-006"
        ]
      },
      "relates": {
        "screens": [
          "run-timeline",
          "run-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-461",
        "AIFACTORY-US-465"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/security.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-471]",
      "number": 471
    },
    {
      "id": "AIFACTORY-TASK-1883",
      "type": "task",
      "parent": "AIFACTORY-US-471",
      "title": "GetAttemptTimeline and ListCheckpoints read models under the tenant filter and the project role",
      "sequence": "02.01.13.01",
      "description": "GetAttemptTimeline and ListCheckpoints read models under the tenant filter and the project role. Expected output: GetAttemptTimeline returns the attempt with phases, checkpoints, calls by request hash and receipt reference, decision requests, delegations and the outcome; ListCheckpoints returns the checkpoints in sequence order without the adapter state; both apply the tenant row filter so that an attempt of another tenant is answered 404 like an unknown one, answer 403 for a missing scope and for a token without a role in the project of the attempt, and write nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "GetAttemptTimeline returns the attempt with phases, checkpoints, calls by request hash and receipt reference, decision requests, delegations and the outcome; ListCheckpoints returns the checkpoints in sequence order without the adapter state; both apply the tenant row filter so that an attempt of another tenant is answered 404 like an unknown one, answer 403 for a missing scope and for a token without a role in the project of the attempt, and write nothing."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1883]",
      "number": 1883
    },
    {
      "id": "AIFACTORY-TASK-1884",
      "type": "task",
      "parent": "AIFACTORY-US-471",
      "title": "Runtime.WatchAttempt server stream of phase changes and checkpoints in commit order",
      "sequence": "02.01.13.02",
      "description": "Runtime.WatchAttempt server stream of phase changes and checkpoints in commit order. Expected output: The gRPC method Runtime.WatchAttempt streams one run-event-envelope-v1 per committed phase change and checkpoint of the attempt from the subscription on, in commit order, ends when the attempt is terminal or the subscriber cancels, writes nothing and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND before a stream is opened.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The gRPC method Runtime.WatchAttempt streams one run-event-envelope-v1 per committed phase change and checkpoint of the attempt from the subscription on, in commit order, ends when the attempt is terminal or the subscriber cancels, writes nothing and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND before a stream is opened."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1884]",
      "number": 1884
    },
    {
      "id": "AIFACTORY-TASK-1885",
      "type": "task",
      "parent": "AIFACTORY-US-471",
      "title": "Verify the two reads and the stream with a two-tenant fixture",
      "sequence": "02.01.13.03",
      "description": "Verify the two reads and the stream with a two-tenant fixture. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-001|Scenario=SCN-AgentRuntimeService-002|Scenario=SCN-AgentRuntimeService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-471: the timeline by hash and reference without content, the ordered checkpoints without adapter state, the 403 and the 404 of each read over two tenants and two projects, the ordered stream that ends with the attempt and each refusal of the stream.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeService-001|Scenario=SCN-AgentRuntimeService-002|Scenario=SCN-AgentRuntimeService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-471: the timeline by hash and reference without content, the ordered checkpoints without adapter state, the 403 and the 404 of each read over two tenants and two projects, the ordered stream that ends with the attempt and each refusal of the stream."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 57,
      "phase": "factory",
      "stackRank": 5713,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1885]",
      "number": 1885
    },
    {
      "id": "AIFACTORY-FEAT-012",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-002",
      "title": "WorkflowEngineService: complete delivery",
      "sequence": "02.02",
      "description": "WorkflowEngineService is the service of bounded context BC-38 (Workflow Definitions & Engine). Loads Published workflow definitions (DAGs of agent, tool, human, condition, timer, sub-workflow and compensation steps) and drives a workflow run — computing ready steps for Run Control to dispatch, evaluating conditions on recorded outputs, firing durable timers and running compensation — without ever owning run authority (BC-38). Its own repository is ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Delivers: WorkflowEngineService (complete). Increment I1: Generate a microservice. Build order 58 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-006",
        "AIFACTORY-US-496",
        "AIFACTORY-US-497",
        "AIFACTORY-US-498",
        "AIFACTORY-US-499",
        "AIFACTORY-US-746",
        "AIFACTORY-US-500",
        "AIFACTORY-US-501",
        "AIFACTORY-US-502",
        "AIFACTORY-US-503",
        "AIFACTORY-US-1496",
        "AIFACTORY-US-646",
        "AIFACTORY-US-647",
        "AIFACTORY-US-504",
        "AIFACTORY-US-505",
        "AIFACTORY-US-009"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5800,
      "titlePrefix": "[AIFACTORY-FEAT-012]",
      "number": 12
    },
    {
      "id": "AIFACTORY-US-006",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "A workflow run is driven from its pinned definition to one terminal report and survives a restart",
      "sequence": "02.02.01",
      "description": "As an operator, I want a run to be planned step by step from recorded outputs by an engine that holds no run authority, and to continue after a process restart, so that a crash never loses work or runs a step twice. This is the integration PBI of the complete delivery of WorkflowEngineService, the engine of bounded context BC-38. The engine owns no run authority (ADR-0014): RunControlService accepts the run, creates steps, attempts and leases and records every outcome; the engine keeps a projection of the run in `workflow-engine-sql`, computes from the pinned definition and the recorded outputs which steps are ready, announces them through `WorkflowEngineService/StepReady` and reports the terminal result it decided exactly once through `WorkflowEngineService/WorkflowRunCompleted`, `WorkflowEngineService/WorkflowRunFailed` or `WorkflowEngineService/WorkflowRunCancelled`; for a run that Run Control failed itself it writes no `WorkflowRunFailed` and closes its projection on `RunFailed`. It dispatches nothing itself. Three rules of decisions D121 and D123 shape the whole. Before the engine announces an agent or tool step it stores the task contract of the step in ArtifactService, once for the step and for no attempt, `StepReady` carries the reference and the hash of that contract and the step run keeps both (D125); a human step has no task contract and its `StepReady` carries neither (AIFACTORY-US-746), and a human step that waits on the promotion gate of EnvironmentPromotionService is announced by no `StepReady` and advances on the decision of that gate (AIFACTORY-US-1496, D133). The engine advances a run on `StepSettled` alone, and `AttemptOutcomeRecorded` only updates its projection (AIFACTORY-US-500). And after a failed step Run Control only settles the step: the engine applies the declared failure policy, Fail or Compensate, a step settled Failed under Retry with its attempts spent being failed like one under Fail, and its `WorkflowRunFailed` alone fails the run in Run Control (AIFACTORY-US-501). The repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService is scaffolded from the pinned package of the agent host template, the template the model binds the service to, as the host kind `workflow-engine` (AIFACTORY-US-496); the Factory service profile of the base template reaches the host through the base-template submodule of that package, so the Orleans outbox and inbox, the trusted scope chain, the tenant row filter, token validation, health, readiness and telemetry come from pinned packages and are not written again. Every integration event is the run event envelope of the pinned contracts package, written to the Orleans outbox of the messaging profile `workflow-engine` in the transaction of the command that changed the aggregate (ADR-0012), so publication is never proof of a transition. The behaviour is delivered by the other PBIs of this feature: the skeleton of aggregates, store, messaging and workers (AIFACTORY-US-497), definitions validated and loaded (AIFACTORY-US-498), a run opened and its ready steps announced (AIFACTORY-US-499), the task contract of each agent and tool step stored before its announcement (AIFACTORY-US-746), the run advanced on settled steps (AIFACTORY-US-500), failed or compensated by the declared failure policy (AIFACTORY-US-501), durable timers and stuck-run recovery (AIFACTORY-US-502), decisions applied and the projection closed on cancellation (AIFACTORY-US-503), the choice of the Operator followed on an escalated or uncertain step and the projection closed when Run Control fails the run (AIFACTORY-US-646), a step of kind SubWorkflow executed as a child run (AIFACTORY-US-647), the run graph read (AIFACTORY-US-504), the members of a readiness bundle satisfied by kind (AIFACTORY-US-505), and the next workflow submitted by a readiness correlation (AIFACTORY-US-009). The scaffold, the hosted surface, the messaging registration and the worker hosting are proven by AIFACTORY-US-496 and AIFACTORY-US-497 and are not proven again here. This PBI proves what only the whole shows, on runs driven against the fake Run Control of AIFACTORY-TASK-2002. One run of a chain definition goes from `RunAccepted` to a single terminal event, each step reaching its final state when the fake settled it through `StepSettled`, the one event on which the engine advances, whether the recorded outcome of its attempt arrived before or after (AIFACTORY-US-500). One run of `generate-product`, the chain definition that holds a bounded loop, a fan-out with its join and a human step, ends with exactly one terminal event. The restart is proven: `WorkflowRunGrain` serialises Advance for one run and commits step-run rows with the outbox in one transaction; when the process dies between applying the settlement of a step and emitting the `StepReady` it causes, the re-activated grain re-applies what Run Control recorded idempotently, an outcome on the outcome sequence and a `StepSettled` on its event id, and re-emits `StepReady` with the same `stepRunId` and the task contract reference the step run keeps, and Run Control deduplicates on `stepRunId`, so no step runs twice and no output is duplicated. And the engine respects the run states that only Run Control holds. A run may be Held while its environment is frozen and WaitingForApproval for a step approval, a spend approval or an operator decision; a `StepReady` of such a run creates a Pending step that waits for the dispatcher of Run Control, and the engine never moves the run: while no outcome arrives it fails no step run and writes no terminal event, and all its reconciler does is to re-emit `StepReady` with the same `stepRunId` (AIFACTORY-US-502). A ChangesRequested decision returns the run to Running in Run Control with the reason of the reviewer. What Run Control does with `StepReady` is its own delivery: the copy of `actionClass` and `idempotent` to `sideEffectClass` and `idempotent` of its `Step`, the dispatch of the attempt and the opening of the approval of a human step are proven by AIFACTORY-US-163 of feature `run-control-service`, and the same feature proves that the `Step` keeps the `stepRunId` and the `failurePolicy` the event carries, that the reference and the hash of the task contract are kept on the step and copied to each attempt of it, that `StepSettled` is published once and that the operator decision is opened. This PBI proves the publisher side, the payload the engine writes, and a consumer contract test in the repository of Run Control pins that payload. The route through the Agent Mesh gateway arrives with feature `agent-runtime-worker` in a later increment; until then the three REST operations are hosted and proven on the service itself. A step of kind SubWorkflow is executed as a child run that the engine submits through the internal operation `RunControlService/RunControl.SubmitChildRun`, and the result of the child returns to the parent step run with the terminal run events of Run Control (AIFACTORY-US-647); none of the six chain definitions uses the kind, so no run of this suite holds such a step. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun, RunControlService/Step; apis: RunControlService/SubmitRun, RunControlService/RunControl.SubmitChildRun; events: WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, WorkflowEngineService/WorkflowRunCancelled, RunControlService/RunAccepted, RunControlService/AttemptOutcomeRecorded, RunControlService/StepSettled, RunControlService/ApprovalDecided; workflows: generate-product; steps: generate-product/fan-out-fill, generate-product/join-fill, generate-product/check-build, generate-product/approve-proposal; adrs: ADR-0012, ADR-0014, ADR-0024, ADR-0027; requirements: FR-03, FR-10, XL-06. Relates: nfrs: NFR-05, NFR-06. Depends on: AIFACTORY-US-496, AIFACTORY-US-497, AIFACTORY-US-498, AIFACTORY-US-499, AIFACTORY-US-500, AIFACTORY-US-501, AIFACTORY-US-502, AIFACTORY-US-503, AIFACTORY-US-504, AIFACTORY-US-505, AIFACTORY-US-009, AIFACTORY-US-646, AIFACTORY-US-647, AIFACTORY-US-746, AIFACTORY-US-1496, feature:run-control-service, feature:agent-registry-service-thin, feature:contracts-package. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, model/workflows/generate-product.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a seeded Draft release of a chain definition and a `RunControlService/RunAccepted` that pins it, when the fake Run Control records a Succeeded outcome through `RunControlService/AttemptOutcomeRecorded` and settles the step through `RunControlService/StepSettled` for every announced step, then `WorkflowEngineService/WorkflowRunStarted` is written once, every step is announced exactly once through `WorkflowEngineService/StepReady` in dependency order and only after `RunControlService/StepSettled` settled the steps it depends on, each announcement of an agent or tool step with the reference and the hash of a task contract the engine stored before it, and `WorkflowEngineService/WorkflowRunCompleted` is written exactly once, each in the transaction of the transition it announces (ADR-0014, ADR-0012).",
        "AC2: Given the engine process is killed between applying a `RunControlService/StepSettled` and emitting the `WorkflowEngineService/StepReady` it causes, when the grain of the `WorkflowEngineService/WorkflowRun` is activated again, then the settlement is re-applied idempotently on its event id and a redelivered `RunControlService/AttemptOutcomeRecorded` on the outcome sequence, `StepReady` is emitted with the same `stepRunId`, the task contract reference the step run keeps and the same hash, the run completes with exactly one step run per step and iteration and no step output is duplicated (XL-06, FR-10, docs/planes/agent-runtime/services/workflow-engine-service/index.md).",
        "AC3: Given a run whose announced steps the fake Run Control keeps without an attempt for longer than the step timeout of the definition, as Run Control does for a run that is Held while its environment is frozen or WaitingForApproval for a step approval or a spend approval, when the engine, its timers and its reconciler run, then every ready step was announced once through `WorkflowEngineService/StepReady` by the Advance, a re-emission carries the same `stepRunId` and leaves one step in the fake, no step run is Failed, neither `WorkflowEngineService/WorkflowRunFailed` nor another terminal event is written, and once the fake records the outcomes the run continues to its single terminal event (model/services/control-plane/RunControlService.yaml, ADR-0014).",
        "AC4: Given the seeded Draft release of the chain definition `generate-product` with the bounded loop of generate-product/check-build, the fan-out generate-product/fan-out-fill with its join generate-product/join-fill and the human step generate-product/approve-proposal, when the fake Run Control records and settles Succeeded outcomes, one build result that makes the condition false and an Approved `RunControlService/ApprovalDecided` for the human step, then the run returns once to the fan-out with the declared feedback, passes the join and the human step, and ends with exactly one terminal event, `WorkflowEngineService/WorkflowRunCompleted`, with one step run per step and iteration (ADR-0027, FR-03).",
        "AC5: Given any run driven by the engine in this suite, when the store of the engine and the fake Run Control are inspected, then the engine wrote only its projection in `workflow-engine-sql` and, in the artifact store, the run variables and the task contract of each announced agent or tool step, called no operation of Run Control other than `RunControlService/SubmitRun` for a readiness correlation, no run of the suite holding a step of kind SubWorkflow, the only step for which the engine calls `RunControlService/RunControl.SubmitChildRun`, every `WorkflowEngineService/StepReady` carries `actionClass`, `idempotent` and `failurePolicy` equal to the values the step declares in the pinned definition, the `StepReady` of an agent or tool step carries `taskContractRef` and `taskContractHash` of a contract the artifact store holds and the `StepReady` of a human step carries neither, the fake received one step per `stepRunId`, and exactly one of `WorkflowEngineService/WorkflowRunCompleted`, `WorkflowEngineService/WorkflowRunFailed` and `WorkflowEngineService/WorkflowRunCancelled` exists per workflow run; the copy of these values to the `RunControlService/Step` is proven by feature `run-control-service`, by AIFACTORY-US-163 for `sideEffectClass` and `idempotent`, and not here (ADR-0014, ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-198",
        "AIFACTORY-TASK-199",
        "AIFACTORY-TASK-660"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5801,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "RunControlService/Step"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "RunControlService/RunControl.SubmitChildRun"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "WorkflowEngineService/WorkflowRunCancelled",
          "RunControlService/RunAccepted",
          "RunControlService/AttemptOutcomeRecorded",
          "RunControlService/StepSettled",
          "RunControlService/ApprovalDecided"
        ],
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/fan-out-fill",
          "generate-product/join-fill",
          "generate-product/check-build",
          "generate-product/approve-proposal"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-03",
          "FR-10",
          "XL-06"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05",
          "NFR-06"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-496",
        "AIFACTORY-US-497",
        "AIFACTORY-US-498",
        "AIFACTORY-US-499",
        "AIFACTORY-US-500",
        "AIFACTORY-US-501",
        "AIFACTORY-US-502",
        "AIFACTORY-US-503",
        "AIFACTORY-US-504",
        "AIFACTORY-US-505",
        "AIFACTORY-US-009",
        "AIFACTORY-US-646",
        "AIFACTORY-US-647",
        "AIFACTORY-US-746",
        "AIFACTORY-US-1496",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-006]",
      "number": 6
    },
    {
      "id": "AIFACTORY-TASK-198",
      "type": "task",
      "parent": "AIFACTORY-US-006",
      "title": "Run Control side of the engine contract: consumer contract test of StepReady and of the terminal reports",
      "sequence": "02.02.01.01",
      "description": "Run Control side of the engine contract: consumer contract test of StepReady and of the terminal reports. Expected output: A consumer contract test in the RunControlService repository pins the event types StepReady, WorkflowRunCompleted and WorkflowRunFailed of the contracts package as the engine publishes them (stepRunId, stepId, kind, actionClass, idempotent, inputRef, failurePolicy and the optional taskContractRef and taskContractHash, present for an agent or tool step and absent for a Human step; outputRef; failedStepId, failureClass and compensated), so a change of a payload fails the build of the consumer; it serves AC5 of AIFACTORY-US-006, the payload from which Run Control copies actionClass, idempotent, stepRunId and failurePolicy to its Step, keeps the reference and the hash of the task contract on the step and copies them to each attempt of it, and it pins WorkflowRunFailed as the report that alone fails a run after a failed step; Run Control stays the single writer of steps, attempts, leases and outcomes, whose behaviour is delivered by AIFACTORY-US-163, AIFACTORY-US-164 and AIFACTORY-US-167 of feature run-control-service and is not built here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "A consumer contract test in the RunControlService repository pins the event types StepReady, WorkflowRunCompleted and WorkflowRunFailed of the contracts package as the engine publishes them (stepRunId, stepId, kind, actionClass, idempotent, inputRef, failurePolicy and the optional taskContractRef and taskContractHash, present for an agent or tool step and absent for a Human step; outputRef; failedStepId, failureClass and compensated), so a change of a payload fails the build of the consumer; it serves AC5 of AIFACTORY-US-006, the payload from which Run Control copies actionClass, idempotent, stepRunId and failurePolicy to its Step, keeps the reference and the hash of the task contract on the step and copies them to each attempt of it, and it pins WorkflowRunFailed as the report that alone fails a run after a failed step; Run Control stays the single writer of steps, attempts, leases and outcomes, whose behaviour is delivered by AIFACTORY-US-163, AIFACTORY-US-164 and AIFACTORY-US-167 of feature run-control-service and is not built here."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5801,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-198]",
      "number": 198
    },
    {
      "id": "AIFACTORY-TASK-199",
      "type": "task",
      "parent": "AIFACTORY-US-006",
      "title": "Restart test of a workflow run between an applied outcome and its StepReady",
      "sequence": "02.02.01.02",
      "description": "Restart test of a workflow run between an applied outcome and its StepReady. Expected output: An acceptance test kills the engine process between applying a StepSettled and emitting the StepReady it causes, starts it again and proves AC2 of AIFACTORY-US-006: the settlement is re-applied idempotently on its event id and a redelivered outcome on the outcome sequence, StepReady is emitted with the same stepRunId, the task contract reference the step run keeps and the same hash, the fake Run Control creates no second step, and the run completes with one step run and one output per step and iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "An acceptance test kills the engine process between applying a StepSettled and emitting the StepReady it causes, starts it again and proves AC2 of AIFACTORY-US-006: the settlement is re-applied idempotently on its event id and a redelivered outcome on the outcome sequence, StepReady is emitted with the same stepRunId, the task contract reference the step run keeps and the same hash, the fake Run Control creates no second step, and the run completes with one step run and one output per step and iteration."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-199]",
      "number": 199
    },
    {
      "id": "AIFACTORY-TASK-660",
      "type": "task",
      "parent": "AIFACTORY-US-006",
      "title": "Verify durable-steps by running the declared command",
      "sequence": "02.02.01.03",
      "description": "Verify durable-steps by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=durable-steps\"`; a zero-match filter counts as a failure; the tests prove AC1, AC3, AC4 and AC5 of AIFACTORY-US-006 against the fake Run Control of AIFACTORY-TASK-2002, and AIFACTORY-TASK-199 proves AC2: one run of a seeded chain definition to its single terminal report, a run the fake keeps without attempts beyond the step timeout in which nothing fails and no terminal event is written, one run of generate-product through its loop, its fan-out and its human step, and the inspection of the engine store and of what the fake received; the behaviour of each handler is proven by the suites of AIFACTORY-US-498 to AIFACTORY-US-505, AIFACTORY-US-646, AIFACTORY-US-647, AIFACTORY-US-746 and AIFACTORY-US-009, and the hosted surface and the messaging registration by AIFACTORY-US-496 and AIFACTORY-US-497.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=durable-steps\"`; a zero-match filter counts as a failure; the tests prove AC1, AC3, AC4 and AC5 of AIFACTORY-US-006 against the fake Run Control of AIFACTORY-TASK-2002, and AIFACTORY-TASK-199 proves AC2: one run of a seeded chain definition to its single terminal report, a run the fake keeps without attempts beyond the step timeout in which nothing fails and no terminal event is written, one run of generate-product through its loop, its fan-out and its human step, and the inspection of the engine store and of what the fake received; the behaviour of each handler is proven by the suites of AIFACTORY-US-498 to AIFACTORY-US-505, AIFACTORY-US-646, AIFACTORY-US-647, AIFACTORY-US-746 and AIFACTORY-US-009, and the hosted surface and the messaging registration by AIFACTORY-US-496 and AIFACTORY-US-497."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-660]",
      "number": 660
    },
    {
      "id": "AIFACTORY-US-496",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "WorkflowEngineService host: scaffolded from the pinned agent host template as the workflow-engine silo kind, with its REST and gRPC surface hosted under the Factory scope chain",
      "sequence": "02.02.02",
      "description": "As an operator, I want the engine repository generated from the published agent template package as the workflow-engine host kind, not assembled by hand, so that scope, tenancy, messaging and telemetry behave in the engine as in every other Factory service and a template fix reaches it by a new pin. The model binds WorkflowEngineService to the agent host template `connectsoft-ai-agent` (model/services/agent-mesh/WorkflowEngineService.yaml, ADR-0028 amendment on the Factory templates), and feature `component-agent-template` gave that template the choice `agent-host-kind` with the value `workflow-engine`: a host that carries the silo-kind configuration of the one Orleans cluster of the Agent Mesh (ADR-0024, ADR-0028 decision 4), defaults to the Orleans messaging profile and has no agent execution path, exemplar or execution port of its own. The repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService is created and scaffolded in I0 by AIFACTORY-TASK-037 of feature repository-and-pipeline-conventions (D140), and this PBI starts from that scaffold; the repository checklist of that feature has a row for this service that states the command `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.WorkflowEngineService --agent-host-kind workflow-engine`, run from the package that feature `component-agent-template-release` publishes and pinned by version. The command carries the host kind and no Factory profile switch of its own. The agent template composes on the base template through its submodule, so the Factory service profile of the base template and its closed findings (features `component-base-template-factory-profile` and `component-base-template-findings`) arrive with the pinned agent template package, as they do for AgentRuntimeService (AIFACTORY-US-460): the Orleans outbox and inbox with the run event envelope, the tenant taken from the token and the project admitted only when the token grants it, token validation with the seven Factory roles mapped to endpoint policies, the REST and gRPC surface described by a service descriptor, health, readiness and telemetry. Nothing of that is forked or written again in the service; a defect found in it is fixed in the template and consumed by a new pin, and the repository records the template version it was generated from. On the scaffold this PBI hosts the surface of the model without its behaviour: the three REST routes with their scopes (`factory.assets.write` for validation, `factory.assets.read` for the version list, `factory.runs.read` for the run graph), problem responses for every modelled refusal code, the two internal gRPC methods of the service `WorkflowEngine` with the workload identity check, and the OpenAPI and proto documents. A caller without a valid token is answered 401, a caller without the scope 403, and a resource of another tenant 404, over gRPC NOT_FOUND, exactly as an identifier that does not exist (ADR-0015); a missing scope inside the tenant stays 403. Every query runs under the tenant row filter. The secret `messaging-transport` is read from the key vault by reference, and the eight metrics of the model are registered under the observability conventions. The route through the Agent Mesh gateway belongs to feature `agent-runtime-worker` of a later increment; until then the surface is reached on the service itself. Kind: enabling. Traces: services: WorkflowEngineService; apis: WorkflowEngineService/ValidateWorkflowDefinition, WorkflowEngineService/ListWorkflowDefinitionVersions, WorkflowEngineService/GetWorkflowRunGraph, WorkflowEngineService/WorkflowEngine.PlanNextSteps, WorkflowEngineService/WorkflowEngine.GetRunGraph; adrs: ADR-0015, ADR-0024, ADR-0028. Depends on: feature:repository-and-pipeline-conventions, feature:component-agent-template, feature:component-agent-template-factory-access, feature:component-agent-template-release, feature:component-base-template-factory-profile, feature:component-base-template-findings. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/agent-runtime/services/workflow-engine-service/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-037 of feature repository-and-pipeline-conventions, whose first commit is the output of `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.WorkflowEngineService --agent-host-kind workflow-engine` from the agent host template package published by feature `component-agent-template-release` and pinned by version, when the repository pipeline runs, then the solution builds, the template tests pass with complete reports, a container image is published, the repository records the template version, and the generated settings carry the silo kind of the workflow engine in the Agent Mesh cluster and the messaging service name `workflow-engine` (ADR-0028, ADR-0024, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC2: Given the hosted surface, when the contract test compares it with the service descriptor and the model, then exactly `WorkflowEngineService/ValidateWorkflowDefinition` with `factory.assets.write`, `WorkflowEngineService/ListWorkflowDefinitionVersions` with `factory.assets.read`, `WorkflowEngineService/GetWorkflowRunGraph` with `factory.runs.read`, `WorkflowEngineService/WorkflowEngine.PlanNextSteps` and `WorkflowEngineService/WorkflowEngine.GetRunGraph` are hosted with their side-effect class and response codes, and the test fails when an operation outside model/services/agent-mesh/WorkflowEngineService.yaml appears.",
        "AC3: Given a REST call without a valid token, with a token that lacks the scope of the route, or that addresses a run or a definition of another tenant, when it reaches the host, then it is answered 401, 403 or 404 respectively with a problem response, the 404 being the same answer as for an identifier that does not exist; given a call to `WorkflowEngineService/WorkflowEngine.GetRunGraph` without a workload identity or with a token that lacks the service scope, then it is refused with UNAUTHENTICATED or PERMISSION_DENIED before any handler runs and nothing is read (ADR-0015).",
        "AC4: Given the service starts, when liveness and readiness are probed, then liveness answers and readiness is unready until `workflow-engine-sql` is migrated; the secret `messaging-transport` is resolved by reference and never from a settings file, and the eight metrics of model/services/agent-mesh/WorkflowEngineService.yaml are registered with their modelled instruments and dimensions."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-040",
        "AIFACTORY-TASK-043",
        "AIFACTORY-TASK-1991"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5802,
      "kind": "enabling",
      "traces": {
        "services": [
          "WorkflowEngineService"
        ],
        "apis": [
          "WorkflowEngineService/ValidateWorkflowDefinition",
          "WorkflowEngineService/ListWorkflowDefinitionVersions",
          "WorkflowEngineService/GetWorkflowRunGraph",
          "WorkflowEngineService/WorkflowEngine.PlanNextSteps",
          "WorkflowEngineService/WorkflowEngine.GetRunGraph"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-agent-template",
        "feature:component-agent-template-factory-access",
        "feature:component-agent-template-release",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-496]",
      "number": 496
    },
    {
      "id": "AIFACTORY-TASK-040",
      "type": "task",
      "parent": "AIFACTORY-US-496",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 3 REST and 2 gRPC operations",
      "sequence": "02.02.02.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 3 REST and 2 gRPC operations. Expected output: The three REST routes (ValidateWorkflowDefinition, GetWorkflowRunGraph, ListWorkflowDefinitionVersions) and the two gRPC methods (WorkflowEngine.PlanNextSteps, WorkflowEngine.GetRunGraph) are hosted with token validation, scope enforcement per route, problem responses for every modelled refusal code, the workload identity and service scope checks on the gRPC methods, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-498, AIFACTORY-US-499 and AIFACTORY-US-504, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three REST routes (ValidateWorkflowDefinition, GetWorkflowRunGraph, ListWorkflowDefinitionVersions) and the two gRPC methods (WorkflowEngine.PlanNextSteps, WorkflowEngine.GetRunGraph) are hosted with token validation, scope enforcement per route, problem responses for every modelled refusal code, the workload identity and service scope checks on the gRPC methods, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-498, AIFACTORY-US-499 and AIFACTORY-US-504, not here."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-040]",
      "number": 40
    },
    {
      "id": "AIFACTORY-TASK-043",
      "type": "task",
      "parent": "AIFACTORY-US-496",
      "title": "Security, tenancy and telemetry of WorkflowEngineService",
      "sequence": "02.02.02.02",
      "description": "Security, tenancy and telemetry of WorkflowEngineService. Expected output: The scopes factory.runs.read, factory.assets.read and factory.assets.write and the roles of the model are enforced through the endpoint policies of the profile, every query is tenant-filtered, the secret messaging-transport comes from the key vault by reference, traces and health checks follow the observability conventions, and the eight metrics of model/services/agent-mesh/WorkflowEngineService.yaml are registered with their dimensions, among them the gauge connectsoft.factory.workflows.inbox_lag, the age in seconds of the oldest unprocessed inbox message of the service, measured by the inbox of the messaging profile (D140); each other metric moves in the behaviour PBI that owns it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The scopes factory.runs.read, factory.assets.read and factory.assets.write and the roles of the model are enforced through the endpoint policies of the profile, every query is tenant-filtered, the secret messaging-transport comes from the key vault by reference, traces and health checks follow the observability conventions, and the eight metrics of model/services/agent-mesh/WorkflowEngineService.yaml are registered with their dimensions, among them the gauge connectsoft.factory.workflows.inbox_lag, the age in seconds of the oldest unprocessed inbox message of the service, measured by the inbox of the messaging profile (D140); each other metric moves in the behaviour PBI that owns it."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-043]",
      "number": 43
    },
    {
      "id": "AIFACTORY-TASK-1991",
      "type": "task",
      "parent": "AIFACTORY-US-496",
      "title": "Verify the scaffolded host and its hosted surface",
      "sequence": "02.02.02.03",
      "description": "Verify the scaffolded host and its hosted surface. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build --filter \"Category=Contract|Category=HostSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-496: the surface equals model/services/agent-mesh/WorkflowEngineService.yaml, the 401, 403 and 404 answers and the gRPC refusals hold before any handler runs, readiness follows the store and the eight metrics are registered.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build --filter \"Category=Contract|Category=HostSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-496: the surface equals model/services/agent-mesh/WorkflowEngineService.yaml, the 401, 403 and 404 answers and the gRPC refusals hold before any handler runs, readiness follows the store and the eight metrics are registered."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1991]",
      "number": 1991
    },
    {
      "id": "AIFACTORY-US-497",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "WorkflowEngineService skeleton: the three aggregates, the nine tables of `workflow-engine-sql`, the outbox and inbox of the `workflow-engine` profile and the hosting of five workers and two grains",
      "sequence": "02.02.03",
      "description": "This PBI lays what every behaviour of the engine stands on and adds no behaviour of its own. The domain model holds the three aggregates of model/services/agent-mesh/WorkflowEngineService.yaml with their invariants: `WorkflowDefinitionVersion` with its step and edge definitions, immutable once loaded; `WorkflowRun` with its step runs, timer entries and compensation entries and the seventeen transitions of `WorkflowRunState` (Pending to Running on `RunAccepted`, Running to WaitingForTimer and back, Running to WaitingForHuman and back, Running to Compensating both for a step that failed under the policy Compensate and for the choice compensate of an operator decision, Compensating to Failed, Running to Completed, Running to Failed both for a step that failed under the policy Fail and, through `StepFailedWithRetryPolicyAttemptsSpent`, for a step settled Failed under the policy Retry with its attempts spent (decision D123), Running, WaitingForTimer and WaitingForHuman to Cancelled on `RunCancelled`, and the same three states to Failed on `RunFailed`); a step run keeps in `childRunId` the child run of a step of kind SubWorkflow, in `attemptCount` and `failureClass` the number of attempts and the failure class that `StepSettled` carries for it (decision D121) and in `taskContractRef` the reference of the task contract the engine stored for the step, empty for a step without one, such as a human step (decision D123); and `ReadinessCorrelation` with its members and the five transitions of `ReadinessState` (Open to Satisfied, Satisfied to Submitted, Open and Satisfied to Superseded, Open to Expired). A transition the model does not list is refused by the aggregate. The store `workflow-engine-sql` gets the nine tables of the model with a tenant column on every row, the tenant row filter of the profile and the modelled indexes, among them the unique `UX_ReadinessCorrelations_Key` on tenant and idempotency key, the unique `UX_StepRuns_Run_Step_Iteration` and `IX_Timers_Due`. The messaging skeleton wires the Orleans outbox and inbox of the messaging profile whose service name is `workflow-engine`, which belong to this service alone (ADR-0028): the outbox writer enlists in the transaction of the command, the dispatcher publishes the twelve events of the model under the run event envelope of the pinned contracts package, and the event types and topic constants are taken from that package and declared nowhere in the service. The model lists twenty-four consume rows over twenty-one event types, of which `ApprovalDecided`, `RunFailed` and `RunCancelled` are each handled by two handlers. The inbox of this feature registers twenty-three of them, idempotently on the event id, among them the rows by which the engine follows Run Control: `StepSettled` for the final state of a step, `RunFailed` and `RunCancelled` to close the projection, and `RunCompleted`, `RunFailed` and `RunCancelled` to return the result of a child run. The engine pins the contracts package at a version generated from the model that carries `StepSettled` with its `stepId` and `outputRef`, `failurePolicy` and the optional `taskContractRef` and `taskContractHash` of `StepReady`, `choice` and `stepRunId` of `ApprovalDecided` and the optional `outputRef` of `RunCompleted` (decisions D119, D121 and D123). The twenty-fourth row is not registered: the handler `ExecuteDeletionOrder` of `DeletionOrderIssued` is built and proven in I4 together with RetentionResidencyService, and this feature registers no handler for deletion orders. Some producers arrive later than this service: AgentRegistryService publishes `AssetReleasePublished` only with its complete delivery, and ReleaseService is delivered in a later increment. Their handlers are registered now and exercised on fixture events built from the contracts package. The five workers of the model (`ReadinessCorrelator`, `ReadinessExpiryReconciler`, `TimerScheduler`, `StuckRunReconciler`, `DefinitionCacheWarmer`) run inside the deployable of the service (ADR-0028) and are not written as five private loops. The host registers the worker engine `ConnectSoft.Workers.Runtime` at the version feature `component-workers-runtime-library` published, the way AgentRuntimeService hosts its jobs (AIFACTORY-US-462), with drain wired to the stop of the host, the idempotency and failed-work stores on `workflow-engine-sql` and the singleton lease, so that two replicas never run the same job instance. The tables of the engine are created by a migration of this repository from the schema script of the engine in its scoped shape, in which a processed-message row and a failed-work row carry tenant and project, with the run where the work has one, as the Factory profile of the worker template defines it (feature `component-worker-template-factory-profile`); they stand beside the nine tables of the model. Each worker is registered with the trigger, the retry policy, the idempotency key and the partitioning the model states. `ReadinessCorrelator` runs on the signal events of its modelled trigger with five exponential attempts from 30 seconds, the key `correlationId` plus slot plus `refHash` for members and the idempotency key of the correlation for the submission, and two parallel runs partitioned by project. `ReadinessExpiryReconciler` runs every six hours with three exponential attempts from 60 seconds, the key `correlationId` plus version and one run at a time. `TimerScheduler` runs on the reminder of a timer entry with five exponential attempts from 10 seconds, the key `timerId` and one run at a time per run. `StuckRunReconciler` runs every five minutes with three fixed attempts 60 seconds apart, the key `stepRunId` plus `lastOutcomeSequence` and two parallel runs partitioned by tenant. `DefinitionCacheWarmer` runs on `AssetReleasePublished` with five exponential attempts from 30 seconds, the key `releaseId` and two parallel runs partitioned by tenant. A trigger repeated under the same key has no second effect, and work that exhausts its modelled retries leaves one open failed-work record with its scope and no partial write. Run state never moves into the worker engine: it lives in the two grains (`WorkflowRunGrain` keyed by run id, `ReadinessCorrelationGrain` keyed by tenant, project, operation, workflow release and bundle fingerprint, both not reentrant), and their reminders, `timer` and `stuck-detection` of the first and `expiry` of the second, are grain reminders (ADR-0024) and no periodic jobs of the worker engine; the reminder of a timer entry hands the fired timer to `TimerScheduler`. The eight options of the model are bound with their defaults. The model lists no operation of WorkflowEngineService that serves the job catalog or the failed work, so this delivery exposes none; which surface an operator uses to list and replay the failed work of this service is reported to the owner. What each handler, worker and grain does is delivered by AIFACTORY-US-498 to AIFACTORY-US-505, AIFACTORY-US-646, AIFACTORY-US-647, AIFACTORY-US-746 and AIFACTORY-US-009. Kind: enabling. Traces: services: WorkflowEngineService; aggregates: WorkflowEngineService/WorkflowRun, WorkflowEngineService/ReadinessCorrelation, WorkflowEngineService/WorkflowDefinitionVersion; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024, ADR-0028. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-496, feature:contracts-package, feature:component-workers-runtime-library, feature:component-worker-template-factory-profile. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, docs/planes/agent-runtime/services/workflow-engine-service/ddl.md, docs/planes/agent-runtime/services/workflow-engine-service/index.md#domain-model, docs/planes/agent-runtime/services/workflow-engine-service/index.md#workers-and-jobs, docs/planes/agent-runtime/workers.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md.",
      "acceptanceCriteria": [
        "AC1: Given the aggregates `WorkflowEngineService/WorkflowRun`, `WorkflowEngineService/ReadinessCorrelation` and `WorkflowEngineService/WorkflowDefinitionVersion`, when the unit suite runs, then every one of the seventeen transitions of `WorkflowRunState` and the five of `ReadinessState` listed in model/services/agent-mesh/WorkflowEngineService.yaml is accepted, every pair of states the model does not list is refused, a loaded definition version cannot be changed and each modelled invariant has a test.",
        "AC2: Given an empty isolated test database, when the migrations of `workflow-engine-sql` run, then the nine tables of the model exist with their tenant column, keys and indexes as docs/planes/agent-runtime/services/workflow-engine-service/ddl.md lists them, the mapping tests round-trip every aggregate under the tenant row filter, a row of another tenant is never read (ADR-0015), and no shared database is used.",
        "AC3: Given a command that changes an aggregate of WorkflowEngineService, when it commits, then the state change and its outbox record are written in one transaction and a command that rolls back leaves neither; when the dispatcher of the `workflow-engine` profile publishes the record, then it is sent under `run-event-envelope-v1` with the event type and the topic constant of the pinned contracts package, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (ADR-0012, ADR-0014).",
        "AC4: Given each of the twenty-three consume rows of model/services/agent-mesh/WorkflowEngineService.yaml that this feature registers, every row but `DeletionOrderIssued`, when the same event id is delivered twice, then each handler of the event runs once; the handlers of events whose producers arrive in later increments are registered and proven on fixture events of the pinned contracts package, without a dependency on those producers; and no handler is registered for `DeletionOrderIssued`, whose handler is built and proven in I4 with RetentionResidencyService.",
        "AC5: Given the five workers and the two grains of model/services/agent-mesh/WorkflowEngineService.yaml and the worker engine registered in the host, when the host starts on an isolated database, then the tables of the worker engine exist in `workflow-engine-sql` in the scoped shape, each worker is in the catalog with its modelled trigger, retry policy, partition key and idempotency key, a duplicate trigger has no second effect, work that exhausts its modelled retries leaves one open failed-work record that carries its tenant and project and no partial write, both grains are not reentrant and register their reminders, and the eight options are bound with their modelled defaults (ADR-0024, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/ddl.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#domain-model",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#workers-and-jobs",
        "docs/planes/agent-runtime/workers.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-038",
        "AIFACTORY-TASK-039",
        "AIFACTORY-TASK-041",
        "AIFACTORY-TASK-042",
        "AIFACTORY-TASK-1992"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5803,
      "kind": "enabling",
      "traces": {
        "services": [
          "WorkflowEngineService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "WorkflowEngineService/ReadinessCorrelation",
          "WorkflowEngineService/WorkflowDefinitionVersion"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-496",
        "feature:contracts-package",
        "feature:component-workers-runtime-library",
        "feature:component-worker-template-factory-profile"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/ddl.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#domain-model",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#workers-and-jobs",
        "docs/planes/agent-runtime/workers.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md"
      ],
      "titlePrefix": "[AIFACTORY-US-497]",
      "number": 497
    },
    {
      "id": "AIFACTORY-TASK-038",
      "type": "task",
      "parent": "AIFACTORY-US-497",
      "title": "Domain model: ReadinessCorrelation, WorkflowDefinitionVersion, WorkflowRun",
      "sequence": "02.02.03.01",
      "description": "Domain model: ReadinessCorrelation, WorkflowDefinitionVersion, WorkflowRun. Expected output: The three aggregates with their entities, invariants and state transitions as modelled; unit tests cover every invariant, each of the seventeen transitions of WorkflowRunState and the five of ReadinessState, and the refusal of every transition the model does not list.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three aggregates with their entities, invariants and state transitions as modelled; unit tests cover every invariant, each of the seventeen transitions of WorkflowRunState and the five of ReadinessState, and the refusal of every transition the model does not list."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-038]",
      "number": 38
    },
    {
      "id": "AIFACTORY-TASK-039",
      "type": "task",
      "parent": "AIFACTORY-US-497",
      "title": "Persistence in workflow-engine-sql: ReadinessCorrelations, ReadinessMembers, WorkflowDefinitions, StepDefinitions, EdgeDefinitions, WorkflowRuns, StepRuns, Timers and CompensationEntries",
      "sequence": "02.02.03.02",
      "description": "Persistence in workflow-engine-sql: ReadinessCorrelations, ReadinessMembers, WorkflowDefinitions, StepDefinitions, EdgeDefinitions, WorkflowRuns, StepRuns, Timers and CompensationEntries. Expected output: Mappings and migrations for the nine modelled tables with tenant filters and the modelled indexes, the unique UX_ReadinessCorrelations_Key and UX_StepRuns_Run_Step_Iteration among them, and with the nullable ChildRunId, the AttemptCount with the default 0, the nullable FailureClass, the nullable TaskContractRef, TaskContractHash and FailureReason of StepRuns (D125), and the nullable PolicyGuardJson and WaitsOn of StepDefinitions (D133); mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the nine modelled tables with tenant filters and the modelled indexes, the unique UX_ReadinessCorrelations_Key and UX_StepRuns_Run_Step_Iteration among them, and with the nullable ChildRunId, the AttemptCount with the default 0, the nullable FailureClass, the nullable TaskContractRef, TaskContractHash and FailureReason of StepRuns (D125), and the nullable PolicyGuardJson and WaitsOn of StepDefinitions (D133); mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5803,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-039]",
      "number": 39
    },
    {
      "id": "AIFACTORY-TASK-041",
      "type": "task",
      "parent": "AIFACTORY-US-497",
      "title": "Messaging skeleton: outbox and inbox wiring of the workflow-engine profile for 12 published events and 23 of the 24 consume rows",
      "sequence": "02.02.03.03",
      "description": "Messaging skeleton: outbox and inbox wiring of the workflow-engine profile for 12 published events and 23 of the 24 consume rows. Expected output: The outbox writer enlists in the transaction of the command and the dispatcher of the workflow-engine messaging profile publishes the 12 modelled events (WorkflowDefinitionLoaded, WorkflowRunStarted, StepReady, StepRunStateChanged, TimerFired, CompensationStarted, WorkflowRunCompleted, WorkflowRunFailed, WorkflowRunCancelled, ReadinessSatisfied, ReadinessRunSubmitted, ReadinessSuperseded) under the run event envelope with the event types and topic constants of the pinned contracts package; the inbox registers 23 of the 24 consume rows of the model with idempotency on the event id, the rows StepSettled, RunFailed, RunCompleted and the second handler of RunCancelled among them, at a contracts package version that carries StepSettled with stepId and outputRef, failurePolicy and the optional taskContractRef and taskContractHash of StepReady, choice and stepRunId of ApprovalDecided and outputRef of RunCompleted; no handler is registered for DeletionOrderIssued, whose handler ExecuteDeletionOrder is built and proven in I4 with RetentionResidencyService; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of the command and the dispatcher of the workflow-engine messaging profile publishes the 12 modelled events (WorkflowDefinitionLoaded, WorkflowRunStarted, StepReady, StepRunStateChanged, TimerFired, CompensationStarted, WorkflowRunCompleted, WorkflowRunFailed, WorkflowRunCancelled, ReadinessSatisfied, ReadinessRunSubmitted, ReadinessSuperseded) under the run event envelope with the event types and topic constants of the pinned contracts package; the inbox registers 23 of the 24 consume rows of the model with idempotency on the event id, the rows StepSettled, RunFailed, RunCompleted and the second handler of RunCancelled among them, at a contracts package version that carries StepSettled with stepId and outputRef, failurePolicy and the optional taskContractRef and taskContractHash of StepReady, choice and stepRunId of ApprovalDecided and outputRef of RunCompleted; no handler is registered for DeletionOrderIssued, whose handler ExecuteDeletionOrder is built and proven in I4 with RetentionResidencyService; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-041]",
      "number": 41
    },
    {
      "id": "AIFACTORY-TASK-042",
      "type": "task",
      "parent": "AIFACTORY-US-497",
      "title": "Worker and grain hosting skeleton: the five workers of the model on the Workers.Runtime engine, WorkflowRunGrain and ReadinessCorrelationGrain",
      "sequence": "02.02.03.04",
      "description": "Worker and grain hosting skeleton: the five workers of the model on the Workers.Runtime engine, WorkflowRunGrain and ReadinessCorrelationGrain. Expected output: The host registers the worker engine ConnectSoft.Workers.Runtime at the pinned version with drain, the singleton lease and the idempotency and failed-work stores on workflow-engine-sql, whose engine tables a migration creates in the scoped shape with tenant and project; the five workers are in its catalog with their modelled triggers, retry policies, partitioning and idempotency keys, a duplicate trigger has no second effect, and work that exhausts its retries leaves one open failed-work record with its scope and no partial write; the two grains are hosted with their keys, their reminders as grain reminders and reentrancy off; the eight options of the model are bound with their defaults; what each worker and grain does is delivered by AIFACTORY-US-498, AIFACTORY-US-500, AIFACTORY-US-502, AIFACTORY-US-505 and AIFACTORY-US-009.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The host registers the worker engine ConnectSoft.Workers.Runtime at the pinned version with drain, the singleton lease and the idempotency and failed-work stores on workflow-engine-sql, whose engine tables a migration creates in the scoped shape with tenant and project; the five workers are in its catalog with their modelled triggers, retry policies, partitioning and idempotency keys, a duplicate trigger has no second effect, and work that exhausts its retries leaves one open failed-work record with its scope and no partial write; the two grains are hosted with their keys, their reminders as grain reminders and reentrancy off; the eight options of the model are bound with their defaults; what each worker and grain does is delivered by AIFACTORY-US-498, AIFACTORY-US-500, AIFACTORY-US-502, AIFACTORY-US-505 and AIFACTORY-US-009."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-042]",
      "number": 42
    },
    {
      "id": "AIFACTORY-TASK-1992",
      "type": "task",
      "parent": "AIFACTORY-US-497",
      "title": "Verify the domain, store, messaging and worker skeleton",
      "sequence": "02.02.03.05",
      "description": "Verify the domain, store, messaging and worker skeleton. Expected output: Run `dotnet test -c Release --filter \"Category=Unit|Category=Mapping|Category=Messaging|Category=Workers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-497 against model/services/agent-mesh/WorkflowEngineService.yaml: every transition and its refusal, the nine tables under the tenant filter on an isolated database, the outbox record in the transaction of its command, the inbox idempotent on the event id for the twenty-three registered rows and without a handler for DeletionOrderIssued, each worker in the catalog of the worker engine with its trigger and idempotency key, and the case of a worker whose retries are exhausted, which leaves one failed-work record with tenant and project and no partial write.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Unit|Category=Mapping|Category=Messaging|Category=Workers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-497 against model/services/agent-mesh/WorkflowEngineService.yaml: every transition and its refusal, the nine tables under the tenant filter on an isolated database, the outbox record in the transaction of its command, the inbox idempotent on the event id for the twenty-three registered rows and without a handler for DeletionOrderIssued, each worker in the catalog of the worker engine with its trigger and idempotency key, and the case of a worker whose retries are exhausted, which leaves one failed-work record with tenant and project and no partial write."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1992]",
      "number": 1992
    },
    {
      "id": "AIFACTORY-US-498",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Validate a workflow definition, refuse one without declared failure policies, and load a release by alias into the engine",
      "sequence": "02.02.04",
      "description": "As an asset maintainer, I want a workflow definition checked by the engine that will execute it, before any run can pin it, so that no run starts on a graph the engine cannot drive or on a step whose failure handling nobody declared. A caller whose scope carries `factory.assets.write` posts a workflow definition to `WorkflowEngineService/ValidateWorkflowDefinition` (POST `/runtime/workflow-definitions/validate`, class sandbox). The request schema the model names is `asset-manifests-v1`: the body is the `WorkflowDefinition` of docs/reference/schemas/asset-manifests.schema.json, the wire shape that the descriptor `workflow-definition-v1` stands for and that the contracts package carries. A step of it has the fields `id`, `kind`, `agent`, `skill`, `tool`, `gate`, `sideEffectClass`, `dependsOn`, `retry`, `compensation`, `timeout`, `when` and `onFalse` with `to`, `maxIterations` and `feedback`. The engine checks the document and writes nothing. The graph of `dependsOn` must be acyclic except for loops declared with a bounded iteration count, an `onFalse` branch bounded by its `maxIterations`, or by `Workflows:Engine:DefaultMaxLoopIterations` when the definition declares none. Every agent, tool and human step must declare its action class in `sideEffectClass` and its failure policy in `failurePolicy`, one of Retry, Compensate, Escalate and Fail, and the engine refuses a definition without it. Retry is accepted only on a step whose `sideEffectClass` is read or sandbox, or shared-write when the step declares `idempotencyKey`. A human step is an approval gate and declares its `approval` binding, a condition reads only recorded step outputs and run variables, the schema references of inputs and outputs resolve, and a fan-out stays within `Workflows:Engine:MaxFanout`. A step of kind `sub-workflow` is executed as a child run and must name its child workflow; that rule and the wire property `workflow` it reads are added to this validator with the execution of the kind (AIFACTORY-US-647). The rule on failure policies is a decision of the owner, and its source is the model file schema model/schemas/workflow.schema.json, in which the fields are `failure_policy`, `idempotency_key` and `approval` and which the definitions under model/workflows follow. The published wire schema does not carry them yet: a step of `WorkflowDefinition` declares neither a failure policy nor an idempotency key nor the approval binding nor the expression of a condition, and the activation block knows no member of kind signal. The contract task of this PBI adds them to docs/reference/schemas/asset-manifests.schema.json in the camel case of the wire (`failurePolicy`, `idempotencyKey`, `approval` and `condition` on a step; the member kind signal with `ref`, `versionRef` and `hashRef` in the activation block), the contracts package regenerates its types from the published schema (feature `contracts-package`), and the service takes them by a new pin. The validator reads the wire fields and nothing else; the model file schema stays the source of the rule and of the fixtures. A valid document is answered 200; a body that is not a `WorkflowDefinition` of that schema or that fails one of these rules is answered 400 with a problem response that names each finding by step and rule; a caller without the scope is answered 403. The engine copies the declared failure policy as it stands and derives none. The same validation runs when a release is loaded. The command `LoadWorkflowDefinition` streams the release by its id through `AgentRegistryService/AssetPublication.LoadRelease`, fetches the definition content its manifest `release-manifest-v1` references through `ArtifactService/Artifacts.Fetch`, validates the graph, has every declared action class decided through `PolicyEngineService/Policy.Decide`, and writes the `WorkflowDefinitionVersion` with its `StepDefinition` and `EdgeDefinition` rows, `graphHash`, `stepCount`, schema references and `maxLoopIterations` together with the `WorkflowEngineService/WorkflowDefinitionLoaded` outbox record in one transaction. An action class that policy denies, a decision with the effect Deny or Prohibited, rejects the release like a validation failure. The model says that declared action classes are validated against policy at load and names no method; `Policy.Decide` is the one of the three gRPC methods of PolicyEngineService that evaluates an action, and that reading is reported to the owner. Loading is idempotent on `releaseId`: a version is immutable once loaded, and a changed graph has a new release id. In this increment AgentRegistryService is delivered thin: it serves seeded Draft releases and publishes no event, so `AssetReleasePublished`, the trigger of the `DefinitionCacheWarmer`, does not arrive before feature `agent-registry-service-publication` in I2 (D140). Until then a release is loaded by alias and on first use: the warmer resolves the alias of a workflow definition to an immutable release id through `AgentRegistryService/AssetPublication.ResolveRelease` and loads it, and `StartWorkflowRun` loads the release a `RunAccepted` pins when it is not cached. The alias of a definition is the one its activation block declares in `submit.release_alias` (`submit.releaseAlias` on the wire, `latest` in the chain definitions that declare an activation block), and the option `Workflows:Readiness:StarterReleaseAlias` is the value used when the block declares none. Which definitions the warmer resolves at start, so that a readiness signal finds the activation block of a definition no run has pinned yet, is an input the model does not state while the registry publishes no event and offers no list operation, and before its first load the warmer holds no activation block to read an alias from; the acceptance suite proves the path on a fixture list of the six chain definitions with the option value, and the point is reported to the owner. The manifest of a seeded release states Draft and the engine applies no waiver of its own: whether a Draft release may run is decided by the policy rule of the ADR-0021 amendment where policy is evaluated for the submission. A release that fails validation, whose manifest hash cannot be verified, or one of whose action classes policy denies is not loaded: no `WorkflowDefinitionLoaded` is written, `connectsoft.factory.workflows.definition_rejections` is incremented with the reason, and a run that pins that release fails at acceptance with an explicit reason, as the failure modes of the model state (AIFACTORY-US-501). AgentRegistryService, PolicyEngineService and ArtifactService are fail-fast dependencies: when one is unavailable the load fails, nothing is written and the worker retries with its exponential policy of five attempts. A caller whose scope carries `factory.assets.read` lists the loaded versions of a definition through `WorkflowEngineService/ListWorkflowDefinitionVersions` with `version`, `releaseId`, `graphHash` and `loadedAt`; a definition with no loaded version the tenant of the caller can read is answered 404, the same answer as for a definition of another tenant (ADR-0015), and a missing scope 403. Kind: behavior. Traces: services: WorkflowEngineService, AgentRegistryService, PolicyEngineService, ArtifactService; aggregates: WorkflowEngineService/WorkflowDefinitionVersion; apis: WorkflowEngineService/ValidateWorkflowDefinition, WorkflowEngineService/ListWorkflowDefinitionVersions, AgentRegistryService/AssetPublication.ResolveRelease, AgentRegistryService/AssetPublication.LoadRelease, ArtifactService/Artifacts.Fetch, PolicyEngineService/Policy.Decide; events: WorkflowEngineService/WorkflowDefinitionLoaded; descriptors: workflow-definition-v1, release-manifest-v1; adrs: ADR-0012, ADR-0015, ADR-0021, ADR-0024; requirements: FR-02; scenarios: SCN-WorkflowEngineService-001, SCN-WorkflowEngineService-003, SCN-WorkflowEngineService-006. Relates: screens: workflow-definitions. Depends on: AIFACTORY-US-496, AIFACTORY-US-497, feature:agent-registry-service-thin, feature:policy-engine-service, feature:artifact-service, feature:contracts-package. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/schemas/workflow.schema.json, docs/reference/schemas/asset-manifests.schema.json, docs/architecture/adr/0021-quality-gates.md, docs/planes/agent-runtime/services/workflow-engine-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.assets.write` and a `WorkflowDefinition` document of docs/reference/schemas/asset-manifests.schema.json, the shape of `workflow-definition-v1`, whose `dependsOn` graph is acyclic except for loops bounded by `onFalse.maxIterations`, whose every agent, tool and human step declares `sideEffectClass` and `failurePolicy`, whose Retry steps are of class read or sandbox or of class shared-write with `idempotencyKey`, whose human steps declare their `approval` binding and whose schema references resolve, when `WorkflowEngineService/ValidateWorkflowDefinition` is called, then the response is 200, the declared failure policies are taken as they stand and nothing is written or published (SCN-WorkflowEngineService-001).",
        "AC2: Given a body that is not a `WorkflowDefinition` of docs/reference/schemas/asset-manifests.schema.json, or a document with a cycle outside a bounded loop, an agent, tool or human step without `sideEffectClass` or `failurePolicy`, Retry on a shared-write step without `idempotencyKey` or on a step of a class above shared-write, a human step without `approval`, an unresolved schema reference or a fan-out above `Workflows:Engine:MaxFanout`, or a caller without `factory.assets.write`, when `WorkflowEngineService/ValidateWorkflowDefinition` is called, then the response is 400 with a problem response that names each finding by step and rule, or 403 for the missing scope, `connectsoft.factory.workflows.definition_rejections` counts the rejected definition with its reason, and no state changes (SCN-WorkflowEngineService-001).",
        "AC3: Given the seeded Draft release of a workflow definition, when `LoadWorkflowDefinition` runs for the release id that `AgentRegistryService/AssetPublication.ResolveRelease` returned for its alias, or that an accepted run pins, then the release is streamed through `AgentRegistryService/AssetPublication.LoadRelease`, the content its manifest `release-manifest-v1` references is fetched through `ArtifactService/Artifacts.Fetch`, the graph passes the validation of AC1, every declared action class is decided through `PolicyEngineService/Policy.Decide`, and the `WorkflowEngineService/WorkflowDefinitionVersion` with its step and edge rows and the `WorkflowEngineService/WorkflowDefinitionLoaded` outbox record are written in one transaction; a second load of the same `releaseId` changes nothing (SCN-WorkflowEngineService-006, FR-02).",
        "AC4: Given a version was loaded, when the outbox dispatcher publishes `WorkflowEngineService/WorkflowDefinitionLoaded` on `workflows.definitions.v1.workflow-definition-loaded`, then the event is sent under the canonical envelope with `releaseId`, `tenantId`, `definitionId`, `version` and `graphHash`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; given a release that fails load validation, whose manifest hash cannot be verified, or for one of whose action classes `PolicyEngineService/Policy.Decide` answers with the effect Deny or Prohibited, then no version and no event is written and `connectsoft.factory.workflows.definition_rejections` counts the rejection with its reason; given AgentRegistryService, PolicyEngineService or ArtifactService unavailable, then the load fails, nothing is written and the worker retries (SCN-WorkflowEngineService-006, ADR-0012, ADR-0021).",
        "AC5: Given a caller with `factory.assets.read` and a definition with loaded versions the tenant of the caller can read, when `WorkflowEngineService/ListWorkflowDefinitionVersions` is called, then the response is 200 with every loaded version and its `version`, `releaseId`, `graphHash` and `loadedAt`; a caller without the scope is answered 403, and a `definitionId` that is unknown or loaded only for another tenant is answered 404, the same answer in both cases, with a problem response and no state change (SCN-WorkflowEngineService-003, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/schemas/workflow.schema.json",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2019",
        "AIFACTORY-TASK-2020",
        "AIFACTORY-TASK-1993",
        "AIFACTORY-TASK-1994",
        "AIFACTORY-TASK-1995",
        "AIFACTORY-TASK-1996"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5804,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "AgentRegistryService",
          "PolicyEngineService",
          "ArtifactService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowDefinitionVersion"
        ],
        "apis": [
          "WorkflowEngineService/ValidateWorkflowDefinition",
          "WorkflowEngineService/ListWorkflowDefinitionVersions",
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "AgentRegistryService/AssetPublication.LoadRelease",
          "ArtifactService/Artifacts.Fetch",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "WorkflowEngineService/WorkflowDefinitionLoaded"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021",
          "ADR-0024"
        ],
        "requirements": [
          "FR-02"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-001",
          "SCN-WorkflowEngineService-003",
          "SCN-WorkflowEngineService-006"
        ]
      },
      "relates": {
        "screens": [
          "workflow-definitions"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-496",
        "AIFACTORY-US-497",
        "feature:agent-registry-service-thin",
        "feature:policy-engine-service",
        "feature:artifact-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/schemas/workflow.schema.json",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-498]",
      "number": 498
    },
    {
      "id": "AIFACTORY-TASK-2019",
      "type": "task",
      "parent": "AIFACTORY-US-498",
      "title": "Add the failure policy, the idempotency key, the approval binding, the condition and the signal member to WorkflowDefinition of the published asset manifest schema",
      "sequence": "02.02.04.01",
      "description": "Add the failure policy, the idempotency key, the approval binding, the condition and the signal member to WorkflowDefinition of the published asset manifest schema. Expected output: docs/reference/schemas/asset-manifests.schema.json declares on a step of `WorkflowDefinition` the properties `failurePolicy` (Retry, Compensate, Escalate, Fail), `idempotencyKey`, `condition` and `approval` with `actionClass`, `proposalKind`, `proposalFrom`, `approverRule` and `staleOn`, and in the activation block the member kind signal with `ref`, `versionRef` and `hashRef`, each mirroring the property of the same meaning in model/schemas/workflow.schema.json; the six chain definitions of model/workflows can be written as documents that are valid against it, the reference page of the schema shows the new properties, and `python -I tools/docs_model validate` passes.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "docs/reference/schemas/asset-manifests.schema.json declares on a step of `WorkflowDefinition` the properties `failurePolicy` (Retry, Compensate, Escalate, Fail), `idempotencyKey`, `condition` and `approval` with `actionClass`, `proposalKind`, `proposalFrom`, `approverRule` and `staleOn`, and in the activation block the member kind signal with `ref`, `versionRef` and `hashRef`, each mirroring the property of the same meaning in model/schemas/workflow.schema.json; the six chain definitions of model/workflows can be written as documents that are valid against it, the reference page of the schema shows the new properties, and `python -I tools/docs_model validate` passes."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5804,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2019]",
      "number": 2019
    },
    {
      "id": "AIFACTORY-TASK-2020",
      "type": "task",
      "parent": "AIFACTORY-US-498",
      "title": "Publish the contracts package version that carries the extended WorkflowDefinition types",
      "sequence": "02.02.04.02",
      "description": "Publish the contracts package version that carries the extended WorkflowDefinition types. Expected output: The contracts package regenerates its `WorkflowDefinition` types from docs/reference/schemas/asset-manifests.schema.json as AIFACTORY-TASK-2019 changed it, stamps them with the hash of the schema and is published to the ConnectSoft feed at a new version, the way feature contracts-package builds and publishes it; the repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService pins that version.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Contracts.",
      "acceptanceCriteria": [
        "The contracts package regenerates its `WorkflowDefinition` types from docs/reference/schemas/asset-manifests.schema.json as AIFACTORY-TASK-2019 changed it, stamps them with the hash of the schema and is published to the ConnectSoft feed at a new version, the way feature contracts-package builds and publishes it; the repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService pins that version."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5804,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2020]",
      "number": 2020
    },
    {
      "id": "AIFACTORY-TASK-1993",
      "type": "task",
      "parent": "AIFACTORY-US-498",
      "title": "Definition validator and the ValidateWorkflowDefinition and ListWorkflowDefinitionVersions operations",
      "sequence": "02.02.04.03",
      "description": "Definition validator and the ValidateWorkflowDefinition and ListWorkflowDefinitionVersions operations. Expected output: One validator, built on the `WorkflowDefinition` types of the contracts package version of AIFACTORY-TASK-2020, checks acyclicity of dependsOn with loops bounded by onFalse.maxIterations, the declared sideEffectClass and failurePolicy of every agent, tool and human step (a definition without them is refused and no policy is derived), Retry only on read or sandbox steps or on shared-write steps with idempotencyKey, the approval binding of human steps, conditions over recorded outputs only, schema references and the fan-out limit, with one unit test per rule; ValidateWorkflowDefinition answers 200, 400 with the findings for a body that is not a WorkflowDefinition of docs/reference/schemas/asset-manifests.schema.json or that breaks a rule, or 403, and writes nothing; ListWorkflowDefinitionVersions returns the loaded versions with version, releaseId, graphHash and loadedAt under the tenant row filter, 403 without the scope and 404 for an unknown or foreign definition.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "One validator, built on the `WorkflowDefinition` types of the contracts package version of AIFACTORY-TASK-2020, checks acyclicity of dependsOn with loops bounded by onFalse.maxIterations, the declared sideEffectClass and failurePolicy of every agent, tool and human step (a definition without them is refused and no policy is derived), Retry only on read or sandbox steps or on shared-write steps with idempotencyKey, the approval binding of human steps, conditions over recorded outputs only, schema references and the fan-out limit, with one unit test per rule; ValidateWorkflowDefinition answers 200, 400 with the findings for a body that is not a WorkflowDefinition of docs/reference/schemas/asset-manifests.schema.json or that breaks a rule, or 403, and writes nothing; ListWorkflowDefinitionVersions returns the loaded versions with version, releaseId, graphHash and loadedAt under the tenant row filter, 403 without the scope and 404 for an unknown or foreign definition."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1993]",
      "number": 1993
    },
    {
      "id": "AIFACTORY-TASK-1994",
      "type": "task",
      "parent": "AIFACTORY-US-498",
      "title": "LoadWorkflowDefinition and the DefinitionCacheWarmer with alias resolution and loading on first use",
      "sequence": "02.02.04.04",
      "description": "LoadWorkflowDefinition and the DefinitionCacheWarmer with alias resolution and loading on first use. Expected output: LoadWorkflowDefinition streams a release through AssetPublication.LoadRelease, fetches its content through Artifacts.Fetch, runs the validator of AIFACTORY-TASK-1993, has every declared action class decided through Policy.Decide and writes the WorkflowDefinitionVersion with its step and edge rows and the WorkflowDefinitionLoaded outbox record in one transaction, idempotent on releaseId; the DefinitionCacheWarmer handles AssetReleasePublished of kind Workflow and, while the registry publishes no event, resolves at start the alias of each definition it is given through AssetPublication.ResolveRelease, the alias being the one the activation block declares and the option StarterReleaseAlias when it declares none or is not loaded yet; a release that fails validation, whose manifest hash cannot be verified or whose action class is answered Deny or Prohibited writes nothing and increments definition_rejections with the reason; an unavailable dependency fails the load and is retried with the exponential policy of five attempts.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "LoadWorkflowDefinition streams a release through AssetPublication.LoadRelease, fetches its content through Artifacts.Fetch, runs the validator of AIFACTORY-TASK-1993, has every declared action class decided through Policy.Decide and writes the WorkflowDefinitionVersion with its step and edge rows and the WorkflowDefinitionLoaded outbox record in one transaction, idempotent on releaseId; the DefinitionCacheWarmer handles AssetReleasePublished of kind Workflow and, while the registry publishes no event, resolves at start the alias of each definition it is given through AssetPublication.ResolveRelease, the alias being the one the activation block declares and the option StarterReleaseAlias when it declares none or is not loaded yet; a release that fails validation, whose manifest hash cannot be verified or whose action class is answered Deny or Prohibited writes nothing and increments definition_rejections with the reason; an unavailable dependency fails the load and is retried with the exponential policy of five attempts."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1994]",
      "number": 1994
    },
    {
      "id": "AIFACTORY-TASK-1995",
      "type": "task",
      "parent": "AIFACTORY-US-498",
      "title": "Acceptance fixture of a fake registry with the six chain definitions and one invalid variant per validation rule",
      "sequence": "02.02.04.05",
      "description": "Acceptance fixture of a fake registry with the six chain definitions and one invalid variant per validation rule. Expected output: A test double of AgentRegistryService serves the six chain definitions of model/workflows, written as `WorkflowDefinition` documents of docs/reference/schemas/asset-manifests.schema.json, as seeded Draft releases with their aliases through ResolveRelease and LoadRelease; a set of invalid documents holds one variant per rule of the validator (a cycle, a missing failurePolicy, a missing sideEffectClass, Retry on a shared-write step without idempotencyKey, a human step without approval, an unresolved schema reference, a fan-out above the limit, a body that is no WorkflowDefinition); a fake policy engine answers Allow or a scripted Deny and a fake artifact store serves the content, so the scenarios run without the registry, the policy engine and the artifact store.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A test double of AgentRegistryService serves the six chain definitions of model/workflows, written as `WorkflowDefinition` documents of docs/reference/schemas/asset-manifests.schema.json, as seeded Draft releases with their aliases through ResolveRelease and LoadRelease; a set of invalid documents holds one variant per rule of the validator (a cycle, a missing failurePolicy, a missing sideEffectClass, Retry on a shared-write step without idempotencyKey, a human step without approval, an unresolved schema reference, a fan-out above the limit, a body that is no WorkflowDefinition); a fake policy engine answers Allow or a scripted Deny and a fake artifact store serves the content, so the scenarios run without the registry, the policy engine and the artifact store."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5804,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1995]",
      "number": 1995
    },
    {
      "id": "AIFACTORY-TASK-1996",
      "type": "task",
      "parent": "AIFACTORY-US-498",
      "title": "Verify validate-and-load-workflow-definitions through the acceptance suite",
      "sequence": "02.02.04.06",
      "description": "Verify validate-and-load-workflow-definitions through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-001|Scenario=SCN-WorkflowEngineService-003|Scenario=SCN-WorkflowEngineService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-498, including the refusal of a definition without failurePolicy, the load by alias and on first use, the idempotent second load, the release rejected by validation or by a denied action class that writes no event, and the publication and payload of WorkflowDefinitionLoaded; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-001|Scenario=SCN-WorkflowEngineService-003|Scenario=SCN-WorkflowEngineService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-498, including the refusal of a definition without failurePolicy, the load by alias and on first use, the idempotent second load, the release rejected by validation or by a denied action class that writes no event, and the publication and payload of WorkflowDefinitionLoaded; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1996]",
      "number": 1996
    },
    {
      "id": "AIFACTORY-US-499",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Open the projection of an accepted run and announce its ready steps with the declared action class and idempotency, without dispatching anything",
      "sequence": "02.02.05",
      "description": "When RunControlService accepts a run it publishes `RunControlService/RunAccepted` with `runId`, `tenantId`, `projectId`, `workflowId`, `releaseId`, `policyRevision`, `modelProfileId` and `requestedBy`. The inbox handler `StartWorkflowRun` of the engine opens the projection of that run, idempotently on the event id and on `runId`: it takes the `WorkflowDefinitionVersion` of the pinned `releaseId` from its store, loading the release on first use (AIFACTORY-US-498), creates the `WorkflowRun` with the same `runId`, the `definitionReleaseId` and the `graphHash` in state Pending, computes the first ready steps, moves the run from Pending to Running through the modelled trigger `RunAccepted`, and writes `WorkflowEngineService/WorkflowRunStarted` and one `WorkflowEngineService/StepReady` per ready step in the same transaction. A step is ready when every step it depends on is Succeeded or Skipped and its `when` guard holds over the workflow inputs and the recorded outputs; a step whose guard does not hold is recorded Skipped and its dependants treat it as satisfied (ADR-0027). For each ready step the engine creates a `StepRun`, and `StepReady` carries `runId`, `tenantId`, `stepRunId`, `stepId`, `kind`, `actionClass`, `idempotent`, `inputRef`, `failurePolicy`, `taskContractRef` and `taskContractHash`: `actionClass` is the side-effect class the step declares in the pinned definition, `idempotent` is true when that step declares an idempotency key, `inputRef` refers to the input of the step built from its input mapping, and `failurePolicy` is the failure policy the step declares, which Run Control keeps on its step and reads when the step fails terminally, so that a step under Escalate opens an operator decision. The engine copies the three values from the definition and derives none. `taskContractRef` and `taskContractHash` name the task contract of an agent or tool step, which the engine stored in ArtifactService before the announcement; no agent or tool step is announced without them, and how the contract is built and stored is delivered by AIFACTORY-US-746 (decision D121). Both members are optional on `StepReady`: a human step has no task contract, so its `StepReady` carries neither (decision D123). The three copied values hold for a human step as well: its `actionClass` is the side-effect class the step declares, and the action class of its approval binding is read by Run Control for the approval request. A step of kind SubWorkflow is announced by no `StepReady`, because the engine submits its child run itself (AIFACTORY-US-647). The engine dispatches nothing: RunControlService consumes `StepReady` in its handler `CreateStepAndDispatch`, creates the `Step` idempotently on `stepRunId`, copies `actionClass` to `sideEffectClass` and `idempotent` to `idempotent` of the `Step`, keeps `stepRunId` and `failurePolicy` on it, keeps the reference and the hash of the task contract on the step and copies them to each attempt of it, and dispatches the attempt of an Agent or Tool step or opens the approval of a Human step, in its own PBIs. The gates of dispatch are also Run Control's: its dispatcher releases the first attempt once the budget is reserved, a run that waits for a spend approval has no reservation yet, and a Held run gets no attempt, so a `StepReady` of such a run creates a Pending step that waits. The engine consumes no budget event and never moves a run: the trigger of its own transition is `RunAccepted` alone. An internal caller may also ask instead of listening, and RunControlService does so when a run is accepted, as a fail-fast dependency of its own: `WorkflowEngineService/WorkflowEngine.PlanNextSteps` takes the run and the last applied outcome sequence and returns the steps that are ready to dispatch with their input mappings and action classes, in the reply the model describes by `agent-task-contract-v1`. The method is of class read and idempotent: it computes from the committed projection, writes nothing and returns the same steps for the same sequence. The caller presents a workload token, and the engine reads the tenant and project the caller forwards only when the token holds the service scope that names the engine (ADR-0015). A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, an invalid request with INVALID_ARGUMENT, and a run that does not exist in the forwarded tenant, a run of another tenant included, with NOT_FOUND. When the pinned release cannot be loaded because AgentRegistryService is unavailable, the handler fails, no `WorkflowRun` is written and the inbox redelivers `RunAccepted`. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService, AgentRegistryService; aggregates: WorkflowEngineService/WorkflowRun, WorkflowEngineService/WorkflowDefinitionVersion, RunControlService/Step; apis: WorkflowEngineService/WorkflowEngine.PlanNextSteps, AgentRegistryService/AssetPublication.LoadRelease; events: WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/StepReady, WorkflowEngineService/StepRunStateChanged, RunControlService/RunAccepted; descriptors: agent-task-contract-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024, ADR-0027; requirements: FR-03, FUX-04; scenarios: SCN-WorkflowEngineService-004, SCN-WorkflowEngineService-007, SCN-WorkflowEngineService-008. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-496, AIFACTORY-US-497, AIFACTORY-US-498, feature:run-control-service, feature:agent-registry-service-thin. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/run-event-envelope.schema.json, docs/planes/agent-runtime/services/workflow-engine-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a loaded `WorkflowEngineService/WorkflowDefinitionVersion` and a `RunControlService/RunAccepted` that pins its `releaseId`, when the handler `StartWorkflowRun` runs, then a `WorkflowEngineService/WorkflowRun` with the same `runId`, the `definitionReleaseId` and the `graphHash` exists in state Running, a step run exists for every step whose dependencies are satisfied, and `WorkflowEngineService/WorkflowRunStarted` and one `WorkflowEngineService/StepReady` per ready step are written in the same transaction; a redelivery of the same event id, or a second `RunAccepted` for the same `runId`, changes nothing (SCN-WorkflowEngineService-007, ADR-0014).",
        "AC2: Given the run was opened, when the outbox dispatcher publishes `WorkflowEngineService/WorkflowRunStarted` on `workflows.runs.v1.workflow-run-started` and `WorkflowEngineService/StepReady` on `workflows.runs.v1.step-ready`, then both are sent under the canonical envelope, the first with `runId`, `tenantId`, `definitionReleaseId` and `graphHash`, the second with `runId`, `tenantId`, `stepRunId`, `stepId`, `kind`, `actionClass`, `idempotent`, `inputRef`, `failurePolicy` and, for an agent or tool step, `taskContractRef` and `taskContractHash`, where `actionClass` equals the side-effect class the step declares, `idempotent` is true exactly when the step declares an idempotency key, `idempotencyKey` of its step in the loaded definition, `failurePolicy` equals the failure policy the step declares, `taskContractRef` and `taskContractHash` name the task contract stored before the announcement and are absent on the `StepReady` of a human step, and a transport outage is retried with backoff so neither event is lost or duplicated under its event id (SCN-WorkflowEngineService-007, SCN-WorkflowEngineService-008, ADR-0012).",
        "AC3: Given `WorkflowEngineService/StepReady` was published for an Agent, a Tool and a Human step, when the stores are inspected, then the engine created no step, attempt, lease or approval of Run Control, the payload is the one from which `CreateStepAndDispatch` creates the `RunControlService/Step` with `sideEffectClass`, `idempotent`, `stepRunId` and `failurePolicy` copied, and a step whose `when` guard does not hold was announced by no `StepReady` but recorded Skipped with `WorkflowEngineService/StepRunStateChanged`, its dependants treating it as satisfied (SCN-WorkflowEngineService-008, ADR-0027, model/services/control-plane/RunControlService.yaml).",
        "AC4: Given a caller with a workload identity whose token holds the service scope and a run of the tenant it forwards, when `WorkflowEngineService/WorkflowEngine.PlanNextSteps` is called with the run and the last applied outcome sequence, then the reply names the steps that are ready to dispatch with their input mappings and action classes as `agent-task-contract-v1` describes them, nothing is written, and a repeated call with the same sequence returns the same steps (SCN-WorkflowEngineService-004).",
        "AC5: Given a caller without a workload identity, a token without the service scope, a request that names no run, or a run that is unknown or belongs to another tenant, when `WorkflowEngineService/WorkflowEngine.PlanNextSteps` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, the foreign run answered exactly as the unknown one, and no state changes; given AgentRegistryService is unavailable when `StartWorkflowRun` must load the pinned release through `AgentRegistryService/AssetPublication.LoadRelease`, then the handler fails, no workflow run is written and the inbox redelivers the event (SCN-WorkflowEngineService-004, SCN-WorkflowEngineService-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-197",
        "AIFACTORY-TASK-1997",
        "AIFACTORY-TASK-1998",
        "AIFACTORY-TASK-1999"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5805,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "WorkflowEngineService/WorkflowDefinitionVersion",
          "RunControlService/Step"
        ],
        "apis": [
          "WorkflowEngineService/WorkflowEngine.PlanNextSteps",
          "AgentRegistryService/AssetPublication.LoadRelease"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/StepRunStateChanged",
          "RunControlService/RunAccepted"
        ],
        "descriptors": [
          "agent-task-contract-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-03",
          "FUX-04"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-004",
          "SCN-WorkflowEngineService-007",
          "SCN-WorkflowEngineService-008"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-496",
        "AIFACTORY-US-497",
        "AIFACTORY-US-498",
        "feature:run-control-service",
        "feature:agent-registry-service-thin"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-499]",
      "number": 499
    },
    {
      "id": "AIFACTORY-TASK-197",
      "type": "task",
      "parent": "AIFACTORY-US-499",
      "title": "Plan next steps: dependencies, conditions, when guards, bounded loops",
      "sequence": "02.02.05.01",
      "description": "Plan next steps: dependencies, conditions, when guards, bounded loops. Expected output: One planner computes the ready set of a run from the pinned graph and the recorded outputs for agent, tool, human, condition, timer, parallel, sub-workflow and compensation steps as `WorkflowDefinition` of docs/reference/schemas/asset-manifests.schema.json defines them: dependencies, when guards with a Skipped step treated as satisfied, conditions and bounded loops; it is the single planner behind StartWorkflowRun, Advance and PlanNextSteps, with unit tests per step kind.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "One planner computes the ready set of a run from the pinned graph and the recorded outputs for agent, tool, human, condition, timer, parallel, sub-workflow and compensation steps as `WorkflowDefinition` of docs/reference/schemas/asset-manifests.schema.json defines them: dependencies, when guards with a Skipped step treated as satisfied, conditions and bounded loops; it is the single planner behind StartWorkflowRun, Advance and PlanNextSteps, with unit tests per step kind."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5805,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-197]",
      "number": 197
    },
    {
      "id": "AIFACTORY-TASK-1997",
      "type": "task",
      "parent": "AIFACTORY-US-499",
      "title": "StartWorkflowRun inbox handler with WorkflowRunStarted and the StepReady payload copied from the definition",
      "sequence": "02.02.05.02",
      "description": "StartWorkflowRun inbox handler with WorkflowRunStarted and the StepReady payload copied from the definition. Expected output: The handler of RunAccepted opens the WorkflowRun for the pinned release, loading the release on first use, moves it from Pending to Running, creates the step runs of the first ready steps and writes WorkflowRunStarted and one StepReady per ready step in the same transaction, idempotent on the event id and on runId; StepReady carries actionClass, idempotent and failurePolicy copied from the step of the pinned definition, never derived, inputRef, and, for an agent or tool step, taskContractRef and taskContractHash of the task contract that AIFACTORY-TASK-3011 stored before the announcement, the StepReady of a human step carrying neither; no StepReady is written for a step of kind SubWorkflow, which AIFACTORY-US-647 executes; an unavailable registry fails the handler and nothing is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The handler of RunAccepted opens the WorkflowRun for the pinned release, loading the release on first use, moves it from Pending to Running, creates the step runs of the first ready steps and writes WorkflowRunStarted and one StepReady per ready step in the same transaction, idempotent on the event id and on runId; StepReady carries actionClass, idempotent and failurePolicy copied from the step of the pinned definition, never derived, inputRef, and, for an agent or tool step, taskContractRef and taskContractHash of the task contract that AIFACTORY-TASK-3011 stored before the announcement, the StepReady of a human step carrying neither; no StepReady is written for a step of kind SubWorkflow, which AIFACTORY-US-647 executes; an unavailable registry fails the handler and nothing is written."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5805,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1997]",
      "number": 1997
    },
    {
      "id": "AIFACTORY-TASK-1998",
      "type": "task",
      "parent": "AIFACTORY-US-499",
      "title": "WorkflowEngine.PlanNextSteps answered from the committed projection",
      "sequence": "02.02.05.03",
      "description": "WorkflowEngine.PlanNextSteps answered from the committed projection. Expected output: WorkflowEngine.PlanNextSteps returns, for a run and the last applied outcome sequence, the steps ready to dispatch with their input mappings and action classes, writes nothing and returns the same steps for the same sequence; callers without workload identity are refused with Unauthenticated, tokens without the service scope with PermissionDenied, invalid requests with InvalidArgument, and an unknown run and a run of another tenant alike with NotFound, the gRPC status NOT_FOUND (ADR-0015).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "WorkflowEngine.PlanNextSteps returns, for a run and the last applied outcome sequence, the steps ready to dispatch with their input mappings and action classes, writes nothing and returns the same steps for the same sequence; callers without workload identity are refused with Unauthenticated, tokens without the service scope with PermissionDenied, invalid requests with InvalidArgument, and an unknown run and a run of another tenant alike with NotFound, the gRPC status NOT_FOUND (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5805,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1998]",
      "number": 1998
    },
    {
      "id": "AIFACTORY-TASK-1999",
      "type": "task",
      "parent": "AIFACTORY-US-499",
      "title": "Verify open-a-workflow-run-and-announce-ready-steps through the acceptance suite",
      "sequence": "02.02.05.04",
      "description": "Verify open-a-workflow-run-and-announce-ready-steps through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-004|Scenario=SCN-WorkflowEngineService-007|Scenario=SCN-WorkflowEngineService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-499, including the idempotent redelivery of RunAccepted, actionClass, idempotent and failurePolicy of StepReady equal to the declared values of each chain definition, taskContractRef and taskContractHash present on the StepReady of every agent and tool step and absent on that of a human step, the Skipped step of a guard that does not hold, the refusal mapping of PlanNextSteps and the publication and payload of WorkflowRunStarted and StepReady; consumer handling is proven by the suite of RunControlService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-004|Scenario=SCN-WorkflowEngineService-007|Scenario=SCN-WorkflowEngineService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-499, including the idempotent redelivery of RunAccepted, actionClass, idempotent and failurePolicy of StepReady equal to the declared values of each chain definition, taskContractRef and taskContractHash present on the StepReady of every agent and tool step and absent on that of a human step, the Skipped step of a guard that does not hold, the refusal mapping of PlanNextSteps and the publication and payload of WorkflowRunStarted and StepReady; consumer handling is proven by the suite of RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1999]",
      "number": 1999
    },
    {
      "id": "AIFACTORY-US-746",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Store the task contract of a step in the artifact store before the step is announced ready, and carry its reference and hash on StepReady",
      "sequence": "02.02.06",
      "description": "An agent or tool step leaves the engine with its task handoff already written (decisions D121 and D123). Whenever the engine finds an agent or tool step ready that it announces, in the handler `StartWorkflowRun` after `RunControlService/RunAccepted`, in the Advance after a `StepSettled`, after a fired timer or after a decision, it first builds the task contract of the step, a document of `agent-task-contract-v1`: the run, the agent the step names, the objective, the inputs by reference as the input mapping of the step maps them from the workflow inputs and the recorded outputs, the tools the step allows with their side-effect class and approval mode, the model profile the run was accepted with, the expected output with its descriptor and validation, and the limits. Every value comes from the pinned definition, from `RunAccepted` and from recorded outputs, and the engine invents none. The contract describes the step and no attempt (decision D123): the engine writes it once for the step, every attempt of the step, a retried one included, reads the same contract, and the engine writes neither `attemptId` nor the `stepId` of RunControlService nor `snapshotId` into it. None of the three is a required member of the schema, because Run Control creates the step and the attempt only after `StepReady`; the runtime takes the ids of the attempt and the reference of its snapshot from the answer of `RunControlService/RunControl.AcquireLease`. The contract of a step run is built deterministically from those sources and the step run id, so the same step run always yields the same content and the same hash. The engine stores the document through `ArtifactService/Artifacts.Store` under its workload identity, within the tenant and the project of the run, and takes the reference and the content hash of the reply. Only then does it create the `StepRun`, which keeps the reference in `taskContractRef` and the hash in `taskContractHash` (D125), and write `WorkflowEngineService/StepReady`, which carries the reference in `taskContractRef` and the hash in `taskContractHash` beside the fields AIFACTORY-US-499 specifies, in the transaction of the announcement. No agent or tool step is announced ready without a stored contract, and a compensation step, which Run Control dispatches like any other step (AIFACTORY-US-501), gets its contract on the same path, as the owner decided (D125). The contract names the kind of its step in `stepKind` and names the agent only for an agent step, so the contract of a tool step or of a compensation step may name no agent (D125). A human step has no task contract (decision D123): the engine stores none for it, both members are optional on `StepReady` and absent on the `StepReady` of a human step, and its step run keeps no reference (AIFACTORY-US-503). The engine writes the contract and no other service does: RunControlService keeps the reference and the hash on its step, copies them to each attempt of the step and returns them in the answer of `RunControlService/RunControl.AcquireLease`, and AgentRuntimeService reads the content by that reference and verifies it against the hash before the attempt starts; both are proven by their own features. ArtifactService is a fail-fast dependency of the announcement. When `Artifacts.Store` fails or does not answer, the handler fails, `StepReady` is not published for the step, nothing is committed and the inbox redelivers the event that made the step ready, so the engine repeats the write before it announces the step. The write is idempotent on tenant and hash: a repeat after a lost answer, a redelivered event and a restarted Advance all yield the same reference and the same hash and no second contract. Once the announcement is committed the step run holds the reference, so a re-emitted `StepReady`, written by the re-activated grain after a crash or by the `StuckRunReconciler` (AIFACTORY-US-502), carries that same reference and the same hash the step run keeps, and no contract is written again (decisions D123 and D125). The delay is the only effect: no step run fails and no terminal event is written because the store is away. A step of kind SubWorkflow is announced by no `StepReady` and gets no task contract on this path (AIFACTORY-US-647), and neither does a step the engine evaluates itself, a condition, a timer, a fan-out or a join. Kind: behavior. Traces: services: WorkflowEngineService, ArtifactService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun; apis: ArtifactService/Artifacts.Store, RunControlService/RunControl.AcquireLease; events: WorkflowEngineService/StepReady, RunControlService/RunAccepted; descriptors: agent-task-contract-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014; requirements: FR-03, XL-06. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-499, AIFACTORY-US-500, feature:artifact-service, feature:run-control-service, feature:contracts-package. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, model/services/knowledge/ArtifactService.yaml, docs/reference/schemas/agent-task-contract.schema.json, docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running `WorkflowEngineService/WorkflowRun` and a step of kind Agent or Tool that becomes ready, when the engine announces it, then `ArtifactService/Artifacts.Store` was called before the announcement, under the workload identity of the engine and within the tenant and the project of the run, with a document of `agent-task-contract-v1` whose objective, inputs, allowed tools, model profile, expected output and limits equal what the pinned definition and `RunControlService/RunAccepted` state for the step and which is valid against docs/reference/schemas/agent-task-contract.schema.json without `attemptId`, without the `stepId` of RunControlService and without `snapshotId`, and `WorkflowEngineService/StepReady` is written in the transaction that creates the step run with the reference of the reply in `taskContractRef` and the hash of the stored content in `taskContractHash`, the step run keeping the same reference in `taskContractRef` and the same hash in `taskContractHash` (D125, ADR-0014).",
        "AC2: Given `WorkflowEngineService/StepReady` events published for the first steps of a run, for steps announced after a settled step, a fired timer and a decision, and for a compensation step, when the outbox and the artifact store are inspected, then every `StepReady` of an agent, tool or compensation step carries `taskContractRef` and `taskContractHash`, the content the artifact store holds under each reference hashes to its `taskContractHash`, the `StepReady` of a human step carries neither member, the artifact store holds no task contract for the human step and its step run keeps no reference, and a step of kind SubWorkflow and a step the engine evaluates itself have neither a `StepReady` nor a task contract (model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC3: Given `ArtifactService/Artifacts.Store` fails or does not answer when an agent or tool step becomes ready, when the engine handles the event that made the step ready, then the handler fails, no `WorkflowEngineService/StepReady` is published for the step, nothing is committed, no step run is Failed and no terminal event is written, the inbox redelivers the event, and once the store answers the contract is stored and the step is announced once, as the failure mode of model/services/agent-mesh/WorkflowEngineService.yaml states.",
        "AC4: Given the write of the contract of one step run is repeated before its announcement is committed, after a lost answer of `ArtifactService/Artifacts.Store`, after a redelivery of the event that made the step ready or after a restart of the engine between the write and its commit, when `WorkflowEngineService/StepReady` is written, then the artifact store holds one task contract for the step run and the fake Run Control holds one step; given a committed announcement and a re-emission by the re-activated grain or by the `StuckRunReconciler`, then the re-emitted `StepReady` carries the same `stepRunId` and the `taskContractRef` and `taskContractHash` the step run keeps, and no second contract is written; and given the fake Run Control dispatches a second attempt of the step, then the engine writes no contract for it and the artifact store still holds one task contract for the step run (XL-06)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3011",
        "AIFACTORY-TASK-3012",
        "AIFACTORY-TASK-3013"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5806,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "ArtifactService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store",
          "RunControlService/RunControl.AcquireLease"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "RunControlService/RunAccepted"
        ],
        "descriptors": [
          "agent-task-contract-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-03",
          "XL-06"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-499",
        "AIFACTORY-US-500",
        "feature:artifact-service",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-746]",
      "number": 746
    },
    {
      "id": "AIFACTORY-TASK-3011",
      "type": "task",
      "parent": "AIFACTORY-US-746",
      "title": "Task contract builder and the store-then-announce path of every StepReady",
      "sequence": "02.02.06.01",
      "description": "Task contract builder and the store-then-announce path of every StepReady. Expected output: One builder produces the agent-task-contract-v1 document of a step run from the pinned definition, RunAccepted, the recorded outputs and the step run id, deterministically, so the same step run yields the same content and hash; the document describes the step and no attempt and carries no attemptId, no stepId of RunControlService and no snapshotId; the single path that writes StepReady, used by StartWorkflowRun, the Advance, the TimerScheduler, the decision handler, the compensation plan and the StuckRunReconciler, calls Artifacts.Store for an agent, tool or compensation step with that document under the workload identity of the engine and within the tenant and project of the run before it creates the step run, keeps the reference of the reply in TaskContractRef and the hash of the stored content in TaskContractHash of the step run (D125) and writes taskContractRef and taskContractHash on StepReady in the transaction of the announcement; the document names its stepKind and names the agent only for an agent step (D125); a failed or unanswered Artifacts.Store fails the handler without a write and without a StepReady, and a write repeated before the commit yields the same reference and hash; a re-emission takes the reference and the hash from the step run and stores nothing again; for a human step the path stores no contract, leaves TaskContractRef empty and writes StepReady without the two members; no contract is written for a step of kind SubWorkflow or for a step the engine evaluates itself; unit tests cover the builder per announced step kind, the human step announced without a contract and the refusal to announce an agent or tool step without a stored contract.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "One builder produces the agent-task-contract-v1 document of a step run from the pinned definition, RunAccepted, the recorded outputs and the step run id, deterministically, so the same step run yields the same content and hash; the document describes the step and no attempt and carries no attemptId, no stepId of RunControlService and no snapshotId; the single path that writes StepReady, used by StartWorkflowRun, the Advance, the TimerScheduler, the decision handler, the compensation plan and the StuckRunReconciler, calls Artifacts.Store for an agent, tool or compensation step with that document under the workload identity of the engine and within the tenant and project of the run before it creates the step run, keeps the reference of the reply in TaskContractRef and the hash of the stored content in TaskContractHash of the step run (D125) and writes taskContractRef and taskContractHash on StepReady in the transaction of the announcement; the document names its stepKind and names the agent only for an agent step (D125); a failed or unanswered Artifacts.Store fails the handler without a write and without a StepReady, and a write repeated before the commit yields the same reference and hash; a re-emission takes the reference and the hash from the step run and stores nothing again; for a human step the path stores no contract, leaves TaskContractRef empty and writes StepReady without the two members; no contract is written for a step of kind SubWorkflow or for a step the engine evaluates itself; unit tests cover the builder per announced step kind, the human step announced without a contract and the refusal to announce an agent or tool step without a stored contract."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3011]",
      "number": 3011
    },
    {
      "id": "AIFACTORY-TASK-3012",
      "type": "task",
      "parent": "AIFACTORY-US-746",
      "title": "Fake of the artifact store that holds task contracts and can fail, lose its answer or be stopped",
      "sequence": "02.02.06.02",
      "description": "Fake of the artifact store that holds task contracts and can fail, lose its answer or be stopped. Expected output: The acceptance suite holds a fake of Artifacts.Store that keeps every stored document by tenant and content hash, returns the same reference for the same tenant and hash, exposes what it holds, and on request fails a write, stores a document but loses the answer, or is stopped and started again, so that the store-then-announce path, its repetition and its delay are reachable without ArtifactService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of Artifacts.Store that keeps every stored document by tenant and content hash, returns the same reference for the same tenant and hash, exposes what it holds, and on request fails a write, stores a document but loses the answer, or is stopped and started again, so that the store-then-announce path, its repetition and its delay are reachable without ArtifactService."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5806,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3012]",
      "number": 3012
    },
    {
      "id": "AIFACTORY-TASK-3013",
      "type": "task",
      "parent": "AIFACTORY-US-746",
      "title": "Verify store-the-task-contract-before-a-step-is-announced through the acceptance suite",
      "sequence": "02.02.06.03",
      "description": "Verify store-the-task-contract-before-a-step-is-announced through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=store-the-task-contract-before-a-step-is-announced\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-746 against the fake Run Control of AIFACTORY-TASK-2002 and the fake artifact store of AIFACTORY-TASK-3012: the contract stored before each StepReady of an agent, tool or compensation step with the members the engine fills equal to the pinned definition and without attemptId, the stepId of Run Control and snapshotId, taskContractRef and taskContractHash on each such StepReady, the same reference kept on the step run and the stored content hashing to the hash, the StepReady of a human step without the two members and with no contract in the store, no contract and no StepReady for a sub-workflow step and for a step the engine evaluates, the stopped store after which nothing is announced, nothing fails and the step is announced once when the store is back, one contract after a lost answer, a redelivery and a restart, the reference of the step run and the same hash on a re-emission of the grain and of the reconciler, and no second contract for a second attempt of the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=store-the-task-contract-before-a-step-is-announced\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-746 against the fake Run Control of AIFACTORY-TASK-2002 and the fake artifact store of AIFACTORY-TASK-3012: the contract stored before each StepReady of an agent, tool or compensation step with the members the engine fills equal to the pinned definition and without attemptId, the stepId of Run Control and snapshotId, taskContractRef and taskContractHash on each such StepReady, the same reference kept on the step run and the stored content hashing to the hash, the StepReady of a human step without the two members and with no contract in the store, no contract and no StepReady for a sub-workflow step and for a step the engine evaluates, the stopped store after which nothing is announced, nothing fails and the step is announced once when the store is back, one contract after a lost answer, a redelivery and a restart, the reference of the step run and the same hash on a re-emission of the grain and of the reconciler, and no second contract for a second attempt of the step."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5806,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3013]",
      "number": 3013
    },
    {
      "id": "AIFACTORY-US-500",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Advance a workflow run on each settled step through conditions, guards, fan-out, join and bounded loops, keep recorded outcomes on the projection, and report completion once",
      "sequence": "02.02.07",
      "description": "RunControlService records the outcome of an attempt exactly once and publishes `RunControlService/AttemptOutcomeRecorded` with `runId`, `stepId`, `attemptId`, `outcome`, `failureClass` and `outcomeHash`. That event only updates the projection of the engine (decision D121): the inbox handler `AdvanceOnOutcome` hands it to the `WorkflowRunGrain` of the run, which records the attempt and its outcome on the step run once, idempotently on the outcome sequence the projection keeps in `lastOutcomeSequence`, so an outcome delivered twice or re-applied after a restart changes nothing; the handler computes nothing and announces nothing, whatever the outcome is. An attempt outcome settles no step. The engine advances a run on `RunControlService/StepSettled` alone. Run Control publishes that event once per step, and it names the step run by the `stepRunId` the engine announced and carries beside it the `stepId` of Run Control, the final state (Succeeded, Failed, Skipped or Cancelled), the number of attempts, for a failed step the failure class and, for a step whose settling attempt reported an output, the `outputRef` of that attempt. The inbox handler `ApplyStepSettled` hands it to the same grain, which serialises Advance and applies it once, idempotently on the event id: the step run moves to the final state the event carries, keeps `attemptCount` and `failureClass` from it and takes its `outputRef` from it, and for a step settled Succeeded the engine evaluates what the graph allows next over recorded outputs only. Run Control writes the outcome that settles a step and its `StepSettled` in one transaction, and the two may reach the engine in either order; the order changes nothing, because the settlement alone advances the run. A Succeeded outcome whose `StepSettled` has not arrived moves no step run to a final state and announces nothing, and a `StepSettled` with the final state Succeeded whose outcome has not arrived yet advances the run without waiting for it. A condition step is evaluated by the engine itself in the expression language `Workflows:Engine:ConditionLanguage`; it reads only recorded step outputs and run variables, never calls a model or a service and never retries. When a condition is false and declares `onFalse`, the run returns to the named earlier step with the declared feedback and a new iteration of that step runs, at most `maxIterations` times, or `Workflows:Engine:DefaultMaxLoopIterations` times when the definition declares none; after the limit the run fails with the evidence (AIFACTORY-US-501). A missing or unreadable recorded output fails the condition with evidence and is never read as true. A step whose `when` guard does not hold is recorded Skipped and its dependants treat it as satisfied. A parallel step fans out into at most `Workflows:Engine:MaxFanout` branches; only inside a fan-out may more than one step run of a step be active, and the join waits for every branch that ran, or for the declared quorum, and treats a skipped branch as satisfied. One step run exists per step and iteration (`UX_StepRuns_Run_Step_Iteration`). Every move of a step run between two states of `StepRunState` is announced by `WorkflowEngineService/StepRunStateChanged` with `fromState` and `toState`, and every newly ready step by `WorkflowEngineService/StepReady`, all written with the step-run rows in the transaction of the Advance. Run variables and step outputs are held by reference in ArtifactService, a fail-fast dependency: when it is unavailable the Advance fails, nothing is written and the inbox redelivers the event. When every terminal step of the graph is Succeeded or Skipped, the run moves from Running to Completed through `TerminalStepsSucceeded` and `WorkflowEngineService/WorkflowRunCompleted` is written in the same transaction with the `outputRef` of the run; RunControlService records Completed in its handler `CompleteRun` and carries that reference as the `outputRef` of its `RunCompleted` (decision D121), and the engine never changes the authoritative state itself. A Failed, TimedOut, Cancelled or Uncertain outcome is not a success and announces no next step; it is recorded on the step run, which stays open until `StepSettled` names it. Whether a new attempt of the same step follows is decided by Run Control alone, and the engine announces nothing for a retry and holds no retry rule of its own. What the engine does when a step is settled Failed or Cancelled is specified in AIFACTORY-US-501, and what it does while Run Control keeps an operator decision open for a step that failed under Escalate or ended Uncertain in AIFACTORY-US-646. An outcome or a `StepSettled` for a run the projection does not hold, or for a run that is already Completed, Failed or Cancelled, changes nothing. `AttemptOutcomeRecorded` carries the `stepId` of Run Control and no step run id, and `StepSettled` carries both ids (decision D121), so from the settlement of a step on the engine knows which step run that `stepId` names. Two points stay unstated by the model and are reported to the owner: how an outcome that arrives before the settlement of its step, as the Failed outcome of an attempt that Run Control retries, is matched to its step run, and which value orders outcomes in `lastOutcomeSequence`, since the event carries no outcome sequence. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService, ArtifactService; aggregates: WorkflowEngineService/WorkflowRun; events: WorkflowEngineService/StepRunStateChanged, WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunCompleted, RunControlService/AttemptOutcomeRecorded, RunControlService/StepSettled; steps: vision-to-blueprint/check-valid, architecture-decomposition/check-valid, module-blueprints/fan-out-contexts, module-blueprints/check-valid, module-blueprints/join, database-blueprint/check-valid, generate-product/fan-out-fill, generate-product/join-fill, generate-product/check-build; adrs: ADR-0012, ADR-0014, ADR-0024, ADR-0026, ADR-0027; requirements: FR-03, FR-10, XL-06; scenarios: SCN-WorkflowEngineService-009, SCN-WorkflowEngineService-012. Relates: screens: workflow-run-graph; nfrs: NFR-05. Depends on: AIFACTORY-US-499, feature:run-control-service, feature:artifact-service. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/schemas/workflow.schema.json, model/workflows/module-blueprints.yaml, model/workflows/generate-product.yaml, docs/planes/agent-runtime/services/workflow-engine-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given a Running `WorkflowEngineService/WorkflowRun` and, for one of its step runs, a `RunControlService/StepSettled` that names its `stepRunId` with the final state Succeeded, the `stepId` of Run Control, an attempt count and an `outputRef`, when the handler `ApplyStepSettled` runs, then the step run is Succeeded and keeps the `attemptCount` and the `outputRef` of the event, a step run exists for every step whose dependencies are now satisfied, and `WorkflowEngineService/StepRunStateChanged` and one `WorkflowEngineService/StepReady` per newly ready step are written, each in the transaction of the change it announces, whether the `RunControlService/AttemptOutcomeRecorded` of the settling attempt arrived before, arrives after or has not arrived; an `AttemptOutcomeRecorded` handled by `AdvanceOnOutcome` records the attempt and its outcome on the projection, advances `lastOutcomeSequence`, moves no step run to a final state and announces nothing, also when its outcome is Succeeded and its `StepSettled` has not arrived; and the same outcome or the same `StepSettled` delivered twice changes nothing and writes no second event (SCN-WorkflowEngineService-009, XL-06).",
        "AC2: Given a condition such as vision-to-blueprint/check-valid, architecture-decomposition/check-valid, module-blueprints/check-valid, database-blueprint/check-valid or generate-product/check-build whose expression is false over the recorded output while its `onFalse` limit is not reached, when the engine evaluates it, then no model and no service is called, the run returns to the named earlier step with the declared feedback in a new iteration, and after the last allowed iteration the run fails with the evidence as AIFACTORY-US-501 specifies; a missing or unreadable recorded output fails the condition and is never read as true (ADR-0026).",
        "AC3: Given a fan-out such as module-blueprints/fan-out-contexts or generate-product/fan-out-fill within `Workflows:Engine:MaxFanout`, when its branches end, then the join module-blueprints/join or generate-product/join-fill waits for every branch that ran, or for the declared quorum, treats a branch skipped by its `when` guard as satisfied, and exactly one step run exists per step and iteration (ADR-0027, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC4: Given a step run moved between two states of `StepRunState`, when the outbox dispatcher publishes `WorkflowEngineService/StepRunStateChanged` on `workflows.runs.v1.step-run-state-changed`, then the outbox record was written in the same transaction as the step-run row, the event is sent under the canonical envelope with `runId`, `tenantId`, `stepRunId`, `stepId`, `fromState` and `toState`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; given ArtifactService is unavailable when the Advance needs a recorded output, then the Advance fails, nothing is written and the event is redelivered (SCN-WorkflowEngineService-009, ADR-0012).",
        "AC5: Given a Running `WorkflowEngineService/WorkflowRun` whose last terminal step is settled Succeeded, when the Advance is applied, then the run moves to Completed through `TerminalStepsSucceeded` and `WorkflowEngineService/WorkflowRunCompleted` is written in the same transaction and published on `workflows.runs.v1.workflow-run-completed` under the canonical envelope with `runId`, `tenantId` and `outputRef`; a transport outage is retried with backoff without loss or duplicate, a later outcome for the Completed run changes nothing, and the engine wrote no state of the run in Run Control (SCN-WorkflowEngineService-012, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/module-blueprints.yaml",
        "model/workflows/generate-product.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2000",
        "AIFACTORY-TASK-2001",
        "AIFACTORY-TASK-2002",
        "AIFACTORY-TASK-2003"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5807,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "ArtifactService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun"
        ],
        "events": [
          "WorkflowEngineService/StepRunStateChanged",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunCompleted",
          "RunControlService/AttemptOutcomeRecorded",
          "RunControlService/StepSettled"
        ],
        "steps": [
          "vision-to-blueprint/check-valid",
          "architecture-decomposition/check-valid",
          "module-blueprints/fan-out-contexts",
          "module-blueprints/check-valid",
          "module-blueprints/join",
          "database-blueprint/check-valid",
          "generate-product/fan-out-fill",
          "generate-product/join-fill",
          "generate-product/check-build"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-03",
          "FR-10",
          "XL-06"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-009",
          "SCN-WorkflowEngineService-012"
        ]
      },
      "relates": {
        "screens": [
          "workflow-run-graph"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-499",
        "feature:run-control-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/module-blueprints.yaml",
        "model/workflows/generate-product.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-500]",
      "number": 500
    },
    {
      "id": "AIFACTORY-TASK-2000",
      "type": "task",
      "parent": "AIFACTORY-US-500",
      "title": "AdvanceOnOutcome and ApplyStepSettled inbox handlers and the Advance of the WorkflowRunGrain, advanced on StepSettled alone and idempotent on the outcome sequence and the event id",
      "sequence": "02.02.07.01",
      "description": "AdvanceOnOutcome and ApplyStepSettled inbox handlers and the Advance of the WorkflowRunGrain, advanced on StepSettled alone and idempotent on the outcome sequence and the event id. Expected output: The handlers of AttemptOutcomeRecorded and of StepSettled hand their events to the WorkflowRunGrain: an outcome is applied once on lastOutcomeSequence and only updates the projection, the attempt and its outcome recorded, with nothing computed and nothing announced; StepSettled is applied once on the event id, moves the step run it names by stepRunId to the final state it carries and writes attemptCount, failureClass and outputRef of the event on the step run with the stepId of Run Control; the run is advanced on StepSettled alone, an outcome moves no step run to a final state, and the two events of one step are handled in either order with the same result; once a step is settled Succeeded, whether its outcome was applied or not, the grain computes the next ready steps through the planner of AIFACTORY-TASK-197 and commits the step-run rows with StepRunStateChanged, StepReady and, at the last terminal step, WorkflowRunCompleted in one transaction; an event applied twice, an event for an unknown run and an event for a terminal run change nothing; an unavailable ArtifactService fails the Advance without a write; what follows a step settled Failed or Cancelled is delivered by AIFACTORY-US-501.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The handlers of AttemptOutcomeRecorded and of StepSettled hand their events to the WorkflowRunGrain: an outcome is applied once on lastOutcomeSequence and only updates the projection, the attempt and its outcome recorded, with nothing computed and nothing announced; StepSettled is applied once on the event id, moves the step run it names by stepRunId to the final state it carries and writes attemptCount, failureClass and outputRef of the event on the step run with the stepId of Run Control; the run is advanced on StepSettled alone, an outcome moves no step run to a final state, and the two events of one step are handled in either order with the same result; once a step is settled Succeeded, whether its outcome was applied or not, the grain computes the next ready steps through the planner of AIFACTORY-TASK-197 and commits the step-run rows with StepRunStateChanged, StepReady and, at the last terminal step, WorkflowRunCompleted in one transaction; an event applied twice, an event for an unknown run and an event for a terminal run change nothing; an unavailable ArtifactService fails the Advance without a write; what follows a step settled Failed or Cancelled is delivered by AIFACTORY-US-501."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5807,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2000]",
      "number": 2000
    },
    {
      "id": "AIFACTORY-TASK-2001",
      "type": "task",
      "parent": "AIFACTORY-US-500",
      "title": "Condition evaluation with bounded onFalse loops, when guards, fan-out and join",
      "sequence": "02.02.07.02",
      "description": "Condition evaluation with bounded onFalse loops, when guards, fan-out and join. Expected output: Conditions and guards are evaluated in the configured expression language over recorded outputs and run variables only, with no model or service call and no retry; onFalse returns to the named step with the feedback in a new iteration up to maxIterations or DefaultMaxLoopIterations; a guard that does not hold records the step Skipped; a fan-out creates at most MaxFanout branches and the join waits for every branch that ran or for the declared quorum and treats a skipped branch as satisfied; unit tests cover each rule on the nine steps this PBI traces.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Conditions and guards are evaluated in the configured expression language over recorded outputs and run variables only, with no model or service call and no retry; onFalse returns to the named step with the feedback in a new iteration up to maxIterations or DefaultMaxLoopIterations; a guard that does not hold records the step Skipped; a fan-out creates at most MaxFanout branches and the join waits for every branch that ran or for the declared quorum and treats a skipped branch as satisfied; unit tests cover each rule on the nine steps this PBI traces."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5807,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2001]",
      "number": 2001
    },
    {
      "id": "AIFACTORY-TASK-2002",
      "type": "task",
      "parent": "AIFACTORY-US-500",
      "title": "Acceptance fixture of a fake Run Control that consumes StepReady and records outcomes",
      "sequence": "02.02.07.03",
      "description": "Acceptance fixture of a fake Run Control that consumes StepReady and records outcomes. Expected output: A test double subscribes to StepReady, creates one step per stepRunId, keeps the failurePolicy the event carries and exposes what it received, so the engine scenarios run without RunControlService and a duplicated StepReady is visible as a single step; on request it publishes RunAccepted, RunCancelled, RunFailed and RunCompleted; for each attempt it publishes AttemptOutcomeRecorded with a scripted outcome (Succeeded, Failed, TimedOut, Cancelled or Uncertain) and failure class, and when its script lets a step reach its final state it publishes StepSettled with the stepRunId, its own stepId, the final state, the attempt count, for a failed step the failure class and, for a step whose settling attempt reported an output, the outputRef, before or after the outcome or without it as the script says; it holds the task contract reference and hash of every StepReady it received and exposes them; on WorkflowRunFailed it publishes RunFailed for the run, as Run Control does when the engine reports the end of a failed step; for a step that fails under Escalate, and for an Uncertain outcome on a step of class shared-write or above, it publishes no StepSettled and plays the operator decision instead, an ApprovalDecided with proposalKind operator-decision, the stepRunId, the choice retry, compensate or fail and, for an Uncertain outcome, the finding applied or not-applied, or its expiry, each followed by what Run Control does after it (a new attempt, StepSettled with the final state Failed, RunFailed); it answers RunControl.SubmitChildRun with one child run per idempotency key and exposes the submissions it received; it can keep every announced step of a run without an attempt, as Run Control does for a run that is Held or WaitingForApproval; for human steps it publishes ApprovalDecided in each state (Approved, Rejected, ChangesRequested, Expired followed by a re-request, Expired without one, Stale and Cancelled).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A test double subscribes to StepReady, creates one step per stepRunId, keeps the failurePolicy the event carries and exposes what it received, so the engine scenarios run without RunControlService and a duplicated StepReady is visible as a single step; on request it publishes RunAccepted, RunCancelled, RunFailed and RunCompleted; for each attempt it publishes AttemptOutcomeRecorded with a scripted outcome (Succeeded, Failed, TimedOut, Cancelled or Uncertain) and failure class, and when its script lets a step reach its final state it publishes StepSettled with the stepRunId, its own stepId, the final state, the attempt count, for a failed step the failure class and, for a step whose settling attempt reported an output, the outputRef, before or after the outcome or without it as the script says; it holds the task contract reference and hash of every StepReady it received and exposes them; on WorkflowRunFailed it publishes RunFailed for the run, as Run Control does when the engine reports the end of a failed step; for a step that fails under Escalate, and for an Uncertain outcome on a step of class shared-write or above, it publishes no StepSettled and plays the operator decision instead, an ApprovalDecided with proposalKind operator-decision, the stepRunId, the choice retry, compensate or fail and, for an Uncertain outcome, the finding applied or not-applied, or its expiry, each followed by what Run Control does after it (a new attempt, StepSettled with the final state Failed, RunFailed); it answers RunControl.SubmitChildRun with one child run per idempotency key and exposes the submissions it received; it can keep every announced step of a run without an attempt, as Run Control does for a run that is Held or WaitingForApproval; for human steps it publishes ApprovalDecided in each state (Approved, Rejected, ChangesRequested, Expired followed by a re-request, Expired without one, Stale and Cancelled)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5807,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2002]",
      "number": 2002
    },
    {
      "id": "AIFACTORY-TASK-2003",
      "type": "task",
      "parent": "AIFACTORY-US-500",
      "title": "Verify advance-a-workflow-run-on-recorded-outcomes through the acceptance suite",
      "sequence": "02.02.07.04",
      "description": "Verify advance-a-workflow-run-on-recorded-outcomes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-009|Scenario=SCN-WorkflowEngineService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-500 on the chain definitions, including the outcome and the StepSettled of a step in both orders, the StepSettled without its outcome that advances the run, the Succeeded outcome without its StepSettled that announces nothing, the attempt count and the output reference of StepSettled kept on the step run, the outcome applied twice, the bounded loop of each check step, the fan-out and join with a skipped branch, the single WorkflowRunCompleted and the publication and payload of StepRunStateChanged and WorkflowRunCompleted; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-009|Scenario=SCN-WorkflowEngineService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-500 on the chain definitions, including the outcome and the StepSettled of a step in both orders, the StepSettled without its outcome that advances the run, the Succeeded outcome without its StepSettled that announces nothing, the attempt count and the output reference of StepSettled kept on the step run, the outcome applied twice, the bounded loop of each check step, the fan-out and join with a skipped branch, the single WorkflowRunCompleted and the publication and payload of StepRunStateChanged and WorkflowRunCompleted; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5807,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2003]",
      "number": 2003
    },
    {
      "id": "AIFACTORY-US-501",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Fail a workflow run or compensate its succeeded steps by the failure policy each step declares, close a cancelled step run, and report the failure once",
      "sequence": "02.02.08",
      "description": "Every agent, tool and human step of a loaded definition declares its failure policy, Retry, Compensate, Escalate or Fail, and the engine applies the declared value: it copies `failurePolicy` of the step of the loaded `WorkflowDefinition` into `failurePolicy` of the `StepDefinition` and derives none. `RunControlService/AttemptOutcomeRecorded` reports one of five outcomes, and four of them are not a success. Each of the four is first the business of Run Control, as the invariants of its `Attempt` state (model/services/control-plane/RunControlService.yaml). A Failed attempt is retried below `maxAttempts` of the `Step` only when its failure class is transient and the side-effect class of the step is read or sandbox, or shared-write when the step declares an idempotency key (ADR-0014), both read from the `Step` that Run Control created from `StepReady`; any other Failed attempt fails the step terminally. A TimedOut attempt follows the lease reconciliation rule: the `LeaseExpiryReconciler` of Run Control settles the attempt of an expired lease as TimedOut and schedules the retry or the terminal failure, so a TimedOut outcome may be followed by a new attempt of the same step. An Uncertain outcome means that an external effect may have happened; it is never retried automatically when the side-effect class of the step is shared-write or above, and on such a step Run Control opens an operator decision for the Operator of the project. A Cancelled outcome is the settlement of an attempt of a run that Run Control is cancelling. The engine evaluates no retry rule and counts no attempts against a limit: `StepReady` carries no `maxAttempts` and `maxAttempts` of the `Step` comes from `RunControl:Retries:DefaultMaxAttempts` unless the release overrides it, so a second copy of the retry rule in the engine could disagree with the authority and is not built. The engine announces nothing for a retry and no longer guesses whether a Failed or TimedOut outcome was the last one. It learns that from `RunControlService/StepSettled`: Run Control publishes the event once per step, in the transaction that moves its `Step` to the final state, with the `stepRunId` the engine announced, the final state, the number of attempts and, for a failed step, the failure class of its last attempt; the step run keeps the two in `attemptCount` and `failureClass` (decision D121). A Failed or TimedOut outcome without a `StepSettled` changes the state of no step run, whether Run Control follows it with a new attempt or not. The inbox handler `ApplyStepSettled` applies the event once, idempotently on the event id, and for a step settled Failed the engine acts by the declared policy. Who ends the run is decided (decision D121): after a failed step Run Control only settles the step and fails nothing, its own transition of a run from Running to Failed on a terminally failed step is withdrawn, and the run stays Running there until the engine, which applies the failure policy of the step, Fail or Compensate, reports `WorkflowRunFailed`. With policy Fail the step run moves to Failed, the run moves from Running to Failed through `StepFailedWithFailPolicy`, and `WorkflowEngineService/WorkflowRunFailed` is written in the same transaction with `failedStepId`, the `failureClass` of `StepSettled` and `compensated` false. A step settled Failed under the policy Retry has its attempts spent, since Run Control settles it only when it retries no more, and the engine fails the run for it like for a step under Fail (decision D123): the step run moves to Failed, the run moves from Running to Failed through `StepFailedWithRetryPolicyAttemptsSpent`, and the same `WorkflowRunFailed` is written in the same transaction. That report alone fails the run: Run Control records Failed when it hears it and publishes `RunControlService/RunFailed`, which finds the projection of the engine already Failed and changes nothing. A step settled Cancelled moves its step run to Cancelled with `WorkflowEngineService/StepRunStateChanged`, announces no step and writes no `WorkflowRunFailed`, whatever policy the step declares: the run is closed by `RunCancelled` (AIFACTORY-US-503), so the single terminal report of a cancelled run is `WorkflowRunCancelled`. Two failures are not settled by rule and not by the engine. A step that fails terminally under the policy Escalate, and a step of class shared-write or above whose outcome is Uncertain whatever policy it declares, go to the operator decision of Run Control, and the step stays unsettled while the request is pending. The engine records the outcome on the step run, which stays open: it does not retry the step, announces nothing, fails nothing and writes no terminal event, and when Run Control later settles such a step Failed the engine applies no declared policy to it, because what follows is the choice of the Operator (AIFACTORY-US-646). A condition that is still false after its last allowed iteration fails the run through `StepFailedWithFailPolicy` with the recorded evidence. A run whose pinned release the engine refused at load fails at acceptance with an explicit reason, as the failure modes of the model state, and no step of it is ever announced. With policy Compensate a step settled Failed moves the run from Running to Compensating through `StepFailedWithCompensatePolicy`: the engine plans one `CompensationEntry` for each succeeded step that declares a compensation, in reverse completion order, writes `WorkflowEngineService/CompensationStarted` with the number of entries, and announces each compensation step through `StepReady` with the action class of the compensation step itself, so Run Control dispatches it like any other step. A step without a compensation leaves its sandbox output in place as evidence. The owner kept this rule (D133): a run compensates only when the failing step declares the failure policy Compensate or the Operator chooses compensate, a definition that promises a compensation declares Compensate on the steps that follow an effect, and the compensation of a step runs only after its effect is confirmed, which is why only succeeded steps get an entry; the engine derives no compensation from a definition otherwise. Each compensation step gets its task contract like an agent or tool step before it is announced (D125, AIFACTORY-US-746). While the compensation runs, the run stays Running in Run Control, which waits for the report of the engine and dispatches the compensation steps. When every entry is Compensated the run moves from Compensating to Failed through `CompensationCompletedOrFailed` and `WorkflowRunFailed` carries `compensated` true. When a compensation step fails, its entry is Failed, the run ends Failed with the failure class compensation and `compensated` false, the partially compensated effects stay listed on the run, no further automatic retry happens and an operator follow-up is raised, never silently. `connectsoft.factory.workflows.compensations` counts each compensation with its outcome. RunControlService records Failed with the reported class in its handler `FailRun`; StudioBff, DashboardService and AuditService consume the events in their own PBIs and increments. The same compensation plan is started by the choice compensate of an operator decision (AIFACTORY-US-646). The run failures that no failure policy of a step decides stay with Run Control, a denied budget, a rejected or expired approval, a retired environment and the operator decision among them; for those Run Control fails the run itself and the engine closes its projection on `RunFailed` (AIFACTORY-US-646). A `RunFailed` that reaches a run in Compensating finds no modelled transition and changes nothing. The following are not stated by the model and are reported to the owner. Whether the explicit reason of a refused release reaches Run Control through `WorkflowRunFailed` or through the answer of `PlanNextSteps` at acceptance is open, since a workflow run row needs a loaded definition. The failure class compensation is not among the six classes `RunFailed` of Run Control lists, and the failure class of a condition that is exhausted is not stated. The definitions declare `compensation` as free text while a `CompensationEntry` keeps a `compensationStepId`, so how the text resolves to a step is open; the fixture of this PBI names the id of a step of kind compensation. `failurePolicy` of a `StepDefinition` is not nullable although condition, timer, parallel and compensation steps declare none. And where the operator follow-up of a failed compensation is raised is not modelled. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun, WorkflowEngineService/WorkflowDefinitionVersion; events: WorkflowEngineService/WorkflowRunFailed, WorkflowEngineService/CompensationStarted, WorkflowEngineService/StepReady, WorkflowEngineService/StepRunStateChanged, RunControlService/AttemptOutcomeRecorded, RunControlService/StepSettled, RunControlService/RunFailed; adrs: ADR-0012, ADR-0014, ADR-0024; requirements: FR-10, XL-06; scenarios: SCN-WorkflowEngineService-011, SCN-WorkflowEngineService-013. Relates: screens: workflow-run-graph, run-detail; nfrs: NFR-05, NFR-06. Depends on: AIFACTORY-US-500, feature:run-control-service. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, model/schemas/workflow.schema.json, model/workflows/generate-product.yaml, docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running `WorkflowEngineService/WorkflowRun`, a step for which the `WorkflowEngineService/WorkflowDefinitionVersion` stores the declared failure policy Fail or Retry, and a `RunControlService/StepSettled` that names its step run with the final state Failed, an attempt count and a failure class, when the handler `ApplyStepSettled` runs, then the step run is Failed and keeps the `attemptCount` and the `failureClass` of the event, the run moves to Failed, through `StepFailedWithFailPolicy` for the policy Fail and through `StepFailedWithRetryPolicyAttemptsSpent` for the policy Retry, whose attempts are spent when the step is settled, and `WorkflowEngineService/WorkflowRunFailed` with `failedStepId`, the `failureClass` of the event and `compensated` false is written in the same transaction, the one report on which Run Control, which only settled the step, fails the run; a Failed or TimedOut outcome in `RunControlService/AttemptOutcomeRecorded` that no `StepSettled` follows, whether the fake dispatches a new attempt or not, changes the state of no step run and announces nothing, the engine counts no attempts against a limit, and no default policy is applied to an agent, tool or human step (SCN-WorkflowEngineService-013, ADR-0014).",
        "AC2: Given a Running run and a `RunControlService/StepSettled` with the final state Cancelled for one of its open step runs, when the handler `ApplyStepSettled` runs, then the step run moves to Cancelled with `WorkflowEngineService/StepRunStateChanged`, no `WorkflowEngineService/StepReady` and no `WorkflowEngineService/WorkflowRunFailed` is written under any declared policy, and the run stays open until the cancellation of the run closes it; given an outcome Uncertain in `RunControlService/AttemptOutcomeRecorded`, then it is recorded on the step run, the step run stays open until a `StepSettled` names it, the engine does not retry the step, nothing is announced and no terminal event is written, since the invariants of the attempt in model/services/control-plane/RunControlService.yaml send an Uncertain outcome on a step of class shared-write or above to the operator decision of Run Control (ADR-0014).",
        "AC3: Given the run failed, when the outbox dispatcher publishes `WorkflowEngineService/WorkflowRunFailed` on `workflows.runs.v1.workflow-run-failed`, then the event is sent under the canonical envelope with `runId`, `tenantId`, `failedStepId`, `failureClass` and `compensated`, a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, exactly one terminal event exists for the workflow run, and a later outcome for the Failed run, and the `RunControlService/RunFailed` that Run Control publishes when it hears the report, change nothing; given a condition that is still false after its last allowed iteration, then the event names the condition step with the recorded evidence and nothing is announced afterwards; given an accepted run whose pinned release the engine refused at load, then no step of it is announced and the run fails at acceptance with an explicit reason, as the failure modes of model/services/agent-mesh/WorkflowEngineService.yaml state (SCN-WorkflowEngineService-013, ADR-0012).",
        "AC4: Given the fixture definition of AIFACTORY-TASK-2006, a Running run with succeeded steps of which one declares a compensation step and one does not, and a step that declares the failure policy Compensate and that `RunControlService/StepSettled` names with the final state Failed, when the handler `ApplyStepSettled` runs, then the run moves to Compensating through `StepFailedWithCompensatePolicy`, one compensation entry is planned per succeeded step with a compensation step in reverse completion order, `WorkflowEngineService/CompensationStarted` with `runId`, `tenantId` and `entries` is written in the same transaction and published on `workflows.runs.v1.compensation-started` under the canonical envelope, retried on a transport outage without loss or duplicate, and each compensation step is announced through `WorkflowEngineService/StepReady` with its own action class (SCN-WorkflowEngineService-011).",
        "AC5: Given a Compensating `WorkflowEngineService/WorkflowRun`, when every compensation entry is Compensated, then the run moves to Failed through `CompensationCompletedOrFailed` and `WorkflowEngineService/WorkflowRunFailed` carries `compensated` true; when a compensation step fails, then its entry is Failed, the run ends Failed with the failure class compensation and `compensated` false, the partially compensated effects stay listed on the run, no further automatic retry happens, and `connectsoft.factory.workflows.compensations` counts the compensation with its outcome (SCN-WorkflowEngineService-011, SCN-WorkflowEngineService-013, FR-10)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/generate-product.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2004",
        "AIFACTORY-TASK-2005",
        "AIFACTORY-TASK-2006",
        "AIFACTORY-TASK-2007"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5808,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "WorkflowEngineService/WorkflowDefinitionVersion"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunFailed",
          "WorkflowEngineService/CompensationStarted",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/StepRunStateChanged",
          "RunControlService/AttemptOutcomeRecorded",
          "RunControlService/StepSettled",
          "RunControlService/RunFailed"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FR-10",
          "XL-06"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-011",
          "SCN-WorkflowEngineService-013"
        ]
      },
      "relates": {
        "screens": [
          "workflow-run-graph",
          "run-detail"
        ],
        "nfrs": [
          "NFR-05",
          "NFR-06"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-500",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/generate-product.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-501]",
      "number": 501
    },
    {
      "id": "AIFACTORY-TASK-2004",
      "type": "task",
      "parent": "AIFACTORY-US-501",
      "title": "Apply the declared failure policy of a step that StepSettled names Failed, leave an unsettled step open, and report WorkflowRunFailed once",
      "sequence": "02.02.08.01",
      "description": "Apply the declared failure policy of a step that StepSettled names Failed, leave an unsettled step open, and report WorkflowRunFailed once. Expected output: The Advance holds no retry rule and no attempt limit of its own and treats no step as settled on an outcome. When ApplyStepSettled names a step run with the final state Failed, it writes attemptCount and failureClass of the event on the step run, reads failurePolicy from the StepDefinition, where it was copied from the declared failurePolicy, and moves the step run to Failed and the run to Failed, for Fail through StepFailedWithFailPolicy and for Retry, whose attempts are spent when the step is settled, through StepFailedWithRetryPolicyAttemptsSpent, and writes WorkflowRunFailed with failedStepId, the failureClass of StepSettled and compensated false in the same transaction; that report is the one on which Run Control fails the run, since it only settled the step, and the RunFailed that follows it finds the projection Failed and changes nothing; a Failed or TimedOut outcome without StepSettled changes the state of no step run; a step settled Cancelled moves the step run to Cancelled with StepRunStateChanged and writes neither StepReady nor WorkflowRunFailed; an outcome Uncertain is recorded, is not retried and leaves the step run open; to a step settled Failed whose policy is Escalate, or whose last outcome on a step of class shared-write or above was Uncertain, no declared policy is applied, since AIFACTORY-US-646 follows the choice of the Operator; a condition false after its last iteration fails the run with its evidence, and a run whose pinned release the engine refused at load fails at acceptance with an explicit reason and gets no StepReady; at most one terminal event is written per workflow run.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The Advance holds no retry rule and no attempt limit of its own and treats no step as settled on an outcome. When ApplyStepSettled names a step run with the final state Failed, it writes attemptCount and failureClass of the event on the step run, reads failurePolicy from the StepDefinition, where it was copied from the declared failurePolicy, and moves the step run to Failed and the run to Failed, for Fail through StepFailedWithFailPolicy and for Retry, whose attempts are spent when the step is settled, through StepFailedWithRetryPolicyAttemptsSpent, and writes WorkflowRunFailed with failedStepId, the failureClass of StepSettled and compensated false in the same transaction; that report is the one on which Run Control fails the run, since it only settled the step, and the RunFailed that follows it finds the projection Failed and changes nothing; a Failed or TimedOut outcome without StepSettled changes the state of no step run; a step settled Cancelled moves the step run to Cancelled with StepRunStateChanged and writes neither StepReady nor WorkflowRunFailed; an outcome Uncertain is recorded, is not retried and leaves the step run open; to a step settled Failed whose policy is Escalate, or whose last outcome on a step of class shared-write or above was Uncertain, no declared policy is applied, since AIFACTORY-US-646 follows the choice of the Operator; a condition false after its last iteration fails the run with its evidence, and a run whose pinned release the engine refused at load fails at acceptance with an explicit reason and gets no StepReady; at most one terminal event is written per workflow run."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5808,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2004]",
      "number": 2004
    },
    {
      "id": "AIFACTORY-TASK-2005",
      "type": "task",
      "parent": "AIFACTORY-US-501",
      "title": "Compensation plan in reverse completion order with CompensationStarted and the terminal report",
      "sequence": "02.02.08.02",
      "description": "Compensation plan in reverse completion order with CompensationStarted and the terminal report. Expected output: For policy Compensate a step settled Failed moves the run to Compensating, one CompensationEntry is written per succeeded step that declares a compensation step in reverse completion order, CompensationStarted is written with the number of entries and each compensation step is announced through StepReady with its own action class; when all entries are Compensated the run moves to Failed with compensated true, and when a compensation step fails the entry is Failed and the run ends Failed with the failure class compensation, compensated false, the partially compensated effects listed and no further automatic retry; connectsoft.factory.workflows.compensations is emitted with tenant, definition and outcome.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "For policy Compensate a step settled Failed moves the run to Compensating, one CompensationEntry is written per succeeded step that declares a compensation step in reverse completion order, CompensationStarted is written with the number of entries and each compensation step is announced through StepReady with its own action class; when all entries are Compensated the run moves to Failed with compensated true, and when a compensation step fails the entry is Failed and the run ends Failed with the failure class compensation, compensated false, the partially compensated effects listed and no further automatic retry; connectsoft.factory.workflows.compensations is emitted with tenant, definition and outcome."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5808,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2005]",
      "number": 2005
    },
    {
      "id": "AIFACTORY-TASK-2006",
      "type": "task",
      "parent": "AIFACTORY-US-501",
      "title": "Fixture definitions that declare Fail, Retry and Compensate with a compensation step",
      "sequence": "02.02.08.03",
      "description": "Fixture definitions that declare Fail, Retry and Compensate with a compensation step. Expected output: The fixture set of AIFACTORY-TASK-1995 gains definitions of its own in the wire shape of WorkflowDefinition: a step with failurePolicy Fail and one with failurePolicy Retry; a step with failurePolicy Compensate that runs after two succeeded steps, of which one names in compensation the id of a step of kind compensation and one declares none; and a compensation step scripted to fail, so both ends of the compensation path are reachable in the acceptance suite; no definition of model/workflows is changed, since the six chain definitions plan no compensation entry of an earlier step.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The fixture set of AIFACTORY-TASK-1995 gains definitions of its own in the wire shape of WorkflowDefinition: a step with failurePolicy Fail and one with failurePolicy Retry; a step with failurePolicy Compensate that runs after two succeeded steps, of which one names in compensation the id of a step of kind compensation and one declares none; and a compensation step scripted to fail, so both ends of the compensation path are reachable in the acceptance suite; no definition of model/workflows is changed, since the six chain definitions plan no compensation entry of an earlier step."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5808,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2006]",
      "number": 2006
    },
    {
      "id": "AIFACTORY-TASK-2007",
      "type": "task",
      "parent": "AIFACTORY-US-501",
      "title": "Verify fail-or-compensate-a-workflow-run through the acceptance suite",
      "sequence": "02.02.08.04",
      "description": "Verify fail-or-compensate-a-workflow-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-011|Scenario=SCN-WorkflowEngineService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-501 with the scripts of the fake Run Control of AIFACTORY-TASK-2002: a StepSettled with the final state Failed under Fail and under Retry, each failing the run through its own transition, after a Failed and after a TimedOut last outcome, with the attempt count and the failure class of the event kept on the step run, the RunFailed the fake publishes after WorkflowRunFailed that changes nothing, a Failed and a TimedOut outcome without StepSettled that change nothing, with and without a new attempt, the step settled Cancelled that moves the step run to Cancelled without WorkflowRunFailed, the Uncertain outcome that leaves the step run open and is not retried, the policy read from the definition and never derived, the compensation in reverse order with compensated true, the failed compensation with compensated false and the publication and payload of CompensationStarted and WorkflowRunFailed; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-011|Scenario=SCN-WorkflowEngineService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-501 with the scripts of the fake Run Control of AIFACTORY-TASK-2002: a StepSettled with the final state Failed under Fail and under Retry, each failing the run through its own transition, after a Failed and after a TimedOut last outcome, with the attempt count and the failure class of the event kept on the step run, the RunFailed the fake publishes after WorkflowRunFailed that changes nothing, a Failed and a TimedOut outcome without StepSettled that change nothing, with and without a new attempt, the step settled Cancelled that moves the step run to Cancelled without WorkflowRunFailed, the Uncertain outcome that leaves the step run open and is not retried, the policy read from the definition and never derived, the compensation in reverse order with compensated true, the failed compensation with compensated false and the publication and payload of CompensationStarted and WorkflowRunFailed; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5808,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2007]",
      "number": 2007
    },
    {
      "id": "AIFACTORY-US-502",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Fire durable timers once, make a late timer a no-op, and recover a lost reminder or a lost announcement by reconciliation",
      "sequence": "02.02.09",
      "description": "As an operator, I want a waiting run to continue when its timer is due, and a run whose reminder or announcement was lost to be found and continued, so that no run stays stuck silently and no timer moves a run twice. A timer step and the timeout of a step are durable timers of the `WorkflowRun`. When the Advance reaches a timer step, the engine writes a `TimerEntry` with `timerId`, `stepRunId` and `dueAt`, moves the run from Running to WaitingForTimer through `TimerStepReached`, and the `WorkflowRunGrain` registers one Orleans reminder per pending entry. A step timeout is a `TimerEntry` of the same kind, due after the `timeout` the step declares or after `Workflows:Engine:DefaultStepTimeoutMinutes` when it declares none. The `TimerScheduler` applies a fired reminder to the run, idempotently on `timerId` and partitioned by run: the entry of a timer step is marked fired, a run in WaitingForTimer returns to Running through `TimerFired`, the next ready steps are computed, and `WorkflowEngineService/TimerFired` with `runId`, `tenantId`, `timerId` and `stepRunId` is written in the same transaction as the `StepReady` records of those steps. A fired timer that finds its step already advanced is a no-op: nothing is written and no event is published, so a late or duplicated reminder never moves a run twice. Reminders can be lost. The `StuckRunReconciler` runs on its schedule, partitioned by tenant and idempotent on `stepRunId` plus `lastOutcomeSequence`: it fires a due timer whose reminder did not fire, and for a Running workflow run older than the step timeout without progress it re-emits `StepReady` with the same `stepRunId` and, for an agent or tool step, the task contract reference the step run keeps in `taskContractRef` and the hash of the same contract, without writing the contract again (decision D123, AIFACTORY-US-746), for every active step run that has no recorded attempt outcome, which Run Control deduplicates; the re-emitted `StepReady` of a human step carries no reference, as its first one did; a step run of kind SubWorkflow, which no `StepReady` announced, is left to its child run (AIFACTORY-US-647). That is all it does. Neither the reconciler nor a step timeout fails a step run on its own. A step timeout that fires while its step run is still open marks its entry fired and leaves the step run to that rule; it advances nothing, so it writes no `TimerFired`, the event of a timer that advanced the run, and it moves neither the step run nor the run. The reason is the authority of Run Control. The engine does not hold the states Held and WaitingForApproval, which only RunControlService keeps: a step that waits there because the environment of the run is frozen, or because a step approval or a spend approval is pending, has no attempt for longer than any timeout the definitions declare. A re-emitted `StepReady` changes nothing in Run Control, while a step run failed by the engine would end in `WorkflowRunFailed` for a run that Run Control keeps waiting. The model describes the reconciler as finding active step runs with no corresponding open attempt or approval in Run Control and as re-emitting `StepReady` or failing the step per policy, but it gives the engine no read of the attempts, the approvals or the run state of Run Control. When the reconciler may fail a step, what a fired step timeout does beyond the rule above, and how either tells a wait in Run Control from a lost dispatch are therefore not stated and are reported to the owner. The same re-emission recovers a crash between applying the settlement of a step and emitting the `StepReady` it causes. `connectsoft.factory.workflows.timers_pending` moves with every entry created and fired, and `connectsoft.factory.workflows.step_latency` records the time from `StepReady` to a terminal step state. When the run is cancelled its pending timers are skipped (AIFACTORY-US-503). Kind: behavior. Traces: services: WorkflowEngineService; aggregates: WorkflowEngineService/WorkflowRun; events: WorkflowEngineService/TimerFired, WorkflowEngineService/StepReady; adrs: ADR-0012, ADR-0024; requirements: FR-10; scenarios: SCN-WorkflowEngineService-010. Relates: nfrs: NFR-06. Depends on: AIFACTORY-US-500. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/services/workflow-engine-service/index.md#workers-and-jobs, docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running `WorkflowEngineService/WorkflowRun` whose Advance reaches a timer step, when it is applied, then a timer entry with `timerId`, `stepRunId` and `dueAt` is written, the run moves to WaitingForTimer through `TimerStepReached` and one reminder is registered; when the reminder fires at `dueAt`, then the entry is marked fired, the run returns to Running through `TimerFired`, and `WorkflowEngineService/TimerFired` and the `WorkflowEngineService/StepReady` of every newly ready step are written in the same transaction (SCN-WorkflowEngineService-010).",
        "AC2: Given a timer fired, when the outbox dispatcher publishes `WorkflowEngineService/TimerFired` on `workflows.runs.v1.timer-fired`, then the outbox record was written in the same transaction as the fired entry, the event is sent under the canonical envelope with `runId`, `tenantId`, `timerId` and `stepRunId`, a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, and `connectsoft.factory.workflows.timers_pending` went down by one (SCN-WorkflowEngineService-010, ADR-0012).",
        "AC3: Given a timer whose step already advanced, the same `timerId` delivered twice, or a timer of a run that is Completed, Failed or Cancelled, when it fires, then nothing is written, no `WorkflowEngineService/TimerFired` is published and the run does not move, as the invariant of the `WorkflowEngineService/WorkflowRun` on fired timers requires (SCN-WorkflowEngineService-010, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC4: Given a due timer entry whose reminder was lost, when the `StuckRunReconciler` runs, then it fires the timer with the effect of AC1 exactly once; given a Running workflow run without progress beyond the step timeout, then for every active step run that has no recorded attempt outcome the reconciler re-emits `WorkflowEngineService/StepReady` with the same `stepRunId` and the task contract reference the step run keeps, which creates no second step in the fake Run Control and no second contract in the artifact store, it changes the state of no step run and fails none, and a second pass for the same `stepRunId` and `lastOutcomeSequence` changes nothing (SCN-WorkflowEngineService-010, FR-10, docs/planes/agent-runtime/services/workflow-engine-service/index.md).",
        "AC5: Given a run whose announced step the fake Run Control keeps without an attempt beyond the step timeout, as Run Control does for a run that is Held or WaitingForApproval, when the step timeout fires and the `StuckRunReconciler` runs, then the timeout entry is marked fired, no step run is Failed, no `WorkflowEngineService/TimerFired` and no terminal event is written, the `WorkflowEngineService/WorkflowRun` does not move, and when the fake later records the outcome the run advances as if nothing had fired (model/services/control-plane/RunControlService.yaml, ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#workers-and-jobs",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2008",
        "AIFACTORY-TASK-2009",
        "AIFACTORY-TASK-2010"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5809,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun"
        ],
        "events": [
          "WorkflowEngineService/TimerFired",
          "WorkflowEngineService/StepReady"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0024"
        ],
        "requirements": [
          "FR-10"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-010"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-06"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-500"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#workers-and-jobs",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-502]",
      "number": 502
    },
    {
      "id": "AIFACTORY-TASK-2008",
      "type": "task",
      "parent": "AIFACTORY-US-502",
      "title": "Timer entries, grain reminders and the TimerScheduler with TimerFired",
      "sequence": "02.02.09.01",
      "description": "Timer entries, grain reminders and the TimerScheduler with TimerFired. Expected output: A timer step and a step timeout write a TimerEntry and register one reminder of the WorkflowRunGrain; the TimerScheduler applies a fired reminder idempotently on timerId: for a timer step it marks the entry fired, returns a WaitingForTimer run to Running, computes the next ready steps and writes TimerFired with their StepReady records in one transaction; a step timeout that fires on a step run that is still open marks its entry fired, fails nothing and writes no event; a timer whose step advanced, a duplicate and a timer of a terminal run are no-ops; connectsoft.factory.workflows.timers_pending and step_latency are emitted with their modelled dimensions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A timer step and a step timeout write a TimerEntry and register one reminder of the WorkflowRunGrain; the TimerScheduler applies a fired reminder idempotently on timerId: for a timer step it marks the entry fired, returns a WaitingForTimer run to Running, computes the next ready steps and writes TimerFired with their StepReady records in one transaction; a step timeout that fires on a step run that is still open marks its entry fired, fails nothing and writes no event; a timer whose step advanced, a duplicate and a timer of a terminal run are no-ops; connectsoft.factory.workflows.timers_pending and step_latency are emitted with their modelled dimensions."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5809,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2008]",
      "number": 2008
    },
    {
      "id": "AIFACTORY-TASK-2009",
      "type": "task",
      "parent": "AIFACTORY-US-502",
      "title": "StuckRunReconciler firing due timers and re-emitting StepReady for step runs without a recorded outcome",
      "sequence": "02.02.09.02",
      "description": "StuckRunReconciler firing due timers and re-emitting StepReady for step runs without a recorded outcome. Expected output: The scheduled worker, partitioned by tenant with the fixed retry policy of three attempts, fires every due TimerEntry of a timer step that is not fired, and for Running workflow runs without progress beyond the step timeout re-emits StepReady with the same stepRunId, the task contract reference kept in TaskContractRef of the step run and the hash of the same contract, through the announcing path of AIFACTORY-TASK-3011, which stores nothing again on a re-emission and sends the StepReady of a human step without a reference, for every active step run that has no recorded attempt outcome, a step run of kind SubWorkflow excepted, which no StepReady announced; it changes the state of no step run and fails none, since the model gives the engine no read of the run state of Run Control; it is idempotent on stepRunId plus lastOutcomeSequence, so a second pass changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The scheduled worker, partitioned by tenant with the fixed retry policy of three attempts, fires every due TimerEntry of a timer step that is not fired, and for Running workflow runs without progress beyond the step timeout re-emits StepReady with the same stepRunId, the task contract reference kept in TaskContractRef of the step run and the hash of the same contract, through the announcing path of AIFACTORY-TASK-3011, which stores nothing again on a re-emission and sends the StepReady of a human step without a reference, for every active step run that has no recorded attempt outcome, a step run of kind SubWorkflow excepted, which no StepReady announced; it changes the state of no step run and fails none, since the model gives the engine no read of the run state of Run Control; it is idempotent on stepRunId plus lastOutcomeSequence, so a second pass changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5809,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2009]",
      "number": 2009
    },
    {
      "id": "AIFACTORY-TASK-2010",
      "type": "task",
      "parent": "AIFACTORY-US-502",
      "title": "Verify fire-durable-timers-and-recover-stuck-runs through the acceptance suite",
      "sequence": "02.02.09.03",
      "description": "Verify fire-durable-timers-and-recover-stuck-runs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WorkflowEngineService-010\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-502 with a controllable clock, including the timer fired once, the late and the duplicated timer as no-ops, the lost reminder fired by the reconciler, the re-emitted StepReady that carries the task contract reference of its step run and that the fake Run Control of AIFACTORY-TASK-2002 receives as one step, the case of a run the fake keeps Held beyond the step timeout, in which no step run is Failed and no WorkflowRunFailed is written, and the publication and payload of TimerFired; consumer handling is proven by the suite of DashboardService in its increment.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WorkflowEngineService-010\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-502 with a controllable clock, including the timer fired once, the late and the duplicated timer as no-ops, the lost reminder fired by the reconciler, the re-emitted StepReady that carries the task contract reference of its step run and that the fake Run Control of AIFACTORY-TASK-2002 receives as one step, the case of a run the fake keeps Held beyond the step timeout, in which no step run is Failed and no WorkflowRunFailed is written, and the publication and payload of TimerFired; consumer handling is proven by the suite of DashboardService in its increment."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5809,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2010]",
      "number": 2010
    },
    {
      "id": "AIFACTORY-US-503",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Wait for the decision of a human step, apply it as Run Control recorded it, and close the projection when the run is cancelled",
      "sequence": "02.02.10",
      "description": "As a reviewer, I want my recorded decision on a human step to move the workflow exactly once, and a cancelled run to stop planning, so that the engine never advances on a decision I did not take and never announces a step of a run that was cancelled. Until I4 a human step is always a decision (D133). When the Advance reaches a human step, the engine announces it through `StepReady` with kind Human and moves the run from Running to WaitingForHuman through `HumanStepReached`. A human step has no task contract: the engine stores none for it, its `StepReady` carries neither `taskContractRef` nor `taskContractHash`, and its step run keeps no reference (decision D123). `actionClass` of that `StepReady` is, as for every step (AIFACTORY-US-499), the side-effect class the step declares in the pinned definition; the action class of the approval binding of the step is read by Run Control for the `ApprovalRequest`, which RunControlService opens for the exact proposal in its handler `CreateStepAndDispatch`. The engine opens no approval and decides nothing. The owner decided that from I4 a human step may carry a policy guard, as generate-product/approve-proposal and project-bootstrap/approve-shared-write declare it: the engine then asks PolicyEngineService before it announces the step, and an allow records the step run Skipped, emits no `StepReady`, opens no approval and advances the run, while any other answer announces the step as here (D133). This I1 delivery keeps the guard of a loaded definition in `PolicyGuardJson` of its step definition and evaluates none, so the approval of every human step runs. A human step that waits on the promotion gate of EnvironmentPromotionService opens no approval and is announced by no `StepReady`; that wait is delivered by AIFACTORY-US-1496. RunControlService publishes every decision as `RunControlService/ApprovalDecided` with `approvalId`, the subject as `subjectKind` and `subjectId`, `runId` when the subject is a run or belongs to one (D135), `state`, `decidedBy`, `reason` and the proposal hash, and the state is one of Approved, Rejected, ChangesRequested, Expired, Stale and Cancelled. The inbox handler `AdvanceOnDecision` applies a decision to the human step run it belongs to, idempotently on the event id. An Approved decision completes the human step as Succeeded, returns the run from WaitingForHuman to Running through `DecisionApplied`, and the next ready steps are announced. A Rejected decision fails the human step, and the failure policy the step declares decides what follows (AIFACTORY-US-501): with policy Fail the engine reports `WorkflowRunFailed` with the failure class policy-denied, the class a run failed by a rejected or expired approval carries (ADR-0014), and Run Control, which failed the run through its own transition, takes the report as a duplicate that changes nothing; the `RunFailed` it publishes for that run finds the projection already Failed, and a Rejected decision that arrives after `RunFailed` closed the projection changes nothing either (AIFACTORY-US-646). A ChangesRequested decision returns the run to Running in Run Control with the reason of the reviewer; the engine applies it by leaving WaitingForHuman through `DecisionApplied` without completing the step as Succeeded and without failing the run. An Expired, a Stale and a Cancelled decision change nothing in the engine: the step run keeps waiting and the run stays WaitingForHuman. Run Control settles an expired request by the on-expiry rule of the approval policy in the pinned policy revision of the run, fail or re-request up to its limit, and publishes `ApprovalDecided` with the state Expired in both cases; after a re-request the run stays WaitingForApproval with a new Pending request, so an engine that failed the step on Expired would report `WorkflowRunFailed` for a run that Run Control keeps waiting. A Stale request is followed by a new request for the current proposal hash, and a Cancelled request belongs to a run that was cancelled or failed; the model says that an expired or stale decision never advances the run. When an expiry was final, Run Control fails the run itself with the failure class policy-denied and publishes `RunFailed`; the engine hears it and closes its projection as Failed without a `WorkflowRunFailed` of its own (AIFACTORY-US-646). A decision whose `proposalKind` is operator-decision is no decision on a human step: it names its step run in `stepRunId`, carries the `choice` of the Operator, and the same handler applies it as AIFACTORY-US-646 specifies. Any other decision that belongs to no human step run of the projection changes nothing in the engine. That is the case for the approval a lease holder requested for a gated action inside an agent or tool step, where the reason of the reviewer goes back to the lease holder and the run is WaitingForApproval only in Run Control, and for the run-level spend approval that precedes the budget reservation, and it is the case for a decision whose subject is no run, such as a provisioning run, an evaluation run or an asset release, which belongs to the service that owns the subject (D135); a decision of subject kind promotion is applied only to a human step that waits on that gate (AIFACTORY-US-1496). The same event feeds the readiness correlation in a separate handler (AIFACTORY-US-505). The engine also follows cancellation without owning it. RunControlService records the intent, settles the attempts and publishes `RunControlService/RunCancelled`; the handler `CancelWorkflowRun` then closes the projection: the run moves to Cancelled from Running, WaitingForTimer or WaitingForHuman, every open step run moves to Cancelled, pending timers are skipped so that a reminder that still fires is a no-op, and `WorkflowEngineService/WorkflowRunCancelled` is written in the same transaction with the number of step runs that were open. A step run that a `StepSettled` with the final state Cancelled already closed (AIFACTORY-US-501) is not counted again. A cancellation for a run that is already Completed, Failed or Cancelled, or that the projection does not hold, changes nothing; a Compensating run has no cancel transition in the model and finishes its compensation. When the cancelled run is the child run of a step of kind SubWorkflow, a second handler of the same event returns the cancellation to the parent step run (AIFACTORY-US-647). Three points are not stated by the model and are reported to the owner: `ApprovalDecided` names a step run in `stepRunId` only for an operator decision, and nothing tells the engine the `approvalId` of the request Run Control opened for a human step, so the match of a decision on a human step to its step run has no modelled key; which step becomes ready after a ChangesRequested decision on a human step, where no lease holder regenerates the proposal; and `StepReady` does not carry the approval binding, while a human step declares both a side-effect class and the action class of its binding, which the schema lets differ. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun, RunControlService/ApprovalRequest; events: WorkflowEngineService/WorkflowRunCancelled, WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/ApprovalDecided, RunControlService/RunCancelled; steps: generate-product/approve-proposal; adrs: ADR-0012, ADR-0014; requirements: FR-06, FR-10, FUX-05, XL-05; scenarios: SCN-WorkflowEngineService-014. Relates: screens: workflow-run-graph; nfrs: NFR-05. Depends on: AIFACTORY-US-500, AIFACTORY-US-501, AIFACTORY-US-502, feature:run-control-service. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, model/workflows/generate-product.yaml, docs/planes/agent-runtime/services/workflow-engine-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a Running `WorkflowEngineService/WorkflowRun` whose Advance reaches a human step with its approval binding, such as generate-product/approve-proposal, when it is applied, then `WorkflowEngineService/StepReady` with kind Human, `actionClass` equal to the side-effect class the step declares and neither `taskContractRef` nor `taskContractHash` is written, no task contract is stored for the step, the run moves to WaitingForHuman through `HumanStepReached` in the same transaction, and the engine opens no `RunControlService/ApprovalRequest` of its own; the action class of the binding is read by Run Control for that request; the step is announced the same way although it declares a policy guard from I4, which this delivery keeps and does not evaluate (D133, FR-06, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC2: Given a WaitingForHuman run and a `RunControlService/ApprovalDecided` for its human step, when the handler `AdvanceOnDecision` runs, then an Approved decision completes the step run as Succeeded, returns the run to Running through `DecisionApplied` and announces the next ready steps; a Rejected decision fails the step run and the declared failure policy applies, policy Fail giving `WorkflowEngineService/WorkflowRunFailed` with the failure class policy-denied; a ChangesRequested decision leaves WaitingForHuman through `DecisionApplied` with the step run not Succeeded and the run not failed; and a redelivery of the same event id changes nothing (ADR-0014, FUX-05, XL-05).",
        "AC3: Given a WaitingForHuman run and a `RunControlService/ApprovalDecided` with the state Expired, Stale or Cancelled for its human step, when the handler runs, then the step run keeps waiting, the run stays WaitingForHuman, nothing is announced and no `WorkflowEngineService/WorkflowRunFailed` is written, because Run Control may re-request an expired approval by its on-expiry rule and an expired or stale decision never advances the run, and an Approved decision that follows a re-request completes the step; given a decision of any state that belongs to no human step run of the projection and is no operator decision, as for an approval requested by a lease holder or a spend approval of the run, then nothing changes in the engine and nothing is published (model/services/control-plane/RunControlService.yaml).",
        "AC4: Given a `WorkflowEngineService/WorkflowRun` that is Running, WaitingForTimer or WaitingForHuman and a `RunControlService/RunCancelled` for its `runId`, when the handler `CancelWorkflowRun` runs, then the run moves to Cancelled, every open step run moves to Cancelled, pending timers are skipped, and `WorkflowEngineService/WorkflowRunCancelled` with `runId`, `tenantId` and `openStepRuns` is written in the same transaction (SCN-WorkflowEngineService-014, FR-10).",
        "AC5: Given the projection was closed, when the outbox dispatcher publishes `WorkflowEngineService/WorkflowRunCancelled` on `workflows.runs.v1.workflow-run-cancelled`, then the event is sent under the canonical envelope with `runId`, `tenantId` and `openStepRuns`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; a cancellation for a run already Completed, Failed or Cancelled or unknown to the projection, a redelivery, and a timer that fires after the cancellation change nothing (SCN-WorkflowEngineService-014, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/generate-product.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2011",
        "AIFACTORY-TASK-2012",
        "AIFACTORY-TASK-2013"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5810,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "RunControlService/ApprovalRequest"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCancelled",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunCancelled"
        ],
        "steps": [
          "generate-product/approve-proposal"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-06",
          "FR-10",
          "FUX-05",
          "XL-05"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-014"
        ]
      },
      "relates": {
        "screens": [
          "workflow-run-graph"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-500",
        "AIFACTORY-US-501",
        "AIFACTORY-US-502",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/generate-product.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-503]",
      "number": 503
    },
    {
      "id": "AIFACTORY-TASK-2011",
      "type": "task",
      "parent": "AIFACTORY-US-503",
      "title": "Human step announcement and the AdvanceOnDecision inbox handler",
      "sequence": "02.02.10.01",
      "description": "Human step announcement and the AdvanceOnDecision inbox handler. Expected output: A human step is announced through StepReady with kind Human and, as actionClass, the side-effect class the step declares, without a task contract and so without taskContractRef and taskContractHash, and moves the run to WaitingForHuman; the handler of ApprovalDecided applies a decision to the human step run it belongs to, idempotently on the event id: Approved completes the step and announces the next ready steps, Rejected fails the step under its declared failure policy, ChangesRequested leaves WaitingForHuman without completing or failing, an Expired decision, whether Run Control re-requests the approval or not, a Stale and a Cancelled decision leave the step run waiting and change nothing, and a decision that belongs to no human step run of the projection and is no operator decision changes nothing, a decision whose subject is no run among them (D135); a decision whose proposalKind is operator-decision is applied by the same handler as AIFACTORY-US-646 delivers it; a human step whose definition declares a policy guard is announced like any human step, the guard being kept in PolicyGuardJson and not evaluated before I4 (D133).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A human step is announced through StepReady with kind Human and, as actionClass, the side-effect class the step declares, without a task contract and so without taskContractRef and taskContractHash, and moves the run to WaitingForHuman; the handler of ApprovalDecided applies a decision to the human step run it belongs to, idempotently on the event id: Approved completes the step and announces the next ready steps, Rejected fails the step under its declared failure policy, ChangesRequested leaves WaitingForHuman without completing or failing, an Expired decision, whether Run Control re-requests the approval or not, a Stale and a Cancelled decision leave the step run waiting and change nothing, and a decision that belongs to no human step run of the projection and is no operator decision changes nothing, a decision whose subject is no run among them (D135); a decision whose proposalKind is operator-decision is applied by the same handler as AIFACTORY-US-646 delivers it; a human step whose definition declares a policy guard is announced like any human step, the guard being kept in PolicyGuardJson and not evaluated before I4 (D133)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5810,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2011]",
      "number": 2011
    },
    {
      "id": "AIFACTORY-TASK-2012",
      "type": "task",
      "parent": "AIFACTORY-US-503",
      "title": "CancelWorkflowRun inbox handler closing the projection with WorkflowRunCancelled",
      "sequence": "02.02.10.02",
      "description": "CancelWorkflowRun inbox handler closing the projection with WorkflowRunCancelled. Expected output: The handler of RunCancelled moves a Running, WaitingForTimer or WaitingForHuman workflow run to Cancelled, moves every open step run to Cancelled, skips pending timers and writes WorkflowRunCancelled with the number of open step runs in the same transaction, idempotently on the event id; a cancellation for a terminal or unknown run changes nothing, and connectsoft.factory.workflows.runs_active moves with the state.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The handler of RunCancelled moves a Running, WaitingForTimer or WaitingForHuman workflow run to Cancelled, moves every open step run to Cancelled, skips pending timers and writes WorkflowRunCancelled with the number of open step runs in the same transaction, idempotently on the event id; a cancellation for a terminal or unknown run changes nothing, and connectsoft.factory.workflows.runs_active moves with the state."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5810,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2012]",
      "number": 2012
    },
    {
      "id": "AIFACTORY-TASK-2013",
      "type": "task",
      "parent": "AIFACTORY-US-503",
      "title": "Verify apply-decisions-and-close-on-cancellation through the acceptance suite",
      "sequence": "02.02.10.03",
      "description": "Verify apply-decisions-and-close-on-cancellation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WorkflowEngineService-014\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-503 against the fake Run Control of AIFACTORY-TASK-2002, including the Approved, Rejected and ChangesRequested decisions on a human step, the Expired decision followed by a re-request and a later Approved decision, the Expired decision without a re-request, the Stale and the Cancelled decision, each of which leaves the step run waiting and writes no WorkflowRunFailed, the decision of a lease-holder approval and of a spend approval that change nothing, the cancellation from each of the three states, the late timer as a no-op and the publication and payload of WorkflowRunCancelled; consumer handling is proven by the suite of DashboardService in its increment.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WorkflowEngineService-014\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-503 against the fake Run Control of AIFACTORY-TASK-2002, including the Approved, Rejected and ChangesRequested decisions on a human step, the Expired decision followed by a re-request and a later Approved decision, the Expired decision without a re-request, the Stale and the Cancelled decision, each of which leaves the step run waiting and writes no WorkflowRunFailed, the decision of a lease-holder approval and of a spend approval that change nothing, the cancellation from each of the three states, the late timer as a no-op and the publication and payload of WorkflowRunCancelled; consumer handling is proven by the suite of DashboardService in its increment."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5810,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2013]",
      "number": 2013
    },
    {
      "id": "AIFACTORY-US-1496",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Let a human step wait on the approval of the promotion gate of EnvironmentPromotionService instead of opening an approval of its own",
      "sequence": "02.02.11",
      "description": "As a reviewer, I want to give one production approval, on the promotion gate, and have the workflow follow it, so that a production release is never approved twice, once in the workflow and once on the promotion, and never on two different decisions. The owner decided that a person gives one production approval: the gate of EnvironmentPromotionService, bound to the release id and the environment, and that the workflow step approve-production of the release and delivery-run definitions waits on that approval (D133). Such a human step declares in its definition that it waits on the promotion gate, which the engine keeps in `WaitsOn` of its step definition. When the Advance reaches it, the engine opens no approval, emits no `StepReady` for it, so Run Control opens no approval request for it either, records the step run as waiting and moves the run from Running to WaitingForHuman through `HumanStepReached`. The approval of the gate is requested by EnvironmentPromotionService with its own service identity for the promotion the earlier step of the run requested, and RunControlService announces the decision as `RunControlService/ApprovalDecided` with the subject kind promotion and the promotion as subject (D135). The inbox handler `AdvanceOnDecision` applies such a decision to the step that waits on it, idempotently on the event id: an Approved gate completes the step run as Succeeded, returns the run to Running through `DecisionApplied` and the next ready steps are announced; a Rejected or an Expired gate fails the step run with the failure class policy-denied and the failure policy the step declares applies, Fail for both definitions, so `WorkflowEngineService/WorkflowRunFailed` is written (AIFACTORY-US-501). As a design choice of this PBI a ChangesRequested, a Stale and a Cancelled decision of the gate leave the step waiting, as for every human step. The decision is matched to the waiting step by the run of the event and by the promotion id that the output of the step which requested the promotion recorded, request-promotion of delivery-run among them, compared with the subject id of the event; the model binds the gate to the release id and the environment and does not name that key, which is reported to the owner. A decision of subject kind promotion that matches no waiting step changes nothing. A step whose `when` guard does not hold, approve-production of delivery-run for a target that is not production, is recorded Skipped as every guarded step and waits on nothing. Cancellation and the stuck-run recovery treat the waiting step as any open human step run (AIFACTORY-US-503, AIFACTORY-US-502); no `StepReady` is ever re-emitted for it. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun; events: RunControlService/ApprovalDecided, RunControlService/RunCancelled, WorkflowEngineService/StepReady, WorkflowEngineService/StepRunStateChanged, WorkflowEngineService/WorkflowRunFailed; steps: release/approve-production, delivery-run/approve-production; adrs: ADR-0014; requirements: FR-06. Depends on: AIFACTORY-US-501, AIFACTORY-US-502, AIFACTORY-US-503, feature:run-control-service. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/workflows/release.yaml, model/workflows/delivery-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a Running `WorkflowEngineService/WorkflowRun` of a fixture definition shaped like release/approve-production, whose Advance reaches a human step that waits on the promotion gate, when it is applied, then no `WorkflowEngineService/StepReady` is written for the step, no task contract is stored, the step run is recorded as waiting with its `WaitsOn`, and the run moves to WaitingForHuman through `HumanStepReached` in the same transaction (D133, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC2: Given that wait and a `RunControlService/ApprovalDecided` with the subject kind promotion, the run of the step and the promotion id the earlier step recorded, when `AdvanceOnDecision` runs, then an Approved gate completes the step run as Succeeded, returns the run to Running through `DecisionApplied` and announces the next ready steps; a Rejected or an Expired gate fails the step run with the failure class policy-denied and, under the failure policy Fail, `WorkflowEngineService/WorkflowRunFailed` is written; a redelivery of the same event id changes nothing (D133, ADR-0014).",
        "AC3: Given that wait, when a `RunControlService/ApprovalDecided` of the gate with the state ChangesRequested, Stale or Cancelled, or one of subject kind promotion for another promotion, arrives, then the step run keeps waiting, the run stays WaitingForHuman and nothing is published; given a decision of subject kind run for the run, which belongs to no step that waits on the gate, then the step is not completed by it (D135, model/services/control-plane/RunControlService.yaml).",
        "AC4: Given a fixture definition shaped like delivery-run/approve-production whose `when` guard does not hold, when the Advance reaches the step, then it is recorded Skipped with `WorkflowEngineService/StepRunStateChanged` and its dependants treat it as satisfied; given a waiting run that `RunControlService/RunCancelled` names, then the step run is cancelled as AIFACTORY-US-503 states, and the stuck-run recovery re-emits no `WorkflowEngineService/StepReady` for the waiting step (FR-06, model/workflows/delivery-run.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/workflows/release.yaml",
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6080",
        "AIFACTORY-TASK-6081",
        "AIFACTORY-TASK-6082"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5811,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun"
        ],
        "events": [
          "RunControlService/ApprovalDecided",
          "RunControlService/RunCancelled",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/StepRunStateChanged",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "steps": [
          "release/approve-production",
          "delivery-run/approve-production"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-501",
        "AIFACTORY-US-502",
        "AIFACTORY-US-503",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/workflows/release.yaml",
        "model/workflows/delivery-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1496]",
      "number": 1496
    },
    {
      "id": "AIFACTORY-TASK-6080",
      "type": "task",
      "parent": "AIFACTORY-US-1496",
      "title": "Wait of a human step on the promotion gate in the planner and in AdvanceOnDecision",
      "sequence": "02.02.11.01",
      "description": "Wait of a human step on the promotion gate in the planner and in AdvanceOnDecision. Expected output: The planner records a human step whose definition declares waits_on the promotion gate as a waiting step run, keeps the gate in the WaitsOn column of the step definition, writes no StepReady and stores no task contract for it and moves the run to WaitingForHuman; AdvanceOnDecision matches an ApprovalDecided of subject kind promotion to that step by the run and by the promotion id the output of the requesting step recorded, completes it on Approved, fails it with the failure class policy-denied on Rejected and Expired under its declared failure policy, leaves it waiting on ChangesRequested, Stale and Cancelled and on a decision for another promotion, idempotently on the event id; the StuckRunReconciler re-emits nothing for such a step (D133).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The planner records a human step whose definition declares waits_on the promotion gate as a waiting step run, keeps the gate in the WaitsOn column of the step definition, writes no StepReady and stores no task contract for it and moves the run to WaitingForHuman; AdvanceOnDecision matches an ApprovalDecided of subject kind promotion to that step by the run and by the promotion id the output of the requesting step recorded, completes it on Approved, fails it with the failure class policy-denied on Rejected and Expired under its declared failure policy, leaves it waiting on ChangesRequested, Stale and Cancelled and on a decision for another promotion, idempotently on the event id; the StuckRunReconciler re-emits nothing for such a step (D133)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5811,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6080]",
      "number": 6080
    },
    {
      "id": "AIFACTORY-TASK-6081",
      "type": "task",
      "parent": "AIFACTORY-US-1496",
      "title": "Fixture definitions of a human step that waits on the promotion gate",
      "sequence": "02.02.11.02",
      "description": "Fixture definitions of a human step that waits on the promotion gate. Expected output: The acceptance suite holds two fixture definitions in the shape of WorkflowDefinition, one with a human step that waits on the promotion gate after a step whose output records a promotion id, as release/approve-production, and one where that step carries a when guard on a production target, as delivery-run/approve-production, with decision scripts of the fake Run Control that publish ApprovalDecided of subject kind promotion in each state, for the matching promotion and for another one.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The acceptance suite holds two fixture definitions in the shape of WorkflowDefinition, one with a human step that waits on the promotion gate after a step whose output records a promotion id, as release/approve-production, and one where that step carries a when guard on a production target, as delivery-run/approve-production, with decision scripts of the fake Run Control that publish ApprovalDecided of subject kind promotion in each state, for the matching promotion and for another one."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5811,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6081]",
      "number": 6081
    },
    {
      "id": "AIFACTORY-TASK-6082",
      "type": "task",
      "parent": "AIFACTORY-US-1496",
      "title": "Verify wait-on-the-promotion-gate through the acceptance suite",
      "sequence": "02.02.11.03",
      "description": "Verify wait-on-the-promotion-gate through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=PromotionGateWait\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1496 with the fixtures of AIFACTORY-TASK-6081: no StepReady for the waiting step, the Approved gate that completes it, the Rejected and the Expired gate that fail the run, the states and the other promotion that leave it waiting, the redelivery, the Skipped step of a target that is not production, the cancellation and the stuck-run recovery that re-emits nothing.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=PromotionGateWait\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1496 with the fixtures of AIFACTORY-TASK-6081: no StepReady for the waiting step, the Approved gate that completes it, the Rejected and the Expired gate that fail the run, the states and the other promotion that leave it waiting, the redelivery, the Skipped step of a target that is not production, the cancellation and the stuck-run recovery that re-emits nothing."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5811,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6082]",
      "number": 6082
    },
    {
      "id": "AIFACTORY-US-646",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Leave an escalated or uncertain step to the decision of the Operator, compensate when the Operator chooses it, and close the projection of a run that Run Control failed",
      "sequence": "02.02.12",
      "description": "As an operator, I want the engine to wait for my choice on a step that failed under Escalate or ended Uncertain on a write step, and then to do exactly what I chose, so that no write is repeated blindly and no run is failed or compensated without my decision. A step that fails terminally under the failure policy Escalate is not settled by rule, and neither is a step of class shared-write or above whose attempt ends Uncertain, whatever policy that step declares. For both RunControlService opens an operator decision for the Operator of the project: an `ApprovalRequest` of kind operator-decision that Run Control opens itself, that names the run and the step and that is decided with one of the choices retry, compensate and fail. While the request is pending the run waits in WaitingForApproval in Run Control and the step is not settled, so no `RunControlService/StepSettled` arrives for it (model/services/control-plane/RunControlService.yaml). Run Control knows the policy because `StepReady` carries `failurePolicy` (AIFACTORY-US-499). Opening, deciding and expiring the request is the delivery of feature `run-control-service`; this PBI delivers the side of the engine, which decides nothing here and follows the decision it hears. While the decision is pending the engine keeps the Failed, TimedOut or Uncertain outcome on the step run, which stays open (AIFACTORY-US-501). It does not retry the step, re-emits no `StepReady` for it, since its reconciler re-emits only for step runs without a recorded outcome (AIFACTORY-US-502), starts no compensation, fails no step run and writes no terminal event, and the `WorkflowRun` keeps its state: the engine has no state of its own for this wait, as it has none for Held. After the choice retry Run Control dispatches a new attempt of the same step; its outcome and its `StepSettled` arrive as any other and are applied as AIFACTORY-US-500 and AIFACTORY-US-501 specify, and the `RunControlService/ApprovalDecided` that carries the choice retry changes nothing in the engine by itself. After the choice compensate Run Control publishes `ApprovalDecided` with `proposalKind` operator-decision, `choice` compensate and the `stepRunId` of the step the decision is about, and settles the step Failed. The inbox handler `AdvanceOnDecision` reads the choice, idempotently on the event id, and starts the compensation of the run for that step run: the run moves from Running to Compensating through `OperatorChoseCompensate`, one `CompensationEntry` is planned for each succeeded step that declares a compensation step, in reverse completion order, `WorkflowEngineService/CompensationStarted` is written in the same transaction, each compensation step is announced through `StepReady`, and the compensation ends as AIFACTORY-US-501 specifies, with `WorkflowEngineService/WorkflowRunFailed` as the terminal report of the engine. The `StepSettled` with the final state Failed that Run Control publishes for the same step moves the step run to Failed, whichever of the two events arrives first, and the engine applies no declared policy to it: after the choice compensate or fail the engine follows what it hears from Run Control and applies no policy of its own to that step (decision D121). For an operator decision that an Uncertain outcome of a tool call caused, `ApprovalDecided` also carries the `finding` the Operator recorded on the effect, applied or not-applied, which Run Control records in ToolAdapterService; the engine reads the choice and never the finding. The engine reads the rule on the declared policy from its projection alone: for a step whose policy is Escalate, and for a step of class shared-write or above whose last recorded outcome is Uncertain, what follows a failure is the choice of the Operator and never the policy the step declares, so a step that declares Fail and reached the decision by an Uncertain outcome is compensated when the Operator chose compensate. After the choice fail, and when the request expires, which Run Control never requests again, Run Control settles the step Failed, fails the run itself and publishes `RunControlService/RunFailed`. Following that event is the second delivery of this PBI, and it holds for every run that Run Control fails itself, the run failures that no failure policy of a step decides (decision D121): after the choice fail or an expired operator decision, after a rejected or finally expired approval, after a denied budget and after a retired environment. After a step that failed under the policy Fail or Compensate Run Control fails nothing itself and waits for the `WorkflowRunFailed` of the engine (AIFACTORY-US-501). The inbox handler `CloseFailedWorkflowRun` closes the projection, idempotently on the event id: a `WorkflowRun` that is Running, WaitingForTimer or WaitingForHuman moves to Failed through the modelled trigger `RunFailed`, its open step runs move to Cancelled with `WorkflowEngineService/StepRunStateChanged` (decision D121), the state the cancellation of a run gives them (AIFACTORY-US-503), pending timers are skipped so that a reminder that still fires is a no-op, and `connectsoft.factory.workflows.runs_active` moves with the state. The engine writes no `WorkflowRunFailed` for such a run, because it publishes that event only for a failure it decided itself and Run Control already holds the terminal state; StudioBff and DashboardService learn the end of the run from `RunFailed` itself, which both consume. A `RunFailed` for a run that is already Completed, Failed or Cancelled, as after the `WorkflowRunFailed` of the engine that Run Control recorded, for a run the projection does not hold, and for a run that is Compensating, for which the model lists no such transition, changes nothing. When the failed run is the child run of a step of kind SubWorkflow, a second handler of the same event returns the failure to the parent step run (AIFACTORY-US-647). One point is not stated by the model and is reported to the owner: an Uncertain outcome on a step of class read or sandbox opens no operator decision; the engine leaves its step run open until `StepSettled` names it, and what Run Control does with such an outcome is its own rule. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun, RunControlService/ApprovalRequest, RunControlService/Step; events: WorkflowEngineService/CompensationStarted, WorkflowEngineService/StepReady, WorkflowEngineService/StepRunStateChanged, WorkflowEngineService/WorkflowRunFailed, RunControlService/AttemptOutcomeRecorded, RunControlService/StepSettled, RunControlService/ApprovalDecided, RunControlService/RunFailed; adrs: ADR-0012, ADR-0014, ADR-0024; requirements: FR-10, XL-06. Relates: screens: workflow-run-graph, run-detail; nfrs: NFR-05, NFR-06. Depends on: AIFACTORY-US-500, AIFACTORY-US-501, AIFACTORY-US-502, AIFACTORY-US-503, feature:run-control-service, feature:contracts-package. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running `WorkflowEngineService/WorkflowRun`, a step that declares the failure policy Escalate whose last `RunControlService/AttemptOutcomeRecorded` is Failed or TimedOut, or a step of class shared-write or above whose outcome is Uncertain, and no `RunControlService/StepSettled` for its step run, as while Run Control keeps an operator decision pending, when the engine, its timers and its reconciler run beyond the step timeout, then the step run stays open with the outcome recorded, no `WorkflowEngineService/StepReady` is emitted or re-emitted for it, no compensation starts, neither `WorkflowEngineService/WorkflowRunFailed` nor another terminal event is written and the run does not move (model/services/control-plane/RunControlService.yaml, ADR-0014).",
        "AC2: Given that wait and a `RunControlService/ApprovalDecided` with `proposalKind` operator-decision and the choice retry, when the fake Run Control dispatches a new attempt of the same step and its Succeeded outcome and its `RunControlService/StepSettled` with the final state Succeeded arrive, then the decision changed nothing in the engine by itself, the step run is Succeeded with both attempts recorded, and the next ready steps are announced through `WorkflowEngineService/StepReady` as for any other step (XL-06).",
        "AC3: Given that wait, succeeded steps of which one declares a compensation step, and a `RunControlService/ApprovalDecided` with `proposalKind` operator-decision, the choice compensate and the `stepRunId` of the step, when the handler `AdvanceOnDecision` runs, then the run moves from Running to Compensating through `OperatorChoseCompensate`, one compensation entry is planned per succeeded step with a compensation step in reverse completion order, `WorkflowEngineService/CompensationStarted` is written in the same transaction and each compensation step is announced through `WorkflowEngineService/StepReady` with its own action class; the `RunControlService/StepSettled` with the final state Failed for the same step run, before or after the decision, moves the step run to Failed and applies no declared policy, also for a step that declares Fail and reached the decision by an Uncertain outcome; and a redelivery of the decision changes nothing.",
        "AC4: Given that wait and a `RunControlService/RunFailed` for the run, as Run Control publishes it after the choice fail and after an operator decision that expired, when the handler `CloseFailedWorkflowRun` runs, then the run moves to Failed through the trigger `RunFailed`, its open step runs move to Cancelled with `WorkflowEngineService/StepRunStateChanged`, pending timers are skipped, and neither `WorkflowEngineService/WorkflowRunFailed` nor another terminal event of the engine is written; the `RunControlService/ApprovalDecided` that carries the choice fail or the state Expired of the operator decision, and the `RunControlService/StepSettled` with the final state Failed, change nothing more, in whatever order the three events arrive (model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC5: Given a `WorkflowEngineService/WorkflowRun` that is Running, WaitingForTimer or WaitingForHuman and a `RunControlService/RunFailed` for its `runId`, as after a rejected approval or a denied budget, when the handler `CloseFailedWorkflowRun` runs, then the projection is closed as Failed from each of the three states with pending timers skipped and no `WorkflowEngineService/WorkflowRunFailed` written; a `RunFailed` for a run that is already Completed, Failed or Cancelled, as after the engine's own `WorkflowRunFailed`, for a run that is Compensating or for a run unknown to the projection, a redelivery of the same event id, and a timer that fires after the closure change nothing (FR-10, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2601",
        "AIFACTORY-TASK-2602",
        "AIFACTORY-TASK-2603",
        "AIFACTORY-TASK-2604",
        "AIFACTORY-TASK-2605"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5812,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "RunControlService/ApprovalRequest",
          "RunControlService/Step"
        ],
        "events": [
          "WorkflowEngineService/CompensationStarted",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/StepRunStateChanged",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/AttemptOutcomeRecorded",
          "RunControlService/StepSettled",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunFailed"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FR-10",
          "XL-06"
        ]
      },
      "relates": {
        "screens": [
          "workflow-run-graph",
          "run-detail"
        ],
        "nfrs": [
          "NFR-05",
          "NFR-06"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-500",
        "AIFACTORY-US-501",
        "AIFACTORY-US-502",
        "AIFACTORY-US-503",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-646]",
      "number": 646
    },
    {
      "id": "AIFACTORY-TASK-2601",
      "type": "task",
      "parent": "AIFACTORY-US-646",
      "title": "Hold an escalated or uncertain step open and start the compensation on the choice compensate of an operator decision",
      "sequence": "02.02.12.01",
      "description": "Hold an escalated or uncertain step open and start the compensation on the choice compensate of an operator decision. Expected output: A step run whose step declares Escalate, or whose step is of class shared-write or above with a last outcome Uncertain, stays open after a failed or Uncertain outcome: the engine retries nothing, re-emits no StepReady, starts no compensation and writes no terminal event; the handler of ApprovalDecided recognises an operator decision by proposalKind operator-decision and matches it to its step run by stepRunId, idempotently on the event id; the choice compensate moves the run from Running to Compensating through OperatorChoseCompensate, plans the compensation entries with the plan of AIFACTORY-TASK-2005 and writes CompensationStarted in the same transaction; the choices retry and fail and an expired request change nothing by themselves, and the finding an operator decision on an uncertain tool effect carries is not read; the StepSettled with the final state Failed of such a step moves the step run to Failed with its attemptCount and failureClass and applies no declared policy, in either order with the decision, so that after the choice compensate or fail the engine does only what it hears from Run Control.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A step run whose step declares Escalate, or whose step is of class shared-write or above with a last outcome Uncertain, stays open after a failed or Uncertain outcome: the engine retries nothing, re-emits no StepReady, starts no compensation and writes no terminal event; the handler of ApprovalDecided recognises an operator decision by proposalKind operator-decision and matches it to its step run by stepRunId, idempotently on the event id; the choice compensate moves the run from Running to Compensating through OperatorChoseCompensate, plans the compensation entries with the plan of AIFACTORY-TASK-2005 and writes CompensationStarted in the same transaction; the choices retry and fail and an expired request change nothing by themselves, and the finding an operator decision on an uncertain tool effect carries is not read; the StepSettled with the final state Failed of such a step moves the step run to Failed with its attemptCount and failureClass and applies no declared policy, in either order with the decision, so that after the choice compensate or fail the engine does only what it hears from Run Control."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5812,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2601]",
      "number": 2601
    },
    {
      "id": "AIFACTORY-TASK-2602",
      "type": "task",
      "parent": "AIFACTORY-US-646",
      "title": "CloseFailedWorkflowRun inbox handler closing the projection on RunFailed without a terminal event of the engine",
      "sequence": "02.02.12.02",
      "description": "CloseFailedWorkflowRun inbox handler closing the projection on RunFailed without a terminal event of the engine. Expected output: The handler of RunFailed moves a Running, WaitingForTimer or WaitingForHuman workflow run to Failed through the trigger RunFailed, moves every open step run to Cancelled with StepRunStateChanged, skips pending timers and writes no WorkflowRunFailed, idempotently on the event id; a RunFailed for a Completed, Failed, Cancelled, Compensating or unknown run changes nothing, a timer that fires after the closure is a no-op, and connectsoft.factory.workflows.runs_active moves with the state.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The handler of RunFailed moves a Running, WaitingForTimer or WaitingForHuman workflow run to Failed through the trigger RunFailed, moves every open step run to Cancelled with StepRunStateChanged, skips pending timers and writes no WorkflowRunFailed, idempotently on the event id; a RunFailed for a Completed, Failed, Cancelled, Compensating or unknown run changes nothing, a timer that fires after the closure is a no-op, and connectsoft.factory.workflows.runs_active moves with the state."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5812,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2602]",
      "number": 2602
    },
    {
      "id": "AIFACTORY-TASK-2603",
      "type": "task",
      "parent": "AIFACTORY-US-646",
      "title": "Fixture definitions that declare Escalate and a write step without an idempotency key",
      "sequence": "02.02.12.03",
      "description": "Fixture definitions that declare Escalate and a write step without an idempotency key. Expected output: The fixture set of AIFACTORY-TASK-1995 gains definitions in the wire shape of WorkflowDefinition: a step with failurePolicy Escalate that runs after two succeeded steps of which one names a compensation step, and a step of class shared-write with failurePolicy Fail and no idempotencyKey; with the operator decision scripts of the fake Run Control of AIFACTORY-TASK-2002 they reach the pending decision, each of the three choices and the expiry; no definition of model/workflows is changed, since none of them declares Escalate.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The fixture set of AIFACTORY-TASK-1995 gains definitions in the wire shape of WorkflowDefinition: a step with failurePolicy Escalate that runs after two succeeded steps of which one names a compensation step, and a step of class shared-write with failurePolicy Fail and no idempotencyKey; with the operator decision scripts of the fake Run Control of AIFACTORY-TASK-2002 they reach the pending decision, each of the three choices and the expiry; no definition of model/workflows is changed, since none of them declares Escalate."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5812,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2603]",
      "number": 2603
    },
    {
      "id": "AIFACTORY-TASK-2604",
      "type": "task",
      "parent": "AIFACTORY-US-646",
      "title": "Engine side of the settlement contract as a consumer contract test of StepSettled, RunFailed and the operator decision fields of ApprovalDecided",
      "sequence": "02.02.12.04",
      "description": "Engine side of the settlement contract as a consumer contract test of StepSettled, RunFailed and the operator decision fields of ApprovalDecided. Expected output: A consumer contract test in the WorkflowEngineService repository pins the event types of the contracts package as Run Control publishes them and the engine reads them: StepSettled with runId, tenantId, stepRunId, stepId, finalState, attemptCount, failureClass and outputRef; RunFailed with runId, tenantId, failureClass and reason; and ApprovalDecided with proposalKind, choice, stepRunId and finding beside its other fields; a change of one of these payloads fails the build of the consumer; publishing the events is the delivery of feature run-control-service and is not built here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A consumer contract test in the WorkflowEngineService repository pins the event types of the contracts package as Run Control publishes them and the engine reads them: StepSettled with runId, tenantId, stepRunId, stepId, finalState, attemptCount, failureClass and outputRef; RunFailed with runId, tenantId, failureClass and reason; and ApprovalDecided with proposalKind, choice, stepRunId and finding beside its other fields; a change of one of these payloads fails the build of the consumer; publishing the events is the delivery of feature run-control-service and is not built here."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5812,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2604]",
      "number": 2604
    },
    {
      "id": "AIFACTORY-TASK-2605",
      "type": "task",
      "parent": "AIFACTORY-US-646",
      "title": "Verify follow-operator-decisions-and-close-failed-runs through the acceptance suite",
      "sequence": "02.02.12.05",
      "description": "Verify follow-operator-decisions-and-close-failed-runs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=follow-operator-decisions-and-close-failed-runs\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-646 against the fake Run Control of AIFACTORY-TASK-2002: the step under Escalate and the Uncertain write step that stay open beyond the step timeout with nothing announced and nothing failed, the choice retry followed by a new attempt, the choice compensate with the compensation in reverse order and the step settled Failed without a declared policy applied, in both orders of the two events, the choice fail and the expired decision closed by RunFailed without WorkflowRunFailed, the closure on RunFailed from each of the three states, and the RunFailed for a terminal, a Compensating and an unknown run that changes nothing.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=follow-operator-decisions-and-close-failed-runs\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-646 against the fake Run Control of AIFACTORY-TASK-2002: the step under Escalate and the Uncertain write step that stay open beyond the step timeout with nothing announced and nothing failed, the choice retry followed by a new attempt, the choice compensate with the compensation in reverse order and the step settled Failed without a declared policy applied, in both orders of the two events, the choice fail and the expired decision closed by RunFailed without WorkflowRunFailed, the closure on RunFailed from each of the three states, and the RunFailed for a terminal, a Compensating and an unknown run that changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5812,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2605]",
      "number": 2605
    },
    {
      "id": "AIFACTORY-US-647",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Execute a step of kind SubWorkflow as a child run submitted through Run Control and return its result to the parent step run",
      "sequence": "02.02.13",
      "description": "A step of kind SubWorkflow runs another workflow as a child run. The engine does not announce such a step through `StepReady`, since no agent, tool or human acts in it and Run Control creates no step and no attempt for it; the engine executes the step itself by asking Run Control, the single writer of runs (ADR-0014), for a child run. On the wire the kind is `sub-workflow`, and the step names its child workflow in `workflow`, as model/schemas/workflow.schema.json declares it and model/workflows/sprint-execution.yaml uses it in its step run-item. The published wire schema does not carry that property yet: the contract task of this PBI adds `workflow` to a step of `WorkflowDefinition` in docs/reference/schemas/asset-manifests.schema.json, the contracts package regenerates its types (feature `contracts-package`) and the service takes them by a new pin, the path the properties of AIFACTORY-US-498 took. The validator of AIFACTORY-US-498 gains one rule: a step of kind `sub-workflow` that names no child workflow is refused with a finding by step and rule, through `WorkflowEngineService/ValidateWorkflowDefinition` and at load. When the planner finds a step of kind SubWorkflow ready, the Advance creates its `StepRun` and calls `RunControlService/RunControl.SubmitChildRun`, the internal gRPC operation of Run Control, with a body of `run-submission-v1` that carries the `workflowId` of the child, the input built from the input mapping of the step, the `modelProfileId` the parent run was accepted with and `parentRunId`, the run the step belongs to. The run is the parent: no attempt exists for a step the engine executes, so the body carries no `parentAttemptId`. The engine chooses neither tenant nor project nor a policy revision nor a release: the child inherits the tenant, the project, the policy revision and the pinned release closure of the parent, all applied by Run Control. The child gets no reservation of its own: its usage is recorded with the child run id and counts on the reservation of the parent run, and the submission waits for no budget reservation and opens no spend approval (decision D121). The call presents the workload identity of the engine. The same idempotency key with the same input returns the same child run, and the key of a step of kind SubWorkflow is the `stepRunId` (decision D121), which is unique per step and iteration, so a redelivered event or a restarted Advance never creates a second child. The reply `run-accepted-v1` names the child run; the engine keeps its id in `childRunId` of the step run and moves the step run to Running with `WorkflowEngineService/StepRunStateChanged`, in the transaction of the Advance. Run Control is a fail-fast dependency of this call: when it fails the Advance fails, nothing is written and the inbox redelivers the event that made the step ready, which repeats the call under the same key. One answer is no failure of the dependency: under a parent run that is terminal or Cancelling Run Control answers FAILED_PRECONDITION and no child run exists (decision D121). On that answer the engine keeps no `childRunId` on the step run and does not repeat the call (decision D123); it announces nothing, and the step run is closed with its projection when `RunFailed` or `RunCancelled` of the parent arrives (AIFACTORY-US-646, AIFACTORY-US-503). The child run is a run like any other: Run Control publishes `RunAccepted` for it and the engine opens a second projection and drives it from its own pinned definition (AIFACTORY-US-499). Its result returns to the parent through the terminal run events of Run Control and through nothing else. The inbox handler `ReturnChildRunResult` consumes `RunControlService/RunCompleted`, `RunControlService/RunFailed` and `RunControlService/RunCancelled`, idempotently on the event id, looks for the step run whose `childRunId` equals the `runId` of the event and ignores every run that is no child. For `RunCompleted` the parent step run moves to Succeeded with the result of the child, which the engine reads through the optional `outputRef` of the event, the reference of the outcome of the child run in ArtifactService, and keeps as the `outputRef` of the step run (decision D121), and the Advance of the parent computes what is ready next. For `RunFailed` the parent step run moves to Failed with the `failureClass` of the child, and the failure policy the step declares decides what follows, as for any other step settled Failed (AIFACTORY-US-501). For `RunCancelled` the parent step run moves to Cancelled, and nothing is announced and nothing fails. Two cancellations are a failure for the parent (decisions D121, D123 and D125): a child run stopped for an overrun of its budget arrives as `RunCancelled` with the reason budget-exceeded, and a child run stopped because a release of its pinned closure was revoked arrives with the reason release-revoked; each is a failed child, so the parent step run of kind SubWorkflow is set to Failed with the failure class policy-denied and keeps the reason of the stop, budget-exceeded or release-revoked, in `failureReason`, because the model has no failure class of its own for either, and the failure policy of the step applies as after `RunFailed`; every other step run keeps no failure reason; under the policy Fail the `WorkflowRunFailed` of the parent carries the failure class policy-denied. The stopped child itself ends Cancelled and not Failed, and only its parent treats it as failed. The same events also close the projection of the child itself, through `CloseFailedWorkflowRun` and `CancelWorkflowRun`, the other handlers of these events (AIFACTORY-US-646, AIFACTORY-US-503). In the other direction Run Control cancels the open child runs of a parent that ends Failed or Cancelled, and the engine follows each of those cancellations as it follows any other. While the child runs the parent step run waits: a step timeout fails nothing and the `StuckRunReconciler` re-emits no `StepReady` for a step run of kind SubWorkflow (AIFACTORY-US-502). None of the six chain definitions uses the kind, so the acceptance suite proves it on fixture definitions. Three points are not stated by the model and are reported to the owner. `run-submission-v1` requires `modelProfileId`, which `RunAccepted` of the parent carries and for which the `WorkflowRun` has no field. The rule on failure policies binds agent, tool and human steps only, while the handler applies the failure policy of the step and run-item of model/workflows/sprint-execution.yaml declares none; the fixtures of this PBI declare one, and what applies to a step of kind `sub-workflow` without one is open. And a `StepRun` has a field for the failure class and none for a reason, and `WorkflowRunFailed` carries no reason, so where the reason budget-exceeded of the parent step run is kept is not stated; the suite asserts the state Failed, the failure class policy-denied and the policy applied. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun, WorkflowEngineService/WorkflowDefinitionVersion, RunControlService/Run; apis: RunControlService/RunControl.SubmitChildRun, WorkflowEngineService/ValidateWorkflowDefinition; events: WorkflowEngineService/StepReady, WorkflowEngineService/StepRunStateChanged, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled; descriptors: run-submission-v1, run-accepted-v1, workflow-definition-v1; adrs: ADR-0014, ADR-0024; requirements: FR-03. Relates: screens: workflow-run-graph; nfrs: NFR-05. Depends on: AIFACTORY-US-498, AIFACTORY-US-500, AIFACTORY-US-501, AIFACTORY-US-503, AIFACTORY-US-646, feature:run-control-service, feature:contracts-package. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/services/control-plane/RunControlService.yaml, model/schemas/workflow.schema.json, model/workflows/sprint-execution.yaml, docs/reference/schemas/asset-manifests.schema.json, docs/reference/schemas/run-submission.schema.json, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a `WorkflowDefinition` document of docs/reference/schemas/asset-manifests.schema.json, the shape of `workflow-definition-v1`, with a step of kind `sub-workflow`, when `WorkflowEngineService/ValidateWorkflowDefinition` is called or the release is loaded, then a step that names its child workflow in `workflow` passes, and a step that names none is refused, 400 with a problem response that names the finding by step and rule at validation and a release that is not loaded at load, with `connectsoft.factory.workflows.definition_rejections` counting the rejection (model/schemas/workflow.schema.json).",
        "AC2: Given a Running `WorkflowEngineService/WorkflowRun` whose Advance finds a step of kind SubWorkflow ready, when it is applied, then no `WorkflowEngineService/StepReady` is written for the step, `RunControlService/RunControl.SubmitChildRun` is called once with a `run-submission-v1` body that carries the `workflowId` of the child, the input of the step and `parentRunId` equal to the run, without `parentAttemptId` and under the idempotency key `stepRunId`, the id of the child run named by the reply `run-accepted-v1` is kept in `childRunId` of the step run, and the step run moves to Running with `WorkflowEngineService/StepRunStateChanged` in the same transaction (ADR-0014).",
        "AC3: Given `RunControlService/RunControl.SubmitChildRun` fails, or the event that made the step ready is delivered again, or the engine restarts between the call and its commit, when the Advance runs again, then the call is repeated under the same idempotency key, the fake Run Control holds exactly one child run for the step run, a failed call leaves no step run and no event written, and the `RunControlService/RunAccepted` of the child opens a second projection that the engine drives like any other run; given the call answers FAILED_PRECONDITION because the parent run is terminal or Cancelling, then no child run exists, no `childRunId` is kept, the call is not repeated and nothing is announced (FR-03).",
        "AC4: Given a step run with a `childRunId` and a `RunControlService/RunCompleted` whose `runId` equals it, when the handler `ReturnChildRunResult` runs, then the parent step run is Succeeded with the result of the child, its `outputRef` equal to the `outputRef` of the event, the next ready steps of the parent are announced through `WorkflowEngineService/StepReady`, and a `RunCompleted` of a run that is the child of no step run, and a redelivery of the same event id, change nothing.",
        "AC5: Given a step run with a `childRunId` and a `RunControlService/RunFailed` that names the child, when the handler `ReturnChildRunResult` runs, then the parent step run is Failed with the `failureClass` of the child and the declared failure policy of the step applies as for a step settled Failed, policy Fail giving `WorkflowEngineService/WorkflowRunFailed` of the parent with the step as `failedStepId`; given a `RunControlService/RunCancelled` that names the child, then the parent step run is Cancelled, nothing is announced and no `WorkflowRunFailed` is written, unless its reason is budget-exceeded, the stop of a child for an overrun of its budget, or release-revoked, the stop of a child whose pinned release was revoked (D125), for which the parent step run is Failed with the failure class policy-denied and that reason in `failureReason` and the declared failure policy applies as after `RunFailed`, policy Fail giving `WorkflowEngineService/WorkflowRunFailed` of the parent with the failure class policy-denied; and in every case the projection of the child itself is closed by the other handler of the event."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/sprint-execution.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2606",
        "AIFACTORY-TASK-2607",
        "AIFACTORY-TASK-2608",
        "AIFACTORY-TASK-2609",
        "AIFACTORY-TASK-2610",
        "AIFACTORY-TASK-2611"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5813,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "WorkflowEngineService/WorkflowDefinitionVersion",
          "RunControlService/Run"
        ],
        "apis": [
          "RunControlService/RunControl.SubmitChildRun",
          "WorkflowEngineService/ValidateWorkflowDefinition"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/StepRunStateChanged",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled"
        ],
        "descriptors": [
          "run-submission-v1",
          "run-accepted-v1",
          "workflow-definition-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FR-03"
        ]
      },
      "relates": {
        "screens": [
          "workflow-run-graph"
        ],
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-498",
        "AIFACTORY-US-500",
        "AIFACTORY-US-501",
        "AIFACTORY-US-503",
        "AIFACTORY-US-646",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/sprint-execution.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-647]",
      "number": 647
    },
    {
      "id": "AIFACTORY-TASK-2606",
      "type": "task",
      "parent": "AIFACTORY-US-647",
      "title": "Add the child workflow reference of a sub-workflow step to WorkflowDefinition of the published asset manifest schema",
      "sequence": "02.02.13.01",
      "description": "Add the child workflow reference of a sub-workflow step to WorkflowDefinition of the published asset manifest schema. Expected output: docs/reference/schemas/asset-manifests.schema.json declares on a step of `WorkflowDefinition` the property `workflow`, the id of the child workflow of a step of kind `sub-workflow`, mirroring `workflow` of model/schemas/workflow.schema.json; model/workflows/sprint-execution.yaml with its step run-item can be written as a document that is valid against it, the reference page of the schema shows the property, and `python -I tools/docs_model validate` passes.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "docs/reference/schemas/asset-manifests.schema.json declares on a step of `WorkflowDefinition` the property `workflow`, the id of the child workflow of a step of kind `sub-workflow`, mirroring `workflow` of model/schemas/workflow.schema.json; model/workflows/sprint-execution.yaml with its step run-item can be written as a document that is valid against it, the reference page of the schema shows the property, and `python -I tools/docs_model validate` passes."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5813,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2606]",
      "number": 2606
    },
    {
      "id": "AIFACTORY-TASK-2607",
      "type": "task",
      "parent": "AIFACTORY-US-647",
      "title": "Publish the contracts package version that carries the child workflow reference and the parent fields of the run submission",
      "sequence": "02.02.13.02",
      "description": "Publish the contracts package version that carries the child workflow reference and the parent fields of the run submission. Expected output: The contracts package regenerates its `WorkflowDefinition` types from docs/reference/schemas/asset-manifests.schema.json as AIFACTORY-TASK-2606 changed it and its run submission type from docs/reference/schemas/run-submission.schema.json with `parentRunId` and `parentAttemptId`, carries the event type `RunCompleted` with its optional `outputRef` as the model states it, stamps them with the hash of each schema and is published to the ConnectSoft feed at a new version, the way feature contracts-package builds and publishes it; the repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService pins that version.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Contracts.",
      "acceptanceCriteria": [
        "The contracts package regenerates its `WorkflowDefinition` types from docs/reference/schemas/asset-manifests.schema.json as AIFACTORY-TASK-2606 changed it and its run submission type from docs/reference/schemas/run-submission.schema.json with `parentRunId` and `parentAttemptId`, carries the event type `RunCompleted` with its optional `outputRef` as the model states it, stamps them with the hash of each schema and is published to the ConnectSoft feed at a new version, the way feature contracts-package builds and publishes it; the repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService pins that version."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5813,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2607]",
      "number": 2607
    },
    {
      "id": "AIFACTORY-TASK-2608",
      "type": "task",
      "parent": "AIFACTORY-US-647",
      "title": "Validation rule of a sub-workflow step and the submission of its child run through RunControl.SubmitChildRun",
      "sequence": "02.02.13.03",
      "description": "Validation rule of a sub-workflow step and the submission of its child run through RunControl.SubmitChildRun. Expected output: The validator of AIFACTORY-TASK-1993 refuses a step of kind sub-workflow that names no child workflow, with a unit test of the rule; when the planner of AIFACTORY-TASK-197 returns a ready step of kind SubWorkflow, the Advance creates its step run, writes no StepReady and calls RunControl.SubmitChildRun with the workload identity of the engine, a run-submission-v1 body with the workflowId of the child, the input of the step, the modelProfileId of the parent and parentRunId, no parentAttemptId, and the stepRunId as idempotency key; it keeps the child run id of the reply in ChildRunId and moves the step run to Running with StepRunStateChanged in one transaction; a failed call fails the Advance without a write, the answer FAILED_PRECONDITION of a parent run that is terminal or Cancelling keeps no child run id and is not repeated, the engine sets no budget and asks for no reservation for the child, and the StuckRunReconciler re-emits nothing for a step run of kind SubWorkflow.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The validator of AIFACTORY-TASK-1993 refuses a step of kind sub-workflow that names no child workflow, with a unit test of the rule; when the planner of AIFACTORY-TASK-197 returns a ready step of kind SubWorkflow, the Advance creates its step run, writes no StepReady and calls RunControl.SubmitChildRun with the workload identity of the engine, a run-submission-v1 body with the workflowId of the child, the input of the step, the modelProfileId of the parent and parentRunId, no parentAttemptId, and the stepRunId as idempotency key; it keeps the child run id of the reply in ChildRunId and moves the step run to Running with StepRunStateChanged in one transaction; a failed call fails the Advance without a write, the answer FAILED_PRECONDITION of a parent run that is terminal or Cancelling keeps no child run id and is not repeated, the engine sets no budget and asks for no reservation for the child, and the StuckRunReconciler re-emits nothing for a step run of kind SubWorkflow."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5813,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2608]",
      "number": 2608
    },
    {
      "id": "AIFACTORY-TASK-2609",
      "type": "task",
      "parent": "AIFACTORY-US-647",
      "title": "ReturnChildRunResult inbox handler for RunCompleted, RunFailed and RunCancelled of a child run",
      "sequence": "02.02.13.04",
      "description": "ReturnChildRunResult inbox handler for RunCompleted, RunFailed and RunCancelled of a child run. Expected output: The handler matches the runId of RunCompleted, RunFailed and RunCancelled to the step run that keeps it in ChildRunId, idempotently on the event id, and ignores a run that is no child; RunCompleted moves the parent step run to Succeeded with the result of the child, read through the outputRef of the event and kept as the outputRef of the step run, and lets the Advance of the parent announce the next ready steps; RunFailed moves it to Failed with the failureClass of the child and applies the declared failure policy of the step through the path of AIFACTORY-TASK-2004 and AIFACTORY-TASK-2005; RunCancelled moves it to Cancelled and announces nothing, except with the reason budget-exceeded or release-revoked (D125), for which the child is a failed child, the parent step run moves to Failed with the failure class policy-denied and keeps that reason in FailureReason, and the same policy path applies; the handlers that close the projection of the child itself run beside it on the same events.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The handler matches the runId of RunCompleted, RunFailed and RunCancelled to the step run that keeps it in ChildRunId, idempotently on the event id, and ignores a run that is no child; RunCompleted moves the parent step run to Succeeded with the result of the child, read through the outputRef of the event and kept as the outputRef of the step run, and lets the Advance of the parent announce the next ready steps; RunFailed moves it to Failed with the failureClass of the child and applies the declared failure policy of the step through the path of AIFACTORY-TASK-2004 and AIFACTORY-TASK-2005; RunCancelled moves it to Cancelled and announces nothing, except with the reason budget-exceeded or release-revoked (D125), for which the child is a failed child, the parent step run moves to Failed with the failure class policy-denied and keeps that reason in FailureReason, and the same policy path applies; the handlers that close the projection of the child itself run beside it on the same events."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5813,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2609]",
      "number": 2609
    },
    {
      "id": "AIFACTORY-TASK-2610",
      "type": "task",
      "parent": "AIFACTORY-US-647",
      "title": "Fixture definitions of a parent workflow with a sub-workflow step and of its child workflow",
      "sequence": "02.02.13.05",
      "description": "Fixture definitions of a parent workflow with a sub-workflow step and of its child workflow. Expected output: The fixture set of AIFACTORY-TASK-1995 gains, in the wire shape of WorkflowDefinition, a parent definition whose step of kind sub-workflow names a child definition in workflow and declares a failure policy, once Fail and once Compensate, the child definition itself with two agent steps, and one invalid variant whose sub-workflow step names no child; the fake registry serves the releases of both, and the fake Run Control of AIFACTORY-TASK-2002 answers SubmitChildRun, on request with FAILED_PRECONDITION as for a parent run that is terminal or Cancelling, and publishes RunAccepted with the parent run id and the terminal run events of the child, RunCompleted with an outputRef and RunCancelled without a reason and with the reasons budget-exceeded and release-revoked among them; no definition of model/workflows is changed.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The fixture set of AIFACTORY-TASK-1995 gains, in the wire shape of WorkflowDefinition, a parent definition whose step of kind sub-workflow names a child definition in workflow and declares a failure policy, once Fail and once Compensate, the child definition itself with two agent steps, and one invalid variant whose sub-workflow step names no child; the fake registry serves the releases of both, and the fake Run Control of AIFACTORY-TASK-2002 answers SubmitChildRun, on request with FAILED_PRECONDITION as for a parent run that is terminal or Cancelling, and publishes RunAccepted with the parent run id and the terminal run events of the child, RunCompleted with an outputRef and RunCancelled without a reason and with the reasons budget-exceeded and release-revoked among them; no definition of model/workflows is changed."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5813,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2610]",
      "number": 2610
    },
    {
      "id": "AIFACTORY-TASK-2611",
      "type": "task",
      "parent": "AIFACTORY-US-647",
      "title": "Verify execute-a-sub-workflow-step-as-a-child-run through the acceptance suite",
      "sequence": "02.02.13.06",
      "description": "Verify execute-a-sub-workflow-step-as-a-child-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=execute-a-sub-workflow-step-as-a-child-run\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-647 against the fake Run Control of AIFACTORY-TASK-2002: the sub-workflow step without a child workflow refused at validation and at load, the single call of SubmitChildRun with parentRunId and the stepRunId as key and no StepReady for the step, the repeated call after a failure and after a redelivery that leaves one child run, the FAILED_PRECONDITION of a terminal and of a Cancelling parent run after which no child run id is kept and the call is not repeated, the second projection opened for the child, the parent step run Succeeded on RunCompleted with the outputRef of the event and the next steps announced, Failed on RunFailed with the declared policy applied, Cancelled on RunCancelled, Failed with the failure class policy-denied, the reason kept in failureReason and the declared policy applied on a RunCancelled with the reason budget-exceeded and on one with the reason release-revoked, and the terminal event of a run that is no child ignored.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=execute-a-sub-workflow-step-as-a-child-run\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-647 against the fake Run Control of AIFACTORY-TASK-2002: the sub-workflow step without a child workflow refused at validation and at load, the single call of SubmitChildRun with parentRunId and the stepRunId as key and no StepReady for the step, the repeated call after a failure and after a redelivery that leaves one child run, the FAILED_PRECONDITION of a terminal and of a Cancelling parent run after which no child run id is kept and the call is not repeated, the second projection opened for the child, the parent step run Succeeded on RunCompleted with the outputRef of the event and the next steps announced, Failed on RunFailed with the declared policy applied, Cancelled on RunCancelled, Failed with the failure class policy-denied, the reason kept in failureReason and the declared policy applied on a RunCancelled with the reason budget-exceeded and on one with the reason release-revoked, and the terminal event of a run that is no child ignored."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5813,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2611]",
      "number": 2611
    },
    {
      "id": "AIFACTORY-US-504",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Read the engine projection of a run as a graph through REST for the Studio and through gRPC for internal callers",
      "sequence": "02.02.14",
      "description": "As a requester, I want to see the graph of my run with the state of every step run, its timers and its compensation entries, so that I can tell where the workflow stands and why it waits, without reading two services. The engine projection of a run is readable in two ways and neither writes anything. A caller whose scope carries `factory.runs.read` reads the graph of one run through `WorkflowEngineService/GetWorkflowRunGraph` (GET `/runtime/workflow-runs/{runId}`), the read model of the workflow run graph screen of the Studio: the state of the workflow run with `definitionReleaseId`, `graphHash` and `lastOutcomeSequence`, every step run with its step id, kind, state, iteration, attempt ids, the number of attempts and, for a failed step, the failure class it keeps from `StepSettled` (decision D121), output reference, approval id, the id of the child run of a step of kind SubWorkflow and start and end times, the timer entries with their due time and whether they fired, and the compensation entries with their order and state. The steps and edges of the pinned definition come from the cached `WorkflowDefinitionVersion`, so the caller sees the whole graph and not only the steps that already ran. The read runs under the tenant row filter: a run of another tenant is answered 404, the same answer as for a `runId` that does not exist, and the response never confirms that it exists (ADR-0015); a caller without the scope is answered 403. The response states the projection of the engine, which is not the authority: the authoritative state of the run, its steps and its attempts is read from RunControlService (ADR-0014), and the two agree once the outcomes Run Control recorded are applied, which `lastOutcomeSequence` lets a reader judge. Internal callers read the same projection through the gRPC method `WorkflowEngineService/WorkflowEngine.GetRunGraph`, of class read: RunControlService for its projections, and the Studio backend-for-frontend once it is delivered in a later increment. The caller presents a workload token, and the engine reads the tenant and project the caller forwards only when the token holds the service scope that names the engine. A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, a request without a run id with INVALID_ARGUMENT, and a run that does not exist in the forwarded tenant, a run of another tenant included, with NOT_FOUND. When `workflow-engine-sql` is unavailable the read fails and no partial graph is returned. The model names no descriptor for the REST response and names `run-event-envelope-v1` as the request and the reply descriptor of the gRPC method; the shape of the graph is therefore fixed by the OpenAPI and proto documents of the service and that naming is reported to the owner. The route of the REST operation through the Agent Mesh gateway arrives with feature `agent-runtime-worker`; in this increment the operation is hosted and proven on the service. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun, WorkflowEngineService/WorkflowDefinitionVersion; apis: WorkflowEngineService/GetWorkflowRunGraph, WorkflowEngineService/WorkflowEngine.GetRunGraph; descriptors: run-event-envelope-v1; adrs: ADR-0014, ADR-0015; requirements: FUX-04, FUX-11; scenarios: SCN-WorkflowEngineService-002, SCN-WorkflowEngineService-005. Relates: screens: workflow-run-graph. Depends on: AIFACTORY-US-496, AIFACTORY-US-499. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/ux/screens.yaml, docs/planes/agent-runtime/services/workflow-engine-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.runs.read` and a `WorkflowEngineService/WorkflowRun` of the caller's tenant with step runs, a pending timer and compensation entries, when `WorkflowEngineService/GetWorkflowRunGraph` is called, then the response is 200 with the state of the run, `definitionReleaseId`, `graphHash` and `lastOutcomeSequence`, the steps and edges of the pinned `WorkflowEngineService/WorkflowDefinitionVersion`, every step run with its state, iteration and attempt ids, the timer entries and the compensation entries, and nothing is written (SCN-WorkflowEngineService-002, FUX-04).",
        "AC2: Given a caller without `factory.runs.read`, or a `runId` that exists only in another tenant or not at all, when `WorkflowEngineService/GetWorkflowRunGraph` is called, then the response is 403 for the missing scope and 404 for the foreign run, the same answer as for a `runId` that does not exist, each with a problem response and no state change (SCN-WorkflowEngineService-002, ADR-0015).",
        "AC3: Given a caller with a workload identity whose token holds the service scope and a run of the tenant it forwards, when `WorkflowEngineService/WorkflowEngine.GetRunGraph` is called, then the reply carries the current projection of the engine with the same content as the REST read, nothing is written, and two calls with no Advance between them return the same projection (SCN-WorkflowEngineService-005, ADR-0014).",
        "AC4: Given a caller without a workload identity, a token without the service scope, a request without a run id, or a run that is unknown or belongs to another tenant, when `WorkflowEngineService/WorkflowEngine.GetRunGraph` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, the foreign run answered exactly as the unknown one, and no state changes (SCN-WorkflowEngineService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/ux/screens.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2014",
        "AIFACTORY-TASK-2015",
        "AIFACTORY-TASK-2016",
        "AIFACTORY-TASK-2017"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5814,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "WorkflowEngineService/WorkflowDefinitionVersion"
        ],
        "apis": [
          "WorkflowEngineService/GetWorkflowRunGraph",
          "WorkflowEngineService/WorkflowEngine.GetRunGraph"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04",
          "FUX-11"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-002",
          "SCN-WorkflowEngineService-005"
        ]
      },
      "relates": {
        "screens": [
          "workflow-run-graph"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-496",
        "AIFACTORY-US-499"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/ux/screens.yaml",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-504]",
      "number": 504
    },
    {
      "id": "AIFACTORY-TASK-2014",
      "type": "task",
      "parent": "AIFACTORY-US-504",
      "title": "GetWorkflowRunGraph read model under the tenant row filter",
      "sequence": "02.02.14.01",
      "description": "GetWorkflowRunGraph read model under the tenant row filter. Expected output: GetWorkflowRunGraph returns the state of the workflow run with definitionReleaseId, graphHash and lastOutcomeSequence, the steps and edges of the pinned definition, every step run, the timer entries and the compensation entries; it applies the tenant row filter so a run of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015), a missing scope is 403, and nothing is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "GetWorkflowRunGraph returns the state of the workflow run with definitionReleaseId, graphHash and lastOutcomeSequence, the steps and edges of the pinned definition, every step run, the timer entries and the compensation entries; it applies the tenant row filter so a run of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015), a missing scope is 403, and nothing is written."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5814,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2014]",
      "number": 2014
    },
    {
      "id": "AIFACTORY-TASK-2015",
      "type": "task",
      "parent": "AIFACTORY-US-504",
      "title": "WorkflowEngine.GetRunGraph over the same projection for internal callers",
      "sequence": "02.02.14.02",
      "description": "WorkflowEngine.GetRunGraph over the same projection for internal callers. Expected output: WorkflowEngine.GetRunGraph returns the same projection as the REST read for a run of the forwarded tenant and writes nothing; callers without workload identity are refused with Unauthenticated, tokens without the service scope with PermissionDenied, requests without a run id with InvalidArgument, and an unknown run and a run of another tenant alike with NotFound, the gRPC status NOT_FOUND (ADR-0015).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "WorkflowEngine.GetRunGraph returns the same projection as the REST read for a run of the forwarded tenant and writes nothing; callers without workload identity are refused with Unauthenticated, tokens without the service scope with PermissionDenied, requests without a run id with InvalidArgument, and an unknown run and a run of another tenant alike with NotFound, the gRPC status NOT_FOUND (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5814,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2015]",
      "number": 2015
    },
    {
      "id": "AIFACTORY-TASK-2016",
      "type": "task",
      "parent": "AIFACTORY-US-504",
      "title": "Contract of the run graph in the OpenAPI and proto documents",
      "sequence": "02.02.14.03",
      "description": "Contract of the run graph in the OpenAPI and proto documents. Expected output: The OpenAPI document and the proto of the service describe one shape of the run graph for GetWorkflowRunGraph and WorkflowEngine.GetRunGraph, built from the fields of WorkflowRun, StepRun, TimerEntry, CompensationEntry, StepDefinition and EdgeDefinition in model/services/agent-mesh/WorkflowEngineService.yaml; a contract test fails when the hosted reply and the documents differ.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The OpenAPI document and the proto of the service describe one shape of the run graph for GetWorkflowRunGraph and WorkflowEngine.GetRunGraph, built from the fields of WorkflowRun, StepRun, TimerEntry, CompensationEntry, StepDefinition and EdgeDefinition in model/services/agent-mesh/WorkflowEngineService.yaml; a contract test fails when the hosted reply and the documents differ."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5814,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2016]",
      "number": 2016
    },
    {
      "id": "AIFACTORY-TASK-2017",
      "type": "task",
      "parent": "AIFACTORY-US-504",
      "title": "Verify read-the-workflow-run-graph through the acceptance suite",
      "sequence": "02.02.14.04",
      "description": "Verify read-the-workflow-run-graph through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-002|Scenario=SCN-WorkflowEngineService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-504, including the 404 for a run of another tenant, the 403 for a missing scope, the gRPC refusal mapping with NOT_FOUND for the unknown and the foreign run alike, and the equality of the REST and the gRPC projection.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-002|Scenario=SCN-WorkflowEngineService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-504, including the 404 for a run of another tenant, the 403 for a missing scope, the gRPC refusal mapping with NOT_FOUND for the unknown and the foreign run alike, and the equality of the REST and the gRPC projection."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5814,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2017]",
      "number": 2017
    },
    {
      "id": "AIFACTORY-US-505",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "Satisfy the members of a readiness bundle by kind, blueprint, signal, artifact and approval, and complete a bundle of several members only when the last required member is satisfied and consistent",
      "sequence": "02.02.15",
      "description": "A readiness-activated workflow declares in its `activation` block the member slots it needs, and each slot names its kind, its descriptor and the event with the predicate that satisfies it (ADR-0026 with its amendment). This PBI delivers the member side of the `ReadinessCorrelation`: how a signal is matched to a slot of each kind, how a bundle of several members fills, and when it is complete. The submission that follows a complete bundle, the superseding and the expiry are AIFACTORY-US-009. The inbox hands each signal to the `ReadinessCorrelator`, which matches it against the activation members of the loaded definitions within the trusted tenant and project of the signal, and the `ReadinessCorrelationGrain` serialises the member updates of one correlation, idempotently on `correlationId`, slot and `refHash`. The first matching signal for a project and operation opens the correlation in state Open with every slot of the block as a `ReadinessMember` with its `slot`, `kind`, `descriptor` and `required`, on the workflow release the alias of the definition resolved to; the resolution is a seam this PBI calls and AIFACTORY-US-009 delivers and proves against the registry. A member reference always carries the id, the version and the hash of the triggering object as the event gives them, and the correlation never resolves latest for a member. A blueprint member is satisfied by `BlueprintService/BlueprintValidated` only when `passed` is true and `kind` equals the blueprint kind of the slot, and only by a version of project scope; it takes `blueprintId`, `version` and `documentHash`. A signal member is satisfied by the event its slot names when the predicate of the slot holds, and takes the id, the version and the hash from the payload fields the member names in `ref`, `version_ref` and `hash_ref`: the slot context-map of `module-blueprints` takes `contextMapId` and `blueprintVersion` of `BlueprintService/ContextMapDerived` when `contexts` is above zero, the slot domain-model of `database-blueprint` takes `domainModelId` of `BlueprintService/DomainModelDerived` when `aggregates` is above zero, and the slot recipe of `generate-product` takes `recipeId` and `version` of `GenerationRecipeService/RecipeApproved` when `approvedBy` is set. A part for which the member names no field stays empty on the member. An artifact member is satisfied by `ArtifactService/ArtifactStored` whose `descriptor` equals the descriptor of the slot, and takes `artifactId`, `versionInChain` and `contentHash`. An approval member is satisfied by `RunControlService/ApprovalDecided` only when the predicate of the slot holds, the state Approved with the proposal descriptor of the slot, with `proposalHash` as its hash, and only when the memo that was approved names the same versions and hashes as the other members of the bundle; a memo that names other versions satisfies nothing. A signal whose predicate does not hold, a version that is not of project scope and a signal of another tenant or project satisfy no member and write nothing. A bundle of several members stays Open until its last required member is satisfied: the bundle of `module-blueprints` needs the validated Service blueprint and the context map, the bundle of `database-blueprint` the validated Service blueprint and the domain model, in whatever order they arrive. When the last required member is satisfied and the members are consistent with each other, the correlation moves from Open to Satisfied through `LastRequiredMemberSatisfied`: the bundle fingerprint is computed as sha256 over the sorted list of slot, id, version and hash of every satisfied required and optional member, the bundle document `readiness-bundle-v1` with one reference per slot is stored through `ArtifactService/Artifacts.Store`, and `WorkflowEngineService/ReadinessSatisfied` is written in the same transaction. When ArtifactService is unavailable the correlation stays Open with its members, nothing is announced and the work is retried, a branch AIFACTORY-US-009 proves on the first chain. No chain definition of this increment declares an artifact or an approval member; both kinds are proven on a fixture definition that carries the member slots of model/workflows/ux-blueprint.yaml, and events whose producers arrive in later increments are fixture events built from the contracts package. On the wire the activation block of `WorkflowDefinition` gains the member kind signal with its reference fields through the contract task of AIFACTORY-US-498. Four points are not stated by the model and are reported to the owner. A signal member that names no `version_ref` or no `hash_ref`, as the slots context-map and domain-model do, has no hash or no version, so what makes a later signal a newer version of such a member is open. Which payload fields are the id and the version of an approval member is open; this PBI keeps `approvalId` as the id and leaves the version empty. Through which operation the engine reads the versions and hashes the memo names is open: `ApprovalDecided` carries `proposalReference` and the model names no read for it, so this PBI fetches the memo through `ArtifactService/Artifacts.Fetch`. And the entity `ReadinessMember` describes its `kind` as blueprint, artifact or approval, without the kind signal that the definitions and the consume rows of the model use. Kind: behavior. Traces: services: WorkflowEngineService, BlueprintService, GenerationRecipeService, ArtifactService, RunControlService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: ArtifactService/Artifacts.Store, ArtifactService/Artifacts.Fetch; events: WorkflowEngineService/ReadinessSatisfied, BlueprintService/BlueprintValidated, BlueprintService/ContextMapDerived, BlueprintService/DomainModelDerived, GenerationRecipeService/RecipeApproved, ArtifactService/ArtifactStored, RunControlService/ApprovalDecided; workflows: module-blueprints, database-blueprint, generate-product; descriptors: readiness-bundle-v1; adrs: ADR-0015, ADR-0026; requirements: FR-03; scenarios: SCN-WorkflowEngineService-015. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-497, AIFACTORY-US-498, feature:blueprint-service, feature:generation-recipe-service, feature:artifact-service, feature:run-control-service. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/schemas/workflow.schema.json, model/workflows/module-blueprints.yaml, model/workflows/database-blueprint.yaml, model/workflows/generate-product.yaml, model/workflows/ux-blueprint.yaml, docs/architecture/adr/0026-requirements-to-ux-handoff.md, docs/reference/schemas/readiness-bundle.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the loaded definition `module-blueprints`, whose activation names the required slots service-blueprint and context-map, when a `BlueprintService/BlueprintValidated` with kind Service and `passed` true for a version of project scope is handled, then the `WorkflowEngineService/ReadinessCorrelation` is Open with one satisfied member and no `WorkflowEngineService/ReadinessSatisfied` is written; when the `BlueprintService/ContextMapDerived` of the same project then arrives, then the correlation moves to Satisfied through `LastRequiredMemberSatisfied`, `bundleFingerprint` is the sha256 over the sorted list of slot, id, version and hash of both members, and `WorkflowEngineService/ReadinessSatisfied` carries that fingerprint and the `bundleRef` of the `readiness-bundle-v1` document stored through `ArtifactService/Artifacts.Store`; the same holds for `database-blueprint` with `BlueprintService/DomainModelDerived`, and in either order of arrival (SCN-WorkflowEngineService-015, ADR-0026).",
        "AC2: Given a member of kind signal, when its event arrives and the predicate of the slot holds, then the member takes its id, version and hash from the payload fields the slot names: `contextMapId` and `blueprintVersion` of `BlueprintService/ContextMapDerived` for the slot context-map, `domainModelId` of `BlueprintService/DomainModelDerived` for the slot domain-model, and `recipeId` and `version` of `GenerationRecipeService/RecipeApproved` for the slot recipe of `generate-product`, whose bundle of one member is Satisfied by that event alone; a part the slot names no field for stays empty, no latest version is resolved, and an event whose predicate does not hold, with `contexts` zero, `aggregates` zero or no `approvedBy`, satisfies nothing (model/workflows/module-blueprints.yaml, model/workflows/generate-product.yaml).",
        "AC3: Given a fixture definition with the artifact slots of model/workflows/ux-blueprint.yaml, when an `ArtifactService/ArtifactStored` arrives whose `descriptor` equals the descriptor of a slot, then that member is satisfied with `artifactId`, `versionInChain` and `contentHash` of the event and names the event that satisfied it; an `ArtifactService/ArtifactStored` with another descriptor, without a descriptor, or of another tenant or project satisfies no member and writes nothing (ADR-0026, ADR-0015).",
        "AC4: Given the same fixture definition with its approval slot and its blueprint and artifact members satisfied, when a `RunControlService/ApprovalDecided` arrives with the state Approved and the proposal descriptor of the slot, and the memo it approves, read through `ArtifactService/Artifacts.Fetch`, names the versions and hashes the other members hold, then the approval member is satisfied with `proposalHash` and the `WorkflowEngineService/ReadinessCorrelation` moves to Satisfied; a decision in any other state, with another proposal descriptor, or whose memo names other versions or hashes than the members hold satisfies nothing, and the correlation stays Open (model/services/agent-mesh/WorkflowEngineService.yaml, ADR-0026).",
        "AC5: Given a member signal delivered twice, a `BlueprintService/BlueprintValidated` with `passed` false, of another kind or for a version that is not of project scope, or a signal of another tenant or project, when it is handled, then a repeated member is a no-op on `correlationId`, slot and `refHash`, and a signal that does not match satisfies no member and writes nothing (SCN-WorkflowEngineService-015, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/module-blueprints.yaml",
        "model/workflows/database-blueprint.yaml",
        "model/workflows/generate-product.yaml",
        "model/workflows/ux-blueprint.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2021",
        "AIFACTORY-TASK-2022",
        "AIFACTORY-TASK-2023"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5815,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "BlueprintService",
          "GenerationRecipeService",
          "ArtifactService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store",
          "ArtifactService/Artifacts.Fetch"
        ],
        "events": [
          "WorkflowEngineService/ReadinessSatisfied",
          "BlueprintService/BlueprintValidated",
          "BlueprintService/ContextMapDerived",
          "BlueprintService/DomainModelDerived",
          "GenerationRecipeService/RecipeApproved",
          "ArtifactService/ArtifactStored",
          "RunControlService/ApprovalDecided"
        ],
        "workflows": [
          "module-blueprints",
          "database-blueprint",
          "generate-product"
        ],
        "descriptors": [
          "readiness-bundle-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-03"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-015"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-497",
        "AIFACTORY-US-498",
        "feature:blueprint-service",
        "feature:generation-recipe-service",
        "feature:artifact-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/schemas/workflow.schema.json",
        "model/workflows/module-blueprints.yaml",
        "model/workflows/database-blueprint.yaml",
        "model/workflows/generate-product.yaml",
        "model/workflows/ux-blueprint.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-505]",
      "number": 505
    },
    {
      "id": "AIFACTORY-TASK-2021",
      "type": "task",
      "parent": "AIFACTORY-US-505",
      "title": "Member matching by kind and the member side of the ReadinessCorrelationGrain up to the Satisfied bundle",
      "sequence": "02.02.15.01",
      "description": "Member matching by kind and the member side of the ReadinessCorrelationGrain up to the Satisfied bundle. Expected output: The ReadinessCorrelator matches each signal against the activation members of the loaded definitions by the predicate of the slot within the tenant and project of the signal: blueprint members by kind, passed and project scope, signal members with id, version and hash from the payload fields the slot names, artifact members by descriptor, approval members by the state Approved, the proposal descriptor and a memo that names the versions and hashes of the other members; the ReadinessCorrelationGrain opens the correlation on the first matching signal with every slot of the block, for the workflow release the resolver seam returns, serialises member updates idempotently on correlationId, slot and refHash, and on the last required member computes the fingerprint over the sorted slot, id, version and hash list, stores the readiness-bundle-v1 document through Artifacts.Store and moves the correlation to Satisfied with ReadinessSatisfied in the same transaction; an unavailable ArtifactService leaves it Open.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The ReadinessCorrelator matches each signal against the activation members of the loaded definitions by the predicate of the slot within the tenant and project of the signal: blueprint members by kind, passed and project scope, signal members with id, version and hash from the payload fields the slot names, artifact members by descriptor, approval members by the state Approved, the proposal descriptor and a memo that names the versions and hashes of the other members; the ReadinessCorrelationGrain opens the correlation on the first matching signal with every slot of the block, for the workflow release the resolver seam returns, serialises member updates idempotently on correlationId, slot and refHash, and on the last required member computes the fingerprint over the sorted slot, id, version and hash list, stores the readiness-bundle-v1 document through Artifacts.Store and moves the correlation to Satisfied with ReadinessSatisfied in the same transaction; an unavailable ArtifactService leaves it Open."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5815,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2021]",
      "number": 2021
    },
    {
      "id": "AIFACTORY-TASK-2022",
      "type": "task",
      "parent": "AIFACTORY-US-505",
      "title": "Fixture definitions and fixture events for the four member kinds",
      "sequence": "02.02.15.02",
      "description": "Fixture definitions and fixture events for the four member kinds. Expected output: The fixture set of AIFACTORY-TASK-1995 serves the activation blocks of module-blueprints, database-blueprint and generate-product, and gains one fixture definition with the blueprint, approval and artifact slots of model/workflows/ux-blueprint.yaml; fixture events built from the contracts package cover BlueprintValidated, ContextMapDerived, DomainModelDerived, RecipeApproved, ArtifactStored and ApprovalDecided, each in a variant whose predicate holds and one whose predicate does not, and a memo fixture exists in a variant that names the versions and hashes of the members and one that names others; the fake registry answers the resolver seam with a fixed release id.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The fixture set of AIFACTORY-TASK-1995 serves the activation blocks of module-blueprints, database-blueprint and generate-product, and gains one fixture definition with the blueprint, approval and artifact slots of model/workflows/ux-blueprint.yaml; fixture events built from the contracts package cover BlueprintValidated, ContextMapDerived, DomainModelDerived, RecipeApproved, ArtifactStored and ApprovalDecided, each in a variant whose predicate holds and one whose predicate does not, and a memo fixture exists in a variant that names the versions and hashes of the members and one that names others; the fake registry answers the resolver seam with a fixed release id."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5815,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2022]",
      "number": 2022
    },
    {
      "id": "AIFACTORY-TASK-2023",
      "type": "task",
      "parent": "AIFACTORY-US-505",
      "title": "Verify satisfy-readiness-members-by-kind through the acceptance suite",
      "sequence": "02.02.15.03",
      "description": "Verify satisfy-readiness-members-by-kind through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=satisfy-readiness-members-by-kind\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-505 and the given of SCN-WorkflowEngineService-015: the bundles of two members that are Open after the first and Satisfied after the last in either order, the fingerprint over both members, the signal members filled from the payload fields their slots name, the artifact member matched by descriptor, the approval member satisfied only by an Approved decision whose memo names the versions of the members, the signals that satisfy nothing and the repeated member; the branch of an unavailable artifact store is proven by AIFACTORY-TASK-208 of AIFACTORY-US-009.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=satisfy-readiness-members-by-kind\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-505 and the given of SCN-WorkflowEngineService-015: the bundles of two members that are Open after the first and Satisfied after the last in either order, the fingerprint over both members, the signal members filled from the payload fields their slots name, the artifact member matched by descriptor, the approval member satisfied only by an Approved decision whose memo names the versions of the members, the signals that satisfy nothing and the repeated member; the branch of an unavailable artifact store is proven by AIFACTORY-TASK-208 of AIFACTORY-US-009."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5815,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2023]",
      "number": 2023
    },
    {
      "id": "AIFACTORY-US-009",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-012",
      "title": "A validated blueprint starts the next workflow by itself: a readiness correlation joins the signals and submits exactly one run through Run Control",
      "sequence": "02.02.16",
      "description": "As a requester, I want the architecture decomposition to start when my Vision Blueprint is validated, without anyone submitting it, so that the chain moves from one workflow to the next on evidence, not on a person remembering. Every workflow definition that a person does not submit is readiness-activated (ADR-0026 with its amendment): its `activation` block names the member slots the workflow needs, each satisfied by an event with a predicate. How a signal satisfies a member of each kind, and when a bundle of several members is complete, is delivered by AIFACTORY-US-505; this PBI delivers the life of the correlation around it and proves the whole on the first chain, whose bundle has the one slot vision-blueprint. The `ReadinessCorrelator` consumes the signals through the inbox and handles each within the trusted tenant and project of the signal. The first signal for a project and operation opens a `ReadinessCorrelation` in state Open: the alias of the definition is resolved once through `AgentRegistryService/AssetPublication.ResolveRelease` to an immutable `workflowReleaseId`, which is persisted, is part of the key and never changes afterwards, so a moved alias never changes an open correlation. The alias is the one the activation block declares in `submit.release_alias`, `latest` in model/workflows/architecture-decomposition.yaml, and the option `Workflows:Readiness:StarterReleaseAlias` is the value used when the block declares none. In this increment the release is a seeded Draft release of the thin registry. AgentRegistryService is a fail-fast dependency: when `ResolveRelease` is unavailable, or the alias resolves to no release, no correlation opens, nothing is written and the signal is redelivered. When the last required member is satisfied and the members are consistent with each other, the correlation moves from Open to Satisfied: the bundle fingerprint is computed as sha256 over the sorted list of slot, id, version and hash of every satisfied member, the bundle document `readiness-bundle-v1` is stored through `ArtifactService/Artifacts.Store`, and `WorkflowEngineService/ReadinessSatisfied` is written in the same transaction with `bundleFingerprint` and `bundleRef`. ArtifactService is fail-fast as well: when it is unavailable the correlation does not move to Satisfied and no `ReadinessSatisfied` is written. The engine then submits the run and never creates run state itself: the canonical submission body `run-submission-v1` is stored once through the same operation (`submissionRef`), and `RunControlService/SubmitRun` is called with the workload identity of the engine as requester, the `releaseId` and never an alias, and an `Idempotency-Key` equal to `{scope}:{operation}:{workflowReleaseId}:{bundleFingerprint}`. On 202 the correlation records the `runId`, moves from Satisfied to Submitted, and `WorkflowEngineService/ReadinessRunSubmitted` is written in the same transaction; the accepted run then starts like any other (AIFACTORY-US-499). A repeated signal returns the existing run under the same key and body. A timeout or an uncertain answer is retried by the correlator, exponentially with five attempts, with the same key and the stored canonical body, so Run Control returns the existing run or accepts once. When the five attempts are exhausted, for a submission or for an unavailable dependency, the correlation keeps the state it had, nothing partial is written and the failed work is recorded once with its scope, as the worker hosting of AIFACTORY-US-497 defines it; a Satisfied correlation stays Satisfied, and the same key submits it once when the work runs again. A 409 for the key with a different input hash marks the correlation Superseded with reason conflict, names the existing run for an operator and never submits a second run. A newer version of any member opens a new correlation with a new fingerprint and supersedes the Open or Satisfied one, with `supersededBy` and `WorkflowEngineService/ReadinessSuperseded`; a Submitted correlation is never mutated, and a signal that arrives for it is a no-op. Beyond `Workflows:Readiness:MaxOpenPerProject` open correlations per project and operation the oldest is superseded. The `ReadinessExpiryReconciler` on its schedule, and the expiry reminder of the grain, move an Open correlation older than `Workflows:Readiness:CorrelationExpiryDays` to Expired and write `ReadinessSuperseded` with the reason expired, so a stale half-satisfied bundle never submits a run later. `connectsoft.factory.workflows.readiness_open` and `connectsoft.factory.workflows.readiness_submissions` follow each change. AuditService takes `ReadinessRunSubmitted` as the evidence of a run the engine requested, and StudioBff and DashboardService consume the three events, each in its own PBI and increment. The first chain proves the path: a validated Vision Blueprint submits exactly one run of `architecture-decomposition`, and the first step architecture-decomposition/identify-contexts becomes ready when the accepted run opens. The steps of that definition and the releases of its agents are specified by its own feature: AIFACTORY-TASK-170 of feature `wf-architecture-decomposition` authors the agent releases, and the engine neither loads nor executes an agent release. Two points are not stated by the model and are reported to the owner: a 409 of `SubmitRun` that names a gate of Run Control (a suspended, closing or closed project, a deprecated release, a retired environment), a 400 and a 403 are refusals no transition of `ReadinessState` covers; and where the notice to an operator about a conflict is raised is not modelled. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService, BlueprintService, AgentRegistryService, ArtifactService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun, AgentRegistryService/AssetPublication.ResolveRelease, ArtifactService/Artifacts.Store; events: WorkflowEngineService/ReadinessSatisfied, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, BlueprintService/BlueprintValidated, RunControlService/RunAccepted; steps: architecture-decomposition/identify-contexts; workflows: architecture-decomposition; descriptors: readiness-bundle-v1, run-submission-v1; adrs: ADR-0012, ADR-0014, ADR-0026; requirements: FR-03, FUX-11; scenarios: SCN-WorkflowEngineService-015, SCN-WorkflowEngineService-016, SCN-WorkflowEngineService-017. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-497, AIFACTORY-US-498, AIFACTORY-US-499, AIFACTORY-US-505, feature:run-control-service, feature:blueprint-service, feature:agent-registry-service-thin, feature:artifact-service. Sources: model/services/agent-mesh/WorkflowEngineService.yaml, model/workflows/architecture-decomposition.yaml, docs/architecture/adr/0026-requirements-to-ux-handoff.md, docs/reference/schemas/readiness-bundle.schema.json, docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the loaded definition `architecture-decomposition`, whose activation names the one slot vision-blueprint and the alias `latest` in `submit.release_alias`, and a `BlueprintService/BlueprintValidated` with kind Vision and `passed` true for a version of project scope, when the `ReadinessCorrelator` handles it, then a `WorkflowEngineService/ReadinessCorrelation` opens with that alias resolved once to `workflowReleaseId` through `AgentRegistryService/AssetPublication.ResolveRelease`, moves to Satisfied with the bundle fingerprint and the `readiness-bundle-v1` document stored through `ArtifactService/Artifacts.Store`, and `WorkflowEngineService/ReadinessSatisfied` with `correlationId`, `tenantId`, `projectId`, `operation`, `workflowReleaseId`, `bundleFingerprint` and `bundleRef` is written in the same transaction and published on `workflows.readiness.v1.readiness-satisfied` under the canonical envelope (SCN-WorkflowEngineService-015, ADR-0026).",
        "AC2: Given a Satisfied correlation, when the correlator calls `RunControlService/SubmitRun` with the workload identity of the engine, the stored canonical body `run-submission-v1` that carries the `releaseId`, and the `Idempotency-Key` built from scope, operation, workflow release and bundle fingerprint, and Run Control answers 202, then the correlation is Submitted with `submittedRunId`, `WorkflowEngineService/ReadinessRunSubmitted` with `correlationId`, `tenantId`, `projectId`, `operation`, `runId` and `idempotencyKey` is written in the same transaction and published on `workflows.readiness.v1.readiness-run-submitted`, exactly one run of `architecture-decomposition` exists, and the `RunControlService/RunAccepted` of that run opens the workflow run whose first step architecture-decomposition/identify-contexts becomes ready (SCN-WorkflowEngineService-016, FR-03, ADR-0014).",
        "AC3: Given the same signal delivered twice, a timeout or an uncertain answer of `RunControlService/SubmitRun`, or a signal that arrives after the correlation is Submitted, when it is handled, then the member update is idempotent on `correlationId`, slot and `refHash`, the retry sends the same `Idempotency-Key` and the stored canonical body so the same run is returned, the Submitted correlation is not mutated, `connectsoft.factory.workflows.readiness_submissions` counts the outcome, and no second run exists (SCN-WorkflowEngineService-016, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC4: Given an Open or a Satisfied correlation and a newer version of one of its members, a 409 of `RunControlService/SubmitRun` for the key with a different input hash, or more open correlations of the project and operation than `Workflows:Readiness:MaxOpenPerProject`, when it is handled, then a new correlation with a new fingerprint opens in the first case, the affected correlation is Superseded with `supersededBy` where a newer one replaced it and with its `reason`, `WorkflowEngineService/ReadinessSuperseded` with `correlationId`, `tenantId`, `projectId`, `supersededBy` and `reason` is written in the same transaction and published on `workflows.readiness.v1.readiness-superseded`, and the conflict names the existing run and submits no second run (SCN-WorkflowEngineService-017).",
        "AC5: Given an Open correlation older than `Workflows:Readiness:CorrelationExpiryDays`, when the expiry reminder or the `ReadinessExpiryReconciler` runs, then it moves to Expired and `WorkflowEngineService/ReadinessSuperseded` with the reason expired is written in the same transaction, and a second pass for the same `correlationId` and version changes nothing; given `AgentRegistryService/AssetPublication.ResolveRelease` unavailable, or answering that the alias resolves to no release, when a correlation would open, then no correlation opens, nothing is written and the signal is redelivered; given ArtifactService unavailable at `ArtifactService/Artifacts.Store`, then the correlation does not move to Satisfied and no `WorkflowEngineService/ReadinessSatisfied` is written; after the five attempts of the `ReadinessCorrelator` the correlation keeps its state, nothing partial is written and one failed-work record with its scope exists; and for each of the three readiness events a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-WorkflowEngineService-017, SCN-WorkflowEngineService-015, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/workflows/architecture-decomposition.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/reference/schemas/readiness-bundle.schema.json",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-206",
        "AIFACTORY-TASK-207",
        "AIFACTORY-TASK-2018",
        "AIFACTORY-TASK-208",
        "AIFACTORY-TASK-661"
      ],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5816,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "BlueprintService",
          "AgentRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "WorkflowEngineService/ReadinessSatisfied",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "BlueprintService/BlueprintValidated",
          "RunControlService/RunAccepted"
        ],
        "steps": [
          "architecture-decomposition/identify-contexts"
        ],
        "workflows": [
          "architecture-decomposition"
        ],
        "descriptors": [
          "readiness-bundle-v1",
          "run-submission-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-03",
          "FUX-11"
        ],
        "scenarios": [
          "SCN-WorkflowEngineService-015",
          "SCN-WorkflowEngineService-016",
          "SCN-WorkflowEngineService-017"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-497",
        "AIFACTORY-US-498",
        "AIFACTORY-US-499",
        "AIFACTORY-US-505",
        "feature:run-control-service",
        "feature:blueprint-service",
        "feature:agent-registry-service-thin",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/workflows/architecture-decomposition.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/reference/schemas/readiness-bundle.schema.json",
        "docs/planes/agent-runtime/services/workflow-engine-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-009]",
      "number": 9
    },
    {
      "id": "AIFACTORY-TASK-206",
      "type": "task",
      "parent": "AIFACTORY-US-009",
      "title": "ReadinessCorrelator: the alias resolved once when a correlation opens and the single submission through SubmitRun",
      "sequence": "02.02.16.01",
      "description": "ReadinessCorrelator: the alias resolved once when a correlation opens and the single submission through SubmitRun. Expected output: The resolver behind the member side of AIFACTORY-TASK-2021 resolves the alias the activation block declares in submit.release_alias, or the option StarterReleaseAlias when the block declares none, once through AssetPublication.ResolveRelease when a correlation opens and persists workflowReleaseId; an unavailable registry or an alias that resolves to no release opens no correlation, writes nothing and lets the signal be redelivered; for a Satisfied correlation the correlator stores the canonical submission body once through Artifacts.Store, submits one run through SubmitRun with the idempotency key of the model, the releaseId and the workload identity of the engine, and on 202 records the runId and writes ReadinessRunSubmitted in the same transaction; a timeout is retried with the same key and body, a 409 with a different input hash supersedes the correlation with reason conflict, and exhausted retries leave the correlation in its state with one failed-work record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The resolver behind the member side of AIFACTORY-TASK-2021 resolves the alias the activation block declares in submit.release_alias, or the option StarterReleaseAlias when the block declares none, once through AssetPublication.ResolveRelease when a correlation opens and persists workflowReleaseId; an unavailable registry or an alias that resolves to no release opens no correlation, writes nothing and lets the signal be redelivered; for a Satisfied correlation the correlator stores the canonical submission body once through Artifacts.Store, submits one run through SubmitRun with the idempotency key of the model, the releaseId and the workload identity of the engine, and on 202 records the runId and writes ReadinessRunSubmitted in the same transaction; a timeout is retried with the same key and body, a 409 with a different input hash supersedes the correlation with reason conflict, and exhausted retries leave the correlation in its state with one failed-work record."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5816,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-206]",
      "number": 206
    },
    {
      "id": "AIFACTORY-TASK-207",
      "type": "task",
      "parent": "AIFACTORY-US-009",
      "title": "Fixture release of architecture-decomposition in the fake registry",
      "sequence": "02.02.16.02",
      "description": "Fixture release of architecture-decomposition in the fake registry. Expected output: The fake registry of AIFACTORY-TASK-1995 serves the Draft release of architecture-decomposition with its alias and its closure entries as references, so the correlation of the first chain resolves the alias and the accepted run loads the definition; no agent release is authored here, AIFACTORY-TASK-170 of feature wf-architecture-decomposition authors the releases of enterprise-architect and domain-modeler.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The fake registry of AIFACTORY-TASK-1995 serves the Draft release of architecture-decomposition with its alias and its closure entries as references, so the correlation of the first chain resolves the alias and the accepted run loads the definition; no agent release is authored here, AIFACTORY-TASK-170 of feature wf-architecture-decomposition authors the releases of enterprise-architect and domain-modeler."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5816,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-207]",
      "number": 207
    },
    {
      "id": "AIFACTORY-TASK-2018",
      "type": "task",
      "parent": "AIFACTORY-US-009",
      "title": "Supersede by a newer member version, the limit of open correlations and the ReadinessExpiryReconciler",
      "sequence": "02.02.16.03",
      "description": "Supersede by a newer member version, the limit of open correlations and the ReadinessExpiryReconciler. Expected output: A newer version of a member opens a new correlation with a new fingerprint and supersedes the Open or Satisfied one with supersededBy and ReadinessSuperseded; beyond MaxOpenPerProject the oldest open correlation of the project and operation is superseded; the expiry reminder of the grain and the scheduled ReadinessExpiryReconciler move Open correlations older than CorrelationExpiryDays to Expired with ReadinessSuperseded and the reason expired, idempotent on correlationId plus version; a Submitted correlation is never mutated; readiness_open and readiness_submissions are emitted with their modelled dimensions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A newer version of a member opens a new correlation with a new fingerprint and supersedes the Open or Satisfied one with supersededBy and ReadinessSuperseded; beyond MaxOpenPerProject the oldest open correlation of the project and operation is superseded; the expiry reminder of the grain and the scheduled ReadinessExpiryReconciler move Open correlations older than CorrelationExpiryDays to Expired with ReadinessSuperseded and the reason expired, idempotent on correlationId plus version; a Submitted correlation is never mutated; readiness_open and readiness_submissions are emitted with their modelled dimensions."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5816,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2018]",
      "number": 2018
    },
    {
      "id": "AIFACTORY-TASK-208",
      "type": "task",
      "parent": "AIFACTORY-US-009",
      "title": "Supersede, duplicate and dependency failure tests",
      "sequence": "02.02.16.04",
      "description": "Supersede, duplicate and dependency failure tests. Expected output: Acceptance tests cover a duplicate event, a newer member version, a signal after Submitted, an uncertain answer of SubmitRun and a 409 with a different input hash, and prove AC3 and AC4 of AIFACTORY-US-009 against the fake Run Control of AIFACTORY-TASK-2002: one run per key, the superseded correlation with its reason, and no second run; three further cases prove the dependency branches of AC5: ResolveRelease unavailable or an alias that resolves to no release, where no correlation opens and the signal is redelivered; ArtifactService unavailable, where the correlation is not Satisfied and no ReadinessSatisfied is written; and the five attempts of the ReadinessCorrelator exhausted, where the correlation keeps its state and one failed-work record with its scope exists.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Acceptance tests cover a duplicate event, a newer member version, a signal after Submitted, an uncertain answer of SubmitRun and a 409 with a different input hash, and prove AC3 and AC4 of AIFACTORY-US-009 against the fake Run Control of AIFACTORY-TASK-2002: one run per key, the superseded correlation with its reason, and no second run; three further cases prove the dependency branches of AC5: ResolveRelease unavailable or an alias that resolves to no release, where no correlation opens and the signal is redelivered; ArtifactService unavailable, where the correlation is not Satisfied and no ReadinessSatisfied is written; and the five attempts of the ReadinessCorrelator exhausted, where the correlation keeps its state and one failed-work record with its scope exists."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5816,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-208]",
      "number": 208
    },
    {
      "id": "AIFACTORY-TASK-661",
      "type": "task",
      "parent": "AIFACTORY-US-009",
      "title": "Verify readiness-starts-next by running the declared command",
      "sequence": "02.02.16.05",
      "description": "Verify readiness-starts-next by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-015|Scenario=SCN-WorkflowEngineService-016|Scenario=SCN-WorkflowEngineService-017)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-009, including the single run of architecture-decomposition submitted for a validated Vision Blueprint, the expiry of an Open correlation and the publication and payload of ReadinessSatisfied, ReadinessRunSubmitted and ReadinessSuperseded; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WorkflowEngineService-015|Scenario=SCN-WorkflowEngineService-016|Scenario=SCN-WorkflowEngineService-017)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-009, including the single run of architecture-decomposition submitted for a validated Vision Blueprint, the expiry of an Open correlation and the publication and payload of ReadinessSatisfied, ReadinessRunSubmitted and ReadinessSuperseded; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/WorkflowEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 58,
      "phase": "factory",
      "stackRank": 5816,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-661]",
      "number": 661
    },
    {
      "id": "AIFACTORY-FEAT-013",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-002",
      "title": "AgentRuntimeWorker: gateway delivery",
      "sequence": "02.03",
      "description": "AgentRuntimeWorker is the platform API gateway of bounded context BC-06 (Execution). The internal gateway of the Agent Mesh platform (ADR-0028): fronts AgentRuntimeService and WorkflowEngineService, which deploy alone as silo kinds of one Orleans cluster (ADR-0024); routes internal gRPC and owns no run state. Its own repository is ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker. Delivers: AgentRuntimeWorker (complete). Increment I3: Studio. Build order 110 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:feature",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-080",
        "AIFACTORY-US-472",
        "AIFACTORY-US-473",
        "AIFACTORY-US-474",
        "AIFACTORY-US-475"
      ],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11000,
      "titlePrefix": "[AIFACTORY-FEAT-013]",
      "number": 13
    },
    {
      "id": "AIFACTORY-US-080",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-013",
      "title": "AgentRuntimeWorker routes its platform's calls under a trusted scope",
      "sequence": "02.03.01",
      "description": "As an operator, I want one gateway in front of AgentRuntimeService and WorkflowEngineService that validates tokens and scopes, so that no service of the platform is reachable except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the Agent Mesh gateway. ADR-0028 decision 4 makes AgentRuntimeWorker the internal gateway of the platform: it fronts the two services the model lists under `deployment.fronts`, AgentRuntimeService and WorkflowEngineService, which deploy alone as two silo kinds of one Orleans cluster (ADR-0024), routes their REST operations and their internal gRPC methods, validates tokens and scopes and owns no run state. It keeps the identifier of the former runtime worker so that references stay valid, and it is a gateway and no worker: it executes no attempt and hosts no silo, no grain and no job. The repository ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker is scaffolded from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none: the gateway has no relational store, no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events), holds no secret, and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package; the gateway copies neither the accessor nor the token contract. Work never enters the Agent Mesh through this gateway: an attempt arrives as `AttemptDispatched` in the inbox of AgentRuntimeService. What passes the gateway is the synchronous traffic into the platform: interrupt requests and timeline reads of the Control plane over gRPC, and attempt timeline and workflow run graph reads of the Studio BFF. The feature is delivered by four PBIs beside this one: the fronts file and the routes generated from it (AIFACTORY-US-472), the read and sandbox routes under token, tenant and scope (AIFACTORY-US-473), the internal gRPC routes with the pass-through of the two shared-write methods (AIFACTORY-US-474), and health, modules, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-475). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. Every route of the two services addresses its resource by an identifier only, an attempt, a release, a run or a definition, so the gateway, which holds no state, forwards under the tenant of the token and the scope of the operation; the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment of D113), and the gateway returns that answer unchanged. Both services were delivered in I1 and are reached on their internal addresses until this gateway exists. This feature delivers the routes and proves them with its own suite against fakes of the two services; it changes no caller. The address a caller uses for a service of the Agent Mesh is a deployment value of the feature that delivers that caller, in its own repository, and the model does not name the callers with one voice: the gateway lists ControlPlaneApi and StudioBff as its inbound callers, while the two services list RunControlService and StudioBff. Which feature moves the address of each caller to the gateway, and which closes the internal addresses of the two services to callers outside the platform, is therefore not claimed here and is reported to the owner. The gateway invents no response. Kind: enabling. Traces: services: AgentRuntimeWorker, AgentRuntimeService, WorkflowEngineService; apis: AgentRuntimeWorker/RuntimeHealth; adrs: ADR-0012, ADR-0015, ADR-0017, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-472, AIFACTORY-US-473, AIFACTORY-US-474, AIFACTORY-US-475, feature:component-api-gateway-template, feature:component-extensions-ai, feature:agent-runtime-service, feature:workflow-engine-service. Sources: model/services/agent-mesh/AgentRuntimeWorker.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/agent-runtime/services/agent-runtime-worker/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker scaffolded with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, when its pipeline runs, then the solution builds, the tests pass with complete reports and a container image is published (ADR-0028, model/services/agent-mesh/AgentRuntimeWorker.yaml).",
        "AC2: Given a valid token for a route of AgentRuntimeService and for a route of WorkflowEngineService, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with tenant, project and correlation id, the fronted service answers and the response returns unchanged, as AIFACTORY-US-473 and AIFACTORY-US-474 prove per route class (ADR-0015).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration, a message consumer, a grain or a silo, the gateway binds no relational store, no outbox and no inbox, and no event of the model lists AgentRuntimeWorker as a consumer; the silo kinds of the cluster stay in the two fronted services (ADR-0028, ADR-0024, ADR-0012, model/services/agent-mesh/AgentRuntimeWorker.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `AgentRuntimeWorker/RuntimeHealth` is probed and one replica is stopped, then readiness reflects the identity platform and the two fronted services, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/agent-mesh/AgentRuntimeWorker.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-356",
        "AIFACTORY-TASK-1886",
        "AIFACTORY-TASK-659"
      ],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11001,
      "kind": "enabling",
      "traces": {
        "services": [
          "AgentRuntimeWorker",
          "AgentRuntimeService",
          "WorkflowEngineService"
        ],
        "apis": [
          "AgentRuntimeWorker/RuntimeHealth"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0017",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-472",
        "AIFACTORY-US-473",
        "AIFACTORY-US-474",
        "AIFACTORY-US-475",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-080]",
      "number": 80
    },
    {
      "id": "AIFACTORY-TASK-356",
      "type": "task",
      "parent": "AIFACTORY-US-080",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the Factory profile",
      "sequence": "02.03.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the Factory profile. Expected output: The repository exists, the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker --UseFactoryProfile true --GatewayRole Platform` from the pinned template package is committed, the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker --UseFactoryProfile true --GatewayRole Platform` from the pinned template package is committed, the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-356]",
      "number": 356
    },
    {
      "id": "AIFACTORY-TASK-1886",
      "type": "task",
      "parent": "AIFACTORY-US-080",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "02.03.01.02",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 20, the ports https 7500 and grpc 7502, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/agent-mesh/AgentRuntimeWorker.yaml records them, and sets Runtime:Host:FrontedServices to the two service ids of deployment.fronts; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 20, the ports https 7500 and grpc 7502, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/agent-mesh/AgentRuntimeWorker.yaml records them, and sets Runtime:Host:FrontedServices to the two service ids of deployment.fronts; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11001,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1886]",
      "number": 1886
    },
    {
      "id": "AIFACTORY-TASK-659",
      "type": "task",
      "parent": "AIFACTORY-US-080",
      "title": "Verify agent-runtime-worker-routes-its-platform by running the declared command",
      "sequence": "02.03.01.03",
      "description": "Verify agent-runtime-worker-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-080, that is the scaffold, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the two fronted services, probes AgentRuntimeWorker/RuntimeHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-080, that is the scaffold, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the two fronted services, probes AgentRuntimeWorker/RuntimeHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-659]",
      "number": 659
    },
    {
      "id": "AIFACTORY-US-472",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-013",
      "title": "Agent Mesh fronts file: named clients and the six REST and five gRPC routes of the two fronted services, generated at build",
      "sequence": "02.03.02",
      "description": "As a platform admin, I want the route table of the Agent Mesh gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Agent Mesh. It lists the two services of `deployment.fronts` in model/services/agent-mesh/AgentRuntimeWorker.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method, scope, side-effect class and idempotency. For AgentRuntimeService these are the three REST reads `GetAttemptTimeline`, `ListCheckpoints` and `GetLoadedRelease` and the three methods of the gRPC service `Runtime`, `Interrupt`, `AnswerDecision` and `WatchAttempt`. For WorkflowEngineService they are the REST operations `ValidateWorkflowDefinition`, `GetWorkflowRunGraph` and `ListWorkflowDefinitionVersions` and the two methods of the gRPC service `WorkflowEngine`, `PlanNextSteps` and `GetRunGraph`. That is six REST routes and five gRPC routes; `WatchAttempt` is a server stream, and its route forwards the stream and its cancellation without buffering. Each route carries the scope and the side-effect class of its operation, which is what the route PBIs of this feature enforce. A test lists the emitted route table against the file and against the two service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `RuntimeHealth` and `RuntimeModules`, transforms no payload and composes no response from the two services: the response of a fronted service returns unchanged. The fronts file alone decides which routes are hosted, because the routes are generated from it at build. The option `Runtime:Host:FrontedServices` of the model is bound at startup and compared with the services of the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable, so a change of the list is a new build and a new deployment. The modelled default of the option holds the names attempt-execution and workflow-engine, which match neither service id of `deployment.fronts`; that mismatch is reported to the owner as a model correction, and until the model is corrected the deployment values set the option to the two service ids. Kind: enabling. Traces: services: AgentRuntimeWorker, AgentRuntimeService, WorkflowEngineService; adrs: ADR-0015, ADR-0028. Depends on: feature:component-api-gateway-template, feature:agent-runtime-service, feature:workflow-engine-service. Sources: model/services/agent-mesh/AgentRuntimeWorker.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/planes/agent-runtime/services/agent-runtime-worker/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Agent Mesh, when the gateway builds, then one named HTTP client and one gRPC client exist for AgentRuntimeService and for WorkflowEngineService and one route per REST operation and gRPC method of the two services, six REST and five gRPC routes, each with the scope, side-effect class and idempotency of its operation, and the route table test passes against model/services/agent-mesh/AgentRuntimeWorker.yaml and the two service files it fronts (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given a value of `Runtime:Host:FrontedServices` that differs from the services of the fronts file, when the gateway starts, then startup fails with the differing name; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, the tenant, the correlation id and the trace context, and the response of the fake returns unchanged (ADR-0015, model/services/agent-mesh/AgentRuntimeWorker.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-357",
        "AIFACTORY-TASK-1887",
        "AIFACTORY-TASK-1888"
      ],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11002,
      "kind": "enabling",
      "traces": {
        "services": [
          "AgentRuntimeWorker",
          "AgentRuntimeService",
          "WorkflowEngineService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-472]",
      "number": 472
    },
    {
      "id": "AIFACTORY-TASK-357",
      "type": "task",
      "parent": "AIFACTORY-US-472",
      "title": "Fronts file with the REST and gRPC operations of AgentRuntimeService and WorkflowEngineService",
      "sequence": "02.03.02.01",
      "description": "Fronts file with the REST and gRPC operations of AgentRuntimeService and WorkflowEngineService. Expected output: The fronts file lists the two services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class and idempotency; the build emits the named clients, the six REST and five gRPC routes and the route table; at startup the option Runtime:Host:FrontedServices is compared with the services of the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the two services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class and idempotency; the build emits the named clients, the six REST and five gRPC routes and the route table; at startup the option Runtime:Host:FrontedServices is compared with the services of the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-357]",
      "number": 357
    },
    {
      "id": "AIFACTORY-TASK-1887",
      "type": "task",
      "parent": "AIFACTORY-US-472",
      "title": "Fakes of the two fronted services and the token matrix of the acceptance suite",
      "sequence": "02.03.02.02",
      "description": "Fakes of the two fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake of AgentRuntimeService and one of WorkflowEngineService over REST and gRPC, each recording the headers and metadata it received and answering a configured status or stream, a switch that makes a fake stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience and a workload token with and without a service scope.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake of AgentRuntimeService and one of WorkflowEngineService over REST and gRPC, each recording the headers and metadata it received and answering a configured status or stream, a switch that makes a fake stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience and a workload token with and without a service scope."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11002,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1887]",
      "number": 1887
    },
    {
      "id": "AIFACTORY-TASK-1888",
      "type": "task",
      "parent": "AIFACTORY-US-472",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "02.03.02.03",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-472: one route per operation of model/services/agent-mesh/AgentRuntimeService.yaml and model/services/agent-mesh/WorkflowEngineService.yaml, the failing builds, the failing startup on an option value that differs from the fronts file, the 404 of an unknown path and one forwarded call per service and protocol.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-472: one route per operation of model/services/agent-mesh/AgentRuntimeService.yaml and model/services/agent-mesh/WorkflowEngineService.yaml, the failing builds, the failing startup on an option value that differs from the fronts file, the 404 of an unknown path and one forwarded call per service and protocol."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1888]",
      "number": 1888
    },
    {
      "id": "AIFACTORY-US-473",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-013",
      "title": "A read or sandbox route of the Agent Mesh forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "02.03.03",
      "description": "As a requester, I want my reads of an attempt and of a workflow run to reach the service only with the tenant and the scope my token grants, so that I see what I am entitled to and nobody reads across a tenant through the gateway. A caller reaches a read or a sandbox operation of the Agent Mesh through the gateway: the Studio BFF reads the timeline and the checkpoints of an attempt, a loaded release, the graph of a workflow run and the loaded versions of a definition on behalf of a requester, an operator or an observer, and an asset maintainer has a workflow definition validated. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment on the audience of a user token); a client that also calls the gateway of the Control Plane requests a second token. The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names: `factory.runs.read` for `GetAttemptTimeline`, `ListCheckpoints` and `GetWorkflowRunGraph`, `factory.assets.read` for `GetLoadedRelease` and `ListWorkflowDefinitionVersions`, and `factory.assets.write` for the sandbox operation `ValidateWorkflowDefinition`. It takes the tenant from the `tid` claim, overwrites any tenant header of the caller and establishes the scope once with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package. No route of the two services names a project or a tenant in its path: each addresses an attempt, a release, a run or a definition by its identifier, and the sandbox route addresses nothing. A gateway without business state cannot know the project or the tenant of such a resource, so it forwards the call under the tenant of the token and the scope of the operation, with the authorization header, which carries the user token unchanged because no token is exchanged between a gateway and the service it fronts, the tenant in `X-Tenant-Id`, the correlation id and the trace context. The fronted service validates the token again, accepting the audience of its own gateway, applies its tenant row filter and answers 403 for a caller without a role in the project of the resource and 404 for a resource of another tenant, the same answer as for an unknown identifier (ADR-0015 amendment of D113); the gateway returns that answer unchanged. For a read route the response is served by the fronted service with no side effect. The sandbox route, `ValidateWorkflowDefinition`, has a workflow DSL document validated and reported on; it changes no shared state, and the gateway adds no gate of its own to the class. The gateway returns the response unchanged with the correlation id and keeps nothing of the call. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope of the operation 403; in each of these cases no fronted service is called, and the refusal is counted for the route and logged with the correlation id and without the token. When a fronted service does not answer, its routes answer 503 with a retry hint that names the service and never its address, and the routes of the other service keep serving. Kind: behavior. Traces: services: AgentRuntimeWorker, AgentRuntimeService, WorkflowEngineService; apis: AgentRuntimeService/GetAttemptTimeline, AgentRuntimeService/ListCheckpoints, AgentRuntimeService/GetLoadedRelease, WorkflowEngineService/ValidateWorkflowDefinition, WorkflowEngineService/GetWorkflowRunGraph, WorkflowEngineService/ListWorkflowDefinitionVersions; adrs: ADR-0015, ADR-0028; requirements: FUX-04; scenarios: SCN-AgentRuntimeWorker-003, SCN-AgentRuntimeWorker-004. Relates: screens: run-timeline, workflow-run-graph. Depends on: AIFACTORY-US-472, feature:component-api-gateway-template, feature:component-extensions-ai, feature:agent-runtime-service, feature:workflow-engine-service. Sources: model/services/agent-mesh/AgentRuntimeWorker.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/agent-runtime/services/agent-runtime-worker/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway and whose scope carries the scope of a read operation, when the route of `AgentRuntimeService/GetAttemptTimeline`, `AgentRuntimeService/ListCheckpoints`, `AgentRuntimeService/GetLoadedRelease`, `WorkflowEngineService/GetWorkflowRunGraph` or `WorkflowEngineService/ListWorkflowDefinitionVersions` is called, then the gateway forwards the call with the authorization header, the tenant of the `tid` claim, the correlation id and the trace context, the fronted service answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-AgentRuntimeWorker-003, ADR-0015).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope 403, and in none of these cases a fronted service is called; a call the gateway admits is forwarded, the 403 of the fake for a missing project role and its 404 for a resource of another tenant return unchanged, and a tenant header of the caller that names another tenant is overwritten with the `tid` claim before the call is forwarded (SCN-AgentRuntimeWorker-003, ADR-0015).",
        "AC3: Given a token with `factory.assets.write`, when the sandbox route of `WorkflowEngineService/ValidateWorkflowDefinition` is called, then the call is forwarded under the same token, tenant and scope rules, the gateway adds no gate of its own to the class and the answer of the service returns unchanged; the refusals apply as on a read route and no fronted service is called when the gateway refuses (SCN-AgentRuntimeWorker-004, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC4: Given AgentRuntimeService does not answer, when one of its read routes is called, then the gateway answers 503 with a problem response that carries a retry hint and names the service and never its address, invents no response, and the routes of WorkflowEngineService keep serving (SCN-AgentRuntimeWorker-003, model/services/agent-mesh/AgentRuntimeWorker.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1889",
        "AIFACTORY-TASK-1890"
      ],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11003,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeWorker",
          "AgentRuntimeService",
          "WorkflowEngineService"
        ],
        "apis": [
          "AgentRuntimeService/GetAttemptTimeline",
          "AgentRuntimeService/ListCheckpoints",
          "AgentRuntimeService/GetLoadedRelease",
          "WorkflowEngineService/ValidateWorkflowDefinition",
          "WorkflowEngineService/GetWorkflowRunGraph",
          "WorkflowEngineService/ListWorkflowDefinitionVersions"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-04"
        ],
        "scenarios": [
          "SCN-AgentRuntimeWorker-003",
          "SCN-AgentRuntimeWorker-004"
        ]
      },
      "relates": {
        "screens": [
          "run-timeline",
          "workflow-run-graph"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-472",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-473]",
      "number": 473
    },
    {
      "id": "AIFACTORY-TASK-1889",
      "type": "task",
      "parent": "AIFACTORY-US-473",
      "title": "Issuer, audience, scope and forwarded headers of the read and sandbox routes",
      "sequence": "02.03.03.01",
      "description": "Issuer, audience, scope and forwarded headers of the read and sandbox routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each of the five read routes and the sandbox route requires the scope of its operation and is marked as addressed by a resource id only, so the gateway checks token and scope and leaves the project role and the tenant of the resource to the fronted service; the tenant header is overwritten with the tid claim, the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header with the correlation id and the trace context; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each of the five read routes and the sandbox route requires the scope of its operation and is marked as addressed by a resource id only, so the gateway checks token and scope and leaves the project role and the tenant of the resource to the fronted service; the tenant header is overwritten with the tid claim, the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header with the correlation id and the trace context; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1889]",
      "number": 1889
    },
    {
      "id": "AIFACTORY-TASK-1890",
      "type": "task",
      "parent": "AIFACTORY-US-473",
      "title": "Verify the read and sandbox routes through the acceptance suite",
      "sequence": "02.03.03.02",
      "description": "Verify the read and sandbox routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeWorker-003|Scenario=SCN-AgentRuntimeWorker-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-473 over the token matrix: each read route forwarded with its headers, the 401 and 403 of the gateway without a call to a fake, the 403 and 404 of a fake returned unchanged, the overwritten tenant header, the sandbox route and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeWorker-003|Scenario=SCN-AgentRuntimeWorker-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-473 over the token matrix: each read route forwarded with its headers, the 401 and 403 of the gateway without a call to a fake, the 403 and 404 of a fake returned unchanged, the overwritten tenant header, the sandbox route and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1890]",
      "number": 1890
    },
    {
      "id": "AIFACTORY-US-474",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-013",
      "title": "An internal gRPC route admits only a workload token with the service scope of its operation and passes the two shared-write methods through once",
      "sequence": "02.03.04",
      "description": "The internal surface of the Agent Mesh is five gRPC methods, and their callers are services. Run Control asks the lease holder to stop an attempt through `Runtime.Interrupt`; an answer of a human for a waiting attempt is delivered through `Runtime.AnswerDecision`, which RunControlService calls with its workload identity when a member answers on its public route `AnswerDecision` behind ControlPlaneApi (D137); the phases of an attempt are watched as a stream through `Runtime.WatchAttempt`; Run Control plans the next steps of a run through `WorkflowEngine.PlanNextSteps` and reads the projection of a run through `WorkflowEngine.GetRunGraph`. The model names ControlPlaneApi as the inbound caller of the gateway over gRPC. A caller presents a workload token, which carries service scopes, no audience of a user API and no tenant claim (ADR-0015 amendment of D114). The gateway validates the token through the pinned resource-server library and admits it only on a route whose operation names a service scope the token holds: a call without a token or with an expired one is answered UNAUTHENTICATED, and a workload token without that scope, or a user token, which holds no service scope, PERMISSION_DENIED, in each case before any fronted service is called. Because a workload token has no tenant claim, the overwrite of the tenant header does not apply to it: for a token that holds the service scope the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, together with the authorization metadata, the correlation id and the trace context, and the fronted service reads the forwarded tenant and project only under that scope. The gateway knows neither the tenant nor the project of an attempt or a run; an attempt or a run outside the forwarded tenant is answered NOT_FOUND by the fronted service, exactly as an unknown one, and that status returns unchanged, as does every other status of the service. `Runtime.Interrupt` and `Runtime.AnswerDecision` are of class shared-write. The gateway keeps nothing between calls and applies no idempotency rule of its own: it forwards each call once, never retries a shared-write call on its own, and returns the `ack-v1` or the refusal of AgentRuntimeService unchanged. The service applies an interrupt and an answer once under its own rule (feature `agent-runtime-service`), so a caller that repeats a call after a timeout gets the answer of the service and no second effect. `Runtime.WatchAttempt` is a server stream: the route forwards each message as it arrives, in order and without buffering the stream, ends when the service ends it and cancels the upstream call when the subscriber cancels. `WorkflowEngine.PlanNextSteps` and `WorkflowEngine.GetRunGraph` are of class read and are forwarded under the same token and metadata rules. When AgentRuntimeService or WorkflowEngineService does not answer, the routes of that service answer UNAVAILABLE with a retry hint that names the service, the routes of the other keep serving, and the gateway invents no reply. The derivation of scenarios reads only the REST operations of the fronted services, so the route class shared-write of the two gRPC methods has no scenario of its own; the criteria of this PBI cite the operations and the model, and the missing scenario is reported. Kind: behavior. Traces: services: AgentRuntimeWorker, AgentRuntimeService, WorkflowEngineService; apis: AgentRuntimeService/Runtime.Interrupt, AgentRuntimeService/Runtime.AnswerDecision, AgentRuntimeService/Runtime.WatchAttempt, WorkflowEngineService/WorkflowEngine.PlanNextSteps, WorkflowEngineService/WorkflowEngine.GetRunGraph; descriptors: ack-v1; adrs: ADR-0015, ADR-0028; requirements: FR-10. Depends on: AIFACTORY-US-472, feature:component-api-gateway-template, feature:component-extensions-ai, feature:agent-runtime-service, feature:workflow-engine-service. Sources: model/services/agent-mesh/AgentRuntimeWorker.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/agent-runtime/services/agent-runtime-worker/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope of the operation, when `AgentRuntimeService/Runtime.Interrupt`, `AgentRuntimeService/Runtime.AnswerDecision`, `WorkflowEngineService/WorkflowEngine.PlanNextSteps` or `WorkflowEngineService/WorkflowEngine.GetRunGraph` is called through the gateway, then the call reaches the fake of its service once with the authorization metadata, the `tenant-id` and the project metadata of the caller unchanged, the correlation id and the trace context, and the reply returns unchanged (ADR-0015, model/services/agent-mesh/AgentRuntimeWorker.yaml).",
        "AC2: Given a call without a token, with an expired token, with a workload token that lacks the service scope of the operation, or with a user token, when an internal gRPC route is called, then the answers are UNAUTHENTICATED for the first two and PERMISSION_DENIED for the other two, and no fronted service is called (ADR-0015).",
        "AC3: Given the fake of AgentRuntimeService answers `ack-v1`, FAILED_PRECONDITION or NOT_FOUND, when `AgentRuntimeService/Runtime.Interrupt` is called twice with the same request, then each call is forwarded once, the gateway retries none and keeps nothing between the calls, and each answer returns unchanged, the NOT_FOUND of a foreign attempt exactly as that of an unknown one (ADR-0028, ADR-0015).",
        "AC4: Given a subscriber of `AgentRuntimeService/Runtime.WatchAttempt` through the gateway, when the fake streams three messages and the subscriber then cancels, then the three messages arrive in order as they are sent and the upstream call to the fake is cancelled (model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC5: Given AgentRuntimeService does not answer, when its gRPC routes are called, then the answer is UNAVAILABLE with a retry hint that names the service, no reply is invented, and the routes of `WorkflowEngineService/WorkflowEngine.GetRunGraph` and `WorkflowEngineService/WorkflowEngine.PlanNextSteps` keep serving (FR-10, model/services/agent-mesh/AgentRuntimeWorker.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1891",
        "AIFACTORY-TASK-1892"
      ],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11004,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeWorker",
          "AgentRuntimeService",
          "WorkflowEngineService"
        ],
        "apis": [
          "AgentRuntimeService/Runtime.Interrupt",
          "AgentRuntimeService/Runtime.AnswerDecision",
          "AgentRuntimeService/Runtime.WatchAttempt",
          "WorkflowEngineService/WorkflowEngine.PlanNextSteps",
          "WorkflowEngineService/WorkflowEngine.GetRunGraph"
        ],
        "descriptors": [
          "ack-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-472",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-474]",
      "number": 474
    },
    {
      "id": "AIFACTORY-TASK-1891",
      "type": "task",
      "parent": "AIFACTORY-US-474",
      "title": "Service scope, metadata forwarding and stream pass-through of the five internal gRPC routes",
      "sequence": "02.03.04.01",
      "description": "Service scope, metadata forwarding and stream pass-through of the five internal gRPC routes. Expected output: Each of the five gRPC routes names the service scope a workload token must hold; a token without it, and a user token, is answered PERMISSION_DENIED and a missing or expired token UNAUTHENTICATED before any call; for an admitted token the tenant-id and the project metadata of the caller are forwarded unchanged with the authorization metadata, the correlation id and the trace context (ADR-0015 amendment of D114); every call is forwarded once without a retry of the gateway, the status of the service returns unchanged, Runtime.WatchAttempt is forwarded message by message with its cancellation, and an unavailable service is answered UNAVAILABLE with a retry hint that names it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "Each of the five gRPC routes names the service scope a workload token must hold; a token without it, and a user token, is answered PERMISSION_DENIED and a missing or expired token UNAUTHENTICATED before any call; for an admitted token the tenant-id and the project metadata of the caller are forwarded unchanged with the authorization metadata, the correlation id and the trace context (ADR-0015 amendment of D114); every call is forwarded once without a retry of the gateway, the status of the service returns unchanged, Runtime.WatchAttempt is forwarded message by message with its cancellation, and an unavailable service is answered UNAVAILABLE with a retry hint that names it."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1891]",
      "number": 1891
    },
    {
      "id": "AIFACTORY-TASK-1892",
      "type": "task",
      "parent": "AIFACTORY-US-474",
      "title": "Verify the internal gRPC routes through the acceptance suite",
      "sequence": "02.03.04.02",
      "description": "Verify the internal gRPC routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InternalGrpcRoutes\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-474 for `AgentRuntimeService/Runtime.Interrupt`, `AgentRuntimeService/Runtime.AnswerDecision`, `AgentRuntimeService/Runtime.WatchAttempt`, `WorkflowEngineService/WorkflowEngine.PlanNextSteps` and `WorkflowEngineService/WorkflowEngine.GetRunGraph`: the forwarded metadata of a workload token with the service scope, the refusals without a call to a fake, the single forward of a repeated shared-write call with each answer unchanged, the ordered stream with its cancellation and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InternalGrpcRoutes\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-474 for `AgentRuntimeService/Runtime.Interrupt`, `AgentRuntimeService/Runtime.AnswerDecision`, `AgentRuntimeService/Runtime.WatchAttempt`, `WorkflowEngineService/WorkflowEngine.PlanNextSteps` and `WorkflowEngineService/WorkflowEngine.GetRunGraph`: the forwarded metadata of a workload token with the service scope, the refusals without a call to a fake, the single forward of a repeated shared-write call with each answer unchanged, the ordered stream with its cancellation and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1892]",
      "number": 1892
    },
    {
      "id": "AIFACTORY-US-475",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-013",
      "title": "Health, modules, limits and telemetry of the Agent Mesh gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "02.03.05",
      "description": "As an operator, I want to see whether the gateway, the identity platform and each of the two fronted services answer, and which services the gateway fronts, so that I can tell a failing service from a failing gateway and act on the right one. An operator, the Studio and the probes of the cluster read the state of the gateway through its two own operations. `RuntimeHealth` reports liveness and readiness of the gateway with the aggregated health of AgentRuntimeService and WorkflowEngineService and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. While a cached signing key still validates tokens, the gateway keeps validating tokens that were already issued, stays in rotation and reports degraded, naming the identity platform; it leaves rotation only when no valid key remains, as the amendment of ADR-0015 on the forwarded user token states: then it refuses calls, fails closed, and health answers 503 with a problem response that names the identity platform. A fronted service is an optional dependency of the degrade kind: when it does not answer, health reports it as unavailable in the detail, its routes answer 503 with a retry hint, and the routes of the other service keep serving. `RuntimeModules` serves a caller whose scope carries `factory.meta.read`. The model describes its answer as the runtime adapter version, the checkpoint format version, the fronted services and the supported tool schema versions, used for release compatibility checks. The fronted services are known to the gateway from its fronts file and its build, and the answer lists them with their versions and repositories. The adapter version, the checkpoint format version and the tool schema versions are facts of AgentRuntimeService, and the model names no operation of that service from which a gateway without state could read them. The gateway may not invent them: until the owner names their source the answer states the three values as not available, and the gap is reported. A call that exceeds the rate limit configured for its route is refused with 429 through the pinned rate-limiting library, and a limit is configured per route in the configuration of the gateway. The gateway emits `connectsoft.factory.runtime.host.requests` with the dimensions service, route and status and `connectsoft.factory.runtime.host.request_duration` with service and route, the latency including the fronted service, through the single registration of feature `component-observability-factory-conventions`, and carries the trace context to the service; its logs never contain a token, a prompt, an artifact or a payload. A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed and callers retry with their own idempotency key. The roles of the gateway are Observer, Operator and Platform admin, and they apply to its two own operations: the health detail and the modules answer need the scope of the operation and one of the three roles, and a token that holds the scope and none of them is answered 403. The routes of the fronted services are admitted at the gateway by token and scope alone, the role in the project being checked by the service. Kind: behavior. Traces: services: AgentRuntimeWorker; apis: AgentRuntimeWorker/RuntimeHealth, AgentRuntimeWorker/RuntimeModules; adrs: ADR-0015, ADR-0017, ADR-0028; requirements: NFR-08, NFR-17, XL-16; scenarios: SCN-AgentRuntimeWorker-001, SCN-AgentRuntimeWorker-002. Depends on: AIFACTORY-US-472, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/agent-mesh/AgentRuntimeWorker.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/agent-runtime/services/agent-runtime-worker/index.md#metrics-and-observability, docs/planes/agent-runtime/services/agent-runtime-worker/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and both fronted services reachable, when `AgentRuntimeWorker/RuntimeHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` and one of the roles Observer, Operator or Platform admin receives 200 with the state of AgentRuntimeService, of WorkflowEngineService and of the identity platform (SCN-AgentRuntimeWorker-001, NFR-17).",
        "AC2: Given the identity platform is unreachable and a signing key is cached, when calls arrive, then tokens that were already issued are validated with the cached key, the gateway stays in rotation and `AgentRuntimeWorker/RuntimeHealth` reports degraded and names the identity platform; given no valid key remains, when calls arrive, then they are refused, `AgentRuntimeWorker/RuntimeHealth` answers 503 with a problem response that names the identity platform, the replica leaves rotation and no state changes (SCN-AgentRuntimeWorker-001, ADR-0015).",
        "AC3: Given one fronted service does not answer, when `AgentRuntimeWorker/RuntimeHealth` and the routes are called, then health reports that service as unavailable in its detail, its routes answer 503 with a retry hint that names the service and the routes of the other service keep serving (SCN-AgentRuntimeWorker-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read`, when `AgentRuntimeWorker/RuntimeModules` is called, then the response is 200 with AgentRuntimeService and WorkflowEngineService, each with its version and repository, as model/services/agent-mesh/AgentRuntimeWorker.yaml lists them under `deployment.fronts`, and with the adapter version, the checkpoint format version and the tool schema versions stated as not available and never invented; a call without a token is answered 401, a token without the scope 403, and a token that holds `factory.meta.read` and none of the roles Observer, Operator and Platform admin 403, as is a token with `factory.health.read` and none of the three roles on the detail of `AgentRuntimeWorker/RuntimeHealth`; nothing is written (SCN-AgentRuntimeWorker-002, model/services/agent-mesh/AgentRuntimeWorker.yaml).",
        "AC5: Given routed calls and a call above the rate limit of its route, when the metrics and logs are read, then `connectsoft.factory.runtime.host.requests` counts every call by service, route and status, the call above the limit was refused with 429, `connectsoft.factory.runtime.host.request_duration` holds the latency by service and route, and no log record holds a token or a payload (NFR-08, XL-16, model/services/agent-mesh/AgentRuntimeWorker.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#metrics-and-observability",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-358",
        "AIFACTORY-TASK-1893",
        "AIFACTORY-TASK-1894",
        "AIFACTORY-TASK-1895"
      ],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11005,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeWorker"
        ],
        "apis": [
          "AgentRuntimeWorker/RuntimeHealth",
          "AgentRuntimeWorker/RuntimeModules"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-08",
          "NFR-17",
          "XL-16"
        ],
        "scenarios": [
          "SCN-AgentRuntimeWorker-001",
          "SCN-AgentRuntimeWorker-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-472",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#metrics-and-observability",
        "docs/planes/agent-runtime/services/agent-runtime-worker/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-475]",
      "number": 475
    },
    {
      "id": "AIFACTORY-TASK-358",
      "type": "task",
      "parent": "AIFACTORY-US-475",
      "title": "Health, modules and telemetry of the gateway",
      "sequence": "02.03.05.01",
      "description": "Health, modules and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform, reports degraded and stays in rotation while a cached signing key validates tokens, and answers 503 naming the identity platform when no valid key remains; the modules operation lists the two fronted services with version and repository under factory.meta.read and states the adapter version, the checkpoint format version and the tool schema versions as not available; the health detail and the modules operation require one of the roles Observer, Operator and Platform admin beside their scope and answer 403 to a token that holds the scope and none of them; every routed call records connectsoft.factory.runtime.host.requests and connectsoft.factory.runtime.host.request_duration with their modelled dimensions and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform, reports degraded and stays in rotation while a cached signing key validates tokens, and answers 503 naming the identity platform when no valid key remains; the modules operation lists the two fronted services with version and repository under factory.meta.read and states the adapter version, the checkpoint format version and the tool schema versions as not available; the health detail and the modules operation require one of the roles Observer, Operator and Platform admin beside their scope and answer 403 to a token that holds the scope and none of them; every routed call records connectsoft.factory.runtime.host.requests and connectsoft.factory.runtime.host.request_duration with their modelled dimensions and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-358]",
      "number": 358
    },
    {
      "id": "AIFACTORY-TASK-1893",
      "type": "task",
      "parent": "AIFACTORY-US-475",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "02.03.05.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each of the eleven routes and the two own operations takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it; the refusal is counted in connectsoft.factory.runtime.host.requests with its status and reaches no fronted service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "Each of the eleven routes and the two own operations takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it; the refusal is counted in connectsoft.factory.runtime.host.requests with its status and reaches no fronted service."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1893]",
      "number": 1893
    },
    {
      "id": "AIFACTORY-TASK-1894",
      "type": "task",
      "parent": "AIFACTORY-US-475",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "02.03.05.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/agent-mesh/AgentRuntimeWorker.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step (NFR-17).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/agent-mesh/AgentRuntimeWorker.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step (NFR-17)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11005,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1894]",
      "number": 1894
    },
    {
      "id": "AIFACTORY-TASK-1895",
      "type": "task",
      "parent": "AIFACTORY-US-475",
      "title": "Verify health, modules, limits and telemetry through the acceptance suite",
      "sequence": "02.03.05.04",
      "description": "Verify health, modules, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeWorker-001|Scenario=SCN-AgentRuntimeWorker-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-475 with the identity platform stopped with and without a cached key, one fake stopped, the modules answer under and without factory.meta.read, the 403 of the modules operation and of the health detail for a token that holds the scope and none of the roles Observer, Operator and Platform admin, and a call above its limit.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AgentRuntimeWorker-001|Scenario=SCN-AgentRuntimeWorker-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-475 with the identity platform stopped with and without a cached key, one fake stopped, the modules answer under and without factory.meta.read, the 403 of the modules operation and of the health detail for a token that holds the scope and none of the roles Observer, Operator and Platform admin, and a call above its limit."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeWorker.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:agent-mesh",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeWorker"
      ],
      "children": [],
      "buildOrder": 110,
      "phase": "factory",
      "stackRank": 11005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1895]",
      "number": 1895
    },
    {
      "id": "AIFACTORY-EPIC-003",
      "type": "epic",
      "parent": null,
      "title": "Model & Compute Platform (PF-03)",
      "sequence": "03",
      "description": "Everything that builds the Model & Compute Platform platform (PF-03): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Model gateway pipeline, capability registry and router, profiles and providers, compute pools. Done when: Every service of the platform has its complete delivery accepted (ComputePoolService, ModelGatewayHost, ModelRouterService), the platform gateway routes them under a trusted scope, and the outcome verification of I8 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (ComputePoolService, ModelGatewayHost, ModelRouterService), the platform gateway routes them under a trusted scope, and the outcome verification of I8 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-014",
        "AIFACTORY-FEAT-015",
        "AIFACTORY-FEAT-016"
      ],
      "stackRank": 5899,
      "titlePrefix": "[AIFACTORY-EPIC-003]",
      "number": 3
    },
    {
      "id": "AIFACTORY-FEAT-014",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-003",
      "title": "ModelGatewayHost: gateway delivery",
      "sequence": "03.01",
      "description": "ModelGatewayHost is the platform API gateway of bounded context BC-07 (Model Access). The API gateway of the Model & Compute platform (ADR-0028): routes public REST and internal gRPC calls to the 2 services it fronts, validates tokens and scopes, and owns no business state. ModelRouterService behind it stays the only caller of model providers (GW-04). Its own repository is ConnectSoft.AI.SoftwareFactory.ModelGatewayHost. Delivers: ModelGatewayHost (complete). Increment I1: Generate a microservice. Build order 59 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-057",
        "AIFACTORY-US-561",
        "AIFACTORY-US-562",
        "AIFACTORY-US-563",
        "AIFACTORY-US-564",
        "AIFACTORY-US-565",
        "AIFACTORY-US-756"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5900,
      "titlePrefix": "[AIFACTORY-FEAT-014]",
      "number": 14
    },
    {
      "id": "AIFACTORY-US-057",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-014",
      "title": "ModelGatewayHost routes the calls of its platform under a trusted scope",
      "sequence": "03.01.01",
      "description": "As a platform admin, I want one gateway in front of ModelRouterService and ComputePoolService that validates tokens and scopes, so that no service of the platform is reachable except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the Model and Compute platform. ADR-0028 re-scopes the former composition host as the API gateway of its platform: ModelGatewayHost routes public REST and internal gRPC calls to the two services the model lists under `deployment.fronts`, ModelRouterService and ComputePoolService, validates tokens and scopes and owns no business state, no relational store and no secret. ModelRouterService stays the only service that calls model providers, and this gateway is the only route to it (ADR-0028 decision 3, gateway role GW-04). The repository ConnectSoft.AI.SoftwareFactory.ModelGatewayHost is created and scaffolded in I0 by AIFACTORY-TASK-044 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold: it is scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway therefore has no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`); the gateway copies neither the accessor nor the token contract. A user token has one audience, this gateway, and the gateway forwards it to the fronted service unchanged and exchanges no token, because the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). A workload token carries service scopes and no tenant claim and is admitted only on an internal gRPC route whose operation names a service scope the token holds (ADR-0015 amendment D114). The feature is delivered by six further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-561), token, tenant and scope on every read and sandbox route (AIFACTORY-US-562), the pass-through of a shared-write call with its idempotency key (AIFACTORY-US-563), the publication, production and spend routes whose gate stays in the fronted service, with the relay of a model stream (AIFACTORY-US-564), health, adapter metadata, limits and telemetry with the four failure modes of this gateway (AIFACTORY-US-565), and the OpenAI-compatible chat completions route, the one operation in which the gateway translates a wire protocol into `model-invocation-v1` and calls ModelRouterService with the forwarded token of the caller, the token of an attempt for a run-bound call and a user token for a call outside a run (AIFACTORY-US-756, decisions D121 and D125). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. No route of the two fronted services names a project or a tenant in its path: each addresses a profile, a deployment, a run, a pool or a placement by its identifier, so the gateway forwards under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing right and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. ModelRouterService is delivered in the same increment. ComputePoolService arrives in I8: until then its routes are generated from its fronts entry and proven against a fake, and on a deployed instance a route of the service that is not deployed answers 503 with a problem response that names the service. The gateway invents no response. Kind: enabling. Traces: services: ModelGatewayHost, ModelRouterService; apis: ModelGatewayHost/GatewayHealth; adrs: ADR-0015, ADR-0017, ADR-0028; requirements: FR-04. Depends on: AIFACTORY-US-561, AIFACTORY-US-562, AIFACTORY-US-563, AIFACTORY-US-564, AIFACTORY-US-565, AIFACTORY-US-756, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai. Sources: model/services/model-compute/ModelGatewayHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/model-compute/services/model-gateway-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ModelGatewayHost created and scaffolded in I0 by AIFACTORY-TASK-044 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ModelGatewayHost --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/model-compute/ModelGatewayHost.yaml).",
        "AC2: Given a valid token for a route of ModelRouterService, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with the token unchanged, the tenant, the correlation id and the trace context, the fronted service answers and the response returns unchanged, as AIFACTORY-US-562 to AIFACTORY-US-564 prove per route class (ADR-0015, FR-04).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret and no provider credential, and no event of the model lists ModelGatewayHost as a consumer (ADR-0028, model/services/model-compute/ModelGatewayHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `ModelGatewayHost/GatewayHealth` is probed and one replica is stopped, then health reports the identity platform and the fronted services, a replica stays in rotation while it can validate tokens, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/model-compute/ModelGatewayHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/model-compute/services/model-gateway-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-2261",
        "AIFACTORY-TASK-766"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5901,
      "kind": "enabling",
      "traces": {
        "services": [
          "ModelGatewayHost",
          "ModelRouterService"
        ],
        "apis": [
          "ModelGatewayHost/GatewayHealth"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-561",
        "AIFACTORY-US-562",
        "AIFACTORY-US-563",
        "AIFACTORY-US-564",
        "AIFACTORY-US-565",
        "AIFACTORY-US-756",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/model-compute/services/model-gateway-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-057]",
      "number": 57
    },
    {
      "id": "AIFACTORY-TASK-2261",
      "type": "task",
      "parent": "AIFACTORY-US-057",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "03.01.01.01",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 12, the ports https 7600 and grpc 7602, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/model-compute/ModelGatewayHost.yaml records them; it states ModelGateway:Host:FrontedServices with the two service identifiers of the fronts file, which are also the modelled default of the option (D121), and holds no secret; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 12, the ports https 7600 and grpc 7602, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/model-compute/ModelGatewayHost.yaml records them; it states ModelGateway:Host:FrontedServices with the two service identifiers of the fronts file, which are also the modelled default of the option (D121), and holds no secret; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5901,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2261]",
      "number": 2261
    },
    {
      "id": "AIFACTORY-TASK-766",
      "type": "task",
      "parent": "AIFACTORY-US-057",
      "title": "Verify model-gateway-host-routes-its-platform by running the declared command",
      "sequence": "03.01.01.02",
      "description": "Verify model-gateway-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-057, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes ModelGatewayHost/GatewayHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-057, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes ModelGatewayHost/GatewayHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-766]",
      "number": 766
    },
    {
      "id": "AIFACTORY-US-561",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-014",
      "title": "Model gateway fronts file: named clients and REST and gRPC routes of ModelRouterService and ComputePoolService, generated at build",
      "sequence": "03.01.02",
      "description": "As a platform admin, I want the route table of the model gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Model and Compute platform. It lists the two services of `deployment.fronts` in model/services/model-compute/ModelGatewayHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method with its streaming mode, scope, side-effect class and idempotency. For ModelRouterService these are the ten public REST operations, `ListModelProfiles`, `GetModelProfile`, `ListModelDeployments`, `RegisterDeployment`, `EvaluateDeployment`, `ApproveDeployment`, `AttestDeployment`, which decision D121 added for the approval of a deployment by attestation, `PreviewRoutePlan`, `ListRunReceipts` and `ListProjectReceipts`, which decision D123 added for the receipts of a project that name no run, and the four internal gRPC methods of `ModelGateway`: `ResolveRoutePlan`, `Invoke` with server streaming, `Embed` and `Rerank`. For ComputePoolService these are its five REST operations and the gRPC methods `ComputePools.Place` and `ComputePools.ReportUtilization`, the second with client streaming. The REST operations are the public surface that the typed model gateway client and, later, StudioBff call; the gRPC methods are the internal surface the agent hosts call through the Factory model client of the AI libraries and the Knowledge services call for embeddings and reranking. Each route carries the scope and the side-effect class of its operation, which is what the route class PBIs of this feature enforce; an internal gRPC route names the service scope a workload token must hold. A test lists the emitted route table against the file and against the two service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `GatewayHealth`, `GatewayAdapters` and the OpenAI-compatible route `CreateChatCompletion` of AIFACTORY-US-756, transforms no payload on a route of the fronts file and composes no response from two services. The option `ModelGateway:Host:FrontedServices` is bound at startup and compared with the service names of the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable. The fronts file names its services by their identifiers, ModelRouterService and ComputePoolService, as `deployment.fronts` lists them, and the modelled default of the option names the same two identifiers (decision D121), so a gateway that leaves the option unset starts. The two switches `ModelGateway:Protocols:ExposeOpenAiCompatible` and `ModelGateway:Protocols:ExposeAnthropicCompatible` are bound and validated at startup, and neither is reloadable. `ExposeOpenAiCompatible`, true by default, guards the one public operation the gateway serves itself, `CreateChatCompletion`, POST /v1/chat/completions, which is no entry of the fronts file: the gateway serves it itself, translates the call into `model-invocation-v1` and calls `ModelGateway.Invoke` of ModelRouterService, and AIFACTORY-US-756 delivers it in this increment (decision D121). `ExposeAnthropicCompatible` is false by default; its route is a later feature and the model declares no operation for it, so this delivery hosts no Anthropic-compatible route, and a start with that switch true fails with the switch named, because no route stands behind it. The gateway clients of feature `typed-gateway-clients` are generated from a contract-first OpenAPI document of the client repository until a gateway publishes its own (decision D117): the pipeline of this repository publishes the OpenAPI document of the ten public REST operations of ModelRouterService and of the public operation `CreateChatCompletion` of the gateway itself as a build output, checked against the fronts file and against the two service files of the model. The five REST operations of ComputePoolService are not in the document of this increment. Feature `typed-gateway-clients` generates the model gateway client from the operations of the services of increment I1 or earlier that the gateway fronts, and ComputePoolService arrives in I8, so a document that held its operations would put operations of a later increment into the I1 client; they join the published document with feature `compute-pool-service`. Their routes are generated from the fronts file all the same and proven against the fake, as the route class PBIs of this feature need. Kind: enabling. Traces: services: ModelGatewayHost, ModelRouterService; adrs: ADR-0015, ADR-0028; requirements: FR-04. Depends on: feature:component-api-gateway-template. Sources: model/services/model-compute/ModelGatewayHost.yaml, model/services/model-compute/ModelRouterService.yaml, model/services/model-compute/ComputePoolService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/planes/model-compute/services/model-gateway-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Model and Compute platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, each with the scope, side-effect class, idempotency and streaming mode of the operation, and the route table test passes against model/services/model-compute/ModelGatewayHost.yaml, model/services/model-compute/ModelRouterService.yaml and model/services/model-compute/ComputePoolService.yaml (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `ModelGateway:Host:FrontedServices` left at its modelled default of model/services/model-compute/ModelGatewayHost.yaml, which names the two service identifiers of the fronts file (D121), or set to those two names, when the gateway starts, then startup succeeds; given a value of the option that differs from the services of the fronts file, when the gateway starts, then startup fails with the differing name; given `ModelGateway:Protocols:ExposeAnthropicCompatible` true, when the gateway starts, then startup fails with the switch named, because this delivery holds no Anthropic-compatible route; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, which carries the token of the caller unchanged because the gateway exchanges no token, the tenant, the correlation id and the trace context, and the response of the fake returns unchanged (ADR-0015, FR-04).",
        "AC4: Given the built gateway, when its pipeline publishes the OpenAPI document of the public REST routes, then the document holds exactly the ten REST operations of ModelRouterService of the fronts file and the public operation `CreateChatCompletion` of the gateway itself with their methods, paths, scopes and response codes, holds no operation of ComputePoolService, no internal operation of the gateway and no internal gRPC method, and a contract check fails the build when it differs from model/services/model-compute/ModelRouterService.yaml or from model/services/model-compute/ModelGatewayHost.yaml; the routes of the five operations of ComputePoolService exist in the route table of AC1 and are absent from the document until feature `compute-pool-service` adds them (docs/architecture/api-governance.md)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ComputePoolService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/model-compute/services/model-gateway-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-045",
        "AIFACTORY-TASK-2262",
        "AIFACTORY-TASK-2263",
        "AIFACTORY-TASK-2264"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5902,
      "kind": "enabling",
      "traces": {
        "services": [
          "ModelGatewayHost",
          "ModelRouterService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ComputePoolService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/model-compute/services/model-gateway-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-561]",
      "number": 561
    },
    {
      "id": "AIFACTORY-TASK-045",
      "type": "task",
      "parent": "AIFACTORY-US-561",
      "title": "Fronts file with the REST and gRPC operations of ModelRouterService and ComputePoolService",
      "sequence": "03.01.02.01",
      "description": "Fronts file with the REST and gRPC operations of ModelRouterService and ComputePoolService. Expected output: The fronts file lists the two services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; the build emits the named clients, the routes and the route table; at startup the option ModelGateway:Host:FrontedServices is compared with the service names of the fronts file and a difference in either direction fails startup with the name; the two protocol switches are bound and validated, ExposeOpenAiCompatible guarding the route of AIFACTORY-US-756 and a start with ExposeAnthropicCompatible true failing with the switch named, because its route is a later feature (D121); a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the two services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; the build emits the named clients, the routes and the route table; at startup the option ModelGateway:Host:FrontedServices is compared with the service names of the fronts file and a difference in either direction fails startup with the name; the two protocol switches are bound and validated, ExposeOpenAiCompatible guarding the route of AIFACTORY-US-756 and a start with ExposeAnthropicCompatible true failing with the switch named, because its route is a later feature (D121); a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-045]",
      "number": 45
    },
    {
      "id": "AIFACTORY-TASK-2262",
      "type": "task",
      "parent": "AIFACTORY-US-561",
      "title": "Fakes of the two fronted services and the token matrix of the acceptance suite",
      "sequence": "03.01.02.02",
      "description": "Fakes of the two fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake per fronted service that records the headers and metadata it received and answers a configured status, a fake of the server stream of ModelGateway.Invoke that emits a scripted number of messages and then a receipt or an error status, a switch that makes a fake stop answering, and tokens for the matrix of role and tenant, including an expired token, an identity token, a user token of another audience and a workload token with and without the service scope of a gRPC route.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake per fronted service that records the headers and metadata it received and answers a configured status, a fake of the server stream of ModelGateway.Invoke that emits a scripted number of messages and then a receipt or an error status, a switch that makes a fake stop answering, and tokens for the matrix of role and tenant, including an expired token, an identity token, a user token of another audience and a workload token with and without the service scope of a gRPC route."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2262]",
      "number": 2262
    },
    {
      "id": "AIFACTORY-TASK-2263",
      "type": "task",
      "parent": "AIFACTORY-US-561",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "03.01.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the ten public REST operations of ModelRouterService of the fronts file and the public operation CreateChatCompletion of the gateway itself, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with model/services/model-compute/ModelRouterService.yaml and, for CreateChatCompletion, with model/services/model-compute/ModelGatewayHost.yaml, and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can take the place of the contract-first document of the client repository (decision D117); the five REST operations of ComputePoolService stay out of the document until feature compute-pool-service adds them in I8, while their routes stay in the route table.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the ten public REST operations of ModelRouterService of the fronts file and the public operation CreateChatCompletion of the gateway itself, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with model/services/model-compute/ModelRouterService.yaml and, for CreateChatCompletion, with model/services/model-compute/ModelGatewayHost.yaml, and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can take the place of the contract-first document of the client repository (decision D117); the five REST operations of ComputePoolService stay out of the document until feature compute-pool-service adds them in I8, while their routes stay in the route table."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5902,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2263]",
      "number": 2263
    },
    {
      "id": "AIFACTORY-TASK-2264",
      "type": "task",
      "parent": "AIFACTORY-US-561",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "03.01.02.04",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-561: one route per operation of model/services/model-compute/ModelRouterService.yaml and model/services/model-compute/ComputePoolService.yaml, the failing builds, the start with the option left at its modelled default and with the option set to the names of the fronts file, the failing startup on a differing value and with ExposeAnthropicCompatible true, the 404 of an unknown path, one forwarded call per service and protocol and the contract check of the published OpenAPI document, which is limited to the ten operations of model/services/model-compute/ModelRouterService.yaml and the operation CreateChatCompletion of model/services/model-compute/ModelGatewayHost.yaml and fails when the document holds an operation of ComputePoolService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-561: one route per operation of model/services/model-compute/ModelRouterService.yaml and model/services/model-compute/ComputePoolService.yaml, the failing builds, the start with the option left at its modelled default and with the option set to the names of the fronts file, the failing startup on a differing value and with ExposeAnthropicCompatible true, the 404 of an unknown path, one forwarded call per service and protocol and the contract check of the published OpenAPI document, which is limited to the ten operations of model/services/model-compute/ModelRouterService.yaml and the operation CreateChatCompletion of model/services/model-compute/ModelGatewayHost.yaml and fails when the document holds an operation of ComputePoolService."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2264]",
      "number": 2264
    },
    {
      "id": "AIFACTORY-US-562",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-014",
      "title": "A read or sandbox route of the model gateway forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "03.01.03",
      "description": "As a requester, I want my read calls to reach the model services only with the tenant and scope my token grants, so that I see the profiles, deployments and receipts I am entitled to and nobody reads across a tenant through the gateway. A caller reaches a read or sandbox operation of the Model and Compute platform through the gateway: a requester reads the model profiles before submitting a run, the model receipts of a run and the receipts of a project that name no run, a Platform admin or an Observer lists the model deployments, a Platform admin previews a route plan, and a Platform admin starts the capability evaluation of a deployment, which is the sandbox route of this platform. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment D114); a client that also calls the Control Plane gateway requests a second token for it. The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names: `factory.models.read` for `ListModelProfiles`, `GetModelProfile`, `PreviewRoutePlan` and `ListProjectReceipts`, `factory.models.admin` for `ListModelDeployments` and `EvaluateDeployment`, `factory.runs.read` for `ListRunReceipts`, and `factory.compute.read` for the two read operations of ComputePoolService. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. Every public REST operation of the two services names a `factory.` scope and none names a service scope, so no read or sandbox REST route admits a workload token today, the state feature `typed-gateway-clients` records as well; a workload token on such a route is answered 403. The scope is established once with the scope accessor of the pinned abstractions package and forwarded: the authorization header with the user token itself, the tenant in `X-Tenant-Id`, the correlation id and the trace context. The gateway exchanges no token; ModelRouterService validates the forwarded token again, accepts the audience of its own gateway, which is this one, and applies its own tenant filter and role policies (ADR-0015 amendment D117). One read route names a project in its path: `ListProjectReceipts`, GET /factory/projects/{projectId}/model-receipts, the read of the receipts of a project that name no run, which are the receipts of the calls outside a run on the OpenAI-compatible route (AIFACTORY-US-756, decision D123). For that route the gateway checks the `projectId` of the path against the role claims of the validated token, answers 403 for a project the token does not grant and calls no fronted service in that case, and forwards the call for a granted project; the check needs no business state, because the token carries the roles. No other read or sandbox route names a project or a tenant in its path: a profile, a deployment, a run and a placement are addressed by identifier, and a gateway without business state cannot know the tenant or the project of such a resource. It forwards such a call under the tenant of the token and the scope of the operation; the fronted service answers 403 for a missing role, such as an Observer who starts an evaluation or a caller without a role in the project of a run, and 404 for a profile, a deployment or a run of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. For a read route the response is served by the fronted service with no side effect. For the sandbox route `EvaluateDeployment` the gateway forwards the `Idempotency-Key` header unchanged, adds no gate of its own to the class and returns the 202 of the service; the service changes no shared state by that call, and the capability evidence arrives later inside ModelRouterService. The gateway returns every response unchanged with the correlation id and keeps nothing of the call. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope of the operation 403; in these cases no fronted service is called, and the refusal is counted for the route and logged with the correlation id and without the token. When the fronted service does not answer, the route answers 503 with a retry hint and the routes of the other service keep serving. The read routes of ComputePoolService are proven against the fake generated from its fronts entry, because the service arrives in I8. Kind: behavior. Traces: services: ModelGatewayHost, ModelRouterService; adrs: ADR-0015, ADR-0028; requirements: FR-04, FUX-08; scenarios: SCN-ModelGatewayHost-005, SCN-ModelGatewayHost-006. Depends on: AIFACTORY-US-561, feature:component-api-gateway-template, feature:component-extensions-ai. Sources: model/services/model-compute/ModelGatewayHost.yaml, model/services/model-compute/ModelRouterService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/model-compute/services/model-gateway-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with `factory.models.read`, when the read route of `ListModelProfiles` is called, then the gateway forwards the call with the user token unchanged in the authorization header, without a token exchange, the tenant of the `tid` claim, the correlation id and the trace context, ModelRouterService answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-ModelGatewayHost-005, ADR-0015, FR-04).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes of ModelRouterService are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope of the operation and a workload token are answered 403, and in none of these cases a fronted service is called; each refusal is counted for its route and logged with the correlation id and without the token (SCN-ModelGatewayHost-005, ADR-0015).",
        "AC3: Given a valid user token and a tenant header of the caller that names another tenant, when a read route is called, then the header is overwritten with the `tid` claim before the call is forwarded; given a route addressed by a `profileId`, a `deploymentId` or a `runId`, when the fronted service answers 403 for a missing role or 404 for a resource of another tenant (ADR-0015 amendment D113), then the gateway returns that answer unchanged and adds no check of its own; given the read route of `ListProjectReceipts`, whose path names a project, when it is called with a token whose role claims do not grant that project, then the gateway answers 403 and calls no fronted service, and for a project the token grants it forwards the call and returns the answer of ModelRouterService unchanged (SCN-ModelGatewayHost-005, ADR-0015).",
        "AC4: Given a user token with `factory.models.admin` and an `Idempotency-Key`, when the sandbox route of `EvaluateDeployment` is called, then the call is forwarded under the same token, tenant and scope rules with the header unchanged, the gateway adds no gate of its own to the class and the 202 of ModelRouterService returns unchanged; the refusals apply as on a read route and no fronted service is called when the gateway refuses (SCN-ModelGatewayHost-006, model/services/model-compute/ModelRouterService.yaml).",
        "AC5: Given a fronted service that does not answer, among them ComputePoolService before its delivery in I8, when one of its read routes is called, then the gateway answers 503 with a problem response that carries a retry hint and names the service and never its address, invents no response, and the read routes of the other service keep serving (SCN-ModelGatewayHost-005, model/services/model-compute/ModelGatewayHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/model-compute/services/model-gateway-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2265",
        "AIFACTORY-TASK-2266"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5903,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelGatewayHost",
          "ModelRouterService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04",
          "FUX-08"
        ],
        "scenarios": [
          "SCN-ModelGatewayHost-005",
          "SCN-ModelGatewayHost-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-561",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/model-compute/services/model-gateway-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-562]",
      "number": 562
    },
    {
      "id": "AIFACTORY-TASK-2265",
      "type": "task",
      "parent": "AIFACTORY-US-562",
      "title": "Issuer, audience and scope configuration of the read and sandbox routes",
      "sequence": "03.01.03.01",
      "description": "Issuer, audience and scope configuration of the read and sandbox routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route requires the scope of its operation and is marked as addressed by a resource id only, so the gateway checks token and scope and leaves the role and the tenant of the resource to the fronted service, except the one route whose path names a project, ListProjectReceipts, for which the gateway checks the projectId of the path against the role claims of the token and answers 403 for a project the token does not grant, without a call of the fronted service (D123); the tenant header is overwritten with the tid claim; a workload token is refused with 403 on a REST route, because no REST operation names a service scope; the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header; the user token is forwarded unchanged in the authorization header and no token is exchanged (ADR-0015 amendment D117); the Idempotency-Key header of EvaluateDeployment is forwarded unchanged; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route requires the scope of its operation and is marked as addressed by a resource id only, so the gateway checks token and scope and leaves the role and the tenant of the resource to the fronted service, except the one route whose path names a project, ListProjectReceipts, for which the gateway checks the projectId of the path against the role claims of the token and answers 403 for a project the token does not grant, without a call of the fronted service (D123); the tenant header is overwritten with the tid claim; a workload token is refused with 403 on a REST route, because no REST operation names a service scope; the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header; the user token is forwarded unchanged in the authorization header and no token is exchanged (ADR-0015 amendment D117); the Idempotency-Key header of EvaluateDeployment is forwarded unchanged; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2265]",
      "number": 2265
    },
    {
      "id": "AIFACTORY-TASK-2266",
      "type": "task",
      "parent": "AIFACTORY-US-562",
      "title": "Verify the read and sandbox routes through the acceptance suite",
      "sequence": "03.01.03.02",
      "description": "Verify the read and sandbox routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelGatewayHost-005|Scenario=SCN-ModelGatewayHost-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-562 over the token matrix, the token received by the fake equal to the user token of the caller, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the route of ListProjectReceipts called with a token that grants the project of the path, which is forwarded, and with one that does not, which is answered 403 without a call of the fake, the overwritten tenant header, a workload token refused on a REST route, the sandbox route with its header and its 202 unchanged, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelGatewayHost-005|Scenario=SCN-ModelGatewayHost-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-562 over the token matrix, the token received by the fake equal to the user token of the caller, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the route of ListProjectReceipts called with a token that grants the project of the path, which is forwarded, and with one that does not, which is answered 403 without a call of the fake, the overwritten tenant header, a workload token refused on a REST route, the sandbox route with its header and its 202 unchanged, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2266]",
      "number": 2266
    },
    {
      "id": "AIFACTORY-US-563",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-014",
      "title": "A shared-write route of the model gateway passes the idempotency key through and the gateway keeps nothing between calls",
      "sequence": "03.01.04",
      "description": "As a platform admin, I want a write I repeat after a failure to be applied once, so that a lost answer or a restarted gateway never registers a second deployment or resolves a second route plan. A shared-write operation changes state that others read. On this platform these are `RegisterDeployment` of ModelRouterService, a public REST operation a Platform admin calls with `factory.models.admin`, the internal gRPC method `ModelGateway.ResolveRoutePlan` of ModelRouterService, which AgentRuntimeService calls once per run and profile, and, from I8, `RegisterComputePool` and `WarmModel` and the gRPC methods `ComputePools.Place` and `ComputePools.ReportUtilization` of ComputePoolService. The caller sends a REST call through the gateway under the token, tenant and scope rules of AIFACTORY-US-562. `RegisterDeployment` declares idempotency `key-header`: it is called with an `Idempotency-Key`, the gateway forwards the header unchanged and ModelRouterService applies the request once under its own rule, where the same key with the same body returns the same deployment and the same key with a different body is a conflict, and that 409 returns to the caller unchanged. An internal gRPC route is called by a workload: the token carries service scopes, no audience of a user API and no tenant claim, and the route names the service scope it must hold. For a workload token that holds the scope, the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope (ADR-0015 amendment D114); for a workload token without it, and for a user token, which holds no service scope, the answer is PERMISSION_DENIED and no fronted service is called. `ResolveRoutePlan` is idempotent per run and profile inside ModelRouterService, so a repeated call returns the plan that was resolved first. The gateway is no party to idempotency. It stores neither a key nor a result, keeps no session and no pending call, has no outbox and writes no event, so a gateway replica that crashes during a call loses nothing: the replica restarts, nothing is replayed, and the caller retries with the same key, or for the same run and profile, and receives from the service the result of the first application (failure mode of a gateway replica crash in the model). When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with the service named and a retry hint, the routes of the other service keep serving, and the caller retries. A refusal by the gateway reaches no fronted service, so it applies nothing. A missing key, an invalid body, the 403 of the service for a caller who is not Platform admin, a NOT_FOUND for a profile the tenant cannot read and every domain refusal are answers of the fronted service and return unchanged with the correlation id. The gateway records request count and latency for the route with the status that was returned. The shared-write routes of ComputePoolService are proven against the fake generated from its fronts entry until the service arrives in I8. Kind: behavior. Traces: services: ModelGatewayHost, ModelRouterService; adrs: ADR-0015, ADR-0028; requirements: FR-04; scenarios: SCN-ModelGatewayHost-007. Depends on: AIFACTORY-US-561, AIFACTORY-US-562, feature:component-api-gateway-template. Sources: model/services/model-compute/ModelGatewayHost.yaml, model/services/model-compute/ModelRouterService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a valid user token with `factory.models.admin` and the shared-write route of `RegisterDeployment`, when the call arrives with an `Idempotency-Key`, then the gateway forwards the request with the header unchanged, the fronted service applies it once and the response returns unchanged with the correlation id (SCN-ModelGatewayHost-007, ADR-0015).",
        "AC2: Given the same call repeated with the same key, and then with the same key and a different body, when both pass the gateway, then the first returns the result of the first application and the second returns the 409 of the fronted service unchanged; the gateway has stored neither the key nor a result (SCN-ModelGatewayHost-007, ADR-0028).",
        "AC3: Given a workload token that holds the service scope the route of `ModelGateway.ResolveRoutePlan` names, when the method is called with `tenant-id` and project metadata, then the gateway forwards the call with that metadata unchanged and returns the reply unchanged, and a second call for the same run and profile returns the plan of the first as the fronted service answers it; given a workload token without the scope, or a user token, which holds no service scope, then the answer is PERMISSION_DENIED and no fronted service is called (SCN-ModelGatewayHost-007, ADR-0015).",
        "AC4: Given a gateway replica stopped while a shared-write call is in flight, when the caller retries with the same key through another replica, then the fronted service returns the result of the one application, nothing is replayed by the gateway and no second state change exists (SCN-ModelGatewayHost-007, model/services/model-compute/ModelGatewayHost.yaml).",
        "AC5: Given a call without a token, a token that lacks the scope, or a fronted service that does not answer, when a shared-write route is called, then the answer is 401, 403 or 503 respectively, over gRPC UNAUTHENTICATED, PERMISSION_DENIED or UNAVAILABLE; a call the gateway refuses reaches no fronted service; the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged; the 503 names the service and carries a retry hint while the routes of the other service keep serving (SCN-ModelGatewayHost-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2267",
        "AIFACTORY-TASK-2268"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5904,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelGatewayHost",
          "ModelRouterService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04"
        ],
        "scenarios": [
          "SCN-ModelGatewayHost-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-561",
        "AIFACTORY-US-562",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-563]",
      "number": 563
    },
    {
      "id": "AIFACTORY-TASK-2267",
      "type": "task",
      "parent": "AIFACTORY-US-563",
      "title": "Forwarded headers and metadata of a write route and a stateless call path",
      "sequence": "03.01.04.01",
      "description": "Forwarded headers and metadata of a write route and a stateless call path. Expected output: A shared-write REST route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; an internal gRPC route names the service scope a workload token must hold, answers PERMISSION_DENIED without it and forwards the tenant-id and project metadata of the caller unchanged with it (ADR-0015 amendment D114); no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "A shared-write REST route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; an internal gRPC route names the service scope a workload token must hold, answers PERMISSION_DENIED without it and forwards the tenant-id and project metadata of the caller unchanged with it (ADR-0015 amendment D114); no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2267]",
      "number": 2267
    },
    {
      "id": "AIFACTORY-TASK-2268",
      "type": "task",
      "parent": "AIFACTORY-US-563",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "03.01.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelGatewayHost-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-563 with a fake that applies a key once, the gRPC route of ModelGateway.ResolveRoutePlan under a workload token with and without the service scope and under a user token of the token matrix (PERMISSION_DENIED and no call to the fake), a replica stopped during a call, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelGatewayHost-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-563 with a fake that applies a key once, the gRPC route of ModelGateway.ResolveRoutePlan under a workload token with and without the service scope and under a user token of the token matrix (PERMISSION_DENIED and no call to the fake), a replica stopped during a call, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2268]",
      "number": 2268
    },
    {
      "id": "AIFACTORY-US-564",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-014",
      "title": "A publication, production or spend route is forwarded under its scope, the gate stays in the fronted service and a model stream passes through unspliced",
      "sequence": "03.01.05",
      "description": "As a platform admin, I want a gated action and a model call to be decided by the service that owns their state, with the gateway only checking who calls and what may be called, so that an approval, a budget or a provider is never decided twice or by a component that holds no state. Three side-effect classes of this platform carry a gate beyond the scope. The publication routes are two operations of ModelRouterService: `ApproveDeployment`, which moves an Evaluated deployment to Approved after license and evidence checks, and `AttestDeployment`, by which a Platform admin approves a Candidate or an Evaluated deployment by attestation with a required reason (decisions D121 and D123). The production route is `DrainComputePool` of ComputePoolService, a production action on serving capacity. The spend routes are the internal gRPC methods `ModelGateway.Invoke`, `ModelGateway.Embed` and `ModelGateway.Rerank` of ModelRouterService, each of which calls a model provider; spend is the highest side-effect class the model gives this gateway. The one spend operation the gateway serves itself, the OpenAI-compatible route `CreateChatCompletion`, ends in the same `ModelGateway.Invoke` and is delivered by AIFACTORY-US-756. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from a user token, requires the scope the operation names, `factory.models.admin` for the approval and for the attestation and `factory.compute.admin` for the drain, or the service scope a workload token must hold on a gRPC route, and forwards the call with the established scope. The gate itself is decided where the state is. ModelRouterService approves a deployment only in state Evaluated, with license metadata that permits the use and capability evidence that meets the thresholds of every profile that lists the deployment, and answers 409 or 412 otherwise; it approves by attestation only a Candidate or an Evaluated deployment (decision D123) whose request states a reason, and answers 400 without a reason and 409 for a deployment in another state or with a license that forbids the use; the gateway evaluates no approval and no attestation, holds no approval reference and returns those answers unchanged. For a model call the gateway resolves no profile, selects no provider, holds no provider credential, asks for no policy decision, reads no budget and writes no receipt: the policy decision, the brokered credential, the adapter call, the receipt and the usage belong to ModelRouterService. The gateway writes no audit evidence; ModelRouterService writes its events in the transaction of its command and AuditService records evidence from them. `ModelGateway.Invoke` is a server stream. The gateway relays each message in the order the service sends it, buffers no whole output, propagates a cancellation of the caller to the service and ends the stream with the final message of the service, which carries the receipt; an error status of the service ends the stream with that status unchanged. When a gateway replica crashes during a stream, the caller sees the stream break (failure mode of a gateway crash mid-stream in the model). The gateway does not reconnect, resume or splice a stream and replays nothing; ModelRouterService observes the broken call, records the partial output status in the receipt of the invocation, and the caller reads the run state and the receipt and never joins the output of two calls. A caller that repeats the call with the same idempotency key receives the existing receipt from the service and no second provider call. A call without a token is answered 401, over gRPC UNAUTHENTICATED, and a token without the scope 403, over gRPC PERMISSION_DENIED, and no fronted service is called. A user token on `ModelGateway.Invoke`, `ModelGateway.Embed` or `ModelGateway.Rerank` holds no service scope and is answered PERMISSION_DENIED in the same way; a user reaches a chat model only through the route of AIFACTORY-US-756, under the scope `factory.models.invoke`. Every one of these routes names only a resource id or a message of the call: the fronted service answers 403 for a missing role and 404, over gRPC NOT_FOUND, for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. The production route is proven against the fake of ComputePoolService generated from its fronts entry, because the service arrives in I8. Kind: behavior. Traces: services: ModelGatewayHost, ModelRouterService; adrs: ADR-0015, ADR-0028; requirements: FR-04, XL-04; scenarios: SCN-ModelGatewayHost-003, SCN-ModelGatewayHost-004. Depends on: AIFACTORY-US-561, AIFACTORY-US-562, feature:component-api-gateway-template. Sources: model/services/model-compute/ModelGatewayHost.yaml, model/services/model-compute/ModelRouterService.yaml, model/services/model-compute/ComputePoolService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/model-compute/model-gateway.md.",
      "acceptanceCriteria": [
        "AC1: Given a user token with `factory.models.admin`, when the publication route of `ApproveDeployment` is called against the fake of ModelRouterService that answers 200, 409 or 412, or the publication route of `AttestDeployment` against the fake that answers 200, 400 or 409, then the gateway forwards the call, for the attestation with its body unchanged, under the established scope and returns each answer unchanged with the correlation id; it evaluates no approval and no attestation, holds no approval reference and writes nothing (SCN-ModelGatewayHost-004, ADR-0028, model/services/model-compute/ModelRouterService.yaml).",
        "AC2: Given a user token with `factory.compute.admin`, when the production route of `DrainComputePool` is called against the fake of ComputePoolService generated from the fronts entry, then the gateway forwards the call under the tenant of the token and the scope of the operation, because the route names only the `poolId`, and returns the answer of the fake unchanged; the gateway evaluates no approval and writes no audit evidence (SCN-ModelGatewayHost-003, ADR-0028).",
        "AC3: Given a workload token that holds the service scope of the spend routes, when `ModelGateway.Embed` and the server stream of `ModelGateway.Invoke` are called, then the unary reply returns unchanged and every message of the stream reaches the caller in the order the fake of ModelRouterService sent it, ending with the message that carries the receipt; a cancellation of the caller reaches the fake, and an error status of the fake ends the stream with that status unchanged; the gateway selected no provider, held no credential and read no budget (ADR-0028, model/services/model-compute/ModelGatewayHost.yaml).",
        "AC4: Given a gateway replica stopped while a stream of `ModelGateway.Invoke` is open, when the caller observes the break and repeats the call with the same idempotency key through another replica, then the first stream ended with an error and was neither resumed nor spliced, the second call returns what the fronted service answers for that key, and the gateway replayed nothing, as the failure mode of model/services/model-compute/ModelGatewayHost.yaml states.",
        "AC5: Given a call without a token or with an expired token, or a token that lacks the scope of the operation, when a publication, production or spend route is called, then the gateway answers 401 or 403, over gRPC UNAUTHENTICATED or PERMISSION_DENIED, and no fronted service is called; given a user token, which holds no service scope, on the spend route of `ModelGateway.Invoke`, `ModelGateway.Embed` or `ModelGateway.Rerank`, then the answer is PERMISSION_DENIED and no fronted service is called; given a route that names only a resource id, such as the `deploymentId` of an approval or the `poolId` of a drain, when the fronted service answers 403 for a missing role or 404 for a resource of another tenant (ADR-0015 amendment D113), then the gateway returns that answer unchanged (SCN-ModelGatewayHost-003, SCN-ModelGatewayHost-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ComputePoolService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/model-compute/model-gateway.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2269",
        "AIFACTORY-TASK-2270",
        "AIFACTORY-TASK-2271"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5905,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelGatewayHost",
          "ModelRouterService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04",
          "XL-04"
        ],
        "scenarios": [
          "SCN-ModelGatewayHost-003",
          "SCN-ModelGatewayHost-004"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-561",
        "AIFACTORY-US-562",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ComputePoolService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/model-compute/model-gateway.md"
      ],
      "titlePrefix": "[AIFACTORY-US-564]",
      "number": 564
    },
    {
      "id": "AIFACTORY-TASK-2269",
      "type": "task",
      "parent": "AIFACTORY-US-564",
      "title": "Fakes of the publication, production and spend routes and the route class register of the gateway",
      "sequence": "03.01.05.01",
      "description": "Fakes of the publication, production and spend routes and the route class register of the gateway. Expected output: The acceptance suite holds a fake of ApproveDeployment that answers 200, 409 and 412, a fake of AttestDeployment that records the body it received and answers 200, 400 and 409, a fake of ComputePoolService generated from the production entry of the fronts file, and the stream fake of ModelGateway.Invoke of AIFACTORY-TASK-2262 with scripts for a complete stream, an error status and a stream that stays open; a register test lists every route of class publication, production and spend from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a budget, a provider credential or a receipt.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of ApproveDeployment that answers 200, 409 and 412, a fake of AttestDeployment that records the body it received and answers 200, 400 and 409, a fake of ComputePoolService generated from the production entry of the fronts file, and the stream fake of ModelGateway.Invoke of AIFACTORY-TASK-2262 with scripts for a complete stream, an error status and a stream that stays open; a register test lists every route of class publication, production and spend from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a budget, a provider credential or a receipt."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5905,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2269]",
      "number": 2269
    },
    {
      "id": "AIFACTORY-TASK-2270",
      "type": "task",
      "parent": "AIFACTORY-US-564",
      "title": "Relay of the server stream of ModelGateway.Invoke with cancellation and status pass-through",
      "sequence": "03.01.05.02",
      "description": "Relay of the server stream of ModelGateway.Invoke with cancellation and status pass-through. Expected output: The generated gRPC route of ModelGateway.Invoke relays each message of the fronted service to the caller in order without buffering the whole output, propagates the cancellation and the deadline of the caller to the fronted service, ends the stream with the final message or the error status of the service unchanged, and holds no state of an open stream that another replica could resume; request count and latency of the route are recorded when the stream ends, with the status that ended it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The generated gRPC route of ModelGateway.Invoke relays each message of the fronted service to the caller in order without buffering the whole output, propagates the cancellation and the deadline of the caller to the fronted service, ends the stream with the final message or the error status of the service unchanged, and holds no state of an open stream that another replica could resume; request count and latency of the route are recorded when the stream ends, with the status that ended it."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5905,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2270]",
      "number": 2270
    },
    {
      "id": "AIFACTORY-TASK-2271",
      "type": "task",
      "parent": "AIFACTORY-US-564",
      "title": "Verify the publication, production and spend routes through the acceptance suite",
      "sequence": "03.01.05.03",
      "description": "Verify the publication, production and spend routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelGatewayHost-003|Scenario=SCN-ModelGatewayHost-004)\"` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ModelStreamRelay\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-564: each class forwarded under its scope, the answers 409 and 412 of the approval and 400 and 409 of the attestation returned unchanged, the ordered relay and the cancellation of a stream, a replica stopped during an open stream, the refusals of the gateway without a call to a fronted service, among them a user token of the token matrix on ModelGateway.Invoke, ModelGateway.Embed and ModelGateway.Rerank answered PERMISSION_DENIED, and the register of gated routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelGatewayHost-003|Scenario=SCN-ModelGatewayHost-004)\"` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ModelStreamRelay\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-564: each class forwarded under its scope, the answers 409 and 412 of the approval and 400 and 409 of the attestation returned unchanged, the ordered relay and the cancellation of a stream, a replica stopped during an open stream, the refusals of the gateway without a call to a fronted service, among them a user token of the token matrix on ModelGateway.Invoke, ModelGateway.Embed and ModelGateway.Rerank answered PERMISSION_DENIED, and the register of gated routes."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2271]",
      "number": 2271
    },
    {
      "id": "AIFACTORY-US-565",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-014",
      "title": "Health, adapter metadata, limits and telemetry of the model gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "03.01.06",
      "description": "As an operator, I want to see whether the model gateway, the identity platform and each fronted service answer, and which provider adapters stand behind the gateway, so that I can tell a failing service from a failing gateway and act on the right one. An operator and the probes of the cluster read the state of the gateway through its two own operations. `ModelGatewayHost/GatewayHealth` reports liveness and readiness of the gateway with the aggregated health of the two services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. What the gateway does when it is unreachable is decided (D117, ADR-0015 amendment). While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe `GatewayHealth` answers 200 with the health degraded and a detail that names the identity platform as unreachable, so the operator sees the failure in health while calls still pass. The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, `GatewayHealth` answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency: when it does not answer, health reports it as unavailable in the detail, its routes answer 503 with a retry hint, and the routes of the other service keep serving. Until ComputePoolService is delivered in I8, the detail reports it as unavailable and the answer stays 200. `ModelGatewayHost/GatewayAdapters` returns to a caller whose scope carries `factory.meta.read` the provider adapters of the services behind this gateway with their package versions and supported protocols: OpenAI-compatible, Anthropic-compatible, embeddings, reranking, streaming, structured outputs and tool calls. The gateway loads no adapter and holds no state: the adapters are loaded by ModelRouterService from the pinned AI library, as its option `ModelGateway:Adapters:Enabled` names them. The model gives ModelRouterService no operation that returns that list, so the source of the answer is an open point reported to the owner. Until it is decided, the operation is hosted with its scope, its refusals and its response shape and reads the list through one metadata port of the gateway, which the acceptance suite fills with the fake of ModelRouterService; a deployed instance whose port has no source answers 503 with a problem response that says so and invents no list. A call that exceeds the rate limit configured for its route is refused with 429 through the pinned rate-limiting library, from the configuration of the gateway. The gateway emits `connectsoft.factory.model_gateway.host.requests` with the dimensions protocol and status and `connectsoft.factory.model_gateway.host.request_duration` with service and route, the latency including the fronted service, and carries the trace context to the service; the duration is the series against which the objective of the model for the access overhead of gateway and router, 150 ms at p95 without provider time, is measured once the system is deployed, and no value is claimed here. Logs, activities and metrics never contain a token, a prompt, a completion, a tool output or a payload (ADR-0019). A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed, and an open model stream of that replica breaks as AIFACTORY-US-564 states. The roles of the gateway are Observer, Operator and Platform admin. Kind: behavior. Traces: services: ModelGatewayHost; apis: ModelGatewayHost/GatewayHealth, ModelGatewayHost/GatewayAdapters; adrs: ADR-0015, ADR-0017, ADR-0019, ADR-0028; requirements: NFR-07, NFR-13, NFR-18; scenarios: SCN-ModelGatewayHost-001, SCN-ModelGatewayHost-002. Depends on: AIFACTORY-US-561, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/model-compute/ModelGatewayHost.yaml, docs/planes/model-compute/services/model-gateway-host/index.md#metrics-and-observability, docs/planes/model-compute/services/model-gateway-host/index.md#failure-and-recovery, docs/planes/model-compute/providers-and-profiles.md.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and ModelRouterService reachable, when `ModelGatewayHost/GatewayHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the two fronted services and of the identity platform, ComputePoolService being reported as unavailable in the detail until its delivery in I8 without turning the answer into 503 (SCN-ModelGatewayHost-001, NFR-18).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `ModelGatewayHost/GatewayHealth` is probed, then tokens that were already issued are validated with the cached key, readiness stays ready so the replica stays in rotation, and from the first failed probe health answers 200 with the health degraded and a detail that names the identity platform as unreachable, while liveness keeps answering 200; given no valid key remains, because none was cached or the cached keys expired, when calls arrive, then they are refused, readiness is unready so the replica leaves rotation, `ModelGatewayHost/GatewayHealth` answers 503 with a problem response that names the identity platform and no state changes (SCN-ModelGatewayHost-001, model/services/model-compute/ModelGatewayHost.yaml).",
        "AC3: Given ModelRouterService does not answer, when `ModelGatewayHost/GatewayHealth` and the routes are called, then health reports that service as unavailable in its detail, its routes answer 503 with a retry hint that names the service, over gRPC UNAVAILABLE, and the gateway invents no response (SCN-ModelGatewayHost-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read` and a metadata source that answers, when `ModelGatewayHost/GatewayAdapters` is called, then the response is 200 with each provider adapter, its package version and its supported protocols as the source reported them; a call without a token is answered 401 and a token without the scope 403; when the source does not answer or no source is configured, the answer is 503 with a problem response that names it; nothing is written and no list is invented (SCN-ModelGatewayHost-002).",
        "AC5: Given routed calls and a call above the rate limit of its route, when the metrics and logs are read, then `connectsoft.factory.model_gateway.host.requests` counts every call by protocol and status, the call above the limit was refused with 429, `connectsoft.factory.model_gateway.host.request_duration` holds the latency by service and route, and no log record, activity or metric holds a token, a prompt, a completion or a payload (ADR-0019, model/services/model-compute/ModelGatewayHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "docs/planes/model-compute/services/model-gateway-host/index.md#metrics-and-observability",
        "docs/planes/model-compute/services/model-gateway-host/index.md#failure-and-recovery",
        "docs/planes/model-compute/providers-and-profiles.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-046",
        "AIFACTORY-TASK-2272",
        "AIFACTORY-TASK-2273",
        "AIFACTORY-TASK-2274"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5906,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelGatewayHost"
        ],
        "apis": [
          "ModelGatewayHost/GatewayHealth",
          "ModelGatewayHost/GatewayAdapters"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-07",
          "NFR-13",
          "NFR-18"
        ],
        "scenarios": [
          "SCN-ModelGatewayHost-001",
          "SCN-ModelGatewayHost-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-561",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "docs/planes/model-compute/services/model-gateway-host/index.md#metrics-and-observability",
        "docs/planes/model-compute/services/model-gateway-host/index.md#failure-and-recovery",
        "docs/planes/model-compute/providers-and-profiles.md"
      ],
      "titlePrefix": "[AIFACTORY-US-565]",
      "number": 565
    },
    {
      "id": "AIFACTORY-TASK-046",
      "type": "task",
      "parent": "AIFACTORY-US-565",
      "title": "Health, adapter metadata and telemetry of the gateway",
      "sequence": "03.01.06.01",
      "description": "Health, adapter metadata and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the adapters operation serves, under factory.meta.read, the adapter list its metadata port returns and answers 503 when the port has no source or the source does not answer; every routed call records connectsoft.factory.model_gateway.host.requests and connectsoft.factory.model_gateway.host.request_duration with their modelled dimensions and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the adapters operation serves, under factory.meta.read, the adapter list its metadata port returns and answers 503 when the port has no source or the source does not answer; every routed call records connectsoft.factory.model_gateway.host.requests and connectsoft.factory.model_gateway.host.request_duration with their modelled dimensions and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5906,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-046]",
      "number": 46
    },
    {
      "id": "AIFACTORY-TASK-2272",
      "type": "task",
      "parent": "AIFACTORY-US-565",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "03.01.06.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status; the limit values are configuration of the deployment and none is fixed in code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status; the limit values are configuration of the deployment and none is fixed in code."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5906,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2272]",
      "number": 2272
    },
    {
      "id": "AIFACTORY-TASK-2273",
      "type": "task",
      "parent": "AIFACTORY-US-565",
      "title": "Runbook of the four failure modes of the gateway",
      "sequence": "03.01.06.03",
      "description": "Runbook of the four failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/model-compute/ModelGatewayHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash, gateway crash mid-stream) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the crash mid-stream states that no stream is resumed or spliced and that the caller reads the receipt (NFR-18).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/model-compute/ModelGatewayHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash, gateway crash mid-stream) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the crash mid-stream states that no stream is resumed or spliced and that the caller reads the receipt (NFR-18)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5906,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2273]",
      "number": 2273
    },
    {
      "id": "AIFACTORY-TASK-2274",
      "type": "task",
      "parent": "AIFACTORY-US-565",
      "title": "Verify health, adapter metadata, limits and telemetry through the acceptance suite",
      "sequence": "03.01.06.04",
      "description": "Verify health, adapter metadata, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelGatewayHost-001|Scenario=SCN-ModelGatewayHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-565 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, the adapters operation with a source, without one and without its scope, a call above its limit, and a scan of the captured logs and activities for token and payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelGatewayHost-001|Scenario=SCN-ModelGatewayHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-565 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, the adapters operation with a source, without one and without its scope, a call above its limit, and a scan of the captured logs and activities for token and payload content."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5906,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2274]",
      "number": 2274
    },
    {
      "id": "AIFACTORY-US-756",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-014",
      "title": "The OpenAI-compatible chat completions route turns a run-bound call under the token of an attempt or a call outside a run under a user token into one model invocation of ModelRouterService",
      "sequence": "03.01.07",
      "description": "As a requester, I want to call a model profile from a client that speaks the OpenAI chat completions protocol, inside a run and outside one, so that a tool inside my tenant reaches the models of the Factory under the same policy, credential and receipt rules as an agent and never holds a provider key. An in-tenant client that speaks the OpenAI chat completions protocol reaches a model through `CreateChatCompletion`, POST /v1/chat/completions on gateway role GW-01, the one public operation this gateway serves itself; decision D121 delivers it in I1. The route is hosted while `ModelGateway:Protocols:ExposeOpenAiCompatible` is true, its modelled default; with the switch false no route is hosted and the path is answered 404 like every path without a route. The switch is not reloadable. The Anthropic-compatible switch is false by default, its route is a later feature, and nothing of it is built here (AIFACTORY-US-561). The route admits two kinds of token and no other (decision D125). The gateway validates issuer, signature, lifetime and audience as on every route (AIFACTORY-US-562); a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a user token without `factory.models.invoke`, the invoke scope of the model services, and a workload token that is not the token of an attempt 403, and in these cases no fronted service is called. The route serves two kinds of call in I1 (decision D123), and the kind of token tells them apart. A run-bound call presents the token of an attempt: the short-lived token that RunControlService hands out in the `attemptToken` member of the lease answer, which the Authorization Server issues by a token exchange and which names the run, the step and the attempt in the claims `run_id`, `step_id` and `attempt_id` beside the tenant claim `tid`. The gateway takes the three from those claims and copies them into the invocation, requires no `OpenAI-Project` header and forwards the token of the attempt in place of a user token; ModelRouterService takes the project, the classification and the pinned profile version from the route plan of the run, never from a header or the body of the caller, the usage of the call counts on the reservation of the run, and its receipt is listed with the receipts of the run by `ListRunReceipts` of ModelRouterService. The gateway holds no state and needs no dependency on RunControlService for this, because the claims carry the run and the route plan carries the rest. A call outside a run presents a user access token whose one audience is this gateway and whose scope carries `factory.models.invoke`. It names its project in the `OpenAI-Project` request header of the protocol: a call without the header is answered 400 with the header named, and the gateway checks the project against the role claims of the validated token and answers 403 for a project the token does not grant; in both cases no fronted service is called. Its classification is the value of `ModelGateway:Protocols:OpenAiCompatibleClassification`, one of the classification values of `model-invocation-v1`; the option has no default value and is not reloadable, and a start with the route enabled and the option unset fails with the key named. The invocation of such a call names no run and no attempt, which are optional members of `model-invocation-v1` since decision D123. `ModelGateway.Invoke` resolves the candidates for the call and persists no route plan, the usage is recorded without a run and metered on the budget of the project without a reservation, and the receipt is read back through `ListProjectReceipts` of ModelRouterService, GET /factory/projects/{projectId}/model-receipts, which this gateway fronts as a read route with the same check of the project (AIFACTORY-US-562). This route is the one place where the gateway translates a payload, and it translates the wire protocol only. In both kinds of call the `model` member of the request is a model profile id, such as `code-agent`, and never a provider model name: the gateway copies it into the profile of the invocation and resolves nothing, and ModelRouterService resolves it to the version pinned by the snapshot of the run for a run-bound call and to the active version of the profile otherwise. From the body the gateway builds one `model-invocation-v1`: a new invocation id, the profile, the trusted scope with the tenant of the validated token and, for a call outside a run, the project of the header, the hash of the canonical request, a new idempotency key for every call, because the operation declares no idempotency and a repeated HTTP call is a new invocation, for a call outside a run the classification of the option, the capabilities the body asks for (tools, structured output, streaming), the budget with the output token limit of the body, and the stream switch. The messages and the tool definitions travel in the request message of the proto of ModelRouterService and are stored nowhere by the gateway. It then calls `ModelGateway.Invoke` of ModelRouterService through its generated gRPC client with the token of the caller forwarded unchanged and exchanges no token (ADR-0015 amendment D117); ModelRouterService validates the token again, requires `factory.models.invoke` of a user token, admits the token of an attempt as a run-bound call and runs its pipeline. Everything that decides the call stays there (ADR-0028): the gateway resolves no profile, selects no deployment, asks for no policy decision, holds no provider credential, reads no budget, makes no reservation and writes no receipt. Every call of either kind produces a receipt like any other invocation, written by ModelRouterService with the deployment that answered and the usage status. The reply is translated back. Without streaming the gateway collects the messages of the server stream and answers 200 with one chat completion whose id is the invocation id of the receipt, whose `model` is the profile id the caller sent and whose usage holds the token counts of the receipt when the provider reported them and is absent, never zero, when the usage is Unknown. With `stream` true it answers 200 with an event stream, relays every message of the router as one chunk in the order received, buffers no whole output, propagates a cancellation of the caller to the router and ends with the terminal marker of the protocol after the message that carries the receipt. A refusal is translated into the error body of the protocol with the correlation id, and since decision D123 the operation lists every code the translation answers: 200, 400, 403, 404, 429, 503 and 504; 401 is the answer of every route of this gateway. A body the gateway cannot translate is answered 400 with the member named and calls no fronted service: a member the translation does not carry is refused and never dropped silently, because the protocols row of docs/planes/model-compute/model-gateway.md promises no complete wire compatibility. INVALID_ARGUMENT of the router becomes 400 and PERMISSION_DENIED, the denial of a policy decision among them, 403. NOT_FOUND becomes 404, the answer when no profile answers to the model name. A rate or budget refusal is answered 429: a call above the rate limit of the route is refused by the gateway itself (AIFACTORY-US-565) and reaches no fronted service, and RESOURCE_EXHAUSTED of the router is translated into the same code. The router answers RESOURCE_EXHAUSTED to a call outside a run of a project for which it keeps a budget mark, set from `BudgetExceeded` of CostUsageService, and refuses no run-bound call for that mark (decision D125); the gateway reads no budget and only translates the answer. UNAVAILABLE becomes 503 with a retry hint that names the service, and DEADLINE_EXCEEDED 504. When the stream of the router ends with an error after output was emitted, or a gateway replica stops while the stream is open, the event stream of the caller breaks; the gateway resumes and splices nothing, and ModelRouterService records the partial output in the receipt (failure mode of a gateway crash mid-stream in the model, AIFACTORY-US-564). The gateway records `connectsoft.factory.model_gateway.host.requests` with the protocol of the route and the returned status and `connectsoft.factory.model_gateway.host.request_duration` for the route, and no log record, activity or metric holds a token, a message, a completion or a tool output (ADR-0019). The route is proven against the stream fake of `ModelGateway.Invoke` of the acceptance suite; what ModelRouterService does with the forwarded token in either kind of call is proven by feature `model-router-service`. Kind: behavior. Traces: services: ModelGatewayHost, ModelRouterService; apis: ModelGatewayHost/CreateChatCompletion; descriptors: model-invocation-v1; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: FR-04, XL-04; scenarios: SCN-ModelGatewayHost-008. Depends on: AIFACTORY-US-561, AIFACTORY-US-562, AIFACTORY-US-564, AIFACTORY-US-565, feature:component-api-gateway-template, feature:contracts-package. Sources: model/services/model-compute/ModelGatewayHost.yaml, model/services/model-compute/ModelRouterService.yaml, docs/reference/schemas/model-invocation.schema.json, docs/reference/schemas/attempt-outcome.schema.json, docs/planes/model-compute/model-gateway.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given `ModelGateway:Protocols:ExposeOpenAiCompatible` true, a user token whose audience is this gateway with `factory.models.invoke` that carries no run, an `OpenAI-Project` header that names a project the role claims of the token grant, and a body that names a model profile id as `model`, when `ModelGatewayHost/CreateChatCompletion` is called without streaming, then the fake of ModelRouterService receives exactly one call of `ModelGateway.Invoke` whose `model-invocation-v1` holds a new invocation id, the profile id as profile, the tenant of the token, the project of the header, the request hash, a new idempotency key, the classification of `ModelGateway:Protocols:OpenAiCompatibleClassification` and no run and no attempt, and whose authorization metadata carries the user token unchanged, without a token exchange; the answer is 200 with one chat completion whose id is the invocation id, whose `model` is the profile id and whose usage holds the token counts of the receipt, or no usage when the receipt states Unknown; the gateway wrote nothing (SCN-ModelGatewayHost-008, ADR-0015).",
        "AC2: Given the token of an attempt whose claims `run_id`, `step_id` and `attempt_id` name a run, a step and an attempt, as the `attemptToken` member of the lease answer of docs/reference/schemas/attempt-outcome.schema.json carries it, when `ModelGatewayHost/CreateChatCompletion` is called, with or without an `OpenAI-Project` header, then the `model-invocation-v1` the fake receives carries that run, step and attempt from the claims, takes its project from no header and its classification not from `ModelGateway:Protocols:OpenAiCompatibleClassification`, and the token of the attempt is forwarded unchanged in place of a user token; given `stream` true in either kind of call, then the answer is 200 with an event stream in which every message of the fake reaches the caller as one chunk in the order sent and which ends with the terminal marker of the protocol after the message that carries the receipt; a cancellation of the caller reaches the fake; an error status of the fake after output was emitted, and a gateway replica stopped while the stream is open, break the stream of the caller, and nothing is resumed or spliced (SCN-ModelGatewayHost-008, model/services/model-compute/ModelGatewayHost.yaml).",
        "AC3: Given the token matrix of the acceptance suite, when `ModelGatewayHost/CreateChatCompletion` is called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a user token without `factory.models.invoke` and a workload token that is not the token of an attempt 403, a call outside a run without the `OpenAI-Project` header 400 with the header named, a call outside a run whose header names a project the role claims of the token do not grant 403, and a body the gateway cannot translate 400 with the member named, and in none of these cases the fake is called; given `ModelGateway:Protocols:ExposeOpenAiCompatible` false, then no route is hosted and the path is answered 404; given the route enabled and `ModelGateway:Protocols:OpenAiCompatibleClassification` unset, then the start fails with the key named (SCN-ModelGatewayHost-008, ADR-0015).",
        "AC4: Given a fake of ModelRouterService that ends `ModelGateway.Invoke` with INVALID_ARGUMENT, PERMISSION_DENIED, NOT_FOUND, RESOURCE_EXHAUSTED, DEADLINE_EXCEEDED or UNAVAILABLE, or that does not answer, when `ModelGatewayHost/CreateChatCompletion` is called, then the answer is 400, 403, 404, 429, 504 or 503 respectively in the error body of the protocol with the correlation id, each a code model/services/model-compute/ModelGatewayHost.yaml lists for the operation, the 503 carrying a retry hint that names the service and never its address; the gateway invents no completion; given the fake answers RESOURCE_EXHAUSTED for a call outside a run of a project under a budget mark and serves a run-bound call of the same project, then the first is answered 429 and the second 200; a call above the rate limit of the route is refused with 429 and reaches no fronted service (SCN-ModelGatewayHost-008, ADR-0028).",
        "AC5: Given calls of the route of both kinds that completed, were refused and broke mid-stream, when the metrics, logs and stores are read, then `connectsoft.factory.model_gateway.host.requests` counts each call with the protocol of the route and the returned status, `connectsoft.factory.model_gateway.host.request_duration` holds the latency of the route, no log record, activity or metric holds a token, a message, a completion or a tool output, and the gateway holds no profile, no deployment, no provider credential, no budget, no reservation, no idempotency key and no receipt of any call (ADR-0019, ADR-0028, model/services/model-compute/ModelGatewayHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/planes/model-compute/model-gateway.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3051",
        "AIFACTORY-TASK-3052",
        "AIFACTORY-TASK-3053",
        "AIFACTORY-TASK-3054"
      ],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5907,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelGatewayHost",
          "ModelRouterService"
        ],
        "apis": [
          "ModelGatewayHost/CreateChatCompletion"
        ],
        "descriptors": [
          "model-invocation-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04",
          "XL-04"
        ],
        "scenarios": [
          "SCN-ModelGatewayHost-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-561",
        "AIFACTORY-US-562",
        "AIFACTORY-US-564",
        "AIFACTORY-US-565",
        "feature:component-api-gateway-template",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/planes/model-compute/model-gateway.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-756]",
      "number": 756
    },
    {
      "id": "AIFACTORY-TASK-3051",
      "type": "task",
      "parent": "AIFACTORY-US-756",
      "title": "Translation contract of the OpenAI-compatible chat completions route",
      "sequence": "03.01.07.01",
      "description": "Translation contract of the OpenAI-compatible chat completions route. Expected output: The repository documentation holds one table that maps the members of a chat completions request the route carries (model as the model profile id, messages, stream, tools with the tool choice, the output token limit and the response format) and the OpenAI-Project request header onto the fields of model-invocation-v1 of docs/reference/schemas/model-invocation.schema.json and onto the request message of ModelGateway.Invoke, and names the fields the gateway assigns itself for each kind of call (D123): the invocation id, the idempotency key, the request hash and the tenant of the token in both; for a run-bound call under the token of an attempt the run, the step and the attempt from its claims run_id, step_id and attempt_id, no OpenAI-Project header, and no project and no classification, which ModelRouterService takes from the route plan of the run (D125); for a call outside a run under a user token the project of the OpenAI-Project header, checked against the role claims of the token, the classification from ModelGateway:Protocols:OpenAiCompatibleClassification and no run and no attempt; it states that every other member is refused with 400 and the member named, fixes the shape of the completion, of a stream chunk and of the error body, and maps every gRPC status of ModelGateway.Invoke onto its HTTP code: INVALID_ARGUMENT 400, UNAUTHENTICATED 401, PERMISSION_DENIED 403, NOT_FOUND 404, RESOURCE_EXHAUSTED 429, UNAVAILABLE 503 and DEADLINE_EXCEEDED 504; golden files of a request of each kind, a completion, a chunk sequence and each error body are checked in the pipeline, and the OpenAPI document of AIFACTORY-TASK-2263 lists the route with its scope, the OpenAI-Project header and the codes 200, 400, 403, 404, 429, 503 and 504 of model/services/model-compute/ModelGatewayHost.yaml.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one table that maps the members of a chat completions request the route carries (model as the model profile id, messages, stream, tools with the tool choice, the output token limit and the response format) and the OpenAI-Project request header onto the fields of model-invocation-v1 of docs/reference/schemas/model-invocation.schema.json and onto the request message of ModelGateway.Invoke, and names the fields the gateway assigns itself for each kind of call (D123): the invocation id, the idempotency key, the request hash and the tenant of the token in both; for a run-bound call under the token of an attempt the run, the step and the attempt from its claims run_id, step_id and attempt_id, no OpenAI-Project header, and no project and no classification, which ModelRouterService takes from the route plan of the run (D125); for a call outside a run under a user token the project of the OpenAI-Project header, checked against the role claims of the token, the classification from ModelGateway:Protocols:OpenAiCompatibleClassification and no run and no attempt; it states that every other member is refused with 400 and the member named, fixes the shape of the completion, of a stream chunk and of the error body, and maps every gRPC status of ModelGateway.Invoke onto its HTTP code: INVALID_ARGUMENT 400, UNAUTHENTICATED 401, PERMISSION_DENIED 403, NOT_FOUND 404, RESOURCE_EXHAUSTED 429, UNAVAILABLE 503 and DEADLINE_EXCEEDED 504; golden files of a request of each kind, a completion, a chunk sequence and each error body are checked in the pipeline, and the OpenAPI document of AIFACTORY-TASK-2263 lists the route with its scope, the OpenAI-Project header and the codes 200, 400, 403, 404, 429, 503 and 504 of model/services/model-compute/ModelGatewayHost.yaml."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5907,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3051]",
      "number": 3051
    },
    {
      "id": "AIFACTORY-TASK-3052",
      "type": "task",
      "parent": "AIFACTORY-US-756",
      "title": "Stream scripts and tokens of the acceptance suite for the chat completions route",
      "sequence": "03.01.07.02",
      "description": "Stream scripts and tokens of the acceptance suite for the chat completions route. Expected output: The stream fake of ModelGateway.Invoke of AIFACTORY-TASK-2262 gains scripts for a complete stream that ends with a receipt of reported usage, one that ends with a receipt of usage Unknown, one per error status of the contract of AIFACTORY-TASK-3051 before any output, RESOURCE_EXHAUSTED among them, one that ends with an error after output and one that stays open; the fake records the invocation and the authorization metadata it received; the token matrix gains a user token with factory.models.invoke that carries no run and whose role claims grant one project and not another, the token of an attempt with the claims run_id, step_id, attempt_id and tid as the Authorization Server issues it by token exchange, a workload token that is not the token of an attempt, and a user token without the scope; a script answers RESOURCE_EXHAUSTED for a call outside a run of a marked project and serves a run-bound call of the same project.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The stream fake of ModelGateway.Invoke of AIFACTORY-TASK-2262 gains scripts for a complete stream that ends with a receipt of reported usage, one that ends with a receipt of usage Unknown, one per error status of the contract of AIFACTORY-TASK-3051 before any output, RESOURCE_EXHAUSTED among them, one that ends with an error after output and one that stays open; the fake records the invocation and the authorization metadata it received; the token matrix gains a user token with factory.models.invoke that carries no run and whose role claims grant one project and not another, the token of an attempt with the claims run_id, step_id, attempt_id and tid as the Authorization Server issues it by token exchange, a workload token that is not the token of an attempt, and a user token without the scope; a script answers RESOURCE_EXHAUSTED for a call outside a run of a marked project and serves a run-bound call of the same project."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5907,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3052]",
      "number": 3052
    },
    {
      "id": "AIFACTORY-TASK-3053",
      "type": "task",
      "parent": "AIFACTORY-US-756",
      "title": "CreateChatCompletion behind the protocol switch with the translation to ModelGateway.Invoke and back",
      "sequence": "03.01.07.03",
      "description": "CreateChatCompletion behind the protocol switch with the translation to ModelGateway.Invoke and back. Expected output: The route POST /v1/chat/completions is hosted only while ModelGateway:Protocols:ExposeOpenAiCompatible is true, admits the token of an attempt or a user token of the audience of the gateway with factory.models.invoke, refuses a workload token that is not the token of an attempt with 403, and tells the two kinds of call apart by the kind of token (D123, D125): for the token of an attempt it copies the run, the step and the attempt of the claims run_id, step_id and attempt_id into the invocation, requires no OpenAI-Project header, forwards that token in place of a user token and takes neither the project from a header nor the classification from the option; for a user token it requires the OpenAI-Project header (400 with the header named), checks its project against the role claims of the token (403), states the classification of ModelGateway:Protocols:OpenAiCompatibleClassification and names no run and no attempt; it refuses a body the contract of AIFACTORY-TASK-3051 does not carry with 400 and the member named, builds the model-invocation-v1 with the model name as the model profile id, the tenant of the token, a new invocation id and idempotency key and the request hash, calls ModelGateway.Invoke through the generated gRPC client with the token forwarded unchanged, answers one completion or relays the messages as an event stream that ends with the terminal marker of the protocol, propagates the cancellation of the caller, translates every refusal by the mapping of the contract and resumes or splices no broken stream; a start with the route enabled and ModelGateway:Protocols:OpenAiCompatibleClassification unset fails with the key named; the route is rate limited like every route and records the two metrics of the gateway with its protocol and the returned status; nothing of a call is written to the shared cache or to any store.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "The route POST /v1/chat/completions is hosted only while ModelGateway:Protocols:ExposeOpenAiCompatible is true, admits the token of an attempt or a user token of the audience of the gateway with factory.models.invoke, refuses a workload token that is not the token of an attempt with 403, and tells the two kinds of call apart by the kind of token (D123, D125): for the token of an attempt it copies the run, the step and the attempt of the claims run_id, step_id and attempt_id into the invocation, requires no OpenAI-Project header, forwards that token in place of a user token and takes neither the project from a header nor the classification from the option; for a user token it requires the OpenAI-Project header (400 with the header named), checks its project against the role claims of the token (403), states the classification of ModelGateway:Protocols:OpenAiCompatibleClassification and names no run and no attempt; it refuses a body the contract of AIFACTORY-TASK-3051 does not carry with 400 and the member named, builds the model-invocation-v1 with the model name as the model profile id, the tenant of the token, a new invocation id and idempotency key and the request hash, calls ModelGateway.Invoke through the generated gRPC client with the token forwarded unchanged, answers one completion or relays the messages as an event stream that ends with the terminal marker of the protocol, propagates the cancellation of the caller, translates every refusal by the mapping of the contract and resumes or splices no broken stream; a start with the route enabled and ModelGateway:Protocols:OpenAiCompatibleClassification unset fails with the key named; the route is rate limited like every route and records the two metrics of the gateway with its protocol and the returned status; nothing of a call is written to the shared cache or to any store."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5907,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3053]",
      "number": 3053
    },
    {
      "id": "AIFACTORY-TASK-3054",
      "type": "task",
      "parent": "AIFACTORY-US-756",
      "title": "Verify the OpenAI-compatible chat completions route through the acceptance suite",
      "sequence": "03.01.07.04",
      "description": "Verify the OpenAI-compatible chat completions route through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelGatewayHost-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-756 with the scripts of AIFACTORY-TASK-3052: a call outside a run that completes without streaming with reported and with Unknown usage, the invocation with the project of the header, the configured classification and no run and no attempt and the unchanged user token received by the fake, the same call without the OpenAI-Project header (400) and with a project the role claims do not grant (403), neither reaching the fake, a run-bound call under the token of an attempt whose invocation carries the run, the step and the attempt of its claims, with and without the header, a call outside a run of a marked project answered 429 beside a run-bound call of the same project answered 200, a workload token that is not the token of an attempt (403), an event stream in order with its terminal marker, a cancellation of the caller, an error after output and a replica stopped during an open stream, the token matrix with and without factory.models.invoke and with a workload token, a body with a member the translation does not carry, the switch false, the start without the classification key, each refusal of the fake mapped to its code, RESOURCE_EXHAUSTED to 429 among them, a call above the rate limit, the golden files of the contract and a scan of the captured logs, activities and metrics for token and message content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelGatewayHost-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-756 with the scripts of AIFACTORY-TASK-3052: a call outside a run that completes without streaming with reported and with Unknown usage, the invocation with the project of the header, the configured classification and no run and no attempt and the unchanged user token received by the fake, the same call without the OpenAI-Project header (400) and with a project the role claims do not grant (403), neither reaching the fake, a run-bound call under the token of an attempt whose invocation carries the run, the step and the attempt of its claims, with and without the header, a call outside a run of a marked project answered 429 beside a run-bound call of the same project answered 200, a workload token that is not the token of an attempt (403), an event stream in order with its terminal marker, a cancellation of the caller, an error after output and a replica stopped during an open stream, the token matrix with and without factory.models.invoke and with a workload token, a body with a member the translation does not carry, the switch false, the start without the classification key, each refusal of the fake mapped to its code, RESOURCE_EXHAUSTED to 429 among them, a call above the rate limit, the golden files of the contract and a scan of the captured logs, activities and metrics for token and message content."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelGatewayHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 59,
      "phase": "factory",
      "stackRank": 5907,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3054]",
      "number": 3054
    },
    {
      "id": "AIFACTORY-FEAT-015",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-003",
      "title": "ModelRouterService: complete delivery",
      "sequence": "03.02",
      "description": "ModelRouterService is the service of bounded context BC-07 (Model Access). The model gateway pipeline — resolves a pinned model profile into a route plan from capability evidence, privacy class, policy, region, cost and availability; invokes the provider adapter with streaming, structured outputs and tool calls; and records an invocation receipt with the actual deployment and the usage status (BC-07). Its own repository is ConnectSoft.AI.SoftwareFactory.ModelRouterService. Delivers: ModelRouterService (complete). Increment I1: Generate a microservice. Build order 60 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-058",
        "AIFACTORY-US-566",
        "AIFACTORY-US-567",
        "AIFACTORY-US-568",
        "AIFACTORY-US-569",
        "AIFACTORY-US-570",
        "AIFACTORY-US-571",
        "AIFACTORY-US-572",
        "AIFACTORY-US-757",
        "AIFACTORY-US-573",
        "AIFACTORY-US-574",
        "AIFACTORY-US-575",
        "AIFACTORY-US-576",
        "AIFACTORY-US-577",
        "AIFACTORY-US-901",
        "AIFACTORY-US-1508"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6000,
      "titlePrefix": "[AIFACTORY-FEAT-015]",
      "number": 15
    },
    {
      "id": "AIFACTORY-US-058",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "ModelRouterService serves its scope end to end: a pinned profile becomes a route plan, a provider call and a receipt",
      "sequence": "03.02.01",
      "description": "As a platform admin, I want one service that resolves a model profile to an approved deployment, calls the provider and records what was used, so that the Model Access context has one owner that the rest of the Factory calls through its contract and no other service holds a provider credential. This is the integration PBI of the feature: it proves on a deployed instance that the behaviours of ModelRouterService work together along one model call of a run, as the first outcome demands. ModelRouterService is the model gateway pipeline of bounded context BC-07 and the only service that calls model providers; ModelGatewayHost is the only route to it (ADR-0028 decision 3). The chain it proves is this. The profile releases of the first outcome are loaded from AgentRegistryService by alias, their definitions are fetched from ArtifactService and the profile versions are active (AIFACTORY-US-569). A Platform admin registers a deployment as Candidate (AIFACTORY-US-570), capability evidence moves it to Evaluated (AIFACTORY-US-571), and the Platform admin approves it after the license and evidence checks, while the health probe keeps it Approved or Degraded (AIFACTORY-US-572). Where no capability suite runs, a Platform admin approves a Candidate or an Evaluated deployment by attestation with a required reason, and that is how the first Approved deployment of a deployed instance comes into being (AIFACTORY-US-757, decisions D121 and D123). AgentRuntimeService resolves the route plan of a run and profile once (AIFACTORY-US-573) and invokes the model through the Factory model client of the AI libraries and the gateway; the router asks PolicyEngineService for the decision, takes a short-lived credential from SecretBrokerService, calls the provider adapter with streaming and writes the receipt, with the deployment that answered and the usage status, together with `ModelInvoked` in one transaction (AIFACTORY-US-574). A user of an in-tenant client reaches the same pipeline through the OpenAI-compatible route of ModelGatewayHost, which calls `ModelGateway.Invoke` with the forwarded token of the caller, as a run-bound call under the token of an attempt that counts on the reservation of its run or as a call outside a run under a user token that is metered on the budget of its project without a reservation (AIFACTORY-US-574, decisions D121, D123 and D125). The router applies a fallback only where the profile allows it (AIFACTORY-US-575), serves embeddings and reranking the same way (AIFACTORY-US-576) and lets a caller read the receipts of the run (AIFACTORY-US-577) and the receipts of a project that name no run (AIFACTORY-US-901). CostUsageService records the input tokens and the output tokens of each receipt on its two meters and stores a receipt without a valid price or with an unknown quantity as Uncertain, so the router never keeps and repeats a receipt for a missing price (D117). The repository, the aggregates and the store are delivered by AIFACTORY-US-566, the hosted surface by AIFACTORY-US-567 and secrets, tenancy and telemetry by AIFACTORY-US-568. Throughout, a resource of another tenant is answered 404, over gRPC NOT_FOUND, a missing scope or role inside the tenant 403, and prompt and completion content is never stored in `model-router-sql`, logged or put on an activity. The delivery states its limits, and those the owner has not decided are reported. QualityScoreService is delivered thin in this increment and runs no capability suite, so on a deployed instance capability evidence arrives only once a service publishes `EvaluationCompleted` of the kind capability-suite; the acceptance environment publishes it by fixture, and until a suite runs a deployment of a deployed instance is approved by attestation (AIFACTORY-US-757). The thin AgentRegistryService publishes no release event, so profiles are loaded by alias and the handlers of the release events are proven by fixture. ComputePoolService arrives in I8: no placement is asked for and the handlers of its three events are not registered. RetentionResidencyService arrives in I4: the handlers of `ResidencyRuleChanged` and `DeletionOrderIssued` are not built here. No PBI of the backlog builds the handlers `ApplyResidencyRule` and `UpdateDeploymentAvailability` yet. The handler `ApplyClassification` of `ClassificationChanged` is registered with the least effect the model words (AIFACTORY-US-567). No source of provider statements is modelled, so the reconciler confirms nothing on a deployed instance. The thin AgentRegistryService seeds all eleven model profiles of model/model-profiles.yaml as Draft releases that are loadable by alias (decision D123), and the Draft allowance covers ModelProfile releases until the complete registry arrives in I4 (decision D121), so the chain of this PBI starts on a deployed instance from the seeded releases (AIFACTORY-US-569). `ModelGateway.Embed` and `ModelGateway.Rerank` stay in I1 behind ports and are proven with fixtures (decision D121): the rerank adapter is a port of the service until the AI library publishes the keyed rerank adapter abstraction of feature `component-extensions-ai`, so `ModelGateway.Rerank` has no provider behind it on a deployed instance of this increment (AIFACTORY-US-576). The scripted provider of the acceptance environment has no provider value of its own: the acceptance configuration binds it in place of the adapter of one of the six modelled provider values (AIFACTORY-TASK-2297), and the deployment of the chain is registered with that value. This PBI proves the one chain and its tenancy and content rules; every other scenario of the service is proven by the suite of the PBI that traces it and is not repeated here, and the scaffold and its pipeline are accepted by AIFACTORY-US-566. Decision D125 adds two rules to the path of the OpenAI-compatible route, both delivered by their own PBIs: a run-bound call presents the token of an attempt and takes its project, classification and profile version from the route plan of its run (AIFACTORY-US-574), and the calls outside a run of a project whose budget CostUsageService announced as exceeded are refused while the router keeps a budget mark for it (AIFACTORY-US-1508). Kind: behavior. Traces: services: ModelRouterService, ModelGatewayHost, PolicyEngineService, SecretBrokerService, CostUsageService, AgentRegistryService, ArtifactService; aggregates: ModelRouterService/ModelProfile, ModelRouterService/ModelDeployment, ModelRouterService/RoutePlan, ModelRouterService/InvocationReceipt; apis: ModelRouterService/ModelGateway.ResolveRoutePlan, ModelRouterService/ModelGateway.Invoke, ModelRouterService/ListRunReceipts; events: ModelRouterService/ModelInvoked; descriptors: model-invocation-v1; adrs: ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: FR-04, FR-09, XL-12; scenarios: SCN-ModelRouterService-004, SCN-ModelRouterService-006, SCN-ModelRouterService-008, SCN-ModelRouterService-009, SCN-ModelRouterService-010, SCN-ModelRouterService-013, SCN-ModelRouterService-015, SCN-ModelRouterService-016, SCN-ModelRouterService-017, SCN-ModelRouterService-018. Depends on: AIFACTORY-US-566, AIFACTORY-US-567, AIFACTORY-US-568, AIFACTORY-US-569, AIFACTORY-US-570, AIFACTORY-US-571, AIFACTORY-US-572, AIFACTORY-US-573, AIFACTORY-US-574, AIFACTORY-US-575, AIFACTORY-US-576, AIFACTORY-US-577, AIFACTORY-US-757, AIFACTORY-US-901, AIFACTORY-US-1508, feature:model-gateway-host, feature:agent-registry-service-thin, feature:policy-engine-service, feature:secret-broker-service, feature:cost-usage-service-complete, feature:artifact-service. Sources: model/services/model-compute/ModelRouterService.yaml, model/scenarios/ModelRouterService.yaml, docs/planes/model-compute/model-gateway.md, docs/planes/model-compute/workflows.md, docs/planes/model-compute/services/model-router-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a deployed instance behind ModelGatewayHost with an active profile and an Approved deployment whose provider value is the one the acceptance environment binds the scripted adapter to, when a workload resolves the route plan of a run through `ModelRouterService/ModelGateway.ResolveRoutePlan` and calls `ModelRouterService/ModelGateway.Invoke`, then the stream ends with a receipt that names the profile, the deployment that answered, the policy decision and the usage status, `ModelRouterService/ModelInvoked` is published once for the receipt, and `ModelRouterService/ListRunReceipts` returns that receipt for the run (ADR-0014, FR-04).",
        "AC2: Given the receipt of AC1 with reported usage and a second call whose provider reports none, when CostUsageService has handled `ModelRouterService/ModelInvoked` for both, then the first receipt appears as one usage record on each of the meters ModelInputTokens and ModelOutputTokens and the second as Uncertain without a quantity, the router published each event once and holds no pending receipt for a missing price (FR-09, XL-12, model/services/control-plane/CostUsageService.yaml).",
        "AC3: Given two tenants on the deployed instance, when a caller of one addresses a deployment, a profile that belongs to the other tenant and not to the platform tenant, or the receipts of a run of the other, then the REST answers are 404 and the gRPC answers NOT_FOUND, the same as for an identifier that does not exist, a caller without the scope or the role is answered 403 or PERMISSION_DENIED, and no state changes (ADR-0015).",
        "AC4: Given the chain test of the acceptance suite, when it runs against the deployed instance, then the chain of the description passes in one sequence: the profile loaded and active (SCN-ModelRouterService-013), the deployment registered (SCN-ModelRouterService-004), the evidence imported from a fixture publisher (SCN-ModelRouterService-016), the approval and its state change (SCN-ModelRouterService-006, SCN-ModelRouterService-015), the route plan (SCN-ModelRouterService-009, SCN-ModelRouterService-017), the invocation with its receipt (SCN-ModelRouterService-010, SCN-ModelRouterService-018), the usage on the two meters and the read (SCN-ModelRouterService-008); no captured log record, activity, metric or event of the chain holds a prompt, a completion or a provider key; the other scenarios of model/scenarios/ModelRouterService.yaml are proven by the suites of their PBIs and are not demanded here (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/scenarios/ModelRouterService.yaml",
        "docs/planes/model-compute/model-gateway.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2275",
        "AIFACTORY-TASK-767"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6001,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService",
          "ModelGatewayHost",
          "PolicyEngineService",
          "SecretBrokerService",
          "CostUsageService",
          "AgentRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "ModelRouterService/ModelProfile",
          "ModelRouterService/ModelDeployment",
          "ModelRouterService/RoutePlan",
          "ModelRouterService/InvocationReceipt"
        ],
        "apis": [
          "ModelRouterService/ModelGateway.ResolveRoutePlan",
          "ModelRouterService/ModelGateway.Invoke",
          "ModelRouterService/ListRunReceipts"
        ],
        "events": [
          "ModelRouterService/ModelInvoked"
        ],
        "descriptors": [
          "model-invocation-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04",
          "FR-09",
          "XL-12"
        ],
        "scenarios": [
          "SCN-ModelRouterService-004",
          "SCN-ModelRouterService-006",
          "SCN-ModelRouterService-008",
          "SCN-ModelRouterService-009",
          "SCN-ModelRouterService-010",
          "SCN-ModelRouterService-013",
          "SCN-ModelRouterService-015",
          "SCN-ModelRouterService-016",
          "SCN-ModelRouterService-017",
          "SCN-ModelRouterService-018"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-566",
        "AIFACTORY-US-567",
        "AIFACTORY-US-568",
        "AIFACTORY-US-569",
        "AIFACTORY-US-570",
        "AIFACTORY-US-571",
        "AIFACTORY-US-572",
        "AIFACTORY-US-573",
        "AIFACTORY-US-574",
        "AIFACTORY-US-575",
        "AIFACTORY-US-576",
        "AIFACTORY-US-577",
        "AIFACTORY-US-757",
        "AIFACTORY-US-901",
        "AIFACTORY-US-1508",
        "feature:model-gateway-host",
        "feature:agent-registry-service-thin",
        "feature:policy-engine-service",
        "feature:secret-broker-service",
        "feature:cost-usage-service-complete",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/scenarios/ModelRouterService.yaml",
        "docs/planes/model-compute/model-gateway.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-058]",
      "number": 58
    },
    {
      "id": "AIFACTORY-TASK-2275",
      "type": "task",
      "parent": "AIFACTORY-US-058",
      "title": "Deployment values of ModelRouterService: replica range, secret references, dependency addresses and the gateway as the only caller",
      "sequence": "03.02.01.01",
      "description": "Deployment values of ModelRouterService: replica range, secret references, dependency addresses and the gateway as the only caller. Expected output: The deployment manifest of the service states the replica range 2 to 12 of model/services/model-compute/ModelRouterService.yaml, the liveness and readiness probes, the messaging service name model-router, one base address per dependency (PolicyEngineService, CostUsageService, SecretBrokerService, AgentRegistryService, ArtifactService) from configuration, the two secret references provider-credentials and messaging-transport by name and never by value, and a network rule that admits inbound calls from ModelGatewayHost only (ADR-0028 decision 3); the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The deployment manifest of the service states the replica range 2 to 12 of model/services/model-compute/ModelRouterService.yaml, the liveness and readiness probes, the messaging service name model-router, one base address per dependency (PolicyEngineService, CostUsageService, SecretBrokerService, AgentRegistryService, ArtifactService) from configuration, the two secret references provider-credentials and messaging-transport by name and never by value, and a network rule that admits inbound calls from ModelGatewayHost only (ADR-0028 decision 3); the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6001,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2275]",
      "number": 2275
    },
    {
      "id": "AIFACTORY-TASK-767",
      "type": "task",
      "parent": "AIFACTORY-US-058",
      "title": "Verify model-router-service-serves-its-scope by running the declared command",
      "sequence": "03.02.01.02",
      "description": "Verify model-router-service-serves-its-scope by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance\"` against the deployed instance with ModelGatewayHost, the thin AgentRegistryService, PolicyEngineService, SecretBrokerService, CostUsageService and ArtifactService of the same environment and the scripted provider adapter bound in place of the adapter of one modelled provider value; a filter that matches no test counts as a failure; the chain profile, deployment, evidence by fixture, approval, route plan, invocation, receipt, usage on two meters and read passes, which exercises SCN-ModelRouterService-004, SCN-ModelRouterService-006, SCN-ModelRouterService-008, SCN-ModelRouterService-009, SCN-ModelRouterService-010, SCN-ModelRouterService-013, SCN-ModelRouterService-015, SCN-ModelRouterService-016, SCN-ModelRouterService-017 and SCN-ModelRouterService-018 and no other scenario, the two-tenant answers of AC3 hold, and the captured logs, activities, metrics and events of the chain are scanned and hold no content and no key, which proves AC1 to AC4 of AIFACTORY-US-058; the chain loads its profiles by alias from the eleven Draft model-profile releases the thin AgentRegistryService of the environment seeds (D121, D123).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance\"` against the deployed instance with ModelGatewayHost, the thin AgentRegistryService, PolicyEngineService, SecretBrokerService, CostUsageService and ArtifactService of the same environment and the scripted provider adapter bound in place of the adapter of one modelled provider value; a filter that matches no test counts as a failure; the chain profile, deployment, evidence by fixture, approval, route plan, invocation, receipt, usage on two meters and read passes, which exercises SCN-ModelRouterService-004, SCN-ModelRouterService-006, SCN-ModelRouterService-008, SCN-ModelRouterService-009, SCN-ModelRouterService-010, SCN-ModelRouterService-013, SCN-ModelRouterService-015, SCN-ModelRouterService-016, SCN-ModelRouterService-017 and SCN-ModelRouterService-018 and no other scenario, the two-tenant answers of AC3 hold, and the captured logs, activities, metrics and events of the chain are scanned and hold no content and no key, which proves AC1 to AC4 of AIFACTORY-US-058; the chain loads its profiles by alias from the eleven Draft model-profile releases the thin AgentRegistryService of the environment seeds (D121, D123)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-767]",
      "number": 767
    },
    {
      "id": "AIFACTORY-US-566",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "ModelRouterService repository: scaffolded from the base template with the Factory profile, with its four aggregates and the store model-router-sql",
      "sequence": "03.02.02",
      "description": "The repository ConnectSoft.AI.SoftwareFactory.ModelRouterService is created and scaffolded in I0 by AIFACTORY-TASK-047 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold, with the scaffold command of ADR-0028 and its amendment on the Factory profile switch (D114): `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ModelRouterService --UseFactoryProfile true`, from the template package at the version the gate of feature `component-base-template-factory-profile` published (AIFACTORY-US-230), after the findings of feature `component-base-template-findings` are closed (AIFACTORY-US-235). The generated output is committed unchanged and the repository records the version of the template package it was generated from. What the profile generates, that is the Orleans messaging profile with an outbox and an inbox of the service, the propagation of the trusted tenant and project scope, the role policies, the REST and gRPC hosts from a service descriptor, health and telemetry, is the work of the template feature; it is consumed by that version pin and is neither rewritten nor forked here. The run event envelope and the descriptor `model-invocation-v1` come from the contracts package by a version pin, and the provider adapters, the Anthropic adapter the first solution pack requires among them (D16), from the pinned `ConnectSoft.Extensions.AI` package of feature `component-extensions-ai`. On that scaffold this PBI adds the domain and the store. The `ModelProfile` is the runtime read model of a model-profile release: profile id, version, release, tenant, modality, required capabilities, privacy class, latency class, context and output limits, allowed regions, allowed deployments in preference order, fallback chain, fallback switch, embedding compatibility and price basis. Its invariants are those of the model: every entry of the fallback chain has the same or a stricter privacy class and the same tool and structured-output guarantees, and clients reference profiles, never provider model names. The `ModelDeployment` is one provider, model revision and endpoint in a region with its `CapabilityScore` entities, its license metadata, its health and its state. It has exactly eight transitions: Candidate to Evaluated (`CapabilityEvidenceRecorded`), Candidate to Approved and Evaluated to Approved (`PlatformAdminAttestation`, the approval by attestation of decision D121, allowed from both states since decision D123), Evaluated to Approved (`PlatformAdminApproval`), Approved to Degraded (`HealthProbeFailed`), Degraded to Approved (`HealthProbeRecovered`), and Approved or Degraded to Retired (`Retire`); it is routable only when Approved and healthy, is never Approved without recorded license metadata that permits the use, is approved through `PlatformAdminApproval` only with capability evidence that meets the thresholds of every profile that lists it and through `PlatformAdminAttestation` only with a stated reason, keeps the basis of its approval in `approvalBasis`, attestation or capability-suite, with `approvalReason` and `attestedBy` for an attestation, all three absent until it is Approved, and Retired is terminal. The `RoutePlan` holds the ordered candidates of one run and profile under one policy revision with the constraints every candidate satisfies; it is immutable, at most one exists per run and profile, and no candidate is added after resolution. The `InvocationReceipt` is the record of one model call: scope, run and attempt where the call has them, profile, the deployment that produced the output, route plan, fallback flag, request hash, idempotency key, policy decision, outcome, usage status, tokens, cost estimate, pricing revision, latency, output artifact reference and times. At most one exists per tenant, project and idempotency key, usage Unknown is recorded as such and never as zero, and it has no field for prompt or completion content. The store `model-router-sql` is owned by this service alone (ADR-0028 decision 5). This PBI migrates five of its six tables, `ModelProfiles`, `ModelDeployments`, `CapabilityScores`, `RoutePlans` and `InvocationReceipts`, with the keys and columns of the model, the three approval columns of `ModelDeployments` and the columns `ProjectId` and `Classification` of `RoutePlans` (decision D125) among them; the sixth table, `ProjectBudgetMarks`, is migrated with the budget mark it holds (AIFACTORY-US-1508). It also migrates the index over tenant, provider, region and state of deployments, the unique index over run and profile of route plans, the unique index over tenant, project and idempotency key of receipts and the indexes over run and attempt and over tenant and start. The primary keys of `ModelProfiles`, `ModelDeployments` and `CapabilityScores` include the tenant, so that a deployment id, or a profile id and version, of one tenant never collides with the same id of another tenant or of the platform tenant (decision D121). Every mapping carries the tenant row filter of the Factory profile; the filter of `ModelProfiles` also admits the rows of the platform tenant for reading, as the model defines for ConnectSoft profiles. The retention of receipts, one year by default and seven years for a receipt that audit evidence references, is recorded with the table; no deletion job and no deletion-order handler is built here, because those arrive with RetentionResidencyService in I4. Kind: enabling. Traces: services: ModelRouterService; aggregates: ModelRouterService/ModelProfile, ModelRouterService/ModelDeployment, ModelRouterService/RoutePlan, ModelRouterService/InvocationReceipt; descriptors: model-invocation-v1; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: NFR-03, NFR-13. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:component-extensions-ai. Sources: model/services/model-compute/ModelRouterService.yaml, model/template-parameters/connectsoft-base.yaml, model/stores.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/model-compute/services/model-router-service/index.md#domain-model, docs/reference/schemas/model-invocation.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-047 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ModelRouterService --UseFactoryProfile true` from the base template package at the version the gate of feature `component-base-template-factory-profile` published, when its pipeline runs, then the committed output equals the generated output, the solution builds in Release, the generated tests pass, a container image is published and the repository records the template version (ADR-0028, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given the `ModelRouterService/ModelDeployment`, `ModelRouterService/ModelProfile`, `ModelRouterService/RoutePlan` and `ModelRouterService/InvocationReceipt` aggregates, when their unit tests run, then the deployment accepts exactly the eight transitions of model/services/model-compute/ModelRouterService.yaml and refuses every other one, a transition out of Retired among them; an approval through `PlatformAdminApproval` without license metadata or with a capability score below a threshold is refused, an approval through `PlatformAdminAttestation` without a reason is refused, and an Approved deployment states the basis of its approval, attestation or capability-suite; a profile whose fallback chain names a weaker privacy class is refused; a second route plan for one run and profile, a candidate added to a resolved plan and a second receipt for one tenant, project and idempotency key are refused; and a receipt with unknown usage holds no token count and no zero.",
        "AC3: Given `model-router-sql` created by the migrations of the repository on an isolated test database, when the mapping tests run, then the five tables exist with their keys and indexes, the same `deploymentId` and the same profile id and version are stored for two tenants without a key violation, because the keys include the tenant, a second route plan for one run and profile and a second receipt for one tenant, project and idempotency key each violate their unique index, a query made for one tenant never returns a deployment, a route plan or a receipt of another, a profile of the platform tenant is readable for every tenant, and no table has a column for prompt, completion or tool output (ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/model-compute/services/model-router-service/index.md#domain-model",
        "docs/reference/schemas/model-invocation.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-048",
        "AIFACTORY-TASK-049",
        "AIFACTORY-TASK-2276"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6002,
      "kind": "enabling",
      "traces": {
        "services": [
          "ModelRouterService"
        ],
        "aggregates": [
          "ModelRouterService/ModelProfile",
          "ModelRouterService/ModelDeployment",
          "ModelRouterService/RoutePlan",
          "ModelRouterService/InvocationReceipt"
        ],
        "descriptors": [
          "model-invocation-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-03",
          "NFR-13"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/model-compute/services/model-router-service/index.md#domain-model",
        "docs/reference/schemas/model-invocation.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-566]",
      "number": 566
    },
    {
      "id": "AIFACTORY-TASK-048",
      "type": "task",
      "parent": "AIFACTORY-US-566",
      "title": "Domain model: ModelProfile, ModelDeployment with CapabilityScore, RoutePlan, InvocationReceipt",
      "sequence": "03.02.02.01",
      "description": "Domain model: ModelProfile, ModelDeployment with CapabilityScore, RoutePlan, InvocationReceipt. Expected output: The four aggregates and the CapabilityScore entity enforce the invariants of the model as it words them; the ModelDeployment accepts only CapabilityEvidenceRecorded and PlatformAdminAttestation out of Candidate, PlatformAdminApproval and PlatformAdminAttestation out of Evaluated (D123), HealthProbeFailed and Retire out of Approved and HealthProbeRecovered and Retire out of Degraded, and records the approval basis capability-suite with PlatformAdminApproval and the basis attestation, the reason and the attesting subject with PlatformAdminAttestation (D121); the RoutePlan is immutable after creation; the InvocationReceipt keeps usage Unknown without a number; unit tests cover every invariant, each of the eight transitions and the refusal of every other one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The four aggregates and the CapabilityScore entity enforce the invariants of the model as it words them; the ModelDeployment accepts only CapabilityEvidenceRecorded and PlatformAdminAttestation out of Candidate, PlatformAdminApproval and PlatformAdminAttestation out of Evaluated (D123), HealthProbeFailed and Retire out of Approved and HealthProbeRecovered and Retire out of Degraded, and records the approval basis capability-suite with PlatformAdminApproval and the basis attestation, the reason and the attesting subject with PlatformAdminAttestation (D121); the RoutePlan is immutable after creation; the InvocationReceipt keeps usage Unknown without a number; unit tests cover every invariant, each of the eight transitions and the refusal of every other one."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-048]",
      "number": 48
    },
    {
      "id": "AIFACTORY-TASK-049",
      "type": "task",
      "parent": "AIFACTORY-US-566",
      "title": "Persistence in model-router-sql: ModelProfiles, ModelDeployments, CapabilityScores, RoutePlans, InvocationReceipts",
      "sequence": "03.02.02.02",
      "description": "Persistence in model-router-sql: ModelProfiles, ModelDeployments, CapabilityScores, RoutePlans, InvocationReceipts. Expected output: Mappings and migrations for the five tables with the columns the model lists, the columns ApprovalBasis, ApprovalReason and AttestedBy of ModelDeployments and the columns ProjectId and Classification of RoutePlans (D125) among them, the tenant as part of the primary keys of ModelProfiles, ModelDeployments and CapabilityScores (D121), the index IX_Deployments_Provider_Region, the unique indexes UX_RoutePlans_Run_Profile and UX_Receipts_Scope_Idempotency, the indexes IX_Receipts_Run and IX_Receipts_Tenant_StartedAt, the row version of ModelDeployments and the tenant filter in every mapping, the filter of ModelProfiles admitting the platform tenant for reading; the retention of InvocationReceipts is recorded as table metadata; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the five tables with the columns the model lists, the columns ApprovalBasis, ApprovalReason and AttestedBy of ModelDeployments and the columns ProjectId and Classification of RoutePlans (D125) among them, the tenant as part of the primary keys of ModelProfiles, ModelDeployments and CapabilityScores (D121), the index IX_Deployments_Provider_Region, the unique indexes UX_RoutePlans_Run_Profile and UX_Receipts_Scope_Idempotency, the indexes IX_Receipts_Run and IX_Receipts_Tenant_StartedAt, the row version of ModelDeployments and the tenant filter in every mapping, the filter of ModelProfiles admitting the platform tenant for reading; the retention of InvocationReceipts is recorded as table metadata; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6002,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-049]",
      "number": 49
    },
    {
      "id": "AIFACTORY-TASK-2276",
      "type": "task",
      "parent": "AIFACTORY-US-566",
      "title": "Verify the scaffold, the aggregates and the store of ModelRouterService",
      "sequence": "03.02.02.03",
      "description": "Verify the scaffold, the aggregates and the store of ModelRouterService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the four aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-566 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the four aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-566 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2276]",
      "number": 2276
    },
    {
      "id": "AIFACTORY-US-567",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "ModelRouterService host: ten REST routes and four gRPC methods behind scope policies, the model-router messaging profile with nine subscriptions and the three hosted workers",
      "sequence": "03.02.03",
      "description": "This PBI turns the scaffold of AIFACTORY-US-566 into a host on which the behaviour PBIs of the feature land. From the service descriptor the host exposes the ten REST operations of the model, `AttestDeployment` of decision D121 and `ListProjectReceipts` of decision D123 among them, for its platform gateway and the internal gRPC service `ModelGateway` with the methods `ResolveRoutePlan`, `Invoke` as a server stream, `Embed` and `Rerank`, with their contract documents, an OpenAPI document and a proto. A user token reaches the service forwarded by ModelGatewayHost: the service validates it again through the resource-server library the profile wires and accepts the audience of its own gateway (ADR-0015 amendment D117). Each route requires its scope: `factory.models.read` for `ListModelProfiles`, `GetModelProfile`, `PreviewRoutePlan` and `ListProjectReceipts`, `factory.models.admin` for the five deployment operations, `factory.runs.read` for `ListRunReceipts`. The role policies narrow the admin scope as the model words it: `ListModelDeployments` admits a Platform admin and an Observer, and `RegisterDeployment`, `EvaluateDeployment`, `ApproveDeployment` and `AttestDeployment` admit a Platform admin only, since an Observer issues no command. The tenant of a user call comes from the token. The gRPC methods require a workload identity whose token holds the service scope that names ModelRouterService; the model names AgentRuntimeService as the caller of `ResolveRoutePlan` and `Invoke` and the Knowledge services as callers of `Embed` and `Rerank`, and a method admits a workload by that scope. `Invoke` has a second caller since decision D121: ModelGatewayHost calls it for a call of its OpenAI-compatible route with the user token of the caller forwarded unchanged, and the method admits such a user token when its audience is the gateway of the service and its scope carries `factory.models.invoke`, the fourth scope of the model, for a call outside a run. A run-bound call of that route presents the token of an attempt, which the gateway forwards in place of a user token and which names run, step and attempt in its claims; the method admits it (decision D125). The tenant of either call comes from the token; the project of a run-bound call comes from the route plan of its run and the project of a call outside a run is the one the caller named and the gateway checked (AIFACTORY-US-574, decisions D123 and D125). `ResolveRoutePlan`, `Embed` and `Rerank` admit neither a user token nor the token of an attempt. A workload token carries no tenant claim, and the service reads the tenant and project a workload forwards only because the token holds that service scope (ADR-0015 amendment D114). A resource of another tenant is invisible under the tenant row filter and is answered 404, over gRPC NOT_FOUND, while a missing scope or role inside the tenant of the caller is answered 403, over gRPC PERMISSION_DENIED (D113); the filter is wired here and the answers are proven by the behaviour PBIs. Every modelled refusal code has a problem response, and `RegisterDeployment` and `EvaluateDeployment` run behind the `Idempotency-Key` filter. The messaging profile of the service is named `model-router`: the outbox writer enlists in the unit of work of a command, and the dispatcher publishes the seven events of the model in the run event envelope of the contracts package with their routes declared in the `OrleansMessaging` section. The inbox subscribes, with deduplication on the event id, to `AssetReleasePublished`, `AssetReleaseDeprecated` and `AssetReleaseRevoked` of AgentRegistryService, `EvaluationCompleted` of QualityScoreService, `SecretRotated` and `SecretReferenceRevoked` of SecretBrokerService, `ClassificationChanged` of AuditService, and `BudgetExceeded` and `BudgetUpdated` of CostUsageService (decision D125); what the first six handlers do is delivered by AIFACTORY-US-568, AIFACTORY-US-569, AIFACTORY-US-571 and AIFACTORY-US-572, and the handlers `MarkProjectBudgetExceeded` and `ClearProjectBudgetMark` of the two budget events by AIFACTORY-US-1508. The seventh is delivered here. AuditService is delivered complete in this increment (feature `audit-service-complete`) and lists ModelRouterService as a consumer of `ClassificationChanged`, so the subscription is registered and the handler `ApplyClassification` is built with the least effect the model words, that routing which follows uses the changed label: idempotent on the event id, it drops every cached decision and every classification-dependent routing datum the service holds for the tenant of the event in its cache store, so that the next resolution or invocation asks PolicyEngineService for its decision again with the classification the caller sends, and it logs the label id, the resource type and the data class. It changes no stored route plan, which is immutable for its run, no deployment and no profile, and publishes nothing. This delivery caches no decision, so the handler has nothing else to drop; what else a changed label has to change in the router, given that the payload names a resource and no profile, is reported to the owner. The three workers of the model are hosted with their triggers and limits: `DeploymentHealthProbe` every two minutes, two attempts 15 seconds apart, four in parallel partitioned by provider, keyed by deployment and probe window; `ReceiptReconciler` at minute 30 of every hour, five attempts with exponential backoff from 60 seconds, two in parallel partitioned by tenant, keyed by invocation and statement reference; `CapabilityEvidenceImporter` on `EvaluationCompleted`, five attempts with exponential backoff from 30 seconds, two in parallel partitioned by tenant, keyed by deployment, suite version and evidence reference. A duplicate trigger has no second effect. The seven options of the model are bound and validated at start: `ModelAccess:Routing:FallbackEnabledByDefault`, `ModelAccess:Routing:Weights`, `ModelAccess:Invocation:DefaultTimeoutSeconds`, `ModelAccess:Invocation:PromptCaching`, `ModelAccess:Privacy:LogContent`, `ModelGateway:Adapters:Enabled` and `OrleansMessaging:ServiceName`. The chat and embedding adapters the list names are loaded at start from the pinned AI library. The values of the option, which are also the provider values of a `ModelDeployment`, are not the keyed registration names of the library: the modelled default names `openai`, `azure-openai`, `azure-ai-inference`, `ollama` and `anthropic`, and the library registers its keyed clients as `openAI`, `azureOpenAI`, `azureAIInference` and `ollama` (docs/planes/model-compute/providers-and-profiles.md). The service therefore holds one mapping from each option value to the keyed registration name of the pinned library, `openai` to `openAI`, `azure-openai` to `azureOpenAI`, `azure-ai-inference` to `azureAIInference`, `ollama` to `ollama` and `anthropic` to the key under which feature `component-extensions-ai` registers the Anthropic adapter, so the modelled default starts. A value without a mapping, or a mapped key the library does not register, stops the start with the value named, and a start with `ModelAccess:Privacy:LogContent` true in the Production environment is refused. The naming difference between the option values and the registration names is reported to the owner. The four reloadable options, `ModelAccess:Routing:FallbackEnabledByDefault`, `ModelAccess:Routing:Weights`, `ModelAccess:Invocation:DefaultTimeoutSeconds` and `ModelAccess:Invocation:PromptCaching`, take a changed value without a restart: it applies to calls and resolutions that start later and never to a resolved route plan or to a call in flight. Readiness reports the store, the messaging profile and the loaded adapters; the health detail names PolicyEngineService, CostUsageService, SecretBrokerService and ArtifactService and the health of each provider adapter, and a call that needs a required dependency that does not answer fails fast. The delivery states its limits. The handlers of `ResidencyRuleChanged` and `DeletionOrderIssued` are not part of it: RetentionResidencyService is first delivered in I4 by feature `retention-residency-service`, and the deletion-order handler `ExecuteDeletionOrder` is built and proven there with it (D119). Neither are the handlers of `ComputePoolStateChanged`, `ModelWarmed` and `ModelEvicted` of ComputePoolService, which arrives in I8 with feature `compute-pool-service`. These five events are not subscribed in this delivery. No PBI of the backlog builds the router handlers `ApplyResidencyRule` and `UpdateDeploymentAvailability` yet: the two later features deliver the publishers, the handlers live in this repository, and which feature takes them is reported to the owner. Kind: enabling. Traces: services: ModelRouterService, AuditService; aggregates: ModelRouterService/ModelDeployment; events: AuditService/ClassificationChanged; descriptors: run-event-envelope-v1, model-invocation-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: NFR-07, NFR-13. Depends on: AIFACTORY-US-566, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-extensions-ai, feature:audit-service-complete. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/governance/AuditService.yaml, docs/planes/model-compute/providers-and-profiles.md, model/gateways.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/model-compute/services/model-router-service/index.md#apis, docs/planes/model-compute/services/model-router-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given the hosted service, when each of the ten REST operations of model/services/model-compute/ModelRouterService.yaml is called without a token and with a token that lacks the scope of the route, then the answers are 401 and 403 with a problem response; when a command of the deployment operations is called by an Observer who holds `factory.models.admin`, then the answer is 403; a gRPC call without a token is refused with UNAUTHENTICATED and one whose workload token lacks the service scope with PERMISSION_DENIED; a user token is refused with PERMISSION_DENIED on every gRPC method except `ModelGateway.Invoke`, which admits it only with `factory.models.invoke`, and the token of an attempt is admitted by `ModelGateway.Invoke` alone; a user token whose audience is not the gateway of the service is refused with 401; no state changes (ADR-0015).",
        "AC2: Given a handler that changes a `ModelRouterService/ModelDeployment` and publishes one of the seven declared events, when its unit of work commits, then one outbox record in `run-event-envelope-v1` with event id, tenant id, project id and run id where the event has them, correlation id and payload is committed in the same transaction; when the unit of work rolls back, neither the change nor the record exists; a publish of an event the `OrleansMessaging` section does not declare throws (ADR-0012, ADR-0014).",
        "AC3: Given the same event id delivered twice to the inbox of the `model-router` messaging profile, or the same trigger of a hosted worker fired twice under one idempotency key, when it is dispatched, then the handler or the worker runs once and the second delivery has no effect; a handler that keeps failing is retried with backoff and never applied twice; given a fixture publisher of `AuditService/ClassificationChanged`, when the event is delivered, the same event id twice, then the `ApplyClassification` handler runs once, drops the classification-dependent routing data the service caches for the tenant of the event, changes no stored route plan, no deployment and no profile, publishes nothing, and the next resolution asks PolicyEngineService for its decision again; an event the delivery does not subscribe to reaches no handler (ADR-0012).",
        "AC4: Given the service starts, when liveness and readiness are probed, then readiness answers ready only after `model-router-sql` is migrated, the messaging profile has started and every adapter of `ModelGateway:Adapters:Enabled` is loaded, and it names what is missing while it is unready; the seven options of model/services/model-compute/ModelRouterService.yaml are bound; the modelled default of `ModelGateway:Adapters:Enabled` starts, because each of its values is mapped to the keyed registration name of the pinned AI library; a value without a mapping, a mapped key the library does not register, or `ModelAccess:Privacy:LogContent` true in the Production environment stops the start with the value or the key named; a reloaded value of one of the four reloadable options applies to later calls and resolutions and never to a resolved route plan or a call in flight; and traces and logs carry the tenant, project and run scope of the call (ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/planes/model-compute/providers-and-profiles.md",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/model-compute/services/model-router-service/index.md#apis",
        "docs/planes/model-compute/services/model-router-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-050",
        "AIFACTORY-TASK-051",
        "AIFACTORY-TASK-052",
        "AIFACTORY-TASK-2277"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6003,
      "kind": "enabling",
      "traces": {
        "services": [
          "ModelRouterService",
          "AuditService"
        ],
        "aggregates": [
          "ModelRouterService/ModelDeployment"
        ],
        "events": [
          "AuditService/ClassificationChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "model-invocation-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-07",
          "NFR-13"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-566",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-extensions-ai",
        "feature:audit-service-complete"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/planes/model-compute/providers-and-profiles.md",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/model-compute/services/model-router-service/index.md#apis",
        "docs/planes/model-compute/services/model-router-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-567]",
      "number": 567
    },
    {
      "id": "AIFACTORY-TASK-050",
      "type": "task",
      "parent": "AIFACTORY-US-567",
      "title": "API hosting skeleton: REST and gRPC hosts, scope and role policies, problem responses and contract documents for the 10 REST operations and 4 gRPC methods",
      "sequence": "03.02.03.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope and role policies, problem responses and contract documents for the 10 REST operations and 4 gRPC methods. Expected output: The ten REST routes, ListProjectReceipts of decision D123 among them, and the gRPC methods ModelGateway.ResolveRoutePlan, ModelGateway.Invoke as a server stream, ModelGateway.Embed and ModelGateway.Rerank are hosted from the service descriptor with token validation that accepts the audience of ModelGatewayHost, scope enforcement per route, the role policies of the deployment operations, AttestDeployment among them, the workload identity and service scope check per gRPC method, the admission of a forwarded user token with factory.models.invoke and of the forwarded token of an attempt on ModelGateway.Invoke alone (D121, D125), problem responses for every modelled refusal code, the Idempotency-Key filter of RegisterDeployment and EvaluateDeployment, and the OpenAPI and proto documents; one mapping turns each value of ModelGateway:Adapters:Enabled, which is also a provider value of ModelDeployment, into the keyed registration name of the pinned AI library (openai to openAI, azure-openai to azureOpenAI, azure-ai-inference to azureAIInference, ollama to ollama, anthropic to the key of the Anthropic adapter of feature component-extensions-ai), the modelled default starts, and a value without a mapping or a key the library does not register stops the start with the value named; the four reloadable options are read through a monitor so that a changed value applies to later calls and never to a resolved plan; the proto messages are fixed by the contract task AIFACTORY-TASK-2293, and the behaviour of each operation is delivered by AIFACTORY-US-569 to AIFACTORY-US-577 and AIFACTORY-US-901, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The ten REST routes, ListProjectReceipts of decision D123 among them, and the gRPC methods ModelGateway.ResolveRoutePlan, ModelGateway.Invoke as a server stream, ModelGateway.Embed and ModelGateway.Rerank are hosted from the service descriptor with token validation that accepts the audience of ModelGatewayHost, scope enforcement per route, the role policies of the deployment operations, AttestDeployment among them, the workload identity and service scope check per gRPC method, the admission of a forwarded user token with factory.models.invoke and of the forwarded token of an attempt on ModelGateway.Invoke alone (D121, D125), problem responses for every modelled refusal code, the Idempotency-Key filter of RegisterDeployment and EvaluateDeployment, and the OpenAPI and proto documents; one mapping turns each value of ModelGateway:Adapters:Enabled, which is also a provider value of ModelDeployment, into the keyed registration name of the pinned AI library (openai to openAI, azure-openai to azureOpenAI, azure-ai-inference to azureAIInference, ollama to ollama, anthropic to the key of the Anthropic adapter of feature component-extensions-ai), the modelled default starts, and a value without a mapping or a key the library does not register stops the start with the value named; the four reloadable options are read through a monitor so that a changed value applies to later calls and never to a resolved plan; the proto messages are fixed by the contract task AIFACTORY-TASK-2293, and the behaviour of each operation is delivered by AIFACTORY-US-569 to AIFACTORY-US-577 and AIFACTORY-US-901, not here."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-050]",
      "number": 50
    },
    {
      "id": "AIFACTORY-TASK-051",
      "type": "task",
      "parent": "AIFACTORY-US-567",
      "title": "Messaging skeleton: outbox and inbox wiring of the model-router profile for 7 published and 9 consumed events, with the ApplyClassification handler",
      "sequence": "03.02.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the model-router profile for 7 published and 9 consumed events, with the ApplyClassification handler. Expected output: The outbox writer enlists in the unit of work and the dispatcher of the model-router messaging profile publishes ModelProfileActivated, ModelProfileRetired, DeploymentStateChanged, CapabilityEvidenceRecorded, RoutePlanResolved, ModelInvoked and ModelFallbackUsed in the run event envelope of the pinned contracts package, each declared with its route in the OrleansMessaging section; the inbox registers AssetReleasePublished, AssetReleaseDeprecated, AssetReleaseRevoked, EvaluationCompleted, SecretRotated, SecretReferenceRevoked, ClassificationChanged of AuditService, and BudgetExceeded and BudgetUpdated of CostUsageService (D125) with idempotency on the event id; the handler ApplyClassification drops the cached decisions and the classification-dependent routing data of the tenant of the event from the cache store, logs the label id, the resource type and the data class, and changes no route plan, deployment or profile; ResidencyRuleChanged, DeletionOrderIssued, ComputePoolStateChanged, ModelWarmed and ModelEvicted are not subscribed in this delivery; what the eight other handlers do is delivered by the behaviour PBIs of this feature, the two budget handlers by AIFACTORY-US-1508.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work and the dispatcher of the model-router messaging profile publishes ModelProfileActivated, ModelProfileRetired, DeploymentStateChanged, CapabilityEvidenceRecorded, RoutePlanResolved, ModelInvoked and ModelFallbackUsed in the run event envelope of the pinned contracts package, each declared with its route in the OrleansMessaging section; the inbox registers AssetReleasePublished, AssetReleaseDeprecated, AssetReleaseRevoked, EvaluationCompleted, SecretRotated, SecretReferenceRevoked, ClassificationChanged of AuditService, and BudgetExceeded and BudgetUpdated of CostUsageService (D125) with idempotency on the event id; the handler ApplyClassification drops the cached decisions and the classification-dependent routing data of the tenant of the event from the cache store, logs the label id, the resource type and the data class, and changes no route plan, deployment or profile; ResidencyRuleChanged, DeletionOrderIssued, ComputePoolStateChanged, ModelWarmed and ModelEvicted are not subscribed in this delivery; what the eight other handlers do is delivered by the behaviour PBIs of this feature, the two budget handlers by AIFACTORY-US-1508."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-051]",
      "number": 51
    },
    {
      "id": "AIFACTORY-TASK-052",
      "type": "task",
      "parent": "AIFACTORY-US-567",
      "title": "Worker hosting skeleton: schedules, partitioning and retry policies of DeploymentHealthProbe, ReceiptReconciler and CapabilityEvidenceImporter",
      "sequence": "03.02.03.03",
      "description": "Worker hosting skeleton: schedules, partitioning and retry policies of DeploymentHealthProbe, ReceiptReconciler and CapabilityEvidenceImporter. Expected output: The three workers are hosted with their modelled triggers (every two minutes, minute 30 of every hour, the event EvaluationCompleted), retry policies (fixed 2 attempts 15 seconds apart, exponential 5 attempts from 60 seconds, exponential 5 attempts from 30 seconds), partitioning by provider or tenant with the modelled parallelism, and idempotency keys, and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-571, AIFACTORY-US-572 and AIFACTORY-US-577.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three workers are hosted with their modelled triggers (every two minutes, minute 30 of every hour, the event EvaluationCompleted), retry policies (fixed 2 attempts 15 seconds apart, exponential 5 attempts from 60 seconds, exponential 5 attempts from 30 seconds), partitioning by provider or tenant with the modelled parallelism, and idempotency keys, and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-571, AIFACTORY-US-572 and AIFACTORY-US-577."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-052]",
      "number": 52
    },
    {
      "id": "AIFACTORY-TASK-2277",
      "type": "task",
      "parent": "AIFACTORY-US-567",
      "title": "Verify the hosted surface of ModelRouterService with a two-tenant fixture",
      "sequence": "03.02.03.04",
      "description": "Verify the hosted surface of ModelRouterService with a two-tenant fixture. Expected output: Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every route without a token, without its scope and with a token of another audience, call the deployment commands as an Observer, call the four gRPC methods with and without the service scope and with a user token with and without factory.models.invoke, commit and roll back a publishing handler, deliver one event id twice, deliver ClassificationChanged from a fixture publisher twice and assert one run of ApplyClassification and no changed route plan, fire one worker trigger twice, start with the modelled default of ModelGateway:Adapters:Enabled, with a value that has no mapping and with a key the library does not register, change a reloadable option while a route plan is resolved and a call is in flight, and probe readiness with the store stopped, which proves AC1 to AC4 of AIFACTORY-US-567 (ADR-0015, ADR-0012).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build --filter \"Category=Acceptance&Area=Hosting\"`; a filter that matches no test counts as a failure; the tests call every route without a token, without its scope and with a token of another audience, call the deployment commands as an Observer, call the four gRPC methods with and without the service scope and with a user token with and without factory.models.invoke, commit and roll back a publishing handler, deliver one event id twice, deliver ClassificationChanged from a fixture publisher twice and assert one run of ApplyClassification and no changed route plan, fire one worker trigger twice, start with the modelled default of ModelGateway:Adapters:Enabled, with a value that has no mapping and with a key the library does not register, change a reloadable option while a route plan is resolved and a call is in flight, and probe readiness with the store stopped, which proves AC1 to AC4 of AIFACTORY-US-567 (ADR-0015, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2277]",
      "number": 2277
    },
    {
      "id": "AIFACTORY-US-568",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "ModelRouterService starts only with its secret references, keeps provider keys and content out of every log, event and metric, and filters every query by tenant",
      "sequence": "03.02.04",
      "description": "As a platform admin, I want the one service that holds provider credentials to prove that it never starts without its secret references and never writes a key or a prompt anywhere, so that credential isolation and content privacy of the model gateway are a tested fact and not an intention. ModelRouterService is the only service that calls model providers, so it is the only place where a provider credential exists (ADR-0028 decision 3, and decision 7 places secrets with the service that owns the behaviour). The readiness epic left the proof of that to this feature: the local start page of feature `local-development-environment` states that the start of this service without its secret reference fails with the name of the missing reference and that the failing start is recorded when the feature that delivers the service runs the steps. This PBI delivers the rule and records the proof. The model lists two secrets of the service, `provider-credentials` and `messaging-transport`, both in the key vault with a rotation of 90 days. The service reads them through secret references only: configuration names the reference and never a value, a start without a declared reference or with a reference that does not resolve stops with the name of the missing reference, and no file of the repository, no deployment manifest and no page holds a key value. What the secret `provider-credentials` holds once every provider call runs on a brokered credential the model does not say. This delivery checks at start that both references resolve, as the start rule demands, reads the value of `provider-credentials` at no other time and passes it to no adapter; whether it is the vault entry the references of the broker point to, in which case the router should hold no reference to it, is reported to the owner. The rule for the brokered credential is one, and AIFACTORY-US-572 and AIFACTORY-US-574 follow it: one credential per invocation and one per probe. Each is a short-lived, scoped credential issued by `SecretBrokerService/SecretBroker.Issue` for the purpose `model-invoke` under the policy decision of that call; it lives in memory for that one call, is passed to the adapter call alone and is kept for no later invocation, because an issuance of the broker outlives neither its invocation nor its lease. It is never written to `model-router-sql`, to the outbox, to a receipt, to an event, to a log record, to an activity or to a metric. A redaction guard of the logging pipeline masks any value issued by the broker or resolved from a reference, and a test scans everything the service emitted for the fixture key. Because no credential is kept across invocations, the inbox handler `RefreshProviderCredential` of `SecretBrokerService/SecretRotated` has no credential to drop. It invalidates the adapter client instances and the reference metadata the service caches for the deployments whose `endpointRef` resolves to the rotated reference, so the following invocations build their client anew and run on the credential the broker issues from the new vault version, as every invocation asks the broker; an invocation in flight ends on the credential it holds or fails as the provider answers. The handler is idempotent on the event id and changes no deployment. The caller workload identity, the delegated scope of a user and the provider credential are three different things and are never merged. Tenancy is enforced in the service and not only at the gateway: every query of the five tables runs under the tenant row filter, the tenant of a user call comes from the token, the tenant and project of a workload call are read only under the service scope, a resource of another tenant is answered 404 or NOT_FOUND and a missing scope or role 403 or PERMISSION_DENIED (ADR-0015 amendments D113 and D114). Telemetry follows the Factory conventions of feature `component-observability-factory-conventions` (ADR-0019): the eight metrics of the model are registered with their dimensions through the helper of the pinned observability libraries, which puts tenant and project on every instrument by default; run, step and attempt are on activities and log records and never on a metric; an activity of a model call carries the generative AI attributes with `model.profile`, `model.deployment`, `route_plan.id`, `receipt.id`, `policy.decision.id` and `fallback.used`, as docs/planes/model-compute/observability.md lists them, and has one child activity per adapter call. No prompt, completion or tool output reaches a log record, an activity, a metric or an event by default: the content guard of the observability libraries refuses it and carries the request hash or the artifact reference in its place, and `ModelAccess:Privacy:LogContent`, which is not reloadable, is false in every deployed environment. The model gives the service two objectives under `nfr.objectives`, and the observability page adds two; this PBI delivers the series each is measured on and claims no value, because a value exists only once the system is deployed. The objective `model-access-overhead`, 150 ms at p95 for gateway and router without provider time, is measured on the duration of the invocation activity minus the duration of its adapter activities, recorded as an attribute of the invocation activity; the gateway adds its own duration histogram (feature `model-gateway-host`). The objective `receipt-coverage`, a receipt for 100 percent of the invocations that reached an adapter, is measured as the invocations whose adapter activity started against the receipts written for them, the second taken from `connectsoft.factory.model_gateway.invocations` without the outcome Denied. The reconciliation of Unknown receipts within 24 hours is measured on the age of the oldest receipt with usage Unknown, which the `ReceiptReconciler` records at every run beside `connectsoft.factory.model_gateway.usage_unknown`. The detection of provider health within 2 minutes rests on the probe interval of two minutes and is read from the changes of `connectsoft.factory.model_gateway.provider_health` and the time of `DeploymentStateChanged`. The model lists no instrument for the overhead and for the age of the oldest Unknown receipt, which is reported to the owner. Kind: enabling. Traces: services: ModelRouterService, SecretBrokerService; apis: SecretBrokerService/SecretBroker.Issue; events: SecretBrokerService/SecretRotated; adrs: ADR-0012, ADR-0015, ADR-0019, ADR-0028; requirements: NFR-03, NFR-12. Depends on: AIFACTORY-US-567, feature:secret-broker-service, feature:component-observability-factory-conventions, feature:local-development-environment. Sources: model/services/model-compute/ModelRouterService.yaml, docs/planes/model-compute/security.md, docs/planes/model-compute/observability.md, docs/architecture/adr/0019-data-governance.md, docs/planes/model-compute/services/model-router-service/index.md#security, docs/planes/model-compute/services/model-router-service/index.md#metrics-and-observability.",
      "acceptanceCriteria": [
        "AC1: Given the configuration of the service without the secret reference `provider-credentials`, or without `messaging-transport`, or with a reference that does not resolve, when the service starts, then the start stops with an error that names the missing reference and holds no value; given both references resolved from the secret store, when it starts, then it becomes ready; the failing and the passing start are recorded in the repository as the proof the local start steps ask for (ADR-0028, model/services/model-compute/ModelRouterService.yaml).",
        "AC2: Given invocations that ran with a fixture credential issued by `SecretBrokerService/SecretBroker.Issue`, among them a failing provider call and a start with debug logging, when every log record, activity, metric, outbox record and stored row the service produced is scanned, then the fixture key appears in none of them, and no file of the repository or of the deployment manifest holds a key value (ADR-0019, ADR-0028).",
        "AC3: Given invocations of a deployment, each of which ran on its own credential from `SecretBrokerService/SecretBroker.Issue` and kept none after the call, and `SecretBrokerService/SecretRotated` for the reference of the deployment, when the `RefreshProviderCredential` handler runs, then the adapter client instances and the cached reference metadata of that reference are invalidated, the next invocation builds its client anew and asks `SecretBrokerService/SecretBroker.Issue` as every invocation does, no deployment changes state and a redelivery of the same event id has no second effect; the reference `provider-credentials` is resolved at start only and its value reaches no adapter (ADR-0012).",
        "AC4: Given model calls of two tenants, when the metrics, activities and log records are read, then every instrument of model/services/model-compute/ModelRouterService.yaml carries its modelled dimensions with tenant and project, run, step and attempt appear on activities and log records only, an activity of a model call carries profile, deployment, route plan id, receipt id, policy decision id and the fallback flag, and no prompt, completion or tool output is present anywhere, the request hash or the artifact reference standing in its place; the series of the objectives of model/services/model-compute/ModelRouterService.yaml and of docs/planes/model-compute/observability.md exist, that is the access overhead as the duration of the invocation activity minus its adapter activities, receipt coverage as adapter calls started against receipts written, the age of the oldest receipt with usage Unknown beside `connectsoft.factory.model_gateway.usage_unknown`, and the probe interval of two minutes for the detection of provider health, and no value of an objective is claimed before the system is deployed (ADR-0019).",
        "AC5: Given rows of two tenants in each of the five tables, when every repository query of the service is run for one tenant, then no row of the other tenant is returned, a workload call without the service scope never sets a tenant, and the answers for a resource of another tenant are 404 and NOT_FOUND (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/security.md",
        "docs/planes/model-compute/observability.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/model-compute/services/model-router-service/index.md#security",
        "docs/planes/model-compute/services/model-router-service/index.md#metrics-and-observability"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-053",
        "AIFACTORY-TASK-2278",
        "AIFACTORY-TASK-2279"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6004,
      "kind": "enabling",
      "traces": {
        "services": [
          "ModelRouterService",
          "SecretBrokerService"
        ],
        "apis": [
          "SecretBrokerService/SecretBroker.Issue"
        ],
        "events": [
          "SecretBrokerService/SecretRotated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-03",
          "NFR-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-567",
        "feature:secret-broker-service",
        "feature:component-observability-factory-conventions",
        "feature:local-development-environment"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/security.md",
        "docs/planes/model-compute/observability.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/model-compute/services/model-router-service/index.md#security",
        "docs/planes/model-compute/services/model-router-service/index.md#metrics-and-observability"
      ],
      "titlePrefix": "[AIFACTORY-US-568]",
      "number": 568
    },
    {
      "id": "AIFACTORY-TASK-053",
      "type": "task",
      "parent": "AIFACTORY-US-568",
      "title": "Security, tenancy and telemetry of ModelRouterService",
      "sequence": "03.02.04.01",
      "description": "Security, tenancy and telemetry of ModelRouterService. Expected output: The four scopes and the role policies of the model are enforced, every query of the five tables is tenant-filtered, the tenant and project of a workload call are read only under the service scope, the eight metrics of the model are registered with their dimensions through the helper of the pinned observability libraries with tenant and project by default, run, step and attempt are on activities and log records, an activity of a model call carries model.profile, model.deployment, route_plan.id, receipt.id, policy.decision.id and fallback.used and has one child activity per adapter call, and the content guard keeps prompt, completion and tool output out of logs, activities, metrics and events; the series of the four objectives are in place: the overhead of an invocation as its activity duration minus the duration of its adapter activities, recorded as an attribute of the invocation activity (objective model-access-overhead of model/services/model-compute/ModelRouterService.yaml), the adapter activities started against the receipts written (objective receipt-coverage), the age of the oldest receipt with usage Unknown recorded by the ReceiptReconciler at every run beside connectsoft.factory.model_gateway.usage_unknown, and the probe interval of two minutes read from connectsoft.factory.model_gateway.provider_health; no value of an objective is claimed before the system is deployed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The four scopes and the role policies of the model are enforced, every query of the five tables is tenant-filtered, the tenant and project of a workload call are read only under the service scope, the eight metrics of the model are registered with their dimensions through the helper of the pinned observability libraries with tenant and project by default, run, step and attempt are on activities and log records, an activity of a model call carries model.profile, model.deployment, route_plan.id, receipt.id, policy.decision.id and fallback.used and has one child activity per adapter call, and the content guard keeps prompt, completion and tool output out of logs, activities, metrics and events; the series of the four objectives are in place: the overhead of an invocation as its activity duration minus the duration of its adapter activities, recorded as an attribute of the invocation activity (objective model-access-overhead of model/services/model-compute/ModelRouterService.yaml), the adapter activities started against the receipts written (objective receipt-coverage), the age of the oldest receipt with usage Unknown recorded by the ReceiptReconciler at every run beside connectsoft.factory.model_gateway.usage_unknown, and the probe interval of two minutes read from connectsoft.factory.model_gateway.provider_health; no value of an objective is claimed before the system is deployed."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-053]",
      "number": 53
    },
    {
      "id": "AIFACTORY-TASK-2278",
      "type": "task",
      "parent": "AIFACTORY-US-568",
      "title": "Secret references at start, one brokered credential per call in memory only and the RefreshProviderCredential handler",
      "sequence": "03.02.04.02",
      "description": "Secret references at start, one brokered credential per call in memory only and the RefreshProviderCredential handler. Expected output: The service binds provider-credentials and messaging-transport as secret references and stops its start with the name of a missing or unresolvable reference; the value of provider-credentials is read at no other time and reaches no adapter; a credential issued by SecretBroker.Issue for the purpose model-invoke under the decision of the call is held in memory for that one invocation or probe, passed to the adapter call alone, kept for no later call and masked by the redaction guard of the logging pipeline; the handler of SecretRotated invalidates the adapter client instances and the cached reference metadata of the deployments whose endpointRef resolves to the rotated reference, idempotent on the event id, and holds no credential to drop; no key value is in a file of the repository or in the deployment manifest.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The service binds provider-credentials and messaging-transport as secret references and stops its start with the name of a missing or unresolvable reference; the value of provider-credentials is read at no other time and reaches no adapter; a credential issued by SecretBroker.Issue for the purpose model-invoke under the decision of the call is held in memory for that one invocation or probe, passed to the adapter call alone, kept for no later call and masked by the redaction guard of the logging pipeline; the handler of SecretRotated invalidates the adapter client instances and the cached reference metadata of the deployments whose endpointRef resolves to the rotated reference, idempotent on the event id, and holds no credential to drop; no key value is in a file of the repository or in the deployment manifest."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2278]",
      "number": 2278
    },
    {
      "id": "AIFACTORY-TASK-2279",
      "type": "task",
      "parent": "AIFACTORY-US-568",
      "title": "Verify the failing start without a secret reference, the key scan and the telemetry content guard",
      "sequence": "03.02.04.03",
      "description": "Verify the failing start without a secret reference, the key scan and the telemetry content guard. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Area=SecretsAndTelemetry\"`; a zero-match filter counts as a failure; the tests start the service without each secret reference and assert the named error, scan logs, activities, metrics, outbox records and rows for the fixture key and for prompt and completion text, run two invocations of one deployment and assert two calls of SecretBroker.Issue and no credential kept between them, deliver SecretRotated twice and assert the invalidated adapter client, read the attributes of an invocation activity and the series of the four objectives, and run every repository query against a two-tenant fixture, which proves AC1 to AC5 of AIFACTORY-US-568; the local start steps of feature local-development-environment are run once for this service and the failing and the passing start are recorded in the repository documentation (ADR-0019).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Area=SecretsAndTelemetry\"`; a zero-match filter counts as a failure; the tests start the service without each secret reference and assert the named error, scan logs, activities, metrics, outbox records and rows for the fixture key and for prompt and completion text, run two invocations of one deployment and assert two calls of SecretBroker.Issue and no credential kept between them, deliver SecretRotated twice and assert the invalidated adapter client, read the attributes of an invocation activity and the series of the four objectives, and run every repository query against a two-tenant fixture, which proves AC1 to AC5 of AIFACTORY-US-568; the local start steps of feature local-development-environment are run once for this service and the failing and the passing start are recorded in the repository documentation (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2279]",
      "number": 2279
    },
    {
      "id": "AIFACTORY-US-569",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Load the model profile releases by alias with their definitions from ArtifactService, activate and retire profile versions, and read the active profiles",
      "sequence": "03.02.05",
      "description": "As a platform admin, I want the profiles agents reference to be the releases the registry holds, active in the router with their limits and fallback chains, so that no agent names a provider model and a retired profile is never selected for a new run. Agents and workflows reference logical profiles, never provider model names (decision D32); a profile is a release of the asset kind model-profile in AgentRegistryService, and `ModelProfile` in this service is its runtime read model. In this increment AgentRegistryService is delivered thin: it holds seeded Draft releases, resolves them by alias and publishes no release event (feature `agent-registry-service-thin`). The thin delivery seeds all eleven model profiles of model/model-profiles.yaml as Draft releases that are loadable by alias (decision D123), and the Draft allowance of decision D83 covers ModelProfile releases until I4 (decision D121). Model profiles are therefore loaded as seeded Draft releases by alias in I1, and the approval of a model-profile release by a Platform admin who is not its author becomes required with the complete AgentRegistryService in I4 (decision D119); the invariant of the model on Published releases is enforced with feature `agent-registry-service-complete`. At start a profile loader resolves each alias of its configured list through `AgentRegistryService/AssetPublication.ResolveRelease` and loads the release through `AgentRegistryService/AssetPublication.LoadRelease`, with its workload token, which holds the service scope that names AgentRegistryService. The manifest `release-manifest-v1` holds release id, asset kind, asset id, version, state, source, closure and hash and no field of a profile, and the registry never streams content: a reference names content held by ArtifactService and the caller fetches it there (AIFACTORY-US-403). The loader therefore takes the release id, the version and the content reference of the profile definition from the loaded release, fetches the definition through `ArtifactService/Artifacts.Fetch` under its workload token, compares the hash of what it read with the hash the release states, and validates the document against `model-profile-v1`, the definition `ModelProfile` of docs/reference/schemas/asset-manifests.schema.json, before it activates anything. The list of aliases is one configuration key of this thin path, `ModelAccess:Profiles:SeedAliases`, which the model does not list and which is removed in I4, when the seeded model profile releases are published through the evaluation gate by AIFACTORY-US-421 (D140). The authoring schema follows the aggregate since decision D121, so the loader projects the validated document through one mapping in which every member the aggregate holds has one counterpart, and the contract task of this PBI fixes it: `id`, `version`, `modality` and `privacyClass` with the values of the aggregate, `allowedRegions`, `allowedDeployments` in preference order, `fallbackChain`, `fallbackEnabled`, `priceBasis`, `embeddingCompatibility`, `limits.contextWindow` as the context limit, `limits.maxOutputTokens` and `limits.latencyClass`; the release id and the tenant come from the release. An absent `fallbackChain` is an empty chain and an absent `fallbackEnabled` is false, the default of the schema. The `providers` of the document, the single `fallback` member of documents written before the chain and the other members the aggregate does not hold are not projected, and the documents this PBI authors state `fallbackChain`. One difference remains: each name in `capabilities` is a required capability that a verdict pass meets, because the schema holds no threshold, and that is reported to the owner. A document without `modality`, `allowedRegions`, `allowedDeployments`, `priceBasis`, `limits.contextWindow` or `limits.maxOutputTokens`, which the schema leaves optional and the aggregate requires, fails activation with the member named. The activation is one command: it writes the profile version as active together with the `ModelProfileActivated` outbox record in one transaction, is idempotent on profile id, version and release, and refuses a profile whose fallback names a profile with a weaker privacy class or without the same tool and structured-output guarantees, with the entry named. The same command is the inbox handler `ActivateProfile` of `AssetReleasePublished`, and `RetireProfile` handles `AssetReleaseDeprecated` and `AssetReleaseRevoked`: the profile version is marked inactive with `ModelProfileRetired` in the same transaction, a revoked version at once. A retired version is no longer selectable, and runs that pinned it finish on their route plans. The three handlers are built and proven with fixture publishers, because no service publishes these events in I1: `AssetReleasePublished` arrives with the publication path of feature `agent-registry-service-publication` in I2 (D140), and `AssetReleaseDeprecated` and `AssetReleaseRevoked` with feature `agent-registry-service-complete` in I4; an event of another asset kind is acknowledged without effect. Readiness stays unready until every configured alias is loaded, so the service never answers NOT_FOUND for a profile the first outcome pins, and it names what is missing. Three branches keep an alias unloaded: AgentRegistryService does not answer; AgentRegistryService answers NOT_FOUND for the alias; ArtifactService does not answer or the content does not match the hash of the release. In each the loader logs the alias, the reason and the number of the attempt, retries with backoff in the running process without a restart, and readiness names the alias, in the second case as the missing alias; content that does not match its hash is never used. The gRPC dependency on AgentRegistryService degrades (decision D125): once a profile version is loaded, its copy in `ModelProfiles` serves resolution and invocation, so while the registry does not answer the router keeps serving the profile versions it already loaded, a restart of a replica reads them from its store and does not wait for the registry, and readiness stays unready only for an alias that was never loaded. For each of the eleven profiles of model/model-profiles.yaml, `code-fast`, `code-agent`, `code-agent-strong`, `reasoning`, `reasoning-high`, `structured`, `vision`, `long-context`, `embedding`, `reranker` and `pii-local`, this PBI authors two files: the authoring document `model-profile-v1`, and the seed entry in the file shape the seed loader of the thin registry reads, with its two members `manifest` and `alias`. The `allowedDeployments`, `allowedRegions` and `priceBasis` values of the documents, for which the schema states no value, and the output limit are inputs of the owner and are not invented here; the acceptance suite uses fixture values. Feature `agent-registry-service-thin` registers the eleven entries with its seed, as Draft releases under their aliases, and the router loads all eleven by alias (decisions D121 and D123). A loaded release has to name the content reference of its authoring document, which ArtifactService holds; the decision does not say which step stores that document for a seeded release, and that one point is reported to the owner. The suite of this PBI proves the path against a fake of the two registry methods and a fake of `ArtifactService/Artifacts.Fetch`, and the chain of AIFACTORY-US-058 runs it against the seeded registry of the environment. A caller whose scope carries `factory.models.read` lists the active profiles through `ListModelProfiles` with capabilities, privacy class, limits and fallback chains, and reads one through `GetModelProfile` with its allowed deployments and their evidence summary, that is the state, the health and the capability verdicts of each allowed deployment the tenant filter admits. Profiles of the platform tenant are readable by every tenant; a profile of another tenant is answered 404, the same answer as for an unknown `profileId` (ADR-0015 amendment D113), and a missing scope 403. No read writes anything, and no response holds a credential. This PBI proves what the publisher can prove for the two events; StudioBff, DashboardService and AuditService, which records each as evidence, handle them in their own PBIs. Kind: behavior. Traces: services: ModelRouterService, AgentRegistryService, ArtifactService; aggregates: ModelRouterService/ModelProfile; apis: ModelRouterService/ListModelProfiles, ModelRouterService/GetModelProfile, AgentRegistryService/AssetPublication.ResolveRelease, AgentRegistryService/AssetPublication.LoadRelease, ArtifactService/Artifacts.Fetch; events: ModelRouterService/ModelProfileActivated, ModelRouterService/ModelProfileRetired; descriptors: model-profile-v1, release-manifest-v1; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FR-04; scenarios: SCN-ModelRouterService-001, SCN-ModelRouterService-002, SCN-ModelRouterService-013, SCN-ModelRouterService-014. Relates: screens: model-profiles, run-submit. Depends on: AIFACTORY-US-567, feature:agent-registry-service-thin, feature:artifact-service. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/control-plane/AgentRegistryService.yaml, model/services/knowledge/ArtifactService.yaml, model/model-profiles.yaml, docs/reference/schemas/asset-manifests.schema.json, docs/reference/schemas/release-manifest.schema.json, docs/architecture/adr/0021-quality-gates.md, docs/architecture/catalogs/model-profiles.md, docs/planes/model-compute/workflows.md.",
      "acceptanceCriteria": [
        "AC1: Given a fake of the two registry methods that serves seeded Draft releases of the kind model-profile under their aliases, a fake of `ArtifactService/Artifacts.Fetch` that holds their authoring documents, and `ModelAccess:Profiles:SeedAliases` naming the aliases, when the service starts, then each alias is resolved through `AgentRegistryService/AssetPublication.ResolveRelease`, its release is loaded through `AgentRegistryService/AssetPublication.LoadRelease`, the definition is fetched through `ArtifactService/Artifacts.Fetch`, matches the hash of the release and is valid against `model-profile-v1` of docs/reference/schemas/asset-manifests.schema.json, one active `ModelRouterService/ModelProfile` exists per profile version with the values of the mapping, readiness turns ready only after the last alias is loaded, and a second start activates nothing twice; an alias the registry answers NOT_FOUND for, a registry or an ArtifactService that does not answer, and content that does not match its hash each leave the alias unloaded and readiness unready with the alias named, are logged and retried with backoff; a document that fails the schema, lacks a member the aggregate requires or names a profile of a weaker privacy class in its fallback chain is refused with the member named; given every alias loaded and the registry then stops answering, when a replica restarts and a route plan is resolved, then the loaded profile versions are served from `ModelProfiles` and readiness turns ready without the registry (SCN-ModelRouterService-013, ADR-0021, model/services/model-compute/ModelRouterService.yaml).",
        "AC2: Given a profile version was activated, when the outbox dispatcher of the `model-router` messaging profile publishes `ModelRouterService/ModelProfileActivated` on `model-access.profiles.v1.model-profile-activated`, then the outbox record was written in the same transaction as the activation, the event is sent in the run event envelope with `profileId`, `version`, `tenantId`, `releaseId` and `privacyClass`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ModelRouterService-013, ADR-0012).",
        "AC3: Given an active profile version and a fixture publisher of `AssetReleaseDeprecated` or `AssetReleaseRevoked` for its release, when the `RetireProfile` handler runs, then the version is inactive, `ModelRouterService/ModelProfileRetired` with `profileId`, `version` and `tenantId` is written in the same transaction and published on `model-access.profiles.v1.model-profile-retired`, the version is absent from `ModelRouterService/ListModelProfiles`, a route plan of a run that pinned it stays usable, and a redelivery of the same event id retires nothing twice (SCN-ModelRouterService-014, ADR-0012).",
        "AC4: Given active profiles of the platform tenant, of the tenant of the caller and of another tenant, when a caller with `factory.models.read` calls `ModelRouterService/ListModelProfiles`, then the response is 200 with the active versions of the platform tenant and of the own tenant only, each with capabilities, privacy class, limits and fallback chain; a call without the scope is answered 403 and nothing is written (SCN-ModelRouterService-001, ADR-0015).",
        "AC5: Given the same profiles, when `ModelRouterService/GetModelProfile` is called for a readable `profileId`, then the response is 200 with the profile, its allowed deployments and the state, health and capability verdicts of each; for a `profileId` of another tenant or one that does not exist the response is 404 with a problem response, the same in both cases, and for a missing scope 403 (SCN-ModelRouterService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/model-profiles.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/catalogs/model-profiles.md",
        "docs/planes/model-compute/workflows.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2280",
        "AIFACTORY-TASK-2309",
        "AIFACTORY-TASK-2281",
        "AIFACTORY-TASK-2282",
        "AIFACTORY-TASK-2283"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6005,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService",
          "AgentRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "ModelRouterService/ModelProfile"
        ],
        "apis": [
          "ModelRouterService/ListModelProfiles",
          "ModelRouterService/GetModelProfile",
          "AgentRegistryService/AssetPublication.ResolveRelease",
          "AgentRegistryService/AssetPublication.LoadRelease",
          "ArtifactService/Artifacts.Fetch"
        ],
        "events": [
          "ModelRouterService/ModelProfileActivated",
          "ModelRouterService/ModelProfileRetired"
        ],
        "descriptors": [
          "model-profile-v1",
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-04"
        ],
        "scenarios": [
          "SCN-ModelRouterService-001",
          "SCN-ModelRouterService-002",
          "SCN-ModelRouterService-013",
          "SCN-ModelRouterService-014"
        ]
      },
      "relates": {
        "screens": [
          "model-profiles",
          "run-submit"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-567",
        "feature:agent-registry-service-thin",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/model-profiles.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/catalogs/model-profiles.md",
        "docs/planes/model-compute/workflows.md"
      ],
      "titlePrefix": "[AIFACTORY-US-569]",
      "number": 569
    },
    {
      "id": "AIFACTORY-TASK-2280",
      "type": "task",
      "parent": "AIFACTORY-US-569",
      "title": "Authoring documents and seed entries of the eleven Draft model-profile releases",
      "sequence": "03.02.05.01",
      "description": "Authoring documents and seed entries of the eleven Draft model-profile releases. Expected output: The repository holds two files per profile of model/model-profiles.yaml, eleven in all (code-fast, code-agent, code-agent-strong, reasoning, reasoning-high, structured, vision, long-context, embedding, reranker, pii-local): the authoring document model-profile-v1, valid against the definition ModelProfile of docs/reference/schemas/asset-manifests.schema.json, with id, version, name, capabilities, modality, privacyClass with the values of the aggregate, providers, fallbackChain, fallbackEnabled and limits written from model/model-profiles.yaml through the mapping of AIFACTORY-TASK-2309, and the seed entry in the file shape the seed loader of the thin AgentRegistryService reads, with the member manifest (a Draft manifest of the kind model-profile with releaseId, assetKind, assetId, version, state Draft, source, closure and hash, the hash being that of the authoring document) and the member alias; allowedDeployments, allowedRegions, priceBasis and the output limit are filled only from values the owner supplies, the acceptance suite using fixture values; feature agent-registry-service-thin registers the eleven entries with its seed as Draft releases under their aliases (D121, D123).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The repository holds two files per profile of model/model-profiles.yaml, eleven in all (code-fast, code-agent, code-agent-strong, reasoning, reasoning-high, structured, vision, long-context, embedding, reranker, pii-local): the authoring document model-profile-v1, valid against the definition ModelProfile of docs/reference/schemas/asset-manifests.schema.json, with id, version, name, capabilities, modality, privacyClass with the values of the aggregate, providers, fallbackChain, fallbackEnabled and limits written from model/model-profiles.yaml through the mapping of AIFACTORY-TASK-2309, and the seed entry in the file shape the seed loader of the thin AgentRegistryService reads, with the member manifest (a Draft manifest of the kind model-profile with releaseId, assetKind, assetId, version, state Draft, source, closure and hash, the hash being that of the authoring document) and the member alias; allowedDeployments, allowedRegions, priceBasis and the output limit are filled only from values the owner supplies, the acceptance suite using fixture values; feature agent-registry-service-thin registers the eleven entries with its seed as Draft releases under their aliases (D121, D123)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6005,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2280]",
      "number": 2280
    },
    {
      "id": "AIFACTORY-TASK-2309",
      "type": "task",
      "parent": "AIFACTORY-US-569",
      "title": "Mapping of the authoring document model-profile-v1 onto the ModelProfile aggregate",
      "sequence": "03.02.05.02",
      "description": "Mapping of the authoring document model-profile-v1 onto the ModelProfile aggregate. Expected output: The repository documentation holds one table that maps every member of the definition ModelProfile of docs/reference/schemas/asset-manifests.schema.json onto the aggregate of model/services/model-compute/ModelRouterService.yaml; since the schema follows the aggregate (D121), id, version, modality, privacyClass, allowedRegions, allowedDeployments, fallbackChain, fallbackEnabled, priceBasis and embeddingCompatibility map one to one, maxContextTokens comes from limits.contextWindow and maxOutputTokens and latencyClass from limits; the one row where the two shapes still differ is marked with the value this delivery applies until the owner decides, a capability name as a required capability met by a verdict pass; the members the schema leaves optional and the aggregate requires (modality, allowedRegions, allowedDeployments, priceBasis and the two limits) are listed as required for activation; the members of the document the aggregate does not hold (name, providers, the single fallback of documents written before the chain, reliableContext, costClass, capabilityEvidence and license) are listed as not projected; one golden document per row is checked in the pipeline, and the marked row changes only with the decision of the owner that closes its open question.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The repository documentation holds one table that maps every member of the definition ModelProfile of docs/reference/schemas/asset-manifests.schema.json onto the aggregate of model/services/model-compute/ModelRouterService.yaml; since the schema follows the aggregate (D121), id, version, modality, privacyClass, allowedRegions, allowedDeployments, fallbackChain, fallbackEnabled, priceBasis and embeddingCompatibility map one to one, maxContextTokens comes from limits.contextWindow and maxOutputTokens and latencyClass from limits; the one row where the two shapes still differ is marked with the value this delivery applies until the owner decides, a capability name as a required capability met by a verdict pass; the members the schema leaves optional and the aggregate requires (modality, allowedRegions, allowedDeployments, priceBasis and the two limits) are listed as required for activation; the members of the document the aggregate does not hold (name, providers, the single fallback of documents written before the chain, reliableContext, costClass, capabilityEvidence and license) are listed as not projected; one golden document per row is checked in the pipeline, and the marked row changes only with the decision of the owner that closes its open question."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6005,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2309]",
      "number": 2309
    },
    {
      "id": "AIFACTORY-TASK-2281",
      "type": "task",
      "parent": "AIFACTORY-US-569",
      "title": "Profile loader by alias with the definition fetched from ArtifactService, the ActivateProfile and RetireProfile handlers and the two profile events",
      "sequence": "03.02.05.03",
      "description": "Profile loader by alias with the definition fetched from ArtifactService, the ActivateProfile and RetireProfile handlers and the two profile events. Expected output: At start the loader resolves each alias of ModelAccess:Profiles:SeedAliases through AssetPublication.ResolveRelease and loads the release through AssetPublication.LoadRelease with the workload token of the service, takes the release id, the version and the content reference of the definition from the loaded release, fetches the definition through Artifacts.Fetch, compares its hash with the hash of the release and validates it against model-profile-v1; one activation command projects the valid document through the mapping of AIFACTORY-TASK-2309 into ModelProfiles with the ModelProfileActivated outbox record in the same transaction, idempotent on profile id, version and release, refusing a fallback chain entry of a weaker privacy class or other guarantees and a document without a member the aggregate requires; ActivateProfile runs the same command for AssetReleasePublished of the kind model-profile; RetireProfile marks the version inactive with ModelProfileRetired in the same transaction for AssetReleaseDeprecated and AssetReleaseRevoked; an alias answered NOT_FOUND, a registry or an ArtifactService that does not answer and content that does not match its hash leave the alias unloaded, are logged with the alias, the reason and the number of the attempt and retried with backoff, and readiness stays unready and names the alias until every alias is loaded; an alias already loaded counts as loaded from its copy in ModelProfiles, so a replica that restarts while the registry does not answer serves the loaded profile versions and turns ready (D125).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "At start the loader resolves each alias of ModelAccess:Profiles:SeedAliases through AssetPublication.ResolveRelease and loads the release through AssetPublication.LoadRelease with the workload token of the service, takes the release id, the version and the content reference of the definition from the loaded release, fetches the definition through Artifacts.Fetch, compares its hash with the hash of the release and validates it against model-profile-v1; one activation command projects the valid document through the mapping of AIFACTORY-TASK-2309 into ModelProfiles with the ModelProfileActivated outbox record in the same transaction, idempotent on profile id, version and release, refusing a fallback chain entry of a weaker privacy class or other guarantees and a document without a member the aggregate requires; ActivateProfile runs the same command for AssetReleasePublished of the kind model-profile; RetireProfile marks the version inactive with ModelProfileRetired in the same transaction for AssetReleaseDeprecated and AssetReleaseRevoked; an alias answered NOT_FOUND, a registry or an ArtifactService that does not answer and content that does not match its hash leave the alias unloaded, are logged with the alias, the reason and the number of the attempt and retried with backoff, and readiness stays unready and names the alias until every alias is loaded; an alias already loaded counts as loaded from its copy in ModelProfiles, so a replica that restarts while the registry does not answer serves the loaded profile versions and turns ready (D125)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2281]",
      "number": 2281
    },
    {
      "id": "AIFACTORY-TASK-2282",
      "type": "task",
      "parent": "AIFACTORY-US-569",
      "title": "ListModelProfiles and GetModelProfile over the active profile versions",
      "sequence": "03.02.05.04",
      "description": "ListModelProfiles and GetModelProfile over the active profile versions. Expected output: ListModelProfiles returns the active profile versions of the platform tenant and of the tenant of the token with capabilities, privacy class, limits and fallback chain; GetModelProfile returns one profile with its allowed deployments in preference order and, for each deployment the tenant filter admits, state, health and capability verdicts; a profile of another tenant and an unknown profileId are answered 404 alike and a missing scope 403; no response holds an endpoint secret.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "ListModelProfiles returns the active profile versions of the platform tenant and of the tenant of the token with capabilities, privacy class, limits and fallback chain; GetModelProfile returns one profile with its allowed deployments in preference order and, for each deployment the tenant filter admits, state, health and capability verdicts; a profile of another tenant and an unknown profileId are answered 404 alike and a missing scope 403; no response holds an endpoint secret."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2282]",
      "number": 2282
    },
    {
      "id": "AIFACTORY-TASK-2283",
      "type": "task",
      "parent": "AIFACTORY-US-569",
      "title": "Verify the profile loading, activation, retirement and reads through the acceptance suite",
      "sequence": "03.02.05.05",
      "description": "Verify the profile loading, activation, retirement and reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-001|Scenario=SCN-ModelRouterService-002|Scenario=SCN-ModelRouterService-013|Scenario=SCN-ModelRouterService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-569 with a fake of the two registry methods, a fake of Artifacts.Fetch that holds the authoring documents, can return content that does not match its hash and can be stopped, an alias the fake registry answers NOT_FOUND for, which is logged, retried with backoff and named by readiness as the missing alias until the fake serves it, a registry that stops answering, the golden rows of the mapping, fixture publishers of the three release events, a three-tenant fixture, a document refused by the schema, by a missing member the aggregate requires and by its fallback chain, and the publication and payload of ModelProfileActivated and ModelProfileRetired; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-001|Scenario=SCN-ModelRouterService-002|Scenario=SCN-ModelRouterService-013|Scenario=SCN-ModelRouterService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-569 with a fake of the two registry methods, a fake of Artifacts.Fetch that holds the authoring documents, can return content that does not match its hash and can be stopped, an alias the fake registry answers NOT_FOUND for, which is logged, retried with backoff and named by readiness as the missing alias until the fake serves it, a registry that stops answering, the golden rows of the mapping, fixture publishers of the three release events, a three-tenant fixture, a document refused by the schema, by a missing member the aggregate requires and by its fallback chain, and the publication and payload of ModelProfileActivated and ModelProfileRetired; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2283]",
      "number": 2283
    },
    {
      "id": "AIFACTORY-US-570",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Register a model deployment as Candidate without posting a credential, and list the deployments of the tenant with state, health and license metadata",
      "sequence": "03.02.06",
      "description": "As a platform admin, I want to register a provider deployment by reference and see every deployment of my tenant with its state, so that a model enters the Factory as a named, licensed candidate and never as a key pasted into a form. A Platform admin, with a user token whose scope carries `factory.models.admin`, registers one concrete provider, model revision and endpoint in a region through the gateway route of `RegisterDeployment` with an `Idempotency-Key`. The body names `deploymentId`, `provider` (one of openai, azure-openai, azure-ai-inference, ollama, anthropic and self-hosted), `model`, `region`, `privacyClass`, `endpointRef`, the license metadata (commercial use, redistribution, fine-tuning, customer deployment) and, for a self-hosted deployment, the `computePoolId`. Credentials are brokered, never posted: `endpointRef` is a connection or pool reference, the credential comes from the Secret Broker at invocation, and a body that carries a credential value is refused. The tenant comes from the token (ADR-0015). The service writes the `ModelDeployment` in state Candidate together with a `DeploymentStateChanged` outbox record in one transaction and answers 201 with the deployment. The `fromState` of the event is optional and a new deployment has no previous state, so the event of a registration carries `toState` Candidate and no `fromState` (decision D121): an event without `fromState` announces a registration. A Candidate is never routed: the router considers only deployments that are Approved and healthy. The same key with the same body returns the same deployment and writes nothing; the same key with a different body, or a `deploymentId` that already exists in the tenant, is answered 409; a caller without the scope, and a caller who holds the scope but not the Platform admin role, such as an Observer, is answered 403. A body that fails validation is answered 400, which the model lists for the operation since decision D121. Beyond a missing or malformed member, three bodies fail it: one that carries a credential value, one that names a provider outside the six values of the model, and one that names `openai`, `azure-openai`, `azure-ai-inference`, `ollama` or `anthropic` while `ModelGateway:Adapters:Enabled` does not load the adapter of that value. The value `self-hosted` is exempt from the adapter rule. The option names no adapter of that name and the model does not say which adapter serves a self-hosted deployment, so such a deployment, with or without a `computePoolId`, is registered as Candidate like any other, the routing function of AIFACTORY-US-573 excludes it with the reason that no adapter serves its provider, and the question is reported to the owner. The scripted adapter of the acceptance suite has no provider value of its own: the acceptance configuration binds it in place of the adapter of one of the modelled provider values (AIFACTORY-TASK-2297), so the deployment of a test or of the acceptance environment is registered with that value through this operation unchanged. No refusal writes a deployment or publishes anything. The primary key of the table `ModelDeployments` is the `deploymentId` together with the tenant (decision D121). A `deploymentId` that another tenant already uses is therefore no conflict: the deployment is registered for the tenant of the token, and no answer tells a caller whether an id is used elsewhere. The placement and warm state of a deployment with a `computePoolId` come from ComputePoolService, an optional dependency that arrives in I8; until then no placement is asked for, and such a deployment of a provider value with an adapter, `ollama` for example, is called at its `endpointRef` when it is routed. A Platform admin or an Observer whose scope carries `factory.models.admin` lists the deployments through `ListModelDeployments`: provider, model, region, privacy class, state, health, license metadata and evidence reference, paged, filtered by the tenant of the token over the index on tenant, provider, region and state. A deployment of another tenant never appears. Whether a deployment of the platform tenant is visible to, and routable for, another tenant, as a profile of the platform tenant is readable by every tenant, the model does not state; it is reported to the owner, and this delivery shows and routes the deployments the tenant row filter admits. A caller without the scope, or with a role other than Platform admin or Observer, is answered 403. This PBI proves what the publisher can prove for the registration event; AIFACTORY-US-572 proves every other publication of `DeploymentStateChanged` and traces its scenario. Kind: behavior. Traces: services: ModelRouterService; aggregates: ModelRouterService/ModelDeployment; apis: ModelRouterService/RegisterDeployment, ModelRouterService/ListModelDeployments; events: ModelRouterService/DeploymentStateChanged; adrs: ADR-0014, ADR-0015; requirements: FR-04, NFR-13; scenarios: SCN-ModelRouterService-003, SCN-ModelRouterService-004. Relates: screens: model-profiles. Depends on: AIFACTORY-US-567. Sources: model/services/model-compute/ModelRouterService.yaml, docs/planes/model-compute/capability-router.md, docs/planes/model-compute/security.md, docs/planes/model-compute/services/model-router-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Platform admin with `factory.models.admin` and a valid body without a credential, when `ModelRouterService/RegisterDeployment` is called with an `Idempotency-Key`, then the response is 201 with the deployment, the `ModelRouterService/ModelDeployment` is in state Candidate with the tenant of the token, the `ModelRouterService/DeploymentStateChanged` outbox record with `toState` Candidate and no `fromState`, which announces a registration, is written in the same transaction, and the deployment is not routable (SCN-ModelRouterService-004, ADR-0014).",
        "AC2: Given the same call repeated with the same `Idempotency-Key` and the same body, when it arrives, then the same deployment is returned and no second row and no second outbox record exists; given the same key with a different body, or a `deploymentId` that already exists in the tenant, when `ModelRouterService/RegisterDeployment` is called, then the answer is 409; given a `deploymentId` that only another tenant uses, then the deployment is registered for the tenant of the token and the answer is 201, because the key of the table includes the tenant; given a body that lacks a required member, carries a credential value, names a provider outside the six values of the model, or names one of the five provider values with an adapter while `ModelGateway:Adapters:Enabled` does not load it, then the answer is 400; a 409 and a 400 write nothing and publish nothing; given a body with the provider `self-hosted`, or with the provider value the acceptance configuration binds the scripted adapter to, then the deployment is registered as Candidate (SCN-ModelRouterService-004, ADR-0014).",
        "AC3: Given a caller without `factory.models.admin`, or an Observer who holds it, when `ModelRouterService/RegisterDeployment` is called, then the answer is 403 with a problem response, no deployment is written and nothing is published (SCN-ModelRouterService-004, ADR-0015).",
        "AC4: Given deployments of two tenants in several states, when a Platform admin or an Observer with `factory.models.admin` calls `ModelRouterService/ListModelDeployments`, then the response is 200 with the deployments of the tenant of the token only, paged, each with provider, model, region, privacy class, state, health, license metadata and evidence reference and without any credential; a caller without the scope or with another role is answered 403 and nothing is written (SCN-ModelRouterService-003, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/security.md",
        "docs/planes/model-compute/services/model-router-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2284",
        "AIFACTORY-TASK-2285",
        "AIFACTORY-TASK-2286"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6006,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService"
        ],
        "aggregates": [
          "ModelRouterService/ModelDeployment"
        ],
        "apis": [
          "ModelRouterService/RegisterDeployment",
          "ModelRouterService/ListModelDeployments"
        ],
        "events": [
          "ModelRouterService/DeploymentStateChanged"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-04",
          "NFR-13"
        ],
        "scenarios": [
          "SCN-ModelRouterService-003",
          "SCN-ModelRouterService-004"
        ]
      },
      "relates": {
        "screens": [
          "model-profiles"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-567"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/security.md",
        "docs/planes/model-compute/services/model-router-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-570]",
      "number": 570
    },
    {
      "id": "AIFACTORY-TASK-2284",
      "type": "task",
      "parent": "AIFACTORY-US-570",
      "title": "Contract of the deployment registration and of the deployment view",
      "sequence": "03.02.06.01",
      "description": "Contract of the deployment registration and of the deployment view. Expected output: The OpenAPI document of the service fixes the request of RegisterDeployment (deploymentId, provider from the enumeration of the model, model, region, privacyClass, endpointRef, licenseMetadata with its four fields, optional computePoolId, no credential field) and the deployment view of the 201 and of ListModelDeployments, as model/services/model-compute/ModelRouterService.yaml lists the fields; it records that a registration is announced by DeploymentStateChanged with toState Candidate and no fromState, which the model makes optional for this case (D121), the modelled response codes 201, 400, 403 and 409, and that the provider value self-hosted is accepted without an adapter check.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service fixes the request of RegisterDeployment (deploymentId, provider from the enumeration of the model, model, region, privacyClass, endpointRef, licenseMetadata with its four fields, optional computePoolId, no credential field) and the deployment view of the 201 and of ListModelDeployments, as model/services/model-compute/ModelRouterService.yaml lists the fields; it records that a registration is announced by DeploymentStateChanged with toState Candidate and no fromState, which the model makes optional for this case (D121), the modelled response codes 201, 400, 403 and 409, and that the provider value self-hosted is accepted without an adapter check."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6006,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2284]",
      "number": 2284
    },
    {
      "id": "AIFACTORY-TASK-2285",
      "type": "task",
      "parent": "AIFACTORY-US-570",
      "title": "RegisterDeployment with idempotency and role checks, and the ListModelDeployments read",
      "sequence": "03.02.06.02",
      "description": "RegisterDeployment with idempotency and role checks, and the ListModelDeployments read. Expected output: RegisterDeployment validates the body, refuses with 400 a credential value, a provider outside the six values of the model and one of the five provider values with an adapter whose adapter is not loaded, accepts the value self-hosted without an adapter check, writes the deployment as Candidate with its DeploymentStateChanged outbox record (toState Candidate, no fromState) in one transaction and returns 201; the idempotent repeat, the 409 of a reused key with another body and of a deploymentId that already exists in the tenant, the registration of a deploymentId that only another tenant uses, which the key of the table admits because it includes the tenant (D121), and the 403 of a missing scope or role are covered by acceptance tests; ListModelDeployments returns the deployments of the tenant of the token paged, for a Platform admin or an Observer, without any credential.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "RegisterDeployment validates the body, refuses with 400 a credential value, a provider outside the six values of the model and one of the five provider values with an adapter whose adapter is not loaded, accepts the value self-hosted without an adapter check, writes the deployment as Candidate with its DeploymentStateChanged outbox record (toState Candidate, no fromState) in one transaction and returns 201; the idempotent repeat, the 409 of a reused key with another body and of a deploymentId that already exists in the tenant, the registration of a deploymentId that only another tenant uses, which the key of the table admits because it includes the tenant (D121), and the 403 of a missing scope or role are covered by acceptance tests; ListModelDeployments returns the deployments of the tenant of the token paged, for a Platform admin or an Observer, without any credential."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6006,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2285]",
      "number": 2285
    },
    {
      "id": "AIFACTORY-TASK-2286",
      "type": "task",
      "parent": "AIFACTORY-US-570",
      "title": "Verify the registration and the list of deployments through the acceptance suite",
      "sequence": "03.02.06.03",
      "description": "Verify the registration and the list of deployments through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-003|Scenario=SCN-ModelRouterService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-570 with a two-tenant fixture, the role matrix of Platform admin, Observer and Requester, the idempotent repeat, both conflicts, a deploymentId another tenant already uses, which is registered with 201, a body without a required member, the refused credential, a provider outside the enumeration, a provider whose adapter is not loaded, a self-hosted deployment registered as Candidate without an adapter, a deployment registered with the provider value the acceptance configuration binds the scripted adapter of AIFACTORY-TASK-2297 to, and the outbox record of the registration with toState Candidate and no fromState.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-003|Scenario=SCN-ModelRouterService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-570 with a two-tenant fixture, the role matrix of Platform admin, Observer and Requester, the idempotent repeat, both conflicts, a deploymentId another tenant already uses, which is registered with 201, a body without a required member, the refused credential, a provider outside the enumeration, a provider whose adapter is not loaded, a self-hosted deployment registered as Candidate without an adapter, a deployment registered with the provider value the acceptance configuration binds the scripted adapter of AIFACTORY-TASK-2297 to, and the outbox record of the registration with toState Candidate and no fromState."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2286]",
      "number": 2286
    },
    {
      "id": "AIFACTORY-US-571",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Request the capability evaluation of a deployment and import the capability evidence that moves a Candidate to Evaluated",
      "sequence": "03.02.07",
      "description": "As a platform admin, I want a deployment to gain its capability scores from the evaluation suite and nowhere else, so that a model is routed on evidence of tool calling, structured output and the other gated capabilities and never on its name. A model enters routing only on evidence (ADR-0021, decision D32): the evaluation suite of bounded context BC-22 is the only source of capability scores. A Platform admin whose scope carries `factory.models.admin` asks for the capability suite to be run against a deployment of the tenant through the gateway route of `EvaluateDeployment` with an `Idempotency-Key`. It is a sandbox action: it changes no shared state of this service and answers 202; the state of the deployment changes only when evidence arrives. A repeated call with the same key returns the same 202 and asks for no second run; a `deploymentId` of another tenant or one that does not exist is answered 404 (ADR-0015 amendment D113); a caller without the scope or without the Platform admin role is answered 403. How the suite run is requested is not decided by the model: ModelRouterService has only an event dependency on QualityScoreService, the method `Evaluation.RunSuite` of that service names model deployments as a target but is not among the dependencies of the router, no method invokes a deployment that is not yet Approved, and the thin QualityScoreService of this increment runs no suite. This PBI therefore delivers the request behind one evaluation request port: the operation validates, applies its idempotency rule, hands the deployment and the request to the port and answers 202. No adapter to a suite is built or invented here, and the point is reported to the owner. The request itself is not written as audit evidence: it changes no state and publishes nothing, the `action` values of `audit-evidence-v1` name none for an evaluation request, and the evaluation becomes evidence when it has a result, through `DeploymentStateChanged` of the transition to Evaluated, which AuditService records. Whether the request needs an evidence record of its own, with a new action value, is reported to the owner. The evidence path is delivered in full. The `CapabilityEvidenceImporter` is triggered by `EvaluationCompleted` of QualityScoreService of the kind capability-suite; an event of another kind is acknowledged without effect. Evaluation records are artifacts (ADR-0021 decision 3), so the evidence reader port has one binding: it reads the record the event references by `evidenceRef` through `ArtifactService/Artifacts.Fetch` under the workload token of the service. The importer takes from the record the deployment, the suite version and one verdict per capability (pass, fail or a score) with its time, and in one transaction writes one `CapabilityScore` per capability under the suite version, sets `capabilityEvidenceRef` of the deployment, writes the `CapabilityEvidenceRecorded` outbox record with `deploymentId`, `tenantId`, `suiteVersion` and `evidenceRef`, and, for a deployment in state Candidate, applies the transition to Evaluated through the trigger `CapabilityEvidenceRecorded` with a `DeploymentStateChanged` outbox record. A deployment in another state keeps its state and gains the scores. A failing verdict is recorded as it is; whether the scores meet the thresholds of a profile is checked at approval (AIFACTORY-US-572), not here. The importer retries five times with exponential backoff from 30 seconds, runs two tenants in parallel and is idempotent on deployment, suite version and evidence reference, so a redelivered event writes nothing twice. When the five attempts are exhausted, nothing was written, the deployment keeps its state and the failed delivery stays with the poison handling of the messaging profile (ADR-0012 decision 2). An event for a deployment that does not exist in the tenant of the envelope is acknowledged and logged without effect. The event carries `targetReleaseId`, `suiteId` and `evidenceRef` and no deployment id, suite version or score, so the content shape of the evaluation record, that is how it names the deployment, the suite version and the verdicts, is reported to the owner; the acceptance suite serves fixture records from a fake of `ArtifactService/Artifacts.Fetch`. When ArtifactService does not answer or holds nothing under the reference, the attempt of the importer fails and is retried under its policy. When no evidence arrives, because the suite is unavailable or, as in this increment, no service runs it, the deployment stays Candidate and is never routed (failure mode of the model), until a Platform admin approves it by attestation with a stated reason (AIFACTORY-US-757, decision D121). This PBI proves what the publisher can prove for `CapabilityEvidenceRecorded`; StudioBff and DashboardService handle it in their own PBIs. Kind: behavior. Traces: services: ModelRouterService; aggregates: ModelRouterService/ModelDeployment; apis: ModelRouterService/EvaluateDeployment, ArtifactService/Artifacts.Fetch; events: ModelRouterService/CapabilityEvidenceRecorded, ModelRouterService/DeploymentStateChanged; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FUX-10, NFR-11, XL-08; scenarios: SCN-ModelRouterService-005, SCN-ModelRouterService-016. Relates: screens: model-profiles. Depends on: AIFACTORY-US-567, AIFACTORY-US-570, feature:artifact-service. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/observability/QualityScoreService.yaml, model/services/knowledge/ArtifactService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0021-quality-gates.md, docs/architecture/quality-gates.md, docs/planes/model-compute/workflows.md.",
      "acceptanceCriteria": [
        "AC1: Given a Platform admin with `factory.models.admin` and a Candidate deployment of the tenant, when `ModelRouterService/EvaluateDeployment` is called with an `Idempotency-Key`, then the response is 202, the request reached the evaluation request port once, the deployment is still Candidate and nothing is published; a repeated call with the same key returns the same 202 and reaches the port no second time (SCN-ModelRouterService-005, ADR-0021).",
        "AC2: Given a caller without `factory.models.admin`, an Observer who holds it, or a `deploymentId` that belongs to another tenant or does not exist, when `ModelRouterService/EvaluateDeployment` is called, then the answer is 403, 403 or 404 respectively, the 404 the same in both cases, the port is not reached and no state changes (SCN-ModelRouterService-005, ADR-0015).",
        "AC3: Given a Candidate deployment and a fixture publisher of `EvaluationCompleted` of the kind capability-suite whose record names it, when the `CapabilityEvidenceImporter` runs and reads the record at `evidenceRef` through `ArtifactService/Artifacts.Fetch`, then one capability score per capability of the record exists under its suite version, the evidence reference of the deployment is set, the `ModelRouterService/ModelDeployment` is Evaluated, and the `ModelRouterService/CapabilityEvidenceRecorded` and `ModelRouterService/DeploymentStateChanged` outbox records are written in the same transaction; the same event delivered again, or the same deployment, suite version and evidence reference, writes nothing twice; an event of another kind or for a deployment outside the tenant of the envelope has no effect (SCN-ModelRouterService-016, ADR-0021).",
        "AC4: Given the evidence was imported, when the outbox dispatcher publishes `ModelRouterService/CapabilityEvidenceRecorded` on `model-access.deployments.v1.capability-evidence-recorded`, then the event is sent in the run event envelope with `deploymentId`, `tenantId`, `suiteVersion` and `evidenceRef`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; given no evidence arrives for a Candidate, then it stays Candidate and no route plan lists it while it is Candidate (SCN-ModelRouterService-016, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/quality-gates.md",
        "docs/planes/model-compute/workflows.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2287",
        "AIFACTORY-TASK-2288",
        "AIFACTORY-TASK-2289"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6007,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService"
        ],
        "aggregates": [
          "ModelRouterService/ModelDeployment"
        ],
        "apis": [
          "ModelRouterService/EvaluateDeployment",
          "ArtifactService/Artifacts.Fetch"
        ],
        "events": [
          "ModelRouterService/CapabilityEvidenceRecorded",
          "ModelRouterService/DeploymentStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FUX-10",
          "NFR-11",
          "XL-08"
        ],
        "scenarios": [
          "SCN-ModelRouterService-005",
          "SCN-ModelRouterService-016"
        ]
      },
      "relates": {
        "screens": [
          "model-profiles"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-567",
        "AIFACTORY-US-570",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/quality-gates.md",
        "docs/planes/model-compute/workflows.md"
      ],
      "titlePrefix": "[AIFACTORY-US-571]",
      "number": 571
    },
    {
      "id": "AIFACTORY-TASK-2287",
      "type": "task",
      "parent": "AIFACTORY-US-571",
      "title": "EvaluateDeployment behind the evaluation request port",
      "sequence": "03.02.07.01",
      "description": "EvaluateDeployment behind the evaluation request port. Expected output: EvaluateDeployment checks scope and the Platform admin role, finds the deployment under the tenant filter (404 otherwise), applies the Idempotency-Key rule, hands the deployment and the request to the evaluation request port and answers 202 without changing the deployment; the port has a recording fake in the acceptance suite and no adapter to a suite, which waits for the decision of the owner on the call that requests a capability suite run.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "EvaluateDeployment checks scope and the Platform admin role, finds the deployment under the tenant filter (404 otherwise), applies the Idempotency-Key rule, hands the deployment and the request to the evaluation request port and answers 202 without changing the deployment; the port has a recording fake in the acceptance suite and no adapter to a suite, which waits for the decision of the owner on the call that requests a capability suite run."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6007,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2287]",
      "number": 2287
    },
    {
      "id": "AIFACTORY-TASK-2288",
      "type": "task",
      "parent": "AIFACTORY-US-571",
      "title": "CapabilityEvidenceImporter with the evidence reader port, the capability scores and the Candidate to Evaluated transition",
      "sequence": "03.02.07.02",
      "description": "CapabilityEvidenceImporter with the evidence reader port, the capability scores and the Candidate to Evaluated transition. Expected output: The handler of EvaluationCompleted of the kind capability-suite reads the evaluation record at evidenceRef through the evidence reader port, whose one binding fetches the artifact through Artifacts.Fetch of ArtifactService under the workload token of the service, writes one CapabilityScore per capability under the suite version, sets capabilityEvidenceRef, writes the CapabilityEvidenceRecorded outbox record and, for a Candidate, applies CapabilityEvidenceRecorded to Evaluated with a DeploymentStateChanged outbox record, all in one transaction; it is idempotent on deployment, suite version and evidence reference, acknowledges without effect an event of another kind or for a deployment outside the tenant of the envelope, and retries five times with exponential backoff from 30 seconds.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The handler of EvaluationCompleted of the kind capability-suite reads the evaluation record at evidenceRef through the evidence reader port, whose one binding fetches the artifact through Artifacts.Fetch of ArtifactService under the workload token of the service, writes one CapabilityScore per capability under the suite version, sets capabilityEvidenceRef, writes the CapabilityEvidenceRecorded outbox record and, for a Candidate, applies CapabilityEvidenceRecorded to Evaluated with a DeploymentStateChanged outbox record, all in one transaction; it is idempotent on deployment, suite version and evidence reference, acknowledges without effect an event of another kind or for a deployment outside the tenant of the envelope, and retries five times with exponential backoff from 30 seconds."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6007,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2288]",
      "number": 2288
    },
    {
      "id": "AIFACTORY-TASK-2289",
      "type": "task",
      "parent": "AIFACTORY-US-571",
      "title": "Verify the evaluation request and the evidence import through the acceptance suite",
      "sequence": "03.02.07.03",
      "description": "Verify the evaluation request and the evidence import through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-005|Scenario=SCN-ModelRouterService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-571 with the recording fake of the request port, which also asserts that the request leaves no audit evidence record, a fixture publisher of EvaluationCompleted, a fake of Artifacts.Fetch that holds records of passing and failing verdicts under their evidence references, holds nothing under one reference and can be stopped, a redelivery, an event of another kind, a deployment of another tenant, a Candidate that never receives evidence, and the publication and payload of CapabilityEvidenceRecorded; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-005|Scenario=SCN-ModelRouterService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-571 with the recording fake of the request port, which also asserts that the request leaves no audit evidence record, a fixture publisher of EvaluationCompleted, a fake of Artifacts.Fetch that holds records of passing and failing verdicts under their evidence references, holds nothing under one reference and can be stopped, a redelivery, an event of another kind, a deployment of another tenant, a Candidate that never receives evidence, and the publication and payload of CapabilityEvidenceRecorded; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6007,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2289]",
      "number": 2289
    },
    {
      "id": "AIFACTORY-US-572",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Approve an Evaluated deployment after license and evidence checks, keep it Approved or Degraded by the health probe, and announce every state change",
      "sequence": "03.02.08",
      "description": "As a platform admin, I want to approve a deployment only when its license and its evidence allow it, and to see it leave routing when it is unhealthy, so that only licensed, evaluated and healthy deployments ever answer a run. A Platform admin whose scope carries `factory.models.admin` approves a deployment through the gateway route of `ApproveDeployment`, a publication-class action whose gate is in this service and not in the gateway. The service checks, in this order: the deployment exists in the tenant of the token, and a `deploymentId` of another tenant or one that does not exist is answered 404 (ADR-0015 amendment D113); it is in state Evaluated, and a Candidate, a Degraded or a Retired deployment is answered 409, while a repeated approval of a deployment that is already Approved returns 200 and changes nothing, because the operation is naturally idempotent; its license metadata is recorded and permits the intended use, and its capability scores meet the thresholds in `requiredCapabilities` of every active profile that lists it in `allowedDeployments`, and otherwise the answer is 412 with a problem response that names the failed check, the profile and the capability. On success the deployment moves to Approved through the trigger `PlatformAdminApproval` together with a `DeploymentStateChanged` outbox record in one transaction, under optimistic concurrency on the row version, and the response is 200. The approval records the basis capability-suite in `approvalBasis` of the deployment; the approval of a Candidate or an Evaluated deployment by attestation, which records the basis attestation, is the operation `AttestDeployment` of AIFACTORY-US-757 (decisions D121 and D123). Only a deployment that is Approved and healthy is routable. Which of the four license fields forbids which use the model does not state; the check is one rule with those four inputs, and its rule is reported to the owner. A caller without the scope or without the Platform admin role is answered 403. The `DeploymentHealthProbe` runs every two minutes over the deployments in Approved or Degraded, four in parallel partitioned by provider, with two attempts 15 seconds apart, idempotent on deployment and probe window. It sends a minimal request through the adapter of the deployment. SecretBrokerService issues only for a purpose among the allowed purposes of a reference and for a subject with a policy decision Allow, and an issuance carries the id of that decision. The probe therefore asks `PolicyEngineService/Policy.Decide` once per deployment and probe window for the probe of that deployment by the workload identity of the service, and passes the decision id and the purpose `model-invoke` to `SecretBrokerService/SecretBroker.Issue`, which issues one short-lived credential for that one probe (the rule of AIFACTORY-US-568: one credential per call, none kept). Whether a probe needs a decision of its own, and which rule of the policy bundle allows it, is reported to the owner. A probe counts as failed only when the provider call fails on both attempts, or when the broker refuses the issuance because the reference is revoked. When `Policy.Decide` or `SecretBroker.Issue` does not answer, or the decision denies, the probe of that deployment is skipped: its state and `healthy` stay unchanged, the skip is logged with the deployment and the dependency named and counted, and the next window probes again. An outage of the broker or of the policy engine therefore never moves the Approved deployments to Degraded and never ends every invocation with UNAVAILABLE for a reason the providers do not have. The model lists no instrument for a skipped probe, which is reported. A failed probe moves an Approved deployment to Degraded with `healthy` false (trigger `HealthProbeFailed`), and a successful probe moves a Degraded one back to Approved with `healthy` true (trigger `HealthProbeRecovered`), each with a `DeploymentStateChanged` outbox record in the same transaction; a probe that confirms the current state writes nothing. The probe sets `connectsoft.factory.model_gateway.provider_health` per provider and region and records its latency in `connectsoft.factory.model_gateway.latency`. A probe is no invocation of a caller: it writes no receipt and publishes no `ModelInvoked`, and that its provider tokens are recorded by no receipt is reported to the owner. A Degraded deployment is skipped by the router without a change to the constraints of a route plan. The inbox handler `DisableDeploymentOnRevocation` of `SecretBrokerService/SecretReferenceRevoked` takes every deployment of the tenant whose `endpointRef` resolves to the revoked reference out of routing at once: an Approved one moves to Degraded with `healthy` false, by the same transition as a failed probe, and stays there while no credential can be issued for it. Whether a revoked reference should retire the deployment instead is reported to the owner. The aggregate implements the transitions Approved to Retired and Degraded to Retired through the trigger `Retire`; a Retired deployment is terminal and never routed. The model names no operation, command or consumed event that retires a deployment, although the scope `factory.models.admin` names retiring, so the transition is unit-tested and announced when applied, no route calls it in this delivery, and that is reported to the owner. `DeploymentStateChanged` is published on `model-access.deployments.v1.deployment-state-changed` with `deploymentId`, `tenantId`, `fromState`, which is absent only for a registration, `toState` and `healthy`; the event of an approval also carries `approvalBasis`, which is capability-suite for the approval of this PBI, and the event of an approval by attestation carries the stated `approvalReason` and `attestedBy` as well, so that the audit record of an approval holds its basis (decision D123); this PBI proves what the publisher can prove, and StudioBff, DashboardService and AuditService, which records each change as evidence, handle it in their own PBIs. Kind: behavior. Traces: services: ModelRouterService, SecretBrokerService, PolicyEngineService; aggregates: ModelRouterService/ModelDeployment; apis: ModelRouterService/ApproveDeployment, SecretBrokerService/SecretBroker.Issue, PolicyEngineService/Policy.Decide; events: ModelRouterService/DeploymentStateChanged, SecretBrokerService/SecretReferenceRevoked; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: NFR-11, XL-08, XL-16; scenarios: SCN-ModelRouterService-006, SCN-ModelRouterService-015. Relates: screens: model-profiles. Depends on: AIFACTORY-US-567, AIFACTORY-US-568, AIFACTORY-US-570, AIFACTORY-US-571, feature:secret-broker-service, feature:policy-engine-service. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/governance/SecretBrokerService.yaml, model/services/governance/PolicyEngineService.yaml, docs/architecture/adr/0021-quality-gates.md, docs/planes/model-compute/capability-router.md, docs/planes/model-compute/services/model-router-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given a Platform admin with `factory.models.admin` and an Evaluated deployment of the tenant whose license metadata permits the use and whose capability scores meet the thresholds of every active profile that lists it, when `ModelRouterService/ApproveDeployment` is called, then the response is 200, the `ModelRouterService/ModelDeployment` is Approved with the approval basis capability-suite, the `ModelRouterService/DeploymentStateChanged` outbox record with `fromState` Evaluated, `toState` Approved and `approvalBasis` capability-suite is written in the same transaction, and the deployment is routable while it is healthy; a second call returns 200 and writes nothing (SCN-ModelRouterService-006, ADR-0021).",
        "AC2: Given a caller without `factory.models.admin` or without the Platform admin role, a `deploymentId` of another tenant, a deployment that is Candidate, Degraded or Retired, or an Evaluated one with a forbidding license or a score below a threshold of a profile that lists it, when `ModelRouterService/ApproveDeployment` is called, then the answer is 403, 404, 409 or 412 respectively, the 412 naming the failed check, the profile and the capability, the state does not change and nothing is published (SCN-ModelRouterService-006, ADR-0015).",
        "AC3: Given an Approved deployment whose provider stops answering, when the `DeploymentHealthProbe` runs with a decision of `PolicyEngineService/Policy.Decide` and a credential that `SecretBrokerService/SecretBroker.Issue` issued for the purpose `model-invoke` under that decision, and both attempts of the provider call fail, then the deployment is Degraded with `healthy` false and `ModelRouterService/DeploymentStateChanged` is written in the same transaction; when a later probe succeeds, then it is Approved with `healthy` true and the event is written again; when the decision or the issuance does not answer, then the probe of that deployment is skipped, its state and `healthy` stay unchanged, the skip is logged and counted and the next window probes again; a probe that confirms the state writes nothing, the same probe window fired twice probes once, and no receipt is written for a probe (SCN-ModelRouterService-015, XL-16).",
        "AC4: Given an Approved deployment whose `endpointRef` resolves to a secret reference and `SecretBrokerService/SecretReferenceRevoked` for that reference, when the `DisableDeploymentOnRevocation` handler runs, then the deployment is Degraded with `healthy` false, `ModelRouterService/DeploymentStateChanged` is written in the same transaction, the router skips it from then on, a deployment of another reference is untouched and a redelivery of the same event id has no second effect (SCN-ModelRouterService-015, ADR-0012).",
        "AC5: Given any transition of the deployment was applied, the trigger `Retire` out of Approved and out of Degraded in the unit tests among them, when the outbox dispatcher publishes `ModelRouterService/DeploymentStateChanged` on `model-access.deployments.v1.deployment-state-changed`, then the event is sent in the run event envelope with `deploymentId`, `tenantId`, `fromState`, `toState` and `healthy` and, for an approval, `approvalBasis`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ModelRouterService-015, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/services/model-router-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2290",
        "AIFACTORY-TASK-2291",
        "AIFACTORY-TASK-2292"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6008,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService",
          "SecretBrokerService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "ModelRouterService/ModelDeployment"
        ],
        "apis": [
          "ModelRouterService/ApproveDeployment",
          "SecretBrokerService/SecretBroker.Issue",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "ModelRouterService/DeploymentStateChanged",
          "SecretBrokerService/SecretReferenceRevoked"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "NFR-11",
          "XL-08",
          "XL-16"
        ],
        "scenarios": [
          "SCN-ModelRouterService-006",
          "SCN-ModelRouterService-015"
        ]
      },
      "relates": {
        "screens": [
          "model-profiles"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-567",
        "AIFACTORY-US-568",
        "AIFACTORY-US-570",
        "AIFACTORY-US-571",
        "feature:secret-broker-service",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/services/model-router-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-572]",
      "number": 572
    },
    {
      "id": "AIFACTORY-TASK-2290",
      "type": "task",
      "parent": "AIFACTORY-US-572",
      "title": "ApproveDeployment with the state, license and threshold checks",
      "sequence": "03.02.08.01",
      "description": "ApproveDeployment with the state, license and threshold checks. Expected output: ApproveDeployment checks scope and the Platform admin role, finds the deployment under the tenant filter (404), requires the state Evaluated (409, and 200 without effect for an Approved one), evaluates the license rule over the four license fields and the capability scores against requiredCapabilities of every active profile that lists the deployment (412 with the failed check, the profile and the capability named), and applies PlatformAdminApproval, which records the approval basis capability-suite (D121), with the DeploymentStateChanged outbox record, whose payload carries approvalBasis capability-suite (D123), in one transaction under the row version; the license rule is one replaceable rule whose content waits for the decision of the owner.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "ApproveDeployment checks scope and the Platform admin role, finds the deployment under the tenant filter (404), requires the state Evaluated (409, and 200 without effect for an Approved one), evaluates the license rule over the four license fields and the capability scores against requiredCapabilities of every active profile that lists the deployment (412 with the failed check, the profile and the capability named), and applies PlatformAdminApproval, which records the approval basis capability-suite (D121), with the DeploymentStateChanged outbox record, whose payload carries approvalBasis capability-suite (D123), in one transaction under the row version; the license rule is one replaceable rule whose content waits for the decision of the owner."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6008,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2290]",
      "number": 2290
    },
    {
      "id": "AIFACTORY-TASK-2291",
      "type": "task",
      "parent": "AIFACTORY-US-572",
      "title": "DeploymentHealthProbe, the DisableDeploymentOnRevocation handler and the Retire transition",
      "sequence": "03.02.08.02",
      "description": "DeploymentHealthProbe, the DisableDeploymentOnRevocation handler and the Retire transition. Expected output: For each Approved or Degraded deployment the probe asks Policy.Decide once per deployment and probe window, passes the decision id and the purpose model-invoke to SecretBroker.Issue and sends a minimal request through the adapter with the one credential issued for that probe; when Policy.Decide or SecretBroker.Issue does not answer, or the decision denies, the probe of that deployment is skipped, its state and healthy stay unchanged, the skip is logged with the deployment and the dependency named and counted, and the next window probes again; only a provider call that fails on both attempts, or an issuance refused for a revoked reference, is a failed probe; the probe applies HealthProbeFailed or HealthProbeRecovered with a DeploymentStateChanged outbox record in the same transaction, writes nothing when the state is confirmed, sets connectsoft.factory.model_gateway.provider_health and records latency, and writes no receipt; the handler of SecretReferenceRevoked moves the Approved deployments whose endpointRef resolves to the revoked reference to Degraded with healthy false, idempotent on the event id; the aggregate applies Retire out of Approved and Degraded with its event, and no route calls it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "For each Approved or Degraded deployment the probe asks Policy.Decide once per deployment and probe window, passes the decision id and the purpose model-invoke to SecretBroker.Issue and sends a minimal request through the adapter with the one credential issued for that probe; when Policy.Decide or SecretBroker.Issue does not answer, or the decision denies, the probe of that deployment is skipped, its state and healthy stay unchanged, the skip is logged with the deployment and the dependency named and counted, and the next window probes again; only a provider call that fails on both attempts, or an issuance refused for a revoked reference, is a failed probe; the probe applies HealthProbeFailed or HealthProbeRecovered with a DeploymentStateChanged outbox record in the same transaction, writes nothing when the state is confirmed, sets connectsoft.factory.model_gateway.provider_health and records latency, and writes no receipt; the handler of SecretReferenceRevoked moves the Approved deployments whose endpointRef resolves to the revoked reference to Degraded with healthy false, idempotent on the event id; the aggregate applies Retire out of Approved and Degraded with its event, and no route calls it."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6008,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2291]",
      "number": 2291
    },
    {
      "id": "AIFACTORY-TASK-2292",
      "type": "task",
      "parent": "AIFACTORY-US-572",
      "title": "Verify the approval, the health probe and the state change event through the acceptance suite",
      "sequence": "03.02.08.03",
      "description": "Verify the approval, the health probe and the state change event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-006|Scenario=SCN-ModelRouterService-015)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-572 with deployments in every state, a forbidding license, a score below a threshold of a listing profile, the scripted provider adapter failing and recovering under the probe, fakes of Policy.Decide and SecretBroker.Issue that stop answering during a probe window, after which the deployment is still Approved and healthy, the skip is logged and counted and the next window probes it, an issuance refused for a revoked reference, which counts as a failed probe, the decision id and the purpose model-invoke received by the fake of SecretBroker.Issue, one probe window fired twice, a fixture publisher of SecretReferenceRevoked, the unit tests of Retire and the publication and payload of DeploymentStateChanged; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-006|Scenario=SCN-ModelRouterService-015)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-572 with deployments in every state, a forbidding license, a score below a threshold of a listing profile, the scripted provider adapter failing and recovering under the probe, fakes of Policy.Decide and SecretBroker.Issue that stop answering during a probe window, after which the deployment is still Approved and healthy, the skip is logged and counted and the next window probes it, an issuance refused for a revoked reference, which counts as a failed probe, the decision id and the purpose model-invoke received by the fake of SecretBroker.Issue, one probe window fired twice, a fixture publisher of SecretReferenceRevoked, the unit tests of Retire and the publication and payload of DeploymentStateChanged; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6008,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2292]",
      "number": 2292
    },
    {
      "id": "AIFACTORY-US-757",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Approve a Candidate or an Evaluated deployment by attestation of a Platform admin with a required reason, keep the basis of the approval and announce the state change with it",
      "sequence": "03.02.09",
      "description": "As a platform admin, I want to approve a deployment on my stated reason while no capability suite can evaluate it, so that the first deployment of an instance becomes routable through an audited act and its approval is known to rest on an attestation and not on evidence. A deployment is routable only when it is Approved and healthy, and `ApproveDeployment` approves only an Evaluated deployment on capability evidence (AIFACTORY-US-572). In this increment no service runs the capability suite, so no deployment of a deployed instance reaches Evaluated. Decision D121 therefore gives the model a second approval: a Platform admin approves a deployment by attestation, and that is how the first Approved deployment of an instance comes into being. The attestation is allowed from Candidate and from Evaluated (decision D123), so a deployment that capability evidence moved to Evaluated can be attested as well. A Platform admin, with a user token whose scope carries `factory.models.admin`, calls the gateway route of `AttestDeployment`, POST /factory/model-deployments/{deploymentId}/attest, with a body that states the reason. It is a publication-class action whose gate is in this service and not in the gateway. The service checks, in this order: the caller holds the scope and the Platform admin role, and a caller without either, an Observer who holds the scope among them, is answered 403; the body states a reason that is not empty, and a body without one is answered 400; the deployment exists in the tenant of the token, and a `deploymentId` of another tenant or one that does not exist is answered 404 (ADR-0015 amendment D113); the deployment is in state Candidate or Evaluated, and a Degraded or a Retired deployment and one that was Approved on capability evidence is answered 409 with the state named. No capability evidence is asked for and no capability score is read; the scores an Evaluated deployment already holds are kept and decide nothing here. The invariant on license metadata holds for every approval, and an attestation is no exception: a deployment whose license metadata forbids the intended use is never Approved. A deployment whose license forbids the use is answered 409 (decision D123), with a problem response that names the license check, under the one license rule of AIFACTORY-US-572. On success the deployment moves from Candidate or from Evaluated to Approved through the trigger `PlatformAdminAttestation`, under optimistic concurrency on the row version, and keeps the basis of its approval: `approvalBasis` is attestation, `approvalReason` is the stated reason and `attestedBy` is the subject of the token. The `DeploymentStateChanged` outbox record with `fromState` Candidate or Evaluated, `toState` Approved, `healthy`, `approvalBasis` attestation, the stated `approvalReason` and `attestedBy` is written in the same transaction, and the response is 200 with the deployment. The operation is naturally idempotent: a repeated call for a deployment that is already Approved on the basis attestation answers 200 without effect (decision D123), so nothing changes, nothing is published, and the reason and the attesting subject of the first call stay as they are. A deployment approved by attestation is routable like any Approved deployment: the router lists it as a candidate without capability scores (AIFACTORY-US-573), the `DeploymentHealthProbe` keeps it Approved or Degraded, and a revoked secret reference takes it out of routing (AIFACTORY-US-572). Capability evidence that arrives later is imported into its scores and leaves its state and its basis unchanged (AIFACTORY-US-571). The deployment view of `ListModelDeployments` and of the 200 of this operation shows the three approval fields, so that an operator sees on which basis a deployment answers runs. The act is audited. AuditService records `DeploymentStateChanged` as evidence, and the event is the evidence path the model gives this service. Since decision D123 its payload carries, beside the deployment, the tenant, the two states and the health, the optional members `approvalBasis`, `approvalReason` and `attestedBy`, so that the audit record of the approval holds the basis, the reason and who attested; the three values are also kept on the deployment, where a read returns them. The attestation is the approval of I1 and no lasting substitute for evidence: arriving in I4, the capability suite evidence is required for a new approval and the deployments approved by attestation are evaluated again (decision D121). Neither rule is built here, and `approvalBasis` is what lets that later work find the attested deployments. This PBI proves what the publisher can prove for the event of the attestation; AIFACTORY-US-572 traces the scenario of `DeploymentStateChanged`, and StudioBff, DashboardService and AuditService handle the event in their own PBIs. Kind: behavior. Traces: services: ModelRouterService; aggregates: ModelRouterService/ModelDeployment; apis: ModelRouterService/AttestDeployment; events: ModelRouterService/DeploymentStateChanged; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: NFR-11, XL-08; scenarios: SCN-ModelRouterService-020. Relates: screens: model-profiles. Depends on: AIFACTORY-US-567, AIFACTORY-US-570, AIFACTORY-US-572, AIFACTORY-US-573. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/governance/AuditService.yaml, docs/architecture/adr/0021-quality-gates.md, docs/planes/model-compute/capability-router.md, docs/planes/model-compute/services/model-router-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given a Platform admin with `factory.models.admin` and a Candidate or an Evaluated deployment of the tenant whose license metadata permits the use, when `ModelRouterService/AttestDeployment` is called with a reason, then the response is 200, the `ModelRouterService/ModelDeployment` is Approved with `approvalBasis` attestation, the stated `approvalReason` and the subject of the token as `attestedBy`, the `ModelRouterService/DeploymentStateChanged` outbox record with `fromState` Candidate or Evaluated, `toState` Approved, `approvalBasis` attestation, the stated `approvalReason` and `attestedBy` is written in the same transaction, and no capability evidence was asked for and no capability score read; a second call answers 200 without effect, writes nothing and publishes nothing (SCN-ModelRouterService-020, ADR-0021).",
        "AC2: Given a caller without `factory.models.admin` or without the Platform admin role, a body without a reason, a `deploymentId` of another tenant or one that does not exist, a deployment that is Degraded, Retired or Approved on the basis capability-suite, or a Candidate or an Evaluated one whose license metadata forbids the use, when `ModelRouterService/AttestDeployment` is called, then the answer is 403, 400, 404, 409 or 409 respectively, the 404 the same in both cases and the last 409 naming the license check; the state and the approval fields of the deployment do not change and nothing is published (SCN-ModelRouterService-020, ADR-0015).",
        "AC3: Given a deployment approved by attestation, when a route plan is resolved for a profile that lists it, the `DeploymentHealthProbe` runs and the deployments of the tenant are listed, then the deployment is a candidate of the plan like any Approved deployment although it has no capability score, the probe moves it between Approved and Degraded as it does every Approved deployment, and the deployment view shows its approval basis, its reason and the attesting subject; capability evidence imported later adds scores and changes neither its state nor its basis (SCN-ModelRouterService-020, model/services/model-compute/ModelRouterService.yaml).",
        "AC4: Given the attestation was committed, when the outbox dispatcher publishes `ModelRouterService/DeploymentStateChanged` on `model-access.deployments.v1.deployment-state-changed`, then the event is sent in the run event envelope with `deploymentId`, `tenantId`, `fromState` Candidate or Evaluated, `toState` Approved, `healthy`, `approvalBasis` attestation, `approvalReason` and `attestedBy`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; the event, with the basis, the reason and the attesting subject, is what AuditService records as the evidence of the act, as model/services/governance/AuditService.yaml lists its handler (SCN-ModelRouterService-020, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/services/model-router-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3055",
        "AIFACTORY-TASK-3056",
        "AIFACTORY-TASK-3057"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6009,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService"
        ],
        "aggregates": [
          "ModelRouterService/ModelDeployment"
        ],
        "apis": [
          "ModelRouterService/AttestDeployment"
        ],
        "events": [
          "ModelRouterService/DeploymentStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "NFR-11",
          "XL-08"
        ],
        "scenarios": [
          "SCN-ModelRouterService-020"
        ]
      },
      "relates": {
        "screens": [
          "model-profiles"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-567",
        "AIFACTORY-US-570",
        "AIFACTORY-US-572",
        "AIFACTORY-US-573"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/services/model-router-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-757]",
      "number": 757
    },
    {
      "id": "AIFACTORY-TASK-3055",
      "type": "task",
      "parent": "AIFACTORY-US-757",
      "title": "Contract of the attestation and of the approval fields in the deployment view",
      "sequence": "03.02.09.01",
      "description": "Contract of the attestation and of the approval fields in the deployment view. Expected output: The OpenAPI document of the service fixes the request of AttestDeployment, a body with the one required member reason, its response codes 200, 400, 403, 404 and 409 of model/services/model-compute/ModelRouterService.yaml with their problem responses, the 409 of a forbidding license told apart from the 409 of a state by its problem type, and adds approvalBasis with the values attestation and capability-suite, approvalReason and attestedBy to the deployment view of AIFACTORY-TASK-2284, all three absent until the deployment is Approved; the event contract of DeploymentStateChanged gains the same three optional members, present on the event of an approval (D123); it records that a repeated call for a deployment already Approved on the basis attestation returns 200 without effect.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service fixes the request of AttestDeployment, a body with the one required member reason, its response codes 200, 400, 403, 404 and 409 of model/services/model-compute/ModelRouterService.yaml with their problem responses, the 409 of a forbidding license told apart from the 409 of a state by its problem type, and adds approvalBasis with the values attestation and capability-suite, approvalReason and attestedBy to the deployment view of AIFACTORY-TASK-2284, all three absent until the deployment is Approved; the event contract of DeploymentStateChanged gains the same three optional members, present on the event of an approval (D123); it records that a repeated call for a deployment already Approved on the basis attestation returns 200 without effect."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6009,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3055]",
      "number": 3055
    },
    {
      "id": "AIFACTORY-TASK-3056",
      "type": "task",
      "parent": "AIFACTORY-US-757",
      "title": "AttestDeployment with the role, reason, state and license checks and the kept basis of the approval",
      "sequence": "03.02.09.02",
      "description": "AttestDeployment with the role, reason, state and license checks and the kept basis of the approval. Expected output: AttestDeployment checks scope and the Platform admin role (403), requires a reason that is not empty (400), finds the deployment under the tenant filter (404), requires the state Candidate or Evaluated (D123; 409 for every other state, and 200 without effect and without an event for a deployment already Approved on the basis attestation), evaluates the license rule of AIFACTORY-TASK-2290 (409 with the license check named), asks for no capability evidence, and applies PlatformAdminAttestation with approvalBasis attestation, the reason, the subject of the token as attestedBy and the DeploymentStateChanged outbox record (fromState Candidate or Evaluated, toState Approved, approvalBasis, approvalReason and attestedBy) in one transaction under the row version; the deployment view of the 200 and of ListModelDeployments returns the three approval fields.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "AttestDeployment checks scope and the Platform admin role (403), requires a reason that is not empty (400), finds the deployment under the tenant filter (404), requires the state Candidate or Evaluated (D123; 409 for every other state, and 200 without effect and without an event for a deployment already Approved on the basis attestation), evaluates the license rule of AIFACTORY-TASK-2290 (409 with the license check named), asks for no capability evidence, and applies PlatformAdminAttestation with approvalBasis attestation, the reason, the subject of the token as attestedBy and the DeploymentStateChanged outbox record (fromState Candidate or Evaluated, toState Approved, approvalBasis, approvalReason and attestedBy) in one transaction under the row version; the deployment view of the 200 and of ListModelDeployments returns the three approval fields."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6009,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3056]",
      "number": 3056
    },
    {
      "id": "AIFACTORY-TASK-3057",
      "type": "task",
      "parent": "AIFACTORY-US-757",
      "title": "Verify the approval by attestation through the acceptance suite",
      "sequence": "03.02.09.03",
      "description": "Verify the approval by attestation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-020\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-757 with a two-tenant fixture, the role matrix of Platform admin, Observer and Requester, a body without a reason and with an empty one, deployments in every state, a Candidate and an Evaluated one that are attested, one Approved on the basis capability-suite, a Candidate and an Evaluated one with a forbidding license, a repeated attestation that publishes nothing, a route plan that lists the attested deployment without capability scores, the scripted provider failing and recovering under the probe for the attested deployment, evidence imported after the attestation, the deployment view with its three approval fields, and the publication and payload of DeploymentStateChanged with fromState Candidate or Evaluated, toState Approved, approvalBasis attestation, approvalReason and attestedBy; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-020\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-757 with a two-tenant fixture, the role matrix of Platform admin, Observer and Requester, a body without a reason and with an empty one, deployments in every state, a Candidate and an Evaluated one that are attested, one Approved on the basis capability-suite, a Candidate and an Evaluated one with a forbidding license, a repeated attestation that publishes nothing, a route plan that lists the attested deployment without capability scores, the scripted provider failing and recovering under the probe for the attested deployment, evidence imported after the attestation, the deployment view with its three approval fields, and the publication and payload of DeploymentStateChanged with fromState Candidate or Evaluated, toState Approved, approvalBasis attestation, approvalReason and attestedBy; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6009,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3057]",
      "number": 3057
    },
    {
      "id": "AIFACTORY-US-573",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Resolve the route plan of a run and profile once under the policy revision in force, preview it without persisting, and announce the resolved plan",
      "sequence": "03.02.10",
      "description": "As an operator, I want every attempt of a run to route the same way, and to see why a deployment was or was not a candidate, so that a changed policy or a new deployment never changes a run in flight and a routing decision can be explained. A route plan is the ordered list of deployments one run may use for one profile; it is resolved once and reused by every attempt, so that every attempt routes the same way and a changed policy affects future runs only. AgentRuntimeService, with a workload identity whose token holds the service scope that names ModelRouterService, calls the internal gRPC method `ModelGateway.ResolveRoutePlan` through the gateway with the tenant and project of the run, forwarded and read only under that scope (ADR-0015 amendment D114), the `runId`, the `profileId` with the profile version the run pinned at acceptance, the policy revision the run pinned, the classification of the data and the capabilities the run needs. The router loads the active profile version the tenant can read, asks `PolicyEngineService/Policy.Decide` for the decision on profile, data class, region and tools under the policy revision the request names, which is the revision in force for the run and not the one that happens to be active when the call arrives, and builds the candidates from `allowedDeployments` of the profile. It keeps the deployments in state Approved or Degraded that the tenant row filter admits, whose privacy class is the class of the profile or a stricter one, whose region is in `allowedRegions`, that the decision permits, whose capability scores meet `requiredCapabilities` and whose provider value has a loaded adapter, so that a deployment of the provider `self-hosted`, which no adapter serves in this delivery (AIFACTORY-US-570), is excluded with that reason; a Degraded deployment stays a candidate, because health is checked at invocation and does not change the constraints. A deployment approved by attestation is routable like any Approved deployment (decision D121, AIFACTORY-US-757): it passes the capability filter on its attestation instead of on scores; one attested from Candidate has no capability scores, and its capability term in the ordering is neutral, like every term without a value. One attested from Evaluated (decision D123) holds scores, and whether they take part in the filter and in the ordering of an attested deployment is not stated by the decision and is reported to the owner. How the ordering ranks an attested deployment against an evaluated one beyond that is not stated by the decision and is reported to the owner. It orders them by the weights of `ModelAccess:Routing:Weights` (capability, cost, latency, history) and keeps the preference order of `allowedDeployments` between equal scores. Only the capability term has a source in the store of the service, the capability scores; the model names no source for the cost, latency and history terms, so a term without a value is neutral, and the point is reported to the owner. When the profile enables fallback, the deployments of the profiles in its `fallbackChain` that satisfy the same constraints are appended at resolution, never at invocation (AIFACTORY-US-575). The plan is written to `RoutePlans` with run, tenant, the project and the classification of the request, profile, profile version, policy revision, candidates, constraints (privacy class, region, tool and output guarantees) and the time, together with the `RoutePlanResolved` outbox record, in one transaction. The project and the classification are kept in the columns `ProjectId` and `Classification` because a run-bound call of the OpenAI-compatible route takes them, with the pinned profile version, from this plan (decision D125, AIFACTORY-US-574). The method is idempotent per run and profile under the unique index over both: a repeated call with the same input returns the stored plan, writes nothing and asks for no second decision. The same key with a different input is a conflict (ADR-0014 decision 3): a repeated call for the same run and profile whose profile version, policy revision, classification or capabilities differ from those of the stored plan, which keeps the first three in its columns and the capabilities in its constraints, is refused with FAILED_PRECONDITION and the differing field named, the status an idempotency key reused with another request hash has in `Invoke`; the stored plan stays unchanged and nothing is published. The reply names the route plan, the profile version and the candidates. The model declares `model-invocation-v1` as request and reply of the four gRPC methods; the schema of that descriptor has no field for a route plan, for chat content, for vectors or for rerank scores, so the proto of the service carries the descriptor as the header of each message and adds the fields a method needs, which is fixed by the contract task of this PBI and reported to the owner. A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, an invalid request with INVALID_ARGUMENT, and a profile that is unknown, retired or of another tenant with NOT_FOUND, which an attempt takes as the failure class permanent. A decision that denies the profile for the scope is answered PERMISSION_DENIED with the decision id and counted in `connectsoft.factory.model_gateway.denials`. When PolicyEngineService does not answer, the call fails closed with UNAVAILABLE and no plan is written. When no deployment passes the filters, the call is refused with FAILED_PRECONDITION and the excluded deployments with their reasons, and no empty plan is stored; the error detail tells this refusal from the conflict of a repeated call. `RoutePlanResolved` is published on `model-access.routing.v1.route-plan-resolved` with `routePlanId`, `runId`, `tenantId`, `profileId` and `candidates`; DashboardService projects it in its own PBI. A caller whose scope carries `factory.models.read` dry-runs the router through the gateway route of `PreviewRoutePlan` for a profile and a scope: the response is 200 with the candidates in order, the filters applied and, for every excluded deployment, the reason. The preview runs the same filters and scoring and asks for the same decision, persists no plan and publishes nothing. A `profileId` that is unknown, retired or of another tenant is answered 404, a missing scope 403, and an unreachable policy engine 503, because no route is shown without a decision. Kind: behavior. Traces: services: ModelRouterService, PolicyEngineService; aggregates: ModelRouterService/RoutePlan, ModelRouterService/ModelProfile, ModelRouterService/ModelDeployment; apis: ModelRouterService/ModelGateway.ResolveRoutePlan, ModelRouterService/PreviewRoutePlan, PolicyEngineService/Policy.Decide; events: ModelRouterService/RoutePlanResolved; descriptors: model-invocation-v1, policy-decision-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-04, XL-04; scenarios: SCN-ModelRouterService-007, SCN-ModelRouterService-009, SCN-ModelRouterService-017. Relates: screens: model-profiles. Depends on: AIFACTORY-US-567, AIFACTORY-US-569, AIFACTORY-US-572, feature:policy-engine-service. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/governance/PolicyEngineService.yaml, docs/reference/schemas/model-invocation.schema.json, docs/planes/model-compute/capability-router.md, docs/planes/model-compute/workflows.md, docs/planes/model-compute/services/model-router-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a workload identity with the service scope, an active profile version and allowed deployments of which one is Approved, one Degraded, one Candidate, one of a weaker privacy class and one outside the allowed regions, when `ModelRouterService/ModelGateway.ResolveRoutePlan` is called for a run, then `PolicyEngineService/Policy.Decide` is asked once under the policy revision the request names, the `ModelRouterService/RoutePlan` holds the Approved and the Degraded deployment in score order with the constraints, the policy revision and the project and the classification of the request, the `ModelRouterService/RoutePlanResolved` outbox record is written in the same transaction and the reply names the plan, the profile version and the candidates (SCN-ModelRouterService-009, ADR-0014, FR-04).",
        "AC2: Given a resolved plan of a run and profile, when `ModelRouterService/ModelGateway.ResolveRoutePlan` is called again for the same run and profile with the same profile version, policy revision, classification and capabilities, also after a new deployment was approved or a newer policy revision became active, then the stored plan is returned unchanged, no second plan and no second outbox record exists and no second decision is asked for; when it is called again for the same run and profile with another profile version, policy revision, classification or capability set, then the status is FAILED_PRECONDITION with the differing field named, the stored plan stays unchanged and nothing is published (SCN-ModelRouterService-009, XL-04, ADR-0014).",
        "AC3: Given a caller without a workload identity, a token without the service scope, an invalid request, a profile of another tenant or a retired one, a denying decision, no deployment that passes the filters, or a policy engine that does not answer, when `ModelRouterService/ModelGateway.ResolveRoutePlan` is called, then the status is UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND, PERMISSION_DENIED with the decision id, FAILED_PRECONDITION with the exclusion reasons, or UNAVAILABLE respectively, and no plan is written and nothing is published (SCN-ModelRouterService-009, ADR-0015).",
        "AC4: Given a plan was resolved, when the outbox dispatcher publishes `ModelRouterService/RoutePlanResolved` on `model-access.routing.v1.route-plan-resolved`, then the event is sent in the run event envelope with `routePlanId`, `runId`, `tenantId`, `profileId` and `candidates`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ModelRouterService-017, ADR-0012).",
        "AC5: Given a caller with `factory.models.read` and the deployments of AC1, when `ModelRouterService/PreviewRoutePlan` is called for the profile and a scope, then the response is 200 with the same candidates in the same order as a resolution would produce, the filters applied and the reason of exclusion of each other deployment, no `ModelRouterService/RoutePlan` is written and nothing is published; a `profileId` of another tenant is answered 404, a missing scope 403 and an unreachable policy engine 503 (SCN-ModelRouterService-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2293",
        "AIFACTORY-TASK-2294",
        "AIFACTORY-TASK-2295",
        "AIFACTORY-TASK-2296"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6010,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "ModelRouterService/RoutePlan",
          "ModelRouterService/ModelProfile",
          "ModelRouterService/ModelDeployment"
        ],
        "apis": [
          "ModelRouterService/ModelGateway.ResolveRoutePlan",
          "ModelRouterService/PreviewRoutePlan",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "ModelRouterService/RoutePlanResolved"
        ],
        "descriptors": [
          "model-invocation-v1",
          "policy-decision-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-04",
          "XL-04"
        ],
        "scenarios": [
          "SCN-ModelRouterService-007",
          "SCN-ModelRouterService-009",
          "SCN-ModelRouterService-017"
        ]
      },
      "relates": {
        "screens": [
          "model-profiles"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-567",
        "AIFACTORY-US-569",
        "AIFACTORY-US-572",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-573]",
      "number": 573
    },
    {
      "id": "AIFACTORY-TASK-2293",
      "type": "task",
      "parent": "AIFACTORY-US-573",
      "title": "Proto of the ModelGateway service and its mapping onto model-invocation-v1",
      "sequence": "03.02.10.01",
      "description": "Proto of the ModelGateway service and its mapping onto model-invocation-v1. Expected output: The proto of the service fixes the request and reply messages of ResolveRoutePlan, Invoke, Embed and Rerank: each request carries the fields of model-invocation-v1 of docs/reference/schemas/model-invocation.schema.json as its header, the run and the attempt as optional members (D123), and the messages add what the schema does not hold, that is the route plan, profile version and candidates of a resolution, the messages, tool definitions and stream items of an invocation, and the vectors and scores of Embed and Rerank; the document records which fields a caller sends and which the service assigns, the mapping of the receipt statuses of the schema onto the five outcomes and three usage statuses of the model, and the gRPC status of every refusal in one table: UNAUTHENTICATED without a workload identity; PERMISSION_DENIED without the service scope and for a denying decision; INVALID_ARGUMENT for an invalid request, a capability the profile lacks and a profile of another modality; NOT_FOUND, failure class permanent, for a profile the tenant cannot read and for a `runId` for which the tenant of the caller holds no route plan of the profile, whether the run belongs to another tenant, does not exist or was never resolved; FAILED_PRECONDITION only for an idempotency key of Invoke, Embed or Rerank reused with another request hash, for a repeated ResolveRoutePlan of the same run and profile with a different input, and for a resolution in which no deployment passes the filters, each told apart by its error detail; DEADLINE_EXCEEDED for a provider call that exceeds the timeout or the deadline; UNAVAILABLE when PolicyEngineService or SecretBrokerService does not answer or no candidate is healthy; UNIMPLEMENTED for a rerank call whose deployment has no adapter behind the rerank adapter port; the request of ResolveRoutePlan names the policy revision the run pinned; golden files of the messages are checked in the pipeline.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The proto of the service fixes the request and reply messages of ResolveRoutePlan, Invoke, Embed and Rerank: each request carries the fields of model-invocation-v1 of docs/reference/schemas/model-invocation.schema.json as its header, the run and the attempt as optional members (D123), and the messages add what the schema does not hold, that is the route plan, profile version and candidates of a resolution, the messages, tool definitions and stream items of an invocation, and the vectors and scores of Embed and Rerank; the document records which fields a caller sends and which the service assigns, the mapping of the receipt statuses of the schema onto the five outcomes and three usage statuses of the model, and the gRPC status of every refusal in one table: UNAUTHENTICATED without a workload identity; PERMISSION_DENIED without the service scope and for a denying decision; INVALID_ARGUMENT for an invalid request, a capability the profile lacks and a profile of another modality; NOT_FOUND, failure class permanent, for a profile the tenant cannot read and for a `runId` for which the tenant of the caller holds no route plan of the profile, whether the run belongs to another tenant, does not exist or was never resolved; FAILED_PRECONDITION only for an idempotency key of Invoke, Embed or Rerank reused with another request hash, for a repeated ResolveRoutePlan of the same run and profile with a different input, and for a resolution in which no deployment passes the filters, each told apart by its error detail; DEADLINE_EXCEEDED for a provider call that exceeds the timeout or the deadline; UNAVAILABLE when PolicyEngineService or SecretBrokerService does not answer or no candidate is healthy; UNIMPLEMENTED for a rerank call whose deployment has no adapter behind the rerank adapter port; the request of ResolveRoutePlan names the policy revision the run pinned; golden files of the messages are checked in the pipeline."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6010,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2293]",
      "number": 2293
    },
    {
      "id": "AIFACTORY-TASK-2294",
      "type": "task",
      "parent": "AIFACTORY-US-573",
      "title": "Router filters and scoring, ResolveRoutePlan and the RoutePlanResolved event",
      "sequence": "03.02.10.02",
      "description": "Router filters and scoring, ResolveRoutePlan and the RoutePlanResolved event. Expected output: One routing function filters the allowed deployments of a profile by state, tenant, privacy class, region, policy decision, capability thresholds, which a deployment whose approval basis is attestation passes without scores (D121), and a loaded adapter for the provider value, orders them by the weights of ModelAccess:Routing:Weights with a neutral value for a term without a source and the preference order between equal scores, appends the candidates of the fallback chain when the profile enables fallback, and returns the candidates with the reason of every exclusion; ResolveRoutePlan asks Policy.Decide under the policy revision the request names, persists the plan with the RoutePlanResolved outbox record in one transaction, keeps the project and the classification of the request in the columns ProjectId and Classification of the plan (D125) and the capabilities in its constraints, returns the stored plan on a repeat for the same run and profile with the same input, refuses a repeat whose profile version, policy revision, classification or capabilities differ with FAILED_PRECONDITION and the differing field named without changing the stored plan or publishing anything, and maps its refusals to the gRPC statuses of the contract.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "One routing function filters the allowed deployments of a profile by state, tenant, privacy class, region, policy decision, capability thresholds, which a deployment whose approval basis is attestation passes without scores (D121), and a loaded adapter for the provider value, orders them by the weights of ModelAccess:Routing:Weights with a neutral value for a term without a source and the preference order between equal scores, appends the candidates of the fallback chain when the profile enables fallback, and returns the candidates with the reason of every exclusion; ResolveRoutePlan asks Policy.Decide under the policy revision the request names, persists the plan with the RoutePlanResolved outbox record in one transaction, keeps the project and the classification of the request in the columns ProjectId and Classification of the plan (D125) and the capabilities in its constraints, returns the stored plan on a repeat for the same run and profile with the same input, refuses a repeat whose profile version, policy revision, classification or capabilities differ with FAILED_PRECONDITION and the differing field named without changing the stored plan or publishing anything, and maps its refusals to the gRPC statuses of the contract."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6010,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2294]",
      "number": 2294
    },
    {
      "id": "AIFACTORY-TASK-2295",
      "type": "task",
      "parent": "AIFACTORY-US-573",
      "title": "PreviewRoutePlan as a dry run of the routing function",
      "sequence": "03.02.10.03",
      "description": "PreviewRoutePlan as a dry run of the routing function. Expected output: PreviewRoutePlan runs the routing function of AIFACTORY-TASK-2294 for a profile and a scope with the decision of Policy.Decide and returns the candidates in order, the filters applied and the exclusion reasons; it writes no plan and no outbox record; a profile of another tenant is answered 404, a missing scope 403 and an unreachable policy engine 503.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "PreviewRoutePlan runs the routing function of AIFACTORY-TASK-2294 for a profile and a scope with the decision of Policy.Decide and returns the candidates in order, the filters applied and the exclusion reasons; it writes no plan and no outbox record; a profile of another tenant is answered 404, a missing scope 403 and an unreachable policy engine 503."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6010,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2295]",
      "number": 2295
    },
    {
      "id": "AIFACTORY-TASK-2296",
      "type": "task",
      "parent": "AIFACTORY-US-573",
      "title": "Verify the resolution, the preview and the route plan event through the acceptance suite",
      "sequence": "03.02.10.04",
      "description": "Verify the resolution, the preview and the route plan event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-007|Scenario=SCN-ModelRouterService-009|Scenario=SCN-ModelRouterService-017)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-573 with a fake of Policy.Decide that permits, denies and stops answering, deployments in every state and of every excluded kind, a self-hosted deployment excluded because no adapter serves its provider, a deployment approved by attestation that is a candidate without capability scores, a repeat with the same input after a newer policy revision became active, a repeat for the same run and profile with another profile version, another policy revision, another classification and another capability set, each refused with FAILED_PRECONDITION while the stored plan and the outbox stay unchanged, a two-tenant fixture, the golden files of the proto and the publication and payload of RoutePlanResolved; consumer handling is proven by the suite of the consumer.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-007|Scenario=SCN-ModelRouterService-009|Scenario=SCN-ModelRouterService-017)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-573 with a fake of Policy.Decide that permits, denies and stops answering, deployments in every state and of every excluded kind, a self-hosted deployment excluded because no adapter serves its provider, a deployment approved by attestation that is a candidate without capability scores, a repeat with the same input after a newer policy revision became active, a repeat for the same run and profile with another profile version, another policy revision, another classification and another capability set, each refused with FAILED_PRECONDITION while the stored plan and the outbox stay unchanged, a two-tenant fixture, the golden files of the proto and the publication and payload of RoutePlanResolved; consumer handling is proven by the suite of the consumer."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6010,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2296]",
      "number": 2296
    },
    {
      "id": "AIFACTORY-US-574",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Invoke a chat model through the route plan under a policy decision and a brokered credential, stream the output and end with a receipt that names the deployment and the usage status",
      "sequence": "03.02.11",
      "description": "As a requester, I want every model call of my run to be allowed by policy, made with a brokered credential and recorded with the model that really answered and what it used, so that I can trust the cost and the provenance of what the Factory produced for me. An agent host calls a model only through the Factory model client of the AI libraries (feature `component-extensions-ai`) and the gateway; it never names a provider and never holds a provider credential. AgentRuntimeService, with a workload identity whose token holds the service scope that names ModelRouterService, calls the internal gRPC server stream `ModelGateway.Invoke` with `model-invocation-v1`: invocation id, profile, the trusted scope with tenant and project, run, step and attempt, the hash of the canonical request, an idempotency key, the classification, the capabilities asked for, the budget (input and output token limits, cost limit, deadline), the stream switch and the reference of an output schema when structured output is required. The messages and tool definitions travel in the request and are never stored. The pipeline has eight steps. First, the idempotency key is looked up within tenant and project: the same key with the same request hash returns the existing receipt and makes no second provider call, and the same key with another hash is refused with FAILED_PRECONDITION (ADR-0014 decision 3). Second, the route plan of the run and profile is read under the tenant row filter. The router holds no run: a run is known to it only through a route plan or a receipt of the tenant (AIFACTORY-US-577). A `runId` for which the tenant of the caller holds no route plan of that profile is therefore answered NOT_FOUND, failure class permanent for the attempt (ADR-0015 amendments D113 and D114), whether the run belongs to another tenant, does not exist or was never resolved: under the row filter the three cases are one observable condition, and one answer never confirms that a run exists elsewhere. Third, `PolicyEngineService/Policy.Decide` decides the invocation from profile, data class, region and the tools of the request under the policy revision of the plan, and its decision id goes on the receipt. The tool definitions of the request are part of that decision: a tool outside the set the decision permits for the caller, that is outside the closure of its release, makes the decision deny, so the pipeline refuses it as it refuses every denial and forwards no such tool to a provider. A denial writes a receipt with the outcome Denied, calls no adapter, counts `connectsoft.factory.model_gateway.denials` and ends the call with PERMISSION_DENIED and the decision id. The column `DeploymentId` of a receipt and the field `deploymentId` of `ModelInvoked` are required, and a denied call has no deployment that produced an output; the Denied receipt therefore names the first candidate of the route plan, the deployment the plan would have tried first, with no token count, and that the model gives a Denied receipt no deployment is reported as a model correction. When the policy engine does not answer the call fails closed with UNAVAILABLE and no adapter is called. Fourth, the first candidate of the plan that is Approved and healthy is chosen, and one short-lived credential for it is issued by `SecretBrokerService/SecretBroker.Issue`, which receives the decision id of step three and the purpose `model-invoke`; the credential serves this one invocation and is kept for no later one (the rule of AIFACTORY-US-568). When the broker does not answer the call fails fast with UNAVAILABLE. Fifth, the adapter of the provider, a keyed chat client of the pinned AI library, is called with streaming, tools and structured output, bounded by the lower of the token limits of the profile and of the budget and by the lower of `ModelAccess:Invocation:DefaultTimeoutSeconds` and the deadline, with provider prompt caching when `ModelAccess:Invocation:PromptCaching` is on and the adapter supports it, the cache keys being hashes. Sixth, tokens are streamed to the caller as they arrive and a cancellation of the caller is propagated to the adapter. Seventh, the output is stored by hash through `ArtifactService/Artifacts.Store` under the retention of the tenant and its reference goes on the receipt; when ArtifactService does not answer, the output still reaches the caller and the receipt carries no output reference. Eighth, the `InvocationReceipt` is written with invocation, tenant, project, run, attempt, profile, the deployment that produced the output, route plan, request hash, idempotency key, policy decision, outcome, usage status, tokens, latency and times, together with the `ModelInvoked` outbox record, in one transaction, and the stream ends with the receipt. The outcome is Completed, Partial, Failed, Denied or Cancelled. The usage status is Reported when the adapter response carries usage, with input and output tokens as the provider stated them, and Unknown when it carries none; Unknown is never written as zero, counts in `connectsoft.factory.model_gateway.usage_unknown` and waits for reconciliation (AIFACTORY-US-577). Three ends of a call other than completion are fixed here. When the provider exceeds the lower of `ModelAccess:Invocation:DefaultTimeoutSeconds` and the deadline before any output, the adapter call is cancelled, the receipt is Failed with usage Unknown and the status is DEADLINE_EXCEEDED. When the caller cancels before any output, the adapter call is cancelled and the receipt is Cancelled with usage Unknown. Neither proves that no billable work happened, which is why the usage is Unknown and never zero. When the call ends after output was emitted, by a cancellation of the caller, by a broken connection, which the router cannot tell from a cancellation, or by the timeout, the receipt is Partial under the rule of AIFACTORY-US-575. One case stays open. A replica of the router that stops after the adapter was reached and before the receipt was committed leaves no receipt, although the invariant of the model demands one for every invocation that reached an adapter. The outcome of a receipt is required and has five terminal values and none for a call in flight, so this delivery opens no receipt row before the adapter call; the caller repeats under the same idempotency key, finds no receipt and the call runs again, and the gap shows in the series of the objective `receipt-coverage` (AIFACTORY-US-568). How the invariant is kept across a stopped replica is reported to the owner. The receipt holds the `priceBasis` of the profile as its pricing revision. ModelRouterService owns no price table, so `estimatedCostUsd` stays empty and the cost limit of a budget is not evaluated by the router in this delivery; prices, units and estimation rules are inputs of the owner and are not invented, and the point is reported. After the commit the router calls `CostUsageService/Usage.RecordUsage` once per token meter with the receipt as the source. When CostUsageService does not answer, the call fails fast and is not repeated, the output and the receipt stand, and the usage reaches CostUsageService through `ModelInvoked`, which it records once per meter under the same receipt. CostUsageService stores a receipt without a valid price or with an unknown quantity as Uncertain and prices it later, so the router never keeps and repeats a receipt for a missing price, and a budget overrun stops only the run whose usage crossed the limit, through RunControlService and not through the router (D117, D119). The dependency row of the model also names reservation checks against the run budget; CostUsageService admits ModelRouterService to `Usage.RecordUsage` only and RunControlService reserves the budget of a run, so the router makes no reservation call, which is reported. Since decision D121 the method has a second caller. ModelGatewayHost serves the OpenAI-compatible route `CreateChatCompletion` (feature `model-gateway-host`), translates the call into `model-invocation-v1` and calls `ModelGateway.Invoke` with the token the caller presented, forwarded unchanged. The router validates that token again and accepts the audience of its own gateway (ADR-0015 amendment D117); the tenant of the call comes from the token and never from the message. A call of that route is of one of two kinds (decision D123), and the kind of token decides the kind of call (decision D125). A run-bound call presents the token of an attempt: the short-lived token that RunControlService hands out in the `attemptToken` member of the lease answer, which the Authorization Server issues by a token exchange (feature `component-auth-server-template-factory-tokens`) and which names the run, the step and the attempt in the claims `run_id`, `step_id` and `attempt_id` beside the tenant claim `tid`. The router takes run, step and attempt from those claims and never from the message. It is an invocation of that run: the router reads the route plan of the run and profile, and takes the project, the classification and the pinned profile version from that plan, which keeps the project and the classification of the request of `ResolveRoutePlan` (AIFACTORY-US-573); the pipeline runs its eight steps with that plan, the receipt carries the run and the attempt, the usage counts on the reservation of the run, and the receipt is listed with the other receipts of the run (AIFACTORY-US-577). A run of the token for which the tenant holds no route plan of the profile is answered NOT_FOUND like every unknown run. A call that presents a user token is a call outside a run, and the user token must carry the scope `factory.models.invoke`. A call outside a run names no run and no attempt, which are optional members of `model-invocation-v1`. Its project is the one the caller named in the `OpenAI-Project` header and the gateway checked against the roles of the token, and its classification is the one the gateway took from `ModelGateway:Protocols:OpenAiCompatibleClassification`. The candidates are resolved for the call under the same filters, the same policy decision and the same scoring as a resolution, with no plan persisted, the rule of a call outside a run (AIFACTORY-US-576). From there the pipeline is the one of steps three to eight, and the call produces a receipt like any other invocation, without run, attempt and route plan, with the tenant and the project of the call and with `ModelInvoked` in the same transaction. Its usage is recorded through `CostUsageService/Usage.RecordUsage` without a run, and CostUsageService meters it on the budget of the project without a reservation; the receipt is read back through the receipt read of the project, which needs no run (AIFACTORY-US-901). In both kinds the profile of the invocation is named by its model profile id, the model name the caller sent: for a run-bound call it resolves to the version pinned by the snapshot of the run, the version the route plan of the run and profile holds, and otherwise to the active version of the profile the tenant can read. A user token without `factory.models.invoke` is refused with PERMISSION_DENIED, and a model name that no profile the tenant can read answers to with NOT_FOUND. The router still makes no reservation call and evaluates no cost limit itself; what stops the calls outside a run of a project whose budget is above its limit is the budget mark (decision D125, AIFACTORY-US-1508). ModelRouterService keeps a mark for a project from `BudgetExceeded` of CostUsageService, whether or not the event names a run, and clears it on a `BudgetUpdated` that puts the committed amount at or below the limit or at the turn of the budget period. Before step three, while a mark is in force for the project of a call outside a run, the call is refused with RESOURCE_EXHAUSTED, which the gateway translates to 429, and no decision, credential, adapter call or receipt follows. A run-bound call is not refused by the mark, because the budget of a run is reserved and stopped by RunControlService. A call without a workload identity, without a forwarded user token and without the token of an attempt is refused with UNAUTHENTICATED, a workload token that is not the token of an attempt and lacks the service scope with PERMISSION_DENIED, a call outside a run of a project under a budget mark with RESOURCE_EXHAUSTED, with an invalid request, a capability the profile does not provide or a profile of another modality with INVALID_ARGUMENT, and for a profile the tenant cannot read, or a run for which the tenant holds no route plan of the profile, with NOT_FOUND, which the attempt takes as the failure class permanent. FAILED_PRECONDITION is the answer for one case only, the idempotency key reused with another request hash. `ModelInvoked` is published on `model-access.invocations.v1.model-invoked` with `invocationId`, `tenantId`, `projectId`, `runId` and `attemptId`, both absent for a call outside a run (decision D123), `profileId`, `deploymentId`, `outcome`, `usageStatus`, `inputTokens`, `outputTokens` and `estimatedCostUsd`, the three last absent when unknown; this PBI proves what the publisher can prove, and CostUsageService, DashboardService and QualityScoreService handle it in their own PBIs. No prompt, completion or tool output is stored in `model-router-sql`, logged, put on an activity or carried by the event (ADR-0019). The acceptance environment runs a scripted provider adapter in place of a commercial provider. Kind: behavior. Traces: services: ModelRouterService, PolicyEngineService, SecretBrokerService, CostUsageService, ArtifactService; aggregates: ModelRouterService/InvocationReceipt, ModelRouterService/RoutePlan; apis: ModelRouterService/ModelGateway.Invoke, PolicyEngineService/Policy.Decide, SecretBrokerService/SecretBroker.Issue, CostUsageService/Usage.RecordUsage, ArtifactService/Artifacts.Store; events: ModelRouterService/ModelInvoked; descriptors: model-invocation-v1, policy-decision-v1, usage-record-v1; adrs: ADR-0002, ADR-0012, ADR-0014, ADR-0015, ADR-0019; requirements: FR-04, FR-09, NFR-12, XL-04, XL-12; scenarios: SCN-ModelRouterService-010, SCN-ModelRouterService-018. Relates: screens: run-detail. Depends on: AIFACTORY-US-567, AIFACTORY-US-568, AIFACTORY-US-573, AIFACTORY-US-1508, feature:policy-engine-service, feature:secret-broker-service, feature:cost-usage-service-complete, feature:artifact-service, feature:component-extensions-ai, feature:component-auth-server-template-factory-tokens. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/control-plane/CostUsageService.yaml, docs/reference/schemas/model-invocation.schema.json, docs/reference/schemas/attempt-outcome.schema.json, docs/planes/model-compute/model-gateway.md, docs/planes/model-compute/security.md, docs/planes/model-compute/services/model-router-service/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given a workload identity with the service scope, a resolved route plan whose first candidate is Approved and healthy, a permitting decision and the scripted provider reporting usage, when `ModelRouterService/ModelGateway.Invoke` is called with a `model-invocation-v1` and the stream switch on, then `PolicyEngineService/Policy.Decide` and `SecretBrokerService/SecretBroker.Issue` are each called once, the second with the decision id of the first and the purpose `model-invoke`, the tokens reach the caller in order, the stream ends with the receipt, and the `ModelRouterService/InvocationReceipt` with the deployment that answered, the decision id, the outcome Completed and usage Reported is written together with the `ModelRouterService/ModelInvoked` outbox record in one transaction; given a user token forwarded by ModelGatewayHost whose scope carries `factory.models.invoke` and an invocation that names a profile by its model profile id and no run, when the method is called, then the receipt carries the tenant of the token and the project of the invocation, the active version of the profile is used, the candidates are resolved for the call, no `ModelRouterService/RoutePlan` is persisted, the receipt, without run, attempt and route plan, is written with its `ModelRouterService/ModelInvoked` record, and `CostUsageService/Usage.RecordUsage` receives the usage without a run; given the token of an attempt forwarded by ModelGatewayHost, whose claims `run_id`, `step_id` and `attempt_id` name a run with a resolved plan, then the run, the step and the attempt are taken from the claims, the project, the classification and the profile version are taken from the `ModelRouterService/RoutePlan` of the run and profile, and the receipt carries the run and the attempt; a user token without that scope is answered PERMISSION_DENIED and no adapter is called (SCN-ModelRouterService-010, ADR-0014, FR-04, docs/reference/schemas/attempt-outcome.schema.json).",
        "AC2: Given a completed invocation, when `ModelRouterService/ModelGateway.Invoke` is called again with the same idempotency key and the same request hash, then the existing receipt is returned and the provider is not called; with the same key and another hash the status is FAILED_PRECONDITION, the only case of that status; without a workload identity UNAUTHENTICATED, without the service scope PERMISSION_DENIED, with an invalid request or a capability the profile lacks INVALID_ARGUMENT; for a `runId` for which the tenant of the caller holds no route plan of the profile the status is NOT_FOUND, failure class permanent, the same answer whether the run belongs to another tenant, does not exist or was never resolved; for a call outside a run of a project under a budget mark the status is RESOURCE_EXHAUSTED, while a run-bound call of the same project is served; none of these refusals calls an adapter or writes a receipt (SCN-ModelRouterService-010, ADR-0015).",
        "AC3: Given a decision of `PolicyEngineService/Policy.Decide` that denies, for the profile or because the request holds a tool definition outside the set the decision permits, when the model is invoked, then a receipt with the outcome Denied, the decision id and, as its deployment, the first candidate of the route plan is written with its `ModelRouterService/ModelInvoked` record, no adapter is called, no tool definition reaches a provider and the status is PERMISSION_DENIED; given the policy engine or `SecretBrokerService/SecretBroker.Issue` does not answer, then the status is UNAVAILABLE and no adapter is called, because no invocation runs without a decision and a credential (SCN-ModelRouterService-010, XL-04).",
        "AC4: Given the scripted provider exceeds the lower of `ModelAccess:Invocation:DefaultTimeoutSeconds` and the deadline before any output, when `ModelRouterService/ModelGateway.Invoke` runs, then the adapter call is cancelled, the `ModelRouterService/InvocationReceipt` is Failed with usage Unknown and the status is DEADLINE_EXCEEDED; given the caller cancels before any output, then the adapter call is cancelled and the receipt is Cancelled with usage Unknown; given the call ends after output was emitted, by a cancellation of the caller, by a broken connection or by the timeout, then the receipt is Partial; in each case `ModelRouterService/ModelInvoked` is written with the receipt and no usage is written as zero (SCN-ModelRouterService-010, ADR-0014).",
        "AC5: Given a provider that reports no usage, when the invocation completes, then the receipt has the usage status Unknown and no token count, never zero, and `connectsoft.factory.model_gateway.usage_unknown` rises (SCN-ModelRouterService-018); given `CostUsageService/Usage.RecordUsage` fails after the commit, then the call is not repeated, the output and the receipt stand and the router keeps no pending receipt (FR-09, model/services/control-plane/CostUsageService.yaml); given a receipt was written, when the outbox dispatcher publishes `ModelRouterService/ModelInvoked` on `model-access.invocations.v1.model-invoked`, then the event is sent in the run event envelope with `invocationId`, `tenantId`, `projectId`, `runId` and `attemptId`, both absent for a call outside a run, `profileId`, `deploymentId`, `outcome` and `usageStatus` and with the token counts only when known, it holds no prompt and no completion, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ModelRouterService-018, ADR-0012, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/planes/model-compute/model-gateway.md",
        "docs/planes/model-compute/security.md",
        "docs/planes/model-compute/services/model-router-service/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2297",
        "AIFACTORY-TASK-2298",
        "AIFACTORY-TASK-3063",
        "AIFACTORY-TASK-2299",
        "AIFACTORY-TASK-2300"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6011,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService",
          "PolicyEngineService",
          "SecretBrokerService",
          "CostUsageService",
          "ArtifactService"
        ],
        "aggregates": [
          "ModelRouterService/InvocationReceipt",
          "ModelRouterService/RoutePlan"
        ],
        "apis": [
          "ModelRouterService/ModelGateway.Invoke",
          "PolicyEngineService/Policy.Decide",
          "SecretBrokerService/SecretBroker.Issue",
          "CostUsageService/Usage.RecordUsage",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ModelRouterService/ModelInvoked"
        ],
        "descriptors": [
          "model-invocation-v1",
          "policy-decision-v1",
          "usage-record-v1"
        ],
        "adrs": [
          "ADR-0002",
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-04",
          "FR-09",
          "NFR-12",
          "XL-04",
          "XL-12"
        ],
        "scenarios": [
          "SCN-ModelRouterService-010",
          "SCN-ModelRouterService-018"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-567",
        "AIFACTORY-US-568",
        "AIFACTORY-US-573",
        "AIFACTORY-US-1508",
        "feature:policy-engine-service",
        "feature:secret-broker-service",
        "feature:cost-usage-service-complete",
        "feature:artifact-service",
        "feature:component-extensions-ai",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/planes/model-compute/model-gateway.md",
        "docs/planes/model-compute/security.md",
        "docs/planes/model-compute/services/model-router-service/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-574]",
      "number": 574
    },
    {
      "id": "AIFACTORY-TASK-2297",
      "type": "task",
      "parent": "AIFACTORY-US-574",
      "title": "Scripted provider adapter for the acceptance suite and the acceptance environment",
      "sequence": "03.02.11.01",
      "description": "Scripted provider adapter for the acceptance suite and the acceptance environment. Expected output: A scripted chat adapter and a scripted embedding adapter take the keyed registration of one of the six modelled provider values, and a scripted rerank adapter is bound to the rerank adapter port of the service (AIFACTORY-US-576); a setting of the acceptance configuration names the provider value whose registration the scripted adapters take, so that RegisterDeployment accepts a deployment of that value without a provider value of its own for the scripted adapter; no production configuration holds the setting, and a start in the Production environment with the setting present stops with the setting named; the scripts answer with reported usage, answer without usage, stream and break after a number of tokens, fail before any output with a transient or a provider error, time out and stop answering, so that the suites of this feature and of the callers run without a commercial provider and without a key.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "A scripted chat adapter and a scripted embedding adapter take the keyed registration of one of the six modelled provider values, and a scripted rerank adapter is bound to the rerank adapter port of the service (AIFACTORY-US-576); a setting of the acceptance configuration names the provider value whose registration the scripted adapters take, so that RegisterDeployment accepts a deployment of that value without a provider value of its own for the scripted adapter; no production configuration holds the setting, and a start in the Production environment with the setting present stops with the setting named; the scripts answer with reported usage, answer without usage, stream and break after a number of tokens, fail before any output with a transient or a provider error, time out and stop answering, so that the suites of this feature and of the callers run without a commercial provider and without a key."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6011,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2297]",
      "number": 2297
    },
    {
      "id": "AIFACTORY-TASK-2298",
      "type": "task",
      "parent": "AIFACTORY-US-574",
      "title": "Invocation pipeline: idempotency, route plan, policy decision, brokered credential and the streamed adapter call",
      "sequence": "03.02.11.02",
      "description": "Invocation pipeline: idempotency, route plan, policy decision, brokered credential and the streamed adapter call. Expected output: ModelGateway.Invoke looks up the idempotency key within tenant and project, reads the route plan of the run and profile under the tenant filter and answers NOT_FOUND when the tenant holds none, whether the run belongs to another tenant, does not exist or was never resolved, asks Policy.Decide under the policy revision of the plan with the tools of the request, chooses the first Approved and healthy candidate, takes one credential for this invocation from SecretBroker.Issue with the decision id and the purpose model-invoke, calls the keyed adapter with streaming, tools and structured output within the limits of profile and budget and the lower of the default timeout and the deadline, with prompt caching by hash where the adapter supports it, streams tokens to the caller, cancels the adapter call when the timeout or the deadline is exceeded (DEADLINE_EXCEEDED) and propagates a cancellation of the caller; a denial, also for a tool outside the set the decision permits (PERMISSION_DENIED), a missing plan (NOT_FOUND), a reused key with another hash (FAILED_PRECONDITION, the only case of that status) and an unreachable policy engine or broker (UNAVAILABLE) end as the contract of AIFACTORY-TASK-2293 states and call no adapter.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "ModelGateway.Invoke looks up the idempotency key within tenant and project, reads the route plan of the run and profile under the tenant filter and answers NOT_FOUND when the tenant holds none, whether the run belongs to another tenant, does not exist or was never resolved, asks Policy.Decide under the policy revision of the plan with the tools of the request, chooses the first Approved and healthy candidate, takes one credential for this invocation from SecretBroker.Issue with the decision id and the purpose model-invoke, calls the keyed adapter with streaming, tools and structured output within the limits of profile and budget and the lower of the default timeout and the deadline, with prompt caching by hash where the adapter supports it, streams tokens to the caller, cancels the adapter call when the timeout or the deadline is exceeded (DEADLINE_EXCEEDED) and propagates a cancellation of the caller; a denial, also for a tool outside the set the decision permits (PERMISSION_DENIED), a missing plan (NOT_FOUND), a reused key with another hash (FAILED_PRECONDITION, the only case of that status) and an unreachable policy engine or broker (UNAVAILABLE) end as the contract of AIFACTORY-TASK-2293 states and call no adapter."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6011,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2298]",
      "number": 2298
    },
    {
      "id": "AIFACTORY-TASK-3063",
      "type": "task",
      "parent": "AIFACTORY-US-574",
      "title": "ModelGateway.Invoke under the forwarded token of an attempt for the run-bound calls and under a forwarded user token for the calls outside a run of the OpenAI-compatible route",
      "sequence": "03.02.11.03",
      "description": "ModelGateway.Invoke under the forwarded token of an attempt for the run-bound calls and under a forwarded user token for the calls outside a run of the OpenAI-compatible route. Expected output: ModelGateway.Invoke admits, beside a workload token with the service scope, the token of an attempt and a user token forwarded by ModelGatewayHost whose audience is the gateway of the service, the user token with the scope factory.models.invoke (D121), and serves the two kinds of call of the OpenAI-compatible route, the kind of token deciding the kind of call (D123, D125); the tenant is taken from the token in both; for the token of an attempt the run, the step and the attempt come from the claims run_id, step_id and attempt_id, the project, the classification and the profile version come from the route plan of the run and profile, the pipeline of AIFACTORY-TASK-2298 runs unchanged with that plan, and the receipt carries the run and the attempt; for a user token, an invocation that names no run and no attempt the project and the classification are those of the invocation, the model profile id is matched against the active profile versions the tenant can read (NOT_FOUND otherwise), the candidates are resolved for the call with the routing function of AIFACTORY-TASK-2294 and no plan is persisted, steps three to eight of the pipeline run unchanged and end with a receipt without run, attempt and route plan and its ModelInvoked outbox record, and the usage record of the call names no run; a call outside a run of a project under a budget mark is refused with RESOURCE_EXHAUSTED by the check of AIFACTORY-US-1508 and a run-bound call is not; a user token without the scope is refused with PERMISSION_DENIED before any decision, credential or adapter call.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "ModelGateway.Invoke admits, beside a workload token with the service scope, the token of an attempt and a user token forwarded by ModelGatewayHost whose audience is the gateway of the service, the user token with the scope factory.models.invoke (D121), and serves the two kinds of call of the OpenAI-compatible route, the kind of token deciding the kind of call (D123, D125); the tenant is taken from the token in both; for the token of an attempt the run, the step and the attempt come from the claims run_id, step_id and attempt_id, the project, the classification and the profile version come from the route plan of the run and profile, the pipeline of AIFACTORY-TASK-2298 runs unchanged with that plan, and the receipt carries the run and the attempt; for a user token, an invocation that names no run and no attempt the project and the classification are those of the invocation, the model profile id is matched against the active profile versions the tenant can read (NOT_FOUND otherwise), the candidates are resolved for the call with the routing function of AIFACTORY-TASK-2294 and no plan is persisted, steps three to eight of the pipeline run unchanged and end with a receipt without run, attempt and route plan and its ModelInvoked outbox record, and the usage record of the call names no run; a call outside a run of a project under a budget mark is refused with RESOURCE_EXHAUSTED by the check of AIFACTORY-US-1508 and a run-bound call is not; a user token without the scope is refused with PERMISSION_DENIED before any decision, credential or adapter call."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6011,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3063]",
      "number": 3063
    },
    {
      "id": "AIFACTORY-TASK-2299",
      "type": "task",
      "parent": "AIFACTORY-US-574",
      "title": "Receipt with the ModelInvoked outbox record, the output artifact reference and the usage record",
      "sequence": "03.02.11.04",
      "description": "Receipt with the ModelInvoked outbox record, the output artifact reference and the usage record. Expected output: When a call ends, the InvocationReceipt is written with the deployment that answered, or for a Denied receipt the first candidate of the route plan because the column and the payload field are required, the decision id, the outcome (Failed with usage Unknown for a timeout before output, Cancelled with usage Unknown for a cancellation before output, Partial for an end after output), the usage status Reported or Unknown without a zero, the token counts where known, the price basis of the profile as pricing revision and no cost estimate, together with the ModelInvoked outbox record in one transaction; the output is stored through Artifacts.Store by hash and only its reference is kept, and a failed store leaves the reference empty; after the commit Usage.RecordUsage is called once per token meter with the receipt as source, with the run of the receipt or, for the receipt of a call outside a run, without a run (D123), and a failure is not repeated; the metrics invocations, latency, tokens, denials and usage_unknown are recorded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "When a call ends, the InvocationReceipt is written with the deployment that answered, or for a Denied receipt the first candidate of the route plan because the column and the payload field are required, the decision id, the outcome (Failed with usage Unknown for a timeout before output, Cancelled with usage Unknown for a cancellation before output, Partial for an end after output), the usage status Reported or Unknown without a zero, the token counts where known, the price basis of the profile as pricing revision and no cost estimate, together with the ModelInvoked outbox record in one transaction; the output is stored through Artifacts.Store by hash and only its reference is kept, and a failed store leaves the reference empty; after the commit Usage.RecordUsage is called once per token meter with the receipt as source, with the run of the receipt or, for the receipt of a call outside a run, without a run (D123), and a failure is not repeated; the metrics invocations, latency, tokens, denials and usage_unknown are recorded."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6011,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2299]",
      "number": 2299
    },
    {
      "id": "AIFACTORY-TASK-2300",
      "type": "task",
      "parent": "AIFACTORY-US-574",
      "title": "Verify the invocation and the receipt event through the acceptance suite",
      "sequence": "03.02.11.05",
      "description": "Verify the invocation and the receipt event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-010|Scenario=SCN-ModelRouterService-018)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-574 with the scripted provider adapter, fakes of Policy.Decide, SecretBroker.Issue, Usage.RecordUsage and Artifacts.Store that answer, deny and stop answering, an idempotent repeat, a reused key with another hash, a call under a forwarded user token with factory.models.invoke and without a run, whose receipt carries the tenant of the token, the project of the invocation and no run, attempt or route plan while no plan is persisted and whose usage record names no run, a run-bound call under the token of an attempt, whose run, step and attempt come from the claims and whose project, classification and profile version come from the route plan of its run, and whose receipt carries the run and the attempt, a call outside a run of a marked project (RESOURCE_EXHAUSTED) beside a run-bound call of the same project that is served, the call outside a run without the scope (PERMISSION_DENIED) and with a model profile id no active profile answers to (NOT_FOUND), a two-tenant fixture in which a run of the other tenant, an unknown run and a run without a resolved plan are each answered NOT_FOUND alike, a Denied receipt that names the first candidate of the plan, a request with a tool outside the permitted set, the scripted provider timing out before output (Failed, usage Unknown, DEADLINE_EXCEEDED), the caller cancelling before output (Cancelled, usage Unknown), a call ending after output by cancellation and by a broken connection (Partial), the decision id and the purpose model-invoke received by the fake of SecretBroker.Issue, a fake of Artifacts.Store that does not answer, after which the output reached the caller and the receipt has no output reference, a provider without usage, a scan of the stored rows and of the event for content, and the publication and payload of ModelInvoked; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-010|Scenario=SCN-ModelRouterService-018)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-574 with the scripted provider adapter, fakes of Policy.Decide, SecretBroker.Issue, Usage.RecordUsage and Artifacts.Store that answer, deny and stop answering, an idempotent repeat, a reused key with another hash, a call under a forwarded user token with factory.models.invoke and without a run, whose receipt carries the tenant of the token, the project of the invocation and no run, attempt or route plan while no plan is persisted and whose usage record names no run, a run-bound call under the token of an attempt, whose run, step and attempt come from the claims and whose project, classification and profile version come from the route plan of its run, and whose receipt carries the run and the attempt, a call outside a run of a marked project (RESOURCE_EXHAUSTED) beside a run-bound call of the same project that is served, the call outside a run without the scope (PERMISSION_DENIED) and with a model profile id no active profile answers to (NOT_FOUND), a two-tenant fixture in which a run of the other tenant, an unknown run and a run without a resolved plan are each answered NOT_FOUND alike, a Denied receipt that names the first candidate of the plan, a request with a tool outside the permitted set, the scripted provider timing out before output (Failed, usage Unknown, DEADLINE_EXCEEDED), the caller cancelling before output (Cancelled, usage Unknown), a call ending after output by cancellation and by a broken connection (Partial), the decision id and the purpose model-invoke received by the fake of SecretBroker.Issue, a fake of Artifacts.Store that does not answer, after which the output reached the caller and the receipt has no output reference, a provider without usage, a scan of the stored rows and of the event for content, and the publication and payload of ModelInvoked; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6011,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2300]",
      "number": 2300
    },
    {
      "id": "AIFACTORY-US-575",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Skip a degraded deployment, fall back only to an equivalent-constraint candidate the profile allows, fail as transient when no candidate is healthy, and never splice a broken stream",
      "sequence": "03.02.12",
      "description": "As an operator, I want a failing provider to be handled by the rules of the profile and to be visible on the receipt, so that a run never silently changes its privacy class or its output guarantees to keep going. What the router does when a provider fails is fixed by the profile and the route plan, never improvised at the call (XL-16). There are four cases. First, a candidate that is Degraded, unhealthy or Retired at the moment of the call is skipped without a call and without a change to the constraints of the plan, and the next candidate of the plan that is Approved and healthy is chosen; the skip is ordinary routing among deployments that met the same thresholds, the receipt names the deployment that answered, and no fallback is recorded for it. Second, a failed call. Runtime fallback is off unless the pinned profile sets `fallbackEnabled`. The option `ModelAccess:Routing:FallbackEnabledByDefault`, false by default, is read when a route plan is resolved: when it is true, a profile that names a fallback chain is treated as fallback enabled for that plan although its own switch is off, the chain still has to satisfy the same constraints, and a profile without a chain stays without fallback. The effective switch is fixed at resolution and kept with the plan, so a reloaded value of the option applies to plans resolved later and never to a resolved plan. This reading of the option is reported to the owner. With fallback off, a provider failure of the chosen candidate ends the invocation with a receipt of the outcome Failed, counted in `connectsoft.factory.model_gateway.provider_errors` by provider and class, and the caller decides. With fallback on, a provider failure of the class transient or provider that happens before any output was emitted moves the call to the next candidate of the plan that is Approved and healthy, within the deadline and the token limits of the budget. The receipt then names the deployment that produced the output and sets `fallbackUsed`, and the `ModelFallbackUsed` outbox record with `invocationId`, `tenantId`, `profileId`, `fromDeploymentId`, `toDeploymentId` and `reason` is written in the same transaction as the receipt and `ModelInvoked`; `connectsoft.factory.model_gateway.fallbacks` counts it by profile and reason. One invocation has one receipt. The candidates are fixed at resolution: for a profile with fallback enabled they include the deployments of the profiles in its `fallbackChain` that have the same or a stricter privacy class and the same tool and structured-output guarantees. A fallback never crosses to a less private class, a confidential workload never falls back to an external provider, and the router never adds a candidate at invocation time. A failure of the class policy or validation is never a reason for a fallback. Third, no healthy candidate. When every candidate of the plan is Degraded or Retired, no adapter is called and no receipt is written, the call ends with UNAVAILABLE and a reason that lists the degraded deployments, the attempt takes the failure class transient and retries within its budget, and operators see the degraded deployments through `DeploymentStateChanged` and the provider health gauge. When candidates were called and the last one failed, the receipt is Failed and names the last deployment that was called. Fourth, a stream that ends after output was emitted without the completion of the provider: the adapter stream throws, the call from the gateway breaks, the caller cancels, which the router cannot tell from a broken connection, or the timeout of AIFACTORY-US-574 is reached. The receipt has the outcome Partial with the output tokens emitted up to the break counted; the provider reported no final usage, so the usage status is Estimated when tokens were counted and Unknown otherwise, which is reported to the owner as the one rule of estimation this delivery applies. No fallback follows a partial stream: the output of another model is never spliced onto it, the stream ends with an error that carries the receipt reference, and the runtime decides what to do with the attempt. The router repeats no call on the same deployment. A retry is a new invocation of the caller under a new idempotency key; the same key returns the receipt of the failed call and makes no provider call. `ModelFallbackUsed` is published on `model-access.invocations.v1.model-fallback-used`; this PBI proves what the publisher can prove, and AuditService, which records it as evidence, and DashboardService handle it in their own PBIs. Kind: behavior. Traces: services: ModelRouterService; aggregates: ModelRouterService/InvocationReceipt, ModelRouterService/RoutePlan, ModelRouterService/ModelDeployment, ModelRouterService/ModelProfile; apis: ModelRouterService/ModelGateway.Invoke; events: ModelRouterService/ModelFallbackUsed, ModelRouterService/ModelInvoked; adrs: ADR-0012, ADR-0014; requirements: FR-04, NFR-13, XL-04, XL-16; scenarios: SCN-ModelRouterService-019. Relates: screens: run-detail. Depends on: AIFACTORY-US-572, AIFACTORY-US-574. Sources: model/services/model-compute/ModelRouterService.yaml, docs/planes/model-compute/capability-router.md, docs/planes/model-compute/workflows.md, docs/planes/model-compute/services/model-router-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a route plan whose first candidate is Degraded and whose second is Approved and healthy, when `ModelRouterService/ModelGateway.Invoke` is called, then the first candidate is not called, the second answers, the receipt names the second deployment with `fallbackUsed` false, no fallback event is written and the constraints of the `ModelRouterService/RoutePlan` are unchanged (XL-16, model/services/model-compute/ModelRouterService.yaml).",
        "AC2: Given a profile without fallback and a scripted provider that fails before any output, when the model is invoked, then no other candidate is called, the `ModelRouterService/InvocationReceipt` has the outcome Failed, `connectsoft.factory.model_gateway.provider_errors` counts the failure by provider and class and `ModelRouterService/ModelInvoked` is written with the receipt; a repeat under the same idempotency key returns that receipt and calls no provider (XL-04, FR-04).",
        "AC3: Given a profile with fallback enabled, a plan whose candidates satisfy the same constraints and a first candidate that fails with a transient error before any output, when the model is invoked, then the next Approved and healthy candidate answers, the receipt names it and sets `fallbackUsed`, the `ModelRouterService/ModelFallbackUsed` outbox record with `invocationId`, `tenantId`, `profileId`, `fromDeploymentId`, `toDeploymentId` and `reason` is written in the same transaction as the receipt, and the dispatcher publishes it on `model-access.invocations.v1.model-fallback-used` with retry and without loss or duplicate under its event id; no candidate of a less private class is ever called (SCN-ModelRouterService-019, ADR-0012).",
        "AC4: Given a plan whose candidates are all Degraded, when the model is invoked, then no adapter is called, no receipt is written, the status is UNAVAILABLE with a reason that lists the degraded deployments, and the attempt can retry as transient; given every candidate was called and failed, then the receipt is Failed and names the last deployment called (XL-16, model/services/model-compute/ModelRouterService.yaml).",
        "AC5: Given a stream that breaks after output was emitted, when the invocation ends, then the receipt has the outcome Partial with the emitted output tokens counted and a usage status that is not Reported, no other candidate is called and no output of another model is appended, the stream ends with an error that carries the receipt reference, and `ModelRouterService/ModelInvoked` announces the Partial receipt; the same holds when the caller cancels after output was emitted (ADR-0014, model/services/model-compute/ModelRouterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2301",
        "AIFACTORY-TASK-2302",
        "AIFACTORY-TASK-2303"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6012,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService"
        ],
        "aggregates": [
          "ModelRouterService/InvocationReceipt",
          "ModelRouterService/RoutePlan",
          "ModelRouterService/ModelDeployment",
          "ModelRouterService/ModelProfile"
        ],
        "apis": [
          "ModelRouterService/ModelGateway.Invoke"
        ],
        "events": [
          "ModelRouterService/ModelFallbackUsed",
          "ModelRouterService/ModelInvoked"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-04",
          "NFR-13",
          "XL-04",
          "XL-16"
        ],
        "scenarios": [
          "SCN-ModelRouterService-019"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-572",
        "AIFACTORY-US-574"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/capability-router.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-575]",
      "number": 575
    },
    {
      "id": "AIFACTORY-TASK-2301",
      "type": "task",
      "parent": "AIFACTORY-US-575",
      "title": "Candidate selection at invocation, the fallback rule, the ModelFallbackUsed event and the Partial receipt",
      "sequence": "03.02.12.01",
      "description": "Candidate selection at invocation, the fallback rule, the ModelFallbackUsed event and the Partial receipt. Expected output: At invocation the pipeline skips a candidate that is not Approved and healthy, classifies an adapter failure as transient, policy, validation or provider, moves to the next healthy candidate only when the effective fallback switch of the plan is on, that is the profile sets fallbackEnabled or ModelAccess:Routing:FallbackEnabledByDefault was true at resolution for a profile that names a fallback chain, and no output was emitted, writes ModelFallbackUsed in the transaction of the receipt, ends with UNAVAILABLE and the list of degraded deployments when no candidate is healthy, writes a Partial receipt with the emitted tokens counted when a stream breaks and calls no further candidate after output; the metrics fallbacks and provider_errors are recorded and no call is repeated on the same deployment.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "At invocation the pipeline skips a candidate that is not Approved and healthy, classifies an adapter failure as transient, policy, validation or provider, moves to the next healthy candidate only when the effective fallback switch of the plan is on, that is the profile sets fallbackEnabled or ModelAccess:Routing:FallbackEnabledByDefault was true at resolution for a profile that names a fallback chain, and no output was emitted, writes ModelFallbackUsed in the transaction of the receipt, ends with UNAVAILABLE and the list of degraded deployments when no candidate is healthy, writes a Partial receipt with the emitted tokens counted when a stream breaks and calls no further candidate after output; the metrics fallbacks and provider_errors are recorded and no call is repeated on the same deployment."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6012,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2301]",
      "number": 2301
    },
    {
      "id": "AIFACTORY-TASK-2302",
      "type": "task",
      "parent": "AIFACTORY-US-575",
      "title": "Runbook of the five failure modes of ModelRouterService",
      "sequence": "03.02.12.02",
      "description": "Runbook of the five failure modes of ModelRouterService. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/model-compute/ModelRouterService.yaml (provider reports no usage, all candidates degraded, stream broken after partial output, evaluation suite unavailable, policy engine unreachable) with its detection signal, the answer of the service, the receipt it leaves and the recovery step, and states that no fallback crosses a privacy class and that a broken stream is never spliced (XL-16).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/model-compute/ModelRouterService.yaml (provider reports no usage, all candidates degraded, stream broken after partial output, evaluation suite unavailable, policy engine unreachable) with its detection signal, the answer of the service, the receipt it leaves and the recovery step, and states that no fallback crosses a privacy class and that a broken stream is never spliced (XL-16)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6012,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2302]",
      "number": 2302
    },
    {
      "id": "AIFACTORY-TASK-2303",
      "type": "task",
      "parent": "AIFACTORY-US-575",
      "title": "Verify the skip, the fallback, the exhausted candidates and the partial stream through the acceptance suite",
      "sequence": "03.02.12.03",
      "description": "Verify the skip, the fallback, the exhausted candidates and the partial stream through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-019\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-575 with the scripts of the scripted provider adapter: a Degraded first candidate, a failure with fallback off and on, a fallback chain with a weaker privacy class that is never called, all candidates Degraded, all candidates failing, a stream that breaks after output, a caller that cancels after output, a profile without its own fallback switch resolved once with ModelAccess:Routing:FallbackEnabledByDefault true and once false, the option reloaded after a plan was resolved without a change to that plan, and the publication and payload of ModelFallbackUsed; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-019\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-575 with the scripts of the scripted provider adapter: a Degraded first candidate, a failure with fallback off and on, a fallback chain with a weaker privacy class that is never called, all candidates Degraded, all candidates failing, a stream that breaks after output, a caller that cancels after output, a profile without its own fallback switch resolved once with ModelAccess:Routing:FallbackEnabledByDefault true and once false, the option reloaded after a plan was resolved without a change to that plan, and the publication and payload of ModelFallbackUsed; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6012,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2303]",
      "number": 2303
    },
    {
      "id": "AIFACTORY-US-576",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Serve embeddings and reranking through an embedding or reranker profile with a receipt for every call",
      "sequence": "03.02.13",
      "description": "As an operator, I want embedding and reranking calls to pass the same pipeline as a chat call, so that they are allowed by policy, attributed to a tenant and a project and receipted like every other model call. The Knowledge services need embeddings and reranking without an agent host: the model names KnowledgeIngestionService as the caller of `Embed` and KnowledgeSearchService as the caller of `Rerank` and `Embed`. A caller reaches the internal gRPC methods `ModelGateway.Embed` and `ModelGateway.Rerank` through the gateway with a workload identity whose token holds the service scope that names ModelRouterService and forwards the tenant and project of its own call, which the router reads only under that scope (ADR-0015 amendment D114). Embedding and reranking stay in I1 behind ports and are proven with fixtures (decision D121). In this increment the two methods have no caller: the Knowledge services are delivered thin in I1 and call nothing, their complete deliveries arrive in I5 and their gateway in I3. Their profiles are seeded: `embedding` and `reranker` are among the eleven profiles of model/model-profiles.yaml that the thin AgentRegistryService seeds as Draft releases and the router loads (decision D123, AIFACTORY-US-569), so a call on a deployed I1 instance finds its profile and then needs an Approved and healthy deployment that the profile allows. The methods are delivered and proven here with fixture profiles and the scripted adapters. Both methods are unary and of the class spend and run the pipeline of AIFACTORY-US-574 with three differences. The profile must be of the modality of the method, Embedding for `Embed` and Rerank for `Rerank`; another modality is refused with INVALID_ARGUMENT. The run and the attempt are optional on a receipt: a call inside a run uses the route plan of the run and profile, and a `runId` for which the tenant of the caller holds no route plan of that profile is answered NOT_FOUND, failure class permanent, whether the run belongs to another tenant, does not exist or was never resolved, the one answer `Invoke` gives (AIFACTORY-US-574); a call outside a run, such as an ingestion, resolves the candidates for the call under the same filters, the same policy decision and the same scoring and persists no plan, because a plan belongs to a run. The usage of a call outside a run is recorded without a run and metered on the budget of its project without a reservation, and its receipt is listed with the receipts of its project that name no run (AIFACTORY-US-901, decision D123). The reply carries the vectors or the ranked scores with the receipt; they are returned to the caller, are not stored by this service and no output artifact is written for them. For an embedding profile the reply names the `embeddingCompatibility` of the profile version, the embedding space a knowledge index is pinned to (ADR-0013 decision 1), so that a caller can refuse to mix spaces; the router never changes it for a profile version. The two ports differ. `Embed` runs behind the embedding generator abstraction of the pinned AI library and calls the generator the library registers for the provider of the deployment. For `Rerank` the AI library has no adapter today: `ConnectSoft.Extensions.AI` registers keyed chat clients and embedding generators only (docs/planes/model-compute/providers-and-profiles.md). A provider adapter is library code and is not written in this repository (AIFACTORY-US-566). `ModelGateway.Rerank` is therefore delivered behind one rerank adapter port of the service and proven with the scripted rerank adapter of AIFACTORY-TASK-2297 bound to that port, and the port stays a port of the service until the AI library publishes a rerank adapter (decision D121). Feature `component-extensions-ai` delivers the keyed rerank adapter abstraction in the repository ConnectSoft.Extensions.AI (AIFACTORY-US-758), and this PBI depends on that feature by its version pin: from the pinned version on, the port resolves the keyed rerank adapter the library registers for the provider of the deployment, as the keyed chat clients are resolved, and the scripted adapter of the acceptance suite implements the same abstraction. The abstraction brings no provider implementation with it, so a rerank call whose candidate has no adapter behind the port, as on a deployed instance of this increment, calls no provider, writes no receipt, because no adapter was reached, and ends with UNIMPLEMENTED and the provider named. Everything else is the same: the policy decision per call with the fail-closed rule, a Denied receipt that names the first candidate of the plan or, outside a run, of the candidates resolved for the call, the brokered credential issued for the one call, the receipt with the deployment that answered, `ModelInvoked` in the same transaction, the usage to CostUsageService, the skip of a degraded candidate and the fallback rule of AIFACTORY-US-575. The idempotency key within tenant and project returns the existing receipt and makes no second provider call; the vectors are not kept by the router, so a caller that lost the reply repeats under a new key. The usage a provider reports for an embedding or a rerank call is recorded as input tokens; a provider that reports none leaves the receipt Unknown. In which unit a rerank call is metered and priced is an input of the owner and is not invented here. A call without a workload identity is refused with UNAUTHENTICATED, without the service scope with PERMISSION_DENIED, with an invalid request with INVALID_ARGUMENT and for a profile of another tenant, or inside a run without a route plan of the tenant for the profile, with NOT_FOUND; when PolicyEngineService or the Secret Broker does not answer, or no candidate is healthy, the status is UNAVAILABLE and no provider is called. The run and the attempt are optional members of `model-invocation-v1` since decision D123, as they are on the receipt of the model, and the proto of AIFACTORY-TASK-2293 carries both as optional. Kind: behavior. Traces: services: ModelRouterService; aggregates: ModelRouterService/InvocationReceipt; apis: ModelRouterService/ModelGateway.Embed, ModelRouterService/ModelGateway.Rerank; events: ModelRouterService/ModelInvoked; descriptors: model-invocation-v1; adrs: ADR-0013, ADR-0015; requirements: FR-04, NFR-13; scenarios: SCN-ModelRouterService-011, SCN-ModelRouterService-012. Depends on: AIFACTORY-US-574, AIFACTORY-US-575, feature:component-extensions-ai. Sources: model/services/model-compute/ModelRouterService.yaml, docs/planes/model-compute/providers-and-profiles.md, docs/architecture/adr/0013-vector-store-profiles.md, docs/planes/model-compute/workflows.md, docs/planes/model-compute/services/model-router-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a workload identity with the service scope and an active profile of the modality Embedding with an Approved and healthy deployment, when `ModelRouterService/ModelGateway.Embed` is called inside a run with a resolved plan, then the reply carries the vectors, the embedding compatibility of the profile version and the receipt, the `ModelRouterService/InvocationReceipt` with the deployment that answered and the `ModelRouterService/ModelInvoked` outbox record are written in one transaction, and the vectors are stored nowhere in `model-router-sql` (SCN-ModelRouterService-011, ADR-0013).",
        "AC2: Given an active fixture profile of the modality Rerank and the scripted rerank adapter bound to the rerank adapter port of the service, when `ModelRouterService/ModelGateway.Rerank` is called, then the reply carries the ranked scores and the receipt, the receipt and `ModelRouterService/ModelInvoked` are written in one transaction, and a provider that reports no usage leaves the receipt Unknown without a zero; given a candidate whose provider has no adapter behind the port, as on a deployed instance until a keyed rerank adapter of the pinned `ConnectSoft.Extensions.AI` serves that provider, then no provider is called, no receipt is written and the status is UNIMPLEMENTED with the provider named (SCN-ModelRouterService-012, FR-04, docs/planes/model-compute/providers-and-profiles.md).",
        "AC3: Given a Knowledge caller outside a run, when `ModelRouterService/ModelGateway.Embed` is called without a run and an attempt, then the candidates are resolved for the call under the same filters and the same policy decision, no route plan is persisted, the receipt has no run, no attempt and no route plan, and it carries the tenant and project the caller forwarded under the service scope (SCN-ModelRouterService-011, ADR-0015).",
        "AC4: Given a caller without a workload identity, a token without the service scope, a profile of the wrong modality, a profile of another tenant, a call inside a run for which the tenant of the caller holds no route plan of the profile, a denying decision, or a policy engine that does not answer, when either method is called, then the status is UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND, NOT_FOUND, PERMISSION_DENIED or UNAVAILABLE respectively and no provider is called; the NOT_FOUND of the run is the same whether the run belongs to another tenant, does not exist or was never resolved; a repeat under the same idempotency key returns the existing receipt and calls no provider (SCN-ModelRouterService-011, SCN-ModelRouterService-012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/providers-and-profiles.md",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2304",
        "AIFACTORY-TASK-2305"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6013,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService"
        ],
        "aggregates": [
          "ModelRouterService/InvocationReceipt"
        ],
        "apis": [
          "ModelRouterService/ModelGateway.Embed",
          "ModelRouterService/ModelGateway.Rerank"
        ],
        "events": [
          "ModelRouterService/ModelInvoked"
        ],
        "descriptors": [
          "model-invocation-v1"
        ],
        "adrs": [
          "ADR-0013",
          "ADR-0015"
        ],
        "requirements": [
          "FR-04",
          "NFR-13"
        ],
        "scenarios": [
          "SCN-ModelRouterService-011",
          "SCN-ModelRouterService-012"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-574",
        "AIFACTORY-US-575",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/planes/model-compute/providers-and-profiles.md",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/model-compute/workflows.md",
        "docs/planes/model-compute/services/model-router-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-576]",
      "number": 576
    },
    {
      "id": "AIFACTORY-TASK-2304",
      "type": "task",
      "parent": "AIFACTORY-US-576",
      "title": "ModelGateway.Embed and ModelGateway.Rerank on the invocation pipeline",
      "sequence": "03.02.13.01",
      "description": "ModelGateway.Embed and ModelGateway.Rerank on the invocation pipeline. Expected output: Embed and Rerank run the pipeline of ModelGateway.Invoke as unary calls: Embed calls the embedding generator the pinned AI library registers for the provider of the deployment, and Rerank calls one rerank adapter port of the service, which stays a port of the service until the AI library publishes a rerank adapter (D121) and behind which this repository binds no provider adapter, because a provider adapter is library code; once the service pins the version of ConnectSoft.Extensions.AI that holds the keyed rerank adapter abstraction of AIFACTORY-US-758, the port resolves the keyed rerank adapter the library registers for the provider of the deployment and the scripted adapter implements that abstraction; a rerank call whose candidate has no adapter behind the port ends with UNIMPLEMENTED and the provider named, calls no provider and writes no receipt; both methods require a profile of their modality, use the route plan of a run, answer NOT_FOUND for a run for which the tenant holds no route plan of the profile, or resolve the candidates for a call outside a run without persisting a plan, return the vectors with the embedding compatibility of the profile version or the ranked scores together with the receipt, store neither vectors nor scores, write the receipt with the ModelInvoked outbox record in one transaction and record reported usage as input tokens or leave it Unknown.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Embed and Rerank run the pipeline of ModelGateway.Invoke as unary calls: Embed calls the embedding generator the pinned AI library registers for the provider of the deployment, and Rerank calls one rerank adapter port of the service, which stays a port of the service until the AI library publishes a rerank adapter (D121) and behind which this repository binds no provider adapter, because a provider adapter is library code; once the service pins the version of ConnectSoft.Extensions.AI that holds the keyed rerank adapter abstraction of AIFACTORY-US-758, the port resolves the keyed rerank adapter the library registers for the provider of the deployment and the scripted adapter implements that abstraction; a rerank call whose candidate has no adapter behind the port ends with UNIMPLEMENTED and the provider named, calls no provider and writes no receipt; both methods require a profile of their modality, use the route plan of a run, answer NOT_FOUND for a run for which the tenant holds no route plan of the profile, or resolve the candidates for a call outside a run without persisting a plan, return the vectors with the embedding compatibility of the profile version or the ranked scores together with the receipt, store neither vectors nor scores, write the receipt with the ModelInvoked outbox record in one transaction and record reported usage as input tokens or leave it Unknown."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6013,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2304]",
      "number": 2304
    },
    {
      "id": "AIFACTORY-TASK-2305",
      "type": "task",
      "parent": "AIFACTORY-US-576",
      "title": "Verify the embedding and rerank calls through the acceptance suite",
      "sequence": "03.02.13.02",
      "description": "Verify the embedding and rerank calls through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-011|Scenario=SCN-ModelRouterService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-576 with fixture profiles of the modalities Embedding and Rerank, the scripted embedding adapter and the scripted rerank adapter of AIFACTORY-TASK-2297 bound to the rerank adapter port, a rerank call with no adapter behind the port (UNIMPLEMENTED, no provider call, no receipt), a call inside a run and one outside a run, a call inside a run of another tenant, of an unknown run and of a run without a resolved plan, each answered NOT_FOUND alike, a profile of the wrong modality, a two-tenant fixture, a denying decision, an idempotent repeat and a scan of the store for vectors.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ModelRouterService-011|Scenario=SCN-ModelRouterService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-576 with fixture profiles of the modalities Embedding and Rerank, the scripted embedding adapter and the scripted rerank adapter of AIFACTORY-TASK-2297 bound to the rerank adapter port, a rerank call with no adapter behind the port (UNIMPLEMENTED, no provider call, no receipt), a call inside a run and one outside a run, a call inside a run of another tenant, of an unknown run and of a run without a resolved plan, each answered NOT_FOUND alike, a profile of the wrong modality, a two-tenant fixture, a denying decision, an idempotent repeat and a scan of the store for vectors."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6013,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2305]",
      "number": 2305
    },
    {
      "id": "AIFACTORY-US-577",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Read the invocation receipts of a run and reconcile receipts whose usage is unknown or estimated",
      "sequence": "03.02.14",
      "description": "As a requester, I want to see for my run which model answered each call, what it used and how certain that usage is, so that I can account for the run without anybody presenting unknown usage as zero. Receipts are the evidence of every model call (FR-04, FUX-08). A caller whose scope carries `factory.runs.read`, a requester on the run detail, an operator or an observer, reads the receipts of a run through the gateway route of `ListRunReceipts`: per receipt the invocation, the attempt, the profile, the deployment that answered, the request hash, the outcome, the usage status with tokens where known, whether a fallback was taken, the policy decision id, the latency, the output artifact reference and the times, ordered by start and paged, over the index on run and attempt. Unknown usage is shown as unknown, never as zero. The tenant comes from the token and the query runs under the tenant row filter. The router holds no run: a run is known to it when a route plan or a receipt of the tenant names it, and a `runId` for which neither exists is answered 404, the same answer for a run of another tenant and for a run that does not exist (ADR-0015 amendment D113); a run with a plan and no receipt yet is answered 200 with an empty list. The receipt of a run-bound call of the OpenAI-compatible route of ModelGatewayHost carries the run and the attempt of its token and is listed here with the other receipts of the run; a receipt that names no run is never returned by this operation and is read through `ListProjectReceipts` (AIFACTORY-US-901, decision D123). A caller without the scope is answered 403. The project check has one limit that comes from the model. A receipt names its project, so for a run with at least one receipt a caller whose role claims do not admit the project the receipts name is answered 403. A route plan names no project: `RoutePlans` holds run, tenant, profile, version, revision, candidates, constraints and time, although `ResolveRoutePlan` receives the project of the run. For a run that has a plan and no receipt the project is therefore unknown to this service and the check cannot be made, so such a run is answered 200 with an empty list to every caller of the tenant who holds the scope. An empty list holds no data of the project and discloses only that a run of the tenant resolved a plan, but the same caller can receive 200 before the first receipt and 403 after it. The limit is named here, and that `RoutePlan` carries no `projectId` is reported as a model correction; this delivery adds no column the model does not list. No response holds prompt or completion content, which this service never stores. The `ReceiptReconciler` runs at minute 30 of every hour over the receipts whose usage status is Unknown or Estimated and that are older than one hour, two tenants in parallel, with five attempts and exponential backoff from 60 seconds, idempotent on invocation and statement reference. For each receipt it asks one statement port for the usage a provider statement confirms. When a confirmation is found, the receipt gets the confirmed input and output tokens and the usage status Reported, a `ModelInvoked` outbox record with the corrected usage is written in the same transaction, which forwards the correction to CostUsageService as a later receipt of the same source, and `connectsoft.factory.model_gateway.usage_unknown` falls for a receipt that was Unknown. A receipt without a confirmation is left as it is: it is never zeroed, never guessed and never aged out. When the statement port fails and the five attempts are exhausted, the receipt is left unchanged and the next hourly run takes it up again. The model lists no route, no table and no consumed event through which a provider statement reaches this service, so no statement adapter is built or invented here: the worker, its schedule, its idempotency and the port are delivered and proven with a fixture source, a deployed instance confirms nothing until an adapter exists, and that is reported to the owner. CostUsageService meanwhile holds the same usage as Uncertain and reconciles it by its own worker, so nothing is lost while the port has no source. Kind: behavior. Traces: services: ModelRouterService; aggregates: ModelRouterService/InvocationReceipt; apis: ModelRouterService/ListRunReceipts; events: ModelRouterService/ModelInvoked; adrs: ADR-0015, ADR-0019; requirements: FR-09, FUX-08, NFR-12, XL-12; scenarios: SCN-ModelRouterService-008. Relates: screens: run-detail. Depends on: AIFACTORY-US-574. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/control-plane/CostUsageService.yaml, docs/planes/trust-operations/finops.md, docs/planes/model-compute/services/model-router-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a run of the tenant of the caller with receipts of the outcomes Completed, Partial and Denied, one of them with usage Unknown, when a caller with `factory.runs.read` and a role in the project calls `ModelRouterService/ListRunReceipts`, then the response is 200 with the receipts ordered by start and paged, each with attempt, profile, deployment, request hash, outcome, usage status, fallback flag, decision id and output artifact reference, the Unknown receipt without a token count and never with zero, and no prompt or completion content (SCN-ModelRouterService-008, FUX-08).",
        "AC2: Given a `runId` that only another tenant has receipts for, or that nobody has a plan or a receipt for, when `ModelRouterService/ListRunReceipts` is called, then the answer is 404, the same in both cases; given a run with a route plan and no receipt, then the answer is 200 with an empty list for every caller of the tenant who holds the scope, because a `ModelRouterService/InvocationReceipt` names the project and a route plan does not, as model/services/model-compute/ModelRouterService.yaml lists its columns; given a caller without `factory.runs.read`, then the answer is 403; given a run with at least one receipt and a caller without a role in the project the receipts name, then the answer is 403; nothing is written (SCN-ModelRouterService-008, ADR-0015).",
        "AC3: Given a receipt with usage Unknown that is older than one hour and a fixture source behind the statement port that confirms its tokens, when the `ReceiptReconciler` runs, then the `ModelRouterService/InvocationReceipt` has the confirmed tokens and the usage status Reported, a `ModelRouterService/ModelInvoked` outbox record with the corrected usage is written in the same transaction, `connectsoft.factory.model_gateway.usage_unknown` falls by one, and the same confirmation offered again or the worker triggered twice confirms once (FR-09, XL-12).",
        "AC4: Given receipts with usage Unknown or Estimated and no source behind the statement port, as on a deployed instance of this delivery, when the `ReceiptReconciler` runs, then no receipt changes, none is written as zero or dropped, nothing is published, and `ModelRouterService/ListRunReceipts` keeps showing the usage as unknown or estimated (FR-09, model/services/model-compute/ModelRouterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/planes/trust-operations/finops.md",
        "docs/planes/model-compute/services/model-router-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2306",
        "AIFACTORY-TASK-2307",
        "AIFACTORY-TASK-2308"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6014,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService"
        ],
        "aggregates": [
          "ModelRouterService/InvocationReceipt"
        ],
        "apis": [
          "ModelRouterService/ListRunReceipts"
        ],
        "events": [
          "ModelRouterService/ModelInvoked"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-09",
          "FUX-08",
          "NFR-12",
          "XL-12"
        ],
        "scenarios": [
          "SCN-ModelRouterService-008"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-574"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/planes/trust-operations/finops.md",
        "docs/planes/model-compute/services/model-router-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-577]",
      "number": 577
    },
    {
      "id": "AIFACTORY-TASK-2306",
      "type": "task",
      "parent": "AIFACTORY-US-577",
      "title": "ListRunReceipts over the receipts of a run under the tenant filter and the project role",
      "sequence": "03.02.14.01",
      "description": "ListRunReceipts over the receipts of a run under the tenant filter and the project role. Expected output: ListRunReceipts returns the receipts of a run ordered by start and paged with attempt, profile, deployment, request hash, outcome, usage status, tokens where known, fallback flag, decision id, latency, output artifact reference and times; it answers 404 when neither a route plan nor a receipt of the tenant names the run, 403 for a missing scope, 403 for a caller without a role in the project that the receipts of the run name, and 200 with an empty list for a run with a plan only, for every caller of the tenant who holds the scope, because a route plan carries no project and the project check needs a receipt; the documentation of the operation states that limit; unknown usage is never serialised as zero.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "ListRunReceipts returns the receipts of a run ordered by start and paged with attempt, profile, deployment, request hash, outcome, usage status, tokens where known, fallback flag, decision id, latency, output artifact reference and times; it answers 404 when neither a route plan nor a receipt of the tenant names the run, 403 for a missing scope, 403 for a caller without a role in the project that the receipts of the run name, and 200 with an empty list for a run with a plan only, for every caller of the tenant who holds the scope, because a route plan carries no project and the project check needs a receipt; the documentation of the operation states that limit; unknown usage is never serialised as zero."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6014,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2306]",
      "number": 2306
    },
    {
      "id": "AIFACTORY-TASK-2307",
      "type": "task",
      "parent": "AIFACTORY-US-577",
      "title": "ReceiptReconciler with the statement port",
      "sequence": "03.02.14.02",
      "description": "ReceiptReconciler with the statement port. Expected output: The worker reads the receipts with usage Unknown or Estimated older than one hour, asks the statement port for a confirmation keyed by invocation and statement reference, and on a confirmation sets the tokens and the usage status Reported with a ModelInvoked outbox record in the same transaction and lowers connectsoft.factory.model_gateway.usage_unknown; without a confirmation it changes nothing; the port has a fixture source in the acceptance suite and no adapter, because the model names no source of provider statements.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The worker reads the receipts with usage Unknown or Estimated older than one hour, asks the statement port for a confirmation keyed by invocation and statement reference, and on a confirmation sets the tokens and the usage status Reported with a ModelInvoked outbox record in the same transaction and lowers connectsoft.factory.model_gateway.usage_unknown; without a confirmation it changes nothing; the port has a fixture source in the acceptance suite and no adapter, because the model names no source of provider statements."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6014,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2307]",
      "number": 2307
    },
    {
      "id": "AIFACTORY-TASK-2308",
      "type": "task",
      "parent": "AIFACTORY-US-577",
      "title": "Verify the receipt read and the reconciliation through the acceptance suite",
      "sequence": "03.02.14.03",
      "description": "Verify the receipt read and the reconciliation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-008\"` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReceiptReconciliation\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-577 with a two-tenant fixture, receipts of every outcome, a run with a plan only read by a caller with and without a role in the project of the run (200 with an empty list for both), the same run after its first receipt (403 for the caller without the role), the role matrix, a fixture source behind the statement port, a repeated confirmation and a run of the worker without a source.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-008\"` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReceiptReconciliation\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-577 with a two-tenant fixture, receipts of every outcome, a run with a plan only read by a caller with and without a role in the project of the run (200 with an empty list for both), the same run after its first receipt (403 for the caller without the role), the role matrix, a fixture source behind the statement port, a repeated confirmation and a run of the worker without a source."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6014,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2308]",
      "number": 2308
    },
    {
      "id": "AIFACTORY-US-901",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Read the invocation receipts of a project that name no run, the receipts of the model calls made outside a run",
      "sequence": "03.02.15",
      "description": "As a requester, I want to see for my project which model answered each call made outside a run, what it used and how certain that usage is, so that the calls of my tools on the OpenAI-compatible route are accounted for like the calls of a run. A call of the OpenAI-compatible route of ModelGatewayHost that is outside a run produces a receipt that names no run and no attempt (AIFACTORY-US-574, decision D123). `ListRunReceipts` never returns such a receipt, because it reads by run (AIFACTORY-US-577). Decision D123 therefore gives the service a second receipt read that needs no run: `ListProjectReceipts`, GET /factory/projects/{projectId}/model-receipts, a read operation on gateway role GW-03 with the scope `factory.models.read`. A caller whose token carries that scope and grants the project reads through the gateway route the invocation receipts of the project that name no run: per receipt the invocation, the profile, the deployment that answered, the request hash, the outcome, the usage status with tokens where known, whether a fallback was taken, the policy decision id, the latency, the output artifact reference and the times, ordered by start and paged. Unknown usage is shown as unknown, never as zero, and no response holds prompt or completion content, which this service never stores. The rule of the read is the receipt and not the route the call came by: every receipt of the tenant and the project whose run is empty is returned. In this increment these are the receipts of the calls outside a run on the OpenAI-compatible route; the receipt of an `Embed` or a `Rerank` call outside a run (AIFACTORY-US-576) names no run either and is returned by the same rule. A receipt that names a run is never returned here, the receipt of a run-bound call of the OpenAI-compatible route among them; it is listed with the receipts of its run. The project of the path is checked before the read is served. ModelGatewayHost fronts the operation and checks the `projectId` of the path against the role claims of the token: a project the token does not grant is answered 403, and the call does not reach this service (feature `model-gateway-host`, AIFACTORY-US-562). The service is reachable through its gateway only (ADR-0028 decision 3). It validates the forwarded token again, accepts the audience of its own gateway (ADR-0015 amendment D117), requires `factory.models.read` and answers 403 without it, takes the tenant from the token and runs the query under the tenant row filter with the project of the path. The operation lists the codes 200 and 403 and no 404: a project the token grants that has no such receipt is answered 200 with an empty list, and a receipt of another tenant is never returned, so the read confirms nothing about another tenant. Whether the service repeats the project check of the gateway on the role claims of the forwarded token is not stated by the model and is reported to the owner; this delivery builds the check the model names, the one of the gateway, and the scope check and the tenant filter of the service. The model lists no index for this read beyond the indexes of `InvocationReceipts`, and this delivery adds no index and no column the model does not list. The read writes nothing and publishes nothing. The receipts it returns were metered like every receipt: their usage was recorded without a run on the budget of the project without a reservation (AIFACTORY-US-574), and one whose usage is Unknown or Estimated is taken up by the `ReceiptReconciler` like any other receipt (AIFACTORY-US-577). Kind: behavior. Traces: services: ModelRouterService, ModelGatewayHost; aggregates: ModelRouterService/InvocationReceipt; apis: ModelRouterService/ListProjectReceipts; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: FR-04, FUX-08; scenarios: SCN-ModelRouterService-021. Depends on: AIFACTORY-US-567, AIFACTORY-US-574. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/model-compute/ModelGatewayHost.yaml, model/services/control-plane/CostUsageService.yaml, docs/reference/schemas/model-invocation.schema.json, docs/planes/model-compute/services/model-router-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given receipts of a project of the tenant of the caller that name no run, of the outcomes Completed, Partial and Denied, one of them with usage Unknown, and receipts of the same project that name a run, when a caller with `factory.models.read` whose token grants the project calls `ModelRouterService/ListProjectReceipts`, then the response is 200 with the receipts that name no run only, ordered by start and paged, each with invocation, profile, deployment, request hash, outcome, usage status, fallback flag, decision id and output artifact reference, the Unknown receipt without a token count and never with zero, and no prompt or completion content; nothing is written (SCN-ModelRouterService-021, FUX-08).",
        "AC2: Given a call outside a run under a forwarded user token that ended with a `ModelRouterService/InvocationReceipt`, a run-bound call under the token of an attempt for a run of the same project, and an embedding call outside a run of the same project, when `ModelRouterService/ListProjectReceipts` is called for the project, then the receipts of the first and the third call are returned with the tenant and the project of the call and without run, attempt and route plan, and the receipt of the run-bound call is absent, because it names its run and is listed with the receipts of that run (SCN-ModelRouterService-021, model/services/model-compute/ModelRouterService.yaml).",
        "AC3: Given a caller without `factory.models.read`, when `ModelRouterService/ListProjectReceipts` is called, then the answer is 403 with a problem response; given a project the token grants that has no receipt without a run, then the answer is 200 with an empty list; given receipts of two tenants, then a caller of one tenant never receives a receipt of the other, because the query runs under the tenant row filter; no answer is 404 and no state changes (SCN-ModelRouterService-021, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/planes/model-compute/services/model-router-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3631",
        "AIFACTORY-TASK-3632",
        "AIFACTORY-TASK-3633"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6015,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService",
          "ModelGatewayHost"
        ],
        "aggregates": [
          "ModelRouterService/InvocationReceipt"
        ],
        "apis": [
          "ModelRouterService/ListProjectReceipts"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-04",
          "FUX-08"
        ],
        "scenarios": [
          "SCN-ModelRouterService-021"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-567",
        "AIFACTORY-US-574"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/model-invocation.schema.json",
        "docs/planes/model-compute/services/model-router-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-901]",
      "number": 901
    },
    {
      "id": "AIFACTORY-TASK-3631",
      "type": "task",
      "parent": "AIFACTORY-US-901",
      "title": "Contract of the receipt read of a project",
      "sequence": "03.02.15.01",
      "description": "Contract of the receipt read of a project. Expected output: The OpenAPI document of the service lists ListProjectReceipts, GET /factory/projects/{projectId}/model-receipts, with the scope factory.models.read, the codes 200 and 403 of model/services/model-compute/ModelRouterService.yaml, the paging members and the receipt view of ListRunReceipts without run, attempt and route plan; the description of the operation states that it returns only the receipts of the project that name no run, that a receipt with a run is read through ListRunReceipts, and that ModelGatewayHost checks the project of the path against the role claims of the token before it forwards the call (D123).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service lists ListProjectReceipts, GET /factory/projects/{projectId}/model-receipts, with the scope factory.models.read, the codes 200 and 403 of model/services/model-compute/ModelRouterService.yaml, the paging members and the receipt view of ListRunReceipts without run, attempt and route plan; the description of the operation states that it returns only the receipts of the project that name no run, that a receipt with a run is read through ListRunReceipts, and that ModelGatewayHost checks the project of the path against the role claims of the token before it forwards the call (D123)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6015,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3631]",
      "number": 3631
    },
    {
      "id": "AIFACTORY-TASK-3632",
      "type": "task",
      "parent": "AIFACTORY-US-901",
      "title": "ListProjectReceipts over the receipts of a project that name no run under the tenant filter",
      "sequence": "03.02.15.02",
      "description": "ListProjectReceipts over the receipts of a project that name no run under the tenant filter. Expected output: ListProjectReceipts returns the receipts of the tenant of the token and the project of the path whose run is empty, ordered by start and paged, with invocation, profile, deployment, request hash, outcome, usage status, tokens where known, fallback flag, decision id, latency, output artifact reference and times; it requires factory.models.read (403), runs under the tenant row filter, answers 200 with an empty list for a project without such receipts and never 404, returns no receipt that names a run, adds no index and no column the model does not list, writes nothing and never serialises unknown usage as zero.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "ListProjectReceipts returns the receipts of the tenant of the token and the project of the path whose run is empty, ordered by start and paged, with invocation, profile, deployment, request hash, outcome, usage status, tokens where known, fallback flag, decision id, latency, output artifact reference and times; it requires factory.models.read (403), runs under the tenant row filter, answers 200 with an empty list for a project without such receipts and never 404, returns no receipt that names a run, adds no index and no column the model does not list, writes nothing and never serialises unknown usage as zero."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6015,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3632]",
      "number": 3632
    },
    {
      "id": "AIFACTORY-TASK-3633",
      "type": "task",
      "parent": "AIFACTORY-US-901",
      "title": "Verify the receipt read of a project through the acceptance suite",
      "sequence": "03.02.15.03",
      "description": "Verify the receipt read of a project through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-021\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-901 with a two-tenant fixture, receipts of one project with and without a run and of every outcome, one with usage Unknown, a receipt written by a call outside a run under a forwarded user token, one written by a run-bound call under the token of an attempt and one written by an embedding call outside a run, a project without receipts, a caller without the scope, more receipts than one page, and a scan of the response for prompt and completion content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ModelRouterService-021\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-901 with a two-tenant fixture, receipts of one project with and without a run and of every outcome, one with usage Unknown, a receipt written by a call outside a run under a forwarded user token, one written by a run-bound call under the token of an attempt and one written by an embedding call outside a run, a project without receipts, a caller without the scope, more receipts than one page, and a scan of the response for prompt and completion content."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6015,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3633]",
      "number": 3633
    },
    {
      "id": "AIFACTORY-US-1508",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-015",
      "title": "Keep a budget mark for a project from BudgetExceeded, clear it from BudgetUpdated or at the turn of the period, and refuse the calls outside a run of a marked project",
      "sequence": "03.02.16",
      "description": "As an operator, I want model calls made outside a run to stop for a project whose budget is exceeded, so that a project cannot keep spending through the OpenAI-compatible route after its budget has run out. A run stops on its budget through RunControlService, which reserves the budget of the run; a call of the OpenAI-compatible route that is made outside a run has no reservation, and the router makes no reservation call and evaluates no cost limit itself. What stops such calls is a mark the router keeps for the project (decision D125). ModelRouterService consumes `BudgetExceeded` and `BudgetUpdated` of CostUsageService through the inbox of the `model-router` messaging profile (AIFACTORY-US-567), with deduplication on the event id. The handler `MarkProjectBudgetExceeded` keeps, for the tenant and the project the event names, one `ProjectBudgetMark` in the table `ProjectBudgetMarks` with the budget id, the turn of the budget period from `periodEndsAt`, which is absent for a total budget, and the time it was marked. An event sets the mark whether or not it names a run: CostUsageService publishes it for the project without a run when usage recorded outside a run crosses the limit, and once per run when the usage of a run crosses it. A second event for a project already marked keeps one mark and updates its budget and its period. An event that names no project sets no mark, because the mark is kept per project. The handler `ClearProjectBudgetMark` removes the mark of the project when a `BudgetUpdated` puts `committedUsd` at or below `limitUsd`; an event that leaves the committed amount above the limit changes nothing. The mark of a monthly budget is no longer in force from the instant it keeps in `PeriodEndsAt`, so the turn of the period clears it without an event; the mark of a total budget keeps no such instant and is cleared by `BudgetUpdated` alone. `ModelGateway.Invoke` checks the mark before the policy decision of its pipeline (AIFACTORY-US-574). While a mark is in force for the project of a call outside a run, the call is refused with RESOURCE_EXHAUSTED, which ModelGatewayHost translates to 429, and no decision, credential, adapter call or receipt follows. A run-bound call, which presents the token of an attempt, is not refused by the mark, because its budget is the reservation of its run. The handlers publish nothing. A mark is a row of the tenant under the row filter, and a mark of one tenant never refuses a call of another. The mark lives in the store of the service, so every replica reads the same mark and a restart keeps it; an event that arrives while the store does not answer is retried by the inbox and is not lost. Kind: behavior. Traces: services: ModelRouterService, CostUsageService; aggregates: ModelRouterService/InvocationReceipt; apis: ModelRouterService/ModelGateway.Invoke; events: CostUsageService/BudgetExceeded, CostUsageService/BudgetUpdated; adrs: ADR-0012, ADR-0015; requirements: FR-09. Depends on: AIFACTORY-US-566, AIFACTORY-US-567, feature:cost-usage-service-complete. Sources: model/services/model-compute/ModelRouterService.yaml, model/services/control-plane/CostUsageService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a fixture publisher of `CostUsageService/BudgetExceeded` for a project, once without a run and once with a run, each delivered twice, when the handler `MarkProjectBudgetExceeded` runs, then one mark for the tenant and the project is kept in `ProjectBudgetMarks` with the budget id, the turn of the period and the time it was marked, the second delivery of an event id has no effect, and nothing is published (model/services/model-compute/ModelRouterService.yaml, ADR-0012).",
        "AC2: Given a marked project, when `ModelRouterService/ModelGateway.Invoke` is called outside a run of that project under a user token, then the status is RESOURCE_EXHAUSTED and no policy decision, credential, adapter call or `ModelRouterService/InvocationReceipt` follows; when a run-bound call of the same project is made under the token of an attempt, then it is served and ends with its receipt; a call of another project or of another tenant is not refused (FR-09, model/services/control-plane/CostUsageService.yaml).",
        "AC3: Given a marked project, when a `CostUsageService/BudgetUpdated` with `committedUsd` at or below `limitUsd` is delivered, then the mark is removed and the next call outside a run is served; when one with `committedUsd` above `limitUsd` is delivered, then the mark stays; given the mark of a monthly budget, when the instant of its `PeriodEndsAt` has passed, then the call outside a run is served without an event (model/services/model-compute/ModelRouterService.yaml).",
        "AC4: Given `model-router-sql` created by the migrations on an isolated test database, when the mapping tests run, then the table `ProjectBudgetMarks` exists with the key over tenant and project and the columns `BudgetId`, `PeriodEndsAt` and `MarkedAt`, a query for one tenant never returns a mark of another, and a restarted replica refuses the same calls as before the restart (ADR-0015, model/services/model-compute/ModelRouterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6125",
        "AIFACTORY-TASK-6126",
        "AIFACTORY-TASK-6127",
        "AIFACTORY-TASK-6128"
      ],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6016,
      "kind": "behavior",
      "traces": {
        "services": [
          "ModelRouterService",
          "CostUsageService"
        ],
        "aggregates": [
          "ModelRouterService/InvocationReceipt"
        ],
        "apis": [
          "ModelRouterService/ModelGateway.Invoke"
        ],
        "events": [
          "CostUsageService/BudgetExceeded",
          "CostUsageService/BudgetUpdated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-566",
        "AIFACTORY-US-567",
        "feature:cost-usage-service-complete"
      ],
      "source": [
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1508]",
      "number": 1508
    },
    {
      "id": "AIFACTORY-TASK-6125",
      "type": "task",
      "parent": "AIFACTORY-US-1508",
      "title": "Persistence of the budget mark: the table ProjectBudgetMarks with its mapping",
      "sequence": "03.02.16.01",
      "description": "Persistence of the budget mark: the table ProjectBudgetMarks with its mapping. Expected output: Mapping and migration of ProjectBudgetMarks with the primary key over TenantId and ProjectId and the columns BudgetId, PeriodEndsAt, nullable for a total budget, and MarkedAt, under the tenant row filter; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Mapping and migration of ProjectBudgetMarks with the primary key over TenantId and ProjectId and the columns BudgetId, PeriodEndsAt, nullable for a total budget, and MarkedAt, under the tenant row filter; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6016,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-6125]",
      "number": 6125
    },
    {
      "id": "AIFACTORY-TASK-6126",
      "type": "task",
      "parent": "AIFACTORY-US-1508",
      "title": "The handlers MarkProjectBudgetExceeded and ClearProjectBudgetMark of the two budget events of CostUsageService",
      "sequence": "03.02.16.02",
      "description": "The handlers MarkProjectBudgetExceeded and ClearProjectBudgetMark of the two budget events of CostUsageService. Expected output: MarkProjectBudgetExceeded keeps one mark per tenant and project from BudgetExceeded, with or without a run, with the budget id and the turn of the period, and sets none for an event without a project; ClearProjectBudgetMark removes the mark when BudgetUpdated puts committedUsd at or below limitUsd and changes nothing otherwise; both are idempotent on the event id and publish nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "MarkProjectBudgetExceeded keeps one mark per tenant and project from BudgetExceeded, with or without a run, with the budget id and the turn of the period, and sets none for an event without a project; ClearProjectBudgetMark removes the mark when BudgetUpdated puts committedUsd at or below limitUsd and changes nothing otherwise; both are idempotent on the event id and publish nothing."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6016,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6126]",
      "number": 6126
    },
    {
      "id": "AIFACTORY-TASK-6127",
      "type": "task",
      "parent": "AIFACTORY-US-1508",
      "title": "The budget mark check of ModelGateway.Invoke for the calls outside a run",
      "sequence": "03.02.16.03",
      "description": "The budget mark check of ModelGateway.Invoke for the calls outside a run. Expected output: Before the policy decision ModelGateway.Invoke reads the mark of the tenant and the project of a call outside a run and refuses the call with RESOURCE_EXHAUSTED while the mark is in force, that is until PeriodEndsAt where the mark keeps one; it writes no receipt and calls no decision, broker or adapter for a refused call, and a run-bound call under the token of an attempt is never refused by the mark.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Before the policy decision ModelGateway.Invoke reads the mark of the tenant and the project of a call outside a run and refuses the call with RESOURCE_EXHAUSTED while the mark is in force, that is until PeriodEndsAt where the mark keeps one; it writes no receipt and calls no decision, broker or adapter for a refused call, and a run-bound call under the token of an attempt is never refused by the mark."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6016,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6127]",
      "number": 6127
    },
    {
      "id": "AIFACTORY-TASK-6128",
      "type": "task",
      "parent": "AIFACTORY-US-1508",
      "title": "Verify the budget mark through the acceptance suite",
      "sequence": "03.02.16.04",
      "description": "Verify the budget mark through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ProjectBudgetMark\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1508 with fixture publishers of BudgetExceeded and BudgetUpdated, a duplicate event id, a call outside a run refused with RESOURCE_EXHAUSTED beside a served run-bound call, the clear on a committed amount at the limit, the mark that stays above it, the turn of a monthly period, a two-tenant fixture and a restarted replica.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ProjectBudgetMark\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1508 with fixture publishers of BudgetExceeded and BudgetUpdated, a duplicate event id, a call outside a run refused with RESOURCE_EXHAUSTED beside a served run-bound call, the clear on a committed amount at the limit, the mark that stays above it, the turn of a monthly period, a two-tenant fixture and a restarted replica."
      ],
      "sourceArtifacts": [
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 60,
      "phase": "factory",
      "stackRank": 6016,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6128]",
      "number": 6128
    },
    {
      "id": "AIFACTORY-FEAT-016",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-003",
      "title": "ComputePoolService: complete delivery",
      "sequence": "03.03",
      "description": "ComputePoolService is the service of bounded context BC-41 (Compute Pools & Placement). Compute as an abstraction separate from models — registry of model-serving pools (local GPU, DGX-class, cloud GPU providers, Azure, customer data centre) with their metadata, utilization and warm model cache, and the placement decision that picks a pool for a self-hosted deployment under privacy, region, memory and cost constraints (BC-41). Its own repository is ConnectSoft.AI.SoftwareFactory.ComputePoolService. Delivers: ComputePoolService (complete). Increment I8: Expansion. Build order 181 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/model-compute/ComputePoolService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:model-compute",
        "type:feature",
        "route:backend-developer",
        "slice:i8-expansion",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 181,
      "phase": "factory",
      "stackRank": 18100,
      "titlePrefix": "[AIFACTORY-FEAT-016]",
      "number": 16
    },
    {
      "id": "AIFACTORY-EPIC-004",
      "type": "epic",
      "parent": null,
      "title": "Knowledge Platform (PF-04)",
      "sequence": "04",
      "description": "Everything that builds the Knowledge Platform platform (PF-04): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Ingestion, retrieval, graph, repository intelligence, artifacts, context assembly, promoted memory. Done when: Every service of the platform has its complete delivery accepted (ArtifactService, ContextBuilderService, KnowledgeHost, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService and 1 more), the platform gateway routes them under a trusted scope, and the outcome verification of I5 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (ArtifactService, ContextBuilderService, KnowledgeHost, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService and 1 more), the platform gateway routes them under a trusted scope, and the outcome verification of I5 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-017",
        "AIFACTORY-FEAT-018",
        "AIFACTORY-FEAT-019",
        "AIFACTORY-FEAT-020",
        "AIFACTORY-FEAT-021",
        "AIFACTORY-FEAT-022",
        "AIFACTORY-FEAT-023",
        "AIFACTORY-FEAT-024",
        "AIFACTORY-FEAT-025",
        "AIFACTORY-FEAT-026",
        "AIFACTORY-FEAT-027"
      ],
      "stackRank": 6099,
      "titlePrefix": "[AIFACTORY-EPIC-004]",
      "number": 4
    },
    {
      "id": "AIFACTORY-FEAT-017",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "ArtifactService: complete delivery",
      "sequence": "04.01",
      "description": "ArtifactService is the service of bounded context BC-12 (Artifacts & Lineage). The one authoritative writer of artifacts — immutable, hash-addressed content with metadata, classification, access scope, producing run and attempt, version chains and lineage to sources and inputs; previews and version history are projections (BC-12). Its own repository is ConnectSoft.AI.SoftwareFactory.ArtifactService. Delivers: ArtifactService (complete). Increment I1: Generate a microservice. Build order 61 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-059",
        "AIFACTORY-US-781",
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "AIFACTORY-US-784",
        "AIFACTORY-US-785",
        "AIFACTORY-US-786",
        "AIFACTORY-US-787",
        "AIFACTORY-US-788",
        "AIFACTORY-US-789",
        "AIFACTORY-US-790",
        "AIFACTORY-US-986"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6100,
      "titlePrefix": "[AIFACTORY-FEAT-017]",
      "number": 17
    },
    {
      "id": "AIFACTORY-US-059",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "ArtifactService serves its scope end to end",
      "sequence": "04.01.01",
      "description": "As a requester, I want every document my run depends on or produces stored once by hash with its producer, its lineage and its version chain, so that what a run used and produced can be read back, verified against its hash and explained later, and no other service holds content in its rows. This is the integration PBI of the feature: it proves on a deployed instance that ArtifactService is the one place where the Factory keeps content. ArtifactService is the authoritative writer of bounded context BC-12: immutable content addressed by hash with metadata, classification, access scope, the producing run, attempt and agent, a version chain and lineage edges to its inputs; previews and version history are projections of the same rows and never a second copy. Every other service keeps a reference and a hash and never content (ADR-0019). In this increment the callers are services, not people. Each presents a workload token that holds the service scope naming ArtifactService and forwards the tenant and the project of its work; such a token carries no tenant claim, and the forwarded scope is read only under that service scope (ADR-0015). RunControlService stores the resolved execution snapshot of a run before it accepts the run, WorkflowEngineService stores the task contract of a step before it announces the step ready, AgentRegistryService stores the manifests and the authoring documents of its seeded releases for the platform tenant and names no project, BlueprintService and GenerationRecipeService store their documents and reports, ModelRouterService and ToolAdapterService store outputs, results and receipts, and AgentRuntimeService reads the task contract and the snapshot of an attempt by reference and stores checkpoints and produced artifacts. These are callers the model lists; this feature adds none. The proof of this PBI is the hand-over of the first outcome through the deployed service, and its criteria state only what a deployed instance can prove; what the repository suites of the other PBIs prove is not proven again here. A document stored once through `Artifacts.Store` is read through `Artifacts.Fetch` by another workload of the same tenant with the same bytes and the same hash, a repeated store leaves one artifact, and a workload that forwards another tenant is answered NOT_FOUND. A release manifest that a registry-shaped workload stores for the platform tenant without a project becomes a tenant-level artifact of that tenant, which has no project (D125), and is fetched by a workload of another tenant with the stated hash, because the read filter admits the tenant-level artifacts of the platform tenant for every tenant through `Artifacts.Fetch` (AIFACTORY-US-783, AIFACTORY-US-784); without that path the runtime and ModelRouterService, which work under the tenant of a customer, could not read the documents of the seeded releases, and the chain of the first outcome could not run. The hand-over survives a restart of the service, and `ArtifactStored` reaches a subscriber on the deployed transport once per stored document in the run event envelope of the contracts package. The repository, the aggregate and the store come from AIFACTORY-US-781, the hosted surface from AIFACTORY-US-782 and tenancy, secrets and telemetry from AIFACTORY-US-783. Storing (AIFACTORY-US-784), fetching (AIFACTORY-US-785), the validation verdict (AIFACTORY-US-786), the metadata, version and run reads (AIFACTORY-US-787), the preview (AIFACTORY-US-788), the deletion of content with the retention sweep (AIFACTORY-US-789), the export with the confirmation of a closing project (AIFACTORY-US-790) and the reference records that spare an artifact from the sweep (AIFACTORY-US-986) complete the delivery. The five REST operations are hosted and proven here. A person reaches them through the Knowledge gateway KnowledgeHost, which feature `knowledge-host` delivers in this increment and which is the only route by which a person reads or exports an artifact (D125); a user token carries the audience of that gateway, and this feature builds no direct route for a person. Of the eight consumed events of the model the feature registers the handlers of five: `RunCompleted`, `RunFailed` and `RunCancelled` of RunControlService, `ProjectStateChanged` of ProjectService and `ClassificationChanged` of AuditService. It also receives the audit evidence event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted`, which the model states as the command `RecordEvidenceReference` (AIFACTORY-US-986). The other three consumed events come from RetentionResidencyService, which is first delivered in I4: the handler of `DeletionOrderIssued` is built there with that service and is not registered here, and the handlers `ApplyRetentionRule` and `ApplyLegalHold` are not built either, because the store class a retention rule names and the scope a legal hold names are defined with that service. Until then no legal hold exists and no retention rule sets a project retention, so the default retention applies to every project artifact. The retention sweep is effective in this increment (D125): `RetentionSweeper` deletes content past the default of `Knowledge:Artifacts:DefaultRetentionDays`, one year (ADR-0019 decision 4), that no audit evidence record and no unexpired run references, as the reference records of the service tell, and a tenant-level artifact is no candidate (AIFACTORY-US-789). That no feature of the backlog builds the two handlers `ApplyRetentionRule` and `ApplyLegalHold` is reported to the owner. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Kind: behavior. Traces: services: ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Store, ArtifactService/Artifacts.Fetch; events: ArtifactService/ArtifactStored; descriptors: artifact-v1, resolved-execution-snapshot-v1, agent-task-contract-v1, release-manifest-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: FR-08. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-781, AIFACTORY-US-782, AIFACTORY-US-783, AIFACTORY-US-784, AIFACTORY-US-785, AIFACTORY-US-786, AIFACTORY-US-787, AIFACTORY-US-788, AIFACTORY-US-789, AIFACTORY-US-790, AIFACTORY-US-986, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package. Sources: model/services/knowledge/ArtifactService.yaml, model/backlog/features/knowledge.yaml, docs/planes/knowledge-memory/services/artifact-service/index.md, docs/architecture/adr/0019-data-governance.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the container image that the pipeline of the repository published (AIFACTORY-US-781), deployed in the acceptance environment with its secret references for `artifact-blob` and `messaging-transport`, when the instance starts against the `artifact-sql`, the blob store and the identity authority of that environment, then its readiness turns ready and the hand-over suite of this PBI calls that instance over the network and no in-process host; the scaffold, the hosted surface, tenancy and telemetry are proven by AIFACTORY-US-781, AIFACTORY-US-782 and AIFACTORY-US-783 and are not proven again here (ADR-0028, model/services/knowledge/ArtifactService.yaml).",
        "AC2: Given the deployed service and two workloads of one tenant and project, each with a workload token that holds the service scope, when the first stores a `resolved-execution-snapshot-v1` document and an `agent-task-contract-v1` document through `ArtifactService/Artifacts.Store` and the second reads each through `ArtifactService/Artifacts.Fetch` by the reference of the reply, then the bytes read have the content hash the reply stated and a repeated store of the same document in the same chain returns the same artifact and leaves one `ArtifactService/Artifact`; and when a registry-shaped workload stores a `release-manifest-v1` document for the platform tenant without a project, then it is a tenant-level artifact of the platform tenant and a workload of another tenant fetches it with the hash the reply stated (ADR-0015).",
        "AC3: Given the stored documents of AC2 and a workload that forwards another tenant, when it calls `ArtifactService/Artifacts.Fetch` with the reference of a document of the first tenant, then the answer is NOT_FOUND exactly as for an unknown reference and no content is streamed; when it stores other content under the name of the release manifest without a project, then the artifact is written in its own tenant and the manifest of the platform tenant is unchanged; and a call without a workload identity is refused before any handler runs (ADR-0015).",
        "AC4: Given the documents of AC2 stored on the deployed instance, when the instance is restarted and the hand-over is repeated, then every document is fetched through `ArtifactService/Artifacts.Fetch` with the same bytes and the same hash, a repeated `ArtifactService/Artifacts.Store` of each returns the artifact stored before the restart, and no second `ArtifactService/Artifact`, blob or outbox record exists (ADR-0019).",
        "AC5: Given the subscriber of the fixture on `artifacts.artifacts.v1.artifact-stored` of the deployed transport, when the hand-over of AC2 and its repetition of AC4 have run, then it received exactly one `ArtifactService/ArtifactStored` per stored document in the run event envelope, the one of the release manifest without a `projectId`, because a tenant-level artifact has none, none for a repeated store and none that carries content (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3151",
        "AIFACTORY-TASK-760"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6101,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store",
          "ArtifactService/Artifacts.Fetch"
        ],
        "events": [
          "ArtifactService/ArtifactStored"
        ],
        "descriptors": [
          "artifact-v1",
          "resolved-execution-snapshot-v1",
          "agent-task-contract-v1",
          "release-manifest-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-781",
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "AIFACTORY-US-784",
        "AIFACTORY-US-785",
        "AIFACTORY-US-786",
        "AIFACTORY-US-787",
        "AIFACTORY-US-788",
        "AIFACTORY-US-789",
        "AIFACTORY-US-790",
        "AIFACTORY-US-986",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-059]",
      "number": 59
    },
    {
      "id": "AIFACTORY-TASK-3151",
      "type": "task",
      "parent": "AIFACTORY-US-059",
      "title": "Hand-over fixture of the first outcome for the deployed service",
      "sequence": "04.01.01.01",
      "description": "Hand-over fixture of the first outcome for the deployed service. Expected output: The acceptance suite holds one resolved-execution-snapshot-v1 document and one agent-task-contract-v1 document valid against docs/reference/schemas/resolved-execution-snapshot.schema.json and docs/reference/schemas/agent-task-contract.schema.json, one Draft release manifest with the candidate fields of docs/reference/schemas/release-manifest.schema.json as AgentRegistryService seeds it, two workload identities of one tenant and project, one workload identity that forwards another tenant, and one registry-shaped workload identity that forwards the platform tenant of the environment and no project, each with a token that holds the service scope naming ArtifactService, a subscriber on artifacts.artifacts.v1.artifact-stored of the deployed transport that records every delivered envelope, and a step that restarts the deployed instance and waits for its readiness, so that the hand-over of AC2 to AC5 of AIFACTORY-US-059 runs against the deployed service without RunControlService, WorkflowEngineService, AgentRegistryService or AgentRuntimeService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The acceptance suite holds one resolved-execution-snapshot-v1 document and one agent-task-contract-v1 document valid against docs/reference/schemas/resolved-execution-snapshot.schema.json and docs/reference/schemas/agent-task-contract.schema.json, one Draft release manifest with the candidate fields of docs/reference/schemas/release-manifest.schema.json as AgentRegistryService seeds it, two workload identities of one tenant and project, one workload identity that forwards another tenant, and one registry-shaped workload identity that forwards the platform tenant of the environment and no project, each with a token that holds the service scope naming ArtifactService, a subscriber on artifacts.artifacts.v1.artifact-stored of the deployed transport that records every delivered envelope, and a step that restarts the deployed instance and waits for its readiness, so that the hand-over of AC2 to AC5 of AIFACTORY-US-059 runs against the deployed service without RunControlService, WorkflowEngineService, AgentRegistryService or AgentRuntimeService."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6101,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3151]",
      "number": 3151
    },
    {
      "id": "AIFACTORY-TASK-760",
      "type": "task",
      "parent": "AIFACTORY-US-059",
      "title": "Verify artifact-service-serves-its-scope by running the declared command",
      "sequence": "04.01.01.02",
      "description": "Verify artifact-service-serves-its-scope by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ArtifactHandOver\"` against the deployed service; a run that discovers no test and a zero-match filter count as failures; the run against the deployed instance proves AC1 to AC5 of AIFACTORY-US-059, that is the readiness of the deployed image, the two documents stored once through `ArtifactService/Artifacts.Store` and read with the stated hash through `ArtifactService/Artifacts.Fetch`, the release manifest stored for the platform tenant without a project and fetched by a workload of another tenant, NOT_FOUND for the workload of another tenant and its store that leaves the platform document unchanged, the hand-over repeated after a restart, and exactly one ArtifactStored per stored document on the deployed transport; the thirteen scenarios SCN-ArtifactService-001 to SCN-ArtifactService-013 are proven by the suites of AIFACTORY-US-784 to AIFACTORY-US-790, and the reference records by the suite of AIFACTORY-US-986.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ArtifactHandOver\"` against the deployed service; a run that discovers no test and a zero-match filter count as failures; the run against the deployed instance proves AC1 to AC5 of AIFACTORY-US-059, that is the readiness of the deployed image, the two documents stored once through `ArtifactService/Artifacts.Store` and read with the stated hash through `ArtifactService/Artifacts.Fetch`, the release manifest stored for the platform tenant without a project and fetched by a workload of another tenant, NOT_FOUND for the workload of another tenant and its store that leaves the platform document unchanged, the hand-over repeated after a restart, and exactly one ArtifactStored per stored document on the deployed transport; the thirteen scenarios SCN-ArtifactService-001 to SCN-ArtifactService-013 are proven by the suites of AIFACTORY-US-784 to AIFACTORY-US-790, and the reference records by the suite of AIFACTORY-US-986."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-760]",
      "number": 760
    },
    {
      "id": "AIFACTORY-US-781",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "ArtifactService repository: scaffolded from the base template with the Factory profile, with the Artifact aggregate and the store artifact-sql",
      "sequence": "04.01.02",
      "description": "ArtifactService has its own repository, ConnectSoft.AI.SoftwareFactory.ArtifactService, its own deployable and its own stores (ADR-0028). The repository is created and scaffolded in I0 by AIFACTORY-TASK-054 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ArtifactService --UseFactoryProfile true`, generated from the template package at the version the gate of feature `component-base-template-factory-profile` published, with the messaging service name `artifact`, the default of `OrleansMessaging:ServiceName` in the model. Token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again; the repository pins the contracts package, from which it takes the run event envelope, the topic constants and the event types. On that scaffold this PBI builds the domain model and the relational store and delivers no behaviour of an operation. The aggregate `Artifact` of the model has twenty-three fields. This PBI builds twenty of them, from `artifactId`, `tenantId` and the optional `projectId`, which is absent for a tenant-level artifact (D125), over `kind`, `name`, `contentHash`, `contentRef`, `sizeBytes`, `mediaType`, `classification`, `accessScope` and the optional `descriptor` to the optional producer (`producerRunId`, `producerAttemptId`, `producerAgentId`), `chainId`, `versionInChain`, `state`, the optional `validationRef` and `createdAt`, with the entity `LineageEdge` (input kind, input reference, relation). The other three fields, `passed`, `finalOutput` and `pendingRemoval`, and the entities `ArtifactReference` and `ExportRequest` are in the model as well (D125) and are built with their columns and tables by the PBIs that deliver their behaviour: AIFACTORY-US-786, AIFACTORY-US-787, AIFACTORY-US-789, AIFACTORY-US-986 and AIFACTORY-US-790. The aggregate has the enums `ArtifactKind`, whose eleven values include Prompt and ModelOutput so that content never lives in the rows of another service, and `ArtifactState`. The state machine has exactly the six transitions of the model: Stored to Validated on `ValidationRecorded`, Stored to Superseded and Validated to Superseded on `NewVersionStored`, and Stored, Validated and Superseded to Deleted on `Delete`. The aggregate refuses every other pair: nothing leaves Deleted, a Superseded artifact is never Validated and a Validated artifact never returns to Stored. The invariants hold in the aggregate: the content members `contentHash`, `contentRef`, `sizeBytes` and `mediaType` cannot change after creation, a new content hash is a new artifact with the next `versionInChain` of its chain, and `Delete` clears neither metadata nor a lineage edge. The store `artifact-sql` has five tables in the model. This PBI creates three of them, `VersionChains`, `Artifacts` and `LineageEdges`, with the columns of the twenty fields, the foreign keys, the unique indexes `UX_Chains_Project_Name` and `UX_Artifacts_Chain_Version` and the indexes `IX_Artifacts_Tenant_Hash`, `IX_Artifacts_ProducerRun` and `IX_Lineage_Input`. `ProjectId` is nullable in `Artifacts` and in `VersionChains` and is empty for a tenant-level artifact and for its chain, and `UX_Chains_Project_Name` covers `TenantId`, `ProjectId` and `Name`, so that the chain of a tenant-level artifact is found by tenant and name and tenant-level chains of two tenants with the same name do not collide (D125). The columns `Passed`, `FinalOutput` and `PendingRemoval` of `Artifacts`, the column `Closed` of `VersionChains` and the tables `ArtifactReferences` and `ExportRequests` are created by the migrations of the PBIs named above. Every table has the tenant column and every mapping carries the tenant row filter of the profile. No column holds content: a row holds the hash and the reference of a blob in `artifact-blob`. Mapping tests run against an isolated test database, never a shared one. Kind: enabling. Traces: services: ArtifactService; aggregates: ArtifactService/Artifact; adrs: ADR-0019, ADR-0028; requirements: FR-08. Depends on: feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:repository-and-pipeline-conventions. Sources: model/services/knowledge/ArtifactService.yaml, docs/planes/knowledge-memory/services/artifact-service/ddl.md, docs/planes/knowledge-memory/services/artifact-service/index.md#data-model-and-storage, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-054 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ArtifactService --UseFactoryProfile true` from the template package at its published version with the messaging service name `artifact`, when the pipeline of the repository runs with the work of this feature, then the solution builds, the generated tests pass with complete reports and a container image is published (ADR-0028).",
        "AC2: Given the aggregate `ArtifactService/Artifact`, when each of the six transitions of model/services/knowledge/ArtifactService.yaml is applied from its listed source state, then it succeeds, and every other pair of states, a transition out of Deleted, Superseded to Validated and Validated to Stored among them, is refused with the artifact unchanged.",
        "AC3: Given an empty `artifact-sql`, when the migrations run, then `VersionChains`, `Artifacts` and `LineageEdges` exist with the columns of the twenty fields, the keys and the indexes of docs/planes/knowledge-memory/services/artifact-service/ddl.md, `ProjectId` accepts an empty value in `Artifacts` and in `VersionChains`, a second row with the same `ChainId` and `VersionInChain` and a second chain with the same `TenantId`, `ProjectId` and `Name`, two chains of one tenant with an empty `ProjectId` and the same name included, are refused by their unique indexes, chains of two tenants with an empty `ProjectId` and the same name are both accepted, and rows of two tenants read under the scope of one tenant return only the rows of that tenant.",
        "AC4: Given a created `ArtifactService/Artifact`, when a change of `contentHash`, `contentRef`, `sizeBytes` or `mediaType` is attempted through the aggregate, then it is refused, and no table of `artifact-sql` has a column that holds content, so that content exists only in `artifact-blob` under its hash (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/ddl.md",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#data-model-and-storage",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-055",
        "AIFACTORY-TASK-056",
        "AIFACTORY-TASK-3152"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6102,
      "kind": "enabling",
      "traces": {
        "services": [
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "adrs": [
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/ddl.md",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#data-model-and-storage",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-781]",
      "number": 781
    },
    {
      "id": "AIFACTORY-TASK-055",
      "type": "task",
      "parent": "AIFACTORY-US-781",
      "title": "Domain model: the Artifact aggregate with LineageEdge, ArtifactKind, ArtifactState and its six transitions",
      "sequence": "04.01.02.01",
      "description": "Domain model: the Artifact aggregate with LineageEdge, ArtifactKind, ArtifactState and its six transitions. Expected output: The aggregate Artifact with twenty of the twenty-three fields of model/services/knowledge/ArtifactService.yaml, projectId being optional and absent for a tenant-level artifact (D125), the entity LineageEdge and the enums ArtifactKind and ArtifactState; the fields passed, finalOutput and pendingRemoval and the entities ArtifactReference and ExportRequest are built by AIFACTORY-US-786, AIFACTORY-US-787, AIFACTORY-US-789, AIFACTORY-US-986 and AIFACTORY-US-790; the six transitions under their triggers ValidationRecorded, NewVersionStored and Delete and the refusal of every other pair of states; the content members are immutable after creation and Delete keeps metadata and lineage edges; unit tests cover every transition, every refused pair and every invariant the aggregate can enforce.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregate Artifact with twenty of the twenty-three fields of model/services/knowledge/ArtifactService.yaml, projectId being optional and absent for a tenant-level artifact (D125), the entity LineageEdge and the enums ArtifactKind and ArtifactState; the fields passed, finalOutput and pendingRemoval and the entities ArtifactReference and ExportRequest are built by AIFACTORY-US-786, AIFACTORY-US-787, AIFACTORY-US-789, AIFACTORY-US-986 and AIFACTORY-US-790; the six transitions under their triggers ValidationRecorded, NewVersionStored and Delete and the refusal of every other pair of states; the content members are immutable after creation and Delete keeps metadata and lineage edges; unit tests cover every transition, every refused pair and every invariant the aggregate can enforce."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-055]",
      "number": 55
    },
    {
      "id": "AIFACTORY-TASK-056",
      "type": "task",
      "parent": "AIFACTORY-US-781",
      "title": "Persistence in artifact-sql: migrations and mappings of VersionChains, Artifacts and LineageEdges",
      "sequence": "04.01.02.02",
      "description": "Persistence in artifact-sql: migrations and mappings of VersionChains, Artifacts and LineageEdges. Expected output: Migrations and mappings of the tables VersionChains, Artifacts and LineageEdges of the model with the columns of the twenty fields of AIFACTORY-TASK-055, the foreign keys, the unique indexes UX_Chains_Project_Name on TenantId, ProjectId and Name and UX_Artifacts_Chain_Version and the indexes IX_Artifacts_Tenant_Hash, IX_Artifacts_ProducerRun and IX_Lineage_Input; ProjectId is nullable in Artifacts and in VersionChains and empty for a tenant-level artifact and its chain (D125); the columns Passed, FinalOutput, PendingRemoval and Closed and the tables ArtifactReferences and ExportRequests are created by the migrations of AIFACTORY-TASK-3162, AIFACTORY-TASK-3166, AIFACTORY-TASK-3188, AIFACTORY-TASK-3971 and AIFACTORY-TASK-3176; every mapping carries the tenant row filter of the Factory profile and no column holds content; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Migrations and mappings of the tables VersionChains, Artifacts and LineageEdges of the model with the columns of the twenty fields of AIFACTORY-TASK-055, the foreign keys, the unique indexes UX_Chains_Project_Name on TenantId, ProjectId and Name and UX_Artifacts_Chain_Version and the indexes IX_Artifacts_Tenant_Hash, IX_Artifacts_ProducerRun and IX_Lineage_Input; ProjectId is nullable in Artifacts and in VersionChains and empty for a tenant-level artifact and its chain (D125); the columns Passed, FinalOutput, PendingRemoval and Closed and the tables ArtifactReferences and ExportRequests are created by the migrations of AIFACTORY-TASK-3162, AIFACTORY-TASK-3166, AIFACTORY-TASK-3188, AIFACTORY-TASK-3971 and AIFACTORY-TASK-3176; every mapping carries the tenant row filter of the Factory profile and no column holds content; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6102,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-056]",
      "number": 56
    },
    {
      "id": "AIFACTORY-TASK-3152",
      "type": "task",
      "parent": "AIFACTORY-US-781",
      "title": "Verify the scaffold, the aggregate and the store of ArtifactService",
      "sequence": "04.01.02.03",
      "description": "Verify the scaffold, the aggregate and the store of ArtifactService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"` in the pipeline of the repository; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-781: the unchanged scaffold with the Factory profile, the six transitions and the refused pairs of the aggregate, the three tables with their unique indexes, the empty ProjectId of a tenant-level artifact and of its chain, the two tenant-level chains of one tenant with the same name refused and those of two tenants accepted, the tenant row filter against an isolated database, and the absence of a content column.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"` in the pipeline of the repository; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-781: the unchanged scaffold with the Factory profile, the six transitions and the refused pairs of the aggregate, the three tables with their unique indexes, the empty ProjectId of a tenant-level artifact and of its chain, the two tenant-level chains of one tenant with the same name refused and those of two tenants accepted, the tenant row filter against an isolated database, and the absence of a content column."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3152]",
      "number": 3152
    },
    {
      "id": "AIFACTORY-US-782",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "ArtifactService host: five REST routes and three gRPC methods behind scope policies, messaging with the five events of the model and the audit evidence event, and two hosted workers",
      "sequence": "04.01.03",
      "description": "This PBI hosts the surface of the service and delivers the behaviour of no operation. The service descriptor file of the repository lists the eight operations as the model does. The REST operations are `GetArtifact`, `PreviewArtifact` and `ListArtifactVersions` under the scope `factory.artifacts.read`, `ListRunArtifacts` under `factory.runs.read` and `ExportArtifacts` under `factory.artifacts.admin`, of class external and idempotent on the `Idempotency-Key` header. The internal gRPC methods of the service `Artifacts` are `Store` (client streaming, shared-write), `Fetch` (server streaming, read) and `RecordValidation` (no streaming, shared-write). The contract test of the profile compares the hosted endpoints with that file in both directions. Each REST route sits behind the policy of its scope: a call without a token is answered 401, a valid user token without the scope or without a role in the project the request addresses is answered 403, and the audience a user token must carry is the one of the Knowledge gateway that fronts the service and that feature `knowledge-host` delivers in this increment (D125), because a user token has one audience and a gateway forwards it unchanged (ADR-0015). A workload token carries service scopes and never satisfies a REST scope policy. Each gRPC method requires a workload token that holds the service scope naming ArtifactService: a call without a workload identity is refused with UNAUTHENTICATED and a token without that scope with PERMISSION_DENIED, and the tenant and the project a workload forwards are read only under that scope. The answers that the model does not list for an operation, 401 for a missing token, 400 for an `ExportArtifacts` call without its key header and 503 while a required dependency does not answer, are given by the host and are reported to the owner as codes the model omits. The OpenAPI document and the proto fix the messages. `artifact-v1` is the metadata message of `Store`, `Fetch` and `GetArtifact`, and `ack-v1` is the reply of `RecordValidation`. The published schema docs/reference/schemas/artifact.schema.json follows the aggregate of the model (D125). `projectId` and the producer are optional, `kind` holds the eleven values of `ArtifactKind`, the chain is stated as `chainId` and `versionInChain`, `accessScope`, `state`, `passed` and `validationRef` are members, and `contentHash` has the pattern of the prefix `sha256:` followed by sixty-four lowercase hexadecimal characters. Golden files fix the messages, and the contract test compares the eighteen members the schema and the aggregate share by name, `artifactId`, `tenantId`, `projectId`, `kind`, `name`, `mediaType`, `contentHash`, `contentRef`, `sizeBytes`, `classification`, `accessScope`, `descriptor`, `chainId`, `versionInChain`, `state`, `passed`, `validationRef` and `createdAt`, and the required member `validation` with its `status`, which the message reads from `passed` as AIFACTORY-US-786 states. The list of members the two sides do not share is short and the test holds it completely. The schema states the producer as the optional object `producedBy` with `runId`, `attemptId` and `agentId`, which the message fills from `producerRunId`, `producerAttemptId` and `producerAgentId`, and with `stepId` and `releaseId`, which have no counterpart on the aggregate and stay absent. The schema states lineage as `sources` with `sourceId`, `revision` and `chunkIds`, the aggregate as lineage edges with input kind, input reference and relation. Only the schema has `retention` and, inside `validation`, `checks` and `unverifiedClaims`, which the message leaves absent. Only the aggregate has `finalOutput` and `pendingRemoval`, which the metadata message cannot carry because the schema allows no additional property. The names of the producer members, the verdict that the schema states as `passed` and again as `validation.status`, and the two fields outside the schema are reported to the owner as remaining differences and are not decided here. The messaging profile of the service is named `artifact`. The outbox writer enlists in the unit of work of a command, a handler or a worker step, so that a state change and its event commit together. The profile requires declared routing: every message the service publishes is listed under `PublishedEvents` of the `OrleansMessaging` section with a subscription or an unrouted reason, the start fails otherwise and an undeclared publish is refused. The section therefore declares six entries. Five are the events of the model with their topics, `ArtifactStored`, `ArtifactValidated`, `ArtifactSuperseded`, `ArtifactDeleted` and `ProjectDataOffboarded`, each with its route, in the run event envelope of the pinned contracts package (ADR-0014). The sixth is the audit evidence event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted`, declared with the event type and the topic constant of the pinned contracts package and its route to AuditService, because the deletion and the export write an `audit-evidence-v1` record to the outbox of this service in the transaction of their command (AIFACTORY-US-789, AIFACTORY-US-790). The service publishes no message to itself: a recorded export request reaches `ExportWorker` as a row of the table `ExportRequests` and through no message (D125). The inbox registers five consumed events of other services, each handler deduplicated on the event id: `RunCompleted` of RunControlService for `SealRunArtifacts` and for `RecordRunEnd`, `RunFailed` and `RunCancelled` of RunControlService for `RecordRunEnd`, `ProjectStateChanged` of ProjectService for `ExportOrDeleteOnClosing` and `ClassificationChanged` of AuditService for `ApplyClassification`. It also subscribes to `audit.evidence.v1.evidence-submitted`, the topic on which every service delivers its audit evidence in the run event envelope, for the command `RecordEvidenceReference` of the model, deduplicated on the evidence id; the service receives its own evidence records on that topic like those of every other service (D125). The three events of RetentionResidencyService are not subscribed. Two workers are hosted with the retry policies, idempotency keys and concurrency of the model: `RetentionSweeper` on the schedule `0 4 * * *` with a fixed retry of three attempts, the key `artifactId` and at most two in parallel partitioned by tenant, and `ExportWorker` with an exponential retry of five attempts, the key of project and export request and one at a time per tenant. The model gives `ExportWorker` two triggers: `ProjectStateChanged` of ProjectService, and a recorded export request, a row of `ExportRequests` in the state requested, which no event announces (D125). In this delivery `ProjectStateChanged` reaches the worker through the handler `ExportOrDeleteOnClosing`, which records the work of a closing project as such a row, so the worker has one input for a requested export and for a closing project alike: it picks up the rows in the state requested, which it reads per tenant through the index `IX_ExportRequests_Tenant_State`. How often the worker looks for recorded requests is a configuration value the model does not list. What each handler and worker does is delivered by AIFACTORY-US-787 to AIFACTORY-US-790 and by AIFACTORY-US-986. The options `Knowledge:Artifacts:MaxArtifactMb`, `Knowledge:Artifacts:PreviewRenderers` and `Knowledge:Artifacts:DefaultRetentionDays`, all three reloadable, and `OrleansMessaging:ServiceName` are bound from configuration. Kind: enabling. Traces: services: ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/GetArtifact, ArtifactService/PreviewArtifact, ArtifactService/ListArtifactVersions, ArtifactService/ListRunArtifacts, ArtifactService/ExportArtifacts, ArtifactService/Artifacts.Store, ArtifactService/Artifacts.Fetch, ArtifactService/Artifacts.RecordValidation; events: ArtifactService/ArtifactStored, ArtifactService/ArtifactValidated, ArtifactService/ArtifactSuperseded, ArtifactService/ArtifactDeleted, ArtifactService/ProjectDataOffboarded; descriptors: artifact-v1, ack-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-781, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-audit-factory-evidence. Sources: model/services/knowledge/ArtifactService.yaml, docs/reference/schemas/artifact.schema.json, docs/planes/knowledge-memory/services/artifact-service/index.md#apis, docs/planes/knowledge-memory/services/artifact-service/index.md#messages, docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given the service descriptor file and the hosted surface, when the contract test of the profile runs, then exactly the routes of `ArtifactService/GetArtifact`, `ArtifactService/PreviewArtifact`, `ArtifactService/ListArtifactVersions`, `ArtifactService/ListRunArtifacts` and `ArtifactService/ExportArtifacts` and the methods `ArtifactService/Artifacts.Store`, `ArtifactService/Artifacts.Fetch` and `ArtifactService/Artifacts.RecordValidation` are hosted with the scope, the side-effect class and the idempotency rule of model/services/knowledge/ArtifactService.yaml, and the test fails on an endpoint the file does not name and on an operation without an endpoint.",
        "AC2: Given each REST route called without a token, with a valid user token that lacks the scope of the route and with a user token of another audience, and each gRPC method called without a workload identity and with a workload token that lacks the service scope, when the call arrives, then it is answered 401, 403, 401, UNAUTHENTICATED and PERMISSION_DENIED respectively before any handler runs, and nothing is read or written (ADR-0015).",
        "AC3: Given a command that changes an `ArtifactService/Artifact` and is rolled back and one that commits, when the outbox of the `artifact` messaging profile is read, then the first left no record and the second left its record in the transaction of the change, the dispatcher publishes it in the run event envelope on the topic the model names for the event; the `OrleansMessaging` section declares the five events of the model and the audit evidence event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` with its route to AuditService, six entries and no message the service publishes to itself; an `audit-evidence-v1` record written through the sink of the audit library in the transaction of a command leaves the outbox on that topic; and a publish of a message the section does not declare is refused (ADR-0014, ADR-0012).",
        "AC4: Given fixture publishers of the five subscribed events and of the audit evidence event built from the pinned contracts package, when the same event id or the same evidence id is delivered twice, a recorded export request in the state requested is found by two looks of `ExportWorker`, or the schedule of `RetentionSweeper` fires twice under one idempotency key, then each handler or the worker runs once, `RunCompleted` reaches both `SealRunArtifacts` and `RecordRunEnd`, a handler that keeps failing is retried with backoff and never applied twice, and an event of RetentionResidencyService reaches no handler (model/services/knowledge/ArtifactService.yaml).",
        "AC5: Given the golden files of the proto and of the OpenAPI document, when the contract test compares the metadata message with docs/reference/schemas/artifact.schema.json, then the eighteen shared members `artifactId`, `tenantId`, `projectId`, `kind`, `name`, `mediaType`, `contentHash`, `contentRef`, `sizeBytes`, `classification`, `accessScope`, `descriptor`, `chainId`, `versionInChain`, `state`, `passed`, `validationRef` and `createdAt` and the member `validation` with its `status` are equal in name and type, `kind` holds the eleven values of `ArtifactKind`, `contentHash` matches the pattern of the schema, a message without `projectId` and without `producedBy` is valid, the test lists every member the schema and the aggregate do not share, that is `producedBy` against the three producer members, `sources` against the lineage edges, `retention`, `checks` and `unverifiedClaims`, which only the schema has, and `finalOutput` and `pendingRemoval`, which only the aggregate has, and a change of either side fails it."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/artifact.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#apis",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#messages",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-057",
        "AIFACTORY-TASK-058",
        "AIFACTORY-TASK-059",
        "AIFACTORY-TASK-3153"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6103,
      "kind": "enabling",
      "traces": {
        "services": [
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/GetArtifact",
          "ArtifactService/PreviewArtifact",
          "ArtifactService/ListArtifactVersions",
          "ArtifactService/ListRunArtifacts",
          "ArtifactService/ExportArtifacts",
          "ArtifactService/Artifacts.Store",
          "ArtifactService/Artifacts.Fetch",
          "ArtifactService/Artifacts.RecordValidation"
        ],
        "events": [
          "ArtifactService/ArtifactStored",
          "ArtifactService/ArtifactValidated",
          "ArtifactService/ArtifactSuperseded",
          "ArtifactService/ArtifactDeleted",
          "ArtifactService/ProjectDataOffboarded"
        ],
        "descriptors": [
          "artifact-v1",
          "ack-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-781",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/artifact.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#apis",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#messages",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-782]",
      "number": 782
    },
    {
      "id": "AIFACTORY-TASK-057",
      "type": "task",
      "parent": "AIFACTORY-US-782",
      "title": "Contract and hosting of the surface: service descriptor, OpenAPI document and proto of the 5 REST and 3 gRPC operations behind their scope policies",
      "sequence": "04.01.03.01",
      "description": "Contract and hosting of the surface: service descriptor, OpenAPI document and proto of the 5 REST and 3 gRPC operations behind their scope policies. Expected output: The service descriptor file lists GetArtifact, PreviewArtifact, ListArtifactVersions, ListRunArtifacts, ExportArtifacts and Artifacts.Store, Artifacts.Fetch and Artifacts.RecordValidation with scope, side-effect class, idempotency and response codes as model/services/knowledge/ArtifactService.yaml does; the five routes are hosted behind the policies of factory.artifacts.read, factory.runs.read and factory.artifacts.admin with problem responses, the Idempotency-Key filter of ExportArtifacts and the audience of the Knowledge gateway for user tokens; the three methods are hosted behind the workload policy of the service scope; ListRunArtifacts is described with the codes 200 and 403 of the model and no 404 (D125); the OpenAPI document and the proto fix artifact-v1 and ack-v1 by golden files, which hold the text form of contentHash that the pattern of the schema fixes (the prefix sha256: and sixty-four lowercase hexadecimal characters), a message without projectId and without producedBy for a tenant-level artifact stored outside a run, and the member validation with its status (unvalidated, valid, invalid) beside passed and validationRef; the contract test compares the eighteen shared members and validation.status with docs/reference/schemas/artifact.schema.json, which follows the aggregate (D125), and lists every member the schema and the aggregate do not share: producedBy with runId, attemptId and agentId against producerRunId, producerAttemptId and producerAgentId, with stepId and releaseId that have no counterpart; sources against the lineage edges; retention and the members checks and unverifiedClaims of validation, which only the schema has; and finalOutput and pendingRemoval, which only the aggregate has; the behaviour of each operation is delivered by AIFACTORY-US-784 to AIFACTORY-US-790, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists GetArtifact, PreviewArtifact, ListArtifactVersions, ListRunArtifacts, ExportArtifacts and Artifacts.Store, Artifacts.Fetch and Artifacts.RecordValidation with scope, side-effect class, idempotency and response codes as model/services/knowledge/ArtifactService.yaml does; the five routes are hosted behind the policies of factory.artifacts.read, factory.runs.read and factory.artifacts.admin with problem responses, the Idempotency-Key filter of ExportArtifacts and the audience of the Knowledge gateway for user tokens; the three methods are hosted behind the workload policy of the service scope; ListRunArtifacts is described with the codes 200 and 403 of the model and no 404 (D125); the OpenAPI document and the proto fix artifact-v1 and ack-v1 by golden files, which hold the text form of contentHash that the pattern of the schema fixes (the prefix sha256: and sixty-four lowercase hexadecimal characters), a message without projectId and without producedBy for a tenant-level artifact stored outside a run, and the member validation with its status (unvalidated, valid, invalid) beside passed and validationRef; the contract test compares the eighteen shared members and validation.status with docs/reference/schemas/artifact.schema.json, which follows the aggregate (D125), and lists every member the schema and the aggregate do not share: producedBy with runId, attemptId and agentId against producerRunId, producerAttemptId and producerAgentId, with stepId and releaseId that have no counterpart; sources against the lineage edges; retention and the members checks and unverifiedClaims of validation, which only the schema has; and finalOutput and pendingRemoval, which only the aggregate has; the behaviour of each operation is delivered by AIFACTORY-US-784 to AIFACTORY-US-790, not here."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6103,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-057]",
      "number": 57
    },
    {
      "id": "AIFACTORY-TASK-058",
      "type": "task",
      "parent": "AIFACTORY-US-782",
      "title": "Messaging skeleton: outbox and inbox wiring of the artifact profile for the 5 events of the model, the audit evidence event as published and as received, and 5 consumed events",
      "sequence": "04.01.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the artifact profile for the 5 events of the model, the audit evidence event as published and as received, and 5 consumed events. Expected output: The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the artifact messaging profile publishes ArtifactStored, ArtifactValidated, ArtifactSuperseded, ArtifactDeleted and ProjectDataOffboarded in the run event envelope of the pinned contracts package, each declared with its topic and route under PublishedEvents of the OrleansMessaging section; the section declares a sixth published event, AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, with the event type and the topic constant of the pinned contracts package and its route to AuditService, so that the sink of the pinned audit library writes audit-evidence-v1 records to the outbox of the service without an undeclared publish; the section declares these six entries and no message the service publishes to itself, because a recorded export request reaches ExportWorker as a row of ExportRequests (D125); the inbox registers RunCompleted of RunControlService for the two handlers SealRunArtifacts and RecordRunEnd, RunFailed and RunCancelled of RunControlService for RecordRunEnd, ProjectStateChanged of ProjectService and ClassificationChanged of AuditService, each handler deduplicated on the event id, and a subscription to audit.evidence.v1.evidence-submitted for the command RecordEvidenceReference, deduplicated on the evidence id; RetentionRuleChanged, DeletionOrderIssued and LegalHoldChanged of RetentionResidencyService are not subscribed, the handler of DeletionOrderIssued being built in I4 with that service; what each handler does is delivered by AIFACTORY-US-787, AIFACTORY-US-788, AIFACTORY-US-790 and AIFACTORY-US-986.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the artifact messaging profile publishes ArtifactStored, ArtifactValidated, ArtifactSuperseded, ArtifactDeleted and ProjectDataOffboarded in the run event envelope of the pinned contracts package, each declared with its topic and route under PublishedEvents of the OrleansMessaging section; the section declares a sixth published event, AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, with the event type and the topic constant of the pinned contracts package and its route to AuditService, so that the sink of the pinned audit library writes audit-evidence-v1 records to the outbox of the service without an undeclared publish; the section declares these six entries and no message the service publishes to itself, because a recorded export request reaches ExportWorker as a row of ExportRequests (D125); the inbox registers RunCompleted of RunControlService for the two handlers SealRunArtifacts and RecordRunEnd, RunFailed and RunCancelled of RunControlService for RecordRunEnd, ProjectStateChanged of ProjectService and ClassificationChanged of AuditService, each handler deduplicated on the event id, and a subscription to audit.evidence.v1.evidence-submitted for the command RecordEvidenceReference, deduplicated on the evidence id; RetentionRuleChanged, DeletionOrderIssued and LegalHoldChanged of RetentionResidencyService are not subscribed, the handler of DeletionOrderIssued being built in I4 with that service; what each handler does is delivered by AIFACTORY-US-787, AIFACTORY-US-788, AIFACTORY-US-790 and AIFACTORY-US-986."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-058]",
      "number": 58
    },
    {
      "id": "AIFACTORY-TASK-059",
      "type": "task",
      "parent": "AIFACTORY-US-782",
      "title": "Worker hosting skeleton: schedule, trigger, retry policy and partitioning of RetentionSweeper and ExportWorker",
      "sequence": "04.01.03.03",
      "description": "Worker hosting skeleton: schedule, trigger, retry policy and partitioning of RetentionSweeper and ExportWorker. Expected output: RetentionSweeper is hosted on the schedule 0 4 * * * with a fixed retry of three attempts, the idempotency key artifactId and at most two parallel executions partitioned by tenant; ExportWorker is hosted on the recorded export requests of the model (D125): it picks up the rows of ExportRequests in the state requested, which it reads per tenant through the index IX_ExportRequests_Tenant_State at an interval set by a configuration value the model does not list, with an exponential retry of five attempts, the idempotency key of project and export request and one execution at a time per tenant; the trigger ProjectStateChanged of the model reaches the worker through the handler ExportOrDeleteOnClosing, which records the work of a closing project as such a row; a duplicate trigger and a request found by two looks of the worker have no second effect; the option Knowledge:Artifacts:DefaultRetentionDays is bound, reloadable, for RetentionSweeper; what each worker does is delivered by AIFACTORY-US-789 and AIFACTORY-US-790.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "RetentionSweeper is hosted on the schedule 0 4 * * * with a fixed retry of three attempts, the idempotency key artifactId and at most two parallel executions partitioned by tenant; ExportWorker is hosted on the recorded export requests of the model (D125): it picks up the rows of ExportRequests in the state requested, which it reads per tenant through the index IX_ExportRequests_Tenant_State at an interval set by a configuration value the model does not list, with an exponential retry of five attempts, the idempotency key of project and export request and one execution at a time per tenant; the trigger ProjectStateChanged of the model reaches the worker through the handler ExportOrDeleteOnClosing, which records the work of a closing project as such a row; a duplicate trigger and a request found by two looks of the worker have no second effect; the option Knowledge:Artifacts:DefaultRetentionDays is bound, reloadable, for RetentionSweeper; what each worker does is delivered by AIFACTORY-US-789 and AIFACTORY-US-790."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-059]",
      "number": 59
    },
    {
      "id": "AIFACTORY-TASK-3153",
      "type": "task",
      "parent": "AIFACTORY-US-782",
      "title": "Verify the hosted surface, the messaging profile and the hosted workers of ArtifactService",
      "sequence": "04.01.03.04",
      "description": "Verify the hosted surface, the messaging profile and the hosted workers of ArtifactService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-782: the surface compared with the service descriptor in both directions, the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every operation, the outbox record committed and rolled back with its change, the six declared entries of the OrleansMessaging section with the audit evidence event among them and no message the service publishes to itself, an evidence record that leaves the outbox on audit.evidence.v1.evidence-submitted, the refused undeclared publish, the deduplicated inbox under fixture publishers of the five subscribed events and of the audit evidence event, RunCompleted delivered to both of its handlers, the duplicate worker trigger and the recorded export request found by two looks of ExportWorker, and the golden files compared with docs/reference/schemas/artifact.schema.json with the eighteen shared members and the complete list of members the schema and the aggregate do not share.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-782: the surface compared with the service descriptor in both directions, the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every operation, the outbox record committed and rolled back with its change, the six declared entries of the OrleansMessaging section with the audit evidence event among them and no message the service publishes to itself, an evidence record that leaves the outbox on audit.evidence.v1.evidence-submitted, the refused undeclared publish, the deduplicated inbox under fixture publishers of the five subscribed events and of the audit evidence event, RunCompleted delivered to both of its handlers, the duplicate worker trigger and the recorded export request found by two looks of ExportWorker, and the golden files compared with docs/reference/schemas/artifact.schema.json with the eighteen shared members and the complete list of members the schema and the aggregate do not share."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3153]",
      "number": 3153
    },
    {
      "id": "AIFACTORY-US-783",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "ArtifactService filters every query by tenant, answers a foreign artifact as not found, starts only with its secret references and keeps content out of telemetry",
      "sequence": "04.01.04",
      "description": "ArtifactService holds the content of every tenant, and the model classifies its data as confidential, so isolation and the silence of its telemetry are deliverables of their own. Tenant isolation is the row filter of the profile: every query on the five tables of `artifact-sql`, `VersionChains`, `Artifacts`, `LineageEdges`, `ArtifactReferences` and `ExportRequests`, carries the tenant of the trusted scope, so an artifact, a chain, a lineage edge, a reference record or an export request of another tenant is invisible, with the one read admission for the platform tenant that is stated below. A request that addresses one by identifier or by content reference is answered 404, over gRPC the status NOT_FOUND, the same answer as for an identifier that does not exist, and nothing in the answer confirms that it exists (ADR-0015). Content is held in `artifact-blob` per tenant and hash: equal content of two tenants is two blobs, and a content reference of one tenant never resolves under another; deduplication across tenants is a later capability on the service page and is not built. Inside a tenant the project is the second boundary. A user token reaches an artifact only when it holds a role in the project of the artifact or the tenant-wide Platform admin role, and a workload only when the project it forwards is the project of the artifact; another project of the same tenant is answered 403, over gRPC PERMISSION_DENIED, because a missing right inside the own tenant is never answered as not found. The aggregate carries `accessScope`, which says who may read beyond the project, and the model types it as json without a grammar. This delivery stores the value as given and returns it, and evaluates no value: until the owner defines the grammar nobody is admitted beyond the project of an artifact, which fails closed. Two further rules are decided (D125) and stand as invariants of the model. The first is the tenant-level artifact. The project of an artifact is optional, and an artifact without a project belongs to its tenant: a workload that forwards a tenant and no project stores a tenant-level artifact, whose `projectId` is absent on the aggregate, in the tables `Artifacts` and `VersionChains`, in the payload of `ArtifactStored` and in `artifact-v1` (AIFACTORY-US-784). AgentRegistryService stores the manifests and the authoring documents of its seeded releases in this way for the platform tenant. A tenant-level artifact stands outside the project boundary: every workload of its tenant reads it whatever project it forwards. Over REST no project role can name it, so a user token reads it only with the tenant-wide Platform admin role of its tenant and is answered 403 otherwise. The second rule is the read admission of the platform tenant: tenant-level artifacts of the platform tenant are read by every tenant through the internal `Artifacts.Fetch` only, no REST read admits a token of another tenant, and every write stays in the tenant of the caller. The runtime and ModelRouterService read the documents of the seeded releases while they work under the tenant of a customer, so the row filter of `Artifacts`, `VersionChains` and `LineageEdges` admits, for reading, the tenant-level artifacts of the platform tenant under the scope of every tenant, as the filter of `ModelProfiles` in ModelRouterService admits the profiles of the platform tenant. Which tenant is the platform tenant is a value of the Factory profile configuration and never a member of a request. The admission covers the workload read `Artifacts.Fetch` by identifier or by content reference and nothing else. An artifact that belongs to a project of the platform tenant stays invisible to every other tenant and is answered NOT_FOUND, and over REST a token of another tenant is answered 404 for every artifact of the platform tenant. Every write stays in the forwarded tenant: a store, a verdict, a relabel, a deletion and an export never touch a row of another tenant, the platform tenant included, so a workload of a customer tenant that stores under the name of a platform document creates an artifact of its own tenant and changes nothing of the platform tenant. The two secrets of the model, `artifact-blob` and `messaging-transport`, reach the service as secret references of the key vault; no secret value is in the repository, in configuration or in telemetry, and the service is unready while a reference cannot be resolved. Telemetry follows the Factory conventions through the single enrichment registration of the pinned observability libraries. The three instruments of the model are created through the instrument helper: `connectsoft.factory.artifacts.stored` with the dimensions tenant and kind, `connectsoft.factory.artifacts.bytes` with tenant, and `connectsoft.factory.artifacts.deleted` with tenant and reason, each with tenant and project by default. Activities and log records carry tenant and project, and run, step and attempt when the scope of the call carries a run. No content of an artifact, no preview text and no export content reaches a metric, an activity or a log record: the hash, the size, the artifact identifier and the reference stand in its place (ADR-0019). `connectsoft.factory.artifacts.bytes` is the source of the storage meter. The model lists CostUsageService as an optional dependency for the StorageGb meter, but the one recording method of that service, `Usage.RecordUsage`, records usage from a model or tool receipt and the model names no method for a stored quantity, so no call is made and the gap is reported to the owner. Readiness is unready until `artifact-sql` is migrated, `artifact-blob` answers, the outbox check of the profile is healthy and the identity authority is reachable; an outage of PolicyEngineService fails the calls that need a decision (AIFACTORY-US-784, AIFACTORY-US-788 and AIFACTORY-US-790) and is not a readiness condition. Kind: enabling. Traces: services: ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/GetArtifact, ArtifactService/Artifacts.Fetch; adrs: ADR-0015, ADR-0019; requirements: NFR-03. Relates: nfrs: NFR-03. Depends on: AIFACTORY-US-781, AIFACTORY-US-782, feature:component-base-template-factory-profile, feature:component-observability-factory-conventions. Sources: model/services/knowledge/ArtifactService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/data-governance.md#logging-and-telemetry, docs/planes/knowledge-memory/services/artifact-service/index.md#security, docs/planes/knowledge-memory/services/artifact-service/index.md#metrics-and-observability.",
      "acceptanceCriteria": [
        "AC1: Given artifacts of two tenants, when a caller of the first tenant addresses an artifact of the second by identifier through `ArtifactService/GetArtifact` or by identifier or content reference through `ArtifactService/Artifacts.Fetch`, then the answer is 404 and NOT_FOUND respectively, byte for byte the answer for an identifier that does not exist, no list of the first tenant ever holds a row of the second, and equal content of the two tenants is held as two blobs; and given a tenant-level artifact and a project artifact of the platform tenant, when a workload of either tenant calls `ArtifactService/Artifacts.Fetch`, then the tenant-level artifact is delivered with its hash and the project artifact is answered NOT_FOUND, `ArtifactService/GetArtifact` answers 404 for both to a token of another tenant, and no write of either tenant changes a row of the platform tenant (ADR-0015).",
        "AC2: Given an `ArtifactService/Artifact` of one project and a caller of the same tenant whose token grants, or whose workload forwards, another project only, when the artifact is read, then the answer is 403 over REST and PERMISSION_DENIED over gRPC, and an `accessScope` value stored with the artifact is returned as given and admits nobody beyond the project in this delivery; a tenant-level artifact of the tenant is read by a workload that forwards any project of the tenant or none, and over REST only by a token with the tenant-wide Platform admin role (model/services/knowledge/ArtifactService.yaml).",
        "AC3: Given a start without a resolvable secret reference for `artifact-blob` or for `messaging-transport`, when readiness is probed, then the service is unready and names the missing reference, and neither the configuration of the repository nor any log record holds a secret value (model/services/knowledge/ArtifactService.yaml).",
        "AC4: Given fixture documents that carry a marker text and a run that stores, fetches, previews, exports and deletes them, when the collected metrics, activities and log records are scanned, then none holds the marker or any other content, the metrics carry tenant and project beside their modelled dimensions, and the activities and log records of a call made under the scope of a run carry run, step and attempt (ADR-0019).",
        "AC5: Given content of a known size stored for a tenant and later deleted, when `connectsoft.factory.artifacts.bytes` is read, then it rose and fell by that size for the tenant, and the recording fake of CostUsageService received no call, because the model names no method for a stored quantity (model/services/knowledge/ArtifactService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/data-governance.md#logging-and-telemetry",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#security",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#metrics-and-observability"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-060",
        "AIFACTORY-TASK-3154",
        "AIFACTORY-TASK-3155"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6104,
      "kind": "enabling",
      "traces": {
        "services": [
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/GetArtifact",
          "ArtifactService/Artifacts.Fetch"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-781",
        "AIFACTORY-US-782",
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/data-governance.md#logging-and-telemetry",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#security",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#metrics-and-observability"
      ],
      "titlePrefix": "[AIFACTORY-US-783]",
      "number": 783
    },
    {
      "id": "AIFACTORY-TASK-060",
      "type": "task",
      "parent": "AIFACTORY-US-783",
      "title": "Security, tenancy and telemetry of ArtifactService",
      "sequence": "04.01.04.01",
      "description": "Security, tenancy and telemetry of ArtifactService. Expected output: Every query of the tables of artifact-sql runs under the tenant row filter of the Factory profile, so an artifact of another tenant is answered 404 and NOT_FOUND exactly as an unknown one; the blob path is formed from tenant and hash; another project of the same tenant is answered 403 and PERMISSION_DENIED; a tenant-level artifact, stored by a workload that forwards no project and held without a projectId (D125), is read by every workload of its tenant and over REST only by a token with the tenant-wide Platform admin role; the read filter of the three mappings admits the tenant-level artifacts of the platform tenant, named by the configuration of the Factory profile, for Artifacts.Fetch under the scope of every tenant, as the filter of ModelProfiles in ModelRouterService does, admits no project artifact of the platform tenant and no REST read of another tenant, and every write stays in the forwarded tenant; accessScope is stored and returned as given and evaluated for nobody; artifact-blob and messaging-transport are read as secret references and a missing reference keeps the service unready; the instruments connectsoft.factory.artifacts.stored, connectsoft.factory.artifacts.bytes and connectsoft.factory.artifacts.deleted are created through the instrument helper with their modelled dimensions; no content reaches a metric, an activity or a log record; no call to CostUsageService is made.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Every query of the tables of artifact-sql runs under the tenant row filter of the Factory profile, so an artifact of another tenant is answered 404 and NOT_FOUND exactly as an unknown one; the blob path is formed from tenant and hash; another project of the same tenant is answered 403 and PERMISSION_DENIED; a tenant-level artifact, stored by a workload that forwards no project and held without a projectId (D125), is read by every workload of its tenant and over REST only by a token with the tenant-wide Platform admin role; the read filter of the three mappings admits the tenant-level artifacts of the platform tenant, named by the configuration of the Factory profile, for Artifacts.Fetch under the scope of every tenant, as the filter of ModelProfiles in ModelRouterService does, admits no project artifact of the platform tenant and no REST read of another tenant, and every write stays in the forwarded tenant; accessScope is stored and returned as given and evaluated for nobody; artifact-blob and messaging-transport are read as secret references and a missing reference keeps the service unready; the instruments connectsoft.factory.artifacts.stored, connectsoft.factory.artifacts.bytes and connectsoft.factory.artifacts.deleted are created through the instrument helper with their modelled dimensions; no content reaches a metric, an activity or a log record; no call to CostUsageService is made."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-060]",
      "number": 60
    },
    {
      "id": "AIFACTORY-TASK-3154",
      "type": "task",
      "parent": "AIFACTORY-US-783",
      "title": "Two-tenant fixture with user and workload tokens, marker documents and a telemetry collector",
      "sequence": "04.01.04.02",
      "description": "Two-tenant fixture with user and workload tokens, marker documents and a telemetry collector. Expected output: The acceptance suite holds two tenants with two projects each and a third tenant configured as the platform tenant with one project, user tokens of the gateway audience with and without each scope and project role and with the tenant-wide Platform admin role, workload tokens with and without the service scope naming ArtifactService, workloads that forward a tenant with a project and without one, a tenant-level artifact and a project artifact of the platform tenant and a tenant-level artifact of each other tenant, documents of several kinds and media types that carry a marker text, an in-memory collector of metrics, activities and log records, and a recording fake of CostUsageService; the fixture serves the suites of AIFACTORY-US-783 to AIFACTORY-US-790.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The acceptance suite holds two tenants with two projects each and a third tenant configured as the platform tenant with one project, user tokens of the gateway audience with and without each scope and project role and with the tenant-wide Platform admin role, workload tokens with and without the service scope naming ArtifactService, workloads that forward a tenant with a project and without one, a tenant-level artifact and a project artifact of the platform tenant and a tenant-level artifact of each other tenant, documents of several kinds and media types that carry a marker text, an in-memory collector of metrics, activities and log records, and a recording fake of CostUsageService; the fixture serves the suites of AIFACTORY-US-783 to AIFACTORY-US-790."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6104,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3154]",
      "number": 3154
    },
    {
      "id": "AIFACTORY-TASK-3155",
      "type": "task",
      "parent": "AIFACTORY-US-783",
      "title": "Verify tenancy, secret references and telemetry of ArtifactService",
      "sequence": "04.01.04.03",
      "description": "Verify tenancy, secret references and telemetry of ArtifactService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenancyAndTelemetry\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-783: 404 and NOT_FOUND for a foreign artifact equal to the answer for an unknown one, the tenant-level artifact of the platform tenant fetched by a workload of every tenant while its project artifact and every REST read of another tenant are refused as not found, the writes that never change a row of the platform tenant, 403 and PERMISSION_DENIED for another project of the tenant, the tenant-level artifact read by every workload of its tenant and over REST by the Platform admin role only, the unready start without a secret reference, the telemetry scan for the marker text, and the rise and fall of connectsoft.factory.artifacts.bytes with no call to CostUsageService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenancyAndTelemetry\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-783: 404 and NOT_FOUND for a foreign artifact equal to the answer for an unknown one, the tenant-level artifact of the platform tenant fetched by a workload of every tenant while its project artifact and every REST read of another tenant are refused as not found, the writes that never change a row of the platform tenant, 403 and PERMISSION_DENIED for another project of the tenant, the tenant-level artifact read by every workload of its tenant and over REST by the Platform admin role only, the unready start without a secret reference, the telemetry scan for the marker text, and the rise and fall of connectsoft.factory.artifacts.bytes with no call to CostUsageService."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3155]",
      "number": 3155
    },
    {
      "id": "AIFACTORY-US-784",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Store content once by hash with its producer, lineage and version chain, announce it and supersede the earlier version",
      "sequence": "04.01.05",
      "description": "A workload stores content through the internal gRPC method `Artifacts.Store`, a client stream of class shared-write. The callers are the services the model lists with a dependency on ArtifactService; in this increment RunControlService stores the resolved execution snapshot of a run, WorkflowEngineService the task contract of a step and the readiness bundle, AgentRegistryService its manifests and authoring documents, BlueprintService and GenerationRecipeService their documents and reports, ModelRouterService and ToolAdapterService outputs, results and receipts, and AgentRuntimeService checkpoints and produced artifacts. The caller presents a workload token that holds the service scope naming ArtifactService and forwards the tenant and the project of its work; the tenant and the project of the artifact are those of that trusted scope and never members of the request (ADR-0015). A workload that forwards a tenant and no project stores a tenant-level artifact; AgentRegistryService does so for the platform tenant, whose seeded releases belong to no project. Such an artifact has no project (D125): `projectId` is absent on the aggregate and in its `artifact-v1`, the `ProjectId` of its row in `Artifacts` and of its chain in `VersionChains` is empty, and the payload of its `ArtifactStored` carries no `projectId`. Its version chain is found by tenant and name, and the unique index `UX_Chains_Project_Name` on `TenantId`, `ProjectId` and `Name` keeps the tenant-level chains of two tenants with the same name apart. No value stands in for the missing project. Who reads a tenant-level artifact is stated by AIFACTORY-US-783, and a tenant-level artifact is no candidate of the retention sweep (AIFACTORY-US-789). The first message of the stream is the metadata: name, kind, media type, classification, access scope, the optional descriptor id of a typed body, the optional producer (run, attempt, agent), the optional content hash the caller computed, and the lineage edges to what the content derived from, each with an input kind (artifact, chunk, context-snapshot, receipt or run-input), an input reference and a relation (derived-from, generated-from, validated-by or summarises). The following messages carry the content, and the service hashes the bytes it receives. `contentHash` is the SHA-256 digest of those bytes, written as the prefix `sha256:` followed by sixty-four lowercase hexadecimal characters. The service and its callers share this one form: `artifact-v1` fixes it by the pattern of the member (D125), and the golden files of AIFACTORY-US-782 hold it. Nothing is written when the request is invalid: a kind outside `ArtifactKind`, a lineage edge whose input kind or relation the model does not list, a producer attempt or agent without its run, a missing name, media type or classification, a stated hash that is not of that form or differs from the hash of the received content, and content above `Knowledge:Artifacts:MaxArtifactMb` are each refused with INVALID_ARGUMENT. The service then has the store decided through `Policy.Decide` of PolicyEngineService, the required, fail-fast dependency the model lists for classification and redaction on store and preview. The request is a `policy-decision-v1` with the subject of the trusted scope, that is the workload as caller of the kind workload, the tenant and, when one is forwarded, the project, and with the action members `kind`, `target`, `sideEffectClass` and `classification`. The action kind is store, the value `policy-decision-v1` lists for the store of an artifact (D125), with the target `artifact-store`, the side-effect class shared-write and the classification of the metadata. Every outcome of the schema is mapped. The outcome allow stores. The outcomes deny and allow-with-approval refuse the store with PERMISSION_DENIED and the decision id in the status detail, because the service never grants, opens or assumes an approval. The outcome allow-with-constraints is refused in the same way: content is immutable and addressed by its hash, so the service can apply no constraint to it, and storing it unconstrained would ignore the decision. When PolicyEngineService does not answer, the call fails with UNAVAILABLE. One more point of that dependency is reported to the owner: the model of AuditService lists ArtifactService as a caller of its classification methods while the model of ArtifactService names PolicyEngineService alone, which this PBI follows. The content is written to `artifact-blob` once per tenant and hash. Then, in one transaction, the version chain of the tenant, the project where one is forwarded, and the name of the request is found or created in `VersionChains`, the `Artifact` is written in state Stored with the next `versionInChain`, `LatestVersion` is raised, the lineage edges are written, and the `ArtifactStored` outbox record is written with `artifactId`, `tenantId`, the `projectId` of a project artifact, `kind`, `contentHash`, the optional `producerRunId`, `chainId`, `versionInChain` and the optional `descriptor`. When the metadata names a producer run, the same transaction writes the reference record of that run, which AIFACTORY-US-986 delivers. When the chain held an earlier latest version in state Stored or Validated, that artifact moves to Superseded through `NewVersionStored` in the same transaction and `ArtifactSuperseded` is written with its `artifactId`, `tenantId`, `chainId` and the `newArtifactId`; an earlier version that is Deleted stays Deleted and is not announced. The reply is the `artifact-v1` of the stored artifact with `artifactId`, `contentHash` and `contentRef`. The method is idempotent on tenant and hash within a chain, and the rule regards the state of what it finds. The idempotent answer applies to an artifact of that tenant, hash and chain that still holds content: a repeat returns that artifact and writes no row, no blob and no event, so a caller that lost the answer repeats the call, and ArtifactService itself never repeats a write on behalf of a caller. That holds for a Superseded version as well: when a chain received content A, then B, then A again, the third store returns the Superseded artifact of A unchanged, the latest version stays B and nothing is announced. D125 records this reading: a store that repeats the content of a superseded version returns that version and appends none. A hash that matches only a Deleted artifact of the chain is no repeat, because that artifact has no content and `Artifacts.Fetch` refuses it: the content is written as a new artifact with the next `versionInChain`, its blob is written again and `ArtifactStored` announces it, so no caller is told that content is stored which is not. The same content stored under another name or project of the tenant is a new artifact in that chain that references the same blob. Two concurrent stores of different content into one chain receive distinct consecutive versions, which the unique index `UX_Artifacts_Chain_Version` guarantees. A store and the removal of content after a deletion (AIFACTORY-US-789) exclude each other per tenant and hash through one lock in `artifact-sql`: the removal runs only under that lock, after it has checked again that no artifact of the tenant holds the content, and the transaction of a store takes the same lock and verifies through the content port that the blob is present before it commits. A store that finds the blob gone commits nothing and fails with UNAVAILABLE, and its repeat writes the blob again, so a Stored artifact never exists without content. The failure modes are covered. When `artifact-blob` is unavailable the call fails with UNAVAILABLE and nothing is committed, so callers fail fast; an attempt cannot checkpoint without the store. When `artifact-sql` fails after the blob was written, the call fails with UNAVAILABLE, no row and no outbox record exists, and the blob stays under tenant and hash, where the repeat finds and reuses it. A blob that no repeat ever claims is referenced by no artifact, is counted by no instrument and is reachable by no reference; that nothing removes such a blob is reported to the owner. When content arrives whose hash equals that of held content of the tenant while its size differs, a hash collision is suspected: the store is refused with an explicit error that names it, over gRPC the status FAILED_PRECONDITION, nothing is written and the refusal is logged for the incident investigation. `connectsoft.factory.artifacts.stored` counts each new artifact by tenant and kind, and `connectsoft.factory.artifacts.bytes` rises by the size of content the tenant did not hold yet. The callers keep a reference and a hash; the model does not say whether that reference is `artifactId` or `contentRef`, so the reply carries both and `Artifacts.Fetch` accepts both (AIFACTORY-US-785), and the point is reported to the owner. Kind: behavior. Traces: services: ArtifactService, PolicyEngineService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Store, PolicyEngineService/Policy.Decide; events: ArtifactService/ArtifactStored, ArtifactService/ArtifactSuperseded; descriptors: artifact-v1, policy-decision-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019; requirements: FR-08, XL-06; scenarios: SCN-ArtifactService-006, SCN-ArtifactService-009, SCN-ArtifactService-011. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-781, AIFACTORY-US-782, AIFACTORY-US-783, feature:policy-engine-service. Sources: model/services/knowledge/ArtifactService.yaml, model/services/governance/PolicyEngineService.yaml, docs/reference/schemas/artifact.schema.json, docs/reference/schemas/policy-decision.schema.json, docs/planes/knowledge-memory/services/artifact-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope, a forwarded tenant and project, and a stream with valid metadata, a lineage edge of kind run-input and content, when `ArtifactService/Artifacts.Store` completes, then `artifact-blob` holds the content once under tenant and hash, one `ArtifactService/Artifact` exists in state Stored as version 1 of the chain of that project and name with the producer and the lineage edge as given, the reply is `artifact-v1` with `artifactId`, `contentHash` and `contentRef`, and the `ArtifactService/ArtifactStored` outbox record was written in the same transaction, with `contentHash` as `sha256:` and sixty-four lowercase hexadecimal characters; and given a workload that forwards the platform tenant and no project, when it stores a release manifest, then the artifact is a tenant-level artifact without a `projectId`, its chain in `VersionChains` has an empty `ProjectId` and is found by tenant and name, its `ArtifactService/ArtifactStored` carries no `projectId`, the same name stored without a project by a workload of another tenant is a chain of that tenant and no violation of `UX_Chains_Project_Name`, and a workload of another tenant fetches the manifest of the platform tenant with the stated hash (SCN-ArtifactService-006, ADR-0014).",
        "AC2: Given that artifact, when the same content is stored again in the same chain, then the same artifact is returned and no row, blob or outbox record is added; when other content is stored under the same project and name, then a new artifact is written as version 2, the first moves from Stored, or from Validated, to Superseded through `NewVersionStored`, and `ArtifactService/ArtifactSuperseded` with `artifactId`, `tenantId`, `chainId` and `newArtifactId` is written in the same transaction as the `ArtifactService/ArtifactStored` of the new version; when the content of the Superseded version 1 is stored a third time, then that Superseded artifact is returned unchanged, the latest version stays 2 and nothing is announced; and when the hash of a store matches only a Deleted artifact of the chain, then a new artifact with the next `versionInChain` is written, its blob is written again and it is announced (SCN-ArtifactService-006, SCN-ArtifactService-011, XL-06).",
        "AC3: Given a caller without a workload identity, a token without the service scope, metadata with an unknown kind, an unlisted lineage relation or a stated hash that differs from the content, content above `Knowledge:Artifacts:MaxArtifactMb`, or a decision of `PolicyEngineService/Policy.Decide` with the outcome deny, allow-with-approval or allow-with-constraints, when `ArtifactService/Artifacts.Store` is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, INVALID_ARGUMENT and PERMISSION_DENIED respectively, a refusal after a decision carries the decision id, no blob, row or outbox record remains, only the outcome allow stores, and the request the policy engine received was a `policy-decision-v1` with the action kind store, the target `artifact-store`, the side-effect class shared-write and the classification of the metadata (SCN-ArtifactService-006, ADR-0015).",
        "AC4: Given `artifact-blob` or PolicyEngineService does not answer, when `ArtifactService/Artifacts.Store` is called, then the call fails with UNAVAILABLE, nothing is committed and a repeat after recovery stores the content once; given `artifact-sql` fails after the blob was written, then the call fails with UNAVAILABLE, no row or outbox record exists and the repeat reuses the blob; given the removal of the content of a deleted last holder runs while the same content is stored again, then the two exclude each other and no Stored artifact is left without content; and given held content of the tenant with the same hash and another size, then the store is refused with FAILED_PRECONDITION naming the suspected collision and nothing is written (SCN-ArtifactService-006, model/services/knowledge/ArtifactService.yaml).",
        "AC5: Given the outbox records of a store that superseded a version, when the dispatcher of the `artifact` messaging profile publishes `ArtifactService/ArtifactStored` on `artifacts.artifacts.v1.artifact-stored` and `ArtifactService/ArtifactSuperseded` on `artifacts.artifacts.v1.artifact-superseded`, then each is sent in the run event envelope with the payload members of the model and without content, and a transport outage is retried with backoff so that neither event is lost or duplicated under its event id (SCN-ArtifactService-009, SCN-ArtifactService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/artifact.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3156",
        "AIFACTORY-TASK-3157",
        "AIFACTORY-TASK-3158",
        "AIFACTORY-TASK-3159"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6105,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "ArtifactService/ArtifactStored",
          "ArtifactService/ArtifactSuperseded"
        ],
        "descriptors": [
          "artifact-v1",
          "policy-decision-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-08",
          "XL-06"
        ],
        "scenarios": [
          "SCN-ArtifactService-006",
          "SCN-ArtifactService-009",
          "SCN-ArtifactService-011"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-781",
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/artifact.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-784]",
      "number": 784
    },
    {
      "id": "AIFACTORY-TASK-3156",
      "type": "task",
      "parent": "AIFACTORY-US-784",
      "title": "Content port over artifact-blob keyed by tenant and hash",
      "sequence": "04.01.05.01",
      "description": "Content port over artifact-blob keyed by tenant and hash. Expected output: A content port with one binding to artifact-blob through the storage abstractions library the model lists: it writes a stream once under tenant and hash and reports whether the content was already held and with which size, tells whether a blob is present, reads a stream by tenant and hash, removes content, and issues a delegated, read-only reference of the blob store for one blob that is limited in time and carries no account credential; the held check of a store and the removal of content exclude each other per tenant and hash through one lock in artifact-sql, which the transaction of a store takes before it verifies that the blob is present and commits, and under which a removal checks again that no artifact of the tenant holds the content; the credential comes from the secret reference artifact-blob; an outage surfaces as an unavailable error of the port and never as a partial write that a reader could see.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "A content port with one binding to artifact-blob through the storage abstractions library the model lists: it writes a stream once under tenant and hash and reports whether the content was already held and with which size, tells whether a blob is present, reads a stream by tenant and hash, removes content, and issues a delegated, read-only reference of the blob store for one blob that is limited in time and carries no account credential; the held check of a store and the removal of content exclude each other per tenant and hash through one lock in artifact-sql, which the transaction of a store takes before it verifies that the blob is present and commits, and under which a removal checks again that no artifact of the tenant holds the content; the credential comes from the secret reference artifact-blob; an outage surfaces as an unavailable error of the port and never as a partial write that a reader could see."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3156]",
      "number": 3156
    },
    {
      "id": "AIFACTORY-TASK-3157",
      "type": "task",
      "parent": "AIFACTORY-US-784",
      "title": "Artifacts.Store with validation, policy decision, version chain, supersession and the outbox records",
      "sequence": "04.01.05.02",
      "description": "Artifacts.Store with validation, policy decision, version chain, supersession and the outbox records. Expected output: Artifacts.Store reads the metadata message and the content stream, hashes the content with SHA-256 and states contentHash as sha256: and sixty-four lowercase hexadecimal characters, refuses the invalid requests of AIFACTORY-US-784 with INVALID_ARGUMENT, and has the store decided through Policy.Decide with a policy-decision-v1 request whose action carries the kind store (D125), the target artifact-store, the side-effect class shared-write and the classification of the metadata: the outcome allow stores, and deny, allow-with-approval and allow-with-constraints are refused with PERMISSION_DENIED and the decision id; a workload that forwards a tenant and no project stores a tenant-level artifact without a projectId, with an empty ProjectId in Artifacts and in VersionChains and no projectId in the ArtifactStored payload (D125), and no value stands in for the missing project; the content is written through the content port, and in one transaction the service takes the lock of tenant and hash, verifies that the blob is present, finds or creates the chain of tenant, project where one is forwarded, and name, writes the artifact Stored with the next version and its lineage edges, applies NewVersionStored to an earlier latest version that is Stored or Validated, and writes ArtifactStored and, when a version was superseded, ArtifactSuperseded; a repeat with the same tenant, hash and chain returns the artifact that still holds content, a Superseded one unchanged and unannounced, while a hash that matches only a Deleted artifact of the chain is written as a new artifact with the next version and its blob is written again; an unavailable blob store or policy engine fails the call with UNAVAILABLE and commits nothing; a transaction that fails after the blob was written fails the call with UNAVAILABLE and leaves a blob the repeat reuses; a suspected hash collision is refused with FAILED_PRECONDITION; the reply is artifact-v1 with artifactId, contentHash and contentRef.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Artifacts.Store reads the metadata message and the content stream, hashes the content with SHA-256 and states contentHash as sha256: and sixty-four lowercase hexadecimal characters, refuses the invalid requests of AIFACTORY-US-784 with INVALID_ARGUMENT, and has the store decided through Policy.Decide with a policy-decision-v1 request whose action carries the kind store (D125), the target artifact-store, the side-effect class shared-write and the classification of the metadata: the outcome allow stores, and deny, allow-with-approval and allow-with-constraints are refused with PERMISSION_DENIED and the decision id; a workload that forwards a tenant and no project stores a tenant-level artifact without a projectId, with an empty ProjectId in Artifacts and in VersionChains and no projectId in the ArtifactStored payload (D125), and no value stands in for the missing project; the content is written through the content port, and in one transaction the service takes the lock of tenant and hash, verifies that the blob is present, finds or creates the chain of tenant, project where one is forwarded, and name, writes the artifact Stored with the next version and its lineage edges, applies NewVersionStored to an earlier latest version that is Stored or Validated, and writes ArtifactStored and, when a version was superseded, ArtifactSuperseded; a repeat with the same tenant, hash and chain returns the artifact that still holds content, a Superseded one unchanged and unannounced, while a hash that matches only a Deleted artifact of the chain is written as a new artifact with the next version and its blob is written again; an unavailable blob store or policy engine fails the call with UNAVAILABLE and commits nothing; a transaction that fails after the blob was written fails the call with UNAVAILABLE and leaves a blob the repeat reuses; a suspected hash collision is refused with FAILED_PRECONDITION; the reply is artifact-v1 with artifactId, contentHash and contentRef."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3157]",
      "number": 3157
    },
    {
      "id": "AIFACTORY-TASK-3158",
      "type": "task",
      "parent": "AIFACTORY-US-784",
      "title": "Fakes of Policy.Decide and of the blob store, and builders of store streams",
      "sequence": "04.01.05.03",
      "description": "Fakes of Policy.Decide and of the blob store, and builders of store streams. Expected output: The acceptance suite holds a fake of Policy.Decide that answers each of the four outcomes of policy-decision-v1 (allow, allow-with-approval, deny and allow-with-constraints) with a decision id, stops answering, and records the subject and the action members kind, target, sideEffectClass and classification of each request so that a test asserts them, a blob store double behind the content port that can be stopped, can lose an answer after a write, can be seeded with content of a given hash and another size and honours the clock of the suite for the lifetime of a reference, a switch that fails the transaction of artifact-sql after a blob write and one that holds a removal while a store of the same content runs, and builders of metadata messages and content streams for every ArtifactKind, with and without a forwarded project, including two streams sent concurrently into one chain.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of Policy.Decide that answers each of the four outcomes of policy-decision-v1 (allow, allow-with-approval, deny and allow-with-constraints) with a decision id, stops answering, and records the subject and the action members kind, target, sideEffectClass and classification of each request so that a test asserts them, a blob store double behind the content port that can be stopped, can lose an answer after a write, can be seeded with content of a given hash and another size and honours the clock of the suite for the lifetime of a reference, a switch that fails the transaction of artifact-sql after a blob write and one that holds a removal while a store of the same content runs, and builders of metadata messages and content streams for every ArtifactKind, with and without a forwarded project, including two streams sent concurrently into one chain."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6105,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3158]",
      "number": 3158
    },
    {
      "id": "AIFACTORY-TASK-3159",
      "type": "task",
      "parent": "AIFACTORY-US-784",
      "title": "Verify store-content-by-hash-in-a-version-chain through the acceptance suite",
      "sequence": "04.01.05.04",
      "description": "Verify store-content-by-hash-in-a-version-chain through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-006|Scenario=SCN-ArtifactService-009|Scenario=SCN-ArtifactService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-784: the first store with the fixed form of contentHash, the tenant-level store of a release manifest for the platform tenant without a project and its fetch by a workload of another tenant, the idempotent repeat, the new version with the superseded one from Stored and from Validated, a store whose hash equals a Superseded version of the chain and one whose hash equals only a Deleted artifact of the chain, two concurrent stores with distinct versions, every refusal, the four outcomes of the policy decision with the asserted request members, the unavailable blob store and policy engine, the transaction that fails after the blob write, the removal held against a store of the same content, the suspected collision, and the publication and payload of ArtifactStored and ArtifactSuperseded; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-006|Scenario=SCN-ArtifactService-009|Scenario=SCN-ArtifactService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-784: the first store with the fixed form of contentHash, the tenant-level store of a release manifest for the platform tenant without a project and its fetch by a workload of another tenant, the idempotent repeat, the new version with the superseded one from Stored and from Validated, a store whose hash equals a Superseded version of the chain and one whose hash equals only a Deleted artifact of the chain, two concurrent stores with distinct versions, every refusal, the four outcomes of the policy decision with the asserted request members, the unavailable blob store and policy engine, the transaction that fails after the blob write, the removal held against a store of the same content, the suspected collision, and the publication and payload of ArtifactStored and ArtifactSuperseded; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3159]",
      "number": 3159
    },
    {
      "id": "AIFACTORY-US-785",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Stream the content of an artifact to a workload of its tenant and project by artifact identifier or content reference",
      "sequence": "04.01.06",
      "description": "A workload reads content through the internal gRPC method `Artifacts.Fetch`, a server stream of class read. In this increment AgentRuntimeService reads the task contract and the resolved execution snapshot of an attempt by the references of the lease answer, WorkflowEngineService reads a memo a readiness member names, BlueprintService reads the document it validates, and ModelRouterService reads profile definitions and evaluation records; each presents a workload token that holds the service scope naming ArtifactService and forwards the tenant and the project of its work. The request names the artifact by its `artifactId` or by the `contentRef` the reply of `Artifacts.Store` returned. The first message of the stream is the `artifact-v1` metadata of the artifact, the following messages carry the content in the order it was stored, and the stream then completes. The service changes nothing and writes no event; reading the same artifact twice yields the same messages. It does not hash the content again on a read: the caller compares the hash of what it read with the hash it kept, as the callers of the model do, and content is used only after its stream completed. A Stored, a Validated and a Superseded artifact are served alike, because a caller pins a version by its hash and a newer version does not take an older one away. A Deleted artifact has no content: the call is refused with FAILED_PRECONDITION and no message is streamed, while the metadata of such an artifact stays readable through `GetArtifact` (AIFACTORY-US-787). A `contentRef` can be held by several artifacts of the tenant, because content is stored once per tenant and hash and a chain of another name or project may reference it; a request by `contentRef` is served when the trusted scope admits at least one artifact that holds it and still has content, and the metadata message is the one of an admitted artifact. Two artifacts stand outside the project boundary, as AIFACTORY-US-783 states. A tenant-level artifact, stored by a workload that forwarded no project, is served to every workload of its tenant whatever project it forwards. And a tenant-level artifact of the platform tenant is served to a workload of every tenant, by identifier or by content reference: this is how AgentRuntimeService, WorkflowEngineService and ModelRouterService read the authoring documents of the seeded releases, which AgentRegistryService stored for the platform tenant, while they work under the tenant of a customer. A project artifact of the platform tenant is not admitted. Refusals: a call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, a request that names neither an identifier nor a reference with INVALID_ARGUMENT, an artifact of another project of the tenant with PERMISSION_DENIED, and an identifier or a reference that the tenant of the caller does not hold with NOT_FOUND, which is also the answer for an artifact of another tenant and never confirms that it exists; an attempt that receives NOT_FOUND takes the failure class permanent (ADR-0015). When `artifact-blob` or `artifact-sql` is unavailable before the first message the call fails with UNAVAILABLE; when the blob store fails during the stream, the stream ends with UNAVAILABLE without a completion, and the caller discards what it received and reads again. No content reaches telemetry: the activity of a fetch carries the artifact identifier, the hash and the size. Kind: behavior. Traces: services: ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Fetch, ArtifactService/Artifacts.Store; descriptors: artifact-v1; adrs: ADR-0015, ADR-0019; requirements: FR-08; scenarios: SCN-ArtifactService-007. Depends on: AIFACTORY-US-783, AIFACTORY-US-784. Sources: model/services/knowledge/ArtifactService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/planes/knowledge-memory/services/artifact-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given an `ArtifactService/Artifact` stored through `ArtifactService/Artifacts.Store` and a workload of its tenant and project with the service scope, when `ArtifactService/Artifacts.Fetch` is called with its `artifactId`, then the stream delivers the `artifact-v1` metadata message, then the content whose bytes equal the stored ones and whose hash equals `contentHash`, and completes; no row, blob or outbox record is written (SCN-ArtifactService-007).",
        "AC2: Given the same artifact, when it is fetched by its `contentRef`, then the same bytes are delivered; a Validated and a Superseded artifact are served like a Stored one; and a Deleted artifact is refused with FAILED_PRECONDITION without a message, because its content was removed and only its metadata and lineage remain (SCN-ArtifactService-007, model/services/knowledge/ArtifactService.yaml).",
        "AC3: Given a caller without a workload identity, a token without the service scope, a workload that forwards another project of the tenant, a request that names neither an identifier nor a reference, or an identifier the tenant of the caller does not hold, when `ArtifactService/Artifacts.Fetch` is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND respectively, an artifact of another tenant is answered NOT_FOUND exactly as an unknown one, and no message is streamed (SCN-ArtifactService-007, ADR-0015).",
        "AC4: Given the blob store becomes unavailable after the metadata message was streamed, when the stream continues, then it ends with UNAVAILABLE without a completion, and a repeated `ArtifactService/Artifacts.Fetch` after recovery delivers the whole content from the metadata message on (SCN-ArtifactService-007).",
        "AC5: Given a tenant-level artifact of the platform tenant, a project artifact of the platform tenant and a tenant-level artifact of a customer tenant, when a workload of another customer tenant calls `ArtifactService/Artifacts.Fetch` for each, then the first is delivered with the bytes and the hash that were stored, by `artifactId` and by `contentRef` alike, and the other two are answered NOT_FOUND; and a workload of the customer tenant that forwards any of its projects reads the tenant-level artifact of its own tenant (SCN-ArtifactService-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3160",
        "AIFACTORY-TASK-3161"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6106,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Fetch",
          "ArtifactService/Artifacts.Store"
        ],
        "descriptors": [
          "artifact-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-08"
        ],
        "scenarios": [
          "SCN-ArtifactService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-783",
        "AIFACTORY-US-784"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-785]",
      "number": 785
    },
    {
      "id": "AIFACTORY-TASK-3160",
      "type": "task",
      "parent": "AIFACTORY-US-785",
      "title": "Artifacts.Fetch server stream by artifact identifier or content reference",
      "sequence": "04.01.06.01",
      "description": "Artifacts.Fetch server stream by artifact identifier or content reference. Expected output: Artifacts.Fetch resolves the artifact by artifactId or by contentRef among the artifacts of the forwarded tenant and the tenant-level artifacts of the platform tenant that the read filter of AIFACTORY-US-783 admits, admits the forwarded project and, whatever project is forwarded, a tenant-level artifact, streams the artifact-v1 metadata message and then the content from the content port, and completes; it serves Stored, Validated and Superseded artifacts, refuses a Deleted one with FAILED_PRECONDITION, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND (also for an artifact of another tenant, ADR-0015) before the first message, ends with UNAVAILABLE when the blob store fails during the stream, and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Artifacts.Fetch resolves the artifact by artifactId or by contentRef among the artifacts of the forwarded tenant and the tenant-level artifacts of the platform tenant that the read filter of AIFACTORY-US-783 admits, admits the forwarded project and, whatever project is forwarded, a tenant-level artifact, streams the artifact-v1 metadata message and then the content from the content port, and completes; it serves Stored, Validated and Superseded artifacts, refuses a Deleted one with FAILED_PRECONDITION, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND (also for an artifact of another tenant, ADR-0015) before the first message, ends with UNAVAILABLE when the blob store fails during the stream, and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3160]",
      "number": 3160
    },
    {
      "id": "AIFACTORY-TASK-3161",
      "type": "task",
      "parent": "AIFACTORY-US-785",
      "title": "Verify fetch-artifact-content-by-reference through the acceptance suite",
      "sequence": "04.01.06.02",
      "description": "Verify fetch-artifact-content-by-reference through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ArtifactService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-785 over artifacts in every state, by identifier and by content reference, with the tenants, the platform tenant and the tenant-level artifacts of the fixture of AIFACTORY-TASK-3154 and a blob store stopped before and during the stream.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ArtifactService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-785 over artifacts in every state, by identifier and by content reference, with the tenants, the platform tenant and the tenant-level artifacts of the fixture of AIFACTORY-TASK-3154 and a blob store stopped before and during the stream."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3161]",
      "number": 3161
    },
    {
      "id": "AIFACTORY-US-786",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Attach a validator verdict to a stored artifact and announce it",
      "sequence": "04.01.07",
      "description": "A workload attaches the verdict of a validator to an artifact through the internal gRPC method `Artifacts.RecordValidation`, of class shared-write and without streaming. The request names the artifact, the verdict `passed` and the `validationRef`, the reference of the record the validator produced. The artifact moves from Stored to Validated through the trigger `ValidationRecorded`, `validationRef` and the verdict `passed` are set, and `ArtifactValidated` with `artifactId`, `tenantId`, `passed` and `validationRef` is written to the outbox in the same transaction. Validated means that a validator recorded a verdict, passing or failing; it does not mean that the artifact passed. Where the verdict is kept and shown is defined by the model (D125). The aggregate keeps it in the field `passed`, the column `Passed` of `Artifacts`: true for a passed and false for a failed verdict, and absent while no verdict is recorded. `artifact-v1`, the descriptor the model names for the replies of `Store`, `Fetch` and `GetArtifact`, carries `passed` and `validationRef` as members and requires the member `validation` with a `status`, which is read from `passed`: the metadata of an artifact shows `validation.status` unvalidated before a verdict was recorded, valid for `passed` true and invalid for `passed` false, with the `validationRef` as the details reference of the recorded check; the value partial of the schema is never produced, because the method records one verdict. The migration of this PBI creates the column `Passed`. The reply is `ack-v1`, which states accepted or conflict. The method is idempotent on the artifact, the verdict and the reference: a repeat of the recorded verdict with the recorded reference is acknowledged as accepted and changes nothing in every state that still carries that `validationRef`, that is for a Validated artifact and equally for one that was superseded or deleted after its verdict, so a caller that lost the answer repeats the call whatever happened to the artifact since. The model has one transition into Validated, from Stored. A different verdict or reference for an artifact that carries a verdict, and any verdict for a Superseded or a Deleted artifact that carries none, is therefore answered with `ack-v1` stating conflict; the state, the reference and the kept verdict stay as they are and no event is written. A verdict is recorded only in the tenant the caller forwards: a tenant-level artifact of the platform tenant, which another tenant may read, is answered NOT_FOUND here, because the admission of AIFACTORY-US-783 covers reading alone. The model names no caller of the method: it lists the consumers of the event, BlueprintService (`AttachValidation`), PipelineExecutionService (`LinkValidation`), FeedbackService, QualityScoreService and StudioBff, and no service whose dependency on ArtifactService is the recording of a verdict. The method therefore admits any workload whose token holds the service scope naming ArtifactService, and which workload records verdicts is reported to the owner. Refusals: UNAUTHENTICATED without a workload identity, PERMISSION_DENIED without the service scope or for an artifact of another project of the tenant, INVALID_ARGUMENT for a request without an artifact identifier or without a `validationRef`, and NOT_FOUND for an identifier the tenant of the caller does not hold, which is also the answer for an artifact of another tenant (ADR-0015). When `artifact-sql` is unavailable the call fails with UNAVAILABLE and nothing is recorded. The validation record itself is content and stays where its reference points; the event and the telemetry carry the reference and the verdict only. Kind: behavior. Traces: services: ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.RecordValidation; events: ArtifactService/ArtifactValidated; descriptors: artifact-v1, ack-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-08; scenarios: SCN-ArtifactService-008, SCN-ArtifactService-010. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-783, AIFACTORY-US-784. Sources: model/services/knowledge/ArtifactService.yaml, docs/planes/knowledge-memory/services/artifact-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given an `ArtifactService/Artifact` in state Stored and a workload of its tenant and project with the service scope, when `ArtifactService/Artifacts.RecordValidation` is called with a verdict and a `validationRef`, then the artifact moves to Validated through `ValidationRecorded` with `validationRef` set and the verdict kept, the reply is `ack-v1` stating accepted, and `ArtifactService/ArtifactValidated` with `artifactId`, `tenantId`, `passed` and `validationRef` is written in the same transaction, for a passing and for a failing verdict alike; the `artifact-v1` metadata of the artifact, which carried no `passed` and showed `validation.status` unvalidated before, carries `passed` and `validationRef` and shows `validation.status` valid for the passing and invalid for the failing verdict (SCN-ArtifactService-008, ADR-0014).",
        "AC2: Given that Validated artifact, when the same verdict with the same reference is recorded again, then the reply states accepted and no row or outbox record changes, and the same repeat is accepted without a change after the artifact was superseded and after it was deleted, because it still carries that `validationRef`; and when another verdict or reference is recorded for an artifact that carries a verdict, or any verdict for a Superseded or a Deleted artifact that carries none, then the reply is `ack-v1` stating conflict, the artifact is unchanged and no event is written, because model/services/knowledge/ArtifactService.yaml has no transition for it (SCN-ArtifactService-008).",
        "AC3: Given a caller without a workload identity, a token without the service scope, a workload that forwards another project of the tenant, a request without an artifact identifier or without a `validationRef`, or an identifier the tenant of the caller does not hold, when `ArtifactService/Artifacts.RecordValidation` is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND respectively, an artifact of another tenant, a tenant-level artifact of the platform tenant included, is answered NOT_FOUND exactly as an unknown one, a call made while `artifact-sql` does not answer fails with UNAVAILABLE, and in none of these cases a state changes or an event is written (SCN-ArtifactService-008, ADR-0015).",
        "AC4: Given the outbox record of a recorded verdict, when the dispatcher of the `artifact` messaging profile publishes `ArtifactService/ArtifactValidated` on `artifacts.artifacts.v1.artifact-validated`, then the event is sent in the run event envelope with `artifactId`, `tenantId`, `passed` and `validationRef` and without the content of the validation record, and a transport outage is retried with backoff so that the event is neither lost nor duplicated under its event id (SCN-ArtifactService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3162",
        "AIFACTORY-TASK-3163",
        "AIFACTORY-TASK-3164"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6107,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.RecordValidation"
        ],
        "events": [
          "ArtifactService/ArtifactValidated"
        ],
        "descriptors": [
          "artifact-v1",
          "ack-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08"
        ],
        "scenarios": [
          "SCN-ArtifactService-008",
          "SCN-ArtifactService-010"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-783",
        "AIFACTORY-US-784"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-786]",
      "number": 786
    },
    {
      "id": "AIFACTORY-TASK-3162",
      "type": "task",
      "parent": "AIFACTORY-US-786",
      "title": "Migration of the verdict column Passed on Artifacts",
      "sequence": "04.01.07.01",
      "description": "Migration of the verdict column Passed on Artifacts. Expected output: A migration adds to Artifacts the nullable column Passed of model/services/knowledge/ArtifactService.yaml (D125), the verdict of the recorded validation beside ValidationRef, and the aggregate receives the field passed; the column is the persisted validation status from which the member validation.status of artifact-v1 is read, unvalidated while it is empty, valid for a passed and invalid for a failed verdict; the mapping carries it under the tenant row filter and the mapping test runs against an isolated test database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "A migration adds to Artifacts the nullable column Passed of model/services/knowledge/ArtifactService.yaml (D125), the verdict of the recorded validation beside ValidationRef, and the aggregate receives the field passed; the column is the persisted validation status from which the member validation.status of artifact-v1 is read, unvalidated while it is empty, valid for a passed and invalid for a failed verdict; the mapping carries it under the tenant row filter and the mapping test runs against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6107,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-3162]",
      "number": 3162
    },
    {
      "id": "AIFACTORY-TASK-3163",
      "type": "task",
      "parent": "AIFACTORY-US-786",
      "title": "Artifacts.RecordValidation with the Validated transition, the conflict acknowledgement and the ArtifactValidated outbox record",
      "sequence": "04.01.07.02",
      "description": "Artifacts.RecordValidation with the Validated transition, the conflict acknowledgement and the ArtifactValidated outbox record. Expected output: Artifacts.RecordValidation applies ValidationRecorded to a Stored artifact, sets validationRef and the field passed and writes ArtifactValidated with artifactId, tenantId, passed and validationRef in one transaction, and replies ack-v1 accepted; the artifact-v1 metadata then carries passed and validationRef and shows validation.status valid or invalid, read from passed; a repeat of the recorded verdict and reference replies accepted and writes nothing in every state that still carries that validationRef, a superseded and a deleted artifact included; another verdict or reference for an artifact that carries a verdict and any verdict for a Superseded or Deleted artifact that carries none reply ack-v1 conflict and write nothing; UNAUTHENTICATED, PERMISSION_DENIED (a missing service scope and another project of the tenant), INVALID_ARGUMENT, NOT_FOUND (also for an artifact of another tenant and for a tenant-level artifact of the platform tenant, ADR-0015) and UNAVAILABLE while artifact-sql does not answer are given as AIFACTORY-US-786 states.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Artifacts.RecordValidation applies ValidationRecorded to a Stored artifact, sets validationRef and the field passed and writes ArtifactValidated with artifactId, tenantId, passed and validationRef in one transaction, and replies ack-v1 accepted; the artifact-v1 metadata then carries passed and validationRef and shows validation.status valid or invalid, read from passed; a repeat of the recorded verdict and reference replies accepted and writes nothing in every state that still carries that validationRef, a superseded and a deleted artifact included; another verdict or reference for an artifact that carries a verdict and any verdict for a Superseded or Deleted artifact that carries none reply ack-v1 conflict and write nothing; UNAUTHENTICATED, PERMISSION_DENIED (a missing service scope and another project of the tenant), INVALID_ARGUMENT, NOT_FOUND (also for an artifact of another tenant and for a tenant-level artifact of the platform tenant, ADR-0015) and UNAVAILABLE while artifact-sql does not answer are given as AIFACTORY-US-786 states."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6107,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3163]",
      "number": 3163
    },
    {
      "id": "AIFACTORY-TASK-3164",
      "type": "task",
      "parent": "AIFACTORY-US-786",
      "title": "Verify record-a-validation-verdict-on-an-artifact through the acceptance suite",
      "sequence": "04.01.07.03",
      "description": "Verify record-a-validation-verdict-on-an-artifact through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-008|Scenario=SCN-ArtifactService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-786: a passing and a failing verdict with validation.status shown as valid and invalid, the idempotent repeat for a Validated artifact and for the same artifact after it was superseded and after it was deleted, the conflict acknowledgement for another verdict on a Validated artifact and for a Superseded and a Deleted artifact without a verdict, every refusal with the fixture of AIFACTORY-TASK-3154, PERMISSION_DENIED for a workload that forwards another project of the tenant and UNAVAILABLE with artifact-sql stopped among them, and the publication and payload of ArtifactValidated; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-008|Scenario=SCN-ArtifactService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-786: a passing and a failing verdict with validation.status shown as valid and invalid, the idempotent repeat for a Validated artifact and for the same artifact after it was superseded and after it was deleted, the conflict acknowledgement for another verdict on a Validated artifact and for a Superseded and a Deleted artifact without a verdict, every refusal with the fixture of AIFACTORY-TASK-3154, PERMISSION_DENIED for a workload that forwards another project of the tenant and UNAVAILABLE with artifact-sql stopped among them, and the publication and payload of ArtifactValidated; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6107,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3164]",
      "number": 3164
    },
    {
      "id": "AIFACTORY-US-787",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Read the metadata and lineage of an artifact, its version chain and the artifacts a run produced, and mark the outputs of a completed run",
      "sequence": "04.01.08",
      "description": "As a requester, I want to see what an artifact is, what it derived from, which version of its chain it is and which artifacts my run produced, so that I can trust and explain an output without reading stored content I have no right to. Three REST reads show what the store holds about an artifact; none of them returns content inline and none writes. `GetArtifact` under the scope `factory.artifacts.read` returns the metadata of one artifact as `artifact-v1`, its lineage edges, its position in the version chain (`chainId`, `versionInChain`, the latest version of the chain and the `state`), its validation as the member `validation.status` of `artifact-v1` (unvalidated before a verdict, valid for a passed and invalid for a failed one, as AIFACTORY-US-786 records it) with `validationRef` as the details reference, and a scoped download reference. No operation of the model serves content over REST, so that reference is resolved by the blob store itself and not by the service: it is a delegated, read-only reference of the blob store for the one blob of this artifact, signed for a limited time, and it carries no account credential and is never the bare blob path. Its form and its lifetime are not in the model, so the lifetime is a configuration value the model does not list and both are reported to the owner. The suite proves the three properties: the reference returns the bytes of this artifact, it fails for another blob of the same tenant, and it fails after the configured lifetime on the clock of the suite. A Deleted artifact is returned with the state Deleted, its metadata and its lineage and without a download reference, so that a reference to it stays explainable. `ListArtifactVersions` under the same scope returns the version chain of the addressed artifact: every version in ascending order with `artifactId`, `versionInChain`, `contentHash`, `state` and `createdAt`. `ListRunArtifacts` under the scope `factory.runs.read` returns the artifacts whose `producerRunId` is the run, each with its state, its `validation.status` and the mark of a final output. A tenant-level artifact names no project, so no project role admits a user token to it: the three reads serve it only to a token with the tenant-wide Platform admin role of its tenant, as AIFACTORY-US-783 states, and the read admission of the platform tenant does not extend to these routes. A person reaches these routes through the Knowledge gateway, which feature `knowledge-host` delivers in this increment (D125); the acceptance suite of this feature calls the hosted routes with user tokens of that audience. A call without a token is answered 401 by the profile, and a token without the scope of the route is answered 403. For `GetArtifact` and `ListArtifactVersions` a token without a role in the project of the artifact is answered 403 as well, and an `artifactId` the tenant of the caller does not hold is answered 404, which is also the answer for an artifact of another tenant and never confirms that it exists (ADR-0015). `ListRunArtifacts` has the codes 200 and 403 in the model and no 404 (D125). The service holds no record of runs, only of artifacts, and a list holds only the artifacts of the projects the token grants: a `runId` of which the service holds no artifact visible to the caller is answered 200 with an empty list, which covers an unknown run, a run of another tenant, a run of a project the token does not grant and a run that produced nothing yet, so the answer never confirms that a run exists. When `artifact-sql` does not answer, a read is answered 503 with a problem response. The same PBI delivers the inbox handler `SealRunArtifacts` of `RunCompleted` of RunControlService, whose purpose in the model is to mark the artifacts of the run as final outputs and to close open chains. The handler is idempotent on the event id, runs under the tenant of the envelope and marks every artifact whose `producerRunId` is the run as a final output and every chain whose latest version that run produced as closed. The mark is the field `finalOutput` of the aggregate, the column `FinalOutput` of `Artifacts`, and a closed chain is the column `Closed` of `VersionChains`; both are in the model (D125) and the migration of this PBI creates them. What a closed chain refuses is not decided by the model: nothing is refused on it in this delivery, a later store under the same name still appends a version, and the point is reported to the owner. The handler writes no event, and an event for a run without artifacts is acknowledged without effect. Kind: behavior. Traces: services: ArtifactService, RunControlService; aggregates: ArtifactService/Artifact; apis: ArtifactService/GetArtifact, ArtifactService/ListArtifactVersions, ArtifactService/ListRunArtifacts; events: RunControlService/RunCompleted; descriptors: artifact-v1; adrs: ADR-0015, ADR-0019; requirements: FR-08, FUX-06; scenarios: SCN-ArtifactService-001, SCN-ArtifactService-003, SCN-ArtifactService-004. Relates: screens: artifacts, run-detail. Depends on: AIFACTORY-US-782, AIFACTORY-US-783, AIFACTORY-US-784, AIFACTORY-US-786, feature:run-control-service. Sources: model/services/knowledge/ArtifactService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/knowledge-memory/services/artifact-service/index.md#apis, docs/planes/knowledge-memory/services/artifact-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.artifacts.read` and a role in the project of a Validated `ArtifactService/Artifact` with two lineage edges that is version 2 of its chain, when `ArtifactService/GetArtifact` is called, then the response is 200 with its metadata, both lineage edges, `chainId`, `versionInChain` 2, the latest version of the chain, the state Validated, `validation.status` valid with `validationRef` as its details reference, and a delegated, read-only download reference of the blob store without an account credential, which returns the bytes of this artifact, fails for another blob of the tenant and fails after the configured lifetime on the clock of the suite; and for a Deleted artifact the response is 200 with the state Deleted, metadata and lineage and no download reference (SCN-ArtifactService-001, FUX-06).",
        "AC2: Given a chain of three versions of which the first two are Superseded, when `ArtifactService/ListArtifactVersions` is called with the `artifactId` of any of them, then the response is 200 with the three versions in ascending order, each with `artifactId`, `versionInChain`, `contentHash`, `state` and `createdAt`, and nothing is written (SCN-ArtifactService-003).",
        "AC3: Given artifacts produced by two runs in two projects of one tenant and a caller with `factory.runs.read` and a role in one of the projects, when `ArtifactService/ListRunArtifacts` is called for the run of that project, then the response is 200 with exactly the artifacts whose `producerRunId` is that run, each with its state, its `validation.status` and its final-output mark, and no artifact of the other run or project (SCN-ArtifactService-004).",
        "AC4: Given a token without the scope of the route, a token without a role in the project of the artifact, or an `artifactId` the tenant does not hold, when one of the three reads is called, then the response is 403, 403 and 404 respectively with a problem response, an artifact of another tenant is answered 404 exactly as an unknown one, and no state changes; and given a `runId` of which the service holds no artifact visible to the caller, that is an unknown run, a run of another tenant, a run of a project the token does not grant or a run that produced nothing yet, when `ArtifactService/ListRunArtifacts` is called, then the response is 200 with an empty list in each case and never 404 (SCN-ArtifactService-001, SCN-ArtifactService-003, SCN-ArtifactService-004, ADR-0015).",
        "AC5: Given a `RunControlService/RunCompleted` for a run that produced three artifacts in two chains, when `SealRunArtifacts` handles it, then the three artifacts are marked as final outputs and the two chains as closed in one transaction, `ArtifactService/ListRunArtifacts` shows the mark, a redelivery of the same event id changes nothing, an event for a run without artifacts is acknowledged without effect, and no event is written (model/services/knowledge/ArtifactService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#apis",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3165",
        "AIFACTORY-TASK-3166",
        "AIFACTORY-TASK-3167"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6108,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService",
          "RunControlService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/GetArtifact",
          "ArtifactService/ListArtifactVersions",
          "ArtifactService/ListRunArtifacts"
        ],
        "events": [
          "RunControlService/RunCompleted"
        ],
        "descriptors": [
          "artifact-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-08",
          "FUX-06"
        ],
        "scenarios": [
          "SCN-ArtifactService-001",
          "SCN-ArtifactService-003",
          "SCN-ArtifactService-004"
        ]
      },
      "relates": {
        "screens": [
          "artifacts",
          "run-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "AIFACTORY-US-784",
        "AIFACTORY-US-786",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#apis",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-787]",
      "number": 787
    },
    {
      "id": "AIFACTORY-TASK-3165",
      "type": "task",
      "parent": "AIFACTORY-US-787",
      "title": "GetArtifact and ListArtifactVersions with lineage, chain position, validation and the scoped download reference",
      "sequence": "04.01.08.01",
      "description": "GetArtifact and ListArtifactVersions with lineage, chain position, validation and the scoped download reference. Expected output: GetArtifact returns the artifact-v1 metadata, the lineage edges, chainId, versionInChain, the latest version of the chain, the state, validation.status (unvalidated, valid or invalid) with validationRef as the details reference, and a download reference that the content port issues for the one blob of this artifact: a delegated, read-only reference of the blob store that the blob store resolves, signed for a lifetime set by a configuration value the model does not list, without an account credential; a tenant-level artifact is served only to a token with the tenant-wide Platform admin role of its tenant; a Deleted artifact is returned with its metadata and lineage and without a download reference; ListArtifactVersions returns every version of the chain in ascending order; both run under the tenant row filter, answer 403 for a missing scope or project role and 404 for an identifier the tenant does not hold, an artifact of another tenant included (ADR-0015), and write nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "GetArtifact returns the artifact-v1 metadata, the lineage edges, chainId, versionInChain, the latest version of the chain, the state, validation.status (unvalidated, valid or invalid) with validationRef as the details reference, and a download reference that the content port issues for the one blob of this artifact: a delegated, read-only reference of the blob store that the blob store resolves, signed for a lifetime set by a configuration value the model does not list, without an account credential; a tenant-level artifact is served only to a token with the tenant-wide Platform admin role of its tenant; a Deleted artifact is returned with its metadata and lineage and without a download reference; ListArtifactVersions returns every version of the chain in ascending order; both run under the tenant row filter, answer 403 for a missing scope or project role and 404 for an identifier the tenant does not hold, an artifact of another tenant included (ADR-0015), and write nothing."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6108,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3165]",
      "number": 3165
    },
    {
      "id": "AIFACTORY-TASK-3166",
      "type": "task",
      "parent": "AIFACTORY-US-787",
      "title": "ListRunArtifacts and the SealRunArtifacts inbox handler with the final-output and closed-chain columns",
      "sequence": "04.01.08.02",
      "description": "ListRunArtifacts and the SealRunArtifacts inbox handler with the final-output and closed-chain columns. Expected output: A migration adds the column FinalOutput to Artifacts and the column Closed to VersionChains, both of model/services/knowledge/ArtifactService.yaml (D125), and the aggregate receives the field finalOutput; the handler SealRunArtifacts of RunCompleted marks every artifact whose producerRunId is the run as a final output and every chain whose latest version the run produced as closed, in one transaction, idempotently on the event id and under the tenant of the envelope, writes no event and refuses nothing on a closed chain; ListRunArtifacts returns the artifacts of the run in the projects the token grants with state, validation and the final-output mark, answers 403 for a token without factory.runs.read and answers 200 with an empty list for a runId of which the service holds no artifact visible to the caller (D125).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "A migration adds the column FinalOutput to Artifacts and the column Closed to VersionChains, both of model/services/knowledge/ArtifactService.yaml (D125), and the aggregate receives the field finalOutput; the handler SealRunArtifacts of RunCompleted marks every artifact whose producerRunId is the run as a final output and every chain whose latest version the run produced as closed, in one transaction, idempotently on the event id and under the tenant of the envelope, writes no event and refuses nothing on a closed chain; ListRunArtifacts returns the artifacts of the run in the projects the token grants with state, validation and the final-output mark, answers 403 for a token without factory.runs.read and answers 200 with an empty list for a runId of which the service holds no artifact visible to the caller (D125)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6108,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3166]",
      "number": 3166
    },
    {
      "id": "AIFACTORY-TASK-3167",
      "type": "task",
      "parent": "AIFACTORY-US-787",
      "title": "Verify read-artifact-metadata-version-chain-and-run-artifacts through the acceptance suite",
      "sequence": "04.01.08.03",
      "description": "Verify read-artifact-metadata-version-chain-and-run-artifacts through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-001|Scenario=SCN-ArtifactService-003|Scenario=SCN-ArtifactService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-787 with the fixture of AIFACTORY-TASK-3154, artifacts in every state, the download reference of AC1 that returns the bytes of its artifact, fails for another blob of the tenant and fails after the configured lifetime on the clock of the suite, a chain of three versions, two runs in two projects, the empty list of ListRunArtifacts for an unknown run, a run of another tenant, a run of a project the token does not grant and a run without artifacts, and a fixture publisher of RunCompleted built from the pinned contracts package, delivered once, twice and for a run without artifacts.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-001|Scenario=SCN-ArtifactService-003|Scenario=SCN-ArtifactService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-787 with the fixture of AIFACTORY-TASK-3154, artifacts in every state, the download reference of AC1 that returns the bytes of its artifact, fails for another blob of the tenant and fails after the configured lifetime on the clock of the suite, a chain of three versions, two runs in two projects, the empty list of ListRunArtifacts for an unknown run, a run of another tenant, a run of a project the token does not grant and a run without artifacts, and a fixture publisher of RunCompleted built from the pinned contracts package, delivered once, twice and for a run without artifacts."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6108,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3167]",
      "number": 3167
    },
    {
      "id": "AIFACTORY-US-788",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Render the preview of an artifact as a projection under the scope and the classification rules, and relabel artifacts when a classification changes",
      "sequence": "04.01.09",
      "description": "As a reviewer, I want to read a diff, a document or a report of a run as a rendered preview that shows only what my scope and its classification allow, so that I can judge an output without a second copy of its content being made and without seeing what is restricted. `PreviewArtifact` under the scope `factory.artifacts.read` renders an artifact for reading: a diff, a document or a report. The preview is a projection. It is computed on request from the stored content with one of the renderers that `Knowledge:Artifacts:PreviewRenderers` enables, by default diff, markdown, json and report, chosen by the kind and the media type of the artifact through one mapping table of the repository. It is never stored, so a preview creates no artifact, no blob, no row and no event, and it never becomes a second copy of the content. Before anything is rendered the service has the preview decided through `Policy.Decide` of PolicyEngineService, the required, fail-fast dependency the model lists for classification and redaction on store and preview. The request is a `policy-decision-v1` with the caller of the token as subject, that is the caller of the kind user with tenant, the project of the artifact and the roles of the token, and with the action members `kind`, `target`, `sideEffectClass` and `classification`. The action kind is preview, the value `policy-decision-v1` lists for the preview of an artifact (D125), with the target `artifact-preview`, the side-effect class read and the classification of the artifact. Every outcome of the schema is mapped. The outcome allow shows the content. The outcome allow-with-constraints withholds it: the preview shows the reference of the content in its place, that is the hash, the size and the artifact identifier, because the service applies no constraint it cannot interpret and a reference discloses nothing. The outcomes deny and allow-with-approval are answered 403 with the decision id in the problem body; the service never grants or opens an approval. The text that an allowing decision lets through then passes the artifact projection profile of the pinned compliance library (feature `component-compliance-factory-classifications`), which redacts a restricted field in every case. docs/architecture/data-governance.md shows confidential content only under an explicit scope, and the model lists no scope beyond `factory.artifacts.read` for a preview, so this PBI takes that explicit scope from the outcome of the decision, allow for the content and allow-with-constraints for the reference, and the point is reported to the owner. The response is 200 with the rendered preview and the name of the renderer. The model lists 200, 403 and 404 for the operation. 404 is the answer for an `artifactId` the tenant of the caller does not hold, which is also the answer for an artifact of another tenant, and for an artifact that has no preview: a Deleted artifact, whose content was removed, and an artifact whose kind and media type no enabled renderer serves. A token without the scope or without a role in the project of the artifact is answered 403. When PolicyEngineService or `artifact-blob` does not answer, the call is answered 503 with a problem response and nothing partial is returned. A person reaches the route through the Knowledge gateway, which feature `knowledge-host` delivers in this increment (D125); the suite of this feature calls the hosted route. No preview text reaches telemetry. The same PBI delivers the inbox handler `ApplyClassification` of `ClassificationChanged` of AuditService, whose purpose in the model is to re-label the stored artifacts of the affected scope. The event carries `labelId`, `tenantId`, `resourceType`, the optional `resourceId`, `dataClass` and `retentionDays`. The handler is idempotent on the event id and sets the `classification` of the artifacts of that tenant which the label addresses to the announced class: the one artifact `resourceId` names, or, for a type-level label without `resourceId`, every artifact the label covers. Classification is metadata: the relabel changes neither content nor hash, creates no version and writes no event, and the next preview and the next decision use the new class. Which values of `resourceType` address an artifact or an artifact kind is not fixed by the model, which types the member as a string; the handler reads them from one mapping that the contract test of the event pins, acknowledges a label of any other resource type without effect, and the point is reported to the owner. The `retentionDays` of the label is not applied to the sweep of AIFACTORY-US-789, because the model gives this handler the relabel only. Kind: behavior. Traces: services: ArtifactService, PolicyEngineService, AuditService; aggregates: ArtifactService/Artifact; apis: ArtifactService/PreviewArtifact, PolicyEngineService/Policy.Decide; events: AuditService/ClassificationChanged; descriptors: policy-decision-v1; adrs: ADR-0015, ADR-0019; requirements: FUX-06, NFR-03; scenarios: SCN-ArtifactService-002. Relates: screens: artifacts; nfrs: NFR-03. Depends on: AIFACTORY-US-782, AIFACTORY-US-783, AIFACTORY-US-784, feature:policy-engine-service, feature:audit-service-complete, feature:component-compliance-factory-classifications. Sources: model/services/knowledge/ArtifactService.yaml, model/services/governance/AuditService.yaml, model/services/governance/PolicyEngineService.yaml, docs/architecture/data-governance.md#classification, docs/planes/knowledge-memory/services/artifact-service/index.md#options-and-configuration.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.artifacts.read` and a role in the project of a Markdown document `ArtifactService/Artifact` of class internal, when `ArtifactService/PreviewArtifact` is called, then the response is 200 with the rendered preview and the renderer markdown, and afterwards `artifact-sql`, `artifact-blob` and the outbox hold nothing they did not hold before, so that the preview is a projection and never a second copy (SCN-ArtifactService-002, FUX-06).",
        "AC2: Given a confidential artifact with a restricted field, when `ArtifactService/PreviewArtifact` is called and `PolicyEngineService/Policy.Decide` answers allow, then the content is shown with the restricted field redacted; when it answers allow-with-constraints, then the preview shows the reference of the content, its hash and its size in its place; when it answers deny or allow-with-approval, then the response is 403 with the decision id in the problem body; and the request the policy engine received was a `policy-decision-v1` with the action kind preview, the target `artifact-preview`, the side-effect class read and the classification of the artifact (docs/architecture/data-governance.md, SCN-ArtifactService-002).",
        "AC3: Given a token without the scope, a token without a role in the project of the artifact, an `artifactId` the tenant does not hold, a Deleted artifact, or an artifact whose kind and media type no renderer of `Knowledge:Artifacts:PreviewRenderers` serves, when `ArtifactService/PreviewArtifact` is called, then the response is 403, 403, 404, 404 and 404 respectively with a problem response, and an artifact of another tenant is answered 404 exactly as an unknown one (SCN-ArtifactService-002, ADR-0015).",
        "AC4: Given PolicyEngineService or `artifact-blob` does not answer, when `ArtifactService/PreviewArtifact` is called, then the response is 503 with a problem response, nothing partial is rendered and nothing is written (SCN-ArtifactService-002, model/services/knowledge/ArtifactService.yaml).",
        "AC5: Given an `AuditService/ClassificationChanged` that names one artifact of a tenant and a new data class, when `ApplyClassification` handles it, then the `classification` of that `ArtifactService/Artifact` is the new class while its `contentHash`, its version and its state are unchanged and no event is written, a redelivery of the same event id changes nothing, a label of a resource type that addresses no artifact is acknowledged without effect, and no artifact of another tenant is touched (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/data-governance.md#classification",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#options-and-configuration"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3168",
        "AIFACTORY-TASK-3169",
        "AIFACTORY-TASK-3170",
        "AIFACTORY-TASK-3171"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6109,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService",
          "PolicyEngineService",
          "AuditService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/PreviewArtifact",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "AuditService/ClassificationChanged"
        ],
        "descriptors": [
          "policy-decision-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FUX-06",
          "NFR-03"
        ],
        "scenarios": [
          "SCN-ArtifactService-002"
        ]
      },
      "relates": {
        "screens": [
          "artifacts"
        ],
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "AIFACTORY-US-784",
        "feature:policy-engine-service",
        "feature:audit-service-complete",
        "feature:component-compliance-factory-classifications"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/data-governance.md#classification",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#options-and-configuration"
      ],
      "titlePrefix": "[AIFACTORY-US-788]",
      "number": 788
    },
    {
      "id": "AIFACTORY-TASK-3168",
      "type": "task",
      "parent": "AIFACTORY-US-788",
      "title": "PreviewArtifact with renderer selection, policy decision and the artifact projection profile",
      "sequence": "04.01.09.01",
      "description": "PreviewArtifact with renderer selection, policy decision and the artifact projection profile. Expected output: PreviewArtifact selects a renderer of Knowledge:Artifacts:PreviewRenderers by kind and media type through one mapping table, has the preview decided through Policy.Decide with a policy-decision-v1 request whose action carries the kind preview (D125), the target artifact-preview, the side-effect class read and the classification of the artifact, and maps the four outcomes: for allow it renders the content read through the content port and passes the result through the artifact projection profile of the pinned compliance library, so that a restricted field is always redacted; for allow-with-constraints it returns the reference, the hash and the size in place of the content; for deny and allow-with-approval it answers 403 with the decision id in the problem body; it stores nothing; it answers 403 for a missing scope and a missing project role, 404 for an identifier the tenant does not hold, an artifact of another tenant included (ADR-0015), a Deleted artifact and an artifact without a renderer, and 503 while the policy engine or the blob store does not answer.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "PreviewArtifact selects a renderer of Knowledge:Artifacts:PreviewRenderers by kind and media type through one mapping table, has the preview decided through Policy.Decide with a policy-decision-v1 request whose action carries the kind preview (D125), the target artifact-preview, the side-effect class read and the classification of the artifact, and maps the four outcomes: for allow it renders the content read through the content port and passes the result through the artifact projection profile of the pinned compliance library, so that a restricted field is always redacted; for allow-with-constraints it returns the reference, the hash and the size in place of the content; for deny and allow-with-approval it answers 403 with the decision id in the problem body; it stores nothing; it answers 403 for a missing scope and a missing project role, 404 for an identifier the tenant does not hold, an artifact of another tenant included (ADR-0015), a Deleted artifact and an artifact without a renderer, and 503 while the policy engine or the blob store does not answer."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6109,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3168]",
      "number": 3168
    },
    {
      "id": "AIFACTORY-TASK-3169",
      "type": "task",
      "parent": "AIFACTORY-US-788",
      "title": "ApplyClassification inbox handler relabelling the artifacts a changed label addresses",
      "sequence": "04.01.09.02",
      "description": "ApplyClassification inbox handler relabelling the artifacts a changed label addresses. Expected output: The handler of ClassificationChanged sets the classification of the artifact resourceId names, or of every artifact a type-level label covers, to the announced data class within the tenant of the event, idempotently on the event id, without a change of content, hash, version or state and without an event; the values of resourceType that address an artifact or an artifact kind are read from one mapping that a contract test of the event pins, and a label of another resource type is acknowledged without effect; retentionDays of the label is not applied.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The handler of ClassificationChanged sets the classification of the artifact resourceId names, or of every artifact a type-level label covers, to the announced data class within the tenant of the event, idempotently on the event id, without a change of content, hash, version or state and without an event; the values of resourceType that address an artifact or an artifact kind are read from one mapping that a contract test of the event pins, and a label of another resource type is acknowledged without effect; retentionDays of the label is not applied."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6109,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3169]",
      "number": 3169
    },
    {
      "id": "AIFACTORY-TASK-3170",
      "type": "task",
      "parent": "AIFACTORY-US-788",
      "title": "Preview documents per renderer, classified artifacts and a fixture publisher of ClassificationChanged",
      "sequence": "04.01.09.03",
      "description": "Preview documents per renderer, classified artifacts and a fixture publisher of ClassificationChanged. Expected output: The acceptance suite holds one document per renderer (a diff, a Markdown document, a JSON document and a report), an artifact of a media type no renderer serves, artifacts of each of the four classification classes with a restricted field and a marker text, the fake of Policy.Decide of AIFACTORY-TASK-3158 set to each of the four outcomes allow, allow-with-constraints, deny and allow-with-approval, and a fixture publisher of ClassificationChanged built from the pinned contracts package for one artifact, for a type-level label and for a resource type that addresses no artifact.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The acceptance suite holds one document per renderer (a diff, a Markdown document, a JSON document and a report), an artifact of a media type no renderer serves, artifacts of each of the four classification classes with a restricted field and a marker text, the fake of Policy.Decide of AIFACTORY-TASK-3158 set to each of the four outcomes allow, allow-with-constraints, deny and allow-with-approval, and a fixture publisher of ClassificationChanged built from the pinned contracts package for one artifact, for a type-level label and for a resource type that addresses no artifact."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6109,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3170]",
      "number": 3170
    },
    {
      "id": "AIFACTORY-TASK-3171",
      "type": "task",
      "parent": "AIFACTORY-US-788",
      "title": "Verify preview-an-artifact-as-a-redacted-projection through the acceptance suite",
      "sequence": "04.01.09.04",
      "description": "Verify preview-an-artifact-as-a-redacted-projection through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ArtifactService-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-788: one preview per renderer with nothing stored, the four outcomes of the policy decision with the asserted request members, that is the redacted content for allow, the reference for allow-with-constraints and 403 with the decision id for deny and allow-with-approval, every 403 and 404 with the fixture of AIFACTORY-TASK-3154, the 503 while the policy engine or the blob store is stopped, and the relabel on ClassificationChanged with its redelivery.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ArtifactService-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-788: one preview per renderer with nothing stored, the four outcomes of the policy decision with the asserted request members, that is the redacted content for allow, the reference for allow-with-constraints and 403 with the decision id for deny and allow-with-approval, every 403 and 404 with the fixture of AIFACTORY-TASK-3154, the 503 while the policy engine or the blob store is stopped, and the relabel on ClassificationChanged with its redelivery."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6109,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3171]",
      "number": 3171
    },
    {
      "id": "AIFACTORY-US-789",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Remove the content of a deleted artifact, keep its metadata and lineage and announce the deletion with evidence; sweep content past its retention that no evidence record or unexpired run references",
      "sequence": "04.01.10",
      "description": "As a workspace admin, I want the content of a deleted artifact removed while its record and its lineage stay, and content past the retention of my tenant swept unless an audit evidence record or an unexpired run still references it, so that every reference to a deleted artifact can still be explained, and the retention of my tenant is enforced without content being deleted that evidence or a run still needs. Content does not stay for ever, and when it is removed its record stays. In this increment content is removed on two paths: by the retention sweep, which is effective in I1 (D125) and delivers the retention outcome of ADR-0019 decision 4, and for the artifacts of a closing project (AIFACTORY-US-790). The command `Delete` of the aggregate moves an artifact from Stored, Validated or Superseded to Deleted, keeps the row with its metadata and every lineage edge, and writes, in the same transaction, `ArtifactDeleted` with `artifactId`, `tenantId` and `reason` to the outbox together with one evidence record of the deletion. Audit evidence is an event: the sink of the pinned audit library (feature `component-audit-factory-evidence`) writes an `audit-evidence-v1` record as `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` in the transaction of the command, with the actor, the artifact and its hash as subject, the deletion action the schema names and the reason, and without content. The same transaction sets a pending removal on the artifact. The pending removal is the field `pendingRemoval` of the aggregate, the column `PendingRemoval` of `Artifacts`: the model defines it as the state between Deleted and the removed blob (D125), and the migration of this PBI creates the column. After that transaction committed, the content is removed from `artifact-blob`. Content is held once per tenant and hash and several artifacts may reference it, so the removal runs under the lock of tenant and hash that a store takes as well (AIFACTORY-US-784) and checks again under it whether another artifact of the tenant with that hash still holds content. When one does, the blob stays and the pending removal is cleared, because the deletion of the last holder will remove the blob. When none does, the blob is removed, and the transaction that clears the pending removal lets `connectsoft.factory.artifacts.bytes` fall by its size. When the blob store does not answer, the artifact stays Deleted, `Artifacts.Fetch` already refuses it, the pending removal stays set and no second event is written. The removal is retried under the idempotency key `artifactId` by the retry policy of the worker that applied the deletion. When those attempts are used up, the work is visible as failed work to the worker operations that ADR-0015 defines, and the pending removal still stands: every run of `RetentionSweeper` selects the Deleted artifacts with a pending removal beside its retention candidates and tries their removal again, so a blob whose removal failed is removed on a later run without an operator, and only a cleared pending removal counts as a completed deletion. `connectsoft.factory.artifacts.deleted` counts the deletion by tenant and reason. Two paths apply the command in this delivery. The first is the worker `RetentionSweeper`, hosted by AIFACTORY-US-782 on its daily schedule, which the model defines as deleting content past the retention that no audit evidence record and no unexpired run references, with the reason of the retention expiry. The retention is the value of the option `Knowledge:Artifacts:DefaultRetentionDays`, 365 by default and reloadable, the one year of ADR-0019 decision 4; the retention of a project applies when a retention rule sets one, and such a rule arrives only with RetentionResidencyService in I4, so in this increment the default applies to every project artifact. A candidate is a project artifact that holds content, in state Stored, Validated or Superseded, and whose `createdAt` is older than the retention. A tenant-level artifact has no project and therefore no project retention, and is no candidate (D125). The service keeps its own records of the references that spare a candidate, the rows of the table `ArtifactReferences`, which AIFACTORY-US-986 writes from the audit evidence event and from the stores and the run end events of a run. The sweeper reads them and nothing else. A candidate with a reference record of the kind audit-evidence is spared. A candidate with a reference record of the kind run is spared while that run is unexpired. D125 does not say when a run expires, so this delivery reads it on the safe side, because deleting content cannot be undone: a run is unexpired while its record carries no `RunEndedAt`, and after its end until the retention has passed since `RunEndedAt`. That reading is reported to the owner. Every other candidate is deleted. A reference record written between the selection and the deletion still spares its artifact, because the sweeper checks the reference records of the artifact again in the transaction in which it applies `Delete`. Each run writes one log record per tenant with the number of candidates, the number a reference spared and the number deleted, and the activity of the run carries the three numbers, without content; the deletions are counted in `connectsoft.factory.artifacts.deleted` with the reason of the retention expiry. The second path is the deletion of the artifacts of a closing project (AIFACTORY-US-790), with the reason of the closing; the reference records concern the retention sweep alone, as the model states them, and are not read on this path. A third path arrives later: the handler of a deletion order is built in I4 with RetentionResidencyService and is not registered here, and with it arrive the handlers of a retention rule and of a legal hold, so in this increment no legal hold exists. No operation of the model deletes one artifact on request: the scope `factory.artifacts.admin` is summarised as export and delete, yet no REST or gRPC operation deletes, and AgentRuntimeService has no operation by which it could have the blob of a compacted checkpoint removed; both are reported to the owner. The sweeper follows the retry policy of the model, three attempts at a fixed interval, after which the failed work is visible to the worker operations that ADR-0015 defines; an artifact that is already Deleted is never deleted again and is selected only while its removal is pending, and a duplicate trigger deletes nothing twice. Kind: behavior. Traces: services: ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Fetch, ArtifactService/GetArtifact; events: ArtifactService/ArtifactDeleted; descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0019; requirements: NFR-03, XL-14; scenarios: SCN-ArtifactService-012. Relates: nfrs: NFR-03, NFR-05. Depends on: AIFACTORY-US-782, AIFACTORY-US-783, AIFACTORY-US-784, AIFACTORY-US-785, AIFACTORY-US-986, feature:component-audit-factory-evidence. Sources: model/services/knowledge/ArtifactService.yaml, docs/architecture/data-governance.md#retention-and-deletion, docs/architecture/adr/0019-data-governance.md, docs/reference/schemas/audit-evidence.schema.json, docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given an `ArtifactService/Artifact` that holds content, in state Stored, Validated or Superseded, when `Delete` is applied to it, then it is Deleted, its row and its lineage edges remain, `ArtifactService/ArtifactDeleted` with `artifactId`, `tenantId` and `reason`, one `audit-evidence-v1` record and the pending removal of the artifact were written in the same transaction, the content is removed from `artifact-blob` after the commit and the pending removal is cleared with it, `ArtifactService/Artifacts.Fetch` refuses the artifact and `ArtifactService/GetArtifact` returns it with the state Deleted (SCN-ArtifactService-012, ADR-0019).",
        "AC2: Given two artifacts of one tenant in two chains that reference the same content, when the first is deleted, then the blob stays, the pending removal of the first is cleared and the second is still fetched; and when the second is deleted, then the blob is removed and `connectsoft.factory.artifacts.bytes` falls once by its size (model/services/knowledge/ArtifactService.yaml).",
        "AC3: Given project artifacts younger and older than `Knowledge:Artifacts:DefaultRetentionDays`, of which one older artifact is referenced by an audit evidence record, one by a run that is not over, one by a run that ended within the retention and one by a run that ended before it, and a tenant-level artifact older than the retention, when `RetentionSweeper` runs with the reference records of `ArtifactReferences`, then exactly the older project artifacts that hold content and that no audit evidence record and no unexpired run references are deleted with the reason of the retention expiry, the artifact of the run that ended before the retention among them, the three referenced artifacts, the younger ones and the tenant-level one keep their content, a changed value of the option is applied by the next run, a second run and a duplicate trigger delete nothing more, and every run writes one log record per tenant and carries on its activity the numbers of candidates, spared and deleted (SCN-ArtifactService-012, model/services/knowledge/ArtifactService.yaml).",
        "AC4: Given the blob store does not answer when content is to be removed, when the removal is retried under the key `artifactId`, then the artifact stays Deleted with its pending removal set and refused by `ArtifactService/Artifacts.Fetch`, no second `ArtifactService/ArtifactDeleted` is written, after three failed attempts the work is visible as failed work of the worker, and the next run of `RetentionSweeper` selects the artifact again by its pending removal and removes the blob once the store answers; while the blob store is stopped the pending removal is never cleared, so the deletion does not count as complete, a closing project that waits for it stays Closing and no confirmation is written, and after the recovery the cleared pending removal lets one confirmation be written, which AC4 of AIFACTORY-US-790 proves end to end (SCN-ArtifactService-012, model/services/knowledge/ArtifactService.yaml).",
        "AC5: Given the outbox record of a deletion, when the dispatcher of the `artifact` messaging profile publishes `ArtifactService/ArtifactDeleted` on `artifacts.artifacts.v1.artifact-deleted`, then the event is sent in the run event envelope with `artifactId`, `tenantId` and `reason` and without content, and a transport outage is retried with backoff so that the event is neither lost nor duplicated under its event id (SCN-ArtifactService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3172",
        "AIFACTORY-TASK-3188",
        "AIFACTORY-TASK-3173",
        "AIFACTORY-TASK-3174",
        "AIFACTORY-TASK-3175"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6110,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Fetch",
          "ArtifactService/GetArtifact"
        ],
        "events": [
          "ArtifactService/ArtifactDeleted"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03",
          "XL-14"
        ],
        "scenarios": [
          "SCN-ArtifactService-012"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03",
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "AIFACTORY-US-784",
        "AIFACTORY-US-785",
        "AIFACTORY-US-986",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-789]",
      "number": 789
    },
    {
      "id": "AIFACTORY-TASK-3172",
      "type": "task",
      "parent": "AIFACTORY-US-789",
      "title": "Delete command with the ArtifactDeleted outbox record, the evidence record and the repeatable removal of content",
      "sequence": "04.01.10.01",
      "description": "Delete command with the ArtifactDeleted outbox record, the evidence record and the repeatable removal of content. Expected output: The Delete command moves a Stored, Validated or Superseded artifact to Deleted, keeps the row and the lineage edges, and in one transaction sets the pending removal of the artifact and writes ArtifactDeleted with artifactId, tenantId and reason and one audit-evidence-v1 record through the sink of the pinned audit library as AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, without content; after the commit the removal step takes the lock of tenant and hash that a store takes as well, checks again whether another artifact of the tenant with that hash still holds content, removes the blob through the content port when none does, and clears the pending removal in a transaction that lets connectsoft.factory.artifacts.bytes fall by the size of a removed blob and in which a participant that AIFACTORY-US-790 registers writes the confirmation of a closing project when the last pending removal of that project is cleared; a removal that fails leaves the pending removal set and writes no second event; connectsoft.factory.artifacts.deleted counts the deletion by tenant and reason.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The Delete command moves a Stored, Validated or Superseded artifact to Deleted, keeps the row and the lineage edges, and in one transaction sets the pending removal of the artifact and writes ArtifactDeleted with artifactId, tenantId and reason and one audit-evidence-v1 record through the sink of the pinned audit library as AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, without content; after the commit the removal step takes the lock of tenant and hash that a store takes as well, checks again whether another artifact of the tenant with that hash still holds content, removes the blob through the content port when none does, and clears the pending removal in a transaction that lets connectsoft.factory.artifacts.bytes fall by the size of a removed blob and in which a participant that AIFACTORY-US-790 registers writes the confirmation of a closing project when the last pending removal of that project is cleared; a removal that fails leaves the pending removal set and writes no second event; connectsoft.factory.artifacts.deleted counts the deletion by tenant and reason."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6110,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3172]",
      "number": 3172
    },
    {
      "id": "AIFACTORY-TASK-3188",
      "type": "task",
      "parent": "AIFACTORY-US-789",
      "title": "Migration of the pending-removal column PendingRemoval on Artifacts",
      "sequence": "04.01.10.02",
      "description": "Migration of the pending-removal column PendingRemoval on Artifacts. Expected output: A migration adds to Artifacts the column PendingRemoval of model/services/knowledge/ArtifactService.yaml (D125), which marks a pending removal of content, and the aggregate receives the field pendingRemoval: the Delete transaction sets it and the successful removal, or the finding that another artifact still holds the content, clears it; the selection of Deleted artifacts with a pending removal runs per tenant; the mapping carries the column under the tenant row filter and the mapping test runs against an isolated test database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "A migration adds to Artifacts the column PendingRemoval of model/services/knowledge/ArtifactService.yaml (D125), which marks a pending removal of content, and the aggregate receives the field pendingRemoval: the Delete transaction sets it and the successful removal, or the finding that another artifact still holds the content, clears it; the selection of Deleted artifacts with a pending removal runs per tenant; the mapping carries the column under the tenant row filter and the mapping test runs against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6110,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-3188]",
      "number": 3188
    },
    {
      "id": "AIFACTORY-TASK-3173",
      "type": "task",
      "parent": "AIFACTORY-US-789",
      "title": "RetentionSweeper selection by the default retention with the reference records, the run counts and the retry of pending removals",
      "sequence": "04.01.10.03",
      "description": "RetentionSweeper selection by the default retention with the reference records, the run counts and the retry of pending removals. Expected output: RetentionSweeper selects, per tenant, the project artifacts that hold content and whose createdAt is older than the retention, the value of Knowledge:Artifacts:DefaultRetentionDays (365 by default, reloadable, read on every run) while no retention rule sets a project retention, reads the reference records of ArtifactReferences for each and applies Delete with the reason of the retention expiry to every candidate that no record of the kind audit-evidence and no record of the kind run of an unexpired run references; a run is unexpired while its record carries no RunEndedAt and until the retention has passed since RunEndedAt, a reading of D125 that is reported to the owner; the reference records are checked again in the transaction that applies Delete; the sweep is effective in I1 (D125) and no binding spares every artifact; each run writes one log record per tenant with the numbers of candidates, spared and deleted and sets the three on its activity, without content and without a new instrument; on every run the sweeper also selects the Deleted artifacts with a pending removal and runs the removal step of AIFACTORY-TASK-3172 for each; a tenant-level artifact is no candidate, an artifact already Deleted is never deleted again, a duplicate trigger has no second effect, and after three failed attempts the work is shown to the worker operations that ADR-0015 defines.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "RetentionSweeper selects, per tenant, the project artifacts that hold content and whose createdAt is older than the retention, the value of Knowledge:Artifacts:DefaultRetentionDays (365 by default, reloadable, read on every run) while no retention rule sets a project retention, reads the reference records of ArtifactReferences for each and applies Delete with the reason of the retention expiry to every candidate that no record of the kind audit-evidence and no record of the kind run of an unexpired run references; a run is unexpired while its record carries no RunEndedAt and until the retention has passed since RunEndedAt, a reading of D125 that is reported to the owner; the reference records are checked again in the transaction that applies Delete; the sweep is effective in I1 (D125) and no binding spares every artifact; each run writes one log record per tenant with the numbers of candidates, spared and deleted and sets the three on its activity, without content and without a new instrument; on every run the sweeper also selects the Deleted artifacts with a pending removal and runs the removal step of AIFACTORY-TASK-3172 for each; a tenant-level artifact is no candidate, an artifact already Deleted is never deleted again, a duplicate trigger has no second effect, and after three failed attempts the work is shown to the worker operations that ADR-0015 defines."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6110,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3173]",
      "number": 3173
    },
    {
      "id": "AIFACTORY-TASK-3174",
      "type": "task",
      "parent": "AIFACTORY-US-789",
      "title": "Aged artifacts, a controllable clock, reference records of both kinds and a failing blob removal",
      "sequence": "04.01.10.04",
      "description": "Aged artifacts, a controllable clock, reference records of both kinds and a failing blob removal. Expected output: The acceptance suite holds a clock it sets, project artifacts created before and after the retention of Knowledge:Artifacts:DefaultRetentionDays in each state, a tenant-level artifact older than the retention, two artifacts of one tenant that reference the same content, reference records written through the handlers of AIFACTORY-US-986 with the fixture of AIFACTORY-TASK-3974 for an older artifact that an audit evidence record references, one whose run is not over, one whose run ended within the retention and one whose run ended before it, a second value of the option, the blob store double of AIFACTORY-TASK-3158 set to refuse a removal a given number of times and to stay stopped across a run of the sweeper, a recording participant of the transaction that clears a pending removal, a reader of the log records and the activity of a sweeper run, and a subscriber on artifacts.artifacts.v1.artifact-deleted and on audit.evidence.v1.evidence-submitted that records every delivered envelope.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a clock it sets, project artifacts created before and after the retention of Knowledge:Artifacts:DefaultRetentionDays in each state, a tenant-level artifact older than the retention, two artifacts of one tenant that reference the same content, reference records written through the handlers of AIFACTORY-US-986 with the fixture of AIFACTORY-TASK-3974 for an older artifact that an audit evidence record references, one whose run is not over, one whose run ended within the retention and one whose run ended before it, a second value of the option, the blob store double of AIFACTORY-TASK-3158 set to refuse a removal a given number of times and to stay stopped across a run of the sweeper, a recording participant of the transaction that clears a pending removal, a reader of the log records and the activity of a sweeper run, and a subscriber on artifacts.artifacts.v1.artifact-deleted and on audit.evidence.v1.evidence-submitted that records every delivered envelope."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6110,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3174]",
      "number": 3174
    },
    {
      "id": "AIFACTORY-TASK-3175",
      "type": "task",
      "parent": "AIFACTORY-US-789",
      "title": "Verify delete-artifact-content-keep-metadata-and-lineage through the acceptance suite",
      "sequence": "04.01.10.05",
      "description": "Verify delete-artifact-content-keep-metadata-and-lineage through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ArtifactService-012\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-789: the three Deleted transitions with the kept row and lineage, the evidence record, the pending removal set with the deletion and cleared with the removed blob, the shared content removed with its last holder, the sweep by the default retention that deletes exactly the older project artifacts no audit evidence record and no unexpired run references, the artifact of a run that ended before the retention among them, and spares the artifact an evidence record references, the artifacts of a run that is not over and of a run that ended within the retention, the younger artifacts and the tenant-level artifact, the changed value of Knowledge:Artifacts:DefaultRetentionDays applied by the next run, the log record and the activity of each run with the numbers of candidates, spared and deleted, the removal that fails three times, stays pending and succeeds on the next run of the sweeper, the pending removal that is never cleared while the blob store is stopped and whose clearing transaction calls its registered participant once after the recovery, and the publication and payload of ArtifactDeleted; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ArtifactService-012\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-789: the three Deleted transitions with the kept row and lineage, the evidence record, the pending removal set with the deletion and cleared with the removed blob, the shared content removed with its last holder, the sweep by the default retention that deletes exactly the older project artifacts no audit evidence record and no unexpired run references, the artifact of a run that ended before the retention among them, and spares the artifact an evidence record references, the artifacts of a run that is not over and of a run that ended within the retention, the younger artifacts and the tenant-level artifact, the changed value of Knowledge:Artifacts:DefaultRetentionDays applied by the next run, the log record and the activity of each run with the numbers of candidates, spared and deleted, the removal that fails three times, stays pending and succeeds on the next run of the sweeper, the pending removal that is never cleared while the blob store is stopped and whose clearing transaction calls its registered participant once after the recovery, and the publication and payload of ArtifactDeleted; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6110,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3175]",
      "number": 3175
    },
    {
      "id": "AIFACTORY-US-790",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Export the artifacts, metadata and lineage of a project in open formats, and confirm the export or the deletion of a closing project",
      "sequence": "04.01.11",
      "description": "As a workspace admin, I want the artifacts of my project exported with their metadata and lineage in open formats, on request and when the project closes, so that my tenant takes what it owns and a closing project ends only with a recorded export or deletion of its data. A tenant owns what it submitted and what was derived from it, and takes it along on request (ADR-0019 decision 5). `ExportArtifacts` under the scope `factory.artifacts.admin` starts the export of the artifacts, the metadata and the lineage of one project; it is of class external and idempotent on the `Idempotency-Key` header. The caller is a Workspace admin of the project or a Platform admin. A person reaches the route through the Knowledge gateway, which feature `knowledge-host` delivers in this increment (D125); this feature builds no direct route, and its suite calls the hosted route. The service has the export decided through `Policy.Decide` of PolicyEngineService with the action kind export of `policy-decision-v1`, the target `artifact-export` and the side-effect class external. Whether an export needs an approval is decided by that decision alone: the service never decides, grants or assumes an approval. Every outcome of the schema is mapped. The outcome allow starts the export and the outcome deny is answered 403. For the outcome allow-with-approval the model lists no answer, since the operation has the codes 202, 403 and 404, and it names nobody who opens an approval request for an export asked outside a run; until the owner decides, such a call is answered 403 with the decision id in the problem body and nothing starts. The outcome allow-with-constraints is answered in the same way, because the service can apply no constraint to a package. An allowed call records an export request and answers 202 with its identifier. The request is a row of the table `ExportRequests` of the model (D125), which the migration of this PBI creates: request identifier, tenant, project, kind (export or deletion), origin (caller-request or project-closing), idempotency key, requester, state (requested, completed or failed), failure reason, the artifact of the package and the times of the request and of its completion. Two things are written in one transaction: the request row in the state requested and one evidence record of the request, which is an `audit-evidence-v1` record written as `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` by the sink of the pinned audit library with the requester as actor and the project as subject. The recorded request is what starts the worker: the model names a row of `ExportRequests` in the state requested as a trigger of `ExportWorker` beside `ProjectStateChanged` of ProjectService, and no event announces it (D125). The service publishes no message for it, and a 202 is followed by a package without any event of ProjectService. The key is scoped by tenant and project: a repeat with the same key returns the same request with 202 and starts nothing, and since the request has no body the model defines, no second input can arrive under the same key. A project in which the tenant of the caller holds no version chain is answered 404, which is also the answer for a project of another tenant; a token without the scope or without a role in the project is answered 403. The worker `ExportWorker` picks up the requests in the state requested, as AIFACTORY-US-782 hosts it, and produces the package under the key of project and export request, one at a time per tenant; a request that is found again by a later look of the worker, or picked up again after an interrupted execution, builds one package, because the request is completed with its package in one transaction and a completed or failed request is never picked up again. The package follows docs/architecture/data-governance.md: records as JSON, that is the metadata of every artifact of the project, the Deleted ones included, the version chains and the lineage edges, content in its original format under its hash, and reports as Markdown. It is stored as one artifact of kind Export in the project through the path of AIFACTORY-US-784, so `ArtifactStored` announces it, and the request is marked completed with that artifact in the same transaction; the requester reads it through the download reference of `GetArtifact`. A package larger than `Knowledge:Artifacts:MaxArtifactMb` has no rule in the model and is reported to the owner. The worker retries as the model states, five attempts with exponential backoff, and then marks the request failed with its reason, leaves no partial package and shows the failed work to the worker operations that ADR-0015 defines; it never repeats an export beyond that policy on its own. The same worker serves a closing project. The inbox handler `ExportOrDeleteOnClosing` of `ProjectStateChanged` of ProjectService reacts to the transition to Closing, idempotently on the event id, and exports or deletes the artifacts of the project per tenant policy. Where that tenant policy is held is not named by the model: the handler reads the choice through one port, whose binding in this delivery is one configuration value per tenant that the model does not list, and without a value it exports, because an export destroys nothing; the source of the choice is reported to the owner. The handler only records the work and executes none of it: it writes one row of `ExportRequests` of the origin project-closing, of the kind export or deletion, in the state requested, with the workload identity of the service as requester. The column `IdempotencyKey` of the table is required and the model does not say which key such a record carries; this delivery writes the event id of the consumed `ProjectStateChanged`, so that the unique index on tenant, project and key refuses a second record of a redelivered event, and the point is reported to the owner. `ExportWorker` executes both kinds under the retry policy and the concurrency the model gives it, five attempts with exponential backoff and one execution at a time per tenant. On the export path it builds the package as for a requested export, and the transaction that marks the request completed writes `ProjectDataOffboarded` with `projectId`, `tenantId` and the outcome exported. On the deletion path it applies `Delete` to the artifacts of the project in batches, each batch in one transaction, with the reason of the closing and with everything AIFACTORY-US-789 describes for a deletion: the event, the evidence record and the pending removal of each artifact. The size of a batch is a configuration value the model does not list. A repeated execution skips the artifacts that are already Deleted, so a retry resumes where the failed attempt stopped; when the batches fail five times the request is marked failed and is visible as failed work. The outcome deleted has one meaning: every artifact of the project is in the state Deleted and none has a pending removal, so no blob of the project is left, because the invariant of the model confirms only a completed deletion. `ProjectDataOffboarded` with the outcome deleted is therefore written in the transaction that clears the last pending removal of the project, which marks the request completed as well. This PBI registers that step as a participant of the clearing transaction of AIFACTORY-US-789, so it runs whether the removal succeeds within the attempts of `ExportWorker` or on a later run of `RetentionSweeper`, and a request whose artifacts are all Deleted is not failed by a removal that is still pending. While the blob store does not answer, no pending removal is cleared, no confirmation is written and the project stays Closing; after the recovery one confirmation is written. A project without artifacts is confirmed by the first execution of its request with the outcome of the chosen path, because ProjectService moves the project to Closed only after this confirmation. One confirmation is written per closing project; a redelivered event, a request found twice by the worker and a duplicate trigger write none, and a failed export writes none, so the project stays Closing until the failed work is replayed. Kind: behavior. Traces: services: ArtifactService, PolicyEngineService, ProjectService; aggregates: ArtifactService/Artifact; apis: ArtifactService/ExportArtifacts, PolicyEngineService/Policy.Decide; events: ArtifactService/ProjectDataOffboarded, ArtifactService/ArtifactStored, ProjectService/ProjectStateChanged; descriptors: audit-evidence-v1, policy-decision-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019; requirements: NFR-03, XL-14; scenarios: SCN-ArtifactService-005, SCN-ArtifactService-013. Relates: nfrs: NFR-03, NFR-05. Depends on: AIFACTORY-US-782, AIFACTORY-US-783, AIFACTORY-US-784, AIFACTORY-US-787, AIFACTORY-US-789, feature:policy-engine-service, feature:project-service, feature:component-audit-factory-evidence. Sources: model/services/knowledge/ArtifactService.yaml, model/services/control-plane/ProjectService.yaml, docs/architecture/data-governance.md#retention-and-deletion, docs/reference/schemas/audit-evidence.schema.json, docs/reference/schemas/policy-decision.schema.json, docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin with `factory.artifacts.admin` and a role in a project that holds artifacts, and an allowing decision of `PolicyEngineService/Policy.Decide` for the action kind export, when `ArtifactService/ExportArtifacts` is called with an `Idempotency-Key`, then the response is 202 with the export request, the row of `ExportRequests` in the state requested and one `audit-evidence-v1` record of the request were written in one transaction, no message was published for the request, and a repeat with the same key returns the same request with 202 and starts no second export (SCN-ArtifactService-005, XL-14).",
        "AC2: Given a token without the scope, a token without a role in the project, a decision of `PolicyEngineService/Policy.Decide` with the outcome deny, allow-with-approval or allow-with-constraints, or a project in which the tenant holds no version chain, when `ArtifactService/ExportArtifacts` is called, then the response is 403, 403, 403 and 404 respectively with a problem response, which carries the decision id after a decision, a project of another tenant is answered 404 exactly as an unknown one, and no request, evidence record or package is written (SCN-ArtifactService-005, ADR-0015).",
        "AC3: Given an export request recorded by `ArtifactService/ExportArtifacts` as a row of `ExportRequests` in the state requested, when `ExportWorker` looks for recorded requests, then it picks the request up without any `ProjectService/ProjectStateChanged` and without any message, one `ArtifactService/Artifact` of kind Export exists in the project whose package holds the metadata, the version chains and the lineage edges as JSON and each content in its original format under its hash, as docs/architecture/data-governance.md states, `ArtifactService/ArtifactStored` announces it, the request is completed with that artifact in the same transaction, a request the worker finds a second time and a duplicate trigger build one package, and after five failed attempts the request is failed with its reason and no partial package exists (SCN-ArtifactService-005).",
        "AC4: Given a `ProjectService/ProjectStateChanged` that announces the transition of a project to Closing, when `ExportOrDeleteOnClosing` handles it, then the handler records one row of `ExportRequests` of the origin project-closing in the state requested and executes nothing itself; on the export path the completed export writes `ArtifactService/ProjectDataOffboarded` with the outcome exported in the transaction that completes the request; on the deletion path `ExportWorker` deletes the artifacts in batches and the confirmation with the outcome deleted is written in the transaction that clears the last pending removal of the project; with the blob store stopped the project stays Closing and no confirmation is written, and after its recovery one confirmation is written; a project without artifacts is confirmed by the first execution of its request; and a redelivery of the same event id writes no second confirmation (SCN-ArtifactService-013, XL-14).",
        "AC5: Given the outbox record of a confirmation, when the dispatcher of the `artifact` messaging profile publishes `ArtifactService/ProjectDataOffboarded` on `artifacts.projects.v1.project-data-offboarded`, then the event is sent in the run event envelope with `projectId`, `tenantId` and `outcome`, and a transport outage is retried with backoff so that the event is neither lost nor duplicated under its event id (SCN-ArtifactService-013, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3176",
        "AIFACTORY-TASK-3177",
        "AIFACTORY-TASK-3178",
        "AIFACTORY-TASK-3189",
        "AIFACTORY-TASK-3179"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6111,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService",
          "PolicyEngineService",
          "ProjectService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/ExportArtifacts",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "ArtifactService/ProjectDataOffboarded",
          "ArtifactService/ArtifactStored",
          "ProjectService/ProjectStateChanged"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "policy-decision-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03",
          "XL-14"
        ],
        "scenarios": [
          "SCN-ArtifactService-005",
          "SCN-ArtifactService-013"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03",
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "AIFACTORY-US-784",
        "AIFACTORY-US-787",
        "AIFACTORY-US-789",
        "feature:policy-engine-service",
        "feature:project-service",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/knowledge-memory/services/artifact-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-790]",
      "number": 790
    },
    {
      "id": "AIFACTORY-TASK-3176",
      "type": "task",
      "parent": "AIFACTORY-US-790",
      "title": "Migration of the export request table ExportRequests in artifact-sql",
      "sequence": "04.01.11.01",
      "description": "Migration of the export request table ExportRequests in artifact-sql. Expected output: A migration adds the table ExportRequests of model/services/knowledge/ArtifactService.yaml (D125) for export requests and for the work of a closing project, and the aggregate receives the entity ExportRequest: RequestId, TenantId, ProjectId, Kind (export or deletion), Origin (caller-request or project-closing), IdempotencyKey, RequestedBy, State (requested, completed, failed), FailureReason, PackageArtifactId with its foreign key to Artifacts, RequestedAt and CompletedAt, with the unique index UX_ExportRequests_Tenant_Project_Key on tenant, project and key, the index IX_ExportRequests_Tenant_State by which ExportWorker reads the requested rows, and the tenant row filter on its mapping; the mapping test runs against an isolated test database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "A migration adds the table ExportRequests of model/services/knowledge/ArtifactService.yaml (D125) for export requests and for the work of a closing project, and the aggregate receives the entity ExportRequest: RequestId, TenantId, ProjectId, Kind (export or deletion), Origin (caller-request or project-closing), IdempotencyKey, RequestedBy, State (requested, completed, failed), FailureReason, PackageArtifactId with its foreign key to Artifacts, RequestedAt and CompletedAt, with the unique index UX_ExportRequests_Tenant_Project_Key on tenant, project and key, the index IX_ExportRequests_Tenant_State by which ExportWorker reads the requested rows, and the tenant row filter on its mapping; the mapping test runs against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6111,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-3176]",
      "number": 3176
    },
    {
      "id": "AIFACTORY-TASK-3177",
      "type": "task",
      "parent": "AIFACTORY-US-790",
      "title": "ExportArtifacts with the policy decision, the evidence record and the ExportWorker package",
      "sequence": "04.01.11.02",
      "description": "ExportArtifacts with the policy decision, the evidence record and the ExportWorker package. Expected output: ExportArtifacts has the export decided through Policy.Decide with the action kind export, the target artifact-export and the side-effect class external, starts the export for the outcome allow only and answers 403 with the decision id for the outcomes deny, allow-with-approval and allow-with-constraints, answers 404 for a project without a version chain of the tenant, and for an allowed call writes in one transaction the row of ExportRequests of the origin caller-request in the state requested and one audit-evidence-v1 record through the sink of the pinned audit library, publishes no message for the request, and answers 202; a repeat with the same key in the same tenant and project returns the same request and writes no second row; ExportWorker picks the row up from ExportRequests as the model states (D125), so a recorded request reaches it without an event of ProjectService, and a request it finds a second time builds one package, because a completed or failed request is never picked up again; it builds the package with the records as JSON, each content in its original format under its hash and reports as Markdown, stores it as one artifact of kind Export through the store path with its ArtifactStored record, completes the request in the same transaction, and after five failed attempts marks the request failed and leaves no partial package.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "ExportArtifacts has the export decided through Policy.Decide with the action kind export, the target artifact-export and the side-effect class external, starts the export for the outcome allow only and answers 403 with the decision id for the outcomes deny, allow-with-approval and allow-with-constraints, answers 404 for a project without a version chain of the tenant, and for an allowed call writes in one transaction the row of ExportRequests of the origin caller-request in the state requested and one audit-evidence-v1 record through the sink of the pinned audit library, publishes no message for the request, and answers 202; a repeat with the same key in the same tenant and project returns the same request and writes no second row; ExportWorker picks the row up from ExportRequests as the model states (D125), so a recorded request reaches it without an event of ProjectService, and a request it finds a second time builds one package, because a completed or failed request is never picked up again; it builds the package with the records as JSON, each content in its original format under its hash and reports as Markdown, stores it as one artifact of kind Export through the store path with its ArtifactStored record, completes the request in the same transaction, and after five failed attempts marks the request failed and leaves no partial package."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6111,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3177]",
      "number": 3177
    },
    {
      "id": "AIFACTORY-TASK-3178",
      "type": "task",
      "parent": "AIFACTORY-US-790",
      "title": "ExportOrDeleteOnClosing inbox handler that records the work of a closing project through the tenant choice port",
      "sequence": "04.01.11.03",
      "description": "ExportOrDeleteOnClosing inbox handler that records the work of a closing project through the tenant choice port. Expected output: The handler of ProjectStateChanged reacts to the transition to Closing, idempotently on the event id, reads the choice between export and deletion through one port bound to a configuration value per tenant that the model does not list, and chooses the export when no value is set; it executes nothing itself: it writes one row of ExportRequests of the origin project-closing and of the kind export or deletion, in the state requested, with the workload identity of the service as requester and the event id of the consumed ProjectStateChanged as IdempotencyKey, a choice of this delivery that is reported to the owner because the model names no key for such a record, and publishes no message; a redelivered event writes no second request.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The handler of ProjectStateChanged reacts to the transition to Closing, idempotently on the event id, reads the choice between export and deletion through one port bound to a configuration value per tenant that the model does not list, and chooses the export when no value is set; it executes nothing itself: it writes one row of ExportRequests of the origin project-closing and of the kind export or deletion, in the state requested, with the workload identity of the service as requester and the event id of the consumed ProjectStateChanged as IdempotencyKey, a choice of this delivery that is reported to the owner because the model names no key for such a record, and publishes no message; a redelivered event writes no second request."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6111,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3178]",
      "number": 3178
    },
    {
      "id": "AIFACTORY-TASK-3189",
      "type": "task",
      "parent": "AIFACTORY-US-790",
      "title": "Closing work of ExportWorker with the deletion in batches and the ProjectDataOffboarded confirmation on the last cleared pending removal",
      "sequence": "04.01.11.04",
      "description": "Closing work of ExportWorker with the deletion in batches and the ProjectDataOffboarded confirmation on the last cleared pending removal. Expected output: ExportWorker executes a request of the origin project-closing, which it picks up from ExportRequests in the state requested, under its retry policy of five attempts with exponential backoff, one at a time per tenant: for the kind export it builds the package as for a requested export and writes ProjectDataOffboarded with the outcome exported in the transaction that completes the request; for the kind deletion it applies Delete to the artifacts of the project in batches of a configured size the model does not list, each batch in one transaction with the reason of the closing, the event, the evidence record and the pending removal of AIFACTORY-TASK-3172, skips artifacts that are already Deleted on a repeated execution, and runs the removal step for each; a participant registered in the transaction that clears a pending removal writes ProjectDataOffboarded with the outcome deleted and completes the request when it clears the last pending removal of a project whose artifacts are all Deleted, whether ExportWorker or a later run of RetentionSweeper clears it; with the blob store stopped no confirmation is written and the request stays open; a project without artifacts is confirmed by the first execution; one confirmation is written per closing project.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "ExportWorker executes a request of the origin project-closing, which it picks up from ExportRequests in the state requested, under its retry policy of five attempts with exponential backoff, one at a time per tenant: for the kind export it builds the package as for a requested export and writes ProjectDataOffboarded with the outcome exported in the transaction that completes the request; for the kind deletion it applies Delete to the artifacts of the project in batches of a configured size the model does not list, each batch in one transaction with the reason of the closing, the event, the evidence record and the pending removal of AIFACTORY-TASK-3172, skips artifacts that are already Deleted on a repeated execution, and runs the removal step for each; a participant registered in the transaction that clears a pending removal writes ProjectDataOffboarded with the outcome deleted and completes the request when it clears the last pending removal of a project whose artifacts are all Deleted, whether ExportWorker or a later run of RetentionSweeper clears it; with the blob store stopped no confirmation is written and the request stays open; a project without artifacts is confirmed by the first execution; one confirmation is written per closing project."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6111,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3189]",
      "number": 3189
    },
    {
      "id": "AIFACTORY-TASK-3179",
      "type": "task",
      "parent": "AIFACTORY-US-790",
      "title": "Verify export-project-artifacts-and-confirm-offboarding through the acceptance suite",
      "sequence": "04.01.11.05",
      "description": "Verify export-project-artifacts-and-confirm-offboarding through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-005|Scenario=SCN-ArtifactService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-790 with the fake of Policy.Decide of AIFACTORY-TASK-3158 set to each of its four outcomes, a golden manifest of the package, a request recorded by ExportArtifacts that ExportWorker picks up from ExportRequests while no ProjectStateChanged and no message is published, a request the worker finds twice that builds one package, a fixture publisher of ProjectStateChanged built from the pinned contracts package and delivered once and twice, both bindings of the choice port, the deletion of a closing project in several batches, the blob store stopped during that deletion with the project left Closing and no confirmation on artifacts.projects.v1.project-data-offboarded, one confirmation after its recovery whether the worker or a run of RetentionSweeper clears the last pending removal, a project without artifacts, an export that fails five times, and the publication and payload of ProjectDataOffboarded; consumer handling is proven by the suite of ProjectService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ArtifactService-005|Scenario=SCN-ArtifactService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-790 with the fake of Policy.Decide of AIFACTORY-TASK-3158 set to each of its four outcomes, a golden manifest of the package, a request recorded by ExportArtifacts that ExportWorker picks up from ExportRequests while no ProjectStateChanged and no message is published, a request the worker finds twice that builds one package, a fixture publisher of ProjectStateChanged built from the pinned contracts package and delivered once and twice, both bindings of the choice port, the deletion of a closing project in several batches, the blob store stopped during that deletion with the project left Closing and no confirmation on artifacts.projects.v1.project-data-offboarded, one confirmation after its recovery whether the worker or a run of RetentionSweeper clears the last pending removal, a project without artifacts, an export that fails five times, and the publication and payload of ProjectDataOffboarded; consumer handling is proven by the suite of ProjectService."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6111,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3179]",
      "number": 3179
    },
    {
      "id": "AIFACTORY-US-986",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-017",
      "title": "Keep the reference records of audit evidence and of runs that spare an artifact from the retention sweep",
      "sequence": "04.01.12",
      "description": "As a workspace admin, I want the artifact store to know by its own records which artifacts an audit evidence record or a run of my tenant references, so that the retention sweep deletes old content without removing what evidence or an unexpired run still points at. The retention sweep is effective in I1 (D125), and deleting content cannot be undone, so the service must know which artifacts to spare before `RetentionSweeper` deletes anything. No other service is asked at the time of the sweep: ArtifactService keeps its own records, the entity `ArtifactReference` of the aggregate and the table `ArtifactReferences` of the model, and this PBI writes them; the sweep that reads them is delivered by AIFACTORY-US-789. A reference record names the artifact, the tenant, the kind of the reference, audit-evidence or run, the identifier of the evidence record or of the run as `ReferenceRef`, the time it was recorded and, for a run, the optional `RunEndedAt`. The unique index `UX_ArtifactReferences_Artifact_Reference` on artifact, kind and reference keeps one record per reference, and the index `IX_ArtifactReferences_Tenant_Reference` finds the records of one run or of one evidence record. The table has the tenant column and its mapping carries the tenant row filter of the profile (AIFACTORY-US-783). Three sources write or complete the records. The first is audit evidence. Every service writes its `audit-evidence-v1` records to its own outbox, and they are delivered as `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` in the run event envelope, the topic from which AuditService appends them. The model states the consumption by ArtifactService as the command `RecordEvidenceReference` and not as a consumes row, because the evidence event is no modelled event of a service. The subscription is declared by AIFACTORY-US-782; the handler of this PBI runs under the tenant of the record and writes one reference record of the kind audit-evidence per evidence id and artifact, with the `evidenceId` as `ReferenceRef`. Which artifacts an evidence record references is read from its `subject`: the schema gives a subject a `kind`, an `id` and an optional `hash` and fixes no list of kinds, and D125 does not say which subject kinds name an artifact or whether the match is by identifier or by hash. This delivery records a reference when `subject.id` is the `artifactId` of an artifact of the tenant of the record, for the subject kinds of one mapping that the contract test of the event pins, and matches no hash; a record whose subject names no artifact of that tenant is acknowledged without effect, and the point is reported to the owner. A redelivered evidence record writes nothing, and this delivery never removes a reference record of the kind audit-evidence, because audit evidence is retained far longer than content (ADR-0019). The second source is the store. When the metadata of `Artifacts.Store` names a producer run, the transaction of the store (AIFACTORY-US-784) writes one reference record of the kind run for the new artifact, with the `producerRunId` as `ReferenceRef` and without `RunEndedAt`. This PBI registers that step as a participant of the store transaction, so the record commits or rolls back with the artifact, and an idempotent repeat of a store writes none. The producing run is the only run the service knows of: the model names no writer of a run reference, and D125 does not say whether a run that only fetched or pinned an artifact as an input counts or how the service would learn of it, which is reported to the owner. The third source is the end of a run. The inbox handler `RecordRunEnd` consumes `RunCompleted`, `RunFailed` and `RunCancelled` of RunControlService, idempotently on the event id and under the tenant of the envelope, and sets `RunEndedAt` on every reference record of the kind run whose `ReferenceRef` is that run, with the time the envelope of the event states, so that the sweep knows when a run that references an artifact is over. `RunCompleted` reaches two handlers of the service, `SealRunArtifacts` (AIFACTORY-US-787) and `RecordRunEnd`, each deduplicated on its own. A run end event for a run without reference records is acknowledged without effect, and a record that already carries `RunEndedAt` keeps it. The service holds no record of runs, so a store that names a run whose end was already announced writes a record without `RunEndedAt`, and that artifact stays spared; the case is on the safe side of a deletion and is reported to the owner. The handlers write no event and call no other service. A handler that fails is retried by the inbox with backoff and is never applied twice, and while `artifact-sql` does not answer nothing is recorded and the delivery is retried. An evidence record or a run end event of one tenant never touches a record of another tenant. No content, no subject identifier and no reason text of an evidence record reaches a log record, an activity or a metric. When a run reference stops sparing its artifact is a rule of the sweep and is stated with it (AIFACTORY-US-789). Kind: behavior. Traces: services: ArtifactService, RunControlService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Store; events: RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled; descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0019; requirements: NFR-03. Relates: nfrs: NFR-03. Depends on: AIFACTORY-US-781, AIFACTORY-US-782, AIFACTORY-US-783, AIFACTORY-US-784, feature:run-control-service, feature:contracts-package, feature:component-audit-factory-evidence. Sources: model/services/knowledge/ArtifactService.yaml, model/services/control-plane/RunControlService.yaml, model/services/governance/AuditService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/data-governance.md#retention-and-deletion, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given artifacts of two tenants and fixture evidence records published as `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` in the run event envelope, when the handler of the command `RecordEvidenceReference` receives a record whose `subject.id` is the `artifactId` of an `ArtifactService/Artifact` of the tenant of the record, then one row of `ArtifactReferences` of the kind audit-evidence exists for that artifact with the `evidenceId` as `ReferenceRef`, a redelivery of the same evidence id adds none, a record whose subject names no artifact of that tenant, an artifact of the other tenant included, or whose subject kind the pinned mapping does not list is acknowledged without effect, and no event is written (model/services/knowledge/ArtifactService.yaml, ADR-0019).",
        "AC2: Given a workload that calls `ArtifactService/Artifacts.Store` with a producer run in the metadata, when the store commits, then one row of `ArtifactReferences` of the kind run exists for the new artifact with the `producerRunId` as `ReferenceRef` and an empty `RunEndedAt`, written in the transaction of the store; a store that is rolled back leaves none, an idempotent repeat adds none, and a store without a producer run writes none (model/services/knowledge/ArtifactService.yaml, ADR-0014).",
        "AC3: Given reference records of the kind run for three runs, when `RunControlService/RunCompleted`, `RunControlService/RunFailed` and `RunControlService/RunCancelled` are delivered, one for each run, then `RecordRunEnd` sets `RunEndedAt` on every record of the run its event names, with the time the envelope states, and on no record of another run or of the kind audit-evidence; a redelivery of the same event id changes nothing, an event for a run without reference records is acknowledged without effect, `RunControlService/RunCompleted` is handled by `SealRunArtifacts` and by `RecordRunEnd` once each, and no event is written (model/services/knowledge/ArtifactService.yaml).",
        "AC4: Given reference records of two tenants and a handler whose transaction fails once, when an evidence record or a run end event of one tenant is delivered and the failed delivery is retried, then no row of the other tenant is read or changed under the tenant row filter, the retried delivery is applied once, a second record with the same artifact, kind and reference is refused by `UX_ArtifactReferences_Artifact_Reference`, and no subject identifier, reason text or content reaches a log record, an activity or a metric (ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3971",
        "AIFACTORY-TASK-3972",
        "AIFACTORY-TASK-3973",
        "AIFACTORY-TASK-3974",
        "AIFACTORY-TASK-3975"
      ],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6112,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService",
          "RunControlService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-781",
        "AIFACTORY-US-782",
        "AIFACTORY-US-783",
        "AIFACTORY-US-784",
        "feature:run-control-service",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-986]",
      "number": 986
    },
    {
      "id": "AIFACTORY-TASK-3971",
      "type": "task",
      "parent": "AIFACTORY-US-986",
      "title": "Migration and mapping of the reference record table ArtifactReferences",
      "sequence": "04.01.12.01",
      "description": "Migration and mapping of the reference record table ArtifactReferences. Expected output: A migration adds the table ArtifactReferences of model/services/knowledge/ArtifactService.yaml (D125), and the aggregate receives the entity ArtifactReference: ReferenceId, ArtifactId with its foreign key to Artifacts, TenantId, ReferenceKind (audit-evidence or run), ReferenceRef, the nullable RunEndedAt and RecordedAt, with the unique index UX_ArtifactReferences_Artifact_Reference on artifact, kind and reference and the index IX_ArtifactReferences_Tenant_Reference on tenant, kind and reference; the mapping carries the tenant row filter of the Factory profile and the mapping test runs against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "A migration adds the table ArtifactReferences of model/services/knowledge/ArtifactService.yaml (D125), and the aggregate receives the entity ArtifactReference: ReferenceId, ArtifactId with its foreign key to Artifacts, TenantId, ReferenceKind (audit-evidence or run), ReferenceRef, the nullable RunEndedAt and RecordedAt, with the unique index UX_ArtifactReferences_Artifact_Reference on artifact, kind and reference and the index IX_ArtifactReferences_Tenant_Reference on tenant, kind and reference; the mapping carries the tenant row filter of the Factory profile and the mapping test runs against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6112,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-3971]",
      "number": 3971
    },
    {
      "id": "AIFACTORY-TASK-3972",
      "type": "task",
      "parent": "AIFACTORY-US-986",
      "title": "RecordEvidenceReference handler of the audit evidence event",
      "sequence": "04.01.12.02",
      "description": "RecordEvidenceReference handler of the audit evidence event. Expected output: The handler of the command RecordEvidenceReference receives AuditEvidenceSubmitted from audit.evidence.v1.evidence-submitted through the subscription of AIFACTORY-TASK-058, reads the audit-evidence-v1 record of the envelope under the tenant of the record and writes one row of ArtifactReferences of the kind audit-evidence, with the evidenceId as ReferenceRef, when subject.id is the artifactId of an artifact of that tenant and the subject kind is listed in one mapping that a contract test of the event pins; it matches no hash, acknowledges every other record without effect, is idempotent on the evidence id and on the unique index of the table, writes no event and puts no subject identifier, reason text or content into telemetry; which subject kinds name an artifact and whether a hash is to be matched are reported to the owner.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The handler of the command RecordEvidenceReference receives AuditEvidenceSubmitted from audit.evidence.v1.evidence-submitted through the subscription of AIFACTORY-TASK-058, reads the audit-evidence-v1 record of the envelope under the tenant of the record and writes one row of ArtifactReferences of the kind audit-evidence, with the evidenceId as ReferenceRef, when subject.id is the artifactId of an artifact of that tenant and the subject kind is listed in one mapping that a contract test of the event pins; it matches no hash, acknowledges every other record without effect, is idempotent on the evidence id and on the unique index of the table, writes no event and puts no subject identifier, reason text or content into telemetry; which subject kinds name an artifact and whether a hash is to be matched are reported to the owner."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6112,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3972]",
      "number": 3972
    },
    {
      "id": "AIFACTORY-TASK-3973",
      "type": "task",
      "parent": "AIFACTORY-US-986",
      "title": "Run reference record in the store transaction and the RecordRunEnd inbox handler of the three run end events",
      "sequence": "04.01.12.03",
      "description": "Run reference record in the store transaction and the RecordRunEnd inbox handler of the three run end events. Expected output: A participant of the transaction of Artifacts.Store writes one row of ArtifactReferences of the kind run for a new artifact whose metadata names a producer run, with the producerRunId as ReferenceRef and an empty RunEndedAt, so the record commits or rolls back with the artifact and an idempotent repeat writes none; the handler RecordRunEnd of RunCompleted, RunFailed and RunCancelled of RunControlService sets RunEndedAt, the time the envelope of the event states, on every record of the kind run of that run and tenant that carries none, idempotently on the event id, acknowledges an event for a run without records without effect and writes no event; RunCompleted is delivered to SealRunArtifacts and to RecordRunEnd, each deduplicated on its own; a store that names a run whose end was already announced writes a record without RunEndedAt, which is reported to the owner with the question of which other runs reference an artifact.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "A participant of the transaction of Artifacts.Store writes one row of ArtifactReferences of the kind run for a new artifact whose metadata names a producer run, with the producerRunId as ReferenceRef and an empty RunEndedAt, so the record commits or rolls back with the artifact and an idempotent repeat writes none; the handler RecordRunEnd of RunCompleted, RunFailed and RunCancelled of RunControlService sets RunEndedAt, the time the envelope of the event states, on every record of the kind run of that run and tenant that carries none, idempotently on the event id, acknowledges an event for a run without records without effect and writes no event; RunCompleted is delivered to SealRunArtifacts and to RecordRunEnd, each deduplicated on its own; a store that names a run whose end was already announced writes a record without RunEndedAt, which is reported to the owner with the question of which other runs reference an artifact."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6112,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3973]",
      "number": 3973
    },
    {
      "id": "AIFACTORY-TASK-3974",
      "type": "task",
      "parent": "AIFACTORY-US-986",
      "title": "Fixture publishers of audit evidence records and of the three run end events",
      "sequence": "04.01.12.04",
      "description": "Fixture publishers of audit evidence records and of the three run end events. Expected output: The acceptance suite holds a fixture publisher of AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, built from the pinned contracts package, for records whose subject names an artifact of the tenant, an artifact of another tenant, no artifact and a subject kind outside the pinned mapping, fixture publishers of RunCompleted, RunFailed and RunCancelled of RunControlService for runs with and without stored artifacts, each delivered once and twice, the builders of store streams of AIFACTORY-TASK-3158 with and without a producer run, a switch that fails the transaction of a handler once, and a reader of the rows of ArtifactReferences per tenant; the fixture also serves the sweep suite of AIFACTORY-US-789.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fixture publisher of AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, built from the pinned contracts package, for records whose subject names an artifact of the tenant, an artifact of another tenant, no artifact and a subject kind outside the pinned mapping, fixture publishers of RunCompleted, RunFailed and RunCancelled of RunControlService for runs with and without stored artifacts, each delivered once and twice, the builders of store streams of AIFACTORY-TASK-3158 with and without a producer run, a switch that fails the transaction of a handler once, and a reader of the rows of ArtifactReferences per tenant; the fixture also serves the sweep suite of AIFACTORY-US-789."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6112,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3974]",
      "number": 3974
    },
    {
      "id": "AIFACTORY-TASK-3975",
      "type": "task",
      "parent": "AIFACTORY-US-986",
      "title": "Verify the reference records of audit evidence and of runs through the acceptance suite",
      "sequence": "04.01.12.05",
      "description": "Verify the reference records of audit evidence and of runs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReferenceRecords\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-986: one record per evidence id and artifact with its redelivery, the evidence records that name no artifact of the tenant or a subject kind outside the pinned mapping, the run record written and rolled back with a store and absent for a repeat and for a store without a producer run, RunEndedAt set by each of the three run end events on the records of its run only, the redelivered and the unmatched run end event, RunCompleted handled once by each of its two handlers, the two tenants kept apart, the retried handler applied once, the refused duplicate of UX_ArtifactReferences_Artifact_Reference and the scan of telemetry, against model/services/knowledge/ArtifactService.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReferenceRecords\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-986: one record per evidence id and artifact with its redelivery, the evidence records that name no artifact of the tenant or a subject kind outside the pinned mapping, the run record written and rolled back with a store and absent for a repeat and for a store without a producer run, RunEndedAt set by each of the three run end events on the records of its run only, the redelivered and the unmatched run end event, RunCompleted handled once by each of its two handlers, the two tenants kept apart, the retried handler applied once, the refused duplicate of UX_ArtifactReferences_Artifact_Reference and the scan of telemetry, against model/services/knowledge/ArtifactService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 61,
      "phase": "factory",
      "stackRank": 6112,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3975]",
      "number": 3975
    },
    {
      "id": "AIFACTORY-FEAT-018",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "ContextBuilderService: thin delivery for the first outcome",
      "sequence": "04.02",
      "description": "ContextBuilderService is the service of bounded context BC-09 (Context Assembly). The context engineering plane — plans what a task needs (mandatory instructions, task, conversation state, repository state, knowledge, graph neighbours, episodic memory, diff, tool results), retrieves and expands candidates, ranks, deduplicates, compresses and budgets tokens, and records an immutable context snapshot that says what was used and why (BC-09). In this increment it is delivered thin: Passes the pinned artifacts of a step through as its context package; no budget, ranking or provenance. Its own repository is ConnectSoft.AI.SoftwareFactory.ContextBuilderService. Delivers: ContextBuilderService (thin: Passes the pinned artifacts of a step through as its context package; no budget, ranking or provenance.). Increment I1: Generate a microservice. Build order 62 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-060",
        "AIFACTORY-US-793",
        "AIFACTORY-US-794"
      ],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6200,
      "titlePrefix": "[AIFACTORY-FEAT-018]",
      "number": 18
    },
    {
      "id": "AIFACTORY-US-060",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-018",
      "title": "ContextBuilderService answers the chain with its thin contract",
      "sequence": "04.02.01",
      "description": "As a requester, I want ContextBuilderService to hand an attempt of my run the pinned artifacts of its step as a well-formed context package, so that an agent starts with exactly the inputs its step pins, and the Context Assembly context has one owner behind a contract that does not change later. This is the integration PBI of the thin delivery. ContextBuilderService is the context engineering plane of bounded context BC-09: in its complete form it plans what a task needs, retrieves and expands candidates, ranks, deduplicates, compresses and budgets them and records an immutable context snapshot that says what was used and why. In this increment it is delivered thin, and the thin scope is exactly this: the service passes the pinned artifacts of a step through as its context package, with no budget, no ranking and no provenance. It has one caller, AgentRuntimeService, the only inbound gRPC caller the model lists, which asks `ContextAssembly.Assemble` when an attempt builds its context. The service hosts that one internal gRPC method (AIFACTORY-US-794) on the repository and the surface of AIFACTORY-US-793. Nothing else is served. No plan is made, nothing is retrieved from VectorMemoryService, no promoted memory and no repository state is read, and nothing is compressed, counted against a token budget, ranked, deduplicated or dropped. No `ContextSnapshot` is recorded: the aggregate is the record of provenance and budget, and its invariant never includes an item without provenance, which is exactly what the thin scope leaves out. So `ContextAssembled` is not published, the two REST reads `ListContextSnapshots` and `GetContextSnapshot` are not hosted, the tables `ContextSnapshots` and `ContextItems` are not created and none of the eleven consumed events is subscribed. All of that arrives with feature `context-builder-service-complete` in I5. The thin service calls no dependency. The pinned artifacts stay in ArtifactService, where the runtime reads each by its reference under its own workload token and where the tenant boundary of that read is enforced; no content passes through this service, so it takes no classification or redaction decision and stores nothing by hash. What this PBI proves beyond the suites of the two other PBIs is that hand-over on deployed instances: a task contract and its input documents are stored in the deployed ArtifactService (feature `artifact-service`), the Assemble request is built from the inputs of the stored contract, and every reference the package returns is fetched from ArtifactService with the hash its store reply stated; the service itself still calls no dependency, the suite does. The repository is scaffolded from the pinned base template package with `UseFactoryProfile`, so token validation, the scope chain, health, readiness and the telemetry wiring come from the profile and are not written again. The contract has two open points, which are reported to the owner, and the thin delivery makes it checkable without deciding them. The model names `context-snapshot-v1` as the request and as the reply descriptor of the method, and model/descriptors.yaml lists no descriptor of that id: it lists `context-package-v1`, described by docs/reference/schemas/context-snapshot.schema.json. And that schema requires `snapshotId`, `budget` and, for every item, `sourceRevision`, `chunkId`, `tokens` and `rank`, which is what the thin scope excludes, and it allows no additional property. The proto therefore fixes two messages by golden files. The request message names the run, the attempt, the step and the pinned artifacts of the step as the task contract lists them under `inputs`, each with name, descriptor and reference; the model defines no request shape, so this one is fixed here. The reply message carries `runId`, `attemptId`, the trusted scope, one item per pinned artifact in the order of the request and a `hash` over the package; the members of the snapshot, of the budget and of ranking and provenance exist in the message and are unset in the thin delivery, and the contract test asserts which members are set and which are not. The complete delivery fills the same reply message, so it replaces the thin delivery without a change of the two messages. A caller without a workload identity is refused before any handler runs. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService. Kind: behavior. Traces: services: ContextBuilderService, ArtifactService; apis: ContextBuilderService/ContextAssembly.Assemble, ArtifactService/Artifacts.Store, ArtifactService/Artifacts.Fetch; descriptors: context-package-v1, agent-task-contract-v1; adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-793, AIFACTORY-US-794, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:artifact-service. Sources: model/services/knowledge/ContextBuilderService.yaml, model/services/knowledge/ArtifactService.yaml, model/backlog/features/knowledge.yaml, model/descriptors.yaml, docs/reference/schemas/context-snapshot.schema.json, docs/reference/schemas/agent-task-contract.schema.json, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ContextBuilderService scaffolded with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ContextBuilderService --UseFactoryProfile true` from the pinned template package, when its pipeline runs, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/knowledge/ContextBuilderService.yaml).",
        "AC2: Given the published images of the thin service and of ArtifactService deployed in the acceptance environment, and an `agent-task-contract-v1` document and the documents its `inputs` name stored through `ArtifactService/Artifacts.Store` under one tenant and project, when an Assemble request built from the inputs of that stored task contract is sent to `ContextBuilderService/ContextAssembly.Assemble` on the deployed instance with a workload token of the identity authority of that environment, then the reply is the context package of exactly those inputs in the order of the request, and each reference the package returns is fetched through `ArtifactService/Artifacts.Fetch` from the deployed ArtifactService with the bytes and the hash its store reply stated, while a workload that forwards another tenant is answered NOT_FOUND for the same reference.",
        "AC3: Given the service descriptor of the thin delivery, when the contract test compares it with the hosted surface, then exactly `ContextBuilderService/ContextAssembly.Assemble` is hosted, no REST operation answers, the `OrleansMessaging` section declares no published event and no subscription, no table of model/services/knowledge/ContextBuilderService.yaml exists in `context-builder-sql`, and the test fails when an operation outside the thin scope appears.",
        "AC4: Given a call without a workload identity or with a token that lacks the service scope, when it reaches `ContextBuilderService/ContextAssembly.Assemble`, then it is refused before any handler runs and nothing is read (ADR-0015); given the service starts, when liveness and readiness are probed, then liveness answers and readiness is unready until the store is migrated, the silo has started and the identity authority is reachable."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/backlog/features/knowledge.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/context-snapshot.schema.json",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-063",
        "AIFACTORY-TASK-761"
      ],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6201,
      "kind": "behavior",
      "traces": {
        "services": [
          "ContextBuilderService",
          "ArtifactService"
        ],
        "apis": [
          "ContextBuilderService/ContextAssembly.Assemble",
          "ArtifactService/Artifacts.Store",
          "ArtifactService/Artifacts.Fetch"
        ],
        "descriptors": [
          "context-package-v1",
          "agent-task-contract-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-793",
        "AIFACTORY-US-794",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/backlog/features/knowledge.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/context-snapshot.schema.json",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-060]",
      "number": 60
    },
    {
      "id": "AIFACTORY-TASK-063",
      "type": "task",
      "parent": "AIFACTORY-US-060",
      "title": "Contract of the thin surface: service descriptor and proto of ContextAssembly.Assemble with golden request and reply messages",
      "sequence": "04.02.01.01",
      "description": "Contract of the thin surface: service descriptor and proto of ContextAssembly.Assemble with golden request and reply messages. Expected output: The service descriptor file of the repository lists exactly ContextAssembly.Assemble, internal, without streaming and of class read. The proto fixes the request message (run, attempt, step, the optional token limit and the pinned artifacts of the step, each with name, descriptor and reference, as agent-task-contract-v1 lists them under inputs) and the reply message (runId, attemptId, the scope, one item per pinned artifact in request order and the hash of the package, with the members of the snapshot, of the budget and of ranking and provenance present in the message and unset). A contract test with golden files asserts the set and the unset members and compares the names of the set members with docs/reference/schemas/context-snapshot.schema.json; it does not validate a thin reply against the whole schema, which requires the members the thin scope excludes, and that difference is the open point the PBI reports. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so the caller runs against this service without a fake and the complete delivery fills the same messages.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file of the repository lists exactly ContextAssembly.Assemble, internal, without streaming and of class read. The proto fixes the request message (run, attempt, step, the optional token limit and the pinned artifacts of the step, each with name, descriptor and reference, as agent-task-contract-v1 lists them under inputs) and the reply message (runId, attemptId, the scope, one item per pinned artifact in request order and the hash of the package, with the members of the snapshot, of the budget and of ranking and provenance present in the message and unset). A contract test with golden files asserts the set and the unset members and compares the names of the set members with docs/reference/schemas/context-snapshot.schema.json; it does not validate a thin reply against the whole schema, which requires the members the thin scope excludes, and that difference is the open point the PBI reports. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so the caller runs against this service without a fake and the complete delivery fills the same messages."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6201,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-063]",
      "number": 63
    },
    {
      "id": "AIFACTORY-TASK-761",
      "type": "task",
      "parent": "AIFACTORY-US-060",
      "title": "Verify context-builder-service-thin-contract by running the declared command",
      "sequence": "04.02.01.02",
      "description": "Verify context-builder-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinContextHandOver\"` against the instances of ContextBuilderService and ArtifactService deployed in the acceptance environment, where the suite stores an agent-task-contract-v1 document and its input documents through Artifacts.Store, builds the Assemble request from the inputs of the stored task contract, calls ContextAssembly.Assemble over the network with a workload token of the identity authority of that environment and fetches every returned reference through Artifacts.Fetch with the hash its store reply stated; a run that discovers no test and a zero-match filter count as failures; the runs pass and prove AC1 to AC4 of AIFACTORY-US-060, that is the scaffold and the published image, the pass-through package of SCN-ContextBuilderService-003 handed over on the deployed instances, the thin surface with no REST operation, no event, no subscription and no table of the model, the golden files of the request and reply messages, readiness and the refusal of a caller without workload identity.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinContextHandOver\"` against the instances of ContextBuilderService and ArtifactService deployed in the acceptance environment, where the suite stores an agent-task-contract-v1 document and its input documents through Artifacts.Store, builds the Assemble request from the inputs of the stored task contract, calls ContextAssembly.Assemble over the network with a workload token of the identity authority of that environment and fetches every returned reference through Artifacts.Fetch with the hash its store reply stated; a run that discovers no test and a zero-match filter count as failures; the runs pass and prove AC1 to AC4 of AIFACTORY-US-060, that is the scaffold and the published image, the pass-through package of SCN-ContextBuilderService-003 handed over on the deployed instances, the thin surface with no REST operation, no event, no subscription and no table of the model, the golden files of the request and reply messages, readiness and the refusal of a caller without workload identity."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-761]",
      "number": 761
    },
    {
      "id": "AIFACTORY-US-793",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-018",
      "title": "ContextBuilderService repository: scaffolded from the base template with the Factory profile, hosting one gRPC method and nothing else of the model",
      "sequence": "04.02.02",
      "description": "ContextBuilderService has its own repository, ConnectSoft.AI.SoftwareFactory.ContextBuilderService, its own deployable and its own store (ADR-0028). The repository is created and scaffolded in I0 by AIFACTORY-TASK-061 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ContextBuilderService --UseFactoryProfile true`, generated from the template package at the version the gate of feature `component-base-template-factory-profile` published, with the messaging service name `context-builder`, the default of `OrleansMessaging:ServiceName` in the model. On that scaffold the thin delivery adds one thing and leaves out the rest on purpose. The service descriptor file lists exactly one operation, the internal gRPC method `ContextAssembly.Assemble`, without streaming and of class read, behind the workload policy of the service scope that names ContextBuilderService; the contract test of the profile compares the hosted endpoints with that file in both directions, so neither REST read of the model answers. The store `context-builder-sql` holds only what the scaffold of the profile creates for the messaging profile; the tables `ContextSnapshots` and `ContextItems` are created by the complete delivery, and the cache the model lists for built packages is not used, because the thin package is computed from its request alone. The `OrleansMessaging` section declares no published event and no subscription, so `ContextAssembled` is never written and no event of VectorMemoryService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService, AuditService or RetentionResidencyService reaches a handler. The options `DefaultBudgetTokens`, `PackageTtlSeconds`, `SectionBudgets` and `CompressionProfile` of the section `Knowledge:Context` are not bound, because the thin delivery has no budget, no cache, no section and no compression; `OrleansMessaging:ServiceName` is bound. The one secret of the model, `messaging-transport`, reaches the service as a secret reference of the key vault, and the service is unready while it cannot be resolved. Telemetry is the wiring of the profile with two of the four instruments of the model: `connectsoft.factory.context.assemblies` counts each returned package by tenant and by the status Assembled, and `connectsoft.factory.context.assembly_latency` records its duration, both created through the instrument helper with tenant and project by default. `connectsoft.factory.context.tokens_used` and `connectsoft.factory.context.dropped_items` are not created, because the thin delivery counts no token and drops no item, and a series of zeros would read as a budget that was kept. Activities and log records carry tenant and project and the run, the step and the attempt of the request, and no content, which the service never holds (ADR-0019). Readiness is unready until the store is migrated, the silo has started and the identity authority is reachable. Kind: enabling. Traces: services: ContextBuilderService; apis: ContextBuilderService/ContextAssembly.Assemble; adrs: ADR-0019, ADR-0028. Depends on: feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:repository-and-pipeline-conventions, feature:component-observability-factory-conventions. Sources: model/services/knowledge/ContextBuilderService.yaml, model/backlog/features/knowledge.yaml, docs/planes/knowledge-memory/services/context-builder-service/index.md#apis, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-061 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ContextBuilderService --UseFactoryProfile true` from the template package at its published version with the messaging service name `context-builder`, when the pipeline of the repository runs with the work of this feature, then the solution builds, the generated tests pass with complete reports and a container image is published (ADR-0028).",
        "AC2: Given the service descriptor file and the hosted surface, when the contract test of the profile runs, then exactly `ContextBuilderService/ContextAssembly.Assemble` is hosted as an internal gRPC method of class read behind the workload policy, a call to the route of either REST read of model/services/knowledge/ContextBuilderService.yaml finds no endpoint, and the test fails on an endpoint the file does not name.",
        "AC3: Given the migrated `context-builder-sql` and the configuration of the service, when they are inspected, then neither `ContextSnapshots` nor `ContextItems` exists, the `OrleansMessaging` section declares no published event and no subscription, the outbox holds no record after any call, and no option of `Knowledge:Context` is bound (model/backlog/features/knowledge.yaml).",
        "AC4: Given a start without a resolvable secret reference for `messaging-transport`, when readiness is probed, then the service is unready and names the reference; and given handled calls, when the collected telemetry is read, then `connectsoft.factory.context.assemblies` and `connectsoft.factory.context.assembly_latency` carry tenant and project, the instruments of token use and of dropped items do not exist, and every activity and log record carries run, step and attempt and no content (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/context-builder-service/index.md#apis",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-3184",
        "AIFACTORY-TASK-3185"
      ],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6202,
      "kind": "enabling",
      "traces": {
        "services": [
          "ContextBuilderService"
        ],
        "apis": [
          "ContextBuilderService/ContextAssembly.Assemble"
        ],
        "adrs": [
          "ADR-0019",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:repository-and-pipeline-conventions",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/context-builder-service/index.md#apis",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-793]",
      "number": 793
    },
    {
      "id": "AIFACTORY-TASK-3184",
      "type": "task",
      "parent": "AIFACTORY-US-793",
      "title": "Thin host of ContextBuilderService with one gRPC method, no messaging declaration and two of the four instruments",
      "sequence": "04.02.02.01",
      "description": "Thin host of ContextBuilderService with one gRPC method, no messaging declaration and two of the four instruments. Expected output: The host maps ContextAssembly.Assemble behind the workload policy of the service scope and no REST route; the OrleansMessaging section holds the service name context-builder and declares no published event and no subscription; the migrations create no table of model/services/knowledge/ContextBuilderService.yaml and the cache is not configured; the options of Knowledge:Context are not bound; messaging-transport is read as a secret reference and a missing reference keeps the service unready; the enrichment registration of the pinned observability libraries is called once; connectsoft.factory.context.assemblies and connectsoft.factory.context.assembly_latency are created through the instrument helper, and the instruments of token use and of dropped items are not created.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "The host maps ContextAssembly.Assemble behind the workload policy of the service scope and no REST route; the OrleansMessaging section holds the service name context-builder and declares no published event and no subscription; the migrations create no table of model/services/knowledge/ContextBuilderService.yaml and the cache is not configured; the options of Knowledge:Context are not bound; messaging-transport is read as a secret reference and a missing reference keeps the service unready; the enrichment registration of the pinned observability libraries is called once; connectsoft.factory.context.assemblies and connectsoft.factory.context.assembly_latency are created through the instrument helper, and the instruments of token use and of dropped items are not created."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3184]",
      "number": 3184
    },
    {
      "id": "AIFACTORY-TASK-3185",
      "type": "task",
      "parent": "AIFACTORY-US-793",
      "title": "Verify the repository and the thin surface of ContextBuilderService",
      "sequence": "04.02.02.02",
      "description": "Verify the repository and the thin surface of ContextBuilderService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-793: the unchanged scaffold, the surface compared with the service descriptor in both directions, the absent tables, subscriptions and options of model/services/knowledge/ContextBuilderService.yaml, the empty outbox, the unready start without the secret reference, and the two instruments with tenant and project beside the two that do not exist.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-793: the unchanged scaffold, the surface compared with the service descriptor in both directions, the absent tables, subscriptions and options of model/services/knowledge/ContextBuilderService.yaml, the empty outbox, the unready start without the secret reference, and the two instruments with tenant and project beside the two that do not exist."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3185]",
      "number": 3185
    },
    {
      "id": "AIFACTORY-US-794",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-018",
      "title": "Return the pinned artifacts of a step as the context package of an attempt, unchanged and in order",
      "sequence": "04.02.03",
      "description": "As a requester, I want the attempt of a step to receive exactly the artifacts the step pins, in their order and by reference, so that the first workflows run on their declared inputs before retrieval, ranking and budgets exist, and nothing reaches the agent that the step did not pin. When an attempt builds its context, AgentRuntimeService asks ContextBuilderService for it through the internal gRPC method `ContextAssembly.Assemble`, without streaming and of class read. The runtime presents a workload token; such a token carries service scopes and no tenant claim, so the service reads the tenant and the project the runtime forwards only when the token holds the service scope that names ContextBuilderService (ADR-0015). The request names the run, the attempt, the step and the pinned artifacts of the step: the entries the task contract of the step (`agent-task-contract-v1`) lists under `inputs`, each with its name, its descriptor and its reference. The runtime may state the token limit of the attempt, which it takes from `Runtime:Context:MaxContextTokens`; the thin delivery applies no budget, so the value is accepted and ignored and nothing is cut. The reply is the context package: `runId`, `attemptId`, the trusted scope, one item per pinned artifact in the order of the request with name, descriptor and reference unchanged, and a `hash` over these members. Nothing is added, dropped, reordered, ranked, compressed or read. A step without pinned artifacts receives an empty package, which is no error. The service does not fetch the artifacts and does not check that a reference exists or belongs to the tenant: the runtime reads each from ArtifactService by its reference, and ArtifactService answers NOT_FOUND for an unknown reference and for one of another tenant alike, so the tenant boundary is enforced where the content is. The method writes nothing: no `ContextSnapshot` is recorded, no content is stored and no event is published, and the reply names no snapshot. The same request receives the same package with the same hash, so a runtime that lost the answer asks again and nothing changes. A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, and a request without a run, without an attempt or with an entry that has no reference with INVALID_ARGUMENT; because nothing is addressed by identifier in this service, the thin method has no not-found answer. It reads no store and calls no dependency, so no outage of another service can fail it. When the service itself does not answer, the runtime, for which the dependency is of the degrade kind, retries within the budget of the attempt and ends the attempt Failed with the failure class transient when that budget is exhausted, as its own PBI states. `connectsoft.factory.context.assemblies` counts the package with the status Assembled, and the activity of the call carries run, step and attempt, the number of items and the hash of the package and never the content of an artifact (ADR-0019). Kind: behavior. Traces: services: ContextBuilderService; apis: ContextBuilderService/ContextAssembly.Assemble; descriptors: context-package-v1, agent-task-contract-v1; adrs: ADR-0015, ADR-0019; scenarios: SCN-ContextBuilderService-003. Depends on: AIFACTORY-US-793, feature:component-base-template-factory-profile. Sources: model/services/knowledge/ContextBuilderService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/reference/schemas/agent-task-contract.schema.json, docs/reference/schemas/context-snapshot.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope and forwards the tenant and the project of a run, and a request that names the run, the attempt, the step and three pinned artifacts with name, descriptor and reference, when `ContextBuilderService/ContextAssembly.Assemble` is called, then the reply carries `runId`, `attemptId`, the trusted scope, exactly three items in the order of the request with name, descriptor and reference unchanged and a `hash` over them, and nothing is written or published (SCN-ContextBuilderService-003).",
        "AC2: Given a request with a token limit far below the size of its pinned artifacts, a request without pinned artifacts and the same request sent twice, when `ContextBuilderService/ContextAssembly.Assemble` is called, then every pinned artifact is returned and none is cut, the empty request receives an empty package, the two replies carry the same `hash`, and no member of the snapshot, of the budget, of ranking or of provenance is set, as the thin scope of model/backlog/features/knowledge.yaml states (SCN-ContextBuilderService-003).",
        "AC3: Given a caller without a workload identity, a token without the service scope, or a request without a run, without an attempt or with an entry that has no reference, when `ContextBuilderService/ContextAssembly.Assemble` is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT respectively and no package is returned (SCN-ContextBuilderService-003, ADR-0015).",
        "AC4: Given the calls of the acceptance run, when the store, the outbox, the recording fakes of the dependencies of model/services/knowledge/ContextBuilderService.yaml and the collected telemetry are inspected, then no row and no outbox record was written, no dependency received a call, `connectsoft.factory.context.assemblies` rose once per returned package with the status Assembled, and no activity or log record holds content of an artifact (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/reference/schemas/context-snapshot.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-062",
        "AIFACTORY-TASK-3186",
        "AIFACTORY-TASK-3187"
      ],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6203,
      "kind": "behavior",
      "traces": {
        "services": [
          "ContextBuilderService"
        ],
        "apis": [
          "ContextBuilderService/ContextAssembly.Assemble"
        ],
        "descriptors": [
          "context-package-v1",
          "agent-task-contract-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "scenarios": [
          "SCN-ContextBuilderService-003"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-793",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/reference/schemas/agent-task-contract.schema.json",
        "docs/reference/schemas/context-snapshot.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-794]",
      "number": 794
    },
    {
      "id": "AIFACTORY-TASK-062",
      "type": "task",
      "parent": "AIFACTORY-US-794",
      "title": "Implement the thin scope of ContextBuilderService for the first outcome",
      "sequence": "04.02.03.01",
      "description": "Implement the thin scope of ContextBuilderService for the first outcome. Expected output: ContextAssembly.Assemble takes the request message of AIFACTORY-TASK-063, reads the forwarded tenant and project only under the service scope, refuses a request without a run, without an attempt or with an entry that has no reference with INVALID_ARGUMENT, accepts and ignores a stated token limit, and returns the reply message with runId, attemptId, the trusted scope, one item per pinned artifact in request order with name, descriptor and reference unchanged and the hash of the package; it answers UNAUTHENTICATED and PERMISSION_DENIED as the PBI states, reads no store, calls no dependency, records no snapshot and writes no outbox record. It passes the pinned artifacts of a step through as its context package, with no budget, ranking or provenance; the contract matches the model, so the complete delivery replaces the thin one without a contract change.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ContextAssembly.Assemble takes the request message of AIFACTORY-TASK-063, reads the forwarded tenant and project only under the service scope, refuses a request without a run, without an attempt or with an entry that has no reference with INVALID_ARGUMENT, accepts and ignores a stated token limit, and returns the reply message with runId, attemptId, the trusted scope, one item per pinned artifact in request order with name, descriptor and reference unchanged and the hash of the package; it answers UNAUTHENTICATED and PERMISSION_DENIED as the PBI states, reads no store, calls no dependency, records no snapshot and writes no outbox record. It passes the pinned artifacts of a step through as its context package, with no budget, ranking or provenance; the contract matches the model, so the complete delivery replaces the thin one without a contract change."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-062]",
      "number": 62
    },
    {
      "id": "AIFACTORY-TASK-3186",
      "type": "task",
      "parent": "AIFACTORY-US-794",
      "title": "Assemble requests built from task contracts, workload tokens and recording fakes of the dependencies",
      "sequence": "04.02.03.02",
      "description": "Assemble requests built from task contracts, workload tokens and recording fakes of the dependencies. Expected output: The acceptance suite holds agent-task-contract-v1 documents valid against docs/reference/schemas/agent-task-contract.schema.json with three inputs, with one input and with none, builders that turn their inputs into Assemble requests with and without a token limit, requests without a run, without an attempt and with an entry that has no reference, workload tokens with and without the service scope naming ContextBuilderService, recording fakes of the six outbound dependencies of model/services/knowledge/ContextBuilderService.yaml that fail the test when called, and a collector of metrics, activities and log records.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "The acceptance suite holds agent-task-contract-v1 documents valid against docs/reference/schemas/agent-task-contract.schema.json with three inputs, with one input and with none, builders that turn their inputs into Assemble requests with and without a token limit, requests without a run, without an attempt and with an entry that has no reference, workload tokens with and without the service scope naming ContextBuilderService, recording fakes of the six outbound dependencies of model/services/knowledge/ContextBuilderService.yaml that fail the test when called, and a collector of metrics, activities and log records."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6203,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3186]",
      "number": 3186
    },
    {
      "id": "AIFACTORY-TASK-3187",
      "type": "task",
      "parent": "AIFACTORY-US-794",
      "title": "Verify assemble-the-pinned-artifacts-of-a-step-as-its-context-package through the acceptance suite",
      "sequence": "04.02.03.03",
      "description": "Verify assemble-the-pinned-artifacts-of-a-step-as-its-context-package through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ContextBuilderService-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-794: the package of three, of one and of no pinned artifact in request order, the ignored token limit, the equal hash of a repeated request, every refusal, the empty store and outbox, the dependencies that received no call and the telemetry scan.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ContextBuilderService-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-794: the package of three, of one and of no pinned artifact in request order, the ignored token limit, the equal hash of a repeated request, every refusal, the empty store and outbox, the dependencies that received no call and the telemetry scan."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 62,
      "phase": "factory",
      "stackRank": 6203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3187]",
      "number": 3187
    },
    {
      "id": "AIFACTORY-FEAT-019",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "KnowledgeIngestionService: thin delivery for the first outcome",
      "sequence": "04.03",
      "description": "KnowledgeIngestionService is the service of bounded context BC-10 (Sources & Ingestion). Owns knowledge sources and collections, immutable source snapshots, the ingestion pipeline (parse, normalize, metadata, chunk, publish to indexes with ACL propagation), incremental sync, staleness and deletion lineage; code, documentation, library and template sources are source types, not services (BC-10). In this increment it is delivered thin: No ingestion; the calls the retrieval path requires answer empty. Its own repository is ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService. Delivers: KnowledgeIngestionService (thin: No ingestion; the calls the retrieval path requires answer empty.). Increment I1: Generate a microservice. Build order 63 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-061",
        "AIFACTORY-US-791",
        "AIFACTORY-US-792"
      ],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6300,
      "titlePrefix": "[AIFACTORY-FEAT-019]",
      "number": 19
    },
    {
      "id": "AIFACTORY-US-061",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-019",
      "title": "KnowledgeIngestionService answers the chain with its thin contract",
      "sequence": "04.03.01",
      "description": "As a requester, I want KnowledgeIngestionService to answer the retrieval path of the first outcome with a well-formed, empty source scope, so that my run can call its knowledge tools before any source is ingested, and the Sources and Ingestion context has one owner behind a contract that does not change later. This is the integration PBI of the thin delivery. KnowledgeIngestionService owns the knowledge sources and collections, the immutable source snapshots and the ingestion pipeline of bounded context BC-10. In this increment nothing is ingested: no source is registered, no snapshot is taken, no chunk is published and nothing is embedded. The first outcome needs one thing of this service: the retrieval path must be able to ask which sources and collections a scope may retrieve from and receive a well-formed answer. That path starts at the tools `knowledge-search` and `graph-query`, which an agent calls through ToolAdapterService and which VectorMemoryService serves; VectorMemoryService and RepositoryIntelligenceService are the two services whose model lists a required, fail-fast gRPC dependency on this service for the source scope. The thin scope is therefore exactly this: the service hosts the one internal gRPC method `Ingestion.GetSourceScope` and answers it with an empty source scope (AIFACTORY-US-792), on the repository and the surface of AIFACTORY-US-791. Nothing else is served. The six REST operations of the model, `RegisterSource`, `ListSources`, `SyncSource`, `DeleteSource`, `GetSnapshot` and `SetCollection`, the six events of the two aggregates, the workers `SourceSyncScheduler`, `IngestionPipeline` and `DeletionPropagator`, the nine consumed events and the five tables arrive with feature `knowledge-ingestion-service-complete` in I5. Because no chunk is published, nothing is embedded in this increment; when the complete delivery embeds, it does so through `ModelGateway.Embed` of ModelRouterService with the model profile `embedding`, whose Draft release is seeded in I1 with the other profiles. The thin service calls no dependency: none of IntegrationService, SecretBrokerService, ArtifactService, PolicyEngineService and ProjectService is called, because no source exists whose content, credential, classification or scope would have to be resolved. The repository is scaffolded from the pinned base template package with `UseFactoryProfile`, so token validation, the scope chain with its 401, 403 and 404 answers, health, readiness and the telemetry wiring come from the profile and are not written again. The model names `execution-scope-v1` as the request and as the reply descriptor of the method. The proto request message carries the execution scope, and the reply message carries the same scope with a `sourceScope` that names no repository and no document collection; a contract test with golden files compares both messages with docs/reference/schemas/execution-scope.schema.json, so callers run against this service without a fake and the complete delivery fills the same reply without a change of the messages. Two points are reported to the owner. The summary of the method promises the ACL scopes of the sources, and the schema has no member for them and allows no additional property; an empty answer carries none, so the conflict waits for the complete delivery. And the Studio screen `knowledge-sources` of feature `studio-intelligence` in I3 names `RegisterSource` and `ListSources`, which the thin delivery does not serve and the complete delivery brings only in I5. A caller without a workload identity is refused before any handler runs. What this PBI proves beyond the suites of the two other PBIs is the call on a deployed instance: the typed client that VectorMemoryService builds from the golden proto calls the deployed thin service over the network with a workload token of the identity authority of the acceptance environment and receives the empty source scope. Feature `vector-memory-service-thin` depends on this feature and proves its own retrieval call against the same deployed service, so this feature does not depend on it in turn. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService. Kind: behavior. Traces: services: KnowledgeIngestionService; apis: KnowledgeIngestionService/Ingestion.GetSourceScope; descriptors: execution-scope-v1; adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-791, AIFACTORY-US-792, feature:component-base-template-factory-profile, feature:component-base-template-findings. Sources: model/services/knowledge/KnowledgeIngestionService.yaml, model/backlog/features/knowledge.yaml, docs/reference/schemas/execution-scope.schema.json, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService scaffolded with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService --UseFactoryProfile true` from the pinned template package, when its pipeline runs, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/knowledge/KnowledgeIngestionService.yaml).",
        "AC2: Given the published image of the thin service deployed in the acceptance environment and the typed client that VectorMemoryService builds from the golden proto of AIFACTORY-TASK-066, with a workload token that the identity authority of that environment issued with the service scope and that forwards a tenant and a project, when the client calls `KnowledgeIngestionService/Ingestion.GetSourceScope` on the deployed instance over the network, then the reply is the `execution-scope-v1` of the request, valid against docs/reference/schemas/execution-scope.schema.json, with a `sourceScope` whose repositories and document collections are present and empty, which is the answer the retrieval call of the thin VectorMemoryService needs to return an empty, well-formed result; that call against this deployed service is proven by feature `vector-memory-service-thin`, which depends on this one.",
        "AC3: Given the service descriptor of the thin delivery, when the contract test compares it with the hosted surface, then exactly `KnowledgeIngestionService/Ingestion.GetSourceScope` is hosted, no REST operation answers, the `OrleansMessaging` section declares no published event and no subscription, no worker is hosted, no table of model/services/knowledge/KnowledgeIngestionService.yaml exists in `knowledge-ingestion-sql`, and the test fails when an operation outside the thin scope appears.",
        "AC4: Given a call without a workload identity or with a token that lacks the service scope, when it reaches `KnowledgeIngestionService/Ingestion.GetSourceScope`, then it is refused before any handler runs and nothing is read (ADR-0015); given the service starts, when liveness and readiness are probed, then liveness answers and readiness is unready until the store is migrated, the silo has started and the identity authority is reachable."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-066",
        "AIFACTORY-TASK-763"
      ],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6301,
      "kind": "behavior",
      "traces": {
        "services": [
          "KnowledgeIngestionService"
        ],
        "apis": [
          "KnowledgeIngestionService/Ingestion.GetSourceScope"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-791",
        "AIFACTORY-US-792",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-061]",
      "number": 61
    },
    {
      "id": "AIFACTORY-TASK-066",
      "type": "task",
      "parent": "AIFACTORY-US-061",
      "title": "Contract of the thin surface: service descriptor and proto of Ingestion.GetSourceScope against execution-scope-v1",
      "sequence": "04.03.01.01",
      "description": "Contract of the thin surface: service descriptor and proto of Ingestion.GetSourceScope against execution-scope-v1. Expected output: The service descriptor file of the repository lists exactly Ingestion.GetSourceScope, internal, without streaming and of class read. The proto fixes the request message, which carries the execution scope, and the reply message, which carries the same scope with a sourceScope whose repositories and documentCollections are empty; a contract test with golden files compares both messages with docs/reference/schemas/execution-scope.schema.json, and the contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake and the complete delivery adds operations and fills the reply without changing the two messages.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file of the repository lists exactly Ingestion.GetSourceScope, internal, without streaming and of class read. The proto fixes the request message, which carries the execution scope, and the reply message, which carries the same scope with a sourceScope whose repositories and documentCollections are empty; a contract test with golden files compares both messages with docs/reference/schemas/execution-scope.schema.json, and the contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake and the complete delivery adds operations and fills the reply without changing the two messages."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6301,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-066]",
      "number": 66
    },
    {
      "id": "AIFACTORY-TASK-763",
      "type": "task",
      "parent": "AIFACTORY-US-061",
      "title": "Verify knowledge-ingestion-service-thin-contract by running the declared command",
      "sequence": "04.03.01.02",
      "description": "Verify knowledge-ingestion-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSourceScopeDeployed\"` against the instance deployed in the acceptance environment, where the typed client built from the golden proto of AIFACTORY-TASK-066 calls Ingestion.GetSourceScope over the network with a workload token of the identity authority of that environment; a run that discovers no test and a zero-match filter count as failures; the runs pass and prove AC1 to AC4 of AIFACTORY-US-061, that is the scaffold and the published image, the empty source scope of SCN-KnowledgeIngestionService-007 answered by the deployed instance to the client VectorMemoryService builds, the thin surface with no REST operation, no event, no worker and no table of the model, the golden files of the request and reply messages, readiness and the refusal of a caller without workload identity.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSourceScopeDeployed\"` against the instance deployed in the acceptance environment, where the typed client built from the golden proto of AIFACTORY-TASK-066 calls Ingestion.GetSourceScope over the network with a workload token of the identity authority of that environment; a run that discovers no test and a zero-match filter count as failures; the runs pass and prove AC1 to AC4 of AIFACTORY-US-061, that is the scaffold and the published image, the empty source scope of SCN-KnowledgeIngestionService-007 answered by the deployed instance to the client VectorMemoryService builds, the thin surface with no REST operation, no event, no worker and no table of the model, the golden files of the request and reply messages, readiness and the refusal of a caller without workload identity."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-763]",
      "number": 763
    },
    {
      "id": "AIFACTORY-US-791",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-019",
      "title": "KnowledgeIngestionService repository: scaffolded from the base template with the Factory profile, hosting one gRPC method and nothing else of the model",
      "sequence": "04.03.02",
      "description": "KnowledgeIngestionService has its own repository, ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService, its own deployable and its own store (ADR-0028). The repository is created and scaffolded in I0 by AIFACTORY-TASK-064 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService --UseFactoryProfile true`, generated from the template package at the version the gate of feature `component-base-template-factory-profile` published, with the messaging service name `knowledge-ingestion`, the default of `OrleansMessaging:ServiceName` in the model. On that scaffold the thin delivery adds one thing and leaves out the rest on purpose. The service descriptor file lists exactly one operation, the internal gRPC method `Ingestion.GetSourceScope`, without streaming and of class read, behind the workload policy of the service scope that names KnowledgeIngestionService; the contract test of the profile compares the hosted endpoints with that file in both directions, so no REST route of the model answers. The store `knowledge-ingestion-sql` holds only what the scaffold of the profile creates for the messaging profile; the tables `KnowledgeSources`, `Collections`, `SourceSnapshots`, `Documents` and `Chunks` are created by the complete delivery. The `OrleansMessaging` section declares no published event and no subscription, so nothing is written to the outbox and no event of another service reaches a handler, and no worker is hosted. The options `DefaultChunkTokens`, `StalenessHours` and `MaxSnapshotSizeMb` of the section `Knowledge:Ingestion` are not bound, because nothing reads them; `OrleansMessaging:ServiceName` is bound. The one secret of the model, `messaging-transport`, reaches the service as a secret reference of the key vault, and the service is unready while it cannot be resolved. Telemetry is the wiring of the profile: the activity and the log record of a handled call carry tenant and project, and run, step and attempt when the forwarded scope carries a run. The five instruments of the model, the source and snapshot counts, the stage duration, the pending deletions and the index lag, measure an ingestion that does not exist, so the thin delivery creates none of them and no series reports a zero that would read as a healthy pipeline. Readiness is unready until the store is migrated, the silo has started and the identity authority is reachable. Kind: enabling. Traces: services: KnowledgeIngestionService; apis: KnowledgeIngestionService/Ingestion.GetSourceScope; adrs: ADR-0019, ADR-0028. Depends on: feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:repository-and-pipeline-conventions, feature:component-observability-factory-conventions. Sources: model/services/knowledge/KnowledgeIngestionService.yaml, model/backlog/features/knowledge.yaml, docs/planes/knowledge-memory/services/knowledge-ingestion-service/index.md#apis, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-064 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService --UseFactoryProfile true` from the template package at its published version with the messaging service name `knowledge-ingestion`, when the pipeline of the repository runs with the work of this feature, then the solution builds, the generated tests pass with complete reports and a container image is published (ADR-0028).",
        "AC2: Given the service descriptor file and the hosted surface, when the contract test of the profile runs, then exactly `KnowledgeIngestionService/Ingestion.GetSourceScope` is hosted as an internal gRPC method of class read behind the workload policy, a call to the route of any REST operation of model/services/knowledge/KnowledgeIngestionService.yaml finds no endpoint, and the test fails on an endpoint the file does not name.",
        "AC3: Given the migrated `knowledge-ingestion-sql` and the configuration of the service, when they are inspected, then none of the tables `KnowledgeSources`, `Collections`, `SourceSnapshots`, `Documents` and `Chunks` exists, the `OrleansMessaging` section declares no published event and no subscription, no worker is hosted and no option of `Knowledge:Ingestion` is bound (model/backlog/features/knowledge.yaml).",
        "AC4: Given a start without a resolvable secret reference for `messaging-transport`, when readiness is probed, then the service is unready and names the reference; and given a handled call, when the collected telemetry is read, then its activity and its log record carry tenant and project and none of the five instruments of model/services/knowledge/KnowledgeIngestionService.yaml exists (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/knowledge-ingestion-service/index.md#apis",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-3180",
        "AIFACTORY-TASK-3181"
      ],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6302,
      "kind": "enabling",
      "traces": {
        "services": [
          "KnowledgeIngestionService"
        ],
        "apis": [
          "KnowledgeIngestionService/Ingestion.GetSourceScope"
        ],
        "adrs": [
          "ADR-0019",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:repository-and-pipeline-conventions",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/knowledge-ingestion-service/index.md#apis",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-791]",
      "number": 791
    },
    {
      "id": "AIFACTORY-TASK-3180",
      "type": "task",
      "parent": "AIFACTORY-US-791",
      "title": "Thin host of KnowledgeIngestionService with one gRPC method, no messaging declaration, no worker and no ingestion instrument",
      "sequence": "04.03.02.01",
      "description": "Thin host of KnowledgeIngestionService with one gRPC method, no messaging declaration, no worker and no ingestion instrument. Expected output: The host maps Ingestion.GetSourceScope behind the workload policy of the service scope and no REST route; the OrleansMessaging section holds the service name knowledge-ingestion and declares no published event and no subscription; no worker is registered; the migrations create no table of model/services/knowledge/KnowledgeIngestionService.yaml; the options of Knowledge:Ingestion are not bound; messaging-transport is read as a secret reference and a missing reference keeps the service unready; the enrichment registration of the pinned observability libraries is called once and none of the five instruments of the model is created.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "The host maps Ingestion.GetSourceScope behind the workload policy of the service scope and no REST route; the OrleansMessaging section holds the service name knowledge-ingestion and declares no published event and no subscription; no worker is registered; the migrations create no table of model/services/knowledge/KnowledgeIngestionService.yaml; the options of Knowledge:Ingestion are not bound; messaging-transport is read as a secret reference and a missing reference keeps the service unready; the enrichment registration of the pinned observability libraries is called once and none of the five instruments of the model is created."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3180]",
      "number": 3180
    },
    {
      "id": "AIFACTORY-TASK-3181",
      "type": "task",
      "parent": "AIFACTORY-US-791",
      "title": "Verify the repository and the thin surface of KnowledgeIngestionService",
      "sequence": "04.03.02.02",
      "description": "Verify the repository and the thin surface of KnowledgeIngestionService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-791: the unchanged scaffold, the surface compared with the service descriptor in both directions, the absent tables, subscriptions, workers and instruments of model/services/knowledge/KnowledgeIngestionService.yaml, the unready start without the secret reference and the tenant and project on the activity and the log record of a call.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-791: the unchanged scaffold, the surface compared with the service descriptor in both directions, the absent tables, subscriptions, workers and instruments of model/services/knowledge/KnowledgeIngestionService.yaml, the unready start without the secret reference and the tenant and project on the activity and the log record of a call."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3181]",
      "number": 3181
    },
    {
      "id": "AIFACTORY-US-792",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-019",
      "title": "Answer the retrieval path with a well-formed, empty source scope for any scope of the tenant of the caller",
      "sequence": "04.03.03",
      "description": "As a requester, I want a knowledge search of my run to learn that no source is registered yet, as an empty answer and not as a failure, so that an agent continues with what it has and never mistakes an empty knowledge base for a broken one. The retrieval path asks this service which sources and collections a scope may retrieve from. The callers the model lists are VectorMemoryService, for the source scope and the ACL of a caller, and RepositoryIntelligenceService, for the source scope of a snapshot; each calls the internal gRPC method `Ingestion.GetSourceScope`, without streaming and of class read, with a workload token. Such a token carries service scopes and no tenant claim, so the service reads the tenant and the project the caller forwards only when the token holds the service scope that names KnowledgeIngestionService (ADR-0015). The request is an `execution-scope-v1`: tenant, project, caller, caller kind and policy context. The tenant and the project of the answer are those of the trusted scope: a request whose body names another tenant or project than the forwarded scope is refused with INVALID_ARGUMENT, so no caller can ask for the sources of another tenant, and because the thin delivery addresses nothing by identifier it has no not-found answer. The reply is the `execution-scope-v1` of the request with a `sourceScope` whose `repositories` and `documentCollections` are present and empty. That is the honest answer of this increment: no source is registered and no collection is defined, so a scope may retrieve from nothing. It is never an error and never an absent member, so that VectorMemoryService returns an empty, well-formed search result instead of failing the tool call, and an agent learns that nothing was found, not that knowledge is broken (XL-07). The member `toolIds` of `sourceScope` is no statement of this service and is returned as the request carried it. The method writes nothing and publishes nothing, and the same request receives the same reply. A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, and a request that lacks a member the schema requires, tenant, project, caller, caller kind or policy context, with INVALID_ARGUMENT. The method reads no store and calls no dependency, so no outage of another service can fail it. The one failure it has is the one of the profile: while the signing keys of the identity authority cannot be loaded, the service refuses calls and reports the authority in its readiness, and the callers, for which the dependency is fail-fast, fail their own call; when the keys load again the method answers without a restart. Kind: behavior. Traces: services: KnowledgeIngestionService; apis: KnowledgeIngestionService/Ingestion.GetSourceScope; descriptors: execution-scope-v1; adrs: ADR-0015; requirements: XL-07; scenarios: SCN-KnowledgeIngestionService-007. Depends on: AIFACTORY-US-791, feature:component-base-template-factory-profile. Sources: model/services/knowledge/KnowledgeIngestionService.yaml, model/services/knowledge/VectorMemoryService.yaml, model/services/knowledge/RepositoryIntelligenceService.yaml, docs/reference/schemas/execution-scope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope and forwards a tenant and a project, and a valid `execution-scope-v1` request for that scope, when `KnowledgeIngestionService/Ingestion.GetSourceScope` is called, then the reply is the `execution-scope-v1` of the request with a `sourceScope` whose `repositories` and `documentCollections` are present and empty, and nothing is written or published (SCN-KnowledgeIngestionService-007).",
        "AC2: Given scopes of two tenants and of several projects, when each is asked through `KnowledgeIngestionService/Ingestion.GetSourceScope`, then each reply names its own tenant and project and the same empty source scope, and the same request asked twice receives the same reply, because the thin scope of model/backlog/features/knowledge.yaml ingests nothing (SCN-KnowledgeIngestionService-007, XL-07).",
        "AC3: Given a caller without a workload identity, a token without the service scope, a request without a member the schema requires, or a request whose body names another tenant than the forwarded scope, when `KnowledgeIngestionService/Ingestion.GetSourceScope` is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and INVALID_ARGUMENT respectively, and no source scope is returned (SCN-KnowledgeIngestionService-007, ADR-0015).",
        "AC4: Given the signing keys of the identity authority cannot be loaded, when `KnowledgeIngestionService/Ingestion.GetSourceScope` is called, then the call is refused and readiness names the authority, and once the keys load again the method answers without a restart (SCN-KnowledgeIngestionService-007)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-065",
        "AIFACTORY-TASK-3182",
        "AIFACTORY-TASK-3183"
      ],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6303,
      "kind": "behavior",
      "traces": {
        "services": [
          "KnowledgeIngestionService"
        ],
        "apis": [
          "KnowledgeIngestionService/Ingestion.GetSourceScope"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "XL-07"
        ],
        "scenarios": [
          "SCN-KnowledgeIngestionService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-791",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-792]",
      "number": 792
    },
    {
      "id": "AIFACTORY-TASK-065",
      "type": "task",
      "parent": "AIFACTORY-US-792",
      "title": "Implement the thin scope of KnowledgeIngestionService for the first outcome",
      "sequence": "04.03.03.01",
      "description": "Implement the thin scope of KnowledgeIngestionService for the first outcome. Expected output: Ingestion.GetSourceScope takes the request message of AIFACTORY-TASK-066, reads the forwarded tenant and project only under the service scope, refuses a request that lacks a required member of execution-scope-v1 or whose body names another tenant or project than the forwarded scope with INVALID_ARGUMENT, and returns the scope of the request with a sourceScope whose repositories and documentCollections are present and empty and whose toolIds are as received; it answers UNAUTHENTICATED and PERMISSION_DENIED as the PBI states, reads no store, calls no dependency and writes nothing. No ingestion is built; the contracts match the model, so the complete delivery replaces the thin one without a contract change.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Ingestion.GetSourceScope takes the request message of AIFACTORY-TASK-066, reads the forwarded tenant and project only under the service scope, refuses a request that lacks a required member of execution-scope-v1 or whose body names another tenant or project than the forwarded scope with INVALID_ARGUMENT, and returns the scope of the request with a sourceScope whose repositories and documentCollections are present and empty and whose toolIds are as received; it answers UNAUTHENTICATED and PERMISSION_DENIED as the PBI states, reads no store, calls no dependency and writes nothing. No ingestion is built; the contracts match the model, so the complete delivery replaces the thin one without a contract change."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-065]",
      "number": 65
    },
    {
      "id": "AIFACTORY-TASK-3182",
      "type": "task",
      "parent": "AIFACTORY-US-792",
      "title": "Scope requests of two tenants and workload tokens with and without the service scope",
      "sequence": "04.03.03.02",
      "description": "Scope requests of two tenants and workload tokens with and without the service scope. Expected output: The acceptance suite holds execution-scope-v1 requests of two tenants and several projects valid against docs/reference/schemas/execution-scope.schema.json, one request per missing required member, one whose body names another tenant than the forwarded scope, workload tokens with and without the service scope naming KnowledgeIngestionService, and an identity authority double whose signing keys can be withheld and restored.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "The acceptance suite holds execution-scope-v1 requests of two tenants and several projects valid against docs/reference/schemas/execution-scope.schema.json, one request per missing required member, one whose body names another tenant than the forwarded scope, workload tokens with and without the service scope naming KnowledgeIngestionService, and an identity authority double whose signing keys can be withheld and restored."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6303,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3182]",
      "number": 3182
    },
    {
      "id": "AIFACTORY-TASK-3183",
      "type": "task",
      "parent": "AIFACTORY-US-792",
      "title": "Verify answer-an-empty-source-scope-to-the-retrieval-path through the acceptance suite",
      "sequence": "04.03.03.03",
      "description": "Verify answer-an-empty-source-scope-to-the-retrieval-path through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-KnowledgeIngestionService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-792 over the requests of two tenants, the repeated request, every refusal and the withheld and restored signing keys.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-KnowledgeIngestionService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-792 over the requests of two tenants, the repeated request, every refusal and the withheld and restored signing keys."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 63,
      "phase": "factory",
      "stackRank": 6303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3183]",
      "number": 3183
    },
    {
      "id": "AIFACTORY-FEAT-020",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "RepositoryIntelligenceService: thin delivery for the first outcome",
      "sequence": "04.04",
      "description": "RepositoryIntelligenceService is the service of bounded context BC-39 (Repository Intelligence). Repository indexes per revision — file tree, symbols, types, dependencies, calls, references, Git history, ownership, build and test relationships — built from repository snapshots and exposed as read tools so that large repositories are never dumped into model context (BC-39, original design §33). In this increment it is delivered thin: The seven read tools run inside the sandbox of the tool executor, where the workspace of the run is mounted, and work over that workspace only (D125); no repository index, and no deployed service reads a workspace before the complete delivery. Its own repository is ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService. Delivers: RepositoryIntelligenceService (thin: The seven read tools run inside the sandbox of the tool executor, where the workspace of the run is mounted, and work over that workspace only (D125); no repository index, and no deployed service reads a workspace before the complete delivery.). Increment I1: Generate a microservice. Build order 64 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-062",
        "AIFACTORY-US-816",
        "AIFACTORY-US-817",
        "AIFACTORY-US-818",
        "AIFACTORY-US-819"
      ],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6400,
      "titlePrefix": "[AIFACTORY-FEAT-020]",
      "number": 20
    },
    {
      "id": "AIFACTORY-US-062",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-020",
      "title": "RepositoryIntelligenceService answers the chain with its thin contract",
      "sequence": "04.04.01",
      "description": "As a requester, I want RepositoryIntelligenceService to answer the read tools of my run from the workspace of that run, so that the agents of the chain read what earlier steps wrote without a repository ever being dumped into model context. This is the integration PBI of the thin delivery. RepositoryIntelligenceService is the service of bounded context BC-39. In its complete form it builds one index set per repository revision from snapshots and answers read tools from those indexes; that form arrives with feature `repository-intelligence-service-complete` in I5. The first outcome needs less: the nine agents of the chain read the files that the steps of their own run wrote. The thin scope is exactly this (D125): the seven read tools run inside the sandbox of the tool executor, where the workspace of the run is mounted read-only, and work over that workspace only; no repository index exists, and no deployed service reads a workspace from outside a sandbox before the complete delivery in I5. The seven tools are the seven internal gRPC methods of the service `RepositoryIntelligence`: `ListFiles` for `list-files`, `SearchText` for `search-text`, `SearchSymbols` for `search-symbols`, `FindReferences` for `find-references`, `ReadRange` for `read-range`, `GetDependencies` for `get-dependencies` and `GetHistory` for `get-git-diff`. In this increment the handlers of these seven methods are not reached by a call to a deployed service. The repository packages them as a tool component, and ToolExecutorHost runs that component inside the sandbox of the run, where the sandbox lease mounts the workspace of the run read-only; the component answers the same seven methods with the same request and reply messages and the same golden argument shapes that the complete delivery answers from its indexes in I5 (D125). Every tool call still passes ToolAdapterService, the governed executor (ADR-0022 decision 2): its pipeline authorizes the call, leases the sandbox and executes the tool there, and the method of the tool receives the invocation of `tool-invocation-v1` and the `workspaceRef` of the run, which the lease hands over (feature `tool-adapter-service`). Whether a call needs an approval is decided by the policy decision of that pipeline alone, for every side-effect class; the component evaluates no policy and no approval and writes no audit evidence, because audit is the last stage of that pipeline. The hosting of the component is a dependency in words on feature `tool-executor-host`: how ToolExecutorHost takes the component, starts it in the sandbox of a run and hands it the mounted workspace with the reference and the scope of the lease is delivered by the PBIs of that feature, which are aligned with this decision in their own pass, and this feature delivers the component and its contract. What holds inside the sandbox replaces what a deployed service would check. The component validates no token and holds no credential, because no caller reaches it over the network of the cluster: its only caller is the host that ToolExecutorHost runs in the same sandbox, for a call the pipeline authorized. The tenant, the project and the run of a call are those of the `scope` and the `runId` of the invocation, and the boundary is the sandbox itself: one workspace is mounted, it is mounted read-only, and the lease names the tenant, the project and the run it belongs to. The service scope of a workload token, by which the deployed service of I5 admits its internal gRPC methods, and the scope `factory.knowledge.read`, which guards the public REST operations that read index sets, are stated by the model for that delivery (D125) and are checked by nothing inside the sandbox. The workspace of a run is owned by ExecutionCapacityService, which creates it with the first lease of the run, keeps it between leases and removes it on a terminal run event. The handlers read it through one port, the workspace view (AIFACTORY-US-816), whose production binding is the mounted workspace of the sandbox. The feature is delivered by four further PBIs: the workspace view port with its boundary rules (AIFACTORY-US-816), the three file tools (AIFACTORY-US-817), the three analysis tools (AIFACTORY-US-818) and the diff and status of the workspace (AIFACTORY-US-819). Nothing else is served. The REST operations `ListRepositoryIndexSets` and `RebuildRepositoryIndexes`, the aggregate `RepositoryIndexSet` with its three transitions, the events `RepositoryIndexed` and `RepositoryIndexFailed`, the worker `IndexSetBuilder` and the nine consumed events arrive with the complete delivery; the handler of `DeletionOrderIssued` is built in I4 with RetentionResidencyService and is not registered here. The thin delivery delivers no aggregate, so no state transition exists to cover; it writes no row to `repository-intelligence-sql` and no outbox record, and it calls neither KnowledgeIngestionService nor ArtifactService, the two outbound dependencies of the model, because both serve snapshots and the thin delivery reads none. The repository ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService is created and scaffolded in I0 by AIFACTORY-TASK-067 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold, and is scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`). The scaffold brings the service host with token validation, the scope chain with its 401, 403 and 404 answers, health, readiness, the messaging profile `repository-intelligence` with its outbox and inbox and the telemetry wiring; the complete delivery builds on that host in I5, and the thin delivery deploys no instance of it. What the thin delivery adds to the repository is the tool component: the seven handlers, the workspace view with its mounted-workspace binding, the analyzers and the gRPC surface of `RepositoryIntelligence`, which the pipeline of the repository publishes as a package beside the container image of the service. The component references neither `repository-intelligence-sql` nor the messaging profile, holds no secret and opens no network connection, so it runs in a sandbox whose network is closed. The form in which ToolExecutorHost takes a tool component is defined by feature `tool-executor-host` and is reported with that dependency. The model names `tool-invocation-v1` as the request and as the reply descriptor of all seven methods. docs/reference/schemas/tool-invocation.schema.json describes the governed request and its receipt and has no shape for the result of a read tool. That gap is reported to the owner, and the thin delivery makes its contract checkable without deciding it: the proto fixes one request message for all seven methods, which carries the invocation and the `workspaceRef`, and one typed reply message per method, and the complete delivery answers the same messages from its indexes. The arguments of a tool live in one place, the `arguments` member of the invocation, and in no typed request member beside it. The contract test fixes one argument shape per tool: a path prefix, a name pattern and a depth for `ListFiles`, the text and an optional path prefix for `SearchText`, a name, a kind and a container for `SearchSymbols`, a symbol for `FindReferences`, a path and a line range for `ReadRange`, a path or a symbol for `GetDependencies` and optional paths for `GetHistory`, each with the continuation token of a paged answer; arguments that do not match the shape of the tool are refused with INVALID_ARGUMENT. The schema of the invocation also holds an optional `sandbox.workspaceId`. The component resolves the workspace from the `workspaceRef` member of the request only and never from the invocation; a request whose invocation carries a `sandbox.workspaceId` that differs from the `workspaceRef` is refused with INVALID_ARGUMENT before anything is read, so two carriers can never point a tool at two workspaces. Whether the two members name the same identifier is reported with the same gap. A reply cites the `workspaceRef` it was read from; its `revision` member stays empty, because a workspace is the working state of a run and no snapshot at a commit, and what a workspace answer cites in the place of the revision the model requires is reported with the same gap. Every call is counted in `connectsoft.factory.repo_intelligence.tool_calls` through the helper of the pinned observability library, which puts the tenant and the project on the instrument beside the tool; no file content, no query text and no path listing reaches a log record, an activity or a metric (ADR-0019). How the telemetry of a component leaves the sandbox is the matter of its host and belongs to the dependency on feature `tool-executor-host`. Kind: behavior. Traces: services: RepositoryIntelligenceService, ToolExecutorHost; apis: RepositoryIntelligenceService/RepositoryIntelligence.ListFiles, RepositoryIntelligenceService/RepositoryIntelligence.SearchText, RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols, RepositoryIntelligenceService/RepositoryIntelligence.FindReferences, RepositoryIntelligenceService/RepositoryIntelligence.ReadRange, RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies, RepositoryIntelligenceService/RepositoryIntelligence.GetHistory; tools: list-files, search-text, search-symbols, find-references, read-range, get-dependencies, get-git-diff; descriptors: tool-invocation-v1; adrs: ADR-0013, ADR-0015, ADR-0019, ADR-0022, ADR-0028; requirements: FR-05. Depends on: AIFACTORY-US-816, AIFACTORY-US-817, AIFACTORY-US-818, AIFACTORY-US-819, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-observability-factory-conventions, feature:contracts-package. Sources: model/services/knowledge/RepositoryIntelligenceService.yaml, model/backlog/features/knowledge.yaml, docs/reference/schemas/tool-invocation.schema.json, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService created and scaffolded in I0 by AIFACTORY-TASK-067 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService --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 with complete reports and a container image is published (ADR-0028, model/services/knowledge/RepositoryIntelligenceService.yaml).",
        "AC2: Given the tool component of the repository hosted over a sandbox fixture whose workspace is mounted read-only, when `RepositoryIntelligenceService/RepositoryIntelligence.ListFiles`, `RepositoryIntelligenceService/RepositoryIntelligence.SearchText`, `RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols`, `RepositoryIntelligenceService/RepositoryIntelligence.FindReferences`, `RepositoryIntelligenceService/RepositoryIntelligence.ReadRange`, `RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies` and `RepositoryIntelligenceService/RepositoryIntelligence.GetHistory` are called with the `workspaceRef` of the run of that sandbox and the arguments of their tool in the `arguments` member of the invocation, then all seven answer from that mounted workspace only, each with the reply message the contract test fixes and the `workspaceRef` it read, with the same request and reply messages and the same seven golden argument shapes that the service descriptor of the repository lists for the deployed service of I5, and a request whose invocation carries a `sandbox.workspaceId` that differs from the `workspaceRef` is refused with INVALID_ARGUMENT, as AIFACTORY-US-817 to AIFACTORY-US-819 prove one by one (ADR-0022, FR-05).",
        "AC3: Given the service descriptor of the thin delivery and the packaged tool component, when the contract test compares the surface of the component with the descriptor, then exactly the seven methods of `RepositoryIntelligence` are answered by the component, it hosts no REST operation, references no store, no messaging profile and no secret, the `OrleansMessaging` section of the repository declares no published and no consumed event, no row of an index set is written to `repository-intelligence-sql`, and the test fails when an operation outside the thin scope stated in model/backlog/features/knowledge.yaml appears.",
        "AC4: Given the component in a sandbox fixture whose workspace is mounted read-only and whose network is closed, when the seven methods are called, then every answer is read from the mounted workspace alone, no call validates a token, uses a credential or opens a network connection, a write to the mount fails, and an invocation whose `workspaceRef`, tenant, project or run is not the one of the lease that mounted the workspace is answered NOT_FOUND before anything is read; no deployed service is called in any of these cases, as the invariants of model/services/knowledge/RepositoryIntelligenceService.yaml state for I1 (ADR-0015, ADR-0022).",
        "AC5: Given calls of two tenants and two projects through the seven methods, each in the sandbox fixture of its run, when the metrics, the logs and the activities of the component are read, then `connectsoft.factory.repo_intelligence.tool_calls` counts every call with its tenant, its project and its tool, and no record holds file content, query text or a path listing (ADR-0019, model/services/knowledge/RepositoryIntelligenceService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-069",
        "AIFACTORY-TASK-3291",
        "AIFACTORY-TASK-764"
      ],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6401,
      "kind": "behavior",
      "traces": {
        "services": [
          "RepositoryIntelligenceService",
          "ToolExecutorHost"
        ],
        "apis": [
          "RepositoryIntelligenceService/RepositoryIntelligence.ListFiles",
          "RepositoryIntelligenceService/RepositoryIntelligence.SearchText",
          "RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols",
          "RepositoryIntelligenceService/RepositoryIntelligence.FindReferences",
          "RepositoryIntelligenceService/RepositoryIntelligence.ReadRange",
          "RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies",
          "RepositoryIntelligenceService/RepositoryIntelligence.GetHistory"
        ],
        "tools": [
          "list-files",
          "search-text",
          "search-symbols",
          "find-references",
          "read-range",
          "get-dependencies",
          "get-git-diff"
        ],
        "descriptors": [
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0013",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-816",
        "AIFACTORY-US-817",
        "AIFACTORY-US-818",
        "AIFACTORY-US-819",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-observability-factory-conventions",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-062]",
      "number": 62
    },
    {
      "id": "AIFACTORY-TASK-069",
      "type": "task",
      "parent": "AIFACTORY-US-062",
      "title": "Contract of the thin surface: service descriptor and proto of the seven tool methods with the invocation, the argument shape of each tool and the workspace reference",
      "sequence": "04.04.01.01",
      "description": "Contract of the thin surface: service descriptor and proto of the seven tool methods with the invocation, the argument shape of each tool and the workspace reference. Expected output: The service descriptor file of the repository lists exactly the seven methods of RepositoryIntelligence, all internal, unary and of class read. The proto fixes one request message for all seven methods, which carries the invocation of tool-invocation-v1 and the workspaceRef of the run, and one typed reply message per method: file entries with path, kind (file, directory or link) and length for ListFiles, matches with path and line range for SearchText, symbol entries for SearchSymbols, reference locations for FindReferences, lines with the returned range for ReadRange, edges for GetDependencies and status entries with diff hunks for GetHistory; every reply carries the workspaceRef it was read from, a revision member that stays empty in the thin delivery, a partial mark with the names of what was not analysed where the method analyses, and a continuation token where the answer is paged. The arguments of a tool live in the arguments member of the invocation and in no typed request member beside it. The contract holds seven golden argument shapes, one per tool: a path prefix, a name pattern and a depth for ListFiles; the text and an optional path prefix for SearchText; a name, a kind and a container for SearchSymbols; a symbol for FindReferences; a path and a line range for ReadRange; a path or a symbol for GetDependencies; optional paths for GetHistory; each shape also holds the continuation token of a paged answer, and each method validates the arguments of its request against the shape of its tool and refuses a mismatch with INVALID_ARGUMENT. The component resolves the workspace from the workspaceRef member of the request only; a request whose invocation carries a sandbox.workspaceId that differs from the workspaceRef is refused with INVALID_ARGUMENT, and the contract test holds that case. A contract test with golden files compares the invocation member with docs/reference/schemas/tool-invocation.schema.json and holds the seven argument shapes and the seven reply shapes; it is the same set of shapes that the contract test of AIFACTORY-TASK-220 of feature tool-adapter-service holds against the calls of the executor. The contract test compares the surface of the tool component with the service descriptor file in both directions, so the component that ToolExecutorHost runs in the sandbox of the run in I1 and the deployed service of the complete delivery in I5 answer the same seven methods with the same messages and the same golden argument shapes, without a contract change (D125).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file of the repository lists exactly the seven methods of RepositoryIntelligence, all internal, unary and of class read. The proto fixes one request message for all seven methods, which carries the invocation of tool-invocation-v1 and the workspaceRef of the run, and one typed reply message per method: file entries with path, kind (file, directory or link) and length for ListFiles, matches with path and line range for SearchText, symbol entries for SearchSymbols, reference locations for FindReferences, lines with the returned range for ReadRange, edges for GetDependencies and status entries with diff hunks for GetHistory; every reply carries the workspaceRef it was read from, a revision member that stays empty in the thin delivery, a partial mark with the names of what was not analysed where the method analyses, and a continuation token where the answer is paged. The arguments of a tool live in the arguments member of the invocation and in no typed request member beside it. The contract holds seven golden argument shapes, one per tool: a path prefix, a name pattern and a depth for ListFiles; the text and an optional path prefix for SearchText; a name, a kind and a container for SearchSymbols; a symbol for FindReferences; a path and a line range for ReadRange; a path or a symbol for GetDependencies; optional paths for GetHistory; each shape also holds the continuation token of a paged answer, and each method validates the arguments of its request against the shape of its tool and refuses a mismatch with INVALID_ARGUMENT. The component resolves the workspace from the workspaceRef member of the request only; a request whose invocation carries a sandbox.workspaceId that differs from the workspaceRef is refused with INVALID_ARGUMENT, and the contract test holds that case. A contract test with golden files compares the invocation member with docs/reference/schemas/tool-invocation.schema.json and holds the seven argument shapes and the seven reply shapes; it is the same set of shapes that the contract test of AIFACTORY-TASK-220 of feature tool-adapter-service holds against the calls of the executor. The contract test compares the surface of the tool component with the service descriptor file in both directions, so the component that ToolExecutorHost runs in the sandbox of the run in I1 and the deployed service of the complete delivery in I5 answer the same seven methods with the same messages and the same golden argument shapes, without a contract change (D125)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6401,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-069]",
      "number": 69
    },
    {
      "id": "AIFACTORY-TASK-3291",
      "type": "task",
      "parent": "AIFACTORY-US-062",
      "title": "Packaging of the read-tool component: the package of the seven handlers, its options and the tool call metric",
      "sequence": "04.04.01.02",
      "description": "Packaging of the read-tool component: the package of the seven handlers, its options and the tool call metric. Expected output: The pipeline of the repository publishes the tool component as a package beside the container image of the service: the seven handlers of RepositoryIntelligence, the workspace view port with its mounted-workspace binding, the analyzers and the gRPC surface of the seven methods; the component reads the options Knowledge:Repositories:Analyzers and Knowledge:Repositories:MaxRangeLines at their modelled defaults from the configuration its host passes, references no store, no messaging profile and no secret, binds no base address of KnowledgeIngestionService or ArtifactService, which the thin delivery does not call, and opens no network connection; connectsoft.factory.repo_intelligence.tool_calls is registered through the helper of the pinned observability library with tenant, project and tool; no instance of the service is deployed in I1, so the deployment manifest with the replica range 2 to 10 of model/services/knowledge/RepositoryIntelligenceService.yaml, the probes and the secret reference messaging-transport arrives with the complete delivery in I5 (D125); the hosting of the component in the sandbox of a run belongs to feature tool-executor-host.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The pipeline of the repository publishes the tool component as a package beside the container image of the service: the seven handlers of RepositoryIntelligence, the workspace view port with its mounted-workspace binding, the analyzers and the gRPC surface of the seven methods; the component reads the options Knowledge:Repositories:Analyzers and Knowledge:Repositories:MaxRangeLines at their modelled defaults from the configuration its host passes, references no store, no messaging profile and no secret, binds no base address of KnowledgeIngestionService or ArtifactService, which the thin delivery does not call, and opens no network connection; connectsoft.factory.repo_intelligence.tool_calls is registered through the helper of the pinned observability library with tenant, project and tool; no instance of the service is deployed in I1, so the deployment manifest with the replica range 2 to 10 of model/services/knowledge/RepositoryIntelligenceService.yaml, the probes and the secret reference messaging-transport arrives with the complete delivery in I5 (D125); the hosting of the component in the sandbox of a run belongs to feature tool-executor-host."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6401,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-3291]",
      "number": 3291
    },
    {
      "id": "AIFACTORY-TASK-764",
      "type": "task",
      "parent": "AIFACTORY-US-062",
      "title": "Verify repository-intelligence-service-thin-contract by running the declared command",
      "sequence": "04.04.01.03",
      "description": "Verify repository-intelligence-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-062, that is the scaffold, the seven methods answered by the tool component from the mounted workspace of one sandbox fixture (SCN-RepositoryIntelligenceService-003 to SCN-RepositoryIntelligenceService-009), the surface of the component compared with the service descriptor, with no store, no messaging profile and no secret, the golden files of the invocation member, of the seven argument shapes and of the seven reply shapes, the refused request whose `sandbox.workspaceId` differs from the `workspaceRef`, the component in a sandbox fixture with a closed network and a read-only mount that validates no token and opens no connection, the NOT_FOUND for an invocation of another lease and the telemetry conformance test over two tenants and two projects.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-062, that is the scaffold, the seven methods answered by the tool component from the mounted workspace of one sandbox fixture (SCN-RepositoryIntelligenceService-003 to SCN-RepositoryIntelligenceService-009), the surface of the component compared with the service descriptor, with no store, no messaging profile and no secret, the golden files of the invocation member, of the seven argument shapes and of the seven reply shapes, the refused request whose `sandbox.workspaceId` differs from the `workspaceRef`, the component in a sandbox fixture with a closed network and a read-only mount that validates no token and opens no connection, the NOT_FOUND for an invocation of another lease and the telemetry conformance test over two tenants and two projects."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-764]",
      "number": 764
    },
    {
      "id": "AIFACTORY-US-816",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-020",
      "title": "Workspace view port: one read-only, bounded view of the workspace of a run by its reference, with the path and scope boundary every read tool passes",
      "sequence": "04.04.02",
      "description": "As an operator, I want every read tool to reach a workspace through one port with one boundary, so that a tool can never read another run, another tenant or the host, whatever its arguments say. A read tool of the thin delivery reads one thing: the workspace of the run that called it. ExecutionCapacityService owns that workspace: it creates it with the first lease of the run, keeps it between leases, hands its reference to ToolAdapterService by lease as `workspaceRef` and removes it when it consumes a terminal run event (model/services/runtime-cloud/ExecutionCapacityService.yaml). How a read tool reaches it is decided (D125): the sandbox lease mounts the workspace read-only in the sandbox of the run, ToolExecutorHost runs the read-tool component there, and no deployed service reads a workspace from outside a sandbox before the complete delivery in I5. This PBI delivers the port all seven tool methods read through, the rules that bound it and its production binding, the mounted workspace of the sandbox. The binding serves exactly one workspace: the directory the lease mounted, with the `workspaceRef`, the tenant, the project and the run of that lease, which the host hands to the component with the mount (feature `tool-executor-host`). The port takes the `workspaceRef` of the request together with the tenant, the project and the run of the invocation and yields a view of that one workspace: its file tree, the lines of a file by path and range and, where the workspace holds version control metadata, its base, its status and its diff. The view has four rules. It is read-only: the port has no write operation, because write tools act on the sandboxed workspace through ToolAdapterService and are not here (invariant of the model), and the mount is read-only as well, so a defect of a handler cannot change a file. It is bounded by the root: a path is resolved relative to the root of the workspace, and a path that leaves it, by parent segments, as an absolute path or through a symbolic link whose target lies outside, is refused with INVALID_ARGUMENT and nothing is read. A walk of the tree, by the listing, by the text search or by an analysis, returns a symbolic link whose target lies outside the root as an entry of kind link and never follows it, so no path and no match outside the root appears in any reply. It is bound to the scope: a view is yielded only when the `workspaceRef`, the tenant, the project and the run of the call are those of the lease that mounted the workspace, so a reference of another run, of another project of the same tenant or of another tenant is an unknown reference there, and the method answers NOT_FOUND. That is a rule of this port and no decision of the tenancy record: ADR-0015 amendment D113 decides the answer for a resource of another tenant, which over gRPC is NOT_FOUND, and keeps the refusal for a missing right inside the tenant. The port gives one answer to five cases, a workspace of another tenant, a workspace of another project of the same tenant, a workspace of another run, an unknown reference and a workspace that was removed after its run ended, so the answer never confirms that a workspace exists. Inside the sandbox one answer is also the only possible one, because the component sees one workspace and cannot tell the cases apart; whether a deployed service that reads workspaces by reference answers PERMISSION_DENIED for a workspace of the same tenant is left to the complete delivery in I5. It is bounded in volume: the view returns entries and ranges and never a workspace as one answer, and a file read is capped by `Knowledge:Repositories:MaxRangeLines`. The production binding reads the mounted directory and nothing else: it calls no operation of ExecutionCapacityService and no other service, needs no credential and no network, and reads the base, the status and the diff from the version control metadata the mounted workspace holds, without writing to it. The acceptance suite runs that binding over sandbox fixtures, directory trees of the test host mounted read-only with the lease values of two runs of one project of one tenant, one run of a second project of that tenant and one run of a second tenant. The proof with a leased sandbox, the component hosted by ToolExecutorHost and a workspace of ExecutionCapacityService belongs to the features `tool-executor-host` and `tool-adapter-service`, whose PBIs are aligned with this decision in their own pass. When the mounted workspace cannot be read, the method answers UNAVAILABLE with a reason that names the port and invents no file and no empty listing, and when a read is slower than the deadline of the call, the method ends with DEADLINE_EXCEEDED; in both cases the executor ends the tool call Failed with the failure class transient in its own PBI. The port stores nothing and caches nothing: no workspace content is copied into `repository-intelligence-sql` or into `artifact-blob`, no index set is derived from it, and every operation reads the workspace as it is at the moment of the call, so a read made after a write tool of the run changed a file returns the changed content. Kind: enabling. Traces: services: RepositoryIntelligenceService, ExecutionCapacityService, ToolExecutorHost; adrs: ADR-0015, ADR-0022; requirements: FR-05. Depends on: feature:component-base-template-factory-profile. Sources: model/services/knowledge/RepositoryIntelligenceService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/tools-mcp/ToolExecutorHost.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#dependencies.",
      "acceptanceCriteria": [
        "AC1: Given the mounted-workspace binding of the port over the sandbox fixture of run A, when a view is opened with the `workspaceRef`, the tenant, the project and the run of A, then it yields the file tree and the lines of that mounted workspace only, the port exposes no write operation, a write to the mount fails because it is read-only, and nothing is written to `repository-intelligence-sql`, as the invariants of model/services/knowledge/RepositoryIntelligenceService.yaml require.",
        "AC2: Given a view of the workspace of run A, when a path with parent segments that leave the root, an absolute path or a symbolic link whose target lies outside the root is read, then the read is refused with INVALID_ARGUMENT, no byte outside the root is returned and the host file system is never listed; when the tree, the text search or an analysis walks that workspace, then the link is returned as an entry of kind link, is not followed, and no path or match outside the root appears in any reply (FR-05, ADR-0022).",
        "AC3: Given the fixture with two runs of one project of one tenant, one run of a second project of that tenant and one run of a second tenant, when a view is asked for the `workspaceRef` of another run, of the other project of the same tenant, of the other tenant, for an unknown reference or for a workspace removed after its run ended, then every one of the five is answered NOT_FOUND with the same reply and nothing is read: for the other tenant as ADR-0015 amendment D113 decides, and for the other four because the binding serves only the one workspace its lease mounted, for the tenant, the project and the run of that lease (ADR-0015, model/services/knowledge/RepositoryIntelligenceService.yaml).",
        "AC4: Given a sandbox fixture whose mounted workspace cannot be read, and one whose reads are slower than the deadline of the call, when any tool method is called, then the answer is UNAVAILABLE with a reason that names the workspace view port in the first case and DEADLINE_EXCEEDED in the second, and no file, listing or empty result is invented; and given the binding over a readable mount, then it called no operation of ExecutionCapacityService or of any other service and opened no network connection, because the mounted workspace of the sandbox is its only source (model/services/knowledge/RepositoryIntelligenceService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#dependencies"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-3292",
        "AIFACTORY-TASK-3293",
        "AIFACTORY-TASK-3294"
      ],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6402,
      "kind": "enabling",
      "traces": {
        "services": [
          "RepositoryIntelligenceService",
          "ExecutionCapacityService",
          "ToolExecutorHost"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#dependencies"
      ],
      "titlePrefix": "[AIFACTORY-US-816]",
      "number": 816
    },
    {
      "id": "AIFACTORY-TASK-3292",
      "type": "task",
      "parent": "AIFACTORY-US-816",
      "title": "Workspace view port with its mounted-workspace binding: read-only operations, root boundary, scope binding and volume bounds",
      "sequence": "04.04.02.01",
      "description": "Workspace view port with its mounted-workspace binding: read-only operations, root boundary, scope binding and volume bounds. Expected output: The application layer holds one port with the operations the seven tool methods need (tree, lines by path and range, base, status and diff) and no write operation; a view is opened with workspaceRef, tenant, project and run; the production binding is the mounted workspace of the sandbox (D125): it serves the one directory the lease mounted read-only, with the workspaceRef, the tenant, the project and the run of that lease as the host of the component hands them over, reads base, status and diff from the version control metadata of that directory without writing to it, calls no service and opens no network connection; a view is yielded only for the workspaceRef, the tenant, the project and the run of that lease, and every other reference, also one of another run, another project or another tenant, is refused with NOT_FOUND with one reply; every path is resolved against the root and a path that leaves it by parent segments, as an absolute path or through a symbolic link is refused with INVALID_ARGUMENT before any read; a walk of the tree returns a symbolic link whose target lies outside the root as an entry of kind link and never follows it; the port holds no cache and no state of a workspace, so every operation reads the workspace as it is at the moment of the call; entries are paged and a file read is capped by Knowledge:Repositories:MaxRangeLines; a mounted workspace that cannot be read surfaces as UNAVAILABLE with the port named.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The application layer holds one port with the operations the seven tool methods need (tree, lines by path and range, base, status and diff) and no write operation; a view is opened with workspaceRef, tenant, project and run; the production binding is the mounted workspace of the sandbox (D125): it serves the one directory the lease mounted read-only, with the workspaceRef, the tenant, the project and the run of that lease as the host of the component hands them over, reads base, status and diff from the version control metadata of that directory without writing to it, calls no service and opens no network connection; a view is yielded only for the workspaceRef, the tenant, the project and the run of that lease, and every other reference, also one of another run, another project or another tenant, is refused with NOT_FOUND with one reply; every path is resolved against the root and a path that leaves it by parent segments, as an absolute path or through a symbolic link is refused with INVALID_ARGUMENT before any read; a walk of the tree returns a symbolic link whose target lies outside the root as an entry of kind link and never follows it; the port holds no cache and no state of a workspace, so every operation reads the workspace as it is at the moment of the call; entries are paged and a file read is capped by Knowledge:Repositories:MaxRangeLines; a mounted workspace that cannot be read surfaces as UNAVAILABLE with the port named."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6402,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3292]",
      "number": 3292
    },
    {
      "id": "AIFACTORY-TASK-3293",
      "type": "task",
      "parent": "AIFACTORY-US-816",
      "title": "Sandbox fixtures of the workspace view port with four mounted fixture workspaces across two tenants, with two projects in the first tenant",
      "sequence": "04.04.02.02",
      "description": "Sandbox fixtures of the workspace view port with four mounted fixture workspaces across two tenants, with two projects in the first tenant. Expected output: The acceptance suite holds sandbox fixtures for the mounted-workspace binding of the port: directory trees of the test host mounted read-only, each with the workspaceRef, the tenant, the project and the run of its lease, for four fixture workspaces: two runs of one project of one tenant, one run of a second project of that tenant and one run of a second tenant; one workspace holds a .NET project, a TypeScript project, plain text files, a file longer than Knowledge:Repositories:MaxRangeLines, a symbolic link that points outside its root and version control metadata with a base and uncommitted changes; a double that wraps the binding can be switched to a mount that cannot be read, to reads slower than the deadline of a call and to a removed workspace, the suite can add and change a file of a fixture workspace between two calls through a second, writable mount of the same tree, as a write tool of the run would, and the test host records every network connection of the component and every file read outside the root.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The acceptance suite holds sandbox fixtures for the mounted-workspace binding of the port: directory trees of the test host mounted read-only, each with the workspaceRef, the tenant, the project and the run of its lease, for four fixture workspaces: two runs of one project of one tenant, one run of a second project of that tenant and one run of a second tenant; one workspace holds a .NET project, a TypeScript project, plain text files, a file longer than Knowledge:Repositories:MaxRangeLines, a symbolic link that points outside its root and version control metadata with a base and uncommitted changes; a double that wraps the binding can be switched to a mount that cannot be read, to reads slower than the deadline of a call and to a removed workspace, the suite can add and change a file of a fixture workspace between two calls through a second, writable mount of the same tree, as a write tool of the run would, and the test host records every network connection of the component and every file read outside the root."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6402,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3293]",
      "number": 3293
    },
    {
      "id": "AIFACTORY-TASK-3294",
      "type": "task",
      "parent": "AIFACTORY-US-816",
      "title": "Verify the workspace view port through the acceptance suite",
      "sequence": "04.04.02.03",
      "description": "Verify the workspace view port through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=WorkspaceView\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-816 with the mounted-workspace binding over the sandbox fixtures of AIFACTORY-TASK-3293: the view of one mounted workspace without a write operation, the refused write to the read-only mount, the three refused path forms, the link with a target outside the root returned as an entry of kind link and not followed by the listing, the text search and an analysis, with no path or match outside the root in any reply, the five NOT_FOUND cases with one reply, among them the workspace of the second project of the same tenant, the mount that cannot be read answered UNAVAILABLE, the slow read answered DEADLINE_EXCEEDED, no call to ExecutionCapacityService or another service and no network connection, and an empty `repository-intelligence-sql` after the run, against model/services/knowledge/RepositoryIntelligenceService.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=WorkspaceView\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-816 with the mounted-workspace binding over the sandbox fixtures of AIFACTORY-TASK-3293: the view of one mounted workspace without a write operation, the refused write to the read-only mount, the three refused path forms, the link with a target outside the root returned as an entry of kind link and not followed by the listing, the text search and an analysis, with no path or match outside the root in any reply, the five NOT_FOUND cases with one reply, among them the workspace of the second project of the same tenant, the mount that cannot be read answered UNAVAILABLE, the slow read answered DEADLINE_EXCEEDED, no call to ExecutionCapacityService or another service and no network connection, and an empty `repository-intelligence-sql` after the run, against model/services/knowledge/RepositoryIntelligenceService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3294]",
      "number": 3294
    },
    {
      "id": "AIFACTORY-US-817",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-020",
      "title": "List the files, search the text and read a line range of the workspace of a run through the three file tools",
      "sequence": "04.04.03",
      "description": "As a requester, I want the agents of my run to list, search and read the files earlier steps of the run wrote, range by range, so that a later step builds on the exact files of the run and never receives a whole repository as context. An agent of the chain calls `list-files`, `search-text` or `read-range` through ToolAdapterService. The call is executed inside the sandbox of the run, where ToolExecutorHost runs the read-tool component over the workspace mounted read-only (D125), and reaches `RepositoryIntelligence.ListFiles`, `RepositoryIntelligence.SearchText` or `RepositoryIntelligence.ReadRange` of the component with the invocation of `tool-invocation-v1` and the `workspaceRef` of the run. The arguments of each tool are the `arguments` member of that invocation, in the shape the contract test of AIFACTORY-TASK-069 fixes for the tool, and the request carries no typed argument member beside it. The component validates no token: its only caller is the host in the same sandbox, and the tenant, the project and the run of a call are those of the `scope` and the `runId` of the invocation, which must be those of the lease that mounted the workspace (AIFACTORY-US-816). Each method opens the workspace view of the run (AIFACTORY-US-816), whose binding is the mounted workspace, and answers from it alone. `ListFiles` returns the file tree of the workspace as entries with path, kind (file, directory or link) and length, narrowed by the three filters its `arguments` carry, a path prefix, a name pattern and a depth, and paged with a continuation token, so a large tree never arrives as one answer. `SearchText` takes the text and an optional path prefix from its `arguments`, searches the text files of the workspace through the `generic-text` analyzer and returns each match as a path with its line range; it returns no file content beyond the matched range, and the caller reads on with `ReadRange`. `ReadRange` takes a path and a line range from its `arguments` and returns the lines of that one file; the tools `read_file` and `read_range` of the model are this one method, a file read being a range that starts at line one. An answer returns at most `Knowledge:Repositories:MaxRangeLines` lines, 400 by default and reloadable; a wider request returns the first lines of the range up to the cap and names the range it returned, so the caller asks for the next range, and no request returns a whole repository (ADR-0013 decision 4 names such bounded reads as an accepted retrieval path). Every reply cites the `workspaceRef` it was read from and leaves the `revision` member empty. The three methods are of class read: they write no row, no artifact and no outbox record and publish no event, and a repeated call over an unchanged workspace returns the same answer. The methods keep nothing between calls and the workspace view holds no cache, so a call made after a write tool of the same run added or changed a file returns the new state: the new entry in the listing, the new match in the search and the new lines in the range. The statuses UNAUTHENTICATED and PERMISSION_DENIED belong to the deployed service of the complete delivery, which validates a workload token; the component in the sandbox never answers them. A request without a `workspaceRef`, without the tenant, the project or the run in the invocation, with arguments that do not match the shape of the tool, with a `sandbox.workspaceId` in the invocation that differs from the `workspaceRef`, with a range whose start lies after its end or before line one, or with a path that leaves the workspace is refused with INVALID_ARGUMENT. A `workspaceRef`, a tenant, a project or a run that is not the one of the lease that mounted the workspace is answered NOT_FOUND. For a workspace of another tenant that is the answer ADR-0015 amendment D113 decides; for a workspace of another run or of another project of the same tenant and for an unknown reference it is the rule of the workspace view (AIFACTORY-US-816), and the reply is the same in every case. A path that does not exist in the workspace is answered NOT_FOUND as well. When the mounted workspace cannot be read, the method answers UNAVAILABLE and returns no partial listing presented as complete. The executor passes the deadline of the tool with the call, 30 seconds for `list-files` and `search-text` and 15 seconds for `read-range` in the catalogue; a call that does not finish within that deadline ends with DEADLINE_EXCEEDED and returns nothing as if complete. ToolAdapterService ends the tool call Failed with the failure class transient in both cases, in its own PBI, and a retry of a read is safe. The call is counted in `connectsoft.factory.repo_intelligence.tool_calls` with tenant, project and tool, and neither the query of a search nor a line of a file reaches telemetry (ADR-0019). Kind: behavior. Traces: services: RepositoryIntelligenceService, ToolAdapterService; apis: RepositoryIntelligenceService/RepositoryIntelligence.ListFiles, RepositoryIntelligenceService/RepositoryIntelligence.SearchText, RepositoryIntelligenceService/RepositoryIntelligence.ReadRange; tools: list-files, search-text, read-range; descriptors: tool-invocation-v1; adrs: ADR-0013, ADR-0015, ADR-0019, ADR-0022; requirements: FR-05, XL-03; scenarios: SCN-RepositoryIntelligenceService-003, SCN-RepositoryIntelligenceService-004, SCN-RepositoryIntelligenceService-007. Depends on: AIFACTORY-US-816, feature:component-base-template-factory-profile, feature:component-observability-factory-conventions. Sources: model/services/knowledge/RepositoryIntelligenceService.yaml, model/tools/list-files.yaml, model/tools/search-text.yaml, model/tools/read-range.yaml, docs/architecture/adr/0013-vector-store-profiles.md, docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given the tool component over the sandbox fixture of a run, whose workspace is mounted read-only, when `RepositoryIntelligenceService/RepositoryIntelligence.ListFiles` is called with the `workspaceRef` of the run, a path prefix and a name pattern, then the reply holds only the entries of that workspace that match, each with path, kind and length, a continuation token when more entries exist, the `workspaceRef` and an empty `revision`, and nothing is written (SCN-RepositoryIntelligenceService-003, FR-05).",
        "AC2: Given text that occurs in three files of the workspace, when `RepositoryIntelligenceService/RepositoryIntelligence.SearchText` is called with that text, then the reply holds one match per occurrence as a path with its line range through the `generic-text` analyzer, no file content beyond the matched ranges and no match from another workspace, and a second call over the unchanged workspace returns the same matches; given a file with that text added to the workspace and a line of an existing file changed between two calls, when `RepositoryIntelligenceService/RepositoryIntelligence.ListFiles`, `RepositoryIntelligenceService/RepositoryIntelligence.SearchText` and `RepositoryIntelligenceService/RepositoryIntelligence.ReadRange` are called again, then the listing holds the new entry, the search the new match and the range the changed line, and no reply holds the earlier state (SCN-RepositoryIntelligenceService-003, SCN-RepositoryIntelligenceService-004, SCN-RepositoryIntelligenceService-007, XL-03).",
        "AC3: Given a file of the workspace longer than `Knowledge:Repositories:MaxRangeLines`, when `RepositoryIntelligenceService/RepositoryIntelligence.ReadRange` is called for lines within the cap, for the whole file and for a range wider than the cap, then the first call returns exactly the lines asked for, and the other two return the first lines up to the cap and name the range returned, so no call returns more than the cap and none returns a repository (SCN-RepositoryIntelligenceService-007, ADR-0013).",
        "AC4: Given a request without a `workspaceRef`, with arguments that do not match the shape of the tool, with a `sandbox.workspaceId` that differs from the `workspaceRef`, with an invalid range or with a path that leaves the workspace, and a `workspaceRef` of another tenant, of another project or run of the same tenant or a path that does not exist, when any of the three methods is called in the sandbox fixture, then the call is refused with INVALID_ARGUMENT or NOT_FOUND respectively, a workspace of another tenant is answered exactly as an unknown one, no call validated a token, and nothing is read (SCN-RepositoryIntelligenceService-003, SCN-RepositoryIntelligenceService-004, SCN-RepositoryIntelligenceService-007, ADR-0015).",
        "AC5: Given the mounted workspace cannot be read, when any of the three methods is called, then the answer is UNAVAILABLE without a partial result and a repeated call after recovery returns the full answer; given reads of the mounted workspace are slower than the deadline the executor passes, when any of the three methods is called, then the call ends with DEADLINE_EXCEEDED and returns nothing as if complete; in every case `connectsoft.factory.repo_intelligence.tool_calls` counted the call with tenant, project and tool while no query text and no file line reached a log record, an activity or a metric (SCN-RepositoryIntelligenceService-003, SCN-RepositoryIntelligenceService-004, SCN-RepositoryIntelligenceService-007, ADR-0019, model/services/knowledge/RepositoryIntelligenceService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/tools/list-files.yaml",
        "model/tools/search-text.yaml",
        "model/tools/read-range.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-068",
        "AIFACTORY-TASK-3295"
      ],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6403,
      "kind": "behavior",
      "traces": {
        "services": [
          "RepositoryIntelligenceService",
          "ToolAdapterService"
        ],
        "apis": [
          "RepositoryIntelligenceService/RepositoryIntelligence.ListFiles",
          "RepositoryIntelligenceService/RepositoryIntelligence.SearchText",
          "RepositoryIntelligenceService/RepositoryIntelligence.ReadRange"
        ],
        "tools": [
          "list-files",
          "search-text",
          "read-range"
        ],
        "descriptors": [
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0013",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "XL-03"
        ],
        "scenarios": [
          "SCN-RepositoryIntelligenceService-003",
          "SCN-RepositoryIntelligenceService-004",
          "SCN-RepositoryIntelligenceService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-816",
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/tools/list-files.yaml",
        "model/tools/search-text.yaml",
        "model/tools/read-range.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-817]",
      "number": 817
    },
    {
      "id": "AIFACTORY-TASK-068",
      "type": "task",
      "parent": "AIFACTORY-US-817",
      "title": "ListFiles, SearchText and ReadRange over the workspace view of the run",
      "sequence": "04.04.03.01",
      "description": "ListFiles, SearchText and ReadRange over the workspace view of the run. Expected output: The three methods are handlers of the tool component that ToolExecutorHost runs in the sandbox of the run (D125); they take the request message of AIFACTORY-TASK-069, take the tenant, the project and the run from the scope and the runId of the invocation and validate no token, validate the arguments member of the invocation against the argument shape of their tool, open the workspace view of AIFACTORY-TASK-3292 from the workspaceRef member of the request only and answer from it alone: ListFiles pages the entries that match the path prefix, the name pattern and the depth, a link being an entry of kind link that is not followed; SearchText returns matches of the text, under the optional path prefix, as path and line range through the generic-text analyzer; ReadRange returns at most Knowledge:Repositories:MaxRangeLines lines of the path and names the range returned; every reply cites the workspaceRef and leaves revision empty; the methods keep nothing between calls, so a call after a write to the workspace returns the new state; they answer INVALID_ARGUMENT (also for arguments outside the shape of the tool and for a sandbox.workspaceId that differs from the workspaceRef), NOT_FOUND (for a workspace of another tenant by ADR-0015 and for one of another project or run by the rule of the view), UNAVAILABLE for a mounted workspace that cannot be read and, for a call that overruns the deadline the executor passes, DEADLINE_EXCEEDED as the PBI states, write nothing and count the call in connectsoft.factory.repo_intelligence.tool_calls without content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three methods are handlers of the tool component that ToolExecutorHost runs in the sandbox of the run (D125); they take the request message of AIFACTORY-TASK-069, take the tenant, the project and the run from the scope and the runId of the invocation and validate no token, validate the arguments member of the invocation against the argument shape of their tool, open the workspace view of AIFACTORY-TASK-3292 from the workspaceRef member of the request only and answer from it alone: ListFiles pages the entries that match the path prefix, the name pattern and the depth, a link being an entry of kind link that is not followed; SearchText returns matches of the text, under the optional path prefix, as path and line range through the generic-text analyzer; ReadRange returns at most Knowledge:Repositories:MaxRangeLines lines of the path and names the range returned; every reply cites the workspaceRef and leaves revision empty; the methods keep nothing between calls, so a call after a write to the workspace returns the new state; they answer INVALID_ARGUMENT (also for arguments outside the shape of the tool and for a sandbox.workspaceId that differs from the workspaceRef), NOT_FOUND (for a workspace of another tenant by ADR-0015 and for one of another project or run by the rule of the view), UNAVAILABLE for a mounted workspace that cannot be read and, for a call that overruns the deadline the executor passes, DEADLINE_EXCEEDED as the PBI states, write nothing and count the call in connectsoft.factory.repo_intelligence.tool_calls without content."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-068]",
      "number": 68
    },
    {
      "id": "AIFACTORY-TASK-3295",
      "type": "task",
      "parent": "AIFACTORY-US-817",
      "title": "Verify the three file tools through the acceptance suite",
      "sequence": "04.04.03.02",
      "description": "Verify the three file tools through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RepositoryIntelligenceService-003|Scenario=SCN-RepositoryIntelligenceService-004|Scenario=SCN-RepositoryIntelligenceService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-817 with the tool component over the sandbox fixtures of AIFACTORY-TASK-3293: the filtered and paged listing, the matches as ranges, the read after a write, in which a file is added and a line is changed between two calls and ListFiles, SearchText and ReadRange return the new entry, the new match and the changed line, the cap of ReadRange on a long file, the refusals with the fixture of two tenants, two projects and two runs, in which no call validates a token, the arguments outside the shape of a tool, the differing sandbox.workspaceId, the mount that cannot be read, the reads slowed beyond the deadline answered DEADLINE_EXCEEDED for each of the three methods and a scan of the captured logs, activities and metrics for query text and file lines.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RepositoryIntelligenceService-003|Scenario=SCN-RepositoryIntelligenceService-004|Scenario=SCN-RepositoryIntelligenceService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-817 with the tool component over the sandbox fixtures of AIFACTORY-TASK-3293: the filtered and paged listing, the matches as ranges, the read after a write, in which a file is added and a line is changed between two calls and ListFiles, SearchText and ReadRange return the new entry, the new match and the changed line, the cap of ReadRange on a long file, the refusals with the fixture of two tenants, two projects and two runs, in which no call validates a token, the arguments outside the shape of a tool, the differing sandbox.workspaceId, the mount that cannot be read, the reads slowed beyond the deadline answered DEADLINE_EXCEEDED for each of the three methods and a scan of the captured logs, activities and metrics for query text and file lines."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3295]",
      "number": 3295
    },
    {
      "id": "AIFACTORY-US-818",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-020",
      "title": "Answer symbols, references and dependencies of the workspace of a run on demand, without an index",
      "sequence": "04.04.04",
      "description": "As a requester, I want the agents of my run to find a symbol, its references and the dependencies of a path in the code the run has written so far, so that a step changes the right place and knows what depends on it before any repository index exists. An agent of the chain calls `search-symbols`, `find-references` or `get-dependencies` through ToolAdapterService. The call is executed inside the sandbox of the run, where ToolExecutorHost runs the read-tool component over the workspace mounted read-only (D125), and reaches `RepositoryIntelligence.SearchSymbols`, `RepositoryIntelligence.FindReferences` or `RepositoryIntelligence.GetDependencies` of the component with the invocation of `tool-invocation-v1` and the `workspaceRef` of the run; the component validates no token, as AIFACTORY-US-817 states. The arguments of each tool are the `arguments` member of the invocation, in the shape the contract test of AIFACTORY-TASK-069 fixes: a name, a kind and a container for `SearchSymbols`, a symbol for `FindReferences` and a path or a symbol for `GetDependencies`. In the complete service these three tools read the entities `SymbolEntry` and `DependencyEdge` of a Ready index set. The thin delivery has no index set, so it writes no row to `Symbols` or `DependencyEdges` and computes each answer on demand from the files of the workspace view (AIFACTORY-US-816), with the language analyzers that `Knowledge:Repositories:Analyzers` enables, `dotnet-roslyn`, `typescript` and `generic-text` by default. The files of a workspace were written by agents of the run, and the analysis runs in the component inside the sandbox of the run, over a mount it cannot write to. It still reads source files and project files as data only, a reading D125 records for the on-demand analysis: it executes no target, no task and no script of the workspace, restores no package and makes no network call, because build and test are no part of this service (invariant of the model) and every read is bounded by the root of the workspace (AIFACTORY-US-816). A project reference, an import or a package path that resolves outside the root is not followed and is named in the partial mark of the reply. The version of a package edge is the version a file of the workspace declares; a package that only a restore would reveal is not reported. `SearchSymbols` returns symbols by name, kind and container, each in the shape of a symbol entry of the model: name, kind (namespace, type, member, method, property, field or event), path, start line, end line and container. `FindReferences` returns the references and the callers of one symbol as paths with line ranges. `GetDependencies` returns the edges of a path or a symbol in the shape of a dependency edge of the model: kind (project, package, call or test coverage), from, to and, for a package, its version. Answers are paged and name locations as ranges; the content of a location is read through `ReadRange`. A workspace is working state and may not compile. The analyzers answer from what parses and binds; when a project does not load or a file does not bind, the reply is marked partial and names the projects or paths that were not analysed, and a partial answer is never presented as complete. A path or a symbol in a language that no enabled analyzer covers yields an empty, well-formed result that names the language as not analysed. This is the thin form of the failure mode of the model in which an analyzer fails on a language or a project: no index set exists that could be set Failed, and `SearchText`, `ListFiles` and `ReadRange` keep answering because they need no language analyzer. How deep the on-demand analysis goes for a workspace that does not compile, bound semantics or syntax alone, is reported to the owner; the contract carries the partial mark either way. Every reply cites the `workspaceRef` and leaves `revision` empty. The three methods are of class read, write nothing and publish no event. Nothing of an analysis is kept after the call: the thin delivery holds no cache of an analysis, in memory or elsewhere, because the workspace view yields no state of a workspace by which a cache could be keyed. Each call analyses the workspace as it is at that moment, so a call made after a write tool of the run added or changed a symbol returns the new state and no entry of an earlier analysis; a stale symbol, reference or edge is the defect this rule excludes. A request without a `workspaceRef`, without the tenant, the project or the run in the invocation, without a symbol or a path to look for, with arguments that do not match the shape of the tool, with a `sandbox.workspaceId` in the invocation that differs from the `workspaceRef`, or with a path that leaves the workspace is refused with INVALID_ARGUMENT, and a `workspaceRef`, a tenant, a project or a run that is not the one of the lease that mounted the workspace with NOT_FOUND: for a workspace of another tenant as ADR-0015 amendment D113 decides, and for a workspace of another run or project of the same tenant and for an unknown reference by the rule of the workspace view (AIFACTORY-US-816), with the same reply in every case. An analysis that does not finish within the deadline of the call ends with DEADLINE_EXCEEDED and returns nothing as if complete; a mounted workspace that cannot be read ends the call with UNAVAILABLE. In both cases ToolAdapterService ends the tool call Failed with the failure class transient in its own PBI. Each call is counted in `connectsoft.factory.repo_intelligence.tool_calls` with tenant, project and tool, and no symbol name, path or source line reaches telemetry (ADR-0019). Kind: behavior. Traces: services: RepositoryIntelligenceService, ToolAdapterService; apis: RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols, RepositoryIntelligenceService/RepositoryIntelligence.FindReferences, RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies; tools: search-symbols, find-references, get-dependencies; descriptors: tool-invocation-v1; adrs: ADR-0015, ADR-0019, ADR-0022; requirements: FR-05, XL-03; scenarios: SCN-RepositoryIntelligenceService-005, SCN-RepositoryIntelligenceService-006, SCN-RepositoryIntelligenceService-008. Depends on: AIFACTORY-US-816, AIFACTORY-US-817, feature:component-base-template-factory-profile, feature:component-observability-factory-conventions. Sources: model/services/knowledge/RepositoryIntelligenceService.yaml, model/tools/search-symbols.yaml, model/tools/find-references.yaml, model/tools/get-dependencies.yaml, docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the fixture workspace with a .NET project and a TypeScript project, when `RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols` is called with a name, a kind and a container, then the reply holds the matching symbols of that workspace with name, kind, path, start line, end line and container, paged, with the `workspaceRef` and an empty `revision`, and no row exists in `Symbols` afterwards (SCN-RepositoryIntelligenceService-005, FR-05).",
        "AC2: Given a method of the .NET project that two other files call, when `RepositoryIntelligenceService/RepositoryIntelligence.FindReferences` is called for that symbol, then the reply holds each reference and each caller as a path with its line range and no location outside the workspace, and a second call over the unchanged workspace returns the same locations; given a symbol with one caller added to a file of the fixture workspace between two calls, when `RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols`, `RepositoryIntelligenceService/RepositoryIntelligence.FindReferences` and `RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies` are called again, then each reply holds the new state, the new symbol, its reference and its call edge, and no entry of the earlier analysis (SCN-RepositoryIntelligenceService-005, SCN-RepositoryIntelligenceService-006, SCN-RepositoryIntelligenceService-008, XL-03).",
        "AC3: Given a project of the workspace that references another project and two packages and is covered by a test project, when `RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies` is called for its path, then the reply holds the edges of kind project, package, call and test coverage with from, to and the package versions, and no row exists in `DependencyEdges` afterwards (SCN-RepositoryIntelligenceService-008, model/services/knowledge/RepositoryIntelligenceService.yaml).",
        "AC4: Given a workspace in which one project does not load, one project file declares a target with a command and a project reference that leaves the root, and one file is written in a language no enabled analyzer covers, when the three methods are called, then each reply is marked partial and names the project that was not analysed and the reference that leaves the root, the command of the declared target did not run, no package was restored, no network call was made and nothing outside the root was read, the file of the uncovered language yields an empty, well-formed result that names the language, no partial answer is presented as complete, and `RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols` still answers for the projects that loaded (SCN-RepositoryIntelligenceService-005, SCN-RepositoryIntelligenceService-006, SCN-RepositoryIntelligenceService-008).",
        "AC5: Given a request without a `workspaceRef` or without a symbol or path, a `workspaceRef` of another tenant or run, an analysis that exceeds the deadline of the call and a mounted workspace that cannot be read, when any of the three methods is called in the sandbox fixture, then the answer is INVALID_ARGUMENT, NOT_FOUND, DEADLINE_EXCEEDED or UNAVAILABLE respectively, no call validated a token, nothing is written, and no symbol name or source line reaches telemetry (SCN-RepositoryIntelligenceService-005, SCN-RepositoryIntelligenceService-006, SCN-RepositoryIntelligenceService-008, ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/tools/search-symbols.yaml",
        "model/tools/find-references.yaml",
        "model/tools/get-dependencies.yaml",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3296",
        "AIFACTORY-TASK-3297",
        "AIFACTORY-TASK-3298"
      ],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6404,
      "kind": "behavior",
      "traces": {
        "services": [
          "RepositoryIntelligenceService",
          "ToolAdapterService"
        ],
        "apis": [
          "RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols",
          "RepositoryIntelligenceService/RepositoryIntelligence.FindReferences",
          "RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies"
        ],
        "tools": [
          "search-symbols",
          "find-references",
          "get-dependencies"
        ],
        "descriptors": [
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "XL-03"
        ],
        "scenarios": [
          "SCN-RepositoryIntelligenceService-005",
          "SCN-RepositoryIntelligenceService-006",
          "SCN-RepositoryIntelligenceService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-816",
        "AIFACTORY-US-817",
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/tools/search-symbols.yaml",
        "model/tools/find-references.yaml",
        "model/tools/get-dependencies.yaml",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-818]",
      "number": 818
    },
    {
      "id": "AIFACTORY-TASK-3296",
      "type": "task",
      "parent": "AIFACTORY-US-818",
      "title": "SearchSymbols, FindReferences and GetDependencies computed on demand by the enabled analyzers over the workspace view",
      "sequence": "04.04.04.01",
      "description": "SearchSymbols, FindReferences and GetDependencies computed on demand by the enabled analyzers over the workspace view. Expected output: The three methods are handlers of the tool component that ToolExecutorHost runs in the sandbox of the run (D125); they take the request message of AIFACTORY-TASK-069, validate no token, validate the arguments member of the invocation against the argument shape of their tool, open the workspace view of AIFACTORY-TASK-3292 from the workspaceRef member of the request only and compute their answer per call with the analyzers of Knowledge:Repositories:Analyzers: symbols with name, kind, path, lines and container, references and callers as path and line range, edges of kind project, package, call and test coverage with from, to and version; the analysis reads source files and project files as data only: no target, task or script of the workspace is executed, no package is restored and no network call is made, the version of a package edge is the version a file of the workspace declares, and a project reference, import or package path that resolves outside the root is not followed and is named in the partial mark; answers are paged, cite the workspaceRef and leave revision empty; a project that does not load or a file that does not bind marks the reply partial with the unanalysed projects or paths named, a language without an analyzer yields an empty result that names it; nothing is written to Symbols or DependencyEdges and no cache of an analysis is held, in memory or elsewhere, so every call analyses the workspace as it is at that moment and a call after a write returns the new state; the methods answer INVALID_ARGUMENT, NOT_FOUND, DEADLINE_EXCEEDED and UNAVAILABLE as the PBI states and count the call in connectsoft.factory.repo_intelligence.tool_calls without content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The three methods are handlers of the tool component that ToolExecutorHost runs in the sandbox of the run (D125); they take the request message of AIFACTORY-TASK-069, validate no token, validate the arguments member of the invocation against the argument shape of their tool, open the workspace view of AIFACTORY-TASK-3292 from the workspaceRef member of the request only and compute their answer per call with the analyzers of Knowledge:Repositories:Analyzers: symbols with name, kind, path, lines and container, references and callers as path and line range, edges of kind project, package, call and test coverage with from, to and version; the analysis reads source files and project files as data only: no target, task or script of the workspace is executed, no package is restored and no network call is made, the version of a package edge is the version a file of the workspace declares, and a project reference, import or package path that resolves outside the root is not followed and is named in the partial mark; answers are paged, cite the workspaceRef and leave revision empty; a project that does not load or a file that does not bind marks the reply partial with the unanalysed projects or paths named, a language without an analyzer yields an empty result that names it; nothing is written to Symbols or DependencyEdges and no cache of an analysis is held, in memory or elsewhere, so every call analyses the workspace as it is at that moment and a call after a write returns the new state; the methods answer INVALID_ARGUMENT, NOT_FOUND, DEADLINE_EXCEEDED and UNAVAILABLE as the PBI states and count the call in connectsoft.factory.repo_intelligence.tool_calls without content."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3296]",
      "number": 3296
    },
    {
      "id": "AIFACTORY-TASK-3297",
      "type": "task",
      "parent": "AIFACTORY-US-818",
      "title": "Fixture projects for the analysis tools with known symbols, references, edges and a project that does not load",
      "sequence": "04.04.04.02",
      "description": "Fixture projects for the analysis tools with known symbols, references, edges and a project that does not load. Expected output: The fixture workspace of AIFACTORY-TASK-3293 is extended with a .NET project whose symbols, callers and references are listed in a golden file, a second .NET project it references, a test project that covers it, two package references with versions, a TypeScript project with exported symbols, a project file that does not load, a project file that declares a target with a command which would write a marker file if it ran and a project reference that leaves the root of the workspace toward a directory of the test host that holds a readable source file, and one source file in a language no enabled analyzer covers; the suite can add a symbol with one caller to a file of the fixture workspace between two calls; an analyzer double can be slowed beyond the deadline of a call; the test host records file reads outside the root and outbound network calls of the component process.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The fixture workspace of AIFACTORY-TASK-3293 is extended with a .NET project whose symbols, callers and references are listed in a golden file, a second .NET project it references, a test project that covers it, two package references with versions, a TypeScript project with exported symbols, a project file that does not load, a project file that declares a target with a command which would write a marker file if it ran and a project reference that leaves the root of the workspace toward a directory of the test host that holds a readable source file, and one source file in a language no enabled analyzer covers; the suite can add a symbol with one caller to a file of the fixture workspace between two calls; an analyzer double can be slowed beyond the deadline of a call; the test host records file reads outside the root and outbound network calls of the component process."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6404,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3297]",
      "number": 3297
    },
    {
      "id": "AIFACTORY-TASK-3298",
      "type": "task",
      "parent": "AIFACTORY-US-818",
      "title": "Verify the three analysis tools through the acceptance suite",
      "sequence": "04.04.04.03",
      "description": "Verify the three analysis tools through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RepositoryIntelligenceService-005|Scenario=SCN-RepositoryIntelligenceService-006|Scenario=SCN-RepositoryIntelligenceService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-818 against the golden file of the fixture projects: the symbols, the references and callers, the four kinds of edge, the read after a write, in which a symbol with one caller is added between two calls and SearchSymbols, FindReferences and GetDependencies return the new state and no entry of the earlier analysis, the partial mark for the project that does not load, the project file with a target and a reference that leaves the root, for which the marker file of the command does not exist, no read outside the root, no package restore and no network call was recorded and the reply is partial with the reference named, the empty result of the uncovered language, the refusals over the sandbox fixtures of two tenants, two projects and two runs, in which no call validates a token, the exceeded deadline, the mount that cannot be read, the empty tables Symbols and DependencyEdges and the scan of telemetry for symbol names and source lines.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RepositoryIntelligenceService-005|Scenario=SCN-RepositoryIntelligenceService-006|Scenario=SCN-RepositoryIntelligenceService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-818 against the golden file of the fixture projects: the symbols, the references and callers, the four kinds of edge, the read after a write, in which a symbol with one caller is added between two calls and SearchSymbols, FindReferences and GetDependencies return the new state and no entry of the earlier analysis, the partial mark for the project that does not load, the project file with a target and a reference that leaves the root, for which the marker file of the command does not exist, no read outside the root, no package restore and no network call was recorded and the reply is partial with the reference named, the empty result of the uncovered language, the refusals over the sandbox fixtures of two tenants, two projects and two runs, in which no call validates a token, the exceeded deadline, the mount that cannot be read, the empty tables Symbols and DependencyEdges and the scan of telemetry for symbol names and source lines."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3298]",
      "number": 3298
    },
    {
      "id": "AIFACTORY-US-819",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-020",
      "title": "Read the status and the diff of the workspace of a run through GetHistory, with an empty ownership part until an index exists",
      "sequence": "04.04.05",
      "description": "As a requester, I want the agents of my run to see which files the run changed and how, so that a step reviews the change of the run before a change set is proposed from it. An agent of the chain calls `get-git-diff` through ToolAdapterService. The call is executed inside the sandbox of the run, where ToolExecutorHost runs the read-tool component over the workspace mounted read-only (D125), and reaches `RepositoryIntelligence.GetHistory` of the component with the invocation of `tool-invocation-v1` and the `workspaceRef` of the run; the component validates no token, as AIFACTORY-US-817 states. The model gives this one method three reads: the diff, the status on the read side, and ownership, which is the history, the churn and the owners of a path. The catalogue entry of the tool, model/tools/get-git-diff.yaml, asks for the diff and the status of a workspace or between revisions. The thin delivery serves the part that a workspace can answer. The status lists the paths of the workspace that were added, modified, deleted or renamed against the base the workspace view reports (AIFACTORY-US-816). The diff returns, for the paths the request names or for all changed paths, the hunks of each change as line ranges with their lines; it is paged, and one answer holds at most `Knowledge:Repositories:MaxRangeLines` lines, so a large change is read in parts and never as one dump. The model defines that option as the maximum of lines a read_range answer returns and names no page size for a diff; its reuse as the page cap of a diff is a reading of the thin delivery and no model value, and it is reported to the owner with the open points of the reply contract. The optional paths are the `arguments` member of the invocation, in the shape the contract test of AIFACTORY-TASK-069 fixes. The base of a workspace is what the version control metadata of the mounted workspace records, the commit its working tree was checked out from; the view reads it from that metadata without writing to it (AIFACTORY-US-816), and the method takes the base from the view and decides nothing about it. The ownership part needs the entity `OwnershipEntry` of an index set, with last commit, last change, churn and owners per path. The thin delivery builds no index set, so that part of the reply is present, empty and well-formed, and the complete delivery fills it without a contract change. A request that names two revisions in place of a workspace is outside the thin scope, because the thin delivery holds no revision: it is refused with INVALID_ARGUMENT and a reason that says so. Every reply cites the `workspaceRef` and leaves `revision` empty. The method is of class read: it writes no row to `Ownership`, no artifact and no outbox record and publishes no event, it never changes the workspace or its version control state, and a repeated call over an unchanged workspace returns the same status and the same hunks, while a call made after a file changed returns the new status and hunks, because nothing is kept between calls. A request without a `workspaceRef`, without the tenant, the project or the run in the invocation, with arguments that do not match the shape of the tool, with a `sandbox.workspaceId` in the invocation that differs from the `workspaceRef` or with a path that leaves the workspace is refused with INVALID_ARGUMENT, and a `workspaceRef`, a tenant, a project or a run that is not the one of the lease that mounted the workspace with NOT_FOUND: for a workspace of another tenant as ADR-0015 amendment D113 decides, and for a workspace of another run or project of the same tenant and for an unknown reference by the rule of the workspace view (AIFACTORY-US-816), with the same reply in every case. A workspace that holds no version control metadata has no base: the status and the diff are then empty and well-formed and the reply says that the workspace has no base, so an empty diff is never mistaken for an unchanged workspace. When the mounted workspace cannot be read the method answers UNAVAILABLE. A call that does not finish within the deadline the executor passes, 30 seconds for `get-git-diff` in the catalogue, ends with DEADLINE_EXCEEDED and returns nothing as if complete, which a diff over a large workspace can reach. In both cases ToolAdapterService ends the tool call Failed with the failure class transient in its own PBI. Pushing the diff as a branch and opening a change proposal is the tool `propose-change-set` of ToolAdapterService behind its approval and is not served here (XL-10). The call is counted in `connectsoft.factory.repo_intelligence.tool_calls` with tenant, project and tool, and no path and no line of a diff reaches telemetry (ADR-0019). Kind: behavior. Traces: services: RepositoryIntelligenceService, ToolAdapterService; apis: RepositoryIntelligenceService/RepositoryIntelligence.GetHistory; tools: get-git-diff; descriptors: tool-invocation-v1; adrs: ADR-0015, ADR-0019, ADR-0022; requirements: FR-05, XL-10; scenarios: SCN-RepositoryIntelligenceService-009. Depends on: AIFACTORY-US-816, feature:component-base-template-factory-profile, feature:component-observability-factory-conventions. Sources: model/services/knowledge/RepositoryIntelligenceService.yaml, model/tools/get-git-diff.yaml, model/backlog/features/knowledge.yaml, docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given the fixture workspace with a base, one added, one modified and one deleted file, when `RepositoryIntelligenceService/RepositoryIntelligence.GetHistory` is called with the `workspaceRef` of the run, then the reply holds the three paths with their status against the base, the hunks of the two changed files as line ranges with their lines, the `workspaceRef`, an empty `revision` and an empty, well-formed ownership part, and the workspace and its version control state are unchanged (SCN-RepositoryIntelligenceService-009, FR-05).",
        "AC2: Given a change larger than `Knowledge:Repositories:MaxRangeLines`, the option the thin delivery reuses as the page cap of a diff, when `RepositoryIntelligenceService/RepositoryIntelligence.GetHistory` is called, then one answer holds at most the cap and a continuation token, the following calls return the remaining hunks, and a second pass over the unchanged workspace returns the same status and hunks (SCN-RepositoryIntelligenceService-009, model/tools/get-git-diff.yaml).",
        "AC3: Given a workspace without version control metadata, when the method is called, then status and diff are empty and well-formed and the reply states that the workspace has no base; given a request that names two revisions in place of a workspace, then it is refused with INVALID_ARGUMENT and the reason that the thin delivery holds no revision, as model/backlog/features/knowledge.yaml states its scope (SCN-RepositoryIntelligenceService-009).",
        "AC4: Given a request without a `workspaceRef` or with a path that leaves the workspace, a `workspaceRef` of another tenant or of another project or run of the same tenant, a mounted workspace that cannot be read and reads of the mounted workspace that are slower than the deadline the executor passes, when the method is called in the sandbox fixture, then the answer is INVALID_ARGUMENT, NOT_FOUND, UNAVAILABLE or DEADLINE_EXCEEDED respectively, no call validated a token, nothing is returned as if complete, no row exists in `Ownership`, nothing is published, and no path or diff line reached telemetry (SCN-RepositoryIntelligenceService-009, ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/tools/get-git-diff.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3299",
        "AIFACTORY-TASK-3300"
      ],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6405,
      "kind": "behavior",
      "traces": {
        "services": [
          "RepositoryIntelligenceService",
          "ToolAdapterService"
        ],
        "apis": [
          "RepositoryIntelligenceService/RepositoryIntelligence.GetHistory"
        ],
        "tools": [
          "get-git-diff"
        ],
        "descriptors": [
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "XL-10"
        ],
        "scenarios": [
          "SCN-RepositoryIntelligenceService-009"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-816",
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/tools/get-git-diff.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/repository-intelligence-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-819]",
      "number": 819
    },
    {
      "id": "AIFACTORY-TASK-3299",
      "type": "task",
      "parent": "AIFACTORY-US-819",
      "title": "GetHistory over the workspace view with status, paged diff hunks and an empty ownership part",
      "sequence": "04.04.05.01",
      "description": "GetHistory over the workspace view with status, paged diff hunks and an empty ownership part. Expected output: The method is a handler of the tool component that ToolExecutorHost runs in the sandbox of the run (D125); it takes the request message of AIFACTORY-TASK-069, validates no token, validates the arguments member of the invocation against the argument shape of get-git-diff (optional paths), opens the workspace view of AIFACTORY-TASK-3292 from the workspaceRef member of the request only and returns the status of the changed paths against the base the view reads from the version control metadata of the mounted workspace and the hunks of the named or of all changed paths as line ranges with their lines, paged with at most Knowledge:Repositories:MaxRangeLines lines per answer, a reuse of that option which is a reading of the thin delivery; nothing is kept between calls, so a call after a change returns the new status; the ownership part is present and empty; a workspace without a base yields an empty status and diff and the reply says so; a request that names revisions is refused with INVALID_ARGUMENT; the reply cites the workspaceRef and leaves revision empty; the method never changes the workspace, writes nothing to Ownership, answers INVALID_ARGUMENT, NOT_FOUND, UNAVAILABLE and, for a call that overruns the deadline the executor passes, DEADLINE_EXCEEDED as the PBI states and counts the call in connectsoft.factory.repo_intelligence.tool_calls without content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The method is a handler of the tool component that ToolExecutorHost runs in the sandbox of the run (D125); it takes the request message of AIFACTORY-TASK-069, validates no token, validates the arguments member of the invocation against the argument shape of get-git-diff (optional paths), opens the workspace view of AIFACTORY-TASK-3292 from the workspaceRef member of the request only and returns the status of the changed paths against the base the view reads from the version control metadata of the mounted workspace and the hunks of the named or of all changed paths as line ranges with their lines, paged with at most Knowledge:Repositories:MaxRangeLines lines per answer, a reuse of that option which is a reading of the thin delivery; nothing is kept between calls, so a call after a change returns the new status; the ownership part is present and empty; a workspace without a base yields an empty status and diff and the reply says so; a request that names revisions is refused with INVALID_ARGUMENT; the reply cites the workspaceRef and leaves revision empty; the method never changes the workspace, writes nothing to Ownership, answers INVALID_ARGUMENT, NOT_FOUND, UNAVAILABLE and, for a call that overruns the deadline the executor passes, DEADLINE_EXCEEDED as the PBI states and counts the call in connectsoft.factory.repo_intelligence.tool_calls without content."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3299]",
      "number": 3299
    },
    {
      "id": "AIFACTORY-TASK-3300",
      "type": "task",
      "parent": "AIFACTORY-US-819",
      "title": "Verify the diff and the status of a workspace through the acceptance suite",
      "sequence": "04.04.05.02",
      "description": "Verify the diff and the status of a workspace through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RepositoryIntelligenceService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-819 with the tool component over the sandbox fixtures of AIFACTORY-TASK-3293: the status and the hunks against the base, the paged large change, the workspace without a base, the refused request by revisions, the refusals over the sandbox fixtures of two tenants, two projects and two runs, in which no call validates a token, the mount that cannot be read, the reads slowed beyond the deadline answered DEADLINE_EXCEEDED, the new status and hunks of a call made after a file changed, the unchanged workspace after every call, the empty table Ownership and the scan of telemetry for paths and diff lines.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RepositoryIntelligenceService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-819 with the tool component over the sandbox fixtures of AIFACTORY-TASK-3293: the status and the hunks against the base, the paged large change, the workspace without a base, the refused request by revisions, the refusals over the sandbox fixtures of two tenants, two projects and two runs, in which no call validates a token, the mount that cannot be read, the reads slowed beyond the deadline answered DEADLINE_EXCEEDED, the new status and hunks of a call made after a file changed, the unchanged workspace after every call, the empty table Ownership and the scan of telemetry for paths and diff lines."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 64,
      "phase": "factory",
      "stackRank": 6405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3300]",
      "number": 3300
    },
    {
      "id": "AIFACTORY-FEAT-021",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "VectorMemoryService: thin delivery for the first outcome",
      "sequence": "04.05",
      "description": "VectorMemoryService is the service of bounded context BC-11 (Retrieval & Indexes). The retrieval module (historical name kept from the June-2026 catalog) — vector, full-text, symbol, metadata, graph-projection and temporal retrieval combined under trusted scope with ACL enforced before top-k, citations with source version and index revision, embedding and index revisions pinned to profiles, and rebuildable derived indexes (BC-11, ADR-0013). In this increment it is delivered thin: The knowledge-search and graph-query tools answer with an empty, well-formed result; no index exists. Its own repository is ConnectSoft.AI.SoftwareFactory.VectorMemoryService. Delivers: VectorMemoryService (thin: The knowledge-search and graph-query tools answer with an empty, well-formed result; no index exists.). Increment I1: Generate a microservice. Build order 65 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-063",
        "AIFACTORY-US-820",
        "AIFACTORY-US-821"
      ],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6500,
      "titlePrefix": "[AIFACTORY-FEAT-021]",
      "number": 21
    },
    {
      "id": "AIFACTORY-US-063",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-021",
      "title": "VectorMemoryService answers the chain with its thin contract",
      "sequence": "04.05.01",
      "description": "As a requester, I want VectorMemoryService to answer the knowledge tools of my run with an honest, well-formed empty result while no index exists, so that an agent of the chain can call its knowledge tools without failing and never receives an invented citation. This is the integration PBI of the thin delivery. VectorMemoryService is the retrieval service of bounded context BC-11: in its complete form it combines vector, full-text, symbol, metadata, graph and temporal retrieval under a trusted scope, with the scope enforced by the backend before top-k and a citation on every item (ADR-0013). That form arrives with feature `vector-memory-service-complete` in I5. ADR-0013 decision 4 states that indexed retrieval is no prerequisite for the first governed workflow, and the first outcome ingests nothing. The thin scope is exactly this: the tools `knowledge-search` and `graph-query` answer with an empty, well-formed result, and no index exists. Both tools are owned by this service in the catalogue under model/tools, and every agent of the chain may call them through ToolAdapterService, the governed executor (ADR-0022 decision 2), whose executor forwards the invocation to the gRPC method of the tool. For `knowledge-search` the model names that method: `Retrieval.Retrieve` is the scoped retrieval for context assembly and for the knowledge-search tool. For `graph-query` the model names no gRPC method; `Retrieval.ExpandGraph` is the only graph method on the internal surface, and the REST operation `QueryGraph` has no route before the gateway of I3, so the thin delivery answers the tool through `Retrieval.ExpandGraph` and reports the gap to the owner. Whether a tool call needs an approval is decided by the policy decision of the executor pipeline alone; this service evaluates none and writes no audit evidence, because audit is the last stage of that pipeline. The caller presents a workload token, which carries service scopes and no tenant claim, so the service reads the tenant and the project the caller forwards only when the token holds the service scope that names VectorMemoryService (ADR-0015 amendment D114). The two internal methods are therefore admitted by the service scope alone. The model lists the scope `factory.knowledge.read` with the summary scoped search and graph query; a workload token holds service scopes only and cannot hold that scope, so `factory.knowledge.read` guards the public REST operations `Search`, `QueryGraph` and `ListIndexRevisions` of the complete delivery, and the wording of its summary is reported as a correction of the service file. Before it answers, each method resolves what the forwarded scope may retrieve from through `Ingestion.GetSourceScope` of KnowledgeIngestionService, a required, fail-fast dependency of the model whose thin delivery answers that call with no source and no collection (feature `knowledge-ingestion-service-thin`). The service makes that call under its own identity: it presents its own workload token, which holds the service scope that names KnowledgeIngestionService, forwards the tenant and the project of the incoming call and never forwards the token of its caller, whose service scope names this service and not that one (ADR-0015 amendment D114); the call is bounded by the deadline of the incoming call. The thin scope does not say whether the empty answer is given with or without that call; the delivery makes it, because a failed scope resolution must not read as an empty result, and reports the reading to the owner. The feature is delivered by two further PBIs, one per method (AIFACTORY-US-820 and AIFACTORY-US-821). Nothing else is served. The REST operations `Search`, `QueryGraph`, `ListIndexRevisions` and `RebuildIndexes`, the aggregates `IndexRevision` with its six transitions, `GraphFact` and `RetrievalQuery`, the five events, the workers `IndexBuilder`, `GraphExtractor` and `BackendHealthProbe` and the six consumed events arrive with the complete delivery; the handler of `DeletionOrderIssued` is built in I4 with RetentionResidencyService and is not registered here. The thin delivery delivers no aggregate, so no state transition exists to cover. It writes no row to `vector-memory-sql`, records no `RetrievalQuery`, writes no outbox record and publishes no `RetrievalExecuted`, because the thin scope names the answer and nothing else. It binds no vector backend: `Knowledge:VectorProfile:Kind` is not read, the secret `vector-index` is not referenced, and the contract test of ADR-0013 for the scope filter of a backend belongs to the complete delivery. It makes no model call: embedding through `ModelGateway.Embed` of ModelRouterService with the model profile `embedding` and reranking through `ModelGateway.Rerank` with the profile `reranker` are delivered in I1 behind ports of that service and are first called by the complete delivery, since there is nothing to embed or to rank. It calls ArtifactService for no citation payload, since there is no citation. The repository ConnectSoft.AI.SoftwareFactory.VectorMemoryService is created and scaffolded in I0 by AIFACTORY-TASK-070 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold, and is scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`), so token validation, the scope chain with its 401, 403 and 404 answers, health, readiness, the messaging profile `vector-memory` and the telemetry wiring come from the profile; the profile writes the run event envelope of the pinned contracts package through the Orleans outbox in the transaction of a command, and the thin delivery, which has no command, leaves the outbox empty. The model names `context-snapshot-v1` as the request and as the reply descriptor of both methods. model/descriptors.yaml lists no descriptor of that id; the schema docs/reference/schemas/context-snapshot.schema.json is registered there as `context-package-v1` and describes the context package of one attempt, with no shape for a retrieval request or for cited candidates with ranking signals. That is reported to the owner, and the thin delivery makes its contract checkable without deciding it: the proto fixes the request and the reply message of each method, the reply with the citation members the invariant of the model requires on every item (source id, source version, chunk id, embedding profile version and index revision), and the thin delivery returns those lists empty, so the complete delivery fills the same messages. The request of each method carries typed members and no invocation of `tool-invocation-v1`, because `Retrieval.Retrieve` also serves context assembly, which makes no tool call. The executor of ToolAdapterService, the one caller of this increment, fills the typed members from the invocation of the tool: the scope from its `scope` member, the run from its `runId` and the rest from its `arguments`. For `knowledge-search` the query and the optional number of candidates of the arguments become the query and the number of candidates of `Retrieval.Retrieve`. For `graph-query` the query, the graph domains and the temporal filter of the arguments become the query, the graph domains and the temporal validity of `Retrieval.ExpandGraph`, and the entity list of that request stays empty. The contract test holds golden files of both calls as the executor makes them, so the claim that a caller runs against this service without a fake is proven for the caller that exists. Feature `tool-adapter-service` names no method of VectorMemoryService for either tool; that is reported to the owner. Each call is counted in `connectsoft.factory.knowledge.retrievals` and timed in `connectsoft.factory.knowledge.retrieval_latency` through the helper of the pinned observability library, which puts the tenant and the project on the instruments. The model gives the counter the dimensions tenant, `indexKinds` and outcome: `indexKinds` is recorded empty in the thin delivery, because no index exists, and the outcome values of this delivery are empty and failed. No query text reaches a log record, an activity or a metric (ADR-0019). Kind: behavior. Traces: services: VectorMemoryService, KnowledgeIngestionService; apis: VectorMemoryService/Retrieval.Retrieve, VectorMemoryService/Retrieval.ExpandGraph, KnowledgeIngestionService/Ingestion.GetSourceScope; tools: knowledge-search, graph-query; adrs: ADR-0005, ADR-0013, ADR-0015, ADR-0019, ADR-0022, ADR-0028; requirements: FR-07. Depends on: AIFACTORY-US-820, AIFACTORY-US-821, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-observability-factory-conventions, feature:contracts-package, feature:knowledge-ingestion-service-thin. Sources: model/services/knowledge/VectorMemoryService.yaml, model/backlog/features/knowledge.yaml, model/descriptors.yaml, docs/reference/schemas/context-snapshot.schema.json, docs/architecture/adr/0013-vector-store-profiles.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/knowledge-memory/services/vector-memory-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.VectorMemoryService created and scaffolded in I0 by AIFACTORY-TASK-070 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.VectorMemoryService --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 with complete reports and a container image is published (ADR-0028, model/services/knowledge/VectorMemoryService.yaml).",
        "AC2: Given a workload token that holds the service scope and a forwarded tenant and project, when `VectorMemoryService/Retrieval.Retrieve` and `VectorMemoryService/Retrieval.ExpandGraph` are called, then each resolves the scope through `KnowledgeIngestionService/Ingestion.GetSourceScope` with the own workload token of the service and never the token of its caller, and answers with the reply message the contract test fixes, holding no candidate, no fact, no citation and no index revision, as AIFACTORY-US-820 and AIFACTORY-US-821 prove one by one (ADR-0013, FR-07).",
        "AC3: Given the service descriptor of the thin delivery, when the contract test compares it with the hosted surface, then exactly `VectorMemoryService/Retrieval.Retrieve` and `VectorMemoryService/Retrieval.ExpandGraph` are hosted, no REST operation answers, the `OrleansMessaging` section declares no published and no consumed event, `vector-memory-sql` holds no row, no vector backend is bound and no call to a model profile is made, and the test fails when an operation outside the thin scope stated in model/backlog/features/knowledge.yaml appears.",
        "AC4: Given a call without a workload identity or with a token that lacks the service scope, when it reaches either method, then it is refused before any handler runs and nothing is resolved (ADR-0015); given the service starts, when liveness and readiness are probed, then liveness answers, readiness is ready once the identity authority is reachable, and the health detail names KnowledgeIngestionService with its state and no vector backend (model/services/knowledge/VectorMemoryService.yaml).",
        "AC5: Given calls of two tenants and two projects through both methods, when the metrics, the logs and the activities are read, then `connectsoft.factory.knowledge.retrievals` counts every call with its tenant, its project, the modelled dimension `indexKinds` recorded empty because no index exists, and its outcome, which is empty or failed in this delivery, `connectsoft.factory.knowledge.retrieval_latency` holds its duration, and no record holds query text or an entity name (ADR-0019, model/services/knowledge/VectorMemoryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/backlog/features/knowledge.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/context-snapshot.schema.json",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/vector-memory-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-072",
        "AIFACTORY-TASK-3301",
        "AIFACTORY-TASK-765"
      ],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6501,
      "kind": "behavior",
      "traces": {
        "services": [
          "VectorMemoryService",
          "KnowledgeIngestionService"
        ],
        "apis": [
          "VectorMemoryService/Retrieval.Retrieve",
          "VectorMemoryService/Retrieval.ExpandGraph",
          "KnowledgeIngestionService/Ingestion.GetSourceScope"
        ],
        "tools": [
          "knowledge-search",
          "graph-query"
        ],
        "adrs": [
          "ADR-0005",
          "ADR-0013",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-820",
        "AIFACTORY-US-821",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-observability-factory-conventions",
        "feature:contracts-package",
        "feature:knowledge-ingestion-service-thin"
      ],
      "source": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/backlog/features/knowledge.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/context-snapshot.schema.json",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/vector-memory-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-063]",
      "number": 63
    },
    {
      "id": "AIFACTORY-TASK-072",
      "type": "task",
      "parent": "AIFACTORY-US-063",
      "title": "Contract of the thin surface: service descriptor and proto of Retrieve and ExpandGraph with citation members that stay empty, and the two calls as the tool executor makes them",
      "sequence": "04.05.01.01",
      "description": "Contract of the thin surface: service descriptor and proto of Retrieve and ExpandGraph with citation members that stay empty, and the two calls as the tool executor makes them. Expected output: The service descriptor file of the repository lists exactly Retrieval.Retrieve and Retrieval.ExpandGraph, both internal, unary and of class read. The request of each method carries typed members and no invocation of tool-invocation-v1, because Retrieve also serves context assembly, which makes no tool call. The proto fixes the request message of Retrieve (the forwarded scope as execution-scope-v1, the run, the query, the filters and the optional number of candidates asked for), the request message of ExpandGraph (the forwarded scope, the run, an optional list of entities, an optional query, the graph domains and the temporal validity) and one reply message per method: candidates with ranking signals and, per item, source id, source version, chunk id, embedding profile version and index revision for Retrieve, facts with provenance and trust tier and neighbours for ExpandGraph, and the list of index revisions used. The contract states the mapping the executor of feature tool-adapter-service applies when it fills the typed members from the invocation of a tool: the scope from the scope member and the run from the runId member of the invocation; for knowledge-search the query and the optional number of candidates of the arguments to the query and the number of candidates of Retrieve; for graph-query the query, the graph domains and the temporal filter of the arguments to the query, the graph domains and the temporal validity of ExpandGraph, with the entity list left empty. A contract test with golden files in this repository holds the two request and the two reply shapes and, beside them, two golden calls as the executor makes them, one of Retrieve for knowledge-search and one of ExpandGraph for graph-query with a query, the domain Code, a temporal filter and no entity; these two golden calls are named as the shapes the executor of feature tool-adapter-service calls, and the test asserts that the service accepts each and that the thin delivery returns every list empty; it does not validate a message against docs/reference/schemas/context-snapshot.schema.json, which describes a context package and not a retrieval, and that difference is the open point the PBI reports. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake and the complete delivery fills the same messages without a contract change.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file of the repository lists exactly Retrieval.Retrieve and Retrieval.ExpandGraph, both internal, unary and of class read. The request of each method carries typed members and no invocation of tool-invocation-v1, because Retrieve also serves context assembly, which makes no tool call. The proto fixes the request message of Retrieve (the forwarded scope as execution-scope-v1, the run, the query, the filters and the optional number of candidates asked for), the request message of ExpandGraph (the forwarded scope, the run, an optional list of entities, an optional query, the graph domains and the temporal validity) and one reply message per method: candidates with ranking signals and, per item, source id, source version, chunk id, embedding profile version and index revision for Retrieve, facts with provenance and trust tier and neighbours for ExpandGraph, and the list of index revisions used. The contract states the mapping the executor of feature tool-adapter-service applies when it fills the typed members from the invocation of a tool: the scope from the scope member and the run from the runId member of the invocation; for knowledge-search the query and the optional number of candidates of the arguments to the query and the number of candidates of Retrieve; for graph-query the query, the graph domains and the temporal filter of the arguments to the query, the graph domains and the temporal validity of ExpandGraph, with the entity list left empty. A contract test with golden files in this repository holds the two request and the two reply shapes and, beside them, two golden calls as the executor makes them, one of Retrieve for knowledge-search and one of ExpandGraph for graph-query with a query, the domain Code, a temporal filter and no entity; these two golden calls are named as the shapes the executor of feature tool-adapter-service calls, and the test asserts that the service accepts each and that the thin delivery returns every list empty; it does not validate a message against docs/reference/schemas/context-snapshot.schema.json, which describes a context package and not a retrieval, and that difference is the open point the PBI reports. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake and the complete delivery fills the same messages without a contract change."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6501,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-072]",
      "number": 72
    },
    {
      "id": "AIFACTORY-TASK-3301",
      "type": "task",
      "parent": "AIFACTORY-US-063",
      "title": "Deployment values of the thin service: replica range, probes, messaging service name and the base address of the ingestion service",
      "sequence": "04.05.01.02",
      "description": "Deployment values of the thin service: replica range, probes, messaging service name and the base address of the ingestion service. Expected output: The deployment manifest states the replica range 2 to 10 of model/services/knowledge/VectorMemoryService.yaml, the liveness and readiness probes, the messaging service name vector-memory, the secret reference messaging-transport by name and never by value, and one base address for KnowledgeIngestionService from configuration; the workload identity of the service is the one the typed client of Ingestion.GetSourceScope presents, with the service scope that names KnowledgeIngestionService, and the manifest holds no credential by value; it references no vector-index secret, binds no vector backend and no base address of ModelRouterService or ArtifactService, which the thin delivery does not call; connectsoft.factory.knowledge.retrievals and connectsoft.factory.knowledge.retrieval_latency are registered through the helper of the pinned observability library with tenant and project; the modelled dimension indexKinds of the counter is recorded empty in the thin delivery and its outcome dimension takes the values empty and failed.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "The deployment manifest states the replica range 2 to 10 of model/services/knowledge/VectorMemoryService.yaml, the liveness and readiness probes, the messaging service name vector-memory, the secret reference messaging-transport by name and never by value, and one base address for KnowledgeIngestionService from configuration; the workload identity of the service is the one the typed client of Ingestion.GetSourceScope presents, with the service scope that names KnowledgeIngestionService, and the manifest holds no credential by value; it references no vector-index secret, binds no vector backend and no base address of ModelRouterService or ArtifactService, which the thin delivery does not call; connectsoft.factory.knowledge.retrievals and connectsoft.factory.knowledge.retrieval_latency are registered through the helper of the pinned observability library with tenant and project; the modelled dimension indexKinds of the counter is recorded empty in the thin delivery and its outcome dimension takes the values empty and failed."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6501,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-3301]",
      "number": 3301
    },
    {
      "id": "AIFACTORY-TASK-765",
      "type": "task",
      "parent": "AIFACTORY-US-063",
      "title": "Verify vector-memory-service-thin-contract by running the declared command",
      "sequence": "04.05.01.03",
      "description": "Verify vector-memory-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-063, that is the scaffold, both methods answered empty after the scope was resolved (SCN-VectorMemoryService-005, SCN-VectorMemoryService-006), the thin surface with its empty store, its empty messaging section, no vector backend and no model call, the golden files of the request and reply messages and of the two calls as the executor of feature tool-adapter-service makes them for knowledge-search and graph-query, the scope resolved with the own workload token of the service, the refusal of a caller without workload identity, the health detail and the telemetry conformance test over two tenants and two projects.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-063, that is the scaffold, both methods answered empty after the scope was resolved (SCN-VectorMemoryService-005, SCN-VectorMemoryService-006), the thin surface with its empty store, its empty messaging section, no vector backend and no model call, the golden files of the request and reply messages and of the two calls as the executor of feature tool-adapter-service makes them for knowledge-search and graph-query, the scope resolved with the own workload token of the service, the refusal of a caller without workload identity, the health detail and the telemetry conformance test over two tenants and two projects."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-765]",
      "number": 765
    },
    {
      "id": "AIFACTORY-US-820",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-021",
      "title": "Answer the knowledge-search tool through Retrieval.Retrieve with an empty, well-formed result under the resolved scope",
      "sequence": "04.05.02",
      "description": "As a requester, I want a knowledge search of an agent of my run to return a well-formed result that holds nothing while nothing is indexed, so that the agent goes on with the artifacts of its step and is never handed a citation that no source backs. An agent of the chain calls the tool `knowledge-search`, and the executor of ToolAdapterService forwards the invocation to the internal gRPC method `Retrieval.Retrieve`. The thin ContextBuilderService of this increment passes the pinned artifacts of a step through and makes no retrieval, so the tool is the only caller. The caller presents a workload token; the service reads the forwarded tenant and project only when the token holds the service scope that names VectorMemoryService (ADR-0015 amendment D114). The request message carries typed members that the executor fills from the invocation of the tool, the scope from its `scope` member, the run from its `runId` and the query and the optional number of candidates from its `arguments` (AIFACTORY-TASK-072). The method validates the request message and then resolves what that scope may retrieve from through `Ingestion.GetSourceScope` of KnowledgeIngestionService with the scope of the call as `execution-scope-v1`. It makes that call with its own workload token, which holds the service scope that names KnowledgeIngestionService, forwards the tenant and the project of the incoming call and never forwards the token of its caller, and it bounds the call by the deadline of the incoming call. The thin delivery of that service answers with no source and no collection. With nothing to retrieve from and no index in existence, the method consults no index, no vector backend and no model profile and returns the reply message with zero candidates, no citation and an empty list of index revisions used. The reply is well-formed: it is the same message the complete delivery returns, so a caller parses it without a special case, and it holds nothing that looks like a citation, which keeps the search honest (XL-07). The method is of class read. It writes no row, records no `RetrievalQuery`, writes no outbox record and publishes no `RetrievalExecuted`; a repeated call returns the same empty reply. A call without a workload identity is refused with UNAUTHENTICATED and a token without the service scope with PERMISSION_DENIED. A request without a query, without the tenant or the project in the forwarded scope or with a number of candidates below one is refused with INVALID_ARGUMENT; a request that names no number of candidates is valid, because the arguments of the tool need not name one. The request addresses no resource by identifier, so there is no not-found answer: isolation is that the scope is resolved under the forwarded tenant and project only and that the reply is computed from that resolution alone. KnowledgeIngestionService is a required, fail-fast dependency of the model, and an unresolved scope never reads as an empty result, because an empty result would say nothing is known while the scope was never resolved. When the dependency does not answer within the deadline, or answers UNAVAILABLE or DEADLINE_EXCEEDED, the method fails with UNAVAILABLE. When it refuses the credentials of this service, with UNAUTHENTICATED or PERMISSION_DENIED, or answers INVALID_ARGUMENT, INTERNAL or any other error, the method fails with INTERNAL, because a repeat of the call would not change the answer and the fault lies in this service or its configuration. In every one of these cases no empty reply is returned and the call is counted with the outcome failed. ToolAdapterService, for which this service is an optional dependency that degrades, then ends the tool call Failed in its own PBI, with the failure class transient for UNAVAILABLE, and a retry of the read is safe. The call is counted in `connectsoft.factory.knowledge.retrievals` with tenant, project, an empty `indexKinds` and the outcome empty or failed and timed in `connectsoft.factory.knowledge.retrieval_latency`; the query text reaches no log record, activity or metric (ADR-0019). Kind: behavior. Traces: services: VectorMemoryService, KnowledgeIngestionService, ToolAdapterService; apis: VectorMemoryService/Retrieval.Retrieve, KnowledgeIngestionService/Ingestion.GetSourceScope; tools: knowledge-search; descriptors: execution-scope-v1; adrs: ADR-0013, ADR-0015, ADR-0019; requirements: FR-07, XL-07; scenarios: SCN-VectorMemoryService-005. Depends on: feature:component-base-template-factory-profile, feature:component-observability-factory-conventions, feature:knowledge-ingestion-service-thin. Sources: model/services/knowledge/VectorMemoryService.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/tools/knowledge-search.yaml, model/backlog/features/knowledge.yaml, docs/architecture/adr/0013-vector-store-profiles.md, docs/planes/knowledge-memory/services/vector-memory-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope, a forwarded tenant and project and a query, when `VectorMemoryService/Retrieval.Retrieve` is called, then the scope is resolved once through `KnowledgeIngestionService/Ingestion.GetSourceScope` with `execution-scope-v1`, under the own workload token of the service, which holds the service scope that names KnowledgeIngestionService, with the tenant and the project of the call forwarded and without the token of the caller, the reply is the reply message of the contract with zero candidates, no citation and no index revision, and no index, vector backend or model profile was called (SCN-VectorMemoryService-005, ADR-0013, FR-07).",
        "AC2: Given the same call repeated, when both replies and the store are compared, then the replies are equal, `vector-memory-sql` holds no `RetrievalQuery` row and the outbox holds no record, because the thin scope stated in model/backlog/features/knowledge.yaml names the answer and nothing else (SCN-VectorMemoryService-005, XL-07).",
        "AC3: Given a caller without a workload identity, a token without the service scope, and a request without a query, without the forwarded tenant or project or with a number of candidates below one, when `VectorMemoryService/Retrieval.Retrieve` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT respectively, `KnowledgeIngestionService/Ingestion.GetSourceScope` is not called and nothing changes (SCN-VectorMemoryService-005, ADR-0015).",
        "AC4: Given KnowledgeIngestionService does not answer within the deadline of the call, or answers UNAVAILABLE or DEADLINE_EXCEEDED, when `VectorMemoryService/Retrieval.Retrieve` is called, then the call fails with UNAVAILABLE; given `KnowledgeIngestionService/Ingestion.GetSourceScope` answers PERMISSION_DENIED, UNAUTHENTICATED or another error, then the call fails with INTERNAL; in every one of these cases no empty result is returned in its place and the call is counted with the outcome failed; a repeated call after recovery returns the empty reply; `connectsoft.factory.knowledge.retrievals` counted every call with tenant, project and outcome and no query text reached telemetry (SCN-VectorMemoryService-005, ADR-0019, model/services/knowledge/VectorMemoryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/tools/knowledge-search.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/knowledge-memory/services/vector-memory-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-071",
        "AIFACTORY-TASK-3302",
        "AIFACTORY-TASK-3303"
      ],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6502,
      "kind": "behavior",
      "traces": {
        "services": [
          "VectorMemoryService",
          "KnowledgeIngestionService",
          "ToolAdapterService"
        ],
        "apis": [
          "VectorMemoryService/Retrieval.Retrieve",
          "KnowledgeIngestionService/Ingestion.GetSourceScope"
        ],
        "tools": [
          "knowledge-search"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0013",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-07",
          "XL-07"
        ],
        "scenarios": [
          "SCN-VectorMemoryService-005"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions",
        "feature:knowledge-ingestion-service-thin"
      ],
      "source": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/tools/knowledge-search.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/knowledge-memory/services/vector-memory-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-820]",
      "number": 820
    },
    {
      "id": "AIFACTORY-TASK-071",
      "type": "task",
      "parent": "AIFACTORY-US-820",
      "title": "Retrieval.Retrieve of the thin scope with scope resolution and the empty reply",
      "sequence": "04.05.02.01",
      "description": "Retrieval.Retrieve of the thin scope with scope resolution and the empty reply. Expected output: Retrieval.Retrieve takes the request message of AIFACTORY-TASK-072, reads the forwarded tenant and project only under the service scope, validates the query and the optional number of candidates, resolves the source scope through a typed gRPC client of Ingestion.GetSourceScope and returns the reply message with zero candidates, no citation and no index revision; the typed client presents the own workload token of the service, which holds the service scope that names KnowledgeIngestionService, forwards the tenant and the project of the incoming call, never forwards the token of the caller and is bounded by the deadline of the incoming call; the method consults no index, no vector backend and no model profile, writes no RetrievalQuery row and no outbox record, answers UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT before the scope is resolved, UNAVAILABLE when KnowledgeIngestionService does not answer within the deadline or answers UNAVAILABLE or DEADLINE_EXCEEDED, and INTERNAL when it refuses the credentials of this service or answers another error, returns no empty reply in any of these cases, and records connectsoft.factory.knowledge.retrievals, with indexKinds empty and the outcome empty or failed, and connectsoft.factory.knowledge.retrieval_latency without the query text.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Retrieval.Retrieve takes the request message of AIFACTORY-TASK-072, reads the forwarded tenant and project only under the service scope, validates the query and the optional number of candidates, resolves the source scope through a typed gRPC client of Ingestion.GetSourceScope and returns the reply message with zero candidates, no citation and no index revision; the typed client presents the own workload token of the service, which holds the service scope that names KnowledgeIngestionService, forwards the tenant and the project of the incoming call, never forwards the token of the caller and is bounded by the deadline of the incoming call; the method consults no index, no vector backend and no model profile, writes no RetrievalQuery row and no outbox record, answers UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT before the scope is resolved, UNAVAILABLE when KnowledgeIngestionService does not answer within the deadline or answers UNAVAILABLE or DEADLINE_EXCEEDED, and INTERNAL when it refuses the credentials of this service or answers another error, returns no empty reply in any of these cases, and records connectsoft.factory.knowledge.retrievals, with indexKinds empty and the outcome empty or failed, and connectsoft.factory.knowledge.retrieval_latency without the query text."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-071]",
      "number": 71
    },
    {
      "id": "AIFACTORY-TASK-3302",
      "type": "task",
      "parent": "AIFACTORY-US-820",
      "title": "Fake of Ingestion.GetSourceScope for the acceptance suite",
      "sequence": "04.05.02.02",
      "description": "Fake of Ingestion.GetSourceScope for the acceptance suite. Expected output: The acceptance suite holds a fake of Ingestion.GetSourceScope of KnowledgeIngestionService that records the execution-scope-v1 it received, the forwarded tenant and project and the token that was presented, so a test can tell the own workload token of the service from the token of the caller, answers with no source and no collection as the thin delivery of that service does, can answer with one source to prove that the thin delivery still consults no index, can be switched to not answering and back, can answer slower than the deadline of a call, and can answer each of the statuses UNAVAILABLE, DEADLINE_EXCEEDED, UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and INTERNAL.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of Ingestion.GetSourceScope of KnowledgeIngestionService that records the execution-scope-v1 it received, the forwarded tenant and project and the token that was presented, so a test can tell the own workload token of the service from the token of the caller, answers with no source and no collection as the thin delivery of that service does, can answer with one source to prove that the thin delivery still consults no index, can be switched to not answering and back, can answer slower than the deadline of a call, and can answer each of the statuses UNAVAILABLE, DEADLINE_EXCEEDED, UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and INTERNAL."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3302]",
      "number": 3302
    },
    {
      "id": "AIFACTORY-TASK-3303",
      "type": "task",
      "parent": "AIFACTORY-US-820",
      "title": "Verify the knowledge-search answer through the acceptance suite",
      "sequence": "04.05.02.03",
      "description": "Verify the knowledge-search answer through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-VectorMemoryService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-820 with the fake of AIFACTORY-TASK-3302: the empty reply after one scope resolution, the token recorded by the fake equal to the own workload token of the service and different from the token of the caller, the equal repeat with an empty store and an empty outbox, the request without a number of candidates accepted, the three refusals without a call to the fake, the stopped fake, the slow fake and the fake that answers UNAVAILABLE or DEADLINE_EXCEEDED each answered UNAVAILABLE, the fake that answers PERMISSION_DENIED, UNAUTHENTICATED, INVALID_ARGUMENT or INTERNAL answered INTERNAL, no empty reply and the outcome failed in each of these cases, the fake that returns one source still answered empty, and the scan of telemetry for the query text.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-VectorMemoryService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-820 with the fake of AIFACTORY-TASK-3302: the empty reply after one scope resolution, the token recorded by the fake equal to the own workload token of the service and different from the token of the caller, the equal repeat with an empty store and an empty outbox, the request without a number of candidates accepted, the three refusals without a call to the fake, the stopped fake, the slow fake and the fake that answers UNAVAILABLE or DEADLINE_EXCEEDED each answered UNAVAILABLE, the fake that answers PERMISSION_DENIED, UNAUTHENTICATED, INVALID_ARGUMENT or INTERNAL answered INTERNAL, no empty reply and the outcome failed in each of these cases, the fake that returns one source still answered empty, and the scan of telemetry for the query text."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3303]",
      "number": 3303
    },
    {
      "id": "AIFACTORY-US-821",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-021",
      "title": "Answer the graph-query tool through Retrieval.ExpandGraph with an empty, well-formed result while no graph fact exists",
      "sequence": "04.05.03",
      "description": "As a requester, I want a graph query of an agent of my run to return a well-formed result that holds no fact while no graph exists, so that the agent treats the graph as empty and never reasons from a relationship that no source backs. An agent of the chain calls the tool `graph-query`, and the executor of ToolAdapterService forwards the invocation to a gRPC method of this service. The model names no method for the tool. `Retrieval.ExpandGraph`, which returns the neighbours of a set of entities in one or more graph domains with temporal validity, is the only graph method on the internal surface, and the REST operation `QueryGraph` has no route before the gateway of I3, so the thin delivery answers the tool through `Retrieval.ExpandGraph`; which method the tool calls once a federated query exists is reported to the owner. The catalogue entry model/tools/graph-query.yaml describes the tool as a federated query over graph domains with temporal filters and audits a query hash and the domains; it names no set of entities. The request message of `Retrieval.ExpandGraph` therefore carries typed members that the executor fills from the invocation of the tool (AIFACTORY-TASK-072): the scope from its `scope` member, the run from its `runId`, and from its `arguments` the query as the optional query member, the graph domains as the graph domains and the temporal filter as the temporal validity. The entity list of the request is optional and stays empty for a call made for the tool, so a graph-query call that carries a query and domains and no entity is a well-formed request and is answered with the empty reply. The thin delivery validates the query as a member and does not evaluate it, because no fact exists that it could match. The caller presents a workload token, and the service reads the forwarded tenant and project only when the token holds the service scope that names VectorMemoryService (ADR-0015 amendment D114). The method validates the request message and resolves what the scope may read through `Ingestion.GetSourceScope` of KnowledgeIngestionService, as `Retrieval.Retrieve` does, because a fact carries the source it was observed in. It makes that call with its own workload token, which holds the service scope that names KnowledgeIngestionService, forwards the tenant and the project of the incoming call and never forwards the token of its caller, and it bounds the call by the deadline of the incoming call. The thin delivery of that service answers with no source. No `GraphFact` exists: the worker `GraphExtractor` that derives facts from published chunks arrives with the complete delivery. The method therefore returns the reply message with zero facts and zero neighbours, each list present and empty, and nothing that carries provenance or a trust tier, because there is nothing to label (XL-07). The reply is the message the complete delivery returns, so a caller parses it without a special case. The method is of class read: it writes no row to `GraphFacts`, no outbox record and no `GraphFactsUpdated`, and a repeated call returns the same empty reply. A call without a workload identity is refused with UNAUTHENTICATED and a token without the service scope with PERMISSION_DENIED. A request without the tenant or the project in the forwarded scope, without a graph domain or with a domain that is none of the seven of the model (Code, Architecture, Infrastructure, Organization, Customer, Business, AgentExperience), or with a validity whose end lies before its start, is refused with INVALID_ARGUMENT. A request without an entity is not refused. Whether a graph-query call that names no domain is well-formed and means all seven domains is not stated by the catalogue entry and is reported to the owner; until then the domain list is required. The request addresses no stored resource by identifier, so there is no not-found answer; an entity that no fact names yields no neighbour and is not an error. KnowledgeIngestionService is the required, fail-fast dependency, and an unresolved scope never reads as an empty result. When it does not answer within the deadline, or answers UNAVAILABLE or DEADLINE_EXCEEDED, the method fails with UNAVAILABLE; when it refuses the credentials of this service, with UNAUTHENTICATED or PERMISSION_DENIED, or answers INVALID_ARGUMENT, INTERNAL or any other error, the method fails with INTERNAL. In every one of these cases no empty reply is returned and the call is counted with the outcome failed; ToolAdapterService then ends the tool call Failed in its own PBI, with the failure class transient for UNAVAILABLE. The call is counted in `connectsoft.factory.knowledge.retrievals` with tenant, project, an empty `indexKinds` and the outcome empty or failed and timed in `connectsoft.factory.knowledge.retrieval_latency`; no entity name and no query text reaches a log record, an activity or a metric (ADR-0019). Kind: behavior. Traces: services: VectorMemoryService, KnowledgeIngestionService, ToolAdapterService; apis: VectorMemoryService/Retrieval.ExpandGraph, KnowledgeIngestionService/Ingestion.GetSourceScope; tools: graph-query; descriptors: execution-scope-v1; adrs: ADR-0013, ADR-0015, ADR-0019; requirements: FR-07, XL-07; scenarios: SCN-VectorMemoryService-006. Depends on: AIFACTORY-US-820, feature:component-base-template-factory-profile, feature:component-observability-factory-conventions, feature:knowledge-ingestion-service-thin. Sources: model/services/knowledge/VectorMemoryService.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/tools/graph-query.yaml, model/backlog/features/knowledge.yaml, docs/planes/knowledge-memory/services/vector-memory-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope, a forwarded tenant and project, two entities and the graph domain Code, when `VectorMemoryService/Retrieval.ExpandGraph` is called, then the scope is resolved once through `KnowledgeIngestionService/Ingestion.GetSourceScope` under the own workload token of the service, with the tenant and the project of the call forwarded and without the token of the caller, the reply is the reply message of the contract with zero facts and zero neighbours, each list present and empty, and nothing is written (SCN-VectorMemoryService-006, ADR-0013, FR-07).",
        "AC2: Given the same call repeated, a call for an entity that no fact names, and the call the executor makes for the tool `graph-query`, with a query, the graph domain Code, a temporal filter and no entity, when the replies and the store are compared, then every reply is the same empty message and the call without an entity is not refused, `GraphFacts` holds no row and the outbox holds no record, as the thin scope stated in model/backlog/features/knowledge.yaml requires (SCN-VectorMemoryService-006, XL-07).",
        "AC3: Given a caller without a workload identity, a token without the service scope, and a request without a graph domain, with an unknown domain, with a validity that ends before it starts or without the forwarded tenant or project, when `VectorMemoryService/Retrieval.ExpandGraph` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT respectively, `KnowledgeIngestionService/Ingestion.GetSourceScope` is not called and nothing changes (SCN-VectorMemoryService-006, ADR-0015).",
        "AC4: Given KnowledgeIngestionService does not answer within the deadline of the call, or answers UNAVAILABLE or DEADLINE_EXCEEDED, when `VectorMemoryService/Retrieval.ExpandGraph` is called, then the call fails with UNAVAILABLE; given `KnowledgeIngestionService/Ingestion.GetSourceScope` answers PERMISSION_DENIED, UNAUTHENTICATED or another error, then the call fails with INTERNAL; in every one of these cases no empty result is returned in its place and `connectsoft.factory.knowledge.retrievals` counts the call with the outcome failed; a repeated call after recovery returns the empty reply, and no entity name and no query text reached telemetry (SCN-VectorMemoryService-006, ADR-0019, model/services/knowledge/VectorMemoryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/tools/graph-query.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/vector-memory-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3304",
        "AIFACTORY-TASK-3305"
      ],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6503,
      "kind": "behavior",
      "traces": {
        "services": [
          "VectorMemoryService",
          "KnowledgeIngestionService",
          "ToolAdapterService"
        ],
        "apis": [
          "VectorMemoryService/Retrieval.ExpandGraph",
          "KnowledgeIngestionService/Ingestion.GetSourceScope"
        ],
        "tools": [
          "graph-query"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0013",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-07",
          "XL-07"
        ],
        "scenarios": [
          "SCN-VectorMemoryService-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-820",
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions",
        "feature:knowledge-ingestion-service-thin"
      ],
      "source": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/tools/graph-query.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/knowledge-memory/services/vector-memory-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-821]",
      "number": 821
    },
    {
      "id": "AIFACTORY-TASK-3304",
      "type": "task",
      "parent": "AIFACTORY-US-821",
      "title": "Retrieval.ExpandGraph of the thin scope with scope resolution and the empty reply",
      "sequence": "04.05.03.01",
      "description": "Retrieval.ExpandGraph of the thin scope with scope resolution and the empty reply. Expected output: Retrieval.ExpandGraph takes the request message of AIFACTORY-TASK-072, reads the forwarded tenant and project only under the service scope, accepts an empty entity list and an optional query, as the executor sends them for the tool graph-query, validates the graph domains against the seven domains of the model and the temporal validity, resolves the source scope through the typed client of Ingestion.GetSourceScope and returns the reply message with zero facts and zero neighbours; the typed client presents the own workload token of the service, which holds the service scope that names KnowledgeIngestionService, forwards the tenant and the project of the incoming call, never forwards the token of the caller and is bounded by the deadline of the incoming call; the method writes no row to GraphFacts and no outbox record, answers UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT (no graph domain, an unknown domain, a validity that ends before it starts, no forwarded tenant or project; never for a missing entity) before the scope is resolved, UNAVAILABLE when KnowledgeIngestionService does not answer within the deadline or answers UNAVAILABLE or DEADLINE_EXCEEDED, and INTERNAL when it refuses the credentials of this service or answers another error, returns no empty reply in any of these cases, and records connectsoft.factory.knowledge.retrievals, with indexKinds empty and the outcome empty or failed, and connectsoft.factory.knowledge.retrieval_latency without an entity name or the query text.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "Retrieval.ExpandGraph takes the request message of AIFACTORY-TASK-072, reads the forwarded tenant and project only under the service scope, accepts an empty entity list and an optional query, as the executor sends them for the tool graph-query, validates the graph domains against the seven domains of the model and the temporal validity, resolves the source scope through the typed client of Ingestion.GetSourceScope and returns the reply message with zero facts and zero neighbours; the typed client presents the own workload token of the service, which holds the service scope that names KnowledgeIngestionService, forwards the tenant and the project of the incoming call, never forwards the token of the caller and is bounded by the deadline of the incoming call; the method writes no row to GraphFacts and no outbox record, answers UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT (no graph domain, an unknown domain, a validity that ends before it starts, no forwarded tenant or project; never for a missing entity) before the scope is resolved, UNAVAILABLE when KnowledgeIngestionService does not answer within the deadline or answers UNAVAILABLE or DEADLINE_EXCEEDED, and INTERNAL when it refuses the credentials of this service or answers another error, returns no empty reply in any of these cases, and records connectsoft.factory.knowledge.retrievals, with indexKinds empty and the outcome empty or failed, and connectsoft.factory.knowledge.retrieval_latency without an entity name or the query text."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3304]",
      "number": 3304
    },
    {
      "id": "AIFACTORY-TASK-3305",
      "type": "task",
      "parent": "AIFACTORY-US-821",
      "title": "Verify the graph-query answer through the acceptance suite",
      "sequence": "04.05.03.02",
      "description": "Verify the graph-query answer through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-VectorMemoryService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-821 with the fake of AIFACTORY-TASK-3302: the empty reply after one scope resolution, the token recorded by the fake equal to the own workload token of the service and different from the token of the caller, the equal repeat and the unknown entity with an empty GraphFacts table and an empty outbox, the golden call of the executor for graph-query with a query, the domain Code, a temporal filter and no entity answered with the empty reply, the refusals without a call to the fake, the stopped fake, the slow fake and the fake that answers UNAVAILABLE or DEADLINE_EXCEEDED each answered UNAVAILABLE, the fake that answers PERMISSION_DENIED, UNAUTHENTICATED, INVALID_ARGUMENT or INTERNAL answered INTERNAL, no empty reply and the outcome failed in each of these cases, and the scan of telemetry for entity names and the query text.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-VectorMemoryService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-821 with the fake of AIFACTORY-TASK-3302: the empty reply after one scope resolution, the token recorded by the fake equal to the own workload token of the service and different from the token of the caller, the equal repeat and the unknown entity with an empty GraphFacts table and an empty outbox, the golden call of the executor for graph-query with a query, the domain Code, a temporal filter and no entity answered with the empty reply, the refusals without a call to the fake, the stopped fake, the slow fake and the fake that answers UNAVAILABLE or DEADLINE_EXCEEDED each answered UNAVAILABLE, the fake that answers PERMISSION_DENIED, UNAUTHENTICATED, INVALID_ARGUMENT or INTERNAL answered INTERNAL, no empty reply and the outcome failed in each of these cases, and the scan of telemetry for entity names and the query text."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 65,
      "phase": "factory",
      "stackRank": 6503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3305]",
      "number": 3305
    },
    {
      "id": "AIFACTORY-FEAT-022",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "KnowledgeHost: gateway delivery",
      "sequence": "04.06",
      "description": "KnowledgeHost is the platform API gateway of bounded context BC-11 (Retrieval & Indexes). The API gateway of the Knowledge platform (ADR-0028): routes public REST and internal gRPC calls to the 6 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.KnowledgeHost. Delivers: KnowledgeHost (complete). Increment I1: Generate a microservice. Build order 66 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-081",
        "AIFACTORY-US-822",
        "AIFACTORY-US-823",
        "AIFACTORY-US-824",
        "AIFACTORY-US-825",
        "AIFACTORY-US-826"
      ],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6600,
      "titlePrefix": "[AIFACTORY-FEAT-022]",
      "number": 22
    },
    {
      "id": "AIFACTORY-US-081",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-022",
      "title": "KnowledgeHost routes the calls of its platform under a trusted scope",
      "sequence": "04.06.01",
      "description": "As a platform admin, I want one gateway in front of the six services of the Knowledge platform that validates tokens and scopes, so that no service of the platform is reachable from outside the cluster except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the Knowledge platform. ADR-0028 re-scopes the former composition host as the API gateway of its platform: KnowledgeHost routes public REST and internal gRPC calls to the six services the model lists under `deployment.fronts`, ArtifactService, ContextBuilderService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService and VectorMemoryService, validates tokens and scopes and owns no business state, no relational store and no secret (gateway role GW-03). The repository ConnectSoft.AI.SoftwareFactory.KnowledgeHost is created and scaffolded in I0 by AIFACTORY-TASK-466 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold: it is scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway therefore has no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`); the gateway copies neither the accessor nor the token contract. A user token has one audience, this gateway, and the gateway forwards it to the fronted service unchanged and exchanges no token, because the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). A workload token carries service scopes and no tenant claim and is admitted only on an internal gRPC route whose operation names a service scope the token holds (ADR-0015 amendment D114). The feature is delivered by five further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-822), token, tenant, project and scope on every read route (AIFACTORY-US-823), the pass-through of a shared-write call with its idempotency key (AIFACTORY-US-824), the production, publication and external routes whose gate stays in the fronted service (AIFACTORY-US-825), and health, modules, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-826). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. A project-scoped route names its project in the path, in a query parameter or in a body member and never in a header the caller types. Two operations of the platform name the project in their path, `ExportArtifacts` of ArtifactService and `SetCollection` of KnowledgeIngestionService: the gateway admits the named project only for a token that holds a role claim for it or the tenant-wide Platform admin role, answers 403 itself for a project the token does not grant and calls no service, and sets the project header of the abstractions package itself from the admitted project; a project header a caller sends is dropped on every route. Every other route addresses a resource by its identifier or reads under the tenant of the token: a gateway without business state cannot know the project or the tenant of an artifact, a run, a source or a memory, so it forwards under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing right and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. The gateway is delivered in I1 (D125): it is the only route by which a person reads or exports an artifact, and in this increment it serves the five public routes of ArtifactService, `GetArtifact`, `PreviewArtifact`, `ListArtifactVersions`, `ListRunArtifacts` and `ExportArtifacts`, against the service that is delivered complete in the same increment. The other five services reach the gateway unevenly. ContextBuilderService, KnowledgeIngestionService and VectorMemoryService are delivered thin in I1 and host none of their public REST operations before their complete deliveries in I5. RepositoryIntelligenceService has no deployed instance before its complete delivery in I5, because in I1 its seven read tools run inside the sandbox of the run and pass no gateway (D125). MemoryPromotionService arrives in I5. The fronts file holds the routes of all six services from the start, and the routes of the other knowledge services begin to serve as the complete deliveries appear in I5, without a change of the gateway. Until then a route whose service is not deployed answers 503 with a problem response that names the service, and a route whose operation a thin delivery does not host returns the answer of that service unchanged; the refusals and the failure branches of every route class are proven against fakes generated from the fronts file. Of the three callers the model names, ToolExecutorHost is delivered in the same increment, and AgentRuntimeWorker and StudioBff arrive in I3; each calls the gateway in its own PBIs, and this feature waits for none of them. The feature adds no direct public route to any service of the platform. The gateway invents no response. Kind: enabling. Traces: services: KnowledgeHost, ArtifactService, ContextBuilderService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService, VectorMemoryService; apis: KnowledgeHost/KnowledgeHealth; adrs: ADR-0015, ADR-0016, ADR-0017, ADR-0028; requirements: FR-07, FR-08. Depends on: AIFACTORY-US-822, AIFACTORY-US-823, AIFACTORY-US-824, AIFACTORY-US-825, AIFACTORY-US-826, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai, feature:artifact-service, feature:context-builder-service-thin, feature:knowledge-ingestion-service-thin, feature:repository-intelligence-service-thin, feature:vector-memory-service-thin. Sources: model/services/knowledge/KnowledgeHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/knowledge-memory/services/knowledge-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.KnowledgeHost created and scaffolded in I0 by AIFACTORY-TASK-466 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.KnowledgeHost --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/knowledge/KnowledgeHost.yaml).",
        "AC2: Given a valid token for a route of each fronted service deployed in the increment, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with the token unchanged, the tenant, the project the gateway admitted where the route names one, the correlation id and the trace context, the fronted service answers and the response returns unchanged, as AIFACTORY-US-823 to AIFACTORY-US-825 prove per route class (ADR-0015, FR-07).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret, and no event of the model lists KnowledgeHost as a consumer (ADR-0028, model/services/knowledge/KnowledgeHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `KnowledgeHost/KnowledgeHealth` is probed and one replica is stopped, then health reports the identity platform and the six fronted services, a replica stays in rotation while it can validate tokens, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/knowledge/KnowledgeHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-3306",
        "AIFACTORY-TASK-762"
      ],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6601,
      "kind": "enabling",
      "traces": {
        "services": [
          "KnowledgeHost",
          "ArtifactService",
          "ContextBuilderService",
          "KnowledgeIngestionService",
          "MemoryPromotionService",
          "RepositoryIntelligenceService",
          "VectorMemoryService"
        ],
        "apis": [
          "KnowledgeHost/KnowledgeHealth"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0016",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07",
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-822",
        "AIFACTORY-US-823",
        "AIFACTORY-US-824",
        "AIFACTORY-US-825",
        "AIFACTORY-US-826",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:artifact-service",
        "feature:context-builder-service-thin",
        "feature:knowledge-ingestion-service-thin",
        "feature:repository-intelligence-service-thin",
        "feature:vector-memory-service-thin"
      ],
      "source": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-081]",
      "number": 81
    },
    {
      "id": "AIFACTORY-TASK-3306",
      "type": "task",
      "parent": "AIFACTORY-US-081",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "04.06.01.01",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 10, the ports https 7700 and grpc 7702, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/knowledge/KnowledgeHost.yaml records them; it leaves Knowledge:Host:FrontedServices at its default, the six service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 10, the ports https 7700 and grpc 7702, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/knowledge/KnowledgeHost.yaml records them; it leaves Knowledge:Host:FrontedServices at its default, the six service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6601,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-3306]",
      "number": 3306
    },
    {
      "id": "AIFACTORY-TASK-762",
      "type": "task",
      "parent": "AIFACTORY-US-081",
      "title": "Verify knowledge-host-routes-its-platform by running the declared command",
      "sequence": "04.06.01.02",
      "description": "Verify knowledge-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-081, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes KnowledgeHost/KnowledgeHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-081, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes KnowledgeHost/KnowledgeHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-762]",
      "number": 762
    },
    {
      "id": "AIFACTORY-US-822",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-022",
      "title": "Knowledge fronts file: named clients and REST and gRPC routes of the six fronted services, generated at build",
      "sequence": "04.06.02",
      "description": "As a platform admin, I want the route table of the knowledge gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Knowledge platform. It lists the six services of `deployment.fronts` in model/services/knowledge/KnowledgeHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method with its streaming mode, scope, side-effect class and idempotency. For ArtifactService these are the five REST operations `GetArtifact`, `PreviewArtifact`, `ListArtifactVersions`, `ListRunArtifacts` and `ExportArtifacts` and the three gRPC methods `Artifacts.Store`, `Artifacts.Fetch` and `Artifacts.RecordValidation`. For ContextBuilderService these are `ListContextSnapshots` and `GetContextSnapshot` and the gRPC method `ContextAssembly.Assemble`. For KnowledgeIngestionService these are the six REST operations `RegisterSource`, `ListSources`, `SyncSource`, `DeleteSource`, `GetSnapshot` and `SetCollection` and the gRPC method `Ingestion.GetSourceScope`. For MemoryPromotionService these are the five REST operations `ListMemory`, `GetMemory`, `PromoteMemory`, `ArchiveMemory` and `SetMemoryConsent` and the gRPC methods `Memory.RetrieveMemory` and `Memory.Observe`. For RepositoryIntelligenceService these are `ListRepositoryIndexSets` and `RebuildRepositoryIndexes` and the seven gRPC methods of `RepositoryIntelligence`. For VectorMemoryService these are the four REST operations `Search`, `QueryGraph`, `ListIndexRevisions` and `RebuildIndexes` and the gRPC methods `Retrieval.Retrieve` and `Retrieval.ExpandGraph`. That is twenty-four REST routes and sixteen gRPC routes; `Artifacts.Store` is a client stream, `Artifacts.Fetch` a server stream and the other fourteen are unary. The file holds the whole surface of the model, also for operations that a thin delivery does not host yet and for RepositoryIntelligenceService and MemoryPromotionService, which have no deployed instance before I5: the route exists, and what it answers until then is the answer of the service or 503 (AIFACTORY-US-081). The REST operations are the public surface that StudioBff and a typed client call; the gRPC methods are the internal surface that AgentRuntimeWorker and ToolExecutorHost call for context assembly, artifact writes and the knowledge and repository tools. In I1 the repository read tools do not pass this gateway, because they run inside the sandbox of the run (D125); their seven gRPC routes serve from the complete delivery of RepositoryIntelligenceService in I5. Each route carries the scope and the side-effect class of its operation, which is what the route class PBIs of this feature enforce; an internal gRPC route names the service scope a workload token must hold. Each REST entry also states how its operation addresses a project. A project-scoped route names its project in the path, in a query parameter or in a body member and never in a header the caller types, and the gateway checks it against the roles of the token. `ExportArtifacts` and `SetCollection` name it in the path parameter `projectId`. The operations whose path names an artifact, a run, a context snapshot, a source, a snapshot, a memory or a collection are marked as addressed by a resource identifier only. `ListSources`, `RegisterSource`, `Search`, `QueryGraph` and `ListMemory` read or write under the scope of the caller, and their service files name no path parameter, query parameter or body member for a project; until the model names one they are marked as scoped by the tenant of the token, and the gap is reported as a correction of the service files. `SetMemoryConsent` of MemoryPromotionService, `PUT /factory/memory/consent`, fits none of these three: it grants or revokes the consent of the tenant for shared memory, so it acts on the tenant of the token by design and names no project because none applies. It is marked as tenant-wide by design, a fourth marking that is no gap of the model and no part of that correction. The four markings cover all twenty-four REST operations: two by the path parameter `projectId`, sixteen by a resource identifier only, five by the tenant of the token until their service files name a project parameter, and one tenant-wide by design. A test lists the emitted route table against the file and against the six service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `KnowledgeHealth` and `KnowledgeModules`, transforms no payload and composes no response from two services. The option `Knowledge:Host:FrontedServices` is bound at startup and compared with the service names of the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable. The fronts file names its services by their identifiers, as `deployment.fronts` lists them, and the default of `Knowledge:Host:FrontedServices` in model/services/knowledge/KnowledgeHost.yaml names the same six service identifiers (D125), so the deployment manifest does not set the option. The pipeline of this repository publishes the OpenAPI document of the twenty-four public REST operations as a build output, checked against the fronts file and the six service files. This feature builds and publishes no client package: the typed client of this gateway is published by feature `typed-gateway-clients` of the same increment, which generates it from this OpenAPI document. That feature is aligned with the delivery of this gateway in I1 in its own PBIs, so the dependency is stated here in words and adds no client work to this feature. Kind: enabling. Traces: services: KnowledgeHost, ArtifactService, ContextBuilderService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService, VectorMemoryService; adrs: ADR-0015, ADR-0028; requirements: FR-07. Depends on: feature:component-api-gateway-template, feature:artifact-service, feature:context-builder-service-thin, feature:knowledge-ingestion-service-thin, feature:repository-intelligence-service-thin, feature:vector-memory-service-thin. Sources: model/services/knowledge/KnowledgeHost.yaml, model/services/knowledge/ArtifactService.yaml, model/services/knowledge/ContextBuilderService.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/services/knowledge/MemoryPromotionService.yaml, model/services/knowledge/RepositoryIntelligenceService.yaml, model/services/knowledge/VectorMemoryService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/architecture/api-governance.md, docs/planes/knowledge-memory/services/knowledge-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Knowledge platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, twenty-four REST routes and sixteen gRPC routes, each with the scope, side-effect class, idempotency and streaming mode of the operation, and the route table test passes against model/services/knowledge/KnowledgeHost.yaml and the six service files under model/services/knowledge (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `Knowledge:Host:FrontedServices` at its default, the six service identifiers of `deployment.fronts` in model/services/knowledge/KnowledgeHost.yaml, when the gateway starts, then startup succeeds; given a value of the option that names no service of the fronts file or omits one, when the gateway starts, then startup fails with the differing name; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, which carries the token of the caller unchanged because the gateway exchanges no token, the tenant, the correlation id and the trace context, a project header sent by the caller has been dropped, and the response of the fake returns unchanged (ADR-0015, FR-07).",
        "AC4: Given the built gateway, when its pipeline publishes the OpenAPI document of the public REST routes, then the document holds exactly the twenty-four REST operations of the fronts file with their methods, paths, scopes and response codes and no internal gRPC method, and a contract check fails the build when it differs from the six service files under model/services/knowledge (docs/architecture/api-governance.md)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/MemoryPromotionService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-467",
        "AIFACTORY-TASK-3307",
        "AIFACTORY-TASK-3308",
        "AIFACTORY-TASK-3309"
      ],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6602,
      "kind": "enabling",
      "traces": {
        "services": [
          "KnowledgeHost",
          "ArtifactService",
          "ContextBuilderService",
          "KnowledgeIngestionService",
          "MemoryPromotionService",
          "RepositoryIntelligenceService",
          "VectorMemoryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:artifact-service",
        "feature:context-builder-service-thin",
        "feature:knowledge-ingestion-service-thin",
        "feature:repository-intelligence-service-thin",
        "feature:vector-memory-service-thin"
      ],
      "source": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/MemoryPromotionService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-822]",
      "number": 822
    },
    {
      "id": "AIFACTORY-TASK-467",
      "type": "task",
      "parent": "AIFACTORY-US-822",
      "title": "Fronts file with the REST and gRPC operations of ArtifactService, ContextBuilderService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService and VectorMemoryService",
      "sequence": "04.06.02.01",
      "description": "Fronts file with the REST and gRPC operations of ArtifactService, ContextBuilderService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService and VectorMemoryService. Expected output: The fronts file lists the six services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation how it addresses a project, one of four markings that together cover all twenty-four operations: by the path parameter projectId for ExportArtifacts and SetCollection; by a resource identifier only for the sixteen operations whose path names an artifact, a run, a context snapshot, a source, a snapshot, a memory or a collection; by the tenant of the token for ListSources, RegisterSource, Search, QueryGraph and ListMemory, whose service files name no project parameter, which is reported as a correction of those files; and tenant-wide by design for SetMemoryConsent, which acts on the consent of the tenant and is no part of that correction; a test fails when a REST operation carries none or more than one of the four markings; the build emits the named clients, the twenty-four REST routes, the sixteen gRPC routes and the route table; at startup the option Knowledge:Host:FrontedServices, whose default is the six service identifiers of deployment.fronts, is compared with the service names of the fronts file, the gateway starts with the option at its default, and a difference in either direction fails startup with the name; a project header of a caller is dropped on every route; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the six services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation how it addresses a project, one of four markings that together cover all twenty-four operations: by the path parameter projectId for ExportArtifacts and SetCollection; by a resource identifier only for the sixteen operations whose path names an artifact, a run, a context snapshot, a source, a snapshot, a memory or a collection; by the tenant of the token for ListSources, RegisterSource, Search, QueryGraph and ListMemory, whose service files name no project parameter, which is reported as a correction of those files; and tenant-wide by design for SetMemoryConsent, which acts on the consent of the tenant and is no part of that correction; a test fails when a REST operation carries none or more than one of the four markings; the build emits the named clients, the twenty-four REST routes, the sixteen gRPC routes and the route table; at startup the option Knowledge:Host:FrontedServices, whose default is the six service identifiers of deployment.fronts, is compared with the service names of the fronts file, the gateway starts with the option at its default, and a difference in either direction fails startup with the name; a project header of a caller is dropped on every route; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-467]",
      "number": 467
    },
    {
      "id": "AIFACTORY-TASK-3307",
      "type": "task",
      "parent": "AIFACTORY-US-822",
      "title": "Fakes of the six fronted services and the token matrix of the acceptance suite",
      "sequence": "04.06.02.02",
      "description": "Fakes of the six fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and serves a client stream and a server stream for the two streaming methods of ArtifactService, a switch that makes a fake stop answering, also in the middle of a stream, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and serves a client stream and a server stream for the two streaming methods of ArtifactService, a switch that makes a fake stop answering, also in the middle of a stream, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6602,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3307]",
      "number": 3307
    },
    {
      "id": "AIFACTORY-TASK-3308",
      "type": "task",
      "parent": "AIFACTORY-US-822",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "04.06.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the twenty-four public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the six service files under model/services/knowledge and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can be the input from which feature typed-gateway-clients generates the client of this gateway; no client package is built here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the twenty-four public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the six service files under model/services/knowledge and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can be the input from which feature typed-gateway-clients generates the client of this gateway; no client package is built here."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6602,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3308]",
      "number": 3308
    },
    {
      "id": "AIFACTORY-TASK-3309",
      "type": "task",
      "parent": "AIFACTORY-US-822",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "04.06.02.04",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-822: one route per operation of the six service files under model/services/knowledge, the failing builds, the start with the option at its default, the failing startup on a value that names no service of the fronts file or omits one, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller, and the contract check of the published OpenAPI document.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-822: one route per operation of the six service files under model/services/knowledge, the failing builds, the start with the option at its default, the failing startup on a value that names no service of the fronts file or omits one, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller, and the contract check of the published OpenAPI document."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3309]",
      "number": 3309
    },
    {
      "id": "AIFACTORY-US-823",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-022",
      "title": "A read route of the knowledge gateway forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "04.06.03",
      "description": "As a requester, I want my read calls to reach the artifact, context, source, memory, repository and retrieval services only with the tenant and the scope my token grants, so that I see the artifacts, snapshots, sources and search results I am entitled to and nobody reads across a tenant through the gateway, while the project rule of a read is applied by the fronted service until the service files name a project parameter. A caller reaches a read operation of the Knowledge platform through the gateway: a requester reads an artifact, its preview and its version chain and the artifacts and context snapshots of a run, lists sources and memories, searches knowledge and queries the graph, and an Observer reads the same; a worker of the Agent Mesh assembles context and reads promoted memories, and the tool gateway calls the repository and retrieval tools over gRPC. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment D114); a client that also calls the Control Plane gateway requests a second token for it. The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names: `factory.artifacts.read` for `GetArtifact`, `PreviewArtifact` and `ListArtifactVersions`, `factory.runs.read` for `ListRunArtifacts`, `ListContextSnapshots` and `GetContextSnapshot`, `factory.knowledge.read` for `ListSources`, `GetSnapshot`, `ListRepositoryIndexSets`, `Search`, `QueryGraph` and `ListIndexRevisions`, and `factory.memory.read` for `ListMemory` and `GetMemory`. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. No read operation of the six service files names a project in its path, in a query parameter or in a body member. Ten of the fourteen name a resource by identifier, an artifact, a run, a context snapshot, a snapshot, a memory, a repository source or a collection, and a gateway without business state cannot know the tenant or the project of such a resource: it forwards the call under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. `ListSources`, `Search`, `QueryGraph` and `ListMemory` read under the scope of the caller and name no resource; until their service files name the parameter that carries a project (AIFACTORY-US-822), the gateway forwards them under the tenant of the token, and the fronted service, which validates the forwarded token again, applies its own project rule from the role claims of that token. A project header a caller sends is dropped and establishes nothing; the gateway sets the project header only from a project it admitted from a path, a query parameter or a body member. Every public REST operation names a `factory.` scope and none names a service scope, so no REST route admits a workload token; a workload token on such a route is answered 403. The scope is established once with the scope accessor of the pinned abstractions package and forwarded: the authorization header with the user token itself, the tenant in `X-Tenant-Id`, the correlation id and the trace context. The gateway exchanges no token; the fronted service accepts the audience of its own gateway, which is this one, and applies its own tenant filter and role policies (ADR-0015 amendment D117). The internal gRPC surface has thirteen read methods: `Artifacts.Fetch`, `ContextAssembly.Assemble`, `Ingestion.GetSourceScope`, `Memory.RetrieveMemory`, the seven methods of `RepositoryIntelligence`, `Retrieval.Retrieve` and `Retrieval.ExpandGraph`. A workload presents a token that carries service scopes, no audience of a user API and no tenant claim, and each gRPC route names the service scope the token must hold. For a workload token that holds it, the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope; for a workload token without it, and for a user token, which holds no service scope, the answer is PERMISSION_DENIED and no fronted service is called. `Artifacts.Fetch` is a server stream: the gateway passes the messages through as they arrive, buffers no artifact content and caches none, and when the service fails in the middle of a stream the stream ends with UNAVAILABLE and nothing is replayed. For every read route the response is served by the fronted service with no side effect and returns unchanged with the correlation id; the gateway keeps nothing of the call and records `connectsoft.factory.knowledge.host.requests` and `connectsoft.factory.knowledge.host.request_duration` for the route. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope of the operation 403; in each case no fronted service is called and the refusal is counted for the route and logged with the correlation id and without the token. In this increment the read routes a person uses are the four of ArtifactService, `GetArtifact`, `PreviewArtifact`, `ListArtifactVersions` and `ListRunArtifacts`, and the gateway is the only route by which a person reaches them (D125); the read routes of the other knowledge services serve as their complete deliveries appear in I5. When the fronted service does not answer, or is not deployed yet as RepositoryIntelligenceService and MemoryPromotionService are until I5, the route answers 503, over gRPC UNAVAILABLE, with a retry hint that names the service and never its address, and the routes of the other services keep serving. A read operation that a thin delivery does not host yet returns the answer of that service unchanged. Kind: behavior. Traces: services: KnowledgeHost, ArtifactService, ContextBuilderService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService, VectorMemoryService; adrs: ADR-0015, ADR-0028; requirements: FR-07, FR-08, FUX-06, FUX-09; scenarios: SCN-KnowledgeHost-006. Relates: screens: artifacts, context-snapshot, knowledge-sources, knowledge-search, memory, repository-intelligence. Depends on: AIFACTORY-US-822, feature:component-api-gateway-template, feature:component-extensions-ai, feature:artifact-service, feature:context-builder-service-thin, feature:knowledge-ingestion-service-thin, feature:repository-intelligence-service-thin, feature:vector-memory-service-thin. Sources: model/services/knowledge/KnowledgeHost.yaml, model/services/knowledge/ArtifactService.yaml, model/services/knowledge/ContextBuilderService.yaml, model/services/knowledge/VectorMemoryService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/knowledge-memory/services/knowledge-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with `factory.artifacts.read`, when the read route of `GetArtifact` is called, then the gateway forwards the call with the user token unchanged in the authorization header, without a token exchange, the tenant of the `tid` claim, the correlation id and the trace context, ArtifactService answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-KnowledgeHost-006, ADR-0015, FR-08).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes of the six fronted services are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope of the operation and a workload token on a REST route are answered 403, and in none of these cases a fronted service is called; each refusal is counted for its route and logged with the correlation id and without the token (SCN-KnowledgeHost-006, ADR-0015).",
        "AC3: Given a valid user token, a tenant header of the caller that names another tenant and a project header of the caller, when a read route addressed by an `artifactId`, a `runId` or a `sourceId` is called, then the tenant header is overwritten with the `tid` claim, the project header of the caller is dropped, the call is forwarded under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged; given the routes of `ListSources`, `Search`, `QueryGraph` and `ListMemory`, then they are forwarded under the tenant of the token with the user token unchanged, as model/services/knowledge/KnowledgeHost.yaml and the service files name no project parameter for them (SCN-KnowledgeHost-006).",
        "AC4: Given a workload token that holds the service scope the route names, when the gRPC read routes of `Retrieval.Retrieve`, `RepositoryIntelligence.ReadRange` and the server stream `Artifacts.Fetch` are called with `tenant-id` and project metadata, then the gateway forwards each call with that metadata unchanged, passes the stream through without buffering content and returns the reply of the service unchanged; given a workload token without the scope, or a user token, then the answer is PERMISSION_DENIED and no fronted service is called; a NOT_FOUND of the fronted service for a resource outside the forwarded tenant returns unchanged (SCN-KnowledgeHost-006, ADR-0015).",
        "AC5: Given a fronted service that does not answer, a fake of ArtifactService that stops in the middle of `Artifacts.Fetch`, and the routes of MemoryPromotionService while that service is not deployed, when their read routes are called, then the gateway answers 503, over gRPC UNAVAILABLE, with a problem response that carries a retry hint and names the service and never its address, the interrupted stream ends with UNAVAILABLE and is not replayed, no response is invented, and the read routes of the other services keep serving (SCN-KnowledgeHost-006, model/services/knowledge/KnowledgeHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3310",
        "AIFACTORY-TASK-3311"
      ],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6603,
      "kind": "behavior",
      "traces": {
        "services": [
          "KnowledgeHost",
          "ArtifactService",
          "ContextBuilderService",
          "KnowledgeIngestionService",
          "MemoryPromotionService",
          "RepositoryIntelligenceService",
          "VectorMemoryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07",
          "FR-08",
          "FUX-06",
          "FUX-09"
        ],
        "scenarios": [
          "SCN-KnowledgeHost-006"
        ]
      },
      "relates": {
        "screens": [
          "artifacts",
          "context-snapshot",
          "knowledge-sources",
          "knowledge-search",
          "memory",
          "repository-intelligence"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-822",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:artifact-service",
        "feature:context-builder-service-thin",
        "feature:knowledge-ingestion-service-thin",
        "feature:repository-intelligence-service-thin",
        "feature:vector-memory-service-thin"
      ],
      "source": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-823]",
      "number": 823
    },
    {
      "id": "AIFACTORY-TASK-3310",
      "type": "task",
      "parent": "AIFACTORY-US-823",
      "title": "Issuer, audience, scope, tenant and project configuration of the read routes",
      "sequence": "04.06.03.01",
      "description": "Issuer, audience, scope, tenant and project configuration of the read routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route and the project header is set only from a project the gateway admitted from a path parameter, a query parameter or a body member; a route addressed by a resource identifier is marked as such, so the gateway checks token and scope and leaves the role and the tenant of the resource to the fronted service; ListSources, Search, QueryGraph and ListMemory are forwarded under the tenant of the token until their service files name a project parameter; a workload token is refused with 403 on a REST route; a gRPC route names the service scope a workload token must hold and forwards the tenant-id and project metadata unchanged with it (ADR-0015 amendment D114); the server stream of Artifacts.Fetch is passed through without buffering; the user token is forwarded unchanged and no token is exchanged (ADR-0015 amendment D117); refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route and the project header is set only from a project the gateway admitted from a path parameter, a query parameter or a body member; a route addressed by a resource identifier is marked as such, so the gateway checks token and scope and leaves the role and the tenant of the resource to the fronted service; ListSources, Search, QueryGraph and ListMemory are forwarded under the tenant of the token until their service files name a project parameter; a workload token is refused with 403 on a REST route; a gRPC route names the service scope a workload token must hold and forwards the tenant-id and project metadata unchanged with it (ADR-0015 amendment D114); the server stream of Artifacts.Fetch is passed through without buffering; the user token is forwarded unchanged and no token is exchanged (ADR-0015 amendment D117); refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3310]",
      "number": 3310
    },
    {
      "id": "AIFACTORY-TASK-3311",
      "type": "task",
      "parent": "AIFACTORY-US-823",
      "title": "Verify the read routes through the acceptance suite",
      "sequence": "04.06.03.02",
      "description": "Verify the read routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-KnowledgeHost-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-823 over the token matrix: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the four routes forwarded under the tenant of the token, a workload token refused on a REST route, the gRPC routes of Retrieval.Retrieve and RepositoryIntelligence.ReadRange with and without the service scope, the server stream of Artifacts.Fetch passed through and interrupted, a fake that stops answering and the routes of the service that is not deployed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-KnowledgeHost-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-823 over the token matrix: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the four routes forwarded under the tenant of the token, a workload token refused on a REST route, the gRPC routes of Retrieval.Retrieve and RepositoryIntelligence.ReadRange with and without the service scope, the server stream of Artifacts.Fetch passed through and interrupted, a fake that stops answering and the routes of the service that is not deployed."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3311]",
      "number": 3311
    },
    {
      "id": "AIFACTORY-US-824",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-022",
      "title": "A shared-write route of the knowledge gateway passes the idempotency key through and the gateway keeps nothing between calls",
      "sequence": "04.06.04",
      "description": "As a workspace admin, I want a write I repeat after a failure to be applied once, so that a lost answer or a restarted gateway never registers a second source, starts a second rebuild or stores an artifact twice. A shared-write operation changes state that others read. The Knowledge platform has six on its public surface: `RegisterSource`, `SyncSource` and `SetCollection` of KnowledgeIngestionService, `ArchiveMemory` of MemoryPromotionService, `RebuildRepositoryIndexes` of RepositoryIntelligenceService and `RebuildIndexes` of VectorMemoryService; and three on its internal gRPC surface: `Artifacts.Store` and `Artifacts.RecordValidation` of ArtifactService and `Memory.Observe` of MemoryPromotionService. The caller sends each through the gateway under the token, tenant and scope rules of AIFACTORY-US-823: `factory.knowledge.admin` for the five operations on sources, collections and rebuilds, `factory.memory.review` for `ArchiveMemory`, and on a gRPC route a workload token that holds the service scope the route names. `SetCollection` is the one shared-write route that names its project, in the path parameter `projectId`: the gateway admits the project only for a token that holds a role claim for it or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself for a project the token does not grant, calling no service. The other routes name a source, a memory, a repository source or a collection by identifier, or, for `RegisterSource`, write under the scope of the caller; the gateway forwards them under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. `RegisterSource`, `SyncSource`, `RebuildRepositoryIndexes` and `RebuildIndexes` declare idempotency `key-header` and are called with an `Idempotency-Key`; the gateway forwards the header unchanged and the fronted service applies the request once under its own rule: the same key with the same body returns the same result, and the answer of the fronted service for a key reused with a different body returns to the caller unchanged, whatever its status. The gateway states no status for that case, because the model states none: model/services/knowledge/KnowledgeIngestionService.yaml lists 409 among the codes of `RegisterSource` without a meaning, and no PBI of that service, which stays thin until I5, has decided its answer for a reused key. The 409 of `RegisterSource` is one example of a domain answer that returns unchanged, whatever it stands for. `SetCollection` and `ArchiveMemory` are naturally idempotent and need no key. `Artifacts.Store` is a client stream that stores content by hash and is idempotent on tenant and hash within a chain: the gateway passes the messages through as they arrive, buffers no content and writes none to the shared cache, and returns the reply of the service. The gateway is no party to idempotency. It stores neither a key nor a result, keeps no session and no pending call, has no outbox and writes no event, so a gateway replica that crashes during a call loses nothing: the replica restarts, nothing is replayed, and the caller retries with the same key, or stores the same content again, and receives from the service the result of the one application (failure mode of a gateway replica crash in the model). When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a problem response that names the service and carries a retry hint, the other routes keep serving, and the caller retries with its key. A refusal by the gateway, 401, 403 or the 403 for a project the token does not grant, reaches no fronted service, so it applies nothing. A missing key, an invalid body and every domain refusal are answers of the fronted service and return unchanged with the correlation id. In this increment the two gRPC writes of ArtifactService are served by the deployed service. The thin deliveries of KnowledgeIngestionService and VectorMemoryService do not host their shared-write operations before I5, and RepositoryIntelligenceService and MemoryPromotionService have no deployed instance before I5 (D125), so those routes are proven against the fakes generated from the fronts entries; on a deployed instance the first return the answer of the thin service unchanged and the routes of RepositoryIntelligenceService and MemoryPromotionService answer 503 with the service named. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: KnowledgeHost, ArtifactService, KnowledgeIngestionService, MemoryPromotionService, RepositoryIntelligenceService, VectorMemoryService; adrs: ADR-0015, ADR-0028; requirements: FR-08, FUX-09; scenarios: SCN-KnowledgeHost-007. Relates: screens: knowledge-sources, memory. Depends on: AIFACTORY-US-822, AIFACTORY-US-823, feature:component-api-gateway-template, feature:artifact-service, feature:knowledge-ingestion-service-thin. Sources: model/services/knowledge/KnowledgeHost.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/services/knowledge/ArtifactService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/knowledge-memory/services/knowledge-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a valid token with `factory.knowledge.admin` and the route of `RegisterSource`, whose operation declares idempotency `key-header`, when the call arrives with an `Idempotency-Key`, then the gateway forwards the request with the header and the body unchanged, the fake of KnowledgeIngestionService applies it once and the response returns unchanged with the correlation id (SCN-KnowledgeHost-007, ADR-0015).",
        "AC2: Given the same call repeated with the same key, and then with the same key and a different body, when both pass the gateway, then the first returns the result of the first application and the second returns the answer of the fronted service for a reused key unchanged, whatever its status; the gateway has stored neither the key nor a result in the shared cache or anywhere else (SCN-KnowledgeHost-007, ADR-0028).",
        "AC3: Given a workload token that holds the service scope and the client stream `Artifacts.Store`, when a gateway replica is stopped while the stream is in flight and the caller stores the same content again through another replica, then the second replica passes the repeated stream through message by message, the fake of ArtifactService received the first stream as interrupted and the second stream complete, the gateway replayed nothing and neither replica buffered or cached content; that ArtifactService holds one artifact for a tenant and hash is the rule of that service and is proven by the PBIs of feature `artifact-service`, not by the suite of the gateway (SCN-KnowledgeHost-007, model/services/knowledge/KnowledgeHost.yaml).",
        "AC4: Given the route of `SetCollection` with a `projectId` in its path, when the token holds a role claim for that project or the tenant-wide Platform admin role, then the call is forwarded with the project in the project header the gateway sets, and when the token holds none, then the gateway answers 403 itself and no fronted service is called; given a shared-write route addressed by a `sourceId`, a `memoryId` or a `collectionId`, when the fronted service answers 403 for a missing role or 404 for a resource of another tenant (ADR-0015 amendment D113), then the gateway returns that answer unchanged (SCN-KnowledgeHost-007, ADR-0015).",
        "AC5: Given a call without a token, a token that lacks the scope, a fronted service that does not answer and the routes of MemoryPromotionService while that service is not deployed, when a shared-write route is called, then the answer is 401, 403 or 503 respectively, a call the gateway refuses reaches no fronted service and applies nothing, and the 503 names the service and carries a retry hint while the other routes keep serving (SCN-KnowledgeHost-007, model/services/knowledge/KnowledgeHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3312",
        "AIFACTORY-TASK-3313"
      ],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6604,
      "kind": "behavior",
      "traces": {
        "services": [
          "KnowledgeHost",
          "ArtifactService",
          "KnowledgeIngestionService",
          "MemoryPromotionService",
          "RepositoryIntelligenceService",
          "VectorMemoryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FUX-09"
        ],
        "scenarios": [
          "SCN-KnowledgeHost-007"
        ]
      },
      "relates": {
        "screens": [
          "knowledge-sources",
          "memory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-822",
        "AIFACTORY-US-823",
        "feature:component-api-gateway-template",
        "feature:artifact-service",
        "feature:knowledge-ingestion-service-thin"
      ],
      "source": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-824]",
      "number": 824
    },
    {
      "id": "AIFACTORY-TASK-3312",
      "type": "task",
      "parent": "AIFACTORY-US-824",
      "title": "Forwarded headers and metadata of a write route, the project of SetCollection and a stateless call path",
      "sequence": "04.06.04.01",
      "description": "Forwarded headers and metadata of a write route, the project of SetCollection and a stateless call path. Expected output: A shared-write route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; the route of SetCollection admits the projectId of its path only for a token with a role claim for it or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself otherwise; the client stream of Artifacts.Store is passed through message by message; no key, body, content or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "A shared-write route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; the route of SetCollection admits the projectId of its path only for a token with a role claim for it or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself otherwise; the client stream of Artifacts.Store is passed through message by message; no key, body, content or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3312]",
      "number": 3312
    },
    {
      "id": "AIFACTORY-TASK-3313",
      "type": "task",
      "parent": "AIFACTORY-US-824",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "04.06.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-KnowledgeHost-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-824 with a fake that applies a key once and answers a configured conflict status for the same key with a different body, run with two different configured statuses and asserted as the pass-through of each status and body unchanged, a replica stopped during the client stream of Artifacts.Store, after which the fake holds the first stream as interrupted and the repeated stream through the second replica as complete and the gateway replayed nothing, the route of SetCollection with a granted and a refused project, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, a fake that stops answering, the routes of the service that is not deployed and an inspection of the shared cache that finds no key and no content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-KnowledgeHost-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-824 with a fake that applies a key once and answers a configured conflict status for the same key with a different body, run with two different configured statuses and asserted as the pass-through of each status and body unchanged, a replica stopped during the client stream of Artifacts.Store, after which the fake holds the first stream as interrupted and the repeated stream through the second replica as complete and the gateway replayed nothing, the route of SetCollection with a granted and a refused project, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, a fake that stops answering, the routes of the service that is not deployed and an inspection of the shared cache that finds no key and no content."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3313]",
      "number": 3313
    },
    {
      "id": "AIFACTORY-US-825",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-022",
      "title": "A production, publication or external route of the knowledge gateway is forwarded under its scope and the gate of the action stays in the fronted service",
      "sequence": "04.06.05",
      "description": "As a workspace admin, I want a deletion, a promotion, a consent change or an export to be decided by the service that owns its state, with the gateway only checking who I am and what I may call, so that an approval is never decided twice or by a component that holds no state. Three side-effect classes of the Knowledge platform carry a gate beyond the scope. The production routes are `DeleteSource` of KnowledgeIngestionService, which deletes a source and every derived item with deletion lineage, and `SetMemoryConsent` of MemoryPromotionService, by which a Platform admin grants or revokes the consent of the tenant for shared memory. The publication route is `PromoteMemory` of MemoryPromotionService, the promotion of a reviewed candidate, an approval-gated action bound to the content hash of the memory. The external route is `ExportArtifacts` of ArtifactService, the export of the artifacts, the lineage and the metadata of a project in open formats (XL-14). ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, requires the scope the operation names, `factory.knowledge.admin` for `DeleteSource`, `factory.memory.admin` for `SetMemoryConsent`, `factory.memory.review` for `PromoteMemory` and `factory.artifacts.admin` for `ExportArtifacts`, and forwards the call with the established scope. `ExportArtifacts` names its project in the path parameter `projectId`: the gateway admits it only for a token that holds a role claim for that project or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself for a project the token does not grant. `DeleteSource` and `PromoteMemory` name a source or a memory by identifier and `SetMemoryConsent` acts on the tenant of the token, so the gateway forwards them under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. The gate itself is decided where the state is. KnowledgeIngestionService decides a deletion and moves the source to Deleting. MemoryPromotionService promotes a memory only through a review decision bound to its exact content hash and, for shared scope, with the consent record of the tenant, and answers 409 or 412 when a precondition does not hold; the approval is requested from and decided in RunControlService and reaches the service as an event. ArtifactService accepts an export with 202 and its own worker produces the package; the `Idempotency-Key` of the export passes through unchanged. The gateway evaluates no policy and no approval, holds no approval reference and no consent, calls no connector, writes no receipt and no audit evidence. Where a command leaves audit evidence, the service that owns the command writes it to its own outbox in the transaction of the command, as the event `AuditEvidenceSubmitted` on the topic `audit.evidence.v1.evidence-submitted`; the gateway has no outbox. The answer of the fronted service, including 202, 409 and 412, returns unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. In this increment `ExportArtifacts` is proven against ArtifactService, which is delivered complete in the same increment, and the gateway is the only route by which a person starts an export (D125). `DeleteSource` is not hosted by the thin KnowledgeIngestionService before I5 and MemoryPromotionService arrives in I5, so the production and the publication routes are proven against fakes generated from the fronts entries: on a deployed instance the route of `DeleteSource` returns the answer of the thin service unchanged and the routes of MemoryPromotionService answer 503 with a problem response that names the service. Kind: behavior. Traces: services: KnowledgeHost, ArtifactService, KnowledgeIngestionService, MemoryPromotionService; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: FR-08, NFR-03, XL-14; scenarios: SCN-KnowledgeHost-003, SCN-KnowledgeHost-004, SCN-KnowledgeHost-005. Relates: screens: artifacts, knowledge-sources, memory. Depends on: AIFACTORY-US-822, AIFACTORY-US-823, feature:component-api-gateway-template, feature:artifact-service, feature:knowledge-ingestion-service-thin. Sources: model/services/knowledge/KnowledgeHost.yaml, model/services/knowledge/ArtifactService.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/services/knowledge/MemoryPromotionService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a token with `factory.artifacts.admin` and a role claim for the project of the path, when the external route of `ExportArtifacts` is called with an `Idempotency-Key`, then the gateway forwards the call with the key unchanged and the project in the project header it sets, ArtifactService accepts the export and answers 202, and that answer returns unchanged with the correlation id; the gateway called no connector and wrote no receipt and no evidence; given a token without a role in that project, then the gateway answers 403 itself and ArtifactService is not called (SCN-KnowledgeHost-003, ADR-0028, XL-14).",
        "AC2: Given a token with `factory.knowledge.admin`, when the production route of `DeleteSource` is called against the fake of KnowledgeIngestionService that answers 202, 403 or 404, then the gateway forwards the call under the tenant of the token and the scope of the operation, because the route names only the `sourceId`, and returns each answer unchanged; given a token with `factory.memory.admin`, when the production route of `SetMemoryConsent` is called against the fake of MemoryPromotionService, then the call is forwarded and its answer returns unchanged; the gateway evaluated no approval and holds no consent (SCN-KnowledgeHost-004, ADR-0028).",
        "AC3: Given a token with `factory.memory.review`, when the publication route of `PromoteMemory` is called against the fake of MemoryPromotionService that answers 200, 409 or 412, then the gateway forwards the call under the established scope and returns each answer unchanged, holding no approval reference of its own (SCN-KnowledgeHost-005, ADR-0028, model/services/knowledge/MemoryPromotionService.yaml).",
        "AC4: Given a call without a token or with an expired token, or a token that lacks the scope of the operation, when a production, publication or external route is called, then the gateway answers 401 or 403 and no fronted service is called; given a route that names only a resource id, such as the `sourceId` of a deletion or the `memoryId` of a promotion, when the fronted service answers 403 for a missing role or 404 for a resource of another tenant (ADR-0015 amendment D113), then the gateway returns that answer unchanged (SCN-KnowledgeHost-003, SCN-KnowledgeHost-004, SCN-KnowledgeHost-005, ADR-0015).",
        "AC5: Given a deployed instance of this increment, when the routes of `SetMemoryConsent` and `PromoteMemory` are called while MemoryPromotionService is not deployed, then each answers 503 with a problem response that names the service and carries a retry hint, the gateway invents no response, and the external route of `ExportArtifacts` and every route of the other services keep serving (SCN-KnowledgeHost-004, SCN-KnowledgeHost-005, model/services/knowledge/KnowledgeHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/MemoryPromotionService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3314",
        "AIFACTORY-TASK-3315",
        "AIFACTORY-TASK-3316"
      ],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6605,
      "kind": "behavior",
      "traces": {
        "services": [
          "KnowledgeHost",
          "ArtifactService",
          "KnowledgeIngestionService",
          "MemoryPromotionService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "NFR-03",
          "XL-14"
        ],
        "scenarios": [
          "SCN-KnowledgeHost-003",
          "SCN-KnowledgeHost-004",
          "SCN-KnowledgeHost-005"
        ]
      },
      "relates": {
        "screens": [
          "artifacts",
          "knowledge-sources",
          "memory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-822",
        "AIFACTORY-US-823",
        "feature:component-api-gateway-template",
        "feature:artifact-service",
        "feature:knowledge-ingestion-service-thin"
      ],
      "source": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/MemoryPromotionService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-825]",
      "number": 825
    },
    {
      "id": "AIFACTORY-TASK-3314",
      "type": "task",
      "parent": "AIFACTORY-US-825",
      "title": "Project check of the export route and the route class register of the gateway",
      "sequence": "04.06.05.01",
      "description": "Project check of the export route and the route class register of the gateway. Expected output: The route of ExportArtifacts admits the projectId of its path only for a token with a role claim for it or the tenant-wide Platform admin role, sets the project header from it, forwards the Idempotency-Key unchanged and answers 403 itself otherwise; a register test lists every route of class production, publication and external from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a consent, an export or a receipt.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "The route of ExportArtifacts admits the projectId of its path only for a token with a role claim for it or the tenant-wide Platform admin role, sets the project header from it, forwards the Idempotency-Key unchanged and answers 403 itself otherwise; a register test lists every route of class production, publication and external from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a consent, an export or a receipt."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3314]",
      "number": 3314
    },
    {
      "id": "AIFACTORY-TASK-3315",
      "type": "task",
      "parent": "AIFACTORY-US-825",
      "title": "Fakes of the production and publication routes for the acceptance suite",
      "sequence": "04.06.05.02",
      "description": "Fakes of the production and publication routes for the acceptance suite. Expected output: The acceptance suite holds a fake of DeleteSource of KnowledgeIngestionService that answers 202, 403 and 404, a fake of SetMemoryConsent of MemoryPromotionService that answers 200 and 403 and a fake of PromoteMemory that answers 200, 409 and 412, each generated from its fronts entry, and a configuration in which MemoryPromotionService has no instance behind its base address.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of DeleteSource of KnowledgeIngestionService that answers 202, 403 and 404, a fake of SetMemoryConsent of MemoryPromotionService that answers 200 and 403 and a fake of PromoteMemory that answers 200, 409 and 412, each generated from its fronts entry, and a configuration in which MemoryPromotionService has no instance behind its base address."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6605,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3315]",
      "number": 3315
    },
    {
      "id": "AIFACTORY-TASK-3316",
      "type": "task",
      "parent": "AIFACTORY-US-825",
      "title": "Verify the production, publication and external routes through the acceptance suite",
      "sequence": "04.06.05.03",
      "description": "Verify the production, publication and external routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-KnowledgeHost-003|Scenario=SCN-KnowledgeHost-004|Scenario=SCN-KnowledgeHost-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-825: the export forwarded with its key and its admitted project and refused for a project without a role, the answers 202, 403, 404, 409 and 412 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, the 503 of the routes whose service is not deployed and the register of gated routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-KnowledgeHost-003|Scenario=SCN-KnowledgeHost-004|Scenario=SCN-KnowledgeHost-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-825: the export forwarded with its key and its admitted project and refused for a project without a role, the answers 202, 403, 404, 409 and 412 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, the 503 of the routes whose service is not deployed and the register of gated routes."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3316]",
      "number": 3316
    },
    {
      "id": "AIFACTORY-US-826",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-022",
      "title": "Health, modules, limits and telemetry of the knowledge gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "04.06.06",
      "description": "As an operator, I want to see whether the knowledge gateway, the identity platform and each fronted service answer, and which services and index profiles this installation runs, so that I can tell a failing service from a failing gateway and act on the right one. An operator and the probes of the cluster read the state of the gateway through its two own operations. `KnowledgeHost/KnowledgeHealth` reports liveness and readiness of the gateway with the aggregated health of the six services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. What the gateway does when it is unreachable is decided (ADR-0015 amendment D117). While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe `KnowledgeHealth` answers 200 with the health degraded and a detail that names the identity platform as unreachable, so the operator sees the failure in health while calls still pass. The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, `KnowledgeHealth` answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency: when it does not answer, or is not deployed yet as RepositoryIntelligenceService and MemoryPromotionService are until I5, health reports it as unavailable in the detail and the answer stays 200, its routes answer 503 with a retry hint, and the routes of the other services keep serving. `KnowledgeHost/KnowledgeModules` returns to a caller whose scope carries `factory.meta.read` the six fronted services with their versions and repositories, as `deployment.fronts` lists them, and two further members the model names: the vector profile in use (ADR-0013) and the embedding profile versions of the indexes. The gateway holds no state and reads no index. Both values belong to VectorMemoryService, which owns the vector profile selection and the index revisions, and the model gives that service no operation that returns the profile in use or the versions across collections, so the source of these two members is an open point reported to the owner. Until it is decided the two members are part of the reply and are read through one metadata port of the gateway that has no production binding: a deployed instance answers the six services and states the vector profile and the embedding profile versions as not reported, and invents no value. That matches what exists in this increment, where VectorMemoryService is thin, binds no vector backend and holds no index; the reply with both members filled is proven against a fake metadata source of the acceptance suite only. A call that exceeds the rate limit configured for its route is refused with 429, over gRPC RESOURCE_EXHAUSTED, through the pinned rate-limiting library, from the configuration of the gateway, and calls no fronted service. The gateway emits `connectsoft.factory.knowledge.host.requests` with the dimensions service, route and status and `connectsoft.factory.knowledge.host.request_duration` with service and route, the latency including the fronted service, each recorded through the helper of the pinned observability library, which puts the tenant, and the project where the route names one, on the instrument by default (ADR-0019); the gateway carries the trace context to the service. The gateway belongs to the class `pilot-interactive` of model/nfr-targets.yaml, whose objective is an acknowledgement within 2 seconds at p95; the duration series is what it is measured against once the system is deployed, and no value is claimed here. Logs, activities and metrics never contain a token, an artifact, a query, a search result or any other payload. A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed and callers retry with their idempotency key. The roles of the gateway are Observer, Operator and Platform admin. Kind: behavior. Traces: services: KnowledgeHost, VectorMemoryService; apis: KnowledgeHost/KnowledgeHealth, KnowledgeHost/KnowledgeModules; adrs: ADR-0005, ADR-0013, ADR-0015, ADR-0017, ADR-0019, ADR-0028; requirements: NFR-10, NFR-18; scenarios: SCN-KnowledgeHost-001, SCN-KnowledgeHost-002. Relates: nfrs: NFR-07. Depends on: AIFACTORY-US-822, feature:component-api-gateway-template, feature:component-observability-factory-conventions, feature:vector-memory-service-thin. Sources: model/services/knowledge/KnowledgeHost.yaml, model/services/knowledge/VectorMemoryService.yaml, docs/architecture/adr/0013-vector-store-profiles.md, docs/planes/knowledge-memory/services/knowledge-host/index.md#metrics-and-observability, docs/planes/knowledge-memory/services/knowledge-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and the fronted services reachable, when `KnowledgeHost/KnowledgeHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the six fronted services and of the identity platform; a call for the detail without a token is answered 401 and a token without the scope 403 (SCN-KnowledgeHost-001, NFR-18).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `KnowledgeHost/KnowledgeHealth` is probed, then tokens that were already issued are validated with the cached key, readiness stays ready so the replica stays in rotation, and from the first failed probe health answers 200 with the health degraded and a detail that names the identity platform as unreachable, while liveness keeps answering 200; given no valid key remains, because none was cached or the cached keys expired, when calls arrive, then they are refused, readiness is unready so the replica leaves rotation, `KnowledgeHost/KnowledgeHealth` answers 503 with a problem response that names the identity platform and no state changes (SCN-KnowledgeHost-001, model/services/knowledge/KnowledgeHost.yaml).",
        "AC3: Given one fronted service does not answer and MemoryPromotionService is not deployed, when `KnowledgeHost/KnowledgeHealth` and the routes are called, then health answers 200 and reports both services as unavailable in its detail, their routes answer 503 with a retry hint that names the service, over gRPC UNAVAILABLE, the routes of the other services keep serving and the gateway invents no response (SCN-KnowledgeHost-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read`, when `KnowledgeHost/KnowledgeModules` is called on an instance whose metadata port has no source, then the response is 200 with the six fronted services, each with its version and repository, as model/services/knowledge/KnowledgeHost.yaml lists them under `deployment.fronts`, and with the vector profile and the embedding profile versions stated as not reported; given the fake metadata source of the acceptance suite bound to the port, then the reply names the vector profile and the embedding profile versions the source reported (ADR-0013); a call without a token is answered 401 and a token without the scope 403, no operation of VectorMemoryService was called and nothing is written (SCN-KnowledgeHost-002).",
        "AC5: Given routed calls and a call above the rate limit of its route, when the metrics and logs are read, then `connectsoft.factory.knowledge.host.requests` counts every call by service, route and status, the call above the limit was refused with 429 and called no fronted service, `connectsoft.factory.knowledge.host.request_duration` holds the latency by service and route, both series carry the tenant of the call, and the project where the route names one, as the helper of the pinned observability library adds them, and no log record, activity or metric holds a token or a payload (ADR-0019, NFR-10, model/services/knowledge/KnowledgeHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#metrics-and-observability",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-468",
        "AIFACTORY-TASK-3317",
        "AIFACTORY-TASK-3318",
        "AIFACTORY-TASK-3319"
      ],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6606,
      "kind": "behavior",
      "traces": {
        "services": [
          "KnowledgeHost",
          "VectorMemoryService"
        ],
        "apis": [
          "KnowledgeHost/KnowledgeHealth",
          "KnowledgeHost/KnowledgeModules"
        ],
        "adrs": [
          "ADR-0005",
          "ADR-0013",
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-10",
          "NFR-18"
        ],
        "scenarios": [
          "SCN-KnowledgeHost-001",
          "SCN-KnowledgeHost-002"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-07"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-822",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions",
        "feature:vector-memory-service-thin"
      ],
      "source": [
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#metrics-and-observability",
        "docs/planes/knowledge-memory/services/knowledge-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-826]",
      "number": 826
    },
    {
      "id": "AIFACTORY-TASK-468",
      "type": "task",
      "parent": "AIFACTORY-US-826",
      "title": "Health, modules and telemetry of the gateway",
      "sequence": "04.06.06.01",
      "description": "Health, modules and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the six fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the modules operation serves, under factory.meta.read, the six fronted services with version and repository and the vector profile and the embedding profile versions its metadata port returns, states both as not reported when the port has no source, and calls no operation of VectorMemoryService; the port has no production binding; every routed call records connectsoft.factory.knowledge.host.requests and connectsoft.factory.knowledge.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, with the tenant of the call and the project where the route names one (ADR-0019), and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the six fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the modules operation serves, under factory.meta.read, the six fronted services with version and repository and the vector profile and the embedding profile versions its metadata port returns, states both as not reported when the port has no source, and calls no operation of VectorMemoryService; the port has no production binding; every routed call records connectsoft.factory.knowledge.host.requests and connectsoft.factory.knowledge.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, with the tenant of the call and the project where the route names one (ADR-0019), and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6606,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-468]",
      "number": 468
    },
    {
      "id": "AIFACTORY-TASK-3317",
      "type": "task",
      "parent": "AIFACTORY-US-826",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "04.06.06.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.knowledge.host.requests; the limit values are configuration of the deployment and none is fixed in code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.knowledge.host.requests; the limit values are configuration of the deployment and none is fixed in code."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6606,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3317]",
      "number": 3317
    },
    {
      "id": "AIFACTORY-TASK-3318",
      "type": "task",
      "parent": "AIFACTORY-US-826",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "04.06.06.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/knowledge/KnowledgeHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the fronted service names RepositoryIntelligenceService and MemoryPromotionService as not deployed before I5; the entry of the replica crash states that nothing is replayed and that callers retry with their idempotency key (NFR-18).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/knowledge/KnowledgeHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the fronted service names RepositoryIntelligenceService and MemoryPromotionService as not deployed before I5; the entry of the replica crash states that nothing is replayed and that callers retry with their idempotency key (NFR-18)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6606,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-3318]",
      "number": 3318
    },
    {
      "id": "AIFACTORY-TASK-3319",
      "type": "task",
      "parent": "AIFACTORY-US-826",
      "title": "Verify health, modules, limits and telemetry through the acceptance suite",
      "sequence": "04.06.06.04",
      "description": "Verify health, modules, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-KnowledgeHost-001|Scenario=SCN-KnowledgeHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-826 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped and one service without an instance, the modules operation without a metadata source, with the fake metadata source and without its scope, a call above its limit, the two series connectsoft.factory.knowledge.host.requests and connectsoft.factory.knowledge.host.request_duration with service, route and status, the tenant of the call and the project of a project-scoped route, and a scan of the captured logs and activities for token and payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-KnowledgeHost-001|Scenario=SCN-KnowledgeHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-826 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped and one service without an instance, the modules operation without a metadata source, with the fake metadata source and without its scope, a call above its limit, the two series connectsoft.factory.knowledge.host.requests and connectsoft.factory.knowledge.host.request_duration with service, route and status, the tenant of the call and the project of a project-scoped route, and a scan of the captured logs and activities for token and payload content."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 66,
      "phase": "factory",
      "stackRank": 6606,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3319]",
      "number": 3319
    },
    {
      "id": "AIFACTORY-FEAT-023",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "ContextBuilderService: complete delivery",
      "sequence": "04.07",
      "description": "ContextBuilderService is the service of bounded context BC-09 (Context Assembly). The context engineering plane — plans what a task needs (mandatory instructions, task, conversation state, repository state, knowledge, graph neighbours, episodic memory, diff, tool results), retrieves and expands candidates, ranks, deduplicates, compresses and budgets tokens, and records an immutable context snapshot that says what was used and why (BC-09). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.ContextBuilderService. Delivers: ContextBuilderService (complete). Depends on: AIFACTORY-FEAT-018. Increment I5: Knowledge and connections. Build order 143 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 143,
      "phase": "factory",
      "stackRank": 14300,
      "titlePrefix": "[AIFACTORY-FEAT-023]",
      "number": 23
    },
    {
      "id": "AIFACTORY-FEAT-024",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "KnowledgeIngestionService: complete delivery",
      "sequence": "04.08",
      "description": "KnowledgeIngestionService is the service of bounded context BC-10 (Sources & Ingestion). Owns knowledge sources and collections, immutable source snapshots, the ingestion pipeline (parse, normalize, metadata, chunk, publish to indexes with ACL propagation), incremental sync, staleness and deletion lineage; code, documentation, library and template sources are source types, not services (BC-10). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService. Delivers: KnowledgeIngestionService (complete). Depends on: AIFACTORY-FEAT-019. Increment I5: Knowledge and connections. Build order 144 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/KnowledgeIngestionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 144,
      "phase": "factory",
      "stackRank": 14400,
      "titlePrefix": "[AIFACTORY-FEAT-024]",
      "number": 24
    },
    {
      "id": "AIFACTORY-FEAT-025",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "MemoryPromotionService: complete delivery",
      "sequence": "04.09",
      "description": "MemoryPromotionService is the service of bounded context BC-13 (Promoted Memory). The governed memory lifecycle — observations from completed runs become candidate memories, are classified (temporary, episodic, semantic candidate, procedural candidate, discard), checked against evidence, scored for confidence, reviewed per policy and promoted into scoped, provenance-carrying, expiring memory; agent opinions never become organizational facts without review (BC-13, D32). Its own repository is ConnectSoft.AI.SoftwareFactory.MemoryPromotionService. Delivers: MemoryPromotionService (complete). Increment I5: Knowledge and connections. Build order 145 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/MemoryPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 145,
      "phase": "factory",
      "stackRank": 14500,
      "titlePrefix": "[AIFACTORY-FEAT-025]",
      "number": 25
    },
    {
      "id": "AIFACTORY-FEAT-026",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "RepositoryIntelligenceService: complete delivery",
      "sequence": "04.10",
      "description": "RepositoryIntelligenceService is the service of bounded context BC-39 (Repository Intelligence). Repository indexes per revision — file tree, symbols, types, dependencies, calls, references, Git history, ownership, build and test relationships — built from repository snapshots and exposed as read tools so that large repositories are never dumped into model context (BC-39, original design §33). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService. Delivers: RepositoryIntelligenceService (complete). Depends on: AIFACTORY-FEAT-020. Increment I5: Knowledge and connections. Build order 146 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 146,
      "phase": "factory",
      "stackRank": 14600,
      "titlePrefix": "[AIFACTORY-FEAT-026]",
      "number": 26
    },
    {
      "id": "AIFACTORY-FEAT-027",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-004",
      "title": "VectorMemoryService: complete delivery",
      "sequence": "04.11",
      "description": "VectorMemoryService is the service of bounded context BC-11 (Retrieval & Indexes). The retrieval module (historical name kept from the June-2026 catalog) — vector, full-text, symbol, metadata, graph-projection and temporal retrieval combined under trusted scope with ACL enforced before top-k, citations with source version and index revision, embedding and index revisions pinned to profiles, and rebuildable derived indexes (BC-11, ADR-0013). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.VectorMemoryService. Delivers: VectorMemoryService (complete). Depends on: AIFACTORY-FEAT-021. Increment I5: Knowledge and connections. Build order 147 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:knowledge",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 147,
      "phase": "factory",
      "stackRank": 14700,
      "titlePrefix": "[AIFACTORY-FEAT-027]",
      "number": 27
    },
    {
      "id": "AIFACTORY-EPIC-005",
      "type": "epic",
      "parent": null,
      "title": "Tools & MCP Platform (PF-05)",
      "sequence": "05",
      "description": "Everything that builds the Tools & MCP Platform platform (PF-05): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Tool registry, governed tool executor, MCP server hosting and governance, sandbox broker contracts, skills packaging. Done when: Every service of the platform has its complete delivery accepted (McpServerRegistryService, ToolAdapterService, ToolExecutorHost), the platform gateway routes them under a trusted scope, and the outcome verification of I5 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (McpServerRegistryService, ToolAdapterService, ToolExecutorHost), the platform gateway routes them under a trusted scope, and the outcome verification of I5 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-028",
        "AIFACTORY-FEAT-029",
        "AIFACTORY-FEAT-030",
        "AIFACTORY-FEAT-031"
      ],
      "stackRank": 6699,
      "titlePrefix": "[AIFACTORY-EPIC-005]",
      "number": 5
    },
    {
      "id": "AIFACTORY-FEAT-028",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-005",
      "title": "McpServerRegistryService: thin delivery for the first outcome",
      "sequence": "05.01",
      "description": "McpServerRegistryService is the service of bounded context BC-08 (Tool Execution). Registry of MCP servers the Factory consumes or exposes — transport, endpoint or connection, authentication (on by default), governance policy, discovered tools, resources and prompts bound to tool descriptors and knowledge sources, handshake health and the ModelOps-like lifecycle from registration to retirement (BC-08, ADR-0022). In this increment it is delivered thin: A static registry without MCP servers; every tool of the chain is native. Its own repository is ConnectSoft.AI.SoftwareFactory.McpServerRegistryService. Delivers: McpServerRegistryService (thin: A static registry without MCP servers; every tool of the chain is native.). Increment I1: Generate a microservice. Build order 67 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-064",
        "AIFACTORY-US-596",
        "AIFACTORY-US-597"
      ],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6700,
      "titlePrefix": "[AIFACTORY-FEAT-028]",
      "number": 28
    },
    {
      "id": "AIFACTORY-US-064",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-028",
      "title": "McpServerRegistryService answers the chain with its thin contract",
      "sequence": "05.01.01",
      "description": "As an asset maintainer, I want McpServerRegistryService to answer the calls of the first-outcome chain with a well-formed result of its thin scope, so that the Tool Execution context has one owner of MCP servers that the rest of the Factory calls through its contract. This is the integration PBI of the thin delivery. Every tool the first outcome calls is native: the six workflow definitions of the chain and their nine agents name fifteen tools of the tool catalogue under model/tools, each of kind native, and no descriptor that ToolAdapterService activates in this increment names an `mcpServerId`. McpServerRegistryService is therefore delivered thin, and the thin scope the feature states is exactly this: a static registry without MCP servers. Static means that no operation of the delivery writes a server, a binding or an event. The service hosts the three read operations that do not address a server by its id: `ListMcpServers` (AIFACTORY-US-596) and the internal gRPC methods `McpRegistry.ResolveTool` and `McpRegistry.ListCapabilities` (AIFACTORY-US-597). They read the store `mcp-server-registry-sql`, whose four tables are migrated by this delivery and hold no row on a deployed instance. Nothing else is served. `RegisterMcpServer`, `DiscoverMcpCapabilities`, `ActivateMcpServer`, `RetireMcpServer` and `GetMcpCapabilities`, the three events of the `McpServer` aggregate, the workers `HandshakeProbe` and `CapabilityDiscovery`, the handlers of `AssetReleasePublished`, `AssetReleaseRevoked` and `ConnectionStateChanged` and the calls to IntegrationService, SecretBrokerService and PolicyEngineService arrive with feature `mcp-server-registry-service-complete` in I5. The handler of `DeletionOrderIssued` is built in I4 with RetentionResidencyService and is not registered here. The repository ConnectSoft.AI.SoftwareFactory.McpServerRegistryService is created and scaffolded in I0 by AIFACTORY-TASK-073 of feature repository-and-pipeline-conventions (D140) from the pinned base template package with `UseFactoryProfile`, and this feature starts from that scaffold, so token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again; the messaging profile is the Orleans profile under the service name `mcp-server-registry`, and the thin delivery declares no published and no consumed event in it. The model names `tool-invocation-v1` as the request and the reply descriptor of `McpRegistry.ResolveTool` and as the reply descriptor of `McpRegistry.ListCapabilities`. docs/reference/schemas/tool-invocation.schema.json describes a tool call: it requires the arguments, the policy decision and the idempotency key, which a resolution does not have, allows no additional property and holds `mcpServerId` but no member for a transport, a binding or an authentication. That conflict is an open point reported to the owner, and it concerns both directions: the delivery replaces the request descriptor of `McpRegistry.ResolveTool` too, by a message of tool id and tool version, beside the reply descriptor of both methods. The thin delivery makes its contract checkable without deciding the point: the proto fixes the request and reply messages of the two methods and the OpenAPI document fixes the list (AIFACTORY-TASK-075), and a contract test with golden files holds them. The golden files of the two gRPC messages are provisional until the owner names the request and reply descriptors; when the owner does, the messages change and ToolAdapterService, their one caller, follows them. No promise of an unchanged contract is made for them. The complete delivery adds its operations, its write paths and its events on the same tables, and only the shape of the list of `ListMcpServers` is meant to stay as this delivery fixes it. A caller without a token, without a workload identity or without the scope of the operation, and a workload call that forwards no tenant, is refused before any handler runs. Kind: behavior. Traces: services: McpServerRegistryService; apis: McpServerRegistryService/ListMcpServers, McpServerRegistryService/McpRegistry.ResolveTool, McpServerRegistryService/McpRegistry.ListCapabilities; descriptors: tool-invocation-v1, execution-scope-v1; adrs: ADR-0015, ADR-0022, ADR-0028. Depends on: AIFACTORY-US-596, AIFACTORY-US-597, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings. Sources: model/services/tools-mcp/McpServerRegistryService.yaml, model/backlog/features/tools-mcp.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/reference/schemas/tool-invocation.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.McpServerRegistryService created and scaffolded in I0 by AIFACTORY-TASK-073 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.McpServerRegistryService --UseFactoryProfile true` from the pinned template package, when its pipeline runs, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/tools-mcp/McpServerRegistryService.yaml).",
        "AC2: Given the deployed thin service with its migrated and empty store, when a caller with `factory.tools.read` calls `McpServerRegistryService/ListMcpServers` and ToolAdapterService calls `McpServerRegistryService/McpRegistry.ResolveTool` and `McpServerRegistryService/McpRegistry.ListCapabilities` under a workload token that holds the service scope and forwards its tenant, then the list is empty and well formed, every resolution is answered NOT_FOUND and the capability list is empty, as AIFACTORY-US-596 and AIFACTORY-US-597 prove one by one (ADR-0022).",
        "AC3: Given the service descriptor of the thin delivery, when the contract test of the Factory profile compares it with the hosted surface, then exactly `McpServerRegistryService/ListMcpServers`, `McpServerRegistryService/McpRegistry.ResolveTool` and `McpServerRegistryService/McpRegistry.ListCapabilities` are hosted, no REST operation that writes a server answers, the `OrleansMessaging` section declares no published and no consumed event, and the test fails when an operation outside the thin scope stated in model/backlog/features/tools-mcp.yaml appears; the golden files of the two gRPC messages are marked provisional in the contract test, because the request and reply descriptors the model names (`tool-invocation-v1`) cannot carry a resolution and the owner has yet to name the descriptors.",
        "AC4: Given a call without a token, without a workload identity or without the scope of the operation, or a workload call that forwards no tenant, when it reaches one of the three operations, then it is refused before any handler runs and nothing is read (ADR-0015); given the service starts, when liveness and readiness are probed, then liveness answers and readiness is unready until `mcp-server-registry-sql` is migrated and the identity authority is reachable (model/services/tools-mcp/McpServerRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/backlog/features/tools-mcp.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/tool-invocation.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-075",
        "AIFACTORY-TASK-790"
      ],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6701,
      "kind": "behavior",
      "traces": {
        "services": [
          "McpServerRegistryService"
        ],
        "apis": [
          "McpServerRegistryService/ListMcpServers",
          "McpServerRegistryService/McpRegistry.ResolveTool",
          "McpServerRegistryService/McpRegistry.ListCapabilities"
        ],
        "descriptors": [
          "tool-invocation-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-596",
        "AIFACTORY-US-597",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/backlog/features/tools-mcp.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/tool-invocation.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-064]",
      "number": 64
    },
    {
      "id": "AIFACTORY-TASK-075",
      "type": "task",
      "parent": "AIFACTORY-US-064",
      "title": "Contract of the thin surface: service descriptor, OpenAPI document of ListMcpServers and proto of McpRegistry.ResolveTool and McpRegistry.ListCapabilities",
      "sequence": "05.01.01.01",
      "description": "Contract of the thin surface: service descriptor, OpenAPI document of ListMcpServers and proto of McpRegistry.ResolveTool and McpRegistry.ListCapabilities. Expected output: The service descriptor file of the repository lists exactly ListMcpServers (GET /factory/mcp-servers, scope factory.tools.read, class read) and the internal gRPC methods McpRegistry.ResolveTool and McpRegistry.ListCapabilities (no streaming, class read). The OpenAPI document fixes the paged list with serverId, name, direction, transport, authentication, state and the binding counts of a server. The proto fixes the request message of ResolveTool (toolId and toolVersion), its reply message (serverId, transport, endpointRef or commandRef, authentication, governancePolicyRef, protocolVersion, toolName, schemaHash and declaredClass, and no credential value), the request message of ListCapabilities (the execution scope) and its reply message (tools, resources and prompts, each with its binding). A contract test with golden files holds the three shapes; it does not validate a reply against docs/reference/schemas/tool-invocation.schema.json, which describes a tool call and has no member for a transport, a binding or an authentication, and that difference is the open point the PBI reports. The golden files of the two gRPC messages are provisional until the owner names the request and reply descriptors of the two methods, the replaced request descriptor of ResolveTool included; only the shape of the list is meant to stay for the complete delivery. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file of the repository lists exactly ListMcpServers (GET /factory/mcp-servers, scope factory.tools.read, class read) and the internal gRPC methods McpRegistry.ResolveTool and McpRegistry.ListCapabilities (no streaming, class read). The OpenAPI document fixes the paged list with serverId, name, direction, transport, authentication, state and the binding counts of a server. The proto fixes the request message of ResolveTool (toolId and toolVersion), its reply message (serverId, transport, endpointRef or commandRef, authentication, governancePolicyRef, protocolVersion, toolName, schemaHash and declaredClass, and no credential value), the request message of ListCapabilities (the execution scope) and its reply message (tools, resources and prompts, each with its binding). A contract test with golden files holds the three shapes; it does not validate a reply against docs/reference/schemas/tool-invocation.schema.json, which describes a tool call and has no member for a transport, a binding or an authentication, and that difference is the open point the PBI reports. The golden files of the two gRPC messages are provisional until the owner names the request and reply descriptors of the two methods, the replaced request descriptor of ResolveTool included; only the shape of the list is meant to stay for the complete delivery. The contract test of the Factory profile compares the hosted endpoints with the service descriptor file in both directions, so callers run against this service without a fake."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6701,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-075]",
      "number": 75
    },
    {
      "id": "AIFACTORY-TASK-790",
      "type": "task",
      "parent": "AIFACTORY-US-064",
      "title": "Verify mcp-server-registry-service-thin-contract by running the declared command",
      "sequence": "05.01.01.02",
      "description": "Verify mcp-server-registry-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-064, that is the scaffold, the three hosted operations answering on an empty store (SCN-McpServerRegistryService-001, SCN-McpServerRegistryService-007, SCN-McpServerRegistryService-008), the thin surface against the service descriptor, the golden files of the three shapes, readiness that stays unready until the store is migrated and the refusal of a caller without a token, a workload identity or the scope.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-064, that is the scaffold, the three hosted operations answering on an empty store (SCN-McpServerRegistryService-001, SCN-McpServerRegistryService-007, SCN-McpServerRegistryService-008), the thin surface against the service descriptor, the golden files of the three shapes, readiness that stays unready until the store is migrated and the refusal of a caller without a token, a workload identity or the scope."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-790]",
      "number": 790
    },
    {
      "id": "AIFACTORY-US-596",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-028",
      "title": "List the MCP servers of the tenant from a static registry whose store holds no server",
      "sequence": "05.01.02",
      "description": "As an asset maintainer, I want to list the MCP servers registered for my tenant and see that none exists yet, so that I know that every tool of a run is native until a server is registered and activated through the complete registry. A caller whose scope carries `factory.tools.read` lists the registered MCP servers through the gateway route of `McpServerRegistryService/ListMcpServers`; the roles of the model that read the registry are Asset maintainer, Operator, Platform admin and Observer. ToolExecutorHost forwards the user token unchanged, and the service validates it again, accepts the audience of its own gateway and takes the tenant from the token, never from a header or the query (ADR-0015 amendment D117). A server belongs to a tenant: the table `McpServers` has a tenant column and no project column, so the list is filtered by the tenant row filter of the Factory profile and by nothing else. The response is 200 with a paged list in which each server carries `serverId`, `name`, `direction`, `transport`, `authentication`, `state` and the counts of its tool, resource and prompt bindings, the bound and the unbound tools counted apart. The thin delivery migrates the four tables of the model in `mcp-server-registry-sql`, the store this service owns: `McpServers` with the index on tenant, state and direction, `McpToolBindings`, `McpResourceBindings` and `McpPromptBindings`, each with the tenant column. No column holds a credential value, because a consumed server names a connection reference in `EndpointRef` and its credentials are brokered. No operation of the thin delivery writes a row, so on a deployed instance the answer is an empty, well-formed list for every tenant, in the response shape the complete delivery fills. The read model itself is real and is proven as such: the acceptance suite inserts fixture rows of two tenants directly into the isolated test database, because no operation writes them, and the list returns the server of a tenant with its counts to that tenant and never to the other one. A call without a token is answered 401 and a token without `factory.tools.read` 403, each with a problem response; the list never confirms that a server of another tenant exists. Nothing is written by the read and no event is published. The metric `connectsoft.factory.tools.mcp_servers` is registered with its dimensions tenant, direction, state and authentication and records nothing, because it moves with a state change of a server and the thin delivery has none. Kind: behavior. Traces: services: McpServerRegistryService; aggregates: McpServerRegistryService/McpServer; apis: McpServerRegistryService/ListMcpServers; adrs: ADR-0015, ADR-0022; requirements: FR-05, FUX-02; scenarios: SCN-McpServerRegistryService-001. Depends on: feature:component-base-template-factory-profile. Sources: model/services/tools-mcp/McpServerRegistryService.yaml, model/backlog/features/tools-mcp.yaml, docs/planes/capability-tools/tools/services/mcp-server-registry-service/index.md#data-model-and-storage, docs/planes/capability-tools/tools/services/mcp-server-registry-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller whose scope carries `factory.tools.read` and the deployed thin service with its empty store, when `McpServerRegistryService/ListMcpServers` is called, then the response is 200 with an empty paged list in the response shape of the OpenAPI document, nothing is written and no event is published (SCN-McpServerRegistryService-001).",
        "AC2: Given fixture rows inserted directly into the isolated test database, one `McpServerRegistryService/McpServer` of tenant A in state Active with two bound tool bindings and one unbound, when a caller of tenant A and a caller of tenant B each call `McpServerRegistryService/ListMcpServers`, then tenant A receives the server with `serverId`, `name`, `direction`, `transport`, `authentication`, `state` and the binding counts and tenant B receives an empty list that does not reveal the server (SCN-McpServerRegistryService-001, ADR-0015).",
        "AC3: Given a call without a token or a token without `factory.tools.read`, when `McpServerRegistryService/ListMcpServers` is called, then the response is 401 or 403 with a problem response, no row is read and no state changes (SCN-McpServerRegistryService-001, ADR-0015).",
        "AC4: Given the migrated `mcp-server-registry-sql`, when its schema is compared with model/services/tools-mcp/McpServerRegistryService.yaml, then the tables `McpServers`, `McpToolBindings`, `McpResourceBindings` and `McpPromptBindings` exist with their columns, keys and the index on tenant, state and direction, every table carries the tenant column under the row filter, no column holds a credential value, and no operation of the thin delivery writes a row (ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/backlog/features/tools-mcp.yaml",
        "docs/planes/capability-tools/tools/services/mcp-server-registry-service/index.md#data-model-and-storage",
        "docs/planes/capability-tools/tools/services/mcp-server-registry-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-074",
        "AIFACTORY-TASK-2401",
        "AIFACTORY-TASK-2402"
      ],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6702,
      "kind": "behavior",
      "traces": {
        "services": [
          "McpServerRegistryService"
        ],
        "aggregates": [
          "McpServerRegistryService/McpServer"
        ],
        "apis": [
          "McpServerRegistryService/ListMcpServers"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "FUX-02"
        ],
        "scenarios": [
          "SCN-McpServerRegistryService-001"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/backlog/features/tools-mcp.yaml",
        "docs/planes/capability-tools/tools/services/mcp-server-registry-service/index.md#data-model-and-storage",
        "docs/planes/capability-tools/tools/services/mcp-server-registry-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-596]",
      "number": 596
    },
    {
      "id": "AIFACTORY-TASK-074",
      "type": "task",
      "parent": "AIFACTORY-US-596",
      "title": "Migration and read mappings of McpServers, McpToolBindings, McpResourceBindings and McpPromptBindings in mcp-server-registry-sql",
      "sequence": "05.01.02.01",
      "description": "Migration and read mappings of McpServers, McpToolBindings, McpResourceBindings and McpPromptBindings in mcp-server-registry-sql. Expected output: The four tables of model/services/tools-mcp/McpServerRegistryService.yaml exist with their columns, keys, foreign keys and the index IX_McpServers_Tenant_State; the read mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one. No write path exists in the thin delivery: the store of a deployed instance stays empty, which is the static registry without MCP servers the feature states, and the write paths of registration, discovery, activation and retirement are added by feature mcp-server-registry-service-complete on the same tables.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The four tables of model/services/tools-mcp/McpServerRegistryService.yaml exist with their columns, keys, foreign keys and the index IX_McpServers_Tenant_State; the read mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one. No write path exists in the thin delivery: the store of a deployed instance stays empty, which is the static registry without MCP servers the feature states, and the write paths of registration, discovery, activation and retirement are added by feature mcp-server-registry-service-complete on the same tables."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6702,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-074]",
      "number": 74
    },
    {
      "id": "AIFACTORY-TASK-2401",
      "type": "task",
      "parent": "AIFACTORY-US-596",
      "title": "ListMcpServers read model with the tenant row filter, paging and binding counts",
      "sequence": "05.01.02.02",
      "description": "ListMcpServers read model with the tenant row filter, paging and binding counts. Expected output: ListMcpServers returns the servers of the trusted tenant paged, each with serverId, name, direction, transport, authentication, state and the counts of bound tools, unbound tools, resources and prompts, takes the tenant from the validated token, answers 401 without a token and 403 without factory.tools.read through the policies of the Factory profile, writes nothing and returns an empty list when the tenant has no server; the meter connectsoft.factory.tools.mcp_servers is registered with its modelled dimensions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "ListMcpServers returns the servers of the trusted tenant paged, each with serverId, name, direction, transport, authentication, state and the counts of bound tools, unbound tools, resources and prompts, takes the tenant from the validated token, answers 401 without a token and 403 without factory.tools.read through the policies of the Factory profile, writes nothing and returns an empty list when the tenant has no server; the meter connectsoft.factory.tools.mcp_servers is registered with its modelled dimensions."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2401]",
      "number": 2401
    },
    {
      "id": "AIFACTORY-TASK-2402",
      "type": "task",
      "parent": "AIFACTORY-US-596",
      "title": "Verify the list of the static registry through the acceptance suite",
      "sequence": "05.01.02.03",
      "description": "Verify the list of the static registry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-McpServerRegistryService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-596: the empty list of a deployed instance, the two-tenant fixture rows inserted directly into the isolated test database, the 401 and the 403, and the schema of the four tables compared with the model.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-McpServerRegistryService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-596: the empty list of a deployed instance, the two-tenant fixture rows inserted directly into the isolated test database, the 401 and the 403, and the schema of the four tables compared with the model."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2402]",
      "number": 2402
    },
    {
      "id": "AIFACTORY-US-597",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-028",
      "title": "Resolve a tool to its MCP server for the executor and list the capabilities of a scope, both answered from a registry without servers",
      "sequence": "05.01.03",
      "description": "As an operator, I want the executor to learn from the registry, and from nowhere else, whether a tool is served by an MCP server, so that no tool call reaches an MCP server that the registry does not hold as registered and bound. ToolAdapterService resolves a tool whose descriptor is of kind Mcp before it executes it: the internal gRPC method `McpServerRegistryService/McpRegistry.ResolveTool` turns a tool id and version into the server, the transport, the binding and the authentication the executor needs. The caller presents a workload token. Such a token carries service scopes and no tenant claim, so the service reads the tenant the caller forwards only when the token holds the service scope that names McpServerRegistryService (ADR-0015 amendment D114). The forwarded tenant travels in the gRPC metadata of the call, and the tenant row filter of both methods runs on it and on nothing in the request body. A workload call that forwards no tenant is refused with UNAUTHENTICATED by the Factory profile before any handler runs, as the profile answers 401 for it over REST. The request message names `toolId` and `toolVersion`. The lookup runs in `McpToolBindings` under the tenant row filter for a binding that is bound to that tool version and whose server is Active, and the reply message carries `serverId`, `transport`, `endpointRef` or `commandRef`, `authentication`, `governancePolicyRef`, `protocolVersion`, `toolName`, `schemaHash` and `declaredClass`. It never carries a credential: the registry stores no secret, and the executor obtains the credential of a consumed server through its connection and the Secret Broker (ADR-0022 decision 6). The method is of class read and writes nothing. In the thin delivery no server and no binding exists, so every resolution on a deployed instance is answered NOT_FOUND. That is the answer of the same contract for a tool without a bound, Active server, and it is also the answer for a binding of another tenant, which is never confirmed to exist. The executor calls the method only for a descriptor of kind Mcp, and none is active in this increment, so the fifteen native tools of the chain are never resolved here; what ToolAdapterService does with a NOT_FOUND is stated in its own feature. How an unbound binding and a Degraded server are answered belongs to the complete delivery, which owns discovery and the handshake probe. The second method, `McpServerRegistryService/McpRegistry.ListCapabilities`, returns the tools, resources and prompts visible to a scope, for the clients that connect to the MCP endpoint the Factory exposes. In I1 that endpoint serves only calls bound to a run, a step and an attempt; IDE clients and partner agents, for whom the model names this method, arrive with the complete McpServerRegistryService in I5 (D121). Its request is `execution-scope-v1`, the scope of the client whose list is built; the reply lists each capability with its binding under the tenant row filter of the forwarded tenant, an unbound tool listed as not invocable. The tenant in the request body never selects rows: an `execution-scope-v1` whose `tenantId` differs from the forwarded tenant is refused with PERMISSION_DENIED and the reason scope-mismatch, and nothing is listed. In the thin delivery the reply is an empty, well-formed list for every scope, so the exposed endpoint lists no tool in this increment. Both methods refuse a call without a workload identity, and a workload call that forwards no tenant, with UNAUTHENTICATED, and a token without the service scope with PERMISSION_DENIED. INVALID_ARGUMENT is the answer for a request without a tool id and never for a missing or a differing tenant. When `mcp-server-registry-sql` is unavailable the call fails with UNAVAILABLE and no partial reply; the dependency is fail-fast for ToolAdapterService, which then executes no tool of kind Mcp. The found replies are proven with fixture rows inserted directly into the isolated test database, because no operation of the thin delivery writes them. The open point of the request and reply descriptors is the one AIFACTORY-US-064 records, and the two messages stay provisional until the owner names them. Kind: behavior. Traces: services: McpServerRegistryService; aggregates: McpServerRegistryService/McpServer; apis: McpServerRegistryService/McpRegistry.ResolveTool, McpServerRegistryService/McpRegistry.ListCapabilities; descriptors: tool-invocation-v1, execution-scope-v1; adrs: ADR-0015, ADR-0022; requirements: FR-05, NFR-02; scenarios: SCN-McpServerRegistryService-007, SCN-McpServerRegistryService-008. Depends on: AIFACTORY-US-596, feature:component-base-template-factory-profile. Sources: model/services/tools-mcp/McpServerRegistryService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml, docs/reference/schemas/tool-invocation.schema.json, docs/planes/capability-tools/mcp.md.",
      "acceptanceCriteria": [
        "AC1: Given a fixture binding inserted directly into the isolated test database, a tool version bound to an Active `McpServerRegistryService/McpServer` of tenant A, when `McpServerRegistryService/McpRegistry.ResolveTool` is called with `toolId` and `toolVersion` under a workload token that holds the service scope and forwards tenant A, then the reply message carries `serverId`, `transport`, `endpointRef`, `authentication`, `governancePolicyRef`, `protocolVersion`, `toolName`, `schemaHash` and `declaredClass`, no credential value, and nothing is written (SCN-McpServerRegistryService-007, ADR-0022).",
        "AC2: Given the deployed thin service with its empty store, when `McpServerRegistryService/McpRegistry.ResolveTool` is called for each of the fifteen tool ids the chain names, then every call is answered NOT_FOUND; given the fixture binding of tenant A, when the call forwards tenant B, then the answer is NOT_FOUND exactly as for an unknown tool id and never confirms the binding (SCN-McpServerRegistryService-007, ADR-0015).",
        "AC3: Given a caller without a workload identity, a workload call that forwards no tenant in the gRPC metadata, a workload token without the service scope, a request of `McpServerRegistryService/McpRegistry.ResolveTool` without a tool id, or an unavailable `mcp-server-registry-sql`, when `McpServerRegistryService/McpRegistry.ResolveTool` or `McpServerRegistryService/McpRegistry.ListCapabilities` is called, then the call is refused with UNAUTHENTICATED, UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or UNAVAILABLE respectively, the two UNAUTHENTICATED answers come from the Factory profile before any handler runs, INVALID_ARGUMENT is never the answer for a missing tenant, no partial reply is returned and no state changes (SCN-McpServerRegistryService-007, SCN-McpServerRegistryService-008, ADR-0015, model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml).",
        "AC4: Given a workload token that holds the service scope and forwards tenant A on the deployed thin service, when `McpServerRegistryService/McpRegistry.ListCapabilities` is called with an `execution-scope-v1` of tenant A, then the reply is an empty list of tools, resources and prompts; given fixture bindings of tenant A, when the call forwards tenant A, then they are listed with their binding and an unbound tool is marked as not invocable; when the call forwards tenant B with a scope of tenant B, then nothing of tenant A is listed; when the call forwards tenant B with an `execution-scope-v1` that names tenant A, then it is refused with PERMISSION_DENIED and the reason scope-mismatch and nothing is listed; nothing is written in any case (SCN-McpServerRegistryService-008, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/planes/capability-tools/mcp.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2403",
        "AIFACTORY-TASK-2404",
        "AIFACTORY-TASK-2405",
        "AIFACTORY-TASK-2406"
      ],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6703,
      "kind": "behavior",
      "traces": {
        "services": [
          "McpServerRegistryService"
        ],
        "aggregates": [
          "McpServerRegistryService/McpServer"
        ],
        "apis": [
          "McpServerRegistryService/McpRegistry.ResolveTool",
          "McpServerRegistryService/McpRegistry.ListCapabilities"
        ],
        "descriptors": [
          "tool-invocation-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-McpServerRegistryService-007",
          "SCN-McpServerRegistryService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-596",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/planes/capability-tools/mcp.md"
      ],
      "titlePrefix": "[AIFACTORY-US-597]",
      "number": 597
    },
    {
      "id": "AIFACTORY-TASK-2403",
      "type": "task",
      "parent": "AIFACTORY-US-597",
      "title": "McpRegistry.ResolveTool over the bindings with workload scope checks and the tenant row filter",
      "sequence": "05.01.03.01",
      "description": "McpRegistry.ResolveTool over the bindings with workload scope checks and the tenant row filter. Expected output: McpRegistry.ResolveTool takes the request message of AIFACTORY-TASK-075 (toolId and toolVersion), looks the bound binding of an Active server up under the tenant the caller forwards in the gRPC metadata and returns the reply message with serverId, transport, endpointRef or commandRef, authentication, governancePolicyRef, protocolVersion, toolName, schemaHash and declaredClass and no credential value; the tenant row filter runs on the forwarded tenant, which is read only under the service scope; a call that forwards no tenant is refused with UNAUTHENTICATED by the Factory profile before the handler; a token without the service scope is answered PERMISSION_DENIED; INVALID_ARGUMENT answers a missing tool id only; NOT_FOUND answers a tool without a bound binding of an Active server and a binding of another tenant alike (ADR-0015); an unavailable store is answered UNAVAILABLE; nothing is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "McpRegistry.ResolveTool takes the request message of AIFACTORY-TASK-075 (toolId and toolVersion), looks the bound binding of an Active server up under the tenant the caller forwards in the gRPC metadata and returns the reply message with serverId, transport, endpointRef or commandRef, authentication, governancePolicyRef, protocolVersion, toolName, schemaHash and declaredClass and no credential value; the tenant row filter runs on the forwarded tenant, which is read only under the service scope; a call that forwards no tenant is refused with UNAUTHENTICATED by the Factory profile before the handler; a token without the service scope is answered PERMISSION_DENIED; INVALID_ARGUMENT answers a missing tool id only; NOT_FOUND answers a tool without a bound binding of an Active server and a binding of another tenant alike (ADR-0015); an unavailable store is answered UNAVAILABLE; nothing is written."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2403]",
      "number": 2403
    },
    {
      "id": "AIFACTORY-TASK-2404",
      "type": "task",
      "parent": "AIFACTORY-US-597",
      "title": "McpRegistry.ListCapabilities over the bindings of a scope",
      "sequence": "05.01.03.02",
      "description": "McpRegistry.ListCapabilities over the bindings of a scope. Expected output: McpRegistry.ListCapabilities takes an execution scope and returns the tools, resources and prompts of the tenant the caller forwards in the gRPC metadata with their bindings, an unbound tool marked as not invocable, and an empty well-formed list when the tenant has none; the tenant of the request body never selects rows, and an execution scope whose tenant differs from the forwarded tenant is refused with PERMISSION_DENIED and the reason scope-mismatch without listing anything; a call that forwards no tenant is refused with UNAUTHENTICATED by the Factory profile; the method applies the same workload scope checks as ResolveTool and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "McpRegistry.ListCapabilities takes an execution scope and returns the tools, resources and prompts of the tenant the caller forwards in the gRPC metadata with their bindings, an unbound tool marked as not invocable, and an empty well-formed list when the tenant has none; the tenant of the request body never selects rows, and an execution scope whose tenant differs from the forwarded tenant is refused with PERMISSION_DENIED and the reason scope-mismatch without listing anything; a call that forwards no tenant is refused with UNAUTHENTICATED by the Factory profile; the method applies the same workload scope checks as ResolveTool and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2404]",
      "number": 2404
    },
    {
      "id": "AIFACTORY-TASK-2405",
      "type": "task",
      "parent": "AIFACTORY-US-597",
      "title": "Two-tenant fixture rows and workload tokens of the acceptance suite",
      "sequence": "05.01.03.03",
      "description": "Two-tenant fixture rows and workload tokens of the acceptance suite. Expected output: The acceptance suite holds a fixture that inserts one Active server of tenant A with a bound tool binding, an unbound tool binding, a resource binding and a prompt binding directly into the isolated test database, workload tokens with and without the service scope, a workload call that forwards no tenant, a request whose execution scope names another tenant than the forwarded one, a call without identity, and a switch that stops the store; the fixture is the only writer of the tables, because the thin delivery has no write path (model/services/tools-mcp/McpServerRegistryService.yaml).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fixture that inserts one Active server of tenant A with a bound tool binding, an unbound tool binding, a resource binding and a prompt binding directly into the isolated test database, workload tokens with and without the service scope, a workload call that forwards no tenant, a request whose execution scope names another tenant than the forwarded one, a call without identity, and a switch that stops the store; the fixture is the only writer of the tables, because the thin delivery has no write path (model/services/tools-mcp/McpServerRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2405]",
      "number": 2405
    },
    {
      "id": "AIFACTORY-TASK-2406",
      "type": "task",
      "parent": "AIFACTORY-US-597",
      "title": "Verify the two registry methods through the acceptance suite",
      "sequence": "05.01.03.04",
      "description": "Verify the two registry methods through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-McpServerRegistryService-007|Scenario=SCN-McpServerRegistryService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-597: the found reply on the fixture binding, NOT_FOUND for the fifteen tool ids of the chain on an empty store and for a binding of another tenant, the five refusals with UNAUTHENTICATED for a call that forwards no tenant, the empty and the fixture capability lists, and PERMISSION_DENIED with the reason scope-mismatch for an execution scope of another tenant than the forwarded one.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-McpServerRegistryService-007|Scenario=SCN-McpServerRegistryService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-597: the found reply on the fixture binding, NOT_FOUND for the fifteen tool ids of the chain on an empty store and for a binding of another tenant, the five refusals with UNAUTHENTICATED for a call that forwards no tenant, the empty and the fixture capability lists, and PERMISSION_DENIED with the reason scope-mismatch for an execution scope of another tenant than the forwarded one."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 67,
      "phase": "factory",
      "stackRank": 6703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2406]",
      "number": 2406
    },
    {
      "id": "AIFACTORY-FEAT-029",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-005",
      "title": "ToolAdapterService: complete delivery",
      "sequence": "05.02",
      "description": "ToolAdapterService is the service of bounded context BC-08 (Tool Execution). The one path for every tool call (GW-05): descriptor validation, permission and policy, class raised by the environment, approval binding for gated classes, brokered credentials and sandbox, execution of native, MCP or shell tools, sanitized results, receipts and audit; unconfirmed effects settle as Uncertain (BC-08). Its own repository is ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Delivers: ToolAdapterService (complete). Increment I1: Generate a microservice. Build order 68 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-014",
        "AIFACTORY-US-598",
        "AIFACTORY-US-599",
        "AIFACTORY-US-600",
        "AIFACTORY-US-601",
        "AIFACTORY-US-602",
        "AIFACTORY-US-603",
        "AIFACTORY-US-604",
        "AIFACTORY-US-605",
        "AIFACTORY-US-606",
        "AIFACTORY-US-607",
        "AIFACTORY-US-608",
        "AIFACTORY-US-609",
        "AIFACTORY-US-610"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6800,
      "titlePrefix": "[AIFACTORY-FEAT-029]",
      "number": 29
    },
    {
      "id": "AIFACTORY-US-014",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Tools run in a sandbox under policy",
      "sequence": "05.02.01",
      "description": "As an operator, I want every write, shell and build tool an agent calls to run inside a leased sandbox after a policy decision, so that generated code is built and tested without touching anything outside the run. This is the integration PBI of the governed tool executor. Every tool call of the Factory passes ToolAdapterService (ADR-0022 decision 2, GW-05). In I1 every call it serves is bound to a run, a step and an attempt; IDE clients and partner agents arrive with the complete McpServerRegistryService in I5 (D121). An agent host of the Agent Mesh sends the call with the Factory tool client of the pinned AI libraries (feature `component-extensions-ai`) through the gateway ToolExecutorHost to `ToolAdapterService/ToolExecutor.Invoke`, under a workload token and with the fencing token of its lease. The pipeline order is fixed and no stage is skipped: schema validation, agent permission, tenant policy, side-effect classification, approval where the policy decision asks for one, credential broker, sandbox, execution, result sanitization, audit. In the first outcome the nine agents of the chain read the workspace of their run, write files, build and test in a leased sandbox, validate and submit blueprint versions and propose one change set. The workspace of a run belongs to ExecutionCapacityService, which feature `execution-capacity-service-thin` delivers: that service creates it with the first lease of the run, keeps it between leases and removes it on a terminal run event, and the executor mounts it by lease and neither stores nor removes it (D121). Two tools of the chain are of class shared-write. `blueprint-submit-version` is called by four of the six definitions of the chain and stores a Draft version, which is autonomous by default and gated only where the project policy says so (ADR-0026 amendment D64). `propose-change-set` executes only with an approval that RunControlService owns, unless the project policy allows autonomous proposals. Whether a call needs an approval is therefore read from the outcome of the policy decision and never from the class alone (AIFACTORY-US-604). The owner confirmed this reading and the invariant of `ToolInvocation` states it: an approval is needed only when `Policy.Decide` answers `allow-with-approval`, `allow` executes without one, `deny` ends the invocation Denied, `allow-with-constraints` executes with the constraints applied, a constraint that cannot be applied denies the call, and decision D64 stays (D121). The rule is the only gate for every side-effect class, shared-write, production, publication, external and spend alike, and the default policy bundle that answers `allow-with-approval` for production, publication, external and spend calls belongs to PolicyEngineService (D123). The feature is delivered by thirteen further PBIs: the seeded descriptors of the sixteen tools the chain names (AIFACTORY-US-598), the descriptor read model with activation and retirement (AIFACTORY-US-599), descriptor health and availability (AIFACTORY-US-600), validation and dry run (AIFACTORY-US-601), the pipeline of a call up to its receipt (AIFACTORY-US-602), denials (AIFACTORY-US-603), gated calls and their approval binding (AIFACTORY-US-604), sandbox leases and brokered credentials (AIFACTORY-US-605), the executors of native and shell tools (AIFACTORY-US-606), MCP tools and the hosted MCP endpoint (AIFACTORY-US-607), interruption and uncertain effects (AIFACTORY-US-608), the finding of the Operator on an uncertain effect, which RunControlService records in the same act as the decision of the Operator (AIFACTORY-US-609) and the receipts of a run (AIFACTORY-US-610). The repository ConnectSoft.AI.SoftwareFactory.ToolAdapterService is created and scaffolded in I0 by AIFACTORY-TASK-076 of feature repository-and-pipeline-conventions (D140) from the pinned base template package with `UseFactoryProfile`, and this feature starts from that scaffold, so token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile. The service owns `tool-adapter-sql` with the tables `ToolDescriptors`, `ToolInvocations` and `SandboxLeases`, serialises the pipeline of one invocation in its `ToolInvocationGrain` and writes its seven events in the run event envelope of the pinned contracts package through the Orleans outbox of the messaging profile `tool-adapter`, each in the transaction of the state change it announces. The delivery states its limits. The handler of `DeletionOrderIssued` is built in I4 with RetentionResidencyService and is not registered here. The thin AgentRegistryService of this increment publishes no release event, so descriptors come from the seed; the thin McpServerRegistryService holds no server, so no MCP call leaves a deployed instance and the MCP path is proven against a fixture server. Telemetry follows the Factory conventions: metrics carry tenant and project beside their modelled dimensions, activities and log records carry run, step and attempt, and no tool argument, tool output or credential reaches a metric, an activity or a log record; a hash or an artifact reference stands in its place (ADR-0019). Kind: behavior. Traces: services: ToolAdapterService, ToolExecutorHost, PolicyEngineService, ExecutionCapacityService, SecretBrokerService, RepositoryIntelligenceService, McpServerRegistryService; aggregates: ToolAdapterService/ToolInvocation, ToolAdapterService/ToolDescriptor, PolicyEngineService/PolicyDecision; apis: ToolAdapterService/ToolExecutor.Invoke, PolicyEngineService/Policy.Decide, ExecutionCapacityService/Capacity.AcquireLease, SecretBrokerService/SecretBroker.Issue; events: ToolAdapterService/ToolInvoked, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/SandboxLeased; tools: shell-sandbox, apply-patch, write-file, build-and-test, list-files, search-text, search-symbols, find-references, read-range, get-dependencies, get-git-diff, blueprint-submit-version, record-generated-output, propose-change-set; adrs: ADR-0014, ADR-0015, ADR-0019, ADR-0022, ADR-0026, ADR-0028; requirements: FR-05, NFR-02, NFR-10. Depends on: AIFACTORY-US-598, AIFACTORY-US-599, AIFACTORY-US-600, AIFACTORY-US-601, AIFACTORY-US-602, AIFACTORY-US-603, AIFACTORY-US-604, AIFACTORY-US-605, AIFACTORY-US-606, AIFACTORY-US-607, AIFACTORY-US-608, AIFACTORY-US-609, AIFACTORY-US-610, feature:policy-engine-service, feature:execution-capacity-service-thin, feature:secret-broker-service, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:component-extensions-ai, feature:component-observability-factory-conventions. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/backlog/features/tools-mcp.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/adr/0026-requirements-to-ux-handoff.md, docs/architecture/adr/0019-data-governance.md, model/tools/blueprint-submit-version.yaml, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ToolAdapterService created and scaffolded in I0 by AIFACTORY-TASK-076 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ToolAdapterService --UseFactoryProfile true` from the pinned template package, when its pipeline runs, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/tools-mcp/ToolAdapterService.yaml).",
        "AC2: Given an attempt of the chain that holds a lease and the seeded sandbox-class tool `build-and-test`, when its agent host calls `ToolAdapterService/ToolExecutor.Invoke`, then the decision is obtained through `PolicyEngineService/Policy.Decide`, a sandbox is leased through `ExecutionCapacityService/Capacity.AcquireLease` with `ToolAdapterService/SandboxLeased` written, the `ToolAdapterService/ToolInvocation` is recorded with its declared and its effective class and ends Observed with a receipt and `ToolAdapterService/ToolInvoked`, as AIFACTORY-US-602 and AIFACTORY-US-605 prove (FR-05).",
        "AC3: Given a tool whose descriptor names a secret dependency, when it runs, then a short-lived credential is issued through `SecretBrokerService/SecretBroker.Issue`, is injected into the sandbox or the connector call and appears in no result, receipt, event, log record or reply to the agent (ADR-0022, docs/planes/capability-tools/tool-policies.md).",
        "AC4: Given a read tool of the chain, when it runs, then it sees the workspace of its run only; given a call the policy denies, when it is refused, then `ToolAdapterService/ToolInvocationDenied` is written with the reason and the stage and the agent receives the refusal as the reply of `ToolAdapterService/ToolExecutor.Invoke`, as AIFACTORY-US-603 and AIFACTORY-US-606 prove (FR-05, ADR-0015).",
        "AC5: Given invocations of two tenants and projects, when metrics, activities and log records are read, then the seven metrics of model/services/tools-mcp/ToolAdapterService.yaml are recorded with their modelled dimensions and with tenant and project, activities and log records carry run, step and attempt, and no record holds a tool argument, a tool output or a credential (ADR-0019, NFR-10)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/backlog/features/tools-mcp.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/architecture/adr/0019-data-governance.md",
        "model/tools/blueprint-submit-version.yaml",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-077",
        "AIFACTORY-TASK-078",
        "AIFACTORY-TASK-079",
        "AIFACTORY-TASK-080",
        "AIFACTORY-TASK-081",
        "AIFACTORY-TASK-082",
        "AIFACTORY-TASK-791"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "ToolExecutorHost",
          "PolicyEngineService",
          "ExecutionCapacityService",
          "SecretBrokerService",
          "RepositoryIntelligenceService",
          "McpServerRegistryService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation",
          "ToolAdapterService/ToolDescriptor",
          "PolicyEngineService/PolicyDecision"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Invoke",
          "PolicyEngineService/Policy.Decide",
          "ExecutionCapacityService/Capacity.AcquireLease",
          "SecretBrokerService/SecretBroker.Issue"
        ],
        "events": [
          "ToolAdapterService/ToolInvoked",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/SandboxLeased"
        ],
        "tools": [
          "shell-sandbox",
          "apply-patch",
          "write-file",
          "build-and-test",
          "list-files",
          "search-text",
          "search-symbols",
          "find-references",
          "read-range",
          "get-dependencies",
          "get-git-diff",
          "blueprint-submit-version",
          "record-generated-output",
          "propose-change-set"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022",
          "ADR-0026",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "NFR-02",
          "NFR-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-598",
        "AIFACTORY-US-599",
        "AIFACTORY-US-600",
        "AIFACTORY-US-601",
        "AIFACTORY-US-602",
        "AIFACTORY-US-603",
        "AIFACTORY-US-604",
        "AIFACTORY-US-605",
        "AIFACTORY-US-606",
        "AIFACTORY-US-607",
        "AIFACTORY-US-608",
        "AIFACTORY-US-609",
        "AIFACTORY-US-610",
        "feature:policy-engine-service",
        "feature:execution-capacity-service-thin",
        "feature:secret-broker-service",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:component-extensions-ai",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/backlog/features/tools-mcp.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/architecture/adr/0019-data-governance.md",
        "model/tools/blueprint-submit-version.yaml",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-014]",
      "number": 14
    },
    {
      "id": "AIFACTORY-TASK-077",
      "type": "task",
      "parent": "AIFACTORY-US-014",
      "title": "Domain model: ToolDescriptor and ToolInvocation with its SandboxLease",
      "sequence": "05.02.01.01",
      "description": "Domain model: ToolDescriptor and ToolInvocation with its SandboxLease. Expected output: The two aggregates and the SandboxLease entity carry the fields, the invariants and the sixteen transitions of InvocationState as model/services/tools-mcp/ToolAdapterService.yaml states them: the fixed pipeline order, the approval binding of a call only when the policy decision answers allow-with-approval, the denial of a call whose constraint cannot be applied (ConstraintNotApplicable), one execution per idempotency key, the Uncertain end of an unconfirmed effect, the two transitions out of Uncertain that a recorded finding causes (EffectConfirmedApplied to Observed, EffectConfirmedNotApplied to Failed, D121) and the sanitized result; the invocation carries the step id beside the run and the attempt; unit tests cover every invariant and every transition, and a transition the model does not list is refused.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two aggregates and the SandboxLease entity carry the fields, the invariants and the sixteen transitions of InvocationState as model/services/tools-mcp/ToolAdapterService.yaml states them: the fixed pipeline order, the approval binding of a call only when the policy decision answers allow-with-approval, the denial of a call whose constraint cannot be applied (ConstraintNotApplicable), one execution per idempotency key, the Uncertain end of an unconfirmed effect, the two transitions out of Uncertain that a recorded finding causes (EffectConfirmedApplied to Observed, EffectConfirmedNotApplied to Failed, D121) and the sanitized result; the invocation carries the step id beside the run and the attempt; unit tests cover every invariant and every transition, and a transition the model does not list is refused."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-077]",
      "number": 77
    },
    {
      "id": "AIFACTORY-TASK-078",
      "type": "task",
      "parent": "AIFACTORY-US-014",
      "title": "Persistence in tool-adapter-sql: ToolDescriptors, ToolInvocations and SandboxLeases",
      "sequence": "05.02.01.02",
      "description": "Persistence in tool-adapter-sql: ToolDescriptors, ToolInvocations and SandboxLeases. Expected output: Mappings and migrations for the three modelled tables with their tenant columns under the row filter, the nullable StepId column of ToolInvocations beside RunId and AttemptId (D121), the nullable EffectFinding column that keeps the finding ConfirmToolEffect recorded, so that a repeat with the same finding answers as the first and another finding answers 409 (D125), the unique index UX_Invocations_Scope_Idempotency on tenant, project and idempotency key, the indexes on run and attempt, on tenant and state, on active descriptors and on open leases; no column holds an argument, a result or a credential value, only hashes and artifact references; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the three modelled tables with their tenant columns under the row filter, the nullable StepId column of ToolInvocations beside RunId and AttemptId (D121), the nullable EffectFinding column that keeps the finding ConfirmToolEffect recorded, so that a repeat with the same finding answers as the first and another finding answers 409 (D125), the unique index UX_Invocations_Scope_Idempotency on tenant, project and idempotency key, the indexes on run and attempt, on tenant and state, on active descriptors and on open leases; no column holds an argument, a result or a credential value, only hashes and artifact references; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-078]",
      "number": 78
    },
    {
      "id": "AIFACTORY-TASK-079",
      "type": "task",
      "parent": "AIFACTORY-US-014",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 6 REST and 3 gRPC operations",
      "sequence": "05.02.01.03",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 6 REST and 3 gRPC operations. Expected output: The six REST routes and the three gRPC methods of the model are hosted from the service descriptor with JWT validation, the scope of each route (factory.tools.read, factory.runs.read, factory.tools.operate), problem responses for every modelled refusal code, workload identity and service scope checks on ToolExecutor.Invoke, ToolExecutor.Validate and ToolExecutor.Interrupt, and the OpenAPI and proto documents. ConfirmToolEffect is hosted as an internal operation whose one caller is RunControlService and which admits no user token (D121). The proto fixes the request message of ToolExecutor.Invoke as the tool-invocation-v1 document, which carries the optional members fencingToken and toolVersion since D121, so no wrapping message exists; the tenant and the project of a workload call travel in the gRPC metadata. A contract test validates the request message against docs/reference/schemas/tool-invocation.schema.json and the receipt against tool-receipt-v1 with its six statuses, Cancelled among them, and holds both with golden files. The behaviour of each operation is delivered by AIFACTORY-US-599 to AIFACTORY-US-610, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The six REST routes and the three gRPC methods of the model are hosted from the service descriptor with JWT validation, the scope of each route (factory.tools.read, factory.runs.read, factory.tools.operate), problem responses for every modelled refusal code, workload identity and service scope checks on ToolExecutor.Invoke, ToolExecutor.Validate and ToolExecutor.Interrupt, and the OpenAPI and proto documents. ConfirmToolEffect is hosted as an internal operation whose one caller is RunControlService and which admits no user token (D121). The proto fixes the request message of ToolExecutor.Invoke as the tool-invocation-v1 document, which carries the optional members fencingToken and toolVersion since D121, so no wrapping message exists; the tenant and the project of a workload call travel in the gRPC metadata. A contract test validates the request message against docs/reference/schemas/tool-invocation.schema.json and the receipt against tool-receipt-v1 with its six statuses, Cancelled among them, and holds both with golden files. The behaviour of each operation is delivered by AIFACTORY-US-599 to AIFACTORY-US-610, not here."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-079]",
      "number": 79
    },
    {
      "id": "AIFACTORY-TASK-080",
      "type": "task",
      "parent": "AIFACTORY-US-014",
      "title": "Messaging skeleton: outbox and inbox wiring of the tool-adapter profile for 7 published and 9 consumed events",
      "sequence": "05.02.01.04",
      "description": "Messaging skeleton: outbox and inbox wiring of the tool-adapter profile for 7 published and 9 consumed events. Expected output: The outbox writer enlists in the transaction of the invocation and descriptor commands and the dispatcher of the tool-adapter messaging profile publishes the seven modelled events in the run event envelope of the pinned contracts package (ToolDescriptorActivated, ToolDescriptorRetired, ToolInvoked, ToolInvocationDenied, ToolEffectUncertain, SandboxLeased, SandboxReleased); the inbox registers nine of the ten consumed events of the model with idempotency on the event id, and DeletionOrderIssued is not registered, because its handler is built in I4 with RetentionResidencyService; what each handler does is delivered by AIFACTORY-US-599 and AIFACTORY-US-600.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of the invocation and descriptor commands and the dispatcher of the tool-adapter messaging profile publishes the seven modelled events in the run event envelope of the pinned contracts package (ToolDescriptorActivated, ToolDescriptorRetired, ToolInvoked, ToolInvocationDenied, ToolEffectUncertain, SandboxLeased, SandboxReleased); the inbox registers nine of the ten consumed events of the model with idempotency on the event id, and DeletionOrderIssued is not registered, because its handler is built in I4 with RetentionResidencyService; what each handler does is delivered by AIFACTORY-US-599 and AIFACTORY-US-600."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-080]",
      "number": 80
    },
    {
      "id": "AIFACTORY-TASK-081",
      "type": "task",
      "parent": "AIFACTORY-US-014",
      "title": "Worker and grain hosting skeleton: schedules, partitioning and retry policies of UncertainEffectReconciler, SandboxReaper and DescriptorHealthProbe, and the reminders of ToolInvocationGrain",
      "sequence": "05.02.01.05",
      "description": "Worker and grain hosting skeleton: schedules, partitioning and retry policies of UncertainEffectReconciler, SandboxReaper and DescriptorHealthProbe, and the reminders of ToolInvocationGrain. Expected output: The three workers are hosted with their modelled schedules, retry policies, partitioning and idempotency keys, and a duplicate trigger has no second effect; ToolInvocationGrain is registered as a non-reentrant grain keyed by invocationId with its timeout and credential-expiry reminders; what each worker and reminder does is delivered by AIFACTORY-US-600, AIFACTORY-US-605 and AIFACTORY-US-608.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three workers are hosted with their modelled schedules, retry policies, partitioning and idempotency keys, and a duplicate trigger has no second effect; ToolInvocationGrain is registered as a non-reentrant grain keyed by invocationId with its timeout and credential-expiry reminders; what each worker and reminder does is delivered by AIFACTORY-US-600, AIFACTORY-US-605 and AIFACTORY-US-608."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-081]",
      "number": 81
    },
    {
      "id": "AIFACTORY-TASK-082",
      "type": "task",
      "parent": "AIFACTORY-US-014",
      "title": "Security, tenancy and telemetry of ToolAdapterService",
      "sequence": "05.02.01.06",
      "description": "Security, tenancy and telemetry of ToolAdapterService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered, a resource of another tenant is answered 404 and NOT_FOUND, the secrets messaging-transport and mcp-signing-key come from their secret references, and the seven metrics of the model are recorded through the helper of the pinned observability packages with their modelled dimensions and with tenant and project; activities and log records carry run, step and attempt, and a conformance test fails when a tool argument, a tool output or a credential reaches a metric, an activity or a log record (ADR-0019).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered, a resource of another tenant is answered 404 and NOT_FOUND, the secrets messaging-transport and mcp-signing-key come from their secret references, and the seven metrics of the model are recorded through the helper of the pinned observability packages with their modelled dimensions and with tenant and project; activities and log records carry run, step and attempt, and a conformance test fails when a tool argument, a tool output or a credential reaches a metric, an activity or a log record (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-082]",
      "number": 82
    },
    {
      "id": "AIFACTORY-TASK-791",
      "type": "task",
      "parent": "AIFACTORY-US-014",
      "title": "Verify tools-in-a-sandbox by running the declared command",
      "sequence": "05.02.01.07",
      "description": "Verify tools-in-a-sandbox by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a run that discovers no test counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-014: the scaffold, one sandbox-class call of the chain from ToolAdapterService/ToolExecutor.Invoke to ToolAdapterService/ToolInvoked with its lease, a brokered credential that appears nowhere, a read tool bound to the workspace of its run, a denied call, and the telemetry conformance test over two tenants and projects.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a run that discovers no test counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-014: the scaffold, one sandbox-class call of the chain from ToolAdapterService/ToolExecutor.Invoke to ToolAdapterService/ToolInvoked with its lease, a brokered credential that appears nowhere, a read tool bound to the workspace of its run, a denied call, and the telemetry conformance test over two tenants and projects."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-791]",
      "number": 791
    },
    {
      "id": "AIFACTORY-US-598",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Register the seeded descriptors of the sixteen tools the first-outcome chain names",
      "sequence": "05.02.02",
      "description": "As a platform admin, I want the descriptors of the tools of the first-outcome chain registered when the executor starts, so that an attempt can call its tools before tool releases are published through the registry. A descriptor becomes active when the handler `ActivateDescriptors` projects a Published tool asset from `AssetReleasePublished`. The thin AgentRegistryService of this increment publishes no event: publication arrives with feature `agent-registry-service-publication` in I2 (D140). Until then the descriptors the first outcome needs are registered by a seed, the same way the thin registry seeds its Draft releases. The seed set holds one descriptor for each tool that the six workflow definitions of the chain and their nine agents name, sixteen tools of the catalogue under model/tools: `knowledge-search`, `graph-query`, `list-files`, `search-text`, `search-symbols`, `find-references`, `read-range`, `get-dependencies`, `get-git-diff`, `write-file`, `build-and-test`, `blueprint-validate`, `blueprint-submit-version`, `get-approved-recipe`, `record-generated-output` and `propose-change-set`. `record-generated-output` joined the set with decision D133, which binds it to the skill `microservice-generator-record-outputs` of the step `record-outputs` of `generate-product`. The catalogue states for each tool its kind, its side-effect class, its authentication, its limits (timeout, rate per minute, retries) and the fields its audit requires. It does not state a version, a release id, a risk class, a sandbox kind or the JSON schema of input and output, all of which a `ToolDescriptor` requires, so the seed entry states them, and who authors the sixteen descriptor documents is an open point reported to the owner together with the question the thin registry already records for its manifests. The loader reads the seed set from one configured location, the directory named by the configuration key `Tools:Seed:Path`, a key the model does not list and that stays until the tool assets are published through the publication path of AgentRegistryService, feature `agent-registry-service-publication` of I2 (D140). The directory holds one JSON file per tool with the descriptor document and its hash. A tool descriptor is also an element of the closure of the seeded agent releases, which the runtime verifies by hash, so the version and the hash of a seed entry must equal the closure entry of the agents that name the tool. When the service starts, the loader validates each entry: the side-effect class is one of the seven classes and equals the class of the catalogue, the schema is a valid JSON schema, a secret dependency is a reference and never a value. It then writes the descriptor through the same activation path as the handler, active and healthy, in the platform tenant, the tenant of ConnectSoft-published assets that every tenant reads, and `ToolDescriptorActivated` is written in the same transaction. The table requires `ReleaseId`; no tool release exists in the thin AgentRegistryService, whose seed holds workflow and agent releases only, so the loader stores the release id the descriptor document carries, and whether a tool is a release of its own before the publication path of I2 (D140) is part of the open point. The loader is idempotent: a descriptor whose tool id, version and hash are already registered is left as it is and no second event is written. An entry with a wrong hash, an unknown class or an invalid schema fails the loader with the entry named, and no partial descriptor stays registered for it. Readiness stays unready until every seed entry is registered, so the service never answers that a tool of the chain is inactive because its seed was not loaded; the loader is retried in the running process with backoff, without a restart, and liveness keeps answering meanwhile. The acceptance suite proves the loader on a fixture set in the same file shape. Kind: enabling. Traces: services: ToolAdapterService; aggregates: ToolAdapterService/ToolDescriptor; events: ToolAdapterService/ToolDescriptorActivated; tools: knowledge-search, graph-query, list-files, search-text, search-symbols, find-references, read-range, get-dependencies, get-git-diff, write-file, build-and-test, blueprint-validate, blueprint-submit-version, get-approved-recipe, record-generated-output, propose-change-set; adrs: ADR-0021, ADR-0022. Depends on: feature:component-base-template-factory-profile, feature:agent-registry-service-thin. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/tools/propose-change-set.yaml, model/tools/build-and-test.yaml, model/tools/record-generated-output.yaml, model/backlog/pbis/control-plane/agent-registry-service-thin.yaml, docs/planes/capability-tools/tool-registry.md#descriptor.",
      "acceptanceCriteria": [
        "AC1: Given an empty `tool-adapter-sql` and the seed set of sixteen entries in the configured seed location, when the service starts, then `ToolDescriptors` holds sixteen active and healthy `ToolAdapterService/ToolDescriptor` rows in the platform tenant, each with its tool id, version, kind, side-effect class, schema reference, limits and audit requirements, and the side-effect class of each equals the class of its entry under model/tools (ADR-0022).",
        "AC2: Given the seed registered for the first time, when the outbox is read, then one `ToolAdapterService/ToolDescriptorActivated` record per descriptor was written in the transaction that registered it; given the service starts again or two replicas start together, when the loader runs, then no row is duplicated or changed and no second event is written (model/services/tools-mcp/ToolAdapterService.yaml).",
        "AC3: Given a seed entry whose hash does not match its document, whose side-effect class is not one of the seven classes or whose schema is not a valid JSON schema, when the loader runs, then it fails with the entry named, no partial `ToolAdapterService/ToolDescriptor` stays registered for that entry, readiness stays unready until every entry is registered and the loader is retried in the running process with backoff, so that readiness turns ready once the entry is corrected (docs/planes/capability-tools/tool-registry.md).",
        "AC4: Given the seed registered, when the sixteen descriptors are compared with the closure entries of the seeded agent releases that name them, then the version and the hash of each descriptor equal those of the closure entry, so the runtime that verified the closure and the executor that validates the call hold the same descriptor (ADR-0021, model/backlog/pbis/control-plane/agent-registry-service-thin.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/tools/propose-change-set.yaml",
        "model/tools/build-and-test.yaml",
        "model/tools/record-generated-output.yaml",
        "model/backlog/pbis/control-plane/agent-registry-service-thin.yaml",
        "docs/planes/capability-tools/tool-registry.md#descriptor"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-2407",
        "AIFACTORY-TASK-2408",
        "AIFACTORY-TASK-2409"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6802,
      "kind": "enabling",
      "traces": {
        "services": [
          "ToolAdapterService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolDescriptor"
        ],
        "events": [
          "ToolAdapterService/ToolDescriptorActivated"
        ],
        "tools": [
          "knowledge-search",
          "graph-query",
          "list-files",
          "search-text",
          "search-symbols",
          "find-references",
          "read-range",
          "get-dependencies",
          "get-git-diff",
          "write-file",
          "build-and-test",
          "blueprint-validate",
          "blueprint-submit-version",
          "get-approved-recipe",
          "record-generated-output",
          "propose-change-set"
        ],
        "adrs": [
          "ADR-0021",
          "ADR-0022"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:agent-registry-service-thin"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/tools/propose-change-set.yaml",
        "model/tools/build-and-test.yaml",
        "model/tools/record-generated-output.yaml",
        "model/backlog/pbis/control-plane/agent-registry-service-thin.yaml",
        "docs/planes/capability-tools/tool-registry.md#descriptor"
      ],
      "titlePrefix": "[AIFACTORY-US-598]",
      "number": 598
    },
    {
      "id": "AIFACTORY-TASK-2407",
      "type": "task",
      "parent": "AIFACTORY-US-598",
      "title": "Seed loader of the tool descriptors: sixteen descriptors of the chain registered through the activation path",
      "sequence": "05.02.02.01",
      "description": "Seed loader of the tool descriptors: sixteen descriptors of the chain registered through the activation path. Expected output: At start the loader reads the seed set from the directory named by the configuration key Tools:Seed:Path, one JSON file per tool with the descriptor document and its hash, validates the class, the schema and the secret references of each entry, registers the descriptor active and healthy in the platform tenant through the same activation path as the ActivateDescriptors handler with its ToolDescriptorActivated outbox record in one transaction, is idempotent on tool id, version and hash across restarts and concurrent replicas, and fails with the entry named on a wrong hash, an unknown class or an invalid schema; a readiness check reports unready until every seed entry is registered and a failed run is retried in the running process with backoff.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "At start the loader reads the seed set from the directory named by the configuration key Tools:Seed:Path, one JSON file per tool with the descriptor document and its hash, validates the class, the schema and the secret references of each entry, registers the descriptor active and healthy in the platform tenant through the same activation path as the ActivateDescriptors handler with its ToolDescriptorActivated outbox record in one transaction, is idempotent on tool id, version and hash across restarts and concurrent replicas, and fails with the entry named on a wrong hash, an unknown class or an invalid schema; a readiness check reports unready until every seed entry is registered and a failed run is retried in the running process with backoff."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2407]",
      "number": 2407
    },
    {
      "id": "AIFACTORY-TASK-2408",
      "type": "task",
      "parent": "AIFACTORY-US-598",
      "title": "Seed set fixture of sixteen descriptor documents and of the broken entries for the acceptance suite",
      "sequence": "05.02.02.02",
      "description": "Seed set fixture of sixteen descriptor documents and of the broken entries for the acceptance suite. Expected output: The acceptance suite holds a seed directory in the file shape of AIFACTORY-TASK-2407 with one descriptor document per tool the chain names, each with the kind, the side-effect class, the limits and the audit fields of its entry under model/tools and with a version, a release id, a risk class, a sandbox kind and a JSON schema, an entry with a wrong hash, an entry with an unknown class and an entry with an invalid schema.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a seed directory in the file shape of AIFACTORY-TASK-2407 with one descriptor document per tool the chain names, each with the kind, the side-effect class, the limits and the audit fields of its entry under model/tools and with a version, a release id, a risk class, a sandbox kind and a JSON schema, an entry with a wrong hash, an entry with an unknown class and an entry with an invalid schema."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2408]",
      "number": 2408
    },
    {
      "id": "AIFACTORY-TASK-2409",
      "type": "task",
      "parent": "AIFACTORY-US-598",
      "title": "Verify the seed registration of the tool descriptors through the acceptance suite",
      "sequence": "05.02.02.03",
      "description": "Verify the seed registration of the tool descriptors through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SeededToolDescriptors\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-598: sixteen active descriptors whose classes equal model/tools, one ToolAdapterService/ToolDescriptorActivated record each, the idempotent restart, the refused broken entries with readiness unready until the retry succeeds, and the comparison of version and hash with the closure entries of the fixture agent releases.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SeededToolDescriptors\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-598: sixteen active descriptors whose classes equal model/tools, one ToolAdapterService/ToolDescriptorActivated record each, the idempotent restart, the refused broken entries with readiness unready until the retry succeeds, and the comparison of version and hash with the closure entries of the fixture agent releases."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2409]",
      "number": 2409
    },
    {
      "id": "AIFACTORY-US-599",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "List and read tool descriptors and activate or retire them from the release and connector events",
      "sequence": "05.02.03",
      "description": "As an asset maintainer, I want to see which tool versions are callable, with their class, limits and health, and to have a published or withdrawn release change that set, so that an agent can only call a tool version whose descriptor is active and whose class its owner declared. A caller whose scope carries `factory.tools.read` lists the active tool descriptors through `ToolAdapterService/ListTools` and reads one through `ToolAdapterService/GetTool`; the user token is forwarded by ToolExecutorHost unchanged and the service takes the tenant from it. The list is paged and holds the descriptors visible to the caller, those of the tenant of the caller and those of the platform tenant, each with tool id, version, kind, side-effect class, risk class, the MCP server it is bound to when it has one, and its health. `GetTool` addresses a tool id and returns its active descriptor with the schema reference, the authorization the caller needs, the secret dependencies as references and never as values, timeout, retry policy, rate limits and audit requirements; when more than one version of the tool is active, the request names the version, and without it the highest active version is returned. A tool id that is unknown, inactive or owned by another tenant is answered 404, the same answer in the three cases (ADR-0015 amendment D113); a call without a token is answered 401 and a token without the scope 403. Nothing is written by a read. The set of descriptors changes through the inbox. `ActivateDescriptors` handles `AssetReleasePublished`: for a release of asset kind Tool it loads the manifest through `AgentRegistryService/AssetPublication.LoadRelease`, fetches the descriptor document by its content reference from ArtifactService, validates it and writes the `ToolDescriptor` active and healthy with `ToolDescriptorActivated` in the same transaction; a release of another kind is acknowledged and changes nothing. A descriptor whose side-effect class is missing or not one of the seven classes is not activated, because the class is declared by the tool owner at publication and the executor never lowers it. `RetireDescriptors` handles `AssetReleaseRevoked` by deactivating the descriptors of the release at once and `AssetReleaseDeprecated` by the in-flight policy the event states: under `revoke` the descriptors are deactivated at once. Each deactivation writes `ToolDescriptorRetired` with the reason in the same transaction, and a call to a retired descriptor is denied as AIFACTORY-US-603 states. Under the policies `finish` and `drain` a descriptor is to stay callable for the runs that already pinned the release; the model does not say how the executor tells such a run from a new one, nor what differs between the two policies for a tool descriptor, so this delivery keeps the descriptor active under them, records the stated policy, and reports the question to the owner. The handlers of `ConnectorActivated` and `ConnectorDeprecated` are registered and idempotent, but the two events carry the connector id, version and provider and the model names neither a field by which a descriptor names its connector nor an operation that returns the descriptors of a connector version; that is reported as well, and until it is decided the handlers acknowledge the event and change no descriptor. Every handler is idempotent on the event id. In this increment no release event is published, so the handlers are proven with events the suite publishes in the run event envelope, and the deployed set of descriptors is the seed of AIFACTORY-US-598. Kind: behavior. Traces: services: ToolAdapterService, AgentRegistryService, ConnectorRegistryService; aggregates: ToolAdapterService/ToolDescriptor; apis: ToolAdapterService/ListTools, ToolAdapterService/GetTool, AgentRegistryService/AssetPublication.LoadRelease; events: ToolAdapterService/ToolDescriptorActivated, ToolAdapterService/ToolDescriptorRetired, AgentRegistryService/AssetReleasePublished, AgentRegistryService/AssetReleaseDeprecated, AgentRegistryService/AssetReleaseRevoked; adrs: ADR-0014, ADR-0015, ADR-0022; requirements: FR-05, NFR-02; scenarios: SCN-ToolAdapterService-001, SCN-ToolAdapterService-002, SCN-ToolAdapterService-010, SCN-ToolAdapterService-011. Depends on: AIFACTORY-US-598, feature:agent-registry-service-thin, feature:artifact-service, feature:contracts-package. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/control-plane/AgentRegistryService.yaml, model/services/integration/ConnectorRegistryService.yaml, docs/planes/capability-tools/tool-registry.md#descriptor, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.tools.read` and active descriptors in the tenant of the caller, in the platform tenant and in another tenant, when `ToolAdapterService/ListTools` is called, then the response is 200 with the descriptors of the first two only, each with tool id, version, kind, side-effect class, risk class, server and health, paged; a call without a token is answered 401 and a token without the scope 403, and nothing is written (SCN-ToolAdapterService-001, ADR-0015).",
        "AC2: Given an active `ToolAdapterService/ToolDescriptor`, when `ToolAdapterService/GetTool` is called with its tool id, then the response is 200 with the schema reference, the authorization, the secret dependencies as references without a value, timeout, retry policy, rate limits and audit requirements; given a tool id that is unknown, inactive or owned by another tenant, then the response is 404 with a problem response, the same in the three cases, and no state changes (SCN-ToolAdapterService-002, ADR-0015).",
        "AC3: Given `AgentRegistryService/AssetReleasePublished` for a release of asset kind Tool, when `ActivateDescriptors` handles it, then the manifest is loaded through `AgentRegistryService/AssetPublication.LoadRelease`, the descriptor is written active and healthy with its declared side-effect class and the `ToolAdapterService/ToolDescriptorActivated` outbox record is written in the same transaction; the event is then published on `tool-execution.descriptors.v1.tool-descriptor-activated` in the run event envelope with `toolId`, `version`, `tenantId`, `sideEffectClass` and `kind`, and a transport outage is retried with backoff without loss or duplicate under its event id (SCN-ToolAdapterService-010, ADR-0014).",
        "AC4: Given `AgentRegistryService/AssetReleaseRevoked`, or `AgentRegistryService/AssetReleaseDeprecated` with the in-flight policy `revoke`, for the release of an active descriptor, when `RetireDescriptors` handles it, then the descriptor is inactive and the `ToolAdapterService/ToolDescriptorRetired` outbox record with `toolId`, `version`, `tenantId` and `reason` is written in the same transaction and published on `tool-execution.descriptors.v1.tool-descriptor-retired` with the same retry guarantee; under the policy `finish` or `drain` the descriptor stays active and the policy is recorded (SCN-ToolAdapterService-011, model/services/control-plane/AgentRegistryService.yaml).",
        "AC5: Given any of the five consumed events redelivered with the same event id, a release event of another asset kind, or a descriptor document whose side-effect class is missing, when the handler runs, then the redelivery changes nothing and writes no second event, the other kind is acknowledged without a descriptor, and the classless document is not activated and the refusal is logged with the release id (SCN-ToolAdapterService-010, ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/planes/capability-tools/tool-registry.md#descriptor",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2410",
        "AIFACTORY-TASK-2411",
        "AIFACTORY-TASK-2412"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6803,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "AgentRegistryService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolDescriptor"
        ],
        "apis": [
          "ToolAdapterService/ListTools",
          "ToolAdapterService/GetTool",
          "AgentRegistryService/AssetPublication.LoadRelease"
        ],
        "events": [
          "ToolAdapterService/ToolDescriptorActivated",
          "ToolAdapterService/ToolDescriptorRetired",
          "AgentRegistryService/AssetReleasePublished",
          "AgentRegistryService/AssetReleaseDeprecated",
          "AgentRegistryService/AssetReleaseRevoked"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-001",
          "SCN-ToolAdapterService-002",
          "SCN-ToolAdapterService-010",
          "SCN-ToolAdapterService-011"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-598",
        "feature:agent-registry-service-thin",
        "feature:artifact-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/planes/capability-tools/tool-registry.md#descriptor",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-599]",
      "number": 599
    },
    {
      "id": "AIFACTORY-TASK-2410",
      "type": "task",
      "parent": "AIFACTORY-US-599",
      "title": "ListTools and GetTool read model over the descriptors of the tenant and of the platform tenant",
      "sequence": "05.02.03.01",
      "description": "ListTools and GetTool read model over the descriptors of the tenant and of the platform tenant. Expected output: ListTools returns the active descriptors of the tenant of the caller and of the platform tenant paged, with tool id, version, kind, side-effect class, risk class, server and health; GetTool returns the active descriptor of a tool id, the named version or the highest active one, with schema reference, authorization, secret dependencies as references, limits and audit requirements, and answers 404 alike for an unknown, an inactive and a foreign tool id (ADR-0015); both answer 401 and 403 through the policies of the Factory profile and write nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "ListTools returns the active descriptors of the tenant of the caller and of the platform tenant paged, with tool id, version, kind, side-effect class, risk class, server and health; GetTool returns the active descriptor of a tool id, the named version or the highest active one, with schema reference, authorization, secret dependencies as references, limits and audit requirements, and answers 404 alike for an unknown, an inactive and a foreign tool id (ADR-0015); both answer 401 and 403 through the policies of the Factory profile and write nothing."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2410]",
      "number": 2410
    },
    {
      "id": "AIFACTORY-TASK-2411",
      "type": "task",
      "parent": "AIFACTORY-US-599",
      "title": "ActivateDescriptors and RetireDescriptors inbox handlers of the release and connector events",
      "sequence": "05.02.03.02",
      "description": "ActivateDescriptors and RetireDescriptors inbox handlers of the release and connector events. Expected output: The handler of AssetReleasePublished loads the manifest of a Tool release through AssetPublication.LoadRelease, fetches and validates the descriptor document and writes the descriptor with its ToolDescriptorActivated outbox record in one transaction; the handlers of AssetReleaseRevoked and AssetReleaseDeprecated deactivate at once on a revocation and under the in-flight policy revoke, write ToolDescriptorRetired with the reason, and keep the descriptor active with the policy recorded under finish and drain; the handlers of ConnectorActivated and ConnectorDeprecated acknowledge the event and change no descriptor until the owner states how a descriptor names its connector; every handler is idempotent on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The handler of AssetReleasePublished loads the manifest of a Tool release through AssetPublication.LoadRelease, fetches and validates the descriptor document and writes the descriptor with its ToolDescriptorActivated outbox record in one transaction; the handlers of AssetReleaseRevoked and AssetReleaseDeprecated deactivate at once on a revocation and under the in-flight policy revoke, write ToolDescriptorRetired with the reason, and keep the descriptor active with the policy recorded under finish and drain; the handlers of ConnectorActivated and ConnectorDeprecated acknowledge the event and change no descriptor until the owner states how a descriptor names its connector; every handler is idempotent on the event id."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2411]",
      "number": 2411
    },
    {
      "id": "AIFACTORY-TASK-2412",
      "type": "task",
      "parent": "AIFACTORY-US-599",
      "title": "Verify the descriptor read model and its handlers through the acceptance suite",
      "sequence": "05.02.03.03",
      "description": "Verify the descriptor read model and its handlers through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-001|Scenario=SCN-ToolAdapterService-002|Scenario=SCN-ToolAdapterService-010|Scenario=SCN-ToolAdapterService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-599 with a three-tenant fixture, release events the suite publishes in the run event envelope, a fake of AgentRegistryService and of ArtifactService, redelivered events and a stopped transport; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-001|Scenario=SCN-ToolAdapterService-002|Scenario=SCN-ToolAdapterService-010|Scenario=SCN-ToolAdapterService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-599 with a three-tenant fixture, release events the suite publishes in the run event envelope, a fake of AgentRegistryService and of ArtifactService, redelivered events and a stopped transport; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2412]",
      "number": 2412
    },
    {
      "id": "AIFACTORY-US-600",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Keep descriptors healthy or unhealthy from the probe and from the server, secret, connection and environment events",
      "sequence": "05.02.04",
      "description": "As an operator, I want a tool whose server, credential reference, connection or target environment is not usable to stop being called before it fails inside a run, so that a run fails fast with a reason I can act on, never halfway through an effect. A descriptor is usable only while it is active and healthy. This PBI delivers what keeps that state true between calls. The worker `DescriptorHealthProbe` runs every five minutes over the active descriptors, partitioned by kind with at most four in parallel: for a native tool it checks that the executor of the tool answers, which for a tool owned by another service is the health of that service, and for a tool of kind Mcp it performs the handshake and the schema fetch through the client of the pinned MCP library and compares the schema hash. It marks the descriptor healthy or unhealthy, retries a failed probe twice with a fixed backoff of fifteen seconds, is idempotent on tool id, version and probe window, and publishes no event. A call to an unhealthy descriptor fails fast with the failure class transient and executes nothing (AIFACTORY-US-602). Four inbox handlers act on what other services announce, each idempotent on the event id. `UpdateServerHealth` handles `McpServerStateChanged`: the descriptors bound to a server that became Degraded are marked unhealthy, those of a server that became Active again healthy, and those of a Retired server unhealthy and inactive, with `ToolDescriptorRetired` written for each in the same transaction. `DisableToolsOnRevocation` handles `SecretReferenceRevoked`: from then on a call of that tenant to a tool whose `secretDependencies` name the revoked reference is denied before any credential is requested. `UpdateConnectionAvailability` handles `ConnectionStateChanged`: the tools of that tenant that are bound to the connection are refused while it is Suspended or Revoked and allowed again when it is Active. `ApplyFreeze` handles `EnvironmentStateChanged`: a call of class shared-write or production that targets a Frozen environment is refused, and the freeze ends when the environment is Active again. The model gives the service three tables and none for these three gates, so the announced state of a reference, a connection and an environment is kept in the cache store of the service. A lost cache entry never lets a refused call through: the class and the state of the target environment are read again through `EnvironmentService/Environments.GetPolicyClass` on every call, the Secret Broker issues nothing for a revoked reference, and a suspended connection does not resolve. How a Degraded connection is treated the model does not say, which is reported to the owner. The refusals themselves, with their stage and reason, are those of AIFACTORY-US-603. In this increment the thin McpServerRegistryService publishes no state change, so `UpdateServerHealth` is proven with events the suite publishes. Kind: behavior. Traces: services: ToolAdapterService, McpServerRegistryService, SecretBrokerService, IntegrationService, EnvironmentService; aggregates: ToolAdapterService/ToolDescriptor; apis: EnvironmentService/Environments.GetPolicyClass, SecretBrokerService/SecretBroker.Issue; events: ToolAdapterService/ToolDescriptorRetired, McpServerRegistryService/McpServerStateChanged, SecretBrokerService/SecretReferenceRevoked, IntegrationService/ConnectionStateChanged, EnvironmentService/EnvironmentStateChanged; adrs: ADR-0015, ADR-0022; requirements: XL-16, NFR-02. Depends on: AIFACTORY-US-599, feature:mcp-server-registry-service-thin, feature:secret-broker-service, feature:integration-service-thin, feature:environment-service, feature:component-mcp. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/tools-mcp/McpServerRegistryService.yaml, model/services/control-plane/EnvironmentService.yaml, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given active descriptors of the kinds Native and Mcp, when `DescriptorHealthProbe` runs and the executor of one native tool and the handshake of one MCP tool do not answer after two retries, then those two `ToolAdapterService/ToolDescriptor` rows are unhealthy and the others healthy, a second run in the same probe window changes nothing, and a later run in which both answer marks them healthy again (model/services/tools-mcp/ToolAdapterService.yaml).",
        "AC2: Given descriptors bound to an MCP server, when `McpServerRegistryService/McpServerStateChanged` announces Degraded, then they are unhealthy; when it announces Active again, then they are healthy; when it announces Retired, then they are unhealthy and inactive and one `ToolAdapterService/ToolDescriptorRetired` outbox record per descriptor is written in the same transaction; a redelivery of the same event id changes nothing (ADR-0022).",
        "AC3: Given `SecretBrokerService/SecretReferenceRevoked` for a reference of tenant A, when tenant A and tenant B each call a tool whose `secretDependencies` name a reference of that id, then the call of tenant A is denied before `SecretBrokerService/SecretBroker.Issue` is called and the call of tenant B is not affected; given `IntegrationService/ConnectionStateChanged` to Suspended or Revoked, then the tools of that tenant bound to the connection are refused, and after a change to Active they are allowed again (ADR-0015).",
        "AC4: Given `EnvironmentService/EnvironmentStateChanged` announces an environment Frozen, when a call of effective class shared-write or production targets it, then the call is refused and a read or sandbox call that targets it is not; given the cache of the service was lost, when the same call arrives, then the state read through `EnvironmentService/Environments.GetPolicyClass` refuses it all the same; after the environment is Active again the call passes (model/services/control-plane/EnvironmentService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2413",
        "AIFACTORY-TASK-2414",
        "AIFACTORY-TASK-2415"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6804,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "McpServerRegistryService",
          "SecretBrokerService",
          "IntegrationService",
          "EnvironmentService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolDescriptor"
        ],
        "apis": [
          "EnvironmentService/Environments.GetPolicyClass",
          "SecretBrokerService/SecretBroker.Issue"
        ],
        "events": [
          "ToolAdapterService/ToolDescriptorRetired",
          "McpServerRegistryService/McpServerStateChanged",
          "SecretBrokerService/SecretReferenceRevoked",
          "IntegrationService/ConnectionStateChanged",
          "EnvironmentService/EnvironmentStateChanged"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "XL-16",
          "NFR-02"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-599",
        "feature:mcp-server-registry-service-thin",
        "feature:secret-broker-service",
        "feature:integration-service-thin",
        "feature:environment-service",
        "feature:component-mcp"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-600]",
      "number": 600
    },
    {
      "id": "AIFACTORY-TASK-2413",
      "type": "task",
      "parent": "AIFACTORY-US-600",
      "title": "DescriptorHealthProbe over the active descriptors of the kinds Native and Mcp",
      "sequence": "05.02.04.01",
      "description": "DescriptorHealthProbe over the active descriptors of the kinds Native and Mcp. Expected output: The worker probes every active descriptor on its five-minute schedule, partitioned by kind with at most four in parallel: the executor of a native tool, and the handshake and schema fetch of an MCP tool through the client of the pinned MCP library; it marks the descriptor healthy or unhealthy, retries twice with a fixed backoff of fifteen seconds, is idempotent on tool id, version and probe window and publishes no event.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The worker probes every active descriptor on its five-minute schedule, partitioned by kind with at most four in parallel: the executor of a native tool, and the handshake and schema fetch of an MCP tool through the client of the pinned MCP library; it marks the descriptor healthy or unhealthy, retries twice with a fixed backoff of fifteen seconds, is idempotent on tool id, version and probe window and publishes no event."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2413]",
      "number": 2413
    },
    {
      "id": "AIFACTORY-TASK-2414",
      "type": "task",
      "parent": "AIFACTORY-US-600",
      "title": "UpdateServerHealth, DisableToolsOnRevocation, UpdateConnectionAvailability and ApplyFreeze inbox handlers",
      "sequence": "05.02.04.02",
      "description": "UpdateServerHealth, DisableToolsOnRevocation, UpdateConnectionAvailability and ApplyFreeze inbox handlers. Expected output: The handler of McpServerStateChanged marks the descriptors of a Degraded server unhealthy, of an Active server healthy and of a Retired server unhealthy and inactive with ToolDescriptorRetired in the same transaction; the handlers of SecretReferenceRevoked, ConnectionStateChanged and EnvironmentStateChanged keep the announced state of the reference, the connection and the environment per tenant in the cache store of the service, from which the pipeline refuses the affected calls; each handler is idempotent on the event id, and a lost cache entry lets no refused call through because the environment state is read again on every call and the broker and the connection refuse on their own.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The handler of McpServerStateChanged marks the descriptors of a Degraded server unhealthy, of an Active server healthy and of a Retired server unhealthy and inactive with ToolDescriptorRetired in the same transaction; the handlers of SecretReferenceRevoked, ConnectionStateChanged and EnvironmentStateChanged keep the announced state of the reference, the connection and the environment per tenant in the cache store of the service, from which the pipeline refuses the affected calls; each handler is idempotent on the event id, and a lost cache entry lets no refused call through because the environment state is read again on every call and the broker and the connection refuse on their own."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2414]",
      "number": 2414
    },
    {
      "id": "AIFACTORY-TASK-2415",
      "type": "task",
      "parent": "AIFACTORY-US-600",
      "title": "Verify descriptor health and availability through the acceptance suite",
      "sequence": "05.02.04.03",
      "description": "Verify descriptor health and availability through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=DescriptorHealthAndAvailability\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-600 with a fake executor and a fixture MCP server that stop answering, the events McpServerRegistryService/McpServerStateChanged, SecretBrokerService/SecretReferenceRevoked, IntegrationService/ConnectionStateChanged and EnvironmentService/EnvironmentStateChanged published by the suite, redeliveries, a two-tenant fixture and a cleared cache.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=DescriptorHealthAndAvailability\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-600 with a fake executor and a fixture MCP server that stop answering, the events McpServerRegistryService/McpServerStateChanged, SecretBrokerService/SecretReferenceRevoked, IntegrationService/ConnectionStateChanged and EnvironmentService/EnvironmentStateChanged published by the suite, redeliveries, a two-tenant fixture and a cleared cache."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2415]",
      "number": 2415
    },
    {
      "id": "AIFACTORY-US-601",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Validate the arguments of a tool call and preview its pipeline outcome without executing it",
      "sequence": "05.02.05",
      "description": "As an asset maintainer, I want to see whether a call is valid and what the pipeline would do with it before anything runs, so that I learn the class, the policy outcome and the approval a tool needs without causing an effect. Two operations answer what the pipeline would do with a call and execute nothing. A caller whose scope carries `factory.tools.read` posts arguments to `ToolAdapterService/DryRunTool` for a tool id; an agent host or another service calls the internal gRPC method `ToolAdapterService/ToolExecutor.Validate` with a `tool-invocation-v1` request under a workload token that holds the service scope that names ToolAdapterService. Both run the first stages of the fixed pipeline as a preview. The arguments are validated against the JSON schema of the active descriptor, and every violation is reported with its path. The effective side-effect class is computed: it is the class the tool owner declared, raised to production when the call names a target environment whose class is Production, which the service reads through `EnvironmentService/Environments.GetPolicyClass`, and raised further when the policy says so; it is never lowered. The policy outcome is obtained through `PolicyEngineService/Policy.Decide` for the subject, the tool and the effective class under the active revision, which records its evaluation as it records every evaluation. The answer states whether the arguments are valid, the declared and the effective class, the policy outcome with its reason, whether an approval is needed and the sandbox kind the descriptor names. The need for an approval is read from the outcome of the decision, one of the four outcomes of `policy-decision-v1`, and from nothing else: `allow-with-approval` means that an approval is needed, `allow` that none is, `deny` that the call would be denied at the policy stage, and `allow-with-constraints` that the call would run without an approval under the constraints the decision lists, which the preview returns. The default policy bundle of PolicyEngineService answers `allow-with-approval` for the classes production, publication, external and spend (D123); of the two shared-write tools of the chain `propose-change-set` is answered `allow-with-approval`, and `blueprint-submit-version` for a Draft version is answered `allow` unless the project policy gates blueprint drafts, as ADR-0026 amendment D64 decides. Nothing else happens: no `ToolInvocation` is written, no idempotency key is consumed, no credential is issued, no sandbox is leased, no tool runs and no event of this service is published, so a dry run can be repeated at will. Invalid arguments are a result and not a refusal: the answer is 200, or a normal gRPC reply, with the violations. `DryRunTool` answers 401 without a token, 403 without the scope and 404 for a tool id that is unknown, inactive or owned by another tenant. `ToolExecutor.Validate` refuses a caller without a workload identity with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, a request that is no well-formed `tool-invocation-v1` with INVALID_ARGUMENT and an unknown or foreign tool with NOT_FOUND, the same answer for both; an attempt that receives this NOT_FOUND takes the failure class permanent and is not retried (ADR-0015 amendment D113). PolicyEngineService and EnvironmentService are fail-fast dependencies: when one does not answer, the preview fails with a problem response or UNAVAILABLE that names the dependency, and no partial preview is returned. The model lists `DryRunTool` under the class sandbox although it runs nothing; the class is kept as modelled and reported. Kind: behavior. Traces: services: ToolAdapterService, PolicyEngineService, EnvironmentService; aggregates: ToolAdapterService/ToolDescriptor, ToolAdapterService/ToolInvocation; apis: ToolAdapterService/DryRunTool, ToolAdapterService/ToolExecutor.Validate, PolicyEngineService/Policy.Decide, EnvironmentService/Environments.GetPolicyClass; descriptors: tool-invocation-v1, policy-decision-v1; tools: propose-change-set, blueprint-submit-version; adrs: ADR-0015, ADR-0022, ADR-0026; requirements: FR-05; scenarios: SCN-ToolAdapterService-003, SCN-ToolAdapterService-008. Depends on: AIFACTORY-US-599, feature:policy-engine-service, feature:environment-service. Sources: model/services/tools-mcp/ToolAdapterService.yaml, docs/reference/schemas/tool-invocation.schema.json, docs/reference/schemas/policy-decision.schema.json, docs/planes/capability-tools/tool-policies.md#decision-outcomes.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.tools.read` and the active descriptor of a sandbox-class tool, when `ToolAdapterService/DryRunTool` is called with valid arguments, then the response is 200 with the arguments valid, the declared and the effective class, the policy outcome obtained through `PolicyEngineService/Policy.Decide`, no approval needed and the sandbox kind of the descriptor; no `ToolAdapterService/ToolInvocation` is written, no credential is issued, no sandbox is leased and no event of this service is published (SCN-ToolAdapterService-003).",
        "AC2: Given arguments that violate the schema of the descriptor, a call that names an environment whose class `EnvironmentService/Environments.GetPolicyClass` returns as Production with a decision of `allow-with-approval`, the tool `propose-change-set` with a decision of `allow-with-approval`, and the tool `blueprint-submit-version` for a Draft version with a decision of `allow`, when `ToolAdapterService/DryRunTool` is called for each, then the first answers 200 with every violation and its path, the second states the effective class production and that an approval is needed, the third states that an approval is needed, and the fourth states the class shared-write and that no approval is needed; a decision of `allow-with-constraints` is previewed with its constraints and without an approval, and a decision of `deny` as a denial at the policy stage (SCN-ToolAdapterService-003, ADR-0022, ADR-0026).",
        "AC3: Given a call without a token, a token without `factory.tools.read`, or a tool id that is unknown, inactive or owned by another tenant, when `ToolAdapterService/DryRunTool` is called, then the response is 401, 403 or 404 with a problem response, the 404 the same in the three cases, and no state changes (SCN-ToolAdapterService-003, ADR-0015).",
        "AC4: Given a workload token that holds the service scope and a `tool-invocation-v1` request, when `ToolAdapterService/ToolExecutor.Validate` is called, then the reply carries the same preview as the dry run and nothing is executed or written; a caller without a workload identity, a token without the service scope, a malformed request and an unknown or foreign tool are refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND respectively (SCN-ToolAdapterService-008, ADR-0015).",
        "AC5: Given PolicyEngineService or EnvironmentService does not answer, when `ToolAdapterService/DryRunTool` or `ToolAdapterService/ToolExecutor.Validate` is called, then the call fails with a problem response or UNAVAILABLE that names the dependency and no partial preview is returned (SCN-ToolAdapterService-003, SCN-ToolAdapterService-008, model/services/tools-mcp/ToolAdapterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/capability-tools/tool-policies.md#decision-outcomes"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2416",
        "AIFACTORY-TASK-2417"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6805,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "PolicyEngineService",
          "EnvironmentService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolDescriptor",
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "ToolAdapterService/DryRunTool",
          "ToolAdapterService/ToolExecutor.Validate",
          "PolicyEngineService/Policy.Decide",
          "EnvironmentService/Environments.GetPolicyClass"
        ],
        "descriptors": [
          "tool-invocation-v1",
          "policy-decision-v1"
        ],
        "tools": [
          "propose-change-set",
          "blueprint-submit-version"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0026"
        ],
        "requirements": [
          "FR-05"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-003",
          "SCN-ToolAdapterService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-599",
        "feature:policy-engine-service",
        "feature:environment-service"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/capability-tools/tool-policies.md#decision-outcomes"
      ],
      "titlePrefix": "[AIFACTORY-US-601]",
      "number": 601
    },
    {
      "id": "AIFACTORY-TASK-2416",
      "type": "task",
      "parent": "AIFACTORY-US-601",
      "title": "Pipeline preview shared by DryRunTool and ToolExecutor.Validate",
      "sequence": "05.02.05.01",
      "description": "Pipeline preview shared by DryRunTool and ToolExecutor.Validate. Expected output: One preview component validates the arguments against the schema of the active descriptor, computes the effective class from the declared class, the class of the target environment read through Environments.GetPolicyClass and the policy, obtains the policy outcome through Policy.Decide and states whether an approval is needed, which it reads from the outcome alone (allow-with-approval needs one, allow needs none, deny is a denial at the policy stage, allow-with-constraints needs none and lists its constraints), and which sandbox kind applies; DryRunTool and ToolExecutor.Validate return it with their refusals (401, 403 and 404, or UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND) and write no invocation, issue no credential, lease no sandbox and publish no event.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "One preview component validates the arguments against the schema of the active descriptor, computes the effective class from the declared class, the class of the target environment read through Environments.GetPolicyClass and the policy, obtains the policy outcome through Policy.Decide and states whether an approval is needed, which it reads from the outcome alone (allow-with-approval needs one, allow needs none, deny is a denial at the policy stage, allow-with-constraints needs none and lists its constraints), and which sandbox kind applies; DryRunTool and ToolExecutor.Validate return it with their refusals (401, 403 and 404, or UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND) and write no invocation, issue no credential, lease no sandbox and publish no event."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6805,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2416]",
      "number": 2416
    },
    {
      "id": "AIFACTORY-TASK-2417",
      "type": "task",
      "parent": "AIFACTORY-US-601",
      "title": "Verify validation and dry run through the acceptance suite",
      "sequence": "05.02.05.02",
      "description": "Verify validation and dry run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-003|Scenario=SCN-ToolAdapterService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-601 with fakes of PolicyEngineService and EnvironmentService that answer each of the four outcomes of policy-decision-v1 and that stop answering, with propose-change-set under allow-with-approval and blueprint-submit-version for a Draft version under allow among the cases, and assert after every case that the tables ToolInvocations and SandboxLeases and the outbox are unchanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-003|Scenario=SCN-ToolAdapterService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-601 with fakes of PolicyEngineService and EnvironmentService that answer each of the four outcomes of policy-decision-v1 and that stop answering, with propose-change-set under allow-with-approval and blueprint-submit-version for a Draft version under allow among the cases, and assert after every case that the tables ToolInvocations and SandboxLeases and the outbox are unchanged."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2417]",
      "number": 2417
    },
    {
      "id": "AIFACTORY-US-602",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Execute a tool call for an attempt through the fixed pipeline, once per idempotency key, and end it with a receipt",
      "sequence": "05.02.06",
      "description": "As a requester, I want every tool call of my run to pass one governed pipeline and leave a receipt, so that what an agent did on my behalf is decided by policy, done once and recorded with its hashes. An agent host calls `ToolAdapterService/ToolExecutor.Invoke` through ToolExecutorHost. The request message of the method, fixed by the proto of AIFACTORY-TASK-079, is a `tool-invocation-v1` document. The document holds what its schema allows: the invocation id, the tool id, the scope, the run, the step and the attempt, the class of the step, the idempotency key, the arguments with their hash, the policy decision the runtime obtained for the step and, where the policy decision of the call answers `allow-with-approval`, the approval id. Since D121 the schema also has two optional members, `fencingToken`, the fencing token of the lease of the attempt that makes the call, and `toolVersion`, the exact version of the tool the call names, so both travel inside the document and `ToolInvocations` stores them from it. The Factory tool client sends both for every call of an attempt; the fencing check applies to every call that carries a token, and a call that names no version is recorded with the highest active version of the tool, the version `GetTool` returns by default. The caller presents a workload token; the service reads the tenant and the project the caller forwards in the gRPC metadata only when the token holds the service scope that names ToolAdapterService (ADR-0015 amendment D114). The model also lists the scope `factory.tools.invoke` for attempts; this delivery admits an attempt by the service scope alone and requires `factory.tools.invoke` of the callers of the hosted MCP endpoint (AIFACTORY-US-607), and how the two scopes relate for a workload token is reported to the owner. The method is a server stream: it sends progress messages for a long tool and ends with the receipt. The `ToolInvocationGrain` of the invocation serialises the pipeline. Reception records the `ToolInvocation` in state Received with its scope, its run, step and attempt, its caller kind, which in I1 is always agent because only calls bound to a run, a step and an attempt are served (D121), its tool version, request hash, idempotency key and declared class. The unique index on tenant, project and idempotency key makes a call happen once: the same key with the same request hash returns the existing receipt and executes nothing, and the same key with another request hash is refused as a conflict with ALREADY_EXISTS (ADR-0014 decision 3). The fencing check is keyed by tenant, run and step, because the document carries `stepId` and RunControlService gives a new lease of a step a token greater than every earlier token of that step: a call whose fencing token is lower than the highest token the service has seen for its run and step is refused with FAILED_PRECONDITION, whether it arrives late from the same attempt or from a superseded attempt whose lease expired and whose step was dispatched again under a new attempt id. `ToolInvocations` stores the step id of every call (D121), so the mark per run and step is read back from the table as the highest token stored for the tenant, the run and the step; the cache store of the service only spares that read, and a lost cache entry loses nothing. The mark knows only tokens it has seen, so a superseded attempt that calls before its successor has called passes it. Closing that gap, and refusing a call for a run that is cancelled or terminal, needs the run and lease state of RunControlService, which the model names as a purpose of that dependency. The delivery reads it through the same client port as the approval of AIFACTORY-US-604: a call for a run the port reports as Cancelled or otherwise terminal, or for a step whose current fencing token the port reports as higher than that of the call, is refused with FAILED_PRECONDITION and records no invocation. The only internal read the model lists for a worker is the stream `RunControl.WatchRun`, which is not stated to return the current lease of a step or the state of a run at the moment of a call, so the port is proven against a fake and the missing operation is reported with the approval read of AIFACTORY-US-604. The arguments are validated against the schema of the active descriptor and the invocation moves to Validated (trigger `SchemaValid`). The service then checks the authorization the descriptor requires of the caller, reads the class of the target environment through `EnvironmentService/Environments.GetPolicyClass` and obtains its own decision through `PolicyEngineService/Policy.Decide` for the subject, the tool, the class and the environment under the policy revision the run pinned. The `policyDecision` the document must carry is the decision the runtime obtained for the step: the executor takes the pinned policy revision from it, never executes on it and never lets it replace its own decision; a carried decision whose subject names another tenant than the forwarded one is refused with INVALID_ARGUMENT, and whether the carried decision is meant to be more than this input is reported to the owner. The effective class is the declared class raised by the class of the target environment or by the policy and never lowered; the invocation moves to Authorized (trigger `PermissionAndPolicyPassed`) with `policyDecisionId` and `effectiveClass`. The outcome of the decision, one of the four of `policy-decision-v1`, steers the rest. `deny` denies the call (AIFACTORY-US-603). `allow-with-approval` gates it (AIFACTORY-US-604). `allow` lets it proceed without an approval, which under the default policy is the case for the classes read and sandbox and for `blueprint-submit-version` on a Draft version (ADR-0026 amendment D64). `allow-with-constraints` lets it proceed without an approval under the constraints the decision lists: a constraint that narrows the egress allow list or a limit of the sandbox is applied by the broker stage (AIFACTORY-US-605), the constraints that were applied are part of the limits recorded on the `SandboxLease`, and a constraint the executor cannot apply denies the call, which moves from Authorized to Denied (trigger `ConstraintNotApplicable`) at the stage policy, because a decision is never executed more widely than it was given (D121); the vocabulary of constraints is not modelled and is reported to the owner. A call that needs no approval has its credentials and its sandbox brokered as AIFACTORY-US-605 states and the invocation moves to Brokered (trigger `CredentialsAndSandboxLeased`), then to Executing (trigger `Started`) when the executor of its kind starts (AIFACTORY-US-606, AIFACTORY-US-607). When the result is observed it is sanitized before it can reach a model: secrets are stripped by the sanitizer patterns and the redaction is recorded in the audit evidence, the size is bounded by `Tools:Execution:MaxResultBytes` with a truncation marker, the provenance is tagged as a tool result and instructions inside the result stay data. The sanitized result and the receipt, a `tool-receipt-v1`, are stored by hash through `ArtifactService/Artifacts.Store`; the invocation moves to Observed (trigger `ResultObserved`) with `resultRef`, `resultHash`, `receiptRef` and `auditRef`, and `ToolInvoked` is written in the same transaction with the state, the hashes, the decision id and the approval id. The status of a receipt is one of the six values `tool-receipt-v1` allows, and the states of an invocation map onto them by one rule that every PBI of the feature uses: Observed is written as Succeeded, Denied as Denied, Uncertain as Uncertain, Cancelled as Cancelled, the status of an invocation that was interrupted before any effect (D121), and Failed as Failed, except that an invocation the timeout reminder settled as Failed without a possible effect is written as TimedOut. An error before any effect moves the invocation to Failed (trigger `ErrorBeforeEffect`) with its failure class, a receipt and `ToolInvoked` in state Failed; the executor repeats an execution on its own only within the retry policy of the descriptor, only for an effective class of read or sandbox and only for a transient error before an effect. It never repeats a call of class shared-write or above: its outcome is reported as it is, and whether the step is retried is decided by RunControlService (ADR-0014 amendment D114). The audit stage writes one evidence record of the invocation through the sink of the pinned audit library, as the event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` in the transaction of the receipt, with the invocation as subject, its request hash, the actor and the outcome and without arguments or result; the `action` values of `audit-evidence-v1` name none for a tool invocation, which is reported to the owner. A call to an unhealthy descriptor and a required dependency that does not answer before execution (PolicyEngineService, EnvironmentService, RunControlService, SecretBrokerService, ExecutionCapacityService, McpServerRegistryService or ArtifactService) fail the call fast with UNAVAILABLE, the dependency named and the failure class transient, and nothing executes: without a decision no tool runs. The model has no transition to Failed before Executing, so which state the invocation keeps in that case is reported to the owner; the suite asserts that nothing executed and that a repeat under the same key after recovery executes once. A call above the rate limit of its descriptor is refused with RESOURCE_EXHAUSTED before reception. `connectsoft.factory.tools.invocations` counts every settled invocation by tool, effective class and state and `connectsoft.factory.tools.latency` records pipeline and execution time; the objective of the model for the pipeline overhead without execution and approval wait is 300 milliseconds at the 95th percentile, and a receipt exists for every settled invocation past validation; AIFACTORY-TASK-2420 measures the first from `connectsoft.factory.tools.latency` and asserts the second on `receiptRef`. Kind: behavior. Traces: services: ToolAdapterService, PolicyEngineService, EnvironmentService, ArtifactService, RunControlService; aggregates: ToolAdapterService/ToolInvocation, ToolAdapterService/ToolDescriptor; apis: ToolAdapterService/ToolExecutor.Invoke, PolicyEngineService/Policy.Decide, EnvironmentService/Environments.GetPolicyClass, ArtifactService/Artifacts.Store; events: ToolAdapterService/ToolInvoked; descriptors: tool-invocation-v1, tool-receipt-v1, policy-decision-v1, audit-evidence-v1; adrs: ADR-0014, ADR-0015, ADR-0019, ADR-0022; requirements: FR-05, NFR-05, XL-06; scenarios: SCN-ToolAdapterService-007, SCN-ToolAdapterService-012. Relates: nfrs: NFR-10. Depends on: AIFACTORY-US-599, feature:policy-engine-service, feature:environment-service, feature:artifact-service, feature:run-control-service, feature:contracts-package, feature:component-audit-factory-evidence, feature:component-extensions-ai. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/tool-invocation.schema.json, docs/reference/schemas/policy-decision.schema.json, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given an attempt with a lease, a workload token that holds the service scope and an active read-class tool, when `ToolAdapterService/ToolExecutor.Invoke` is called with a `tool-invocation-v1` document that carries its optional members `fencingToken` and `toolVersion`, then the document validates against docs/reference/schemas/tool-invocation.schema.json, the `ToolAdapterService/ToolInvocation` is recorded with the run, the step and the attempt of the call and moves Received, Validated, Authorized, Brokered, Executing and Observed in that order with `policyDecisionId` from the own call to `PolicyEngineService/Policy.Decide` under the policy revision of the carried decision and with its declared and effective class, the stream ends with a receipt of status Succeeded, and the result and the `tool-receipt-v1` are stored through `ArtifactService/Artifacts.Store` with `resultRef`, `resultHash` and `receiptRef` on the row (SCN-ToolAdapterService-007, FR-05).",
        "AC2: Given the same call repeated with the same idempotency key and request hash, the same key with another request hash, a call under a fencing token lower than the highest seen for its run and step, once from the same attempt and once from a superseded attempt of the step whose successor already called, and a call for a run that the Run Control port reports as Cancelled, when `ToolAdapterService/ToolExecutor.Invoke` is called, then the first returns the existing receipt and executes nothing, the second is refused with ALREADY_EXISTS and the other three with FAILED_PRECONDITION; a caller without a workload identity, a token without the service scope and a malformed request are refused with UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT, and no state changes in any refusal (SCN-ToolAdapterService-007, ADR-0014, ADR-0015).",
        "AC3: Given a result that contains a secret pattern and exceeds `Tools:Execution:MaxResultBytes`, when the invocation is observed, then the stored result has the secret redacted and is truncated with a marker, the receipt states `sanitized` true, the redaction is named in the evidence record, and one `AuditEvidenceSubmitted` record of the invocation is in the outbox of the receipt transaction without arguments or result, as docs/reference/schemas/audit-evidence.schema.json shapes it (SCN-ToolAdapterService-007, ADR-0019).",
        "AC4: Given an invocation that ended Observed, Failed or Cancelled, when the outbox dispatcher publishes `ToolAdapterService/ToolInvoked` on `tool-execution.invocations.v1.tool-invoked`, then the outbox record was written in the same transaction as the terminal transition, the receipt of the invocation carries the status Succeeded, Failed, TimedOut or Cancelled by the mapping of this PBI, the event is sent in the run event envelope with `invocationId`, `tenantId`, `projectId`, `runId`, `attemptId`, `toolId`, `toolVersion`, `effectiveClass`, `state`, `policyDecisionId`, `approvalId`, `requestHash` and `resultHash`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ToolAdapterService-012, ADR-0014).",
        "AC5: Given a transient error before any effect on a read-class tool whose descriptor allows two retries, an unhealthy descriptor, and a PolicyEngineService that does not answer, when `ToolAdapterService/ToolExecutor.Invoke` is called for each, then the first is repeated within the retry policy and, when it still fails, ends Failed with the failure class transient and `ToolAdapterService/ToolInvoked` in state Failed, and the other two fail fast with UNAVAILABLE and the class transient while nothing executes; a repeat under the same key after recovery executes once (SCN-ToolAdapterService-007, model/services/tools-mcp/ToolAdapterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-218",
        "AIFACTORY-TASK-2418",
        "AIFACTORY-TASK-2419",
        "AIFACTORY-TASK-2420"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6806,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "PolicyEngineService",
          "EnvironmentService",
          "ArtifactService",
          "RunControlService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation",
          "ToolAdapterService/ToolDescriptor"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Invoke",
          "PolicyEngineService/Policy.Decide",
          "EnvironmentService/Environments.GetPolicyClass",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ToolAdapterService/ToolInvoked"
        ],
        "descriptors": [
          "tool-invocation-v1",
          "tool-receipt-v1",
          "policy-decision-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-05",
          "XL-06"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-007",
          "SCN-ToolAdapterService-012"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-599",
        "feature:policy-engine-service",
        "feature:environment-service",
        "feature:artifact-service",
        "feature:run-control-service",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-602]",
      "number": 602
    },
    {
      "id": "AIFACTORY-TASK-218",
      "type": "task",
      "parent": "AIFACTORY-US-602",
      "title": "Tool invocation pipeline: receive, validate, decide, classify, broker, execute, sanitize, record",
      "sequence": "05.02.06.01",
      "description": "Tool invocation pipeline: receive, validate, decide, classify, broker, execute, sanitize, record. Expected output: ToolExecutor.Invoke runs the fixed pipeline of the model in the ToolInvocationGrain: reception under the unique index on tenant, project and idempotency key, the fencing token check against the highest token seen for the tenant, run and step, read back from the step id that ToolInvocations stores (D121) and only cached in the cache store, the read of run and lease state through the Run Control port that refuses a call for a cancelled or terminal run and for a superseded lease with FAILED_PRECONDITION, schema validation, the authorization of the descriptor, the own decision of Policy.Decide under the policy revision of the carried decision, which is never executed on, the effective class from the declared class, the environment class and the policy, the branch on the four outcomes of policy-decision-v1 (deny, allow-with-approval, allow, allow-with-constraints with its constraints handed to the broker stage or the call denied through ConstraintNotApplicable when one cannot be applied), the hand-over to the broker stage of AIFACTORY-US-605 and to the executor of the kind, and the terminal transitions Observed and Failed with the receipt and the ToolInvoked outbox record in one transaction; the stream sends progress and ends with the receipt; one path serves every tool, and the class of the step and of the tool are enforced and never lowered.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "ToolExecutor.Invoke runs the fixed pipeline of the model in the ToolInvocationGrain: reception under the unique index on tenant, project and idempotency key, the fencing token check against the highest token seen for the tenant, run and step, read back from the step id that ToolInvocations stores (D121) and only cached in the cache store, the read of run and lease state through the Run Control port that refuses a call for a cancelled or terminal run and for a superseded lease with FAILED_PRECONDITION, schema validation, the authorization of the descriptor, the own decision of Policy.Decide under the policy revision of the carried decision, which is never executed on, the effective class from the declared class, the environment class and the policy, the branch on the four outcomes of policy-decision-v1 (deny, allow-with-approval, allow, allow-with-constraints with its constraints handed to the broker stage or the call denied through ConstraintNotApplicable when one cannot be applied), the hand-over to the broker stage of AIFACTORY-US-605 and to the executor of the kind, and the terminal transitions Observed and Failed with the receipt and the ToolInvoked outbox record in one transaction; the stream sends progress and ends with the receipt; one path serves every tool, and the class of the step and of the tool are enforced and never lowered."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-218]",
      "number": 218
    },
    {
      "id": "AIFACTORY-TASK-2418",
      "type": "task",
      "parent": "AIFACTORY-US-602",
      "title": "Result sanitizer, receipt writer and audit evidence of an invocation",
      "sequence": "05.02.06.02",
      "description": "Result sanitizer, receipt writer and audit evidence of an invocation. Expected output: The sanitizer strips secrets by its patterns, bounds the result by Tools:Execution:MaxResultBytes with a truncation marker, tags the provenance as tool result and never interprets instructions in a result; the receipt writer builds tool-receipt-v1 with effect, usage, the sanitized flag, the receipt hash and the status by the one mapping of the feature (Observed as Succeeded, Denied as Denied, Uncertain as Uncertain, Cancelled as Cancelled, Failed as Failed and a timeout without a possible effect as TimedOut) and stores result and receipt through Artifacts.Store; the audit stage writes one evidence record per receipt through the sink of the pinned audit library as AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted in the transaction of the receipt, with the redactions named and without arguments or result, and keeps its id in auditRef.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The sanitizer strips secrets by its patterns, bounds the result by Tools:Execution:MaxResultBytes with a truncation marker, tags the provenance as tool result and never interprets instructions in a result; the receipt writer builds tool-receipt-v1 with effect, usage, the sanitized flag, the receipt hash and the status by the one mapping of the feature (Observed as Succeeded, Denied as Denied, Uncertain as Uncertain, Cancelled as Cancelled, Failed as Failed and a timeout without a possible effect as TimedOut) and stores result and receipt through Artifacts.Store; the audit stage writes one evidence record per receipt through the sink of the pinned audit library as AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted in the transaction of the receipt, with the redactions named and without arguments or result, and keeps its id in auditRef."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2418]",
      "number": 2418
    },
    {
      "id": "AIFACTORY-TASK-2419",
      "type": "task",
      "parent": "AIFACTORY-US-602",
      "title": "Fakes of the pipeline dependencies and the invocation fixture of the acceptance suite",
      "sequence": "05.02.06.03",
      "description": "Fakes of the pipeline dependencies and the invocation fixture of the acceptance suite. Expected output: The acceptance suite holds fakes of PolicyEngineService, EnvironmentService, RunControlService, SecretBrokerService, ExecutionCapacityService, McpServerRegistryService and ArtifactService that record their calls, answer a configured outcome and can stop answering, the fake of RunControlService behind the one client port that answers the approval of an id, the state of a run and the current fencing token of a step, the fake of PolicyEngineService answering each of the four outcomes of policy-decision-v1, a fake executor per tool kind that returns a configured result, error or delay, workload tokens with and without the service scope, and a two-tenant, two-project invocation fixture; every later verification task of the feature uses it (model/services/tools-mcp/ToolAdapterService.yaml).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fakes of PolicyEngineService, EnvironmentService, RunControlService, SecretBrokerService, ExecutionCapacityService, McpServerRegistryService and ArtifactService that record their calls, answer a configured outcome and can stop answering, the fake of RunControlService behind the one client port that answers the approval of an id, the state of a run and the current fencing token of a step, the fake of PolicyEngineService answering each of the four outcomes of policy-decision-v1, a fake executor per tool kind that returns a configured result, error or delay, workload tokens with and without the service scope, and a two-tenant, two-project invocation fixture; every later verification task of the feature uses it (model/services/tools-mcp/ToolAdapterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6806,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2419]",
      "number": 2419
    },
    {
      "id": "AIFACTORY-TASK-2420",
      "type": "task",
      "parent": "AIFACTORY-US-602",
      "title": "Verify the pipeline of a call and its receipt through the acceptance suite",
      "sequence": "05.02.06.04",
      "description": "Verify the pipeline of a call and its receipt through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-007|Scenario=SCN-ToolAdapterService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-602: the tool-invocation-v1 document with fencingToken and toolVersion validated against docs/reference/schemas/tool-invocation.schema.json, the run, step and attempt on the row, the six states in order, the idempotent repeat, the key conflict, the stale fencing token of the same attempt, the token of a superseded attempt of the same run and step refused with FAILED_PRECONDITION after its successor called, also after the cache was cleared, because the mark is read back by run and step, the call for a cancelled run, the three gRPC refusals, the sanitized result with its evidence record, the publication and payload of ToolInvoked with a stopped transport, the retry of a read tool and the fail-fast answers; every receipt the suite reads is asserted on its status (Succeeded for Observed, Failed for Failed, TimedOut for a timeout without a possible effect, Cancelled for Cancelled) and validated against the schema; a measured run of read-class calls against the fakes reports the pipeline overhead without execution from `connectsoft.factory.tools.latency` and compares its 95th percentile with the objective of 300 milliseconds of the model, and an assertion over the whole suite finds `receiptRef` on every settled invocation past Validated; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-007|Scenario=SCN-ToolAdapterService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-602: the tool-invocation-v1 document with fencingToken and toolVersion validated against docs/reference/schemas/tool-invocation.schema.json, the run, step and attempt on the row, the six states in order, the idempotent repeat, the key conflict, the stale fencing token of the same attempt, the token of a superseded attempt of the same run and step refused with FAILED_PRECONDITION after its successor called, also after the cache was cleared, because the mark is read back by run and step, the call for a cancelled run, the three gRPC refusals, the sanitized result with its evidence record, the publication and payload of ToolInvoked with a stopped transport, the retry of a read tool and the fail-fast answers; every receipt the suite reads is asserted on its status (Succeeded for Observed, Failed for Failed, TimedOut for a timeout without a possible effect, Cancelled for Cancelled) and validated against the schema; a measured run of read-class calls against the fakes reports the pipeline overhead without execution from `connectsoft.factory.tools.latency` and compares its 95th percentile with the objective of 300 milliseconds of the model, and an assertion over the whole suite finds `receiptRef` on every settled invocation past Validated; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6806,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2420]",
      "number": 2420
    },
    {
      "id": "AIFACTORY-US-603",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Deny a tool call at the stage that refuses it, record the reason and announce the denial",
      "sequence": "05.02.07",
      "description": "As an operator, I want a refused tool call to state which stage refused it and why, so that I can tell a wrong argument from a missing permission, a policy rule, a blocked command or a frozen environment. A call that the pipeline refuses ends in state Denied, and nothing after the refusing stage happens: no credential is issued, no sandbox is leased and no tool runs. The stage and the reason are recorded on the `ToolInvocation` and announced by `ToolInvocationDenied`, written in the same transaction as the transition. At the schema stage a call is denied when its arguments violate the JSON schema of the descriptor or when the tool id and version name no active descriptor, because it was never registered, was retired or belongs to another tenant (trigger `SchemaInvalidOrToolInactive`, failure class validation); a tool of kind Mcp whose binding the registry answers NOT_FOUND is denied here as unbound. A descriptor of another tenant is never confirmed: the receipt, the reason and `ToolInvocationDenied` of a call that names it equal those of a call that names a tool id nobody registered, apart from the ids of the two invocations, and the reason of both says only that no active descriptor of that tool id and version exists for the caller. A retired descriptor of the tenant of the caller or of the platform tenant may name its retirement. The invocation keeps the failure class validation, and the attempt that receives the denial of an unknown or a foreign tool takes the failure class permanent and is not retried, as it does for the NOT_FOUND of `ToolExecutor.Validate` and `ToolExecutor.Interrupt` (AIFACTORY-US-601, AIFACTORY-US-608; ADR-0015 amendments D113 and D114). At the permission stage a call is denied when the caller lacks the scopes and roles the `authorization` of the descriptor requires, when the tool depends on a secret reference that was revoked for the tenant, or when the connection it is bound to is Suspended or Revoked. At the policy stage a call is denied when `PolicyEngineService/Policy.Decide` answers `deny`, when a shell command matches the block list and the policy denies it, or when a call of effective class shared-write or production targets a Frozen environment (trigger `PolicyDenied`, failure class policy). A decision of `allow-with-constraints` with a constraint the executor cannot apply is denied at the same stage, after the invocation was Authorized (trigger `ConstraintNotApplicable`, failure class policy, D121). At the approval stage a call the policy gates is denied when its approval was rejected or expired, as AIFACTORY-US-604 states. A call that is bound to no run is no denial: in I1 the hosted MCP endpoint serves only calls bound to a run, a step and an attempt and refuses any other before reception, so it leaves no invocation (AIFACTORY-US-607, D121). Over the hosted MCP endpoint a scope argument that contradicts the token is refused by the MCP library before the handler with a typed tool error whose reason is `scope-mismatch`, and that refusal is recorded as a denial at the permission stage (AIFACTORY-US-607). The caller receives the denial as the end of the `ToolExecutor.Invoke` stream: a `tool-receipt-v1` with the status Denied, by the mapping of AIFACTORY-US-602, whose error names the stage and a reason that is redacted and never repeats an argument; the agent takes it as its observation, and an attempt that fails on it carries the failure class policy-denied for a policy or approval denial. A receipt is stored for every denial past validation. The denial is idempotent: a repeat with the same key and request hash returns the same denial and writes no second event. `ToolInvocationDenied` carries `invocationId`, `tenantId`, `toolId`, `reason` and `stage`; StudioBff, DashboardService and AuditService consume it in their own PBIs. The evidence record that the audit stage writes with the receipt of a denial carries the action `policy-denied`, the one action `audit-evidence-v1` names for it. `connectsoft.factory.tools.denials` counts each denial by stage and reason with tenant and project. A caller that is not admitted at all, without a workload identity or without the service scope, is no denial: it is refused before reception as AIFACTORY-US-602 states and leaves no invocation. Kind: behavior. Traces: services: ToolAdapterService, PolicyEngineService; aggregates: ToolAdapterService/ToolInvocation; apis: ToolAdapterService/ToolExecutor.Invoke, PolicyEngineService/Policy.Decide; events: ToolAdapterService/ToolInvocationDenied; descriptors: tool-receipt-v1; adrs: ADR-0014, ADR-0015, ADR-0022; requirements: FR-05, NFR-04; scenarios: SCN-ToolAdapterService-013. Depends on: AIFACTORY-US-600, AIFACTORY-US-602, feature:policy-engine-service, feature:contracts-package. Sources: model/services/tools-mcp/ToolAdapterService.yaml, docs/planes/capability-tools/tool-policies.md#decision-outcomes, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given arguments that violate the schema of the descriptor, a tool id and version that name a retired descriptor, a tool id nobody registered and the tool id of a descriptor of another tenant, when `ToolAdapterService/ToolExecutor.Invoke` is called for each, then the `ToolAdapterService/ToolInvocation` moves from Received to Denied with the stage schema and the failure class validation, the reply ends with a receipt of status Denied whose reason repeats no argument, and no policy decision, credential or sandbox is requested; the receipt, the reason and `ToolAdapterService/ToolInvocationDenied` of the foreign tool equal those of the unregistered tool apart from the invocation ids and never confirm the descriptor, and the attempt takes the failure class permanent for both (SCN-ToolAdapterService-013, ADR-0015).",
        "AC2: Given a caller that lacks a scope the `authorization` of the descriptor requires, a `PolicyEngineService/Policy.Decide` that answers deny, and a call of effective class shared-write that targets a Frozen environment, when `ToolAdapterService/ToolExecutor.Invoke` is called for each, then the invocation moves from Validated to Denied with the stage permission or policy and its reason, a receipt of status Denied is stored, nothing executes and no credential or sandbox is requested (SCN-ToolAdapterService-013, FR-05).",
        "AC3: Given a denial at any stage, when the outbox dispatcher publishes `ToolAdapterService/ToolInvocationDenied` on `tool-execution.invocations.v1.tool-invocation-denied`, then the outbox record was written in the same transaction as the transition to Denied, the event is sent in the run event envelope with `invocationId`, `tenantId`, `toolId`, `reason` and `stage`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ToolAdapterService-013, ADR-0014).",
        "AC4: Given a denied call repeated with the same idempotency key and request hash, when it arrives, then the same denial is returned, no second `ToolAdapterService/ToolInvocationDenied` is written and `connectsoft.factory.tools.denials` was counted once with its stage, reason, tenant and project (SCN-ToolAdapterService-013, model/services/tools-mcp/ToolAdapterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/capability-tools/tool-policies.md#decision-outcomes",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2421",
        "AIFACTORY-TASK-2422"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6807,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Invoke",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "ToolAdapterService/ToolInvocationDenied"
        ],
        "descriptors": [
          "tool-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-013"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-600",
        "AIFACTORY-US-602",
        "feature:policy-engine-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/capability-tools/tool-policies.md#decision-outcomes",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-603]",
      "number": 603
    },
    {
      "id": "AIFACTORY-TASK-2421",
      "type": "task",
      "parent": "AIFACTORY-US-603",
      "title": "Denial transitions of the pipeline with stage, reason, receipt and the ToolInvocationDenied outbox record",
      "sequence": "05.02.07.01",
      "description": "Denial transitions of the pipeline with stage, reason, receipt and the ToolInvocationDenied outbox record. Expected output: The pipeline moves an invocation to Denied through SchemaInvalidOrToolInactive, PolicyDenied, ConstraintNotApplicable and ApprovalRejectedOrExpired with the stage (schema, permission, policy or approval), a redacted reason and the failure class, gives a call to a descriptor of another tenant the same receipt, reason and event as a call to an unknown tool id so that the descriptor is never confirmed, stores a receipt of status Denied for every denial past validation, writes ToolInvocationDenied in the transaction of the transition, returns the same denial for a repeat under the same key, requests no credential and no sandbox after the refusing stage, and counts connectsoft.factory.tools.denials by stage and reason.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The pipeline moves an invocation to Denied through SchemaInvalidOrToolInactive, PolicyDenied, ConstraintNotApplicable and ApprovalRejectedOrExpired with the stage (schema, permission, policy or approval), a redacted reason and the failure class, gives a call to a descriptor of another tenant the same receipt, reason and event as a call to an unknown tool id so that the descriptor is never confirmed, stores a receipt of status Denied for every denial past validation, writes ToolInvocationDenied in the transaction of the transition, returns the same denial for a repeat under the same key, requests no credential and no sandbox after the refusing stage, and counts connectsoft.factory.tools.denials by stage and reason."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6807,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2421]",
      "number": 2421
    },
    {
      "id": "AIFACTORY-TASK-2422",
      "type": "task",
      "parent": "AIFACTORY-US-603",
      "title": "Verify the denials through the acceptance suite",
      "sequence": "05.02.07.02",
      "description": "Verify the denials through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolAdapterService-013\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-603 with one case per stage and reason (invalid arguments, retired descriptor, unknown tool id, foreign descriptor, unbound MCP tool, missing scope, revoked secret reference, suspended connection, policy deny, a constraint that cannot be applied, blocked shell command, frozen environment), the publication and payload of ToolInvocationDenied with a stopped transport and the idempotent repeat; the receipt, the reason and the event payload of the foreign descriptor are compared with those of the unknown tool id byte for byte apart from the invocation ids and the times, and every receipt is asserted on the status Denied; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolAdapterService-013\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-603 with one case per stage and reason (invalid arguments, retired descriptor, unknown tool id, foreign descriptor, unbound MCP tool, missing scope, revoked secret reference, suspended connection, policy deny, a constraint that cannot be applied, blocked shell command, frozen environment), the publication and payload of ToolInvocationDenied with a stopped transport and the idempotent repeat; the receipt, the reason and the event payload of the foreign descriptor are compared with those of the unknown tool id byte for byte apart from the invocation ids and the times, and every receipt is asserted on the status Denied; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6807,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2422]",
      "number": 2422
    },
    {
      "id": "AIFACTORY-US-604",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "A call the policy gates executes only with an approval bound to its request hash and tool version, which Run Control owns, and a call the policy allows runs without one",
      "sequence": "05.02.08",
      "description": "As a reviewer, I want my approval to release exactly the call I was shown and nothing else, so that a changed argument or another tool version can never run under a decision I gave for something different. Whether a call needs an approval is stated by the policy and by nothing else. The tool service reads it from the outcome of its own decision through `PolicyEngineService/Policy.Decide`, one of the four outcomes of `policy-decision-v1`: `allow-with-approval` gates the call, `allow` and `allow-with-constraints` do not, and `deny` denies it. This one rule holds for every side-effect class, shared-write, production, publication, external and spend alike: the outcome of the policy decision is the only gate, and the tool service gates no class on its own (D123). Which calls the policy gates is the matter of the policy bundles, which belong to PolicyEngineService: its default policy bundle answers `allow-with-approval` for a call of effective class production, publication, external or spend, so a project must change its policy to drop that approval (D123). The chain of the first outcome holds two shared-write tools, and the policy treats them differently. `propose-change-set` is answered `allow-with-approval` and stays approval-bound, unless a project policy allows autonomous proposals, as the definition of `generate-product` foresees. `blueprint-submit-version` for a Draft version is answered `allow`, because ADR-0026 amendment D64 makes a Draft submission autonomous by default: such a call moves from Authorized to Brokered with no `approvalId` and executes. Only where the project policy gates blueprint drafts is it answered `allow-with-approval`, and it then waits like any gated call. Without this reading the four definitions of the chain that submit a blueprint version would stall at every submission. The reading is taken from D64, from the `approvals` section of the workflow definitions and from the outcomes of `policy-decision-v1`, and the owner confirmed it (D121) and decided that it reaches every class (D123): the invariant of `ToolInvocation` states that an invocation of any side-effect class needs a bound approval only when `Policy.Decide` answers `allow-with-approval`, that `allow` executes without one, that `deny` ends the invocation Denied and that `allow-with-constraints` executes without one with its constraints applied, and `tool-invocation-v1` requires the approval id only for a call whose decision answers `allow-with-approval`; decision D64 stays. A call that carries an `approvalId` is treated as gated whatever the outcome, because its caller states that a decision was taken for it, and no call ever executes under an approval id that does not bind. A decision of `allow-with-constraints` needs no approval: the call proceeds under the constraints of the decision, which the broker stage applies to the egress allow list and the limits of the sandbox lease (AIFACTORY-US-605), and a constraint that cannot be applied denies the call (AIFACTORY-US-603). A gated call executes only with an approval bound to the request hash of this invocation and to the exact tool version, and a different hash needs a new approval. The tool service never opens and never decides an approval. An approval is an `ApprovalRequest` of RunControlService: the lease holder requests it for the step with the hash of the exact proposal, a Reviewer decides it, and the agent runtime issues the gated call from its checkpoint once the decision is Approved. When a gated call arrives with an `approvalId`, the service validates the binding through its RunControlService client port before any credential or sandbox is brokered: the approval is of the same tenant and run, its state is Approved, its `proposalHash` equals the request hash of the invocation, and the request hash covers the tool id, the tool version and the arguments, so an approval given for another version or other arguments does not match. A bound approval moves the invocation on to Brokered with `approvalId` recorded, and the receipt and `ToolInvoked` carry it. When a gated call arrives without an `approvalId`, the invocation moves from Authorized to AwaitingApproval (trigger `GatedClassWithoutApproval`): the reply states that an approval for this request hash and tool version is required, nothing executes, and `connectsoft.factory.tools.approvals_waiting` goes up. The caller obtains the approval from RunControlService and repeats the call under the same idempotency key with the `approvalId`; the service validates the binding and the invocation moves from AwaitingApproval to Brokered (trigger `ApprovalBound`). The seven values of `ApprovalState` are answered one by one. Approved binds when hash, run and tenant match. Pending keeps the invocation AwaitingApproval and the reply says that the decision is pending. Rejected and Expired move the invocation to Denied at the stage approval (trigger `ApprovalRejectedOrExpired`) with `ToolInvocationDenied`, and the attempt fails with the failure class policy-denied. ChangesRequested and Stale bind nothing and the invocation stays AwaitingApproval: the proposal changes, a changed proposal has another request hash, and the runtime issues it as a new invocation under a new idempotency key, because the old key with another hash would be a conflict. Cancelled binds nothing and the invocation stays AwaitingApproval until the owner states whether a cancelled approval denies it. An approval of another hash, another run or another tenant binds nothing either: the invocation stays AwaitingApproval and the reply says so, the same answer for an approval of another tenant as for an unknown approval id. The model names a transition from AwaitingApproval to Denied only for Rejected and Expired, so an invocation whose approval ended ChangesRequested, Stale or Cancelled waits without an end, which is reported to the owner. RunControlService is a fail-fast dependency: when it does not answer, the gated call does not execute and fails with UNAVAILABLE. Three points of the read side are open and reported to the owner. The model names RunControlService as the dependency that validates the approval bound to the request hash, but the only internal read its service file lists for a worker is the server stream `RunControl.WatchRun`. That stream announces run and approval state changes; it is not stated to return an approval by its id with its proposal hash, its run and its tenant at the moment of a call, nor to replay the current state to a new subscriber, so it does not serve a validation that must precede the broker stage. The tool service consumes no `ApprovalDecided` either. The delivery puts the validation behind one client port, the port that also reads run and lease state for AIFACTORY-US-602, and proves it against a fake until the operation is named. For the same reason an invocation that waits and is never repeated cannot learn that its approval expired, although the model states that it is then Denied; the delivery denies it when the repeated call finds the approval Rejected or Expired. Which component defines the canonical request hash is reported with them: in `generate-product` the approval is requested on the step `approve-proposal` for the hash of the generated outputs, while `propose-change-set` is called by a later step, so the proposal hash of the approval equals the request hash the executor computes only when one rule defines both. Kind: behavior. Traces: services: ToolAdapterService, RunControlService, PolicyEngineService; aggregates: ToolAdapterService/ToolInvocation, RunControlService/ApprovalRequest; apis: ToolAdapterService/ToolExecutor.Invoke, PolicyEngineService/Policy.Decide; events: ToolAdapterService/ToolInvoked, ToolAdapterService/ToolInvocationDenied; tools: propose-change-set, blueprint-submit-version; descriptors: policy-decision-v1, tool-receipt-v1; adrs: ADR-0014, ADR-0015, ADR-0022, ADR-0026; requirements: FR-06, FUX-05, XL-10, NFR-04. Depends on: AIFACTORY-US-602, AIFACTORY-US-603, feature:run-control-service, feature:policy-engine-service. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/control-plane/RunControlService.yaml, model/tools/blueprint-submit-version.yaml, model/tools/propose-change-set.yaml, model/workflows/vision-to-blueprint.yaml, model/workflows/generate-product.yaml, docs/architecture/adr/0026-requirements-to-ux-handoff.md, docs/reference/schemas/approval.schema.json, docs/reference/schemas/policy-decision.schema.json, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given a call of `propose-change-set` whose decision through `PolicyEngineService/Policy.Decide` is `allow-with-approval`, with an `approvalId` whose `RunControlService/ApprovalRequest` is Approved for the same tenant and run and whose `proposalHash` equals the request hash of the invocation, when `ToolAdapterService/ToolExecutor.Invoke` is called, then the binding is validated before any credential or sandbox is requested, the `ToolAdapterService/ToolInvocation` moves on to Brokered with `approvalId` recorded, the tool executes once, and the receipt and `ToolAdapterService/ToolInvoked` carry the approval id (FR-06, ADR-0022).",
        "AC2: Given a call whose decision is `allow-with-approval` and that carries no `approvalId`, among them a call whose class the environment raised to production, when `ToolAdapterService/ToolExecutor.Invoke` is called, then the invocation moves from Authorized to AwaitingApproval, the reply states that an approval for this request hash and tool version is required, nothing executes, no approval is opened by the tool service and `connectsoft.factory.tools.approvals_waiting` is incremented; when the call is repeated under the same key with a bound, Approved approval, then the invocation moves to Brokered through `ApprovalBound` and executes once (FR-06, model/services/tools-mcp/ToolAdapterService.yaml).",
        "AC3: Given a waiting invocation, when the call is repeated with an `approvalId` whose `RunControlService/ApprovalRequest` is Pending, then the invocation stays AwaitingApproval and the reply says that the decision is pending; when the approval is Rejected or Expired, then the invocation moves from AwaitingApproval to Denied at the stage approval, `ToolAdapterService/ToolInvocationDenied` is written in the same transaction, the receipt carries the status Denied, nothing executes and `connectsoft.factory.tools.approvals_waiting` is decremented (FR-06, ADR-0014).",
        "AC4: Given an approval that is ChangesRequested, Stale or Cancelled, or that is Approved for other arguments, for another tool version, for another run or for another tenant, when the call is repeated with its `approvalId`, then nothing is bound, the invocation stays AwaitingApproval, nothing executes and the reply for an approval of another tenant equals that for an unknown approval id; given the regenerated proposal is called under a new idempotency key, then it is a new invocation with its own request hash; given RunControlService does not answer, when a gated call arrives, then it fails with UNAVAILABLE and nothing executes (FR-06, ADR-0015, model/services/control-plane/RunControlService.yaml).",
        "AC5: Given a call of `blueprint-submit-version` for a Draft version under the default policy, whose decision through `PolicyEngineService/Policy.Decide` is `allow`, when `ToolAdapterService/ToolExecutor.Invoke` is called without an `approvalId`, then the invocation moves from Authorized to Brokered, executes once and ends Observed with no `approvalId` on the row, the receipt or `ToolAdapterService/ToolInvoked`, the Run Control port is not asked for an approval and `connectsoft.factory.tools.approvals_waiting` does not move; given a project policy that gates blueprint drafts, whose decision is `allow-with-approval`, then the same call moves to AwaitingApproval; given a decision of `allow-with-constraints`, then the call proceeds without an approval and the constraints are applied to the egress allow list and the limits of its lease; and given a call of effective class production, publication, external or spend whose decision is `allow`, because the policy of its project dropped the approval the default policy bundle asks for, then it moves from Authorized to Brokered without an approval like any allowed call, the tool service adding no gate of its own for a class (D123, ADR-0026, model/tools/blueprint-submit-version.yaml, docs/reference/schemas/policy-decision.schema.json)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/propose-change-set.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2423",
        "AIFACTORY-TASK-2424"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6808,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "RunControlService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation",
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Invoke",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "ToolAdapterService/ToolInvoked",
          "ToolAdapterService/ToolInvocationDenied"
        ],
        "tools": [
          "propose-change-set",
          "blueprint-submit-version"
        ],
        "descriptors": [
          "policy-decision-v1",
          "tool-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0022",
          "ADR-0026"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "XL-10",
          "NFR-04"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-602",
        "AIFACTORY-US-603",
        "feature:run-control-service",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/propose-change-set.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-604]",
      "number": 604
    },
    {
      "id": "AIFACTORY-TASK-2423",
      "type": "task",
      "parent": "AIFACTORY-US-604",
      "title": "Approval stage that reads the need for an approval from the policy outcome, with the AwaitingApproval wait and the validation port to Run Control",
      "sequence": "05.02.08.01",
      "description": "Approval stage that reads the need for an approval from the policy outcome, with the AwaitingApproval wait and the validation port to Run Control. Expected output: The pipeline gates a call when its own decision through Policy.Decide is allow-with-approval or when the call carries an approvalId, and lets a decision of allow or allow-with-constraints pass to the broker stage without an approval, by one rule for every side-effect class, shared-write, production, publication, external and spend alike, with no gate of its own for a class, the default policy bundle that asks for the approval of production, publication, external and spend calls being the matter of PolicyEngineService (D123), so that blueprint-submit-version for a Draft version runs autonomously under the default policy (ADR-0026 amendment D64) and propose-change-set stays approval-bound; it validates a supplied approvalId through one client port to RunControlService (same tenant and run, state Approved, proposalHash equal to the request hash, which covers tool id, tool version and arguments), moves the invocation to AwaitingApproval when none is bound, to Brokered through ApprovalBound on a bound approval and to Denied on a Rejected or Expired one, keeps it AwaitingApproval for Pending, ChangesRequested, Stale and Cancelled and for an approval of another hash, run or tenant, repeats the stage when the call returns under the same idempotency key, moves connectsoft.factory.tools.approvals_waiting with every entry and exit, opens and decides no approval, and fails with UNAVAILABLE when RunControlService does not answer; the port has one implementation slot for the operation of RunControlService that the model has yet to name, because RunControl.WatchRun is a stream of changes and no read of an approval by its id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The pipeline gates a call when its own decision through Policy.Decide is allow-with-approval or when the call carries an approvalId, and lets a decision of allow or allow-with-constraints pass to the broker stage without an approval, by one rule for every side-effect class, shared-write, production, publication, external and spend alike, with no gate of its own for a class, the default policy bundle that asks for the approval of production, publication, external and spend calls being the matter of PolicyEngineService (D123), so that blueprint-submit-version for a Draft version runs autonomously under the default policy (ADR-0026 amendment D64) and propose-change-set stays approval-bound; it validates a supplied approvalId through one client port to RunControlService (same tenant and run, state Approved, proposalHash equal to the request hash, which covers tool id, tool version and arguments), moves the invocation to AwaitingApproval when none is bound, to Brokered through ApprovalBound on a bound approval and to Denied on a Rejected or Expired one, keeps it AwaitingApproval for Pending, ChangesRequested, Stale and Cancelled and for an approval of another hash, run or tenant, repeats the stage when the call returns under the same idempotency key, moves connectsoft.factory.tools.approvals_waiting with every entry and exit, opens and decides no approval, and fails with UNAVAILABLE when RunControlService does not answer; the port has one implementation slot for the operation of RunControlService that the model has yet to name, because RunControl.WatchRun is a stream of changes and no read of an approval by its id."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6808,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2423]",
      "number": 2423
    },
    {
      "id": "AIFACTORY-TASK-2424",
      "type": "task",
      "parent": "AIFACTORY-US-604",
      "title": "Verify the approval binding of gated calls and the autonomous Draft submission through the acceptance suite",
      "sequence": "05.02.08.02",
      "description": "Verify the approval binding of gated calls and the autonomous Draft submission through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=GatedToolCalls\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-604 against the fakes of PolicyEngineService and RunControlService: propose-change-set under allow-with-approval with a RunControlService/ApprovalRequest that is Approved and bound, missing, Pending, Rejected, Expired, ChangesRequested, Stale, Cancelled, of other arguments, of another tool version, of another run and of another tenant, and with the fake stopped; blueprint-submit-version for a Draft version under allow, which goes from Authorized to Brokered with no approvalId and without a call to the Run Control port, and under a gating project policy with allow-with-approval, which goes to AwaitingApproval; a call under allow-with-constraints whose lease carries the narrowed egress allow list and limits; and one call of each effective class production, publication, external and spend, which waits for its approval under allow-with-approval and goes from Authorized to Brokered without one under allow (D123).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=GatedToolCalls\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-604 against the fakes of PolicyEngineService and RunControlService: propose-change-set under allow-with-approval with a RunControlService/ApprovalRequest that is Approved and bound, missing, Pending, Rejected, Expired, ChangesRequested, Stale, Cancelled, of other arguments, of another tool version, of another run and of another tenant, and with the fake stopped; blueprint-submit-version for a Draft version under allow, which goes from Authorized to Brokered with no approvalId and without a call to the Run Control port, and under a gating project policy with allow-with-approval, which goes to AwaitingApproval; a call under allow-with-constraints whose lease carries the narrowed egress allow list and limits; and one call of each effective class production, publication, external and spend, which waits for its approval under allow-with-approval and goes from Authorized to Brokered without one under allow (D123)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6808,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2424]",
      "number": 2424
    },
    {
      "id": "AIFACTORY-US-605",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Broker short-lived credentials and a sandbox with the workspace of the run for a call, and release both when it ends",
      "sequence": "05.02.09",
      "description": "As an operator, I want every tool that writes, builds or runs a command to work in a leased sandbox with credentials that expire, so that nothing an agent runs touches the host, another run or a secret that outlives the call. After authorization and, where the policy gates the call, after the approval is bound, the pipeline brokers what the call needs to run and nothing more. Credentials come first. For each secret dependency the descriptor names, the service asks `SecretBrokerService/SecretBroker.Issue` for a short-lived credential scoped to the subject and the purpose of this call, with the policy decision id; the credential is delivered once, is injected into the sandbox or into the connector call, and is never written to the result, the receipt, an event, a log record or the reply to the agent. A tool without a secret dependency receives none. The sandbox follows. A descriptor names its sandbox kind; the kind None is allowed only for a native tool of class read that is answered by its owning service, which needs no sandbox. The seven repository read tools are of class read and still name a sandbox kind, because in this increment they execute inside the sandbox of the run over the workspace mounted read-only (decision D125, AIFACTORY-US-606). For every other tool the service asks `ExecutionCapacityService/Capacity.AcquireLease` for a sandbox of that kind with the tenant, project, run and attempt of the call. The model names the pool manager as the target of this dependency, which the service registry records as merged into ExecutionCapacityService. The lease carries the limits of the call: cpu, memory, timeout, read-only mounts and the egress allow list, by default `Tools:Sandbox:DefaultEgressAllowList`; any other destination is unreachable from the sandbox. When the decision of the call is `allow-with-constraints`, a constraint that narrows the egress allow list or a limit is applied to the lease before anything runs, and a lease never carries a wider limit than the decision gave (AIFACTORY-US-602). A lease and a workspace have different lifetimes, and the first outcome depends on the difference: a file that one step writes must still be there when a later step, under another attempt and another lease, builds it and proposes the change set. The workspace belongs to the run, and ExecutionCapacityService owns it (D121). That service creates the isolated workspace of a run with the first lease of the run, keeps it between leases, hands it to the lease holder through the `workspaceRef` of the lease and removes it when it consumes a terminal run event of RunControlService, `RunCompleted`, `RunFailed` or `RunCancelled`. A run has one workspace: every later lease of the same run, of any step and attempt, names the run and receives the same reference. ToolAdapterService mounts the workspace by the lease that hands it over and records the reference on each `SandboxLease`; it neither stores nor removes a workspace and consumes no event of a run. Releasing or reaping a lease ends the sandbox and its credentials, frees the capacity and leaves the workspace of the run in place. The creation, the keeping and the removal of the workspace are delivered by feature `execution-capacity-service-thin`, on which this PBI depends, and are not built here. The invocation moves to Brokered, from Authorized with the trigger `CredentialsAndSandboxLeased` or, for a gated call, from AwaitingApproval with the trigger `ApprovalBound`, and `SandboxLeased` is written in the same transaction. Calls of the same attempt that arrive while a lease of that attempt is open reuse it and renew it through `ExecutionCapacityService/Capacity.RenewLease`; a call of another attempt of the run takes a lease of its own on the same workspace. `connectsoft.factory.tools.sandboxes_open` follows the open leases and `connectsoft.factory.tools.sandbox_capacity` reports what capacity states as available. While a call executes, the reminder `credential-expiry` of the grain fires before a brokered credential expires and a fresh one is issued for a call that still runs. The worker `SandboxReaper` runs every two minutes, partitioned by pool with at most four in parallel: it releases a lease once no invocation that uses it is in a non-terminal state or once its expiry passed, sets `releasedAt` and writes `SandboxReleased` with the reason in the same transaction, idempotently on the lease id and with five exponential retries. ExecutionCapacityService frees the capacity and SecretBrokerService revokes the issuances of the sandbox when they consume that event, in their own PBIs. On release the service reports the minutes of the lease through `CostUsageService/Usage.RecordUsage` as a `usage-record-v1` on the meter `sandbox.minutes`, the value of the descriptor for the meter the model of this service names SandboxMinutes, with the lease id as its source receipt, so a repeated report is recorded once. CostUsageService is a dependency that degrades: a release never waits for it, the report is retried with the retries of the worker, and no receipt is held back for a missing price, because CostUsageService stores an unpriced receipt as Uncertain. Whether the minutes of a failed or cancelled invocation are metered is an input of the owner and is not decided here: the report states the state of the invocation in its dimensions. The usage of the invocation itself reaches CostUsageService through `ToolInvoked`, from which that service records the meter `tools.invocations`. SecretBrokerService and ExecutionCapacityService are fail-fast dependencies: when the broker does not answer, the call fails with UNAVAILABLE and no sandbox is leased; when capacity denies the lease because the pool is exhausted, the call waits and asks again with backoff until the deadline the caller set from its attempt budget, then fails with RESOURCE_EXHAUSTED and the failure class transient, and nothing executed. The capacity alert the model names for this failure mode reads two signals this service emits: the gauge `connectsoft.factory.tools.sandbox_capacity`, which then reports no available sandbox of the kind, and the transient failures that `connectsoft.factory.tools.invocations` counts; the alert rule itself is defined with the observability platform and not here. A sandbox whose heartbeat is lost while a call executes is the case of AIFACTORY-US-608. The model has no column that marks a usage report as acknowledged, so a report that every retry failed to deliver is logged and counted and reported to the owner as a gap. Kind: behavior. Traces: services: ToolAdapterService, SecretBrokerService, ExecutionCapacityService, CostUsageService; aggregates: ToolAdapterService/ToolInvocation; apis: SecretBrokerService/SecretBroker.Issue, ExecutionCapacityService/Capacity.AcquireLease, ExecutionCapacityService/Capacity.RenewLease, CostUsageService/Usage.RecordUsage; events: ToolAdapterService/SandboxLeased, ToolAdapterService/SandboxReleased; descriptors: usage-record-v1; adrs: ADR-0014, ADR-0022; requirements: FR-05, NFR-02, XL-16; scenarios: SCN-ToolAdapterService-015, SCN-ToolAdapterService-016. Depends on: AIFACTORY-US-602, feature:secret-broker-service, feature:execution-capacity-service-thin, feature:cost-usage-service-complete, feature:contracts-package. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/governance/SecretBrokerService.yaml, model/services/control-plane/CostUsageService.yaml, docs/reference/schemas/usage-record.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given an authorized call to a sandbox-class tool whose descriptor names one secret dependency, when the broker stage runs, then one credential is issued through `SecretBrokerService/SecretBroker.Issue` with the policy decision id, a sandbox is leased through `ExecutionCapacityService/Capacity.AcquireLease` with the workspace of the run and the egress allow list, narrowed by the constraints of a decision of `allow-with-constraints` where there is one, the `ToolAdapterService/ToolInvocation` moves to Brokered with its `sandboxLeaseId`, and the credential value appears in no row, receipt, event or log record; a second call of the same attempt while the lease is open reuses it and renews it through `ExecutionCapacityService/Capacity.RenewLease` and writes no second `ToolAdapterService/SandboxLeased`, and a read-class native tool whose sandbox kind is None is brokered without a lease (ADR-0022, docs/planes/capability-tools/tool-policies.md).",
        "AC2: Given the lease was recorded, when the outbox dispatcher publishes `ToolAdapterService/SandboxLeased` on `tool-execution.sandboxes.v1.sandbox-leased`, then the outbox record was written in the same transaction as the transition to Brokered, the event is sent in the run event envelope with `leaseId`, `invocationId`, `tenantId`, `kind` and `poolId`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; given SecretBrokerService does not answer, and given `ExecutionCapacityService/Capacity.AcquireLease` denies the lease until the deadline of the call, then the first call fails with UNAVAILABLE and the second waits, asks again with backoff and fails with RESOURCE_EXHAUSTED and the failure class transient while `connectsoft.factory.tools.sandbox_capacity` reports no available sandbox, and in both nothing executes and no event is written (SCN-ToolAdapterService-015, ADR-0014).",
        "AC3: Given an open lease whose invocations all ended, or whose expiry passed, when `SandboxReaper` runs, then `releasedAt` is set and the `ToolAdapterService/SandboxReleased` outbox record with `leaseId`, `tenantId` and `reason` is written in the same transaction and published on `tool-execution.sandboxes.v1.sandbox-released` with the same retry guarantee; a second run for the same lease id changes nothing, a lease that an executing invocation still uses is not released, and the release ends the sandbox and its credentials and leaves the workspace of the run in place (SCN-ToolAdapterService-016, ADR-0014).",
        "AC4: Given a released lease, when the release is processed, then `CostUsageService/Usage.RecordUsage` is called with a `usage-record-v1` whose `meter` is `sandbox.minutes`, with the minutes between `leasedAt` and `releasedAt`, the state of the invocation in its dimensions and the lease id as `sourceReceipt`; given CostUsageService does not answer, then the release is not held back and the report is retried, and a report delivered twice is recorded once (model/services/control-plane/CostUsageService.yaml, docs/reference/schemas/usage-record.schema.json).",
        "AC5: Given a run whose first attempt wrote a file through a sandbox-class call and whose lease `SandboxReaper` has released, when a call of a later attempt of the same run is brokered through `ExecutionCapacityService/Capacity.AcquireLease`, then the lease hands over the same `workspaceRef` as the released one and the new `SandboxLease` records it, the call reads the file the first attempt wrote and builds it, a call of another run never receives that workspace, and ToolAdapterService has neither stored nor removed a workspace, because ExecutionCapacityService owns it (SCN-ToolAdapterService-016, FR-05, model/services/runtime-cloud/ExecutionCapacityService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2425",
        "AIFACTORY-TASK-2426",
        "AIFACTORY-TASK-219",
        "AIFACTORY-TASK-2427"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6809,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "SecretBrokerService",
          "ExecutionCapacityService",
          "CostUsageService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "SecretBrokerService/SecretBroker.Issue",
          "ExecutionCapacityService/Capacity.AcquireLease",
          "ExecutionCapacityService/Capacity.RenewLease",
          "CostUsageService/Usage.RecordUsage"
        ],
        "events": [
          "ToolAdapterService/SandboxLeased",
          "ToolAdapterService/SandboxReleased"
        ],
        "descriptors": [
          "usage-record-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-02",
          "XL-16"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-015",
          "SCN-ToolAdapterService-016"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-602",
        "feature:secret-broker-service",
        "feature:execution-capacity-service-thin",
        "feature:cost-usage-service-complete",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-605]",
      "number": 605
    },
    {
      "id": "AIFACTORY-TASK-2425",
      "type": "task",
      "parent": "AIFACTORY-US-605",
      "title": "Broker stage: credentials from the Secret Broker and the sandbox lease with the workspace of the run, limits and egress allow list",
      "sequence": "05.02.09.01",
      "description": "Broker stage: credentials from the Secret Broker and the sandbox lease with the workspace of the run, limits and egress allow list. Expected output: The broker stage issues one credential per secret dependency through SecretBroker.Issue with the policy decision id and injects it into the sandbox or the connector call without persisting or logging its value, acquires the sandbox through Capacity.AcquireLease with the tenant, project, run and attempt, the limits and the egress allow list (Tools:Sandbox:DefaultEgressAllowList by default), narrows the egress allow list and the limits by the constraints of a decision of allow-with-constraints and never widens them, records the SandboxLease with the workspaceRef the lease hands over, the reference of the one workspace of the run, which ExecutionCapacityService creates with the first lease of the run and keeps between leases (D121), mounts that workspace whatever the attempt and never creates or stores one itself, reuses an open lease of the same attempt and renews it through Capacity.RenewLease, writes SandboxLeased in the transaction of the Brokered transition (from Authorized through CredentialsAndSandboxLeased, from AwaitingApproval through ApprovalBound), leases nothing for a read-class native tool of sandbox kind None, renews a credential on the credential-expiry reminder, fails with UNAVAILABLE when the broker does not answer and with RESOURCE_EXHAUSTED when capacity denies the lease until the deadline of the call, and records connectsoft.factory.tools.sandbox_capacity and the transient failure in connectsoft.factory.tools.invocations, the two signals the capacity alert reads.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The broker stage issues one credential per secret dependency through SecretBroker.Issue with the policy decision id and injects it into the sandbox or the connector call without persisting or logging its value, acquires the sandbox through Capacity.AcquireLease with the tenant, project, run and attempt, the limits and the egress allow list (Tools:Sandbox:DefaultEgressAllowList by default), narrows the egress allow list and the limits by the constraints of a decision of allow-with-constraints and never widens them, records the SandboxLease with the workspaceRef the lease hands over, the reference of the one workspace of the run, which ExecutionCapacityService creates with the first lease of the run and keeps between leases (D121), mounts that workspace whatever the attempt and never creates or stores one itself, reuses an open lease of the same attempt and renews it through Capacity.RenewLease, writes SandboxLeased in the transaction of the Brokered transition (from Authorized through CredentialsAndSandboxLeased, from AwaitingApproval through ApprovalBound), leases nothing for a read-class native tool of sandbox kind None, renews a credential on the credential-expiry reminder, fails with UNAVAILABLE when the broker does not answer and with RESOURCE_EXHAUSTED when capacity denies the lease until the deadline of the call, and records connectsoft.factory.tools.sandbox_capacity and the transient failure in connectsoft.factory.tools.invocations, the two signals the capacity alert reads."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6809,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2425]",
      "number": 2425
    },
    {
      "id": "AIFACTORY-TASK-2426",
      "type": "task",
      "parent": "AIFACTORY-US-605",
      "title": "SandboxReaper with the SandboxReleased outbox record and the sandbox minutes report, releasing the lease and never the workspace of the run",
      "sequence": "05.02.09.02",
      "description": "SandboxReaper with the SandboxReleased outbox record and the sandbox minutes report, releasing the lease and never the workspace of the run. Expected output: The reaper releases a lease once no invocation that uses it is non-terminal or once its expiry passed, on its two-minute schedule partitioned by pool with at most four in parallel, sets releasedAt and writes SandboxReleased with the reason in one transaction, idempotently on the lease id and with five exponential retries; the release ends the sandbox and its credentials and never removes the workspace of the run, which ExecutionCapacityService owns and removes on a terminal run event (D121); the reference stays on the released SandboxLease and the next lease of the run hands over the same one; on release it reports the minutes of the lease through Usage.RecordUsage as a usage-record-v1 on the meter sandbox.minutes with the lease id as source receipt and the state of the invocation in the dimensions, never holds a release back for the report, and logs and counts a report that every retry failed to deliver.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The reaper releases a lease once no invocation that uses it is non-terminal or once its expiry passed, on its two-minute schedule partitioned by pool with at most four in parallel, sets releasedAt and writes SandboxReleased with the reason in one transaction, idempotently on the lease id and with five exponential retries; the release ends the sandbox and its credentials and never removes the workspace of the run, which ExecutionCapacityService owns and removes on a terminal run event (D121); the reference stays on the released SandboxLease and the next lease of the run hands over the same one; on release it reports the minutes of the lease through Usage.RecordUsage as a usage-record-v1 on the meter sandbox.minutes with the lease id as source receipt and the state of the invocation in the dimensions, never holds a release back for the report, and logs and counts a report that every retry failed to deliver."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6809,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2426]",
      "number": 2426
    },
    {
      "id": "AIFACTORY-TASK-219",
      "type": "task",
      "parent": "AIFACTORY-US-605",
      "title": "Build tooling and egress enforcement of the sandbox worker image of the pool",
      "sequence": "05.02.09.03",
      "description": "Build tooling and egress enforcement of the sandbox worker image of the pool. Expected output: The sandbox worker of the one pool, its lease, the workspace of a run with its creation at the first lease of the run, its keeping between leases and its removal on a terminal run event (D121), the mount of the workspace and the destruction of a sandbox at release are owned by the thin delivery of feature execution-capacity-service-thin and are not planned again here. This task adds only what the tools of the chain need and that feature does not state: the worker image carries the build tooling of the chain (the dotnet toolchain, git and the node toolchain behind the shell allow list of model/services/tools-mcp/ToolAdapterService.yaml), and the worker enforces the egress allow list and the limits a lease of ToolAdapterService carries, so that a destination outside the list is unreachable from a sandbox; the destruction of a sandbox leaves the workspace of its run in place.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "The sandbox worker of the one pool, its lease, the workspace of a run with its creation at the first lease of the run, its keeping between leases and its removal on a terminal run event (D121), the mount of the workspace and the destruction of a sandbox at release are owned by the thin delivery of feature execution-capacity-service-thin and are not planned again here. This task adds only what the tools of the chain need and that feature does not state: the worker image carries the build tooling of the chain (the dotnet toolchain, git and the node toolchain behind the shell allow list of model/services/tools-mcp/ToolAdapterService.yaml), and the worker enforces the egress allow list and the limits a lease of ToolAdapterService carries, so that a destination outside the list is unreachable from a sandbox; the destruction of a sandbox leaves the workspace of its run in place."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6809,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-219]",
      "number": 219
    },
    {
      "id": "AIFACTORY-TASK-2427",
      "type": "task",
      "parent": "AIFACTORY-US-605",
      "title": "Verify the sandbox lease, the credentials, the release and the workspace of the run through the acceptance suite",
      "sequence": "05.02.09.04",
      "description": "Verify the sandbox lease, the credentials, the release and the workspace of the run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-015|Scenario=SCN-ToolAdapterService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-605 with the fakes of SecretBrokerService, ExecutionCapacityService and CostUsageService and a sandbox fixture with a workspace: the credential that appears nowhere, the lease narrowed by the constraints of a decision, the reused lease renewed through ExecutionCapacityService/Capacity.RenewLease, the read tool without a lease, the publication and payload of SandboxLeased and SandboxReleased with a stopped transport, the stopped broker, the exhausted pool with its capacity signal, the idempotent reaper, the usage-record-v1 on the meter sandbox.minutes delivered once, and a file that a call of one attempt wrote and that a call of a later attempt of the same run reads and builds after the first lease was reaped; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-015|Scenario=SCN-ToolAdapterService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-605 with the fakes of SecretBrokerService, ExecutionCapacityService and CostUsageService and a sandbox fixture with a workspace: the credential that appears nowhere, the lease narrowed by the constraints of a decision, the reused lease renewed through ExecutionCapacityService/Capacity.RenewLease, the read tool without a lease, the publication and payload of SandboxLeased and SandboxReleased with a stopped transport, the stopped broker, the exhausted pool with its capacity signal, the idempotent reaper, the usage-record-v1 on the meter sandbox.minutes delivered once, and a file that a call of one attempt wrote and that a call of a later attempt of the same run reads and builds after the first lease was reaped; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6809,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2427]",
      "number": 2427
    },
    {
      "id": "AIFACTORY-US-606",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Execute the native tools of the chain through the service that owns each, and shell commands in the sandbox under the allow list and the block list",
      "sequence": "05.02.10",
      "description": "As a requester, I want the tools my run needs to read its workspace, write files, build, validate blueprints and propose a change to work behind the one executor, so that the agents of my run produce a built and tested change set without any tool running outside the pipeline. When an invocation reaches Executing, the executor of its kind runs the tool, and a native tool wrapped as a descriptor looks to the pipeline like any other (ADR-0022 decision 1). The sixteen tools of the chain are native, and each executes where its catalogue entry places it. The seven repository read tools (`list-files`, `search-text`, `search-symbols`, `find-references`, `read-range`, `get-dependencies` and `get-git-diff`) are owned by RepositoryIntelligenceService, and in this increment they execute inside the sandbox of the run (decision D125). The executor leases the sandbox as for every sandboxed tool (AIFACTORY-US-605); the lease mounts the workspace of the run read-only, and ToolExecutorHost runs in that sandbox the read-tool handlers of the RepositoryIntelligenceService repository, packaged as a tool component that answers the same seven methods with the same contract as the complete service of I5. The executor calls the method of the tool on that component with the invocation and the `workspaceRef` of the run, which it reads from the lease. No deployed service reads a workspace from outside a sandbox before I5, so a read tool sees the workspace of its run only and never another run or the host, and since ExecutionCapacityService creates the workspace with the first lease of the run (D121), a read tool always finds one. The arguments of each read tool follow the golden argument shape of its method: a path prefix, a name pattern and a depth for `ListFiles`; the text and an optional path prefix for `SearchText`; a name, a kind and a container for `SearchSymbols`; a symbol for `FindReferences`; a path and a line range for `ReadRange`; a path or a symbol for `GetDependencies`; optional paths for `GetHistory`, which serves `get-git-diff`. Each shape also holds the continuation token of a paged answer, and arguments that do not match the shape are refused with INVALID_ARGUMENT, which ends the invocation Failed with the failure class validation. `knowledge-search` and `graph-query` are owned by VectorMemoryService, whose thin delivery answers with an empty, well-formed result. `blueprint-validate` and `blueprint-submit-version` are calls to the methods `Blueprints.Validate` and `Blueprints.SubmitDraftVersion` of BlueprintService, and `get-approved-recipe` is a call to `Recipes.GetApprovedRecipe` of GenerationRecipeService; both services name ToolAdapterService as an inbound caller, and each call carries the scope of the run. From I2 every service call a run-bound tool makes also carries in its call metadata the requester of the run as delegatedUserId and the runId and stepRunId of the calling step, so that the promotion request of the deploy-environment tool is decided for the run requester and the completion events of the promotion or of a change proposal find the waiting step (D141). `blueprint-submit-version` is a shared write that the default policy lets run without an approval for a Draft version (AIFACTORY-US-604). Its effect is the stored version: the receipt carries the reference of the blueprint version as its effect and the audit fields of its catalogue entry, `blueprintId`, `version`, `kind` and `documentHash`. The catalogue declares it naturally idempotent on the document hash and without a retry of the executor, so a second call with the same document, also under another idempotency key, returns the same version from BlueprintService and creates none. `record-generated-output` is the tool of the step `record-outputs` of `generate-product`, bound to the skill `microservice-generator-record-outputs` (decision D133). It is a shared write that the default policy lets run without an approval: the executor calls `Recipes.RecordOutput` of GenerationRecipeService with its own workload identity and the scope `factory.recipes.write`, with the change set of `change-set-v1` that the step produced, so that the recipe reaches Generated and `GenerationCompleted` is published in this increment. The catalogue declares it naturally idempotent on run, recipe and change set hash and without a retry of the executor, so a repeated call records nothing new, and its receipt carries the audit fields `recipeId`, `recipeVersion`, `runId`, `moduleName` and `changeSetHash`. The tools the executor owns itself run in the leased sandbox: `write-file` creates, deletes or moves files inside the workspace, `apply-patch` applies a unified diff to it, `build-and-test` builds and tests the workspace and returns its report as an artifact, and each refuses a path that leaves the workspace. `propose-change-set` is the first write of a run to a shared system. Under the default policy it is gated: after its approval is bound (AIFACTORY-US-604) it pushes the workspace diff as a branch and opens the change proposal through the connection of the project, resolved through IntegrationService with a credential from the Secret Broker, and returns the reference of the proposal as the effect of the receipt. A shell tool runs a command in the sandbox under two lists. A command that matches `Tools:Shell:AllowList` runs as sandbox class. A command that matches `Tools:Shell:BlockList` is passed to the policy decision with the match and is then denied with the reason block-list or escalated to the effective class production, which the policy gates; it never runs as sandbox class. A command on neither list does not run as sandbox class either, because the service page states that shell tools run only allow-listed commands as sandbox class: it is passed to the policy decision as not allow-listed and is denied or escalated like a block-listed one, and only which of the two the default policy chooses is reported to the owner. The command line, the exit code and the duration are recorded as the audit requirements of the descriptor ask, and the output is sanitized like every result. The seed of this increment holds the sixteen tools of the chain and neither `apply-patch` nor `shell-sandbox`, so these two are not callable on a deployed instance: their executors are built here and proven on fixture descriptors of the acceptance suite, and they become callable when their descriptors are published through the registry. Every executor respects the timeout of the descriptor, or `Tools:Execution:DefaultTimeoutSeconds` when it sets none, through the reminder `timeout` of the grain. The read-tool component in the sandbox, VectorMemoryService and IntegrationService degrade: when one does not answer, the call that needs it ends Failed with the failure class transient (trigger `ErrorBeforeEffect`) and `ToolInvoked` in state Failed, the probe marks its descriptors unhealthy, and the other tools keep working. The outbound dependencies of the model do not list BlueprintService and GenerationRecipeService although both name the executor as their caller; the delivery treats them as it treats the other owning services, and the missing rows are reported. The service summary names the execution of native, MCP and shell tools; the kind enum also lists Http, Browser and Agent, for which this feature builds no executor and no tool is seeded, so a call to a descriptor of such a kind is denied at the schema stage with the reason that its kind has no executor, and which feature delivers them is reported to the owner. Kind: behavior. Traces: services: ToolAdapterService, RepositoryIntelligenceService, VectorMemoryService, BlueprintService, GenerationRecipeService, IntegrationService; aggregates: ToolAdapterService/ToolInvocation; apis: ToolAdapterService/ToolExecutor.Invoke, BlueprintService/Blueprints.Validate, BlueprintService/Blueprints.SubmitDraftVersion, GenerationRecipeService/Recipes.GetApprovedRecipe, GenerationRecipeService/Recipes.RecordOutput; events: ToolAdapterService/ToolInvoked; tools: record-generated-output, list-files, search-text, search-symbols, find-references, read-range, get-dependencies, get-git-diff, knowledge-search, graph-query, blueprint-validate, blueprint-submit-version, get-approved-recipe, write-file, apply-patch, build-and-test, shell-sandbox, propose-change-set; adrs: ADR-0022, ADR-0026; requirements: FR-05, FR-06, XL-03, XL-10. Depends on: AIFACTORY-US-602, AIFACTORY-US-604, AIFACTORY-US-605, feature:execution-capacity-service-thin, feature:repository-intelligence-service-thin, feature:vector-memory-service-thin, feature:blueprint-service, feature:generation-recipe-service, feature:integration-service-thin. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/knowledge/RepositoryIntelligenceService.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml, model/tools/shell-sandbox.yaml, model/tools/propose-change-set.yaml, model/tools/blueprint-submit-version.yaml, model/tools/record-generated-output.yaml, model/services/tools-mcp/ToolExecutorHost.yaml, docs/planes/capability-tools/tool-registry.md#the-executor-gw-05.",
      "acceptanceCriteria": [
        "AC1: Given a run and the seeded read tools, when each of the seven repository read tools is called through `ToolAdapterService/ToolExecutor.Invoke` with arguments in the golden shape of its method, then it executes inside the leased sandbox of the run, where the workspace is mounted read-only and the read-tool component that ToolExecutorHost runs answers the method of the tool with the `workspaceRef` of the lease, the result is sanitized and receipted, a path outside the workspace of the run is refused, and arguments that do not match the shape end Failed with the failure class validation; given the component does not answer, then the read tool ends Failed with the failure class transient and `ToolAdapterService/ToolInvoked` in state Failed while `build-and-test` still executes (FR-05, XL-03, D125, model/services/knowledge/RepositoryIntelligenceService.yaml).",
        "AC2: Given a leased sandbox with the workspace of the run, when the seeded tools `write-file` and `build-and-test` and, on a fixture descriptor because the seed does not hold it, `apply-patch` are called through `ToolAdapterService/ToolExecutor.Invoke`, then the file and the patch are in the workspace, the build and the tests ran inside the sandbox on them, the report is stored as an artifact referenced by the receipt, each `ToolAdapterService/ToolInvocation` ends Observed, and a path that leaves the workspace ends Failed without a write (FR-05, ADR-0022).",
        "AC3: Given the seeded tools `blueprint-validate`, `blueprint-submit-version`, `get-approved-recipe`, `knowledge-search` and `graph-query`, when each is called through `ToolAdapterService/ToolExecutor.Invoke`, then the executor calls `BlueprintService/Blueprints.Validate`, `BlueprintService/Blueprints.SubmitDraftVersion` and `GenerationRecipeService/Recipes.GetApprovedRecipe` with the scope of the run, the receipt of `blueprint-submit-version` carries the reference of the version as its effect and the audit fields `blueprintId`, `version`, `kind` and `documentHash` of model/tools/blueprint-submit-version.yaml, a second call with the same document hash under another idempotency key returns the same version and creates none, and the two tools of the thin VectorMemoryService end Observed with an empty, well-formed result; given the seeded tool `record-generated-output` called in the step `record-outputs`, when it executes, then the executor calls `GenerationRecipeService/Recipes.RecordOutput` with its workload identity and the scope `factory.recipes.write`, the receipt carries the audit fields of model/tools/record-generated-output.yaml, and a repeat with the same run, recipe and change set hash records nothing new (FR-05, ADR-0026, D133).",
        "AC4: Given the shell tool on its fixture descriptor, because the seed does not hold `shell-sandbox`, and the default lists of the model, when the commands `dotnet build`, `rm -rf` with a policy that denies the block list, `terraform destroy` with a policy that escalates and a command on neither list are called, then the first runs in the sandbox as sandbox class with command line, exit code and duration recorded, the second is denied with the reason block-list and runs nothing, the third takes the effective class production and waits for an approval as AIFACTORY-US-604 states, and the fourth does not run as sandbox class and is denied or escalated by the decision (model/services/tools-mcp/ToolAdapterService.yaml, docs/planes/capability-tools/tool-policies.md).",
        "AC5: Given `propose-change-set` under a decision of `allow-with-approval` with a bound approval, when it executes, then the diff of the workspace is pushed as a branch and the change proposal is opened through the connection of the project with a brokered credential, the receipt carries the reference of the proposal as its effect and `ToolAdapterService/ToolInvoked` carries the approval id, and without a bound approval nothing is pushed; given a tool that runs past the timeout of its descriptor, then the timeout reminder stops it and it is settled as AIFACTORY-US-608 states; given a descriptor of kind Http, Browser or Agent, then the call is denied because its kind has no executor (XL-10, FR-06, model/services/tools-mcp/ToolAdapterService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/tools/shell-sandbox.yaml",
        "model/tools/propose-change-set.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/record-generated-output.yaml",
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/planes/capability-tools/tool-registry.md#the-executor-gw-05"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2428",
        "AIFACTORY-TASK-2429",
        "AIFACTORY-TASK-220",
        "AIFACTORY-TASK-2430"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6810,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "RepositoryIntelligenceService",
          "VectorMemoryService",
          "BlueprintService",
          "GenerationRecipeService",
          "IntegrationService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Invoke",
          "BlueprintService/Blueprints.Validate",
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "GenerationRecipeService/Recipes.GetApprovedRecipe",
          "GenerationRecipeService/Recipes.RecordOutput"
        ],
        "events": [
          "ToolAdapterService/ToolInvoked"
        ],
        "tools": [
          "record-generated-output",
          "list-files",
          "search-text",
          "search-symbols",
          "find-references",
          "read-range",
          "get-dependencies",
          "get-git-diff",
          "knowledge-search",
          "graph-query",
          "blueprint-validate",
          "blueprint-submit-version",
          "get-approved-recipe",
          "write-file",
          "apply-patch",
          "build-and-test",
          "shell-sandbox",
          "propose-change-set"
        ],
        "adrs": [
          "ADR-0022",
          "ADR-0026"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "XL-03",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-602",
        "AIFACTORY-US-604",
        "AIFACTORY-US-605",
        "feature:execution-capacity-service-thin",
        "feature:repository-intelligence-service-thin",
        "feature:vector-memory-service-thin",
        "feature:blueprint-service",
        "feature:generation-recipe-service",
        "feature:integration-service-thin"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/tools/shell-sandbox.yaml",
        "model/tools/propose-change-set.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/record-generated-output.yaml",
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/planes/capability-tools/tool-registry.md#the-executor-gw-05"
      ],
      "titlePrefix": "[AIFACTORY-US-606]",
      "number": 606
    },
    {
      "id": "AIFACTORY-TASK-2428",
      "type": "task",
      "parent": "AIFACTORY-US-606",
      "title": "Executors of the native tools owned by other services and of the workspace tools of the executor",
      "sequence": "05.02.10.01",
      "description": "Executors of the native tools owned by other services and of the workspace tools of the executor. Expected output: One executor per owning service forwards the invocation to the gRPC method of its tool with the scope of the run: for the seven read tools, the read-tool component of the RepositoryIntelligenceService repository that ToolExecutorHost runs inside the leased sandbox of the run, where the workspace is mounted read-only, with the workspaceRef of the lease and the arguments in the golden shape of each method, a mismatch ending Failed with the class validation (D125); Recipes.RecordOutput of GenerationRecipeService for record-generated-output, called with the workload identity of the executor and the scope factory.recipes.write, without a retry and naturally idempotent on run, recipe and change set hash, with the audit fields of its catalogue entry on the receipt (D133); VectorMemoryService for knowledge-search and graph-query; Blueprints.Validate and Blueprints.SubmitDraftVersion of BlueprintService for blueprint-validate and blueprint-submit-version; Recipes.GetApprovedRecipe of GenerationRecipeService for get-approved-recipe. The receipt of blueprint-submit-version carries the reference of the version as its effect and the audit fields blueprintId, version, kind and documentHash, and the executor does not repeat that call, whose idempotency on the document hash lies with BlueprintService. write-file, apply-patch and build-and-test run in the leased sandbox on the workspace and refuse a path that leaves it; propose-change-set pushes the workspace diff and opens the change proposal through the connection of the project with a brokered credential and returns its reference as the effect; every executor honours the timeout reminder and ends Failed with the class transient when its owning service or the read-tool component does not answer.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "One executor per owning service forwards the invocation to the gRPC method of its tool with the scope of the run: for the seven read tools, the read-tool component of the RepositoryIntelligenceService repository that ToolExecutorHost runs inside the leased sandbox of the run, where the workspace is mounted read-only, with the workspaceRef of the lease and the arguments in the golden shape of each method, a mismatch ending Failed with the class validation (D125); Recipes.RecordOutput of GenerationRecipeService for record-generated-output, called with the workload identity of the executor and the scope factory.recipes.write, without a retry and naturally idempotent on run, recipe and change set hash, with the audit fields of its catalogue entry on the receipt (D133); VectorMemoryService for knowledge-search and graph-query; Blueprints.Validate and Blueprints.SubmitDraftVersion of BlueprintService for blueprint-validate and blueprint-submit-version; Recipes.GetApprovedRecipe of GenerationRecipeService for get-approved-recipe. The receipt of blueprint-submit-version carries the reference of the version as its effect and the audit fields blueprintId, version, kind and documentHash, and the executor does not repeat that call, whose idempotency on the document hash lies with BlueprintService. write-file, apply-patch and build-and-test run in the leased sandbox on the workspace and refuse a path that leaves it; propose-change-set pushes the workspace diff and opens the change proposal through the connection of the project with a brokered credential and returns its reference as the effect; every executor honours the timeout reminder and ends Failed with the class transient when its owning service or the read-tool component does not answer."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6810,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2428]",
      "number": 2428
    },
    {
      "id": "AIFACTORY-TASK-2429",
      "type": "task",
      "parent": "AIFACTORY-US-606",
      "title": "Shell executor in the sandbox with the allow list, the block list and the recorded command line",
      "sequence": "05.02.10.02",
      "description": "Shell executor in the sandbox with the allow list, the block list and the recorded command line. Expected output: The shell executor matches a command against Tools:Shell:AllowList and Tools:Shell:BlockList, both reloadable: an allow-listed command runs in the leased sandbox as sandbox class; a block-listed command is passed to the policy decision with its match and is denied with the reason block-list or raised to the effective class production; a command on neither list never runs as sandbox class and is passed to the policy decision as not allow-listed, which denies or escalates it; command line, exit code and duration are recorded as the audit requirements of the descriptor ask and the output is sanitized.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The shell executor matches a command against Tools:Shell:AllowList and Tools:Shell:BlockList, both reloadable: an allow-listed command runs in the leased sandbox as sandbox class; a block-listed command is passed to the policy decision with its match and is denied with the reason block-list or raised to the effective class production; a command on neither list never runs as sandbox class and is passed to the policy decision as not allow-listed, which denies or escalates it; command line, exit code and duration are recorded as the audit requirements of the descriptor ask and the output is sanitized."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6810,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2429]",
      "number": 2429
    },
    {
      "id": "AIFACTORY-TASK-220",
      "type": "task",
      "parent": "AIFACTORY-US-606",
      "title": "Contract of the seven repository read tool methods as the executor calls them on the read-tool component in the sandbox of the run",
      "sequence": "05.02.10.03",
      "description": "Contract of the seven repository read tool methods as the executor calls them on the read-tool component in the sandbox of the run. Expected output: The read implementation over the mounted workspace of the run and its packaging as a tool component are owned by the thin delivery of feature repository-intelligence-service-thin and are not planned again here. This task fixes only what this feature adds: the contract of the seven tool methods of RepositoryIntelligenceService (ListFiles, SearchText, SearchSymbols, FindReferences, ReadRange, GetDependencies and GetHistory for get-git-diff) as the executor calls them on the component that ToolExecutorHost runs in the sandbox of the run, with the invocation, the scope of the run and the workspaceRef of the lease, the seven golden argument shapes (a path prefix, a name pattern and a depth; the text and an optional path prefix; a name, a kind and a container; a symbol; a path and a line range; a path or a symbol; optional paths), each with the continuation token of a paged answer and a mismatch refused with INVALID_ARGUMENT, the refusal of a path outside that workspace, and replies in ranges and never a whole repository; a contract test in the repository of that service holds the seven shapes against the calls of the executor, the same set of shapes that the contract of that thin delivery holds (D125, model/services/knowledge/RepositoryIntelligenceService.yaml, model/backlog/features/knowledge.yaml).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The read implementation over the mounted workspace of the run and its packaging as a tool component are owned by the thin delivery of feature repository-intelligence-service-thin and are not planned again here. This task fixes only what this feature adds: the contract of the seven tool methods of RepositoryIntelligenceService (ListFiles, SearchText, SearchSymbols, FindReferences, ReadRange, GetDependencies and GetHistory for get-git-diff) as the executor calls them on the component that ToolExecutorHost runs in the sandbox of the run, with the invocation, the scope of the run and the workspaceRef of the lease, the seven golden argument shapes (a path prefix, a name pattern and a depth; the text and an optional path prefix; a name, a kind and a container; a symbol; a path and a line range; a path or a symbol; optional paths), each with the continuation token of a paged answer and a mismatch refused with INVALID_ARGUMENT, the refusal of a path outside that workspace, and replies in ranges and never a whole repository; a contract test in the repository of that service holds the seven shapes against the calls of the executor, the same set of shapes that the contract of that thin delivery holds (D125, model/services/knowledge/RepositoryIntelligenceService.yaml, model/backlog/features/knowledge.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6810,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-220]",
      "number": 220
    },
    {
      "id": "AIFACTORY-TASK-2430",
      "type": "task",
      "parent": "AIFACTORY-US-606",
      "title": "Verify the native and shell executors through the acceptance suite",
      "sequence": "05.02.10.04",
      "description": "Verify the native and shell executors through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=NativeAndShellTools\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-606 through ToolAdapterService/ToolExecutor.Invoke with fakes of the owning services and a sandbox fixture with a workspace: the seven read tools on the read-tool component in the sandbox fixture with the workspace mounted read-only, their golden argument shapes and a mismatched shape, a stopped component, record-generated-output calling a fake GenerationRecipeService/Recipes.RecordOutput with the workload identity of the executor and its repeat that records nothing new, write-file and build-and-test on their seeded descriptors and apply-patch on a fixture descriptor, the calls of BlueprintService/Blueprints.Validate, BlueprintService/Blueprints.SubmitDraftVersion and GenerationRecipeService/Recipes.GetApprovedRecipe with the scope of the run, the receipt of blueprint-submit-version with its version reference and audit fields, the repeat with the same document hash that returns the same version, the empty results of knowledge-search and graph-query, the shell tool on a fixture descriptor with the three listed commands under both policy outcomes and a command on neither list, propose-change-set with and without a bound approval against a fake connection, and a descriptor of a kind without an executor; the suite asserts that apply-patch and shell-sandbox are absent from the seed of sixteen descriptors.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=NativeAndShellTools\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-606 through ToolAdapterService/ToolExecutor.Invoke with fakes of the owning services and a sandbox fixture with a workspace: the seven read tools on the read-tool component in the sandbox fixture with the workspace mounted read-only, their golden argument shapes and a mismatched shape, a stopped component, record-generated-output calling a fake GenerationRecipeService/Recipes.RecordOutput with the workload identity of the executor and its repeat that records nothing new, write-file and build-and-test on their seeded descriptors and apply-patch on a fixture descriptor, the calls of BlueprintService/Blueprints.Validate, BlueprintService/Blueprints.SubmitDraftVersion and GenerationRecipeService/Recipes.GetApprovedRecipe with the scope of the run, the receipt of blueprint-submit-version with its version reference and audit fields, the repeat with the same document hash that returns the same version, the empty results of knowledge-search and graph-query, the shell tool on a fixture descriptor with the three listed commands under both policy outcomes and a command on neither list, propose-change-set with and without a bound approval against a fake connection, and a descriptor of a kind without an executor; the suite asserts that apply-patch and shell-sandbox are absent from the seed of sixteen descriptors."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6810,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2430]",
      "number": 2430
    },
    {
      "id": "AIFACTORY-US-607",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Execute a tool of kind Mcp through the MCP library client and host the MCP endpoint of the Factory with authorization on",
      "sequence": "05.02.11",
      "description": "As an asset maintainer, I want a tool served by an MCP server, and a client that reaches the Factory over MCP, to pass the same executor with the same identity rules, so that no MCP path exists that is anonymous, ungoverned or outside the receipts. MCP is the tool protocol of the Factory (ADR-0022), and both directions use the pinned MCP library (feature `component-mcp`); the service writes no protocol code of its own. Outbound, a descriptor of kind Mcp names its `mcpServerId`. When such an invocation reaches Executing, the executor asks `McpServerRegistryService/McpRegistry.ResolveTool` for the server, the transport, the binding and the authentication of the tool. For a consumed server on the streamable HTTP transport it resolves the connection of the server through IntegrationService, and the client call of the library carries a token obtained through the credential port of the library from the Secret Broker, never a raw secret (ADR-0022 decision 6). A server on the stdio transport runs as the sandboxed command of its registration inside a leased sandbox, and the library client speaks to it through the bridge in that sandbox. The governance policy the registration names is applied to the call through the governance integration of the library, which fails closed. The result of an MCP tool is untrusted content like any tool result and is sanitized before it reaches a model. A NOT_FOUND from the registry denies the call as unbound (AIFACTORY-US-603); a registry that does not answer and a descriptor that a degraded server made unhealthy fail the call fast with the failure class transient (AIFACTORY-US-600, AIFACTORY-US-602). Inbound, the service hosts the MCP endpoint of the Factory with the hosting of the library, and ToolExecutorHost routes the transport to it. Authorization is on by default for any exposure beyond the local process: a client without a token is refused with the protected-resource challenge of the library, and anonymous exposure would need a declared exception, which this service does not declare. The scope of the authenticated caller reaches every tool handler. A tool call through the endpoint requires `factory.tools.invoke`. In I1 the endpoint serves only calls bound to a run, a step and an attempt; IDE clients and partner agents arrive with the complete McpServerRegistryService in I5, and the caller kinds ide-client and partner-agent, a call without a run and the approval of such a call are no part of this delivery (D121). Tenant and project come from the token, which the library refuses before the handler when it carries no tenant or no project, and the run, the step and the attempt come from the token through the scope accessor of the library. A call whose token carries no run, step and attempt identity is refused by the endpoint before reception with a typed tool error whose reason says that the call is bound to no run: no `ToolInvocation` is recorded, no `ToolInvocationDenied` is written and nothing executes. A bound call enters the same pipeline as `ToolAdapterService/ToolExecutor.Invoke` with the caller kind agent, so it is validated, decided, classified, brokered, executed, sanitized and receipted like every call of an attempt: the endpoint builds the `tool-invocation-v1` of the call from the MCP call and the scope the library hands it, the run, the step and the attempt are stored on the invocation, the fencing check of AIFACTORY-US-602 applies when the call carries the fencing token of its lease, the receipt is listed under the run, and a call the policy gates waits for the approval of its run and executes only with that approval bound (AIFACTORY-US-604). The idempotency key, which `ToolInvocations` requires and holds unique per tenant and project, is the key the caller supplies in the request metadata of the tool call when it supplies one; otherwise the endpoint derives it from the session id of the MCP connection and the request id of the call, so the same request sent again in the same session returns the existing receipt and a new request is a new invocation. A declared scope argument of a tool call, `tenantId`, `projectId` or a parameter the tool declares as scope, that contradicts the token is refused by the library before the handler with a typed tool error whose reason is `scope-mismatch`. The list of tools the endpoint offers is the answer of `McpServerRegistryService/McpRegistry.ListCapabilities` for the scope of the caller. The signing key of the endpoint is read from the secret reference `mcp-signing-key`. An agent is never exposed as a raw tool: ADR-0022 decision 7 allows it only through the lifecycle pipeline, and no tool of kind Agent exists here. In this increment the registry is static and holds no server: on a deployed instance no call leaves the service over MCP and the endpoint lists no tool. The delivery is therefore proven against a fixture MCP server with authorization on and against a fake registry that returns a binding, and the first registered server arrives with feature `mcp-server-registry-service-complete`. Kind: behavior. Traces: services: ToolAdapterService, McpServerRegistryService, IntegrationService; aggregates: ToolAdapterService/ToolInvocation; apis: ToolAdapterService/ToolExecutor.Invoke, McpServerRegistryService/McpRegistry.ResolveTool, McpServerRegistryService/McpRegistry.ListCapabilities; events: ToolAdapterService/ToolInvocationDenied; adrs: ADR-0015, ADR-0022; requirements: FR-05, NFR-02. Depends on: AIFACTORY-US-602, AIFACTORY-US-603, AIFACTORY-US-605, feature:component-mcp, feature:mcp-server-registry-service-thin, feature:integration-service-thin, feature:secret-broker-service. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/tools-mcp/McpServerRegistryService.yaml, model/backlog/pbis/component-extensions/component-mcp.yaml, model/services/control-plane/RunControlService.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/planes/capability-tools/mcp.md#security-notes.",
      "acceptanceCriteria": [
        "AC1: Given an active descriptor of kind Mcp and a fake registry whose `McpServerRegistryService/McpRegistry.ResolveTool` returns a binding to a fixture server on streamable HTTP that requires authorization, when the tool is called through `ToolAdapterService/ToolExecutor.Invoke`, then the client of the pinned MCP library calls the server with a token obtained through its credential port, no raw secret is held by the service, the result is sanitized and the `ToolAdapterService/ToolInvocation` ends Observed with a receipt (ADR-0022, model/backlog/pbis/component-extensions/component-mcp.yaml).",
        "AC2: Given a registry that answers NOT_FOUND, a registry that does not answer, and a fixture server that returns a result containing an instruction and a secret pattern, when the MCP tool is called for each, then the first is denied as unbound, the second fails fast with UNAVAILABLE and the failure class transient, and the third ends Observed with the secret redacted and the instruction kept as data; in the first two no call reaches a server (ADR-0022, docs/planes/capability-tools/tool-policies.md).",
        "AC3: Given the hosted MCP endpoint, when a client connects without a token, and when a caller whose token carries `factory.tools.invoke` and the run, step and attempt identity calls a tool, then the first is refused with the protected-resource challenge and no handler runs, and the second enters the pipeline of `ToolAdapterService/ToolExecutor.Invoke` with the caller kind agent, the scope of the token in the handler, the run, the step and the attempt on its `ToolAdapterService/ToolInvocation` and a receipt at its end that is listed under the run (ADR-0022, ADR-0015).",
        "AC4: Given a tool call through the endpoint whose `tenantId` or `projectId` argument contradicts the token, when it arrives, then it is refused before the handler with a typed tool error whose reason is `scope-mismatch` and no tool runs; given the deployed thin registry, when a client lists the tools of the endpoint, then the list is the empty answer of `McpServerRegistryService/McpRegistry.ListCapabilities` (ADR-0015, model/backlog/pbis/component-extensions/component-mcp.yaml).",
        "AC5: Given a caller of the hosted endpoint whose token carries `factory.tools.invoke` and no run, step and attempt identity, when it calls a tool, then the call is refused before reception with a typed tool error whose reason says that the call is bound to no run, no `ToolAdapterService/ToolInvocation` is recorded, no `ToolAdapterService/ToolInvocationDenied` is written and nothing executes, because in I1 the endpoint serves only calls bound to a run, a step and an attempt; given a bound call, then its idempotency key is taken from the request metadata of the call or derived from the session id and the request id, the same request sent again in the same session returns the existing receipt, and a call whose policy decision is `allow-with-approval` moves to AwaitingApproval and executes only with the approval of its run bound, as every gated call does (ADR-0022, model/services/tools-mcp/ToolAdapterService.yaml, model/services/control-plane/RunControlService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/backlog/pbis/component-extensions/component-mcp.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md#security-notes"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2431",
        "AIFACTORY-TASK-2432",
        "AIFACTORY-TASK-2433",
        "AIFACTORY-TASK-2434"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6811,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "McpServerRegistryService",
          "IntegrationService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Invoke",
          "McpServerRegistryService/McpRegistry.ResolveTool",
          "McpServerRegistryService/McpRegistry.ListCapabilities"
        ],
        "events": [
          "ToolAdapterService/ToolInvocationDenied"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-602",
        "AIFACTORY-US-603",
        "AIFACTORY-US-605",
        "feature:component-mcp",
        "feature:mcp-server-registry-service-thin",
        "feature:integration-service-thin",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/backlog/pbis/component-extensions/component-mcp.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md#security-notes"
      ],
      "titlePrefix": "[AIFACTORY-US-607]",
      "number": 607
    },
    {
      "id": "AIFACTORY-TASK-2431",
      "type": "task",
      "parent": "AIFACTORY-US-607",
      "title": "MCP executor on the client of the pinned MCP library with the credential port and the sandboxed stdio bridge",
      "sequence": "05.02.11.01",
      "description": "MCP executor on the client of the pinned MCP library with the credential port and the sandboxed stdio bridge. Expected output: The executor of kind Mcp resolves the tool through McpRegistry.ResolveTool, calls a streamable HTTP server through the client of the pinned ConnectSoft.Extensions.ModelContextProtocol package with a token obtained through its credential port from the Secret Broker and the connection of the server, runs a stdio server as its sandboxed command inside a leased sandbox, applies the governance policy of the registration through the governance integration of the library with fail-closed handling, sanitizes the result, denies the call as unbound on NOT_FOUND and fails fast with the class transient when the registry does not answer; the library is consumed by its pinned version and no protocol code is copied.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The executor of kind Mcp resolves the tool through McpRegistry.ResolveTool, calls a streamable HTTP server through the client of the pinned ConnectSoft.Extensions.ModelContextProtocol package with a token obtained through its credential port from the Secret Broker and the connection of the server, runs a stdio server as its sandboxed command inside a leased sandbox, applies the governance policy of the registration through the governance integration of the library with fail-closed handling, sanitizes the result, denies the call as unbound on NOT_FOUND and fails fast with the class transient when the registry does not answer; the library is consumed by its pinned version and no protocol code is copied."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6811,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2431]",
      "number": 2431
    },
    {
      "id": "AIFACTORY-TASK-2432",
      "type": "task",
      "parent": "AIFACTORY-US-607",
      "title": "Hosted MCP endpoint with authorization on by default and tool calls that enter the pipeline",
      "sequence": "05.02.11.02",
      "description": "Hosted MCP endpoint with authorization on by default and tool calls that enter the pipeline. Expected output: The service hosts its MCP endpoint with the hosting of the pinned library: authorization is on and no anonymous exception is declared, the scope of the caller reaches every handler, a tool call requires factory.tools.invoke and, in I1, a token that carries the run, step and attempt identity (D121); a call bound to no run is refused before reception with a typed tool error and leaves no invocation and no event; a bound call enters the pipeline of ToolExecutor.Invoke with the caller kind agent, the tenant and the project of the token, the run, the step and the attempt from the scope accessor of the library, and an idempotency key taken from the request metadata of the call or derived from the session id of the connection and the request id, and a gated call waits for the approval of its run like every gated call; the caller kinds ide-client and partner-agent are not served before I5; a scope argument that contradicts the token is refused by the library with the typed tool error scope-mismatch, the tool list is the answer of McpRegistry.ListCapabilities for the scope of the caller, and the signing key is read from the secret reference mcp-signing-key.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The service hosts its MCP endpoint with the hosting of the pinned library: authorization is on and no anonymous exception is declared, the scope of the caller reaches every handler, a tool call requires factory.tools.invoke and, in I1, a token that carries the run, step and attempt identity (D121); a call bound to no run is refused before reception with a typed tool error and leaves no invocation and no event; a bound call enters the pipeline of ToolExecutor.Invoke with the caller kind agent, the tenant and the project of the token, the run, the step and the attempt from the scope accessor of the library, and an idempotency key taken from the request metadata of the call or derived from the session id of the connection and the request id, and a gated call waits for the approval of its run like every gated call; the caller kinds ide-client and partner-agent are not served before I5; a scope argument that contradicts the token is refused by the library with the typed tool error scope-mismatch, the tool list is the answer of McpRegistry.ListCapabilities for the scope of the caller, and the signing key is read from the secret reference mcp-signing-key."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6811,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2432]",
      "number": 2432
    },
    {
      "id": "AIFACTORY-TASK-2433",
      "type": "task",
      "parent": "AIFACTORY-US-607",
      "title": "Fixture MCP server and fake registry of the acceptance suite",
      "sequence": "05.02.11.03",
      "description": "Fixture MCP server and fake registry of the acceptance suite. Expected output: The acceptance suite holds a fixture MCP server on streamable HTTP that requires authorization, lists two tools and can return a result with an instruction and a secret pattern, a fixture stdio server command, and a fake of McpServerRegistryService that answers McpRegistry.ResolveTool with a binding, with NOT_FOUND or not at all and McpRegistry.ListCapabilities with an empty or a filled list (model/services/tools-mcp/McpServerRegistryService.yaml).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fixture MCP server on streamable HTTP that requires authorization, lists two tools and can return a result with an instruction and a secret pattern, a fixture stdio server command, and a fake of McpServerRegistryService that answers McpRegistry.ResolveTool with a binding, with NOT_FOUND or not at all and McpRegistry.ListCapabilities with an empty or a filled list (model/services/tools-mcp/McpServerRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6811,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2433]",
      "number": 2433
    },
    {
      "id": "AIFACTORY-TASK-2434",
      "type": "task",
      "parent": "AIFACTORY-US-607",
      "title": "Verify the MCP executor and the hosted endpoint through the acceptance suite",
      "sequence": "05.02.11.04",
      "description": "Verify the MCP executor and the hosted endpoint through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=McpToolsAndEndpoint\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-607: the authenticated client call through McpServerRegistryService/McpRegistry.ResolveTool and the credential port, the unbound and the unavailable registry, the sanitized hostile result, the refused anonymous client, the tool call of a token with a run, step and attempt identity that enters the pipeline of ToolAdapterService/ToolExecutor.Invoke with the caller kind agent and is listed under its run, the scope-mismatch refusal, the empty tool list of the thin registry, the supplied or derived idempotency key of a bound call, the same request repeated in one session that returns the existing receipt, a bound call of a gated decision that moves to AwaitingApproval, and the call of a token without a run identity, which is refused before reception, records no invocation, writes no ToolAdapterService/ToolInvocationDenied and executes nothing.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=McpToolsAndEndpoint\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-607: the authenticated client call through McpServerRegistryService/McpRegistry.ResolveTool and the credential port, the unbound and the unavailable registry, the sanitized hostile result, the refused anonymous client, the tool call of a token with a run, step and attempt identity that enters the pipeline of ToolAdapterService/ToolExecutor.Invoke with the caller kind agent and is listed under its run, the scope-mismatch refusal, the empty tool list of the thin registry, the supplied or derived idempotency key of a bound call, the same request repeated in one session that returns the existing receipt, a bound call of a gated decision that moves to AwaitingApproval, and the call of a token without a run identity, which is refused before reception, records no invocation, writes no ToolAdapterService/ToolInvocationDenied and executes nothing."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6811,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2434]",
      "number": 2434
    },
    {
      "id": "AIFACTORY-US-608",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Interrupt an executing call and settle it as observed, cancelled or uncertain, and never repeat an effect that could not be confirmed",
      "sequence": "05.02.12",
      "description": "As an operator, I want a call that was stopped, timed out or lost its host to be reported as what is known about its effect, so that nobody repeats a write that may already have happened. A call that is executing can end without a result in four ways: the runtime interrupts it, its timeout fires, its sandbox is lost, or the replica that runs it crashes. In each the service settles the invocation as what it can prove and never as what it assumes. AgentRuntimeService calls the internal gRPC method `ToolAdapterService/ToolExecutor.Interrupt` when a run is cancelled or the call timeout of an attempt fires, with the invocation id under a workload token that holds the service scope that names ToolAdapterService. The grain stops the executor. When the tool had not started an effect, the invocation moves from Executing to Cancelled (trigger `InterruptedBeforeEffect`) with a receipt of status Cancelled and `ToolInvoked` in state Cancelled. When the result had already been observed, the invocation is Observed and stays so. When an effect may have happened and cannot be confirmed, the invocation moves to Uncertain (trigger `EffectUnconfirmed`). The reply is `ack-v1` with the settled state, a repeated interrupt returns the same answer and changes nothing, and an invocation that is already terminal is answered with its state. A caller without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED, a request without an invocation id with INVALID_ARGUMENT, and an invocation that is unknown or of another tenant with NOT_FOUND, the same answer for both, for which the calling attempt takes the failure class permanent (ADR-0015 amendment D113). What decides between Cancelled, Failed and Uncertain is whether an effect was possible and whether it can be confirmed, and the rule follows the failure modes of the model, which make no exception for a class other than read. A tool of effective class read has no effect at any time: a stopped call of that class is Cancelled when it was interrupted and Failed with the failure class transient otherwise, which is the case the model describes as Failed when no effect was possible. For every other class, sandbox included, the executor of the tool tells its grain when it hands the call to the sandbox or to the owning service, the moment from which an effect may have begun. Before that moment an interrupt settles the invocation Cancelled and a timeout settles it Failed. After it, an invocation whose result was not observed is Uncertain, whatever stopped it. A lost sandbox and a crashed replica take away the only component that knew whether the effect had begun, so an invocation of a class other than read that they end is always Uncertain, as the two failure modes of the model state. The receipts follow the mapping of AIFACTORY-US-602: Cancelled is written with the status Cancelled, which `tool-receipt-v1` has for an invocation that was interrupted before any effect (D121), a timeout without a possible effect with the status TimedOut, every other Failed with the status Failed and Uncertain with the status Uncertain. Another reading would let a sandbox-class call never end Uncertain, because its effect stays inside the workspace of the run and ADR-0014 amendment D114 allows the retry of a sandbox step. That reading is not taken, since it retries on a workspace that may be half written, and it is reported to the owner with two questions the model leaves open: what happens to a partly written workspace before a retry, and what RunControlService does with an Uncertain outcome on a step of class sandbox, for which ADR-0014 amendment D119 names no Operator decision. The same rule serves the other three ways. The reminder `timeout` of the grain fires at the timeout of the descriptor, or at `Tools:Execution:DefaultTimeoutSeconds` when it sets none, and stops the executor. A lost lease heartbeat means the sandbox is gone in the middle of the execution. The worker `UncertainEffectReconciler` runs every minute, partitioned by tenant with at most four in parallel, over the Executing invocations whose grain is inactive or whose timeout passed, which is how a crashed replica is found; it settles each one, idempotently on invocation id and state, with three retries at a fixed backoff of thirty seconds, and its sandbox is released by the reaper. An Uncertain invocation writes a `tool-receipt-v1` with the status Uncertain and `ToolEffectUncertain` in the same transaction, and `connectsoft.factory.tools.uncertain` goes up. The service never repeats an Uncertain call and never repeats a write on its own. The attempt that made the call ends with the outcome Uncertain, reports it and waits for nothing; its outcome marks this invocation as the one whose effect is uncertain, in the optional member `uncertainToolInvocationId` of `attempt-outcome-v1`, and the approval request of the operator decision keeps that id (D123). RunControlService opens the operator decision for an Uncertain outcome on a step of class shared-write or above (ADR-0014 amendment D119), the Operator decides there with a finding, applied or not-applied, and RunControlService records that finding through `ConfirmToolEffect` for the invocation the request keeps, which moves the invocation out of Uncertain to Observed or Failed (AIFACTORY-US-609, D121). No operator acts in the tool service directly. The idempotency key of an Uncertain invocation stays taken, so the same call can never execute a second time under it. The model has no transition out of a state before Executing other than Denied, so an interrupt of an invocation that waits for its approval or its sandbox is answered with its state and changes nothing, which is reported to the owner. Kind: behavior. Traces: services: ToolAdapterService; aggregates: ToolAdapterService/ToolInvocation; apis: ToolAdapterService/ToolExecutor.Interrupt; events: ToolAdapterService/ToolEffectUncertain, ToolAdapterService/ToolInvoked; descriptors: ack-v1, tool-receipt-v1; adrs: ADR-0014, ADR-0015; requirements: FR-10, FUX-07, XL-06, NFR-05; scenarios: SCN-ToolAdapterService-009, SCN-ToolAdapterService-014. Depends on: AIFACTORY-US-602, AIFACTORY-US-605, feature:contracts-package. Sources: model/services/tools-mcp/ToolAdapterService.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#failure-and-recovery, docs/planes/capability-tools/tool-registry.md#the-executor-gw-05.",
      "acceptanceCriteria": [
        "AC1: Given an Executing invocation of a read-class tool, and one of a sandbox-class tool whose executor has not yet handed the call to the sandbox, when `ToolAdapterService/ToolExecutor.Interrupt` is called under a workload token that holds the service scope, then the executor is stopped, each `ToolAdapterService/ToolInvocation` moves to Cancelled with a receipt of status Cancelled and `ToolAdapterService/ToolInvoked` in state Cancelled, the reply is `ack-v1` with the settled state, and a repeated interrupt returns the same answer and writes nothing; a read-class call that its timeout reminder stops ends Failed with a receipt of status TimedOut (SCN-ToolAdapterService-009, FR-10).",
        "AC2: Given an Executing invocation of effective class sandbox and one of class shared-write, each handed on by its executor and without an observed result, when it is interrupted or when its timeout reminder fires, and given an Executing invocation of either class whose sandbox lease loses its heartbeat, then it moves to Uncertain, a receipt with the status Uncertain is stored, `ToolAdapterService/ToolEffectUncertain` is written in the same transaction, `connectsoft.factory.tools.uncertain` is incremented and the service starts no second execution, under the same key or any other (SCN-ToolAdapterService-009, XL-06, ADR-0014).",
        "AC3: Given an Uncertain settlement, when the outbox dispatcher publishes `ToolAdapterService/ToolEffectUncertain` on `tool-execution.invocations.v1.tool-effect-uncertain`, then the outbox record was written in the same transaction as the transition, the event is sent in the run event envelope with `invocationId`, `tenantId`, `runId`, `attemptId`, `toolId` and `effectiveClass`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ToolAdapterService-014, ADR-0014).",
        "AC4: Given Executing invocations whose grain is inactive after a replica crash, one of class read, one of class sandbox and one of class shared-write, when `UncertainEffectReconciler` runs, then the first is settled Failed with the failure class transient, a receipt of status Failed and `ToolAdapterService/ToolInvoked`, the other two Uncertain with a receipt of status Uncertain and `ToolAdapterService/ToolEffectUncertain`, a second run for the same invocation and state changes nothing, and the sandbox of each is released by the reaper while the workspace of the run stays (SCN-ToolAdapterService-014, model/services/tools-mcp/ToolAdapterService.yaml).",
        "AC5: Given a caller without a workload identity, a token without the service scope, a request without an invocation id, or an invocation that is unknown or of another tenant, when `ToolAdapterService/ToolExecutor.Interrupt` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, the NOT_FOUND the same for an unknown and a foreign invocation, and no state changes; an invocation that is already terminal or still waits before execution is answered with its state and is not changed (SCN-ToolAdapterService-009, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#failure-and-recovery",
        "docs/planes/capability-tools/tool-registry.md#the-executor-gw-05"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2435",
        "AIFACTORY-TASK-2436",
        "AIFACTORY-TASK-2437"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6812,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Interrupt"
        ],
        "events": [
          "ToolAdapterService/ToolEffectUncertain",
          "ToolAdapterService/ToolInvoked"
        ],
        "descriptors": [
          "ack-v1",
          "tool-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "FUX-07",
          "XL-06",
          "NFR-05"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-009",
          "SCN-ToolAdapterService-014"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-602",
        "AIFACTORY-US-605",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#failure-and-recovery",
        "docs/planes/capability-tools/tool-registry.md#the-executor-gw-05"
      ],
      "titlePrefix": "[AIFACTORY-US-608]",
      "number": 608
    },
    {
      "id": "AIFACTORY-TASK-2435",
      "type": "task",
      "parent": "AIFACTORY-US-608",
      "title": "ToolExecutor.Interrupt and the settlement rule of a stopped, timed-out or lost execution",
      "sequence": "05.02.12.01",
      "description": "ToolExecutor.Interrupt and the settlement rule of a stopped, timed-out or lost execution. Expected output: ToolExecutor.Interrupt stops the executor of an Executing invocation through its grain and answers ack-v1 with the settled state, idempotently; the executor of every tool tells the grain when it hands the call to the sandbox or to the owning service; one settlement rule, which follows the failure modes of the model, serves the interrupt, the timeout reminder and the lost lease heartbeat: Observed when the result was observed; for a call of class read, Cancelled through InterruptedBeforeEffect on an interrupt and Failed with the class transient on a timeout or a lost sandbox; for a call of any other class, sandbox included, Cancelled on an interrupt and Failed on a timeout only before the hand-over, and Uncertain through EffectUnconfirmed after it and always when the sandbox was lost; each settlement writes its receipt with the status of the mapping of AIFACTORY-US-602 (Cancelled for Cancelled, TimedOut for a timeout without a possible effect, Failed, Uncertain) and its ToolInvoked or ToolEffectUncertain outbox record in one transaction; the refusals are UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND, and an Uncertain invocation is never executed again.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "ToolExecutor.Interrupt stops the executor of an Executing invocation through its grain and answers ack-v1 with the settled state, idempotently; the executor of every tool tells the grain when it hands the call to the sandbox or to the owning service; one settlement rule, which follows the failure modes of the model, serves the interrupt, the timeout reminder and the lost lease heartbeat: Observed when the result was observed; for a call of class read, Cancelled through InterruptedBeforeEffect on an interrupt and Failed with the class transient on a timeout or a lost sandbox; for a call of any other class, sandbox included, Cancelled on an interrupt and Failed on a timeout only before the hand-over, and Uncertain through EffectUnconfirmed after it and always when the sandbox was lost; each settlement writes its receipt with the status of the mapping of AIFACTORY-US-602 (Cancelled for Cancelled, TimedOut for a timeout without a possible effect, Failed, Uncertain) and its ToolInvoked or ToolEffectUncertain outbox record in one transaction; the refusals are UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND, and an Uncertain invocation is never executed again."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6812,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2435]",
      "number": 2435
    },
    {
      "id": "AIFACTORY-TASK-2436",
      "type": "task",
      "parent": "AIFACTORY-US-608",
      "title": "UncertainEffectReconciler over Executing invocations without a live grain or past their timeout",
      "sequence": "05.02.12.02",
      "description": "UncertainEffectReconciler over Executing invocations without a live grain or past their timeout. Expected output: The worker finds the Executing invocations whose grain is inactive or whose timeout passed on its one-minute schedule, partitioned by tenant with at most four in parallel, applies the settlement rule of AIFACTORY-TASK-2435 for a lost grain, by which an invocation of class read is settled Failed with the class transient and an invocation of any other class, sandbox included, Uncertain, writes ToolEffectUncertain or ToolInvoked in the transaction of the settlement, is idempotent on invocation id and state, retries three times with a fixed backoff of thirty seconds, and moves connectsoft.factory.tools.uncertain with every Uncertain settlement.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The worker finds the Executing invocations whose grain is inactive or whose timeout passed on its one-minute schedule, partitioned by tenant with at most four in parallel, applies the settlement rule of AIFACTORY-TASK-2435 for a lost grain, by which an invocation of class read is settled Failed with the class transient and an invocation of any other class, sandbox included, Uncertain, writes ToolEffectUncertain or ToolInvoked in the transaction of the settlement, is idempotent on invocation id and state, retries three times with a fixed backoff of thirty seconds, and moves connectsoft.factory.tools.uncertain with every Uncertain settlement."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6812,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2436]",
      "number": 2436
    },
    {
      "id": "AIFACTORY-TASK-2437",
      "type": "task",
      "parent": "AIFACTORY-US-608",
      "title": "Verify interruption and uncertain effects through the acceptance suite",
      "sequence": "05.02.12.03",
      "description": "Verify interruption and uncertain effects through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-009|Scenario=SCN-ToolAdapterService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-608 with fake executors that block before and after the hand-over of the call, for the classes read, sandbox and shared-write, a fired timeout reminder, a lost lease heartbeat, a deactivated grain, the publication and payload of ToolEffectUncertain with a stopped transport, the four refusals and the assertion that no second execution starts for an Uncertain invocation; every receipt is asserted on its status and validated against docs/reference/schemas/tool-invocation.schema.json: Cancelled for a Cancelled invocation, TimedOut for a read-class call its timeout stopped, Failed for a read-class call of a lost sandbox or a crashed replica, and Uncertain for every invocation settled Uncertain; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-009|Scenario=SCN-ToolAdapterService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-608 with fake executors that block before and after the hand-over of the call, for the classes read, sandbox and shared-write, a fired timeout reminder, a lost lease heartbeat, a deactivated grain, the publication and payload of ToolEffectUncertain with a stopped transport, the four refusals and the assertion that no second execution starts for an Uncertain invocation; every receipt is asserted on its status and validated against docs/reference/schemas/tool-invocation.schema.json: Cancelled for a Cancelled invocation, TimedOut for a read-class call its timeout stopped, Failed for a read-class call of a lost sandbox or a crashed replica, and Uncertain for every invocation settled Uncertain; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6812,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2437]",
      "number": 2437
    },
    {
      "id": "AIFACTORY-US-609",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "RunControlService records the finding of the Operator on an Uncertain invocation, applied or not-applied, and the invocation is settled with a receipt",
      "sequence": "05.02.13",
      "description": "As an operator, I want the finding I give with my decision at Run Control, from the receipt and from what I find in the target system, to settle the uncertain invocation in the tool service, so that the run continues from a known fact and the write is never repeated on a guess. An Uncertain invocation waits for a finding, and the finding comes from one act of the Operator (D121). The Operator of the project decides the operator decision that RunControlService opened for the Uncertain outcome of the step, with the tool receipt in view (AIFACTORY-US-610), and states with that decision whether the effect was applied or not. RunControlService records the finding in the tool service as part of the same act by calling `ToolAdapterService/ConfirmToolEffect` for the invocation, which is the one the Uncertain outcome of the attempt marked in `uncertainToolInvocationId` and whose id the approval request of the operator decision keeps (D123). No operator acts in the tool service directly: the operation is internal, its one caller is RunControlService and the Studio offers no confirmation of its own. RunControlService calls through ToolExecutorHost under its workload token, which holds the scope `factory.tools.operate` and the service scope that names ToolAdapterService, and forwards the tenant and the project of the run, which the tool service reads only under that service scope (ADR-0015 amendment D114); the token names the Operator who decided as the user on whose behalf the workload acts. This token is decided (D123): for `ConfirmToolEffect` RunControlService presents a workload token that holds `factory.tools.operate` and names the Operator as the user it acts for, and the value `operator` of `callerKind` stays. The body states the finding, `applied` or `not-applied`, and the reason the decision carries. Whether the decider was eligible, as the Operator of the project or as the member who requested the run, is checked by RunControlService and not again here. The command applies to an invocation in state Uncertain only. It records the finding, the Operator as the actor and the reason on the invocation, writes the final `tool-receipt-v1` and settles the invocation: the finding applied moves it from Uncertain to Observed (trigger `EffectConfirmedApplied`) with the status Succeeded, and the finding not-applied moves it from Uncertain to Failed (trigger `EffectConfirmedNotApplied`) with the status Failed, by the mapping of AIFACTORY-US-602. `ToolInvoked` is written in the same transaction with the settled state, which is the result event the model names for this command, and `connectsoft.factory.tools.uncertain` goes down. The audit stage writes one evidence record of the finding through the sink of the pinned audit library, as `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` in the transaction of the command, with the Operator as actor, the invocation and its request hash as subject and the finding as outcome. A decision without a finding never reaches the tool service, because RunControlService answers it 400, and when the tool service does not answer the call, RunControlService answers the decision 503 and records nothing, so that the Operator takes the decision again and the call arrives again; the decision and the finding therefore never diverge (D123). The command is naturally idempotent, which RunControlService relies on when it repeats the call after a lost answer or after such a repeated decision: the same finding posted again returns the same result and writes nothing; a different finding for an invocation that a finding already settled, and a finding for an invocation that is not Uncertain, are refused with 409. A call without a token is answered 401; a token without `factory.tools.operate`, and every user token, because the operation admits no caller but RunControlService, 403; an invocation that is unknown or of another tenant 404, the same answer in both cases (ADR-0015 amendment D113). The command executes nothing and repeats nothing. What follows for the step is the choice the Operator made in the same decision, retry, compensate or fail: RunControlService refuses the choice retry unless the finding is not-applied, and a retry is a new call of the runtime under a new idempotency key, because the key of the settled invocation stays taken. The `action` values of `audit-evidence-v1` name none for the finding on an effect, which is reported with the question of AIFACTORY-US-602. Kind: behavior. Traces: services: ToolAdapterService, RunControlService; aggregates: ToolAdapterService/ToolInvocation, RunControlService/ApprovalRequest; apis: ToolAdapterService/ConfirmToolEffect, RunControlService/DecideApproval; events: ToolAdapterService/ToolInvoked; descriptors: tool-receipt-v1, audit-evidence-v1; adrs: ADR-0014, ADR-0015, ADR-0019; requirements: FR-10, FUX-07, XL-06, NFR-04; scenarios: SCN-ToolAdapterService-006. Depends on: AIFACTORY-US-608, AIFACTORY-US-610, feature:run-control-service, feature:component-audit-factory-evidence, feature:contracts-package. Sources: model/services/tools-mcp/ToolAdapterService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/approval.schema.json, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given an Uncertain `ToolAdapterService/ToolInvocation` and the operator decision of its run, a `RunControlService/ApprovalRequest` that keeps the id of that invocation in `uncertainToolInvocationId` and that the Operator decided through `RunControlService/DecideApproval` with the finding applied, when RunControlService calls `ToolAdapterService/ConfirmToolEffect` for that id under its workload token, which holds `factory.tools.operate` and names the Operator as the user it acts for (D123), with the finding `applied` and the reason of the decision, then the response is 200, the invocation moves from Uncertain to Observed through `EffectConfirmedApplied` with the finding, the actor and the reason recorded, the final receipt carries the status Succeeded, `ToolAdapterService/ToolInvoked` is written in the same transaction and `connectsoft.factory.tools.uncertain` is decremented (SCN-ToolAdapterService-006, FR-10).",
        "AC2: Given the same invocation and the finding `not-applied`, when RunControlService calls `ToolAdapterService/ConfirmToolEffect`, then the invocation moves from Uncertain to Failed through `EffectConfirmedNotApplied` with a receipt of status Failed, `ToolAdapterService/ToolInvoked` carries the state Failed, and the service starts no execution; a later call of the runtime for the same step under a new idempotency key, after the Operator chose retry, is a new invocation, while the key of the settled one still returns its receipt (SCN-ToolAdapterService-006, XL-06).",
        "AC3: Given a call without a token, a workload token without `factory.tools.operate`, the user token of an Operator, an invocation that is unknown or of another tenant, an invocation that is not Uncertain, or a different finding for an invocation that a finding already settled, when `ToolAdapterService/ConfirmToolEffect` is called, then the response is 401, 403, 403, 404, 409 or 409 respectively with a problem response and no state changes, so no operator acts in the tool service directly; the same finding posted again by RunControlService returns 200 with the same result and writes nothing, which is also the answer when the Operator repeats a decision that RunControlService answered 503 because the answer of the first call was lost (SCN-ToolAdapterService-006, ADR-0015, D123).",
        "AC4: Given a finding was recorded, when the outbox of its transaction is read, then it holds one `AuditEvidenceSubmitted` record for `audit.evidence.v1.evidence-submitted` with the Operator as actor, the invocation and its request hash as subject and the finding, applied or not-applied, as outcome, shaped as docs/reference/schemas/audit-evidence.schema.json states and without arguments or result (SCN-ToolAdapterService-006, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2438",
        "AIFACTORY-TASK-2439"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6813,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation",
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "ToolAdapterService/ConfirmToolEffect",
          "RunControlService/DecideApproval"
        ],
        "events": [
          "ToolAdapterService/ToolInvoked"
        ],
        "descriptors": [
          "tool-receipt-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-10",
          "FUX-07",
          "XL-06",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-608",
        "AIFACTORY-US-610",
        "feature:run-control-service",
        "feature:component-audit-factory-evidence",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-609]",
      "number": 609
    },
    {
      "id": "AIFACTORY-TASK-2438",
      "type": "task",
      "parent": "AIFACTORY-US-609",
      "title": "ConfirmToolEffect as the internal operation of RunControlService with the finding, the settlement of the Uncertain invocation and its evidence record",
      "sequence": "05.02.13.01",
      "description": "ConfirmToolEffect as the internal operation of RunControlService with the finding, the settlement of the Uncertain invocation and its evidence record. Expected output: ConfirmToolEffect is an internal operation whose one caller is RunControlService (D121): it accepts the finding (applied or not-applied) and the reason of the operator decision for an Uncertain invocation, requires the workload token of the caller with factory.tools.operate and the service scope, under which it reads the forwarded tenant and project, takes the Operator from the user the token names as the one the caller acts for, the value operator of callerKind staying (D123), and refuses a user token with 403; it records the finding, the Operator the caller acts for as actor and the reason, writes the final receipt, settles the invocation to Observed through EffectConfirmedApplied or to Failed through EffectConfirmedNotApplied with its ToolInvoked outbox record and one AuditEvidenceSubmitted record in one transaction, moves connectsoft.factory.tools.uncertain down, returns the same result for the same finding posted again, and answers 401, 403, 404 (also for an invocation of another tenant, ADR-0015) and 409 as the PBI states; it starts no execution.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "ConfirmToolEffect is an internal operation whose one caller is RunControlService (D121): it accepts the finding (applied or not-applied) and the reason of the operator decision for an Uncertain invocation, requires the workload token of the caller with factory.tools.operate and the service scope, under which it reads the forwarded tenant and project, takes the Operator from the user the token names as the one the caller acts for, the value operator of callerKind staying (D123), and refuses a user token with 403; it records the finding, the Operator the caller acts for as actor and the reason, writes the final receipt, settles the invocation to Observed through EffectConfirmedApplied or to Failed through EffectConfirmedNotApplied with its ToolInvoked outbox record and one AuditEvidenceSubmitted record in one transaction, moves connectsoft.factory.tools.uncertain down, returns the same result for the same finding posted again, and answers 401, 403, 404 (also for an invocation of another tenant, ADR-0015) and 409 as the PBI states; it starts no execution."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6813,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2438]",
      "number": 2438
    },
    {
      "id": "AIFACTORY-TASK-2439",
      "type": "task",
      "parent": "AIFACTORY-US-609",
      "title": "Verify the confirmation of an uncertain effect through the acceptance suite",
      "sequence": "05.02.13.02",
      "description": "Verify the confirmation of an uncertain effect through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolAdapterService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-609 with a caller that stands for RunControlService, over the matrix of token kind and tenant: both findings with their transitions out of Uncertain, each sent under a workload token that holds factory.tools.operate and names the Operator as the user the caller acts for (D123), the idempotent repeat, the six refusals, among them the user token of an Operator, the evidence record in the outbox and the assertion that no execution starts and that a new key is a new invocation.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolAdapterService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-609 with a caller that stands for RunControlService, over the matrix of token kind and tenant: both findings with their transitions out of Uncertain, each sent under a workload token that holds factory.tools.operate and names the Operator as the user the caller acts for (D123), the idempotent repeat, the six refusals, among them the user token of an Operator, the evidence record in the outbox and the assertion that no execution starts and that a new key is a new invocation."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6813,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2439]",
      "number": 2439
    },
    {
      "id": "AIFACTORY-US-610",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-029",
      "title": "Read the tool receipts of a run and one invocation with its pipeline stages, sandbox lease and receipt",
      "sequence": "05.02.14",
      "description": "As a requester, I want to see every tool call of my run with its class, decision, approval, outcome and hashes, so that I can account for what the agents did and open the one call I need to understand. A caller whose scope carries `factory.runs.read` reads what the executor recorded. `ToolAdapterService/ListRunToolReceipts` returns the receipts of a run, paged in the order the calls were received: for each invocation the tool id and version, the effective class, the policy decision id, the approval id when the call was gated, the outcome, that is the state with the failure class or the denial stage and reason where there is one, and the request hash, the result hash and the receipt reference. `ToolAdapterService/GetToolInvocation` returns one invocation: its scope, caller kind, declared and effective class, the pipeline stages it passed with the time of each, its sandbox lease with kind, pool, limits and the times it was leased and released, and its receipt. Neither answer inlines arguments or results. The service stores hashes and artifact references only, and the caller fetches a result from ArtifactService under its own scope; a credential is in no row and therefore in no answer. Both reads run under the tenant row filter and admit a caller only for a project the token grants a role in, since every invocation carries its project. The user token is forwarded by ToolExecutorHost unchanged. A call without a token is answered 401, a token without `factory.runs.read` or without a role in the project of the run or the invocation 403, and an invocation that is unknown or of another tenant 404, the same answer in both cases (ADR-0015 amendment D113). The executor owns no run: `ListRunToolReceipts` answers 404 when it holds no invocation of that run in the tenant of the caller, which is also the answer for a run of another tenant and for a run that called no tool. Nothing is written by a read. The receipts are kept as the model states: one year by default, and seven years where audit evidence references them. The Studio run detail reads through these two operations, and so does the Operator who decides an uncertain outcome at RunControlService with the tool receipt in view (D121). Kind: behavior. Traces: services: ToolAdapterService; aggregates: ToolAdapterService/ToolInvocation; apis: ToolAdapterService/ListRunToolReceipts, ToolAdapterService/GetToolInvocation; descriptors: tool-receipt-v1; adrs: ADR-0015, ADR-0019; requirements: FR-05, NFR-04, NFR-10; scenarios: SCN-ToolAdapterService-004, SCN-ToolAdapterService-005. Depends on: AIFACTORY-US-602. Sources: model/services/tools-mcp/ToolAdapterService.yaml, docs/reference/schemas/tool-invocation.schema.json, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#data-model-and-storage, docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a run of my project with an observed, a denied, a gated and an uncertain invocation and a caller with `factory.runs.read` and a role in that project, when `ToolAdapterService/ListRunToolReceipts` is called, then the response is 200 with the four receipts in the order of reception, each with tool id, version, effective class, policy decision id, approval id where gated, outcome, request hash, result hash and receipt reference, paged, without arguments or results (SCN-ToolAdapterService-004, FR-05).",
        "AC2: Given one `ToolAdapterService/ToolInvocation` of my project that ran in a sandbox, when `ToolAdapterService/GetToolInvocation` is called, then the response is 200 with its scope, caller kind, declared and effective class, the pipeline stages it passed with their times, the sandbox lease with kind, pool, limits, leased and released times, and the receipt, and no argument, result or credential is in the answer (SCN-ToolAdapterService-005, ADR-0019).",
        "AC3: Given a call without a token, a token without `factory.runs.read` or without a role in the project, and a run or an invocation that is unknown or of another tenant, when `ToolAdapterService/ListRunToolReceipts` or `ToolAdapterService/GetToolInvocation` is called, then the response is 401, 403 or 404 with a problem response, the 404 the same for an unknown and a foreign id, and no state changes (SCN-ToolAdapterService-004, SCN-ToolAdapterService-005, ADR-0015).",
        "AC4: Given invocations of two tenants and of two projects of one tenant, when each caller lists and reads, then a caller receives only the receipts of the tenant of its token and of the projects it holds a role in, and nothing is written by any read (SCN-ToolAdapterService-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#data-model-and-storage",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2440",
        "AIFACTORY-TASK-2441"
      ],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6814,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolAdapterService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "ToolAdapterService/ListRunToolReceipts",
          "ToolAdapterService/GetToolInvocation"
        ],
        "descriptors": [
          "tool-receipt-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-05",
          "NFR-04",
          "NFR-10"
        ],
        "scenarios": [
          "SCN-ToolAdapterService-004",
          "SCN-ToolAdapterService-005"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-602"
      ],
      "source": [
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#data-model-and-storage",
        "docs/planes/capability-tools/tools/services/tool-adapter-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-610]",
      "number": 610
    },
    {
      "id": "AIFACTORY-TASK-2440",
      "type": "task",
      "parent": "AIFACTORY-US-610",
      "title": "ListRunToolReceipts and GetToolInvocation read model with tenant row filter, project admission and paging",
      "sequence": "05.02.14.01",
      "description": "ListRunToolReceipts and GetToolInvocation read model with tenant row filter, project admission and paging. Expected output: ListRunToolReceipts returns the receipts of a run paged in the order of reception with tool id, version, effective class, policy decision id, approval id, outcome, request hash, result hash and receipt reference; GetToolInvocation returns one invocation with its pipeline stages, sandbox lease and receipt; both apply the tenant row filter and admit only a project the token grants a role in, answer 401, 403 and 404 (also for a run or an invocation of another tenant, ADR-0015), inline no argument or result and write nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "ListRunToolReceipts returns the receipts of a run paged in the order of reception with tool id, version, effective class, policy decision id, approval id, outcome, request hash, result hash and receipt reference; GetToolInvocation returns one invocation with its pipeline stages, sandbox lease and receipt; both apply the tenant row filter and admit only a project the token grants a role in, answer 401, 403 and 404 (also for a run or an invocation of another tenant, ADR-0015), inline no argument or result and write nothing."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6814,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2440]",
      "number": 2440
    },
    {
      "id": "AIFACTORY-TASK-2441",
      "type": "task",
      "parent": "AIFACTORY-US-610",
      "title": "Verify the receipt reads through the acceptance suite",
      "sequence": "05.02.14.02",
      "description": "Verify the receipt reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-004|Scenario=SCN-ToolAdapterService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-610 over the two-tenant, two-project invocation fixture with an observed, a denied, a gated and an uncertain invocation, the three refusals and the assertion that no answer holds an argument, a result or a credential.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolAdapterService-004|Scenario=SCN-ToolAdapterService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-610 over the two-tenant, two-project invocation fixture with an observed, a denied, a gated and an uncertain invocation, the three refusals and the assertion that no answer holds an argument, a result or a credential."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 68,
      "phase": "factory",
      "stackRank": 6814,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2441]",
      "number": 2441
    },
    {
      "id": "AIFACTORY-FEAT-030",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-005",
      "title": "ToolExecutorHost: gateway delivery",
      "sequence": "05.03",
      "description": "ToolExecutorHost is the platform API gateway of bounded context BC-08 (Tool Execution). The API gateway of the Tools & MCP platform (ADR-0028): routes public REST and internal gRPC calls to the 2 services it fronts, validates tokens and scopes, and owns no business state. ToolAdapterService behind it stays the only executor of tools (GW-05). Its own repository is ConnectSoft.AI.SoftwareFactory.ToolExecutorHost. Delivers: ToolExecutorHost (complete). Increment I1: Generate a microservice. Build order 69 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-065",
        "AIFACTORY-US-611",
        "AIFACTORY-US-612",
        "AIFACTORY-US-613",
        "AIFACTORY-US-614",
        "AIFACTORY-US-615",
        "AIFACTORY-US-616",
        "AIFACTORY-US-1509"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6900,
      "titlePrefix": "[AIFACTORY-FEAT-030]",
      "number": 30
    },
    {
      "id": "AIFACTORY-US-065",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "ToolExecutorHost routes its platform's calls under a trusted scope",
      "sequence": "05.03.01",
      "description": "As an asset maintainer, I want one gateway in front of McpServerRegistryService and ToolAdapterService that validates tokens and scopes, so that no service of the platform is reachable except through its gateway and every call arrives with a scope it can trust. This is the integration PBI of the Tools and MCP gateway. ADR-0028 re-scopes the former composition host as the API gateway of its platform: ToolExecutorHost routes public REST and internal gRPC calls to the two services the model lists under `deployment.fronts`, McpServerRegistryService and ToolAdapterService, validates tokens and scopes and owns no business state. It is the only route to the executor, and the executor behind it stays the only component that runs a tool (GW-05, ADR-0022 decision 2): the gateway executes nothing, decides no policy, binds no approval, leases no sandbox and holds no secret. One part of the host runs outside the gateway process (decision D125): in I1 the seven repository read tools execute inside the sandbox of the run, and the host carries the read-tool component of the RepositoryIntelligenceService repository, which it starts inside the sandbox that ToolAdapterService leased, over the workspace mounted read-only (AIFACTORY-US-1509); the gateway process still runs no tool, and the executor still decides, leases and receipts every call. The repository ConnectSoft.AI.SoftwareFactory.ToolExecutorHost is created and scaffolded in I0 by AIFACTORY-TASK-083 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; it was scaffolded from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform, which fixes persistence, messaging and the actor model to none: the gateway has no relational store, no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package; the gateway copies neither the accessor nor the token contract. It forwards the user token to the fronted service unchanged and exchanges no token, and the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). The feature is delivered by seven further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-611), token, tenant and scope on every read and sandbox route (AIFACTORY-US-612), the pass-through of a shared-write call (AIFACTORY-US-613), the publication routes of the registry whose gate stays in the service (AIFACTORY-US-614), the two ways a tool call reaches the executor, the gRPC route of the agent hosts and the MCP route (AIFACTORY-US-615), health, capabilities, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-616), and the read-tool component in the sandbox of the run (AIFACTORY-US-1509). The callers are the agent hosts, which invoke tools with the Factory tool client of the pinned AI libraries under a workload token, and the Studio backend and the command-line client, which read descriptors, servers and receipts with the typed tool gateway client of feature `typed-gateway-clients`, generated from the OpenAPI document this gateway publishes. RunControlService is the one caller of the internal route of `ConfirmToolEffect`, by which it records the finding of the Operator on an uncertain tool effect (D121). In I1 the hosted MCP endpoint behind the MCP route serves only calls bound to a run, a step and an attempt, and IDE clients and partner agents arrive with the complete McpServerRegistryService in I5 (D121). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. Every route of this platform addresses a tool, a server, a run or an invocation by its id and none names a project or a tenant in its path, so the gateway forwards under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. ToolAdapterService is delivered complete in this increment and McpServerRegistryService thin: a route whose operation the thin registry does not host returns the answer of that service unchanged, and its route class is proven against a fake generated from the fronts entry. The gateway invents no response. Kind: enabling. Traces: services: ToolExecutorHost, McpServerRegistryService, ToolAdapterService; apis: ToolExecutorHost/ToolsHealth; adrs: ADR-0015, ADR-0017, ADR-0022, ADR-0028; requirements: FR-05. Depends on: AIFACTORY-US-611, AIFACTORY-US-612, AIFACTORY-US-613, AIFACTORY-US-614, AIFACTORY-US-615, AIFACTORY-US-616, AIFACTORY-US-1509, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/capability-tools/tools/services/tool-executor-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ToolExecutorHost created and scaffolded in I0 by AIFACTORY-TASK-083 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ToolExecutorHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, when its pipeline runs, then the solution builds, the tests pass with complete reports and a container image is published (ADR-0028, model/services/tools-mcp/ToolExecutorHost.yaml).",
        "AC2: Given a valid token for a route of each fronted service, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with the token unchanged, the tenant, the correlation id and the trace context, the fronted service answers and the response returns unchanged, as AIFACTORY-US-612 to AIFACTORY-US-615 prove per route class (ADR-0015, FR-05).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, no event of the model lists ToolExecutorHost as a consumer, and no type of the gateway process executes a tool, evaluates a policy or holds an approval, the read-tool component that the host starts inside the sandbox of a run being the one part outside that process (ADR-0028, ADR-0022, model/services/tools-mcp/ToolExecutorHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `ToolExecutorHost/ToolsHealth` is probed and one replica is stopped, then health reports the identity platform and the two fronted services, a replica stays in rotation while it can validate tokens, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/tools-mcp/ToolExecutorHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-2442",
        "AIFACTORY-TASK-792"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6901,
      "kind": "enabling",
      "traces": {
        "services": [
          "ToolExecutorHost",
          "McpServerRegistryService",
          "ToolAdapterService"
        ],
        "apis": [
          "ToolExecutorHost/ToolsHealth"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-611",
        "AIFACTORY-US-612",
        "AIFACTORY-US-613",
        "AIFACTORY-US-614",
        "AIFACTORY-US-615",
        "AIFACTORY-US-616",
        "AIFACTORY-US-1509",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-065]",
      "number": 65
    },
    {
      "id": "AIFACTORY-TASK-2442",
      "type": "task",
      "parent": "AIFACTORY-US-065",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "05.03.01.01",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 16, the ports https 7800 and grpc 7802, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/tools-mcp/ToolExecutorHost.yaml records them; the silo port 11800 and the gateway port 30800 that the same model file carries are not exposed, because the Platform role has no actor model and nothing listens on them, and that the model file lists them is reported to the owner; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile from ConnectSoftIdentityPlatform:Authority (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 16, the ports https 7800 and grpc 7802, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/tools-mcp/ToolExecutorHost.yaml records them; the silo port 11800 and the gateway port 30800 that the same model file carries are not exposed, because the Platform role has no actor model and nothing listens on them, and that the model file lists them is reported to the owner; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile from ConnectSoftIdentityPlatform:Authority (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6901,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2442]",
      "number": 2442
    },
    {
      "id": "AIFACTORY-TASK-792",
      "type": "task",
      "parent": "AIFACTORY-US-065",
      "title": "Verify tool-executor-host-routes-its-platform by running the declared command",
      "sequence": "05.03.01.02",
      "description": "Verify tool-executor-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-065, that is the scaffold of the Platform role, the scope established once and forwarded, the architecture test with its rule that no type of the gateway executes a tool, and, for AC4, the acceptance test of feature TwoReplicas, which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes ToolExecutorHost/ToolsHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-065, that is the scaffold of the Platform role, the scope established once and forwarded, the architecture test with its rule that no type of the gateway executes a tool, and, for AC4, the acceptance test of feature TwoReplicas, which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes ToolExecutorHost/ToolsHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-792]",
      "number": 792
    },
    {
      "id": "AIFACTORY-US-611",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "Tools and MCP fronts file: named clients and REST and gRPC routes of the two fronted services, generated at build",
      "sequence": "05.03.02",
      "description": "As a platform admin, I want the route table of the Tools and MCP gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Tools and MCP platform. It lists the two services of `deployment.fronts` in model/services/tools-mcp/ToolExecutorHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method, scope, side-effect class, idempotency and, for a gRPC method, its streaming. For McpServerRegistryService these are six REST operations and the two methods of `McpRegistry`; for ToolAdapterService six REST operations and the three methods of `ToolExecutor`, of which `Invoke` is a server stream. The REST operations are the public surface that the Studio backend and the clients call, with one exception: `ConfirmToolEffect` of ToolAdapterService is an internal operation whose one caller is RunControlService (D121), so its route admits no user token and is left out of the public OpenAPI document. The gRPC methods are the internal surface the agent hosts call. Each route carries the scope and the side-effect class of its operation, which is what the route class PBIs of this feature enforce. A test lists the emitted route table against the file and against the two service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `ToolsHealth` and `ToolsCapabilities`, transforms no payload and composes no response from two services. The fronts file lists every operation of the model, also the five REST operations the thin registry does not host yet, so the complete registry of I5 needs no change of the gateway; until then such a route forwards and returns the answer of the thin service unchanged. The fronts file alone decides which routes are hosted. The option `Tools:Host:FrontedServices` of the model is bound at startup and compared with the fronts file, and a difference in either direction fails startup with the name; it is not reloadable. Its modelled default names the two services by their service ids, `McpServerRegistryService` and `ToolAdapterService`, and equals the service set of `deployment.fronts` (D121), so an entry of the fronts file needs no second name for its service. The gateway publishes the OpenAPI document of its public REST routes, from which feature `typed-gateway-clients` generates the tool gateway client. Kind: enabling. Traces: services: ToolExecutorHost, McpServerRegistryService, ToolAdapterService; adrs: ADR-0015, ADR-0028; requirements: FR-05. Depends on: feature:component-api-gateway-template. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/tools-mcp/McpServerRegistryService.yaml, model/gateways.yaml, docs/planes/capability-tools/tools/services/tool-executor-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Tools and MCP platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of McpServerRegistryService and ToolAdapterService, twelve REST routes and five gRPC routes, each with the scope, side-effect class and idempotency of the operation, and the route table test passes against model/services/tools-mcp/ToolExecutorHost.yaml and the two service files it fronts (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `Tools:Host:FrontedServices` at its modelled default, which names the two service ids of `deployment.fronts`, when the gateway starts, then startup succeeds; given a value of the option that differs from the services of the fronts file, then startup fails with the differing name; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (ADR-0028, model/services/tools-mcp/ToolExecutorHost.yaml).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, which carries the token of the caller unchanged because the gateway exchanges no token, the tenant, the correlation id and the trace context, and the response of the fake returns unchanged (ADR-0015, FR-05).",
        "AC4: Given the built gateway, when its OpenAPI document is compared with the REST operations of model/services/tools-mcp/ToolAdapterService.yaml and model/services/tools-mcp/McpServerRegistryService.yaml, then every public REST route is described with its path, scope and response codes and no internal operation appears in it, neither the route of `ConfirmToolEffect`, whose one caller is RunControlService, nor a gRPC method, so the tool gateway client is generated from it without a hand-written operation (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/gateways.yaml",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-084",
        "AIFACTORY-TASK-2443",
        "AIFACTORY-TASK-2444",
        "AIFACTORY-TASK-2445"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6902,
      "kind": "enabling",
      "traces": {
        "services": [
          "ToolExecutorHost",
          "McpServerRegistryService",
          "ToolAdapterService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/gateways.yaml",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-611]",
      "number": 611
    },
    {
      "id": "AIFACTORY-TASK-084",
      "type": "task",
      "parent": "AIFACTORY-US-611",
      "title": "Fronts file with the REST and gRPC operations of McpServerRegistryService and ToolAdapterService",
      "sequence": "05.03.02.01",
      "description": "Fronts file with the REST and gRPC operations of McpServerRegistryService and ToolAdapterService. Expected output: The fronts file lists the two services of deployment.fronts by their service ids with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class, idempotency, streaming and visibility, ConfirmToolEffect being the one internal REST operation; the build emits the named clients, the twelve REST and five gRPC routes and the route table; at startup the option Tools:Host:FrontedServices, whose default names the same two service ids (D121), is compared with the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the two services of deployment.fronts by their service ids with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class, idempotency, streaming and visibility, ConfirmToolEffect being the one internal REST operation; the build emits the named clients, the twelve REST and five gRPC routes and the route table; at startup the option Tools:Host:FrontedServices, whose default names the same two service ids (D121), is compared with the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-084]",
      "number": 84
    },
    {
      "id": "AIFACTORY-TASK-2443",
      "type": "task",
      "parent": "AIFACTORY-US-611",
      "title": "OpenAPI document of the public REST routes of the gateway",
      "sequence": "05.03.02.02",
      "description": "OpenAPI document of the public REST routes of the gateway. Expected output: The build of the gateway emits one OpenAPI document that describes the eleven public REST routes with path, scope, request and response codes as the two service files of the model state them and the two operations of the gateway itself, and holds no internal operation, neither the route of ConfirmToolEffect, which only RunControlService calls (D121), nor a gRPC method; the document is published as a pipeline artifact with the version of the gateway, so that the tool gateway client of feature typed-gateway-clients is generated from it (model/services/tools-mcp/ToolExecutorHost.yaml).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The build of the gateway emits one OpenAPI document that describes the eleven public REST routes with path, scope, request and response codes as the two service files of the model state them and the two operations of the gateway itself, and holds no internal operation, neither the route of ConfirmToolEffect, which only RunControlService calls (D121), nor a gRPC method; the document is published as a pipeline artifact with the version of the gateway, so that the tool gateway client of feature typed-gateway-clients is generated from it (model/services/tools-mcp/ToolExecutorHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6902,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2443]",
      "number": 2443
    },
    {
      "id": "AIFACTORY-TASK-2444",
      "type": "task",
      "parent": "AIFACTORY-US-611",
      "title": "Fakes of the two fronted services and the token matrix of the acceptance suite",
      "sequence": "05.03.02.03",
      "description": "Fakes of the two fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers and the gRPC metadata it received, answers a configured status, streams configured messages on ToolExecutor.Invoke and can stop answering, and tokens for the matrix of role and tenant, including an expired token, an identity token, a user token of another audience and a workload token with and without a service scope (model/services/tools-mcp/ToolExecutorHost.yaml).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers and the gRPC metadata it received, answers a configured status, streams configured messages on ToolExecutor.Invoke and can stop answering, and tokens for the matrix of role and tenant, including an expired token, an identity token, a user token of another audience and a workload token with and without a service scope (model/services/tools-mcp/ToolExecutorHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2444]",
      "number": 2444
    },
    {
      "id": "AIFACTORY-TASK-2445",
      "type": "task",
      "parent": "AIFACTORY-US-611",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "05.03.02.04",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-611: one route per operation of model/services/tools-mcp/ToolExecutorHost.yaml and the two service files it fronts, the failing builds, the start with the option at its default, the failing startup on an option value that differs from the fronts file, the 404 of an unknown path, one forwarded call per service and protocol and the OpenAPI document compared with the model.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-611: one route per operation of model/services/tools-mcp/ToolExecutorHost.yaml and the two service files it fronts, the failing builds, the start with the option at its default, the failing startup on an option value that differs from the fronts file, the 404 of an unknown path, one forwarded call per service and protocol and the OpenAPI document compared with the model."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2445]",
      "number": 2445
    },
    {
      "id": "AIFACTORY-US-612",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "A read or sandbox route of the tools platform forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "05.03.03",
      "description": "As an observer, I want my read calls to reach the executor and the registry only with the tenant and scope my token grants, so that I see the descriptors, servers and receipts I am entitled to and nobody reads across a tenant through the gateway. A caller reaches a read or sandbox operation of the platform through the gateway: an asset maintainer lists tools and servers, a requester reads the tool receipts of a run, an operator opens one invocation, and an asset maintainer dry-runs a call. The read routes are `ListTools`, `GetTool`, `ListRunToolReceipts` and `GetToolInvocation` of ToolAdapterService and `ListMcpServers` and `GetMcpCapabilities` of McpServerRegistryService; the sandbox routes are `DryRunTool` of ToolAdapterService and `DiscoverMcpCapabilities` of the registry. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment on the audience of a user token); a client that also calls the Control Plane gateway requests a second token. The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names: `factory.tools.read`, `factory.runs.read` or `factory.tools.admin`. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. The scope is established once with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package and forwarded: the authorization header with the user token itself, because the gateway exchanges no token and the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117), the tenant in `X-Tenant-Id`, the correlation id and the trace context. Every one of these routes addresses its resource by an id: a tool, a run, an invocation or a server. A gateway without business state cannot resolve the project or the tenant of such an id, so it checks token and scope and forwards; the fronted service answers 403 for a missing project role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. For a read route the response is served by the fronted service with no side effect. For a sandbox route the service acts inside its own bounds: a dry run executes nothing, and a discovery lists capabilities into bindings without activating a server; the gateway adds no gate of its own to the class. `GetMcpCapabilities` and `DiscoverMcpCapabilities` are not hosted by the thin registry of this increment, so their routes return the answer of the thin service unchanged and their class is proven against the fake generated from the fronts entry. The gateway returns every response unchanged with the correlation id and keeps nothing of the call. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope of the operation 403; in each case no fronted service is called, and the refusal is counted for the route and logged with the correlation id and without the token. A public REST route admits no workload token, because its operation names no service scope. When a fronted service does not answer, its routes answer 503 with a problem response that carries a retry hint and names the service and never its address, and the routes of the other service keep serving. Kind: behavior. Traces: services: ToolExecutorHost, McpServerRegistryService, ToolAdapterService; apis: ToolAdapterService/ListTools, ToolAdapterService/DryRunTool, McpServerRegistryService/ListMcpServers; adrs: ADR-0015, ADR-0028; requirements: FR-05, NFR-02; scenarios: SCN-ToolExecutorHost-004, SCN-ToolExecutorHost-005. Depends on: AIFACTORY-US-611, feature:component-api-gateway-template, feature:component-extensions-ai, feature:tool-adapter-service, feature:mcp-server-registry-service-thin. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/capability-tools/tools/services/tool-executor-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway with `factory.tools.read`, when the read route of `ToolAdapterService/ListTools` and of `McpServerRegistryService/ListMcpServers` is called, then the gateway forwards the call with the user token unchanged in the authorization header, without a token exchange, the tenant of the `tid` claim, the correlation id and the trace context, the fronted service, which accepts the audience of its own gateway, answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-ToolExecutorHost-004, ADR-0015).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes of both services are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope of the operation 403 and a workload token on a public REST route 403, and in none of these cases a fronted service is called; given a route addressed by a tool, run, invocation or server id, then the gateway forwards under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing project role and its 404 for a resource of another tenant return unchanged (SCN-ToolExecutorHost-004, ADR-0015).",
        "AC3: Given a valid user token and a tenant header of the caller that names another tenant, when a read route is called, then the header is overwritten with the `tid` claim before the call is forwarded and the fake of the fronted service receives the tenant of the token only (SCN-ToolExecutorHost-004, ADR-0015).",
        "AC4: Given a token with `factory.tools.read`, when the sandbox route of `ToolAdapterService/DryRunTool` is called, then the call is forwarded under the same token, tenant and scope rules, the gateway adds no gate of its own to the class and the preview of the service returns unchanged; the sandbox route of the registry is proven against the fake generated from the fronts entry, because `DiscoverMcpCapabilities` arrives with feature mcp-server-registry-service-complete (SCN-ToolExecutorHost-005, model/services/tools-mcp/McpServerRegistryService.yaml).",
        "AC5: Given ToolAdapterService does not answer, when one of its read or sandbox routes is called, then the gateway answers 503 with a problem response that carries a retry hint and names the service and never its address, invents no response, and the read route of `McpServerRegistryService/ListMcpServers` keeps serving (SCN-ToolExecutorHost-004, SCN-ToolExecutorHost-005, model/services/tools-mcp/ToolExecutorHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2446",
        "AIFACTORY-TASK-2447"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6903,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolExecutorHost",
          "McpServerRegistryService",
          "ToolAdapterService"
        ],
        "apis": [
          "ToolAdapterService/ListTools",
          "ToolAdapterService/DryRunTool",
          "McpServerRegistryService/ListMcpServers"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-ToolExecutorHost-004",
          "SCN-ToolExecutorHost-005"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-611",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:tool-adapter-service",
        "feature:mcp-server-registry-service-thin"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-612]",
      "number": 612
    },
    {
      "id": "AIFACTORY-TASK-2446",
      "type": "task",
      "parent": "AIFACTORY-US-612",
      "title": "Issuer, audience and scope configuration of the read and sandbox routes",
      "sequence": "05.03.03.01",
      "description": "Issuer, audience and scope configuration of the read and sandbox routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route is marked as addressed by a resource id only, so the gateway checks token and scope and leaves the project role and the tenant of the resource to the fronted service; the tenant header is overwritten with the tid claim, the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header, the user token is forwarded unchanged in the authorization header and no token is exchanged (ADR-0015 amendment D117); a workload token is refused on a public REST route; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route is marked as addressed by a resource id only, so the gateway checks token and scope and leaves the project role and the tenant of the resource to the fronted service; the tenant header is overwritten with the tid claim, the scope is established through the scope accessor of the pinned abstractions package and forwarded in the canonical tenant header, the user token is forwarded unchanged in the authorization header and no token is exchanged (ADR-0015 amendment D117); a workload token is refused on a public REST route; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2446]",
      "number": 2446
    },
    {
      "id": "AIFACTORY-TASK-2447",
      "type": "task",
      "parent": "AIFACTORY-US-612",
      "title": "Verify the read and sandbox routes through the acceptance suite",
      "sequence": "05.03.03.02",
      "description": "Verify the read and sandbox routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolExecutorHost-004|Scenario=SCN-ToolExecutorHost-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-612 over the token matrix, the token received by the fake equal to the user token of the caller, a route addressed by an id whose 403 and 404 come from the fake and return unchanged, the overwritten tenant header, the sandbox route of the registry against the fake generated from the fronts entry and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolExecutorHost-004|Scenario=SCN-ToolExecutorHost-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-612 over the token matrix, the token received by the fake equal to the user token of the caller, a route addressed by an id whose 403 and 404 come from the fake and return unchanged, the overwritten tenant header, the sandbox route of the registry against the fake generated from the fronts entry and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2447]",
      "number": 2447
    },
    {
      "id": "AIFACTORY-US-613",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "A shared-write route of the tools platform passes the request and its idempotency key through and the gateway keeps nothing between calls",
      "sequence": "05.03.04",
      "description": "As an operator, I want a write that is repeated after a failure, by me or by Run Control when it records my finding, to be applied once, so that a lost answer or a restarted gateway never confirms an effect twice or registers a server twice. Two REST operations of the platform are of class shared-write. `RegisterMcpServer` of McpServerRegistryService is public: its caller sends it through the gateway under the token, tenant and scope rules of AIFACTORY-US-612, with `factory.tools.admin`. `ConfirmToolEffect` of ToolAdapterService is internal: RunControlService calls it to record the finding of the Operator on an Uncertain invocation, applied or not-applied, when the Operator decides the operator decision of the run, and no operator calls it directly (D121). On this route the gateway admits the workload token of RunControlService when it holds `factory.tools.operate`, forwards the tenant and the project of the caller unchanged, as it does on an internal gRPC route (ADR-0015 amendment D114), and refuses a user token with 403 before any fronted service is called. Which token RunControlService presents is not stated by the decision, so this is the reading of the delivery and is reported to the owner. `RegisterMcpServer` declares idempotency `key-header`: it is called with an `Idempotency-Key`, the gateway forwards the header unchanged, and the registry applies the request once under its own rule, the same key with the same body returning the same result and the same key with a different body its 409, which returns to the caller unchanged. `ConfirmToolEffect` is naturally idempotent: the executor returns the same result for the same finding and answers 409 for a different one, and the gateway forwards both answers as they are. The gateway is no party to idempotency. It stores neither a key nor a result, keeps no session and no pending call, has no outbox and writes no event and no audit evidence; the evidence of a confirmation is written by the executor in the transaction of its command. A gateway replica that crashes during a call therefore loses nothing: the replica restarts, nothing is replayed, and the caller repeats the call and receives from the service the result of the one application (failure mode of a gateway replica crash in the model). When the fronted service does not answer, the route answers 503 with a problem response that names the service and carries a retry hint, the other routes keep serving, and the caller repeats the call. A refusal by the gateway, 401 or 403, reaches no fronted service, so it applies nothing. Both routes name only a resource id or none, so the 403 of the fronted service for a missing project role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged; the service has applied nothing. A missing key, an invalid body and every domain refusal are answers of the fronted service and return unchanged with the correlation id. `RegisterMcpServer` is not hosted by the thin registry of this increment, so the key-header rule is proven against the fake generated from the fronts entry. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: ToolExecutorHost, McpServerRegistryService, ToolAdapterService; apis: ToolAdapterService/ConfirmToolEffect; adrs: ADR-0014, ADR-0015, ADR-0028; requirements: FR-10, XL-06; scenarios: SCN-ToolExecutorHost-006. Depends on: AIFACTORY-US-611, AIFACTORY-US-612, feature:component-api-gateway-template, feature:tool-adapter-service. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given the workload token of RunControlService that holds `factory.tools.operate`, when the internal shared-write route of `ToolAdapterService/ConfirmToolEffect` is called with a finding, then the gateway forwards the request with the body, the token and the tenant and project of the caller unchanged, the executor applies it once and its response returns unchanged with the correlation id; the same finding repeated returns the result of the first application and a different finding the 409 of the executor, both unchanged; a user token on this route is answered 403 and reaches no fronted service, because no operator calls the operation directly (SCN-ToolExecutorHost-006, ADR-0015).",
        "AC2: Given the shared-write route of the registry, whose operation declares idempotency `key-header`, and the fake generated from its fronts entry, when the call arrives with an `Idempotency-Key`, is repeated with the same key, and is repeated with the same key and a different body, then the header is forwarded unchanged each time, the fake applies the request once, the repeat returns the first result and the third call returns the 409 of the fake unchanged; the gateway has stored neither the key nor a result (SCN-ToolExecutorHost-006, ADR-0028).",
        "AC3: Given a gateway replica stopped while a shared-write call is in flight, when the caller repeats the call through another replica, then the fronted service returns the result of the one application, nothing is replayed by the gateway and no second state change exists (SCN-ToolExecutorHost-006, model/services/tools-mcp/ToolExecutorHost.yaml).",
        "AC4: Given a call without a token, a token that lacks the scope, or a fronted service that does not answer, when a shared-write route is called, then the answer is 401, 403 or 503 respectively and a call the gateway refuses reaches no fronted service; the 403 of the fronted service for a missing project role and its 404 for an invocation of another tenant return unchanged; the 503 names the service and carries a retry hint while the other routes keep serving (SCN-ToolExecutorHost-006, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2448",
        "AIFACTORY-TASK-2449"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6904,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolExecutorHost",
          "McpServerRegistryService",
          "ToolAdapterService"
        ],
        "apis": [
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "XL-06"
        ],
        "scenarios": [
          "SCN-ToolExecutorHost-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-611",
        "AIFACTORY-US-612",
        "feature:component-api-gateway-template",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-613]",
      "number": 613
    },
    {
      "id": "AIFACTORY-TASK-2448",
      "type": "task",
      "parent": "AIFACTORY-US-613",
      "title": "Forwarded headers of a write route and a stateless call path",
      "sequence": "05.03.04.01",
      "description": "Forwarded headers of a write route and a stateless call path. Expected output: A shared-write route forwards the Idempotency-Key header where the operation declares one, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; the route of ConfirmToolEffect is internal, admits the workload token of RunControlService that holds factory.tools.operate with the tenant and project it forwards, and refuses a user token with 403 (D121); no key, body or result is written to the shared cache or to any store, and no event or evidence record is written by the gateway; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "A shared-write route forwards the Idempotency-Key header where the operation declares one, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; the route of ConfirmToolEffect is internal, admits the workload token of RunControlService that holds factory.tools.operate with the tenant and project it forwards, and refuses a user token with 403 (D121); no key, body or result is written to the shared cache or to any store, and no event or evidence record is written by the gateway; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2448]",
      "number": 2448
    },
    {
      "id": "AIFACTORY-TASK-2449",
      "type": "task",
      "parent": "AIFACTORY-US-613",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "05.03.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolExecutorHost-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-613 with the fake of ToolAdapterService for ToolAdapterService/ConfirmToolEffect, called under a workload token that holds factory.tools.operate and refused with 403 for a user token, the fake of the registry that applies a key once, a replica stopped during a call, a 403 and a 404 that come from the fake and return unchanged, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolExecutorHost-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-613 with the fake of ToolAdapterService for ToolAdapterService/ConfirmToolEffect, called under a workload token that holds factory.tools.operate and refused with 403 for a user token, the fake of the registry that applies a key once, a replica stopped during a call, a 403 and a 404 that come from the fake and return unchanged, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2449]",
      "number": 2449
    },
    {
      "id": "AIFACTORY-US-614",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "A publication route of the registry is forwarded under its scope and the gate of the action stays in McpServerRegistryService",
      "sequence": "05.03.05",
      "description": "As a platform admin, I want the activation and the retirement of an MCP server to be decided by the registry that owns the server, with the gateway only checking who I am and what I may call, so that an approval or an authentication exception is never decided by a component that holds no state. Two operations of the platform are of class publication: `ActivateMcpServer`, which approves the bindings of a server and activates it, and `RetireMcpServer`, after which the descriptors of the server are unhealthy and inactive. Both belong to McpServerRegistryService and need `factory.tools.admin`. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, requires the scope the operation names and forwards the call with the established scope. The gate itself is decided where the state is. The registry activates a server only when its handshake and discovery succeeded and its bindings are approved, refuses a server that is reachable beyond the local process without authentication unless a Platform admin recorded the exception with an expiry (ADR-0022 decision 4), answers 409 when the state of the server does not allow the action and 412 when a precondition such as the recorded exception does not hold, and writes `McpServerStateChanged` in the transaction of its command; whatever gate the registry applies to the action is decided in the registry, and its answer returns unchanged. The gateway evaluates no approval, holds no approval reference, reads no registration and no exception, and writes no audit evidence: AuditService records the evidence from the event of the registry. The answer of the registry, including 409 and 412, returns unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. Both routes name only the `serverId`, so the gateway forwards under the tenant of the token and the scope of the operation, the registry answers 404 for a server of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. When the registry does not answer, the routes answer 503 with a retry hint and the routes of the executor keep serving. Neither operation is hosted by the thin registry of this increment: the fronts file holds their routes, the class is proven against the fake generated from the fronts entry, which answers 200, 409 and 412, and against the deployed thin service the routes return its answer unchanged. The derived default of the scenario made the gateway forward only a request that carries an approval reference; the gate is stated here where the model puts it, in the fronted service. Kind: behavior. Traces: services: ToolExecutorHost, McpServerRegistryService; adrs: ADR-0015, ADR-0022, ADR-0028; requirements: NFR-04, FR-05; scenarios: SCN-ToolExecutorHost-003. Depends on: AIFACTORY-US-611, AIFACTORY-US-612, feature:component-api-gateway-template. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, model/services/tools-mcp/McpServerRegistryService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0022-mcp-as-tool-protocol.md.",
      "acceptanceCriteria": [
        "AC1: Given a user token with `factory.tools.admin`, when a publication route of McpServerRegistryService is called against the fake generated from its fronts entry that answers 200, 409 or 412, then the gateway forwards the call under the tenant of the token and the scope of the operation, because the route names only the `serverId`, and returns each answer unchanged with the correlation id, holding no approval reference and writing nothing (SCN-ToolExecutorHost-003, ADR-0028).",
        "AC2: Given a call without a token or with an expired token, or a token that lacks `factory.tools.admin`, when a publication route is called, then the gateway answers 401 or 403 and no fronted service is called; given a server of another tenant, when the route is called with a valid token, then the gateway forwards and the 404 of the fronted service returns unchanged (SCN-ToolExecutorHost-003, ADR-0015).",
        "AC3: Given the register of gated routes built from the route table, when it is checked, then every route of class publication has a scope and the gateway holds no handler, cache entry or store for an approval, an authentication exception or a server registration; given the registry does not answer, when a publication route is called, then the answer is 503 with a retry hint that names the service and the routes of ToolAdapterService keep serving (SCN-ToolExecutorHost-003, ADR-0022, model/services/tools-mcp/McpServerRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2450",
        "AIFACTORY-TASK-2451"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6905,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolExecutorHost",
          "McpServerRegistryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-04",
          "FR-05"
        ],
        "scenarios": [
          "SCN-ToolExecutorHost-003"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-611",
        "AIFACTORY-US-612",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md"
      ],
      "titlePrefix": "[AIFACTORY-US-614]",
      "number": 614
    },
    {
      "id": "AIFACTORY-TASK-2450",
      "type": "task",
      "parent": "AIFACTORY-US-614",
      "title": "Fake of the publication operations of the registry and the route class register of the gateway",
      "sequence": "05.03.05.01",
      "description": "Fake of the publication operations of the registry and the route class register of the gateway. Expected output: The acceptance suite holds a fake of ActivateMcpServer and RetireMcpServer generated from the fronts entry of McpServerRegistryService that answers 200, 409, 412 and 404; a register test lists every route of class publication from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, an authentication exception or a server registration (model/services/tools-mcp/ToolExecutorHost.yaml).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of ActivateMcpServer and RetireMcpServer generated from the fronts entry of McpServerRegistryService that answers 200, 409, 412 and 404; a register test lists every route of class publication from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, an authentication exception or a server registration (model/services/tools-mcp/ToolExecutorHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6905,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2450]",
      "number": 2450
    },
    {
      "id": "AIFACTORY-TASK-2451",
      "type": "task",
      "parent": "AIFACTORY-US-614",
      "title": "Verify the publication routes through the acceptance suite",
      "sequence": "05.03.05.02",
      "description": "Verify the publication routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolExecutorHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-614: the class forwarded under its scope, the answers 409 and 412 returned unchanged, the refusals of the gateway without a call to a fronted service, the 404 of the fake for a server of another tenant returned unchanged, the register of gated routes and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ToolExecutorHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-614: the class forwarded under its scope, the answers 409 and 412 returned unchanged, the refusals of the gateway without a call to a fronted service, the 404 of the fake for a server of another tenant returned unchanged, the register of gated routes and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2451]",
      "number": 2451
    },
    {
      "id": "AIFACTORY-US-615",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "A tool call reaches the executor only through the gateway, over the internal gRPC route of the agent hosts or the MCP route, and the gateway adds no gate and keeps no state",
      "sequence": "05.03.06",
      "description": "As a requester, I want every tool call of my run, and every call of a client that speaks MCP, to enter the executor through one authenticated door, so that no path to a tool exists that skips identity, and what the tool may do is still decided by the executor alone. A tool call reaches ToolAdapterService by two routes of the gateway, and by no other. The first is the internal gRPC surface. An agent host of the Agent Mesh calls `ToolAdapterService/ToolExecutor.Invoke` with the Factory tool client of the pinned AI libraries, and `ToolExecutor.Validate` and `ToolExecutor.Interrupt` beside it; the two methods of `McpRegistry` are routed the same way. The caller presents a workload token. Such a token carries service scopes, no audience of a user API and no tenant claim, and the gateway admits it only on a route whose operation names a service scope the token holds. For a workload token that holds the service scope that names the fronted service, the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope (ADR-0015 amendment D114); a call without a token is refused with UNAUTHENTICATED and a workload token without the scope with PERMISSION_DENIED, and no fronted service is called. `Invoke` is a server stream of class production. The gateway forwards the request, relays every message of the stream in order and unchanged up to the receipt, and propagates the deadline and the cancellation of the caller; it buffers no result and writes no message to a store. The class of the route changes nothing at the gateway: schema, permission, policy, classification, approval binding, credentials, sandbox and the receipt are stages of the executor. The request message of `Invoke` is a `tool-invocation-v1` document, which holds the idempotency key and, as optional members since D121, the fencing token of the lease and the tool version; the gateway relays the message as it is and reads none of it. When a gateway replica stops while a stream is open, the caller sees the stream fail and repeats the call under the same idempotency key through another replica, and the executor answers with the existing invocation and its receipt; the gateway replays nothing. A NOT_FOUND of the fronted service for a resource of another tenant returns unchanged, and the attempt that receives it takes the failure class permanent (ADR-0015 amendment D113). When the executor does not answer, the route fails with UNAVAILABLE and the routes of the registry keep serving. The second route is MCP. ToolAdapterService hosts the MCP endpoint of the Factory with the pinned MCP library, and the gateway routes the transports the option `Tools:Mcp:Transports` names to it. With `Tools:Mcp:AuthorizationEnabled` at its default true, a request on the MCP route without a valid token is refused at the gateway with 401 and the protected-resource challenge and never reaches the executor; with a token whose audience is this gateway and whose scope carries `factory.tools.invoke` it is forwarded with the token unchanged, and the endpoint applies the scope of the caller, the scope-mismatch refusal and the pipeline. In I1 the endpoint serves only calls bound to a run, a step and an attempt, and IDE clients and partner agents arrive with the complete McpServerRegistryService in I5 (D121): the endpoint refuses a call whose token carries no run, step and attempt identity, and the gateway, which adds no gate of its own, returns that refusal unchanged. The option is not reloadable. A value of false would expose the endpoint without identity, which ADR-0022 allows only as a documented exception per server; no such exception can be recorded before the complete registry exists, so in this delivery the gateway fails startup when the option is false. The model defines the option as a boolean with the default true and does not forbid the value false, so the startup failure is the behaviour of this delivery until the owner decides how the option relates to the exception recorded per server, and it is reported to the owner as such, not presented as a rule of the model. The gateway routes the streamable HTTP transport. What routing `stdio-bridge` means for a network gateway the model does not say; a stdio server of the registry is bridged by the executor inside a sandbox, so the gateway accepts the value, routes nothing for it and the question is reported. `connectsoft.factory.tools.host.requests` counts every call of both routes by service, transport and status. Kind: behavior. Traces: services: ToolExecutorHost, ToolAdapterService, McpServerRegistryService; apis: ToolAdapterService/ToolExecutor.Invoke, ToolAdapterService/ToolExecutor.Validate, ToolAdapterService/ToolExecutor.Interrupt, McpServerRegistryService/McpRegistry.ResolveTool, McpServerRegistryService/McpRegistry.ListCapabilities; descriptors: tool-invocation-v1; adrs: ADR-0015, ADR-0022, ADR-0028; requirements: FR-05, NFR-02. Depends on: AIFACTORY-US-611, feature:component-api-gateway-template, feature:component-extensions-ai, feature:tool-adapter-service, feature:mcp-server-registry-service-thin. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/reference/schemas/tool-invocation.schema.json, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/planes/capability-tools/tools/services/tool-executor-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope that names ToolAdapterService and the fake of the executor, when `ToolAdapterService/ToolExecutor.Invoke` is called through the gateway with a `tool-invocation-v1` document that holds its idempotency key and the optional members `fencingToken` and `toolVersion`, then the message reaches the fake byte for byte with the token, the `tenant-id` and the project metadata of the caller unchanged, every message of the stream and the receipt are relayed in order and unchanged, the deadline and a cancellation of the caller reach the fake, and the gateway has stored nothing (FR-05, ADR-0015).",
        "AC2: Given a call without a token, a workload token without the service scope, and a user token on an internal gRPC route, when `ToolAdapterService/ToolExecutor.Invoke`, `ToolAdapterService/ToolExecutor.Validate`, `ToolAdapterService/ToolExecutor.Interrupt` or `McpServerRegistryService/McpRegistry.ResolveTool` is called through the gateway, then the first is refused with UNAUTHENTICATED and the other two with PERMISSION_DENIED and no fronted service is called; a NOT_FOUND of the fronted service for a resource of another tenant returns unchanged (ADR-0015).",
        "AC3: Given a gateway replica stopped while a stream of `ToolAdapterService/ToolExecutor.Invoke` is open, when the caller repeats the call under the same idempotency key through another replica, then the fake of the executor receives the same key and answers with the one invocation, the gateway replays nothing, and a stopped executor fails the route with UNAVAILABLE while the routes of the registry keep serving (ADR-0028, model/services/tools-mcp/ToolExecutorHost.yaml).",
        "AC4: Given `Tools:Mcp:AuthorizationEnabled` at its default, when a request arrives on the MCP route without a token, with a token of another audience and with a token that carries `factory.tools.invoke`, then the first two are refused at the gateway with 401 and never reach the executor and the third is forwarded with the token unchanged over streamable HTTP, and the answer of the endpoint returns unchanged, also its refusal of a call that is bound to no run; given the option set to false, when the gateway starts, then startup fails with the option named, which is the behaviour of this delivery until the owner decides how the option relates to the exception recorded per server, because model/services/tools-mcp/ToolExecutorHost.yaml does not forbid the value (ADR-0022, model/backlog/pbis/component-extensions/component-mcp.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2452",
        "AIFACTORY-TASK-2453",
        "AIFACTORY-TASK-2454"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6906,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolExecutorHost",
          "ToolAdapterService",
          "McpServerRegistryService"
        ],
        "apis": [
          "ToolAdapterService/ToolExecutor.Invoke",
          "ToolAdapterService/ToolExecutor.Validate",
          "ToolAdapterService/ToolExecutor.Interrupt",
          "McpServerRegistryService/McpRegistry.ResolveTool",
          "McpServerRegistryService/McpRegistry.ListCapabilities"
        ],
        "descriptors": [
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-611",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:tool-adapter-service",
        "feature:mcp-server-registry-service-thin"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-615]",
      "number": 615
    },
    {
      "id": "AIFACTORY-TASK-2452",
      "type": "task",
      "parent": "AIFACTORY-US-615",
      "title": "Internal gRPC routes with the service scope of each method and the pass-through of the Invoke stream",
      "sequence": "05.03.06.01",
      "description": "Internal gRPC routes with the service scope of each method and the pass-through of the Invoke stream. Expected output: Each of the five gRPC routes names the service scope a workload token must hold; for a token that holds it the tenant-id and the project metadata of the caller are forwarded unchanged (ADR-0015 amendment D114), a call without a token is answered UNAUTHENTICATED and a token without the scope PERMISSION_DENIED before any call; the route of ToolExecutor.Invoke relays the server stream message by message and unchanged, propagates deadline and cancellation, buffers and stores nothing, and fails with UNAVAILABLE when the executor does not answer.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Each of the five gRPC routes names the service scope a workload token must hold; for a token that holds it the tenant-id and the project metadata of the caller are forwarded unchanged (ADR-0015 amendment D114), a call without a token is answered UNAUTHENTICATED and a token without the scope PERMISSION_DENIED before any call; the route of ToolExecutor.Invoke relays the server stream message by message and unchanged, propagates deadline and cancellation, buffers and stores nothing, and fails with UNAVAILABLE when the executor does not answer."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6906,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2452]",
      "number": 2452
    },
    {
      "id": "AIFACTORY-TASK-2453",
      "type": "task",
      "parent": "AIFACTORY-US-615",
      "title": "MCP route to the hosted endpoint of the executor with authorization required at the gateway",
      "sequence": "05.03.06.02",
      "description": "MCP route to the hosted endpoint of the executor with authorization required at the gateway. Expected output: The gateway routes the streamable HTTP transport of Tools:Mcp:Transports to the MCP endpoint that ToolAdapterService hosts, requires a valid token whose audience is this gateway and whose scope carries factory.tools.invoke while Tools:Mcp:AuthorizationEnabled is true, answers 401 with the protected-resource challenge otherwise, forwards the token unchanged, returns the answer of the endpoint unchanged, also its refusal of a call that is bound to no run, because in I1 the endpoint serves only calls bound to a run, a step and an attempt (D121), fails startup when the option is false as the behaviour of this delivery until the owner decides how the option relates to the exception recorded per server, accepts the value stdio-bridge without routing anything for it, and records connectsoft.factory.tools.host.requests with the transport of each call.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The gateway routes the streamable HTTP transport of Tools:Mcp:Transports to the MCP endpoint that ToolAdapterService hosts, requires a valid token whose audience is this gateway and whose scope carries factory.tools.invoke while Tools:Mcp:AuthorizationEnabled is true, answers 401 with the protected-resource challenge otherwise, forwards the token unchanged, returns the answer of the endpoint unchanged, also its refusal of a call that is bound to no run, because in I1 the endpoint serves only calls bound to a run, a step and an attempt (D121), fails startup when the option is false as the behaviour of this delivery until the owner decides how the option relates to the exception recorded per server, accepts the value stdio-bridge without routing anything for it, and records connectsoft.factory.tools.host.requests with the transport of each call."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6906,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2453]",
      "number": 2453
    },
    {
      "id": "AIFACTORY-TASK-2454",
      "type": "task",
      "parent": "AIFACTORY-US-615",
      "title": "Verify the two routes of a tool call through the acceptance suite",
      "sequence": "05.03.06.03",
      "description": "Verify the two routes of a tool call through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ToolCallRoutes\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-615 against the fake of the executor: the request message of ToolAdapterService/ToolExecutor.Invoke, a tool-invocation-v1 document with its optional members fencingToken and toolVersion, received by the fake byte for byte, the relayed stream with its metadata, deadline and cancellation, the three gRPC refusals, a replica stopped during a stream, a stopped executor, the MCP route with and without a valid token, the refusal of the fake endpoint for a call bound to no run returned unchanged and the failing startup with authorization switched off.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ToolCallRoutes\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-615 against the fake of the executor: the request message of ToolAdapterService/ToolExecutor.Invoke, a tool-invocation-v1 document with its optional members fencingToken and toolVersion, received by the fake byte for byte, the relayed stream with its metadata, deadline and cancellation, the three gRPC refusals, a replica stopped during a stream, a stopped executor, the MCP route with and without a valid token, the refusal of the fake endpoint for a call bound to no run returned unchanged and the failing startup with authorization switched off."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6906,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2454]",
      "number": 2454
    },
    {
      "id": "AIFACTORY-US-616",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "Health, capabilities, limits and telemetry of the tools gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "05.03.07",
      "description": "As an operator, I want to see whether the gateway, the identity platform, the executor and the registry answer, and what the executor can do, so that I can tell a failing service from a failing gateway and act on the right one. An operator, the Studio and the probes of the cluster read the state of the gateway through its two own operations. `ToolExecutorHost/ToolsHealth` reports liveness and readiness of the gateway with the aggregated health of the two services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. What the gateway does when it is unreachable is decided (D117, ADR-0015 amendment). While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe `ToolsHealth` answers 200 with the health degraded and a detail that names the identity platform as unreachable. The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, `ToolsHealth` answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency that degrades: when the executor or the registry does not answer, health reports it as unavailable in the detail, its routes answer 503 with a retry hint, and the routes of the other service keep serving. `ToolExecutorHost/ToolsCapabilities` returns the capabilities of the executor to a caller whose scope carries `factory.meta.read`: the transports, that is MCP over streamable HTTP, the stdio bridge and native, the sandbox kinds available and the descriptor schema versions the executor supports. The transports come from `Tools:Mcp:Transports`. The model names no operation of a fronted service that returns the sandbox kinds or the schema versions, and a gateway invents no response, so in this delivery the gateway serves both from its deployment configuration, set to the sandbox kinds of the one pool of the thin ExecutionCapacityService and to `tool-invocation-v1`, and the missing source is reported to the owner. A call without a token is answered 401 and a token without the scope 403. A call that exceeds the rate limit configured for its route is refused with 429 through the pinned rate-limiting library. The gateway emits `connectsoft.factory.tools.host.requests` with the dimensions service, transport and status and `connectsoft.factory.tools.host.request_duration` with service and route, the latency including the fronted service, and carries the trace context to the service; its logs never contain a token, a tool argument, a tool result or a payload (ADR-0019). A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed and callers repeat their call with their idempotency key. The roles of the gateway are Operator, Platform admin and Observer. Kind: behavior. Traces: services: ToolExecutorHost; apis: ToolExecutorHost/ToolsHealth, ToolExecutorHost/ToolsCapabilities; adrs: ADR-0015, ADR-0017, ADR-0019, ADR-0028; requirements: NFR-10, NFR-17; scenarios: SCN-ToolExecutorHost-001, SCN-ToolExecutorHost-002. Depends on: AIFACTORY-US-611, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, docs/planes/capability-tools/tools/services/tool-executor-host/index.md#metrics-and-observability, docs/planes/capability-tools/tools/services/tool-executor-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and both fronted services reachable, when `ToolExecutorHost/ToolsHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of ToolAdapterService, of McpServerRegistryService and of the identity platform (SCN-ToolExecutorHost-001, NFR-17).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `ToolExecutorHost/ToolsHealth` is probed, then tokens that were already issued are validated with the cached key, readiness stays ready so the replica stays in rotation, and from the first failed probe health answers 200 with the health degraded and a detail that names the identity platform as unreachable, while liveness keeps answering 200; given no valid key remains, when calls arrive, then they are refused, readiness is unready so the replica leaves rotation, `ToolExecutorHost/ToolsHealth` answers 503 with a problem response that names the identity platform and no state changes (SCN-ToolExecutorHost-001, model/services/tools-mcp/ToolExecutorHost.yaml).",
        "AC3: Given the registry does not answer, when `ToolExecutorHost/ToolsHealth` and the routes are called, then health reports that service as unavailable in its detail and still answers 200, its routes answer 503 with a retry hint that names the service and the routes of the executor keep serving (SCN-ToolExecutorHost-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read`, when `ToolExecutorHost/ToolsCapabilities` is called, then the response is 200 with the transports of `Tools:Mcp:Transports` and native, the configured sandbox kinds and the supported descriptor schema versions; a call without a token is answered 401 and a token without the scope 403, and nothing is written (SCN-ToolExecutorHost-002).",
        "AC5: Given routed REST, gRPC and MCP calls and a call above the rate limit of its route, when the metrics and logs are read, then `connectsoft.factory.tools.host.requests` counts every call by service, transport and status, the call above the limit was refused with 429, `connectsoft.factory.tools.host.request_duration` holds the latency by service and route, and no log record holds a token, a tool argument or a tool result (ADR-0019, model/services/tools-mcp/ToolExecutorHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#metrics-and-observability",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-085",
        "AIFACTORY-TASK-2455",
        "AIFACTORY-TASK-2456",
        "AIFACTORY-TASK-2457"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6907,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolExecutorHost"
        ],
        "apis": [
          "ToolExecutorHost/ToolsHealth",
          "ToolExecutorHost/ToolsCapabilities"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-10",
          "NFR-17"
        ],
        "scenarios": [
          "SCN-ToolExecutorHost-001",
          "SCN-ToolExecutorHost-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-611",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#metrics-and-observability",
        "docs/planes/capability-tools/tools/services/tool-executor-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-616]",
      "number": 616
    },
    {
      "id": "AIFACTORY-TASK-085",
      "type": "task",
      "parent": "AIFACTORY-US-616",
      "title": "Health, capabilities and telemetry of the gateway",
      "sequence": "05.03.07.01",
      "description": "Health, capabilities and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the capabilities operation lists the transports of Tools:Mcp:Transports and native, the configured sandbox kinds and the supported descriptor schema versions under factory.meta.read; every routed call records connectsoft.factory.tools.host.requests and connectsoft.factory.tools.host.request_duration with their modelled dimensions and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the capabilities operation lists the transports of Tools:Mcp:Transports and native, the configured sandbox kinds and the supported descriptor schema versions under factory.meta.read; every routed call records connectsoft.factory.tools.host.requests and connectsoft.factory.tools.host.request_duration with their modelled dimensions and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6907,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-085]",
      "number": 85
    },
    {
      "id": "AIFACTORY-TASK-2455",
      "type": "task",
      "parent": "AIFACTORY-US-616",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "05.03.07.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it; the limit of the route of ToolExecutor.Invoke counts calls and never the messages of a stream, and a refused call reaches no fronted service and is counted in connectsoft.factory.tools.host.requests with its status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it; the limit of the route of ToolExecutor.Invoke counts calls and never the messages of a stream, and a refused call reaches no fronted service and is counted in connectsoft.factory.tools.host.requests with its status."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6907,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2455]",
      "number": 2455
    },
    {
      "id": "AIFACTORY-TASK-2456",
      "type": "task",
      "parent": "AIFACTORY-US-616",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "05.03.07.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/tools-mcp/ToolExecutorHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117, NFR-17); the entry of the replica crash states that a caller of ToolExecutor.Invoke repeats the call under its idempotency key.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/tools-mcp/ToolExecutorHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117, NFR-17); the entry of the replica crash states that a caller of ToolExecutor.Invoke repeats the call under its idempotency key."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6907,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2456]",
      "number": 2456
    },
    {
      "id": "AIFACTORY-TASK-2457",
      "type": "task",
      "parent": "AIFACTORY-US-616",
      "title": "Verify health, capabilities, limits and telemetry through the acceptance suite",
      "sequence": "05.03.07.04",
      "description": "Verify health, capabilities, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolExecutorHost-001|Scenario=SCN-ToolExecutorHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-616 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, the capabilities document, a call above its limit and the log scan for tokens and payloads.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ToolExecutorHost-001|Scenario=SCN-ToolExecutorHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-616 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, the capabilities document, a call above its limit and the log scan for tokens and payloads."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6907,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2457]",
      "number": 2457
    },
    {
      "id": "AIFACTORY-US-1509",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-030",
      "title": "ToolExecutorHost starts the read-tool component of the repository intelligence inside the sandbox of the run over the workspace mounted read-only",
      "sequence": "05.03.08",
      "description": "As an operator, I want the seven repository read tools of a run to execute inside the sandbox of that run, so that no deployed service reads a workspace from outside a sandbox before the complete repository intelligence of I5. In I1 the seven repository read tools (`list-files`, `search-text`, `search-symbols`, `find-references`, `read-range`, `get-dependencies` and `get-git-diff`) are not reached by a call to a deployed RepositoryIntelligenceService (decision D125). They execute inside the sandbox of the run, where the sandbox lease mounts the workspace of the run read-only, and ToolExecutorHost runs there the read-tool handlers of the RepositoryIntelligenceService repository. The pipeline of that repository publishes the handlers as a tool component, a package beside the container image of the service, which answers the seven methods of `RepositoryIntelligence` with the same request and reply messages and the same golden argument shapes as the complete service (feature `repository-intelligence-service-thin`). This PBI fixes the form in which the host takes that component. The host references the package at one pinned version as a library dependency, the dependency of kind library that model/services/tools-mcp/ToolExecutorHost.yaml records as required and fail-fast: a host whose pinned component cannot be loaded does not turn ready. When ToolAdapterService has leased the sandbox of a read tool (feature `tool-adapter-service`), the host starts the component inside that sandbox and nowhere else; the component reads only the workspace the lease mounts, through the `workspaceRef` of the lease, holds no secret, opens no network connection and references no store and no messaging profile, so it runs with the network of the sandbox closed. The gateway process itself still runs no tool and keeps no state, and the executor still decides the policy, leases the sandbox, sanitizes the result and writes the receipt; the component returns its reply to the executor, and a read tool that is not answered ends Failed with the failure class transient in the executor. Arguments that do not match the golden shape of the method are refused by the component with INVALID_ARGUMENT, and a request whose invocation names another workspace than the `workspaceRef` of the lease is refused the same way. The component version is pinned with the other packages of the host and changes only with a new version of the host, so the component in the sandbox and the deployed service of I5 answer the same contract without a contract change. How the executor addresses the component once the host has started it in the leased sandbox is not stated by the model and is reported to the owner; this delivery proves the start, the mount and the contract against a sandbox fixture. Kind: behavior. Traces: services: ToolExecutorHost, RepositoryIntelligenceService, ToolAdapterService; apis: RepositoryIntelligenceService/RepositoryIntelligence.ListFiles, RepositoryIntelligenceService/RepositoryIntelligence.SearchText, RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols, RepositoryIntelligenceService/RepositoryIntelligence.FindReferences, RepositoryIntelligenceService/RepositoryIntelligence.ReadRange, RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies, RepositoryIntelligenceService/RepositoryIntelligence.GetHistory; tools: list-files, search-text, search-symbols, find-references, read-range, get-dependencies, get-git-diff; adrs: ADR-0022, ADR-0028; requirements: FR-05, XL-03. Depends on: feature:repository-intelligence-service-thin, feature:component-api-gateway-template. Sources: model/services/tools-mcp/ToolExecutorHost.yaml, model/services/knowledge/RepositoryIntelligenceService.yaml, model/backlog/pbis/knowledge/repository-intelligence-service-thin.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the host built with the pinned package of the read-tool component, when it starts, then the component is loaded at the pinned version and readiness turns ready; given the package cannot be loaded, then readiness stays unready and no route is served as ready (model/services/tools-mcp/ToolExecutorHost.yaml, model/backlog/pbis/knowledge/repository-intelligence-service-thin.yaml).",
        "AC2: Given a sandbox fixture leased for a read tool with the workspace of a run mounted read-only, when the host starts the component in it and `RepositoryIntelligenceService/RepositoryIntelligence.ListFiles`, `RepositoryIntelligenceService/RepositoryIntelligence.SearchText` and `RepositoryIntelligenceService/RepositoryIntelligence.ReadRange` are called with arguments in their golden shapes, then each answers from the mounted workspace only, a write to the workspace and a network connection from the component fail, and a path outside the workspace is refused (model/services/knowledge/RepositoryIntelligenceService.yaml).",
        "AC3: Given the component started in the sandbox fixture, when `RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols`, `RepositoryIntelligenceService/RepositoryIntelligence.FindReferences`, `RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies` and `RepositoryIntelligenceService/RepositoryIntelligence.GetHistory` are called with arguments that do not match their shape or with an invocation that names another workspace than the `workspaceRef` of the lease, then each is refused with INVALID_ARGUMENT and nothing is read (docs/reference/schemas/tool-invocation.schema.json).",
        "AC4: Given the architecture test of the host, when it runs, then the component is started only inside a leased sandbox, the gateway process executes no tool, holds no state and evaluates no policy, and no deployed instance of RepositoryIntelligenceService is called for a read tool (ADR-0028, ADR-0022, model/services/tools-mcp/ToolExecutorHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/backlog/pbis/knowledge/repository-intelligence-service-thin.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6121",
        "AIFACTORY-TASK-6122",
        "AIFACTORY-TASK-6123",
        "AIFACTORY-TASK-6124"
      ],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6908,
      "kind": "behavior",
      "traces": {
        "services": [
          "ToolExecutorHost",
          "RepositoryIntelligenceService",
          "ToolAdapterService"
        ],
        "apis": [
          "RepositoryIntelligenceService/RepositoryIntelligence.ListFiles",
          "RepositoryIntelligenceService/RepositoryIntelligence.SearchText",
          "RepositoryIntelligenceService/RepositoryIntelligence.SearchSymbols",
          "RepositoryIntelligenceService/RepositoryIntelligence.FindReferences",
          "RepositoryIntelligenceService/RepositoryIntelligence.ReadRange",
          "RepositoryIntelligenceService/RepositoryIntelligence.GetDependencies",
          "RepositoryIntelligenceService/RepositoryIntelligence.GetHistory"
        ],
        "tools": [
          "list-files",
          "search-text",
          "search-symbols",
          "find-references",
          "read-range",
          "get-dependencies",
          "get-git-diff"
        ],
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "XL-03"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-intelligence-service-thin",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/backlog/pbis/knowledge/repository-intelligence-service-thin.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1509]",
      "number": 1509
    },
    {
      "id": "AIFACTORY-TASK-6121",
      "type": "task",
      "parent": "AIFACTORY-US-1509",
      "title": "Pinned reference of the read-tool component package and its load check at start",
      "sequence": "05.03.08.01",
      "description": "Pinned reference of the read-tool component package and its load check at start. Expected output: The host references the package of the read-tool component that the pipeline of ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService publishes, at one pinned version beside the other packages of the host; a readiness check reports unready while the component cannot be loaded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The host references the package of the read-tool component that the pipeline of ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService publishes, at one pinned version beside the other packages of the host; a readiness check reports unready while the component cannot be loaded."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6908,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6121]",
      "number": 6121
    },
    {
      "id": "AIFACTORY-TASK-6122",
      "type": "task",
      "parent": "AIFACTORY-US-1509",
      "title": "Start of the read-tool component inside the leased sandbox of a read tool over the workspace mounted read-only",
      "sequence": "05.03.08.02",
      "description": "Start of the read-tool component inside the leased sandbox of a read tool over the workspace mounted read-only. Expected output: The host starts the component only inside the sandbox that ToolAdapterService leased for a read tool, with the workspace of the lease mounted read-only, the network of the sandbox closed and no secret, store or messaging profile; the component answers the seven methods of RepositoryIntelligence there and returns its reply to the executor, and the gateway process runs no tool and keeps no state.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The host starts the component only inside the sandbox that ToolAdapterService leased for a read tool, with the workspace of the lease mounted read-only, the network of the sandbox closed and no secret, store or messaging profile; the component answers the seven methods of RepositoryIntelligence there and returns its reply to the executor, and the gateway process runs no tool and keeps no state."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6908,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6122]",
      "number": 6122
    },
    {
      "id": "AIFACTORY-TASK-6123",
      "type": "task",
      "parent": "AIFACTORY-US-1509",
      "title": "Sandbox fixture with a workspace mounted read-only for the acceptance suite of the host",
      "sequence": "05.03.08.03",
      "description": "Sandbox fixture with a workspace mounted read-only for the acceptance suite of the host. Expected output: The acceptance suite holds a sandbox fixture that mounts a workspace of a fixture run read-only with a closed network, a lease document with its workspaceRef, golden arguments of the seven tool methods and arguments that do not match them, and an invocation that names another workspace.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a sandbox fixture that mounts a workspace of a fixture run read-only with a closed network, a lease document with its workspaceRef, golden arguments of the seven tool methods and arguments that do not match them, and an invocation that names another workspace."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6908,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6123]",
      "number": 6123
    },
    {
      "id": "AIFACTORY-TASK-6124",
      "type": "task",
      "parent": "AIFACTORY-US-1509",
      "title": "Verify the read-tool component in the sandbox through the acceptance suite",
      "sequence": "05.03.08.04",
      "description": "Verify the read-tool component in the sandbox through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReadToolComponent\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1509: the load check with a missing package, the seven methods answered from the mounted workspace of the sandbox fixture, the refused write and network connection, the refused mismatched shapes and foreign workspace, and the architecture test that the component starts only inside a leased sandbox.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReadToolComponent\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1509: the load check with a missing package, the seven methods answered from the mounted workspace of the sandbox fixture, the refused write and network connection, the refused mismatched shapes and foreign workspace, and the architecture test that the component starts only inside a leased sandbox."
      ],
      "sourceArtifacts": [
        "model/services/tools-mcp/ToolExecutorHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 69,
      "phase": "factory",
      "stackRank": 6908,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6124]",
      "number": 6124
    },
    {
      "id": "AIFACTORY-FEAT-031",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-005",
      "title": "McpServerRegistryService: complete delivery",
      "sequence": "05.04",
      "description": "McpServerRegistryService is the service of bounded context BC-08 (Tool Execution). Registry of MCP servers the Factory consumes or exposes — transport, endpoint or connection, authentication (on by default), governance policy, discovered tools, resources and prompts bound to tool descriptors and knowledge sources, handshake health and the ModelOps-like lifecycle from registration to retirement (BC-08, ADR-0022). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.McpServerRegistryService. Delivers: McpServerRegistryService (complete). Depends on: AIFACTORY-FEAT-028. Increment I5: Knowledge and connections. Build order 148 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/tools-mcp/McpServerRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:tools-mcp",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 148,
      "phase": "factory",
      "stackRank": 14800,
      "titlePrefix": "[AIFACTORY-FEAT-031]",
      "number": 31
    },
    {
      "id": "AIFACTORY-EPIC-006",
      "type": "epic",
      "parent": null,
      "title": "Integration Platform (PF-06)",
      "sequence": "06",
      "description": "Everything that builds the Integration Platform platform (PF-06): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Tenant connections and credential references, connectors to external systems, webhook ingress. Done when: Every service of the platform has its complete delivery accepted (ConnectorRegistryService, IntegrationHost, IntegrationService, WebhookGatewayService), the platform gateway routes them under a trusted scope, and the outcome verification of I5 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (ConnectorRegistryService, IntegrationHost, IntegrationService, WebhookGatewayService), the platform gateway routes them under a trusted scope, and the outcome verification of I5 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-032",
        "AIFACTORY-FEAT-033",
        "AIFACTORY-FEAT-034",
        "AIFACTORY-FEAT-188",
        "AIFACTORY-FEAT-035",
        "AIFACTORY-FEAT-036",
        "AIFACTORY-FEAT-037"
      ],
      "stackRank": 6999,
      "titlePrefix": "[AIFACTORY-EPIC-006]",
      "number": 6
    },
    {
      "id": "AIFACTORY-FEAT-032",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-006",
      "title": "ConnectorRegistryService: thin delivery for the first outcome",
      "sequence": "06.01",
      "description": "ConnectorRegistryService is the service of bounded context BC-17 (Connectors & Webhooks). Connector descriptors (capability interfaces, retry and rate-limit profiles, webhook schemes, configuration forms) with provider certification, subscriptions to inbound events, verified inbound deliveries and outbound deliveries with receipts; first-party clients (Azure DevOps, GitHub, Deputy, Braze, Bill, Twilio, Israel019, ACS, GA, Meta) are adapters behind descriptors (BC-17). In this increment it is delivered thin: The Azure DevOps connector for template feeds and for opening the change proposal. Its own repository is ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService. Delivers: ConnectorRegistryService (thin: The Azure DevOps connector for template feeds and for opening the change proposal.). Increment I1: Generate a microservice. Build order 70 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-066",
        "AIFACTORY-US-1001",
        "AIFACTORY-US-1002",
        "AIFACTORY-US-1003"
      ],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7000,
      "titlePrefix": "[AIFACTORY-FEAT-032]",
      "number": 32
    },
    {
      "id": "AIFACTORY-US-066",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-032",
      "title": "ConnectorRegistryService answers the chain with its thin contract",
      "sequence": "06.01.01",
      "description": "As a platform admin, I want ConnectorRegistryService to hold the Azure DevOps connector, certified and active, and to resolve its capabilities for the first-outcome chain, so that template feeds are read through one governed connector and the change proposal is opened only once that connector is certified and announced. This is the integration PBI of the thin delivery. The thin scope stated in model/backlog/features/integration.yaml is the Azure DevOps connector for template feeds and for opening the change proposal, and the delivery holds exactly that: one `ConnectorDescriptor` of provider Azure DevOps, written in state Draft from the Azure DevOps adapter the build carries and listed through `ListConnectors` (AIFACTORY-US-1001), certified against a sandbox connection and activated with `ConnectorActivated` through `CertifyConnector` (AIFACTORY-US-1002), and the internal gRPC method `Connectors.ResolveCapability`, which resolves a capability interface of that connector to its adapter and to the connection of the forwarded scope through IntegrationService (AIFACTORY-US-1003). TemplateRegistryService is the only caller of that method in I1: a discovery pass of the platform tenant resolves the repository and package feed capabilities through it, under the template-feed project of the platform tenant, to read template sources and feeds. For the change proposal the thin registry contributes the certified Active Azure DevOps descriptor, announced by `ConnectorActivated`, which ToolAdapterService consumes (ActivateDescriptors); ToolAdapterService opens the proposal through the connection that `IntegrationService/Connections.Resolve` returns for the project, with a credential from the Secret Broker, and does not call `Connectors.ResolveCapability`; the tool opens the pull request itself and records it through `Pipelines.RecordProposal` of PipelineExecutionService (D135). Nothing else is served. The chain calls no tool of class external: its tools are read, sandbox or shared-write, and `propose-change-set` is shared-write, so `Connectors.Deliver`, which the model gives to external-class tools, is not needed before I5. `CreateSubscription` and `ListDeliveries` for Azure DevOps inbound subscriptions, the aggregates `Subscription` and `Delivery` with the tables `Subscriptions` and `Deliveries`, the events `ConnectorSubscriptionChanged` and `DeliveryReceived`, the worker `InboundDispatcher` with the handler `RecordAndDispatch` of `InboundDeliveryVerified`, and the four reads `Connectors.ReadPipelineRun`, `Connectors.ReadPullRequest`, `Connectors.ReadPackageFeed` and `Connectors.ReadContainerRegistry` arrive in I2 with feature `connector-registry-service-deliveries` (D135); `ReplayDelivery`, `Connectors.Deliver`, the dispatch of a delivery to its target, the events `ConnectorDeprecated`, `DeliveryDispatched`, `DeliveryFailed` and `DeliveryReplayed`, the worker `OutboundDeliveryRetrier`, the handler `PauseOnRevocation` of `ConnectionStateChanged` and the other providers arrive with feature `connector-registry-service-complete` in I5; the handler of `DeletionOrderIssued` is built in I4 with RetentionResidencyService and is not registered here. The repository ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService is created and scaffolded in I0 by AIFACTORY-TASK-086 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; it was scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`, consumed by their pinned versions), so token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again. The messaging profile is the Orleans profile under the service name `connector-registry`; the service writes the run event envelope of the contracts package through the Orleans outbox in the transaction of its command, for `ConnectorActivated` and for the audit evidence event `AuditEvidenceSubmitted` on the topic `audit.evidence.v1.evidence-submitted` of the pinned audit library, and the thin delivery registers no consumed event. A user token reaches the service with the audience of its own gateway, IntegrationHost, which the service accepts (ADR-0015 amendment D117); a workload token carries service scopes and no tenant claim, and the service reads a forwarded tenant and project only under the service scope that names it (D114). The service holds no credential: it reaches a credential only by reference through SecretBrokerService, and no secret value reaches telemetry, an event, an artifact, a log record or a reply. Tenant and project are on metrics by default and run, step and attempt on activities and log records; no stored content reaches telemetry (ADR-0019). The REST operations are public routes of the IntegrationHost gateway, delivered in I1 like the other gateways (D127, D129), and the delivery builds no direct public route; a Platform admin of the platform tenant certifies the connector on a deployed I1 instance by the provisioning runbook of AIFACTORY-TASK-4069 through that gateway, after the connection of the sandbox project is provisioned by the runbook of IntegrationService. Kind: behavior. Traces: services: ConnectorRegistryService; aggregates: ConnectorRegistryService/ConnectorDescriptor; apis: ConnectorRegistryService/ListConnectors, ConnectorRegistryService/CertifyConnector, ConnectorRegistryService/Connectors.ResolveCapability; events: ConnectorRegistryService/ConnectorActivated; descriptors: run-event-envelope-v1, audit-evidence-v1, execution-scope-v1, tool-invocation-v1; adrs: ADR-0012, ADR-0015, ADR-0019, ADR-0022, ADR-0028; requirements: FR-05, NFR-05. Depends on: AIFACTORY-US-1001, AIFACTORY-US-1002, AIFACTORY-US-1003, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:component-audit-factory-evidence, feature:component-observability-factory-conventions. Sources: model/services/integration/ConnectorRegistryService.yaml, model/backlog/features/integration.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService created and scaffolded in I0 by AIFACTORY-TASK-086 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService --UseFactoryProfile true` from the pinned template package, when its pipeline runs with the work of this feature, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/integration/ConnectorRegistryService.yaml).",
        "AC2: Given the service descriptor of the thin delivery, when the contract test of the Factory profile compares it with the hosted surface, then exactly `ConnectorRegistryService/ListConnectors`, `ConnectorRegistryService/CertifyConnector` and `ConnectorRegistryService/Connectors.ResolveCapability` are hosted, as AIFACTORY-US-1001 to AIFACTORY-US-1003 prove one by one, a path of an operation outside the thin scope stated in model/backlog/features/integration.yaml answers 404 over REST and UNIMPLEMENTED over gRPC, and the test fails when such an operation appears (ADR-0022).",
        "AC3: Given the `connector-registry` messaging profile, when its registration is inspected and a certification is committed, then the outbox publishes `ConnectorRegistryService/ConnectorActivated` and the audit evidence event under the run event envelope of the pinned contracts package in the transaction of the command, no consumed event is registered, the handler of `DeletionOrderIssued` included, and no other event of the model is declared (ADR-0012, docs/reference/schemas/run-event-envelope.schema.json).",
        "AC4: Given a call without a token, without a workload identity or without the scope of the operation, or a workload call that forwards no tenant, when it reaches one of the three operations, then it is refused before any handler runs and nothing is read (ADR-0015); given the service starts, when liveness and readiness are probed, then liveness answers and readiness is unready until `connector-registry-sql` is migrated and the identity authority is reachable; given the captured logs, activities and metrics of the acceptance suite, then none holds a token, a credential, a credential reference or a payload (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/backlog/features/integration.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-087",
        "AIFACTORY-TASK-088",
        "AIFACTORY-TASK-4069",
        "AIFACTORY-TASK-757"
      ],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7001,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "ConnectorRegistryService/ConnectorDescriptor"
        ],
        "apis": [
          "ConnectorRegistryService/ListConnectors",
          "ConnectorRegistryService/CertifyConnector",
          "ConnectorRegistryService/Connectors.ResolveCapability"
        ],
        "events": [
          "ConnectorRegistryService/ConnectorActivated"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1",
          "execution-scope-v1",
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "NFR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1001",
        "AIFACTORY-US-1002",
        "AIFACTORY-US-1003",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/backlog/features/integration.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-066]",
      "number": 66
    },
    {
      "id": "AIFACTORY-TASK-087",
      "type": "task",
      "parent": "AIFACTORY-US-066",
      "title": "Host the thin surface: three operations behind scope policies, the messaging profile with one published event and the deployment values",
      "sequence": "06.01.01.01",
      "description": "Host the thin surface: three operations behind scope policies, the messaging profile with one published event and the deployment values. Expected output: ListConnectors, CertifyConnector and Connectors.ResolveCapability are hosted with the scope policies of the Factory profile; the connector-registry messaging profile publishes ConnectorActivated and the audit evidence event under the run event envelope of the pinned contracts package and registers no consumed event; the deployment manifest states the replica range 2 to 8, the probes, the base addresses of IntegrationService, SecretBrokerService and ArtifactService, the secret reference messaging-transport by name and never by value, Integration:Adapters:Enabled set to azure-devops and Integration:Connectors:DefaultRetry at its modelled default; the metrics of model/services/integration/ConnectorRegistryService.yaml are registered with their modelled dimensions through the pinned observability library.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ListConnectors, CertifyConnector and Connectors.ResolveCapability are hosted with the scope policies of the Factory profile; the connector-registry messaging profile publishes ConnectorActivated and the audit evidence event under the run event envelope of the pinned contracts package and registers no consumed event; the deployment manifest states the replica range 2 to 8, the probes, the base addresses of IntegrationService, SecretBrokerService and ArtifactService, the secret reference messaging-transport by name and never by value, Integration:Adapters:Enabled set to azure-devops and Integration:Connectors:DefaultRetry at its modelled default; the metrics of model/services/integration/ConnectorRegistryService.yaml are registered with their modelled dimensions through the pinned observability library."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-087]",
      "number": 87
    },
    {
      "id": "AIFACTORY-TASK-088",
      "type": "task",
      "parent": "AIFACTORY-US-066",
      "title": "Contract of the thin surface: service descriptor, OpenAPI document of the two REST operations and proto of Connectors.ResolveCapability",
      "sequence": "06.01.01.02",
      "description": "Contract of the thin surface: service descriptor, OpenAPI document of the two REST operations and proto of Connectors.ResolveCapability. Expected output: The service descriptor file lists exactly ListConnectors (GET /factory/connectors, factory.connections.read, read), CertifyConnector (POST /factory/connectors/{connectorId}/certify, factory.connections.admin, sandbox, key-header, with a body that names only the projectId of the sandbox project and no connection, because the runner certifies against the connection that Connections.Resolve returns for that project) and Connectors.ResolveCapability (internal, no streaming, read); the OpenAPI document fixes the list and the certification request and its 202 reply; the proto fixes the provisional request and reply messages of AIFACTORY-TASK-4038; a contract test with golden files holds the shapes and compares the hosted endpoints with the descriptor file in both directions, so callers run against this service without a fake.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists exactly ListConnectors (GET /factory/connectors, factory.connections.read, read), CertifyConnector (POST /factory/connectors/{connectorId}/certify, factory.connections.admin, sandbox, key-header, with a body that names only the projectId of the sandbox project and no connection, because the runner certifies against the connection that Connections.Resolve returns for that project) and Connectors.ResolveCapability (internal, no streaming, read); the OpenAPI document fixes the list and the certification request and its 202 reply; the proto fixes the provisional request and reply messages of AIFACTORY-TASK-4038; a contract test with golden files holds the shapes and compares the hosted endpoints with the descriptor file in both directions, so callers run against this service without a fake."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7001,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-088]",
      "number": 88
    },
    {
      "id": "AIFACTORY-TASK-4069",
      "type": "task",
      "parent": "AIFACTORY-US-066",
      "title": "Provisioning runbook of the Azure DevOps connector on a deployed I1 instance, inside the cluster and without a public route",
      "sequence": "06.01.01.03",
      "description": "Provisioning runbook of the Azure DevOps connector on a deployed I1 instance, inside the cluster and without a public route. Expected output: The repository documentation holds the runbook by which a Platform admin of the platform tenant certifies the connector through the IntegrationHost gateway of I1 (D129): it calls the public route of the gateway, never the cluster-internal address of the service, with a user token of the authorization server whose one audience is IntegrationHost, the audience the service accepts (ADR-0015 amendment D117), and whose tenant is the platform tenant; its precondition is the runbook of IntegrationService, by which the connection of the sandbox project and the connection of the template-feed project are registered, verified and granted, and a secret reference of each connection registered with the Secret Broker with the purposes the callers ask; it names the one call of this service, CertifyConnector with an Idempotency-Key and the projectId of the sandbox project, and the evidence of success, ListConnectors answering 200 with the Azure DevOps descriptor in state Active with its certificationRef, and the ConnectorActivated record in the outbox; it states that the platform bundle allows a credential issuance of the purpose delivery for the service identities of ConnectorRegistryService and WebhookGatewayService, so that on a deployed I1 instance the certification credential is issued to this service, and that the same purpose asked by any other subject is denied (D139, D140), and holds no token, credential, reference value or limit.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The repository documentation holds the runbook by which a Platform admin of the platform tenant certifies the connector through the IntegrationHost gateway of I1 (D129): it calls the public route of the gateway, never the cluster-internal address of the service, with a user token of the authorization server whose one audience is IntegrationHost, the audience the service accepts (ADR-0015 amendment D117), and whose tenant is the platform tenant; its precondition is the runbook of IntegrationService, by which the connection of the sandbox project and the connection of the template-feed project are registered, verified and granted, and a secret reference of each connection registered with the Secret Broker with the purposes the callers ask; it names the one call of this service, CertifyConnector with an Idempotency-Key and the projectId of the sandbox project, and the evidence of success, ListConnectors answering 200 with the Azure DevOps descriptor in state Active with its certificationRef, and the ConnectorActivated record in the outbox; it states that the platform bundle allows a credential issuance of the purpose delivery for the service identities of ConnectorRegistryService and WebhookGatewayService, so that on a deployed I1 instance the certification credential is issued to this service, and that the same purpose asked by any other subject is denied (D139, D140), and holds no token, credential, reference value or limit."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7001,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-4069]",
      "number": 4069
    },
    {
      "id": "AIFACTORY-TASK-757",
      "type": "task",
      "parent": "AIFACTORY-US-066",
      "title": "Verify connector-registry-service-thin-contract by running the declared command",
      "sequence": "06.01.01.04",
      "description": "Verify connector-registry-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-066, that is the scaffold with the Factory profile, exactly the three hosted operations of the thin scope (SCN-ConnectorRegistryService-001, SCN-ConnectorRegistryService-002, SCN-ConnectorRegistryService-007) and the 404 and UNIMPLEMENTED of the others, the messaging registration with ConnectorActivated (SCN-ConnectorRegistryService-008) and no consumed event, the refusals before any handler, readiness that stays unready until the store is migrated and the scan of logs, activities and metrics for tokens, credentials, credential references and payloads; the runbook of AIFACTORY-TASK-4069 is present in the repository documentation.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-066, that is the scaffold with the Factory profile, exactly the three hosted operations of the thin scope (SCN-ConnectorRegistryService-001, SCN-ConnectorRegistryService-002, SCN-ConnectorRegistryService-007) and the 404 and UNIMPLEMENTED of the others, the messaging registration with ConnectorActivated (SCN-ConnectorRegistryService-008) and no consumed event, the refusals before any handler, readiness that stays unready until the store is migrated and the scan of logs, activities and metrics for tokens, credentials, credential references and payloads; the runbook of AIFACTORY-TASK-4069 is present in the repository documentation."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-757]",
      "number": 757
    },
    {
      "id": "AIFACTORY-US-1001",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-032",
      "title": "Register the Azure DevOps connector in Draft from the adapter the build carries and list the connectors a tenant may use",
      "sequence": "06.01.02",
      "description": "As a platform admin, I want the Azure DevOps connector to appear as a descriptor with its capabilities, adapter version and certification state, so that I can see which connector the Factory uses for template feeds and change proposals and whether it is certified before anything relies on it. The model names no operation that creates a `ConnectorDescriptor`; a connector is the description of an adapter the service loads (`Integration:Adapters:Enabled`). The thin delivery therefore writes the descriptor of each adapter it loads at startup. The build carries one adapter, Azure DevOps, built on the first-party Azure DevOps client library (`ext-client-libraries`), and the deployment sets `Integration:Adapters:Enabled` to `azure-devops`; a name in the option for which the build carries no adapter fails startup with the name, so no descriptor without an adapter exists. At startup the service writes, idempotently on `connectorId` and `version`, a `ConnectorDescriptor` of the platform tenant in state Draft with provider Azure DevOps, the capability interfaces the adapter implements for repositories (read a repository at a commit, push a branch and open a pull request) and for package feeds (list the versions of a package), the adapter reference with the client library and its version, the retry profile of `Integration:Connectors:DefaultRetry` where the adapter sets none, the rate-limit profile, the webhook scheme it declares and its configuration form. The model gives no value for an Azure DevOps rate limit and no option that carries one, and a limit is an owner input, so the rate-limit profile is written as an empty profile that applies no limit until the owner supplies one; no limit value is fixed in code or in the adapter, and the input is reported to the owner. A restart writes no second row, and an adapter of a new version writes a new descriptor version in Draft, because a changed adapter version re-runs certification (invariant of the model); the earlier version keeps its state. A caller whose scope carries `factory.connections.read` (Observer, Operator, Workspace admin or Platform admin) lists the connectors through `ConnectorRegistryService/ListConnectors`; the tenant comes from the validated token. The response is 200 with the descriptors of the platform tenant and of the tenant of the caller, each with `connectorId`, `version`, `provider`, capabilities, adapter reference, webhook scheme and certification state with its evidence reference; descriptors that another tenant registered never appear. On a deployed instance the list holds the one Azure DevOps descriptor. A call without a token is answered 401 and a token without the scope 403; when `connector-registry-sql` is unavailable the call fails fast with 503 and a problem response. Nothing is written by the list and no event is published. The store holds the table `ConnectorDescriptors` with its columns and keys; the tables `Subscriptions` and `Deliveries` arrive with their aggregates in I2 with feature `connector-registry-service-deliveries` (D135). The gauge `connectsoft.factory.integration.adapter_health` reports the loaded adapter and `connectsoft.factory.integration.connectors` counts descriptors by provider and state. Kind: behavior. Traces: services: ConnectorRegistryService; aggregates: ConnectorRegistryService/ConnectorDescriptor; apis: ConnectorRegistryService/ListConnectors; adrs: ADR-0015, ADR-0022; requirements: FUX-02, NFR-13; scenarios: SCN-ConnectorRegistryService-001. Relates: screens: connectors. Depends on: feature:component-base-template-factory-profile. Sources: model/services/integration/ConnectorRegistryService.yaml, model/externals.yaml, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#domain-model, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#data-model-and-storage.",
      "acceptanceCriteria": [
        "AC1: Given the deployment with `Integration:Adapters:Enabled` set to `azure-devops`, when the service starts twice, then one `ConnectorRegistryService/ConnectorDescriptor` of the platform tenant exists in state Draft with the capabilities, the adapter reference with the client library version, the retry profile of `Integration:Connectors:DefaultRetry`, an empty rate-limit profile that applies no limit, because no limit value exists in the model or in code, and the configuration form of the adapter, and the second start wrote no row; given an adapter of a new version, then a new descriptor version is written in Draft and the earlier version keeps its state; given a name in the option without an adapter in the build, then startup fails with the name (model/services/integration/ConnectorRegistryService.yaml).",
        "AC2: Given a caller with `factory.connections.read`, when `ConnectorRegistryService/ListConnectors` is called on the deployed instance, then the response is 200 with the Azure DevOps descriptor carrying `connectorId`, `version`, `provider`, capabilities, adapter reference, webhook scheme and certification state, nothing is written and no event is published (SCN-ConnectorRegistryService-001).",
        "AC3: Given fixture descriptors inserted directly into the isolated test database, one of the platform tenant and one registered by tenant A, when a caller of tenant A and a caller of tenant B call `ConnectorRegistryService/ListConnectors`, then tenant A receives both and tenant B receives only the descriptor of the platform tenant, and the list never reveals the descriptor of tenant A to tenant B (SCN-ConnectorRegistryService-001, ADR-0015).",
        "AC4: Given a call without a token, a token without `factory.connections.read`, or an unavailable `connector-registry-sql`, when `ConnectorRegistryService/ListConnectors` is called, then the answer is 401, 403 or 503 with a problem response, no partial list is returned and no state changes (SCN-ConnectorRegistryService-001)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/externals.yaml",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#domain-model",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#data-model-and-storage"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4031",
        "AIFACTORY-TASK-4032",
        "AIFACTORY-TASK-4033",
        "AIFACTORY-TASK-4034"
      ],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7002,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "ConnectorRegistryService/ConnectorDescriptor"
        ],
        "apis": [
          "ConnectorRegistryService/ListConnectors"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FUX-02",
          "NFR-13"
        ],
        "scenarios": [
          "SCN-ConnectorRegistryService-001"
        ]
      },
      "relates": {
        "screens": [
          "connectors"
        ]
      },
      "dependsOn": [
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/externals.yaml",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#domain-model",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#data-model-and-storage"
      ],
      "titlePrefix": "[AIFACTORY-US-1001]",
      "number": 1001
    },
    {
      "id": "AIFACTORY-TASK-4031",
      "type": "task",
      "parent": "AIFACTORY-US-1001",
      "title": "Migration and mappings of ConnectorDescriptors in connector-registry-sql",
      "sequence": "06.01.02.01",
      "description": "Migration and mappings of ConnectorDescriptors in connector-registry-sql. Expected output: The table ConnectorDescriptors of model/services/integration/ConnectorRegistryService.yaml exists with its columns and its key on ConnectorId and Version; the mappings carry the tenant row filter of the Factory profile and admit the rows of the platform tenant for reads; mapping tests run against an isolated test database, never a shared one; the tables Subscriptions and Deliveries are not created by this delivery.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The table ConnectorDescriptors of model/services/integration/ConnectorRegistryService.yaml exists with its columns and its key on ConnectorId and Version; the mappings carry the tenant row filter of the Factory profile and admit the rows of the platform tenant for reads; mapping tests run against an isolated test database, never a shared one; the tables Subscriptions and Deliveries are not created by this delivery."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7002,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-4031]",
      "number": 4031
    },
    {
      "id": "AIFACTORY-TASK-4032",
      "type": "task",
      "parent": "AIFACTORY-US-1001",
      "title": "Azure DevOps adapter and the Draft descriptor written at startup from Integration:Adapters:Enabled",
      "sequence": "06.01.02.02",
      "description": "Azure DevOps adapter and the Draft descriptor written at startup from Integration:Adapters:Enabled. Expected output: The adapter wraps the first-party Azure DevOps client library behind the capability interfaces for repositories and package feeds; at startup each name of Integration:Adapters:Enabled is matched with an adapter of the build and its descriptor is written in Draft for the platform tenant idempotently on connectorId and version, with the retry profile of Integration:Connectors:DefaultRetry where the adapter sets none and an empty rate-limit profile in the not-nullable column RateLimitProfileJson, which applies no limit until the owner supplies one; no limit value is fixed in the adapter or anywhere in code, and a test fails when the written profile holds a value; a name without an adapter fails startup with the name; the adapter holds no credential and receives one per call.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The adapter wraps the first-party Azure DevOps client library behind the capability interfaces for repositories and package feeds; at startup each name of Integration:Adapters:Enabled is matched with an adapter of the build and its descriptor is written in Draft for the platform tenant idempotently on connectorId and version, with the retry profile of Integration:Connectors:DefaultRetry where the adapter sets none and an empty rate-limit profile in the not-nullable column RateLimitProfileJson, which applies no limit until the owner supplies one; no limit value is fixed in the adapter or anywhere in code, and a test fails when the written profile holds a value; a name without an adapter fails startup with the name; the adapter holds no credential and receives one per call."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4032]",
      "number": 4032
    },
    {
      "id": "AIFACTORY-TASK-4033",
      "type": "task",
      "parent": "AIFACTORY-US-1001",
      "title": "ListConnectors read model over the platform tenant and the tenant of the caller",
      "sequence": "06.01.02.03",
      "description": "ListConnectors read model over the platform tenant and the tenant of the caller. Expected output: ListConnectors returns the descriptors of the platform tenant and of the trusted tenant of the caller with connectorId, version, provider, capabilities, adapter reference, webhook scheme, state and certification reference, answers 401 and 403 through the policies of the Factory profile and 503 with a problem response when the store is unavailable, and writes nothing; connectsoft.factory.integration.connectors and connectsoft.factory.integration.adapter_health record their modelled dimensions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "ListConnectors returns the descriptors of the platform tenant and of the trusted tenant of the caller with connectorId, version, provider, capabilities, adapter reference, webhook scheme, state and certification reference, answers 401 and 403 through the policies of the Factory profile and 503 with a problem response when the store is unavailable, and writes nothing; connectsoft.factory.integration.connectors and connectsoft.factory.integration.adapter_health record their modelled dimensions."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4033]",
      "number": 4033
    },
    {
      "id": "AIFACTORY-TASK-4034",
      "type": "task",
      "parent": "AIFACTORY-US-1001",
      "title": "Verify the registration and the list of the Azure DevOps connector through the acceptance suite",
      "sequence": "06.01.02.04",
      "description": "Verify the registration and the list of the Azure DevOps connector through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1001: two starts with one Draft descriptor, a new adapter version, the failing start for a name without an adapter, the list on the deployed configuration, the two-tenant fixture rows, the 401, the 403 and the 503 of an unavailable store.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1001: two starts with one Draft descriptor, a new adapter version, the failing start for a name without an adapter, the list on the deployed configuration, the two-tenant fixture rows, the 401, the 403 and the 503 of an unavailable store."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4034]",
      "number": 4034
    },
    {
      "id": "AIFACTORY-US-1002",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-032",
      "title": "Certify the Azure DevOps connector against a sandbox connection and activate it with ConnectorActivated",
      "sequence": "06.01.03",
      "description": "As a platform admin, I want to run the conformance suite of the Azure DevOps connector against a sandbox connection and have it activated only when the suite passes, so that no template feed is read and no change proposal is opened through a connector that has not proven its capabilities. A connector is Active only with certification evidence from the conformance suite (invariant of the model). A caller whose scope carries `factory.connections.admin` asks for the certification through `ConnectorRegistryService/CertifyConnector` with an `Idempotency-Key`. Who may certify follows the owner of the descriptor. A descriptor of the platform tenant is shared: every tenant reads it (AIFACTORY-US-1001), and its activation makes it usable for every tenant. CertifyConnector on a descriptor of the platform tenant is therefore admitted only for a Platform admin whose token names the platform tenant; a caller of another tenant, who can read that descriptor, is answered 403 whatever role it holds, and nothing runs, as TemplateRegistryService admits writes to rows of the platform tenant. A descriptor that a tenant registered is certified by a Workspace admin or Platform admin of that tenant, and a caller of any other tenant is answered 404 for it, the same answer as for a descriptor that does not exist (ADR-0015 amendment D113); the thin delivery writes descriptors of the platform tenant only, so on a deployed I1 instance only the first rule applies. The body names the `projectId` of the sandbox project, a project of the tenant of the descriptor whose Project grant holds the connection of a sandbox Azure DevOps organization; the route names its project in that body member, never in a header. The body names no connection: the thin scope holds one Azure DevOps connection per project, and the runner certifies against the connection that `IntegrationService/Connections.Resolve` returns for the sandbox project (AIFACTORY-US-1008), so the certified connection is always the one granted to that project. The service answers 202 with the reference of the certification and hands the request to the worker `ConformanceRunner`, one attempt, idempotent on `connectorId`, `version` and the suite version, at most two runs in parallel per connector. The runner calls `IntegrationService/Connections.Resolve` under its workload token with the forwarded tenant and sandbox project; a refusal, no-grant, not-active, degraded, ambiguous or NOT_FOUND, ends the run failed with that reason. It then exchanges the broker ticket of the reply with `SecretBrokerService/SecretBroker.Issue` for a short-lived credential of the purpose `delivery`. A certification asks the broker with the purpose `delivery` (D129); the purpose `sandbox` is not used, because the broker issues it only for a reference of kind SandboxToken and with a sandbox lease, and a certification holds no lease. The broker issues only when `delivery` is in `allowedPurposes` of the secret reference of the sandbox connection and its policy decision allows the issuance, so that reference must be registered with the purpose `delivery`. When the issuance is refused, PERMISSION_DENIED for a purpose outside `allowedPurposes` or a decision other than allow, FAILED_PRECONDITION for a revoked reference or an answer that is no decision, the run ends failed with the status and its reason, the descriptor stays Draft and only the audit evidence of the failed run is written; the service retries nothing. With the credential the runner exercises each capability interface of the descriptor against the sandbox connection, so its effect stays in the sandbox system, and stores the evidence, with the suite version, the adapter version and the result of each capability, through `ArtifactService/Artifacts.Store`. When every capability passes, the descriptor moves from Draft to Certified (`ConformanceSuitePassed`) and from Certified to Active (`Activate`) in one transaction with its `certificationRef`, the `ConnectorActivated` outbox record and the audit evidence event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted`. When a capability fails, the descriptor stays Draft, the evidence of the failure is stored and referenced, the audit evidence records the result and no `ConnectorActivated` is written. A repeated request with the same `Idempotency-Key` returns the same reference and runs nothing; a request for a version already certified under the same suite version runs nothing and points at the recorded result. A token without the scope is answered 403; a `connectorId` that does not exist, or a descriptor that another tenant registered, is answered 404, the same answer in both cases (ADR-0015 amendment D113); a body without `projectId` is answered 400. IntegrationService, SecretBrokerService and ArtifactService are required and fail-fast: when one does not answer, the run ends failed, the descriptor stays Draft, only the audit evidence of the failed run is written, and the admin asks again. The credential is used in memory for the run only and never reaches the evidence, an event, a log record or telemetry. `ConnectorActivated` carries `connectorId`, `version`, `tenantId` and `provider` under the run event envelope; StudioBff, AuditService and ToolAdapterService handle it in their own PBIs. The platform bundle allows the connection grant of the sandbox project for the Platform admin (D129), so its Project grant can be set, and allows a credential issuance, the action kind `credential-issuance`, for the purposes `tool-call` and `sandbox`, and for the purpose `delivery` that a certification asks (D129) only when the subject is the service identity of ConnectorRegistryService or WebhookGatewayService (D127, D139, AIFACTORY-US-917 of feature policy-engine-service), so on a deployed I1 instance the certification credential is issued, and the same purpose asked by any other subject is denied. The transition from Active to Deprecated has no operation in the model and arrives with the complete delivery in I5. Kind: behavior. Traces: services: ConnectorRegistryService, IntegrationService, SecretBrokerService, ArtifactService; aggregates: ConnectorRegistryService/ConnectorDescriptor; apis: ConnectorRegistryService/CertifyConnector, IntegrationService/Connections.Resolve, SecretBrokerService/SecretBroker.Issue, ArtifactService/Artifacts.Store; events: ConnectorRegistryService/ConnectorActivated; descriptors: run-event-envelope-v1, audit-evidence-v1; adrs: ADR-0012, ADR-0015, ADR-0019, ADR-0022; requirements: FR-05, FUX-02, NFR-05; scenarios: SCN-ConnectorRegistryService-002, SCN-ConnectorRegistryService-008. Relates: screens: connectors. Depends on: AIFACTORY-US-1001, feature:integration-service-thin, feature:secret-broker-service, feature:artifact-service, feature:contracts-package, feature:component-audit-factory-evidence. Sources: model/services/integration/ConnectorRegistryService.yaml, model/services/integration/IntegrationService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Draft `ConnectorRegistryService/ConnectorDescriptor` of Azure DevOps of the platform tenant and a Platform admin with `factory.connections.admin` whose token names the platform tenant, when `ConnectorRegistryService/CertifyConnector` is called with an `Idempotency-Key` and the `projectId` of the sandbox project, then the response is 202, the runner resolves the connection granted to that project through `IntegrationService/Connections.Resolve`, exchanges its broker ticket through `SecretBrokerService/SecretBroker.Issue` for a credential of the purpose `delivery`, stores the evidence through `ArtifactService/Artifacts.Store`, and on a passing suite the descriptor is Active with its `certificationRef`, the `ConnectorRegistryService/ConnectorActivated` outbox record and the audit evidence written in the same transaction (SCN-ConnectorRegistryService-002, ADR-0022).",
        "AC2: Given a suite in which one capability fails, when the runner ends, then the descriptor stays Draft, the evidence of the failure is stored and referenced, the audit evidence records the failed result and no `ConnectorRegistryService/ConnectorActivated` is written; given the same request repeated with the same `Idempotency-Key`, or a request for a version already certified under the same suite version, then the same reference is returned and nothing runs (SCN-ConnectorRegistryService-002).",
        "AC3: Given a token without the scope, a caller of another tenant than the platform tenant, Workspace admin or Platform admin, on a descriptor of the platform tenant, a descriptor that tenant B registered asked for by tenant A, a `connectorId` that does not exist, or a body without `projectId`, when the certification is asked for, then the answer is 403, 403, 404, 404 (the same for a foreign and an unknown descriptor, ADR-0015 amendment D113) or 400 with a problem response, nothing runs and no state changes; given `IntegrationService/Connections.Resolve` refusing the sandbox project, `SecretBrokerService/SecretBroker.Issue` refusing with PERMISSION_DENIED or FAILED_PRECONDITION, or IntegrationService, SecretBrokerService or ArtifactService that does not answer, when the run starts, then it ends failed with the status and reason, the descriptor stays Draft and only the audit evidence of the failed run is written (SCN-ConnectorRegistryService-002, ADR-0015).",
        "AC4: Given the certification committed, when the outbox dispatcher of the `connector-registry` profile publishes `ConnectorRegistryService/ConnectorActivated` on `connectors.connectors.v1.connector-activated`, then the event is sent under the run event envelope with `connectorId`, `version`, `tenantId` and `provider`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ConnectorRegistryService-008, ADR-0012).",
        "AC5: Given the captured evidence artifact, events, log records and activities of a certification, when they are scanned, then none holds the credential or a payload of the sandbox system, and `connectsoft.factory.integration.connectors` moved from Draft to Active for provider Azure DevOps (ADR-0019, model/services/integration/ConnectorRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4035",
        "AIFACTORY-TASK-4036",
        "AIFACTORY-TASK-4037"
      ],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7003,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "IntegrationService",
          "SecretBrokerService",
          "ArtifactService"
        ],
        "aggregates": [
          "ConnectorRegistryService/ConnectorDescriptor"
        ],
        "apis": [
          "ConnectorRegistryService/CertifyConnector",
          "IntegrationService/Connections.Resolve",
          "SecretBrokerService/SecretBroker.Issue",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ConnectorRegistryService/ConnectorActivated"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "FUX-02",
          "NFR-05"
        ],
        "scenarios": [
          "SCN-ConnectorRegistryService-002",
          "SCN-ConnectorRegistryService-008"
        ]
      },
      "relates": {
        "screens": [
          "connectors"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1001",
        "feature:integration-service-thin",
        "feature:secret-broker-service",
        "feature:artifact-service",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1002]",
      "number": 1002
    },
    {
      "id": "AIFACTORY-TASK-4035",
      "type": "task",
      "parent": "AIFACTORY-US-1002",
      "title": "CertifyConnector with its Idempotency-Key, the ConformanceRunner worker and the two transitions to Active",
      "sequence": "06.01.03.01",
      "description": "CertifyConnector with its Idempotency-Key, the ConformanceRunner worker and the two transitions to Active. Expected output: CertifyConnector validates the body, which names the projectId and no connection, admits a descriptor of the platform tenant only for a Platform admin whose token names the platform tenant and answers 403 to a caller of any other tenant, admits a descriptor a tenant registered for a Workspace admin or Platform admin of that tenant and answers 404 to a caller of another tenant, answers 202 with the reference of the certification, 400 without projectId, 403 without the scope and 404 for an unknown descriptor, and returns the same reference for a repeated key; ConformanceRunner runs once per connectorId, version and suite version, resolves the connection of the sandbox project through Connections.Resolve, exchanges the broker ticket through SecretBroker.Issue for a credential of the purpose delivery, exercises every capability interface of the descriptor, stores the evidence through Artifacts.Store and commits Draft to Certified to Active with certificationRef, the ConnectorActivated outbox record and AuditEvidenceSubmitted in one transaction, or keeps Draft with the referenced failure evidence and the audit evidence; a refusal of Connections.Resolve or SecretBroker.Issue, and an unavailable dependency, end the run failed with the descriptor in Draft and only the audit evidence of the failed run written, without a retry; the credential is never written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "CertifyConnector validates the body, which names the projectId and no connection, admits a descriptor of the platform tenant only for a Platform admin whose token names the platform tenant and answers 403 to a caller of any other tenant, admits a descriptor a tenant registered for a Workspace admin or Platform admin of that tenant and answers 404 to a caller of another tenant, answers 202 with the reference of the certification, 400 without projectId, 403 without the scope and 404 for an unknown descriptor, and returns the same reference for a repeated key; ConformanceRunner runs once per connectorId, version and suite version, resolves the connection of the sandbox project through Connections.Resolve, exchanges the broker ticket through SecretBroker.Issue for a credential of the purpose delivery, exercises every capability interface of the descriptor, stores the evidence through Artifacts.Store and commits Draft to Certified to Active with certificationRef, the ConnectorActivated outbox record and AuditEvidenceSubmitted in one transaction, or keeps Draft with the referenced failure evidence and the audit evidence; a refusal of Connections.Resolve or SecretBroker.Issue, and an unavailable dependency, end the run failed with the descriptor in Draft and only the audit evidence of the failed run written, without a retry; the credential is never written."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4035]",
      "number": 4035
    },
    {
      "id": "AIFACTORY-TASK-4036",
      "type": "task",
      "parent": "AIFACTORY-US-1002",
      "title": "Fakes of Connections.Resolve, SecretBroker.Issue, Artifacts.Store and the sandbox Azure DevOps system",
      "sequence": "06.01.03.02",
      "description": "Fakes of Connections.Resolve, SecretBroker.Issue, Artifacts.Store and the sandbox Azure DevOps system. Expected output: The acceptance suite holds fakes of IntegrationService/Connections.Resolve, which answers a granted connection with its broker ticket, no-grant, not-active and ambiguous, of SecretBrokerService/SecretBroker.Issue, which issues for the purpose delivery and refuses with PERMISSION_DENIED for a purpose outside allowedPurposes or a denying decision and with FAILED_PRECONDITION for a revoked reference, and of ArtifactService/Artifacts.Store, each of which records its calls and can be stopped, tokens of a Platform admin of the platform tenant and of a Workspace admin and a Platform admin of another tenant, fixture descriptors of the platform tenant and of tenant B inserted directly into the isolated test database, and a recording stub of the sandbox Azure DevOps system that answers each capability call and can be made to fail one capability, so the passing, the failing and the interrupted certification run without a real organization.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fakes of IntegrationService/Connections.Resolve, which answers a granted connection with its broker ticket, no-grant, not-active and ambiguous, of SecretBrokerService/SecretBroker.Issue, which issues for the purpose delivery and refuses with PERMISSION_DENIED for a purpose outside allowedPurposes or a denying decision and with FAILED_PRECONDITION for a revoked reference, and of ArtifactService/Artifacts.Store, each of which records its calls and can be stopped, tokens of a Platform admin of the platform tenant and of a Workspace admin and a Platform admin of another tenant, fixture descriptors of the platform tenant and of tenant B inserted directly into the isolated test database, and a recording stub of the sandbox Azure DevOps system that answers each capability call and can be made to fail one capability, so the passing, the failing and the interrupted certification run without a real organization."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7003,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4036]",
      "number": 4036
    },
    {
      "id": "AIFACTORY-TASK-4037",
      "type": "task",
      "parent": "AIFACTORY-US-1002",
      "title": "Verify the certification and the activation through the acceptance suite",
      "sequence": "06.01.03.03",
      "description": "Verify the certification and the activation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-002|Scenario=SCN-ConnectorRegistryService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1002: the passing suite with the descriptor Active and ConnectorActivated in the outbox, the failing capability with the descriptor in Draft, the repeated key and the repeated suite version, the 400, the 403 without the scope, the 403 to a Workspace admin and to a Platform admin of another tenant on the descriptor of the platform tenant, the 404 to tenant A for the descriptor of tenant B and for an unknown descriptor, the refusals of Connections.Resolve and of SecretBroker.Issue with the run failed and the descriptor in Draft, each of the three fakes stopped, the publication of ConnectorActivated under the run event envelope with retry, and the scan of evidence, events, logs and activities for the credential.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-002|Scenario=SCN-ConnectorRegistryService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1002: the passing suite with the descriptor Active and ConnectorActivated in the outbox, the failing capability with the descriptor in Draft, the repeated key and the repeated suite version, the 400, the 403 without the scope, the 403 to a Workspace admin and to a Platform admin of another tenant on the descriptor of the platform tenant, the 404 to tenant A for the descriptor of tenant B and for an unknown descriptor, the refusals of Connections.Resolve and of SecretBroker.Issue with the run failed and the descriptor in Draft, each of the three fakes stopped, the publication of ConnectorActivated under the run event envelope with retry, and the scan of evidence, events, logs and activities for the credential."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4037]",
      "number": 4037
    },
    {
      "id": "AIFACTORY-US-1003",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-032",
      "title": "Resolve a capability interface of the Azure DevOps connector to its adapter and to the connection granted to the forwarded scope",
      "sequence": "06.01.04",
      "description": "As an operator, I want the service that reads template sources and feeds to learn from the registry which certified connector and which granted connection it uses, so that no template feed is read from Azure DevOps through a connector that is not active or a connection the project does not hold. A workload resolves a capability interface before it calls the external system. In I1 the only caller is TemplateRegistryService, whose discovery pass resolves the repository and package feed capabilities to read template sources and feeds; the change proposal is opened by ToolAdapterService through `IntegrationService/Connections.Resolve` and does not call this method. A discovery pass runs in the platform tenant, and a connection is resolved only for a project with a Project grant (AIFACTORY-US-1008), so the scope under which a pass resolves is the platform tenant and the template-feed project: a project of the platform tenant, supplied by the installation and never fixed here, whose Project grant holds the Azure DevOps connection of the template sources. TemplateRegistryService forwards that project with the platform tenant; the choice is an owner point shared with feature template-registry-service and is reported. A request that forwards no project is not served without a connection: it is answered INVALID_ARGUMENT with the reason project-required, which the template-feed path never meets because it forwards its project. The caller presents a workload token with the service scope that names ConnectorRegistryService and forwards its tenant and project in the gRPC metadata; such a token carries no tenant claim, so the service reads the forwarded tenant and project only under that scope (ADR-0015 amendment D114). `ConnectorRegistryService/Connectors.ResolveCapability` looks up the Active descriptor that declares the capability among the descriptors of the platform tenant and of the forwarded tenant, and asks `IntegrationService/Connections.Resolve` for the connection of the forwarded scope, which checks the grant of the project. The reply names the connector and its version, the adapter reference, the capability, the connection, its endpoint policy as narrowed by the grant, and the broker ticket of IntegrationService unchanged; it never carries a credential, which the caller obtains from the Secret Broker with the ticket. The ticket names the credential reference, which the Secret Broker needs; the service passes it through in the reply only and writes it to no log record, activity, metric or event. The method is of class read and writes nothing. A capability that no Active descriptor declares, as for a Draft descriptor, is answered NOT_FOUND, and so is a descriptor of another tenant. The answers of IntegrationService return with their reason: PERMISSION_DENIED with the reason no-grant when the project holds no grant, FAILED_PRECONDITION when the connection is not Active or is Degraded, NOT_FOUND when the tenant has no such connection. A call without a workload identity, or a workload call that forwards no tenant, is refused with UNAUTHENTICATED by the Factory profile; a token without the service scope with PERMISSION_DENIED; a request whose execution scope names another tenant than the forwarded one with PERMISSION_DENIED and the reason scope-mismatch; a request without a capability with INVALID_ARGUMENT, and one without a project with INVALID_ARGUMENT and the reason project-required. IntegrationService is required and fail-fast: when it does not answer, the call fails with UNAVAILABLE and no partial reply, and so it does when `connector-registry-sql` is unavailable. The model names `execution-scope-v1` as the request and `tool-invocation-v1` as the reply of the method; the first has no member for a capability and the second describes a tool call with arguments, a policy decision and an idempotency key and no member for an adapter or a connection. That conflict is an open point for the owner: until the descriptors are named the request and reply messages are provisional golden files, the request carrying the execution scope beside the capability name. The found reply is proven with fixture rows inserted directly into the isolated test database and with the fake of `IntegrationService/Connections.Resolve`. Kind: behavior. Traces: services: ConnectorRegistryService, IntegrationService; aggregates: ConnectorRegistryService/ConnectorDescriptor; apis: ConnectorRegistryService/Connectors.ResolveCapability, IntegrationService/Connections.Resolve; descriptors: execution-scope-v1, tool-invocation-v1; adrs: ADR-0015, ADR-0022; requirements: FR-05, NFR-02; scenarios: SCN-ConnectorRegistryService-007. Depends on: AIFACTORY-US-1001, feature:integration-service-thin, feature:component-base-template-factory-profile. Sources: model/services/integration/ConnectorRegistryService.yaml, model/services/integration/IntegrationService.yaml, docs/reference/schemas/tool-invocation.schema.json, docs/reference/schemas/execution-scope.schema.json, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given an Active Azure DevOps descriptor of the platform tenant and a workload token of TemplateRegistryService with the service scope that forwards the platform tenant and its template-feed project, when `ConnectorRegistryService/Connectors.ResolveCapability` is called for the repository capability and for the package feed capability and `IntegrationService/Connections.Resolve` grants the connection of that project, then each reply names the connector and its version, the adapter reference, the capability, the connection, its narrowed endpoint policy and the broker ticket, carries no credential, nothing is written, and the credential reference of the ticket appears in no log record, activity or metric; given the same call for project P of tenant A, then the connection of project P is resolved the same way (SCN-ConnectorRegistryService-007).",
        "AC2: Given a Draft descriptor, a capability no descriptor declares or a descriptor of another tenant, when the method is called, then the answer is NOT_FOUND; given IntegrationService answering PERMISSION_DENIED with the reason no-grant, FAILED_PRECONDITION for a connection that is not Active or is Degraded, or NOT_FOUND, then that status and its reason return to the caller and nothing is written (SCN-ConnectorRegistryService-007, ADR-0015).",
        "AC3: Given a call without a workload identity, a workload call that forwards no tenant, a token without the service scope, an execution scope of another tenant than the forwarded one, a request without a capability, a request without a project, an unavailable IntegrationService or an unavailable `connector-registry-sql`, when the method is called, then it is refused with UNAUTHENTICATED, UNAUTHENTICATED, PERMISSION_DENIED, PERMISSION_DENIED with the reason scope-mismatch, INVALID_ARGUMENT, INVALID_ARGUMENT with the reason project-required, UNAVAILABLE or UNAVAILABLE respectively, no partial reply is returned and no state changes (SCN-ConnectorRegistryService-007, ADR-0015).",
        "AC4: Given the proto of the method, when the contract test runs, then the provisional golden files hold the request and the reply messages, a reply validated against the schema finds no credential member, and the test marks both messages provisional because `execution-scope-v1` and `tool-invocation-v1` cannot carry a capability, an adapter or a connection (docs/reference/schemas/tool-invocation.schema.json, docs/reference/schemas/execution-scope.schema.json)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4038",
        "AIFACTORY-TASK-4039",
        "AIFACTORY-TASK-4040"
      ],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7004,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "IntegrationService"
        ],
        "aggregates": [
          "ConnectorRegistryService/ConnectorDescriptor"
        ],
        "apis": [
          "ConnectorRegistryService/Connectors.ResolveCapability",
          "IntegrationService/Connections.Resolve"
        ],
        "descriptors": [
          "execution-scope-v1",
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-ConnectorRegistryService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1001",
        "feature:integration-service-thin",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "docs/reference/schemas/tool-invocation.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1003]",
      "number": 1003
    },
    {
      "id": "AIFACTORY-TASK-4038",
      "type": "task",
      "parent": "AIFACTORY-US-1003",
      "title": "Provisional request and reply messages of Connectors.ResolveCapability",
      "sequence": "06.01.04.01",
      "description": "Provisional request and reply messages of Connectors.ResolveCapability. Expected output: The proto fixes the request message (the execution scope and the capability name) and the reply message (connectorId, version, adapterRef, capability, connectionId, endpoint policy and broker ticket, no credential member) as provisional golden files, marked so in the contract test until the owner names the request and reply descriptors, because docs/reference/schemas/execution-scope.schema.json and docs/reference/schemas/tool-invocation.schema.json have no member for them.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The proto fixes the request message (the execution scope and the capability name) and the reply message (connectorId, version, adapterRef, capability, connectionId, endpoint policy and broker ticket, no credential member) as provisional golden files, marked so in the contract test until the owner names the request and reply descriptors, because docs/reference/schemas/execution-scope.schema.json and docs/reference/schemas/tool-invocation.schema.json have no member for them."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7004,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4038]",
      "number": 4038
    },
    {
      "id": "AIFACTORY-TASK-4039",
      "type": "task",
      "parent": "AIFACTORY-US-1003",
      "title": "Connectors.ResolveCapability over the Active descriptors and Connections.Resolve",
      "sequence": "06.01.04.02",
      "description": "Connectors.ResolveCapability over the Active descriptors and Connections.Resolve. Expected output: The method reads the forwarded tenant and project only under the service scope, looks up the Active descriptor that declares the capability among the descriptors of the platform tenant and the forwarded tenant, calls Connections.Resolve through a typed gRPC client under its workload token with the forwarded scope, returns the reply with the broker ticket unchanged and no credential, logs and measures neither the ticket nor its credential reference, returns the refusals of IntegrationService with their reason, answers NOT_FOUND, PERMISSION_DENIED with scope-mismatch, INVALID_ARGUMENT for a missing capability, INVALID_ARGUMENT with project-required for a missing project and UNAVAILABLE as AIFACTORY-US-1003 states, and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The method reads the forwarded tenant and project only under the service scope, looks up the Active descriptor that declares the capability among the descriptors of the platform tenant and the forwarded tenant, calls Connections.Resolve through a typed gRPC client under its workload token with the forwarded scope, returns the reply with the broker ticket unchanged and no credential, logs and measures neither the ticket nor its credential reference, returns the refusals of IntegrationService with their reason, answers NOT_FOUND, PERMISSION_DENIED with scope-mismatch, INVALID_ARGUMENT for a missing capability, INVALID_ARGUMENT with project-required for a missing project and UNAVAILABLE as AIFACTORY-US-1003 states, and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4039]",
      "number": 4039
    },
    {
      "id": "AIFACTORY-TASK-4040",
      "type": "task",
      "parent": "AIFACTORY-US-1003",
      "title": "Verify the capability resolution through the acceptance suite",
      "sequence": "06.01.04.03",
      "description": "Verify the capability resolution through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1003 with fixture descriptors of the platform tenant and of two tenants inserted directly into the isolated test database and the fake of IntegrationService/Connections.Resolve answering a grant for the template-feed project of the platform tenant and for project P of tenant A, no-grant, a Degraded connection, NOT_FOUND and no answer, the scan of logs, activities and metrics for the credential reference of the ticket, the eight refusals and the provisional golden files.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1003 with fixture descriptors of the platform tenant and of two tenants inserted directly into the isolated test database and the fake of IntegrationService/Connections.Resolve answering a grant for the template-feed project of the platform tenant and for project P of tenant A, no-grant, a Degraded connection, NOT_FOUND and no answer, the scan of logs, activities and metrics for the credential reference of the ticket, the eight refusals and the provisional golden files."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 70,
      "phase": "factory",
      "stackRank": 7004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4040]",
      "number": 4040
    },
    {
      "id": "AIFACTORY-FEAT-033",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-006",
      "title": "IntegrationService: thin delivery for the first outcome",
      "sequence": "06.02",
      "description": "IntegrationService is the service of bounded context BC-16 (Connections). Tenant-scoped connections to external systems — provider, endpoint policy, credential references (never values), grants that say which projects, agents and tools may use a connection, rotation metadata and health — with every use brokered as a short-lived credential by the Secret Broker (BC-16). In this increment it is delivered thin: One Azure DevOps connection per project with its credential reference. Its own repository is ConnectSoft.AI.SoftwareFactory.IntegrationService. Delivers: IntegrationService (thin: One Azure DevOps connection per project with its credential reference.). Increment I1: Generate a microservice. Build order 71 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-067",
        "AIFACTORY-US-1004",
        "AIFACTORY-US-1005",
        "AIFACTORY-US-1006",
        "AIFACTORY-US-1007",
        "AIFACTORY-US-1008"
      ],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7100,
      "titlePrefix": "[AIFACTORY-FEAT-033]",
      "number": 33
    },
    {
      "id": "AIFACTORY-US-067",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-033",
      "title": "IntegrationService answers the chain with its thin contract",
      "sequence": "06.02.01",
      "description": "As a workspace admin, I want one Azure DevOps connection for my project, registered with its credential reference, verified, granted to the project and resolved for the services that use it, so that the chain reads template feeds and opens the change proposal through a connection whose credential no service ever holds. This is the integration PBI of the thin delivery. The thin scope stated in model/backlog/features/integration.yaml is one Azure DevOps connection per project with its credential reference, and the delivery holds exactly that: a Workspace admin or Platform admin registers a connection of provider Azure DevOps with its credential kind and its Key Vault reference (AIFACTORY-US-1004), lists the connections of the tenant (AIFACTORY-US-1005), verifies the credential through the Secret Broker, which activates the connection (AIFACTORY-US-1006), and grants the connection to the project (AIFACTORY-US-1007); the services of the chain resolve the connection of a project with its grant check through the internal gRPC method `Connections.Resolve` (AIFACTORY-US-1008), ToolAdapterService for the change proposal and ConnectorRegistryService for the capabilities of its connector, which it resolves for the template feeds of TemplateRegistryService under the template-feed project of the platform tenant and for the certification under the sandbox project. Nothing else is served. The platform bundle allows a connection grant, the action kind `connection-grant`, for a Workspace admin of the project and the Platform admin (D127, D129), so on a deployed I1 instance a Project grant is written for those callers and refused for every other. `RotateCredential`, `RevokeConnection`, the event `CredentialRotated`, the transitions to Suspended and Revoked, the workers `ConnectionHealthProbe` and `RotationReminder` and the handlers of `ProjectStateChanged`, `SecretRotated` and `SecretReferenceRevoked` arrive with feature `integration-service-complete` in I5; the handler of `DeletionOrderIssued` is built in I4 with RetentionResidencyService and is not registered here. Until then a revoked secret reference is refused by the Secret Broker when a caller exchanges its ticket, so no outbound call is made without a brokered credential (fail closed). The repository ConnectSoft.AI.SoftwareFactory.IntegrationService is created and scaffolded in I0 by AIFACTORY-TASK-089 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; it was scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`, consumed by their pinned versions), so token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile. The messaging profile is the Orleans profile under the service name `integration`; the service writes the run event envelope of the contracts package through the Orleans outbox in the transaction of its command, for `ConnectionRegistered`, `ConnectionStateChanged` and `ConnectionGrantChanged` and for the audit evidence event `AuditEvidenceSubmitted` on the topic `audit.evidence.v1.evidence-submitted` of the pinned audit library, and the thin delivery registers no consumed event. A user token reaches the service with the audience of its own gateway, IntegrationHost, which the service accepts (ADR-0015 amendment D117); a workload token carries service scopes and no tenant claim. A connection stores a credential reference and its kind, never a value: no request, row, event, receipt, log record, activity or metric holds a secret value, and the service never holds a credential, also not during a verification (ADR-0019). The credential reference is held in the row and in the broker ticket of `Connections.Resolve` only, which the caller presents to the Secret Broker; it never appears in a list reply, an event, an audit evidence record, a log record, an activity or a metric. The REST operations are public routes of the IntegrationHost gateway, delivered in I1 like the other gateways (D127, D129), and the delivery builds no direct public route; a Workspace admin or Platform admin provisions the connection of a project on a deployed I1 instance by the runbook of AIFACTORY-TASK-4070 through that gateway. Kind: behavior. Traces: services: IntegrationService; aggregates: IntegrationService/Connection; apis: IntegrationService/RegisterConnection, IntegrationService/ListConnections, IntegrationService/VerifyConnection, IntegrationService/SetGrant, IntegrationService/Connections.Resolve; events: IntegrationService/ConnectionRegistered, IntegrationService/ConnectionStateChanged, IntegrationService/ConnectionGrantChanged; descriptors: run-event-envelope-v1, audit-evidence-v1, execution-scope-v1; adrs: ADR-0012, ADR-0015, ADR-0019, ADR-0022, ADR-0028; requirements: FR-01, FR-05, NFR-02. Depends on: AIFACTORY-US-1004, AIFACTORY-US-1005, AIFACTORY-US-1006, AIFACTORY-US-1007, AIFACTORY-US-1008, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:component-audit-factory-evidence, feature:component-observability-factory-conventions. Sources: model/services/integration/IntegrationService.yaml, model/backlog/features/integration.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0019-data-governance.md, docs/planes/capability-tools/connectors/services/integration-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.IntegrationService created and scaffolded in I0 by AIFACTORY-TASK-089 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IntegrationService --UseFactoryProfile true` from the pinned template package, when its pipeline runs with the work of this feature, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/integration/IntegrationService.yaml).",
        "AC2: Given the service descriptor of the thin delivery, when the contract test of the Factory profile compares it with the hosted surface, then exactly `IntegrationService/RegisterConnection`, `IntegrationService/ListConnections`, `IntegrationService/VerifyConnection`, `IntegrationService/SetGrant` and `IntegrationService/Connections.Resolve` are hosted, as AIFACTORY-US-1004 to AIFACTORY-US-1008 prove one by one, the paths of `RotateCredential` and `RevokeConnection` answer 404, and the test fails when an operation outside the thin scope stated in model/backlog/features/integration.yaml appears (ADR-0022).",
        "AC3: Given the `integration` messaging profile, when its registration is inspected, then the outbox publishes `IntegrationService/ConnectionRegistered`, `IntegrationService/ConnectionStateChanged`, `IntegrationService/ConnectionGrantChanged` and the audit evidence event under the run event envelope of the pinned contracts package in the transaction of their commands, no consumed event is registered, the handler of `DeletionOrderIssued` included, and no other event of the model is declared (ADR-0012, docs/reference/schemas/run-event-envelope.schema.json).",
        "AC4: Given a call without a token, without a workload identity or without the scope of the operation, or a workload call that forwards no tenant, when it reaches one of the five operations, then it is refused before any handler runs and nothing is read (ADR-0015); given the service starts, then liveness answers and readiness is unready until `integration-sql` is migrated and the identity authority is reachable; given the captured requests, rows, events, logs, activities and metrics of the acceptance suite, then none holds a secret value or a token (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml",
        "model/backlog/features/integration.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-090",
        "AIFACTORY-TASK-091",
        "AIFACTORY-TASK-4070",
        "AIFACTORY-TASK-759"
      ],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7101,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationService"
        ],
        "aggregates": [
          "IntegrationService/Connection"
        ],
        "apis": [
          "IntegrationService/RegisterConnection",
          "IntegrationService/ListConnections",
          "IntegrationService/VerifyConnection",
          "IntegrationService/SetGrant",
          "IntegrationService/Connections.Resolve"
        ],
        "events": [
          "IntegrationService/ConnectionRegistered",
          "IntegrationService/ConnectionStateChanged",
          "IntegrationService/ConnectionGrantChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "FR-05",
          "NFR-02"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1004",
        "AIFACTORY-US-1005",
        "AIFACTORY-US-1006",
        "AIFACTORY-US-1007",
        "AIFACTORY-US-1008",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/integration/IntegrationService.yaml",
        "model/backlog/features/integration.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-067]",
      "number": 67
    },
    {
      "id": "AIFACTORY-TASK-090",
      "type": "task",
      "parent": "AIFACTORY-US-067",
      "title": "Host the thin surface: five operations behind scope policies, the messaging profile with three published events and the deployment values",
      "sequence": "06.02.01.01",
      "description": "Host the thin surface: five operations behind scope policies, the messaging profile with three published events and the deployment values. Expected output: RegisterConnection, ListConnections, VerifyConnection, SetGrant and Connections.Resolve are hosted with the scope policies of the Factory profile and the Idempotency-Key filter of RegisterConnection and VerifyConnection; the integration messaging profile publishes ConnectionRegistered, ConnectionStateChanged, ConnectionGrantChanged and the audit evidence event under the run event envelope of the pinned contracts package and registers no consumed event; the deployment manifest states the replica range 2 to 8, the probes, the base addresses of SecretBrokerService, PolicyEngineService and ProjectService, the secret reference messaging-transport by name and never by value, Integration:Connections:DefaultRotationDays and Integration:Connections:VerifyOnActivate at their modelled defaults, and no setting names the action kind of a grant, which is fixed in the service (D129); the three metrics of model/services/integration/IntegrationService.yaml are registered with their modelled dimensions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "RegisterConnection, ListConnections, VerifyConnection, SetGrant and Connections.Resolve are hosted with the scope policies of the Factory profile and the Idempotency-Key filter of RegisterConnection and VerifyConnection; the integration messaging profile publishes ConnectionRegistered, ConnectionStateChanged, ConnectionGrantChanged and the audit evidence event under the run event envelope of the pinned contracts package and registers no consumed event; the deployment manifest states the replica range 2 to 8, the probes, the base addresses of SecretBrokerService, PolicyEngineService and ProjectService, the secret reference messaging-transport by name and never by value, Integration:Connections:DefaultRotationDays and Integration:Connections:VerifyOnActivate at their modelled defaults, and no setting names the action kind of a grant, which is fixed in the service (D129); the three metrics of model/services/integration/IntegrationService.yaml are registered with their modelled dimensions."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-090]",
      "number": 90
    },
    {
      "id": "AIFACTORY-TASK-091",
      "type": "task",
      "parent": "AIFACTORY-US-067",
      "title": "Contract of the thin surface: service descriptor, OpenAPI document of the four REST operations and proto of Connections.Resolve",
      "sequence": "06.02.01.02",
      "description": "Contract of the thin surface: service descriptor, OpenAPI document of the four REST operations and proto of Connections.Resolve. Expected output: The service descriptor file lists exactly RegisterConnection, ListConnections, VerifyConnection, SetGrant and Connections.Resolve with path or method, scope, side-effect class and idempotency as model/services/integration/IntegrationService.yaml states them; the OpenAPI document fixes the registration body without any member for a credential value, the list, the verification result and the grant; the proto fixes the provisional reply message of AIFACTORY-TASK-4052; a contract test with golden files holds the shapes and compares the hosted endpoints with the descriptor file in both directions, so callers run against this service without a fake.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists exactly RegisterConnection, ListConnections, VerifyConnection, SetGrant and Connections.Resolve with path or method, scope, side-effect class and idempotency as model/services/integration/IntegrationService.yaml states them; the OpenAPI document fixes the registration body without any member for a credential value, the list, the verification result and the grant; the proto fixes the provisional reply message of AIFACTORY-TASK-4052; a contract test with golden files holds the shapes and compares the hosted endpoints with the descriptor file in both directions, so callers run against this service without a fake."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7101,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-091]",
      "number": 91
    },
    {
      "id": "AIFACTORY-TASK-4070",
      "type": "task",
      "parent": "AIFACTORY-US-067",
      "title": "Provisioning runbook of the Azure DevOps connection of a project on a deployed I1 instance, inside the cluster and without a public route",
      "sequence": "06.02.01.03",
      "description": "Provisioning runbook of the Azure DevOps connection of a project on a deployed I1 instance, inside the cluster and without a public route. Expected output: The repository documentation holds the runbook by which a Workspace admin or Platform admin provisions the connection of a project through the IntegrationHost gateway of I1 (D129), for a project of a tenant and for the sandbox project and the template-feed project of the platform tenant: it calls the public routes of the gateway, never the cluster-internal address of the service, with a user token of the authorization server whose one audience is IntegrationHost, the audience the service accepts (ADR-0015 amendment D117), and whose tenant is the tenant of the connection; its precondition is a secret reference registered with the Secret Broker with the purposes its callers ask, tool-call for the change proposal, delivery for the certification and, for the template-feed project, the purpose that feature template-registry-service names for its read; it names the four calls, RegisterConnection with an Idempotency-Key, VerifyConnection with an Idempotency-Key, SetGrant for subject kind Project and, in the repository of ConnectorRegistryService, CertifyConnector, and the evidence that the connection is usable, ListConnections answering 200 with the connection in state Active and healthy with a grant count of at least one, and the ConnectionStateChanged and ConnectionGrantChanged records in the outbox; it states that SetGrant is allowed under the platform bundle for a Workspace admin of the project and the Platform admin (D129) and answered 403 for any other caller, and holds no token, credential, reference value or limit.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "The repository documentation holds the runbook by which a Workspace admin or Platform admin provisions the connection of a project through the IntegrationHost gateway of I1 (D129), for a project of a tenant and for the sandbox project and the template-feed project of the platform tenant: it calls the public routes of the gateway, never the cluster-internal address of the service, with a user token of the authorization server whose one audience is IntegrationHost, the audience the service accepts (ADR-0015 amendment D117), and whose tenant is the tenant of the connection; its precondition is a secret reference registered with the Secret Broker with the purposes its callers ask, tool-call for the change proposal, delivery for the certification and, for the template-feed project, the purpose that feature template-registry-service names for its read; it names the four calls, RegisterConnection with an Idempotency-Key, VerifyConnection with an Idempotency-Key, SetGrant for subject kind Project and, in the repository of ConnectorRegistryService, CertifyConnector, and the evidence that the connection is usable, ListConnections answering 200 with the connection in state Active and healthy with a grant count of at least one, and the ConnectionStateChanged and ConnectionGrantChanged records in the outbox; it states that SetGrant is allowed under the platform bundle for a Workspace admin of the project and the Platform admin (D129) and answered 403 for any other caller, and holds no token, credential, reference value or limit."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7101,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-4070]",
      "number": 4070
    },
    {
      "id": "AIFACTORY-TASK-759",
      "type": "task",
      "parent": "AIFACTORY-US-067",
      "title": "Verify integration-service-thin-contract by running the declared command",
      "sequence": "06.02.01.04",
      "description": "Verify integration-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-067, that is the scaffold with the Factory profile, exactly the five hosted operations of the thin scope and the 404 of RotateCredential and RevokeConnection, the messaging registration with three published events and no consumed event, the refusals before any handler, readiness that stays unready until integration-sql is migrated and the scan for secret values and tokens; the runbook of AIFACTORY-TASK-4070 is present in the repository documentation.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-067, that is the scaffold with the Factory profile, exactly the five hosted operations of the thin scope and the 404 of RotateCredential and RevokeConnection, the messaging registration with three published events and no consumed event, the refusals before any handler, readiness that stays unready until integration-sql is migrated and the scan for secret values and tokens; the runbook of AIFACTORY-TASK-4070 is present in the repository documentation."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-759]",
      "number": 759
    },
    {
      "id": "AIFACTORY-US-1004",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-033",
      "title": "Register an Azure DevOps connection with its credential kind and Key Vault reference, never its value, and announce it with ConnectionRegistered",
      "sequence": "06.02.02",
      "description": "As a workspace admin, I want to register the Azure DevOps connection of my organization with a reference to the secret that the vault holds, so that the Factory can reach the system of record without the secret ever passing through a Factory service. A Workspace admin or Platform admin whose scope carries `factory.connections.admin` registers a connection through `IntegrationService/RegisterConnection` with an `Idempotency-Key`. The body names the connection name, the provider, the endpoint policy (allowed hosts, base URL, methods, rate limits, timeouts), the credential kind and the Key Vault reference of the credential. The value was written to Key Vault by the caller or the Secret Broker flow and is never posted here: the body has no member for a value, and a body that carries one, or any member the contract does not name, is refused with 400 and nothing is stored. The thin delivery registers connections of provider Azure DevOps only; another provider is refused with 400 until the complete delivery in I5. The connection belongs to the tenant of the token; the route names no project, and the project that may use the connection is named by its grant (AIFACTORY-US-1007). The service writes the `Connection` in state Draft and not healthy, with its rotation metadata, the rotation period of the provider policy or `Integration:Connections:DefaultRotationDays` where it sets none and the next rotation due, together with the `ConnectionRegistered` outbox record and the audit evidence event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` in one transaction, and answers 201 with the location of the connection. A repeated call with the same key and the same body returns the same connection and changes nothing; the same key with a different body is refused with 409, and so is a second connection with the same name in the tenant. A token without the scope is answered 403. The reference is not resolved at registration: whether it resolves and works is proven by the verification, and until then the connection cannot be used. `ConnectionRegistered` carries `connectionId`, `tenantId`, `provider` and `credentialKind` and no reference and no value; StudioBff and AuditService handle it in their own PBIs. The credential reference is held in the row and, once the connection is resolved, in the broker ticket of `Connections.Resolve` (AIFACTORY-US-1008) only; it is in no list reply, event, audit evidence record, log record, activity or metric. The counter `connectsoft.factory.integration.connections` moves for the tenant, the provider and the state Draft. Kind: behavior. Traces: services: IntegrationService; aggregates: IntegrationService/Connection; apis: IntegrationService/RegisterConnection; events: IntegrationService/ConnectionRegistered; descriptors: run-event-envelope-v1, audit-evidence-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: FR-01, NFR-02, NFR-05; scenarios: SCN-IntegrationService-001, SCN-IntegrationService-008. Relates: screens: connections. Depends on: feature:component-base-template-factory-profile, feature:contracts-package, feature:component-audit-factory-evidence. Sources: model/services/integration/IntegrationService.yaml, docs/planes/capability-tools/connectors/services/integration-service/index.md#domain-model, docs/planes/capability-tools/connectors/services/integration-service/ddl.md.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.connections.admin` and a valid body for provider Azure DevOps with credential kind and Key Vault reference, when `IntegrationService/RegisterConnection` is called with an `Idempotency-Key`, then the response is 201 with the location, the `IntegrationService/Connection` is in state Draft and not healthy with its rotation metadata, and the `IntegrationService/ConnectionRegistered` outbox record and the audit evidence event are written in the same transaction (SCN-IntegrationService-001, ADR-0012).",
        "AC2: Given the same call repeated with the same key and body, then the same connection is returned and nothing changes; given the same key with a different body or a second connection with the same name in the tenant, then 409; given a body with a member for a credential value, an unknown member or another provider than Azure DevOps, then 400 and nothing is stored; given a token without the scope, then 403; no refusal writes a row or an event (SCN-IntegrationService-001, ADR-0015).",
        "AC3: Given the connection registered, when the outbox dispatcher of the `integration` profile publishes `IntegrationService/ConnectionRegistered` on `connections.connections.v1.connection-registered`, then the event is sent under the run event envelope with `connectionId`, `tenantId`, `provider` and `credentialKind` and without the reference, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-IntegrationService-008, ADR-0012).",
        "AC4: Given the registration, when the row, the event, the audit evidence, the log records and the metrics are inspected, then the reference is held in the row and, for a resolved connection, in the broker ticket of the resolution that AIFACTORY-US-1008 delivers only, and in none of the event, the audit evidence, the log records, the activities or the metrics, no secret value exists anywhere, and `connectsoft.factory.integration.connections` counts the connection for the tenant, the provider and the state Draft (ADR-0019, model/services/integration/IntegrationService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#domain-model",
        "docs/planes/capability-tools/connectors/services/integration-service/ddl.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4041",
        "AIFACTORY-TASK-4042",
        "AIFACTORY-TASK-4043"
      ],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7102,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationService"
        ],
        "aggregates": [
          "IntegrationService/Connection"
        ],
        "apis": [
          "IntegrationService/RegisterConnection"
        ],
        "events": [
          "IntegrationService/ConnectionRegistered"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-01",
          "NFR-02",
          "NFR-05"
        ],
        "scenarios": [
          "SCN-IntegrationService-001",
          "SCN-IntegrationService-008"
        ]
      },
      "relates": {
        "screens": [
          "connections"
        ]
      },
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/integration/IntegrationService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#domain-model",
        "docs/planes/capability-tools/connectors/services/integration-service/ddl.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1004]",
      "number": 1004
    },
    {
      "id": "AIFACTORY-TASK-4041",
      "type": "task",
      "parent": "AIFACTORY-US-1004",
      "title": "Migration and mappings of Connections and ConnectionGrants in integration-sql",
      "sequence": "06.02.02.01",
      "description": "Migration and mappings of Connections and ConnectionGrants in integration-sql. Expected output: The tables Connections and ConnectionGrants of model/services/integration/IntegrationService.yaml exist with their columns, keys, the foreign key of a grant to its connection, the unique indexes UX_Connections_Tenant_Name and UX_Grants_Connection_Subject and the index IX_Connections_Provider_State; no column holds a secret value; the mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The tables Connections and ConnectionGrants of model/services/integration/IntegrationService.yaml exist with their columns, keys, the foreign key of a grant to its connection, the unique indexes UX_Connections_Tenant_Name and UX_Grants_Connection_Subject and the index IX_Connections_Provider_State; no column holds a secret value; the mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7102,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-4041]",
      "number": 4041
    },
    {
      "id": "AIFACTORY-TASK-4042",
      "type": "task",
      "parent": "AIFACTORY-US-1004",
      "title": "RegisterConnection with its Idempotency-Key, the Draft connection and ConnectionRegistered in one transaction",
      "sequence": "06.02.02.02",
      "description": "RegisterConnection with its Idempotency-Key, the Draft connection and ConnectionRegistered in one transaction. Expected output: RegisterConnection validates the body, refuses a credential value member, an unknown member and a provider other than Azure DevOps with 400, writes the Connection in Draft and not healthy with its rotation metadata, the ConnectionRegistered outbox record and AuditEvidenceSubmitted in one transaction, answers 201, returns the same connection for a repeated key and body, answers 409 for a key with a different body and for a duplicate name and 403 without the scope, and moves connectsoft.factory.integration.connections.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "RegisterConnection validates the body, refuses a credential value member, an unknown member and a provider other than Azure DevOps with 400, writes the Connection in Draft and not healthy with its rotation metadata, the ConnectionRegistered outbox record and AuditEvidenceSubmitted in one transaction, answers 201, returns the same connection for a repeated key and body, answers 409 for a key with a different body and for a duplicate name and 403 without the scope, and moves connectsoft.factory.integration.connections."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4042]",
      "number": 4042
    },
    {
      "id": "AIFACTORY-TASK-4043",
      "type": "task",
      "parent": "AIFACTORY-US-1004",
      "title": "Verify the registration of a connection through the acceptance suite",
      "sequence": "06.02.02.03",
      "description": "Verify the registration of a connection through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationService-001|Scenario=SCN-IntegrationService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1004: the 201 with the Draft connection and the outbox record, the repeated key, the 409 for a different body and a duplicate name, the 400 for a value member, an unknown member and another provider, the 403, the publication of ConnectionRegistered under the run event envelope with retry, and the scan for secret values.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationService-001|Scenario=SCN-IntegrationService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1004: the 201 with the Draft connection and the outbox record, the repeated key, the 409 for a different body and a duplicate name, the 400 for a value member, an unknown member and another provider, the 403, the publication of ConnectionRegistered under the run event envelope with retry, and the scan for secret values."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4043]",
      "number": 4043
    },
    {
      "id": "AIFACTORY-US-1005",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-033",
      "title": "List the connections of a tenant with provider, state, health, rotation due and grant counts and without any credential",
      "sequence": "06.02.03",
      "description": "As a workspace admin, I want to see the connections of my tenant with their state, health, rotation due and how many subjects hold a grant, so that I know whether the Azure DevOps connection my project uses is active and granted before a run needs it. A caller whose scope carries `factory.connections.read` (Observer, Operator, Workspace admin or Platform admin) lists the connections through `IntegrationService/ListConnections`. The tenant comes from the validated token; the route names no project, because a connection belongs to its tenant and the projects that may use it are named by its grants. The response is 200 with the connections of that tenant only, each with `connectionId`, name, provider, credential kind, state, health, last verification, the next rotation due and the count of its grants. The list carries neither the credential reference nor any value: the reference is held in the row and in the broker ticket of `Connections.Resolve` only (D129), which the caller presents to the Secret Broker, and never in a list reply, an event, a log record, an activity or a metric. The tenant row filter of the Factory profile makes the connections of another tenant invisible; the list never confirms that one exists. A call without a token is answered 401 and a token without the scope 403; when `integration-sql` is unavailable the call fails fast with 503 and a problem response and no partial list. Nothing is written by the read and no event is published. The Studio screen of connections reads the same list through StudioBff in its own increment. Kind: behavior. Traces: services: IntegrationService; aggregates: IntegrationService/Connection; apis: IntegrationService/ListConnections; adrs: ADR-0015, ADR-0019; requirements: FUX-01; scenarios: SCN-IntegrationService-002. Relates: screens: connections. Depends on: AIFACTORY-US-1004. Sources: model/services/integration/IntegrationService.yaml, docs/planes/capability-tools/connectors/services/integration-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a connection of the tenant of the caller in state Active with two grants, when a caller with `factory.connections.read` calls `IntegrationService/ListConnections`, then the response is 200 with the connection carrying `connectionId`, name, provider, credential kind, state, health, last verification, next rotation due and the grant count 2, without the credential reference and without any value, and nothing is written (SCN-IntegrationService-002).",
        "AC2: Given fixture connections of tenant A and tenant B inserted directly into the isolated test database, when an Observer of tenant B calls `IntegrationService/ListConnections`, then only the connections of tenant B are returned and the connection of tenant A is not revealed (SCN-IntegrationService-002, ADR-0015).",
        "AC3: Given a call without a token, a token without `factory.connections.read` or an unavailable `integration-sql`, when `IntegrationService/ListConnections` is called, then the answer is 401, 403 or 503 with a problem response, no partial list is returned and no state changes (SCN-IntegrationService-002)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4044",
        "AIFACTORY-TASK-4045"
      ],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7103,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationService"
        ],
        "aggregates": [
          "IntegrationService/Connection"
        ],
        "apis": [
          "IntegrationService/ListConnections"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FUX-01"
        ],
        "scenarios": [
          "SCN-IntegrationService-002"
        ]
      },
      "relates": {
        "screens": [
          "connections"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1004"
      ],
      "source": [
        "model/services/integration/IntegrationService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1005]",
      "number": 1005
    },
    {
      "id": "AIFACTORY-TASK-4044",
      "type": "task",
      "parent": "AIFACTORY-US-1005",
      "title": "ListConnections read model with the tenant row filter and grant counts",
      "sequence": "06.02.03.01",
      "description": "ListConnections read model with the tenant row filter and grant counts. Expected output: ListConnections returns the connections of the trusted tenant with connectionId, name, provider, credential kind, state, health, last verification, next rotation due and grant count, never the credential reference, answers 401 and 403 through the policies of the Factory profile and 503 with a problem response when the store is unavailable, and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "ListConnections returns the connections of the trusted tenant with connectionId, name, provider, credential kind, state, health, last verification, next rotation due and grant count, never the credential reference, answers 401 and 403 through the policies of the Factory profile and 503 with a problem response when the store is unavailable, and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4044]",
      "number": 4044
    },
    {
      "id": "AIFACTORY-TASK-4045",
      "type": "task",
      "parent": "AIFACTORY-US-1005",
      "title": "Verify the list of connections through the acceptance suite",
      "sequence": "06.02.03.02",
      "description": "Verify the list of connections through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IntegrationService-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1005: the list with its members and the grant count and without the reference, the two-tenant fixture rows, the 401, the 403 and the 503 of an unavailable store.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IntegrationService-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1005: the list with its members and the grant count and without the reference, the two-tenant fixture rows, the 401, the 403 and the 503 of an unavailable store."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4045]",
      "number": 4045
    },
    {
      "id": "AIFACTORY-US-1006",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-033",
      "title": "Verify a connection through the Secret Broker, activate it on success, mark it Degraded on failure and announce each state change",
      "sequence": "06.02.04",
      "description": "As a workspace admin, I want to verify that the credential of a connection resolves and works and to have the connection activated only then, so that no service uses a connection whose credential was never proven, and a credential that stopped working is visible as Degraded. A caller whose scope carries `factory.connections.admin` verifies a connection through `IntegrationService/VerifyConnection` with an `Idempotency-Key`; the path names the connection. The verification is a read-only probe of class external: the service asks `SecretBrokerService/SecretBroker.Verify` whether the credential reference resolves and the credential works at the provider, and the broker answers without issuing the credential, so IntegrationService never holds it. The service decides no approval. The answer is 200 with the outcome, verified or not verified with the reason the broker gives, and the state of the connection. `Integration:Connections:VerifyOnActivate` makes a successful verification the precondition of Active, and the model names no other operation for the trigger `Activate`, so a successful verification of a Draft connection moves it from Draft to Verified (`VerificationSucceeded`) and from Verified to Active (`Activate`) in one transaction, sets it healthy and records the verification time; each transition writes its own `ConnectionStateChanged` outbox record with `fromState` and `toState`, and the audit evidence event `AuditEvidenceSubmitted` is written in the same transaction. Every verification that reaches an outcome is an external probe and is recorded: the audit evidence event `AuditEvidenceSubmitted` with the outcome and the reason the broker gives is written to the outbox for it, also when no state changes. A failed verification of a Draft connection changes no state and writes no `ConnectionStateChanged`, and its audit evidence records the outcome not verified with the reason. A failed verification of an Active connection moves it to Degraded and not healthy, and a successful verification of a Degraded connection moves it back to Active, each with its `ConnectionStateChanged`, as the failure mode of an expired credential at the provider states; a successful verification of an Active connection records the time and writes no `ConnectionStateChanged`, only its audit evidence. A repeated call with the same key returns the same outcome and changes nothing. A token without the scope is answered 403; a connection that does not exist in the tenant of the caller, or that belongs to another tenant, is answered 404, the same answer in both cases (ADR-0015 amendment D113). SecretBrokerService is required and fail-fast: when it does not answer, the call fails with 503, the state stays as it was and nothing is published, because no connection is activated without a verification (fail closed). `ConnectionStateChanged` carries `connectionId`, `tenantId`, `fromState` and `toState`; its consumers, ConnectorRegistryService, ToolAdapterService, KnowledgeIngestionService, McpServerRegistryService, StudioBff and AuditService, handle it in their own PBIs. The periodic probe of `ConnectionHealthProbe`, suspension and revocation arrive with the complete delivery in I5. `connectsoft.factory.integration.connections` moves with every state change. Kind: behavior. Traces: services: IntegrationService, SecretBrokerService; aggregates: IntegrationService/Connection; apis: IntegrationService/VerifyConnection, SecretBrokerService/SecretBroker.Verify; events: IntegrationService/ConnectionStateChanged; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: NFR-02, NFR-05; scenarios: SCN-IntegrationService-003, SCN-IntegrationService-009. Relates: screens: connections. Depends on: AIFACTORY-US-1004, feature:secret-broker-service. Sources: model/services/integration/IntegrationService.yaml, model/services/governance/SecretBrokerService.yaml, docs/planes/capability-tools/connectors/services/integration-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Draft `IntegrationService/Connection` of the tenant of the caller and `SecretBrokerService/SecretBroker.Verify` answering that the reference resolves and the credential works, when `IntegrationService/VerifyConnection` is called with an `Idempotency-Key`, then the response is 200 with the outcome verified, the connection is Active and healthy with its verification time, and two `IntegrationService/ConnectionStateChanged` outbox records, Draft to Verified and Verified to Active, and the audit evidence event are written in the same transaction (SCN-IntegrationService-003, SCN-IntegrationService-009).",
        "AC2: Given the broker answering not verified, when a Draft connection is verified, then the response is 200 with the outcome and the reason, no state changes, no `IntegrationService/ConnectionStateChanged` is written and the audit evidence event with the outcome not verified and the reason is written; when an Active connection is verified, then it becomes Degraded and not healthy with its `IntegrationService/ConnectionStateChanged` and its audit evidence; given a Degraded connection verified successfully, then it is Active again with its event and its audit evidence; given an Active connection verified successfully, then only the verification time changes, no `IntegrationService/ConnectionStateChanged` is written and the audit evidence records the outcome (SCN-IntegrationService-003).",
        "AC3: Given the same call repeated with the same key, then the same outcome returns and nothing changes; given a token without the scope, a connection of another tenant or an unknown connection, or a broker that does not answer, then the answer is 403, 404 (the same for a foreign and an unknown connection, ADR-0015 amendment D113) or 503 with a problem response, the state stays as it was and nothing is published (SCN-IntegrationService-003, ADR-0015).",
        "AC4: Given a state change committed, when the outbox dispatcher publishes `IntegrationService/ConnectionStateChanged` on `connections.connections.v1.connection-state-changed`, then the event is sent under the run event envelope with `connectionId`, `tenantId`, `fromState` and `toState`, the two events of an activation in commit order, and a transport outage is retried with backoff so no event is lost or duplicated under its event id (SCN-IntegrationService-009, ADR-0012).",
        "AC5: Given the calls recorded by the fake of `SecretBrokerService/SecretBroker.Verify` and the captured logs and activities of a verification, when they are inspected, then the service sent the reference and received no credential, and no secret value appears anywhere (ADR-0019, NFR-02)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4046",
        "AIFACTORY-TASK-4047",
        "AIFACTORY-TASK-4048"
      ],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7104,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationService",
          "SecretBrokerService"
        ],
        "aggregates": [
          "IntegrationService/Connection"
        ],
        "apis": [
          "IntegrationService/VerifyConnection",
          "SecretBrokerService/SecretBroker.Verify"
        ],
        "events": [
          "IntegrationService/ConnectionStateChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-02",
          "NFR-05"
        ],
        "scenarios": [
          "SCN-IntegrationService-003",
          "SCN-IntegrationService-009"
        ]
      },
      "relates": {
        "screens": [
          "connections"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1004",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/integration/IntegrationService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1006]",
      "number": 1006
    },
    {
      "id": "AIFACTORY-TASK-4046",
      "type": "task",
      "parent": "AIFACTORY-US-1006",
      "title": "VerifyConnection through SecretBroker.Verify with the transitions to Active and Degraded and their events",
      "sequence": "06.02.04.01",
      "description": "VerifyConnection through SecretBroker.Verify with the transitions to Active and Degraded and their events. Expected output: VerifyConnection calls SecretBroker.Verify through a typed gRPC client with the reference and receives no credential, answers 200 with the outcome and the state, commits Draft to Verified to Active, Active to Degraded or Degraded to Active with one ConnectionStateChanged outbox record per transition and AuditEvidenceSubmitted in the transaction, writes AuditEvidenceSubmitted with the outcome and the reason also for a verification that changes no state, a failed verification of a Draft connection and a successful verification of an Active connection, records the verification time, returns the same outcome for a repeated key, answers 403, 404 for a foreign and an unknown connection alike and 503 without a state change when the broker does not answer, and moves connectsoft.factory.integration.connections.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "VerifyConnection calls SecretBroker.Verify through a typed gRPC client with the reference and receives no credential, answers 200 with the outcome and the state, commits Draft to Verified to Active, Active to Degraded or Degraded to Active with one ConnectionStateChanged outbox record per transition and AuditEvidenceSubmitted in the transaction, writes AuditEvidenceSubmitted with the outcome and the reason also for a verification that changes no state, a failed verification of a Draft connection and a successful verification of an Active connection, records the verification time, returns the same outcome for a repeated key, answers 403, 404 for a foreign and an unknown connection alike and 503 without a state change when the broker does not answer, and moves connectsoft.factory.integration.connections."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4046]",
      "number": 4046
    },
    {
      "id": "AIFACTORY-TASK-4047",
      "type": "task",
      "parent": "AIFACTORY-US-1006",
      "title": "Fake of SecretBroker.Verify for the acceptance suite",
      "sequence": "06.02.04.02",
      "description": "Fake of SecretBroker.Verify for the acceptance suite. Expected output: The acceptance suite holds a fake of SecretBrokerService/SecretBroker.Verify that records the reference it received, answers verified or not verified with a reason, and can be stopped, so every transition and the fail-closed answer are proven without a vault or a provider.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of SecretBrokerService/SecretBroker.Verify that records the reference it received, answers verified or not verified with a reason, and can be stopped, so every transition and the fail-closed answer are proven without a vault or a provider."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7104,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4047]",
      "number": 4047
    },
    {
      "id": "AIFACTORY-TASK-4048",
      "type": "task",
      "parent": "AIFACTORY-US-1006",
      "title": "Verify the verification and the state changes through the acceptance suite",
      "sequence": "06.02.04.03",
      "description": "Verify the verification and the state changes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationService-003|Scenario=SCN-IntegrationService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1006: the activation with two events, the failed verification of a Draft connection with its audit evidence and no ConnectionStateChanged, the failed verification of an Active connection, the recovery from Degraded, the successful verification of an Active connection with its audit evidence and no ConnectionStateChanged, the repeated key, the 403, the 404 for a foreign and an unknown connection, the 503 with the broker stopped, the publication of ConnectionStateChanged in commit order and the recorded broker calls without a credential.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationService-003|Scenario=SCN-IntegrationService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1006: the activation with two events, the failed verification of a Draft connection with its audit evidence and no ConnectionStateChanged, the failed verification of an Active connection, the recovery from Degraded, the successful verification of an Active connection with its audit evidence and no ConnectionStateChanged, the repeated key, the 403, the 404 for a foreign and an unknown connection, the 503 with the broker stopped, the publication of ConnectionStateChanged in commit order and the recorded broker calls without a credential."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4048]",
      "number": 4048
    },
    {
      "id": "AIFACTORY-US-1007",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-033",
      "title": "Grant or narrow the use of a connection by a project after the project scope and the grant policy allow it, announced by ConnectionGrantChanged",
      "sequence": "06.02.05",
      "description": "As a workspace admin, I want to grant the Azure DevOps connection to my project and narrow what the project may do with it, so that only the project I name can resolve the connection and only within the hosts and methods I allow. A caller whose scope carries `factory.connections.admin` sets a grant through `IntegrationService/SetGrant`, `PUT /factory/connections/{connectionId}/grants/{subjectKind}/{subjectId}`, with a body that holds the scopes narrowing the endpoint policy for the subject and an optional expiry. The thin delivery grants to subject kind Project, which is what one Azure DevOps connection per project needs; the kinds Agent, Tool, Source and McpServer are refused with 400 until the complete delivery in I5. For a Project grant the path names the project in `subjectId`, so the route names its project in the path and never in a header. The service asks `ProjectService/Projects.ResolveScope` for the project and the roles of the caller in it, and `PolicyEngineService/Policy.Decide` for the grant policy, who may grant what to whom. The request is a `policy-decision-request-v1` with the action kind `connection-grant`, which pairs with the domain ConnectionGrant so that the caller names no domain, the target `connection-grant`, the side-effect class shared-write, the granting subject with its roles in the project, and the subject kind and subject of the grant; the kind is fixed in the service and no setting names it (D127, D129). The policy decision alone decides and the service decides no approval: only the outcome allow writes the grant, any other outcome is answered 403 with the outcome and the reason of the decision, and an answer that is no decision is answered 403 with the reason no-decision, so no grant exists without an allowing decision (fail closed). The platform bundle allows the action kind `connection-grant` for a subject who is Workspace admin of the project or the Platform admin (AIFACTORY-US-917 of feature policy-engine-service, D129), and `Policy.Decide` answers deny for an action no rule matches, so on a deployed I1 instance a grant of those callers is written and a grant of any other caller is answered 403 with the reason of the deny. The grant is written or replaced on the unique key of connection, subject kind and subject, with the subject who granted it and the time; a first grant writes `ConnectionGrantChanged` with the change set, a grant with fewer scopes than before with the change narrowed, a grant with other scopes with the change set, each in the transaction with the audit evidence event `AuditEvidenceSubmitted`; the same body repeated is answered 200 and writes nothing and no event, because the operation is naturally idempotent. A grant may be set on a connection in any state; it is used only once the connection is Active (AIFACTORY-US-1008). A token without the scope is answered 403; a connection of another tenant or an unknown connection, and a project that does not exist in the tenant, are answered 404 (ADR-0015 amendment D113). ProjectService and PolicyEngineService are required and fail-fast: when one does not answer, the call fails with 503 and nothing changes. The model has no operation that removes a grant; removal and the revocation of project grants when a project is closing (XL-13) arrive with the complete delivery. `ConnectionGrantChanged` carries `connectionId`, `tenantId`, `subjectKind`, `subjectId` and `change`; StudioBff and AuditService handle it in their own PBIs. Kind: behavior. Traces: services: IntegrationService, ProjectService, PolicyEngineService; aggregates: IntegrationService/Connection; apis: IntegrationService/SetGrant, ProjectService/Projects.ResolveScope, PolicyEngineService/Policy.Decide; events: IntegrationService/ConnectionGrantChanged; descriptors: run-event-envelope-v1, policy-decision-request-v1; adrs: ADR-0012, ADR-0015; requirements: FR-01, FUX-01; scenarios: SCN-IntegrationService-004, SCN-IntegrationService-010. Relates: screens: connections. Depends on: AIFACTORY-US-1004, feature:project-service, feature:policy-engine-service. Sources: model/services/integration/IntegrationService.yaml, model/services/control-plane/ProjectService.yaml, model/services/governance/PolicyEngineService.yaml, docs/planes/capability-tools/connectors/services/integration-service/index.md#entities-and-value-objects.",
      "acceptanceCriteria": [
        "AC1: Given an `IntegrationService/Connection` of the tenant of the caller, a project of that tenant, the fake of `ProjectService/Projects.ResolveScope` and the fake of `PolicyEngineService/Policy.Decide` answering allow, as the platform bundle does for a Workspace admin of the project (D129), when `IntegrationService/SetGrant` is called for subject kind Project with scopes, then the response is 200, the grant is written with the granting subject and the time, and the `IntegrationService/ConnectionGrantChanged` outbox record with the change set and the audit evidence event are written in the same transaction (SCN-IntegrationService-004, SCN-IntegrationService-010).",
        "AC2: Given the same body repeated, then the response is 200 and nothing is written and no event is published; given a body with fewer scopes, then the grant is narrowed and `IntegrationService/ConnectionGrantChanged` carries the change narrowed; given an expiry, then it is stored with the grant (SCN-IntegrationService-004).",
        "AC3: Given a token without the scope, a policy decision other than allow, among them the deny that `PolicyEngineService/Policy.Decide` answers under the platform bundle for a caller who is neither Workspace admin of the project nor Platform admin, an answer that is no decision, a connection of another tenant or an unknown connection, a project that does not exist in the tenant, a subject kind other than Project, or ProjectService or PolicyEngineService that does not answer, when `IntegrationService/SetGrant` is called, then the answer is 403, 403 with the outcome and the reason of the decision, 403 with the reason no-decision, 404, 404, 400 or 503 with a problem response, and no grant and no event are written (SCN-IntegrationService-004, ADR-0015).",
        "AC4: Given a grant committed, when the outbox dispatcher publishes `IntegrationService/ConnectionGrantChanged` on `connections.grants.v1.connection-grant-changed`, then the event is sent under the run event envelope with `connectionId`, `tenantId`, `subjectKind`, `subjectId` and `change`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-IntegrationService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#entities-and-value-objects"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4049",
        "AIFACTORY-TASK-4050",
        "AIFACTORY-TASK-4051"
      ],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7105,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationService",
          "ProjectService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "IntegrationService/Connection"
        ],
        "apis": [
          "IntegrationService/SetGrant",
          "ProjectService/Projects.ResolveScope",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "IntegrationService/ConnectionGrantChanged"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "policy-decision-request-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "FUX-01"
        ],
        "scenarios": [
          "SCN-IntegrationService-004",
          "SCN-IntegrationService-010"
        ]
      },
      "relates": {
        "screens": [
          "connections"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1004",
        "feature:project-service",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/integration/IntegrationService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#entities-and-value-objects"
      ],
      "titlePrefix": "[AIFACTORY-US-1007]",
      "number": 1007
    },
    {
      "id": "AIFACTORY-TASK-4049",
      "type": "task",
      "parent": "AIFACTORY-US-1007",
      "title": "SetGrant for subject kind Project after Projects.ResolveScope and Policy.Decide, with ConnectionGrantChanged",
      "sequence": "06.02.05.01",
      "description": "SetGrant for subject kind Project after Projects.ResolveScope and Policy.Decide, with ConnectionGrantChanged. Expected output: SetGrant accepts subject kind Project and refuses the other kinds with 400, resolves the project and the roles of the caller through Projects.ResolveScope, asks Policy.Decide for the grant policy with a policy-decision-request-v1 of the action kind connection-grant, fixed in the service, the target connection-grant and the class shared-write, writes the grant for the outcome allow only, answers 403 with the outcome and reason of any other decision and 403 with no-decision for an answer that is no decision, writes or replaces the grant on its unique key with grantedBy and grantedAt, writes ConnectionGrantChanged with the change set or narrowed and AuditEvidenceSubmitted in the transaction, answers 200 without a write for an identical body, 404 for a foreign or unknown connection and an unknown project, and 503 without a change when a dependency does not answer.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "SetGrant accepts subject kind Project and refuses the other kinds with 400, resolves the project and the roles of the caller through Projects.ResolveScope, asks Policy.Decide for the grant policy with a policy-decision-request-v1 of the action kind connection-grant, fixed in the service, the target connection-grant and the class shared-write, writes the grant for the outcome allow only, answers 403 with the outcome and reason of any other decision and 403 with no-decision for an answer that is no decision, writes or replaces the grant on its unique key with grantedBy and grantedAt, writes ConnectionGrantChanged with the change set or narrowed and AuditEvidenceSubmitted in the transaction, answers 200 without a write for an identical body, 404 for a foreign or unknown connection and an unknown project, and 503 without a change when a dependency does not answer."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4049]",
      "number": 4049
    },
    {
      "id": "AIFACTORY-TASK-4050",
      "type": "task",
      "parent": "AIFACTORY-US-1007",
      "title": "Fakes of Projects.ResolveScope and Policy.Decide for the acceptance suite",
      "sequence": "06.02.05.02",
      "description": "Fakes of Projects.ResolveScope and Policy.Decide for the acceptance suite. Expected output: The acceptance suite holds a fake of ProjectService/Projects.ResolveScope that answers a known project with the roles of the caller and an unknown project, and a fake of PolicyEngineService/Policy.Decide that answers allow, allow-with-approval and deny with a reason, the deny the platform bundle answers for a caller who is neither Workspace admin of the project nor Platform admin, and an answer that is no decision; it records the action kind connection-grant of each request; both record their calls and can be stopped.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of ProjectService/Projects.ResolveScope that answers a known project with the roles of the caller and an unknown project, and a fake of PolicyEngineService/Policy.Decide that answers allow, allow-with-approval and deny with a reason, the deny the platform bundle answers for a caller who is neither Workspace admin of the project nor Platform admin, and an answer that is no decision; it records the action kind connection-grant of each request; both record their calls and can be stopped."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7105,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4050]",
      "number": 4050
    },
    {
      "id": "AIFACTORY-TASK-4051",
      "type": "task",
      "parent": "AIFACTORY-US-1007",
      "title": "Verify the grant of a connection through the acceptance suite",
      "sequence": "06.02.05.03",
      "description": "Verify the grant of a connection through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationService-004|Scenario=SCN-IntegrationService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1007: the first grant with the change set, the identical repeat without an event, the narrowing, the expiry, the 403 without the scope, on a denial, on the deny of the platform bundle for a caller without the role, on allow-with-approval and with no-decision, the action kind connection-grant on every decision request, the 404 for a foreign connection and an unknown project, the 400 for another subject kind, the 503 with each fake stopped and the publication of ConnectionGrantChanged with retry.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationService-004|Scenario=SCN-IntegrationService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1007: the first grant with the change set, the identical repeat without an event, the narrowing, the expiry, the 403 without the scope, on a denial, on the deny of the platform bundle for a caller without the role, on allow-with-approval and with no-decision, the action kind connection-grant on every decision request, the 404 for a foreign connection and an unknown project, the 400 for another subject kind, the 503 with each fake stopped and the publication of ConnectionGrantChanged with retry."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4051]",
      "number": 4051
    },
    {
      "id": "AIFACTORY-US-1008",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-033",
      "title": "Resolve the Azure DevOps connection of a project with its grant check and return the endpoint policy and a broker ticket, never a credential",
      "sequence": "06.02.06",
      "description": "As an operator, I want every service that calls Azure DevOps for a project to obtain the connection only through a grant check, so that a project without a grant, an inactive connection or a degraded credential stops the call before anything leaves the Factory. ToolAdapterService resolves the connection of the project when `propose-change-set` opens the change proposal, which the tool opens itself through the connection and records through `Pipelines.RecordProposal` of PipelineExecutionService (D135), and ConnectorRegistryService resolves it when a capability of its connector is resolved and when it certifies the connector. Every resolution names a project: a discovery pass of TemplateRegistryService reaches this method through ConnectorRegistryService under the platform tenant and the template-feed project of the platform tenant, a project the installation supplies whose Project grant holds the Azure DevOps connection of the template sources, and a certification under the sandbox project of the platform tenant; no path of the chain resolves without a project. The caller presents a workload token with the service scope that names IntegrationService and forwards the tenant and the project of its scope in the gRPC metadata; the token carries no tenant claim, so the service reads the forwarded tenant and project only under that scope (ADR-0015 amendment D114). The request of `IntegrationService/Connections.Resolve` is `execution-scope-v1`, whose project is the subject of the grant check; an execution scope whose tenant differs from the forwarded tenant is refused with PERMISSION_DENIED and the reason scope-mismatch and selects no row. The service looks up the connection of provider Azure DevOps that holds an unexpired grant of subject kind Project for that project under the tenant row filter. It answers with the connection, its provider and credential kind, the endpoint policy narrowed by the scopes of the grant, and a broker ticket that names the connection, the credential reference and the subject; the ticket is the one place outside the row where the reference appears, it is never logged, measured or published, and the caller exchanges the ticket with `SecretBrokerService/SecretBroker.Issue` for a short-lived credential, and the broker decides that issuance under its own policy decision. The reply never carries a credential. The method is of class read and writes nothing; `connectsoft.factory.integration.resolves` counts every call by tenant, provider and outcome. A project without a grant, or with an expired grant, is answered PERMISSION_DENIED with the reason no-grant, so the action of the caller is denied with that reason and a Workspace admin grants (failure mode of a missing grant). A connection in Draft or Verified is answered FAILED_PRECONDITION with the reason not-active and a Degraded connection with the reason degraded, so dependent calls fail fast. A tenant with no Azure DevOps connection, and a connection of another tenant, are answered NOT_FOUND. The thin scope holds one Azure DevOps connection per project; when two connections of the provider grant the same project, the answer is FAILED_PRECONDITION with the reason ambiguous and nothing is chosen. A call without a workload identity, or a workload call that forwards no tenant, is refused with UNAUTHENTICATED by the Factory profile, a token without the service scope with PERMISSION_DENIED and a request without a project with INVALID_ARGUMENT; an unavailable `integration-sql` is answered UNAVAILABLE without a partial reply. When the Secret Broker is unavailable, the caller cannot exchange its ticket and makes no outbound call (fail closed). The model names `execution-scope-v1` also as the reply, which has no member for the endpoint policy or the ticket; that is an open point for the owner, and the reply message is a provisional golden file until the owner names the descriptor. Kind: behavior. Traces: services: IntegrationService, SecretBrokerService; aggregates: IntegrationService/Connection; apis: IntegrationService/Connections.Resolve, SecretBrokerService/SecretBroker.Issue; descriptors: execution-scope-v1; adrs: ADR-0015, ADR-0019, ADR-0022; requirements: FR-05, NFR-02, XL-10; scenarios: SCN-IntegrationService-007. Depends on: AIFACTORY-US-1006, AIFACTORY-US-1007, feature:secret-broker-service. Sources: model/services/integration/IntegrationService.yaml, docs/reference/schemas/execution-scope.schema.json, docs/planes/capability-tools/connectors/services/integration-service/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given an Active and healthy Azure DevOps `IntegrationService/Connection` with an unexpired Project grant for project P, when `IntegrationService/Connections.Resolve` is called under a workload token with the service scope that forwards tenant A and project P, then the reply names the connection, provider, credential kind, the endpoint policy narrowed by the grant and a broker ticket for `SecretBrokerService/SecretBroker.Issue`, carries no credential, nothing is written and the resolve counter records the outcome granted (SCN-IntegrationService-007, NFR-02).",
        "AC2: Given a project without a grant or with an expired grant, a connection in Draft, a Degraded connection, two Azure DevOps connections that grant the same project, a tenant without such a connection or a connection of another tenant, when `IntegrationService/Connections.Resolve` is called, then the answer is PERMISSION_DENIED with the reason no-grant, FAILED_PRECONDITION with not-active, degraded or ambiguous, or NOT_FOUND, nothing is written and the counter records the outcome (SCN-IntegrationService-007, ADR-0015).",
        "AC3: Given a call without a workload identity, a workload call that forwards no tenant, a token without the service scope, an execution scope of another tenant than the forwarded one, a request without a project or an unavailable `integration-sql`, when the method is called, then it is refused with UNAUTHENTICATED, UNAUTHENTICATED, PERMISSION_DENIED, PERMISSION_DENIED with the reason scope-mismatch, INVALID_ARGUMENT or UNAVAILABLE respectively, no partial reply is returned and no state changes (SCN-IntegrationService-007, ADR-0015).",
        "AC4: Given the proto of the method, when the contract test runs, then the provisional golden file of the reply holds the connection, the endpoint policy and the ticket and no member for a credential, and the test marks it provisional because `execution-scope-v1` has no member for them (docs/reference/schemas/execution-scope.schema.json, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4052",
        "AIFACTORY-TASK-4053",
        "AIFACTORY-TASK-4054"
      ],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7106,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationService",
          "SecretBrokerService"
        ],
        "aggregates": [
          "IntegrationService/Connection"
        ],
        "apis": [
          "IntegrationService/Connections.Resolve",
          "SecretBrokerService/SecretBroker.Issue"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-02",
          "XL-10"
        ],
        "scenarios": [
          "SCN-IntegrationService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1006",
        "AIFACTORY-US-1007",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/integration/IntegrationService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/capability-tools/connectors/services/integration-service/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-1008]",
      "number": 1008
    },
    {
      "id": "AIFACTORY-TASK-4052",
      "type": "task",
      "parent": "AIFACTORY-US-1008",
      "title": "Provisional reply message of Connections.Resolve",
      "sequence": "06.02.06.01",
      "description": "Provisional reply message of Connections.Resolve. Expected output: The proto keeps execution-scope-v1 as the request, with no connection member, and fixes the reply message (connectionId, provider, credentialKind, the narrowed endpoint policy and the broker ticket with connectionId, credential reference and subject, no credential member) as a provisional golden file; the ticket is the only member outside the row that holds the credential reference, and a test fails when the reference reaches a log record, an activity, a metric or an event; the file is marked provisional in the contract test until the owner names the reply descriptor, because docs/reference/schemas/execution-scope.schema.json has no member for it.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "The proto keeps execution-scope-v1 as the request, with no connection member, and fixes the reply message (connectionId, provider, credentialKind, the narrowed endpoint policy and the broker ticket with connectionId, credential reference and subject, no credential member) as a provisional golden file; the ticket is the only member outside the row that holds the credential reference, and a test fails when the reference reaches a log record, an activity, a metric or an event; the file is marked provisional in the contract test until the owner names the reply descriptor, because docs/reference/schemas/execution-scope.schema.json has no member for it."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7106,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4052]",
      "number": 4052
    },
    {
      "id": "AIFACTORY-TASK-4053",
      "type": "task",
      "parent": "AIFACTORY-US-1008",
      "title": "Connections.Resolve with the grant check, the state check and the outcome counter",
      "sequence": "06.02.06.02",
      "description": "Connections.Resolve with the grant check, the state check and the outcome counter. Expected output: Connections.Resolve reads the forwarded tenant and project only under the service scope, refuses a differing execution scope with PERMISSION_DENIED and scope-mismatch, finds the Azure DevOps connection with an unexpired Project grant for the project, returns the reply with the narrowed endpoint policy and the broker ticket and no credential, answers PERMISSION_DENIED no-grant, FAILED_PRECONDITION not-active, degraded or ambiguous, NOT_FOUND, INVALID_ARGUMENT and UNAVAILABLE as AIFACTORY-US-1008 states, writes nothing and records connectsoft.factory.integration.resolves by tenant, provider and outcome.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Connections.Resolve reads the forwarded tenant and project only under the service scope, refuses a differing execution scope with PERMISSION_DENIED and scope-mismatch, finds the Azure DevOps connection with an unexpired Project grant for the project, returns the reply with the narrowed endpoint policy and the broker ticket and no credential, answers PERMISSION_DENIED no-grant, FAILED_PRECONDITION not-active, degraded or ambiguous, NOT_FOUND, INVALID_ARGUMENT and UNAVAILABLE as AIFACTORY-US-1008 states, writes nothing and records connectsoft.factory.integration.resolves by tenant, provider and outcome."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4053]",
      "number": 4053
    },
    {
      "id": "AIFACTORY-TASK-4054",
      "type": "task",
      "parent": "AIFACTORY-US-1008",
      "title": "Verify the resolution of a connection through the acceptance suite",
      "sequence": "06.02.06.03",
      "description": "Verify the resolution of a connection through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IntegrationService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1008 with connections and grants of two tenants written through the operations of this feature: the granted reply with the ticket, no-grant, the expired grant, not-active, degraded, ambiguous, NOT_FOUND for a foreign tenant, the six refusals, the outcome counter and the provisional golden file.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IntegrationService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1008 with connections and grants of two tenants written through the operations of this feature: the granted reply with the ticket, no-grant, the expired grant, not-active, degraded, ambiguous, NOT_FOUND for a foreign tenant, the six refusals, the outcome counter and the provisional golden file."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 71,
      "phase": "factory",
      "stackRank": 7106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4054]",
      "number": 4054
    },
    {
      "id": "AIFACTORY-FEAT-034",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-006",
      "title": "IntegrationHost: gateway delivery",
      "sequence": "06.03",
      "description": "IntegrationHost is the platform API gateway of bounded context BC-16 (Connections). The API gateway of the Integration platform (ADR-0028): routes public REST and internal gRPC calls to the 2 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.IntegrationHost. Delivers: IntegrationHost (complete). Increment I1: Generate a microservice. Build order 72 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-082",
        "AIFACTORY-US-1009",
        "AIFACTORY-US-1010",
        "AIFACTORY-US-1011",
        "AIFACTORY-US-1012",
        "AIFACTORY-US-1013"
      ],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7200,
      "titlePrefix": "[AIFACTORY-FEAT-034]",
      "number": 34
    },
    {
      "id": "AIFACTORY-US-082",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-034",
      "title": "IntegrationHost routes the calls of its platform under a trusted scope",
      "sequence": "06.03.01",
      "description": "As a platform admin, I want one gateway in front of ConnectorRegistryService and IntegrationService that validates tokens and scopes, so that no service of the Integration platform is reachable from outside the cluster except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the Integration platform. ADR-0028 re-scopes the former composition host as the API gateway of its platform: IntegrationHost routes public REST and internal gRPC calls to the two services the model lists under `deployment.fronts`, ConnectorRegistryService and IntegrationService, validates tokens and scopes and owns no business state, no relational store and no secret. It loads no connector adapter: the adapters are loaded by ConnectorRegistryService, and the webhook ingress is the separate conditional WebhookGatewayService. The repository ConnectSoft.AI.SoftwareFactory.IntegrationHost is created and scaffolded in I0 by AIFACTORY-TASK-463 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; it was scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway therefore has no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`). A user token has one audience, this gateway, and the gateway forwards it to the fronted service unchanged and exchanges no token, because the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). A workload token carries service scopes and no tenant claim and is admitted only on an internal gRPC route whose operation names a service scope the token holds (ADR-0015 amendment D114). The feature is delivered by five further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-1009), token, tenant and scope on every read route (AIFACTORY-US-1010), the shared-write and sandbox routes with their idempotency key and their project (AIFACTORY-US-1011), the external and production routes whose gate stays in the fronted service (AIFACTORY-US-1012), and health, adapters, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-1013). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. A project-scoped route names its project in the path, in a query parameter or in a body member and never in a header the caller types; the gateway admits the project only for a token that holds a role claim for it or the tenant-wide Platform admin role, answers 403 itself otherwise, and sets the project header from the admitted project; a project header a caller sends is dropped on every REST route and for every user token. On an internal gRPC route the tenant and project metadata of a workload token that holds the service scope of the route are forwarded unchanged, because the fronted service reads a forwarded tenant and project only under that scope (ADR-0015 amendment D114). Every other route is forwarded under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing right and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. The gateway is of increment I1, like the other gateways (D127, D129), and every dependency of this feature is of I0 or I1, the two fronted services included; the REST operations of the two thin services are reached through this gateway from the first delivery, and this feature adds no direct public route to either service. Both services are delivered thin in I1 and complete in I5: a route whose operation a thin delivery does not host returns the answer of that service unchanged until I5, and the refusals and failure branches of every route class are proven against fakes generated from the fronts file. In I1 a Workspace admin or Platform admin provisions the connection of a project and a Platform admin of the platform tenant certifies the Azure DevOps connector through the public routes of this gateway, by the runbooks AIFACTORY-TASK-4070 of feature `integration-service-thin` and AIFACTORY-TASK-4069 of feature `connector-registry-service-thin` (D129). StudioBff, delivered in I3, is the caller the model names for the public routes, for the administration of connections and connectors in its own PBIs (D129). A gateway calls no other gateway and consumes no event: ToolAdapterService and KnowledgeIngestionService call IntegrationService and ConnectorRegistryService directly, and the verified deliveries reach ConnectorRegistryService directly. The typed client of this gateway is published by feature `typed-gateway-clients` from the OpenAPI document of AIFACTORY-US-1009, and this feature builds no client package. The gateway invents no response. Kind: enabling. Traces: services: IntegrationHost, ConnectorRegistryService, IntegrationService; apis: IntegrationHost/IntegrationHealth; adrs: ADR-0012, ADR-0015, ADR-0016, ADR-0017, ADR-0022, ADR-0028; requirements: FR-01, FR-05, NFR-18. Depends on: AIFACTORY-US-1009, AIFACTORY-US-1010, AIFACTORY-US-1011, AIFACTORY-US-1012, AIFACTORY-US-1013, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai, feature:connector-registry-service-thin, feature:integration-service-thin. Sources: model/services/integration/IntegrationHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0016-architecture-meta-model.md, docs/planes/capability-tools/connectors/services/integration-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.IntegrationHost created and scaffolded in I0 by AIFACTORY-TASK-463 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.IntegrationHost --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/integration/IntegrationHost.yaml).",
        "AC2: Given a valid token for a route of each fronted service, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with the token unchanged, the tenant, the project the gateway admitted where the route names one, the correlation id and the trace context, the fronted service answers and the response returns unchanged, as AIFACTORY-US-1010 to AIFACTORY-US-1012 prove per route class (ADR-0015, FR-01).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration, a message consumer or a connector adapter, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret, and no event of the model lists IntegrationHost as a consumer (ADR-0028, ADR-0012, model/services/integration/IntegrationHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `IntegrationHost/IntegrationHealth` is probed and one replica is stopped, then health reports the identity platform and the two fronted services, a replica stays in rotation while it can validate tokens, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, NFR-18)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0016-architecture-meta-model.md",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-4055",
        "AIFACTORY-TASK-758"
      ],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7201,
      "kind": "enabling",
      "traces": {
        "services": [
          "IntegrationHost",
          "ConnectorRegistryService",
          "IntegrationService"
        ],
        "apis": [
          "IntegrationHost/IntegrationHealth"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0016",
          "ADR-0017",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "FR-05",
          "NFR-18"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1009",
        "AIFACTORY-US-1010",
        "AIFACTORY-US-1011",
        "AIFACTORY-US-1012",
        "AIFACTORY-US-1013",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:connector-registry-service-thin",
        "feature:integration-service-thin"
      ],
      "source": [
        "model/services/integration/IntegrationHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0016-architecture-meta-model.md",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-082]",
      "number": 82
    },
    {
      "id": "AIFACTORY-TASK-4055",
      "type": "task",
      "parent": "AIFACTORY-US-082",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "06.03.01.01",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 8, the ports https 7900 and grpc 7902, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/integration/IntegrationHost.yaml records them; it leaves Integration:Host:FrontedServices at its default, the two service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid and on-prem topologies (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 8, the ports https 7900 and grpc 7902, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/integration/IntegrationHost.yaml records them; it leaves Integration:Host:FrontedServices at its default, the two service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid and on-prem topologies (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7201,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-4055]",
      "number": 4055
    },
    {
      "id": "AIFACTORY-TASK-758",
      "type": "task",
      "parent": "AIFACTORY-US-082",
      "title": "Verify integration-host-routes-its-platform by running the declared command",
      "sequence": "06.03.01.02",
      "description": "Verify integration-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-082, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes IntegrationHost/IntegrationHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-082, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes IntegrationHost/IntegrationHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-758]",
      "number": 758
    },
    {
      "id": "AIFACTORY-US-1009",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-034",
      "title": "Integration fronts file: named clients and REST and gRPC routes of the two fronted services, generated at build",
      "sequence": "06.03.02",
      "description": "As a platform admin, I want the route table of the integration gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope, its class and its project rule and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Integration platform. It lists the two services of `deployment.fronts` in model/services/integration/IntegrationHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method with its streaming mode, scope, side-effect class and idempotency. For ConnectorRegistryService these are the five REST operations `ListConnectors`, `CertifyConnector`, `CreateSubscription`, `ListDeliveries` and `ReplayDelivery` and the gRPC methods `Connectors.Deliver` and `Connectors.ResolveCapability`. For IntegrationService these are the six REST operations `RegisterConnection`, `ListConnections`, `VerifyConnection`, `SetGrant`, `RotateCredential` and `RevokeConnection` and the gRPC method `Connections.Resolve`. That is eleven REST routes and three unary gRPC routes. The file holds the whole surface of the model, also for the operations the thin deliveries of I1 do not host: the route exists, and until the complete deliveries of I5 it returns the answer of the service unchanged. Each route carries the scope and the side-effect class of its operation, which is what the route class PBIs of this feature enforce; an internal gRPC route names the service scope a workload token must hold. Each REST entry also states how its operation addresses a project, and the four markings cover all eleven. `SetGrant` names its project in the path parameter `subjectId` when `subjectKind` is Project and addresses a connection only for the other kinds. `CertifyConnector` names its project in the body member `projectId`, as the thin contract of ConnectorRegistryService fixes it, and so does `CreateSubscription`, as stated below. `ReplayDelivery`, `VerifyConnection`, `RotateCredential` and `RevokeConnection` address a delivery or a connection by identifier only. `ListConnectors`, `ListDeliveries`, `RegisterConnection` and `ListConnections` act on the tenant of the token by design, because a connector descriptor, a delivery and a connection carry no project. `CreateSubscription` names its project in the required body member `projectId`, a call without it is answered 400 by the service, and the gateway admits that project against the roles of the token and answers 403 for a project the token does not grant (D129). A test lists the emitted route table against the file and against the two service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `IntegrationHealth` and `IntegrationAdapters`, transforms no payload and composes no response from two services. The option `Integration:Host:FrontedServices` is bound at startup and compared with the service names of the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable, and its default in the model names the two service identifiers of `deployment.fronts`, so the deployment manifest does not set it. The pipeline publishes the OpenAPI document of the eleven public REST operations as a build output, checked against the fronts file and the two service files; feature `typed-gateway-clients` generates the typed client of this gateway from it, and this feature builds no client package. Kind: enabling. Traces: services: IntegrationHost, ConnectorRegistryService, IntegrationService; adrs: ADR-0015, ADR-0016, ADR-0028; requirements: FR-01. Depends on: feature:component-api-gateway-template, feature:connector-registry-service-thin, feature:integration-service-thin. Sources: model/services/integration/IntegrationHost.yaml, model/services/integration/ConnectorRegistryService.yaml, model/services/integration/IntegrationService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/architecture/api-governance.md, docs/planes/capability-tools/connectors/services/integration-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Integration platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, eleven REST routes and three gRPC routes, each with the scope, side-effect class, idempotency and project marking of the operation, and the route table test passes against model/services/integration/IntegrationHost.yaml, model/services/integration/ConnectorRegistryService.yaml and model/services/integration/IntegrationService.yaml (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `Integration:Host:FrontedServices` at its default, when the gateway starts, then startup succeeds; given a value that names no service of the fronts file or omits one, then startup fails with the differing name; given a path no route matches, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header carrying the token of the caller unchanged, the tenant, the correlation id and the trace context, a project header sent by the caller on the REST route has been dropped, the tenant and project metadata of the workload token on the gRPC route have been forwarded unchanged, and the response of the fake returns unchanged (ADR-0015, FR-01).",
        "AC4: Given the built gateway, when its pipeline publishes the OpenAPI document of the public REST routes, then the document holds exactly the eleven REST operations of the fronts file with their methods, paths, scopes and response codes and no internal gRPC method, and a contract check fails the build when it differs from the two service files under model/services/integration (docs/architecture/api-governance.md)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-464",
        "AIFACTORY-TASK-4056",
        "AIFACTORY-TASK-4057",
        "AIFACTORY-TASK-4058"
      ],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7202,
      "kind": "enabling",
      "traces": {
        "services": [
          "IntegrationHost",
          "ConnectorRegistryService",
          "IntegrationService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0016",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:connector-registry-service-thin",
        "feature:integration-service-thin"
      ],
      "source": [
        "model/services/integration/IntegrationHost.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-1009]",
      "number": 1009
    },
    {
      "id": "AIFACTORY-TASK-464",
      "type": "task",
      "parent": "AIFACTORY-US-1009",
      "title": "Fronts file with the REST and gRPC operations of ConnectorRegistryService and IntegrationService",
      "sequence": "06.03.02.01",
      "description": "Fronts file with the REST and gRPC operations of ConnectorRegistryService and IntegrationService. Expected output: The fronts file lists the two services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation one of four project markings that together cover all eleven: the path parameter subjectId for SetGrant when subjectKind is Project, the body member projectId for CertifyConnector and CreateSubscription, the second admitted against the roles of the token (D129), a resource identifier only for ReplayDelivery, VerifyConnection, RotateCredential and RevokeConnection, and the tenant of the token by design for ListConnectors, ListDeliveries, RegisterConnection and ListConnections; a test fails when a REST operation carries none or more than one marking; the build emits the named clients, the eleven REST routes, the three gRPC routes and the route table; Integration:Host:FrontedServices is compared with the fronts file at startup; a project header of a caller is dropped on every REST route and for every user token, and on an internal gRPC route the tenant and project metadata of a workload token that holds the service scope of the route are forwarded unchanged (ADR-0015 amendment D114).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the two services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation one of four project markings that together cover all eleven: the path parameter subjectId for SetGrant when subjectKind is Project, the body member projectId for CertifyConnector and CreateSubscription, the second admitted against the roles of the token (D129), a resource identifier only for ReplayDelivery, VerifyConnection, RotateCredential and RevokeConnection, and the tenant of the token by design for ListConnectors, ListDeliveries, RegisterConnection and ListConnections; a test fails when a REST operation carries none or more than one marking; the build emits the named clients, the eleven REST routes, the three gRPC routes and the route table; Integration:Host:FrontedServices is compared with the fronts file at startup; a project header of a caller is dropped on every REST route and for every user token, and on an internal gRPC route the tenant and project metadata of a workload token that holds the service scope of the route are forwarded unchanged (ADR-0015 amendment D114)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-464]",
      "number": 464
    },
    {
      "id": "AIFACTORY-TASK-4056",
      "type": "task",
      "parent": "AIFACTORY-US-1009",
      "title": "Fakes of the two fronted services and the token matrix of the acceptance suite",
      "sequence": "06.03.02.02",
      "description": "Fakes of the two fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and a switch that makes it stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and a switch that makes it stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7202,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4056]",
      "number": 4056
    },
    {
      "id": "AIFACTORY-TASK-4057",
      "type": "task",
      "parent": "AIFACTORY-US-1009",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "06.03.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the eleven public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares it with the two service files under model/services/integration and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so feature typed-gateway-clients can generate the client of this gateway from it; no client package is built here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the eleven public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares it with the two service files under model/services/integration and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so feature typed-gateway-clients can generate the client of this gateway from it; no client package is built here."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7202,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4057]",
      "number": 4057
    },
    {
      "id": "AIFACTORY-TASK-4058",
      "type": "task",
      "parent": "AIFACTORY-US-1009",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "06.03.02.04",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1009: one route per operation of the two service files under model/services/integration with its project marking, the failing builds, the start with the option at its default, the failing startup on a differing value, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller on the REST route and the forwarded metadata of the workload on the gRPC route, and the contract check of the published OpenAPI document.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1009: one route per operation of the two service files under model/services/integration with its project marking, the failing builds, the start with the option at its default, the failing startup on a differing value, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller on the REST route and the forwarded metadata of the workload on the gRPC route, and the contract check of the published OpenAPI document."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4058]",
      "number": 4058
    },
    {
      "id": "AIFACTORY-US-1010",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-034",
      "title": "A read route of the integration gateway forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "06.03.03",
      "description": "As a workspace admin, I want my reads of connectors, deliveries and connections to reach the services only with the tenant and the scope my token grants, so that I see the connections and connectors of my tenant and nobody reads across a tenant through the gateway. A caller reaches a read operation of the Integration platform through the gateway: a Workspace admin, an Operator or an Observer lists the connector descriptors, the deliveries and the connections, as the Studio screens of connectors and connections do through StudioBff; a workload that the model routes through this gateway resolves a capability or a connection over gRPC, while ToolAdapterService and ConnectorRegistryService call IntegrationService directly inside the cluster. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment D114). The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires `factory.connections.read`, the scope of `ListConnectors`, `ListDeliveries` and `ListConnections`. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. The three read operations act on the tenant of the token by design, because a descriptor, a delivery and a connection carry no project: the gateway forwards them under the tenant of the token and the scope of the operation, the fronted service applies its tenant row filter, and its answer returns unchanged. A project header a caller sends is dropped and establishes nothing. Every public REST operation names a `factory.` scope and none names a service scope, so a workload token on a REST route is answered 403. The scope is established once with the scope accessor of the pinned abstractions package and forwarded: the authorization header with the user token itself, the tenant in `X-Tenant-Id`, the correlation id and the trace context; the gateway exchanges no token (ADR-0015 amendment D117). The internal gRPC surface has two read methods, `Connectors.ResolveCapability` and `Connections.Resolve`. A workload presents a token with service scopes, no audience of a user API and no tenant claim, and each gRPC route names the service scope the token must hold; for a token that holds it the gateway forwards the `tenant-id` and project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope; for a token without it, and for a user token, the answer is PERMISSION_DENIED and no fronted service is called. The NOT_FOUND, PERMISSION_DENIED and FAILED_PRECONDITION answers of the fronted service, with their reasons, return unchanged. For every read route the response is served by the fronted service with no side effect and returns unchanged with the correlation id; the gateway keeps nothing of the call and records `connectsoft.factory.integration.host.requests` and `connectsoft.factory.integration.host.request_duration` for the route. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope 403; in each case no fronted service is called and the refusal is counted for the route and logged with the correlation id and without the token. When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a retry hint that names the service and never its address, and the routes of the other service keep serving. `ListDeliveries` is not hosted by the thin ConnectorRegistryService before I5, so its answer is the answer of that service, returned unchanged. Kind: behavior. Traces: services: IntegrationHost, ConnectorRegistryService, IntegrationService; adrs: ADR-0015, ADR-0028; requirements: FR-01, FUX-01; scenarios: SCN-IntegrationHost-005. Relates: screens: connections, connectors. Depends on: AIFACTORY-US-1009, feature:component-api-gateway-template, feature:component-extensions-ai. Sources: model/services/integration/IntegrationHost.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/capability-tools/connectors/services/integration-host/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with `factory.connections.read`, when the read route of `ListConnections` is called, then the gateway forwards the call with the user token unchanged, without a token exchange, the tenant of the `tid` claim, the correlation id and the trace context, IntegrationService answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-IntegrationHost-005, ADR-0015).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes of the two fronted services are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope and a workload token on a REST route are answered 403, and in none of these cases a fronted service is called; each refusal is counted for its route and logged with the correlation id and without the token (SCN-IntegrationHost-005, ADR-0015).",
        "AC3: Given a valid user token, a tenant header of the caller that names another tenant and a project header of the caller, when the routes of `ListConnectors`, `ListDeliveries` and `ListConnections` are called, then the tenant header is overwritten with the `tid` claim, the project header is dropped, the calls are forwarded under the tenant of the token and the answers of the fakes return unchanged, as model/services/integration/IntegrationHost.yaml and the two service files name no project for these operations (SCN-IntegrationHost-005).",
        "AC4: Given a workload token that holds the service scope the route names, when the gRPC routes of `Connectors.ResolveCapability` and `Connections.Resolve` are called with `tenant-id` and project metadata, then the gateway forwards each call with that metadata unchanged and returns the reply, and the NOT_FOUND, PERMISSION_DENIED and FAILED_PRECONDITION answers of the fakes with their reasons unchanged; given a workload token without the scope, or a user token, then the answer is PERMISSION_DENIED and no fronted service is called (SCN-IntegrationHost-005, ADR-0015).",
        "AC5: Given a fronted service that does not answer, when its read routes are called, then the gateway answers 503, over gRPC UNAVAILABLE, with a problem response that carries a retry hint and names the service and never its address, no response is invented, and the read routes of the other service keep serving (SCN-IntegrationHost-005, model/services/integration/IntegrationHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4059",
        "AIFACTORY-TASK-4060"
      ],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7203,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationHost",
          "ConnectorRegistryService",
          "IntegrationService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "FUX-01"
        ],
        "scenarios": [
          "SCN-IntegrationHost-005"
        ]
      },
      "relates": {
        "screens": [
          "connections",
          "connectors"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1009",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/integration/IntegrationHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-1010]",
      "number": 1010
    },
    {
      "id": "AIFACTORY-TASK-4059",
      "type": "task",
      "parent": "AIFACTORY-US-1010",
      "title": "Issuer, audience, scope and tenant configuration of the read routes",
      "sequence": "06.03.03.01",
      "description": "Issuer, audience, scope and tenant configuration of the read routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped; ListConnectors, ListDeliveries and ListConnections are forwarded under the tenant of the token; a workload token is refused with 403 on a REST route; the two gRPC read routes name the service scope a workload token must hold and forward the tenant-id and project metadata unchanged with it; the user token is forwarded unchanged and no token is exchanged; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped; ListConnectors, ListDeliveries and ListConnections are forwarded under the tenant of the token; a workload token is refused with 403 on a REST route; the two gRPC read routes name the service scope a workload token must hold and forward the tenant-id and project metadata unchanged with it; the user token is forwarded unchanged and no token is exchanged; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4059]",
      "number": 4059
    },
    {
      "id": "AIFACTORY-TASK-4060",
      "type": "task",
      "parent": "AIFACTORY-US-1010",
      "title": "Verify the read routes through the acceptance suite",
      "sequence": "06.03.03.02",
      "description": "Verify the read routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IntegrationHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1010 over the token matrix: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, a workload token refused on a REST route, the two gRPC read routes with and without the service scope and the status answers of the fakes returned with their reasons, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IntegrationHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1010 over the token matrix: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, a workload token refused on a REST route, the two gRPC read routes with and without the service scope and the status answers of the fakes returned with their reasons, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4060]",
      "number": 4060
    },
    {
      "id": "AIFACTORY-US-1011",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-034",
      "title": "A shared-write or sandbox route of the integration gateway admits the project it names, passes the idempotency key through and keeps nothing between calls",
      "sequence": "06.03.04",
      "description": "As a workspace admin, I want a registration, a grant, a replay or a certification I repeat after a failure to be applied once, and a project I name to be checked against my roles, so that a lost answer or a restarted gateway never registers a second connection or runs a second certification, and nobody grants a connection to a project they hold no role in. A shared-write operation changes state that others read. The Integration platform has three on its public surface: `RegisterConnection` and `SetGrant` of IntegrationService under `factory.connections.admin` and `ReplayDelivery` of ConnectorRegistryService under `factory.connections.operate`. Its one sandbox operation is `CertifyConnector` of ConnectorRegistryService under `factory.connections.admin`, whose conformance suite runs against a sandbox connection, so its effect stays in the sandbox system. The caller sends each through the gateway under the token, tenant and scope rules of AIFACTORY-US-1010. Two of them name a project. `SetGrant` names it in the path parameter `subjectId` when `subjectKind` is Project, and `CertifyConnector` in the body member `projectId`: the gateway admits the project only for a token that holds a role claim for it or the tenant-wide Platform admin role, sets the project header from it, and answers 403 itself for a project the token does not grant, calling no service. Whether the role suffices to grant is decided by IntegrationService through the policy decision of PolicyEngineService, not by the gateway. `ReplayDelivery` addresses a delivery by identifier and `RegisterConnection` writes under the tenant of the token; the gateway forwards them under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing right and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. `RegisterConnection` and `CertifyConnector` declare idempotency `key-header` and are called with an `Idempotency-Key`; the gateway forwards the header unchanged and the fronted service applies the request once under its own rule: the same key with the same body returns the same result, and its answer for a key reused with a different body, 409 for `RegisterConnection`, returns unchanged. `SetGrant` and `ReplayDelivery` are naturally idempotent and need no key. The gateway is no party to idempotency: it stores neither a key nor a result, keeps no session and no pending call, has no outbox and writes no event, so a replica that crashes during a call loses nothing; the replica restarts, nothing is replayed, and the caller retries with the same key and receives from the service the result of the one application. The gateway reads no credential and no body member but the project it admits; a body that carries a credential value is refused with 400 by IntegrationService, and that answer returns unchanged. When the fronted service does not answer, the route answers 503 with a problem response that names the service and carries a retry hint, the other routes keep serving, and the caller retries with its key. `ReplayDelivery` is not hosted by the thin ConnectorRegistryService before I5, so its route is proven against the fake and returns the answer of the thin service on a deployed instance. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: IntegrationHost, ConnectorRegistryService, IntegrationService; adrs: ADR-0015, ADR-0028; requirements: FR-01, FUX-01; scenarios: SCN-IntegrationHost-006, SCN-IntegrationHost-007. Relates: screens: connections, connectors. Depends on: AIFACTORY-US-1009, AIFACTORY-US-1010, feature:component-api-gateway-template. Sources: model/services/integration/IntegrationHost.yaml, model/services/integration/IntegrationService.yaml, model/services/integration/ConnectorRegistryService.yaml, docs/planes/capability-tools/connectors/services/integration-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a valid token with `factory.connections.admin` and the route of `RegisterConnection`, whose operation declares idempotency `key-header`, when the call arrives with an `Idempotency-Key`, then the gateway forwards the request with the header and the body unchanged, the fake of IntegrationService applies it once and the response returns unchanged with the correlation id; the same call repeated returns the result of the first application, and the 409 of the fake for the same key with a different body returns unchanged; the gateway has stored neither the key nor a result in the shared cache or anywhere else (SCN-IntegrationHost-007, ADR-0028).",
        "AC2: Given the route of `SetGrant` with `subjectKind` Project and a project in `subjectId`, when the token holds a role claim for that project or the tenant-wide Platform admin role, then the call is forwarded with the project in the project header the gateway sets and the answer of the fake, 200 or the 403 of a denied policy decision, returns unchanged; when the token holds neither, then the gateway answers 403 itself and no fronted service is called (SCN-IntegrationHost-007, ADR-0015).",
        "AC3: Given the sandbox route of `CertifyConnector` with a `projectId` body member and an `Idempotency-Key`, when the token holds a role claim for that project, then the call is forwarded with the key and the body unchanged and the 202 of the fake returns unchanged, and when the token holds none, then the gateway answers 403 itself and no fronted service is called; given the fake answering 404 for a descriptor of another tenant (ADR-0015 amendment D113), then that answer returns unchanged (SCN-IntegrationHost-006, ADR-0015).",
        "AC4: Given a call of `RegisterConnection` with an `Idempotency-Key` in progress, when the gateway replica that holds it is stopped and the caller retries with the same key through another replica, then the second replica forwards the repeated call, the fake applied the request once and returns the result of that application, and the gateway replayed nothing; given a call without a token, a token without the scope or a fronted service that does not answer, then the answer is 401, 403 or 503 with a retry hint that names the service, and a call the gateway refuses reaches no fronted service (SCN-IntegrationHost-007, model/services/integration/IntegrationHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4061",
        "AIFACTORY-TASK-4062"
      ],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7204,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationHost",
          "ConnectorRegistryService",
          "IntegrationService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "FUX-01"
        ],
        "scenarios": [
          "SCN-IntegrationHost-006",
          "SCN-IntegrationHost-007"
        ]
      },
      "relates": {
        "screens": [
          "connections",
          "connectors"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1009",
        "AIFACTORY-US-1010",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/integration/IntegrationHost.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1011]",
      "number": 1011
    },
    {
      "id": "AIFACTORY-TASK-4061",
      "type": "task",
      "parent": "AIFACTORY-US-1011",
      "title": "Project admission of SetGrant and CertifyConnector and a stateless write path",
      "sequence": "06.03.04.01",
      "description": "Project admission of SetGrant and CertifyConnector and a stateless write path. Expected output: The route of SetGrant admits the subjectId of its path when subjectKind is Project, and the route of CertifyConnector the projectId body member, only for a token with a role claim for that project or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself otherwise; every shared-write and sandbox route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "The route of SetGrant admits the subjectId of its path when subjectKind is Project, and the route of CertifyConnector the projectId body member, only for a token with a role claim for that project or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself otherwise; every shared-write and sandbox route forwards the Idempotency-Key header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4061]",
      "number": 4061
    },
    {
      "id": "AIFACTORY-TASK-4062",
      "type": "task",
      "parent": "AIFACTORY-US-1011",
      "title": "Verify the shared-write and sandbox routes through the acceptance suite",
      "sequence": "06.03.04.02",
      "description": "Verify the shared-write and sandbox routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationHost-006|Scenario=SCN-IntegrationHost-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1011 with a fake that applies a key once and answers 409 for the same key with a different body, the routes of SetGrant and CertifyConnector with a granted and a refused project, the 404 of the fake returned unchanged, a replica stopped during a call and the retry through the second replica, a fake that stops answering and an inspection of the shared cache that finds no key and no body.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationHost-006|Scenario=SCN-IntegrationHost-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1011 with a fake that applies a key once and answers 409 for the same key with a different body, the routes of SetGrant and CertifyConnector with a granted and a refused project, the 404 of the fake returned unchanged, a replica stopped during a call and the retry through the second replica, a fake that stops answering and an inspection of the shared cache that finds no key and no body."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4062]",
      "number": 4062
    },
    {
      "id": "AIFACTORY-US-1012",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-034",
      "title": "An external or production route of the integration gateway is forwarded under its scope and the gate of the action stays in the fronted service",
      "sequence": "06.03.05",
      "description": "As a workspace admin, I want a verification, a subscription, an outbound delivery, a rotation or a revocation to be decided by the service that owns its state, with the gateway only checking who I am and what I may call, so that an approval is never decided twice or by a component that holds no state, and no external call leaves the Factory from the gateway. Two side-effect classes of the Integration platform reach beyond the Factory. The external routes are `VerifyConnection` of IntegrationService, a read-only probe of the credential through the Secret Broker, `CreateSubscription` of ConnectorRegistryService, which subscribes to provider events through a connection and creates the ingress identity of the webhook gateway, and the internal gRPC method `Connectors.Deliver`, the outbound delivery of an external-class tool with its policy decision and approval. The production routes are `RotateCredential` and `RevokeConnection` of IntegrationService, which affect every dependent system. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, requires `factory.connections.admin` on the four REST routes and, on `Connectors.Deliver`, a workload token that holds the service scope of the route, and forwards the call with the established scope. The four REST routes address a connection by identifier or, for `CreateSubscription`, name the project in the body member `projectId`, which the gateway admits against the roles of the token and answers 403 for a project the token does not grant (D129, AIFACTORY-US-1009), so the gateway forwards them under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing right and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. The `Idempotency-Key` of `VerifyConnection`, `CreateSubscription` and `RotateCredential` passes through unchanged. The gate itself is decided where the state is. Whether an action needs an approval is decided by the policy decision of PolicyEngineService alone, never by the gateway; a tool call reaches ConnectorRegistryService through ToolAdapterService, which carries that decision and the approval in `tool-invocation-v1`, and the gateway passes the message through unchanged. The gateway evaluates no policy and no approval, holds no approval reference, calls no connector, resolves no connection, reads no credential, writes no receipt and no audit evidence; the service that owns a command writes its event and its audit evidence `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` to its own outbox in the transaction of the command. The answer of the fronted service, including 200, 201, 202, 409 and the gRPC status of a delivery, returns unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. `VerifyConnection` is hosted by the thin IntegrationService of I1. `CreateSubscription`, `Connectors.Deliver`, `RotateCredential` and `RevokeConnection` are not hosted before the complete deliveries of I5, so their routes are proven against fakes generated from the fronts entries and return the answer of the thin service on a deployed instance. Kind: behavior. Traces: services: IntegrationHost, ConnectorRegistryService, IntegrationService; descriptors: tool-invocation-v1; adrs: ADR-0015, ADR-0019, ADR-0022, ADR-0028; requirements: FR-05, NFR-02, XL-10; scenarios: SCN-IntegrationHost-003, SCN-IntegrationHost-004. Relates: screens: connections, connectors. Depends on: AIFACTORY-US-1009, AIFACTORY-US-1010, feature:component-api-gateway-template. Sources: model/services/integration/IntegrationHost.yaml, model/services/integration/IntegrationService.yaml, model/services/integration/ConnectorRegistryService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0022-mcp-as-tool-protocol.md.",
      "acceptanceCriteria": [
        "AC1: Given a token with `factory.connections.admin`, when the external route of `VerifyConnection` is called with an `Idempotency-Key`, then the gateway forwards the call with the key unchanged under the tenant of the token, IntegrationService answers 200 with the outcome and that answer returns unchanged with the correlation id; the gateway called no connector, read no credential and wrote no receipt and no evidence (SCN-IntegrationHost-003, ADR-0028).",
        "AC2: Given a workload token with the service scope of the route and a `tool-invocation-v1` message that carries a policy decision and an approval, when the gRPC route of `Connectors.Deliver` is called against the fake of ConnectorRegistryService, then the message and the forwarded metadata reach the fake unchanged and its reply or status returns unchanged; given a user token or a workload token without the scope, then the answer is PERMISSION_DENIED and no fronted service is called; given the route of `CreateSubscription` against the fake answering 201 or 409, then each answer returns unchanged (SCN-IntegrationHost-003, ADR-0022).",
        "AC3: Given a token with `factory.connections.admin`, when the production routes of `RotateCredential` and `RevokeConnection` are called against the fake of IntegrationService answering 200, 403, 404 or 409, then the gateway forwards each call under the tenant of the token and the scope of the operation, with the `Idempotency-Key` of the rotation unchanged, and returns each answer unchanged; the gateway evaluated no approval and holds none (SCN-IntegrationHost-004, ADR-0028).",
        "AC4: Given a call without a token or with an expired token, or a token that lacks the scope of the operation, when an external or production route is called, then the gateway answers 401 or 403 and no fronted service is called; given a route that names only a `connectionId`, when the fronted service answers 403 for a missing right or 404 for a connection of another tenant (ADR-0015 amendment D113), then the gateway returns that answer unchanged (SCN-IntegrationHost-003, SCN-IntegrationHost-004, ADR-0015).",
        "AC5: Given the route class register of the gateway, when the register test lists every route of class external and production from the route table, then each has a scope, and the test fails when the gateway holds a handler, a cache entry or a store for an approval, a credential, a connection, a receipt or an evidence record (SCN-IntegrationHost-004, model/services/integration/IntegrationHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4063",
        "AIFACTORY-TASK-4064",
        "AIFACTORY-TASK-4065"
      ],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7205,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationHost",
          "ConnectorRegistryService",
          "IntegrationService"
        ],
        "descriptors": [
          "tool-invocation-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "NFR-02",
          "XL-10"
        ],
        "scenarios": [
          "SCN-IntegrationHost-003",
          "SCN-IntegrationHost-004"
        ]
      },
      "relates": {
        "screens": [
          "connections",
          "connectors"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1009",
        "AIFACTORY-US-1010",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/services/integration/IntegrationHost.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1012]",
      "number": 1012
    },
    {
      "id": "AIFACTORY-TASK-4063",
      "type": "task",
      "parent": "AIFACTORY-US-1012",
      "title": "Route class register of the external and production routes of the gateway",
      "sequence": "06.03.05.01",
      "description": "Route class register of the external and production routes of the gateway. Expected output: A register test lists every route of class external and production from the route table, VerifyConnection, CreateSubscription, Connectors.Deliver, RotateCredential and RevokeConnection, and fails when such a route has no scope, when the gRPC route of Connectors.Deliver admits a token without its service scope, or when the gateway holds a handler, a cache entry or a store for an approval, a credential, a connection, a receipt or an evidence record; the Idempotency-Key of the three key-header operations is forwarded unchanged.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "A register test lists every route of class external and production from the route table, VerifyConnection, CreateSubscription, Connectors.Deliver, RotateCredential and RevokeConnection, and fails when such a route has no scope, when the gRPC route of Connectors.Deliver admits a token without its service scope, or when the gateway holds a handler, a cache entry or a store for an approval, a credential, a connection, a receipt or an evidence record; the Idempotency-Key of the three key-header operations is forwarded unchanged."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4063]",
      "number": 4063
    },
    {
      "id": "AIFACTORY-TASK-4064",
      "type": "task",
      "parent": "AIFACTORY-US-1012",
      "title": "Fakes of the external and production operations for the acceptance suite",
      "sequence": "06.03.05.02",
      "description": "Fakes of the external and production operations for the acceptance suite. Expected output: The acceptance suite holds a fake of VerifyConnection that answers 200, 403 and 404, a fake of CreateSubscription that answers 201 and 409, a fake of Connectors.Deliver that records the tool-invocation-v1 message and answers a reply or a status, and fakes of RotateCredential and RevokeConnection that answer 200, 403, 404 and 409, each generated from its fronts entry.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of VerifyConnection that answers 200, 403 and 404, a fake of CreateSubscription that answers 201 and 409, a fake of Connectors.Deliver that records the tool-invocation-v1 message and answers a reply or a status, and fakes of RotateCredential and RevokeConnection that answer 200, 403, 404 and 409, each generated from its fronts entry."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7205,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4064]",
      "number": 4064
    },
    {
      "id": "AIFACTORY-TASK-4065",
      "type": "task",
      "parent": "AIFACTORY-US-1012",
      "title": "Verify the external and production routes through the acceptance suite",
      "sequence": "06.03.05.03",
      "description": "Verify the external and production routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationHost-003|Scenario=SCN-IntegrationHost-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1012: the verification forwarded with its key, the delivery message passed through unchanged and refused without the service scope, the answers 200, 201, 403, 404 and 409 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service and the register of external and production routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationHost-003|Scenario=SCN-IntegrationHost-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1012: the verification forwarded with its key, the delivery message passed through unchanged and refused without the service scope, the answers 200, 201, 403, 404 and 409 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service and the register of external and production routes."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4065]",
      "number": 4065
    },
    {
      "id": "AIFACTORY-US-1013",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-034",
      "title": "Health, adapters, limits and telemetry of the integration gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "06.03.06",
      "description": "As an operator, I want to see whether the integration gateway, the identity platform and each fronted service answer, and which connector adapters the platform runs, so that I can tell a failing service from a failing gateway and act on the right one. An operator and the probes of the cluster read the state of the gateway through its two own operations. `IntegrationHost/IntegrationHealth` reports liveness and readiness of the gateway with the aggregated health of the two services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway. While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe `IntegrationHealth` answers 200 with the health degraded and a detail that names the identity platform as unreachable (ADR-0015 amendment D117). The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, `IntegrationHealth` answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 in both phases. A fronted service is an optional dependency that degrades: when it does not answer, health reports it as unavailable in the detail and the answer stays 200, its routes answer 503 with a retry hint, and the routes of the other service keep serving. `IntegrationHost/IntegrationAdapters` returns to a caller whose scope carries `factory.meta.read` the connector adapters of the services behind the gateway, first-party clients and the generic HTTP, OpenAPI and MCP adapters, with their versions and capability interfaces. The gateway loads no adapter and holds no state: the adapters are loaded by ConnectorRegistryService, and the model gives that service no operation that returns its loaded adapters under `factory.meta.read`, since `ListConnectors` requires `factory.connections.read`. The source of the reply is therefore an open point reported to the owner. Until it is decided the reply is read through one metadata port of the gateway that has no production binding: a deployed instance answers 200 with the two fronted services and their repositories, as `deployment.fronts` lists them, and states the adapters as not reported, and invents no value; the reply with the adapters filled is proven against a fake metadata source of the acceptance suite. The operation calls no fronted service, so it has no dependency to fail on. A call that exceeds the rate limit configured for its route is refused with 429, over gRPC RESOURCE_EXHAUSTED, through the pinned rate-limiting library, from the configuration of the gateway, and calls no fronted service; no limit value is fixed in code. The gateway emits `connectsoft.factory.integration.host.requests` with the dimensions service and status and `connectsoft.factory.integration.host.request_duration` with service and route, the latency including the fronted service, each recorded through the helper of the pinned observability library, which puts the tenant, and the project where the route names one, on the instrument by default (ADR-0019); the gateway carries the trace context to the service. The gateway belongs to the class `pilot-interactive` of model/nfr-targets.yaml; the duration series is what it is measured against once the system is deployed, and no value is claimed here. Logs, activities and metrics never contain a token, a credential reference, a credential or a payload. A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed and callers retry with their idempotency key. The roles of the gateway are Observer, Operator and Platform admin. Kind: behavior. Traces: services: IntegrationHost, ConnectorRegistryService; apis: IntegrationHost/IntegrationHealth, IntegrationHost/IntegrationAdapters; adrs: ADR-0015, ADR-0017, ADR-0018, ADR-0019, ADR-0028; requirements: NFR-13, NFR-18; scenarios: SCN-IntegrationHost-001, SCN-IntegrationHost-002. Relates: nfrs: NFR-10. Depends on: AIFACTORY-US-1009, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/integration/IntegrationHost.yaml, model/nfr-targets.yaml, docs/planes/capability-tools/connectors/services/integration-host/index.md#metrics-and-observability, docs/planes/capability-tools/connectors/services/integration-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and the fronted services reachable, when `IntegrationHost/IntegrationHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the two fronted services and of the identity platform; a call for the detail without a token is answered 401 and a token without the scope 403 (SCN-IntegrationHost-001, NFR-18).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `IntegrationHost/IntegrationHealth` is probed, then already issued tokens pass, readiness stays ready and health answers 200 with the health degraded and a detail that names the identity platform, while liveness answers 200; given no valid key remains, then calls are refused, readiness is unready, `IntegrationHost/IntegrationHealth` answers 503 with a problem response that names the identity platform and no state changes (SCN-IntegrationHost-001, ADR-0017).",
        "AC3: Given one fronted service does not answer, when `IntegrationHost/IntegrationHealth` and the routes are called, then health answers 200 and reports the service as unavailable in its detail, its routes answer 503 with a retry hint that names the service, over gRPC UNAVAILABLE, the routes of the other service keep serving and the gateway invents no response (SCN-IntegrationHost-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read`, when `IntegrationHost/IntegrationAdapters` is called on an instance whose metadata port has no source, then the response is 200 with the two fronted services and their repositories as model/services/integration/IntegrationHost.yaml lists them under `deployment.fronts` and the adapters stated as not reported; given the fake metadata source bound to the port, then the reply names the adapters with their versions and capability interfaces; a call without a token is answered 401 and a token without the scope 403, no fronted service is called and nothing is written (SCN-IntegrationHost-002).",
        "AC5: Given routed calls and a call above the rate limit of its route, when the metrics and logs are read, then `connectsoft.factory.integration.host.requests` counts every call by service and status, the call above the limit was refused with 429 and called no fronted service, `connectsoft.factory.integration.host.request_duration` holds the latency by service and route, both carry the tenant of the call and the project where the route names one, and no log record, activity or metric holds a token, a credential reference or a payload (ADR-0018, ADR-0019, NFR-13, model/services/integration/IntegrationHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml",
        "model/nfr-targets.yaml",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#metrics-and-observability",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-465",
        "AIFACTORY-TASK-4066",
        "AIFACTORY-TASK-4067",
        "AIFACTORY-TASK-4068"
      ],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7206,
      "kind": "behavior",
      "traces": {
        "services": [
          "IntegrationHost",
          "ConnectorRegistryService"
        ],
        "apis": [
          "IntegrationHost/IntegrationHealth",
          "IntegrationHost/IntegrationAdapters"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0018",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-13",
          "NFR-18"
        ],
        "scenarios": [
          "SCN-IntegrationHost-001",
          "SCN-IntegrationHost-002"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1009",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/integration/IntegrationHost.yaml",
        "model/nfr-targets.yaml",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#metrics-and-observability",
        "docs/planes/capability-tools/connectors/services/integration-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1013]",
      "number": 1013
    },
    {
      "id": "AIFACTORY-TASK-465",
      "type": "task",
      "parent": "AIFACTORY-US-1013",
      "title": "Health, adapters and telemetry of the gateway",
      "sequence": "06.03.06.01",
      "description": "Health, adapters and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform; the adapters operation serves, under factory.meta.read, the two fronted services with their repositories and the adapters its metadata port returns, states the adapters as not reported when the port has no source, and calls no fronted service; the port has no production binding; every routed call records connectsoft.factory.integration.host.requests and connectsoft.factory.integration.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, the tenant and the project where the route names one, and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the two fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform; the adapters operation serves, under factory.meta.read, the two fronted services with their repositories and the adapters its metadata port returns, states the adapters as not reported when the port has no source, and calls no fronted service; the port has no production binding; every routed call records connectsoft.factory.integration.host.requests and connectsoft.factory.integration.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, the tenant and the project where the route names one, and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-465]",
      "number": 465
    },
    {
      "id": "AIFACTORY-TASK-4066",
      "type": "task",
      "parent": "AIFACTORY-US-1013",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "06.03.06.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.integration.host.requests; the limit values are configuration of the deployment and none is fixed in code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.integration.host.requests; the limit values are configuration of the deployment and none is fixed in code."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4066]",
      "number": 4066
    },
    {
      "id": "AIFACTORY-TASK-4067",
      "type": "task",
      "parent": "AIFACTORY-US-1013",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "06.03.06.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/integration/IntegrationHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains; the entry of the replica crash states that nothing is replayed and that callers retry with their idempotency key (NFR-18).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/integration/IntegrationHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains; the entry of the replica crash states that nothing is replayed and that callers retry with their idempotency key (NFR-18)."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7206,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-4067]",
      "number": 4067
    },
    {
      "id": "AIFACTORY-TASK-4068",
      "type": "task",
      "parent": "AIFACTORY-US-1013",
      "title": "Verify health, adapters, limits and telemetry through the acceptance suite",
      "sequence": "06.03.06.04",
      "description": "Verify health, adapters, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationHost-001|Scenario=SCN-IntegrationHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1013 with the identity platform stopped while a cached key validates tokens, without a cached key and after the cached key expired, one fake stopped, the adapters operation without a metadata source, with the fake metadata source and without its scope, a call above its limit, the two series with their dimensions, the tenant and the project, and a scan of the captured logs and activities for token, credential and payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IntegrationHost-001|Scenario=SCN-IntegrationHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1013 with the identity platform stopped while a cached key validates tokens, without a cached key and after the cached key expired, one fake stopped, the adapters operation without a metadata source, with the fake metadata source and without its scope, a call above its limit, the two series with their dimensions, the tenant and the project, and a scan of the captured logs and activities for token, credential and payload content."
      ],
      "sourceArtifacts": [
        "model/services/integration/IntegrationHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 72,
      "phase": "factory",
      "stackRank": 7206,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4068]",
      "number": 4068
    },
    {
      "id": "AIFACTORY-FEAT-188",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-006",
      "title": "ConnectorRegistryService: inbound deliveries and delivery reads for the second outcome",
      "sequence": "06.04",
      "description": "ConnectorRegistryService is the service of bounded context BC-17 (Connectors & Webhooks). In this increment it receives the inbound deliveries of Azure DevOps through the webhook ingress of WebhookGatewayService, records each verified delivery and publishes DeliveryReceived, and serves the reads of pipeline runs, pull requests, package feeds and container registries that PipelineExecutionService and ReleaseService need, so that review states, merges and pipeline runs reach the second outcome (D135). Outbound deliveries and the other providers stay with the complete delivery in I5. Its repositories are ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService and ConnectSoft.AI.SoftwareFactory.WebhookGatewayService. Delivers: ConnectorRegistryService (thin: Inbound Azure DevOps deliveries recorded and announced as DeliveryReceived, and the reads of pipeline runs, pull requests, package feeds and container registries for Azure DevOps (D135).); WebhookGatewayService (thin: The webhook ingress for the Azure DevOps signature scheme with replay-window and deduplication checks, emitting verified deliveries to ConnectorRegistryService (D135).). Depends on: AIFACTORY-FEAT-032, AIFACTORY-FEAT-033. Increment I2: Deliver it. Build order 93 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1476",
        "AIFACTORY-US-1477",
        "AIFACTORY-US-1478",
        "AIFACTORY-US-1479",
        "AIFACTORY-US-1480",
        "AIFACTORY-US-1481",
        "AIFACTORY-US-1483"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9300,
      "titlePrefix": "[AIFACTORY-FEAT-188]",
      "number": 188
    },
    {
      "id": "AIFACTORY-US-1476",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-188",
      "title": "ConnectorRegistryService and WebhookGatewayService carry Azure DevOps subscriptions, deliveries and reads to the second outcome",
      "sequence": "06.04.01",
      "description": "As a platform admin, I want the webhook ingress and the connector registry to subscribe a project to its Azure DevOps service hooks, to receive and record those deliveries and to serve the Azure DevOps reads of pipeline runs, pull requests, package feeds and container registries, so that review states, merges and pipeline runs reach PipelineExecutionService and publication evidence reaches ReleaseService through one governed path, without a poll of the system of record for every change. This is the integration PBI of the I2 delivery that decision D135 adds before the complete delivery of I5, so that PipelineExecutionService and ReleaseService of I2 receive review states, merges and pipeline runs and the outcome of I2 can be met. Its thin scope, stated in model/backlog/features/integration.yaml, has three parts. ConnectorRegistryService creates an Azure DevOps inbound `Subscription` of a project with its GW-06 ingress identity through `CreateSubscription`, announces it as `ConnectorSubscriptionChanged` and lists deliveries through `ListDeliveries` (AIFACTORY-US-1483); it records each verified inbound Azure DevOps delivery as a `Delivery` and announces it as `DeliveryReceived` in the same transaction, deduplicated on its key (AIFACTORY-US-1480); and it serves four internal reads under the scope `factory.connections.read`, `Connectors.ReadPipelineRun` and `Connectors.ReadPullRequest` for PipelineExecutionService and `Connectors.ReadPackageFeed` and `Connectors.ReadContainerRegistry` for ReleaseService (AIFACTORY-US-1481), through an Azure DevOps adapter of a new version that declares these capabilities and the webhook scheme of the service hooks and is certified again (AIFACTORY-US-1477). WebhookGatewayService, the conditional ingress GW-06, keeps its ingress table from `ConnectorSubscriptionChanged` through the handler `RefreshIngressTable` (AIFACTORY-US-1483), verifies an Azure DevOps delivery under the scheme of its ingress entry with the signing secret of the connection of the tenant, the replay window, deduplication, the size limit and the rate limit per ingress identity, captures the payload by hash, and announces `InboundDeliveryVerified` or `InboundDeliveryRejected` (AIFACTORY-US-1478, AIFACTORY-US-1479); it never dispatches anything itself. The registry keeps the surface of its thin delivery of I1 and now hosts nine operations; `ReplayDelivery` and `Connectors.Deliver`, the dispatch of a delivery to its target with `DeliveryDispatched`, `DeliveryFailed` and `DeliveryReplayed`, the worker `OutboundDeliveryRetrier`, the event `ConnectorDeprecated`, the handler `PauseOnRevocation` of `ConnectionStateChanged` and the other providers arrive with features connector-registry-service-complete and webhook-gateway-service in I5; the handler of `DeletionOrderIssued` is built in I4 by feature retention-residency-service. The `connector-registry` messaging profile now registers one consumed event, `InboundDeliveryVerified`, in its inbox with idempotency on the event id, and publishes `ConnectorActivated`, `ConnectorSubscriptionChanged`, `DeliveryReceived` and the audit evidence of its certifications under the run event envelope of the pinned contracts package through its outbox. The repository ConnectSoft.AI.SoftwareFactory.WebhookGatewayService is created by the steps of the repository checklist of feature `repository-and-pipeline-conventions` and scaffolded once from the pinned API gateway template package with `UseFactoryProfile` (feature `component-api-gateway-template`). The gateway is an edge service with a primary relational store, `webhook-gateway-sql`, an outbox and an inbox, which the Platform role of the template forbids; it is scaffolded with the BackendForFrontend role, the only role that admits persistence and messaging, with NHibernate persistence on SQL Server, migrations and the Orleans actor model named on the command line, because their defaults are None and off. The template offers no Orleans value of `MessagingModelType`, so the pinned Orleans messaging profile library (`connectsoft-extensions-messaging-model-orleans`) is added by reference after the scaffold under the messaging service name `webhook-gateway`, with its own transport credential `messaging-transport` by reference (ADR-0028 decision 7); the model of WebhookGatewayService names neither that option, that secret nor that library, which is reported to the owner. Its one exemption file names the `InboundDelivery` aggregate and the `IngressEntry` projection, their mappings and migrations, the publisher of its two events and the handler `RefreshIngressTable`, and the gateway keeps the API gateway template with the BackendForFrontend role and this one exemption file (D139). The gateway takes no token on `ReceiveWebhook`, because the signature is the authentication and the tenant comes from the ingress identity; `WebhookHealth` is internal under `factory.health.read` (SCN-WebhookGatewayService-002). It runs in the topologies saas-default and hybrid only (ADR-0017), on container apps with one to eight replicas and the port https 7950. The model secret `webhook-signing-secrets` is read as the Key Vault location of the signing secrets of the connections, which the broker references of owner kind `webhook-scheme` point at; the gateway names it by reference with its rotation of 90 days and never reads it directly, a reading reported to the owner. No payload, signature, signing secret, credential or credential reference reaches a log record, an activity, a metric or an event of either service (ADR-0019). The certification, the four reads and the signing secret of the gateway ask a credential issuance of the purpose `delivery`, which the platform bundle allows only for the service identities of ConnectorRegistryService and WebhookGatewayService (D139), so they are issued on a deployed instance and the same purpose asked by any other subject is denied. The descriptor of the new adapter version must be certified by a Platform admin, a signing secret reference must be registered for each connection, and the service hook must be configured at Azure DevOps, all by the runbook of AIFACTORY-TASK-6007; until then the behaviour is proven against fixtures and fakes. Kind: behavior. Traces: services: ConnectorRegistryService, WebhookGatewayService; aggregates: ConnectorRegistryService/Subscription, ConnectorRegistryService/Delivery, WebhookGatewayService/InboundDelivery; apis: ConnectorRegistryService/ListConnectors, ConnectorRegistryService/CertifyConnector, ConnectorRegistryService/CreateSubscription, ConnectorRegistryService/ListDeliveries, ConnectorRegistryService/Connectors.ResolveCapability, ConnectorRegistryService/Connectors.ReadPipelineRun, ConnectorRegistryService/Connectors.ReadPullRequest, ConnectorRegistryService/Connectors.ReadPackageFeed, ConnectorRegistryService/Connectors.ReadContainerRegistry, WebhookGatewayService/ReceiveWebhook, WebhookGatewayService/WebhookHealth; events: ConnectorRegistryService/ConnectorActivated, ConnectorRegistryService/ConnectorSubscriptionChanged, ConnectorRegistryService/DeliveryReceived, WebhookGatewayService/InboundDeliveryVerified, WebhookGatewayService/InboundDeliveryRejected; scenarios: SCN-WebhookGatewayService-002; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0017, ADR-0019, ADR-0022, ADR-0028; requirements: FR-05, NFR-18, XL-16. Depends on: AIFACTORY-US-1477, AIFACTORY-US-1478, AIFACTORY-US-1479, AIFACTORY-US-1480, AIFACTORY-US-1481, AIFACTORY-US-1483, feature:connector-registry-service-thin, feature:integration-service-thin, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/backlog/features/integration.yaml, model/services/integration/ConnectorRegistryService.yaml, model/services/integration/WebhookGatewayService.yaml, model/template-parameters/connectsoft-apigateway.yaml, model/libraries.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0017-deployment-profiles.md, docs/planes/capability-tools/connectors/workflows.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.WebhookGatewayService created by the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.WebhookGatewayService --UseFactoryProfile true --GatewayRole BackendForFrontend --persistence-model-type NHibernate --nhibernate-dialect-type SqlServer --migrations true --database-name WebhookGateway --actor-model-type Orleans` from the pinned template package, followed by the pinned Orleans messaging profile library added by reference, when its pipeline runs with the work of this feature, then the solution builds, the tests pass with complete reports, the architecture test admits exactly the types its one exemption file names and a container image is published (ADR-0028, model/services/integration/WebhookGatewayService.yaml, model/template-parameters/connectsoft-apigateway.yaml).",
        "AC2: Given the service descriptor of ConnectorRegistryService for I2, when the contract test of the Factory profile compares it with the hosted surface, then exactly `ConnectorRegistryService/ListConnectors`, `ConnectorRegistryService/CertifyConnector`, `ConnectorRegistryService/CreateSubscription`, `ConnectorRegistryService/ListDeliveries`, `ConnectorRegistryService/Connectors.ResolveCapability`, `ConnectorRegistryService/Connectors.ReadPipelineRun`, `ConnectorRegistryService/Connectors.ReadPullRequest`, `ConnectorRegistryService/Connectors.ReadPackageFeed` and `ConnectorRegistryService/Connectors.ReadContainerRegistry` are hosted, a path of `ReplayDelivery` answers 404 over REST and `Connectors.Deliver` UNIMPLEMENTED over gRPC, and the test fails when an operation outside the scope of model/backlog/features/integration.yaml appears (ADR-0022).",
        "AC3: Given the `connector-registry` messaging profile and the `webhook-gateway` messaging profile, when their registrations are inspected, then the registry registers `WebhookGatewayService/InboundDeliveryVerified` as its one consumed event with idempotency on the event id and publishes `ConnectorRegistryService/ConnectorActivated`, `ConnectorRegistryService/ConnectorSubscriptionChanged` and `ConnectorRegistryService/DeliveryReceived` under the run event envelope, the gateway publishes `WebhookGatewayService/InboundDeliveryVerified` and `WebhookGatewayService/InboundDeliveryRejected` and consumes `ConnectorRegistryService/ConnectorSubscriptionChanged` only, and no other event of the model is declared by either (ADR-0012, docs/reference/schemas/run-event-envelope.schema.json).",
        "AC4: Given the gateway deployed, when `WebhookGatewayService/WebhookHealth` is probed, then liveness answers while the process runs and readiness answers 200 only while `webhook-gateway-sql` is migrated, the cache answers and ArtifactService and SecretBrokerService answer, and 503 with a problem response naming the dependency otherwise, while an outage of the transport to ConnectorRegistryService leaves readiness up because verified deliveries wait in the outbox (SCN-WebhookGatewayService-002, ADR-0017).",
        "AC5: Given the captured logs, activities and metrics of the acceptance suites of both repositories, when they are scanned, then none holds a payload, a signature, a signing secret, a credential or a credential reference, and the deployment manifest of the gateway names the topologies saas-default and hybrid, one to eight replicas, the port 7950, `OrleansMessaging:ServiceName` set to `webhook-gateway` and the secrets `messaging-transport` and `webhook-signing-secrets` by name and never by value (ADR-0019, ADR-0017, ADR-0028, model/services/integration/WebhookGatewayService.yaml)."
      ],
      "sourceArtifacts": [
        "model/backlog/features/integration.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml",
        "model/template-parameters/connectsoft-apigateway.yaml",
        "model/libraries.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6001",
        "AIFACTORY-TASK-6035",
        "AIFACTORY-TASK-6002",
        "AIFACTORY-TASK-6003",
        "AIFACTORY-TASK-6004"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9301,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "WebhookGatewayService"
        ],
        "aggregates": [
          "ConnectorRegistryService/Subscription",
          "ConnectorRegistryService/Delivery",
          "WebhookGatewayService/InboundDelivery"
        ],
        "apis": [
          "ConnectorRegistryService/ListConnectors",
          "ConnectorRegistryService/CertifyConnector",
          "ConnectorRegistryService/CreateSubscription",
          "ConnectorRegistryService/ListDeliveries",
          "ConnectorRegistryService/Connectors.ResolveCapability",
          "ConnectorRegistryService/Connectors.ReadPipelineRun",
          "ConnectorRegistryService/Connectors.ReadPullRequest",
          "ConnectorRegistryService/Connectors.ReadPackageFeed",
          "ConnectorRegistryService/Connectors.ReadContainerRegistry",
          "WebhookGatewayService/ReceiveWebhook",
          "WebhookGatewayService/WebhookHealth"
        ],
        "events": [
          "ConnectorRegistryService/ConnectorActivated",
          "ConnectorRegistryService/ConnectorSubscriptionChanged",
          "ConnectorRegistryService/DeliveryReceived",
          "WebhookGatewayService/InboundDeliveryVerified",
          "WebhookGatewayService/InboundDeliveryRejected"
        ],
        "scenarios": [
          "SCN-WebhookGatewayService-002"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "NFR-18",
          "XL-16"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1477",
        "AIFACTORY-US-1478",
        "AIFACTORY-US-1479",
        "AIFACTORY-US-1480",
        "AIFACTORY-US-1481",
        "AIFACTORY-US-1483",
        "feature:connector-registry-service-thin",
        "feature:integration-service-thin",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/backlog/features/integration.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml",
        "model/template-parameters/connectsoft-apigateway.yaml",
        "model/libraries.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1476]",
      "number": 1476
    },
    {
      "id": "AIFACTORY-TASK-6001",
      "type": "task",
      "parent": "AIFACTORY-US-1476",
      "title": "Create the WebhookGatewayService repository, scaffold it from the API gateway template with its persistence and actor choices named and host its two operations",
      "sequence": "06.04.01.01",
      "description": "Create the WebhookGatewayService repository, scaffold it from the API gateway template with its persistence and actor choices named and host its two operations. Expected output: The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.WebhookGatewayService --UseFactoryProfile true --GatewayRole BackendForFrontend --persistence-model-type NHibernate --nhibernate-dialect-type SqlServer --migrations true --database-name WebhookGateway --actor-model-type Orleans` from the pinned template package, whose version the repository records; the one exemption file names the InboundDelivery aggregate, the IngressEntry projection, their mappings, the migrations of InboundDeliveries and IngressEntries, the outbox publisher of InboundDeliveryVerified and InboundDeliveryRejected and the inbox handler RefreshIngressTable, each with its reason; ReceiveWebhook is public on GW-06 without a token and WebhookHealth internal under factory.health.read with liveness and readiness over webhook-gateway-sql, the cache, ArtifactService and SecretBrokerService; the deployment manifest states container apps, the replica range 1 to 8, the port https 7950, the topologies saas-default and hybrid, the secrets messaging-transport and webhook-signing-secrets by reference and Integration:Webhooks:MaxPayloadKb, ReplayWindowMinutes and RatePerMinutePerIngress at their modelled defaults; the two metrics of the model are registered through the pinned observability library.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.WebhookGatewayService --UseFactoryProfile true --GatewayRole BackendForFrontend --persistence-model-type NHibernate --nhibernate-dialect-type SqlServer --migrations true --database-name WebhookGateway --actor-model-type Orleans | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.WebhookGatewayService --UseFactoryProfile true --GatewayRole BackendForFrontend --persistence-model-type NHibernate --nhibernate-dialect-type SqlServer --migrations true --database-name WebhookGateway --actor-model-type Orleans` from the pinned template package, whose version the repository records; the one exemption file names the InboundDelivery aggregate, the IngressEntry projection, their mappings, the migrations of InboundDeliveries and IngressEntries, the outbox publisher of InboundDeliveryVerified and InboundDeliveryRejected and the inbox handler RefreshIngressTable, each with its reason; ReceiveWebhook is public on GW-06 without a token and WebhookHealth internal under factory.health.read with liveness and readiness over webhook-gateway-sql, the cache, ArtifactService and SecretBrokerService; the deployment manifest states container apps, the replica range 1 to 8, the port https 7950, the topologies saas-default and hybrid, the secrets messaging-transport and webhook-signing-secrets by reference and Integration:Webhooks:MaxPayloadKb, ReplayWindowMinutes and RatePerMinutePerIngress at their modelled defaults; the two metrics of the model are registered through the pinned observability library."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6001]",
      "number": 6001
    },
    {
      "id": "AIFACTORY-TASK-6035",
      "type": "task",
      "parent": "AIFACTORY-US-1476",
      "title": "Add the pinned Orleans messaging profile library to WebhookGatewayService with the messaging service name webhook-gateway",
      "sequence": "06.04.01.02",
      "description": "Add the pinned Orleans messaging profile library to WebhookGatewayService with the messaging service name webhook-gateway. Expected output: The pinned `connectsoft-extensions-messaging-model-orleans` package is referenced by version in the central package file; the OrleansMessaging section holds ServiceName webhook-gateway, the Outbox connection of webhook-gateway-sql, the subscription of ConnectorSubscriptionChanged and PublishedEvents with InboundDeliveryVerified and InboundDeliveryRejected routed to their topics; the outbox records carry the run event envelope of the pinned contracts package; the exemption file lists the outbox publisher and the inbox handler with their reasons; the transport credential is the secret messaging-transport by reference; a startup test fails when the section or a route is absent.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The pinned `connectsoft-extensions-messaging-model-orleans` package is referenced by version in the central package file; the OrleansMessaging section holds ServiceName webhook-gateway, the Outbox connection of webhook-gateway-sql, the subscription of ConnectorSubscriptionChanged and PublishedEvents with InboundDeliveryVerified and InboundDeliveryRejected routed to their topics; the outbox records carry the run event envelope of the pinned contracts package; the exemption file lists the outbox publisher and the inbox handler with their reasons; the transport credential is the secret messaging-transport by reference; a startup test fails when the section or a route is absent."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6035]",
      "number": 6035
    },
    {
      "id": "AIFACTORY-TASK-6002",
      "type": "task",
      "parent": "AIFACTORY-US-1476",
      "title": "Extend the surface of ConnectorRegistryService to I2: nine hosted operations, the consumed event and the three published events of the service",
      "sequence": "06.04.01.03",
      "description": "Extend the surface of ConnectorRegistryService to I2: nine hosted operations, the consumed event and the three published events of the service. Expected output: The service descriptor file and the contract test of AIFACTORY-TASK-088 list CreateSubscription, ListDeliveries and the four reads beside the three operations of I1 and still answer 404 and UNIMPLEMENTED for ReplayDelivery and Connectors.Deliver; the connector-registry messaging profile registers InboundDeliveryVerified in its inbox with idempotency on the event id and publishes ConnectorActivated, ConnectorSubscriptionChanged and DeliveryReceived under the run event envelope of the pinned contracts package; the deployment manifest keeps Integration:Adapters:Enabled at azure-devops and sets Integration:Connectors:ReplayWindowMinutes at its modelled default; connectsoft.factory.integration.deliveries and connectsoft.factory.integration.subscriptions are registered with their modelled dimensions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The service descriptor file and the contract test of AIFACTORY-TASK-088 list CreateSubscription, ListDeliveries and the four reads beside the three operations of I1 and still answer 404 and UNIMPLEMENTED for ReplayDelivery and Connectors.Deliver; the connector-registry messaging profile registers InboundDeliveryVerified in its inbox with idempotency on the event id and publishes ConnectorActivated, ConnectorSubscriptionChanged and DeliveryReceived under the run event envelope of the pinned contracts package; the deployment manifest keeps Integration:Adapters:Enabled at azure-devops and sets Integration:Connectors:ReplayWindowMinutes at its modelled default; connectsoft.factory.integration.deliveries and connectsoft.factory.integration.subscriptions are registered with their modelled dimensions."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6002]",
      "number": 6002
    },
    {
      "id": "AIFACTORY-TASK-6003",
      "type": "task",
      "parent": "AIFACTORY-US-1476",
      "title": "Verify the hosting of WebhookGatewayService by running the declared command",
      "sequence": "06.04.01.04",
      "description": "Verify the hosting of WebhookGatewayService by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.WebhookGatewayService and `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WebhookGatewayService-002\"`; a run that discovers no test counts as a failure; the runs pass and prove AC1, the gateway half of AC3, AC4 and AC5 of AIFACTORY-US-1476, that is the scaffold with its named choices, the added messaging profile and the exemption file, the two published events and ConnectorSubscriptionChanged as the one consumed event, readiness with each dependency stopped and the transport stopped, the deployment manifest and the scan of logs, activities and metrics for payloads, signatures and secrets.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.WebhookGatewayService and `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WebhookGatewayService-002\"`; a run that discovers no test counts as a failure; the runs pass and prove AC1, the gateway half of AC3, AC4 and AC5 of AIFACTORY-US-1476, that is the scaffold with its named choices, the added messaging profile and the exemption file, the two published events and ConnectorSubscriptionChanged as the one consumed event, readiness with each dependency stopped and the transport stopped, the deployment manifest and the scan of logs, activities and metrics for payloads, signatures and secrets."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6003]",
      "number": 6003
    },
    {
      "id": "AIFACTORY-TASK-6004",
      "type": "task",
      "parent": "AIFACTORY-US-1476",
      "title": "Verify the I2 surface of ConnectorRegistryService by running the declared command",
      "sequence": "06.04.01.05",
      "description": "Verify the I2 surface of ConnectorRegistryService by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService; a run that discovers no test counts as a failure; the runs pass and prove AC2 and the registry half of AC3 and AC5 of AIFACTORY-US-1476, that is exactly the nine hosted operations with the 404 and UNIMPLEMENTED of the two others, InboundDeliveryVerified as the one consumed event, the three published events and the scan of logs, activities and metrics for payloads, credentials and credential references.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService; a run that discovers no test counts as a failure; the runs pass and prove AC2 and the registry half of AC3 and AC5 of AIFACTORY-US-1476, that is exactly the nine hosted operations with the 404 and UNIMPLEMENTED of the two others, InboundDeliveryVerified as the one consumed event, the three published events and the scan of logs, activities and metrics for payloads, credentials and credential references."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6004]",
      "number": 6004
    },
    {
      "id": "AIFACTORY-US-1477",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-188",
      "title": "The Azure DevOps adapter of a new version declares the four read capabilities and the service-hook webhook scheme and is certified again",
      "sequence": "06.04.02",
      "description": "As a platform admin, I want the Azure DevOps connector to declare the reads and the webhook scheme the second outcome needs and to pass the conformance suite again before anything relies on them, so that no delivery is accepted and no read is served through a capability that has not proven itself against a sandbox connection. The descriptor of I1 declares the repository capabilities, read a repository at a commit, push a branch and open a pull request, and the package feed capability, list the versions of a package (AIFACTORY-US-1001). The second outcome needs more of the same connector, and a connector without a webhook scheme accepts no inbound deliveries (invariant of the model). The Azure DevOps adapter of this feature is therefore a new version, still built on the first-party Azure DevOps client library (`ext-client-libraries`), that adds four capability interfaces: read one pipeline run with its stages and results, read one pull request with its review state, commits and merge commit, read whether a package version with its digest is in an Azure Artifacts feed, and read whether an image with its digest is in a container registry reached through the Azure DevOps connection. It declares the webhook scheme of the Azure DevOps service hooks, which the model defines as signature algorithm, header, replay window and deduplication key: the header that carries the signature, the signature algorithm, the payload member that carries the event time checked against the replay window, the replay window itself, the member that carries the delivery identifier used as the deduplication key, the member that carries the event type, and the service-hook event types the adapter accepts, a push, a pull request update, a review, a merge and a completed pipeline run. The scheme holds no secret and no secret reference: the descriptor belongs to the platform tenant and every tenant reads it (AIFACTORY-US-1001), so a signing secret in it would be one secret for the ingress identities of every tenant. The signing secret belongs to the connection of a tenant and is registered with the broker under owner kind `webhook-scheme` (AIFACTORY-US-1478, AIFACTORY-TASK-6007). The model fixes none of the scheme values for Azure DevOps; they come from the adapter, no value is fixed elsewhere in code, and they are reported to the owner. A changed adapter version re-runs certification (invariant of the model), so at startup the service writes, as AIFACTORY-US-1001 does, a new descriptor version of the platform tenant in state Draft with the new capabilities and the scheme, and the earlier version keeps its state Active, because the Deprecate transition arrives in I5. Where two versions are Active, the four reads, `Connectors.ResolveCapability` of I1 and `CreateSubscription` take the highest Active version that declares the capability or the scheme; `ConnectorActivated` names the new version and ToolAdapterService handles it in its own feature. A Platform admin of the platform tenant certifies the new version through `ConnectorRegistryService/CertifyConnector` exactly as AIFACTORY-US-1002 describes, against the sandbox project whose sandbox Azure DevOps organization holds a pipeline run, a pull request, a feed package and a registry image, and the conformance suite of this version exercises the four reads as well; on a passing suite the version moves from Draft through Certified to Active with `ConnectorActivated`, and on a failing one it stays Draft while the earlier version keeps serving. The runbook names that call and its evidence. Until the version is Active, the four reads answer NOT_FOUND, `CreateSubscription` answers 409 and the ingress has no scheme to verify against. Kind: behavior. Traces: services: ConnectorRegistryService; aggregates: ConnectorRegistryService/ConnectorDescriptor; apis: ConnectorRegistryService/ListConnectors, ConnectorRegistryService/CertifyConnector, ConnectorRegistryService/Connectors.ResolveCapability; events: ConnectorRegistryService/ConnectorActivated; adrs: ADR-0022; requirements: FR-05, NFR-05. Depends on: feature:connector-registry-service-thin. Sources: model/services/integration/ConnectorRegistryService.yaml, model/externals.yaml, docs/planes/capability-tools/connectors/workflows.md, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given the Active Azure DevOps descriptor of I1 and the build carrying the adapter of the new version, when the service starts twice, then one new `ConnectorRegistryService/ConnectorDescriptor` version of the platform tenant exists in state Draft with the four read capabilities beside the earlier ones and the webhook scheme of the service hooks, the second start wrote no row, and the earlier version is still Active (model/services/integration/ConnectorRegistryService.yaml).",
        "AC2: Given the Draft descriptor of the new version and a sandbox Azure DevOps system that holds a pipeline run, a pull request, a feed package and a registry image, when a Platform admin of the platform tenant calls `ConnectorRegistryService/CertifyConnector` for that version, then the conformance suite exercises every capability including the four reads, the version moves to Active with its `certificationRef` and `ConnectorRegistryService/ConnectorActivated` is written in the same transaction; given one read capability failing, the version stays Draft and the earlier version keeps serving; given both versions Active, then `ConnectorRegistryService/Connectors.ResolveCapability` resolves a capability to the highest Active version that declares it (ADR-0022).",
        "AC3: Given the written descriptor, when `ConnectorRegistryService/ListConnectors` returns it, then its webhook scheme names the signature header, the signature algorithm, the event-time member, the replay window, the deduplication-key member, the event-type member and the accepted event types, and holds neither a secret value nor a secret reference, and a test fails when a scheme value is fixed anywhere in code outside the adapter or when a scheme carries a secret reference (model/services/integration/ConnectorRegistryService.yaml, model/services/governance/SecretBrokerService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/externals.yaml",
        "docs/planes/capability-tools/connectors/workflows.md",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6005",
        "AIFACTORY-TASK-6006",
        "AIFACTORY-TASK-6007",
        "AIFACTORY-TASK-6008"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9302,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "ConnectorRegistryService/ConnectorDescriptor"
        ],
        "apis": [
          "ConnectorRegistryService/ListConnectors",
          "ConnectorRegistryService/CertifyConnector",
          "ConnectorRegistryService/Connectors.ResolveCapability"
        ],
        "events": [
          "ConnectorRegistryService/ConnectorActivated"
        ],
        "adrs": [
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "NFR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:connector-registry-service-thin"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/externals.yaml",
        "docs/planes/capability-tools/connectors/workflows.md",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-1477]",
      "number": 1477
    },
    {
      "id": "AIFACTORY-TASK-6005",
      "type": "task",
      "parent": "AIFACTORY-US-1477",
      "title": "Azure DevOps adapter of the new version with the four read capabilities and the service-hook webhook scheme without a secret reference",
      "sequence": "06.04.02.01",
      "description": "Azure DevOps adapter of the new version with the four read capabilities and the service-hook webhook scheme without a secret reference. Expected output: The adapter wraps the first-party Azure DevOps client library behind the capability interfaces of I1 and the four reads of pipeline runs, pull requests, package versions with digests and container images with digests, declares the webhook scheme with its signature header, signature algorithm, event-time member, replay window, deduplication-key member, event-type member and accepted event types and with no secret or secret reference, writes its new descriptor version in Draft at startup idempotently on connectorId and version, holds no credential and receives one per call; the lookup of an Active descriptor takes the highest Active version that declares the capability or the scheme; no scheme value is fixed outside the adapter and a test fails when one is or when a scheme carries a secret reference.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The adapter wraps the first-party Azure DevOps client library behind the capability interfaces of I1 and the four reads of pipeline runs, pull requests, package versions with digests and container images with digests, declares the webhook scheme with its signature header, signature algorithm, event-time member, replay window, deduplication-key member, event-type member and accepted event types and with no secret or secret reference, writes its new descriptor version in Draft at startup idempotently on connectorId and version, holds no credential and receives one per call; the lookup of an Active descriptor takes the highest Active version that declares the capability or the scheme; no scheme value is fixed outside the adapter and a test fails when one is or when a scheme carries a secret reference."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6005]",
      "number": 6005
    },
    {
      "id": "AIFACTORY-TASK-6006",
      "type": "task",
      "parent": "AIFACTORY-US-1477",
      "title": "Extend the sandbox Azure DevOps stub of AIFACTORY-TASK-4036 with pipeline runs, pull requests, feed packages and registry images",
      "sequence": "06.04.02.02",
      "description": "Extend the sandbox Azure DevOps stub of AIFACTORY-TASK-4036 with pipeline runs, pull requests, feed packages and registry images. Expected output: The recording stub of the sandbox Azure DevOps system answers the four reads with a pipeline run with stages and results, a pull request with review state, commits and merge commit, a feed package version with its digest and a registry image with its digest, can be made to fail one capability or to stop answering, and the conformance suite of the new adapter version exercises the four reads against it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The recording stub of the sandbox Azure DevOps system answers the four reads with a pipeline run with stages and results, a pull request with review state, commits and merge commit, a feed package version with its digest and a registry image with its digest, can be made to fail one capability or to stop answering, and the conformance suite of the new adapter version exercises the four reads against it."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9302,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6006]",
      "number": 6006
    },
    {
      "id": "AIFACTORY-TASK-6007",
      "type": "task",
      "parent": "AIFACTORY-US-1477",
      "title": "Runbook to certify the new descriptor version, register the signing secret of a connection and subscribe a project on a deployed I2 instance",
      "sequence": "06.04.02.03",
      "description": "Runbook to certify the new descriptor version, register the signing secret of a connection and subscribe a project on a deployed I2 instance. Expected output: The repository documentation extends the runbook of AIFACTORY-TASK-4069 in three steps. First, a Platform admin of the platform tenant calls CertifyConnector with an Idempotency-Key and the projectId of the sandbox project for the new version, whose sandbox organization must hold a pipeline run, a pull request, a feed package and a registry image; the evidence of success is ListConnectors answering 200 with the new version Active beside the earlier one and its ConnectorActivated record in the outbox. Second, for each Azure DevOps connection of a tenant that will receive service hooks, a Platform admin registers through RegisterSecretReference of SecretBrokerService a reference of kind SigningKey in the tenant of the connection, with owner kind webhook-scheme, the connectionId as owner, the allowed purpose delivery that the gateway asks, and the rotation of the model secret webhook-signing-secrets; the value is placed in Key Vault and in the service hook by the admin and never in the runbook. Third, a Workspace admin of the project calls CreateSubscription with an Idempotency-Key, the projectId, the connector and the event types, and configures the Azure DevOps service hooks of the project with the ingress path the 201 reply returns and the signing secret of the connection; the evidence is a delivery recorded with outcome Verified at the gateway and a DeliveryReceived record in the outbox of the registry. It states that the platform bundle allows a credential issuance of the purpose delivery only for the service identities of ConnectorRegistryService and WebhookGatewayService (D139), which covers the certification, the four Azure DevOps reads and the signing secret of the gateway, and that the same purpose asked by any other subject is denied, and it holds no token, credential, reference value or limit.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The repository documentation extends the runbook of AIFACTORY-TASK-4069 in three steps. First, a Platform admin of the platform tenant calls CertifyConnector with an Idempotency-Key and the projectId of the sandbox project for the new version, whose sandbox organization must hold a pipeline run, a pull request, a feed package and a registry image; the evidence of success is ListConnectors answering 200 with the new version Active beside the earlier one and its ConnectorActivated record in the outbox. Second, for each Azure DevOps connection of a tenant that will receive service hooks, a Platform admin registers through RegisterSecretReference of SecretBrokerService a reference of kind SigningKey in the tenant of the connection, with owner kind webhook-scheme, the connectionId as owner, the allowed purpose delivery that the gateway asks, and the rotation of the model secret webhook-signing-secrets; the value is placed in Key Vault and in the service hook by the admin and never in the runbook. Third, a Workspace admin of the project calls CreateSubscription with an Idempotency-Key, the projectId, the connector and the event types, and configures the Azure DevOps service hooks of the project with the ingress path the 201 reply returns and the signing secret of the connection; the evidence is a delivery recorded with outcome Verified at the gateway and a DeliveryReceived record in the outbox of the registry. It states that the platform bundle allows a credential issuance of the purpose delivery only for the service identities of ConnectorRegistryService and WebhookGatewayService (D139), which covers the certification, the four Azure DevOps reads and the signing secret of the gateway, and that the same purpose asked by any other subject is denied, and it holds no token, credential, reference value or limit."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9302,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-6007]",
      "number": 6007
    },
    {
      "id": "AIFACTORY-TASK-6008",
      "type": "task",
      "parent": "AIFACTORY-US-1477",
      "title": "Verify the adapter of the new version and its certification through the acceptance suite",
      "sequence": "06.04.02.04",
      "description": "Verify the adapter of the new version and its certification through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AzureDevOpsAdapterNextVersion\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1477: two starts with one new Draft version and the earlier version still Active, the passing certification with ConnectorActivated, a failing read capability with the version in Draft, the resolution to the highest Active version, the webhook scheme in the listed descriptor without a secret value or a secret reference and the test that fails on a scheme value fixed outside the adapter; the runbook of AIFACTORY-TASK-6007 is present with its three steps.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AzureDevOpsAdapterNextVersion\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1477: two starts with one new Draft version and the earlier version still Active, the passing certification with ConnectorActivated, a failing read capability with the version in Draft, the resolution to the highest Active version, the webhook scheme in the listed descriptor without a secret value or a secret reference and the test that fails on a scheme value fixed outside the adapter; the runbook of AIFACTORY-TASK-6007 is present with its three steps."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6008]",
      "number": 6008
    },
    {
      "id": "AIFACTORY-US-1478",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-188",
      "title": "Receive an Azure DevOps service hook, verify it with the signing secret of the connection of its tenant, capture its payload and announce InboundDeliveryVerified",
      "sequence": "06.04.03",
      "description": "As an operator, I want every Azure DevOps service hook of a project to be verified at the ingress with the signing secret of its own tenant and handed to the connector registry exactly once, so that a review, a merge or a pipeline run reaches the delivery services from a delivery whose origin is proven and whose payload is kept by hash. Azure DevOps posts a service hook of a project to `WebhookGatewayService/ReceiveWebhook` at `/webhooks/{ingressRef}`, the ingress identity of the subscription. The route is public on GW-06 and takes no token: the signature is the authentication (scope `factory.webhooks.receive`), and the tenant, the subscription and the connector come from the ingress entry, never from the body or a header. The ingress entries are written by the handler `RefreshIngressTable` from `ConnectorSubscriptionChanged` into the table `IngressEntries` of `webhook-gateway-sql` (AIFACTORY-US-1483); each names the ingress identity, the tenant, the subscription, the connector and the connection of the subscription, the descriptor version whose webhook scheme verifies it and that scheme (AIFACTORY-US-1477), and whether it is active. The model gives `ConnectorSubscriptionChanged` only `subscriptionId`, `tenantId`, `connectorId` and `active` and lists no dependency of the gateway through which it could read the rest, so the event carries the ingress identity, the connection, the descriptor version and the scheme as well, and the gateway keeps them in a table, although the model says it is stateless beyond the deduplication cache; both are model gaps reported to the owner. The signing secret belongs to the connection of the tenant of the entry, never to the shared descriptor: the gateway asks `SecretBrokerService/SecretBroker.Issue` for the reference of owner kind `webhook-scheme` whose owner is that connection, in the tenant of the entry, so a delivery signed with the secret of tenant A never verifies at an ingress identity of tenant B. The broker is addressed by owner and no reference value travels in an event or an entry, a reading of the request of `SecretBroker.Issue` reported to the owner. The gateway holds the secret in memory until the issuance expires and never in the cache, the store, a log record or telemetry. The gateway asks with the purpose `delivery`, the purpose of the deliveries of the connector, which the platform bundle allows only for the service identities of ConnectorRegistryService and WebhookGatewayService (D139). The model gives ReceiveWebhook the idempotency `key-header`; a vendor-sent hook carries no such header, so the delivery identifier that the scheme reads from the body stands in for it, a reading reported to the owner. The replay window is the window of the scheme bounded above by `Integration:Webhooks:ReplayWindowMinutes`, so the smaller of the two applies, a reading reported to the owner. The gateway applies its checks in the order this PBI states: the ingress identity is known and active, the identity has not exceeded `Integration:Webhooks:RatePerMinutePerIngress` deliveries in the current minute across the replicas, the body is within `Integration:Webhooks:MaxPayloadKb`, the signature verifies under the scheme with the signing secret of the connection, the body carries the event time, the event type and the delivery identifier the scheme names, the event time lies inside the replay window, and the delivery identifier is not already held; the refusals are AIFACTORY-US-1479. Deduplication follows the signature check, so an unsigned body never learns an `inboundId`, and the rate limit precedes it, so a vendor retry of an accepted delivery that arrives over the limit is answered 429 and answered 202 with the same `inboundId` when the vendor retries it inside the window. A delivery whose deduplication key the cache already holds inside the window is the repeat of an accepted one: the answer is 202 with the same `inboundId`, and nothing is captured, recorded or published again. A new delivery is captured by hash through `ArtifactService/Artifacts.Store` under the tenant of the ingress entry, idempotent on tenant and hash; the `InboundDelivery` is recorded with `signatureValid` true, outcome Verified, `dedupKey`, `externalId`, `payloadRef` and `payloadHash`, and the `InboundDeliveryVerified` outbox record is written in the same transaction; the answer is 202 with the `inboundId`. The dispatcher publishes the event on `connectors.ingress.v1.inbound-delivery-verified` under the run event envelope with `inboundId`, `tenantId`, `subscriptionId`, `connectorId`, `externalId`, `dedupKey`, `payloadRef` and `payloadHash` and never the payload, and retries a transport outage with backoff so the event is neither lost nor duplicated; ConnectorRegistryService records it (AIFACTORY-US-1480). ArtifactService, SecretBrokerService, the cache and `webhook-gateway-sql` are required and fail-fast: when one does not answer, the answer is 503 with a problem response naming it (D137). When SecretBrokerService answers but refuses the issuance, PERMISSION_DENIED or FAILED_PRECONDITION, the answer is 503 with the reason credential-refused, counted with the outcome dimension value CredentialRefused, so that a refusal is told apart from an outage; D137 speaks of an unavailable dependency, and answering a refusal with 503 so the vendor retries is a reading reported to the owner. In each case nothing is recorded or published and Azure DevOps retries the service hook. The scheduled purge deletes rows of `InboundDeliveries` older than their modelled retention of 30 days; the model names no worker for it, which is reported. The counter `connectsoft.factory.integration.webhooks_received` counts each delivery by connector and outcome and the histogram `connectsoft.factory.integration.webhook_latency` records the verification latency. Kind: behavior. Traces: services: WebhookGatewayService, ArtifactService, SecretBrokerService; aggregates: WebhookGatewayService/InboundDelivery; apis: WebhookGatewayService/ReceiveWebhook, ArtifactService/Artifacts.Store, SecretBrokerService/SecretBroker.Issue; events: WebhookGatewayService/InboundDeliveryVerified; scenarios: SCN-WebhookGatewayService-001, SCN-WebhookGatewayService-003; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: FR-05, NFR-02, NFR-09. Depends on: AIFACTORY-US-1477, AIFACTORY-US-1483, feature:secret-broker-service, feature:artifact-service, feature:contracts-package. Sources: model/services/integration/WebhookGatewayService.yaml, model/services/governance/SecretBrokerService.yaml, model/services/knowledge/ArtifactService.yaml, docs/planes/capability-tools/connectors/services/webhook-gateway-service/index.md#apis, docs/planes/capability-tools/connectors/workflows.md.",
      "acceptanceCriteria": [
        "AC1: Given an active ingress entry of tenant A with the Active Azure DevOps scheme and the connection C of tenant A, and a service hook whose signature verifies with the secret issued through `SecretBrokerService/SecretBroker.Issue` for the reference of owner kind `webhook-scheme` owned by C and whose event time lies inside the replay window, when `WebhookGatewayService/ReceiveWebhook` is called without a token, then the response is 202 with the `inboundId`, the payload is captured through `ArtifactService/Artifacts.Store` under tenant A, and the `WebhookGatewayService/InboundDelivery` with outcome Verified and the `WebhookGatewayService/InboundDeliveryVerified` outbox record are written in the same transaction (SCN-WebhookGatewayService-001).",
        "AC2: Given the same service hook repeated with the same deduplication key inside the replay window, when it arrives at `WebhookGatewayService/ReceiveWebhook`, then the response is 202 with the same `inboundId`, and nothing is captured, recorded or published a second time; given the repeat arriving over the rate limit, then it is answered 429 and the next retry inside the window 202 with the same `inboundId`; given a scheme window larger than `Integration:Webhooks:ReplayWindowMinutes`, then the option bounds it; given a body or header that names another tenant, then the delivery is recorded under the tenant of the ingress entry only (SCN-WebhookGatewayService-001, ADR-0015).",
        "AC3: Given ArtifactService, SecretBrokerService, the cache or `webhook-gateway-sql` that does not answer, when a valid service hook arrives, then the response is 503 with a problem response naming the dependency; given SecretBrokerService refusing the issuance, then the response is 503 with the reason credential-refused and the counter records CredentialRefused; in each case no `WebhookGatewayService/InboundDelivery` is recorded, no event is written, and the signing secret appears in no cache entry, row, log record, activity or metric (SCN-WebhookGatewayService-001, ADR-0019).",
        "AC4: Given the recorded delivery, when the outbox dispatcher publishes `WebhookGatewayService/InboundDeliveryVerified` on `connectors.ingress.v1.inbound-delivery-verified`, then the event is sent under the run event envelope with `inboundId`, `tenantId`, `subscriptionId`, `connectorId`, `externalId`, `dedupKey`, `payloadRef` and `payloadHash` and without the payload, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-WebhookGatewayService-003, ADR-0012).",
        "AC5: Given rows of `InboundDeliveries` older and younger than the retention of 30 days, when the scheduled purge of the gateway runs, then only the older rows are deleted, a second run deletes nothing more, and no ingress entry is touched (model/services/integration/WebhookGatewayService.yaml, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/integration/WebhookGatewayService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/capability-tools/connectors/services/webhook-gateway-service/index.md#apis",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6009",
        "AIFACTORY-TASK-6010",
        "AIFACTORY-TASK-6033",
        "AIFACTORY-TASK-6011",
        "AIFACTORY-TASK-6012"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9303,
      "kind": "behavior",
      "traces": {
        "services": [
          "WebhookGatewayService",
          "ArtifactService",
          "SecretBrokerService"
        ],
        "aggregates": [
          "WebhookGatewayService/InboundDelivery"
        ],
        "apis": [
          "WebhookGatewayService/ReceiveWebhook",
          "ArtifactService/Artifacts.Store",
          "SecretBrokerService/SecretBroker.Issue"
        ],
        "events": [
          "WebhookGatewayService/InboundDeliveryVerified"
        ],
        "scenarios": [
          "SCN-WebhookGatewayService-001",
          "SCN-WebhookGatewayService-003"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-05",
          "NFR-02",
          "NFR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1477",
        "AIFACTORY-US-1483",
        "feature:secret-broker-service",
        "feature:artifact-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/integration/WebhookGatewayService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/planes/capability-tools/connectors/services/webhook-gateway-service/index.md#apis",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1478]",
      "number": 1478
    },
    {
      "id": "AIFACTORY-TASK-6009",
      "type": "task",
      "parent": "AIFACTORY-US-1478",
      "title": "Contract of ReceiveWebhook: OpenAPI document, problem responses and the shape of the ingress entry",
      "sequence": "06.04.03.01",
      "description": "Contract of ReceiveWebhook: OpenAPI document, problem responses and the shape of the ingress entry. Expected output: The OpenAPI document fixes POST /webhooks/{ingressRef} without a security requirement, the 202 reply with the inboundId and the problem responses of 400, 401, 404, 409, 413, 429 and 503, the last with the reasons naming a dependency and credential-refused; the ingress entry names ingressRef, tenantId, subscriptionId, connectorId, connectionId, the descriptor version of the scheme, the scheme and active, as RefreshIngressTable writes it from ConnectorSubscriptionChanged, and holds no secret value and no secret reference; golden files hold the shapes and the payload of InboundDeliveryVerified under the run event envelope.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "The OpenAPI document fixes POST /webhooks/{ingressRef} without a security requirement, the 202 reply with the inboundId and the problem responses of 400, 401, 404, 409, 413, 429 and 503, the last with the reasons naming a dependency and credential-refused; the ingress entry names ingressRef, tenantId, subscriptionId, connectorId, connectionId, the descriptor version of the scheme, the scheme and active, as RefreshIngressTable writes it from ConnectorSubscriptionChanged, and holds no secret value and no secret reference; golden files hold the shapes and the payload of InboundDeliveryVerified under the run event envelope."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9303,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6009]",
      "number": 6009
    },
    {
      "id": "AIFACTORY-TASK-6010",
      "type": "task",
      "parent": "AIFACTORY-US-1478",
      "title": "Verification pipeline of ReceiveWebhook with the signing secret of the connection, the deduplication cache, payload capture and the InboundDeliveryVerified outbox record",
      "sequence": "06.04.03.02",
      "description": "Verification pipeline of ReceiveWebhook with the signing secret of the connection, the deduplication cache, payload capture and the InboundDeliveryVerified outbox record. Expected output: ReceiveWebhook reads the ingress entry from IngressEntries and applies, in the order AIFACTORY-US-1478 states, the known and active ingress, the rate limit, the size limit, the signature check with the secret issued through SecretBroker.Issue for the reference of owner kind webhook-scheme owned by the connection of the entry in its tenant and held in memory until it expires, the body check, the replay window of the scheme bounded by Integration:Webhooks:ReplayWindowMinutes and the deduplication cache; it answers 202 with the same inboundId for a deduplication key the cache holds inside the window, captures a new payload through Artifacts.Store under the tenant of the entry, records the InboundDelivery as Verified with the InboundDeliveryVerified outbox record in one transaction, answers 503 naming an unavailable dependency and 503 with the reason credential-refused for a refused issuance, and logs and measures neither the payload, the signature nor the secret.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "ReceiveWebhook reads the ingress entry from IngressEntries and applies, in the order AIFACTORY-US-1478 states, the known and active ingress, the rate limit, the size limit, the signature check with the secret issued through SecretBroker.Issue for the reference of owner kind webhook-scheme owned by the connection of the entry in its tenant and held in memory until it expires, the body check, the replay window of the scheme bounded by Integration:Webhooks:ReplayWindowMinutes and the deduplication cache; it answers 202 with the same inboundId for a deduplication key the cache holds inside the window, captures a new payload through Artifacts.Store under the tenant of the entry, records the InboundDelivery as Verified with the InboundDeliveryVerified outbox record in one transaction, answers 503 naming an unavailable dependency and 503 with the reason credential-refused for a refused issuance, and logs and measures neither the payload, the signature nor the secret."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6010]",
      "number": 6010
    },
    {
      "id": "AIFACTORY-TASK-6033",
      "type": "task",
      "parent": "AIFACTORY-US-1478",
      "title": "Scheduled purge of InboundDeliveries after the modelled retention of 30 days",
      "sequence": "06.04.03.03",
      "description": "Scheduled purge of InboundDeliveries after the modelled retention of 30 days. Expected output: A scheduled job of the gateway deletes the rows of InboundDeliveries whose ReceivedAt is older than 30 days in batches, idempotently, touching no row of IngressEntries; its run and the number of rows it deleted are logged without a payload or a reference.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "A scheduled job of the gateway deletes the rows of InboundDeliveries whose ReceivedAt is older than 30 days in batches, idempotently, touching no row of IngressEntries; its run and the number of rows it deleted are logged without a payload or a reference."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6033]",
      "number": 6033
    },
    {
      "id": "AIFACTORY-TASK-6011",
      "type": "task",
      "parent": "AIFACTORY-US-1478",
      "title": "Fakes of Artifacts.Store and SecretBroker.Issue, fixture ingress entries of two tenants and signed recorded Azure DevOps service hooks",
      "sequence": "06.04.03.04",
      "description": "Fakes of Artifacts.Store and SecretBroker.Issue, fixture ingress entries of two tenants and signed recorded Azure DevOps service hooks. Expected output: The acceptance suite holds fakes of ArtifactService/Artifacts.Store and SecretBrokerService/SecretBroker.Issue that record their calls, issue a distinct test secret per tenant and connection, refuse with PERMISSION_DENIED and FAILED_PRECONDITION and can be stopped; fixture ingress entries of two tenants with distinct connections, in the shape RefreshIngressTable writes, inserted directly into the isolated test database; recorded Azure DevOps service hooks for a push, a pull request update, a review, a merge and a pipeline run signed with the test secret of each tenant under the scheme of the new adapter version; and variants with a wrong signature, a signature of the other tenant, an old event time, an oversized body and a missing delivery identifier.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fakes of ArtifactService/Artifacts.Store and SecretBrokerService/SecretBroker.Issue that record their calls, issue a distinct test secret per tenant and connection, refuse with PERMISSION_DENIED and FAILED_PRECONDITION and can be stopped; fixture ingress entries of two tenants with distinct connections, in the shape RefreshIngressTable writes, inserted directly into the isolated test database; recorded Azure DevOps service hooks for a push, a pull request update, a review, a merge and a pipeline run signed with the test secret of each tenant under the scheme of the new adapter version; and variants with a wrong signature, a signature of the other tenant, an old event time, an oversized body and a missing delivery identifier."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9303,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6011]",
      "number": 6011
    },
    {
      "id": "AIFACTORY-TASK-6012",
      "type": "task",
      "parent": "AIFACTORY-US-1478",
      "title": "Verify the accepted path of ReceiveWebhook, InboundDeliveryVerified and the purge through the acceptance suite",
      "sequence": "06.04.03.05",
      "description": "Verify the accepted path of ReceiveWebhook, InboundDeliveryVerified and the purge through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WebhookGatewayService-001|Scenario=SCN-WebhookGatewayService-003)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1478: the accepted service hook with its capture and outbox record, the repeat inside the window and the repeat over the rate limit, the scheme window bounded by the option, the tenant taken from the ingress entry, each dependency and the store stopped with the 503, the refused issuance with credential-refused, the publication under the run event envelope with retry, the purge of rows older than 30 days, and the scan of the cache, rows, logs, activities and metrics for the secret and the payload.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-WebhookGatewayService-001|Scenario=SCN-WebhookGatewayService-003)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1478: the accepted service hook with its capture and outbox record, the repeat inside the window and the repeat over the rate limit, the scheme window bounded by the option, the tenant taken from the ingress entry, each dependency and the store stopped with the 503, the refused issuance with credential-refused, the publication under the run event envelope with retry, the purge of rows older than 30 days, and the scan of the cache, rows, logs, activities and metrics for the secret and the payload."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6012]",
      "number": 6012
    },
    {
      "id": "AIFACTORY-US-1479",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-188",
      "title": "Reject a webhook that fails a check of the ingress with its outcome, rate-limit an ingress identity and announce InboundDeliveryRejected",
      "sequence": "06.04.04",
      "description": "As an operator, I want every delivery that fails a check of the ingress to be refused with its outcome and recorded as evidence, so that a rotated signing secret, a delivery signed for another tenant, a replayed delivery or a flood is visible and audited, and nothing unverified reaches the connector registry. Every check of `WebhookGatewayService/ReceiveWebhook` that fails refuses the delivery before its payload is captured or forwarded, so no payload of a rejected delivery is dispatched or stored (invariant of the model). An unknown or inactive `ingressRef` is answered 404; the delivery has no tenant, so it is counted with outcome UnknownIngress and nothing is recorded or published. For a known ingress identity, in the order of AIFACTORY-US-1478, a delivery beyond `Integration:Webhooks:RatePerMinutePerIngress` in the current minute is answered 429 with outcome RateLimited, a body over `Integration:Webhooks:MaxPayloadKb` 413 with outcome Oversized, a signature that does not verify with the signing secret of the connection of the ingress entry 401 with outcome BadSignature and `signatureValid` false, and an event time outside the replay window 409 with outcome Replayed; each is recorded as an `InboundDelivery` under the tenant of the ingress entry with its outcome, without `payloadRef` or `payloadHash`, together with the `InboundDeliveryRejected` outbox record in the same transaction. A delivery signed with the signing secret of tenant A and posted to an ingress identity of tenant B does not verify, because the gateway checks it with the secret of the connection of tenant B, and is answered 401 with outcome BadSignature under tenant B. A body that fails validation, unparseable or without the event time, the event type or the delivery identifier the scheme names, is answered 400; the enum `VerificationOutcome` has no value for it, so it is counted with the outcome dimension value Invalid, a value outside the enum, and nothing is recorded or published, an open point reported to the owner. Every refusal carries a problem response that names the check and never echoes the payload or the signature. The dispatcher publishes `InboundDeliveryRejected` on `connectors.ingress.v1.inbound-delivery-rejected` under the run event envelope with `inboundId`, `tenantId`, `ingressRef` and `outcome`, retrying a transport outage with backoff so the event is neither lost nor duplicated; AuditService records it in its own suite. Two failure modes of the model show here: a signing secret rotated at the vendor raises the BadSignature rate of one connector, deliveries are rejected until the reference of the connection is rotated through the broker and Azure DevOps retries them, and an ingress flood is held by the per-ingress limit, the vendor backs off and no accepted delivery loses its payload. The counter `connectsoft.factory.integration.webhooks_received` counts every refusal by connector and outcome. Kind: behavior. Traces: services: WebhookGatewayService; aggregates: WebhookGatewayService/InboundDelivery; apis: WebhookGatewayService/ReceiveWebhook; events: WebhookGatewayService/InboundDeliveryRejected, WebhookGatewayService/InboundDeliveryVerified; scenarios: SCN-WebhookGatewayService-004; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: NFR-09, XL-16. Depends on: AIFACTORY-US-1478. Sources: model/services/integration/WebhookGatewayService.yaml, docs/planes/capability-tools/connectors/services/webhook-gateway-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a known ingress identity, when `WebhookGatewayService/ReceiveWebhook` receives a delivery with a signature that does not verify, an event time outside the replay window, a body over the size limit, or more deliveries in a minute than the rate limit, then the response is 401, 409, 413 or 429 with a problem response, the `WebhookGatewayService/InboundDelivery` is recorded with outcome BadSignature, Replayed, Oversized or RateLimited and no payload reference, and the `WebhookGatewayService/InboundDeliveryRejected` outbox record is written in the same transaction; given a delivery signed with the secret of tenant A at an ingress identity of tenant B, then the response is 401 with outcome BadSignature recorded under tenant B and nothing is captured (SCN-WebhookGatewayService-004, ADR-0015).",
        "AC2: Given an unknown or inactive `ingressRef`, or a body that fails validation at a known ingress identity, when `WebhookGatewayService/ReceiveWebhook` is called, then the response is 404 or 400 with a problem response, nothing is captured, recorded or published, and `connectsoft.factory.integration.webhooks_received` counts the delivery with UnknownIngress or Invalid (SCN-WebhookGatewayService-004, model/services/integration/WebhookGatewayService.yaml).",
        "AC3: Given a rejection recorded, when the outbox dispatcher publishes `WebhookGatewayService/InboundDeliveryRejected` on `connectors.ingress.v1.inbound-delivery-rejected`, then the event is sent under the run event envelope with `inboundId`, `tenantId`, `ingressRef` and `outcome` and nothing of the payload, and a transport outage is retried with backoff so the event is neither lost nor duplicated (SCN-WebhookGatewayService-004, ADR-0012).",
        "AC4: Given a flood at one ingress identity while another identity receives its normal deliveries, when the limit of the first is reached, then only the first is answered 429, every delivery accepted before the limit keeps its captured payload and its `WebhookGatewayService/InboundDeliveryVerified` record, and the second identity is not limited (SCN-WebhookGatewayService-004, NFR-09)."
      ],
      "sourceArtifacts": [
        "model/services/integration/WebhookGatewayService.yaml",
        "docs/planes/capability-tools/connectors/services/webhook-gateway-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6013",
        "AIFACTORY-TASK-6014"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9304,
      "kind": "behavior",
      "traces": {
        "services": [
          "WebhookGatewayService"
        ],
        "aggregates": [
          "WebhookGatewayService/InboundDelivery"
        ],
        "apis": [
          "WebhookGatewayService/ReceiveWebhook"
        ],
        "events": [
          "WebhookGatewayService/InboundDeliveryRejected",
          "WebhookGatewayService/InboundDeliveryVerified"
        ],
        "scenarios": [
          "SCN-WebhookGatewayService-004"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-09",
          "XL-16"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1478"
      ],
      "source": [
        "model/services/integration/WebhookGatewayService.yaml",
        "docs/planes/capability-tools/connectors/services/webhook-gateway-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1479]",
      "number": 1479
    },
    {
      "id": "AIFACTORY-TASK-6013",
      "type": "task",
      "parent": "AIFACTORY-US-1479",
      "title": "Refusals of ReceiveWebhook with their outcomes, the per-ingress rate limit and the InboundDeliveryRejected outbox record",
      "sequence": "06.04.04.01",
      "description": "Refusals of ReceiveWebhook with their outcomes, the per-ingress rate limit and the InboundDeliveryRejected outbox record. Expected output: ReceiveWebhook answers 404 for an unknown or inactive ingress and 400 for an invalid body without a row or an event, answers 429, 413, 401 and 409 for a known ingress with the outcomes RateLimited, Oversized, BadSignature and Replayed recorded under the tenant of the ingress entry without a payload reference together with the InboundDeliveryRejected outbox record in one transaction, verifies every signature with the secret of the connection of the entry only, applies Integration:Webhooks:RatePerMinutePerIngress per ingress identity across the replicas through the pinned rate-limiting library, counts the unrecorded refusals with UnknownIngress and Invalid, and names the failed check in each problem response without the payload or the signature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "ReceiveWebhook answers 404 for an unknown or inactive ingress and 400 for an invalid body without a row or an event, answers 429, 413, 401 and 409 for a known ingress with the outcomes RateLimited, Oversized, BadSignature and Replayed recorded under the tenant of the ingress entry without a payload reference together with the InboundDeliveryRejected outbox record in one transaction, verifies every signature with the secret of the connection of the entry only, applies Integration:Webhooks:RatePerMinutePerIngress per ingress identity across the replicas through the pinned rate-limiting library, counts the unrecorded refusals with UnknownIngress and Invalid, and names the failed check in each problem response without the payload or the signature."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6013]",
      "number": 6013
    },
    {
      "id": "AIFACTORY-TASK-6014",
      "type": "task",
      "parent": "AIFACTORY-US-1479",
      "title": "Verify the refusals and InboundDeliveryRejected through the acceptance suite",
      "sequence": "06.04.04.02",
      "description": "Verify the refusals and InboundDeliveryRejected through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WebhookGatewayService-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1479 with the fixtures of AIFACTORY-TASK-6011: the four recorded outcomes with their outbox records, the delivery signed for tenant A at the ingress of tenant B answered 401, the unknown ingress and the invalid body without a row, the publication under the run event envelope with retry, and a flood at one ingress identity beside a second one with no accepted payload lost.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-WebhookGatewayService-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1479 with the fixtures of AIFACTORY-TASK-6011: the four recorded outcomes with their outbox records, the delivery signed for tenant A at the ingress of tenant B answered 401, the unknown ingress and the invalid body without a row, the publication under the run event envelope with retry, and a flood at one ingress identity beside a second one with no accepted payload lost."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6014]",
      "number": 6014
    },
    {
      "id": "AIFACTORY-US-1480",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-188",
      "title": "Record a verified Azure DevOps delivery once, deduplicated on its key, and announce DeliveryReceived in the same transaction",
      "sequence": "06.04.05",
      "description": "As an operator, I want each verified Azure DevOps delivery to be recorded once as an inbound delivery and announced to the services that act on it, so that pushes, review states, merges and pipeline runs reach PipelineExecutionService without a duplicate and without a delivery that the subscription does not admit. The inbox of the `connector-registry` messaging profile consumes `WebhookGatewayService/InboundDeliveryVerified` with the handler `RecordAndDispatch`, idempotent on the event id, run by the worker `InboundDispatcher` with its modelled retry, exponential with five attempts and a backoff of 30 seconds, its idempotency key `dedupKey` and at most eight in parallel partitioned by `SubscriptionId`. The handler reads the `Subscription` that the event names under the tenant of the event; a subscription that does not exist in that tenant, as one of another tenant is under the row filter, records nothing, because a `Delivery` needs the connection of its subscription, and is counted. It fetches the captured payload through `ArtifactService/Artifacts.Fetch` by `payloadRef` and checks it against `payloadHash`, and reads the event type through the event-type member of the webhook scheme. When the subscription is active, the event type is one of its `eventTypes`, the connector has an Active Azure DevOps descriptor with a webhook scheme and the hash matches, it records an inbound `Delivery` with `connectorId`, `connectionId` of the subscription, `subscriptionId`, `externalId`, `dedupKey`, `payloadRef`, `payloadHash` and `receivedAt`, written in Received and moved to Verified (`SignatureAndReplayChecked`, the check the event announces), and writes the `DeliveryReceived` outbox record in the same transaction (invariant of the model, D135). Otherwise the delivery is recorded and moved from Received to Rejected (`VerificationFailed`) and nothing is published. Deduplication follows one rule. The unique index `UX_Deliveries_Dedup` holds one row per tenant, connector and `dedupKey` with no window, while the model speaks of the same key within `Integration:Connectors:ReplayWindowMinutes`. A verified delivery whose key already has a row for the tenant and connector is a duplicate, whether it arrives inside or after that window, as long as the earlier row is kept: no second row is written, nothing is published, the counter records the state Deduplicated, and the inbox message completes, so a repeated key never spends the five attempts. The handler checks for the row before it writes, and a violation of the unique index by a concurrent handler is treated the same way. The option therefore has no effect of its own in I2, and the conflict between the index and the window stays reported to the owner. The dispatcher publishes `DeliveryReceived` on `connectors.deliveries.v1.delivery-received` under the run event envelope with `deliveryId`, `tenantId`, `connectorId`, `subscriptionId`, `eventType` and `payloadHash`, never the payload or a credential, and retries a transport outage with backoff, so the event is neither lost nor duplicated (ADR-0012); PipelineExecutionService (ApplyDelivery) and KnowledgeIngestionService (IngestOnDelivery) handle it in their own suites (D140). ArtifactService and `connector-registry-sql` are required: when one does not answer, the handler fails and the inbox retries it; when the five attempts are spent the message stays failed with its reason, nothing is recorded or published, and the consumers reconcile from the system of record through the reads of AIFACTORY-US-1481. Dispatch of a delivery to the target of its subscription, with Dispatched, Acknowledged, Failed and Replayed, arrives in I5, so no inbound delivery of I2 carries a `receiptRef`. The event carries neither `payloadRef` nor the project, an open point reported to the owner. The counter `connectsoft.factory.integration.deliveries` counts each outcome by tenant, connector, direction and state. The tables `Deliveries` and `Subscriptions` are created together as modelled by AIFACTORY-TASK-6015 of AIFACTORY-US-1483, because the foreign key of `Deliveries` names `Subscriptions`; `CreateSubscription` writes the subscriptions, and this suite inserts fixture subscriptions directly into the isolated test database. A scheduled purge deletes rows of `Deliveries` older than their modelled retention of 90 days and spares every row whose `ReceiptRef` is set, the receipts that audit evidence references for seven years; the model names no worker for it, which is reported. After a purge a repeated key is recorded again as a new delivery. Kind: behavior. Traces: services: ConnectorRegistryService, WebhookGatewayService, ArtifactService; aggregates: ConnectorRegistryService/Delivery, ConnectorRegistryService/Subscription; apis: ArtifactService/Artifacts.Fetch; events: WebhookGatewayService/InboundDeliveryVerified, ConnectorRegistryService/DeliveryReceived; scenarios: SCN-ConnectorRegistryService-011; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: FR-05, NFR-05, XL-10. Depends on: AIFACTORY-US-1477, AIFACTORY-US-1478, AIFACTORY-US-1483, feature:artifact-service, feature:contracts-package. Sources: model/services/integration/ConnectorRegistryService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#workers-and-jobs, docs/planes/capability-tools/connectors/workflows.md.",
      "acceptanceCriteria": [
        "AC1: Given a `ConnectorRegistryService/Subscription` of tenant A that is active for the event type of a captured pull-request delivery and the Active Azure DevOps descriptor with its webhook scheme, when `WebhookGatewayService/InboundDeliveryVerified` arrives, then one inbound `ConnectorRegistryService/Delivery` exists in state Verified with the connection of the subscription, and the `ConnectorRegistryService/DeliveryReceived` outbox record is written in the same transaction (SCN-ConnectorRegistryService-011, D135).",
        "AC2: Given the same event delivered twice, or a second verified delivery with the same `dedupKey` for the same tenant and connector inside or after `Integration:Connectors:ReplayWindowMinutes` while the earlier row is kept, or two such deliveries handled concurrently, when it is handled, then no second `ConnectorRegistryService/Delivery` exists, nothing more is published, `connectsoft.factory.integration.deliveries` records the state Deduplicated and the inbox message completes without a retry; given an inactive subscription, an event type outside its `eventTypes`, a connector without an Active descriptor with a webhook scheme or a payload whose hash does not match, then the delivery is recorded Rejected and no `ConnectorRegistryService/DeliveryReceived` is written (SCN-ConnectorRegistryService-011).",
        "AC3: Given an event that names a subscription of tenant B while its tenant is A, or a subscription that does not exist, when it is handled, then nothing is recorded or published and the subscription of tenant B is never read; given `ArtifactService/Artifacts.Fetch` or `connector-registry-sql` unavailable, then the inbox retries five times with exponential backoff, and when the attempts are spent the message stays failed with its reason and nothing is recorded or published (SCN-ConnectorRegistryService-011, ADR-0015).",
        "AC4: Given the delivery recorded, when the outbox dispatcher of the `connector-registry` profile publishes `ConnectorRegistryService/DeliveryReceived` on `connectors.deliveries.v1.delivery-received`, then the event is sent under the run event envelope with `deliveryId`, `tenantId`, `connectorId`, `subscriptionId`, `eventType` and `payloadHash` and without the payload, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ConnectorRegistryService-011, ADR-0012).",
        "AC5: Given rows of `Deliveries` older and younger than the retention of 90 days, one older row with a `ReceiptRef`, when the scheduled purge of the registry runs, then only the older rows without a receipt are deleted, a second run deletes nothing more, and a key of a purged row is recorded again as a new `ConnectorRegistryService/Delivery` (model/services/integration/ConnectorRegistryService.yaml, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#workers-and-jobs",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6016",
        "AIFACTORY-TASK-6034",
        "AIFACTORY-TASK-6017",
        "AIFACTORY-TASK-6018"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9305,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "WebhookGatewayService",
          "ArtifactService"
        ],
        "aggregates": [
          "ConnectorRegistryService/Delivery",
          "ConnectorRegistryService/Subscription"
        ],
        "apis": [
          "ArtifactService/Artifacts.Fetch"
        ],
        "events": [
          "WebhookGatewayService/InboundDeliveryVerified",
          "ConnectorRegistryService/DeliveryReceived"
        ],
        "scenarios": [
          "SCN-ConnectorRegistryService-011"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-05",
          "NFR-05",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1477",
        "AIFACTORY-US-1478",
        "AIFACTORY-US-1483",
        "feature:artifact-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#workers-and-jobs",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1480]",
      "number": 1480
    },
    {
      "id": "AIFACTORY-TASK-6016",
      "type": "task",
      "parent": "AIFACTORY-US-1480",
      "title": "RecordAndDispatch on InboundDeliveryVerified with one deduplication rule, the Rejected path and the DeliveryReceived outbox record",
      "sequence": "06.04.05.01",
      "description": "RecordAndDispatch on InboundDeliveryVerified with one deduplication rule, the Rejected path and the DeliveryReceived outbox record. Expected output: The handler RecordAndDispatch, run by InboundDispatcher with exponential retry of five attempts, a backoff of 30 seconds, the idempotency key dedupKey and eight in parallel by SubscriptionId, reads the subscription under the tenant of the event, fetches the payload through Artifacts.Fetch and checks its hash, reads the event type through the scheme, records the inbound Delivery in Verified with the DeliveryReceived outbox record in one transaction, records Rejected for an inactive subscription, an event type outside the subscription, a connector without an Active descriptor with a scheme or a hash mismatch, writes nothing for an unknown subscription, and for a key that already has a row for the tenant and connector, inside or after the window, or a violation of UX_Deliveries_Dedup by a concurrent handler, writes and publishes nothing, records the state Deduplicated and completes the message; connectsoft.factory.integration.deliveries is recorded by tenant, connector, direction and state.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The handler RecordAndDispatch, run by InboundDispatcher with exponential retry of five attempts, a backoff of 30 seconds, the idempotency key dedupKey and eight in parallel by SubscriptionId, reads the subscription under the tenant of the event, fetches the payload through Artifacts.Fetch and checks its hash, reads the event type through the scheme, records the inbound Delivery in Verified with the DeliveryReceived outbox record in one transaction, records Rejected for an inactive subscription, an event type outside the subscription, a connector without an Active descriptor with a scheme or a hash mismatch, writes nothing for an unknown subscription, and for a key that already has a row for the tenant and connector, inside or after the window, or a violation of UX_Deliveries_Dedup by a concurrent handler, writes and publishes nothing, records the state Deduplicated and completes the message; connectsoft.factory.integration.deliveries is recorded by tenant, connector, direction and state."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9305,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6016]",
      "number": 6016
    },
    {
      "id": "AIFACTORY-TASK-6034",
      "type": "task",
      "parent": "AIFACTORY-US-1480",
      "title": "Scheduled purge of Deliveries after the modelled retention of 90 days, sparing rows with a receipt",
      "sequence": "06.04.05.02",
      "description": "Scheduled purge of Deliveries after the modelled retention of 90 days, sparing rows with a receipt. Expected output: A scheduled job of the registry deletes the rows of Deliveries whose ReceivedAt is older than 90 days and whose ReceiptRef is not set, in batches and idempotently, under the tenant row filter of each tenant it purges, and logs its run and the number of rows it deleted without a payload or a reference.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "A scheduled job of the registry deletes the rows of Deliveries whose ReceivedAt is older than 90 days and whose ReceiptRef is not set, in batches and idempotently, under the tenant row filter of each tenant it purges, and logs its run and the number of rows it deleted without a payload or a reference."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9305,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6034]",
      "number": 6034
    },
    {
      "id": "AIFACTORY-TASK-6017",
      "type": "task",
      "parent": "AIFACTORY-US-1480",
      "title": "Fixture subscriptions, recorded InboundDeliveryVerified events and the fake of Artifacts.Fetch",
      "sequence": "06.04.05.03",
      "description": "Fixture subscriptions, recorded InboundDeliveryVerified events and the fake of Artifacts.Fetch. Expected output: The acceptance suite holds fixture subscriptions of two tenants inserted directly into the isolated test database, active and inactive, recorded InboundDeliveryVerified events for a push, a pull request update, a review, a merge and a pipeline run, a fake of ArtifactService/Artifacts.Fetch that serves the captured payloads, can serve a payload with another hash and can be stopped, fixture delivery rows older and younger than 90 days with and without a receipt, and a stoppable transport for the outbox.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fixture subscriptions of two tenants inserted directly into the isolated test database, active and inactive, recorded InboundDeliveryVerified events for a push, a pull request update, a review, a merge and a pipeline run, a fake of ArtifactService/Artifacts.Fetch that serves the captured payloads, can serve a payload with another hash and can be stopped, fixture delivery rows older and younger than 90 days with and without a receipt, and a stoppable transport for the outbox."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9305,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6017]",
      "number": 6017
    },
    {
      "id": "AIFACTORY-TASK-6018",
      "type": "task",
      "parent": "AIFACTORY-US-1480",
      "title": "Verify the recording of verified deliveries, DeliveryReceived and the purge through the acceptance suite",
      "sequence": "06.04.05.04",
      "description": "Verify the recording of verified deliveries, DeliveryReceived and the purge through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1480: the Verified delivery with its outbox record, the repeated event, the repeated key inside and after the window and the concurrent pair with the message completed, the four Rejected cases, the subscription of another tenant and the unknown one, the stopped fetch and store with the spent retries, the publication under the run event envelope with retry, and the purge that spares young rows and rows with a receipt.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1480: the Verified delivery with its outbox record, the repeated event, the repeated key inside and after the window and the concurrent pair with the message completed, the four Rejected cases, the subscription of another tenant and the unknown one, the stopped fetch and store with the spent retries, the publication under the run event envelope with retry, and the purge that spares young rows and rows with a receipt."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6018]",
      "number": 6018
    },
    {
      "id": "AIFACTORY-US-1481",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-188",
      "title": "Read an Azure DevOps pipeline run, pull request, package version or container image through the connection of the project for PipelineExecutionService and ReleaseService",
      "sequence": "06.04.06",
      "description": "As an operator, I want the delivery and release services to read a pipeline run, a pull request, a package version or an image from Azure DevOps through the governed connection of the project, so that a missed delivery is never assumed, the state of a run or a proposal always comes from the system of record, and a release cites publication evidence that was read and never assumed. PipelineExecutionService calls `ConnectorRegistryService/Connectors.ReadPipelineRun` and `ConnectorRegistryService/Connectors.ReadPullRequest` when a delivery names a run or a pull request it does not know and for reconciliation, from its `DeliveryApplier` and `RunReconciler` workers. ReleaseService calls `ConnectorRegistryService/Connectors.ReadPackageFeed` to read whether a package version with its digest is in an Azure Artifacts feed, and `ConnectorRegistryService/Connectors.ReadContainerRegistry` to read whether an image with its digest is in a container registry reached through the Azure DevOps connection of the project, as publication evidence. The four methods share one path. The caller presents a workload token that holds `factory.connections.read`, the scope of the four methods (D135), and forwards its tenant and project in the gRPC metadata; such a token carries no tenant claim, so the service reads the forwarded scope only under that scope (ADR-0015 amendment D114). The request names the execution scope and what to read: the run or the pull request in Azure DevOps, the feed, package and version, or the registry, repository and digest. The service takes the highest Active Azure DevOps descriptor that declares the capability among those of the platform tenant and the forwarded tenant (AIFACTORY-US-1477), resolves the connection of the forwarded project through `IntegrationService/Connections.Resolve`, which checks the Project grant, exchanges the broker ticket through `SecretBrokerService/SecretBroker.Issue` for a short-lived credential of the purpose `delivery` and calls Azure DevOps through the adapter, the credential in memory for the call only. `delivery` is the purpose the model gives the credentials of this service and the one the certification uses (D129), and the platform bundle allows it only for the service identities of ConnectorRegistryService and WebhookGatewayService (D139). The run is read with its state, commit, stages and the results the system of record reports, the pull request with its review state, commits and merge commit; the feed and registry results state whether the version or the image is present and the digest the system reports, so that a digest that differs from the requested one is visible, and an absent version or image is an answer and not an error, with status Succeeded, on which ReleaseService decides in its own feature. The result is stored by hash through `ArtifactService/Artifacts.Store` under the forwarded tenant and project, and the reply is a `tool-receipt-v1` receipt whose `resultRef` names it and whose `status` is Succeeded, without a credential, a ticket or a credential reference. The methods have the side-effect class read, yet storing the result through `Artifacts.Store`, idempotent on tenant and hash, is a write in another service; it is a reading of the `resultRef` of the receipt under a read-class method, reported to the owner. The service writes nothing to `connector-registry-sql`. `tool-receipt-v1` requires an `invocationId` that a read does not have and `execution-scope-v1` has no member for what to read, so the request and reply messages are provisional golden files until the owner names them. Refusals: a call without a workload identity, or one that forwards no tenant, UNAUTHENTICATED; a token without the scope, PERMISSION_DENIED; an execution scope of another tenant than the forwarded one, PERMISSION_DENIED with the reason scope-mismatch; a request without a project, INVALID_ARGUMENT with the reason project-required, and one without what to read, INVALID_ARGUMENT; no Active descriptor that declares the capability, NOT_FOUND; the answers of `Connections.Resolve` and `SecretBroker.Issue` return with their status and reason, NOT_FOUND among them for a connection of another tenant (ADR-0015); a run or pull request unknown to Azure DevOps, NOT_FOUND. Azure DevOps that does not answer is retried within the deadline of the call under the retry profile of the descriptor, then the call fails with UNAVAILABLE and the reason provider-unavailable and `connectsoft.factory.integration.adapter_health` reports the adapter degraded; IntegrationService, SecretBrokerService, ArtifactService and the store are required and fail-fast, and their outage answers UNAVAILABLE. No refusal returns a partial reply. The model declares ReleaseService as a caller with the failure mode degrade, so an UNAVAILABLE answer leaves the evidence unread and never stated as present. Kind: behavior. Traces: services: ConnectorRegistryService, IntegrationService, SecretBrokerService, ArtifactService; aggregates: ConnectorRegistryService/ConnectorDescriptor; apis: ConnectorRegistryService/Connectors.ReadPipelineRun, ConnectorRegistryService/Connectors.ReadPullRequest, ConnectorRegistryService/Connectors.ReadPackageFeed, ConnectorRegistryService/Connectors.ReadContainerRegistry, IntegrationService/Connections.Resolve, SecretBrokerService/SecretBroker.Issue, ArtifactService/Artifacts.Store; scenarios: SCN-ConnectorRegistryService-015, SCN-ConnectorRegistryService-016, SCN-ConnectorRegistryService-017, SCN-ConnectorRegistryService-018; descriptors: execution-scope-v1, tool-receipt-v1; adrs: ADR-0015, ADR-0019; requirements: FR-05, FR-11, NFR-02, XL-15. Depends on: AIFACTORY-US-1477, feature:integration-service-thin, feature:secret-broker-service, feature:artifact-service. Sources: model/services/integration/ConnectorRegistryService.yaml, model/services/integration/IntegrationService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/services/devops-gitops/ReleaseService.yaml, docs/reference/schemas/execution-scope.schema.json, docs/reference/schemas/tool-invocation.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given an Active Azure DevOps descriptor that declares the pipeline-run and pull-request reads and a workload token of PipelineExecutionService with `factory.connections.read` that forwards tenant A and project P, when `ConnectorRegistryService/Connectors.ReadPipelineRun` or `ConnectorRegistryService/Connectors.ReadPullRequest` is called with a reference the sandbox stub holds, then the connection of P is resolved through `IntegrationService/Connections.Resolve`, a credential of the purpose `delivery` is issued through `SecretBrokerService/SecretBroker.Issue`, the result is stored through `ArtifactService/Artifacts.Store` and the reply is a receipt whose `resultRef` names the run with its stages and results or the pull request with its review state, commits and merge commit (SCN-ConnectorRegistryService-015, SCN-ConnectorRegistryService-016).",
        "AC2: Given an Active descriptor that declares the package-feed and container-registry reads and a workload token of ReleaseService with `factory.connections.read` that forwards tenant A and project P, when `ConnectorRegistryService/Connectors.ReadPackageFeed` or `ConnectorRegistryService/Connectors.ReadContainerRegistry` is called for a version or an image that is present, absent, or present with another digest than the requested one, then the receipt has status Succeeded and the stored result states the presence with the reported digest, the absence or the differing digest (SCN-ConnectorRegistryService-017, SCN-ConnectorRegistryService-018).",
        "AC3: Given a call without a workload identity, one that forwards no tenant, a token without the scope, an execution scope of another tenant, a request without a project or without what to read, no Active descriptor that declares the capability, or a run or pull request unknown to Azure DevOps, when one of the four methods is called, then it is refused with UNAUTHENTICATED, UNAUTHENTICATED, PERMISSION_DENIED, PERMISSION_DENIED with the reason scope-mismatch, INVALID_ARGUMENT with the reason project-required or INVALID_ARGUMENT, NOT_FOUND or NOT_FOUND, with no partial reply and no state change (SCN-ConnectorRegistryService-015, SCN-ConnectorRegistryService-016, SCN-ConnectorRegistryService-017, SCN-ConnectorRegistryService-018, ADR-0015).",
        "AC4: Given `IntegrationService/Connections.Resolve` answering no-grant, a connection that is not Active or is Degraded, or NOT_FOUND for a connection of another tenant, `SecretBrokerService/SecretBroker.Issue` refusing, Azure DevOps that does not answer within the deadline, or IntegrationService, SecretBrokerService, ArtifactService or `connector-registry-sql` unavailable, when one of the four methods is called, then the status and reason of the refusing service return unchanged, or the call fails with UNAVAILABLE, with the reason provider-unavailable for Azure DevOps, and no partial reply (SCN-ConnectorRegistryService-015, SCN-ConnectorRegistryService-017, ADR-0015).",
        "AC5: Given the captured replies, stored results, log records, activities and metrics of the suite, when they are scanned, then none holds the credential, the broker ticket or its credential reference, nothing was written to `connector-registry-sql`, and the contract test marks the request and reply messages of the four methods provisional because docs/reference/schemas/execution-scope.schema.json has no member for what to read and docs/reference/schemas/tool-invocation.schema.json requires an `invocationId` (SCN-ConnectorRegistryService-018, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/reference/schemas/tool-invocation.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6019",
        "AIFACTORY-TASK-6020",
        "AIFACTORY-TASK-6022",
        "AIFACTORY-TASK-6023",
        "AIFACTORY-TASK-6021",
        "AIFACTORY-TASK-6024"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9306,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "IntegrationService",
          "SecretBrokerService",
          "ArtifactService"
        ],
        "aggregates": [
          "ConnectorRegistryService/ConnectorDescriptor"
        ],
        "apis": [
          "ConnectorRegistryService/Connectors.ReadPipelineRun",
          "ConnectorRegistryService/Connectors.ReadPullRequest",
          "ConnectorRegistryService/Connectors.ReadPackageFeed",
          "ConnectorRegistryService/Connectors.ReadContainerRegistry",
          "IntegrationService/Connections.Resolve",
          "SecretBrokerService/SecretBroker.Issue",
          "ArtifactService/Artifacts.Store"
        ],
        "scenarios": [
          "SCN-ConnectorRegistryService-015",
          "SCN-ConnectorRegistryService-016",
          "SCN-ConnectorRegistryService-017",
          "SCN-ConnectorRegistryService-018"
        ],
        "descriptors": [
          "execution-scope-v1",
          "tool-receipt-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-05",
          "FR-11",
          "NFR-02",
          "XL-15"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1477",
        "feature:integration-service-thin",
        "feature:secret-broker-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/reference/schemas/tool-invocation.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1481]",
      "number": 1481
    },
    {
      "id": "AIFACTORY-TASK-6019",
      "type": "task",
      "parent": "AIFACTORY-US-1481",
      "title": "Provisional request and reply messages of the four Azure DevOps reads",
      "sequence": "06.04.06.01",
      "description": "Provisional request and reply messages of the four Azure DevOps reads. Expected output: The proto fixes one request message per read, the execution scope beside what to read (a run, a pull request, a package with its version and digest, an image with its digest), and the reply as the tool-receipt-v1 receipt with status, startedAt, finishedAt, resultRef and receiptHash and no credential member, as provisional golden files marked so in the contract test until the owner names the descriptors, because docs/reference/schemas/execution-scope.schema.json has no member for what to read and docs/reference/schemas/tool-invocation.schema.json requires an invocationId.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The proto fixes one request message per read, the execution scope beside what to read (a run, a pull request, a package with its version and digest, an image with its digest), and the reply as the tool-receipt-v1 receipt with status, startedAt, finishedAt, resultRef and receiptHash and no credential member, as provisional golden files marked so in the contract test until the owner names the descriptors, because docs/reference/schemas/execution-scope.schema.json has no member for what to read and docs/reference/schemas/tool-invocation.schema.json requires an invocationId."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9306,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6019]",
      "number": 6019
    },
    {
      "id": "AIFACTORY-TASK-6020",
      "type": "task",
      "parent": "AIFACTORY-US-1481",
      "title": "Shared read path and Connectors.ReadPipelineRun and Connectors.ReadPullRequest over the connection of the project",
      "sequence": "06.04.06.02",
      "description": "Shared read path and Connectors.ReadPipelineRun and Connectors.ReadPullRequest over the connection of the project. Expected output: The shared read path reads the forwarded scope only under factory.connections.read, takes the highest Active descriptor that declares the capability, resolves the connection through Connections.Resolve, exchanges the ticket through SecretBroker.Issue for a credential of the purpose delivery used in memory for the call, reads through the adapter within the deadline under the retry profile of the descriptor, stores the result through Artifacts.Store and replies with its resultRef, returns the refusals of the dependencies with their reason, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND and UNAVAILABLE as AIFACTORY-US-1481 states, writes nothing to connector-registry-sql and logs and measures neither the ticket nor its credential reference; the pipeline-run and pull-request methods use it with their adapter calls.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The shared read path reads the forwarded scope only under factory.connections.read, takes the highest Active descriptor that declares the capability, resolves the connection through Connections.Resolve, exchanges the ticket through SecretBroker.Issue for a credential of the purpose delivery used in memory for the call, reads through the adapter within the deadline under the retry profile of the descriptor, stores the result through Artifacts.Store and replies with its resultRef, returns the refusals of the dependencies with their reason, answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND and UNAVAILABLE as AIFACTORY-US-1481 states, writes nothing to connector-registry-sql and logs and measures neither the ticket nor its credential reference; the pipeline-run and pull-request methods use it with their adapter calls."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6020]",
      "number": 6020
    },
    {
      "id": "AIFACTORY-TASK-6022",
      "type": "task",
      "parent": "AIFACTORY-US-1481",
      "title": "Connectors.ReadPackageFeed and Connectors.ReadContainerRegistry over the shared read path",
      "sequence": "06.04.06.03",
      "description": "Connectors.ReadPackageFeed and Connectors.ReadContainerRegistry over the shared read path. Expected output: The two methods use the shared read path of AIFACTORY-TASK-6020, read through the adapter whether the package version or the image is present and the digest the feed or the registry reports, store that result through Artifacts.Store and reply with its resultRef and status Succeeded also for an absent version or image, and answer the refusals and failures as AIFACTORY-US-1481 states.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The two methods use the shared read path of AIFACTORY-TASK-6020, read through the adapter whether the package version or the image is present and the digest the feed or the registry reports, store that result through Artifacts.Store and reply with its resultRef and status Succeeded also for an absent version or image, and answer the refusals and failures as AIFACTORY-US-1481 states."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6022]",
      "number": 6022
    },
    {
      "id": "AIFACTORY-TASK-6023",
      "type": "task",
      "parent": "AIFACTORY-US-1481",
      "title": "Extend the sandbox stub with absent versions, absent images and differing digests",
      "sequence": "06.04.06.04",
      "description": "Extend the sandbox stub with absent versions, absent images and differing digests. Expected output: The recording stub of AIFACTORY-TASK-6006 also answers a package version and an image that are absent and ones present with another digest than the requested one, and can be stopped, so the present, absent and differing answers of both reads run without a real organization.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The recording stub of AIFACTORY-TASK-6006 also answers a package version and an image that are absent and ones present with another digest than the requested one, and can be stopped, so the present, absent and differing answers of both reads run without a real organization."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9306,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6023]",
      "number": 6023
    },
    {
      "id": "AIFACTORY-TASK-6021",
      "type": "task",
      "parent": "AIFACTORY-US-1481",
      "title": "Verify the pipeline-run and pull-request reads through the acceptance suite",
      "sequence": "06.04.06.05",
      "description": "Verify the pipeline-run and pull-request reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-015|Scenario=SCN-ConnectorRegistryService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1, AC3, AC4 and AC5 of AIFACTORY-US-1481 for these two methods with the fakes of AIFACTORY-TASK-4036 and the stub of AIFACTORY-TASK-6006: both reads for project P of tenant A, the eight refusals, each refusal of Connections.Resolve and SecretBroker.Issue, the stub that stops answering, each dependency and the store stopped, the scan for the credential and the ticket, no row written and the provisional golden files.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-015|Scenario=SCN-ConnectorRegistryService-016)\"`; a zero-match filter counts as a failure; the tests prove AC1, AC3, AC4 and AC5 of AIFACTORY-US-1481 for these two methods with the fakes of AIFACTORY-TASK-4036 and the stub of AIFACTORY-TASK-6006: both reads for project P of tenant A, the eight refusals, each refusal of Connections.Resolve and SecretBroker.Issue, the stub that stops answering, each dependency and the store stopped, the scan for the credential and the ticket, no row written and the provisional golden files."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9306,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6021]",
      "number": 6021
    },
    {
      "id": "AIFACTORY-TASK-6024",
      "type": "task",
      "parent": "AIFACTORY-US-1481",
      "title": "Verify the package-feed and container-registry reads through the acceptance suite",
      "sequence": "06.04.06.06",
      "description": "Verify the package-feed and container-registry reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-017|Scenario=SCN-ConnectorRegistryService-018)\"`; a zero-match filter counts as a failure; the tests prove AC2 to AC5 of AIFACTORY-US-1481 for these two methods with the stub of AIFACTORY-TASK-6023: the present version and image, the absent ones and the differing digests, the refusals and failures of the shared path, no row written, the scan for the credential and the ticket and the provisional golden files.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-017|Scenario=SCN-ConnectorRegistryService-018)\"`; a zero-match filter counts as a failure; the tests prove AC2 to AC5 of AIFACTORY-US-1481 for these two methods with the stub of AIFACTORY-TASK-6023: the present version and image, the absent ones and the differing digests, the refusals and failures of the shared path, no row written, the scan for the credential and the ticket and the provisional golden files."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9306,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6024]",
      "number": 6024
    },
    {
      "id": "AIFACTORY-US-1483",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-188",
      "title": "Subscribe a project to its Azure DevOps service hooks with an ingress identity, refresh the ingress table and list deliveries",
      "sequence": "06.04.07",
      "description": "As a workspace admin, I want to subscribe my project to the Azure DevOps service hooks it needs, receive the ingress identity the hooks post to, and see the inbound deliveries and their states, so that review states, merges and pipeline runs of my project reach the Factory from a subscription I created, and a rejected or failed delivery is visible. A caller whose scope carries `factory.connections.admin`, a Workspace admin of the project or a Platform admin, subscribes a project to Azure DevOps service hooks through `ConnectorRegistryService/CreateSubscription` (POST `/factory/subscriptions`) with an `Idempotency-Key`. The body names the required `projectId`, the `connectorId` of the Azure DevOps connector, the `eventTypes`, a non-empty list of event types that the webhook scheme of the connector accepts, and the `target`; the scope of I2 is Azure DevOps inbound subscriptions only. A call without `projectId` or with an invalid body is answered 400, and a project that the roles of the token do not grant 403 (D129). The service takes the highest Active Azure DevOps descriptor with a webhook scheme (AIFACTORY-US-1477); a connector that does not exist or that another tenant registered is answered 404 (ADR-0015), and one with no Active version with a webhook scheme 409. It resolves the connection of the project through `IntegrationService/Connections.Resolve` with its workload token and the forwarded tenant and project, which checks the Project grant and the state of the connection: no-grant is answered 403, a connection that is not Active or is Degraded 409, and a connection the tenant does not hold 404 (ADR-0015). The model asks for a grant of subject kind Source or Tool; the thin IntegrationService resolves through the Project grant, which stands in for it, a reading reported to the owner. The model lists neither 404 nor 503 for the operation; ADR-0015 and D137 give both, which is reported. On success the service writes, in one transaction, the `Subscription` with `tenantId`, `projectId`, `connectorId`, `connectionId`, `eventTypes`, `target`, `active` true and a new `ingressRef`, an opaque identity that cannot be guessed and is unique under `UX_Subscriptions_Ingress`, and the `ConnectorSubscriptionChanged` outbox record; the answer is 201 with the `subscriptionId` and the ingress path `/webhooks/{ingressRef}`. A repeated call with the same key returns the same result and changes nothing; the same key with another body is answered 409. The operation has the side-effect class external, because the model subscribes at the provider through the connection; in I2 the service hook is configured at Azure DevOps by the admin by the runbook of AIFACTORY-TASK-6007 with that path and the signing secret of the connection, and the registration at the provider arrives in I5, a reading reported to the owner. AuditService records the subscription from `ConnectorSubscriptionChanged` (RecordEvidence), so the command writes no evidence record of its own. The dispatcher publishes `ConnectorSubscriptionChanged` on `connectors.subscriptions.v1.connector-subscription-changed` under the run event envelope with `subscriptionId`, `tenantId`, `connectorId` and `active`, and, because the gateway has no other source and no dependency to read them, with `ingressRef`, `connectionId`, the descriptor version and its webhook scheme, never a secret or a secret reference, a model gap reported to the owner; a transport outage is retried with backoff so the event is neither lost nor duplicated. StudioBff and AuditService handle it in their own suites. The handler `RefreshIngressTable` of WebhookGatewayService consumes it through the inbox of the `webhook-gateway` profile, idempotent on the event id, and writes or updates the ingress entry of the `ingressRef` in the table `IngressEntries` of `webhook-gateway-sql`; an event with `active` false makes the entry inactive, after which a delivery to it is answered 404. No operation of I2 changes or deactivates a subscription; that arrives with `PauseOnRevocation` in I5. A caller whose scope carries `factory.connections.read` lists deliveries through `ConnectorRegistryService/ListDeliveries` (GET `/factory/deliveries`), a read, filtered by direction, connector, state and a time range on `receivedAt` and paged; the reply holds the deliveries of the tenant of the token only under the row filter, each with `deliveryId`, `direction`, `connectorId`, `subscriptionId`, `externalId`, `state`, `payloadHash`, `receivedAt`, `settledAt` and `receiptRef`, never the payload, so an operator sees a Rejected or Deduplicated inbound delivery. In I2 only inbound Azure DevOps deliveries exist, so a filter on Outbound returns an empty page. A delivery of another tenant never appears. A call without a token is answered 401, a token without the scope 403, an unknown filter value 400, a code the model does not list and reports, and an unavailable `connector-registry-sql` 503 with a problem response (D137). The gauge `connectsoft.factory.integration.subscriptions` counts active subscriptions by tenant and connector. This PBI creates the tables `Subscriptions` and `Deliveries` of `connector-registry-sql` together, because the foreign key of `Deliveries` names `Subscriptions`. Kind: behavior. Traces: services: ConnectorRegistryService, WebhookGatewayService, IntegrationService; aggregates: ConnectorRegistryService/Subscription, ConnectorRegistryService/Delivery; apis: ConnectorRegistryService/CreateSubscription, ConnectorRegistryService/ListDeliveries, IntegrationService/Connections.Resolve, WebhookGatewayService/ReceiveWebhook; events: ConnectorRegistryService/ConnectorSubscriptionChanged; scenarios: SCN-ConnectorRegistryService-003, SCN-ConnectorRegistryService-004, SCN-ConnectorRegistryService-010; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0022; requirements: FR-05, FUX-02, NFR-13. Relates: screens: connectors. Depends on: AIFACTORY-US-1477, feature:integration-service-thin, feature:contracts-package. Sources: model/services/integration/ConnectorRegistryService.yaml, model/services/integration/WebhookGatewayService.yaml, model/services/integration/IntegrationService.yaml, docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#apis, docs/planes/capability-tools/connectors/workflows.md.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin of project P of tenant A with `factory.connections.admin`, the Active Azure DevOps descriptor with its webhook scheme and `IntegrationService/Connections.Resolve` granting the Active connection C of P, when `ConnectorRegistryService/CreateSubscription` is called with an `Idempotency-Key`, `projectId` P, the connector, event types the scheme accepts and a target, then the response is 201 with the `subscriptionId` and the ingress path, the `ConnectorRegistryService/Subscription` is active with the connection C and a unique `ingressRef`, and the `ConnectorRegistryService/ConnectorSubscriptionChanged` outbox record is written in the same transaction; the same call repeated with the same key returns the same result and changes nothing (SCN-ConnectorRegistryService-003).",
        "AC2: Given a body without `projectId`, an event type the scheme does not accept, a token without the scope or for a project it does not grant, a connector unknown or registered by tenant B, a connector without an Active version with a webhook scheme, the key reused with another body, `IntegrationService/Connections.Resolve` answering no-grant, a connection that is not Active or is Degraded, or NOT_FOUND, or IntegrationService or `connector-registry-sql` unavailable, when `ConnectorRegistryService/CreateSubscription` is called, then the response is 400, 400, 403, 404, 409, 409, 403, 409, 404 or 503 with a problem response, and no subscription, ingress identity or event is written (SCN-ConnectorRegistryService-003, ADR-0015).",
        "AC3: Given the subscription committed, when the outbox dispatcher of the `connector-registry` profile publishes `ConnectorRegistryService/ConnectorSubscriptionChanged` on `connectors.subscriptions.v1.connector-subscription-changed`, then the event is sent under the run event envelope with `subscriptionId`, `tenantId`, `connectorId`, `active`, `ingressRef`, `connectionId`, the descriptor version and its webhook scheme and without a secret or a secret reference, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ConnectorRegistryService-010, ADR-0012).",
        "AC4: Given the event received by WebhookGatewayService, when `RefreshIngressTable` handles it once or twice, then one ingress entry of the `ingressRef` exists with the tenant, the subscription, the connector, the connection, the descriptor version and the scheme, and a signed delivery to that ingress identity is accepted by `WebhookGatewayService/ReceiveWebhook`; given a later event with `active` false, then the entry is inactive and a delivery to it is answered 404 (SCN-ConnectorRegistryService-010, model/services/integration/WebhookGatewayService.yaml).",
        "AC5: Given fixture deliveries of tenant A and tenant B in the states Verified, Rejected and Deduplicated, when a caller of tenant A with `factory.connections.read` calls `ConnectorRegistryService/ListDeliveries` with or without the filters of direction, connector, state and time, then the response is 200 with the matching inbound deliveries of tenant A and their states, never one of tenant B and never a payload, an Outbound filter returns an empty page, and a call without a token, a token without the scope, an unknown filter value or an unavailable `connector-registry-sql` is answered 401, 403, 400 or 503 with a problem response (SCN-ConnectorRegistryService-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#apis",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6015",
        "AIFACTORY-TASK-6025",
        "AIFACTORY-TASK-6026",
        "AIFACTORY-TASK-6027",
        "AIFACTORY-TASK-6029",
        "AIFACTORY-TASK-6028",
        "AIFACTORY-TASK-6030",
        "AIFACTORY-TASK-6036",
        "AIFACTORY-TASK-6031",
        "AIFACTORY-TASK-6032"
      ],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "WebhookGatewayService",
          "IntegrationService"
        ],
        "aggregates": [
          "ConnectorRegistryService/Subscription",
          "ConnectorRegistryService/Delivery"
        ],
        "apis": [
          "ConnectorRegistryService/CreateSubscription",
          "ConnectorRegistryService/ListDeliveries",
          "IntegrationService/Connections.Resolve",
          "WebhookGatewayService/ReceiveWebhook"
        ],
        "events": [
          "ConnectorRegistryService/ConnectorSubscriptionChanged"
        ],
        "scenarios": [
          "SCN-ConnectorRegistryService-003",
          "SCN-ConnectorRegistryService-004",
          "SCN-ConnectorRegistryService-010"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "FUX-02",
          "NFR-13"
        ]
      },
      "relates": {
        "screens": [
          "connectors"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1477",
        "feature:integration-service-thin",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "docs/planes/capability-tools/connectors/services/connector-registry-service/index.md#apis",
        "docs/planes/capability-tools/connectors/workflows.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1483]",
      "number": 1483
    },
    {
      "id": "AIFACTORY-TASK-6015",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "Migration and mappings of Deliveries and Subscriptions in connector-registry-sql",
      "sequence": "06.04.07.01",
      "description": "Migration and mappings of Deliveries and Subscriptions in connector-registry-sql. Expected output: The tables Deliveries and Subscriptions of model/services/integration/ConnectorRegistryService.yaml exist with their columns, keys, the foreign key of Deliveries on SubscriptionId and the indexes UX_Deliveries_Dedup, IX_Deliveries_State_ReceivedAt and UX_Subscriptions_Ingress; the mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The tables Deliveries and Subscriptions of model/services/integration/ConnectorRegistryService.yaml exist with their columns, keys, the foreign key of Deliveries on SubscriptionId and the indexes UX_Deliveries_Dedup, IX_Deliveries_State_ReceivedAt and UX_Subscriptions_Ingress; the mappings carry the tenant row filter of the Factory profile; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-6015]",
      "number": 6015
    },
    {
      "id": "AIFACTORY-TASK-6025",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "Contract of CreateSubscription and ListDeliveries: OpenAPI document, problem responses and the extended payload of ConnectorSubscriptionChanged",
      "sequence": "06.04.07.02",
      "description": "Contract of CreateSubscription and ListDeliveries: OpenAPI document, problem responses and the extended payload of ConnectorSubscriptionChanged. Expected output: The OpenAPI document fixes POST /factory/subscriptions with the body members projectId, connectorId, eventTypes and target, the Idempotency-Key header, the 201 reply with subscriptionId and the ingress path and the problem responses of 400, 403, 404, 409 and 503, and GET /factory/deliveries with the filters of direction, connector, state and time, the page and the problem responses of 400, 401, 403 and 503; golden files hold the shapes, a delivery item without a payload member, and the payload of ConnectorSubscriptionChanged under the run event envelope with the four modelled members and ingressRef, connectionId, the descriptor version and the webhook scheme, without a secret or a secret reference.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The OpenAPI document fixes POST /factory/subscriptions with the body members projectId, connectorId, eventTypes and target, the Idempotency-Key header, the 201 reply with subscriptionId and the ingress path and the problem responses of 400, 403, 404, 409 and 503, and GET /factory/deliveries with the filters of direction, connector, state and time, the page and the problem responses of 400, 401, 403 and 503; golden files hold the shapes, a delivery item without a payload member, and the payload of ConnectorSubscriptionChanged under the run event envelope with the four modelled members and ingressRef, connectionId, the descriptor version and the webhook scheme, without a secret or a secret reference."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6025]",
      "number": 6025
    },
    {
      "id": "AIFACTORY-TASK-6026",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "CreateSubscription with its Idempotency-Key, the connection of the project, the ingress identity and the ConnectorSubscriptionChanged outbox record",
      "sequence": "06.04.07.03",
      "description": "CreateSubscription with its Idempotency-Key, the connection of the project, the ingress identity and the ConnectorSubscriptionChanged outbox record. Expected output: CreateSubscription validates the body and the event types against the scheme, admits the project only when the roles of the token grant it, takes the highest Active Azure DevOps descriptor with a webhook scheme, resolves the connection of the project through Connections.Resolve with its workload token and the forwarded scope, writes the Subscription with a new opaque unique ingressRef and the ConnectorSubscriptionChanged outbox record with its extended payload in one transaction, answers 201, 400, 403, 404, 409 and 503 as AIFACTORY-US-1483 states, returns the same result for a repeated key and 409 for a key reused with another body, writes no evidence record of its own, and updates connectsoft.factory.integration.subscriptions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "CreateSubscription validates the body and the event types against the scheme, admits the project only when the roles of the token grant it, takes the highest Active Azure DevOps descriptor with a webhook scheme, resolves the connection of the project through Connections.Resolve with its workload token and the forwarded scope, writes the Subscription with a new opaque unique ingressRef and the ConnectorSubscriptionChanged outbox record with its extended payload in one transaction, answers 201, 400, 403, 404, 409 and 503 as AIFACTORY-US-1483 states, returns the same result for a repeated key and 409 for a key reused with another body, writes no evidence record of its own, and updates connectsoft.factory.integration.subscriptions."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6026]",
      "number": 6026
    },
    {
      "id": "AIFACTORY-TASK-6027",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "ListDeliveries read model over the deliveries of the tenant of the caller",
      "sequence": "06.04.07.04",
      "description": "ListDeliveries read model over the deliveries of the tenant of the caller. Expected output: ListDeliveries returns, under the tenant row filter, the deliveries of the trusted tenant of the caller filtered by direction, connector, state and a time range on receivedAt and paged, each item without a payload or a payload reference, answers 401 and 403 through the policies of the Factory profile, 400 for an unknown filter value and 503 with a problem response when the store is unavailable, and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "ListDeliveries returns, under the tenant row filter, the deliveries of the trusted tenant of the caller filtered by direction, connector, state and a time range on receivedAt and paged, each item without a payload or a payload reference, answers 401 and 403 through the policies of the Factory profile, 400 for an unknown filter value and 503 with a problem response when the store is unavailable, and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6027]",
      "number": 6027
    },
    {
      "id": "AIFACTORY-TASK-6029",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "Migration and mapping of IngressEntries in webhook-gateway-sql",
      "sequence": "06.04.07.05",
      "description": "Migration and mapping of IngressEntries in webhook-gateway-sql. Expected output: The table IngressEntries holds IngressRef as key with TenantId, SubscriptionId, ConnectorId, ConnectionId, the descriptor version, the webhook scheme and Active, and no secret or secret reference column; the mapping carries the tenant column and is named in the exemption file; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "The table IngressEntries holds IngressRef as key with TenantId, SubscriptionId, ConnectorId, ConnectionId, the descriptor version, the webhook scheme and Active, and no secret or secret reference column; the mapping carries the tenant column and is named in the exemption file; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-6029]",
      "number": 6029
    },
    {
      "id": "AIFACTORY-TASK-6028",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "RefreshIngressTable on ConnectorSubscriptionChanged through the inbox of the webhook-gateway profile",
      "sequence": "06.04.07.06",
      "description": "RefreshIngressTable on ConnectorSubscriptionChanged through the inbox of the webhook-gateway profile. Expected output: The inbox handler RefreshIngressTable, idempotent on the event id, writes or updates the ingress entry of the ingressRef of the event with its tenant, subscription, connector, connection, descriptor version, scheme and active state, makes the entry inactive for active false, writes through the repository of IngressEntries only, and logs neither the scheme of a tenant nor any reference; ReceiveWebhook reads the entry it writes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "The inbox handler RefreshIngressTable, idempotent on the event id, writes or updates the ingress entry of the ingressRef of the event with its tenant, subscription, connector, connection, descriptor version, scheme and active state, makes the entry inactive for active false, writes through the repository of IngressEntries only, and logs neither the scheme of a tenant nor any reference; ReceiveWebhook reads the entry it writes."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6028]",
      "number": 6028
    },
    {
      "id": "AIFACTORY-TASK-6030",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "Tokens, fixture deliveries of two tenants and recorded ConnectorSubscriptionChanged events",
      "sequence": "06.04.07.07",
      "description": "Tokens, fixture deliveries of two tenants and recorded ConnectorSubscriptionChanged events. Expected output: The registry suite holds tokens of a Workspace admin of project P of tenant A, of a caller without the scope, of a caller whose roles do not grant P and of a caller of tenant B, fixture descriptors of the platform tenant and of tenant B and fixture delivery rows of two tenants in the states Verified, Rejected and Deduplicated inserted directly into the isolated test database, and the fake of IntegrationService/Connections.Resolve of AIFACTORY-TASK-4036 answering a grant, no-grant, a Degraded connection, NOT_FOUND and no answer.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The registry suite holds tokens of a Workspace admin of project P of tenant A, of a caller without the scope, of a caller whose roles do not grant P and of a caller of tenant B, fixture descriptors of the platform tenant and of tenant B and fixture delivery rows of two tenants in the states Verified, Rejected and Deduplicated inserted directly into the isolated test database, and the fake of IntegrationService/Connections.Resolve of AIFACTORY-TASK-4036 answering a grant, no-grant, a Degraded connection, NOT_FOUND and no answer."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6030]",
      "number": 6030
    },
    {
      "id": "AIFACTORY-TASK-6036",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "Recorded ConnectorSubscriptionChanged events in the extended payload shape for the gateway suite",
      "sequence": "06.04.07.08",
      "description": "Recorded ConnectorSubscriptionChanged events in the extended payload shape for the gateway suite. Expected output: The gateway suite holds recorded ConnectorSubscriptionChanged events under the run event envelope with active true and false, in the extended payload shape of AIFACTORY-TASK-6025, for ingress identities of two tenants with distinct connections, and the delivery of one event twice with the same event id.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "The gateway suite holds recorded ConnectorSubscriptionChanged events under the run event envelope with active true and false, in the extended payload shape of AIFACTORY-TASK-6025, for ingress identities of two tenants with distinct connections, and the delivery of one event twice with the same event id."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6036]",
      "number": 6036
    },
    {
      "id": "AIFACTORY-TASK-6031",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "Verify CreateSubscription, ConnectorSubscriptionChanged and ListDeliveries through the acceptance suite of the registry",
      "sequence": "06.04.07.09",
      "description": "Verify CreateSubscription, ConnectorSubscriptionChanged and ListDeliveries through the acceptance suite of the registry. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-003|Scenario=SCN-ConnectorRegistryService-004|Scenario=SCN-ConnectorRegistryService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1, AC2, AC3 and AC5 of AIFACTORY-US-1483: the created subscription with its unique ingress identity and outbox record, the repeated key, each of the ten refusals with nothing written, the publication with the extended payload under the run event envelope with retry and without a secret reference, and the list of tenant A without a row of tenant B or a payload with its four refusals.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ConnectorRegistryService-003|Scenario=SCN-ConnectorRegistryService-004|Scenario=SCN-ConnectorRegistryService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1, AC2, AC3 and AC5 of AIFACTORY-US-1483: the created subscription with its unique ingress identity and outbox record, the repeated key, each of the ten refusals with nothing written, the publication with the extended payload under the run event envelope with retry and without a secret reference, and the list of tenant A without a row of tenant B or a payload with its four refusals."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6031]",
      "number": 6031
    },
    {
      "id": "AIFACTORY-TASK-6032",
      "type": "task",
      "parent": "AIFACTORY-US-1483",
      "title": "Verify RefreshIngressTable through the acceptance suite of the gateway",
      "sequence": "06.04.07.10",
      "description": "Verify RefreshIngressTable through the acceptance suite of the gateway. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-010\"` in ConnectSoft.AI.SoftwareFactory.WebhookGatewayService; a zero-match filter counts as a failure; the tests prove AC4 of AIFACTORY-US-1483 with the recorded events of AIFACTORY-TASK-6036: one entry after the event handled twice, a signed delivery accepted at the new ingress identity, and the entry made inactive with a delivery to it answered 404.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WebhookGatewayService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ConnectorRegistryService-010\"` in ConnectSoft.AI.SoftwareFactory.WebhookGatewayService; a zero-match filter counts as a failure; the tests prove AC4 of AIFACTORY-US-1483 with the recorded events of AIFACTORY-TASK-6036: one entry after the event handled twice, a signed delivery accepted at the new ingress identity, and the entry made inactive with a delivery to it answered 404."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WebhookGatewayService"
      ],
      "children": [],
      "buildOrder": 93,
      "phase": "factory",
      "stackRank": 9307,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6032]",
      "number": 6032
    },
    {
      "id": "AIFACTORY-FEAT-035",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-006",
      "title": "ConnectorRegistryService: complete delivery",
      "sequence": "06.05",
      "description": "ConnectorRegistryService is the service of bounded context BC-17 (Connectors & Webhooks). Connector descriptors (capability interfaces, retry and rate-limit profiles, webhook schemes, configuration forms) with provider certification, subscriptions to inbound events, verified inbound deliveries and outbound deliveries with receipts; first-party clients (Azure DevOps, GitHub, Deputy, Braze, Bill, Twilio, Israel019, ACS, GA, Meta) are adapters behind descriptors (BC-17). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService. Delivers: ConnectorRegistryService (complete). Depends on: AIFACTORY-FEAT-032. Increment I5: Knowledge and connections. Build order 149 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 149,
      "phase": "factory",
      "stackRank": 14900,
      "titlePrefix": "[AIFACTORY-FEAT-035]",
      "number": 35
    },
    {
      "id": "AIFACTORY-FEAT-036",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-006",
      "title": "IntegrationService: complete delivery",
      "sequence": "06.06",
      "description": "IntegrationService is the service of bounded context BC-16 (Connections). Tenant-scoped connections to external systems — provider, endpoint policy, credential references (never values), grants that say which projects, agents and tools may use a connection, rotation metadata and health — with every use brokered as a short-lived credential by the Secret Broker (BC-16). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.IntegrationService. Delivers: IntegrationService (complete). Depends on: AIFACTORY-FEAT-033. Increment I5: Knowledge and connections. Build order 150 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 150,
      "phase": "factory",
      "stackRank": 15000,
      "titlePrefix": "[AIFACTORY-FEAT-036]",
      "number": 36
    },
    {
      "id": "AIFACTORY-FEAT-037",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-006",
      "title": "WebhookGatewayService: complete delivery",
      "sequence": "06.07",
      "description": "WebhookGatewayService is the edge service of bounded context BC-17 (Connectors & Webhooks). The conditional inbound ingress for vendor webhooks — signature verification per connector scheme, replay-window and deduplication checks, rate limiting and payload capture — that emits verified deliveries to the connector module and never dispatches anything itself (BC-17, GW-06). Its own repository is ConnectSoft.AI.SoftwareFactory.WebhookGatewayService. Delivers: WebhookGatewayService (complete). Increment I5: Knowledge and connections. Build order 151 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/integration/WebhookGatewayService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:integration",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 151,
      "phase": "factory",
      "stackRank": 15100,
      "titlePrefix": "[AIFACTORY-FEAT-037]",
      "number": 37
    },
    {
      "id": "AIFACTORY-EPIC-007",
      "type": "epic",
      "parent": null,
      "title": "Marketplace (PF-07)",
      "sequence": "07",
      "description": "Everything that builds the Marketplace platform (PF-07): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Distribution of qualified releases, acquisition, licensing and partner publishing (later stage). Done when: Every service of the platform has its complete delivery accepted (LicenseService, MarketplaceCatalogService, MarketplaceHost), the platform gateway routes them under a trusted scope, and the outcome verification of I8 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (LicenseService, MarketplaceCatalogService, MarketplaceHost), the platform gateway routes them under a trusted scope, and the outcome verification of I8 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:marketplace",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-038",
        "AIFACTORY-FEAT-039",
        "AIFACTORY-FEAT-040"
      ],
      "stackRank": 18199,
      "titlePrefix": "[AIFACTORY-EPIC-007]",
      "number": 7
    },
    {
      "id": "AIFACTORY-FEAT-038",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-007",
      "title": "LicenseService: complete delivery",
      "sequence": "07.01",
      "description": "LicenseService is the service of bounded context BC-28 (Marketplace Acquisition & Licensing). Pricing plans (free, included in an edition, seat, usage, one-time), acquisition against the tenant's Factory subscription, entitlements that gate installation and use, license records, publisher certification, reviews and revenue shares — the Factory's own instance of the SaaS ProductsCatalog, Entitlements and Billing foundations (BC-28). Its own repository is ConnectSoft.AI.SoftwareFactory.LicenseService. Delivers: LicenseService (complete). Increment I8: Expansion. Build order 182 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/marketplace/LicenseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:marketplace",
        "type:feature",
        "route:backend-developer",
        "slice:i8-expansion",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 182,
      "phase": "factory",
      "stackRank": 18200,
      "titlePrefix": "[AIFACTORY-FEAT-038]",
      "number": 38
    },
    {
      "id": "AIFACTORY-FEAT-039",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-007",
      "title": "MarketplaceCatalogService: complete delivery",
      "sequence": "07.02",
      "description": "MarketplaceCatalogService is the service of bounded context BC-27 (Marketplace Catalog & Distribution). Listings of already-Published asset releases and operated products with provenance, evaluation evidence and compatibility, search, and installation into a tenant as a scoped release reference — distribution of qualified releases, never publication (BC-27; catalog, search, version, compatibility, installation, dependency and publishing rows merged). Its own repository is ConnectSoft.AI.SoftwareFactory.MarketplaceCatalogService. Delivers: MarketplaceCatalogService (complete). Increment I8: Expansion. Build order 183 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/marketplace/MarketplaceCatalogService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:marketplace",
        "type:feature",
        "route:backend-developer",
        "slice:i8-expansion",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 183,
      "phase": "factory",
      "stackRank": 18300,
      "titlePrefix": "[AIFACTORY-FEAT-039]",
      "number": 39
    },
    {
      "id": "AIFACTORY-FEAT-040",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-007",
      "title": "MarketplaceHost: gateway delivery",
      "sequence": "07.03",
      "description": "MarketplaceHost is the platform API gateway of bounded context BC-27 (Marketplace Catalog & Distribution). The API gateway of the Marketplace platform (ADR-0028): routes public REST and internal gRPC calls to the 2 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.MarketplaceHost. Delivers: MarketplaceHost (complete). Increment I8: Expansion. Build order 184 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/marketplace/MarketplaceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:marketplace",
        "type:feature",
        "route:backend-developer",
        "slice:i8-expansion",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 184,
      "phase": "factory",
      "stackRank": 18400,
      "titlePrefix": "[AIFACTORY-FEAT-040]",
      "number": 40
    },
    {
      "id": "AIFACTORY-EPIC-008",
      "type": "epic",
      "parent": null,
      "title": "DevOps / GitOps (PF-08)",
      "sequence": "08",
      "description": "Everything that builds the DevOps / GitOps platform (PF-08): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Pipeline and build receipts, releases and promotions, package publication evidence. Done when: Every service of the platform has its complete delivery accepted (DeliveryHost, EnvironmentPromotionService, PipelineExecutionService, ReleaseService), the platform gateway routes them under a trusted scope, and the outcome verification of I2 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (DeliveryHost, EnvironmentPromotionService, PipelineExecutionService, ReleaseService), the platform gateway routes them under a trusted scope, and the outcome verification of I2 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-041",
        "AIFACTORY-FEAT-042",
        "AIFACTORY-FEAT-043",
        "AIFACTORY-FEAT-044",
        "AIFACTORY-FEAT-045"
      ],
      "stackRank": 7299,
      "titlePrefix": "[AIFACTORY-EPIC-008]",
      "number": 8
    },
    {
      "id": "AIFACTORY-FEAT-041",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-008",
      "title": "PipelineExecutionService: thin delivery for the first outcome",
      "sequence": "08.01",
      "description": "PipelineExecutionService is the service of bounded context BC-23 (Source & Pipelines). Receipts for everything the Factory does in a system of record: change proposals that became branches and pull requests with their review state, pipeline runs with stages, build, test, coverage, security and package results, and the provenance that ties every commit and run back to the Factory run, agent release and change set that produced it (BC-23; BuildResultService merged). In this increment it is delivered thin: The ChangeProposal aggregate and the path that opens a proposal in the system of record; no pipeline runs. Its own repository is ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Delivers: PipelineExecutionService (thin: The ChangeProposal aggregate and the path that opens a proposal in the system of record; no pipeline runs.). Increment I1: Generate a microservice. Build order 73 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-017",
        "AIFACTORY-US-1277",
        "AIFACTORY-US-1278",
        "AIFACTORY-US-1279"
      ],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7300,
      "titlePrefix": "[AIFACTORY-FEAT-041]",
      "number": 41
    },
    {
      "id": "AIFACTORY-US-017",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-041",
      "title": "Approve the exact change set and open the change proposal",
      "sequence": "08.01.01",
      "description": "As a reviewer, I want to approve the exact change set a run produced before it reaches the repository, so that nothing is written to the system of record that a person did not approve. This is the integration PBI of the thin delivery of PipelineExecutionService, the receipts service of bounded context BC-23. The thin scope stated in model/backlog/features/devops-gitops.yaml is the `ChangeProposal` aggregate and the path that opens a proposal in the system of record, and the delivery holds exactly that and nothing more. When `generate-product` reaches its Human step `approve-proposal`, RunControlService opens an approval request whose subject is the run and the step (D129), bound to the hash of the change set the run recorded; the request appears in the approvals list of an eligible Reviewer, the requester of the run never decides, and a regenerated change set makes the pending request Stale. Until I4 this human approval always runs, whatever the project policy answers (D133). The approval itself, its list and its decision are delivered by feature run-control-service, the step by feature wf-generate-product and the `approvals list` command by feature command-line-client-commands; this feature consumes them. When the Reviewer approved, the tool `propose-change-set` executes in ToolAdapterService under the run's workload identity. In I1 the opening path is the one the owner decided (D135): the tool opens the pull request through the Azure DevOps connection that `IntegrationService/Connections.Resolve` returns for the project, with a credential from the Secret Broker (feature connector-registry-service-thin, AIFACTORY-US-066), and records it through the internal `Pipelines.RecordProposal` with the request descriptor `change-proposal-record-v1`, which carries the change set, the run, the attempt, the agent release, the pull-request reference and the tool receipt, under the service scope `factory.delivery.propose` (AIFACTORY-US-1277). One `ChangeProposal` then exists per run and change set, with its provenance to the run, the attempt, the agent release and the change-set artifact, in state PullRequestOpen, and `ChangeProposalOpened` is published once in the transaction of that transition (AIFACTORY-US-1278). `OpenChangeProposal`, the REST route that pushes the branch from this service, is not in the thin scope: it stays the route of a person and arrives with a connector path of PipelineExecutionService in feature pipeline-execution-service-complete (AIFACTORY-US-1276, D135). The thin delivery reads no proposal over REST, mirrors no review or merge, records no pipeline run, reconciles nothing and handles no consumed event: those arrive with feature pipeline-execution-service-complete in I2. A step's own compensation runs only after its effect is confirmed (D133), so a failed recording withdraws nothing; no modelled operation withdraws a confirmed proposal, so the declared compensation of `propose-change-set` stays an open point of the model. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Kind: behavior. Traces: services: PipelineExecutionService, RunControlService, ToolAdapterService, IntegrationService, ConnectorRegistryService, AuditService; aggregates: RunControlService/ApprovalRequest, PipelineExecutionService/ChangeProposal; apis: RunControlService/RunControl.RequestApproval, RunControlService/DecideApproval, RunControlService/ListApprovals, PipelineExecutionService/Pipelines.RecordProposal, IntegrationService/Connections.Resolve; events: RunControlService/ApprovalRequested, PipelineExecutionService/ChangeProposalOpened; steps: generate-product/approve-proposal, generate-product/propose-change-set; tools: propose-change-set; descriptors: pull-request-proposal-v1, change-set-v1, change-proposal-record-v1; adrs: ADR-0014, ADR-0015, ADR-0027; requirements: FR-07, XL-10. Relates: screens: proposals. Depends on: AIFACTORY-US-1277, AIFACTORY-US-1278, AIFACTORY-US-1279, feature:run-control-service, feature:tool-adapter-service, feature:wf-generate-product, feature:command-line-client-commands, feature:integration-service-thin, feature:connector-registry-service-thin, feature:secret-broker-service. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, model/backlog/features/devops-gitops.yaml, model/workflows/generate-product.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the outputs of the run are recorded, when the run reaches generate-product/approve-proposal, then RunControlService opens through `RunControlService/RunControl.RequestApproval` an approval request that names the run and the step as its subject and is bound to the hash of the change set, `RunControlService/ApprovalRequested` is published, and the request appears in `RunControlService/ListApprovals` of an eligible Reviewer with the bound hash (ADR-0015).",
        "AC2: Given I requested the run, when I try to decide the approval through `RunControlService/DecideApproval`, then I am refused because the requester never decides; given the change set is regenerated while the `RunControlService/ApprovalRequest` is pending, then the request is Stale and an approval of it never reaches generate-product/propose-change-set.",
        "AC3: Given I approved the exact hash, when generate-product/propose-change-set runs the tool `propose-change-set` and ToolAdapterService opened the pull request through the connection of `IntegrationService/Connections.Resolve`, then a `PipelineExecutionService/ChangeProposal` in state PullRequestOpen exists once for the run and the change set, recorded through `PipelineExecutionService/Pipelines.RecordProposal` with a `change-proposal-record-v1` request carrying branch, pull-request reference, tool receipt and provenance, and `PipelineExecutionService/ChangeProposalOpened` is published once (XL-10, ADR-0014, D135).",
        "AC4: Given the thin delivery is deployed on an I1 instance, when its surface is inspected, then it serves `PipelineExecutionService/Pipelines.RecordProposal`, publishes `PipelineExecutionService/ChangeProposalOpened` and nothing else, every other operation, event, worker and handler of model/services/devops-gitops/PipelineExecutionService.yaml arriving with feature pipeline-execution-service-complete, and the contracts it serves match the model so that the complete delivery replaces it without a contract change."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/backlog/features/devops-gitops.yaml",
        "model/workflows/generate-product.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-226",
        "AIFACTORY-TASK-228",
        "AIFACTORY-TASK-710"
      ],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7301,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "RunControlService",
          "ToolAdapterService",
          "IntegrationService",
          "ConnectorRegistryService",
          "AuditService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "RunControlService/RunControl.RequestApproval",
          "RunControlService/DecideApproval",
          "RunControlService/ListApprovals",
          "PipelineExecutionService/Pipelines.RecordProposal",
          "IntegrationService/Connections.Resolve"
        ],
        "events": [
          "RunControlService/ApprovalRequested",
          "PipelineExecutionService/ChangeProposalOpened"
        ],
        "steps": [
          "generate-product/approve-proposal",
          "generate-product/propose-change-set"
        ],
        "tools": [
          "propose-change-set"
        ],
        "descriptors": [
          "pull-request-proposal-v1",
          "change-set-v1",
          "change-proposal-record-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0027"
        ],
        "requirements": [
          "FR-07",
          "XL-10"
        ]
      },
      "relates": {
        "screens": [
          "proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1277",
        "AIFACTORY-US-1278",
        "AIFACTORY-US-1279",
        "feature:run-control-service",
        "feature:tool-adapter-service",
        "feature:wf-generate-product",
        "feature:command-line-client-commands",
        "feature:integration-service-thin",
        "feature:connector-registry-service-thin",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/backlog/features/devops-gitops.yaml",
        "model/workflows/generate-product.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-017]",
      "number": 17
    },
    {
      "id": "AIFACTORY-TASK-226",
      "type": "task",
      "parent": "AIFACTORY-US-017",
      "title": "Fixture of a recorded change set and the proposal the tool opened for it",
      "sequence": "08.01.01.01",
      "description": "Fixture of a recorded change set and the proposal the tool opened for it. Expected output: The acceptance suite of the service holds a fixture of a change set the tool proposed: a change-proposal-record-v1 request whose change-set-v1 document has its hash and diff reference stored in a fake of ArtifactService, with the run, the attempt and the agent release of the provenance, the pull-request reference and the receipt of propose-change-set for a pull request opened in a sandbox Azure DevOps project, as the oracle of SCN-PipelineExecutionService-007 and SCN-PipelineExecutionService-008; the fixture holds no approval request, because no operation of PipelineExecutionService reads one, and the approval is proven by the suites of feature run-control-service.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The acceptance suite of the service holds a fixture of a change set the tool proposed: a change-proposal-record-v1 request whose change-set-v1 document has its hash and diff reference stored in a fake of ArtifactService, with the run, the attempt and the agent release of the provenance, the pull-request reference and the receipt of propose-change-set for a pull request opened in a sandbox Azure DevOps project, as the oracle of SCN-PipelineExecutionService-007 and SCN-PipelineExecutionService-008; the fixture holds no approval request, because no operation of PipelineExecutionService reads one, and the approval is proven by the suites of feature run-control-service."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7301,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-226]",
      "number": 226
    },
    {
      "id": "AIFACTORY-TASK-228",
      "type": "task",
      "parent": "AIFACTORY-US-017",
      "title": "Verify that approvals list shows the bound change-set hash of approve-proposal",
      "sequence": "08.01.01.02",
      "description": "Verify that approvals list shows the bound change-set hash of approve-proposal. Expected output: The acceptance suite of the client repository runs `approvals list` of feature command-line-client-commands (AIFACTORY-US-376) against a fixture approval request of generate-product/approve-proposal and finds the change-set hash the request is bound to in the printed row, which proves the reviewer-facing half of AC1 of AIFACTORY-US-017; no command is written here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The acceptance suite of the client repository runs `approvals list` of feature command-line-client-commands (AIFACTORY-US-376) against a fixture approval request of generate-product/approve-proposal and finds the change-set hash the request is bound to in the printed row, which proves the reviewer-facing half of AC1 of AIFACTORY-US-017; no command is written here."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-228]",
      "number": 228
    },
    {
      "id": "AIFACTORY-TASK-710",
      "type": "task",
      "parent": "AIFACTORY-US-017",
      "title": "Verify approve-and-propose by running the declared command",
      "sequence": "08.01.01.03",
      "description": "Verify approve-and-propose by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-007|Scenario=SCN-PipelineExecutionService-008)\"`; a zero-match filter counts as a failure; the tests prove AC3 and AC4 of AIFACTORY-US-017 on the fixture of AIFACTORY-TASK-226. AC1 is proven by AIFACTORY-TASK-879 (request-an-approval, AIFACTORY-US-165) and AC2 by AIFACTORY-TASK-883 (decide-an-approval, AIFACTORY-US-166) of feature run-control-service, together with AIFACTORY-TASK-228 for the hash shown to the Reviewer.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-007|Scenario=SCN-PipelineExecutionService-008)\"`; a zero-match filter counts as a failure; the tests prove AC3 and AC4 of AIFACTORY-US-017 on the fixture of AIFACTORY-TASK-226. AC1 is proven by AIFACTORY-TASK-879 (request-an-approval, AIFACTORY-US-165) and AC2 by AIFACTORY-TASK-883 (decide-an-approval, AIFACTORY-US-166) of feature run-control-service, together with AIFACTORY-TASK-228 for the hash shown to the Reviewer."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-710]",
      "number": 710
    },
    {
      "id": "AIFACTORY-US-1277",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-041",
      "title": "Record a proposal that the propose-change-set tool opened, with its receipt, exactly once",
      "sequence": "08.01.02",
      "description": "ToolAdapterService, the inbound caller the model names for this method, calls the internal gRPC method `PipelineExecutionService/Pipelines.RecordProposal` with its workload identity after the tool `propose-change-set` opened a pull request through the connection that `IntegrationService/Connections.Resolve` returned for the project with a credential from the Secret Broker, and sends the request descriptor `change-proposal-record-v1` (D135): the trusted `scope`, the change set as `change-set-v1` (`changeSetId`, `repository`, `baseRevision`, `branch`, `hash`, `diffRef`, build and test results), `changeSetRef`, `runId`, the optional `stepId`, the optional `stepRunId` of the requesting step (D141), `attemptId`, `agentReleaseId`, the `pullRequest` (system, repository, branch, target branch and `pullRequestRef`) and the `toolReceipt` of the invocation. This is the path through which the thin delivery opens a proposal in the system of record. The service records one `ChangeProposal` with its provenance to the run, the attempt, the agent release and the change-set artifact, applies the transitions Proposed, BranchCreated (`BranchPushed`) and PullRequestOpen (`PullRequestOpened`) in one transaction, records the commits in `ProposalCommits` with their trailers, writes the `ChangeProposalOpened` outbox record in that transaction (AIFACTORY-US-1278) and replies `ack-v1`. The side effect of this shared-write method happens once: a repeated call for the same run and change-set hash replies the same acknowledgement and writes nothing; from I2 the same rule keeps one proposal when the change set also arrives through `OpenChangeProposal` (AIFACTORY-US-1276). A caller without a workload identity is refused with UNAUTHENTICATED, a workload whose token does not hold the service scope `factory.delivery.propose` with PERMISSION_DENIED, and a request that fails the validation of `change-proposal-record-v1` or carries no provenance with INVALID_ARGUMENT, because a proposal without provenance is not Factory-authored; nothing is written on any refusal. When ArtifactService, a fail-fast dependency, is unavailable the call fails with UNAVAILABLE and writes nothing, and the caller repeats it. Tenant and project are read from the forwarded scope only under the service scope that names them (ADR-0015 amendment D114). The proposal records the pull-request reference, the tool receipt and the provenance from the members of `change-proposal-record-v1`, and keeps the `stepRunId` beside the `runId` in the nullable column `StepRunId` of `ChangeProposals`, because no request of this service starts a pipeline run: the pipeline run of the merged commit takes both from this proposal and `PipelineRunCompleted` echoes them (AIFACTORY-US-1283 of feature `pipeline-execution-service-complete`, D141). Kind: behavior. Traces: services: PipelineExecutionService, ToolAdapterService, ArtifactService; aggregates: PipelineExecutionService/ChangeProposal; apis: PipelineExecutionService/Pipelines.RecordProposal; events: PipelineExecutionService/ChangeProposalOpened; descriptors: change-proposal-record-v1, change-set-v1, ack-v1; adrs: ADR-0014, ADR-0015; requirements: FR-07; scenarios: SCN-PipelineExecutionService-007. Depends on: AIFACTORY-US-1279, feature:tool-adapter-service, feature:artifact-service. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, model/descriptors.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given ToolAdapterService with a workload identity holding `factory.delivery.propose` and a `change-proposal-record-v1` request for a proposal the tool opened, when `PipelineExecutionService/Pipelines.RecordProposal` is called, then the reply carries `ack-v1`, one `PipelineExecutionService/ChangeProposal` exists in state PullRequestOpen with its provenance (run, attempt, agent release), its pull-request reference, its tool receipt and its commits, and the `PipelineExecutionService/ChangeProposalOpened` outbox record is written in the same transaction (SCN-PipelineExecutionService-007, ADR-0014, D135).",
        "AC2: Given the same run and change-set hash recorded before, when `PipelineExecutionService/Pipelines.RecordProposal` is called again, then the same acknowledgement is returned, no second proposal or commit row is written and no second event is published (SCN-PipelineExecutionService-007).",
        "AC3: Given a caller without a workload identity, a token without the service scope `factory.delivery.propose`, or a request that fails the validation of `change-proposal-record-v1` or names no provenance, when `PipelineExecutionService/Pipelines.RecordProposal` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT respectively and no state changes (SCN-PipelineExecutionService-007, ADR-0015).",
        "AC4: Given ArtifactService is unavailable, when `PipelineExecutionService/Pipelines.RecordProposal` is called, then the call fails with UNAVAILABLE, nothing is written or published, and the repeat after recovery records the proposal once (SCN-PipelineExecutionService-007, model/services/devops-gitops/PipelineExecutionService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/descriptors.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5103",
        "AIFACTORY-TASK-5104"
      ],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7302,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ToolAdapterService",
          "ArtifactService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "PipelineExecutionService/Pipelines.RecordProposal"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalOpened"
        ],
        "descriptors": [
          "change-proposal-record-v1",
          "change-set-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-07"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1279",
        "feature:tool-adapter-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/descriptors.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1277]",
      "number": 1277
    },
    {
      "id": "AIFACTORY-TASK-5103",
      "type": "task",
      "parent": "AIFACTORY-US-1277",
      "title": "Pipelines.RecordProposal with one effect per run and change-set hash",
      "sequence": "08.01.02.01",
      "description": "Pipelines.RecordProposal with one effect per run and change-set hash. Expected output: The gRPC method checks the service scope factory.delivery.propose, validates change-proposal-record-v1 and the provenance, records the proposal with its pull-request reference and tool receipt, the runId and the optional stepRunId of the requesting step (D141), with BranchPushed and PullRequestOpened applied in one transaction with the ChangeProposalOpened outbox record, writes ProposalCommits, replies ack-v1, deduplicates on run and change-set hash and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or UNAVAILABLE without writing anything.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The gRPC method checks the service scope factory.delivery.propose, validates change-proposal-record-v1 and the provenance, records the proposal with its pull-request reference and tool receipt, the runId and the optional stepRunId of the requesting step (D141), with BranchPushed and PullRequestOpened applied in one transaction with the ChangeProposalOpened outbox record, writes ProposalCommits, replies ack-v1, deduplicates on run and change-set hash and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or UNAVAILABLE without writing anything."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5103]",
      "number": 5103
    },
    {
      "id": "AIFACTORY-TASK-5104",
      "type": "task",
      "parent": "AIFACTORY-US-1277",
      "title": "Verify record-a-proposal-receipt through the acceptance suite",
      "sequence": "08.01.02.02",
      "description": "Verify record-a-proposal-receipt through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1277 on the fixture of AIFACTORY-TASK-226, including one proposal when the same run and change-set hash are recorded twice.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1277 on the fixture of AIFACTORY-TASK-226, including one proposal when the same run and change-set hash are recorded twice."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5104]",
      "number": 5104
    },
    {
      "id": "AIFACTORY-US-1278",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-041",
      "title": "Publish ChangeProposalOpened once for every opened proposal through the outbox",
      "sequence": "08.01.03",
      "description": "When a `ChangeProposal` reaches PullRequestOpen through the opening path, in I1 through `Pipelines.RecordProposal` (AIFACTORY-US-1277) and from I2 also through `OpenChangeProposal` (AIFACTORY-US-1276 of feature pipeline-execution-service-complete), the service writes the outbox record of `ChangeProposalOpened` in the same transaction as the transition (ADR-0014), under the messaging profile of the service named `pipeline-execution` by `OrleansMessaging:ServiceName`, whose inbox and outbox belong to this service alone (ADR-0028). The dispatcher publishes the event on `pipelines.proposals.v1.change-proposal-opened` under the run event envelope of the contracts package (ADR-0014 amendment D114) with the payload `proposalId`, `tenantId`, `projectId`, `runId`, `repository` and the optional `pullRequestRef`, and with the run, step and attempt of the provenance in the envelope. A transport outage is retried with backoff, so the event is neither lost nor published twice under its event id (ADR-0012); one proposal yields one event whichever entry point opened it. Publication is not proof of the transition: the state is in the store, the event announces it. The consumers the model names, WorkflowEngineService, which correlates it with the run, RunControlService, which binds the proposal to the run, AuditService, which records it as evidence, StudioBff and DashboardService in their increments, prove their handling in their own suites; this PBI proves what the publisher can prove. A refused or failed recording publishes nothing. Kind: behavior. Traces: services: PipelineExecutionService; aggregates: PipelineExecutionService/ChangeProposal; apis: PipelineExecutionService/Pipelines.RecordProposal; events: PipelineExecutionService/ChangeProposalOpened; adrs: ADR-0012, ADR-0014, ADR-0028; scenarios: SCN-PipelineExecutionService-008. Depends on: AIFACTORY-US-1279, feature:contracts-package. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a `PipelineExecutionService/ChangeProposal` moved to PullRequestOpen through `PipelineExecutionService/Pipelines.RecordProposal`, when the transaction commits, then exactly one outbox record of `PipelineExecutionService/ChangeProposalOpened` was written in that transaction, and none is written for a refused or failed call (SCN-PipelineExecutionService-008, ADR-0014).",
        "AC2: Given the outbox record, when the dispatcher of the `pipeline-execution` profile publishes `PipelineExecutionService/ChangeProposalOpened` on `pipelines.proposals.v1.change-proposal-opened`, then the event is sent under the run event envelope with `proposalId`, `tenantId`, `projectId`, `runId`, `repository` and `pullRequestRef`, and the run, step and attempt of the provenance (SCN-PipelineExecutionService-008, ADR-0028).",
        "AC3: Given the transport is unavailable when the record is dispatched, when it recovers, then the event is published with backoff, neither lost nor duplicated under its event id, and a redelivery to a consumer carries the same event id so the consumer can deduplicate (SCN-PipelineExecutionService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5105",
        "AIFACTORY-TASK-5106"
      ],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7303,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "PipelineExecutionService/Pipelines.RecordProposal"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalOpened"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0028"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1279",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1278]",
      "number": 1278
    },
    {
      "id": "AIFACTORY-TASK-5105",
      "type": "task",
      "parent": "AIFACTORY-US-1278",
      "title": "Outbox publication of ChangeProposalOpened under the run event envelope",
      "sequence": "08.01.03.01",
      "description": "Outbox publication of ChangeProposalOpened under the run event envelope. Expected output: The outbox writer of the pipeline-execution profile enlists in the transaction of the PullRequestOpened transition, and the dispatcher publishes ChangeProposalOpened on pipelines.proposals.v1.change-proposal-opened under the run event envelope of the contracts package with the modelled payload, retrying with backoff on a transport outage.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The outbox writer of the pipeline-execution profile enlists in the transaction of the PullRequestOpened transition, and the dispatcher publishes ChangeProposalOpened on pipelines.proposals.v1.change-proposal-opened under the run event envelope of the contracts package with the modelled payload, retrying with backoff on a transport outage."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5105]",
      "number": 5105
    },
    {
      "id": "AIFACTORY-TASK-5106",
      "type": "task",
      "parent": "AIFACTORY-US-1278",
      "title": "Verify publish-change-proposal-opened through the acceptance suite",
      "sequence": "08.01.03.02",
      "description": "Verify publish-change-proposal-opened through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1278 with a transport that can be stopped; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1278 with a transport that can be stopped; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5106]",
      "number": 5106
    },
    {
      "id": "AIFACTORY-US-1279",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-041",
      "title": "Scaffold PipelineExecutionService with the ChangeProposal aggregate and its store for the thin scope",
      "sequence": "08.01.04",
      "description": "PipelineExecutionService has its own repository, ConnectSoft.AI.SoftwareFactory.PipelineExecutionService, its own deployable and its own store (ADR-0028). The repository is created and scaffolded in I0 by AIFACTORY-TASK-092 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; it is scaffolded once from the pinned base template package with `UseFactoryProfile` (feature component-base-template-factory-profile, consumed by its pinned version), so token validation, scope enforcement, problem responses, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again. The thin scope adds the `ChangeProposal` aggregate with its fields, its invariants and the transitions `BranchPushed` and `PullRequestOpened` that the recording path uses, the tables `ChangeProposals` and `ProposalCommits` of the store `pipeline-execution-sql` with their keys, indexes and tenant filters, the outbox of the Orleans messaging profile under the service name `pipeline-execution`, the options `Delivery:Pipelines:CommitTrailerKeys`, whose keys the recorded commits carry in `ProposalCommits`, and `Delivery:Systems:DefaultSystemOfRecord`, the gauge `connectsoft.factory.delivery.proposals`, and the workload check of the gRPC method. No REST route is served in I1. The other transitions of `ProposalState`, the `PipelineRun` aggregate with its tables, the REST routes, the inbox handlers, the workers and the other operations are left to feature pipeline-execution-service-complete; the contracts that the thin delivery serves already match the model, so the complete delivery replaces the thin one without a contract change. Kind: enabling. Traces: services: PipelineExecutionService; aggregates: PipelineExecutionService/ChangeProposal; adrs: ADR-0014, ADR-0015, ADR-0028. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#data-model-and-storage.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-092 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PipelineExecutionService --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 and the tests pass (ADR-0028, model/services/devops-gitops/PipelineExecutionService.yaml).",
        "AC2: Given the domain model of the thin scope, when its unit tests run, then the `PipelineExecutionService/ChangeProposal` holds its fields and invariants, applies `BranchPushed` and `PullRequestOpened` from the states the model draws and refuses any other move, and a proposal without provenance cannot be created (ADR-0014).",
        "AC3: Given the store `pipeline-execution-sql`, when the mapping tests run against an isolated test database, then `ChangeProposals` and `ProposalCommits` are mapped with their keys, the indexes `IX_Proposals_Run` and `IX_Proposals_Repo_State` and the tenant filter, and a row of another tenant is never read (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#data-model-and-storage"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-093",
        "AIFACTORY-TASK-094"
      ],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7304,
      "kind": "enabling",
      "traces": {
        "services": [
          "PipelineExecutionService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#data-model-and-storage"
      ],
      "titlePrefix": "[AIFACTORY-US-1279]",
      "number": 1279
    },
    {
      "id": "AIFACTORY-TASK-093",
      "type": "task",
      "parent": "AIFACTORY-US-1279",
      "title": "Implement the thin scope of PipelineExecutionService for the first outcome",
      "sequence": "08.01.04.01",
      "description": "Implement the thin scope of PipelineExecutionService for the first outcome. Expected output: The ChangeProposal aggregate with BranchPushed and PullRequestOpened, the tables ChangeProposals and ProposalCommits with tenant filters, the outbox of the pipeline-execution profile, the two options of the recording path and the workload check of Pipelines.RecordProposal; no REST route and no pipeline runs. The contracts of the method and the event the chain uses match model/services/devops-gitops/PipelineExecutionService.yaml, so the complete delivery replaces the thin one without a contract change.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The ChangeProposal aggregate with BranchPushed and PullRequestOpened, the tables ChangeProposals and ProposalCommits with tenant filters, the outbox of the pipeline-execution profile, the two options of the recording path and the workload check of Pipelines.RecordProposal; no REST route and no pipeline runs. The contracts of the method and the event the chain uses match model/services/devops-gitops/PipelineExecutionService.yaml, so the complete delivery replaces the thin one without a contract change."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-093]",
      "number": 93
    },
    {
      "id": "AIFACTORY-TASK-094",
      "type": "task",
      "parent": "AIFACTORY-US-1279",
      "title": "Contract tests for the method and the event of PipelineExecutionService that the chain uses",
      "sequence": "08.01.04.02",
      "description": "Contract tests for the method and the event of PipelineExecutionService that the chain uses. Expected output: Contract tests of PipelineExecutionService/Pipelines.RecordProposal and PipelineExecutionService/ChangeProposalOpened pass against the request and response descriptors of model/descriptors.yaml, and AC1 to AC3 of AIFACTORY-US-1279 pass in the repository pipeline; callers can run against this service without a fake.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Contract tests of PipelineExecutionService/Pipelines.RecordProposal and PipelineExecutionService/ChangeProposalOpened pass against the request and response descriptors of model/descriptors.yaml, and AC1 to AC3 of AIFACTORY-US-1279 pass in the repository pipeline; callers can run against this service without a fake."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 73,
      "phase": "factory",
      "stackRank": 7304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-094]",
      "number": 94
    },
    {
      "id": "AIFACTORY-FEAT-042",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-008",
      "title": "DeliveryHost: gateway delivery",
      "sequence": "08.02",
      "description": "DeliveryHost is the platform API gateway of bounded context BC-23 (Source & Pipelines). The API gateway of the DevOps / GitOps platform (ADR-0028): routes public REST and internal gRPC calls to the 3 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.DeliveryHost. Delivers: DeliveryHost (complete). Increment I2: Deliver it. Build order 94 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-075",
        "AIFACTORY-US-1317",
        "AIFACTORY-US-1318",
        "AIFACTORY-US-1319",
        "AIFACTORY-US-1320",
        "AIFACTORY-US-1321"
      ],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9400,
      "titlePrefix": "[AIFACTORY-FEAT-042]",
      "number": 42
    },
    {
      "id": "AIFACTORY-US-075",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-042",
      "title": "DeliveryHost routes the calls of the DevOps and GitOps platform under a trusted scope",
      "sequence": "08.02.01",
      "description": "As an operator, I want one gateway in front of EnvironmentPromotionService, PipelineExecutionService and ReleaseService that validates tokens and scopes, so that no service of the platform is reachable from outside the cluster except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the DevOps and GitOps platform. ADR-0028 makes DeliveryHost the API gateway of its platform: it routes public REST and internal gRPC calls to the three services the model lists under `deployment.fronts`, EnvironmentPromotionService, PipelineExecutionService and ReleaseService, validates tokens and scopes and owns no business state, no relational store and no secret (gateway role GW-03). The repository ConnectSoft.AI.SoftwareFactory.DeliveryHost is created by the first task of this feature by the steps of the repository checklist of feature `repository-and-pipeline-conventions`: it is scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway therefore has no outbox and no inbox, consumes and publishes no event (D129) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`); the gateway copies neither the accessor nor the token contract. A user token has one audience, this gateway, and the gateway forwards it unchanged to the fronted service, which accepts the audience of its own gateway, and exchanges no token (ADR-0015 amendments D114 and D117). A workload token carries service scopes and is admitted only on an internal gRPC route whose fronts entry names a service scope the token holds; each of the three gRPC methods takes the service scope of its service (D114, D135): `factory.delivery.promote` for `Promotions.Request`, `factory.delivery.propose` for `Pipelines.RecordProposal` and `factory.delivery.read` for `Releases.GetRelease` (AIFACTORY-US-1317). The feature is delivered by five further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-1317), token, tenant, project and scope on every read route (AIFACTORY-US-1318), the pass-through of a shared-write call (AIFACTORY-US-1319), the production routes whose one approval stays in EnvironmentPromotionService (AIFACTORY-US-1320), and health, systems, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-1321). A call without a token, with an expired token or with a user token issued for another gateway is answered 401, a missing scope or a project the token does not grant 403, and no fronted service is called. A resource of another tenant is answered 404 by the fronted service (ADR-0015 amendment D113) and the gateway returns that answer unchanged. All three fronted services are delivered complete in this increment, PipelineExecutionService by feature `pipeline-execution-service-complete` after its thin delivery of I1, so every route serves from the start. The inbound list of model/services/devops-gitops/DeliveryHost.yaml names StudioBff and ToolExecutorHost: ToolExecutorHost, delivered in I1, calls the services for the deploy-environment and propose-change-set tools, and StudioBff in I3; each calls the gateway in its own PBIs, and this feature waits for none of them. The gateway invents no response. Kind: enabling. Traces: services: DeliveryHost, EnvironmentPromotionService, PipelineExecutionService, ReleaseService; apis: DeliveryHost/DeliveryHealth; adrs: ADR-0004, ADR-0012, ADR-0014, ADR-0015, ADR-0017, ADR-0028; requirements: FR-07, FR-08. Depends on: AIFACTORY-US-1317, AIFACTORY-US-1318, AIFACTORY-US-1319, AIFACTORY-US-1320, AIFACTORY-US-1321, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai, feature:environment-promotion-service, feature:pipeline-execution-service-thin, feature:pipeline-execution-service-complete, feature:release-service. Sources: model/services/devops-gitops/DeliveryHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/execution/delivery-engine/services/delivery-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.DeliveryHost created by the steps of the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DeliveryHost --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/devops-gitops/DeliveryHost.yaml).",
        "AC2: Given the pipeline of the repository with the acceptance suites of AIFACTORY-US-1317 to AIFACTORY-US-1321, when it runs, then every suite passes: the scope established once through the scope accessor of the pinned abstractions package and the forwarding of the token, the tenant, the correlation id and the trace context are proven by AC3 of AIFACTORY-US-1317, and the stateless replica crash by AC2 of AIFACTORY-US-1319, so this PBI proves neither again (ADR-0015, FR-08).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret, and no event of the model lists DeliveryHost as a consumer or a publisher (ADR-0028, model/services/devops-gitops/DeliveryHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `DeliveryHost/DeliveryHealth` is probed on each replica, then each reports the identity platform and the three fronted services with the same aggregated state, because the state is read from the fronted services and the gateway holds none (ADR-0017, model/services/devops-gitops/DeliveryHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-245",
        "AIFACTORY-TASK-5275",
        "AIFACTORY-TASK-707"
      ],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9401,
      "kind": "enabling",
      "traces": {
        "services": [
          "DeliveryHost",
          "EnvironmentPromotionService",
          "PipelineExecutionService",
          "ReleaseService"
        ],
        "apis": [
          "DeliveryHost/DeliveryHealth"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07",
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1317",
        "AIFACTORY-US-1318",
        "AIFACTORY-US-1319",
        "AIFACTORY-US-1320",
        "AIFACTORY-US-1321",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:environment-promotion-service",
        "feature:pipeline-execution-service-thin",
        "feature:pipeline-execution-service-complete",
        "feature:release-service"
      ],
      "source": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-075]",
      "number": 75
    },
    {
      "id": "AIFACTORY-TASK-245",
      "type": "task",
      "parent": "AIFACTORY-US-075",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.DeliveryHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "08.02.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.DeliveryHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DeliveryHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-246 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DeliveryHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DeliveryHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-246 is written."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-245]",
      "number": 245
    },
    {
      "id": "AIFACTORY-TASK-5275",
      "type": "task",
      "parent": "AIFACTORY-US-075",
      "title": "Deployment values of the gateway that the environment stack reads: replica range, ports, probes and the address of each fronted service",
      "sequence": "08.02.01.02",
      "description": "Deployment values of the gateway that the environment stack reads: replica range, ports, probes and the address of each fronted service. Expected output: The repository holds the deployment values of the gateway, from which the environment stack of ADR-0028 (D105) writes the workload manifest of the service; the values state the replica range of 2 to 6, the https port 8120 and the grpc port 8122, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/devops-gitops/DeliveryHost.yaml records them; it sets Delivery:Host:FrontedServices to the three service identifiers of deployment.fronts, because the default of the model names the short names pipelines, releases and promotions, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "The repository holds the deployment values of the gateway, from which the environment stack of ADR-0028 (D105) writes the workload manifest of the service; the values state the replica range of 2 to 6, the https port 8120 and the grpc port 8122, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/devops-gitops/DeliveryHost.yaml records them; it sets Delivery:Host:FrontedServices to the three service identifiers of deployment.fronts, because the default of the model names the short names pipelines, releases and promotions, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9401,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5275]",
      "number": 5275
    },
    {
      "id": "AIFACTORY-TASK-707",
      "type": "task",
      "parent": "AIFACTORY-US-075",
      "title": "Verify delivery-host-routes-its-platform by running the declared command",
      "sequence": "08.02.01.03",
      "description": "Verify delivery-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-075, that is the repository with its scaffold of the Platform role, the acceptance suites of AIFACTORY-US-1317 to AIFACTORY-US-1321 passing in the same run, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances with the fakes of the fronted services and probes DeliveryHost/DeliveryHealth on each; the replica crash is proven by AIFACTORY-TASK-5282, not here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-075, that is the repository with its scaffold of the Platform role, the acceptance suites of AIFACTORY-US-1317 to AIFACTORY-US-1321 passing in the same run, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances with the fakes of the fronted services and probes DeliveryHost/DeliveryHealth on each; the replica crash is proven by AIFACTORY-TASK-5282, not here."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-707]",
      "number": 707
    },
    {
      "id": "AIFACTORY-US-1317",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-042",
      "title": "Delivery fronts file: named clients and REST and gRPC routes of the three fronted services, generated at build",
      "sequence": "08.02.02",
      "description": "As a platform admin, I want the route table of the delivery gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the DevOps and GitOps platform. It lists the three services of `deployment.fronts` in model/services/devops-gitops/DeliveryHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method with its streaming mode, scope, side-effect class and idempotency. For EnvironmentPromotionService these are the five REST operations `ListPromotions`, `GetPromotion`, `RequestPromotion`, `RollbackPromotion` and `GetCurrentRelease` and the gRPC method `Promotions.Request`. For PipelineExecutionService these are the six REST operations `ListChangeProposals`, `GetChangeProposal`, `OpenChangeProposal`, `ListPipelineRuns`, `GetPipelineRun` and `ReconcilePipelineRun` and the gRPC method `Pipelines.RecordProposal`. For ReleaseService these are the four REST operations `ListProductReleases`, `GetProductRelease`, `CreateProductRelease` and `WithdrawProductRelease` and the gRPC method `Releases.GetRelease`. That is fifteen REST routes and three unary gRPC routes. By side-effect class nine REST routes and `Releases.GetRelease` are read, four REST routes and `Pipelines.RecordProposal` are shared-write, and `RequestPromotion`, `RollbackPromotion` and `Promotions.Request` are production. Each REST entry also states how its operation addresses a project. `ListChangeProposals` and `ListPipelineRuns` filter by project, so their project filter is marked as checked against the roles of the token. The operations that address a promotion, a proposal, a pipeline run, a release or an environment by identifier, and `RequestPromotion`, `OpenChangeProposal` and `CreateProductRelease`, whose body names a release, a change set or a pipeline run, are marked as addressed by a resource identifier. `ListPromotions` and `ListProductReleases` are marked as scoped by the tenant of the token. Each gRPC entry names the service scope of its method, because a workload token carries service scopes (ADR-0015 amendment D114), and its route admits a workload token only when the token holds that scope; any other caller, a user token among them, is answered PERMISSION_DENIED. Each of the three methods takes the service scope of its service (D135): `Promotions.Request` names `factory.delivery.promote`, `Pipelines.RecordProposal` names `factory.delivery.propose` and `Releases.GetRelease` names `factory.delivery.read`, the scopes the three service files give them. A test lists the emitted route table against the file and against the three service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `DeliveryHealth` and `DeliverySystems`, transforms no payload and composes no response from two services. The option `Delivery:Host:FrontedServices` is bound at startup and compared with the service identifiers of the fronts file, and a value that names no service of the file or omits one fails startup with the name; its default in the model names the short names pipelines, releases and promotions instead of the service identifiers, which is reported as a correction like the defaults corrected for other gateways, and until then the deployment sets it (AIFACTORY-TASK-5275). The pipeline publishes the OpenAPI document of the fifteen public REST operations as a build output, checked against the fronts file and the three service files. The typed client of this gateway belongs to this feature (D140): one library in the repository `ConnectSoft.AI.SoftwareFactory.Clients`, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the user-token layout from that published document, by the rules of feature `typed-gateway-clients` (AIFACTORY-US-381 to AIFACTORY-US-383), which it applies and does not repeat. It holds the fifteen public REST operations and no internal gRPC method, is checked against the model by the contract check of that feature, takes the shared types from the pinned contracts package, attaches the token issued for this gateway only to requests to the base address of this gateway, is versioned with the contracts package, published to the ConnectSoft feed and recorded on the Runbook page with the consumers that pin it. No workload layout is generated, because no public REST operation of this gateway admits a workload token. Its callers hold a user token: the `promotions waiting` command of the command-line client (AIFACTORY-US-1313) and StudioBff (AIFACTORY-US-1363, AIFACTORY-US-1364) pin the package in their own repositories, and no caller writes a client of this gateway by hand. Kind: enabling. Traces: services: DeliveryHost, EnvironmentPromotionService, PipelineExecutionService, ReleaseService; adrs: ADR-0015, ADR-0028; requirements: FR-07, FR-08. Depends on: feature:component-api-gateway-template, feature:environment-promotion-service, feature:pipeline-execution-service-complete, feature:release-service, feature:typed-gateway-clients, feature:component-api-library-template-factory-clients. Sources: model/services/devops-gitops/DeliveryHost.yaml, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, model/services/devops-gitops/EnvironmentPromotionService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/services/devops-gitops/ReleaseService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/architecture/api-governance.md, docs/planes/execution/delivery-engine/services/delivery-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the DevOps and GitOps platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, fifteen REST routes and three gRPC routes, each with the scope, side-effect class, idempotency and streaming mode of the operation, each gRPC route admitting only a workload token that holds the service scope its entry names, `factory.delivery.promote` for `Promotions.Request`, `factory.delivery.propose` for `Pipelines.RecordProposal` and `factory.delivery.read` for `Releases.GetRelease` (D135), and the route table test passes against model/services/devops-gitops/DeliveryHost.yaml and the three service files under model/services/devops-gitops (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `Delivery:Host:FrontedServices` set to the three service identifiers, when the gateway starts, then startup succeeds; given a value that names no service of the fronts file or omits one, the default of the model among them, then startup fails with the differing name; given a path no route matches, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route per service is called with a valid user token and one gRPC route per service with a workload token that holds the service scope its fronts entry names, then each call reaches the fake of its service with the authorization header carrying the token of the caller unchanged, the tenant of a user token or the tenant metadata a workload forwards, the correlation id and the trace context, and the response of the fake returns unchanged (ADR-0015, FR-08).",
        "AC4: Given the built gateway, when its pipeline publishes the OpenAPI document of the public REST routes, then the document holds exactly the fifteen REST operations of the fronts file with their methods, paths, scopes and response codes and no internal gRPC method, and a contract check fails the build when it differs from the three service files under model/services/devops-gitops (docs/architecture/api-governance.md).",
        "AC5: Given the published OpenAPI document and the pinned API library template, when the client of this gateway is generated, built and published in the repository ConnectSoft.AI.SoftwareFactory.Clients, then it holds the fifteen public REST operations in the user-token layout and no internal gRPC method, the contract check against the three service files under model/services/devops-gitops passes, the token issued for DeliveryHost is attached only to requests to its base address, and the package is on the ConnectSoft feed with a version tied to the contracts package and recorded on the Runbook page with the command-line client and StudioBff as its consumers (model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-246",
        "AIFACTORY-TASK-5276",
        "AIFACTORY-TASK-5277",
        "AIFACTORY-TASK-6601",
        "AIFACTORY-TASK-5278"
      ],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9402,
      "kind": "enabling",
      "traces": {
        "services": [
          "DeliveryHost",
          "EnvironmentPromotionService",
          "PipelineExecutionService",
          "ReleaseService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07",
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:environment-promotion-service",
        "feature:pipeline-execution-service-complete",
        "feature:release-service",
        "feature:typed-gateway-clients",
        "feature:component-api-library-template-factory-clients"
      ],
      "source": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-1317]",
      "number": 1317
    },
    {
      "id": "AIFACTORY-TASK-246",
      "type": "task",
      "parent": "AIFACTORY-US-1317",
      "title": "Fronts file with the REST and gRPC operations of EnvironmentPromotionService, PipelineExecutionService and ReleaseService",
      "sequence": "08.02.02.01",
      "description": "Fronts file with the REST and gRPC operations of EnvironmentPromotionService, PipelineExecutionService and ReleaseService. Expected output: The fronts file lists the three services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; each REST operation carries one of three markings, a project filter checked against the roles of the token for ListChangeProposals and ListPipelineRuns, addressed by a resource identifier, or scoped by the tenant of the token, and a test fails when an operation carries none or two; each gRPC entry names the service scope a workload token must hold, factory.delivery.promote for Promotions.Request, factory.delivery.propose for Pipelines.RecordProposal and factory.delivery.read for Releases.GetRelease, and a test fails on a gRPC entry without a scope; a user token on a gRPC route is answered PERMISSION_DENIED; the build emits the named clients, the fifteen REST routes, the three gRPC routes and the route table; Delivery:Host:FrontedServices is compared with the fronts file at startup; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the three services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; each REST operation carries one of three markings, a project filter checked against the roles of the token for ListChangeProposals and ListPipelineRuns, addressed by a resource identifier, or scoped by the tenant of the token, and a test fails when an operation carries none or two; each gRPC entry names the service scope a workload token must hold, factory.delivery.promote for Promotions.Request, factory.delivery.propose for Pipelines.RecordProposal and factory.delivery.read for Releases.GetRelease, and a test fails on a gRPC entry without a scope; a user token on a gRPC route is answered PERMISSION_DENIED; the build emits the named clients, the fifteen REST routes, the three gRPC routes and the route table; Delivery:Host:FrontedServices is compared with the fronts file at startup; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-246]",
      "number": 246
    },
    {
      "id": "AIFACTORY-TASK-5276",
      "type": "task",
      "parent": "AIFACTORY-US-1317",
      "title": "Fakes of the three fronted services and the token matrix of the acceptance suite",
      "sequence": "08.02.02.02",
      "description": "Fakes of the three fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers, metadata and body it received, answers a configured status and can stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of each gRPC route, factory.delivery.promote, factory.delivery.propose and factory.delivery.read (D135).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers, metadata and body it received, answers a configured status and can stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of each gRPC route, factory.delivery.promote, factory.delivery.propose and factory.delivery.read (D135)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9402,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5276]",
      "number": 5276
    },
    {
      "id": "AIFACTORY-TASK-5277",
      "type": "task",
      "parent": "AIFACTORY-US-1317",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "08.02.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the fifteen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the three service files under model/services/devops-gitops and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code; the document is the input of the client of AIFACTORY-TASK-6601, and no client package is built in this repository.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the fifteen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the three service files under model/services/devops-gitops and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code; the document is the input of the client of AIFACTORY-TASK-6601, and no client package is built in this repository."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9402,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5277]",
      "number": 5277
    },
    {
      "id": "AIFACTORY-TASK-6601",
      "type": "task",
      "parent": "AIFACTORY-US-1317",
      "title": "Typed client of DeliveryHost in the user-token layout, generated from the published document and published to the ConnectSoft feed",
      "sequence": "08.02.02.04",
      "description": "Typed client of DeliveryHost in the user-token layout, generated from the published document and published to the ConnectSoft feed. Expected output: One client library in the repository ConnectSoft.AI.SoftwareFactory.Clients, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template from the OpenAPI document of AIFACTORY-TASK-5277, holds the fifteen public REST operations of EnvironmentPromotionService, PipelineExecutionService and ReleaseService and no internal gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; the contract check of AIFACTORY-TASK-1556 covers its document; a stub of the gateway in the fixture of the client solution answers 401, 403, 404 and a redirect to a second host, and the token issued for DeliveryHost is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with the command-line client and StudioBff as the consumers that pin it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One client library in the repository ConnectSoft.AI.SoftwareFactory.Clients, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template from the OpenAPI document of AIFACTORY-TASK-5277, holds the fifteen public REST operations of EnvironmentPromotionService, PipelineExecutionService and ReleaseService and no internal gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; the contract check of AIFACTORY-TASK-1556 covers its document; a stub of the gateway in the fixture of the client solution answers 401, 403, 404 and a redirect to a second host, and the token issued for DeliveryHost is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with the command-line client and StudioBff as the consumers that pin it."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6601]",
      "number": 6601
    },
    {
      "id": "AIFACTORY-TASK-5278",
      "type": "task",
      "parent": "AIFACTORY-US-1317",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "08.02.02.05",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1317: one route per operation of the three service files under model/services/devops-gitops, the failing builds, the start with the three service identifiers and the failing startup on a differing value, the 404 of an unknown path, one forwarded call per service and protocol, each gRPC route admitting only a workload token with its service scope, and the contract check of the published OpenAPI document; a check of the deployment values of AIFACTORY-TASK-5275 fails when Delivery:Host:FrontedServices differs from the three service identifiers of deployment.fronts; AC5 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6601.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1317: one route per operation of the three service files under model/services/devops-gitops, the failing builds, the start with the three service identifiers and the failing startup on a differing value, the 404 of an unknown path, one forwarded call per service and protocol, each gRPC route admitting only a workload token with its service scope, and the contract check of the published OpenAPI document; a check of the deployment values of AIFACTORY-TASK-5275 fails when Delivery:Host:FrontedServices differs from the three service identifiers of deployment.fronts; AC5 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6601."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5278]",
      "number": 5278
    },
    {
      "id": "AIFACTORY-US-1318",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-042",
      "title": "A read route of the delivery gateway forwards a call only under a validated token, the tenant and project of the token and the scope of its operation",
      "sequence": "08.02.03",
      "description": "As an observer of the project, I want my reads of proposals, pipeline runs, releases and promotions to reach the services only with the tenant, the projects and the scope my token grants, so that nobody reads across a tenant or a project through the gateway and every read is served by the service that owns the state. A caller reaches a read operation of the DevOps and GitOps platform through the gateway: an Operator, a Reviewer, a Workspace admin, a Platform admin or an Observer reads change proposals, pipeline runs, product releases, promotions and the current release of an environment. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment D114). The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires `factory.delivery.read`, the scope all nine read operations name. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. `ListChangeProposals` and `ListPipelineRuns` filter by project: the gateway checks a project the filter names against the roles of the token, the Platform admin holding every project of its tenant, and answers 403 for a project the token does not grant without calling the fronted service. The other read operations address a promotion, a proposal, a pipeline run, a release or an environment by identifier, or read under the tenant of the token; a gateway without business state cannot know the tenant or the project of such a resource, so it forwards the call under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. A project header a caller sends is dropped and establishes nothing. Every public REST operation names a `factory.` scope a user holds, so a workload token on a REST route is answered 403. The scope is established once with the scope accessor of the pinned abstractions package and forwarded: the authorization header with the user token itself, the tenant, the correlation id and the trace context; the gateway exchanges no token. The internal read method `Releases.GetRelease` admits a workload token only when it holds `factory.delivery.read`, the service scope its fronts entry names (D135, AIFACTORY-US-1317), and forwards the `tenant-id` and the project metadata of the caller unchanged; a workload token without that scope, or a user token, is answered PERMISSION_DENIED. `OpenChangeProposal` is the route of a person, and the propose-change-set tool records its proposal through `Pipelines.RecordProposal` (D135); the summary of `RequestPromotion` still names the deploy-environment tool as a caller, yet a tool calls with a workload token, which reaches EnvironmentPromotionService only through `Promotions.Request`; this is reported as an open point. For every read route the response is served by the fronted service with no side effect and returns unchanged with the correlation id; the gateway keeps nothing of the call. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope 403; in each case no fronted service is called and the refusal is counted for the route and logged with the correlation id and without the token. When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a retry hint that names the service and never its address, and the routes of the other services keep serving. Kind: behavior. Traces: services: DeliveryHost, EnvironmentPromotionService, PipelineExecutionService, ReleaseService; apis: EnvironmentPromotionService/GetPromotion, PipelineExecutionService/GetPipelineRun, PipelineExecutionService/ListChangeProposals, PipelineExecutionService/ListPipelineRuns, ReleaseService/GetProductRelease, ReleaseService/Releases.GetRelease; adrs: ADR-0015, ADR-0028; requirements: FR-07, FR-08; scenarios: SCN-DeliveryHost-004. Relates: screens: promotions, pipeline-runs, proposals, product-releases. Depends on: AIFACTORY-US-1317, feature:component-api-gateway-template, feature:component-extensions-ai, feature:environment-promotion-service, feature:pipeline-execution-service-complete, feature:release-service. Sources: model/services/devops-gitops/DeliveryHost.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/execution/delivery-engine/services/delivery-host/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with `factory.delivery.read`, when the read routes of `EnvironmentPromotionService/GetPromotion`, `PipelineExecutionService/GetPipelineRun` and `ReleaseService/GetProductRelease` are called, then the gateway forwards each call with the user token unchanged in the authorization header, the tenant of the `tid` claim, the correlation id and the trace context, the fronted service answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-DeliveryHost-004, ADR-0015).",
        "AC2: Given a token with a role in one project and none in another, when `PipelineExecutionService/ListChangeProposals` and `PipelineExecutionService/ListPipelineRuns` are called with a project filter, then the call for the granted project is forwarded and the call for the other project is answered 403 without a call to the fronted service; given a Platform admin token, then every project of its tenant is forwarded; given a project header of the caller, then it is dropped (SCN-DeliveryHost-004, ADR-0015).",
        "AC3: Given the token matrix of the acceptance suite, when the nine read routes are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope and a workload token on a REST route are answered 403, and in none of these cases a fronted service is called; given a tenant header that names another tenant, then it is overwritten with the `tid` claim, and the 403 of a fake for a missing role and its 404 for a resource of another tenant return unchanged (SCN-DeliveryHost-004, model/services/devops-gitops/DeliveryHost.yaml).",
        "AC4: Given a workload token that holds `factory.delivery.read`, the service scope the fronts entry of `ReleaseService/Releases.GetRelease` names (D135), when the gRPC route is called with `tenant-id` and project metadata, then it is forwarded with that metadata unchanged and the reply, a NOT_FOUND for a release outside the forwarded tenant included, returns unchanged; given a workload token without that scope or a user token, then the answer is PERMISSION_DENIED and no fronted service is called; given the fake of ReleaseService stops answering, then its routes answer 503, over gRPC UNAVAILABLE, with a retry hint naming the service while the routes of the other services keep serving (SCN-DeliveryHost-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5279",
        "AIFACTORY-TASK-5280"
      ],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9403,
      "kind": "behavior",
      "traces": {
        "services": [
          "DeliveryHost",
          "EnvironmentPromotionService",
          "PipelineExecutionService",
          "ReleaseService"
        ],
        "apis": [
          "EnvironmentPromotionService/GetPromotion",
          "PipelineExecutionService/GetPipelineRun",
          "PipelineExecutionService/ListChangeProposals",
          "PipelineExecutionService/ListPipelineRuns",
          "ReleaseService/GetProductRelease",
          "ReleaseService/Releases.GetRelease"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07",
          "FR-08"
        ],
        "scenarios": [
          "SCN-DeliveryHost-004"
        ]
      },
      "relates": {
        "screens": [
          "promotions",
          "pipeline-runs",
          "proposals",
          "product-releases"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1317",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:environment-promotion-service",
        "feature:pipeline-execution-service-complete",
        "feature:release-service"
      ],
      "source": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-1318]",
      "number": 1318
    },
    {
      "id": "AIFACTORY-TASK-5279",
      "type": "task",
      "parent": "AIFACTORY-US-1318",
      "title": "Issuer, audience, scope, tenant and project configuration of the read routes",
      "sequence": "08.02.03.01",
      "description": "Issuer, audience, scope, tenant and project configuration of the read routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires factory.delivery.read; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route; the project filter of ListChangeProposals and ListPipelineRuns is checked against the roles of the token and a project the token does not grant is answered 403; a route addressed by a resource identifier or scoped by the tenant of the token is forwarded under the tenant of the token; a workload token is refused with 403 on a REST route; the gRPC route of Releases.GetRelease admits a workload token only with factory.delivery.read, the service scope its fronts entry names, answers PERMISSION_DENIED to every other caller, and forwards the tenant-id and project metadata unchanged; the user token is forwarded unchanged and no token is exchanged; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires factory.delivery.read; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route; the project filter of ListChangeProposals and ListPipelineRuns is checked against the roles of the token and a project the token does not grant is answered 403; a route addressed by a resource identifier or scoped by the tenant of the token is forwarded under the tenant of the token; a workload token is refused with 403 on a REST route; the gRPC route of Releases.GetRelease admits a workload token only with factory.delivery.read, the service scope its fronts entry names, answers PERMISSION_DENIED to every other caller, and forwards the tenant-id and project metadata unchanged; the user token is forwarded unchanged and no token is exchanged; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5279]",
      "number": 5279
    },
    {
      "id": "AIFACTORY-TASK-5280",
      "type": "task",
      "parent": "AIFACTORY-US-1318",
      "title": "Verify the read routes through the acceptance suite",
      "sequence": "08.02.03.02",
      "description": "Verify the read routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DeliveryHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1318 over the token matrix: the token received by the fake equal to the user token of the caller, the project filter granted and refused, the overwritten tenant header and the dropped project header, the 403 and 404 of the fakes returned unchanged, a workload token refused on a REST route, the gRPC read route with and without the scope, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DeliveryHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1318 over the token matrix: the token received by the fake equal to the user token of the caller, the project filter granted and refused, the overwritten tenant header and the dropped project header, the 403 and 404 of the fakes returned unchanged, a workload token refused on a REST route, the gRPC read route with and without the scope, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5280]",
      "number": 5280
    },
    {
      "id": "AIFACTORY-US-1319",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-042",
      "title": "A shared-write route of the delivery gateway passes the call and its idempotency key through and the gateway keeps nothing between calls",
      "sequence": "08.02.04",
      "description": "As an operator, I want a change proposal, a release, a withdrawal or a reconciliation I repeat after a failure to be applied once, so that a lost answer or a restarted gateway never opens a second pull request or assembles a second release. A shared-write operation changes state that others read. The DevOps and GitOps platform has four on its public surface and one on its internal gRPC surface. `OpenChangeProposal` of PipelineExecutionService pushes a change set as a branch and opens a pull request, under `factory.delivery.propose`, and is idempotent by key header. `ReconcilePipelineRun` re-reads a pipeline run from the system of record, under `factory.delivery.operate`, and is naturally idempotent. `CreateProductRelease` of ReleaseService assembles a release from a succeeded pipeline run, under `factory.delivery.release`, and is idempotent by key header. `WithdrawProductRelease` withdraws a release with a reason under the same scope and is naturally idempotent. `Pipelines.RecordProposal` records a proposal whose pull request the propose-change-set tool opened through the connection, and its route admits a workload token only when it holds `factory.delivery.propose`, the service scope its fronts entry names (D135, AIFACTORY-US-1317). The caller sends each through the gateway under the token, tenant and scope rules of AIFACTORY-US-1318. Each names a change set, a pipeline run or a release by identifier, so the gateway forwards it under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. The `Idempotency-Key` of `OpenChangeProposal` and `CreateProductRelease` passes through unchanged, and the fronted service applies a repeated request once; a request without the key, or with a reused key and another body, is refused by the fronted service and its answer returns unchanged. The gateway is no party to idempotency. It stores neither a key nor a result, keeps no session and no pending call, has no outbox and writes no event, so a gateway replica that crashes during a call loses nothing: the replica restarts, nothing is replayed, and the caller repeats the call with its idempotency key and receives from the service the result of the one application (failure mode of a gateway replica crash in the model). When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a problem response that names the service and carries a retry hint, the other routes keep serving, and the caller repeats the call. A refusal by the gateway, 401 or 403, reaches no fronted service, so it applies nothing. Every domain refusal, the 409 and 412 of `OpenChangeProposal`, the 409 and 422 of `CreateProductRelease` and the 409 of `WithdrawProductRelease` among them, is an answer of the fronted service and returns unchanged with the correlation id. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: DeliveryHost, PipelineExecutionService, ReleaseService; apis: PipelineExecutionService/OpenChangeProposal, PipelineExecutionService/ReconcilePipelineRun, PipelineExecutionService/Pipelines.RecordProposal, ReleaseService/CreateProductRelease, ReleaseService/WithdrawProductRelease; adrs: ADR-0015, ADR-0028; requirements: FR-07, FR-08; scenarios: SCN-DeliveryHost-005. Relates: screens: proposals, pipeline-runs, product-releases. Depends on: AIFACTORY-US-1317, AIFACTORY-US-1318, feature:component-api-gateway-template, feature:pipeline-execution-service-complete, feature:release-service. Sources: model/services/devops-gitops/DeliveryHost.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/services/devops-gitops/ReleaseService.yaml, docs/planes/execution/delivery-engine/services/delivery-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a valid token with `factory.delivery.release`, when the route of `ReleaseService/CreateProductRelease` is called with an `Idempotency-Key` and repeated with the same key after the first answer was lost, then the gateway forwards both with the key, the body and the established scope unchanged, the fake of ReleaseService answers the second from its record of the first, and both responses return unchanged with the correlation id (SCN-DeliveryHost-005, ADR-0015).",
        "AC2: Given a workload token that holds `factory.delivery.propose`, the service scope the fronts entry of `PipelineExecutionService/Pipelines.RecordProposal` names (D135), when a gateway replica is stopped while a call of `PipelineExecutionService/Pipelines.RecordProposal` is in flight and the caller repeats it through another replica, then the second replica forwards the repeated call unchanged, the gateway replayed nothing, and an inspection of the shared cache finds no key and no result; that PipelineExecutionService records the proposal once is the rule of that service and is proven by its own suite (SCN-DeliveryHost-005, model/services/devops-gitops/DeliveryHost.yaml).",
        "AC3: Given the fakes answer 409 and 412 for `PipelineExecutionService/OpenChangeProposal`, 409 and 422 for `ReleaseService/CreateProductRelease`, 409 for `ReleaseService/WithdrawProductRelease`, 202 for `PipelineExecutionService/ReconcilePipelineRun`, 403 for a missing role and 404 for a resource of another tenant, when the calls pass the gateway, then each answer returns unchanged with its body and the correlation id (SCN-DeliveryHost-005, ADR-0015).",
        "AC4: Given a call without a token, a token that lacks the scope, a user token or a workload token without `factory.delivery.propose` on the gRPC route, and a fronted service that does not answer, when a shared-write route is called, then the answer is 401, 403, PERMISSION_DENIED or 503 respectively, a call the gateway refuses reaches no fronted service and applies nothing, and the 503 names the service and carries a retry hint while the other routes keep serving (SCN-DeliveryHost-005, model/services/devops-gitops/DeliveryHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5281",
        "AIFACTORY-TASK-5282"
      ],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9404,
      "kind": "behavior",
      "traces": {
        "services": [
          "DeliveryHost",
          "PipelineExecutionService",
          "ReleaseService"
        ],
        "apis": [
          "PipelineExecutionService/OpenChangeProposal",
          "PipelineExecutionService/ReconcilePipelineRun",
          "PipelineExecutionService/Pipelines.RecordProposal",
          "ReleaseService/CreateProductRelease",
          "ReleaseService/WithdrawProductRelease"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-07",
          "FR-08"
        ],
        "scenarios": [
          "SCN-DeliveryHost-005"
        ]
      },
      "relates": {
        "screens": [
          "proposals",
          "pipeline-runs",
          "product-releases"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1317",
        "AIFACTORY-US-1318",
        "feature:component-api-gateway-template",
        "feature:pipeline-execution-service-complete",
        "feature:release-service"
      ],
      "source": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1319]",
      "number": 1319
    },
    {
      "id": "AIFACTORY-TASK-5281",
      "type": "task",
      "parent": "AIFACTORY-US-1319",
      "title": "Forwarded body, idempotency key, headers and metadata of a shared-write route and a stateless call path",
      "sequence": "08.02.04.01",
      "description": "Forwarded body, idempotency key, headers and metadata of a shared-write route and a stateless call path. Expected output: A shared-write route forwards the body, the Idempotency-Key header and the established scope unchanged and returns the status and the body of the fronted service unchanged; the route of Pipelines.RecordProposal admits a workload token only with factory.delivery.propose, the service scope its fronts entry names, answers PERMISSION_DENIED otherwise, and forwards the tenant-id and project metadata unchanged; no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "A shared-write route forwards the body, the Idempotency-Key header and the established scope unchanged and returns the status and the body of the fronted service unchanged; the route of Pipelines.RecordProposal admits a workload token only with factory.delivery.propose, the service scope its fronts entry names, answers PERMISSION_DENIED otherwise, and forwards the tenant-id and project metadata unchanged; no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5281]",
      "number": 5281
    },
    {
      "id": "AIFACTORY-TASK-5282",
      "type": "task",
      "parent": "AIFACTORY-US-1319",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "08.02.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DeliveryHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1319 with a release creation repeated under its key, a replica stopped during a RecordProposal call and the repeat through the second replica, the 409, 412, 422, 403 and 404 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, a fake that stops answering and an inspection of the shared cache that finds no key or result.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DeliveryHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1319 with a release creation repeated under its key, a replica stopped during a RecordProposal call and the repeat through the second replica, the 409, 412, 422, 403 and 404 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, a fake that stops answering and an inspection of the shared cache that finds no key or result."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5282]",
      "number": 5282
    },
    {
      "id": "AIFACTORY-US-1320",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-042",
      "title": "A production route of the delivery gateway is forwarded under its scope and the one production approval stays in EnvironmentPromotionService",
      "sequence": "08.02.05",
      "description": "As an operator, I want a promotion request or a rollback to be gated by the service that owns the promotion, with the gateway only checking who I am and what I may call, so that a production approval is asked once, bound to the release and the environment, and never decided by a component that holds no state. Three operations of the DevOps and GitOps platform are of side-effect class production, all of EnvironmentPromotionService: `RequestPromotion`, which promotes a ready release into an environment under `factory.delivery.promote` with an `Idempotency-Key`, `RollbackPromotion`, which rolls a completed promotion back to the previous release under `factory.delivery.operate`, and the internal method `Promotions.Request`, through which the deploy-environment tool requests a promotion with the run and the receipt, whose route admits a workload token only when it holds `factory.delivery.promote`, the service scope its fronts entry names (D135, AIFACTORY-US-1317). ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, requires the scope the operation names and forwards the call with the established scope. `RequestPromotion` names a release and an environment and `RollbackPromotion` a promotion by identifier, so the gateway forwards them under the tenant of the token and the scope of the operation; `Promotions.Request` is forwarded with its call metadata unchanged, the tenant and the project the workload forwards and the requester of the run as `delegatedUserId`, and with its request, which carries the `runId` and the `stepRunId` of the requesting step, so that the Policy gate of EnvironmentPromotionService names the requester of the run as the delegated user and the completion events echo the run correlation (D141); the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. The gate itself is decided where the state is. A person gives one production approval, and it is the gate of EnvironmentPromotionService, bound to the release id and the environment; the workflow steps approve-production of delivery-run and release wait on that approval and the deploy-environment tool presents its id (D133, D135). EnvironmentPromotionService requests that approval from RunControlService with the subject kind promotion and applies the decision it publishes; an Operator holds the approval of a rollback by role, and the rollback promotion skips the approval gate (D135). The gateway evaluates no policy and no approval, holds no approval reference, refuses nothing for a missing approval, writes no evidence and audits nothing itself: AuditService records the evidence of a promotion from the events EnvironmentPromotionService publishes. The `Idempotency-Key` of `RequestPromotion` passes through unchanged. The answer of the fronted service, the 202 of an accepted request or rollback, the 409 of a reused key or of a promotion that is not Completed, the 412 of a release that is not ready and the 422 of an invalid request among them, returns unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. Kind: behavior. Traces: services: DeliveryHost, EnvironmentPromotionService; apis: EnvironmentPromotionService/RequestPromotion, EnvironmentPromotionService/RollbackPromotion, EnvironmentPromotionService/Promotions.Request; adrs: ADR-0015, ADR-0028; requirements: FR-08, FUX-05, XL-04; scenarios: SCN-DeliveryHost-003. Relates: screens: promotions. Depends on: AIFACTORY-US-1317, AIFACTORY-US-1318, feature:component-api-gateway-template, feature:environment-promotion-service. Sources: model/services/devops-gitops/DeliveryHost.yaml, model/services/devops-gitops/EnvironmentPromotionService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a token with `factory.delivery.promote`, when the production route of `EnvironmentPromotionService/RequestPromotion` is called with an `Idempotency-Key` against the fake of EnvironmentPromotionService that answers 202, 409, 412, 422, 403 and 404, then the gateway forwards the call with the key and the body unchanged under the tenant of the token and returns each answer unchanged with the correlation id; the gateway evaluated no policy, held no approval and wrote nothing (SCN-DeliveryHost-003, ADR-0028).",
        "AC2: Given a token with `factory.delivery.operate`, when the route of `EnvironmentPromotionService/RollbackPromotion` is called against the fake that answers 202, 409, 403 and 404, and a workload token that holds `factory.delivery.promote`, the service scope the fronts entry of `EnvironmentPromotionService/Promotions.Request` names (D135), calls its route with the requester of the run as `delegatedUserId` in the call metadata and the `runId` and `stepRunId` of the requesting step in the request against the fake that replies with an acknowledgement and with FAILED_PRECONDITION, then the fake received the metadata and the request unchanged (D141), every answer returns unchanged and no route was refused by the gateway for a missing approval (SCN-DeliveryHost-003, model/services/devops-gitops/DeliveryHost.yaml).",
        "AC3: Given a call without a token or with an expired token, a token that lacks the scope of the operation, or a user token or a workload token without `factory.delivery.promote` on the gRPC route, when a production route is called, then the gateway answers 401, 403 or PERMISSION_DENIED, no fronted service is called and the refusal is counted for the route (SCN-DeliveryHost-003, ADR-0015).",
        "AC4: Given the route table, when the register test lists every route of class production, then it finds exactly the routes of `EnvironmentPromotionService/RequestPromotion`, `EnvironmentPromotionService/RollbackPromotion` and `EnvironmentPromotionService/Promotions.Request`, each with its scope, and fails when the gateway holds a handler, a cache entry or a store for a policy decision, an approval, a receipt or an evidence record (SCN-DeliveryHost-003, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5283",
        "AIFACTORY-TASK-5284",
        "AIFACTORY-TASK-5285"
      ],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9405,
      "kind": "behavior",
      "traces": {
        "services": [
          "DeliveryHost",
          "EnvironmentPromotionService"
        ],
        "apis": [
          "EnvironmentPromotionService/RequestPromotion",
          "EnvironmentPromotionService/RollbackPromotion",
          "EnvironmentPromotionService/Promotions.Request"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FUX-05",
          "XL-04"
        ],
        "scenarios": [
          "SCN-DeliveryHost-003"
        ]
      },
      "relates": {
        "screens": [
          "promotions"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1317",
        "AIFACTORY-US-1318",
        "feature:component-api-gateway-template",
        "feature:environment-promotion-service"
      ],
      "source": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1320]",
      "number": 1320
    },
    {
      "id": "AIFACTORY-TASK-5283",
      "type": "task",
      "parent": "AIFACTORY-US-1320",
      "title": "Production routes forwarded under their scope and the register of production routes",
      "sequence": "08.02.05.01",
      "description": "Production routes forwarded under their scope and the register of production routes. Expected output: The routes of RequestPromotion, RollbackPromotion and Promotions.Request require factory.delivery.promote, factory.delivery.operate and, of a workload token, factory.delivery.promote, the service scope the fronts entry of Promotions.Request names, PERMISSION_DENIED being the answer to any other caller, forward the body, the Idempotency-Key of RequestPromotion, the established scope and, for Promotions.Request, the call metadata with the delegatedUserId and the request with the runId and stepRunId unchanged (D141), and return the answer of the fronted service unchanged; a register test lists every route of class production from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for a policy decision, an approval, a receipt or an evidence record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "The routes of RequestPromotion, RollbackPromotion and Promotions.Request require factory.delivery.promote, factory.delivery.operate and, of a workload token, factory.delivery.promote, the service scope the fronts entry of Promotions.Request names, PERMISSION_DENIED being the answer to any other caller, forward the body, the Idempotency-Key of RequestPromotion, the established scope and, for Promotions.Request, the call metadata with the delegatedUserId and the request with the runId and stepRunId unchanged (D141), and return the answer of the fronted service unchanged; a register test lists every route of class production from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for a policy decision, an approval, a receipt or an evidence record."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5283]",
      "number": 5283
    },
    {
      "id": "AIFACTORY-TASK-5284",
      "type": "task",
      "parent": "AIFACTORY-US-1320",
      "title": "Fakes of the three production operations for the acceptance suite",
      "sequence": "08.02.05.02",
      "description": "Fakes of the three production operations for the acceptance suite. Expected output: The acceptance suite holds a fake of RequestPromotion that answers 202, 409, 412, 422, 403 and 404, a fake of RollbackPromotion that answers 202, 409, 403 and 404 and a fake of Promotions.Request that replies with an acknowledgement and with FAILED_PRECONDITION, each generated from its fronts entry and recording the headers, metadata and body it received.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of RequestPromotion that answers 202, 409, 412, 422, 403 and 404, a fake of RollbackPromotion that answers 202, 409, 403 and 404 and a fake of Promotions.Request that replies with an acknowledgement and with FAILED_PRECONDITION, each generated from its fronts entry and recording the headers, metadata and body it received."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9405,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5284]",
      "number": 5284
    },
    {
      "id": "AIFACTORY-TASK-5285",
      "type": "task",
      "parent": "AIFACTORY-US-1320",
      "title": "Verify the production routes through the acceptance suite",
      "sequence": "08.02.05.03",
      "description": "Verify the production routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DeliveryHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1320: the request forwarded with its key, the answers of the three fakes returned unchanged, the refusals of the gateway without a call to a fronted service and the register of production routes; the one production approval is proven by the suite of EnvironmentPromotionService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DeliveryHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1320: the request forwarded with its key, the answers of the three fakes returned unchanged, the refusals of the gateway without a call to a fronted service and the register of production routes; the one production approval is proven by the suite of EnvironmentPromotionService."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5285]",
      "number": 5285
    },
    {
      "id": "AIFACTORY-US-1321",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-042",
      "title": "Health, systems of record, limits and telemetry of the delivery gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "08.02.06",
      "description": "As an operator, I want to see whether the delivery gateway, the identity platform and each fronted service answer, and which systems of record the platform works with, so that I can tell a failing service from a failing gateway and act on the right one. An operator and the probes of the cluster read the state of the gateway through its two own operations. `DeliveryHost/DeliveryHealth` reports liveness and readiness of the gateway with the aggregated health of the three services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe the health operation answers 200 with the health degraded and a detail that names the identity platform as unreachable (ADR-0015 amendment D117). The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, the health operation answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency that degrades: when it does not answer, health reports it as unavailable in the detail and the answer stays 200, its routes answer 503 with a retry hint, and the routes of the other services keep serving. `DeliveryHost/DeliverySystems` returns to a caller whose scope carries `factory.meta.read` the source-control and CI systems of record configured per tenant through connectors, Azure DevOps and GitHub. The gateway holds no state and the model gives it no dependency that knows the connections of a tenant, so the source of the reply is an open point reported to the owner. Until it is decided the reply is read through one metadata port of the gateway that has no production binding: a deployed instance answers 200 with the systems of record stated as not reported, inventing no value, and adds nothing else, the list of fronted services belonging to the modules endpoint of the template and not to this operation. That stub is provisional and owed to the owner; the reply with the systems filled is proven against a fake metadata source of the acceptance suite. The model lists only 200 for that operation; the 401 for a call without a token and the 403 for a token without the scope are given by the host and are reported as codes the model omits, and when no valid signing key remains the call is refused with the 503 of the failing-closed gateway. ADR-0028 decision 7 gives a platform gateway the rate-limiting library, and the model lists `connectsoft-extensions-rate-limiting` for DeliveryHost: a call that exceeds the rate limit configured for its route is refused with 429, over gRPC RESOURCE_EXHAUSTED, through that pinned library, from the configuration of the deployment, and calls no fronted service. The model states no limit value and no class of limits, so the values are reported as unmodelled and set by the deployment. The gateway emits `connectsoft.factory.delivery.host.requests` with the dimensions service, route and status and `connectsoft.factory.delivery.host.request_duration` with service and route, the latency including the fronted service, each recorded through the helper of the pinned observability library, which puts the tenant, and the project where a call carries one, on the instrument by default (ADR-0019); the gateway carries the trace context to the service. Logs, activities and metrics never contain a token, a change set, a release manifest or any other payload. A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed and callers repeat their call with their idempotency key. Kind: behavior. Traces: services: DeliveryHost, EnvironmentPromotionService, PipelineExecutionService, ReleaseService; apis: DeliveryHost/DeliveryHealth, DeliveryHost/DeliverySystems; adrs: ADR-0015, ADR-0017, ADR-0019, ADR-0028; requirements: NFR-08, NFR-12, FUX-06; scenarios: SCN-DeliveryHost-001, SCN-DeliveryHost-002. Depends on: AIFACTORY-US-1317, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/devops-gitops/DeliveryHost.yaml, docs/architecture/adr/0017-deployment-profiles.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/execution/delivery-engine/services/delivery-host/index.md#metrics-and-observability, docs/planes/execution/delivery-engine/services/delivery-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and the fronted services reachable, when `DeliveryHost/DeliveryHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the three fronted services and of the identity platform; a call for the detail without a token is answered 401 and a token without the scope 403 (SCN-DeliveryHost-001).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `DeliveryHost/DeliveryHealth` is probed, then already issued tokens pass, readiness stays ready and health answers 200 degraded with a detail that names the identity platform; given no valid key remains, then calls are refused, readiness is unready, `DeliveryHost/DeliveryHealth` answers 503 with a problem response that names the identity platform and liveness keeps answering 200; given one fronted service does not answer, then health answers 200 and reports it unavailable, its routes answer 503 with a retry hint and the other routes keep serving (SCN-DeliveryHost-001, model/services/devops-gitops/DeliveryHost.yaml).",
        "AC3: Given a caller with `factory.meta.read`, when `DeliveryHost/DeliverySystems` is called on an instance whose metadata port has no source, then the response is 200 with the systems of record stated as not reported and nothing else, a provisional stub owed to the owner until the source of the systems of record of model/services/devops-gitops/DeliveryHost.yaml is decided; given the fake metadata source bound to the port, then the reply names the Azure DevOps and GitHub systems of the tenant; given no token, a token without the scope or no valid signing key, then the answer is 401, 403 or 503, no fronted service is called and nothing is written (SCN-DeliveryHost-002).",
        "AC4: Given routed calls and a call above the rate limit the deployment configures for its route through the pinned `connectsoft-extensions-rate-limiting` library (ADR-0028), when the metrics and logs are read, then `connectsoft.factory.delivery.host.requests` counts every call by service, route and status, the call above the limit was refused with 429 and called no fronted service, `connectsoft.factory.delivery.host.request_duration` holds the latency by service and route, both carry the tenant of the call from the helper of the pinned observability library, and no log record, activity or metric holds a token or a payload (ADR-0019, model/services/devops-gitops/DeliveryHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#metrics-and-observability",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-247",
        "AIFACTORY-TASK-5286",
        "AIFACTORY-TASK-5287",
        "AIFACTORY-TASK-5288"
      ],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9406,
      "kind": "behavior",
      "traces": {
        "services": [
          "DeliveryHost",
          "EnvironmentPromotionService",
          "PipelineExecutionService",
          "ReleaseService"
        ],
        "apis": [
          "DeliveryHost/DeliveryHealth",
          "DeliveryHost/DeliverySystems"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-08",
          "NFR-12",
          "FUX-06"
        ],
        "scenarios": [
          "SCN-DeliveryHost-001",
          "SCN-DeliveryHost-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1317",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/devops-gitops/DeliveryHost.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#metrics-and-observability",
        "docs/planes/execution/delivery-engine/services/delivery-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1321]",
      "number": 1321
    },
    {
      "id": "AIFACTORY-TASK-247",
      "type": "task",
      "parent": "AIFACTORY-US-1321",
      "title": "Health, systems of record and telemetry of the gateway",
      "sequence": "08.02.06.01",
      "description": "Health, systems of record and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 degraded naming the identity platform; when no valid key remains, readiness turns unready and the operation answers 503 naming the identity platform (D117); the systems operation serves, under factory.meta.read, only the systems of record from one metadata port that has no production binding, stated as not reported in a provisional stub owed to the owner until its source is decided; every routed call records connectsoft.factory.delivery.host.requests and request_duration with their modelled dimensions and the tenant of the call, and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 degraded naming the identity platform; when no valid key remains, readiness turns unready and the operation answers 503 naming the identity platform (D117); the systems operation serves, under factory.meta.read, only the systems of record from one metadata port that has no production binding, stated as not reported in a provisional stub owed to the owner until its source is decided; every routed call records connectsoft.factory.delivery.host.requests and request_duration with their modelled dimensions and the tenant of the call, and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-247]",
      "number": 247
    },
    {
      "id": "AIFACTORY-TASK-5286",
      "type": "task",
      "parent": "AIFACTORY-US-1321",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "08.02.06.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the deployment through the pinned connectsoft-extensions-rate-limiting library that ADR-0028 decision 7 gives a platform gateway, and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.delivery.host.requests; no limit value is fixed in code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the deployment through the pinned connectsoft-extensions-rate-limiting library that ADR-0028 decision 7 gives a platform gateway, and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.delivery.host.requests; no limit value is fixed in code."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5286]",
      "number": 5286
    },
    {
      "id": "AIFACTORY-TASK-5287",
      "type": "task",
      "parent": "AIFACTORY-US-1321",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "08.02.06.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/devops-gitops/DeliveryHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains; the entry of the replica crash states that nothing is replayed and that callers repeat their call with their idempotency key.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/devops-gitops/DeliveryHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains; the entry of the replica crash states that nothing is replayed and that callers repeat their call with their idempotency key."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9406,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-5287]",
      "number": 5287
    },
    {
      "id": "AIFACTORY-TASK-5288",
      "type": "task",
      "parent": "AIFACTORY-US-1321",
      "title": "Verify health, systems of record, limits and telemetry through the acceptance suite",
      "sequence": "08.02.06.04",
      "description": "Verify health, systems of record, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DeliveryHost-001|Scenario=SCN-DeliveryHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1321 with the identity platform stopped while a cached key validates tokens, without a cached key and after the cached key expired, one fake stopped, the systems operation without a metadata source, with the fake source and without its scope, a call above its limit, the two series with service, route, status and tenant, and a scan of the captured logs and activities for token and payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DeliveryHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DeliveryHost-001|Scenario=SCN-DeliveryHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1321 with the identity platform stopped while a cached key validates tokens, without a cached key and after the cached key expired, one fake stopped, the systems operation without a metadata source, with the fake source and without its scope, a call above its limit, the two series with service, route, status and tenant, and a scan of the captured logs and activities for token and payload content."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/DeliveryHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DeliveryHost"
      ],
      "children": [],
      "buildOrder": 94,
      "phase": "factory",
      "stackRank": 9406,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5288]",
      "number": 5288
    },
    {
      "id": "AIFACTORY-FEAT-043",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-008",
      "title": "EnvironmentPromotionService: complete delivery",
      "sequence": "08.03",
      "description": "EnvironmentPromotionService is the service of bounded context BC-24 (Package & Release Delivery). Promotion of a ready release into an environment class (development, test, staging, production) through gates — pipeline results, deployment-domain policy, an approval of class production for production, the environment's state — with the desired-state hand-off to provisioning (BC-25), progressive strategies, verification and rollback evidence (BC-24). Its own repository is ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Delivers: EnvironmentPromotionService (complete). Increment I2: Deliver it. Build order 95 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-024",
        "AIFACTORY-US-1311",
        "AIFACTORY-US-1312",
        "AIFACTORY-US-1313",
        "AIFACTORY-US-1314",
        "AIFACTORY-US-1315",
        "AIFACTORY-US-1316",
        "AIFACTORY-US-1621"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9500,
      "titlePrefix": "[AIFACTORY-FEAT-043]",
      "number": 43
    },
    {
      "id": "AIFACTORY-US-024",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "EnvironmentPromotionService promotes a ready release through its gates, one bound production approval, provisioning and verification",
      "sequence": "08.03.01",
      "description": "As a reviewer, I want a promotion to production to wait for my one decision on the exact release and environment, and every promotion to pass its gates before anything is deployed, so that nothing reaches production that I did not approve, the requester never approves their own request, and every environment knows which release it runs. This is the integration PBI of EnvironmentPromotionService, the service of bounded context BC-24 (Package and Release Delivery) that puts a ready release into an environment class of the project, development, test, staging or production, through gates: the pipeline results of the release, the deployment-domain policy, asked with the action kind `promotion` and the class of the target environment (D140), the prior environment of the promotion path, the state of the environment, evaluation evidence where the release carries agent-generated assets and, for production, one approval of class production. It hands the desired state to IaCProvisioningService, which deploys it (the service never touches infrastructure), verifies the result and records rollback evidence. The repository ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService is created by the first task of this feature by the steps of the repository checklist of feature `repository-and-pipeline-conventions`: it is scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`, consumed by pin), so token validation, the role policies, the scope chain with its 401, 403 and 404 answers, the tenant row filter, the Orleans messaging profile with the service name `environment-promotion`, the scheduler, health, readiness and the telemetry wiring come from the profile and are not written again. Every integration event is written as the run event envelope of the pinned contracts package to the outbox in the transaction of its transition. The public REST operations are reached through DeliveryHost, which forwards the user token unchanged; the service accepts the audience of its own gateway and exchanges no token (ADR-0015 amendment D117). A promotion or an environment of another tenant is answered 404, over gRPC NOT_FOUND, the same answer as for an unknown identifier, and a missing scope or project role 403 (ADR-0015 amendment D113). The feature is delivered by seven further PBIs: requesting a promotion (AIFACTORY-US-1311), the gates and the desired-state hand-off (AIFACTORY-US-1312), the one production approval (AIFACTORY-US-1313), deployment, verification and the automatic rollback (AIFACTORY-US-1314), the rollback by an Operator (AIFACTORY-US-1315), the reads (AIFACTORY-US-1316) and, in the repository of RunControlService, the settlement of the step of a run that waits for a promotion from `PromotionCompleted` and `PromotionFailed` (AIFACTORY-US-1621, D140). A rollback opens a new promotion of the previous release whose `rollbackOfPromotionId` names the promotion it rolls back; the new promotion skips the approval gate, passes the other gates and hands off through `PromotionApproved` like any promotion, and the rolled-back promotion ends RolledBack with `RollbackCompleted` when the new one completes (D135). The inbox registers the eight consumed events of the model, `ReleaseReady`, `ReleaseWithdrawn`, `ApprovalDecided`, `EnvironmentStateChanged`, `ProvisioningApplied`, `ProvisioningFailed`, `ProvisioningPlanned` and `ObservedStateChanged`, each idempotent on the event id. SloService, an optional dependency that degrades, is delivered in I4, so in this increment the SLO window of a verification is recorded as not evaluated. Telemetry carries tenant and project on metrics and no release content, desired state or verification payload reaches a log record (ADR-0019). Kind: behavior. Traces: services: EnvironmentPromotionService, DeliveryHost, ReleaseService, PolicyEngineService, RunControlService, IaCProvisioningService, EnvironmentService, RuntimeEnvironmentService; aggregates: EnvironmentPromotionService/Promotion; apis: EnvironmentPromotionService/ListPromotions, EnvironmentPromotionService/GetPromotion, EnvironmentPromotionService/RequestPromotion, EnvironmentPromotionService/RollbackPromotion, EnvironmentPromotionService/GetCurrentRelease, EnvironmentPromotionService/Promotions.Request; events: EnvironmentPromotionService/PromotionRequested, EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/PromotionCompleted, EnvironmentPromotionService/PromotionFailed, EnvironmentPromotionService/RollbackCompleted; workflows: delivery-run; steps: delivery-run/request-promotion, delivery-run/approve-production; agents: deployment-orchestrator; descriptors: run-event-envelope-v1; adrs: ADR-0004, ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: FR-08, FUX-02, FUX-05, NFR-08, NFR-09, XL-04, XL-10. Relates: screens: promotions, environment-board. Depends on: AIFACTORY-US-1311, AIFACTORY-US-1312, AIFACTORY-US-1313, AIFACTORY-US-1314, AIFACTORY-US-1315, AIFACTORY-US-1316, AIFACTORY-US-1621, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-extensions-ai, feature:component-observability-factory-conventions, feature:contracts-package. Sources: model/services/devops-gitops/EnvironmentPromotionService.yaml, docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#purpose-and-responsibilities, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService created by the steps of the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService --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 with complete reports and a container image is published (ADR-0028, model/services/devops-gitops/EnvironmentPromotionService.yaml).",
        "AC2: Given the service descriptor of the repository, when the contract test compares it with the hosted surface, then `EnvironmentPromotionService/ListPromotions`, `EnvironmentPromotionService/GetPromotion`, `EnvironmentPromotionService/RequestPromotion`, `EnvironmentPromotionService/RollbackPromotion`, `EnvironmentPromotionService/GetCurrentRelease` and `EnvironmentPromotionService/Promotions.Request` are hosted with the scope, side-effect class, idempotency and response codes of model/services/devops-gitops/EnvironmentPromotionService.yaml, and the test fails on an operation the file does not name.",
        "AC3: Given the `EnvironmentPromotionService/Promotion` aggregate, when its unit tests run, then each of the twelve transitions of `PromotionState` is accepted from its source state only, every other pair of states is refused, and the invariants hold: a production promotion is approved only through the approval bound to its release id and environment, a release enters production only after it completed in the prior class of `Delivery:Promotions:PromotionPath`, unless policy allows a hotfix path with evidence, and the service never calls infrastructure (ADR-0015, model/services/devops-gitops/EnvironmentPromotionService.yaml).",
        "AC4: Given the outbox and the inbox after the acceptance suite, when their records are read, then `EnvironmentPromotionService/PromotionRequested`, `EnvironmentPromotionService/PromotionApproved`, `EnvironmentPromotionService/PromotionCompleted`, `EnvironmentPromotionService/PromotionFailed` and `EnvironmentPromotionService/RollbackCompleted` are the only event types the outbox holds, each written in the transaction of its transition under the run event envelope, and the inbox registers the eight consumed events of the model with idempotency on the event id (ADR-0014).",
        "AC5: Given the service starts, when liveness and readiness are probed and the acceptance suite has run, then readiness is unready until `environment-promotion-sql` is migrated and while the outbox check of the messaging profile is unhealthy, the four metrics of the model are emitted with their modelled dimensions, and a scan of the captured log records, activities and metrics finds no token, desired state or verification payload (ADR-0019, model/services/devops-gitops/EnvironmentPromotionService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-248",
        "AIFACTORY-TASK-249",
        "AIFACTORY-TASK-250",
        "AIFACTORY-TASK-251",
        "AIFACTORY-TASK-252",
        "AIFACTORY-TASK-253",
        "AIFACTORY-TASK-254",
        "AIFACTORY-TASK-5261",
        "AIFACTORY-TASK-708"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentPromotionService",
          "DeliveryHost",
          "ReleaseService",
          "PolicyEngineService",
          "RunControlService",
          "IaCProvisioningService",
          "EnvironmentService",
          "RuntimeEnvironmentService"
        ],
        "aggregates": [
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "EnvironmentPromotionService/ListPromotions",
          "EnvironmentPromotionService/GetPromotion",
          "EnvironmentPromotionService/RequestPromotion",
          "EnvironmentPromotionService/RollbackPromotion",
          "EnvironmentPromotionService/GetCurrentRelease",
          "EnvironmentPromotionService/Promotions.Request"
        ],
        "events": [
          "EnvironmentPromotionService/PromotionRequested",
          "EnvironmentPromotionService/PromotionApproved",
          "EnvironmentPromotionService/PromotionCompleted",
          "EnvironmentPromotionService/PromotionFailed",
          "EnvironmentPromotionService/RollbackCompleted"
        ],
        "workflows": [
          "delivery-run"
        ],
        "steps": [
          "delivery-run/request-promotion",
          "delivery-run/approve-production"
        ],
        "agents": [
          "deployment-orchestrator"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FUX-02",
          "FUX-05",
          "NFR-08",
          "NFR-09",
          "XL-04",
          "XL-10"
        ]
      },
      "relates": {
        "screens": [
          "promotions",
          "environment-board"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1311",
        "AIFACTORY-US-1312",
        "AIFACTORY-US-1313",
        "AIFACTORY-US-1314",
        "AIFACTORY-US-1315",
        "AIFACTORY-US-1316",
        "AIFACTORY-US-1621",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-extensions-ai",
        "feature:component-observability-factory-conventions",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-024]",
      "number": 24
    },
    {
      "id": "AIFACTORY-TASK-248",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "08.03.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `environment-promotion`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the work of this feature is added.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `environment-promotion`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the work of this feature is added."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-248]",
      "number": 248
    },
    {
      "id": "AIFACTORY-TASK-249",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Domain model: Promotion with the twelve transitions of PromotionState and its invariants",
      "sequence": "08.03.01.02",
      "description": "Domain model: Promotion with the twelve transitions of PromotionState and its invariants. Expected output: The Promotion aggregate holds the fields of the model, the gates per gate kind with outcome and evidence reference, and the twelve transitions Start, GatesPassedApprovalRequired, GatesPassedNoApproval, GateFailed, ApprovalGranted, ApprovalRejectedOrExpired, DesiredStateHandedOff, ProvisioningApplied, VerificationPassed, VerificationFailedAutoRollback, ProvisioningFailed and ManualRollback; unit tests cover every transition, every refused pair of states and every invariant of model/services/devops-gitops/EnvironmentPromotionService.yaml.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Promotion aggregate holds the fields of the model, the gates per gate kind with outcome and evidence reference, and the twelve transitions Start, GatesPassedApprovalRequired, GatesPassedNoApproval, GateFailed, ApprovalGranted, ApprovalRejectedOrExpired, DesiredStateHandedOff, ProvisioningApplied, VerificationPassed, VerificationFailedAutoRollback, ProvisioningFailed and ManualRollback; unit tests cover every transition, every refused pair of states and every invariant of model/services/devops-gitops/EnvironmentPromotionService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-249]",
      "number": 249
    },
    {
      "id": "AIFACTORY-TASK-250",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Persistence in environment-promotion-sql: Promotions and PromotionGates with the tenant filter and the modelled indexes",
      "sequence": "08.03.01.03",
      "description": "Persistence in environment-promotion-sql: Promotions and PromotionGates with the tenant filter and the modelled indexes. Expected output: Mappings and migrations for the tables Promotions and PromotionGates with the tenant column and row filter, the key of promotion and gate kind, the indexes IX_Promotions_Env_State and IX_Promotions_Release and a row version as optimistic concurrency token on a promotion; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the tables Promotions and PromotionGates with the tenant column and row filter, the key of promotion and gate kind, the indexes IX_Promotions_Env_State and IX_Promotions_Release and a row version as optimistic concurrency token on a promotion; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-250]",
      "number": 250
    },
    {
      "id": "AIFACTORY-TASK-251",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 5 REST and 1 gRPC operations",
      "sequence": "08.03.01.04",
      "description": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 5 REST and 1 gRPC operations. Expected output: The service descriptor lists ListPromotions, GetPromotion, RequestPromotion, RollbackPromotion, GetCurrentRelease and Promotions.Request with scope, side-effect class, idempotency and response codes; the routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code, the Idempotency-Key filter of RequestPromotion and the check of the service scope of a workload token on the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-1311, AIFACTORY-US-1315 and AIFACTORY-US-1316, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor lists ListPromotions, GetPromotion, RequestPromotion, RollbackPromotion, GetCurrentRelease and Promotions.Request with scope, side-effect class, idempotency and response codes; the routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code, the Idempotency-Key filter of RequestPromotion and the check of the service scope of a workload token on the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-1311, AIFACTORY-US-1315 and AIFACTORY-US-1316, not here."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-251]",
      "number": 251
    },
    {
      "id": "AIFACTORY-TASK-252",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Messaging skeleton: outbox and inbox wiring of the environment-promotion profile for 5 published and 8 consumed events",
      "sequence": "08.03.01.05",
      "description": "Messaging skeleton: outbox and inbox wiring of the environment-promotion profile for 5 published and 8 consumed events. Expected output: The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the environment-promotion messaging profile publishes PromotionRequested, PromotionApproved, PromotionCompleted, PromotionFailed and RollbackCompleted under the run event envelope of the pinned contracts package; the inbox registers ReleaseReady, ReleaseWithdrawn, ApprovalDecided, EnvironmentStateChanged, ProvisioningApplied, ProvisioningFailed, ProvisioningPlanned and ObservedStateChanged with idempotency on the event id; what each handler does is delivered by AIFACTORY-US-1311 to AIFACTORY-US-1314.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the environment-promotion messaging profile publishes PromotionRequested, PromotionApproved, PromotionCompleted, PromotionFailed and RollbackCompleted under the run event envelope of the pinned contracts package; the inbox registers ReleaseReady, ReleaseWithdrawn, ApprovalDecided, EnvironmentStateChanged, ProvisioningApplied, ProvisioningFailed, ProvisioningPlanned and ObservedStateChanged with idempotency on the event id; what each handler does is delivered by AIFACTORY-US-1311 to AIFACTORY-US-1314."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-252]",
      "number": 252
    },
    {
      "id": "AIFACTORY-TASK-253",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Worker hosting skeleton: triggers, partitioning and retry policies of GateEvaluator and Verifier",
      "sequence": "08.03.01.06",
      "description": "Worker hosting skeleton: triggers, partitioning and retry policies of GateEvaluator and Verifier. Expected output: GateEvaluator is hosted on PromotionRequested with fixed retry of 3 attempts and 30 seconds, idempotency key promotionId plus gateKind and partitioning by EnvironmentId with at most 4 in parallel; Verifier is hosted on ProvisioningApplied with fixed retry of 3 attempts and 60 seconds, idempotency key promotionId and the same partitioning; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1312 and AIFACTORY-US-1314.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "GateEvaluator is hosted on PromotionRequested with fixed retry of 3 attempts and 30 seconds, idempotency key promotionId plus gateKind and partitioning by EnvironmentId with at most 4 in parallel; Verifier is hosted on ProvisioningApplied with fixed retry of 3 attempts and 60 seconds, idempotency key promotionId and the same partitioning; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1312 and AIFACTORY-US-1314."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-253]",
      "number": 253
    },
    {
      "id": "AIFACTORY-TASK-254",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Security, tenancy and telemetry of EnvironmentPromotionService",
      "sequence": "08.03.01.07",
      "description": "Security, tenancy and telemetry of EnvironmentPromotionService. Expected output: The scopes factory.delivery.read, factory.delivery.promote and factory.delivery.operate and the roles Operator, Reviewer, Workspace admin, Platform admin and Observer are enforced per route; a user token forwarded by DeliveryHost is accepted with the audience of that gateway; every query is tenant-filtered so a resource of another tenant is answered 404; the messaging-transport secret comes from a secret reference of the key vault; connectsoft.factory.delivery.promotions, promotion_lead_time, rollbacks and inbox_lag are created through the instrument helper of the observability library with their modelled dimensions; a redaction test fails when a log record, an activity or a metric holds a token, a desired state or a verification payload.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The scopes factory.delivery.read, factory.delivery.promote and factory.delivery.operate and the roles Operator, Reviewer, Workspace admin, Platform admin and Observer are enforced per route; a user token forwarded by DeliveryHost is accepted with the audience of that gateway; every query is tenant-filtered so a resource of another tenant is answered 404; the messaging-transport secret comes from a secret reference of the key vault; connectsoft.factory.delivery.promotions, promotion_lead_time, rollbacks and inbox_lag are created through the instrument helper of the observability library with their modelled dimensions; a redaction test fails when a log record, an activity or a metric holds a token, a desired state or a verification payload."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-254]",
      "number": 254
    },
    {
      "id": "AIFACTORY-TASK-5261",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Runbook of the three failure modes of EnvironmentPromotionService",
      "sequence": "08.03.01.08",
      "description": "Runbook of the three failure modes of EnvironmentPromotionService. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/devops-gitops/EnvironmentPromotionService.yaml (approval expires, verification fails, service store lost) with its detection signal, the state the promotion takes and the recovery step: a new request binds a new approval, the automatic rollback with its evidence, and the restore from backup after which receipts are re-pulled from the system of record.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/devops-gitops/EnvironmentPromotionService.yaml (approval expires, verification fails, service store lost) with its detection signal, the state the promotion takes and the recovery step: a new request binds a new approval, the automatic rollback with its evidence, and the restore from backup after which receipts are re-pulled from the system of record."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-5261]",
      "number": 5261
    },
    {
      "id": "AIFACTORY-TASK-708",
      "type": "task",
      "parent": "AIFACTORY-US-024",
      "title": "Verify promotion-under-approval by running the declared command",
      "sequence": "08.03.01.09",
      "description": "Verify promotion-under-approval by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-024, that is the scaffold, the hosted surface against the service descriptor, the twelve transitions and the invariants of the Promotion aggregate, the event types of the outbox and the inbox, readiness and the redaction scan.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-024, that is the scaffold, the hosted surface against the service descriptor, the twelve transitions and the invariants of the Promotion aggregate, the event types of the outbox and the inbox, readiness and the redaction scan."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-708]",
      "number": 708
    },
    {
      "id": "AIFACTORY-US-1311",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "Request the promotion of a ready release into an environment through the REST route or the internal gRPC method",
      "sequence": "08.03.02",
      "description": "As an operator, I want to request the promotion of a ready release into an environment of my project, or have the deploy-environment tool request it for a run, so that a promotion exists once per request, only for a release that is ready and an environment on the promotion path, and its gates start without anyone driving them. An Operator or a Workspace admin whose scope carries `factory.delivery.promote` requests a promotion through the DeliveryHost route of `EnvironmentPromotionService/RequestPromotion` with an `Idempotency-Key`, naming the release, the target environment and the strategy, one of Recreate, RollingUpdate, BlueGreen or Canary. `RequestPromotion` requires a strategy and answers 422 without one; `Strategy` has no default (D135). The deploy-environment tool requests the same through the internal method `EnvironmentPromotionService/Promotions.Request`, and the reply is `ack-v1`. A workload token carries service scopes and no tenant claim, so the method admits a workload token only when it holds the service scope of the method, `factory.delivery.promote` (D135), and the service reads the tenant and the project that the workload forwards in its metadata only under that scope (ADR-0015 amendment D114). Beside the tenant and the project the call metadata carries the requester of the run as `delegatedUserId`, and the request carries the `runId` and the `stepRunId` of the requesting step; the service keeps the delegated user as `requestedBy` and the run and the step run on the promotion, so that the Policy gate names the requester of the run as the delegated user of the workload subject (AIFACTORY-US-1312) and `PromotionCompleted` and `PromotionFailed` echo the run correlation (D141). The service knows a release only from its inbox: `EnablePromotion` records each `ReleaseService/ReleaseReady` with its tenant and project, and `BlockPromotion` marks the release withdrawn on `ReleaseService/ReleaseWithdrawn`. It knows an environment only from the last state and class that `GateEnvironment` kept from `EnvironmentService/EnvironmentStateChanged`. A request is checked against these records and calls no other service. A release that the service has not recorded in the tenant of the caller, whether unknown, of another tenant or never announced ready, is answered 404, and so is an environment that has announced no state in that tenant; the answer is the same for all of them, so a refusal never confirms a resource of another tenant (ADR-0015 amendment D113). The model lists no 404 for `RequestPromotion`, which is reported as a code the model omits. A withdrawn release is refused with 412. An environment whose class is not on `Delivery:Promotions:PromotionPath`, a Sandbox environment among them, is refused with 422. `EnvironmentStateChanged` carries no project, so the service cannot check that the environment belongs to the project of the release; that check is reported as an open point and is not asserted. The promotion takes the project of the release, and the caller must hold a role in that project. On success the service writes the `Promotion` in state Requested with `requestedBy`, the optional `runId` and `stepRunId` (D141), the strategy and the class of the environment, together with the `PromotionRequested` outbox record in one transaction, increments `connectsoft.factory.delivery.promotions` and answers 202 with the location of the promotion; the gates start from that event (AIFACTORY-US-1312). A repeat under the same key and the same body returns the same promotion and changes nothing; the same key with another body is refused with 409, and a request without an `Idempotency-Key` with 422. A body without a release or an environment, or with an unknown strategy, is refused with 422, and a caller without the scope or without a role in the project of the release with 403. Over gRPC a caller without a workload identity is refused with UNAUTHENTICATED, a workload token without the service scope of the method with PERMISSION_DENIED, an invalid request with INVALID_ARGUMENT, a release or an environment not recorded in the forwarded tenant with NOT_FOUND and a withdrawn release with FAILED_PRECONDITION. The gRPC repeat is keyed as the workflow step delivery-run/request-promotion keys it, on the run, the release and the target environment: a repeat returns the same acknowledgement and creates no second promotion. No refusal writes a promotion or publishes anything. `PromotionRequested` carries `promotionId`, `tenantId`, `projectId`, `releaseId`, `environmentId`, `environmentClass` and the optional `runId`; StudioBff, AuditService and DashboardService handle it in their own PBIs. The request of `Promotions.Request` is `release-manifest-v1` with the `runId` and the `stepRunId` of the requesting step beside it (D141); the manifest names neither the target environment, the strategy nor the receipt, so the members that carry them are reported as an open point. A release of the tenant of the caller that is still a candidate is answered 404 like an unknown one, because the service learns of a release only from `ReleaseReady`; this is reported as well. Kind: behavior. Traces: services: EnvironmentPromotionService, ReleaseService, EnvironmentService; aggregates: EnvironmentPromotionService/Promotion; apis: EnvironmentPromotionService/RequestPromotion, EnvironmentPromotionService/Promotions.Request; events: EnvironmentPromotionService/PromotionRequested, ReleaseService/ReleaseReady, ReleaseService/ReleaseWithdrawn, EnvironmentService/EnvironmentStateChanged; steps: delivery-run/request-promotion; descriptors: release-manifest-v1, ack-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-08, FUX-05; scenarios: SCN-EnvironmentPromotionService-003, SCN-EnvironmentPromotionService-006, SCN-EnvironmentPromotionService-007. Relates: screens: promotions. Depends on: feature:release-service, feature:environment-service, feature:contracts-package. Sources: model/services/devops-gitops/EnvironmentPromotionService.yaml, model/services/devops-gitops/ReleaseService.yaml, model/workflows/delivery-run.yaml, docs/reference/schemas/release-manifest.schema.json, docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a release recorded ready by `ReleaseService/ReleaseReady`, an environment of the tenant whose class is on `Delivery:Promotions:PromotionPath` as `EnvironmentService/EnvironmentStateChanged` announced it, and a caller with `factory.delivery.promote` and a role in the project of the release, when `EnvironmentPromotionService/RequestPromotion` is called with an `Idempotency-Key` and a strategy, then the response is 202 with the location of the promotion, the `EnvironmentPromotionService/Promotion` is in state Requested with the project of the release, `requestedBy`, the strategy and the environment class, the `EnvironmentPromotionService/PromotionRequested` outbox record is written in the same transaction, and a repeat under the same key and body returns the same promotion and writes nothing (SCN-EnvironmentPromotionService-003).",
        "AC2: Given the same key with another body, a request without an `Idempotency-Key`, a body without a release, an environment or a strategy or with an unknown strategy, an environment whose class is not on the promotion path, a release that `ReleaseService/ReleaseWithdrawn` marked withdrawn, a release or an environment not recorded in the tenant of the caller whether unknown, of another tenant or never announced, or a caller without the scope or without a role in the project, when `EnvironmentPromotionService/RequestPromotion` is called, then the response is 409, 422, 422, 422, 412, 404 for every release and environment case alike, or 403 respectively, with a problem response, no promotion written and nothing published (SCN-EnvironmentPromotionService-003, ADR-0015).",
        "AC3: Given a workload token that holds the service scope `factory.delivery.promote` of the method and forwards a tenant, a project and the requester of the run as `delegatedUserId`, and a request for a ready release, an environment on the promotion path and its run with the `runId` and the `stepRunId` of the requesting step, when `EnvironmentPromotionService/Promotions.Request` is called, then the reply is `ack-v1`, the promotion is written in state Requested with its `runId`, its `stepRunId` and the delegated user as `requestedBy` (D141) and `PromotionRequested`, and a repeat for the same run, release and target environment returns the same acknowledgement and creates no second promotion; a caller without a workload identity, a workload token without the service scope, an invalid request, a release or an environment not recorded in the forwarded tenant, or a withdrawn release is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND or FAILED_PRECONDITION and nothing is written (SCN-EnvironmentPromotionService-006, ADR-0015).",
        "AC4: Given the promotion was requested, when the outbox dispatcher of the `environment-promotion` profile publishes `EnvironmentPromotionService/PromotionRequested` on `releases.promotions.v1.promotion-requested`, then the event is sent under the run event envelope with `promotionId`, `tenantId`, `projectId`, `releaseId`, `environmentId`, `environmentClass` and the `runId` when the request carried one, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-EnvironmentPromotionService-007, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/workflows/delivery-run.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5262",
        "AIFACTORY-TASK-5263",
        "AIFACTORY-TASK-5264"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9502,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentPromotionService",
          "ReleaseService",
          "EnvironmentService"
        ],
        "aggregates": [
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "EnvironmentPromotionService/RequestPromotion",
          "EnvironmentPromotionService/Promotions.Request"
        ],
        "events": [
          "EnvironmentPromotionService/PromotionRequested",
          "ReleaseService/ReleaseReady",
          "ReleaseService/ReleaseWithdrawn",
          "EnvironmentService/EnvironmentStateChanged"
        ],
        "steps": [
          "delivery-run/request-promotion"
        ],
        "descriptors": [
          "release-manifest-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08",
          "FUX-05"
        ],
        "scenarios": [
          "SCN-EnvironmentPromotionService-003",
          "SCN-EnvironmentPromotionService-006",
          "SCN-EnvironmentPromotionService-007"
        ]
      },
      "relates": {
        "screens": [
          "promotions"
        ]
      },
      "dependsOn": [
        "feature:release-service",
        "feature:environment-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/workflows/delivery-run.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1311]",
      "number": 1311
    },
    {
      "id": "AIFACTORY-TASK-5262",
      "type": "task",
      "parent": "AIFACTORY-US-1311",
      "title": "RequestPromotion and Promotions.Request with idempotency, the release and environment records and the refusals",
      "sequence": "08.03.02.01",
      "description": "RequestPromotion and Promotions.Request with idempotency, the release and environment records and the refusals. Expected output: RequestPromotion and Promotions.Request write the Promotion in state Requested with the project of the release, requestedBy, the optional runId and stepRunId, the strategy and the environment class, together with the PromotionRequested outbox record in one transaction, and answer 202 with the location or ack-v1; the inbox handlers EnablePromotion and BlockPromotion keep the ready and withdrawn releases by tenant and project, idempotently on the event id, and GateEnvironment keeps the last state and class of each environment by tenant; RequestPromotion answers 409 for a reused key with another body, 422 for a missing Idempotency-Key, release, environment or strategy, an unknown strategy or a class off the promotion path, 412 for a withdrawn release, 404 alike for a release or an environment not recorded in the tenant of the caller, and 403 for a missing scope or role; Promotions.Request admits a workload token only with the service scope factory.delivery.promote, reads the forwarded tenant and project and the delegatedUserId of the call metadata only under it, keeps the delegated user as requestedBy and the runId and stepRunId of the request on the promotion (D141), and answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND or FAILED_PRECONDITION; no refusal writes anything; a repeat under the same Idempotency-Key, or for the same run, release and target environment, returns the first result.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "RequestPromotion and Promotions.Request write the Promotion in state Requested with the project of the release, requestedBy, the optional runId and stepRunId, the strategy and the environment class, together with the PromotionRequested outbox record in one transaction, and answer 202 with the location or ack-v1; the inbox handlers EnablePromotion and BlockPromotion keep the ready and withdrawn releases by tenant and project, idempotently on the event id, and GateEnvironment keeps the last state and class of each environment by tenant; RequestPromotion answers 409 for a reused key with another body, 422 for a missing Idempotency-Key, release, environment or strategy, an unknown strategy or a class off the promotion path, 412 for a withdrawn release, 404 alike for a release or an environment not recorded in the tenant of the caller, and 403 for a missing scope or role; Promotions.Request admits a workload token only with the service scope factory.delivery.promote, reads the forwarded tenant and project and the delegatedUserId of the call metadata only under it, keeps the delegated user as requestedBy and the runId and stepRunId of the request on the promotion (D141), and answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND or FAILED_PRECONDITION; no refusal writes anything; a repeat under the same Idempotency-Key, or for the same run, release and target environment, returns the first result."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5262]",
      "number": 5262
    },
    {
      "id": "AIFACTORY-TASK-5263",
      "type": "task",
      "parent": "AIFACTORY-US-1311",
      "title": "Fixture release and environment events and the token matrix of the request suite",
      "sequence": "08.03.02.02",
      "description": "Fixture release and environment events and the token matrix of the request suite. Expected output: The acceptance suite holds fixture events ReleaseReady and ReleaseWithdrawn of two tenants and fixture events EnvironmentStateChanged announcing environments of the classes Sandbox, Development, Staging and Production in both tenants, built from the event types of the pinned contracts package under the run event envelope, user tokens with and without factory.delivery.promote and with and without a role in the project of the release, and workload tokens of the deploy-environment caller with and without factory.delivery.promote, the service scope of Promotions.Request (D135), whose calls forward the requester of the run as delegatedUserId and name the runId and stepRunId of the requesting step (D141).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fixture events ReleaseReady and ReleaseWithdrawn of two tenants and fixture events EnvironmentStateChanged announcing environments of the classes Sandbox, Development, Staging and Production in both tenants, built from the event types of the pinned contracts package under the run event envelope, user tokens with and without factory.delivery.promote and with and without a role in the project of the release, and workload tokens of the deploy-environment caller with and without factory.delivery.promote, the service scope of Promotions.Request (D135), whose calls forward the requester of the run as delegatedUserId and name the runId and stepRunId of the requesting step (D141)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5263]",
      "number": 5263
    },
    {
      "id": "AIFACTORY-TASK-5264",
      "type": "task",
      "parent": "AIFACTORY-US-1311",
      "title": "Verify request-a-promotion through the acceptance suite",
      "sequence": "08.03.02.03",
      "description": "Verify request-a-promotion through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-003|Scenario=SCN-EnvironmentPromotionService-006|Scenario=SCN-EnvironmentPromotionService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1311: the accepted request and its idempotent repeat, the 409, 422, 412, 404 and 403 refusals without a write, the 404 that answers a release or an environment of another tenant like an unknown one, the gRPC acknowledgement, its repeat keyed on run, release and target environment and its statuses, and the publication and payload of PromotionRequested; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-003|Scenario=SCN-EnvironmentPromotionService-006|Scenario=SCN-EnvironmentPromotionService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1311: the accepted request and its idempotent repeat, the 409, 422, 412, 404 and 403 refusals without a write, the 404 that answers a release or an environment of another tenant like an unknown one, the gRPC acknowledgement, its repeat keyed on run, release and target environment and its statuses, and the publication and payload of PromotionRequested; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5264]",
      "number": 5264
    },
    {
      "id": "AIFACTORY-US-1312",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "Evaluate the gates of a promotion in order and hand the desired state to provisioning once they pass",
      "sequence": "08.03.03",
      "description": "As an operator, I want every promotion to pass the release resolution, policy, the prior environment where it applies, the environment state and evaluation evidence before it is deployed, so that a release reaches an environment only on recorded evidence, and a failing gate stops it with the gate named. The worker `GateEvaluator` starts on `PromotionRequested`, moves the promotion from Requested to GatesEvaluating (trigger Start) and evaluates the gates in order, recording each in `PromotionGates` with its outcome, its evidence reference and the time, once per gate kind under the idempotency key promotionId plus gateKind. Every gate evaluation first reads the withdrawn mark that `BlockPromotion` keeps, so a release withdrawn before or during the evaluation fails the gate being evaluated with the withdrawal as its evidence. PipelineResults resolves the release through `ReleaseService/Releases.GetRelease` under the tenant of the promotion and records the reply as its evidence; it fails when the release is not found. The reply is `release-manifest-v1`, the manifest of an asset release, which carries no pipeline-run outcome, and ReleaseService assembles a product release only from a succeeded pipeline run, so this PBI asserts no failing branch on the outcome of a pipeline run; the member that names the pipeline run of a product release is reported as an open point. Policy asks `PolicyEngineService/Policy.Decide` with a `policy-decision-request-v1` of the action kind `promotion`, which pairs with the domain Deployment, with the release as `action.target`, the class of the target environment that `GateEnvironment` kept as `action.environment`, the environment as `environmentId`, the project of the release, the run when the promotion names one, and the requester of the promotion as the subject (D140). For a promotion that an Operator or a Workspace admin requested through `RequestPromotion` the subject is that user; for one that the deploy-environment tool requested through `Promotions.Request` it is the workload with the requester of the run as `delegatedUserId`, forwarded in the call metadata beside the tenant and the project (AIFACTORY-US-1311). The platform rule for the action kind `promotion` then checks the role of the delegated user, the decision records the workload as the actor, and a workload subject without a delegated user is denied (D127, D141). The platform bundle allows a promotion for a subject who is Operator or Workspace admin of the project, and the seeded tenant bundle answers `allow-with-approval` with `obligations.approvalClass` production for the class production; that answer is met by the one production approval of the approval gate (AIFACTORY-US-1313), which carries the policy revision and the approver rule of the decision, and never by a second approval (D133, D140). The gate records the decision id as its evidence, passes on `allow` and, for production, on `allow-with-approval`, and fails on `deny` and `prohibited`; a subject who is neither Operator nor Workspace admin of the project matches no rule and is denied, because an action no rule matches is denied (D127). PriorEnvironment applies to a production promotion, as the invariant of the model states it: it passes when a promotion of the same release completed in the prior class of `Delivery:Promotions:PromotionPath` for the project, or when the policy decision allows a hotfix path with evidence, and fails otherwise. For a promotion of any other class, the first class of the path, development, among them, the gate is not evaluated and no row is written for it, the reading of D135 that the prior-environment gate applies to production only. EnvironmentReady reads the last state and class that the inbox handler `GateEnvironment` kept from `EnvironmentService/EnvironmentStateChanged`, and passes when the environment is Active. EvaluationEvidence applies where the release carries agent-generated assets and passes on the `evaluation` verdict of the release manifest when it is passed or waived; for any other release it is not evaluated. The first failing gate ends the evaluation: the promotion moves to Rejected (trigger GateFailed) with the gate named, and no later gate runs. ReleaseService and PolicyEngineService are required and fail fast; the worker attempts a gate 3 times, 30 seconds apart, and when the attempts are exhausted the gate is recorded failed with the unreachable dependency named and the promotion is Rejected. When every gate passes and the class is production, the approval is requested as part of the gate evaluation (AIFACTORY-US-1313), except for a rollback promotion, whose `rollbackOfPromotionId` names the promotion it rolls back: it evaluates the same gates, skips the approval gate and hands off like any promotion (D135, AIFACTORY-US-1315). For any other class, and for a rollback promotion, the promotion moves to Approved (trigger GatesPassedNoApproval); the service then builds the desired-state specification from the release and the environment, records `desiredStateRef` and moves to Deploying (trigger DesiredStateHandedOff), writing `PromotionApproved` with `strategy` and `desiredStateRef` in the same transaction: that event is the hand-off to IaCProvisioningService, which deploys from it in its own PBI. The moves to Approved and to Deploying are committed in one transaction, so no promotion rests in Approved when `ReleaseService/ReleaseWithdrawn` arrives, and a promotion that is Deploying or later keeps going, because a withdrawal revokes nothing already deployed. A withdrawal that arrives while the promotion is AwaitingApproval is handled with the approval (AIFACTORY-US-1313). The service never touches infrastructure. The Policy gate is proven against the published container image of PolicyEngineService of feature `policy-engine-service` with the seeded platform and tenant bundles, so the decisions it records are those of the bundles in force; a fake of the decision is kept only for a dependency that stops answering and for the hotfix allowance, for which no seeded rule exists. The class of the target environment travels in `action.environment`, the environment id in `environmentId` and the release in `action.target`, and the delegated user of a tool request in `subject.delegatedUserId`, as docs/reference/schemas/policy-decision-request.schema.json states (D141). A Rejected promotion publishes none of the five events of the model, which is reported as a correction. Kind: behavior. Traces: services: EnvironmentPromotionService, ReleaseService, PolicyEngineService, EnvironmentService, IaCProvisioningService; aggregates: EnvironmentPromotionService/Promotion; apis: ReleaseService/Releases.GetRelease, PolicyEngineService/Policy.Decide, EnvironmentPromotionService/Promotions.Request; events: EnvironmentPromotionService/PromotionRequested, EnvironmentPromotionService/PromotionApproved, EnvironmentService/EnvironmentStateChanged, ReleaseService/ReleaseWithdrawn; descriptors: policy-decision-request-v1, policy-decision-v1, release-manifest-v1; adrs: ADR-0004, ADR-0012, ADR-0014; requirements: FR-08, XL-04; scenarios: SCN-EnvironmentPromotionService-008. Relates: screens: promotions. Depends on: AIFACTORY-US-1311, feature:release-service, feature:policy-engine-service, feature:environment-service, feature:ia-cprovisioning-service. Sources: model/services/devops-gitops/EnvironmentPromotionService.yaml, docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#workers-and-jobs, docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#sagas-and-long-running-flows, model/services/governance/PolicyEngineService.yaml, docs/reference/schemas/policy-decision-request.schema.json, docs/reference/schemas/policy-decision.schema.json, docs/reference/schemas/release-manifest.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a Requested promotion into a staging or a development environment, requested by an Operator or a Workspace admin of the project, whose release resolves through `ReleaseService/Releases.GetRelease` and that targets an environment announced Active by `EnvironmentService/EnvironmentStateChanged`, when `GateEvaluator` handles `EnvironmentPromotionService/PromotionRequested`, then `PolicyEngineService/Policy.Decide` of the deployed PolicyEngineService with its seeded bundles is asked once with the action kind `promotion`, the release in `action.target`, the class of the target environment in `action.environment`, the environment id in `environmentId` and the requester as subject, or, for a promotion requested through `EnvironmentPromotionService/Promotions.Request`, the workload with the requester of the run as `delegatedUserId` (D141), and answers `allow` in the domain Deployment, the `EnvironmentPromotionService/Promotion` moves through GatesEvaluating to Approved and Deploying, each evaluated gate is recorded passed with its evidence reference, the Policy gate with the decision id, PriorEnvironment is not evaluated and has no row, `desiredStateRef` is recorded, and `EnvironmentPromotionService/PromotionApproved` is written in the transaction of the move to Deploying (SCN-EnvironmentPromotionService-008, D140).",
        "AC2: Given a production promotion whose other gates pass, when the Policy gate and PriorEnvironment are evaluated, then `PolicyEngineService/Policy.Decide` answers `allow-with-approval` with `obligations.approvalClass` production under the seeded tenant bundle, the Policy gate is recorded passed with that decision id, PriorEnvironment passes when a promotion of the same release completed in staging, the prior class of `Delivery:Promotions:PromotionPath`, for the project, or when a decision allows a hotfix path with evidence, and the one approval of AIFACTORY-US-1313 is then requested with the policy revision and the approver rule of that decision and no second approval; given neither for PriorEnvironment, then the gate is recorded failed and the promotion moves to Rejected (model/services/devops-gitops/EnvironmentPromotionService.yaml, model/services/governance/PolicyEngineService.yaml, D133, D140).",
        "AC3: Given a release that `ReleaseService/Releases.GetRelease` does not find, a requester who is neither Operator nor Workspace admin of the project, or a workload request whose delegated user holds neither role, whose promotion `PolicyEngineService/Policy.Decide` denies because no rule matches (D141), an environment announced Frozen or Retired, a release with agent-generated assets whose evaluation verdict is missing or failed, or a release that `ReleaseService/ReleaseWithdrawn` marked withdrawn before or during the evaluation, when the gates are evaluated, then the promotion moves to Rejected with the first failing gate named, no later gate is evaluated and no `EnvironmentPromotionService/PromotionApproved` is written; given the withdrawal arrives for a Deploying promotion, then its state is unchanged (model/services/devops-gitops/EnvironmentPromotionService.yaml).",
        "AC4: Given `ReleaseService/Releases.GetRelease` or `PolicyEngineService/Policy.Decide` does not answer, when a gate is evaluated, then it is attempted 3 times, 30 seconds apart; when the attempts are exhausted the gate is recorded failed with the unreachable dependency named and the promotion is Rejected; a duplicate trigger for the same promotion and gate kind records no second outcome (model/services/devops-gitops/EnvironmentPromotionService.yaml).",
        "AC5: Given the desired state was handed off, when the outbox dispatcher publishes `EnvironmentPromotionService/PromotionApproved` on `releases.promotions.v1.promotion-approved`, then the event is sent under the run event envelope with `promotionId`, `tenantId`, `releaseId`, `environmentId`, `strategy`, `desiredStateRef` and, for a production promotion only, `approvalId`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-EnvironmentPromotionService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#workers-and-jobs",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#sagas-and-long-running-flows",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-323",
        "AIFACTORY-TASK-5265",
        "AIFACTORY-TASK-5266",
        "AIFACTORY-TASK-5267"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9503,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentPromotionService",
          "ReleaseService",
          "PolicyEngineService",
          "EnvironmentService",
          "IaCProvisioningService"
        ],
        "aggregates": [
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "ReleaseService/Releases.GetRelease",
          "PolicyEngineService/Policy.Decide",
          "EnvironmentPromotionService/Promotions.Request"
        ],
        "events": [
          "EnvironmentPromotionService/PromotionRequested",
          "EnvironmentPromotionService/PromotionApproved",
          "EnvironmentService/EnvironmentStateChanged",
          "ReleaseService/ReleaseWithdrawn"
        ],
        "descriptors": [
          "policy-decision-request-v1",
          "policy-decision-v1",
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "XL-04"
        ],
        "scenarios": [
          "SCN-EnvironmentPromotionService-008"
        ]
      },
      "relates": {
        "screens": [
          "promotions"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1311",
        "feature:release-service",
        "feature:policy-engine-service",
        "feature:environment-service",
        "feature:ia-cprovisioning-service"
      ],
      "source": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#workers-and-jobs",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#sagas-and-long-running-flows",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/release-manifest.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1312]",
      "number": 1312
    },
    {
      "id": "AIFACTORY-TASK-323",
      "type": "task",
      "parent": "AIFACTORY-US-1312",
      "title": "GateEvaluator with the gates per environment class in order and the evidence of each gate",
      "sequence": "08.03.03.01",
      "description": "GateEvaluator with the gates per environment class in order and the evidence of each gate. Expected output: GateEvaluator moves a Requested promotion to GatesEvaluating, reads the withdrawn mark before each gate, evaluates PipelineResults by resolving the release through Releases.GetRelease, Policy through Policy.Decide with a policy-decision-request-v1 of the action kind promotion, the release as action.target, the class of the target environment as action.environment, the environment id as environmentId, the project, the run and the requester as subject, a workload request carrying the requester of the run as delegatedUserId, whose role the platform rule checks while the workload is recorded as the actor (D141), passing on allow and for production on allow-with-approval, whose decision id, policy revision and approver rule it keeps for the approval of AIFACTORY-TASK-324, and failing on deny or prohibited (D140), PriorEnvironment for a production promotion only against the promotion path or a hotfix allowance of the policy decision, EnvironmentReady from the state kept by GateEnvironment and EvaluationEvidence on the evaluation verdict of the release manifest where the release carries agent-generated assets, records each evaluated outcome in PromotionGates once per gate kind, rejects on the first failing gate with the gate named, attempts a gate 3 times 30 seconds apart and after the last attempt records the gate failed with the unreachable dependency named; GateEnvironment keeps the last announced state and class of each environment and BlockPromotion the withdrawn mark of each release, idempotently on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "GateEvaluator moves a Requested promotion to GatesEvaluating, reads the withdrawn mark before each gate, evaluates PipelineResults by resolving the release through Releases.GetRelease, Policy through Policy.Decide with a policy-decision-request-v1 of the action kind promotion, the release as action.target, the class of the target environment as action.environment, the environment id as environmentId, the project, the run and the requester as subject, a workload request carrying the requester of the run as delegatedUserId, whose role the platform rule checks while the workload is recorded as the actor (D141), passing on allow and for production on allow-with-approval, whose decision id, policy revision and approver rule it keeps for the approval of AIFACTORY-TASK-324, and failing on deny or prohibited (D140), PriorEnvironment for a production promotion only against the promotion path or a hotfix allowance of the policy decision, EnvironmentReady from the state kept by GateEnvironment and EvaluationEvidence on the evaluation verdict of the release manifest where the release carries agent-generated assets, records each evaluated outcome in PromotionGates once per gate kind, rejects on the first failing gate with the gate named, attempts a gate 3 times 30 seconds apart and after the last attempt records the gate failed with the unreachable dependency named; GateEnvironment keeps the last announced state and class of each environment and BlockPromotion the withdrawn mark of each release, idempotently on the event id."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-323]",
      "number": 323
    },
    {
      "id": "AIFACTORY-TASK-5265",
      "type": "task",
      "parent": "AIFACTORY-US-1312",
      "title": "Desired-state specification and the hand-off through PromotionApproved",
      "sequence": "08.03.03.02",
      "description": "Desired-state specification and the hand-off through PromotionApproved. Expected output: For a promotion that passed its gates without an approval, or whose approval was granted, the service builds the desired-state specification from the release and the environment, records desiredStateRef, moves the promotion through Approved to Deploying in one transaction and writes PromotionApproved with strategy, desiredStateRef and, for production, approvalId in that transaction; no call reaches infrastructure.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "For a promotion that passed its gates without an approval, or whose approval was granted, the service builds the desired-state specification from the release and the environment, records desiredStateRef, moves the promotion through Approved to Deploying in one transaction and writes PromotionApproved with strategy, desiredStateRef and, for production, approvalId in that transaction; no call reaches infrastructure."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5265]",
      "number": 5265
    },
    {
      "id": "AIFACTORY-TASK-5266",
      "type": "task",
      "parent": "AIFACTORY-US-1312",
      "title": "PolicyEngineService with its seeded bundles, fakes of Releases.GetRelease and Policy.Decide and fixture EnvironmentStateChanged and ReleaseWithdrawn events",
      "sequence": "08.03.03.03",
      "description": "PolicyEngineService with its seeded bundles, fakes of Releases.GetRelease and Policy.Decide and fixture EnvironmentStateChanged and ReleaseWithdrawn events. Expected output: The acceptance suite runs the pinned container image of PolicyEngineService with its seeded platform and tenant bundles for the decisions of the Policy gate, with requesters who are Operator, Workspace admin and neither of the project and workload requests that name as delegatedUserId a requester of the run who is Operator, Workspace admin or neither (D141), and holds a fake Releases.GetRelease that answers a release-manifest-v1 with or without agent-generated assets and with a passed, failed or missing evaluation verdict, answers NOT_FOUND and can stop answering, a fake Policy.Decide used only for a hotfix allowance and for a dependency that stops answering, fixture EnvironmentStateChanged events announcing an environment Active, Frozen and Retired with its class, and fixture ReleaseWithdrawn events delivered before the evaluation, between two gates and after the hand-off; no fake carries a pipeline-run member the contract lacks.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "The acceptance suite runs the pinned container image of PolicyEngineService with its seeded platform and tenant bundles for the decisions of the Policy gate, with requesters who are Operator, Workspace admin and neither of the project and workload requests that name as delegatedUserId a requester of the run who is Operator, Workspace admin or neither (D141), and holds a fake Releases.GetRelease that answers a release-manifest-v1 with or without agent-generated assets and with a passed, failed or missing evaluation verdict, answers NOT_FOUND and can stop answering, a fake Policy.Decide used only for a hotfix allowance and for a dependency that stops answering, fixture EnvironmentStateChanged events announcing an environment Active, Frozen and Retired with its class, and fixture ReleaseWithdrawn events delivered before the evaluation, between two gates and after the hand-off; no fake carries a pipeline-run member the contract lacks."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9503,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5266]",
      "number": 5266
    },
    {
      "id": "AIFACTORY-TASK-5267",
      "type": "task",
      "parent": "AIFACTORY-US-1312",
      "title": "Verify the gates and the hand-off through the acceptance suite",
      "sequence": "08.03.03.04",
      "description": "Verify the gates and the hand-off through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-EnvironmentPromotionService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1312, and the tests of AIFACTORY-US-1313 that the filter also selects are claimed by AIFACTORY-TASK-5268: the gates in order with their evidence for staging and development, the Policy gate asked with the action kind promotion and the class of the target environment and answered by the seeded bundles allow for an Operator or a Workspace admin, directly or as the delegated user of a workload request, allow-with-approval for production and deny for any other requester (D141), PriorEnvironment for production with the completed prior class and with the hotfix path, each failing gate and the withdrawn release, the exhausted attempts with the dependency named, the duplicate trigger, and the publication and payload of PromotionApproved; the deploy that IaCProvisioningService runs from it is proven by its own suite.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-EnvironmentPromotionService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1312, and the tests of AIFACTORY-US-1313 that the filter also selects are claimed by AIFACTORY-TASK-5268: the gates in order with their evidence for staging and development, the Policy gate asked with the action kind promotion and the class of the target environment and answered by the seeded bundles allow for an Operator or a Workspace admin, directly or as the delegated user of a workload request, allow-with-approval for production and deny for any other requester (D141), PriorEnvironment for production with the completed prior class and with the hotfix path, each failing gate and the withdrawn release, the exhausted attempts with the dependency named, the duplicate trigger, and the publication and payload of PromotionApproved; the deploy that IaCProvisioningService runs from it is proven by its own suite."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5267]",
      "number": 5267
    },
    {
      "id": "AIFACTORY-US-1313",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "A production promotion waits for the one approval bound to its release id and environment",
      "sequence": "08.03.04",
      "description": "As a reviewer of the project, I want to decide once on a production promotion, bound to the exact release and the environment, and never on a run I requested, so that production changes only on a decision someone other than the requester of the run took, and no second approval of the same deployment is asked. A person gives one production approval, and it is the gate of this service, bound to the release id and the environment (D133). The approval is requested as part of the gate evaluation: when every other gate of a production promotion passed, `GateEvaluator`, still in GatesEvaluating, calls `RunControlService/RunControl.RequestApproval` under the service identity of the service with an `approval-request-v1` of action class production and proposal kind release whose `subject` is the kind promotion with the promotion id, whose `requestingService` is EnvironmentPromotionService and whose `runId` names the run that requested the promotion when there is one (D135). The request carries as `policyRevision` and `approverRule` the revision and the `obligations.approverRule` of the `allow-with-approval` decision that the Policy gate recorded for the class production (AIFACTORY-US-1312), so this approval is the approval that decision asks for and no second one is opened (D133, D140). The schema has no member for the environment, so the proposal hash is computed over the hash of the release manifest and the environment id, and the proposal `reference` names the release id and the environment id; the decision then authorizes exactly that release in that environment, and a member that names the environment on its own is reported as an open point. `requestedBy` is, as the schema defines it, the requester of the run when the promotion names one, which RunControlService knows from the run and against which it checks separation of duties, and the Operator who requested the promotion when it names no run (ADR-0015, D135); the service keeps the requester of the promotion, a workload identity for a request of the deploy-environment tool, in its own `requestedBy` and never puts a workload identity in the approval request. Only when the `approvalId` is returned does the promotion move to AwaitingApproval (trigger GatesPassedApprovalRequired) with that `approvalId` recorded. RunControlService resolves the approver rule, refuses a decision by the requester of the run and expires the request in its own PBIs. The workflow steps delivery-run/approve-production and release/approve-production wait on this approval and the deploy-environment tool presents its id (D133, D135); no other production approval is asked for the same deployment, and IaCProvisioningService applies the desired state of an approved promotion without a second one. RunControlService is required and fails fast: the worker attempts the request 3 times, 30 seconds apart, and when the attempts are exhausted the Approval gate is recorded failed with RunControlService named and the promotion moves to Rejected (trigger GateFailed) without an approval id. The inbox handler `ApplyApproval` takes `RunControlService/ApprovalDecided`, idempotently on the event id, and applies a decision only when its `subjectKind` is promotion and its `subjectId`, `approvalId` and `tenantId` are those the promotion keeps; any other decision changes nothing. A rollback promotion requests no approval (D135). Approved records the Approval gate passed and moves the promotion to Approved (trigger ApprovalGranted), after which the hand-off of AIFACTORY-US-1312 writes `PromotionApproved` with that `approvalId`. Rejected and Expired record the Approval gate failed and move it to Rejected (trigger ApprovalRejectedOrExpired), and a new request binds a new approval (failure mode Approval expires). When the approval rule of the run says re-request on expiry, RunControlService opens a new request with a new `approvalId` that the Rejected promotion does not keep, so a decision on it changes nothing; whether a re-requested approval should keep the promotion waiting is reported as an open point. ChangesRequested and Stale keep the promotion AwaitingApproval with the decision recorded, because the proposal hash of a promotion does not change and a new request is the act of the run. Cancelled, which RunControlService publishes when the run is cancelled or fails, has no modelled transition out of AwaitingApproval: the promotion stays AwaitingApproval with the cancellation recorded, and the missing transition is reported as an open point. A release that `ReleaseService/ReleaseWithdrawn` withdraws while its promotion is AwaitingApproval has no modelled transition either: the withdrawal is recorded, an Approved decision that arrives afterwards records the Approval gate passed and hands nothing off, the promotion stays AwaitingApproval, and the missing transition is reported. A Reviewer lists the waiting promotions with the `promotions waiting` command of the command-line client, which reads `EnvironmentPromotionService/ListPromotions` through the typed client of DeliveryHost that feature `delivery-host` publishes with the conventions of feature `typed-gateway-clients` (D140), with its own token whose audience is that gateway (ADR-0015 amendment D114), and decides through the existing `approve` and `reject` commands of feature `command-line-client-commands`, which call `RunControlService/DecideApproval`. A production promotion that an Operator requests without a run is approved the same way, its subject being the promotion and its request carrying no `runId` (D135). Kind: behavior. Traces: services: EnvironmentPromotionService, RunControlService, ReleaseService; aggregates: EnvironmentPromotionService/Promotion; apis: RunControlService/RunControl.RequestApproval, RunControlService/DecideApproval, EnvironmentPromotionService/ListPromotions; events: RunControlService/ApprovalDecided, EnvironmentPromotionService/PromotionApproved, ReleaseService/ReleaseWithdrawn; steps: delivery-run/approve-production, release/approve-production; descriptors: approval-request-v1, approval-ref-v1; adrs: ADR-0014, ADR-0015; requirements: FUX-05, XL-04; scenarios: SCN-EnvironmentPromotionService-008. Relates: screens: promotions, approvals-list. Depends on: AIFACTORY-US-1312, feature:run-control-service, feature:release-service, feature:command-line-client-commands, feature:typed-gateway-clients, feature:delivery-host. Sources: model/services/devops-gitops/EnvironmentPromotionService.yaml, model/services/control-plane/RunControlService.yaml, model/workflows/delivery-run.yaml, docs/reference/schemas/approval.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a production promotion requested for a run whose other gates all passed, when the gate evaluation reaches the approval, then `RunControlService/RunControl.RequestApproval` is called once from GatesEvaluating under the service identity of the service with action class production, proposal kind release, the subject kind promotion with the promotion id, `requestingService` EnvironmentPromotionService, a proposal hash over the hash of the release manifest and the environment id, a `reference` naming the release id and the environment id, the `policyRevision` and `approverRule` of the `allow-with-approval` decision of the Policy gate, the run as `runId` and no workload identity in `requestedBy`; given an Operator requested the promotion without a run, then the request carries no `runId` and names the Operator in `requestedBy`; and only when the `approvalId` is returned does the `EnvironmentPromotionService/Promotion` move to AwaitingApproval with that `approvalId` recorded (SCN-EnvironmentPromotionService-008, ADR-0015).",
        "AC2: Given an AwaitingApproval promotion, when `RunControlService/ApprovalDecided` arrives Approved with the subject kind promotion and the `subjectId`, `approvalId` and `tenantId` the promotion keeps, then the Approval gate is recorded passed and the promotion moves to Approved and on to Deploying with `EnvironmentPromotionService/PromotionApproved` carrying that `approvalId`; given it arrives Rejected or Expired, then the Approval gate is recorded failed, the promotion moves to Rejected and nothing is handed off; given it names another subject kind, promotion, approval or tenant, or is redelivered, then nothing changes (SCN-EnvironmentPromotionService-008).",
        "AC3: Given an AwaitingApproval promotion, when `RunControlService/ApprovalDecided` arrives ChangesRequested, Stale or Cancelled, then the promotion stays AwaitingApproval with the decision recorded and nothing is handed off; given `ReleaseService/ReleaseWithdrawn` withdrew its release while it waited, when an Approved decision arrives, then the Approval gate is recorded passed, the promotion stays AwaitingApproval with the withdrawal recorded and no `EnvironmentPromotionService/PromotionApproved` is written (model/services/devops-gitops/EnvironmentPromotionService.yaml).",
        "AC4: Given `RunControlService/RunControl.RequestApproval` does not answer, when the approval is requested, then it is attempted 3 times, 30 seconds apart, and when the attempts are exhausted the Approval gate is recorded failed with RunControlService named, the promotion moves from GatesEvaluating to Rejected through GateFailed and no approval id is recorded; given a non-production promotion or a rollback promotion, then no approval is requested (SCN-EnvironmentPromotionService-008, D135).",
        "AC5: Given a Reviewer with a role in the project and promotions waiting for approval, when the `promotions waiting` command of the command-line client runs, then it reads `EnvironmentPromotionService/ListPromotions` filtered by state AwaitingApproval through the typed client of DeliveryHost of feature `delivery-host` with a token whose audience is that gateway and lists each promotion with its release, environment and `approvalId`, and the decision is taken by the existing `approve` and `reject` commands through `RunControlService/DecideApproval` naming that `approvalId`, so the steps delivery-run/approve-production and release/approve-production and the promotion settle on the same approval (ADR-0015, D133)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/delivery-run.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-324",
        "AIFACTORY-TASK-326",
        "AIFACTORY-TASK-5268",
        "AIFACTORY-TASK-5289"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9504,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentPromotionService",
          "RunControlService",
          "ReleaseService"
        ],
        "aggregates": [
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "RunControlService/RunControl.RequestApproval",
          "RunControlService/DecideApproval",
          "EnvironmentPromotionService/ListPromotions"
        ],
        "events": [
          "RunControlService/ApprovalDecided",
          "EnvironmentPromotionService/PromotionApproved",
          "ReleaseService/ReleaseWithdrawn"
        ],
        "steps": [
          "delivery-run/approve-production",
          "release/approve-production"
        ],
        "descriptors": [
          "approval-request-v1",
          "approval-ref-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-05",
          "XL-04"
        ],
        "scenarios": [
          "SCN-EnvironmentPromotionService-008"
        ]
      },
      "relates": {
        "screens": [
          "promotions",
          "approvals-list"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1312",
        "feature:run-control-service",
        "feature:release-service",
        "feature:command-line-client-commands",
        "feature:typed-gateway-clients",
        "feature:delivery-host"
      ],
      "source": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/workflows/delivery-run.yaml",
        "docs/reference/schemas/approval.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1313]",
      "number": 1313
    },
    {
      "id": "AIFACTORY-TASK-324",
      "type": "task",
      "parent": "AIFACTORY-US-1313",
      "title": "Production approval requested during the gate evaluation, bound to the release id and the environment, and the ApplyApproval handler",
      "sequence": "08.03.04.01",
      "description": "Production approval requested during the gate evaluation, bound to the release id and the environment, and the ApplyApproval handler. Expected output: For a production promotion other than a rollback promotion whose other gates passed, GateEvaluator calls RunControl.RequestApproval once from GatesEvaluating under the service identity with approval-request-v1 of action class production and proposal kind release, the subject kind promotion with the promotion id, requestingService EnvironmentPromotionService, a proposal hash over the hash of the release manifest and the environment id, a reference naming both, the policyRevision and approverRule of the allow-with-approval decision of the Policy gate, the run as runId when the promotion names one and no workload identity in requestedBy, and moves the promotion to AwaitingApproval only when the approvalId is returned; after 3 attempts 30 seconds apart without an answer it records the Approval gate failed with RunControlService named and rejects through GateFailed; ApplyApproval applies ApprovalDecided only for the subject kind promotion and the subjectId, approvalId and tenantId the promotion keeps, records the Approval gate passed on Approved and failed on Rejected or Expired, moves the promotion to Approved or Rejected, keeps it AwaitingApproval with the decision recorded on ChangesRequested, Stale and Cancelled, and hands nothing off for a release withdrawn while it waited, idempotently on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "For a production promotion other than a rollback promotion whose other gates passed, GateEvaluator calls RunControl.RequestApproval once from GatesEvaluating under the service identity with approval-request-v1 of action class production and proposal kind release, the subject kind promotion with the promotion id, requestingService EnvironmentPromotionService, a proposal hash over the hash of the release manifest and the environment id, a reference naming both, the policyRevision and approverRule of the allow-with-approval decision of the Policy gate, the run as runId when the promotion names one and no workload identity in requestedBy, and moves the promotion to AwaitingApproval only when the approvalId is returned; after 3 attempts 30 seconds apart without an answer it records the Approval gate failed with RunControlService named and rejects through GateFailed; ApplyApproval applies ApprovalDecided only for the subject kind promotion and the subjectId, approvalId and tenantId the promotion keeps, records the Approval gate passed on Approved and failed on Rejected or Expired, moves the promotion to Approved or Rejected, keeps it AwaitingApproval with the decision recorded on ChangesRequested, Stale and Cancelled, and hands nothing off for a release withdrawn while it waited, idempotently on the event id."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-324]",
      "number": 324
    },
    {
      "id": "AIFACTORY-TASK-326",
      "type": "task",
      "parent": "AIFACTORY-US-1313",
      "title": "The promotions waiting command of the command-line client",
      "sequence": "08.03.04.02",
      "description": "The promotions waiting command of the command-line client. Expected output: The client lists the promotions waiting for approval with release, environment and approvalId through EnvironmentPromotionService/ListPromotions filtered by state AwaitingApproval, called through the pinned typed client of DeliveryHost that feature delivery-host publishes (D140) with a token whose audience is that gateway; the decision is left to the existing approve and reject commands of feature command-line-client-commands, and no second decision command is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client lists the promotions waiting for approval with release, environment and approvalId through EnvironmentPromotionService/ListPromotions filtered by state AwaitingApproval, called through the pinned typed client of DeliveryHost that feature delivery-host publishes (D140) with a token whose audience is that gateway; the decision is left to the existing approve and reject commands of feature command-line-client-commands, and no second decision command is written."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-326]",
      "number": 326
    },
    {
      "id": "AIFACTORY-TASK-5268",
      "type": "task",
      "parent": "AIFACTORY-US-1313",
      "title": "Verify the production approval through the acceptance suite",
      "sequence": "08.03.04.03",
      "description": "Verify the production approval through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Feature=ProductionApproval|Scenario=SCN-EnvironmentPromotionService-008)\"`; a zero-match filter counts as a failure; with a fake RunControl.RequestApproval that records the request and can stop answering and fixture ApprovalDecided events Approved, Rejected, Expired, ChangesRequested, Stale and Cancelled, and for another subject kind, another promotion, another approval and another tenant, and promotions with and without a run and a rollback promotion, the tests prove AC1 to AC4 of AIFACTORY-US-1313; the refusal of a decision by the requester of the run is proven by the suite of RunControlService and AC5 by AIFACTORY-TASK-5289.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Feature=ProductionApproval|Scenario=SCN-EnvironmentPromotionService-008)\"`; a zero-match filter counts as a failure; with a fake RunControl.RequestApproval that records the request and can stop answering and fixture ApprovalDecided events Approved, Rejected, Expired, ChangesRequested, Stale and Cancelled, and for another subject kind, another promotion, another approval and another tenant, and promotions with and without a run and a rollback promotion, the tests prove AC1 to AC4 of AIFACTORY-US-1313; the refusal of a decision by the requester of the run is proven by the suite of RunControlService and AC5 by AIFACTORY-TASK-5289."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5268]",
      "number": 5268
    },
    {
      "id": "AIFACTORY-TASK-5289",
      "type": "task",
      "parent": "AIFACTORY-US-1313",
      "title": "Verify the promotions waiting command through the client acceptance suite",
      "sequence": "08.03.04.04",
      "description": "Verify the promotions waiting command through the client acceptance suite. Expected output: Run `dotnet test -c Release --no-build` on the client solution against a fake of the DeliveryHost route of EnvironmentPromotionService/ListPromotions; a run that discovers no test counts as a failure; the tests prove AC5 of AIFACTORY-US-1313: the command sends the state filter AwaitingApproval with a token whose audience is DeliveryHost, lists release, environment and approvalId of each promotion, exits with a non-zero code on 401, 403 and 503, and the decision runs through the existing approve and reject commands.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the client solution against a fake of the DeliveryHost route of EnvironmentPromotionService/ListPromotions; a run that discovers no test counts as a failure; the tests prove AC5 of AIFACTORY-US-1313: the command sends the state filter AwaitingApproval with a token whose audience is DeliveryHost, lists release, environment and approvalId of each promotion, exits with a non-zero code on 401, 403 and 503, and the decision runs through the existing approve and reject commands."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5289]",
      "number": 5289
    },
    {
      "id": "AIFACTORY-US-1314",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "Follow the deployment, verify the release in the environment and record the automatic rollback when verification fails",
      "sequence": "08.03.05",
      "description": "As an operator, I want a deployed release verified in its environment before it counts as current, and its promotion rolled back with evidence when verification fails, so that the current release of an environment is always one that passed verification, and a failed verification never leaves a promotion waiting. IaCProvisioningService deploys the desired state that `PromotionApproved` handed over and reports through events that name the promotion. The inbox handler `AttachProvisioningPlan` attaches the plan of `IaCProvisioningService/ProvisioningPlanned` to the promotion as evidence the approval covers, without a state change. `IaCProvisioningService/ProvisioningFailed` is taken by `FailPromotion`: the promotion moves from Deploying to Failed (trigger ProvisioningFailed) with the reason of provisioning, the environment is unchanged, and `PromotionFailed` is written with `rolledBack` false. `IaCProvisioningService/ProvisioningApplied` is taken by `StartVerification`: the promotion moves from Deploying to Verifying (trigger ProvisioningApplied), and the worker `Verifier`, triggered by the same event under the idempotency key promotionId and attempted 3 times, 60 seconds apart, runs the health checks and the smoke suite of the pipeline and observes the environment for `Delivery:Promotions:VerificationWindowMinutes`. The inbox handler `CompleteVerification` reads `RuntimeEnvironmentService/ObservedStateChanged` for the environment: the verification passes when the observed current release is the release of the promotion, the observation is not stale and the checks passed. The SLO window is checked through SloService, an optional dependency that degrades and is delivered in I4, so in this increment it is recorded as not evaluated and does not fail the verification. A passed verification moves the promotion to Completed (trigger VerificationPassed) with `completedAt` and the release that was current before as `previousReleaseId`, writes `PromotionCompleted` in the same transaction and records `connectsoft.factory.delivery.promotion_lead_time`; the release is then the current release of the environment. A verification fails when a check fails within the window, when the attempts of the Verifier are exhausted because the health checks or the smoke suite cannot be reached, or when the window expires without a fresh observation of the release, a stale observation included, and the reason is recorded. With `Delivery:Promotions:AutoRollbackOnVerificationFailure` at its default true and a previous release, a failed verification records the rollback evidence with the reason and the previous release as its target and opens a rollback promotion: a new promotion of the previous release into the same environment whose `rollbackOfPromotionId` names the failed promotion, written with `PromotionRequested` in the same transaction, and `connectsoft.factory.delivery.rollbacks` counts it as automatic (failure mode Verification fails, D135). The rollback promotion evaluates the gates of AIFACTORY-US-1312, skips the approval gate and hands its desired state to IaCProvisioningService through `PromotionApproved` like any promotion, so the previous release is deployed and verified by the same path. When the rollback promotion completes, the failed promotion moves from Verifying to RolledBack (trigger VerificationFailedAutoRollback) and `PromotionFailed` with `rolledBack` true and `RollbackCompleted` with the previous release as `restoredReleaseId` and the rollback promotion as `rollbackPromotionId` are written in the transaction of that completion (D135). Until then the failed promotion stays Verifying with the failure recorded; a rollback promotion that is Rejected or Failed has no modelled transition for the promotion it rolls back, which then stays Verifying with that outcome recorded, and the missing transition is reported as an open point. The model has no transition out of Verifying when the option is false or when there is no previous release, the first promotion into an environment; the promotion then stays Verifying with the failure and its reason recorded, nothing is published, and both cases are reported as open points. An event for a promotion in another state changes nothing. Both events carry the optional `runId` and `stepRunId` the promotion keeps from the requesting step, and neither carries them for a promotion no run requested, a rollback promotion among them (D141). RunControlService settles the step of a run that waits for the promotion from `PromotionCompleted` and `PromotionFailed` through its handler `SettleWaitingStep`, which AIFACTORY-US-1621 delivers (D140). Kind: behavior. Traces: services: EnvironmentPromotionService, IaCProvisioningService, RuntimeEnvironmentService; aggregates: EnvironmentPromotionService/Promotion; events: EnvironmentPromotionService/PromotionCompleted, EnvironmentPromotionService/PromotionFailed, EnvironmentPromotionService/RollbackCompleted, EnvironmentPromotionService/PromotionRequested, EnvironmentPromotionService/PromotionApproved, IaCProvisioningService/ProvisioningPlanned, IaCProvisioningService/ProvisioningApplied, IaCProvisioningService/ProvisioningFailed, RuntimeEnvironmentService/ObservedStateChanged; adrs: ADR-0004, ADR-0012, ADR-0014; requirements: FR-08, NFR-08, NFR-09; scenarios: SCN-EnvironmentPromotionService-009, SCN-EnvironmentPromotionService-010. Relates: screens: promotions, environment-board. Depends on: AIFACTORY-US-1312, feature:ia-cprovisioning-service, feature:runtime-environment-service. Sources: model/services/devops-gitops/EnvironmentPromotionService.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Deploying promotion, when `IaCProvisioningService/ProvisioningApplied` names it and the `Verifier` health and smoke checks pass and `RuntimeEnvironmentService/ObservedStateChanged` shows its release current and not stale within the window, then the `EnvironmentPromotionService/Promotion` moves through Verifying to Completed with `previousReleaseId` and `completedAt`, `EnvironmentPromotionService/PromotionCompleted` is written in the same transaction, the SLO window is recorded as not evaluated, and `connectsoft.factory.delivery.promotion_lead_time` is recorded (SCN-EnvironmentPromotionService-009).",
        "AC2: Given a Deploying promotion, when `IaCProvisioningService/ProvisioningFailed` names it, then it moves to Failed with the reason of provisioning and `EnvironmentPromotionService/PromotionFailed` is written with `rolledBack` false; given `IaCProvisioningService/ProvisioningPlanned` names it, then the plan is attached as evidence and the state is unchanged; a redelivered event changes nothing (SCN-EnvironmentPromotionService-010).",
        "AC3: Given a Verifying promotion with a previous release and `Delivery:Promotions:AutoRollbackOnVerificationFailure` true, when a check fails within the window, the 3 attempts of the Verifier are exhausted without reaching the checks, or the window expires without a fresh observation of the release, then its rollback evidence names the reason and the previous release, a rollback promotion of the previous release whose `rollbackOfPromotionId` names it is opened with `EnvironmentPromotionService/PromotionRequested`, requests no approval and hands off through `EnvironmentPromotionService/PromotionApproved`, and `connectsoft.factory.delivery.rollbacks` counts an automatic rollback; when the rollback promotion completes, the failed promotion moves from Verifying to RolledBack and `EnvironmentPromotionService/PromotionFailed` with `rolledBack` true and `EnvironmentPromotionService/RollbackCompleted` with `restoredReleaseId` and `rollbackPromotionId` are written in that transaction; before it completes, or when it ends Rejected or Failed, the failed promotion stays Verifying (SCN-EnvironmentPromotionService-010, D135).",
        "AC4: Given a Verifying promotion whose verification fails while `Delivery:Promotions:AutoRollbackOnVerificationFailure` is false, or the first promotion into its environment without a previous release, when the failure is recorded, then the promotion stays Verifying with the failure and its reason recorded and nothing is published, the missing transition being an open point of model/services/devops-gitops/EnvironmentPromotionService.yaml.",
        "AC5: Given the promotion completed or failed, when the outbox dispatcher publishes `EnvironmentPromotionService/PromotionCompleted` on `releases.promotions.v1.promotion-completed` and `EnvironmentPromotionService/PromotionFailed` on `releases.promotions.v1.promotion-failed`, then each is sent under the run event envelope, the first with `promotionId`, `tenantId`, `projectId`, `releaseId`, `environmentId`, `environmentClass` and `previousReleaseId`, the second with `promotionId`, `tenantId`, `releaseId`, `environmentId`, `reason` and `rolledBack`, both with the `runId` and the `stepRunId` of the requesting step when a run requested the promotion and without them otherwise (D141), and a transport outage is retried with backoff so neither is lost nor duplicated under its event id (SCN-EnvironmentPromotionService-009, SCN-EnvironmentPromotionService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-325",
        "AIFACTORY-TASK-5269",
        "AIFACTORY-TASK-5270"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9505,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentPromotionService",
          "IaCProvisioningService",
          "RuntimeEnvironmentService"
        ],
        "aggregates": [
          "EnvironmentPromotionService/Promotion"
        ],
        "events": [
          "EnvironmentPromotionService/PromotionCompleted",
          "EnvironmentPromotionService/PromotionFailed",
          "EnvironmentPromotionService/RollbackCompleted",
          "EnvironmentPromotionService/PromotionRequested",
          "EnvironmentPromotionService/PromotionApproved",
          "IaCProvisioningService/ProvisioningPlanned",
          "IaCProvisioningService/ProvisioningApplied",
          "IaCProvisioningService/ProvisioningFailed",
          "RuntimeEnvironmentService/ObservedStateChanged"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "NFR-08",
          "NFR-09"
        ],
        "scenarios": [
          "SCN-EnvironmentPromotionService-009",
          "SCN-EnvironmentPromotionService-010"
        ]
      },
      "relates": {
        "screens": [
          "promotions",
          "environment-board"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1312",
        "feature:ia-cprovisioning-service",
        "feature:runtime-environment-service"
      ],
      "source": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1314]",
      "number": 1314
    },
    {
      "id": "AIFACTORY-TASK-325",
      "type": "task",
      "parent": "AIFACTORY-US-1314",
      "title": "Deployment reports, the Verifier, its failure branches and the automatic rollback record",
      "sequence": "08.03.05.01",
      "description": "Deployment reports, the Verifier, its failure branches and the automatic rollback record. Expected output: AttachProvisioningPlan, FailPromotion, StartVerification and CompleteVerification handle their events for the promotion they name, idempotently on the event id; the Verifier runs the health checks and the smoke suite within VerificationWindowMinutes, attempted 3 times 60 seconds apart, and records the SLO window as not evaluated; a passed verification completes the promotion with previousReleaseId and PromotionCompleted, a provisioning failure fails it with PromotionFailed, both echoing the runId and stepRunId the promotion keeps and carrying none when no run requested it (D141), and a failed check, exhausted attempts or a window that expires without a fresh observation count as a failed verification with the reason recorded, which with AutoRollbackOnVerificationFailure true and a previous release records the rollback evidence and opens a rollback promotion of the previous release with rollbackOfPromotionId and PromotionRequested in one transaction; completing a rollback promotion moves the promotion it rolls back from Verifying to RolledBack and writes PromotionFailed with rolledBack true and RollbackCompleted with restoredReleaseId and rollbackPromotionId in the transaction of the completion; otherwise the promotion stays Verifying with the failure recorded and nothing published.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "AttachProvisioningPlan, FailPromotion, StartVerification and CompleteVerification handle their events for the promotion they name, idempotently on the event id; the Verifier runs the health checks and the smoke suite within VerificationWindowMinutes, attempted 3 times 60 seconds apart, and records the SLO window as not evaluated; a passed verification completes the promotion with previousReleaseId and PromotionCompleted, a provisioning failure fails it with PromotionFailed, both echoing the runId and stepRunId the promotion keeps and carrying none when no run requested it (D141), and a failed check, exhausted attempts or a window that expires without a fresh observation count as a failed verification with the reason recorded, which with AutoRollbackOnVerificationFailure true and a previous release records the rollback evidence and opens a rollback promotion of the previous release with rollbackOfPromotionId and PromotionRequested in one transaction; completing a rollback promotion moves the promotion it rolls back from Verifying to RolledBack and writes PromotionFailed with rolledBack true and RollbackCompleted with restoredReleaseId and rollbackPromotionId in the transaction of the completion; otherwise the promotion stays Verifying with the failure recorded and nothing published."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-325]",
      "number": 325
    },
    {
      "id": "AIFACTORY-TASK-5269",
      "type": "task",
      "parent": "AIFACTORY-US-1314",
      "title": "Fixture provisioning and observed-state events, fakes of the health and smoke checks and a controllable clock",
      "sequence": "08.03.05.02",
      "description": "Fixture provisioning and observed-state events, fakes of the health and smoke checks and a controllable clock. Expected output: The acceptance suite holds fixture events ProvisioningPlanned, ProvisioningApplied and ProvisioningFailed naming a promotion and ObservedStateChanged with the release of the promotion, with another release and stale, built from the event types of the pinned contracts package, fakes of the health checks and the smoke suite that pass, fail or stop answering on demand, and a clock the suite advances past VerificationWindowMinutes.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fixture events ProvisioningPlanned, ProvisioningApplied and ProvisioningFailed naming a promotion and ObservedStateChanged with the release of the promotion, with another release and stale, built from the event types of the pinned contracts package, fakes of the health checks and the smoke suite that pass, fail or stop answering on demand, and a clock the suite advances past VerificationWindowMinutes."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9505,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5269]",
      "number": 5269
    },
    {
      "id": "AIFACTORY-TASK-5270",
      "type": "task",
      "parent": "AIFACTORY-US-1314",
      "title": "Verify deployment, verification and the automatic rollback through the acceptance suite",
      "sequence": "08.03.05.03",
      "description": "Verify deployment, verification and the automatic rollback through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-009|Scenario=SCN-EnvironmentPromotionService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1314, including a failed check, exhausted Verifier attempts and an expired window each opening a rollback promotion, VerificationFailedAutoRollback with RollbackCompleted only once the rollback promotion completes, the failed promotion left Verifying while the rollback promotion runs or after it is Rejected or Failed, the promotion left Verifying with the option false and without a previous release, and the publication and payload of PromotionCompleted and PromotionFailed with and without the runId and stepRunId of a requesting step (D141); consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-009|Scenario=SCN-EnvironmentPromotionService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1314, including a failed check, exhausted Verifier attempts and an expired window each opening a rollback promotion, VerificationFailedAutoRollback with RollbackCompleted only once the rollback promotion completes, the failed promotion left Verifying while the rollback promotion runs or after it is Rejected or Failed, the promotion left Verifying with the option false and without a previous release, and the publication and payload of PromotionCompleted and PromotionFailed with and without the runId and stepRunId of a requesting step (D141); consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5270]",
      "number": 5270
    },
    {
      "id": "AIFACTORY-US-1315",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "An Operator rolls back the current completed promotion of an environment with evidence",
      "sequence": "08.03.06",
      "description": "As an operator, I want to roll an environment back to its previous release when the completed release it runs misbehaves, so that the rollback is recorded with its actor, reason and target release and cannot skip over a newer release. An Operator whose scope carries `factory.delivery.operate` and who holds the role Operator in the project of the promotion calls `EnvironmentPromotionService/RollbackPromotion` for a promotion through DeliveryHost. The Operator holds the approval of a rollback by role, so no approval is asked. Only the Completed promotion whose release is the current release of its environment, with no later Completed promotion in that environment, and that has a `previousReleaseId` can be rolled back. The rollback is a new promotion (D135): the service records the rollback evidence with the actor, the reason and the previous release as the target, opens a promotion of the previous release into the same environment whose `rollbackOfPromotionId` names the rolled-back promotion and whose requester is the Operator, writes `PromotionRequested` in the same transaction, counts `connectsoft.factory.delivery.rollbacks` as not automatic and answers 202. The rollback promotion evaluates the gates of AIFACTORY-US-1312, skips the approval gate and hands off through `PromotionApproved` like any promotion, and is deployed and verified by AIFACTORY-US-1314. When it completes, the rolled-back promotion moves from Completed to RolledBack (trigger ManualRollback) and `RollbackCompleted` is written in the transaction of that completion with the previous release as `restoredReleaseId` and the rollback promotion as `rollbackPromotionId`; until then the rolled-back promotion stays Completed with the rollback open, and a rollback promotion that is Rejected or Failed leaves it Completed with that outcome recorded. The operation is naturally idempotent: a repeat on a promotion whose rollback this operation opened, or that it moved to RolledBack, returns 202 and opens nothing, while a promotion that `VerificationFailedAutoRollback` moved to RolledBack is answered 409. A promotion in any other state, a Completed one without a previous release, and a Completed one whose release is no longer the current release of its environment are refused with 409; a promotion of another tenant is answered 404, the same answer as for an unknown promotion (ADR-0015); a caller without the scope or without the role Operator in the project is refused with 403. No refusal changes a state or publishes anything. `RollbackCompleted` carries `promotionId`, `tenantId`, `environmentId`, `releaseId`, `restoredReleaseId` and `rollbackPromotionId`, and it is published for an automatic rollback of AIFACTORY-US-1314 the same way; EnvironmentService, StudioBff, FleetInventoryService and AuditService handle it in their own PBIs. Kind: behavior. Traces: services: EnvironmentPromotionService; aggregates: EnvironmentPromotionService/Promotion; apis: EnvironmentPromotionService/RollbackPromotion; events: EnvironmentPromotionService/RollbackCompleted, EnvironmentPromotionService/PromotionRequested; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-08, NFR-09; scenarios: SCN-EnvironmentPromotionService-004, SCN-EnvironmentPromotionService-011. Relates: screens: promotions. Depends on: AIFACTORY-US-1314. Sources: model/services/devops-gitops/EnvironmentPromotionService.yaml, docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Completed promotion whose release is the current release of its environment and that has a previous release, and an Operator with `factory.delivery.operate` and the role Operator in its project, when `EnvironmentPromotionService/RollbackPromotion` is called with a reason, then the response is 202, the actor, the reason and the previous release are recorded as the rollback evidence, a rollback promotion of the previous release whose `rollbackOfPromotionId` names the `EnvironmentPromotionService/Promotion` is opened with `EnvironmentPromotionService/PromotionRequested` and requests no approval, `connectsoft.factory.delivery.rollbacks` counts a manual rollback, the rolled-back promotion stays Completed until the rollback promotion completes and then moves to RolledBack through ManualRollback with `EnvironmentPromotionService/RollbackCompleted` written in that transaction, and a repeat returns 202 and opens nothing (SCN-EnvironmentPromotionService-004, D135).",
        "AC2: Given a promotion that is not Completed, a Completed one without a previous release, a Completed one followed by a later Completed promotion in the same environment, a promotion rolled back by VerificationFailedAutoRollback, a promotion of another tenant, or a caller without the scope or the role Operator, when `EnvironmentPromotionService/RollbackPromotion` is called, then the response is 409, 409, 409, 409, 404 the same as for an unknown promotion, or 403 respectively, with a problem response, no state change and nothing published (SCN-EnvironmentPromotionService-004, ADR-0015).",
        "AC3: Given a rollback promotion that completed, when the outbox dispatcher publishes the `EnvironmentPromotionService/RollbackCompleted` written for the promotion it rolled back on `releases.promotions.v1.rollback-completed`, then the event is sent under the run event envelope with `promotionId`, `tenantId`, `environmentId`, `releaseId`, the previous release as `restoredReleaseId` and the rollback promotion as `rollbackPromotionId`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-EnvironmentPromotionService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5271",
        "AIFACTORY-TASK-5272"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9506,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentPromotionService"
        ],
        "aggregates": [
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "EnvironmentPromotionService/RollbackPromotion"
        ],
        "events": [
          "EnvironmentPromotionService/RollbackCompleted",
          "EnvironmentPromotionService/PromotionRequested"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08",
          "NFR-09"
        ],
        "scenarios": [
          "SCN-EnvironmentPromotionService-004",
          "SCN-EnvironmentPromotionService-011"
        ]
      },
      "relates": {
        "screens": [
          "promotions"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1314"
      ],
      "source": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1315]",
      "number": 1315
    },
    {
      "id": "AIFACTORY-TASK-5271",
      "type": "task",
      "parent": "AIFACTORY-US-1315",
      "title": "RollbackPromotion with the ManualRollback transition, the rollback evidence and the refusals",
      "sequence": "08.03.06.01",
      "description": "RollbackPromotion with the ManualRollback transition, the rollback evidence and the refusals. Expected output: RollbackPromotion, for the Completed promotion whose release is current in its environment and that has a previousReleaseId, records the actor, the reason and the previous release as target, opens a rollback promotion of the previous release with rollbackOfPromotionId and the Operator as requester and writes PromotionRequested in one transaction, counts a manual rollback and answers 202; completing the rollback promotion moves the rolled-back promotion to RolledBack through ManualRollback and writes RollbackCompleted with restoredReleaseId and rollbackPromotionId in that transaction; a repeat on a promotion whose rollback this operation opened answers 202 and opens nothing; a promotion in another state, without a previous release, no longer current in its environment or rolled back automatically is answered 409, one of another tenant or unknown 404 and a missing scope or role 403, and no refusal changes anything.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "RollbackPromotion, for the Completed promotion whose release is current in its environment and that has a previousReleaseId, records the actor, the reason and the previous release as target, opens a rollback promotion of the previous release with rollbackOfPromotionId and the Operator as requester and writes PromotionRequested in one transaction, counts a manual rollback and answers 202; completing the rollback promotion moves the rolled-back promotion to RolledBack through ManualRollback and writes RollbackCompleted with restoredReleaseId and rollbackPromotionId in that transaction; a repeat on a promotion whose rollback this operation opened answers 202 and opens nothing; a promotion in another state, without a previous release, no longer current in its environment or rolled back automatically is answered 409, one of another tenant or unknown 404 and a missing scope or role 403, and no refusal changes anything."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9506,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5271]",
      "number": 5271
    },
    {
      "id": "AIFACTORY-TASK-5272",
      "type": "task",
      "parent": "AIFACTORY-US-1315",
      "title": "Verify roll-back-a-completed-promotion through the acceptance suite",
      "sequence": "08.03.06.02",
      "description": "Verify roll-back-a-completed-promotion through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-004|Scenario=SCN-EnvironmentPromotionService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1315, including the rollback promotion opened without an approval, the idempotent repeat, the 409 for an older promotion of the environment and for an automatic rollback, the refusals without a state change, RollbackCompleted written only when the rollback promotion completes, and its publication and payload with rollbackPromotionId; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-004|Scenario=SCN-EnvironmentPromotionService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1315, including the rollback promotion opened without an approval, the idempotent repeat, the 409 for an older promotion of the environment and for an automatic rollback, the refusals without a state change, RollbackCompleted written only when the rollback promotion completes, and its publication and payload with rollbackPromotionId; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9506,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5272]",
      "number": 5272
    },
    {
      "id": "AIFACTORY-US-1316",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "Read promotions with their gates and evidence and the current release of an environment",
      "sequence": "08.03.07",
      "description": "As an observer of the project, I want to see the promotions of my projects with their gates, approval and evidence, and which release each environment runs, so that the promotion state and the current release I see in the Studio and the fleet views are the truth the service holds. A caller whose scope carries `factory.delivery.read`, an Operator, a Reviewer, a Workspace admin, a Platform admin or an Observer, reads promotions through DeliveryHost; fleet inventory and the Studio read the current release. `EnvironmentPromotionService/ListPromotions` returns the promotions of the projects in which the caller holds a role, every project of the tenant for a Platform admin, filtered by environment, release and state, each with its gates. `EnvironmentPromotionService/GetPromotion` returns one promotion with its gates and their evidence, the approval id, the desired-state reference, the verification results and the rollback evidence. `EnvironmentPromotionService/GetCurrentRelease` returns, for an environment, the release currently completed there: the release of its latest Completed promotion; a rollback is a new promotion of the previous release (D135), so once it completes, that rollback promotion is the latest Completed one and its release, the previous release, is current. Every query runs under the tenant row filter of the service. A promotion of another tenant, or an environment of another tenant, is answered 404, the same answer as for an unknown identifier, and never confirms that it exists (ADR-0015); an environment in which no release has completed is answered 404 as well. A caller without the scope is refused with 403, and so is a caller without a role in the project of the addressed promotion. Nothing is written by any of these reads, and a list never holds a promotion of another tenant. Kind: behavior. Traces: services: EnvironmentPromotionService; aggregates: EnvironmentPromotionService/Promotion; apis: EnvironmentPromotionService/ListPromotions, EnvironmentPromotionService/GetPromotion, EnvironmentPromotionService/GetCurrentRelease; adrs: ADR-0015; requirements: FUX-02, FUX-05; scenarios: SCN-EnvironmentPromotionService-001, SCN-EnvironmentPromotionService-002, SCN-EnvironmentPromotionService-005. Relates: screens: promotions, environment-board. Depends on: AIFACTORY-US-1311. Sources: model/services/devops-gitops/EnvironmentPromotionService.yaml, docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given promotions of two projects and two tenants and a caller with `factory.delivery.read` and a role in one project, when `EnvironmentPromotionService/ListPromotions` is called with a filter by environment, release or state, then the response is 200 with only the promotions of that project that match, each with its gates, and no promotion of another tenant or project appears; given a caller without the scope, then 403 (SCN-EnvironmentPromotionService-001, ADR-0015).",
        "AC2: Given a promotion that completed after a production approval, when `EnvironmentPromotionService/GetPromotion` is called, then the response is 200 with its gates and evidence, the approval id, the desired-state reference and the verification results, and for a rolled back promotion its rollback evidence; given a promotion of another tenant or an unknown id, then 404 with the same problem response; given no scope, then 403; nothing is written (SCN-EnvironmentPromotionService-002, ADR-0015).",
        "AC3: Given an environment with a completed promotion that was later rolled back by a completed rollback promotion, when `EnvironmentPromotionService/GetCurrentRelease` is called, then the response is 200 with the previous release that the rollback promotion completed (D135); given an environment with a completed promotion only, then that release; given an environment of another tenant, an unknown environment or one in which no release completed, then 404; given no scope, then 403 (SCN-EnvironmentPromotionService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5273",
        "AIFACTORY-TASK-5274"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9507,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvironmentPromotionService"
        ],
        "aggregates": [
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "EnvironmentPromotionService/ListPromotions",
          "EnvironmentPromotionService/GetPromotion",
          "EnvironmentPromotionService/GetCurrentRelease"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-02",
          "FUX-05"
        ],
        "scenarios": [
          "SCN-EnvironmentPromotionService-001",
          "SCN-EnvironmentPromotionService-002",
          "SCN-EnvironmentPromotionService-005"
        ]
      },
      "relates": {
        "screens": [
          "promotions",
          "environment-board"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1311"
      ],
      "source": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "docs/planes/execution/delivery-engine/services/environment-promotion-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1316]",
      "number": 1316
    },
    {
      "id": "AIFACTORY-TASK-5273",
      "type": "task",
      "parent": "AIFACTORY-US-1316",
      "title": "ListPromotions, GetPromotion and GetCurrentRelease under the tenant row filter and the project roles of the caller",
      "sequence": "08.03.07.01",
      "description": "ListPromotions, GetPromotion and GetCurrentRelease under the tenant row filter and the project roles of the caller. Expected output: ListPromotions returns the promotions of the projects in which the caller holds a role with their gates, filtered by environment, release and state; GetPromotion returns one promotion with gates, approval id, desired-state reference, verification and rollback evidence; GetCurrentRelease returns the release of the latest Completed promotion of the environment, a completed rollback promotion included; a resource of another tenant, an unknown one and an environment without a completed release are answered 404, a missing scope or role 403, and nothing is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "ListPromotions returns the promotions of the projects in which the caller holds a role with their gates, filtered by environment, release and state; GetPromotion returns one promotion with gates, approval id, desired-state reference, verification and rollback evidence; GetCurrentRelease returns the release of the latest Completed promotion of the environment, a completed rollback promotion included; a resource of another tenant, an unknown one and an environment without a completed release are answered 404, a missing scope or role 403, and nothing is written."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9507,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5273]",
      "number": 5273
    },
    {
      "id": "AIFACTORY-TASK-5274",
      "type": "task",
      "parent": "AIFACTORY-US-1316",
      "title": "Verify read-promotions-and-current-release through the acceptance suite",
      "sequence": "08.03.07.02",
      "description": "Verify read-promotions-and-current-release through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-001|Scenario=SCN-EnvironmentPromotionService-002|Scenario=SCN-EnvironmentPromotionService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1316 over two tenants and two projects, including the 404 that does not confirm a promotion or an environment of another tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvironmentPromotionService-001|Scenario=SCN-EnvironmentPromotionService-002|Scenario=SCN-EnvironmentPromotionService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1316 over two tenants and two projects, including the 404 that does not confirm a promotion or an environment of another tenant."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentPromotionService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9507,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5274]",
      "number": 5274
    },
    {
      "id": "AIFACTORY-US-1621",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-043",
      "title": "RunControlService settles the step of a run that waits for a promotion when the promotion completes or fails",
      "sequence": "08.03.08",
      "description": "As an operator, I want the step of a run that waits for a promotion settled with the outcome the promotion service recorded, so that a delivery or a release run never waits on a promotion that has already ended, and it goes on or fails on the recorded result. The inbox handler `SettleWaitingStep` of RunControlService takes `EnvironmentPromotionService/PromotionCompleted` and `EnvironmentPromotionService/PromotionFailed`. RunControlService itself is delivered in I1 by feature `run-control-service`, but the producer of these two events arrives in I2, so the handler for them is delivered by this feature and its tasks are written in the repository ConnectSoft.AI.SoftwareFactory.RunControlService (D140). The handler registers both events in the inbox of the messaging profile of RunControlService, idempotent on the event id. The requesting step passes its `runId` and its `stepRunId` to `Promotions.Request`, the promotion keeps them, and both events echo them as optional members, absent when no run requested the promotion (D141, AIFACTORY-US-1311, AIFACTORY-US-1314). The handler looks up the waiting step directly by them: under the tenant of the event it takes the `Step` whose step run id is the `stepRunId` of the event in the `Run` that `runId` names, and it ignores an event without them, such as one for a promotion an Operator requested without a run or for a rollback promotion. On `PromotionCompleted` it moves that step to Succeeded with the promotion as its result reference. On `PromotionFailed` it moves the step to Failed with the failure class permanent and records the `reason` and `rolledBack` of the event; a failed promotion is read as permanent because a retry of the step would request a new promotion, and this reading of a class the model leaves unnamed is reported. In both cases `RunControlService/StepSettled` is written in the transaction that moves the step to its final state, with the step run id of the engine, the stepId, the final state, the number of attempts and, for a failed step, the failure class (D119, D121); WorkflowEngineService applies the failure policy of the step and continues or fails the run in its own PBIs. An event without `runId` and `stepRunId`, an event whose `runId` names no run of the tenant of the event, a run of another tenant among them, an event whose `stepRunId` names no step of that run, an event for a step that is already in a final state, Cancelled by a cancellation among them, and a redelivered event change nothing and publish nothing. A Rejected promotion publishes none of the events of EnvironmentPromotionService (AIFACTORY-US-1312), so a step that waits for it is not settled by this handler and ends by the timeout of the step. When the store of RunControlService does not answer, the inbox keeps the event and retries it, and the event is applied once. Kind: behavior. Traces: services: RunControlService, EnvironmentPromotionService, WorkflowEngineService; aggregates: RunControlService/Step; events: EnvironmentPromotionService/PromotionCompleted, EnvironmentPromotionService/PromotionFailed, RunControlService/StepSettled; workflows: delivery-run, release; adrs: ADR-0012, ADR-0014; requirements: FR-08. Depends on: AIFACTORY-US-1314, feature:run-control-service, feature:contracts-package. Sources: model/services/control-plane/RunControlService.yaml, model/services/devops-gitops/EnvironmentPromotionService.yaml, model/workflows/delivery-run.yaml, model/workflows/release.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run of the tenant with a step that waits for a promotion it requested, when `EnvironmentPromotionService/PromotionCompleted` names that promotion with the `runId` of the run and the `stepRunId` of the step (D141), then the `RunControlService/Step` moves to Succeeded with the promotion as its result reference and `RunControlService/StepSettled` is written in the same transaction with the step run id of the engine, the stepId, the final state Succeeded and the number of attempts; a redelivery under the same event id changes nothing (model/services/control-plane/RunControlService.yaml, ADR-0014).",
        "AC2: Given the same waiting step, when `EnvironmentPromotionService/PromotionFailed` names the promotion with the same `runId` and `stepRunId` and with `rolledBack` false after a provisioning failure or true after the automatic rollback, then the `RunControlService/Step` moves to Failed with the failure class permanent, the reason and `rolledBack` are recorded, and `RunControlService/StepSettled` carries the final state Failed and the failure class in the transaction of the move (model/services/control-plane/RunControlService.yaml).",
        "AC3: Given an event without `runId` and `stepRunId`, as for a promotion an Operator requested without a run, an event whose `runId` names a run of another tenant or no run, an event whose `stepRunId` names no step of the run, a waiting step that is already Cancelled (D141), or the store of RunControlService stopped while the event arrives, when `EnvironmentPromotionService/PromotionCompleted` or `EnvironmentPromotionService/PromotionFailed` is handled, then the first four change no step and write no `RunControlService/StepSettled`, and the last is retried by the inbox until the store answers and is applied once under its event id (ADR-0012, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/workflows/delivery-run.yaml",
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6561",
        "AIFACTORY-TASK-6562",
        "AIFACTORY-TASK-6563"
      ],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9508,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "EnvironmentPromotionService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "RunControlService/Step"
        ],
        "events": [
          "EnvironmentPromotionService/PromotionCompleted",
          "EnvironmentPromotionService/PromotionFailed",
          "RunControlService/StepSettled"
        ],
        "workflows": [
          "delivery-run",
          "release"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1314",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/workflows/delivery-run.yaml",
        "model/workflows/release.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1621]",
      "number": 1621
    },
    {
      "id": "AIFACTORY-TASK-6561",
      "type": "task",
      "parent": "AIFACTORY-US-1621",
      "title": "SettleWaitingStep of RunControlService for PromotionCompleted and PromotionFailed",
      "sequence": "08.03.08.01",
      "description": "SettleWaitingStep of RunControlService for PromotionCompleted and PromotionFailed. Expected output: The inbox of the RunControlService messaging profile registers PromotionCompleted and PromotionFailed with idempotency on the event id, and SettleWaitingStep looks up the waiting step directly by the runId and stepRunId the event echoes, under the tenant of the event, and ignores an event without them (D141), moves it to Succeeded with the promotion as result reference or to Failed with the failure class permanent and the reason and rolledBack recorded, and writes StepSettled with step run id, stepId, final state, attempts and failure class in the same transaction; an event without runId and stepRunId, of a run of another tenant or of no run, of a step run the run does not hold or for a step in a final state changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox of the RunControlService messaging profile registers PromotionCompleted and PromotionFailed with idempotency on the event id, and SettleWaitingStep looks up the waiting step directly by the runId and stepRunId the event echoes, under the tenant of the event, and ignores an event without them (D141), moves it to Succeeded with the promotion as result reference or to Failed with the failure class permanent and the reason and rolledBack recorded, and writes StepSettled with step run id, stepId, final state, attempts and failure class in the same transaction; an event without runId and stepRunId, of a run of another tenant or of no run, of a step run the run does not hold or for a step in a final state changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9508,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6561]",
      "number": 6561
    },
    {
      "id": "AIFACTORY-TASK-6562",
      "type": "task",
      "parent": "AIFACTORY-US-1621",
      "title": "Fixture promotion events and waiting steps of the settlement suite",
      "sequence": "08.03.08.02",
      "description": "Fixture promotion events and waiting steps of the settlement suite. Expected output: The acceptance suite of RunControlService holds fixture events PromotionCompleted and PromotionFailed with rolledBack false and true for two tenants, with the runId and stepRunId of a waiting step, with an unknown stepRunId and without both (D141), built from the event types of the pinned contracts package under the run event envelope, runs with a step that waits for a promotion, with a step already Cancelled and with no waiting step, and a switch that stops the store of the service while an event arrives.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite of RunControlService holds fixture events PromotionCompleted and PromotionFailed with rolledBack false and true for two tenants, with the runId and stepRunId of a waiting step, with an unknown stepRunId and without both (D141), built from the event types of the pinned contracts package under the run event envelope, runs with a step that waits for a promotion, with a step already Cancelled and with no waiting step, and a switch that stops the store of the service while an event arrives."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9508,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6562]",
      "number": 6562
    },
    {
      "id": "AIFACTORY-TASK-6563",
      "type": "task",
      "parent": "AIFACTORY-US-1621",
      "title": "Verify settle-the-step-waiting-for-a-promotion through the acceptance suite",
      "sequence": "08.03.08.03",
      "description": "Verify settle-the-step-waiting-for-a-promotion through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SettleWaitingStepOnPromotion\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1621: the step settled Succeeded on PromotionCompleted and Failed with the failure class permanent on PromotionFailed, RunControlService/StepSettled in the transaction of the move, the events that change nothing, the event without runId and stepRunId among them (D141), and the retry while the store is stopped with one application under the event id.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SettleWaitingStepOnPromotion\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1621: the step settled Succeeded on PromotionCompleted and Failed with the failure class permanent on PromotionFailed, RunControlService/StepSettled in the transaction of the move, the events that change nothing, the event without runId and stepRunId among them (D141), and the retry while the store is stopped with one application under the event id."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 95,
      "phase": "factory",
      "stackRank": 9508,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6563]",
      "number": 6563
    },
    {
      "id": "AIFACTORY-FEAT-044",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-008",
      "title": "PipelineExecutionService: complete delivery",
      "sequence": "08.04",
      "description": "PipelineExecutionService is the service of bounded context BC-23 (Source & Pipelines). Receipts for everything the Factory does in a system of record: change proposals that became branches and pull requests with their review state, pipeline runs with stages, build, test, coverage, security and package results, and the provenance that ties every commit and run back to the Factory run, agent release and change set that produced it (BC-23; BuildResultService merged). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Delivers: PipelineExecutionService (complete). Depends on: AIFACTORY-FEAT-041. Increment I2: Deliver it. Build order 96 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-022",
        "AIFACTORY-US-1276",
        "AIFACTORY-US-1280",
        "AIFACTORY-US-1281",
        "AIFACTORY-US-1282",
        "AIFACTORY-US-1283",
        "AIFACTORY-US-1284",
        "AIFACTORY-US-1285",
        "AIFACTORY-US-1286",
        "AIFACTORY-US-1287",
        "AIFACTORY-US-1608"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9600,
      "titlePrefix": "[AIFACTORY-FEAT-044]",
      "number": 44
    },
    {
      "id": "AIFACTORY-US-022",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "A merged change produces a recorded pipeline run",
      "sequence": "08.04.01",
      "description": "As an operator, I want the pipeline run of a merged change recorded with its typed results, so that delivery decisions rest on receipts and never on an assumption that a build passed. This is the integration PBI of the complete delivery of PipelineExecutionService, which replaces the thin delivery of I1 in the same repository without a contract change and serves every aggregate, operation, event, worker and handler of model/services/devops-gitops/PipelineExecutionService.yaml. `OpenChangeProposal`, the REST route that pushes a change set as a branch and opens its pull request from this service, arrives here (AIFACTORY-US-1276) beside the recording path of I1. A proposal opened in I1 now lives on in the system of record: verified deliveries of Azure DevOps and GitHub, announced by `DeliveryReceived` of ConnectorRegistryService, move it through review to Merged or Abandoned with `ChangeProposalStateChanged` and `ChangeProposalMerged` (AIFACTORY-US-1281, AIFACTORY-US-1282). The pipeline of the repository runs on the merged commit; its run is mirrored as a `PipelineRun` with stages and typed results, build, unit and integration tests, coverage, static analysis, security scan, SBOM, packages, images and attestations, each a receipt with an artifact reference, and announced by `PipelineRunStarted` and `PipelineRunCompleted` (AIFACTORY-US-1283). A missed delivery is never assumed: the `RunReconciler` polls the system of record for runs and proposals still open after `Delivery:Pipelines:ReconcileAfterMinutes`, and an Operator can ask for the same read through `ReconcilePipelineRun` (AIFACTORY-US-1285). Readers with `factory.delivery.read` list and read proposals and runs of their own tenant and projects only, a resource of another tenant being answered 404 (ADR-0015; AIFACTORY-US-1280, AIFACTORY-US-1284). A run takes the state the system of record reported, never one the service assumes or derives; each failed result is recorded with `passed` false, its kind and its summary, and consumers judge readiness from the typed results: ReleaseService assembles a release only from a succeeded run and the delivery run evaluates the typed results in their own features, while RunControlService settles the step of a run that waits for the pipeline run of its merged commit through its handler `SettleWaitingStep`, which this feature delivers in the repository of RunControlService (AIFACTORY-US-1608, D140). The public routes are reached through the DeliveryHost gateway of this increment. `DeliveryReceived`, the verified inbound deliveries of Azure DevOps with the webhook ingress they need, and the reads `Connectors.ReadPipelineRun` and `Connectors.ReadPullRequest` that the applier and the reconciler use for an unknown run or pull request are delivered in I2 by feature connector-registry-service-deliveries (D135), so on a deployed I2 instance review states, merges and pipeline runs reach `ApplyDelivery`. The branch push through a connector, which `OpenChangeProposal` needs, is not in the I2 scope of ConnectorRegistryService; that path is proven against a fake connector and stays an open point of the model. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Kind: behavior. Traces: services: PipelineExecutionService, IntegrationService, ConnectorRegistryService, DeliveryHost; aggregates: PipelineExecutionService/PipelineRun, PipelineExecutionService/ChangeProposal; apis: PipelineExecutionService/ListPipelineRuns, PipelineExecutionService/GetPipelineRun, PipelineExecutionService/ReconcilePipelineRun, PipelineExecutionService/OpenChangeProposal, PipelineExecutionService/Pipelines.RecordProposal, ConnectorRegistryService/Connectors.ReadPipelineRun, ConnectorRegistryService/Connectors.ReadPullRequest; events: PipelineExecutionService/ChangeProposalOpened, PipelineExecutionService/ChangeProposalMerged, PipelineExecutionService/PipelineRunStarted, PipelineExecutionService/PipelineRunCompleted, ConnectorRegistryService/DeliveryReceived; adrs: ADR-0014, ADR-0015; requirements: FR-07, FUX-05, FUX-06. Relates: screens: pipeline-runs, proposals. Depends on: AIFACTORY-US-1276, AIFACTORY-US-1280, AIFACTORY-US-1281, AIFACTORY-US-1282, AIFACTORY-US-1283, AIFACTORY-US-1284, AIFACTORY-US-1285, AIFACTORY-US-1286, AIFACTORY-US-1287, AIFACTORY-US-1608, feature:pipeline-execution-service-thin, feature:delivery-host, feature:connector-registry-service-thin, feature:connector-registry-service-deliveries. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a change proposal was merged and the pipeline of the repository ran on the merged commit, when the deliveries of that run, announced by `ConnectorRegistryService/DeliveryReceived` of feature connector-registry-service-deliveries, are applied, then `PipelineExecutionService/PipelineRunStarted` and `PipelineExecutionService/PipelineRunCompleted` are published for one `PipelineExecutionService/PipelineRun` with the commit, the proposal and the tests, scans and quality gates as typed results (ADR-0014).",
        "AC2: Given a webhook delivery of a run was missed, when the reconciler runs after `Delivery:Pipelines:ReconcileAfterMinutes`, then the run is read from the system of record through `ConnectorRegistryService/Connectors.ReadPipelineRun` and recorded once, and its completion is published once (model/services/devops-gitops/PipelineExecutionService.yaml).",
        "AC3: Given a pipeline run with a failed result, when its results are read through `PipelineExecutionService/GetPipelineRun`, then the run carries the state the system of record reported and each failed result is recorded with `passed` false, its kind and its summary, so that a consumer judges readiness from the typed results and not from the run state alone (FR-07).",
        "AC4: Given I list the pipeline runs through `PipelineExecutionService/ListPipelineRuns`, when the project is not in my trusted scope or belongs to another tenant, then I see none of its runs, and reading one of them by id is answered 404 (ADR-0015).",
        "AC5: Given the complete delivery is deployed in place of the thin one, when ToolAdapterService calls `PipelineExecutionService/Pipelines.RecordProposal` as in I1, then it is served unchanged and `PipelineExecutionService/ChangeProposalOpened` keeps its contract, `PipelineExecutionService/OpenChangeProposal` is served beside it, and the fakes and static answers of the first outcome are gone from the repository."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-319",
        "AIFACTORY-TASK-261",
        "AIFACTORY-TASK-709"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9601,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "IntegrationService",
          "ConnectorRegistryService",
          "DeliveryHost"
        ],
        "aggregates": [
          "PipelineExecutionService/PipelineRun",
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "PipelineExecutionService/ListPipelineRuns",
          "PipelineExecutionService/GetPipelineRun",
          "PipelineExecutionService/ReconcilePipelineRun",
          "PipelineExecutionService/OpenChangeProposal",
          "PipelineExecutionService/Pipelines.RecordProposal",
          "ConnectorRegistryService/Connectors.ReadPipelineRun",
          "ConnectorRegistryService/Connectors.ReadPullRequest"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalOpened",
          "PipelineExecutionService/ChangeProposalMerged",
          "PipelineExecutionService/PipelineRunStarted",
          "PipelineExecutionService/PipelineRunCompleted",
          "ConnectorRegistryService/DeliveryReceived"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-07",
          "FUX-05",
          "FUX-06"
        ]
      },
      "relates": {
        "screens": [
          "pipeline-runs",
          "proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1276",
        "AIFACTORY-US-1280",
        "AIFACTORY-US-1281",
        "AIFACTORY-US-1282",
        "AIFACTORY-US-1283",
        "AIFACTORY-US-1284",
        "AIFACTORY-US-1285",
        "AIFACTORY-US-1286",
        "AIFACTORY-US-1287",
        "AIFACTORY-US-1608",
        "feature:pipeline-execution-service-thin",
        "feature:delivery-host",
        "feature:connector-registry-service-thin",
        "feature:connector-registry-service-deliveries"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-022]",
      "number": 22
    },
    {
      "id": "AIFACTORY-TASK-319",
      "type": "task",
      "parent": "AIFACTORY-US-022",
      "title": "Pipeline commands in the command-line client",
      "sequence": "08.04.01.01",
      "description": "Pipeline commands in the command-line client. Expected output: The client lists the pipeline runs of a project through PipelineExecutionService/ListPipelineRuns and shows the typed results of one run through PipelineExecutionService/GetPipelineRun, naming every failed result.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client lists the pipeline runs of a project through PipelineExecutionService/ListPipelineRuns and shows the typed results of one run through PipelineExecutionService/GetPipelineRun, naming every failed result."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-319]",
      "number": 319
    },
    {
      "id": "AIFACTORY-TASK-261",
      "type": "task",
      "parent": "AIFACTORY-US-022",
      "title": "Retire the thin scope and the stubs of PipelineExecutionService",
      "sequence": "08.04.01.02",
      "description": "Retire the thin scope and the stubs of PipelineExecutionService. Expected output: Callers run against the complete service; the fakes and static answers of the first outcome are deleted, the contracts of Pipelines.RecordProposal and ChangeProposalOpened stay unchanged, and no stub remains that this feature does not declare.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Callers run against the complete service; the fakes and static answers of the first outcome are deleted, the contracts of Pipelines.RecordProposal and ChangeProposalOpened stay unchanged, and no stub remains that this feature does not declare."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-261]",
      "number": 261
    },
    {
      "id": "AIFACTORY-TASK-709",
      "type": "task",
      "parent": "AIFACTORY-US-022",
      "title": "Verify pipeline-run-recorded by running the declared command",
      "sequence": "08.04.01.03",
      "description": "Verify pipeline-run-recorded by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance`; a zero-match filter counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-022 over recorded deliveries of a merged proposal and its pipeline run, a missed completion delivery, a run that failed its security scan and a two-tenant fixture.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance`; a zero-match filter counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-022 over recorded deliveries of a merged proposal and its pipeline run, a missed completion delivery, a run that failed its security scan and a two-tenant fixture."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-709]",
      "number": 709
    },
    {
      "id": "AIFACTORY-US-1276",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "Open a change proposal as a branch and a pull request in the system of record",
      "sequence": "08.04.02",
      "description": "As a reviewer, I want the change set I approved pushed as a branch and opened as a pull request with its provenance, so that the system of record holds exactly what I approved and every commit names the run that produced it. `OpenChangeProposal` is the route of a person; the tool `propose-change-set` opens its pull request through the connection itself and records it with `Pipelines.RecordProposal` (D135). A caller whose scope carries `factory.delivery.propose` posts to `PipelineExecutionService/OpenChangeProposal` under an `Idempotency-Key` a `pull-request-proposal-v1` body with exactly the members of `PullRequestProposal` in docs/reference/schemas/change-set.schema.json: `changeSetId`, `changeSetHash`, `targetBranch`, `title`, `body` and the optional `reviewers`, `labels` and `linkedWorkItems`. Tenant and project come from the trusted scope of the call, never from the body (ADR-0015). The service reads the change set by `changeSetId` from ArtifactService, takes `changeSetRef` and the repository from it and refuses, with a problem response and no state change, a `changeSetHash` that is not the hash of the stored change set, the hash the approval was bound to; which of the codes the model lists answers that refusal is reported. A `ChangeProposal` carries its provenance `runId`, `attemptId`, `agentReleaseId` and `changeSetRef`, and a proposal without provenance is not Factory-authored, but neither `OpenChangeProposal`, `pull-request-proposal-v1` nor `execution-scope-v1` carries a run, an attempt or an agent release, so the carrier of the provenance on the route of a person stays an open point of the model, `change-proposal-record-v1` carrying it only for the recording path, and this PBI invents no body member. The service records the proposal in state Proposed with the system of record of the tenant connection (`Delivery:Systems:DefaultSystemOfRecord`, Azure DevOps by default) and answers 202 with the location of the proposal; the push and the pull request follow the answer. It pushes the change set as a branch, every commit carrying the trailers of `Delivery:Pipelines:CommitTrailerKeys` (`Factory-Run`, `Factory-ChangeSet`, `Factory-Agent`), records the commits in `ProposalCommits` and moves the proposal to BranchCreated (`BranchPushed`); it then opens the pull request, records `pullRequestRef` and moves to PullRequestOpen (`PullRequestOpened`), writing `ChangeProposalOpened` in the same transaction (AIFACTORY-US-1278). A repeat under the same key and body returns the same proposal and changes nothing; a different body under the same key is refused with 409 (ADR-0014); a run and change-set hash already recorded through `Pipelines.RecordProposal` return that proposal and push nothing. A caller without the scope is refused with 403. Because the answer precedes the push, a push that the branch policy refuses is not answered with a status: the proposal stays Proposed with the reason, visible through `GetChangeProposal`, nothing is published and the attempt of the tool records a failed shared-write, as the failure mode of the model states. When the system of record is unreachable the proposal stays Proposed and nothing is marked done without a receipt; the pending push of a Proposed proposal is kept and retried once the connector is healthy again, opening the proposal once (D135, a reading the owner may overturn). The model lists 412 without naming its condition, so this PBI asserts no meaning for it and reports it. When ArtifactService is unavailable the call fails fast and records nothing. The connector path of this route is not modelled: feature connector-registry-service-deliveries gives this service the reads `Connectors.ReadPullRequest` and `Connectors.ReadPipelineRun` but no operation through which it pushes a branch or opens a pull request, so the behaviour is proven against a fake Azure DevOps connector and the path stays an open point. No modelled operation merges, and the model forbids an auto-merge to a protected branch without a shared-write approval recorded by the service. The gauge `connectsoft.factory.delivery.proposals` moves with the state of every proposal. Kind: behavior. Traces: services: PipelineExecutionService, ArtifactService, ConnectorRegistryService; aggregates: PipelineExecutionService/ChangeProposal; apis: PipelineExecutionService/OpenChangeProposal, PipelineExecutionService/GetChangeProposal, PipelineExecutionService/Pipelines.RecordProposal; events: PipelineExecutionService/ChangeProposalOpened; descriptors: pull-request-proposal-v1, change-set-v1; adrs: ADR-0014, ADR-0015; requirements: FR-07, XL-10; scenarios: SCN-PipelineExecutionService-003. Relates: screens: proposals. Depends on: AIFACTORY-US-1280, AIFACTORY-US-1286, AIFACTORY-US-1287, feature:pipeline-execution-service-thin, feature:artifact-service, feature:connector-registry-service-thin. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, model/tools/propose-change-set.yaml, docs/reference/schemas/change-set.schema.json, docs/reference/schemas/execution-scope.schema.json, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a person whose scope carries `factory.delivery.propose` and a `pull-request-proposal-v1` body with only the members of `PullRequestProposal` whose `changeSetHash` is the hash of the change set stored in ArtifactService, when `PipelineExecutionService/OpenChangeProposal` is called with an `Idempotency-Key`, then the response is 202 with the location of the proposal, the `PipelineExecutionService/ChangeProposal` is recorded Proposed with tenant and project from the trusted scope and `changeSetRef` from the stored change set, and after the answer it moves to BranchCreated (`BranchPushed`) and PullRequestOpen (`PullRequestOpened`) with `pullRequestRef` recorded (SCN-PipelineExecutionService-003, ADR-0015).",
        "AC2: Given the branch was pushed, when its commits are read from the system of record and from `ProposalCommits`, then every commit carries the trailers `Factory-Run`, `Factory-ChangeSet` and `Factory-Agent` with the run id, the change-set hash and the agent release, so that the proposal is Factory-authored (SCN-PipelineExecutionService-003, XL-10).",
        "AC3: Given the same body repeated under the same `Idempotency-Key`, a different body under that key, a `changeSetHash` that does not match the stored change set, a run and hash already recorded through `PipelineExecutionService/Pipelines.RecordProposal`, or a caller without `factory.delivery.propose`, when `PipelineExecutionService/OpenChangeProposal` is called, then the repeat and the recorded change set return the same proposal and push nothing, the different body is refused with 409, the hash mismatch is refused with a problem response, and the missing scope with 403, each refusal with no state change (SCN-PipelineExecutionService-003, ADR-0014).",
        "AC4: Given the 202 was answered and then the branch policy refuses the push or the system of record is unreachable, when the push runs against a fake Azure DevOps connector, then the `PipelineExecutionService/ChangeProposal` stays Proposed with the reason read through `PipelineExecutionService/GetChangeProposal`, `PipelineExecutionService/ChangeProposalOpened` is not published, and for the unreachable system the pending push is kept and retried once the connector is healthy again and the proposal is opened once (SCN-PipelineExecutionService-003, D135).",
        "AC5: Given ArtifactService is unavailable, when `PipelineExecutionService/OpenChangeProposal` is called, then the call fails fast, no `PipelineExecutionService/ChangeProposal` is written and nothing is pushed, and a repeat under the same key after recovery opens the proposal once (SCN-PipelineExecutionService-003)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/tools/propose-change-set.yaml",
        "docs/reference/schemas/change-set.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-227",
        "AIFACTORY-TASK-5101",
        "AIFACTORY-TASK-5102"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9602,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ArtifactService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "PipelineExecutionService/OpenChangeProposal",
          "PipelineExecutionService/GetChangeProposal",
          "PipelineExecutionService/Pipelines.RecordProposal"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalOpened"
        ],
        "descriptors": [
          "pull-request-proposal-v1",
          "change-set-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-07",
          "XL-10"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-003"
        ]
      },
      "relates": {
        "screens": [
          "proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1280",
        "AIFACTORY-US-1286",
        "AIFACTORY-US-1287",
        "feature:pipeline-execution-service-thin",
        "feature:artifact-service",
        "feature:connector-registry-service-thin"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/tools/propose-change-set.yaml",
        "docs/reference/schemas/change-set.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1276]",
      "number": 1276
    },
    {
      "id": "AIFACTORY-TASK-227",
      "type": "task",
      "parent": "AIFACTORY-US-1276",
      "title": "OpenChangeProposal with an asynchronous push and provenance trailers",
      "sequence": "08.04.02.01",
      "description": "OpenChangeProposal with an asynchronous push and provenance trailers. Expected output: OpenChangeProposal validates the PullRequestProposal body, reads the change set from ArtifactService, refuses a changeSetHash that does not match it, records the proposal Proposed and answers 202; after the answer it pushes the branch with the commit trailers of Delivery:Pipelines:CommitTrailerKeys through the connector port, records ProposalCommits, opens the pull request and applies BranchPushed and PullRequestOpened, the second in the transaction of the ChangeProposalOpened outbox record; a refused push leaves the proposal Proposed with the reason, a push pending on an unreachable system of record is retried when the connector is healthy again, and the idempotent repeat, the 409, the 403, the hash mismatch and the fail-fast on an unavailable ArtifactService are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "OpenChangeProposal validates the PullRequestProposal body, reads the change set from ArtifactService, refuses a changeSetHash that does not match it, records the proposal Proposed and answers 202; after the answer it pushes the branch with the commit trailers of Delivery:Pipelines:CommitTrailerKeys through the connector port, records ProposalCommits, opens the pull request and applies BranchPushed and PullRequestOpened, the second in the transaction of the ChangeProposalOpened outbox record; a refused push leaves the proposal Proposed with the reason, a push pending on an unreachable system of record is retried when the connector is healthy again, and the idempotent repeat, the 409, the 403, the hash mismatch and the fail-fast on an unavailable ArtifactService are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-227]",
      "number": 227
    },
    {
      "id": "AIFACTORY-TASK-5101",
      "type": "task",
      "parent": "AIFACTORY-US-1276",
      "title": "Contract of OpenChangeProposal with its body and problem responses",
      "sequence": "08.04.02.02",
      "description": "Contract of OpenChangeProposal with its body and problem responses. Expected output: The OpenAPI document of the service exposes POST /factory/delivery/proposals with the PullRequestProposal body of docs/reference/schemas/change-set.schema.json and no other member, the Idempotency-Key header, the 202 answer with the proposal location and the problem responses 403, 409 and 412 as model/services/devops-gitops/PipelineExecutionService.yaml lists them, without a stated condition for 412 until the owner names it.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service exposes POST /factory/delivery/proposals with the PullRequestProposal body of docs/reference/schemas/change-set.schema.json and no other member, the Idempotency-Key header, the 202 answer with the proposal location and the problem responses 403, 409 and 412 as model/services/devops-gitops/PipelineExecutionService.yaml lists them, without a stated condition for 412 until the owner names it."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9602,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5101]",
      "number": 5101
    },
    {
      "id": "AIFACTORY-TASK-5102",
      "type": "task",
      "parent": "AIFACTORY-US-1276",
      "title": "Verify open-a-change-proposal through the acceptance suite",
      "sequence": "08.04.02.03",
      "description": "Verify open-a-change-proposal through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1276 against a fake Azure DevOps connector that can accept, refuse by branch policy or be unreachable and recover, and a fake ArtifactService that holds the change set or is unavailable.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1276 against a fake Azure DevOps connector that can accept, refuse by branch policy or be unreachable and recover, and a fake ArtifactService that holds the change set or is unavailable."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5102]",
      "number": 5102
    },
    {
      "id": "AIFACTORY-US-1280",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "List and read change proposals with their commits, reviews, runs and provenance",
      "sequence": "08.04.03",
      "description": "As a reviewer, I want to list the change proposals of my projects and read one with its commits, reviews, pipeline runs and provenance, so that I can follow what the Factory proposed in the system of record without leaving the Factory. A caller whose scope carries `factory.delivery.read` (Requester, Reviewer, Operator, Platform admin or Observer) lists change proposals through `PipelineExecutionService/ListChangeProposals`, filtered by project, run, repository and state, each with its pull-request reference, and reads one proposal through `PipelineExecutionService/GetChangeProposal` with its commits and their trailers, its reviewers, the pipeline runs that name it and its provenance to the run, the attempt, the agent release and the change-set artifact. The tenant comes from the trusted scope of the call and the list holds only the proposals of that tenant and of the projects in scope; the index `IX_Proposals_Repo_State` serves the repository and state filter and `IX_Proposals_Run` the run filter. Every query runs under the tenant row filter, so a proposal of another tenant never appears in a list and is not found when addressed: the read answers 404, the same answer as for a `proposalId` that does not exist, and never confirms that it exists (ADR-0015). A caller without the scope is refused with 403. Nothing is written by these reads and no event is published. The routes are reached through the DeliveryHost gateway; StudioBff renders them in its own increment and the CLI reads them. Kind: behavior. Traces: services: PipelineExecutionService; aggregates: PipelineExecutionService/ChangeProposal; apis: PipelineExecutionService/ListChangeProposals, PipelineExecutionService/GetChangeProposal; adrs: ADR-0015; requirements: FUX-05; scenarios: SCN-PipelineExecutionService-001, SCN-PipelineExecutionService-002. Relates: screens: proposals. Depends on: AIFACTORY-US-1286, AIFACTORY-US-1287. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given proposals of several projects, runs, repositories and states in my tenant and in another tenant, when `PipelineExecutionService/ListChangeProposals` is called with a project, a run, a repository or a state filter, then the response is 200 with only the matching proposals of my tenant and projects in scope, each with its state and pull-request reference, and proposals of the other tenant never appear (SCN-PipelineExecutionService-001, ADR-0015).",
        "AC2: Given a `PipelineExecutionService/ChangeProposal` of my tenant and project with commits, reviewers and pipeline runs, when `PipelineExecutionService/GetChangeProposal` is called, then the response is 200 with its commits and trailers, its reviewers, the runs that name it and the provenance `runId`, `attemptId`, `agentReleaseId` and `changeSetRef` (SCN-PipelineExecutionService-002).",
        "AC3: Given a caller without `factory.delivery.read`, or a `proposalId` that exists only in another tenant or not at all, when `PipelineExecutionService/ListChangeProposals` or `PipelineExecutionService/GetChangeProposal` is called, then the response is 403 for the missing scope and 404 for the foreign or unknown proposal, each with a problem response and no state change (SCN-PipelineExecutionService-001, SCN-PipelineExecutionService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5107",
        "AIFACTORY-TASK-5108"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9603,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "PipelineExecutionService/ListChangeProposals",
          "PipelineExecutionService/GetChangeProposal"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-05"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-001",
          "SCN-PipelineExecutionService-002"
        ]
      },
      "relates": {
        "screens": [
          "proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1286",
        "AIFACTORY-US-1287"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1280]",
      "number": 1280
    },
    {
      "id": "AIFACTORY-TASK-5107",
      "type": "task",
      "parent": "AIFACTORY-US-1280",
      "title": "ListChangeProposals and GetChangeProposal under the tenant row filter",
      "sequence": "08.04.03.01",
      "description": "ListChangeProposals and GetChangeProposal under the tenant row filter. Expected output: ListChangeProposals filters by project, run, repository and state over the indexes of ChangeProposals and returns pull-request references; GetChangeProposal returns commits, reviewers, linked pipeline runs and provenance; both apply the tenant row filter so a foreign proposal is answered 404 like an unknown one, and a missing scope is 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "ListChangeProposals filters by project, run, repository and state over the indexes of ChangeProposals and returns pull-request references; GetChangeProposal returns commits, reviewers, linked pipeline runs and provenance; both apply the tenant row filter so a foreign proposal is answered 404 like an unknown one, and a missing scope is 403."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5107]",
      "number": 5107
    },
    {
      "id": "AIFACTORY-TASK-5108",
      "type": "task",
      "parent": "AIFACTORY-US-1280",
      "title": "Verify read-change-proposals through the acceptance suite",
      "sequence": "08.04.03.02",
      "description": "Verify read-change-proposals through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-001|Scenario=SCN-PipelineExecutionService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1280 over a two-tenant fixture.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-001|Scenario=SCN-PipelineExecutionService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1280 over a two-tenant fixture."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5108]",
      "number": 5108
    },
    {
      "id": "AIFACTORY-US-1281",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "Mirror the review state of a proposal from verified deliveries and announce every change",
      "sequence": "08.04.04",
      "description": "As a reviewer, I want the review and pull-request state of a Factory proposal to follow the system of record, so that an approval bound to a superseded proposal version becomes stale and nobody reads an outdated state. The system of record is the truth of branches, commits and pull requests; the proposal mirrors it and never the other way round. The inbox handler `ApplyDelivery` takes `DeliveryReceived` of ConnectorRegistryService, the verified webhooks of Azure DevOps and GitHub, which feature connector-registry-service-deliveries delivers for Azure DevOps in I2 (D135), and the `DeliveryApplier` worker maps a pull-request, review or push delivery to the proposal it names; an unknown reference is looked up through `Connectors.ReadPullRequest` of that feature. The worker is idempotent on `deliveryId`, retries exponentially five times with a backoff of 30 seconds and runs at most four in parallel, partitioned by repository, so a repeated delivery changes nothing. From PullRequestOpen a review that requests changes moves the proposal to ChangesRequested (`ReviewRequestedChanges`), new commits move it back to PullRequestOpen (`NewCommits`) and are recorded in `ProposalCommits` with their trailers, an approving review moves it to Approved (`ReviewApproved`), and a closed pull request moves it to Abandoned (`Closed`). Every such transition writes `ChangeProposalStateChanged` with `proposalId`, `tenantId`, `runId`, `fromState` and `toState` in the same transaction, and the dispatcher publishes it on `pipelines.proposals.v1.change-proposal-state-changed` under the run event envelope, retrying with backoff so it is neither lost nor duplicated (ADR-0012, ADR-0014). RunControlService marks a pending approval bound to a superseded version Stale from this event, and StudioBff and DashboardService project it, each in its own suite. A delivery whose transition the model does not draw from the current state changes no state. The inbox handler `LinkValidation` takes `ArtifactValidated` of ArtifactService, the local validator results of a change set before it is proposed, idempotent on the event id. In the modelled order these results arrive before any proposal exists: they are kept by change set and attached to the proposal whose `changeSetRef` names that change set when it is opened, and results that arrive after the opening are linked at once. No modelled table stores validation results before a proposal exists, an open point reported to the owner. The opening transitions and `ChangeProposalOpened` stay as the thin delivery built them, and the merge is AIFACTORY-US-1282. The deliveries and the pull-request read reach this service from ConnectorRegistryService in I2, so the behaviour is proven against recorded deliveries and the connector read of that feature. Kind: behavior. Traces: services: PipelineExecutionService, ConnectorRegistryService, ArtifactService; aggregates: PipelineExecutionService/ChangeProposal; apis: ConnectorRegistryService/Connectors.ReadPullRequest; events: PipelineExecutionService/ChangeProposalStateChanged, ConnectorRegistryService/DeliveryReceived, ArtifactService/ArtifactValidated; adrs: ADR-0012, ADR-0014; requirements: FR-07, XL-04; scenarios: SCN-PipelineExecutionService-009. Relates: screens: proposals. Depends on: AIFACTORY-US-1286, AIFACTORY-US-1287, feature:connector-registry-service-thin, feature:connector-registry-service-deliveries, feature:artifact-service. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, model/services/integration/ConnectorRegistryService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a `PipelineExecutionService/ChangeProposal` in PullRequestOpen, when `ConnectorRegistryService/DeliveryReceived` announces a review that requests changes, new commits after it, an approving review, or a closed pull request, then the proposal moves to ChangesRequested, back to PullRequestOpen with the new commits recorded, to Approved, or to Abandoned, and `PipelineExecutionService/ChangeProposalStateChanged` with `fromState` and `toState` is written in the same transaction as each move (SCN-PipelineExecutionService-009, ADR-0014).",
        "AC2: Given the outbox record, when the dispatcher publishes `PipelineExecutionService/ChangeProposalStateChanged` on `pipelines.proposals.v1.change-proposal-state-changed`, then the event is sent under the run event envelope with `proposalId`, `tenantId`, `runId`, `fromState` and `toState`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-PipelineExecutionService-009, ADR-0012).",
        "AC3: Given the same delivery delivered twice, a delivery that names a transition the model does not draw from the current state, or a delivery that names an unknown pull request, when the `DeliveryApplier` runs, then the repeat changes nothing, the undrawn transition changes no state and publishes nothing, and the unknown reference is looked up through `ConnectorRegistryService/Connectors.ReadPullRequest` before it is applied or dropped (SCN-PipelineExecutionService-009, D135).",
        "AC4: Given `ArtifactService/ArtifactValidated` for a change set that no `PipelineExecutionService/ChangeProposal` names yet, when `LinkValidation` runs and the proposal of that change set is opened later, then the validator results are kept by change set and attached to the proposal whose `changeSetRef` names it at its opening; given the proposal already exists, they are linked at once; and a redelivery of the same event id links nothing twice (model/services/devops-gitops/PipelineExecutionService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5109",
        "AIFACTORY-TASK-5110",
        "AIFACTORY-TASK-5111"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9604,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ConnectorRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "ConnectorRegistryService/Connectors.ReadPullRequest"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalStateChanged",
          "ConnectorRegistryService/DeliveryReceived",
          "ArtifactService/ArtifactValidated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-07",
          "XL-04"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-009"
        ]
      },
      "relates": {
        "screens": [
          "proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1286",
        "AIFACTORY-US-1287",
        "feature:connector-registry-service-thin",
        "feature:connector-registry-service-deliveries",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1281]",
      "number": 1281
    },
    {
      "id": "AIFACTORY-TASK-5109",
      "type": "task",
      "parent": "AIFACTORY-US-1281",
      "title": "DeliveryApplier for pull-request, review and push deliveries",
      "sequence": "08.04.04.01",
      "description": "DeliveryApplier for pull-request, review and push deliveries. Expected output: The ApplyDelivery handler and the DeliveryApplier worker apply ReviewRequestedChanges, NewCommits, ReviewApproved and Closed from the states the model draws, record new commits in ProposalCommits, write ChangeProposalStateChanged in the transaction of each transition, look up unknown references through Connectors.ReadPullRequest and deduplicate on deliveryId with the modelled retry and partitioning.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The ApplyDelivery handler and the DeliveryApplier worker apply ReviewRequestedChanges, NewCommits, ReviewApproved and Closed from the states the model draws, record new commits in ProposalCommits, write ChangeProposalStateChanged in the transaction of each transition, look up unknown references through Connectors.ReadPullRequest and deduplicate on deliveryId with the modelled retry and partitioning."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5109]",
      "number": 5109
    },
    {
      "id": "AIFACTORY-TASK-5110",
      "type": "task",
      "parent": "AIFACTORY-US-1281",
      "title": "LinkValidation inbox handler for ArtifactValidated",
      "sequence": "08.04.04.02",
      "description": "LinkValidation inbox handler for ArtifactValidated. Expected output: The handler of ArtifactValidated keeps the validator results of a change set that no proposal names yet and attaches them to the proposal whose changeSetRef names it when that proposal is opened, links them at once to an existing proposal, and is idempotent on the event id through the inbox of the pipeline-execution profile.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The handler of ArtifactValidated keeps the validator results of a change set that no proposal names yet and attaches them to the proposal whose changeSetRef names it when that proposal is opened, links them at once to an existing proposal, and is idempotent on the event id through the inbox of the pipeline-execution profile."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5110]",
      "number": 5110
    },
    {
      "id": "AIFACTORY-TASK-5111",
      "type": "task",
      "parent": "AIFACTORY-US-1281",
      "title": "Verify mirror-proposal-review-state through the acceptance suite",
      "sequence": "08.04.04.03",
      "description": "Verify mirror-proposal-review-state through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1281 over recorded DeliveryReceived and ArtifactValidated events, ArtifactValidated before and after the opening of the proposal, a duplicate delivery and a recorded answer of Connectors.ReadPullRequest for an unknown reference.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1281 over recorded DeliveryReceived and ArtifactValidated events, ArtifactValidated before and after the opening of the proposal, a duplicate delivery and a recorded answer of Connectors.ReadPullRequest for an unknown reference."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5111]",
      "number": 5111
    },
    {
      "id": "AIFACTORY-US-1282",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "Record the merge of an approved proposal with its merged commit and announce it",
      "sequence": "08.04.05",
      "description": "A merge is a decision taken in the system of record by a person or a branch policy: no modelled operation of the service merges, and the model forbids an auto-merge to a protected branch without an approval of class shared-write recorded by the service. When `DeliveryReceived` of ConnectorRegistryService announces that the pull request of an Approved `ChangeProposal` was merged, the `DeliveryApplier` moves the proposal to Merged (trigger `Merged`), records `mergedCommit`, and writes in the same transaction `ChangeProposalStateChanged` from Approved to Merged and `ChangeProposalMerged` with `proposalId`, `tenantId`, `projectId`, `runId` and `mergedCommit`. The dispatcher publishes `ChangeProposalMerged` on `pipelines.proposals.v1.change-proposal-merged` under the run event envelope and retries a transport outage with backoff, so the event is neither lost nor duplicated (ADR-0012). The histogram `connectsoft.factory.delivery.merge_lead_time` records the time from proposal to merge, the agent-success signal for code changes. ReleaseService links the merged proposal to the next release (`LinkProposal`), RunControlService records the merged commit on the binding of the proposal to its run (`BindChangeProposal`, AIFACTORY-US-1606 of feature run-control-service), and WorkflowEngineService, GenerationRecipeService, RepositoryIntelligenceService, AuditService, FeedbackService and StudioBff consume it, each proven in its own suite. A merge delivered twice changes nothing. The model draws the merge only from Approved: a merge that the system of record reports for a proposal still in PullRequestOpen or ChangesRequested, as when a branch policy needs no review, has no transition, changes no state and is reported to the owner as an open point. Kind: behavior. Traces: services: PipelineExecutionService, ConnectorRegistryService; aggregates: PipelineExecutionService/ChangeProposal; events: PipelineExecutionService/ChangeProposalMerged, PipelineExecutionService/ChangeProposalStateChanged, ConnectorRegistryService/DeliveryReceived; adrs: ADR-0012, ADR-0014; requirements: FR-07, XL-10; scenarios: SCN-PipelineExecutionService-010. Depends on: AIFACTORY-US-1281, feature:connector-registry-service-deliveries. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given an Approved `PipelineExecutionService/ChangeProposal`, when `ConnectorRegistryService/DeliveryReceived` announces the merge of its pull request, then the proposal moves to Merged with `mergedCommit`, and `PipelineExecutionService/ChangeProposalStateChanged` and `PipelineExecutionService/ChangeProposalMerged` are written in the same transaction (SCN-PipelineExecutionService-010, ADR-0014).",
        "AC2: Given the outbox record, when the dispatcher publishes `PipelineExecutionService/ChangeProposalMerged` on `pipelines.proposals.v1.change-proposal-merged`, then the event is sent under the run event envelope with `proposalId`, `tenantId`, `projectId`, `runId` and `mergedCommit`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-PipelineExecutionService-010, ADR-0012).",
        "AC3: Given a merge delivery repeated, or a merge reported for a proposal in PullRequestOpen or ChangesRequested, when the `DeliveryApplier` runs, then the repeat changes nothing and the undrawn merge changes no state and publishes nothing, and no operation of the service ever merges a pull request (SCN-PipelineExecutionService-010, model/services/devops-gitops/PipelineExecutionService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5112",
        "AIFACTORY-TASK-5113"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9605,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalMerged",
          "PipelineExecutionService/ChangeProposalStateChanged",
          "ConnectorRegistryService/DeliveryReceived"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-07",
          "XL-10"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-010"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1281",
        "feature:connector-registry-service-deliveries"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1282]",
      "number": 1282
    },
    {
      "id": "AIFACTORY-TASK-5112",
      "type": "task",
      "parent": "AIFACTORY-US-1282",
      "title": "Merged transition with ChangeProposalMerged and the merge lead time",
      "sequence": "08.04.05.01",
      "description": "Merged transition with ChangeProposalMerged and the merge lead time. Expected output: The DeliveryApplier applies Merged only from Approved, records mergedCommit, writes ChangeProposalStateChanged and ChangeProposalMerged in one transaction, publishes ChangeProposalMerged on its topic under the run event envelope and records connectsoft.factory.delivery.merge_lead_time; a merge reported from another state changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The DeliveryApplier applies Merged only from Approved, records mergedCommit, writes ChangeProposalStateChanged and ChangeProposalMerged in one transaction, publishes ChangeProposalMerged on its topic under the run event envelope and records connectsoft.factory.delivery.merge_lead_time; a merge reported from another state changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5112]",
      "number": 5112
    },
    {
      "id": "AIFACTORY-TASK-5113",
      "type": "task",
      "parent": "AIFACTORY-US-1282",
      "title": "Verify record-a-merged-proposal through the acceptance suite",
      "sequence": "08.04.05.02",
      "description": "Verify record-a-merged-proposal through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-010\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1282 with a transport that can be stopped; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-010\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1282 with a transport that can be stopped; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5113]",
      "number": 5113
    },
    {
      "id": "AIFACTORY-US-1283",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "Mirror pipeline runs with stages and typed results and announce their start and completion",
      "sequence": "08.04.06",
      "description": "When `DeliveryReceived` of ConnectorRegistryService announces a pipeline-run delivery, the `DeliveryApplier` records a `PipelineRun` once per tenant, system and external run reference (unique index `UX_PipelineRuns_External`) with its `definitionRef`, the pipeline definition the Factory generated from the pipeline blueprint, its commit, the proposal whose commits contain that commit and its stages, and writes `PipelineRunStarted` with `pipelineRunId`, `tenantId`, `projectId`, `commit` and the optional `proposalId` in the same transaction. When the run ends, the delivery sets the state Succeeded, Failed, Cancelled or PartiallySucceeded and `completedAt`, records one `PipelineResult` per result kind with `passed`, a summary of counts, percentages or severities and the artifact reference of the report, and writes `PipelineRunCompleted` with `state` and `results` in the same transaction. No request of the service starts a pipeline run, so the run correlation comes from the proposal: the `PipelineRun` takes the `runId` and the `stepRunId` that `Pipelines.RecordProposal` recorded on the proposal whose commits contain its commit (AIFACTORY-US-1277 of feature `pipeline-execution-service-thin`), and `PipelineRunCompleted` echoes them as optional members, absent when no run requested the proposal (D141). Results are receipts: logs and reports live in ArtifactService, never in the store. Both events are published under the run event envelope on `pipelines.runs.v1.pipeline-run-started` and `pipelines.runs.v1.pipeline-run-completed`, retried with backoff so neither is lost nor duplicated (ADR-0012). The run takes the state the system of record reported, because a run's state comes from a verified delivery or a connector read and is never assumed; a run may report Succeeded with a failed result, for example a failed step allowed to continue, so each failed result is recorded with `passed` false, its kind and its summary, and consumers judge readiness from the typed results. ReleaseService assembles a candidate from a succeeded run, RunControlService settles the step that waits for the pipeline run (`SettleWaitingStep`, AIFACTORY-US-1608 of this feature), WorkflowEngineService correlates it for the delivery run, and TemplateRegistryService, QualityScoreService, AuditService, StudioBff and DashboardService consume it, each in its own suite. The counter `connectsoft.factory.delivery.pipeline_runs` and the histogram `connectsoft.factory.delivery.pipeline_duration` record every completion. A repeated delivery changes nothing. The model gives `PipelineRun` no drawn transitions, so the order Queued or Running before a terminal state is read from `PipelineRunState`; `DeliveryReceived` with the pipeline-run deliveries of Azure DevOps arrives in I2 with feature connector-registry-service-deliveries (D135). Kind: behavior. Traces: services: PipelineExecutionService, ConnectorRegistryService, ArtifactService; aggregates: PipelineExecutionService/PipelineRun; events: PipelineExecutionService/PipelineRunStarted, PipelineExecutionService/PipelineRunCompleted, ConnectorRegistryService/DeliveryReceived; adrs: ADR-0012, ADR-0014; requirements: FR-07, XL-04; scenarios: SCN-PipelineExecutionService-011, SCN-PipelineExecutionService-012. Relates: screens: pipeline-runs. Depends on: AIFACTORY-US-1286, AIFACTORY-US-1287, feature:connector-registry-service-deliveries. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a pipeline-run delivery for a commit of a merged proposal, when the `DeliveryApplier` applies it, then one `PipelineExecutionService/PipelineRun` exists for the tenant, system and external run reference with its definition, commit, proposal and stages, and `PipelineExecutionService/PipelineRunStarted` is written in the same transaction and published under the run event envelope with `pipelineRunId`, `tenantId`, `projectId`, `commit` and `proposalId` (SCN-PipelineExecutionService-011, ADR-0014).",
        "AC2: Given the completion delivery of that run, when it is applied, then the run takes its terminal state and `completedAt`, one result per kind is recorded with `passed`, summary and artifact reference, and `PipelineExecutionService/PipelineRunCompleted` is written in the same transaction and published with `pipelineRunId`, `tenantId`, `projectId`, `commit`, `state` and `results`, and with the `runId` and the `stepRunId` of the proposal of the commit when a run requested it and without them otherwise (SCN-PipelineExecutionService-012, D141).",
        "AC3: Given a run whose security scan or tests failed, when its completion is applied, then the run takes the state the system of record reported, each failed result is recorded with `passed` false, its kind and its summary, and `PipelineExecutionService/PipelineRunCompleted` carries those results so that consumers judge readiness from them (SCN-PipelineExecutionService-012, FR-07).",
        "AC4: Given a delivery repeated or the transport unavailable at dispatch, when the worker and the dispatcher run, then no second run, result or event is written, and each event is published once after recovery, neither lost nor duplicated under its event id (SCN-PipelineExecutionService-011, SCN-PipelineExecutionService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-317",
        "AIFACTORY-TASK-5114"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9606,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ConnectorRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "PipelineExecutionService/PipelineRun"
        ],
        "events": [
          "PipelineExecutionService/PipelineRunStarted",
          "PipelineExecutionService/PipelineRunCompleted",
          "ConnectorRegistryService/DeliveryReceived"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-07",
          "XL-04"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-011",
          "SCN-PipelineExecutionService-012"
        ]
      },
      "relates": {
        "screens": [
          "pipeline-runs"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1286",
        "AIFACTORY-US-1287",
        "feature:connector-registry-service-deliveries"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1283]",
      "number": 1283
    },
    {
      "id": "AIFACTORY-TASK-317",
      "type": "task",
      "parent": "AIFACTORY-US-1283",
      "title": "Pipeline run intake from the system of record",
      "sequence": "08.04.06.01",
      "description": "Pipeline run intake from the system of record. Expected output: Verified pipeline-run deliveries become PipelineRuns with stages and one PipelineResult per kind with artifact references, with the RunId and StepRunId of the proposal of the commit when the proposal names them (D141); PipelineRunStarted and PipelineRunCompleted are written in the transaction of the change they announce; the run state is the one the delivery reported and every failed result carries passed false; a repeated delivery changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Verified pipeline-run deliveries become PipelineRuns with stages and one PipelineResult per kind with artifact references, with the RunId and StepRunId of the proposal of the commit when the proposal names them (D141); PipelineRunStarted and PipelineRunCompleted are written in the transaction of the change they announce; the run state is the one the delivery reported and every failed result carries passed false; a repeated delivery changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9606,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-317]",
      "number": 317
    },
    {
      "id": "AIFACTORY-TASK-5114",
      "type": "task",
      "parent": "AIFACTORY-US-1283",
      "title": "Verify mirror-pipeline-runs through the acceptance suite",
      "sequence": "08.04.06.02",
      "description": "Verify mirror-pipeline-runs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-011|Scenario=SCN-PipelineExecutionService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1283 over recorded deliveries of a passing run and of a run with a failed security scan, and PipelineRunCompleted with and without the runId and stepRunId of a proposal (D141); consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-011|Scenario=SCN-PipelineExecutionService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1283 over recorded deliveries of a passing run and of a run with a failed security scan, and PipelineRunCompleted with and without the runId and stepRunId of a proposal (D141); consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9606,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5114]",
      "number": 5114
    },
    {
      "id": "AIFACTORY-US-1284",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "List and read pipeline runs with their stages and typed results",
      "sequence": "08.04.07",
      "description": "A caller whose scope carries `factory.delivery.read` lists pipeline runs through `PipelineExecutionService/ListPipelineRuns`, filtered by project, commit, proposal and state, and reads one run through `PipelineExecutionService/GetPipelineRun` with its stages and its typed results, each with `kind`, `passed`, summary and the artifact reference of its report or log in ArtifactService. The tenant comes from the trusted scope and the list holds only the runs of that tenant and of the projects in scope; the index `IX_PipelineRuns_Commit` serves the commit filter. Every query runs under the tenant row filter, so a run of another tenant never appears and is answered 404 when addressed, the same answer as for a `pipelineRunId` that does not exist (ADR-0015). A caller without the scope is refused with 403. A failed result is named so that a reader never takes a failed gate for a pass. Nothing is written and nothing is published by these reads. The routes are reached through the DeliveryHost gateway and read by the CLI; StudioBff renders them in its own increment. Kind: behavior. Traces: services: PipelineExecutionService; aggregates: PipelineExecutionService/PipelineRun; apis: PipelineExecutionService/ListPipelineRuns, PipelineExecutionService/GetPipelineRun; adrs: ADR-0015; requirements: FUX-06; scenarios: SCN-PipelineExecutionService-004, SCN-PipelineExecutionService-005. Relates: screens: pipeline-runs. Depends on: AIFACTORY-US-1283. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given runs of several projects, commits, proposals and states in my tenant and in another tenant, when `PipelineExecutionService/ListPipelineRuns` is called with a filter, then the response is 200 with only the matching runs of my tenant and projects in scope and runs of the other tenant never appear (SCN-PipelineExecutionService-004, ADR-0015).",
        "AC2: Given a `PipelineExecutionService/PipelineRun` of my tenant and project with stages and results, when `PipelineExecutionService/GetPipelineRun` is called, then the response is 200 with its stages and each typed result with `kind`, `passed`, summary and artifact reference, a failed result named (SCN-PipelineExecutionService-005).",
        "AC3: Given a caller without `factory.delivery.read`, or a `pipelineRunId` that exists only in another tenant or not at all, when either route is called, then the response is 403 for the missing scope and 404 for the foreign or unknown run, each with a problem response and no state change (SCN-PipelineExecutionService-004, SCN-PipelineExecutionService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5115",
        "AIFACTORY-TASK-5116"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9607,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService"
        ],
        "aggregates": [
          "PipelineExecutionService/PipelineRun"
        ],
        "apis": [
          "PipelineExecutionService/ListPipelineRuns",
          "PipelineExecutionService/GetPipelineRun"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-06"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-004",
          "SCN-PipelineExecutionService-005"
        ]
      },
      "relates": {
        "screens": [
          "pipeline-runs"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1283"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1284]",
      "number": 1284
    },
    {
      "id": "AIFACTORY-TASK-5115",
      "type": "task",
      "parent": "AIFACTORY-US-1284",
      "title": "ListPipelineRuns and GetPipelineRun under the tenant row filter",
      "sequence": "08.04.07.01",
      "description": "ListPipelineRuns and GetPipelineRun under the tenant row filter. Expected output: ListPipelineRuns filters by project, commit, proposal and state; GetPipelineRun returns stages and every PipelineResult with kind, passed, summary and artifact reference; both apply the tenant row filter so a foreign run is answered 404 like an unknown one, and a missing scope is 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "ListPipelineRuns filters by project, commit, proposal and state; GetPipelineRun returns stages and every PipelineResult with kind, passed, summary and artifact reference; both apply the tenant row filter so a foreign run is answered 404 like an unknown one, and a missing scope is 403."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9607,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5115]",
      "number": 5115
    },
    {
      "id": "AIFACTORY-TASK-5116",
      "type": "task",
      "parent": "AIFACTORY-US-1284",
      "title": "Verify read-pipeline-runs through the acceptance suite",
      "sequence": "08.04.07.02",
      "description": "Verify read-pipeline-runs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-004|Scenario=SCN-PipelineExecutionService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1284 over a two-tenant fixture.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PipelineExecutionService-004|Scenario=SCN-PipelineExecutionService-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1284 over a two-tenant fixture."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9607,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5116]",
      "number": 5116
    },
    {
      "id": "AIFACTORY-US-1285",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "Reconcile runs and proposals whose deliveries were missed, on schedule and on an Operator request",
      "sequence": "08.04.08",
      "description": "As an operator, I want a run or a proposal whose delivery was missed read again from the system of record, so that no state is assumed and a missing completion never blocks a release silently. A missing final delivery is reconciled by a read, never assumed. The `RunReconciler` worker runs every ten minutes, partitioned by tenant with at most four in parallel, and polls through `Connectors.ReadPipelineRun` and `Connectors.ReadPullRequest` of the Azure DevOps connector, read-class calls delivered in I2 by feature connector-registry-service-deliveries (D135), every run still non-terminal after `Delivery:Pipelines:ReconcileAfterMinutes` (60 by default, reloadable) and every proposal without a terminal state older than that threshold. A run found ended takes its terminal state and results and writes `PipelineRunCompleted`; a proposal found moved takes the transitions the model draws and writes `ChangeProposalStateChanged`, each in the transaction of its change. The worker is idempotent on `pipelineRunId` and window and retries three times with a fixed backoff of 120 seconds. An Operator whose scope carries `factory.delivery.operate` asks for the same read of one run through `PipelineExecutionService/ReconcilePipelineRun`; the answer is 202 and the result is observed through the run, not assumed. A run already terminal is read again and changes nothing, so a repeated request has one effect at most. A caller without the scope is refused with 403; a run of another tenant is answered 404, the same answer as for a run that does not exist (ADR-0015). When the system of record is unreachable the run and the proposal keep their state, nothing is marked done without a receipt and the next schedule tries again. The reconciler is proven against recorded answers of the two connector reads. Kind: behavior. Traces: services: PipelineExecutionService, ConnectorRegistryService; aggregates: PipelineExecutionService/PipelineRun, PipelineExecutionService/ChangeProposal; apis: PipelineExecutionService/ReconcilePipelineRun, ConnectorRegistryService/Connectors.ReadPipelineRun, ConnectorRegistryService/Connectors.ReadPullRequest; events: PipelineExecutionService/PipelineRunCompleted, PipelineExecutionService/ChangeProposalStateChanged; adrs: ADR-0014, ADR-0015; requirements: NFR-08; scenarios: SCN-PipelineExecutionService-006. Relates: screens: pipeline-runs. Depends on: AIFACTORY-US-1281, AIFACTORY-US-1283, feature:connector-registry-service-deliveries. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a `PipelineExecutionService/PipelineRun` still Running after `Delivery:Pipelines:ReconcileAfterMinutes` whose completion delivery was missed, when the `RunReconciler` runs, then the run is read through `ConnectorRegistryService/Connectors.ReadPipelineRun`, takes its terminal state and results, and `PipelineExecutionService/PipelineRunCompleted` is written once in the transaction of the change; a second pass in the same window writes nothing (SCN-PipelineExecutionService-006, ADR-0014).",
        "AC2: Given a `PipelineExecutionService/ChangeProposal` without a terminal state older than the threshold whose review delivery was missed, when the `RunReconciler` runs, then the transitions the model draws are applied from the read and `PipelineExecutionService/ChangeProposalStateChanged` is written for each (model/services/devops-gitops/PipelineExecutionService.yaml).",
        "AC3: Given an Operator with `factory.delivery.operate` and a run of the Operator's tenant and project, when `PipelineExecutionService/ReconcilePipelineRun` is called, then the response is 202, the run is read from the system of record and its observed state is recorded once, `PipelineExecutionService/PipelineRunCompleted` is written once in the transaction of the change when the reconciled run is found ended, and a run already terminal changes nothing and publishes nothing (SCN-PipelineExecutionService-006).",
        "AC4: Given a caller without `factory.delivery.operate`, a run of another tenant or an unknown run, or a system of record that is unreachable, when `PipelineExecutionService/ReconcilePipelineRun` is called or the worker runs, then the answer is 403, 404 for the foreign and the unknown run alike, and for the unreachable system no state changes and nothing is published until a later read succeeds (SCN-PipelineExecutionService-006, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-318",
        "AIFACTORY-TASK-5117",
        "AIFACTORY-TASK-5118"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9608,
      "kind": "behavior",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "PipelineExecutionService/PipelineRun",
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "PipelineExecutionService/ReconcilePipelineRun",
          "ConnectorRegistryService/Connectors.ReadPipelineRun",
          "ConnectorRegistryService/Connectors.ReadPullRequest"
        ],
        "events": [
          "PipelineExecutionService/PipelineRunCompleted",
          "PipelineExecutionService/ChangeProposalStateChanged"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "NFR-08"
        ],
        "scenarios": [
          "SCN-PipelineExecutionService-006"
        ]
      },
      "relates": {
        "screens": [
          "pipeline-runs"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1281",
        "AIFACTORY-US-1283",
        "feature:connector-registry-service-deliveries"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1285]",
      "number": 1285
    },
    {
      "id": "AIFACTORY-TASK-318",
      "type": "task",
      "parent": "AIFACTORY-US-1285",
      "title": "Reconciler for missed deliveries",
      "sequence": "08.04.08.01",
      "description": "Reconciler for missed deliveries. Expected output: The RunReconciler reads, every ten minutes and per tenant, the runs and proposals still open after Delivery:Pipelines:ReconcileAfterMinutes through the connector, applies only the transitions the model draws, writes PipelineRunCompleted or ChangeProposalStateChanged with each change, keys its work by pipelineRunId and window and leaves state unchanged when the system of record is unreachable.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "The RunReconciler reads, every ten minutes and per tenant, the runs and proposals still open after Delivery:Pipelines:ReconcileAfterMinutes through the connector, applies only the transitions the model draws, writes PipelineRunCompleted or ChangeProposalStateChanged with each change, keys its work by pipelineRunId and window and leaves state unchanged when the system of record is unreachable."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9608,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-318]",
      "number": 318
    },
    {
      "id": "AIFACTORY-TASK-5117",
      "type": "task",
      "parent": "AIFACTORY-US-1285",
      "title": "ReconcilePipelineRun route for the Operator",
      "sequence": "08.04.08.02",
      "description": "ReconcilePipelineRun route for the Operator. Expected output: POST /factory/delivery/pipeline-runs/{pipelineRunId}/reconcile reads the run through the connector under factory.delivery.operate, answers 202, records the observed state once, changes nothing for a terminal run and answers 403 or 404 as the model lists, a foreign run like an unknown one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "POST /factory/delivery/pipeline-runs/{pipelineRunId}/reconcile reads the run through the connector under factory.delivery.operate, answers 202, records the observed state once, changes nothing for a terminal run and answers 403 or 404 as the model lists, a foreign run like an unknown one."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9608,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5117]",
      "number": 5117
    },
    {
      "id": "AIFACTORY-TASK-5118",
      "type": "task",
      "parent": "AIFACTORY-US-1285",
      "title": "Verify reconcile-missed-deliveries through the acceptance suite",
      "sequence": "08.04.08.03",
      "description": "Verify reconcile-missed-deliveries through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1285 with recorded answers of Connectors.ReadPipelineRun and Connectors.ReadPullRequest that report a finished run, a moved proposal or nothing, and a clock moved past the threshold.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PipelineExecutionService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1285 with recorded answers of Connectors.ReadPipelineRun and Connectors.ReadPullRequest that report a finished run, a moved proposal or nothing, and a clock moved past the threshold."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9608,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5118]",
      "number": 5118
    },
    {
      "id": "AIFACTORY-US-1286",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "Complete the domain model and the store of PipelineExecutionService",
      "sequence": "08.04.09",
      "description": "The complete delivery extends the thin domain model and store in the same repository. The `ChangeProposal` aggregate gains every transition of `ProposalState` the model draws, `ReviewRequestedChanges`, `NewCommits`, `ReviewApproved`, `Merged` and `Closed`, beside the opening transitions `BranchPushed` and `PullRequestOpened`, and keeps its three invariants: the system of record is the truth, a Factory-authored commit carries its trailers, and the Factory never merges without a recorded approval. The `PipelineRun` aggregate arrives with its `PipelineResult` entities, the states of `PipelineRunState`, the result kinds of `ResultKind` and its two invariants: results are receipts with artifact references, and a state comes from a verified delivery or a connector read and is never assumed. The store `pipeline-execution-sql` gains the tables `PipelineRuns` and `PipelineResults` with the unique index `UX_PipelineRuns_External`, the index `IX_PipelineRuns_Commit`, the foreign key from a run to its proposal and the tenant filter on every table; a migration adds them to the store of the thin delivery without touching its rows. Mapping tests run against an isolated test database. When the store is lost it is restored from backup within the recovery point of 15 minutes and receipts can be re-pulled from the system of record through the connectors. Kind: enabling. Traces: services: PipelineExecutionService; aggregates: PipelineExecutionService/ChangeProposal, PipelineExecutionService/PipelineRun; adrs: ADR-0014, ADR-0015. Depends on: feature:pipeline-execution-service-thin. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given the domain model, when its unit tests run, then the `PipelineExecutionService/ChangeProposal` applies each of its seven drawn transitions from its source state only and refuses every other move, and the `PipelineExecutionService/PipelineRun` refuses a result without a kind or a state that no delivery or read announced (ADR-0014).",
        "AC2: Given the store of the thin delivery with proposals in it, when the migration of the complete delivery runs, then `PipelineRuns` and `PipelineResults` exist with their keys, indexes, foreign key and tenant filter, the existing proposal rows are unchanged, and the mapping tests pass against an isolated test database (ADR-0015, model/services/devops-gitops/PipelineExecutionService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-255",
        "AIFACTORY-TASK-256",
        "AIFACTORY-TASK-5119"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9609,
      "kind": "enabling",
      "traces": {
        "services": [
          "PipelineExecutionService"
        ],
        "aggregates": [
          "PipelineExecutionService/ChangeProposal",
          "PipelineExecutionService/PipelineRun"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:pipeline-execution-service-thin"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-1286]",
      "number": 1286
    },
    {
      "id": "AIFACTORY-TASK-255",
      "type": "task",
      "parent": "AIFACTORY-US-1286",
      "title": "Domain model: ChangeProposal, PipelineRun",
      "sequence": "08.04.09.01",
      "description": "Domain model: ChangeProposal, PipelineRun. Expected output: Aggregates with their invariants and state transitions as modelled; unit tests cover every invariant and every transition.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Aggregates with their invariants and state transitions as modelled; unit tests cover every invariant and every transition."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9609,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-255]",
      "number": 255
    },
    {
      "id": "AIFACTORY-TASK-256",
      "type": "task",
      "parent": "AIFACTORY-US-1286",
      "title": "Persistence in pipeline-execution-sql: ChangeProposals, ProposalCommits, PipelineRuns, PipelineResults",
      "sequence": "08.04.09.02",
      "description": "Persistence in pipeline-execution-sql: ChangeProposals, ProposalCommits, PipelineRuns, PipelineResults. Expected output: Mappings and migrations for the modelled tables with tenant filters and indexes; the migration adds PipelineRuns and PipelineResults beside the thin tables without changing their rows; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the modelled tables with tenant filters and indexes; the migration adds PipelineRuns and PipelineResults beside the thin tables without changing their rows; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9609,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-256]",
      "number": 256
    },
    {
      "id": "AIFACTORY-TASK-5119",
      "type": "task",
      "parent": "AIFACTORY-US-1286",
      "title": "Verify the complete domain and store of PipelineExecutionService",
      "sequence": "08.04.09.03",
      "description": "Verify the complete domain and store of PipelineExecutionService. Expected output: Run `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"`; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1286 against model/services/devops-gitops/PipelineExecutionService.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"`; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1286 against model/services/devops-gitops/PipelineExecutionService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9609,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5119]",
      "number": 5119
    },
    {
      "id": "AIFACTORY-US-1287",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "Host every operation, event and handler of PipelineExecutionService with its security and telemetry",
      "sequence": "08.04.10",
      "description": "The complete delivery hosts the six REST routes and the gRPC method of the model behind the scopes `factory.delivery.read`, `factory.delivery.propose` and `factory.delivery.operate`, with problem responses for every modelled code, the `Idempotency-Key` filter of `OpenChangeProposal` and the workload check of `Pipelines.RecordProposal` under its service scope `factory.delivery.propose` (D135); the behaviour of each operation is delivered by its own PBI. The messaging profile `pipeline-execution` publishes the five events of the service under the run event envelope through its outbox and registers the two consumed events, `DeliveryReceived` of ConnectorRegistryService and `ArtifactValidated` of ArtifactService, in its inbox with idempotency on the event id; the gauge `connectsoft.factory.delivery.inbox_lag` reports the age of the oldest unprocessed message. The workers `DeliveryApplier` and `RunReconciler` are hosted with their modelled triggers, retry policies, partitioning and idempotency keys, while their behaviour belongs to AIFACTORY-US-1281, AIFACTORY-US-1282, AIFACTORY-US-1283 and AIFACTORY-US-1285. Tenant isolation is a row filter on every query; the only secret, the messaging transport, comes from Key Vault by reference with a rotation of 90 days; the data classification is internal and the highest side-effect class is shared-write. A user token reaches the service with the audience of its gateway, DeliveryHost, which the service accepts (ADR-0015 amendment D117). Traces, the five metrics of the model and health checks follow the observability conventions, and readiness stays unready while the store is unavailable. Kind: enabling. Traces: services: PipelineExecutionService; apis: PipelineExecutionService/Pipelines.RecordProposal; events: PipelineExecutionService/ChangeProposalStateChanged, ConnectorRegistryService/DeliveryReceived, ArtifactService/ArtifactValidated; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: NFR-12. Depends on: AIFACTORY-US-1286, feature:delivery-host, feature:connector-registry-service-deliveries, feature:artifact-service. Sources: model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given the hosted service, when each of the six REST routes and `PipelineExecutionService/Pipelines.RecordProposal` is called without a token, with a token lacking its scope or without a workload identity, then it is refused with the modelled problem response or gRPC status before any handler runs (ADR-0015, model/services/devops-gitops/PipelineExecutionService.yaml).",
        "AC2: Given the messaging profile `pipeline-execution`, when the contract tests run, then the five published events, among them `PipelineExecutionService/ChangeProposalStateChanged`, carry their modelled payload under the run event envelope, and `ConnectorRegistryService/DeliveryReceived` and `ArtifactService/ArtifactValidated` are registered in the inbox with idempotency on the event id (ADR-0012, ADR-0014).",
        "AC3: Given a query of any route, when it runs, then it is filtered by the trusted tenant, the five metrics of the model are emitted with their dimensions, and no secret value reaches a log record, an event or a reply (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-257",
        "AIFACTORY-TASK-258",
        "AIFACTORY-TASK-259",
        "AIFACTORY-TASK-260",
        "AIFACTORY-TASK-5120"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9610,
      "kind": "enabling",
      "traces": {
        "services": [
          "PipelineExecutionService"
        ],
        "apis": [
          "PipelineExecutionService/Pipelines.RecordProposal"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalStateChanged",
          "ConnectorRegistryService/DeliveryReceived",
          "ArtifactService/ArtifactValidated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "NFR-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1286",
        "feature:delivery-host",
        "feature:connector-registry-service-deliveries",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/pipeline-execution-service/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-1287]",
      "number": 1287
    },
    {
      "id": "AIFACTORY-TASK-257",
      "type": "task",
      "parent": "AIFACTORY-US-1287",
      "title": "API surface: 6 REST and 1 gRPC operations (ListChangeProposals, GetChangeProposal, OpenChangeProposal, ListPipelineRuns, GetPipelineRun, ReconcilePipelineRun and 1 more)",
      "sequence": "08.04.10.01",
      "description": "API surface: 6 REST and 1 gRPC operations (ListChangeProposals, GetChangeProposal, OpenChangeProposal, ListPipelineRuns, GetPipelineRun, ReconcilePipelineRun and 1 more). Expected output: Every modelled operation is hosted with its scope, side-effect class, idempotency rule and problem responses, and the OpenAPI and proto documents match the model; the behaviour of each operation is delivered by AIFACTORY-US-1276, AIFACTORY-US-1277, AIFACTORY-US-1280, AIFACTORY-US-1284 and AIFACTORY-US-1285.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Every modelled operation is hosted with its scope, side-effect class, idempotency rule and problem responses, and the OpenAPI and proto documents match the model; the behaviour of each operation is delivered by AIFACTORY-US-1276, AIFACTORY-US-1277, AIFACTORY-US-1280, AIFACTORY-US-1284 and AIFACTORY-US-1285."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9610,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-257]",
      "number": 257
    },
    {
      "id": "AIFACTORY-TASK-258",
      "type": "task",
      "parent": "AIFACTORY-US-1287",
      "title": "Messaging: publishes 5 events, handles 2",
      "sequence": "08.04.10.02",
      "description": "Messaging: publishes 5 events, handles 2. Expected output: Events are published through the outbox of the service with the run envelope (ChangeProposalOpened, ChangeProposalStateChanged, ChangeProposalMerged, PipelineRunStarted, PipelineRunCompleted); consumed events are handled idempotently through its inbox.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Events are published through the outbox of the service with the run envelope (ChangeProposalOpened, ChangeProposalStateChanged, ChangeProposalMerged, PipelineRunStarted, PipelineRunCompleted); consumed events are handled idempotently through its inbox."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9610,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-258]",
      "number": 258
    },
    {
      "id": "AIFACTORY-TASK-259",
      "type": "task",
      "parent": "AIFACTORY-US-1287",
      "title": "Hosting of the workers DeliveryApplier and RunReconciler",
      "sequence": "08.04.10.03",
      "description": "Hosting of the workers DeliveryApplier and RunReconciler. Expected output: The DeliveryApplier is hosted on DeliveryReceived with exponential retry of five attempts, partitioning by repository and the idempotency key deliveryId, and the RunReconciler on its ten-minute schedule with fixed retry of three attempts, partitioning by tenant and the idempotency key pipelineRunId and window; a duplicate trigger has no second effect. Only the trigger, retry, partitioning and idempotency key wiring is done here; the behaviour of each worker is implemented by AIFACTORY-TASK-5109, AIFACTORY-TASK-5112, AIFACTORY-TASK-317 and AIFACTORY-TASK-318.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The DeliveryApplier is hosted on DeliveryReceived with exponential retry of five attempts, partitioning by repository and the idempotency key deliveryId, and the RunReconciler on its ten-minute schedule with fixed retry of three attempts, partitioning by tenant and the idempotency key pipelineRunId and window; a duplicate trigger has no second effect. Only the trigger, retry, partitioning and idempotency key wiring is done here; the behaviour of each worker is implemented by AIFACTORY-TASK-5109, AIFACTORY-TASK-5112, AIFACTORY-TASK-317 and AIFACTORY-TASK-318."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9610,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-259]",
      "number": 259
    },
    {
      "id": "AIFACTORY-TASK-260",
      "type": "task",
      "parent": "AIFACTORY-US-1287",
      "title": "Security, tenancy and telemetry of PipelineExecutionService",
      "sequence": "08.04.10.04",
      "description": "Security, tenancy and telemetry of PipelineExecutionService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered, secrets come from secret references, and traces, metrics and health checks follow the observability conventions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered, secrets come from secret references, and traces, metrics and health checks follow the observability conventions."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9610,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-260]",
      "number": 260
    },
    {
      "id": "AIFACTORY-TASK-5120",
      "type": "task",
      "parent": "AIFACTORY-US-1287",
      "title": "Verify the hosting of PipelineExecutionService through the contract suite",
      "sequence": "08.04.10.05",
      "description": "Verify the hosting of PipelineExecutionService through the contract suite. Expected output: Run `dotnet test -c Release --filter \"Category=Contract\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1287 against model/services/devops-gitops/PipelineExecutionService.yaml and model/descriptors.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Contract\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1287 against model/services/devops-gitops/PipelineExecutionService.yaml and model/descriptors.yaml."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9610,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5120]",
      "number": 5120
    },
    {
      "id": "AIFACTORY-US-1608",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-044",
      "title": "RunControlService settles the step of a run that waits for the pipeline run of its merged commit with the reference of the typed results",
      "sequence": "08.04.11",
      "description": "As an operator, I want the step of a run that waits for the pipeline run of its merged change settled once that pipeline run completed, so that the run goes on with the receipt of the pipeline run and never waits on a run that has already ended. The inbox handler `SettleWaitingStep` of RunControlService takes `PipelineExecutionService/PipelineRunCompleted`, which carries `pipelineRunId`, `tenantId`, `projectId`, `commit`, `state` and `results` and the optional `runId` and `stepRunId` of the requesting step. RunControlService itself is delivered in I1 by feature `run-control-service`, but the complete producer of this event arrives with this feature in I2, so the handler for it is delivered here and its tasks are written in the repository ConnectSoft.AI.SoftwareFactory.RunControlService (D140); the same handler of `PromotionCompleted` and `PromotionFailed` is delivered by feature `environment-promotion-service` (AIFACTORY-US-1621). The handler registers the event in the inbox of the messaging profile `run-control`, idempotent on the event id. The requesting step passes its `runId` and its `stepRunId` with the proposal it records through `Pipelines.RecordProposal`, the pipeline run of the merged commit takes them from that proposal, and the event echoes them, absent when no run requested the pipeline run (D141, AIFACTORY-US-1283). The handler looks up the waiting step directly by them: under the tenant of the event it takes the `Step` whose step run id is the `stepRunId` of the event in the `Run` that `runId` names, and it ignores an event without them; it no longer finds the run through the merged commit of a change proposal binding. When that run is neither terminal nor Cancelling, the step moves to Succeeded with the pipeline run as its result reference, whatever `state` the system of record reported: results are receipts, readiness is judged from the typed results by WorkflowEngineService and by the steps that read them and never from the run state alone (FR-07, AIFACTORY-US-1283), and the purpose the model gives the handler names a settlement with the reference of the typed results and no failed settlement. `RunControlService/StepSettled` is written in the transaction that moves the step, with the step run id of the engine, the `stepId`, the final state Succeeded, the number of attempts and, in `outputRef`, the reference of the pipeline run (D119, D121); WorkflowEngineService advances the run on that event in its own PBI. No workflow definition of the model has a step that waits for a pipeline run yet, `delivery-run`, `release` and `debt-review` taking `PipelineRunCompleted` as a readiness signal of WorkflowEngineService; this PBI also reads `outputRef`, which the model describes as a reference in ArtifactService, as able to hold the reference of the pipeline run, a reading reported to the owner. An event without `runId` and `stepRunId`, an event whose `runId` names a run of another tenant or no run, an event whose `stepRunId` names no step of that run, a run that is terminal or Cancelling, a step already in a final state and a redelivered event change nothing and publish nothing. When `run-control-sql` does not answer, the inbox keeps the event and retries it, and the event is applied once. Kind: behavior. Traces: services: RunControlService, PipelineExecutionService, WorkflowEngineService; aggregates: RunControlService/Run, RunControlService/Step; events: PipelineExecutionService/PipelineRunCompleted, RunControlService/StepSettled; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-07. Depends on: AIFACTORY-US-1283, feature:run-control-service, feature:contracts-package. Sources: model/services/control-plane/RunControlService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/workflows/delivery-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a Running `RunControlService/Run` of tenant A and its open `RunControlService/Step` that requested the pipeline run, when `PipelineExecutionService/PipelineRunCompleted` names the `runId` of that run and the `stepRunId` of that step with the state Succeeded and `SettleWaitingStep` handles it (D141), then the step moves to Succeeded with the pipeline run as its result reference and `RunControlService/StepSettled` is written in the same transaction with the step run id of the engine, the `stepId`, the final state Succeeded, the number of attempts and the reference of the pipeline run in `outputRef`; a redelivery under the same event id changes nothing (model/services/control-plane/RunControlService.yaml, ADR-0014).",
        "AC2: Given the same waiting step, when `PipelineExecutionService/PipelineRunCompleted` names the same `runId` and `stepRunId` with the state Failed and a failed security scan among its `results`, then the step is settled Succeeded with the reference of the pipeline run in the same way and `RunControlService/StepSettled` is written, and the failed result is left to the reader of the typed results (FR-07, model/services/devops-gitops/PipelineExecutionService.yaml).",
        "AC3: Given an event without `runId` and `stepRunId`, an event of tenant B whose `runId` names a run of tenant A, an event whose `stepRunId` names no step of the run, a run that is Completed or Cancelling, or `run-control-sql` stopped while the event arrives (D141), when `PipelineExecutionService/PipelineRunCompleted` is handled, then the first four change no step and write no `RunControlService/StepSettled`, and the last is retried by the inbox until the store answers and is applied once under its event id (ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6506",
        "AIFACTORY-TASK-6507",
        "AIFACTORY-TASK-6508"
      ],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9611,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "PipelineExecutionService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Step"
        ],
        "events": [
          "PipelineExecutionService/PipelineRunCompleted",
          "RunControlService/StepSettled"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-07"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1283",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/workflows/delivery-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1608]",
      "number": 1608
    },
    {
      "id": "AIFACTORY-TASK-6506",
      "type": "task",
      "parent": "AIFACTORY-US-1608",
      "title": "SettleWaitingStep of RunControlService for PipelineRunCompleted",
      "sequence": "08.04.11.01",
      "description": "SettleWaitingStep of RunControlService for PipelineRunCompleted. Expected output: The inbox of the RunControlService messaging profile registers PipelineRunCompleted with idempotency on the event id; SettleWaitingStep looks up the waiting step directly by the runId and stepRunId the event echoes, under the tenant of the event, and ignores an event without them (D141); in a run that is neither terminal nor Cancelling it moves the step to Succeeded with the pipeline run as its result reference whatever state the event reports, and writes StepSettled with the step run id, the stepId, the final state, the number of attempts and the reference of the pipeline run in outputRef in the same transaction; an event without runId and stepRunId, of a run of another tenant or of no run, of a step run the run does not hold, for a terminal or Cancelling run or for a step in a final state changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox of the RunControlService messaging profile registers PipelineRunCompleted with idempotency on the event id; SettleWaitingStep looks up the waiting step directly by the runId and stepRunId the event echoes, under the tenant of the event, and ignores an event without them (D141); in a run that is neither terminal nor Cancelling it moves the step to Succeeded with the pipeline run as its result reference whatever state the event reports, and writes StepSettled with the step run id, the stepId, the final state, the number of attempts and the reference of the pipeline run in outputRef in the same transaction; an event without runId and stepRunId, of a run of another tenant or of no run, of a step run the run does not hold, for a terminal or Cancelling run or for a step in a final state changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9611,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6506]",
      "number": 6506
    },
    {
      "id": "AIFACTORY-TASK-6507",
      "type": "task",
      "parent": "AIFACTORY-US-1608",
      "title": "Fixture pipeline run events and waiting steps of the settlement suite",
      "sequence": "08.04.11.02",
      "description": "Fixture pipeline run events and waiting steps of the settlement suite. Expected output: The acceptance suite of RunControlService holds fixture events PipelineRunCompleted with the states Succeeded and Failed and with a failed security scan in their results for two tenants, built from the event types of the pinned contracts package under the run event envelope, with the runId and stepRunId of a waiting step, with an unknown stepRunId and without both (D141), runs with a waiting step, a Completed run, a Cancelling run, and a switch that stops run-control-sql while an event arrives.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite of RunControlService holds fixture events PipelineRunCompleted with the states Succeeded and Failed and with a failed security scan in their results for two tenants, built from the event types of the pinned contracts package under the run event envelope, with the runId and stepRunId of a waiting step, with an unknown stepRunId and without both (D141), runs with a waiting step, a Completed run, a Cancelling run, and a switch that stops run-control-sql while an event arrives."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9611,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6507]",
      "number": 6507
    },
    {
      "id": "AIFACTORY-TASK-6508",
      "type": "task",
      "parent": "AIFACTORY-US-1608",
      "title": "Verify settle-the-step-waiting-for-a-pipeline-run through the acceptance suite",
      "sequence": "08.04.11.03",
      "description": "Verify settle-the-step-waiting-for-a-pipeline-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SettleWaitingStepOnPipelineRun\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1608 with the fixture of AIFACTORY-TASK-6507: the waiting step settled Succeeded with the reference of the pipeline run on a Succeeded and on a Failed pipeline run, RunControlService/StepSettled in the transaction of the move, the events that change nothing, and the retry while the store is stopped with one application under the event id.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SettleWaitingStepOnPipelineRun\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1608 with the fixture of AIFACTORY-TASK-6507: the waiting step settled Succeeded with the reference of the pipeline run on a Succeeded and on a Failed pipeline run, RunControlService/StepSettled in the transaction of the move, the events that change nothing, and the retry while the store is stopped with one application under the event id."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/PipelineExecutionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 96,
      "phase": "factory",
      "stackRank": 9611,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6508]",
      "number": 6508
    },
    {
      "id": "AIFACTORY-FEAT-045",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-008",
      "title": "ReleaseService: complete delivery",
      "sequence": "08.05",
      "description": "ReleaseService is the service of bounded context BC-24 (Package & Release Delivery). Releases of generated products and modules — immutable version, merged commit, container image digests, packages, SBOM and provenance attestations, change-set and pipeline references — and the evidence that each package or image was published to its feed or registry (BC-24; ContainerImageService merged; package and template publishing stay in the existing CI as external canonical). Its own repository is ConnectSoft.AI.SoftwareFactory.ReleaseService. Delivers: ReleaseService (complete). Increment I2: Deliver it. Build order 97 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-023",
        "AIFACTORY-US-1288",
        "AIFACTORY-US-1289",
        "AIFACTORY-US-1290",
        "AIFACTORY-US-1291",
        "AIFACTORY-US-1292",
        "AIFACTORY-US-1293",
        "AIFACTORY-US-1294",
        "AIFACTORY-US-1295"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9700,
      "titlePrefix": "[AIFACTORY-FEAT-045]",
      "number": 45
    },
    {
      "id": "AIFACTORY-US-023",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Passing results become an immutable release",
      "sequence": "08.05.01",
      "description": "As an operator, I want a pipeline run that passed its gates to yield a release with its manifest, bill of materials and attestations, so that what is promoted is one immutable, verifiable version. This is the integration PBI of ReleaseService, the service of bounded context BC-24 that holds the releases of generated products and modules and the evidence that each package or image was published. A succeeded pipeline run becomes a candidate release, either through the inbox handler `AssembleFromRun` when PipelineExecutionService publishes `PipelineRunCompleted` (AIFACTORY-US-1290) or through `CreateProductRelease` called by an Operator or a Workspace admin (AIFACTORY-US-1289); a run that did not succeed yields no release. A release carries its semantic version, the merged commit, its components with digests, the SBOM, the provenance attestations, the pipeline run, the merged change proposals that `LinkProposal` collected and the asset releases that generated it; a release without provenance is refused. It stays Candidate until the `PublicationVerifier` found every component in its feed or registry, then it is Released and `ReleaseReady` tells EnvironmentPromotionService and the release workflow that it may be promoted (AIFACTORY-US-1291). A Released release is immutable: a change is a new version, and a newer Released version supersedes it. A release is withdrawn with a reason, which blocks its promotion and revokes nothing already deployed (AIFACTORY-US-1292), and EnvironmentPromotionService resolves a release with its digests and evidence through `Releases.GetRelease` (AIFACTORY-US-1293). The delivery run evaluates the typed results and fails on a blocking gate in its own feature (feature wf-delivery-run). The summary of its step `prepare-release` says that it assembles the release manifest with SBOM and attestations through ReleaseService, but the step binds no tool that reaches `CreateProductRelease`, a gap the model carries (D132) that this PBI reports to the owner and neither closes nor turns into a criterion. The release events are written with the types of the pinned contracts package, which generates every integration event that model/services/devops-gitops/ReleaseService.yaml declares under the run event envelope (ADR-0014 amendment D114), so no contract is published from the service repository. The release condition of the model is a succeeded run on a release branch or tag, and `PipelineRunCompleted` carries neither branch, tag, product nor version, an open point reported to the owner (AIFACTORY-US-1290). Package and template publishing stay in the existing CI as the external canonical; the service records evidence and publishes nothing. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Kind: behavior. Traces: services: ReleaseService, PipelineExecutionService, ArtifactService, WorkflowEngineService; aggregates: ReleaseService/ProductRelease; apis: ReleaseService/CreateProductRelease, ReleaseService/WithdrawProductRelease, ReleaseService/Releases.GetRelease; events: ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady, ReleaseService/ReleaseWithdrawn, PipelineExecutionService/PipelineRunCompleted; workflows: delivery-run; steps: delivery-run/prepare-release; descriptors: release-manifest-v1; adrs: ADR-0014, ADR-0027; requirements: FR-08. Relates: screens: product-releases, release-detail. Depends on: AIFACTORY-US-1288, AIFACTORY-US-1289, AIFACTORY-US-1290, AIFACTORY-US-1291, AIFACTORY-US-1292, AIFACTORY-US-1293, AIFACTORY-US-1294, AIFACTORY-US-1295, feature:pipeline-execution-service-complete, feature:wf-delivery-run, feature:contracts-package. Sources: model/services/devops-gitops/ReleaseService.yaml, model/workflows/delivery-run.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given `PipelineExecutionService/PipelineRunCompleted` in state Succeeded for a run on a release branch or tag, when ReleaseService handles it, then one `ReleaseService/ProductRelease` exists in state Candidate with version, merged commit, component digests, SBOM and provenance attestations, and `ReleaseService/ReleaseCreated` is published once (ADR-0014).",
        "AC2: Given a pipeline run that failed a gate, when its completion is handled or `ReleaseService/CreateProductRelease` names it, then no release is created, the call being refused with 422, and nothing is published (FR-08).",
        "AC3: Given every component of a candidate has publication evidence, when the verifier completes, then the release is Released and `ReleaseService/ReleaseReady` is published after the evidence is recorded, and no component without evidence is ever part of a Released release (model/services/devops-gitops/ReleaseService.yaml).",
        "AC4: Given a release was withdrawn through `ReleaseService/WithdrawProductRelease`, when EnvironmentPromotionService resolves it through `ReleaseService/Releases.GetRelease`, then it is answered in state Withdrawn and `ReleaseService/ReleaseWithdrawn` was published, so the promotion is refused by EnvironmentPromotionService in its own suite."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/workflows/delivery-run.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-322",
        "AIFACTORY-TASK-711"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9701,
      "kind": "behavior",
      "traces": {
        "services": [
          "ReleaseService",
          "PipelineExecutionService",
          "ArtifactService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "apis": [
          "ReleaseService/CreateProductRelease",
          "ReleaseService/WithdrawProductRelease",
          "ReleaseService/Releases.GetRelease"
        ],
        "events": [
          "ReleaseService/ReleaseCreated",
          "ReleaseService/ReleaseReady",
          "ReleaseService/ReleaseWithdrawn",
          "PipelineExecutionService/PipelineRunCompleted"
        ],
        "workflows": [
          "delivery-run"
        ],
        "steps": [
          "delivery-run/prepare-release"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {
        "screens": [
          "product-releases",
          "release-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1288",
        "AIFACTORY-US-1289",
        "AIFACTORY-US-1290",
        "AIFACTORY-US-1291",
        "AIFACTORY-US-1292",
        "AIFACTORY-US-1293",
        "AIFACTORY-US-1294",
        "AIFACTORY-US-1295",
        "feature:pipeline-execution-service-complete",
        "feature:wf-delivery-run",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/workflows/delivery-run.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-023]",
      "number": 23
    },
    {
      "id": "AIFACTORY-TASK-322",
      "type": "task",
      "parent": "AIFACTORY-US-023",
      "title": "Contract test of the release events against the pinned contracts package",
      "sequence": "08.05.01.01",
      "description": "Contract test of the release events against the pinned contracts package. Expected output: Run `dotnet test -c Release --filter \"Category=Contract&Feature=ReleaseEvents\"`; a zero-match filter counts as a failure; the test proves that ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady and ReleaseService/ReleaseWithdrawn are written with the types of the pinned contracts package under the run event envelope and match the payload of model/services/devops-gitops/ReleaseService.yaml; no contract is published from the service repository, and the evaluation of typed results and the blocking gate of the delivery run are delivered by feature wf-delivery-run.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Contract&Feature=ReleaseEvents\"`; a zero-match filter counts as a failure; the test proves that ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady and ReleaseService/ReleaseWithdrawn are written with the types of the pinned contracts package under the run event envelope and match the payload of model/services/devops-gitops/ReleaseService.yaml; no contract is published from the service repository, and the evaluation of typed results and the blocking gate of the delivery run are delivered by feature wf-delivery-run."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-322]",
      "number": 322
    },
    {
      "id": "AIFACTORY-TASK-711",
      "type": "task",
      "parent": "AIFACTORY-US-023",
      "title": "Verify release-from-results by running the declared command",
      "sequence": "08.05.01.02",
      "description": "Verify release-from-results by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance`; a zero-match filter counts as a failure; it passes and proves AC1 to AC4 of AIFACTORY-US-023 over a succeeded run on a release branch, a run with a failed gate, a fake registry that holds or lacks a component and a withdrawn release resolved through Releases.GetRelease.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance`; a zero-match filter counts as a failure; it passes and proves AC1 to AC4 of AIFACTORY-US-023 over a succeeded run on a release branch, a run with a failed gate, a fake registry that holds or lacks a component and a withdrawn release resolved through Releases.GetRelease."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-711]",
      "number": 711
    },
    {
      "id": "AIFACTORY-US-1288",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "List and read product releases with components, SBOM, attestations and provenance",
      "sequence": "08.05.02",
      "description": "A caller whose scope carries `factory.delivery.read` (Operator, Workspace admin, Platform admin or Observer) lists releases through `ReleaseService/ListProductReleases`, filtered by product, version and state, each with its components and provenance, and reads one release through `ReleaseService/GetProductRelease` with its components and their digests, targets and publication evidence, the SBOM, the attestations, the pipeline run, the change proposals, the generating asset releases and the release notes when they exist. The tenant comes from the trusted scope and the list holds only the releases of that tenant and of the projects in scope; the index `IX_Releases_State` serves the state filter. Every query runs under the tenant row filter, so a release of another tenant never appears and is answered 404 when addressed, the same answer as for a `releaseId` that does not exist (ADR-0015). A caller without the scope is refused with 403. A candidate shows which component still lacks evidence. Nothing is written and nothing is published by these reads. The routes are reached through the DeliveryHost gateway; StudioBff renders them in its own increment. Kind: behavior. Traces: services: ReleaseService; aggregates: ReleaseService/ProductRelease; apis: ReleaseService/ListProductReleases, ReleaseService/GetProductRelease; adrs: ADR-0015; requirements: FUX-05; scenarios: SCN-ReleaseService-001, SCN-ReleaseService-002. Relates: screens: product-releases, release-detail, release-evidence. Depends on: AIFACTORY-US-1294, AIFACTORY-US-1295. Sources: model/services/devops-gitops/ReleaseService.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given releases of several products, versions and states in my tenant and in another tenant, when `ReleaseService/ListProductReleases` is called with a filter, then the response is 200 with only the matching releases of my tenant and projects in scope, with components and provenance, and releases of the other tenant never appear (SCN-ReleaseService-001, ADR-0015).",
        "AC2: Given a `ReleaseService/ProductRelease` of my tenant and project, when `ReleaseService/GetProductRelease` is called, then the response is 200 with the components and their digests, targets and publication evidence, the SBOM, the attestations, the pipeline run, the proposals and the generating asset releases (SCN-ReleaseService-002).",
        "AC3: Given a caller without `factory.delivery.read`, or a `releaseId` that exists only in another tenant or not at all, when either route is called, then the response is 403 for the missing scope and 404 for the foreign or unknown release, each with a problem response and no state change (SCN-ReleaseService-001, SCN-ReleaseService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5121",
        "AIFACTORY-TASK-5122"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9702,
      "kind": "behavior",
      "traces": {
        "services": [
          "ReleaseService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "apis": [
          "ReleaseService/ListProductReleases",
          "ReleaseService/GetProductRelease"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-05"
        ],
        "scenarios": [
          "SCN-ReleaseService-001",
          "SCN-ReleaseService-002"
        ]
      },
      "relates": {
        "screens": [
          "product-releases",
          "release-detail",
          "release-evidence"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1294",
        "AIFACTORY-US-1295"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1288]",
      "number": 1288
    },
    {
      "id": "AIFACTORY-TASK-5121",
      "type": "task",
      "parent": "AIFACTORY-US-1288",
      "title": "ListProductReleases and GetProductRelease under the tenant row filter",
      "sequence": "08.05.02.01",
      "description": "ListProductReleases and GetProductRelease under the tenant row filter. Expected output: ListProductReleases filters by product, version and state with components and provenance; GetProductRelease returns components with digests, targets and evidence, SBOM, attestations, pipeline run, proposals and generating assets; both apply the tenant row filter so a foreign release is answered 404 like an unknown one, and a missing scope is 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "ListProductReleases filters by product, version and state with components and provenance; GetProductRelease returns components with digests, targets and evidence, SBOM, attestations, pipeline run, proposals and generating assets; both apply the tenant row filter so a foreign release is answered 404 like an unknown one, and a missing scope is 403."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5121]",
      "number": 5121
    },
    {
      "id": "AIFACTORY-TASK-5122",
      "type": "task",
      "parent": "AIFACTORY-US-1288",
      "title": "Verify read-product-releases through the acceptance suite",
      "sequence": "08.05.02.02",
      "description": "Verify read-product-releases through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ReleaseService-001|Scenario=SCN-ReleaseService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1288 over a two-tenant fixture.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ReleaseService-001|Scenario=SCN-ReleaseService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1288 over a two-tenant fixture."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5122]",
      "number": 5122
    },
    {
      "id": "AIFACTORY-US-1289",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Create a candidate release from a succeeded pipeline run and announce it",
      "sequence": "08.05.03",
      "description": "As an operator, I want to assemble a release from a succeeded pipeline run with its version, components and provenance, so that there is one immutable candidate to verify and promote, and never one without provenance. A caller whose scope carries `factory.delivery.release`, an Operator or a Workspace admin, posts to `ReleaseService/CreateProductRelease` under an `Idempotency-Key` a body that names the succeeded pipeline run, the product and the semantic version. Tenant and project come from the trusted scope (ADR-0015). The service records the `ProductRelease` in state Assembling with the merged commit, the pipeline run, the merged proposals linked for the product and the generating asset releases, resolves one `ReleaseComponent` per image, package, chart, template or static site of the run results, each with its digest, its target feed or registry and publication Pending, stores the SBOM and the attestations by reference in ArtifactService, and moves the release to Candidate (trigger `ComponentsResolved`), writing `ReleaseCreated` with `releaseId`, `tenantId`, `projectId`, `productId`, `version` and `commit` in the same transaction. The answer is 201 with the release. The dispatcher publishes `ReleaseCreated` on `releases.products.v1.release-created` under the run event envelope and retries a transport outage with backoff, so it is neither lost nor duplicated (ADR-0012); StudioBff, AuditService and DashboardService consume it in their own suites, and the `PublicationVerifier` of this service starts from it. A repeat under the same key and body returns the same release and writes nothing; a different body under the key, or a version that already exists for the product, is refused with 409, because a release is immutable and a change is a new version. A run that did not succeed, a component without a digest, a release without provenance, or a release without attestations while `Delivery:Releases:RequireAttestations` is true, is refused with 422. A caller without the scope is refused with 403. When ArtifactService is unavailable the call fails fast and writes nothing. The service has no synchronous read of a pipeline run and the model does not say where it takes the results of the named run from, an open point reported to the owner; the release workflow has no tool that reaches this route (D132). Kind: behavior. Traces: services: ReleaseService, ArtifactService; aggregates: ReleaseService/ProductRelease; apis: ReleaseService/CreateProductRelease; events: ReleaseService/ReleaseCreated; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-08, XL-10; scenarios: SCN-ReleaseService-003, SCN-ReleaseService-006. Relates: screens: product-releases. Depends on: AIFACTORY-US-1294, AIFACTORY-US-1295, feature:artifact-service. Sources: model/services/devops-gitops/ReleaseService.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.delivery.release` and a body naming a succeeded pipeline run, a product and a new version, when `ReleaseService/CreateProductRelease` is called with an `Idempotency-Key`, then the response is 201, the `ReleaseService/ProductRelease` moved from Assembling to Candidate with its commit, pipeline run, proposals, generating assets, SBOM and attestation references and one component per result with digest, target and publication Pending, and `ReleaseService/ReleaseCreated` was written in the same transaction (SCN-ReleaseService-003, ADR-0014).",
        "AC2: Given the same body under the same key, a different body under that key, a version that already exists for the product, or a caller without the scope, when `ReleaseService/CreateProductRelease` is called, then the repeat returns the same release and writes nothing, the conflicts are refused with 409 and the missing scope with 403, each with a problem response and no state change (SCN-ReleaseService-003, ADR-0015).",
        "AC3: Given a run that did not succeed, a component without a digest, a release without provenance, or no attestations while `Delivery:Releases:RequireAttestations` is true, when `ReleaseService/CreateProductRelease` is called, then it is refused with 422 naming the reason and no release is written; given ArtifactService is unavailable, the call fails fast and writes nothing (SCN-ReleaseService-003, model/services/devops-gitops/ReleaseService.yaml).",
        "AC4: Given the outbox record, when the dispatcher publishes `ReleaseService/ReleaseCreated` on `releases.products.v1.release-created`, then the event is sent under the run event envelope with `releaseId`, `tenantId`, `projectId`, `productId`, `version` and `commit`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ReleaseService-006, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5123",
        "AIFACTORY-TASK-5124",
        "AIFACTORY-TASK-320"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9703,
      "kind": "behavior",
      "traces": {
        "services": [
          "ReleaseService",
          "ArtifactService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "apis": [
          "ReleaseService/CreateProductRelease"
        ],
        "events": [
          "ReleaseService/ReleaseCreated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08",
          "XL-10"
        ],
        "scenarios": [
          "SCN-ReleaseService-003",
          "SCN-ReleaseService-006"
        ]
      },
      "relates": {
        "screens": [
          "product-releases"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1294",
        "AIFACTORY-US-1295",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1289]",
      "number": 1289
    },
    {
      "id": "AIFACTORY-TASK-5123",
      "type": "task",
      "parent": "AIFACTORY-US-1289",
      "title": "CreateProductRelease from Assembling to Candidate with ReleaseCreated",
      "sequence": "08.05.03.01",
      "description": "CreateProductRelease from Assembling to Candidate with ReleaseCreated. Expected output: CreateProductRelease records the release Assembling, resolves components with digests and targets, stores SBOM and attestation references in ArtifactService, applies ComponentsResolved in the transaction of the ReleaseCreated outbox record and answers 201; the idempotent repeat, the 409 for a reused key or an existing version, the 422 for a run that did not succeed, a missing digest, missing provenance or missing attestations and the 403 are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "CreateProductRelease records the release Assembling, resolves components with digests and targets, stores SBOM and attestation references in ArtifactService, applies ComponentsResolved in the transaction of the ReleaseCreated outbox record and answers 201; the idempotent repeat, the 409 for a reused key or an existing version, the 422 for a run that did not succeed, a missing digest, missing provenance or missing attestations and the 403 are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5123]",
      "number": 5123
    },
    {
      "id": "AIFACTORY-TASK-5124",
      "type": "task",
      "parent": "AIFACTORY-US-1289",
      "title": "Contract of CreateProductRelease with its problem responses",
      "sequence": "08.05.03.02",
      "description": "Contract of CreateProductRelease with its problem responses. Expected output: The OpenAPI document of the service exposes POST /factory/delivery/releases with the Idempotency-Key header, the 201 answer and the problem responses 403, 409 and 422 as model/services/devops-gitops/ReleaseService.yaml lists them.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service exposes POST /factory/delivery/releases with the Idempotency-Key header, the 201 answer and the problem responses 403, 409 and 422 as model/services/devops-gitops/ReleaseService.yaml lists them."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9703,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5124]",
      "number": 5124
    },
    {
      "id": "AIFACTORY-TASK-320",
      "type": "task",
      "parent": "AIFACTORY-US-1289",
      "title": "Verify create-a-product-release through the acceptance suite",
      "sequence": "08.05.03.03",
      "description": "Verify create-a-product-release through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ReleaseService-003|Scenario=SCN-ReleaseService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1289, that a release is immutable once created, that every component carries a digest and that ReleaseCreated is published once with its payload.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ReleaseService-003|Scenario=SCN-ReleaseService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1289, that a release is immutable once created, that every component carries a digest and that ReleaseCreated is published once with its payload."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-320]",
      "number": 320
    },
    {
      "id": "AIFACTORY-US-1290",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Assemble a candidate from a succeeded run and link merged proposals to the next release",
      "sequence": "08.05.04",
      "description": "ReleaseService consumes two events of PipelineExecutionService through its inbox, each idempotent on the event id. The handler `AssembleFromRun` takes `PipelineRunCompleted`: a succeeded run on a release branch or tag assembles a candidate with its images, packages, SBOM and attestations through the same path as `CreateProductRelease`, from Assembling to Candidate with `ReleaseCreated` in the transaction of the transition, under the identity of the service; a run in any other state assembles nothing. The handler `LinkProposal` takes `ChangeProposalMerged`: the proposals merged since the last release of the project become part of the next one, and the next release records them in `proposalIds`. A redelivered event changes nothing, and the dependency on PipelineExecutionService is an event queue, so an outage delays assembly and loses nothing. Two inputs are not given by the model and are reported to the owner rather than invented: `PipelineRunCompleted` carries no branch, tag, product or version, so the handler cannot read the model's condition, a succeeded run on a release branch or tag, nor the version from the event alone, and no table holds a merged proposal before the release it will join exists. The acceptance below states the model's condition as it is written and is proven over events whose run is known to be on a release branch or tag; where the handler reads branch, tag, product and version from is an owner input. Kind: behavior. Traces: services: ReleaseService, PipelineExecutionService; aggregates: ReleaseService/ProductRelease; apis: ReleaseService/CreateProductRelease; events: PipelineExecutionService/PipelineRunCompleted, PipelineExecutionService/ChangeProposalMerged, ReleaseService/ReleaseCreated; adrs: ADR-0012, ADR-0014; requirements: FR-08. Depends on: AIFACTORY-US-1289, feature:pipeline-execution-service-complete. Sources: model/services/devops-gitops/ReleaseService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given `PipelineExecutionService/PipelineRunCompleted` in state Succeeded for a run on a release branch or tag, when `AssembleFromRun` handles it, then one `ReleaseService/ProductRelease` is assembled in state Candidate through the path of `ReleaseService/CreateProductRelease` and `ReleaseService/ReleaseCreated` is written in the same transaction; a redelivery of the same event id assembles nothing (ADR-0014).",
        "AC2: Given `PipelineExecutionService/PipelineRunCompleted` in state Failed, Cancelled or PartiallySucceeded, when `AssembleFromRun` handles it, then no release is assembled and nothing is published (FR-08).",
        "AC3: Given `PipelineExecutionService/ChangeProposalMerged` for proposals of a project since its last release, when `LinkProposal` handles each, then the next release of that project records those proposals in `proposalIds`, and a redelivery links nothing twice (model/services/devops-gitops/ReleaseService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5125",
        "AIFACTORY-TASK-5126",
        "AIFACTORY-TASK-5127"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9704,
      "kind": "behavior",
      "traces": {
        "services": [
          "ReleaseService",
          "PipelineExecutionService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "apis": [
          "ReleaseService/CreateProductRelease"
        ],
        "events": [
          "PipelineExecutionService/PipelineRunCompleted",
          "PipelineExecutionService/ChangeProposalMerged",
          "ReleaseService/ReleaseCreated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1289",
        "feature:pipeline-execution-service-complete"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1290]",
      "number": 1290
    },
    {
      "id": "AIFACTORY-TASK-5125",
      "type": "task",
      "parent": "AIFACTORY-US-1290",
      "title": "AssembleFromRun inbox handler for succeeded runs",
      "sequence": "08.05.04.01",
      "description": "AssembleFromRun inbox handler for succeeded runs. Expected output: The handler of PipelineRunCompleted assembles a candidate through the CreateProductRelease path for a succeeded run on a release branch or tag, assembles nothing for any other state and is idempotent on the event id through the inbox of the release profile.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "The handler of PipelineRunCompleted assembles a candidate through the CreateProductRelease path for a succeeded run on a release branch or tag, assembles nothing for any other state and is idempotent on the event id through the inbox of the release profile."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5125]",
      "number": 5125
    },
    {
      "id": "AIFACTORY-TASK-5126",
      "type": "task",
      "parent": "AIFACTORY-US-1290",
      "title": "LinkProposal inbox handler for merged proposals",
      "sequence": "08.05.04.02",
      "description": "LinkProposal inbox handler for merged proposals. Expected output: The handler of ChangeProposalMerged keeps the proposals merged since the last release of a project for the next release, which records them in proposalIds, idempotently on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "The handler of ChangeProposalMerged keeps the proposals merged since the last release of a project for the next release, which records them in proposalIds, idempotently on the event id."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5126]",
      "number": 5126
    },
    {
      "id": "AIFACTORY-TASK-5127",
      "type": "task",
      "parent": "AIFACTORY-US-1290",
      "title": "Verify assemble-release-from-pipeline-events through the acceptance suite",
      "sequence": "08.05.04.03",
      "description": "Verify assemble-release-from-pipeline-events through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AssembleFromPipelineEvents\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1290 over recorded PipelineExecutionService/PipelineRunCompleted events of a succeeded run on a release branch and of runs in the other states, and PipelineExecutionService/ChangeProposalMerged events, each delivered twice.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AssembleFromPipelineEvents\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1290 over recorded PipelineExecutionService/PipelineRunCompleted events of a succeeded run on a release branch and of runs in the other states, and PipelineExecutionService/ChangeProposalMerged events, each delivered twice."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5127]",
      "number": 5127
    },
    {
      "id": "AIFACTORY-US-1291",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Verify the publication of every component, ready the release and draft its notes",
      "sequence": "08.05.05",
      "description": "As an operator, I want a release to become ready only when every image and package is found in its registry or feed, so that nothing is promoted that its target cannot serve. The `PublicationVerifier` worker starts from `ReleaseCreated` of this service. For each component of a Candidate release it checks the feed or registry of the component for its digest, through the publishing evidence of the existing CI and the reads `ConnectorRegistryService/Connectors.ReadPackageFeed` for a package and `ConnectorRegistryService/Connectors.ReadContainerRegistry` for an image, which the I2 feature `connector-registry-service-deliveries` delivers for Azure DevOps under the scope `factory.connections.read` with a brokered short-lived credential (D135), and records the publication Published with its evidence reference, the `tool-receipt-v1` of the read, or Failed. ConnectorRegistryService degrades: an unanswered read counts as a failed attempt of the verifier, and the acceptance suite proves the verifier against fakes of both reads. It is idempotent on release id plus component name, retries exponentially six times with a backoff of 60 seconds and runs at most four in parallel, partitioned by tenant. When every component is Published the release moves from Candidate to Released (trigger `AllPublished`) and `ReleaseReady` with `releaseId`, `tenantId`, `projectId`, `productId`, `version` and `components` is written in the same transaction. When the newer release is Released, `NewerReleased` is applied to the earlier Released release of the same product, which moves to Superseded and is announced by no event; whether that move shares the transaction of `AllPublished` on the other aggregate is not stated by the model and is reported to the owner. The dispatcher publishes `ReleaseReady` on `releases.products.v1.release-ready` under the run event envelope and retries a transport outage with backoff (ADR-0012); EnvironmentPromotionService enables the promotion, WorkflowEngineService correlates it for the release workflow, and FleetRolloutService, StudioBff, AuditService and StudioNotificationService consume it in their own suites. When the retries are exhausted for a component that never appears, the release stays Candidate with the failing component named and the counter `connectsoft.factory.delivery.publication_failures` counts it; an Operator re-runs the publication in CI. The model names no trigger that verifies a component again after that, an open point reported to the owner. The `ReleaseNotesWriter` starts from `ReleaseReady`, drafts release notes from the merged proposals and the results with the model profile of `Delivery:Releases:NotesProfile` through ModelRouterService, stores them as an artifact in ArtifactService and records `notesRef`; the notes are never published automatically. ModelRouterService is optional: when it is unavailable no notes are written and the release is unaffected. The writer retries twice with a fixed backoff of 120 seconds and is idempotent on the release id. Recording `notesRef` on a Released release is read as outside the immutable content of the release, a reading reported to the owner. Kind: behavior. Traces: services: ReleaseService, ConnectorRegistryService, ArtifactService, ModelRouterService; aggregates: ReleaseService/ProductRelease; apis: ConnectorRegistryService/Connectors.ReadPackageFeed, ConnectorRegistryService/Connectors.ReadContainerRegistry; events: ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady; adrs: ADR-0012, ADR-0014; requirements: FR-08, NFR-08; scenarios: SCN-ReleaseService-007. Relates: screens: release-evidence. Depends on: AIFACTORY-US-1289, feature:connector-registry-service-deliveries, feature:artifact-service, feature:model-router-service. Sources: model/services/devops-gitops/ReleaseService.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Candidate `ReleaseService/ProductRelease` whose components all appear with their digests in the answers of `ConnectorRegistryService/Connectors.ReadPackageFeed` and `ConnectorRegistryService/Connectors.ReadContainerRegistry`, when the `PublicationVerifier` runs from `ReleaseService/ReleaseCreated`, then every component is Published with the receipt of its read as evidence, the release moves to Released, `ReleaseService/ReleaseReady` is written in the same transaction, and `NewerReleased` is applied to an earlier Released release of the same product, which moves to Superseded (SCN-ReleaseService-007, ADR-0014).",
        "AC2: Given the outbox record, when the dispatcher publishes `ReleaseService/ReleaseReady` on `releases.products.v1.release-ready`, then the event is sent under the run event envelope with `releaseId`, `tenantId`, `projectId`, `productId`, `version` and `components`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ReleaseService-007, ADR-0012).",
        "AC3: Given one component never appears in its registry, or the read of ConnectorRegistryService does not answer, when the six attempts of the verifier are exhausted, then the release stays Candidate with that component named as Failed, `connectsoft.factory.delivery.publication_failures` counts it, `ReleaseService/ReleaseReady` is not published, and a repeated trigger for the same release and component has no second effect (SCN-ReleaseService-007, model/services/devops-gitops/ReleaseService.yaml).",
        "AC4: Given `ReleaseService/ReleaseReady`, when the `ReleaseNotesWriter` runs, then release notes drafted with the profile of `Delivery:Releases:NotesProfile` are stored in ArtifactService and referenced by `notesRef` and published nowhere; given ModelRouterService is unavailable, no notes are written and the release keeps its state (model/services/devops-gitops/ReleaseService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-267",
        "AIFACTORY-TASK-321",
        "AIFACTORY-TASK-5128"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9705,
      "kind": "behavior",
      "traces": {
        "services": [
          "ReleaseService",
          "ConnectorRegistryService",
          "ArtifactService",
          "ModelRouterService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "apis": [
          "ConnectorRegistryService/Connectors.ReadPackageFeed",
          "ConnectorRegistryService/Connectors.ReadContainerRegistry"
        ],
        "events": [
          "ReleaseService/ReleaseCreated",
          "ReleaseService/ReleaseReady"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "NFR-08"
        ],
        "scenarios": [
          "SCN-ReleaseService-007"
        ]
      },
      "relates": {
        "screens": [
          "release-evidence"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1289",
        "feature:connector-registry-service-deliveries",
        "feature:artifact-service",
        "feature:model-router-service"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1291]",
      "number": 1291
    },
    {
      "id": "AIFACTORY-TASK-267",
      "type": "task",
      "parent": "AIFACTORY-US-1291",
      "title": "Hosting of the workers PublicationVerifier and ReleaseNotesWriter",
      "sequence": "08.05.05.01",
      "description": "Hosting of the workers PublicationVerifier and ReleaseNotesWriter. Expected output: The verifier is hosted on ReleaseCreated with exponential retry of six attempts, partitioning by tenant and the idempotency key releaseId and componentName, and the notes writer on ReleaseReady with fixed retry of two attempts and the idempotency key releaseId; a duplicate trigger has no second effect. Only the trigger, retry, partitioning and idempotency key wiring is done here; the behaviour of both workers is implemented by AIFACTORY-TASK-321.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The verifier is hosted on ReleaseCreated with exponential retry of six attempts, partitioning by tenant and the idempotency key releaseId and componentName, and the notes writer on ReleaseReady with fixed retry of two attempts and the idempotency key releaseId; a duplicate trigger has no second effect. Only the trigger, retry, partitioning and idempotency key wiring is done here; the behaviour of both workers is implemented by AIFACTORY-TASK-321."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-267]",
      "number": 267
    },
    {
      "id": "AIFACTORY-TASK-321",
      "type": "task",
      "parent": "AIFACTORY-US-1291",
      "title": "Publication verifier and release notes",
      "sequence": "08.05.05.02",
      "description": "Publication verifier and release notes. Expected output: A release becomes Released only after every image and package is verified in its registry or feed through Connectors.ReadContainerRegistry and Connectors.ReadPackageFeed under factory.connections.read, the receipt of each read kept as evidence, with ReleaseReady in the transaction of AllPublished, and NewerReleased is applied to the earlier Released release of the product; a component never found keeps the release Candidate with the component named; notes are drafted from the merged proposals and results, stored in ArtifactService and never published.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "A release becomes Released only after every image and package is verified in its registry or feed through Connectors.ReadContainerRegistry and Connectors.ReadPackageFeed under factory.connections.read, the receipt of each read kept as evidence, with ReleaseReady in the transaction of AllPublished, and NewerReleased is applied to the earlier Released release of the product; a component never found keeps the release Candidate with the component named; notes are drafted from the merged proposals and results, stored in ArtifactService and never published."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-321]",
      "number": 321
    },
    {
      "id": "AIFACTORY-TASK-5128",
      "type": "task",
      "parent": "AIFACTORY-US-1291",
      "title": "Verify verify-publication-and-ready-a-release through the acceptance suite",
      "sequence": "08.05.05.03",
      "description": "Verify verify-publication-and-ready-a-release through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ReleaseService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1291 with fakes of Connectors.ReadPackageFeed and Connectors.ReadContainerRegistry that hold or lack a component or stop answering, a transport that can be stopped and a fake ModelRouterService that can be unavailable.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ReleaseService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1291 with fakes of Connectors.ReadPackageFeed and Connectors.ReadContainerRegistry that hold or lack a component or stop answering, a transport that can be stopped and a fake ModelRouterService that can be unavailable."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5128]",
      "number": 5128
    },
    {
      "id": "AIFACTORY-US-1292",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Withdraw a release with a reason so that it can no longer be promoted",
      "sequence": "08.05.06",
      "description": "A caller whose scope carries `factory.delivery.release`, an Operator or a Workspace admin, withdraws a release of the caller's tenant and project through `ReleaseService/WithdrawProductRelease` with a reason. A Candidate or a Released release moves to Withdrawn (trigger `Withdraw`) and `ReleaseWithdrawn` with `releaseId`, `tenantId`, `productId`, `version` and `reason` is written in the same transaction; the answer is 200. The withdrawal blocks every later promotion of the release and revokes nothing already deployed. The dispatcher publishes `ReleaseWithdrawn` on `releases.products.v1.release-withdrawn` under the run event envelope and retries a transport outage with backoff, so the event is neither lost nor duplicated (ADR-0012); EnvironmentPromotionService blocks the promotion, and StudioBff and AuditService consume it, each in its own suite. The idempotency of the route is natural: a repeated withdrawal of a release already Withdrawn answers 200 and writes nothing. A Superseded release, from which the model draws no withdrawal, is refused with 409. A caller without the scope is refused with 403, and a release of another tenant is answered 404, the same answer as for a release that does not exist (ADR-0015). Kind: behavior. Traces: services: ReleaseService; aggregates: ReleaseService/ProductRelease; apis: ReleaseService/WithdrawProductRelease; events: ReleaseService/ReleaseWithdrawn; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-08; scenarios: SCN-ReleaseService-004, SCN-ReleaseService-008. Relates: screens: release-detail. Depends on: AIFACTORY-US-1289. Sources: model/services/devops-gitops/ReleaseService.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a Candidate or a Released `ReleaseService/ProductRelease` of my tenant and project, when `ReleaseService/WithdrawProductRelease` is called with a reason, then the response is 200, the release is Withdrawn and `ReleaseService/ReleaseWithdrawn` was written in the same transaction (SCN-ReleaseService-004, ADR-0014).",
        "AC2: Given a release already Withdrawn, a Superseded release, a caller without `factory.delivery.release`, or a release of another tenant or unknown, when `ReleaseService/WithdrawProductRelease` is called, then the repeat answers 200 and writes nothing, the Superseded release is refused with 409, the missing scope with 403 and the foreign or unknown release with 404, each refusal with a problem response and no state change (SCN-ReleaseService-004, ADR-0015).",
        "AC3: Given the outbox record, when the dispatcher publishes `ReleaseService/ReleaseWithdrawn` on `releases.products.v1.release-withdrawn`, then the event is sent under the run event envelope with `releaseId`, `tenantId`, `productId`, `version` and `reason`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ReleaseService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5129",
        "AIFACTORY-TASK-5130"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9706,
      "kind": "behavior",
      "traces": {
        "services": [
          "ReleaseService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "apis": [
          "ReleaseService/WithdrawProductRelease"
        ],
        "events": [
          "ReleaseService/ReleaseWithdrawn"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08"
        ],
        "scenarios": [
          "SCN-ReleaseService-004",
          "SCN-ReleaseService-008"
        ]
      },
      "relates": {
        "screens": [
          "release-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1289"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1292]",
      "number": 1292
    },
    {
      "id": "AIFACTORY-TASK-5129",
      "type": "task",
      "parent": "AIFACTORY-US-1292",
      "title": "WithdrawProductRelease with ReleaseWithdrawn",
      "sequence": "08.05.06.01",
      "description": "WithdrawProductRelease with ReleaseWithdrawn. Expected output: WithdrawProductRelease applies Withdraw from Candidate or Released in the transaction of the ReleaseWithdrawn outbox record with the reason, answers 200, answers 200 without a write for a release already Withdrawn, 409 for a Superseded release, 403 for a missing scope and 404 for a foreign or unknown release.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "WithdrawProductRelease applies Withdraw from Candidate or Released in the transaction of the ReleaseWithdrawn outbox record with the reason, answers 200, answers 200 without a write for a release already Withdrawn, 409 for a Superseded release, 403 for a missing scope and 404 for a foreign or unknown release."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5129]",
      "number": 5129
    },
    {
      "id": "AIFACTORY-TASK-5130",
      "type": "task",
      "parent": "AIFACTORY-US-1292",
      "title": "Verify withdraw-a-product-release through the acceptance suite",
      "sequence": "08.05.06.02",
      "description": "Verify withdraw-a-product-release through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ReleaseService-004|Scenario=SCN-ReleaseService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1292 over a two-tenant fixture and a transport that can be stopped; consumer handling is proven by the consumers' own suites.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ReleaseService-004|Scenario=SCN-ReleaseService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1292 over a two-tenant fixture and a transport that can be stopped; consumer handling is proven by the consumers' own suites."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9706,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5130]",
      "number": 5130
    },
    {
      "id": "AIFACTORY-US-1293",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Resolve a release with its digests and evidence for promotion over gRPC",
      "sequence": "08.05.07",
      "description": "EnvironmentPromotionService, the inbound caller the model names, and the fleet inventory in its increment call the internal gRPC method `ReleaseService/Releases.GetRelease` with a workload identity to resolve a release before a promotion. The reply carries the release with its state, version, commit, the components with their digests and publication evidence, the SBOM and attestation references, so that the promotion deploys exactly the digests of the release and refuses a release that is not Released; a Withdrawn release is answered in state Withdrawn. The method is of class read: it writes nothing and publishes nothing, and a repeated call returns the same answer while the release does not change. The method admits a workload token only with `factory.delivery.read`, the service scope of the method (D114, D135). A caller without a workload identity is refused with UNAUTHENTICATED, a token without `factory.delivery.read` with PERMISSION_DENIED, a request without a release id with INVALID_ARGUMENT, and an unknown release and a release of another tenant alike with NOT_FOUND, which never confirms that a foreign release exists (ADR-0015 amendment D114). The request and the reply are typed `release-manifest-v1`, the manifest of an asset release, which has no member for components, digests or publication evidence of a product release; which descriptor carries them is an open point reported to the owner, and this PBI does not invent members. Kind: behavior. Traces: services: ReleaseService, EnvironmentPromotionService; aggregates: ReleaseService/ProductRelease; apis: ReleaseService/Releases.GetRelease; descriptors: release-manifest-v1; adrs: ADR-0015; requirements: FR-08; scenarios: SCN-ReleaseService-005. Depends on: AIFACTORY-US-1294, AIFACTORY-US-1295. Sources: model/services/devops-gitops/ReleaseService.yaml, docs/reference/schemas/release-manifest.schema.json, docs/planes/execution/delivery-engine/services/release-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given EnvironmentPromotionService with a workload token that holds `factory.delivery.read` and a Released `ReleaseService/ProductRelease` of the forwarded tenant, when `ReleaseService/Releases.GetRelease` is called with its release id, then the reply carries the state, version, commit, components with digests and publication evidence and the SBOM and attestation references, and nothing is written (SCN-ReleaseService-005).",
        "AC2: Given a Withdrawn or a Candidate release, when `ReleaseService/Releases.GetRelease` is called, then the reply carries that state, so the caller can refuse the promotion of a release that is not Released (SCN-ReleaseService-005).",
        "AC3: Given a caller without a workload identity, a token without `factory.delivery.read`, a request without a release id, or a release that is unknown or of another tenant, when `ReleaseService/Releases.GetRelease` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, the foreign release answered like the unknown one, and no state changes (SCN-ReleaseService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5131",
        "AIFACTORY-TASK-5132"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9707,
      "kind": "behavior",
      "traces": {
        "services": [
          "ReleaseService",
          "EnvironmentPromotionService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "apis": [
          "ReleaseService/Releases.GetRelease"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-08"
        ],
        "scenarios": [
          "SCN-ReleaseService-005"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1294",
        "AIFACTORY-US-1295"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1293]",
      "number": 1293
    },
    {
      "id": "AIFACTORY-TASK-5131",
      "type": "task",
      "parent": "AIFACTORY-US-1293",
      "title": "Releases.GetRelease read method for promotion and fleet inventory",
      "sequence": "08.05.07.01",
      "description": "Releases.GetRelease read method for promotion and fleet inventory. Expected output: The gRPC method resolves a release by id under the tenant row filter and replies with state, version, commit, components with digests and evidence and the SBOM and attestation references, writes nothing, admits a workload token only with factory.delivery.read, and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND, a foreign release like an unknown one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "The gRPC method resolves a release by id under the tenant row filter and replies with state, version, commit, components with digests and evidence and the SBOM and attestation references, writes nothing, admits a workload token only with factory.delivery.read, and refuses with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND, a foreign release like an unknown one."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9707,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5131]",
      "number": 5131
    },
    {
      "id": "AIFACTORY-TASK-5132",
      "type": "task",
      "parent": "AIFACTORY-US-1293",
      "title": "Verify resolve-a-release-for-promotion through the acceptance suite",
      "sequence": "08.05.07.02",
      "description": "Verify resolve-a-release-for-promotion through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ReleaseService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1293 over Released, Candidate and Withdrawn releases of two tenants.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ReleaseService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1293 over Released, Candidate and Withdrawn releases of two tenants."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9707,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5132]",
      "number": 5132
    },
    {
      "id": "AIFACTORY-US-1294",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Scaffold ReleaseService with the ProductRelease aggregate and its store",
      "sequence": "08.05.08",
      "description": "ReleaseService has its own repository, ConnectSoft.AI.SoftwareFactory.ReleaseService, its own deployable and its own stores (ADR-0028). The repository is created by the steps of the repository checklist of feature repository-and-pipeline-conventions and scaffolded once from the pinned base template package with `UseFactoryProfile` (feature component-base-template-factory-profile, consumed by its pinned version), so token validation, scope enforcement, problem responses, the tenant row filter, health, readiness and the telemetry wiring come from the profile. The domain model holds the `ProductRelease` aggregate with its `ReleaseComponent` entities, the states of `ReleaseState`, the five transitions the model draws (`ComponentsResolved`, `AllPublished`, `NewerReleased` and `Withdraw` from Candidate and from Released), the kinds of `ComponentKind`, the publication states of `PublicationState` and its three invariants: a Released release is immutable and a Withdrawn one cannot be promoted, every component has a digest and a component without evidence keeps the release Candidate, and a release without provenance is refused. The store `release-sql` holds `ProductReleases` and `ReleaseComponents` with the unique index `UX_Releases_Product_Version`, the index `IX_Releases_State` and the tenant filter; SBOMs, attestations and notes live by reference in ArtifactService. Mapping tests run against an isolated test database. When the store is lost it is restored from backup within the recovery point of 15 minutes. Kind: enabling. Traces: services: ReleaseService; aggregates: ReleaseService/ProductRelease; adrs: ADR-0014, ADR-0015, ADR-0028. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile. Sources: model/services/devops-gitops/ReleaseService.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given the repository created by the repository checklist, when its pipeline runs, then the first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ReleaseService --UseFactoryProfile true` from the pinned template package, the solution builds and the template tests pass (ADR-0028, model/services/devops-gitops/ReleaseService.yaml).",
        "AC2: Given the domain model, when its unit tests run, then the `ReleaseService/ProductRelease` applies each of its five drawn transitions from its source state only, refuses every other move, refuses a component without a digest and a release without provenance, and keeps a Released release unchanged (ADR-0014).",
        "AC3: Given the store `release-sql`, when the mapping tests run against an isolated test database, then `ProductReleases` and `ReleaseComponents` are mapped with their keys, the unique index on tenant, product and version and the tenant filter, and a row of another tenant is never read (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-262",
        "AIFACTORY-TASK-263",
        "AIFACTORY-TASK-264",
        "AIFACTORY-TASK-5133"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9708,
      "kind": "enabling",
      "traces": {
        "services": [
          "ReleaseService"
        ],
        "aggregates": [
          "ReleaseService/ProductRelease"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-1294]",
      "number": 1294
    },
    {
      "id": "AIFACTORY-TASK-262",
      "type": "task",
      "parent": "AIFACTORY-US-1294",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ReleaseService and scaffold it from the ConnectSoft.BaseTemplate template",
      "sequence": "08.05.08.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ReleaseService and scaffold it from the ConnectSoft.BaseTemplate template. Expected output: The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ReleaseService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `release`; the solution builds and the template tests pass in the repository pipeline.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ReleaseService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ReleaseService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `release`; the solution builds and the template tests pass in the repository pipeline."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9708,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-262]",
      "number": 262
    },
    {
      "id": "AIFACTORY-TASK-263",
      "type": "task",
      "parent": "AIFACTORY-US-1294",
      "title": "Domain model: ProductRelease",
      "sequence": "08.05.08.02",
      "description": "Domain model: ProductRelease. Expected output: Aggregates with their invariants and state transitions as modelled; unit tests cover every invariant and every transition.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Aggregates with their invariants and state transitions as modelled; unit tests cover every invariant and every transition."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9708,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-263]",
      "number": 263
    },
    {
      "id": "AIFACTORY-TASK-264",
      "type": "task",
      "parent": "AIFACTORY-US-1294",
      "title": "Persistence in release-sql: ProductReleases, ReleaseComponents",
      "sequence": "08.05.08.03",
      "description": "Persistence in release-sql: ProductReleases, ReleaseComponents. Expected output: Mappings and migrations for the modelled tables with tenant filters and indexes; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the modelled tables with tenant filters and indexes; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9708,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-264]",
      "number": 264
    },
    {
      "id": "AIFACTORY-TASK-5133",
      "type": "task",
      "parent": "AIFACTORY-US-1294",
      "title": "Verify the scaffold, domain and store of ReleaseService",
      "sequence": "08.05.08.04",
      "description": "Verify the scaffold, domain and store of ReleaseService. Expected output: Run `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1294 against model/services/devops-gitops/ReleaseService.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1294 against model/services/devops-gitops/ReleaseService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9708,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5133]",
      "number": 5133
    },
    {
      "id": "AIFACTORY-US-1295",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-045",
      "title": "Host every operation, event and handler of ReleaseService with its security and telemetry",
      "sequence": "08.05.09",
      "description": "ReleaseService hosts its four REST routes and its gRPC method behind the scopes `factory.delivery.read` and `factory.delivery.release`, with problem responses for every modelled code, the `Idempotency-Key` filter of `CreateProductRelease` and the workload check of `Releases.GetRelease`; the behaviour of each operation is delivered by its own PBI. The messaging profile `release` publishes `ReleaseCreated`, `ReleaseReady` and `ReleaseWithdrawn` under the run event envelope through its outbox and registers `PipelineRunCompleted` and `ChangeProposalMerged` of PipelineExecutionService in its inbox with idempotency on the event id; the gauge `connectsoft.factory.delivery.inbox_lag` reports the age of the oldest unprocessed message, and the inbox and the outbox belong to this service alone (ADR-0028). Tenant isolation is a row filter on every query; the only secret, the messaging transport, comes from Key Vault by reference with a rotation of 90 days; the data classification is internal and the highest side-effect class is shared-write. A user token reaches the service with the audience of its gateway, DeliveryHost, which the service accepts (ADR-0015 amendment D117). Traces, the three metrics of the model and health checks follow the observability conventions, and readiness stays unready while the store is unavailable. Kind: enabling. Traces: services: ReleaseService; apis: ReleaseService/Releases.GetRelease; events: ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady, ReleaseService/ReleaseWithdrawn, PipelineExecutionService/PipelineRunCompleted, PipelineExecutionService/ChangeProposalMerged; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028; requirements: NFR-12. Depends on: AIFACTORY-US-1294, feature:delivery-host, feature:pipeline-execution-service-complete. Sources: model/services/devops-gitops/ReleaseService.yaml, docs/planes/execution/delivery-engine/services/release-service/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given the hosted service, when each REST route and `ReleaseService/Releases.GetRelease` is called without a token, with a token lacking its scope or without a workload identity, then it is refused with the modelled problem response or gRPC status before any handler runs (ADR-0015, model/services/devops-gitops/ReleaseService.yaml).",
        "AC2: Given the messaging profile `release`, when the contract tests run, then `ReleaseService/ReleaseCreated`, `ReleaseService/ReleaseReady` and `ReleaseService/ReleaseWithdrawn` carry their modelled payload under the run event envelope, and `PipelineExecutionService/PipelineRunCompleted` and `PipelineExecutionService/ChangeProposalMerged` are registered in the inbox with idempotency on the event id (ADR-0012, ADR-0014).",
        "AC3: Given a query of any route, when it runs, then it is filtered by the trusted tenant, the three metrics of the model are emitted with their dimensions, and no secret value reaches a log record, an event or a reply (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-265",
        "AIFACTORY-TASK-266",
        "AIFACTORY-TASK-268",
        "AIFACTORY-TASK-5134"
      ],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9709,
      "kind": "enabling",
      "traces": {
        "services": [
          "ReleaseService"
        ],
        "apis": [
          "ReleaseService/Releases.GetRelease"
        ],
        "events": [
          "ReleaseService/ReleaseCreated",
          "ReleaseService/ReleaseReady",
          "ReleaseService/ReleaseWithdrawn",
          "PipelineExecutionService/PipelineRunCompleted",
          "PipelineExecutionService/ChangeProposalMerged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1294",
        "feature:delivery-host",
        "feature:pipeline-execution-service-complete"
      ],
      "source": [
        "model/services/devops-gitops/ReleaseService.yaml",
        "docs/planes/execution/delivery-engine/services/release-service/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-1295]",
      "number": 1295
    },
    {
      "id": "AIFACTORY-TASK-265",
      "type": "task",
      "parent": "AIFACTORY-US-1295",
      "title": "API surface: 4 REST and 1 gRPC operations (ListProductReleases, GetProductRelease, CreateProductRelease, WithdrawProductRelease, Releases.GetRelease)",
      "sequence": "08.05.09.01",
      "description": "API surface: 4 REST and 1 gRPC operations (ListProductReleases, GetProductRelease, CreateProductRelease, WithdrawProductRelease, Releases.GetRelease). Expected output: Every modelled operation is hosted with its scope, side-effect class, idempotency rule and problem responses, and the OpenAPI and proto documents match the model; the behaviour of each operation is delivered by AIFACTORY-US-1288, AIFACTORY-US-1289, AIFACTORY-US-1292 and AIFACTORY-US-1293.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Every modelled operation is hosted with its scope, side-effect class, idempotency rule and problem responses, and the OpenAPI and proto documents match the model; the behaviour of each operation is delivered by AIFACTORY-US-1288, AIFACTORY-US-1289, AIFACTORY-US-1292 and AIFACTORY-US-1293."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-265]",
      "number": 265
    },
    {
      "id": "AIFACTORY-TASK-266",
      "type": "task",
      "parent": "AIFACTORY-US-1295",
      "title": "Messaging: publishes 3 events, handles 2",
      "sequence": "08.05.09.02",
      "description": "Messaging: publishes 3 events, handles 2. Expected output: Events are published through the outbox of the service with the run envelope (ReleaseCreated, ReleaseReady, ReleaseWithdrawn); consumed events are handled idempotently through its inbox.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Events are published through the outbox of the service with the run envelope (ReleaseCreated, ReleaseReady, ReleaseWithdrawn); consumed events are handled idempotently through its inbox."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-266]",
      "number": 266
    },
    {
      "id": "AIFACTORY-TASK-268",
      "type": "task",
      "parent": "AIFACTORY-US-1295",
      "title": "Security, tenancy and telemetry of ReleaseService",
      "sequence": "08.05.09.03",
      "description": "Security, tenancy and telemetry of ReleaseService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered, secrets come from secret references, and traces, metrics and health checks follow the observability conventions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered, secrets come from secret references, and traces, metrics and health checks follow the observability conventions."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-268]",
      "number": 268
    },
    {
      "id": "AIFACTORY-TASK-5134",
      "type": "task",
      "parent": "AIFACTORY-US-1295",
      "title": "Verify the hosting of ReleaseService through the contract suite",
      "sequence": "08.05.09.04",
      "description": "Verify the hosting of ReleaseService through the contract suite. Expected output: Run `dotnet test -c Release --filter \"Category=Contract\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1295 against model/services/devops-gitops/ReleaseService.yaml and model/descriptors.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ReleaseService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Contract\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1295 against model/services/devops-gitops/ReleaseService.yaml and model/descriptors.yaml."
      ],
      "sourceArtifacts": [
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:devops-gitops",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ReleaseService"
      ],
      "children": [],
      "buildOrder": 97,
      "phase": "factory",
      "stackRank": 9709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5134]",
      "number": 5134
    },
    {
      "id": "AIFACTORY-EPIC-009",
      "type": "epic",
      "parent": null,
      "title": "Runtime Cloud (PF-09)",
      "sequence": "09",
      "description": "Everything that builds the Runtime Cloud platform (PF-09): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Provisioning and reconciliation, environments, execution capacity and worker pools. Done when: Every service of the platform has its complete delivery accepted (ExecutionCapacityService, IaCProvisioningService, RuntimeCloudHost, RuntimeEnvironmentService), the platform gateway routes them under a trusted scope, and the outcome verification of I2 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (ExecutionCapacityService, IaCProvisioningService, RuntimeCloudHost, RuntimeEnvironmentService), the platform gateway routes them under a trusted scope, and the outcome verification of I2 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-046",
        "AIFACTORY-FEAT-047",
        "AIFACTORY-FEAT-048",
        "AIFACTORY-FEAT-049",
        "AIFACTORY-FEAT-050"
      ],
      "stackRank": 7399,
      "titlePrefix": "[AIFACTORY-EPIC-009]",
      "number": 9
    },
    {
      "id": "AIFACTORY-FEAT-046",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-009",
      "title": "ExecutionCapacityService: thin delivery for the first outcome",
      "sequence": "09.01",
      "description": "ExecutionCapacityService is the service of bounded context BC-26 (Execution Capacity). Worker pools (agent runtime, sandbox, build runner, browser) with security boundary, size and autoscaling; quotas per tenant and project tied to the edition; capacity leases per attempt, sandbox, build or session, granted within quota, renewed and released, so placement is explicit and no tenant starves another (BC-26; pool manager and scaling rows merged). In this increment it is delivered thin: Sandbox and workspace leases from one worker pool; no quotas. Its own repository is ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Delivers: ExecutionCapacityService (thin: Sandbox and workspace leases from one worker pool; no quotas.). Stubbed in this increment: IaCProvisioningService (static, completed in I2); FactoryCommercialService (static, completed in I7); RetentionResidencyService (static, completed in I4). Increment I1: Generate a microservice. Build order 74 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-068",
        "AIFACTORY-US-1036",
        "AIFACTORY-US-1037",
        "AIFACTORY-US-1038",
        "AIFACTORY-US-1039",
        "AIFACTORY-US-1040"
      ],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7400,
      "titlePrefix": "[AIFACTORY-FEAT-046]",
      "number": 46
    },
    {
      "id": "AIFACTORY-US-068",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-046",
      "title": "ExecutionCapacityService leases sandboxes with the workspace of the run from one pool for the first outcome",
      "sequence": "09.01.01",
      "description": "As an operator, I want ExecutionCapacityService to lease the sandboxes of the first-outcome chain from one worker pool and to own the workspace of each run, so that every tool that writes or builds runs in a sandbox placed by one owner and the files of a run survive from one step to the next. This is the integration PBI of the thin delivery. ExecutionCapacityService is the service of bounded context BC-26. In its complete form it manages worker pools of four kinds, quotas per tenant and project and capacity leases for attempts, sandboxes, builds and browser sessions; that form arrives with feature `execution-capacity-service-complete` in I2. The first outcome needs exactly this (the thin scope of model/backlog/features/runtime-cloud.yaml): sandbox and workspace leases from one worker pool, with no quota. ToolAdapterService is the one caller of the thin delivery: its broker stage acquires a sandbox lease through `ExecutionCapacityService/Capacity.AcquireLease` with the tenant, project, run and attempt of the call, renews it through `ExecutionCapacityService/Capacity.RenewLease` and ends it through `SandboxReleased`, which this service consumes, or through `ExecutionCapacityService/Capacity.ReleaseLease`. The workspace of a run belongs to this service (D121): it is created with the first lease of the run, kept between leases, handed to the holder through the `workspaceRef` of every lease that names the run and removed when RunControlService announces that the run ended. The repository read tools run inside the sandbox of the tool executor with the workspace mounted read-only (D125), so this service adds no operation that reads a workspace. The feature is delivered by five PBIs: the grant of a lease with the workspace of the run (AIFACTORY-US-1036), renewal and expiry (AIFACTORY-US-1037), release (AIFACTORY-US-1038), the one sandbox pool and its sandboxes (AIFACTORY-US-1039) and the removal of the workspace on a terminal run event (AIFACTORY-US-1040). Nothing else is served in I1: the five REST operations arrive with the complete delivery behind RuntimeCloudHost in I2, no quota exists, so neither `QuotaChanged` nor `QuotaExceeded` is written, the pool is declared statically, so no `WorkerPoolStateChanged` is written, attempt, build and browser leases are not served, and the workers `Autoscaler` and the handlers of `AttemptOutcomeRecorded` and `ProvisioningApplied` arrive in I2. IaCProvisioningService, FactoryCommercialService and RetentionResidencyService are static stubs of this increment. The handler of a deletion order is built in I4 with RetentionResidencyService and none is registered here. The repository ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService is created and scaffolded in I0 by AIFACTORY-TASK-095 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; it was scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`): the scaffold brings token validation, the scope chain with its 401, 403 and 404 answers, health and readiness, the Orleans messaging profile `execution-capacity` whose outbox writes the run event envelope of the contracts package in the transaction of each command (ADR-0012, ADR-0014), and the telemetry wiring. The internal gRPC methods admit a workload token by the service scope `factory.capacity.lease`; a workload token carries no tenant claim, so the tenant, the project and the run of a lease are those of the Factory scope the caller carries on the call, and a lease of another tenant is answered NOT_FOUND (ADR-0015). Metrics carry the tenant and the project by default, the run and the attempt go on activities and log records only, and no workspace content, path listing or command text reaches telemetry (ADR-0019). Kind: behavior. Traces: services: ExecutionCapacityService, ToolAdapterService, RunControlService; aggregates: ExecutionCapacityService/CapacityLease, ExecutionCapacityService/WorkerPool; apis: ExecutionCapacityService/Capacity.AcquireLease, ExecutionCapacityService/Capacity.RenewLease, ExecutionCapacityService/Capacity.ReleaseLease; events: ExecutionCapacityService/CapacityLeaseGranted, ExecutionCapacityService/CapacityLeaseReleased, RunControlService/RunCompleted; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0017, ADR-0019, ADR-0024, ADR-0028; requirements: NFR-09. Relates: nfrs: NFR-06, NFR-09. Depends on: AIFACTORY-US-1036, AIFACTORY-US-1037, AIFACTORY-US-1038, AIFACTORY-US-1039, AIFACTORY-US-1040, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-observability-factory-conventions, feature:contracts-package, feature:trusted-scope-chain, feature:run-control-service. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/backlog/features/runtime-cloud.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#apis, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService created and scaffolded in I0 by AIFACTORY-TASK-095 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService --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 with complete reports and a container image is published (ADR-0028, model/services/runtime-cloud/ExecutionCapacityService.yaml).",
        "AC2: Given the deployed service with its one sandbox pool and a fake ToolAdapterService caller with a workload identity, when two attempts of one run each acquire a lease through `ExecutionCapacityService/Capacity.AcquireLease`, renew it through `ExecutionCapacityService/Capacity.RenewLease` and end it, the first by `SandboxReleased` and the second through `ExecutionCapacityService/Capacity.ReleaseLease`, and the run then ends with `RunControlService/RunCompleted`, then a file the first sandbox wrote is read by the second, both leases carry the same `workspaceRef`, `ExecutionCapacityService/CapacityLeaseGranted` and `ExecutionCapacityService/CapacityLeaseReleased` are published twice each, and the workspace is removed once, as AIFACTORY-US-1036 to AIFACTORY-US-1040 prove one by one (D121).",
        "AC3: Given the service descriptor and the proto of the thin delivery, when the contract test compares them with model/services/runtime-cloud/ExecutionCapacityService.yaml and the scope of model/backlog/features/runtime-cloud.yaml, then the three gRPC methods of `Capacity` are served, none of the five REST operations is routed, the outbox declares `ExecutionCapacityService/CapacityLeaseGranted` and `ExecutionCapacityService/CapacityLeaseReleased` only, the inbox registers `SandboxReleased` and the three terminal run events only, and the test fails when an operation or an event outside the thin scope appears.",
        "AC4: Given calls without workload identity, with a workload token that lacks `factory.capacity.lease`, and with a lease of another tenant, when they reach any of the three methods of `ExecutionCapacityService/Capacity.AcquireLease`, `ExecutionCapacityService/Capacity.RenewLease` and `ExecutionCapacityService/Capacity.ReleaseLease`, then they are refused with UNAUTHENTICATED, PERMISSION_DENIED and NOT_FOUND, the last the same answer as for a lease that does not exist, and nothing is written; given the service starts, then liveness and readiness answer, readiness only once the store `execution-capacity-sql` and the messaging profile are reachable (ADR-0015).",
        "AC5: Given leases of two tenants and two projects, when the metrics, logs and activities of the service are read, then `connectsoft.factory.capacity.leases_active`, `connectsoft.factory.capacity.lease_wait`, `connectsoft.factory.capacity.pool_utilisation` and `connectsoft.factory.capacity.inbox_lag` are emitted with the dimensions of model/services/runtime-cloud/ExecutionCapacityService.yaml, the tenant and the project on the lease metrics by default, the run and the attempt on activities and log records only, and no record holds a workspace path listing, file content or command text (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/backlog/features/runtime-cloud.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-096",
        "AIFACTORY-TASK-097",
        "AIFACTORY-TASK-782"
      ],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7401,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "ExecutionCapacityService/CapacityLease",
          "ExecutionCapacityService/WorkerPool"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.AcquireLease",
          "ExecutionCapacityService/Capacity.RenewLease",
          "ExecutionCapacityService/Capacity.ReleaseLease"
        ],
        "events": [
          "ExecutionCapacityService/CapacityLeaseGranted",
          "ExecutionCapacityService/CapacityLeaseReleased",
          "RunControlService/RunCompleted"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0024",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-09"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-06",
          "NFR-09"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1036",
        "AIFACTORY-US-1037",
        "AIFACTORY-US-1038",
        "AIFACTORY-US-1039",
        "AIFACTORY-US-1040",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-observability-factory-conventions",
        "feature:contracts-package",
        "feature:trusted-scope-chain",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/backlog/features/runtime-cloud.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-068]",
      "number": 68
    },
    {
      "id": "AIFACTORY-TASK-096",
      "type": "task",
      "parent": "AIFACTORY-US-068",
      "title": "Thin host wiring: the three gRPC methods, the messaging profile, the thin tables, tenancy and telemetry",
      "sequence": "09.01.01.01",
      "description": "Thin host wiring: the three gRPC methods, the messaging profile, the thin tables, tenancy and telemetry. Expected output: The host serves the three gRPC methods of Capacity with workload identity checks and the scope factory.capacity.lease and routes no REST operation; the messaging profile execution-capacity enlists its outbox in the transaction of each command for CapacityLeaseGranted and CapacityLeaseReleased under the run event envelope of the contracts package and registers in its inbox SandboxReleased of ToolAdapterService and RunCompleted, RunFailed and RunCancelled of RunControlService, idempotent on the event id; the migrations of execution-capacity-sql create WorkerPools, CapacityLeases and RunWorkspaces with the tenant row filter and the modelled indexes; the four metrics of the thin scope are registered through the helper of the pinned observability library, the deployment holds the replica range 2 to 6 and the secret reference messaging-transport; the behaviour of each operation is delivered by AIFACTORY-US-1036 to AIFACTORY-US-1040.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The host serves the three gRPC methods of Capacity with workload identity checks and the scope factory.capacity.lease and routes no REST operation; the messaging profile execution-capacity enlists its outbox in the transaction of each command for CapacityLeaseGranted and CapacityLeaseReleased under the run event envelope of the contracts package and registers in its inbox SandboxReleased of ToolAdapterService and RunCompleted, RunFailed and RunCancelled of RunControlService, idempotent on the event id; the migrations of execution-capacity-sql create WorkerPools, CapacityLeases and RunWorkspaces with the tenant row filter and the modelled indexes; the four metrics of the thin scope are registered through the helper of the pinned observability library, the deployment holds the replica range 2 to 6 and the secret reference messaging-transport; the behaviour of each operation is delivered by AIFACTORY-US-1036 to AIFACTORY-US-1040."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-096]",
      "number": 96
    },
    {
      "id": "AIFACTORY-TASK-097",
      "type": "task",
      "parent": "AIFACTORY-US-068",
      "title": "Contract of the thin surface and contract tests of the capacity lease messages and the two published events",
      "sequence": "09.01.01.02",
      "description": "Contract of the thin surface and contract tests of the capacity lease messages and the two published events. Expected output: The proto fixes the request of AcquireLease with tenant, project, run, attempt, holder kind, holder id, cpu, memory, mount mode and egress allow list, the reply with lease id, state, pool id, expiry, workspaceRef and, for a denial, the limit that denied it, the renew and release requests by lease id and the acknowledgement of a release; the model names acquire-lease-v1, lease-v1 and ack-v1 for these methods, which docs/reference/schemas/attempt-outcome.schema.json defines as the attempt lease of RunControlService, so the gap is reported to the owner and the golden files make the contract checkable without deciding it; the contract tests compare the descriptor with model/services/runtime-cloud/ExecutionCapacityService.yaml in both directions and the payloads of CapacityLeaseGranted and CapacityLeaseReleased with the model, so the complete delivery replaces the thin one without a contract change.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The proto fixes the request of AcquireLease with tenant, project, run, attempt, holder kind, holder id, cpu, memory, mount mode and egress allow list, the reply with lease id, state, pool id, expiry, workspaceRef and, for a denial, the limit that denied it, the renew and release requests by lease id and the acknowledgement of a release; the model names acquire-lease-v1, lease-v1 and ack-v1 for these methods, which docs/reference/schemas/attempt-outcome.schema.json defines as the attempt lease of RunControlService, so the gap is reported to the owner and the golden files make the contract checkable without deciding it; the contract tests compare the descriptor with model/services/runtime-cloud/ExecutionCapacityService.yaml in both directions and the payloads of CapacityLeaseGranted and CapacityLeaseReleased with the model, so the complete delivery replaces the thin one without a contract change."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7401,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-097]",
      "number": 97
    },
    {
      "id": "AIFACTORY-TASK-782",
      "type": "task",
      "parent": "AIFACTORY-US-068",
      "title": "Verify execution-capacity-service-thin-contract by running the declared command",
      "sequence": "09.01.01.03",
      "description": "Verify execution-capacity-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-068, that is the scaffold, the two-attempt chain over one workspace with a fake ToolAdapterService caller and a fake RunControlService publisher (SCN-ExecutionCapacityService-006, SCN-ExecutionCapacityService-008), the surface limited to the thin scope, the refusals of the three methods and the telemetry conformance over two tenants and two projects.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-068, that is the scaffold, the two-attempt chain over one workspace with a fake ToolAdapterService caller and a fake RunControlService publisher (SCN-ExecutionCapacityService-006, SCN-ExecutionCapacityService-008), the surface limited to the thin scope, the refusals of the three methods and the telemetry conformance over two tenants and two projects."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-782]",
      "number": 782
    },
    {
      "id": "AIFACTORY-US-1036",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-046",
      "title": "Grant a sandbox lease from the one pool and hand over the workspace of the run, created with its first lease",
      "sequence": "09.01.02",
      "description": "As an operator, I want every sandbox of the chain to be granted from the pool through one lease that also names the workspace of its run, so that placement is explicit, the pool is never oversubscribed and a later step finds the files an earlier step wrote. ToolAdapterService, with a workload identity whose token carries `factory.capacity.lease`, calls `ExecutionCapacityService/Capacity.AcquireLease` for a sandbox with the tenant, the project, the run and the attempt of the tool call, the holder kind `sandbox` and the invocation as holder id, the cpu and memory of the call, the mount mode and the egress allow list. The tenant, project and run are those of the Factory scope the call carries; a workload token has no tenant claim. The request is serialised per pool by `PoolGrain` (ADR-0024). Grain serialisation alone does not guarantee exact accounting: the amendment of ADR-0024 records that Orleans allows occasional duplicate activations with the default grain directory and offers no lease or fencing feature. The grant therefore commits with a concurrency check on the granted cpu and memory of the pool in `execution-capacity-sql`, and a grant whose check fails is evaluated again, so a duplicate activation of `PoolGrain` cannot oversubscribe the pool. When the one sandbox pool has the capacity, a `CapacityLease` is written in state Granted from Requested (trigger `CapacityAvailable`) with `grantedAt` and `expiresAt` at the grant plus `RuntimeCloud:Capacity:LeaseTtlSeconds`, and `CapacityLeaseGranted` is written to the outbox in the same transaction. A lease that names a run receives the workspace of that run. The first lease of the run creates the workspace storage of the run on the pool, isolated per run and tenant, and the `RunWorkspace` with `createdWithLeaseId` whose `workspaceRef` resolves to that storage, in the same transaction as the grant. Every later lease of the same run, of any step and attempt, receives the same `workspaceRef`, so a run has one workspace (D121). The model does not say which medium holds the workspace, a volume or a share on the pool; the medium is an owner input, an entry of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140). The reply carries the lease with its id, state, pool, expiry and `workspaceRef`. When the pool has no free capacity the lease moves from Requested to Denied (trigger `QuotaOrPoolExhausted`) and the reply names the pool as the limit; no quota exists in I1, so no `QuotaExceeded` is written, and ToolAdapterService asks again with backoff until the deadline of its call. As a design choice of this PBI, a repeated request for the same holder kind and holder id while its lease is Granted or Active returns that lease and grants nothing twice. Refusals change nothing: no workload identity is UNAUTHENTICATED, a token without the scope is PERMISSION_DENIED, a request without tenant, project or run, with an unknown holder kind or with cpu or memory outside the bounds of the pool is INVALID_ARGUMENT, a holder kind the thin scope does not serve, `attempt`, `build` or `browser`, is FAILED_PRECONDITION, because the one pool is a sandbox pool and the other kinds arrive with the complete delivery. The invariant of `WorkerPool` lets sandboxes with network egress to the internet run only in pools whose security boundary allows it, so a sandbox lease whose egress allow list is not empty is also refused with FAILED_PRECONDITION when the security boundary of the one pool does not allow internet egress. Whether the boundary of the pool allows internet egress is part of its declared configuration, an owner input, because the three boundary values of the model do not say it; like the other Sandbox pool values it is an entry of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140). The model names `acquire-lease-v1` and `lease-v1` for this method, the attempt lease descriptors of RunControlService; the proto of AIFACTORY-TASK-097 makes the contract checkable and the gap is reported. Kind: behavior. Traces: services: ExecutionCapacityService, ToolAdapterService; aggregates: ExecutionCapacityService/CapacityLease, ExecutionCapacityService/WorkerPool; apis: ExecutionCapacityService/Capacity.AcquireLease; events: ExecutionCapacityService/CapacityLeaseGranted; descriptors: acquire-lease-v1, lease-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024; requirements: NFR-09; scenarios: SCN-ExecutionCapacityService-006, SCN-ExecutionCapacityService-012. Depends on: AIFACTORY-US-1039, feature:component-base-template-factory-profile, feature:contracts-package. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#actors-and-grains.",
      "acceptanceCriteria": [
        "AC1: Given a caller with a workload identity and `factory.capacity.lease`, the one sandbox pool with free capacity and a run without a workspace, when `ExecutionCapacityService/Capacity.AcquireLease` is called for a sandbox of that run, then a `ExecutionCapacityService/CapacityLease` is written in state Granted with `grantedAt`, `expiresAt` from `RuntimeCloud:Capacity:LeaseTtlSeconds` and the pool, the workspace storage of the run exists on the pool, isolated per run and tenant, and the `RunWorkspace` of the run is created with this lease as `createdWithLeaseId` in the same transaction with a `workspaceRef` that resolves to that storage, the reply carries the lease with its `workspaceRef`, and the `ExecutionCapacityService/CapacityLeaseGranted` outbox record is written in that transaction (SCN-ExecutionCapacityService-006, D121).",
        "AC2: Given a run whose workspace exists and whose first lease is Released or Expired, when `ExecutionCapacityService/Capacity.AcquireLease` is called for a later attempt of the same run, then the new lease carries the same `workspaceRef`, no second `RunWorkspace` is created, and a lease of another run never receives that reference; given the same holder kind and holder id repeated while its lease is Granted or Active, then the same lease is returned and nothing is granted or written twice (SCN-ExecutionCapacityService-006).",
        "AC3: Given the one pool has no free cpu or memory for the request, when `ExecutionCapacityService/Capacity.AcquireLease` is called, then the lease moves from Requested to Denied, the reply names the pool as the limit, no capacity is granted, no `ExecutionCapacityService/CapacityLeaseGranted` is written and `connectsoft.factory.capacity.lease_wait` is not recorded for it; given concurrent requests for the last capacity of the pool, also through two activations of `PoolGrain` for the same pool, then exactly one is granted, because the grant commits with a concurrency check on the granted capacity of the pool in `execution-capacity-sql` beside the serialisation of `PoolGrain` (SCN-ExecutionCapacityService-006, the amendment of ADR-0024 on duplicate activations).",
        "AC4: Given a caller without workload identity, a token without `factory.capacity.lease`, a request without tenant, project or run or with an unknown holder kind, a request for the holder kind `attempt`, `build` or `browser`, and a sandbox request whose egress allow list is not empty while the security boundary of the one pool does not allow internet egress, when `ExecutionCapacityService/Capacity.AcquireLease` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, FAILED_PRECONDITION and FAILED_PRECONDITION respectively, and no lease, workspace or outbox record is written (SCN-ExecutionCapacityService-006, ADR-0015, `ExecutionCapacityService/WorkerPool`).",
        "AC5: Given the lease was granted, when the outbox dispatcher of the profile `execution-capacity` publishes `ExecutionCapacityService/CapacityLeaseGranted` on `capacity.leases.v1.capacity-lease-granted`, then the event is sent under the run event envelope with `leaseId`, `tenantId`, `holderKind`, `holderId`, `poolId` and `expiresAt`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ExecutionCapacityService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#actors-and-grains"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4171",
        "AIFACTORY-TASK-4172",
        "AIFACTORY-TASK-4194",
        "AIFACTORY-TASK-4173"
      ],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7402,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "ExecutionCapacityService/CapacityLease",
          "ExecutionCapacityService/WorkerPool"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.AcquireLease"
        ],
        "events": [
          "ExecutionCapacityService/CapacityLeaseGranted"
        ],
        "descriptors": [
          "acquire-lease-v1",
          "lease-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "NFR-09"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-006",
          "SCN-ExecutionCapacityService-012"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1039",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#actors-and-grains"
      ],
      "titlePrefix": "[AIFACTORY-US-1036]",
      "number": 1036
    },
    {
      "id": "AIFACTORY-TASK-4171",
      "type": "task",
      "parent": "AIFACTORY-US-1036",
      "title": "AcquireLease through PoolGrain with the workspace of the run and the CapacityLeaseGranted outbox record",
      "sequence": "09.01.02.01",
      "description": "AcquireLease through PoolGrain with the workspace of the run and the CapacityLeaseGranted outbox record. Expected output: AcquireLease validates the request, resolves the tenant, project and run from the Factory scope of the call, asks PoolGrain of the one sandbox pool for the cpu and memory, commits the grant with a concurrency check on the granted capacity of the pool in execution-capacity-sql so that a duplicate activation of PoolGrain cannot oversubscribe the pool (the amendment of ADR-0024 on duplicate activations), writes the CapacityLease in state Granted with grantedAt and expiresAt from RuntimeCloud:Capacity:LeaseTtlSeconds or in state Denied with the pool named as the limit, creates the RunWorkspace of the run with the first lease through the workspace storage of AIFACTORY-TASK-4194 and hands every later lease of the run the same workspaceRef, writes CapacityLeaseGranted in the same transaction, returns the open lease of the same holder kind and holder id on a repeat, refuses the holder kinds attempt, build and browser with FAILED_PRECONDITION, refuses with FAILED_PRECONDITION and without writing a lease, workspace or outbox record a sandbox lease whose egress allow list is not empty when the security boundary of the one pool does not allow internet egress, and records connectsoft.factory.capacity.lease_wait and connectsoft.factory.capacity.leases_active.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "AcquireLease validates the request, resolves the tenant, project and run from the Factory scope of the call, asks PoolGrain of the one sandbox pool for the cpu and memory, commits the grant with a concurrency check on the granted capacity of the pool in execution-capacity-sql so that a duplicate activation of PoolGrain cannot oversubscribe the pool (the amendment of ADR-0024 on duplicate activations), writes the CapacityLease in state Granted with grantedAt and expiresAt from RuntimeCloud:Capacity:LeaseTtlSeconds or in state Denied with the pool named as the limit, creates the RunWorkspace of the run with the first lease through the workspace storage of AIFACTORY-TASK-4194 and hands every later lease of the run the same workspaceRef, writes CapacityLeaseGranted in the same transaction, returns the open lease of the same holder kind and holder id on a repeat, refuses the holder kinds attempt, build and browser with FAILED_PRECONDITION, refuses with FAILED_PRECONDITION and without writing a lease, workspace or outbox record a sandbox lease whose egress allow list is not empty when the security boundary of the one pool does not allow internet egress, and records connectsoft.factory.capacity.lease_wait and connectsoft.factory.capacity.leases_active."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4171]",
      "number": 4171
    },
    {
      "id": "AIFACTORY-TASK-4172",
      "type": "task",
      "parent": "AIFACTORY-US-1036",
      "title": "Migrations of CapacityLeases and RunWorkspaces with the one-workspace-per-run key",
      "sequence": "09.01.02.02",
      "description": "Migrations of CapacityLeases and RunWorkspaces with the one-workspace-per-run key. Expected output: The migrations create CapacityLeases with IX_Leases_Tenant_State, IX_Leases_Pool_State and IX_Leases_Expiry and RunWorkspaces keyed by RunId with the foreign key CreatedWithLeaseId and IX_RunWorkspaces_Tenant_Open, as docs/planes/execution/environments/services/execution-capacity-service/ddl.md lists them; both are tenant-filtered and the mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "The migrations create CapacityLeases with IX_Leases_Tenant_State, IX_Leases_Pool_State and IX_Leases_Expiry and RunWorkspaces keyed by RunId with the foreign key CreatedWithLeaseId and IX_RunWorkspaces_Tenant_Open, as docs/planes/execution/environments/services/execution-capacity-service/ddl.md lists them; both are tenant-filtered and the mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7402,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-4172]",
      "number": 4172
    },
    {
      "id": "AIFACTORY-TASK-4194",
      "type": "task",
      "parent": "AIFACTORY-US-1036",
      "title": "Workspace storage of a run on the pool, created with the first lease and resolved by workspaceRef",
      "sequence": "09.01.02.03",
      "description": "Workspace storage of a run on the pool, created with the first lease and resolved by workspaceRef. Expected output: The first lease of a run creates the workspace storage of the run on the one sandbox pool, isolated per run and tenant so that no other run and no other tenant can reach it, and the workspaceRef of the RunWorkspace resolves to that storage; a later lease of the run resolves to the same storage and creates none; a grant that rolls back leaves no storage behind; the storage medium, a volume or a share on the pool, is taken from the configuration of the deployment as an owner input, an entry of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "The first lease of a run creates the workspace storage of the run on the one sandbox pool, isolated per run and tenant so that no other run and no other tenant can reach it, and the workspaceRef of the RunWorkspace resolves to that storage; a later lease of the run resolves to the same storage and creates none; a grant that rolls back leaves no storage behind; the storage medium, a volume or a share on the pool, is taken from the configuration of the deployment as an owner input, an entry of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4194]",
      "number": 4194
    },
    {
      "id": "AIFACTORY-TASK-4173",
      "type": "task",
      "parent": "AIFACTORY-US-1036",
      "title": "Verify the grant of a sandbox lease and the workspace of the run through the acceptance suite",
      "sequence": "09.01.02.04",
      "description": "Verify the grant of a sandbox lease and the workspace of the run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-006|Scenario=SCN-ExecutionCapacityService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1036: the grant with the workspace created by the first lease, the workspace storage of the run that exists on the pool after the first grant and that the workspaceRef of a later lease of the run resolves to unchanged, the same workspaceRef for a later attempt of the run and never for another run, the repeat that grants nothing twice, the denial on an exhausted pool, the concurrent grant of the last capacity through two activations of PoolGrain with exactly one grant, the five refusals including the non-empty egress allow list on a pool whose boundary does not allow internet egress, and the publication and payload of CapacityLeaseGranted with a stopped transport.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-006|Scenario=SCN-ExecutionCapacityService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1036: the grant with the workspace created by the first lease, the workspace storage of the run that exists on the pool after the first grant and that the workspaceRef of a later lease of the run resolves to unchanged, the same workspaceRef for a later attempt of the run and never for another run, the repeat that grants nothing twice, the denial on an exhausted pool, the concurrent grant of the last capacity through two activations of PoolGrain with exactly one grant, the five refusals including the non-empty egress allow list on a pool whose boundary does not allow internet egress, and the publication and payload of CapacityLeaseGranted with a stopped transport."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4173]",
      "number": 4173
    },
    {
      "id": "AIFACTORY-US-1037",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-046",
      "title": "Keep a sandbox lease alive by heartbeat and expire it when the heartbeat stops, freeing capacity and keeping the workspace",
      "sequence": "09.01.03",
      "description": "As an operator, I want a lease to stay granted only while its holder renews it and to expire on its own when the holder disappears, so that a crashed holder never keeps capacity of the pool and never takes the workspace of its run with it. The holder of a lease, ToolAdapterService with a workload identity whose token carries `factory.capacity.lease`, renews it through `ExecutionCapacityService/Capacity.RenewLease` every `RuntimeCloud:Capacity:LeaseRenewSeconds`, half the time-to-live. A renewal by the holder of a Granted or Active lease of its tenant extends `expiresAt` to the renewal plus `RuntimeCloud:Capacity:LeaseTtlSeconds` and answers the lease with its unchanged id, pool and `workspaceRef`; a repeated renewal only extends the expiry again. A lease moves from Granted to Active (trigger `HolderStarted`) when its sandbox has started in the pool with the workspace mounted (AIFACTORY-US-1039). A lease whose heartbeat stopped is expired by the worker `LeaseExpirer`, which runs every minute partitioned by pool with at most four in parallel, idempotent on the lease id and the expiry and without retry, and by the reminder `lease-expiry` of `PoolGrain`, which fires at the earliest expiry: an Active lease past its expiry moves to Expired (trigger `HeartbeatMissed`) and a Granted lease whose sandbox never started moves to Expired (trigger `NotStarted`). Expiry frees the cpu and memory in `PoolGrain`, ends the sandbox, sets `releasedAt` and writes `CapacityLeaseReleased` with state Expired in the same transaction; it never removes the workspace of the run, which a later lease of the run receives again (D121). The work of the holder is handled by its own lease semantics, the sandbox lease in ToolAdapterService. A renewal is refused and changes nothing when the caller has no workload identity (UNAUTHENTICATED), lacks the scope (PERMISSION_DENIED), sends no lease id (INVALID_ARGUMENT), names an unknown lease or a lease of another tenant (NOT_FOUND, the same answer for both) or names a lease already Released, Expired or Denied (FAILED_PRECONDITION); the holder then acquires a new lease of the same run. Kind: behavior. Traces: services: ExecutionCapacityService, ToolAdapterService; aggregates: ExecutionCapacityService/CapacityLease; apis: ExecutionCapacityService/Capacity.RenewLease, ExecutionCapacityService/Capacity.AcquireLease; events: ExecutionCapacityService/CapacityLeaseReleased; descriptors: lease-v1; adrs: ADR-0015, ADR-0024; requirements: NFR-09; scenarios: SCN-ExecutionCapacityService-007. Depends on: AIFACTORY-US-1036. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a Granted or Active `ExecutionCapacityService/CapacityLease` of the caller tenant, when its holder calls `ExecutionCapacityService/Capacity.RenewLease`, then `expiresAt` is extended to the renewal plus `RuntimeCloud:Capacity:LeaseTtlSeconds`, the reply carries the same lease id, pool and `workspaceRef`, and no capacity is granted twice; given the sandbox of a Granted lease has started with the workspace mounted, then the lease moves to Active (SCN-ExecutionCapacityService-007).",
        "AC2: Given a caller without workload identity, a token without `factory.capacity.lease`, a request without lease id, an unknown lease, a lease of another tenant and a lease already Released, Expired or Denied, when `ExecutionCapacityService/Capacity.RenewLease` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND for both the unknown and the foreign lease, and FAILED_PRECONDITION, and nothing changes (SCN-ExecutionCapacityService-007, ADR-0015).",
        "AC3: Given an Active lease whose holder stopped renewing and a Granted lease whose sandbox never started, when `LeaseExpirer` or the reminder `lease-expiry` of `PoolGrain` runs after their expiry, then the first moves to Expired by `HeartbeatMissed` and the second by `NotStarted`, their capacity returns to the pool, their sandboxes end, `releasedAt` is set and `ExecutionCapacityService/CapacityLeaseReleased` with state Expired is written in the same transaction; a second run for the same lease and expiry changes nothing (model/services/runtime-cloud/ExecutionCapacityService.yaml, ADR-0024).",
        "AC4: Given a run whose only lease expired, when a later attempt of the run calls `ExecutionCapacityService/Capacity.AcquireLease`, then the workspace of the run still exists and the new lease carries the same `workspaceRef`, because an expired lease frees capacity and never removes the workspace (SCN-ExecutionCapacityService-007, D121)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4174",
        "AIFACTORY-TASK-4175",
        "AIFACTORY-TASK-4176"
      ],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7403,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "ExecutionCapacityService/CapacityLease"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.RenewLease",
          "ExecutionCapacityService/Capacity.AcquireLease"
        ],
        "events": [
          "ExecutionCapacityService/CapacityLeaseReleased"
        ],
        "descriptors": [
          "lease-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "NFR-09"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1036"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1037]",
      "number": 1037
    },
    {
      "id": "AIFACTORY-TASK-4174",
      "type": "task",
      "parent": "AIFACTORY-US-1037",
      "title": "RenewLease by heartbeat and the HolderStarted transition",
      "sequence": "09.01.03.01",
      "description": "RenewLease by heartbeat and the HolderStarted transition. Expected output: RenewLease extends expiresAt of a Granted or Active lease of the caller tenant by RuntimeCloud:Capacity:LeaseTtlSeconds and returns the same lease id, pool and workspaceRef; the start of the sandbox with the workspace mounted moves the lease from Granted to Active; the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND for an unknown and a foreign lease alike, and FAILED_PRECONDITION for a lease no longer open, change nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "RenewLease extends expiresAt of a Granted or Active lease of the caller tenant by RuntimeCloud:Capacity:LeaseTtlSeconds and returns the same lease id, pool and workspaceRef; the start of the sandbox with the workspace mounted moves the lease from Granted to Active; the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND for an unknown and a foreign lease alike, and FAILED_PRECONDITION for a lease no longer open, change nothing."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4174]",
      "number": 4174
    },
    {
      "id": "AIFACTORY-TASK-4175",
      "type": "task",
      "parent": "AIFACTORY-US-1037",
      "title": "LeaseExpirer and the lease-expiry reminder of PoolGrain for the one pool",
      "sequence": "09.01.03.02",
      "description": "LeaseExpirer and the lease-expiry reminder of PoolGrain for the one pool. Expected output: LeaseExpirer runs every minute partitioned by pool with at most four in parallel, without retry and idempotent on lease id plus expiry; it and the lease-expiry reminder of PoolGrain move an Active lease past its expiry to Expired by HeartbeatMissed and a Granted lease never started to Expired by NotStarted, free the capacity, end the sandbox, set releasedAt and write CapacityLeaseReleased with state Expired and executionSeconds in one transaction, and never remove the workspace of the run.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "LeaseExpirer runs every minute partitioned by pool with at most four in parallel, without retry and idempotent on lease id plus expiry; it and the lease-expiry reminder of PoolGrain move an Active lease past its expiry to Expired by HeartbeatMissed and a Granted lease never started to Expired by NotStarted, free the capacity, end the sandbox, set releasedAt and write CapacityLeaseReleased with state Expired and executionSeconds in one transaction, and never remove the workspace of the run."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4175]",
      "number": 4175
    },
    {
      "id": "AIFACTORY-TASK-4176",
      "type": "task",
      "parent": "AIFACTORY-US-1037",
      "title": "Verify renewal and expiry through the acceptance suite",
      "sequence": "09.01.03.03",
      "description": "Verify renewal and expiry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1037 with a test clock: the extended expiry, the Active transition at sandbox start, the five refusals, the HeartbeatMissed and NotStarted expiries with the CapacityLeaseReleased outbox record, the idempotent second expiry run and the workspace that survives an expired lease.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1037 with a test clock: the extended expiry, the Active transition at sandbox start, the five refusals, the HeartbeatMissed and NotStarted expiries with the CapacityLeaseReleased outbox record, the idempotent second expiry run and the workspace that survives an expired lease."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4176]",
      "number": 4176
    },
    {
      "id": "AIFACTORY-US-1038",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-046",
      "title": "Release a sandbox lease on completion or on SandboxReleased, freeing its capacity once and leaving the workspace of the run",
      "sequence": "09.01.04",
      "description": "As an operator, I want capacity to return to the pool the moment a sandbox is done, whichever path reports it, so that the pool serves the next call at once and every lease ends exactly once with the seconds it was held. A lease ends on one of two paths that are one command. The holder, with a workload identity whose token carries `factory.capacity.lease`, calls `ExecutionCapacityService/Capacity.ReleaseLease` with the lease id on completion; and the inbox handler `ReleaseSandboxLease` consumes `SandboxReleased` of ToolAdapterService, which its `SandboxReaper` writes when a sandbox lease is released or reaped, idempotent on the event id. Either path moves an Active lease to Released (trigger `HolderCompleted`), frees its cpu and memory in `PoolGrain`, ends the sandbox, sets `releasedAt` and writes `CapacityLeaseReleased` in the same transaction with the state Released and `executionSeconds`, the seconds between `grantedAt` and `releasedAt`. The answer of the method is `ack-v1`. The release is idempotent on the lease: a second release by the other path or a repeated call finds the lease already Released or Expired, answers the acknowledgement and writes nothing, so capacity is freed once and one `CapacityLeaseReleased` exists per lease. A release never removes the workspace of the run: it stays for the next lease of the run until RunControlService announces that the run ended (AIFACTORY-US-1040, D121). The model has no transition from Granted to Released; how a release of a lease whose sandbox never started is recorded is an open point that this PBI does not decide, and such a lease expires by `NotStarted` (AIFACTORY-US-1037). A call is refused and changes nothing when the caller has no workload identity (UNAUTHENTICATED), lacks the scope (PERMISSION_DENIED), sends no lease id (INVALID_ARGUMENT) or names an unknown lease or a lease of another tenant (NOT_FOUND, the same answer for both, ADR-0015). The consumers CostUsageService and DashboardService record the usage and the projection in their own PBIs. Kind: behavior. Traces: services: ExecutionCapacityService, ToolAdapterService; aggregates: ExecutionCapacityService/CapacityLease; apis: ExecutionCapacityService/Capacity.ReleaseLease; events: ExecutionCapacityService/CapacityLeaseReleased; descriptors: lease-v1, ack-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: NFR-09; scenarios: SCN-ExecutionCapacityService-008, SCN-ExecutionCapacityService-013. Depends on: AIFACTORY-US-1036. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given an Active `ExecutionCapacityService/CapacityLease` of the caller tenant, when its holder calls `ExecutionCapacityService/Capacity.ReleaseLease`, then the lease moves to Released, its capacity returns to `PoolGrain`, its sandbox ends, `releasedAt` is set, the reply is `ack-v1`, and the `ExecutionCapacityService/CapacityLeaseReleased` outbox record with state Released and `executionSeconds` is written in the same transaction (SCN-ExecutionCapacityService-008).",
        "AC2: Given an Active lease, when `SandboxReleased` of ToolAdapterService names it and the handler `ReleaseSandboxLease` runs, then the lease is released exactly as in AC1; given the same lease then released again through `ExecutionCapacityService/Capacity.ReleaseLease`, or the same event redelivered, then the answer is the acknowledgement, nothing is written and capacity is freed once (SCN-ExecutionCapacityService-008).",
        "AC3: Given a caller without workload identity, a token without `factory.capacity.lease`, a request without lease id, an unknown lease and a lease of another tenant, when `ExecutionCapacityService/Capacity.ReleaseLease` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND for both the unknown and the foreign lease, and nothing changes; given any release, then the workspace of the run is not removed (SCN-ExecutionCapacityService-008, ADR-0015, D121).",
        "AC4: Given a lease released or expired, when the outbox dispatcher publishes `ExecutionCapacityService/CapacityLeaseReleased` on `capacity.leases.v1.capacity-lease-released`, then the event is sent under the run event envelope with `leaseId`, `tenantId`, `holderKind`, `holderId`, `poolId`, `state` and `executionSeconds`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ExecutionCapacityService-013, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4177",
        "AIFACTORY-TASK-4178"
      ],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7404,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "ExecutionCapacityService/CapacityLease"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.ReleaseLease"
        ],
        "events": [
          "ExecutionCapacityService/CapacityLeaseReleased"
        ],
        "descriptors": [
          "lease-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "NFR-09"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-008",
          "SCN-ExecutionCapacityService-013"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1036"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1038]",
      "number": 1038
    },
    {
      "id": "AIFACTORY-TASK-4177",
      "type": "task",
      "parent": "AIFACTORY-US-1038",
      "title": "ReleaseLease and the ReleaseSandboxLease inbox handler as one idempotent release command",
      "sequence": "09.01.04.01",
      "description": "ReleaseLease and the ReleaseSandboxLease inbox handler as one idempotent release command. Expected output: ReleaseLease and the handler of SandboxReleased share one release command that moves an Active lease to Released by HolderCompleted, frees the capacity in PoolGrain, ends the sandbox, sets releasedAt and writes CapacityLeaseReleased with state Released and executionSeconds in one transaction, answers ack-v1, acknowledges a lease already Released or Expired without writing, is idempotent on the event id in the inbox, never removes the workspace of the run and decrements connectsoft.factory.capacity.leases_active.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "ReleaseLease and the handler of SandboxReleased share one release command that moves an Active lease to Released by HolderCompleted, frees the capacity in PoolGrain, ends the sandbox, sets releasedAt and writes CapacityLeaseReleased with state Released and executionSeconds in one transaction, answers ack-v1, acknowledges a lease already Released or Expired without writing, is idempotent on the event id in the inbox, never removes the workspace of the run and decrements connectsoft.factory.capacity.leases_active."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4177]",
      "number": 4177
    },
    {
      "id": "AIFACTORY-TASK-4178",
      "type": "task",
      "parent": "AIFACTORY-US-1038",
      "title": "Verify the release paths through the acceptance suite",
      "sequence": "09.01.04.02",
      "description": "Verify the release paths through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-008|Scenario=SCN-ExecutionCapacityService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1038: the release by call and by a SandboxReleased fixture event, the second release and the redelivered event that change nothing, the four refusals, the workspace left in place and the publication and payload of CapacityLeaseReleased with a stopped transport.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-008|Scenario=SCN-ExecutionCapacityService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1038: the release by call and by a SandboxReleased fixture event, the second release and the redelivered event that change nothing, the four refusals, the workspace left in place and the publication and payload of CapacityLeaseReleased with a stopped transport."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4178]",
      "number": 4178
    },
    {
      "id": "AIFACTORY-US-1039",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-046",
      "title": "Serve the chain from one statically declared sandbox pool that starts each sandbox with the workspace mounted and ends it at release",
      "sequence": "09.01.05",
      "description": "As a platform administrator, I want the first outcome to run its sandboxes in one declared pool whose boundary and region I know, so that every sandbox of the chain runs where the deployment placed it and nothing reaches the host or another run. In I1 the service holds one `WorkerPool` of kind Sandbox. IaCProvisioningService is a static stub until I2, so the pool is not provisioned through it: the deployment declares the pool, and at start the service writes or confirms the one row of `WorkerPools` with its pool id, the platform tenant of a shared pool, the security boundary, whether that boundary allows internet egress, region, node profile and size bounds from the configuration of the deployment, in state Ready. The values of the pool, its boundary and its egress permission, region, node profile and size, are inputs of the owner and are not invented here; they are entries of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140). RetentionResidencyService is a static stub until I4 that allows the region of the one pool, and FactoryCommercialService is a static stub until I7 that is not called, because no quota exists in I1. No size change, autoscaling or state change happens in this increment, so `WorkerPoolStateChanged` is not written; it arrives with the complete delivery. `PoolGrain`, keyed by the pool id, holds the current size and the granted cpu and memory and serialises every grant (ADR-0024). For each granted sandbox lease the service starts the sandbox on the pool with the limits, the egress allow list and the mount mode that the lease carries. The workspace is mounted for ToolAdapterService by the lease: the started sandbox mounts the workspace that the `workspaceRef` of the lease hands to ToolAdapterService, with the mount mode of the lease, read-only for the repository read tools of the tool executor (D121, D125). The start of the sandbox moves the lease to Active. At release or expiry the sandbox ends and the workspace stays. The build tooling of the worker image and the enforcement of the egress allow list, with the proof that a destination outside the list is unreachable from a sandbox, are AIFACTORY-TASK-219 of feature `tool-adapter-service` in this repository and are not planned again here; this PBI proves only that the sandbox is started with the configuration the lease carries. `connectsoft.factory.capacity.pool_utilisation` reports the share of the pool granted, with the pool id and the kind. The service adds no operation that reads a workspace: every read of a workspace happens inside a sandbox. Kind: behavior. Traces: services: ExecutionCapacityService; aggregates: ExecutionCapacityService/WorkerPool, ExecutionCapacityService/CapacityLease; apis: ExecutionCapacityService/Capacity.AcquireLease; adrs: ADR-0017, ADR-0024. Depends on: feature:component-base-template-factory-profile. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/backlog/features/runtime-cloud.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#data-model-and-storage.",
      "acceptanceCriteria": [
        "AC1: Given the configuration of the deployment that declares the one sandbox pool, when the service starts, then one `ExecutionCapacityService/WorkerPool` of kind Sandbox exists in state Ready with the declared boundary, region, node profile and bounds, a restart writes no second pool, and no `WorkerPoolStateChanged` is written in I1 (model/services/runtime-cloud/ExecutionCapacityService.yaml, model/backlog/features/runtime-cloud.yaml).",
        "AC2: Given a lease granted through `ExecutionCapacityService/Capacity.AcquireLease` with limits, an egress allow list and a mount mode, when its sandbox starts on the pool, then the sandbox is started with the limits, the egress allow list and the mount mode that the lease carries, it mounts the workspace that the `workspaceRef` of the lease hands to ToolAdapterService, read-only when the lease names read-only as for a read tool (D121, D125), and the `ExecutionCapacityService/CapacityLease` moves to Active; that a destination outside the list is unreachable is proven by AIFACTORY-TASK-219 of feature `tool-adapter-service`.",
        "AC3: Given two runs with one sandbox each on the pool, when the sandbox of the first lists its mount, then it sees the workspace of its own run only; given its lease is released or expired, then its sandbox ends and the workspace of its run is still present for the next lease of the run (`ExecutionCapacityService/CapacityLease`, D121).",
        "AC4: Given sandbox leases granted and released, when `connectsoft.factory.capacity.pool_utilisation` is read, then it reports the share of the one `ExecutionCapacityService/WorkerPool` granted with its pool id and kind, and the region of the pool is the one the static residency stub allows (ADR-0017, ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/backlog/features/runtime-cloud.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#data-model-and-storage"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4179",
        "AIFACTORY-TASK-4180",
        "AIFACTORY-TASK-4181"
      ],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7405,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService"
        ],
        "aggregates": [
          "ExecutionCapacityService/WorkerPool",
          "ExecutionCapacityService/CapacityLease"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.AcquireLease"
        ],
        "adrs": [
          "ADR-0017",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/backlog/features/runtime-cloud.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#data-model-and-storage"
      ],
      "titlePrefix": "[AIFACTORY-US-1039]",
      "number": 1039
    },
    {
      "id": "AIFACTORY-TASK-4179",
      "type": "task",
      "parent": "AIFACTORY-US-1039",
      "title": "Static declaration of the one sandbox pool, the WorkerPools migration and the static stubs of the increment",
      "sequence": "09.01.05.01",
      "description": "Static declaration of the one sandbox pool, the WorkerPools migration and the static stubs of the increment. Expected output: The migration creates WorkerPools with IX_Pools_Kind_Region; at start the service writes or confirms the one Sandbox pool in state Ready from the configuration of the deployment, whose boundary, egress permission of the boundary, region, node profile and bounds are inputs of the owner; the static stubs of IaCProvisioningService, RetentionResidencyService and FactoryCommercialService are bound behind their client ports so the complete delivery replaces them without a contract change; PoolGrain loads the pool with its size and granted capacity.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "The migration creates WorkerPools with IX_Pools_Kind_Region; at start the service writes or confirms the one Sandbox pool in state Ready from the configuration of the deployment, whose boundary, egress permission of the boundary, region, node profile and bounds are inputs of the owner; the static stubs of IaCProvisioningService, RetentionResidencyService and FactoryCommercialService are bound behind their client ports so the complete delivery replaces them without a contract change; PoolGrain loads the pool with its size and granted capacity."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4179]",
      "number": 4179
    },
    {
      "id": "AIFACTORY-TASK-4180",
      "type": "task",
      "parent": "AIFACTORY-US-1039",
      "title": "Sandbox start with the workspace mounted and sandbox end at release or expiry",
      "sequence": "09.01.05.02",
      "description": "Sandbox start with the workspace mounted and sandbox end at release or expiry. Expected output: For a granted sandbox lease the service starts the sandbox on the pool with the limits, the egress allow list and the mount mode that the lease carries, the sandbox mounts for ToolAdapterService the workspace that the workspaceRef of the lease hands over, the lease moves to Active by HolderStarted when the sandbox runs, the sandbox ends at release or expiry and the workspace is never removed there; pool_utilisation follows the granted share of the pool; the enforcement of the egress allow list stays with AIFACTORY-TASK-219.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "For a granted sandbox lease the service starts the sandbox on the pool with the limits, the egress allow list and the mount mode that the lease carries, the sandbox mounts for ToolAdapterService the workspace that the workspaceRef of the lease hands over, the lease moves to Active by HolderStarted when the sandbox runs, the sandbox ends at release or expiry and the workspace is never removed there; pool_utilisation follows the granted share of the pool; the enforcement of the egress allow list stays with AIFACTORY-TASK-219."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4180]",
      "number": 4180
    },
    {
      "id": "AIFACTORY-TASK-4181",
      "type": "task",
      "parent": "AIFACTORY-US-1039",
      "title": "Verify the one pool and its sandboxes through the acceptance suite",
      "sequence": "09.01.05.03",
      "description": "Verify the one pool and its sandboxes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SandboxPool\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1039 with a sandbox fixture: the one pool declared once from configuration, a sandbox started with the limits, egress list and mount mode that its lease carries and mounting the workspace the lease hands over, read-only for a read-only lease, the isolation of two runs, the workspace that outlives its sandbox and the utilisation metric.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SandboxPool\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1039 with a sandbox fixture: the one pool declared once from configuration, a sandbox started with the limits, egress list and mount mode that its lease carries and mounting the workspace the lease hands over, read-only for a read-only lease, the isolation of two runs, the workspace that outlives its sandbox and the utilisation metric."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4181]",
      "number": 4181
    },
    {
      "id": "AIFACTORY-US-1040",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-046",
      "title": "Remove the workspace of a run once when RunControlService announces that the run completed, failed or was cancelled",
      "sequence": "09.01.06",
      "description": "As an operator, I want the workspace of a run to disappear when the run ends and never before, so that no files of a finished run stay on the pool and no running step loses its files. ExecutionCapacityService owns the workspace of a run and removes it on exactly one signal: a terminal run event of RunControlService (D121). The inbox handler `RemoveRunWorkspace` consumes `RunCompleted`, `RunFailed` and `RunCancelled` from the run-control topics, each with `runId` and `tenantId`. For the `RunWorkspace` of that run in that tenant it removes the workspace storage of the run on the pool, which the first lease created (AIFACTORY-US-1036), and sets `removedAt`, idempotent on the run id: a redelivered event, or a second terminal event of the same run, finds `removedAt` set and does nothing, and a run that never took a lease has no workspace and the event changes nothing. The release or the expiry of a lease never removes a workspace (AIFACTORY-US-1037, AIFACTORY-US-1038). Leases of the run still open when the run ends are not released by this handler; they end through their holder or their expiry. The model does not say what `Capacity.AcquireLease` answers for a run whose workspace was removed; this PBI does not decide it and the open point is reported. The removal writes no outbox record, because the model declares no event for it; `connectsoft.factory.capacity.inbox_lag` reports the age of the oldest unprocessed message of the inbox. When the transport delivers late the removal waits in the inbox and is applied once (ADR-0012). The handler of a deletion order of RetentionResidencyService is built in I4 with that service and none is registered here. Kind: behavior. Traces: services: ExecutionCapacityService, RunControlService; aggregates: ExecutionCapacityService/CapacityLease; events: RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled; adrs: ADR-0012, ADR-0015; requirements: XL-14. Depends on: AIFACTORY-US-1036, feature:run-control-service. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run with a workspace and no open lease, when `RunControlService/RunCompleted`, `RunControlService/RunFailed` or `RunControlService/RunCancelled` of that run is consumed, then the content of the workspace is removed and `removedAt` of its `RunWorkspace` is set once, under the tenant of the event (model/services/runtime-cloud/ExecutionCapacityService.yaml, D121).",
        "AC2: Given the same terminal event redelivered, a second terminal event of the same run, or a terminal event of a run that never took a lease, when the handler runs, then nothing is removed or written a second time and the event is acknowledged in the inbox under its event id (`RunControlService/RunCompleted`, ADR-0012).",
        "AC3: Given a run whose leases were released and expired while it still runs, when no terminal event of the run was consumed, then its workspace is present and a later lease of the run receives it through `ExecutionCapacityService/CapacityLease`; given a terminal event whose `tenantId` is not the tenant of the workspace of that run id, then nothing is removed, because the handler acts only on the `RunWorkspace` row of the tenant of the event (ADR-0015, D121)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4182",
        "AIFACTORY-TASK-4183"
      ],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7406,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "RunControlService"
        ],
        "aggregates": [
          "ExecutionCapacityService/CapacityLease"
        ],
        "events": [
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "XL-14"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1036",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1040]",
      "number": 1040
    },
    {
      "id": "AIFACTORY-TASK-4182",
      "type": "task",
      "parent": "AIFACTORY-US-1040",
      "title": "RemoveRunWorkspace inbox handler for RunCompleted, RunFailed and RunCancelled",
      "sequence": "09.01.06.01",
      "description": "RemoveRunWorkspace inbox handler for RunCompleted, RunFailed and RunCancelled. Expected output: The handler of the three terminal run events removes the workspace storage of the run that AIFACTORY-TASK-4194 created, in the tenant of the event, and sets removedAt of its RunWorkspace, idempotent on the run id and on the event id, does nothing for a run without a workspace, releases no lease, writes no outbox record and leaves inbox_lag to report a late delivery.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "The handler of the three terminal run events removes the workspace storage of the run that AIFACTORY-TASK-4194 created, in the tenant of the event, and sets removedAt of its RunWorkspace, idempotent on the run id and on the event id, does nothing for a run without a workspace, releases no lease, writes no outbox record and leaves inbox_lag to report a late delivery."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4182]",
      "number": 4182
    },
    {
      "id": "AIFACTORY-TASK-4183",
      "type": "task",
      "parent": "AIFACTORY-US-1040",
      "title": "Verify the removal of the workspace on a terminal run event through the acceptance suite",
      "sequence": "09.01.06.02",
      "description": "Verify the removal of the workspace on a terminal run event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RunWorkspaceRemoval\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1040 with fixture events of RunControlService/RunCompleted, RunControlService/RunFailed and RunControlService/RunCancelled: one removal per run, the redelivered and the second terminal event that change nothing, the run without a workspace, and the workspace kept while the run still runs.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RunWorkspaceRemoval\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1040 with fixture events of RunControlService/RunCompleted, RunControlService/RunFailed and RunControlService/RunCancelled: one removal per run, the redelivered and the second terminal event that change nothing, the run without a workspace, and the workspace kept while the run still runs."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 74,
      "phase": "factory",
      "stackRank": 7406,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4183]",
      "number": 4183
    },
    {
      "id": "AIFACTORY-FEAT-047",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-009",
      "title": "ExecutionCapacityService: complete delivery",
      "sequence": "09.02",
      "description": "ExecutionCapacityService is the service of bounded context BC-26 (Execution Capacity). Worker pools (agent runtime, sandbox, build runner, browser) with security boundary, size and autoscaling; quotas per tenant and project tied to the edition; capacity leases per attempt, sandbox, build or session, granted within quota, renewed and released, so placement is explicit and no tenant starves another (BC-26; pool manager and scaling rows merged). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Delivers: ExecutionCapacityService (complete). Stubbed in this increment: FactoryCommercialService (static, completed in I7); RetentionResidencyService (static, completed in I4). Depends on: AIFACTORY-FEAT-046. Increment I2: Deliver it. Build order 98 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-028",
        "AIFACTORY-US-1041",
        "AIFACTORY-US-1042",
        "AIFACTORY-US-1043",
        "AIFACTORY-US-1044",
        "AIFACTORY-US-1045",
        "AIFACTORY-US-1046",
        "AIFACTORY-US-1609",
        "AIFACTORY-US-1610"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9800,
      "titlePrefix": "[AIFACTORY-FEAT-047]",
      "number": 47
    },
    {
      "id": "AIFACTORY-US-028",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "Capacity is leased from pools of every kind under quotas, so no tenant starves another",
      "sequence": "09.02.01",
      "description": "As a platform administrator, I want worker pools with their own security boundary and quotas per tenant and project, so that one tenant cannot exhaust the capacity of another and every lease is accounted for. This is the integration PBI of the complete delivery. The thin delivery of I1 (feature `execution-capacity-service-thin`) leases sandboxes with the workspace of the run from one statically declared pool, without quotas; this feature adds everything else the model of ExecutionCapacityService holds and proves on a deployed instance that it works together. Pools of the four kinds, agent runtime, sandbox, build runner and browser session, each with its security boundary, region, node profile, bounds and autoscaling, are read and set through the REST operations behind the platform gateway RuntimeCloudHost (AIFACTORY-US-1041) and change state and size through provisioning and the `Autoscaler`, while an exhausted pool answers a lease Denied with the reason `pool-exhausted` and the pool named exactly as in I1 and the holder retries (D129, AIFACTORY-US-1042). Quotas per tenant and project, derived from the edition (D34) and tightened by Workspace admins, are read and set (AIFACTORY-US-1043) and enforced at lease time, so a tenant at its limit waits and `QuotaExceeded` names the limit while another tenant is still served (AIFACTORY-US-1044); RunControlService then dispatches no further step of the project whose attempt lease a quota denied, without counting an attempt, and dispatches the waiting steps again when a quota changes, through its handlers `HoldDispatchOnQuota` and `ResumeDispatchOnQuota`, which this feature delivers in the repository of RunControlService (AIFACTORY-US-1609, AIFACTORY-US-1610, D140). Leases are granted for attempts, builds and browser sessions as well as sandboxes, placed by kind, boundary and region, and the lease of an attempt is also released when RunControlService records its outcome (AIFACTORY-US-1045); operators see who uses what through `ListCapacityLeases` (AIFACTORY-US-1046). The REST operations are reached only through RuntimeCloudHost, which establishes the scope once from the token (ADR-0028); the service answers a missing scope with 403 and a resource of another tenant with 404 (ADR-0015). The static stubs of the thin delivery for IaCProvisioningService are retired; FactoryCommercialService stays a static stub until I7 and RetentionResidencyService until I4, as the feature declares. When the store `execution-capacity-sql` is lost, readiness fails, the store is restored from backup within the RPO of 15 minutes, desired state is read again, observed state is re-inventoried and leases expire and are granted again (NFR-06). No deletion-order handler is built or registered here; that is I4 with RetentionResidencyService. Kind: behavior. Traces: services: ExecutionCapacityService, AgentRuntimeService, ToolAdapterService, RuntimeCloudHost; aggregates: ExecutionCapacityService/WorkerPool, ExecutionCapacityService/Quota, ExecutionCapacityService/CapacityLease; apis: ExecutionCapacityService/ListWorkerPools, ExecutionCapacityService/SetWorkerPool, ExecutionCapacityService/GetQuotas, ExecutionCapacityService/SetQuota, ExecutionCapacityService/ListCapacityLeases, ExecutionCapacityService/Capacity.AcquireLease, ExecutionCapacityService/Capacity.RenewLease, ExecutionCapacityService/Capacity.ReleaseLease; events: ExecutionCapacityService/WorkerPoolStateChanged, ExecutionCapacityService/QuotaChanged, ExecutionCapacityService/QuotaExceeded, ExecutionCapacityService/CapacityLeaseGranted, ExecutionCapacityService/CapacityLeaseReleased; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0017, ADR-0019, ADR-0024, ADR-0028; requirements: FUX-08, NFR-06, NFR-09. Relates: screens: capacity; nfrs: NFR-06, NFR-07, NFR-09. Depends on: AIFACTORY-US-1041, AIFACTORY-US-1042, AIFACTORY-US-1043, AIFACTORY-US-1044, AIFACTORY-US-1045, AIFACTORY-US-1046, AIFACTORY-US-1609, AIFACTORY-US-1610, feature:execution-capacity-service-thin, feature:runtime-cloud-host, feature:ia-cprovisioning-service, feature:run-control-service. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/backlog/features/runtime-cloud.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the complete delivery deployed with its REST operations behind RuntimeCloudHost, pools of the four kinds and two tenants, when a Workspace admin of the first tenant sets its `concurrentSandboxes` quota through RuntimeCloudHost with `ExecutionCapacityService/SetQuota` to the number of its open sandbox leases and both tenants then request a sandbox through the internal gRPC method `ExecutionCapacityService/Capacity.AcquireLease`, which does not pass through the gateway, then the first is denied with `ExecutionCapacityService/QuotaExceeded` naming the limit while the second is granted with `ExecutionCapacityService/CapacityLeaseGranted`; and when the Workspace admin raises the quota again within the edition through the same operation, `ExecutionCapacityService/QuotaChanged` is published and the retried request of the first tenant is granted, which is the end-to-end proof on the deployed instance of the rules of AIFACTORY-US-1043 and AIFACTORY-US-1044 (FUX-08, NFR-09).",
        "AC2: Given the chain of the first outcome that ran against the thin delivery, when it runs against the complete delivery, then `ExecutionCapacityService/Capacity.AcquireLease`, `ExecutionCapacityService/Capacity.RenewLease` and `ExecutionCapacityService/Capacity.ReleaseLease` answer with the same messages and the same `workspaceRef` behaviour, the static stub of IaCProvisioningService is gone, and the stubs of FactoryCommercialService and RetentionResidencyService remain as model/backlog/features/runtime-cloud.yaml declares.",
        "AC3: Given callers through RuntimeCloudHost without `factory.capacity.read` or `factory.capacity.admin`, and callers addressing a dedicated pool or a project quota of another tenant, when they reach `ExecutionCapacityService/ListWorkerPools`, `ExecutionCapacityService/SetWorkerPool`, `ExecutionCapacityService/GetQuotas`, `ExecutionCapacityService/SetQuota` or `ExecutionCapacityService/ListCapacityLeases`, then the answer is 403 for the missing scope and 404 for the foreign resource, each with a problem response and no state change (ADR-0015, ADR-0028).",
        "AC4: Given open leases on the deployed instance and the store `execution-capacity-sql` lost, when readiness is read and the store is restored from backup in a recovery drill, then readiness fails until the store is back, the restore lies within the RPO of 15 minutes, every `ExecutionCapacityService/WorkerPool` is read again from its desired state, and every `ExecutionCapacityService/CapacityLease` open at the loss expires and its holder is granted a new lease on its next request (NFR-06, docs/planes/execution/environments/services/execution-capacity-service/index.md#failure-and-recovery).",
        "AC5: Given leases, denials and quota changes of two tenants and two projects, when the metrics, logs and activities are read, then the five metrics of model/services/runtime-cloud/ExecutionCapacityService.yaml are emitted with their dimensions and with the tenant and the project by default, `connectsoft.factory.capacity.quota_denials` counts each `ExecutionCapacityService/QuotaExceeded`, the run and the attempt appear on activities and log records only, and no stored content reaches telemetry (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/backlog/features/runtime-cloud.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-283",
        "AIFACTORY-TASK-286",
        "AIFACTORY-TASK-287",
        "AIFACTORY-TASK-4195",
        "AIFACTORY-TASK-781"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9801,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "AgentRuntimeService",
          "ToolAdapterService",
          "RuntimeCloudHost"
        ],
        "aggregates": [
          "ExecutionCapacityService/WorkerPool",
          "ExecutionCapacityService/Quota",
          "ExecutionCapacityService/CapacityLease"
        ],
        "apis": [
          "ExecutionCapacityService/ListWorkerPools",
          "ExecutionCapacityService/SetWorkerPool",
          "ExecutionCapacityService/GetQuotas",
          "ExecutionCapacityService/SetQuota",
          "ExecutionCapacityService/ListCapacityLeases",
          "ExecutionCapacityService/Capacity.AcquireLease",
          "ExecutionCapacityService/Capacity.RenewLease",
          "ExecutionCapacityService/Capacity.ReleaseLease"
        ],
        "events": [
          "ExecutionCapacityService/WorkerPoolStateChanged",
          "ExecutionCapacityService/QuotaChanged",
          "ExecutionCapacityService/QuotaExceeded",
          "ExecutionCapacityService/CapacityLeaseGranted",
          "ExecutionCapacityService/CapacityLeaseReleased"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0024",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-08",
          "NFR-06",
          "NFR-09"
        ]
      },
      "relates": {
        "screens": [
          "capacity"
        ],
        "nfrs": [
          "NFR-06",
          "NFR-07",
          "NFR-09"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1041",
        "AIFACTORY-US-1042",
        "AIFACTORY-US-1043",
        "AIFACTORY-US-1044",
        "AIFACTORY-US-1045",
        "AIFACTORY-US-1046",
        "AIFACTORY-US-1609",
        "AIFACTORY-US-1610",
        "feature:execution-capacity-service-thin",
        "feature:runtime-cloud-host",
        "feature:ia-cprovisioning-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/backlog/features/runtime-cloud.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-028]",
      "number": 28
    },
    {
      "id": "AIFACTORY-TASK-283",
      "type": "task",
      "parent": "AIFACTORY-US-028",
      "title": "API surface: 5 REST and 3 gRPC operations (ListWorkerPools, SetWorkerPool, GetQuotas, SetQuota, ListCapacityLeases, Capacity.AcquireLease and 2 more)",
      "sequence": "09.02.01.01",
      "description": "API surface: 5 REST and 3 gRPC operations (ListWorkerPools, SetWorkerPool, GetQuotas, SetQuota, ListCapacityLeases, Capacity.AcquireLease and 2 more). Expected output: The five REST operations are hosted for the gateway route GW-03 of RuntimeCloudHost with scope enforcement per route, the roles PlatformAdmin and WorkspaceAdmin where the model names them, problem responses for 403, 404 and 422 and natural idempotency of the two PUT operations, beside the three gRPC methods of the thin delivery; the OpenAPI document and the proto match model/services/runtime-cloud/ExecutionCapacityService.yaml; the behaviour of each operation is delivered by AIFACTORY-US-1041 to AIFACTORY-US-1046.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The five REST operations are hosted for the gateway route GW-03 of RuntimeCloudHost with scope enforcement per route, the roles PlatformAdmin and WorkspaceAdmin where the model names them, problem responses for 403, 404 and 422 and natural idempotency of the two PUT operations, beside the three gRPC methods of the thin delivery; the OpenAPI document and the proto match model/services/runtime-cloud/ExecutionCapacityService.yaml; the behaviour of each operation is delivered by AIFACTORY-US-1041 to AIFACTORY-US-1046."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-283]",
      "number": 283
    },
    {
      "id": "AIFACTORY-TASK-286",
      "type": "task",
      "parent": "AIFACTORY-US-028",
      "title": "Security, tenancy and telemetry of ExecutionCapacityService",
      "sequence": "09.02.01.02",
      "description": "Security, tenancy and telemetry of ExecutionCapacityService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered with shared pools visible to every tenant and dedicated pools to their own, a foreign resource answers 404 and a missing scope 403, secrets come from secret references, the five metrics carry their modelled dimensions and the tenant and project by default, and traces, logs and health checks follow the observability conventions without stored content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered with shared pools visible to every tenant and dedicated pools to their own, a foreign resource answers 404 and a missing scope 403, secrets come from secret references, the five metrics carry their modelled dimensions and the tenant and project by default, and traces, logs and health checks follow the observability conventions without stored content."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-286]",
      "number": 286
    },
    {
      "id": "AIFACTORY-TASK-287",
      "type": "task",
      "parent": "AIFACTORY-US-028",
      "title": "Retire the thin scope and the stubs of ExecutionCapacityService",
      "sequence": "09.02.01.03",
      "description": "Retire the thin scope and the stubs of ExecutionCapacityService. Expected output: Callers run against the complete service; the static declaration of the one pool and the static stub of IaCProvisioningService of the thin delivery are deleted from the code, the FAILED_PRECONDITION answer for the holder kinds attempt, build and browser is gone, and the stubs of FactoryCommercialService and RetentionResidencyService that this feature still declares stay behind their client ports.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Callers run against the complete service; the static declaration of the one pool and the static stub of IaCProvisioningService of the thin delivery are deleted from the code, the FAILED_PRECONDITION answer for the holder kinds attempt, build and browser is gone, and the stubs of FactoryCommercialService and RetentionResidencyService that this feature still declares stay behind their client ports."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-287]",
      "number": 287
    },
    {
      "id": "AIFACTORY-TASK-4195",
      "type": "task",
      "parent": "AIFACTORY-US-028",
      "title": "Recovery drill of the store execution-capacity-sql from backup",
      "sequence": "09.02.01.04",
      "description": "Recovery drill of the store execution-capacity-sql from backup. Expected output: A recovery drill on the deployed instance takes the store execution-capacity-sql away and restores it from backup; the drill record shows readiness failing until the restore, a restore point within the RPO of 15 minutes, the pools read again from their desired state and the leases open at the loss expired and granted again on the next request of their holders, as AC4 of AIFACTORY-US-028 states.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "A recovery drill on the deployed instance takes the store execution-capacity-sql away and restores it from backup; the drill record shows readiness failing until the restore, a restore point within the RPO of 15 minutes, the pools read again from their desired state and the leases open at the loss expired and granted again on the next request of their holders, as AC4 of AIFACTORY-US-028 states."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9801,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-4195]",
      "number": 4195
    },
    {
      "id": "AIFACTORY-TASK-781",
      "type": "task",
      "parent": "AIFACTORY-US-028",
      "title": "Verify capacity-pools-and-quotas by running the declared command",
      "sequence": "09.02.01.05",
      "description": "Verify capacity-pools-and-quotas by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a run that discovers no test counts as a failure; it passes and proves AC1, AC2, AC3 and AC5 of AIFACTORY-US-028: the quota set through RuntimeCloudHost, the internal lease call denied and granted again after QuotaChanged, the unchanged lease contract of the thin delivery, the refusals through RuntimeCloudHost and the telemetry conformance over two tenants and two projects; AC4, the restored store, is proven by the drill record of AIFACTORY-TASK-4195.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a run that discovers no test counts as a failure; it passes and proves AC1, AC2, AC3 and AC5 of AIFACTORY-US-028: the quota set through RuntimeCloudHost, the internal lease call denied and granted again after QuotaChanged, the unchanged lease contract of the thin delivery, the refusals through RuntimeCloudHost and the telemetry conformance over two tenants and two projects; AC4, the restored store, is proven by the drill record of AIFACTORY-TASK-4195."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-781]",
      "number": 781
    },
    {
      "id": "AIFACTORY-US-1041",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "List worker pools and create or change the bounds and autoscaling of a pool as a Platform admin",
      "sequence": "09.02.02",
      "description": "As a platform administrator, I want to see every pool with its kind, boundary, region, size and utilisation and to set the bounds of a pool, so that capacity of each kind exists where tenants need it and never beyond the bounds I set. A caller whose scope carries `factory.capacity.read` lists pools through `ExecutionCapacityService/ListWorkerPools`, reached through the route GW-03 of RuntimeCloudHost: each pool with its kind, security boundary, region, node profile, minimum, maximum and current size, utilisation and state. Under the tenant row filter the caller sees the shared pools of the platform tenant and the dedicated pools of its own tenant; a dedicated pool of another tenant is never listed. A Platform admin whose scope carries `factory.capacity.admin` creates or changes a pool through `ExecutionCapacityService/SetWorkerPool` with its kind, boundary, region, node profile, bounds and autoscaling rule. A shared pool belongs to the platform tenant; the tenant of a tenant-dedicated or customer-hosted pool is the tenant that the trusted scope of the Platform admin names, so a Platform admin gives a tenant a dedicated pool by acting in the scope of that tenant. A pool id that exists nowhere is created: the pool is written in state Provisioning and answered 201. A change of the bounds of a Ready pool moves it to Scaling and is answered 200. `WorkerPoolStateChanged` is written to the outbox in the same transaction as the change (AIFACTORY-US-1042). The side-effect class of the operation is `production`, so each create or change also writes audit evidence in the same transaction: the Factory sink of the pinned audit library (feature `component-audit-factory-evidence`) writes an `audit-evidence-v1` record to the outbox with the event type `AuditEvidenceSubmitted` on the topic `audit.evidence.v1.evidence-submitted`, with the tenant and the actor from the trusted scope and the pool id, never the body beyond its references. The operation is naturally idempotent: the same body again is answered 200 and writes nothing, no evidence included. It is refused with 422 when the minimum exceeds the maximum, when the region lies outside the residency bounds of the tenant of the pool, which RetentionResidencyService answers through its static stub until I4 and which fails fast when it cannot be read, or when the boundary does not allow the kind, since sandboxes with egress to the internet and browser sessions run only in pools whose boundary allows it. A caller without the scope, or a Workspace admin, is refused with 403; a pool id that exists under another tenant, a dedicated pool of that tenant, is answered 404 and is never overwritten (ADR-0015). The modelled codes of `SetWorkerPool` and of `SetQuota` do not include 404; the answer follows ADR-0015 and owner decision (2), and the missing code is reported to the owner. The size is applied through provisioning: the pool reaches it when `ProvisioningApplied` is consumed (AIFACTORY-US-1042). How the desired size reaches IaCProvisioningService is not modelled, because that service consumes no event of this one; the gap is reported and this PBI does not decide it. Kind: behavior. Traces: services: ExecutionCapacityService, RuntimeCloudHost; aggregates: ExecutionCapacityService/WorkerPool; apis: ExecutionCapacityService/ListWorkerPools, ExecutionCapacityService/SetWorkerPool; events: ExecutionCapacityService/WorkerPoolStateChanged; descriptors: audit-evidence-v1; adrs: ADR-0014, ADR-0015, ADR-0017, ADR-0019, ADR-0028; scenarios: SCN-ExecutionCapacityService-001, SCN-ExecutionCapacityService-002. Relates: screens: capacity. Depends on: feature:runtime-cloud-host, feature:component-audit-factory-evidence. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given shared pools, a dedicated pool of the caller tenant and a dedicated pool of another tenant, when a caller with `factory.capacity.read` calls `ExecutionCapacityService/ListWorkerPools`, then the response is 200 with the shared pools and the own dedicated pool, each with kind, boundary, region, size, utilisation and state, and the pool of the other tenant never appears; a caller without the scope is answered 403 and nothing is written (SCN-ExecutionCapacityService-001, ADR-0015).",
        "AC2: Given a Platform admin with `factory.capacity.admin` acting in the trusted scope of a tenant, when `ExecutionCapacityService/SetWorkerPool` creates a tenant-dedicated pool under a pool id that exists nowhere and then changes the bounds of a Ready pool, then the first is answered 201 with the `ExecutionCapacityService/WorkerPool` in state Provisioning under the tenant of the scope and the second 200 with the pool in state Scaling, and each writes `ExecutionCapacityService/WorkerPoolStateChanged` and an `AuditEvidenceSubmitted` record of `audit-evidence-v1` to the outbox in the same transaction; the same body repeated is answered 200 and writes nothing (SCN-ExecutionCapacityService-002).",
        "AC3: Given a body whose minimum exceeds its maximum, a region outside the residency bounds of the tenant, or a boundary that does not allow the kind, when `ExecutionCapacityService/SetWorkerPool` is called, then the response is 422 with a problem response naming the rule and nothing is written; given the residency stub cannot be read, then the call fails fast and nothing is written (SCN-ExecutionCapacityService-002, model/services/runtime-cloud/ExecutionCapacityService.yaml).",
        "AC4: Given a caller without `factory.capacity.admin`, a Workspace admin, and a Platform admin acting in the scope of one tenant who addresses a pool id that exists as a dedicated pool of another tenant, when `ExecutionCapacityService/SetWorkerPool` is called, then the response is 403, 403 and 404 respectively, each with a problem response, and the pool of the other tenant is not changed and nothing is written (SCN-ExecutionCapacityService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4184",
        "AIFACTORY-TASK-281",
        "AIFACTORY-TASK-4185"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9802,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "RuntimeCloudHost"
        ],
        "aggregates": [
          "ExecutionCapacityService/WorkerPool"
        ],
        "apis": [
          "ExecutionCapacityService/ListWorkerPools",
          "ExecutionCapacityService/SetWorkerPool"
        ],
        "events": [
          "ExecutionCapacityService/WorkerPoolStateChanged"
        ],
        "descriptors": [
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0028"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-001",
          "SCN-ExecutionCapacityService-002"
        ]
      },
      "relates": {
        "screens": [
          "capacity"
        ]
      },
      "dependsOn": [
        "feature:runtime-cloud-host",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1041]",
      "number": 1041
    },
    {
      "id": "AIFACTORY-TASK-4184",
      "type": "task",
      "parent": "AIFACTORY-US-1041",
      "title": "ListWorkerPools and SetWorkerPool with the residency and boundary rules",
      "sequence": "09.02.02.01",
      "description": "ListWorkerPools and SetWorkerPool with the residency and boundary rules. Expected output: ListWorkerPools returns the shared pools and the dedicated pools of the caller tenant under the row filter; SetWorkerPool writes a shared pool under the platform tenant and a dedicated or customer-hosted pool under the tenant of the trusted scope of the Platform admin, creates a pool id that exists nowhere in state Provisioning with 201 or changes the bounds of a Ready pool to Scaling with 200, writes WorkerPoolStateChanged and, through the Factory sink of the pinned audit library, an AuditEvidenceSubmitted record on audit.evidence.v1.evidence-submitted in the same transaction, answers a repeated body 200 without writing, refuses with 422 an inverted bound, a region outside the residency bounds read through the static RetentionResidencyService stub with fail-fast handling, and a boundary that does not allow the kind, answers 403 without the scope or for a Workspace admin and 404 for a pool id that exists under another tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "ListWorkerPools returns the shared pools and the dedicated pools of the caller tenant under the row filter; SetWorkerPool writes a shared pool under the platform tenant and a dedicated or customer-hosted pool under the tenant of the trusted scope of the Platform admin, creates a pool id that exists nowhere in state Provisioning with 201 or changes the bounds of a Ready pool to Scaling with 200, writes WorkerPoolStateChanged and, through the Factory sink of the pinned audit library, an AuditEvidenceSubmitted record on audit.evidence.v1.evidence-submitted in the same transaction, answers a repeated body 200 without writing, refuses with 422 an inverted bound, a region outside the residency bounds read through the static RetentionResidencyService stub with fail-fast handling, and a boundary that does not allow the kind, answers 403 without the scope or for a Workspace admin and 404 for a pool id that exists under another tenant."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4184]",
      "number": 4184
    },
    {
      "id": "AIFACTORY-TASK-281",
      "type": "task",
      "parent": "AIFACTORY-US-1041",
      "title": "Domain model: WorkerPool, Quota, CapacityLease",
      "sequence": "09.02.02.02",
      "description": "Domain model: WorkerPool, Quota, CapacityLease. Expected output: Aggregates with their invariants and state transitions as modelled: the WorkerPool with its bounds, boundary and residency invariants and its states, the Quota that only tightens its tenant or its edition, and the CapacityLease of every holder kind with the six modelled transitions and the RunWorkspace kept from the thin delivery; unit tests cover every invariant and every transition.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Aggregates with their invariants and state transitions as modelled: the WorkerPool with its bounds, boundary and residency invariants and its states, the Quota that only tightens its tenant or its edition, and the CapacityLease of every holder kind with the six modelled transitions and the RunWorkspace kept from the thin delivery; unit tests cover every invariant and every transition."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-281]",
      "number": 281
    },
    {
      "id": "AIFACTORY-TASK-4185",
      "type": "task",
      "parent": "AIFACTORY-US-1041",
      "title": "Verify reading and setting worker pools through the acceptance suite",
      "sequence": "09.02.02.03",
      "description": "Verify reading and setting worker pools through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-001|Scenario=SCN-ExecutionCapacityService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1041: the row-filtered list, the create with 201 under the tenant of the scope and the change with 200 with their WorkerPoolStateChanged and AuditEvidenceSubmitted outbox records, the idempotent repeat, the three 422 rules, the fail-fast residency stub and the 403 and 404 refusals.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-001|Scenario=SCN-ExecutionCapacityService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1041: the row-filtered list, the create with 201 under the tenant of the scope and the change with 200 with their WorkerPoolStateChanged and AuditEvidenceSubmitted outbox records, the idempotent repeat, the three 422 rules, the fail-fast residency stub and the 403 and 404 refusals."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4185]",
      "number": 4185
    },
    {
      "id": "AIFACTORY-US-1042",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "Move pools through provisioning, autoscaling and draining and announce each state or size change",
      "sequence": "09.02.03",
      "description": "As an operator, I want pools to grow and shrink within their bounds from demand and every change of state or size to be announced, so that queued work is served as soon as capacity can be added and alerts and health follow the real pool. A pool changes state or size through three paths. The inbox handler `PoolProvisioned` consumes `ProvisioningApplied` of IaCProvisioningService, idempotent on the event id: the pool the provisioning run applied takes its new current size and moves from Provisioning or Scaling to Ready, in the transaction of the handler. The payload of that event names no pool id, only `outputs`; the pool is identified from the outputs, and the missing member is reported to the owner. The worker `Autoscaler` runs every two minutes, partitioned by pool with at most four in parallel, with two fixed retries thirty seconds apart and the idempotency key pool id plus window: from utilisation and the requests queued in `PoolGrain` it asks for a new size within the minimum and maximum of the pool and moves a Ready pool to Scaling; a size outside the bounds is never asked for. A pool in state Draining or Unavailable grants no new lease, and the leases running in it end normally; which command moves a pool to Draining or Unavailable is not modelled and is reported. `Capacity.AcquireLease` is a unary method, so a grant made later has no path back to a caller that is no longer waiting on the call. An exhausted pool therefore answers exactly as in I1: the lease moves from Requested to Denied (trigger `QuotaOrPoolExhausted`), the reply carries the reason `pool-exhausted` and names the pool as the limit, no capacity is granted, and the holder asks again with backoff (D129), ToolAdapterService as its failure mode for an exhausted sandbox capacity states. The denied request is recorded in `queuedRequests` of `PoolGrain` only as demand: the `Autoscaler` reads it to raise the size within bounds, and `connectsoft.factory.capacity.lease_wait` measures, for a holder with a queued request, the time from its first denied request to the grant of its retry. The retry of the holder is granted once capacity frees. The reminder `queue-drain` of `PoolGrain` fires every five seconds while requests are queued and only reserves freed capacity for the oldest queued holder, so that its retry is granted before a later request of another holder takes the capacity; the reminder grants nothing by itself and sends nothing to a holder. As decided for I2 (D129), the denied request is recorded as demand, freed capacity is reserved for the oldest waiting holder, and a reservation not claimed within the lease time to live passes to the next; a queued holder is matched by its holder kind and holder id, its entry leaves `queuedRequests` when its retry is granted, and a reservation that its holder does not claim by a retry within `RuntimeCloud:Capacity:LeaseTtlSeconds` passes to the next queued holder. Beyond the bounds the holder keeps being answered Denied with the pool named, so the requester sees why (FUX-08). The model states a five-second reminder while the amendment of ADR-0024 records that Orleans reminders are documented for periods of minutes or longer; this PBI implements the period of the model and the conflict is reported. Every change of state or size writes `WorkerPoolStateChanged` with `poolId`, `tenantId`, `kind`, `fromState`, `toState` and `currentSize` to the outbox in the transaction of the change; StudioBff, AlertRuleService and SloService consume it in their own PBIs, the alert on sustained queueing among them. Kind: behavior. Traces: services: ExecutionCapacityService, IaCProvisioningService; aggregates: ExecutionCapacityService/WorkerPool, ExecutionCapacityService/CapacityLease; apis: ExecutionCapacityService/Capacity.AcquireLease; events: ExecutionCapacityService/WorkerPoolStateChanged, ExecutionCapacityService/CapacityLeaseGranted, IaCProvisioningService/ProvisioningApplied; adrs: ADR-0012, ADR-0014, ADR-0024; requirements: FUX-08, NFR-09; scenarios: SCN-ExecutionCapacityService-009. Depends on: AIFACTORY-US-1041, feature:ia-cprovisioning-service. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#workers-and-jobs, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given a pool in state Provisioning or Scaling, when `IaCProvisioningService/ProvisioningApplied` for it is consumed, then the `ExecutionCapacityService/WorkerPool` takes its new current size and moves to Ready with `ExecutionCapacityService/WorkerPoolStateChanged` written in the same transaction, and a redelivery of the same event id changes nothing (SCN-ExecutionCapacityService-009).",
        "AC2: Given a Ready pool with queued requests and utilisation above its rule, when the `Autoscaler` runs, then a new size within the minimum and maximum is asked for, the pool moves to Scaling with `ExecutionCapacityService/WorkerPoolStateChanged`, a second trigger in the same window has no second effect, and a pool at its maximum is asked for no size beyond it while its queued holders keep being answered Denied with the pool named (FUX-08, ADR-0024).",
        "AC3: Given a pool in state Draining, set through a test fixture until the command that drains a pool is decided, with running leases, when a lease of its kind is requested through `ExecutionCapacityService/Capacity.AcquireLease`, then no lease is granted from that pool and the running leases renew and release normally until they end (model/services/runtime-cloud/ExecutionCapacityService.yaml).",
        "AC4: Given the only pool of the kind exhausted, when a holder requests a lease through `ExecutionCapacityService/Capacity.AcquireLease`, then the `ExecutionCapacityService/CapacityLease` moves from Requested to Denied by `QuotaOrPoolExhausted`, the reply carries the reason `pool-exhausted` and names the pool exactly as in I1, no capacity is granted and the request is recorded in `queuedRequests` of `PoolGrain`; given a lease of the pool is then released and `queue-drain` reserves the freed capacity for that oldest queued holder, then a request of another holder is still answered Denied, the retry of the queued holder is granted with `ExecutionCapacityService/CapacityLeaseGranted`, and `connectsoft.factory.capacity.lease_wait` records the time from its first denied request to that grant (FUX-08, ADR-0024).",
        "AC5: Given a pool changed state or size, when the outbox dispatcher publishes `ExecutionCapacityService/WorkerPoolStateChanged` on `capacity.pools.v1.worker-pool-state-changed`, then the event is sent under the run event envelope with `poolId`, `tenantId`, `kind`, `fromState`, `toState` and `currentSize`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ExecutionCapacityService-009, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#workers-and-jobs",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-336",
        "AIFACTORY-TASK-285",
        "AIFACTORY-TASK-4186"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9803,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "IaCProvisioningService"
        ],
        "aggregates": [
          "ExecutionCapacityService/WorkerPool",
          "ExecutionCapacityService/CapacityLease"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.AcquireLease"
        ],
        "events": [
          "ExecutionCapacityService/WorkerPoolStateChanged",
          "ExecutionCapacityService/CapacityLeaseGranted",
          "IaCProvisioningService/ProvisioningApplied"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FUX-08",
          "NFR-09"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-009"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1041",
        "feature:ia-cprovisioning-service"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#workers-and-jobs",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1042]",
      "number": 1042
    },
    {
      "id": "AIFACTORY-TASK-336",
      "type": "task",
      "parent": "AIFACTORY-US-1042",
      "title": "Worker pools with autoscaling",
      "sequence": "09.02.03.01",
      "description": "Worker pools with autoscaling. Expected output: Pools of each kind are declared with their boundary and size; the Autoscaler follows utilisation and the queue of PoolGrain within the declared bounds, every two minutes partitioned by pool with at most four in parallel, two fixed retries and the idempotency key pool id plus window, and writes WorkerPoolStateChanged with every state or size change; a pool in Draining or Unavailable grants no new lease.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Pools of each kind are declared with their boundary and size; the Autoscaler follows utilisation and the queue of PoolGrain within the declared bounds, every two minutes partitioned by pool with at most four in parallel, two fixed retries and the idempotency key pool id plus window, and writes WorkerPoolStateChanged with every state or size change; a pool in Draining or Unavailable grants no new lease."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-336]",
      "number": 336
    },
    {
      "id": "AIFACTORY-TASK-285",
      "type": "task",
      "parent": "AIFACTORY-US-1042",
      "title": "Workers and grains: Autoscaler hosting, the PoolProvisioned handler and the queue-drain reminder of PoolGrain",
      "sequence": "09.02.03.02",
      "description": "Workers and grains: Autoscaler hosting, the PoolProvisioned handler and the queue-drain reminder of PoolGrain. Expected output: The Autoscaler is hosted with its modelled trigger, retry policy and idempotency key so a duplicate trigger has no second effect; the handler of ProvisioningApplied sets the size and the Ready state of the pool idempotently on the event id; AcquireLease answers a request on an exhausted pool Denied by QuotaOrPoolExhausted with the reason pool-exhausted and the pool named, as in I1, and records it in queuedRequests of PoolGrain as demand for the Autoscaler and for connectsoft.factory.capacity.lease_wait; the queue-drain reminder, at the period the model states, only reserves freed capacity for the oldest queued holder, matched by holder kind and holder id, so that its retry is granted first, grants nothing by itself, and passes a reservation not claimed within RuntimeCloud:Capacity:LeaseTtlSeconds to the next queued holder.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Autoscaler is hosted with its modelled trigger, retry policy and idempotency key so a duplicate trigger has no second effect; the handler of ProvisioningApplied sets the size and the Ready state of the pool idempotently on the event id; AcquireLease answers a request on an exhausted pool Denied by QuotaOrPoolExhausted with the reason pool-exhausted and the pool named, as in I1, and records it in queuedRequests of PoolGrain as demand for the Autoscaler and for connectsoft.factory.capacity.lease_wait; the queue-drain reminder, at the period the model states, only reserves freed capacity for the oldest queued holder, matched by holder kind and holder id, so that its retry is granted first, grants nothing by itself, and passes a reservation not claimed within RuntimeCloud:Capacity:LeaseTtlSeconds to the next queued holder."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-285]",
      "number": 285
    },
    {
      "id": "AIFACTORY-TASK-4186",
      "type": "task",
      "parent": "AIFACTORY-US-1042",
      "title": "Verify pool state, provisioning and autoscaling through the acceptance suite",
      "sequence": "09.02.03.03",
      "description": "Verify pool state, provisioning and autoscaling through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1042 with a fixture ProvisioningApplied event and a test clock: the Ready transition, the redelivered event, the Autoscaler within bounds and its duplicate window, the pool at its maximum whose holders are answered Denied, the pool set to Draining by a test fixture, the Denied reply with the reason pool-exhausted and the pool named on an exhausted pool in I2, the reservation of queue-drain that lets the retry of the oldest queued holder be granted before another holder, lease_wait from the first denied request to that grant, and the publication and payload of WorkerPoolStateChanged with a stopped transport.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1042 with a fixture ProvisioningApplied event and a test clock: the Ready transition, the redelivered event, the Autoscaler within bounds and its duplicate window, the pool at its maximum whose holders are answered Denied, the pool set to Draining by a test fixture, the Denied reply with the reason pool-exhausted and the pool named on an exhausted pool in I2, the reservation of queue-drain that lets the retry of the oldest queued holder be granted before another holder, lease_wait from the first denied request to that grant, and the publication and payload of WorkerPoolStateChanged with a stopped transport."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4186]",
      "number": 4186
    },
    {
      "id": "AIFACTORY-US-1043",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "Read the effective quotas of a tenant and its projects and tighten a quota as a Workspace admin",
      "sequence": "09.02.04",
      "description": "As a workspace administrator, I want to see the quotas my tenant and projects run under and to tighten them, so that one project cannot take the whole share of my tenant and every change is recorded as evidence. A caller whose scope carries `factory.capacity.read` reads through `ExecutionCapacityService/GetQuotas` the effective quotas of its tenant and of each of its projects: concurrent runs, concurrent sandboxes, cpu and memory per attempt and execution minutes per day, each with its source, `edition` or `override`. The defaults of the edition come from `RuntimeCloud:Capacity:EditionDefaults` (D34) for the edition of the tenant, which FactoryCommercialService answers through its static stub until I7 and which degrades when it cannot be read, as the model states for that dependency. A Workspace admin whose scope carries `factory.capacity.admin` tightens the quota of the tenant or of one of its projects through `ExecutionCapacityService/SetQuota`: the `Quota` row of that scope is written with the source `override` and `QuotaChanged` with `quotaId`, `tenantId`, `projectId`, `concurrentRuns` and `concurrentSandboxes` is written to the outbox in the same transaction. A project quota may only tighten the quota of its tenant and a tenant quota only the defaults of its edition; a looser value, a negative value or an unknown scope is refused with 422. The operation is naturally idempotent: the same body again is answered 200 and writes nothing. A caller without the scope is refused with 403, and so is a Workspace admin who addresses the defaults of an edition, which only a Platform admin sets; a project of another tenant is answered 404 (ADR-0015). The model keeps the defaults of an edition in the option `RuntimeCloud:Capacity:EditionDefaults` and has no row for an edition in `Quotas`, so where a value a Platform admin sets through this operation is kept is reported to the owner and this PBI does not decide it. RunControlService consumes `QuotaChanged` to resume the steps that wait for capacity (`ResumeDispatchOnQuota`, AIFACTORY-US-1610 of this feature), StudioBff refreshes its quota view and AuditService records the change as evidence, each in its own PBI. Kind: behavior. Traces: services: ExecutionCapacityService, RuntimeCloudHost; aggregates: ExecutionCapacityService/Quota; apis: ExecutionCapacityService/GetQuotas, ExecutionCapacityService/SetQuota; events: ExecutionCapacityService/QuotaChanged; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FUX-08; scenarios: SCN-ExecutionCapacityService-003, SCN-ExecutionCapacityService-004, SCN-ExecutionCapacityService-010. Relates: screens: capacity. Depends on: feature:runtime-cloud-host. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a tenant on an edition with one project override, when a caller with `factory.capacity.read` calls `ExecutionCapacityService/GetQuotas`, then the response is 200 with the effective quota of the tenant and of each project, each limit with its source `edition` or `override`, the defaults read from `RuntimeCloud:Capacity:EditionDefaults` for the edition of the tenant; a caller without the scope is answered 403 and nothing is written (SCN-ExecutionCapacityService-003).",
        "AC2: Given a Workspace admin with `factory.capacity.admin`, when `ExecutionCapacityService/SetQuota` tightens the quota of a project of its tenant, then the response is 200, the `ExecutionCapacityService/Quota` of that project is written with the source `override`, and `ExecutionCapacityService/QuotaChanged` is written to the outbox in the same transaction; the same body repeated is answered 200 and writes nothing (SCN-ExecutionCapacityService-004).",
        "AC3: Given a project quota looser than its tenant quota, a tenant quota looser than its edition, a negative value, a caller without the scope, a Workspace admin addressing the defaults of an edition and a project of another tenant, when `ExecutionCapacityService/SetQuota` is called, then the response is 422, 422, 422, 403, 403 and 404 respectively, each with a problem response and no state change (SCN-ExecutionCapacityService-004, ADR-0015).",
        "AC4: Given a quota was changed, when the outbox dispatcher publishes `ExecutionCapacityService/QuotaChanged` on `capacity.quotas.v1.quota-changed`, then the event is sent under the run event envelope with `quotaId`, `tenantId`, `projectId` where the quota is of a project, `concurrentRuns` and `concurrentSandboxes`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ExecutionCapacityService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4187",
        "AIFACTORY-TASK-282",
        "AIFACTORY-TASK-4188"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9804,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "RuntimeCloudHost"
        ],
        "aggregates": [
          "ExecutionCapacityService/Quota"
        ],
        "apis": [
          "ExecutionCapacityService/GetQuotas",
          "ExecutionCapacityService/SetQuota"
        ],
        "events": [
          "ExecutionCapacityService/QuotaChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-08"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-003",
          "SCN-ExecutionCapacityService-004",
          "SCN-ExecutionCapacityService-010"
        ]
      },
      "relates": {
        "screens": [
          "capacity"
        ]
      },
      "dependsOn": [
        "feature:runtime-cloud-host"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1043]",
      "number": 1043
    },
    {
      "id": "AIFACTORY-TASK-4187",
      "type": "task",
      "parent": "AIFACTORY-US-1043",
      "title": "GetQuotas and SetQuota with the edition source and the tightening invariant",
      "sequence": "09.02.04.01",
      "description": "GetQuotas and SetQuota with the edition source and the tightening invariant. Expected output: GetQuotas returns the effective quota of the tenant and its projects with the source of each limit, the edition read through the static FactoryCommercialService stub and its defaults from RuntimeCloud:Capacity:EditionDefaults; SetQuota writes the override of a tenant or project scope with QuotaChanged in the same transaction, refuses a looser or negative value and an unknown scope with 422, a missing scope and a Workspace admin on edition defaults with 403 and a project of another tenant with 404, and answers a repeated body 200 without writing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "GetQuotas returns the effective quota of the tenant and its projects with the source of each limit, the edition read through the static FactoryCommercialService stub and its defaults from RuntimeCloud:Capacity:EditionDefaults; SetQuota writes the override of a tenant or project scope with QuotaChanged in the same transaction, refuses a looser or negative value and an unknown scope with 422, a missing scope and a Workspace admin on edition defaults with 403 and a project of another tenant with 404, and answers a repeated body 200 without writing."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4187]",
      "number": 4187
    },
    {
      "id": "AIFACTORY-TASK-282",
      "type": "task",
      "parent": "AIFACTORY-US-1043",
      "title": "Persistence in execution-capacity-sql: WorkerPools, Quotas, CapacityLeases",
      "sequence": "09.02.04.02",
      "description": "Persistence in execution-capacity-sql: WorkerPools, Quotas, CapacityLeases. Expected output: Mappings and migrations of the complete delivery on top of the thin tables: the Quotas table with UX_Quotas_Scope over tenant and project, the columns of the complete WorkerPools and CapacityLeases and the tenant filters; the retention of 90 days of CapacityLeases is applied by the query filter of ListCapacityLeases, and no purge of rows is built here because the model declares no retention worker for CapacityLeases or RunWorkspaces and no deletion-order handler belongs to this increment; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations of the complete delivery on top of the thin tables: the Quotas table with UX_Quotas_Scope over tenant and project, the columns of the complete WorkerPools and CapacityLeases and the tenant filters; the retention of 90 days of CapacityLeases is applied by the query filter of ListCapacityLeases, and no purge of rows is built here because the model declares no retention worker for CapacityLeases or RunWorkspaces and no deletion-order handler belongs to this increment; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9804,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-282]",
      "number": 282
    },
    {
      "id": "AIFACTORY-TASK-4188",
      "type": "task",
      "parent": "AIFACTORY-US-1043",
      "title": "Verify reading and setting quotas through the acceptance suite",
      "sequence": "09.02.04.03",
      "description": "Verify reading and setting quotas through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-003|Scenario=SCN-ExecutionCapacityService-004|Scenario=SCN-ExecutionCapacityService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1043: the effective quotas with their sources, the tightened override with its QuotaChanged outbox record, the idempotent repeat, the 422, 403 and 404 refusals and the publication and payload of QuotaChanged with a stopped transport.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ExecutionCapacityService-003|Scenario=SCN-ExecutionCapacityService-004|Scenario=SCN-ExecutionCapacityService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1043: the effective quotas with their sources, the tightened override with its QuotaChanged outbox record, the idempotent repeat, the 422, 403 and 404 refusals and the publication and payload of QuotaChanged with a stopped transport."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4188]",
      "number": 4188
    },
    {
      "id": "AIFACTORY-US-1044",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "Deny a lease that would exceed a quota of its tenant or project and announce the limit that denied it",
      "sequence": "09.02.05",
      "description": "As a workspace administrator, I want a lease that would exceed a quota to be denied with the limit named, so that my tenant waits within its share, no other tenant is starved and the denial is visible and counted. Every request of `ExecutionCapacityService/Capacity.AcquireLease` is checked against the effective quota of its project and of its tenant before the capacity of a pool, the tighter limit winning: concurrent runs, concurrent sandboxes, counted as the open sandbox leases, cpu and memory per attempt against the request of an attempt lease, and execution minutes per day. Concurrent runs and execution minutes are counted by the reading of D129: concurrent runs are counted as the distinct runs of the scope with an open lease, and execution minutes per day are counted against the `executionSeconds` of the leases of the scope that ended that day plus the seconds held so far by its open leases. A request within quota proceeds to the pool (AIFACTORY-US-1045). A request that would exceed a limit moves its lease from Requested to Denied (trigger `QuotaOrPoolExhausted`), the reply names the limiting quota, no capacity is granted, and `QuotaExceeded` with `tenantId`, `projectId`, `holderKind`, `holderId` and `limit` is written to the outbox in the same transaction; `connectsoft.factory.capacity.quota_denials` counts it with the tenant and the limit. The holder waits and the requester sees why (FUX-08): RunControlService keeps the next steps of the project Pending without counting an attempt (`HoldDispatchOnQuota`, AIFACTORY-US-1609 of this feature), CostUsageService records the denial, StudioBff refreshes its quota view, each in its own PBI, and when a quota is changed RunControlService evaluates the waiting steps again on `QuotaChanged` (`ResumeDispatchOnQuota`, AIFACTORY-US-1610 of this feature). Because quotas are checked per tenant and project before the pool, a tenant at its limit never takes capacity that another tenant within its quota could use, which is how no tenant starves another (NFR-09). A denial is not a refusal of the call: the caller had the scope and a valid request; the refusals of the method stay those of the thin delivery. Kind: behavior. Traces: services: ExecutionCapacityService; aggregates: ExecutionCapacityService/Quota, ExecutionCapacityService/CapacityLease; apis: ExecutionCapacityService/Capacity.AcquireLease; events: ExecutionCapacityService/QuotaExceeded; adrs: ADR-0012, ADR-0014; requirements: FUX-08, NFR-09; scenarios: SCN-ExecutionCapacityService-011. Depends on: AIFACTORY-US-1043. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a project at its `concurrentSandboxes` limit, when its next sandbox is requested through `ExecutionCapacityService/Capacity.AcquireLease`, then the `ExecutionCapacityService/CapacityLease` moves from Requested to Denied, the reply names the limiting quota, no capacity is granted, and `ExecutionCapacityService/QuotaExceeded` is written to the outbox in the same transaction and counted in `connectsoft.factory.capacity.quota_denials` (SCN-ExecutionCapacityService-011).",
        "AC2: Given a tenant quota tighter than a project override, an attempt lease asking for more cpu than `cpuPerAttempt`, and a tenant that used its execution minutes of the day, when each requests a lease through `ExecutionCapacityService/Capacity.AcquireLease`, then each is denied by the tighter or exhausted limit, which the reply and `ExecutionCapacityService/QuotaExceeded` name (SCN-ExecutionCapacityService-011, model/services/runtime-cloud/ExecutionCapacityService.yaml).",
        "AC3: Given one tenant at its quota and another within it, both asking the same pool, when their requests reach `ExecutionCapacityService/Capacity.AcquireLease`, then the first is denied by its quota before the pool is asked and the second is granted from the pool, so the denied tenant never takes the capacity of the other (NFR-09).",
        "AC4: Given a lease was denied by a quota, when the outbox dispatcher publishes `ExecutionCapacityService/QuotaExceeded` on `capacity.quotas.v1.quota-exceeded`, then the event is sent under the run event envelope with `tenantId`, `projectId`, `holderKind`, `holderId` and `limit`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-ExecutionCapacityService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-337",
        "AIFACTORY-TASK-4189"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9805,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService"
        ],
        "aggregates": [
          "ExecutionCapacityService/Quota",
          "ExecutionCapacityService/CapacityLease"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.AcquireLease"
        ],
        "events": [
          "ExecutionCapacityService/QuotaExceeded"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FUX-08",
          "NFR-09"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-011"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1043"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1044]",
      "number": 1044
    },
    {
      "id": "AIFACTORY-TASK-337",
      "type": "task",
      "parent": "AIFACTORY-US-1044",
      "title": "Quotas per tenant and project enforced at lease time",
      "sequence": "09.02.05.01",
      "description": "Quotas per tenant and project enforced at lease time. Expected output: AcquireLease checks the effective project and tenant quota before the pool, the tighter limit winning, over concurrent runs, concurrent sandboxes, cpu and memory per attempt and execution minutes per day, counting concurrent runs and execution minutes by the reading of D129 that the description of AIFACTORY-US-1044 states; a denial moves the lease to Denied by QuotaOrPoolExhausted, names the limiting quota in the reply, writes QuotaExceeded in the same transaction and increments connectsoft.factory.capacity.quota_denials with tenant and limit.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "AcquireLease checks the effective project and tenant quota before the pool, the tighter limit winning, over concurrent runs, concurrent sandboxes, cpu and memory per attempt and execution minutes per day, counting concurrent runs and execution minutes by the reading of D129 that the description of AIFACTORY-US-1044 states; a denial moves the lease to Denied by QuotaOrPoolExhausted, names the limiting quota in the reply, writes QuotaExceeded in the same transaction and increments connectsoft.factory.capacity.quota_denials with tenant and limit."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9805,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-337]",
      "number": 337
    },
    {
      "id": "AIFACTORY-TASK-4189",
      "type": "task",
      "parent": "AIFACTORY-US-1044",
      "title": "Verify quota enforcement through the acceptance suite",
      "sequence": "09.02.05.02",
      "description": "Verify quota enforcement through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1044: the denial at the concurrent sandbox limit, the tighter tenant limit, the cpu per attempt and the daily minutes, the two tenants on one pool where only the one at its quota waits, and the publication and payload of QuotaExceeded with a stopped transport.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1044: the denial at the concurrent sandbox limit, the tighter tenant limit, the cpu per attempt and the daily minutes, the two tenants on one pool where only the one at its quota waits, and the publication and payload of QuotaExceeded with a stopped transport."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4189]",
      "number": 4189
    },
    {
      "id": "AIFACTORY-US-1045",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "Place attempt, build, sandbox and browser leases in pools of their kind and release the lease of an attempt on its recorded outcome",
      "sequence": "09.02.06",
      "description": "As an operator, I want every kind of work to be leased from a pool of its kind, within the boundary and region it may use, so that placement is explicit for agents, builds, sandboxes and browsers alike and no lease outlives its work. The complete delivery serves the four holder kinds through the same three methods of the thin delivery. AgentRuntimeWorker acquires an `attempt` lease for an attempt of a run, ToolAdapterService a `sandbox` or a `browser` lease and, in a later increment, PipelineExecutionService a `build` lease, each with a workload identity whose token carries `factory.capacity.lease`. The model names AgentRuntimeWorker as the inbound caller of attempt leases, but the model of AgentRuntimeWorker declares no outbound call to this service and its feature arrives in I3; this delivery therefore proves the attempt lease with a fake caller and the gap is reported. Within quota (AIFACTORY-US-1044), a lease is placed in a pool of the requested kind that is Ready or Scaling, whose region the residency bounds of the tenant allow, read through the static stub of RetentionResidencyService until I4 with fail-fast handling, and whose boundary allows the holder: a sandbox with egress to the internet and a browser session only in a pool whose boundary allows it, and never in a dedicated pool of another tenant. A lease that names a run receives the workspace of the run as in the thin delivery (D121). The transition from Granted to Active (trigger `HolderStarted`) is signalled for a sandbox by the start of its sandbox, as in the thin delivery. For the holder kinds `attempt`, `build` and `browser` the service starts nothing on the pool, and the model names no signal; by the reading of D129, the first `Capacity.RenewLease` of a Granted lease by its holder is its `HolderStarted` and moves it to Active, so that `HeartbeatMissed`, Released and `executionSeconds` are reached for every holder kind, and the choice is reported. A Granted lease that is never renewed expires by `NotStarted`. Renewal, release and expiry otherwise work as in the thin delivery for every kind and every pool: `LeaseExpirer` and the reminder `lease-expiry` of `PoolGrain` expire leases whose heartbeat stopped in each pool. The inbox handler `ReleaseAttemptLease` consumes `AttemptOutcomeRecorded` of RunControlService and releases the lease of that attempt, belt and braces with the release of the worker. The payload of that event carries no `tenantId`, so the handler takes the tenant from the run event envelope of the event and finds the lease by `attemptId` within that tenant under the tenant row filter. It is idempotent on the event id and on the lease state, so a lease already released by its holder is not released twice and one `CapacityLeaseReleased` exists per lease. The messaging profile `execution-capacity` now publishes its five events and registers its six consumed events. The refusals of the methods are those of the thin delivery, without the FAILED_PRECONDITION for the holder kinds the thin delivery did not serve. A sandbox lease whose egress allow list is not empty, or a browser lease, for which no pool of its kind visible to the tenant has a security boundary that allows it is still refused with FAILED_PRECONDITION and nothing written, because no freed capacity would ever serve it. A request for a kind that no Ready or Scaling pool serves is answered exactly as an exhausted pool (AIFACTORY-US-1042): the lease moves from Requested to Denied by `QuotaOrPoolExhausted`, the reply carries the reason `pool-exhausted` and names the kind as the limit, the request is recorded as demand, and the retry of the holder is granted once a pool of that kind is Ready. Kind: behavior. Traces: services: ExecutionCapacityService, AgentRuntimeService, AgentRuntimeWorker, ToolAdapterService, RunControlService; aggregates: ExecutionCapacityService/CapacityLease, ExecutionCapacityService/WorkerPool; apis: ExecutionCapacityService/Capacity.AcquireLease, ExecutionCapacityService/Capacity.RenewLease, ExecutionCapacityService/Capacity.ReleaseLease; events: ExecutionCapacityService/CapacityLeaseGranted, ExecutionCapacityService/CapacityLeaseReleased, RunControlService/AttemptOutcomeRecorded; adrs: ADR-0015, ADR-0017, ADR-0024; requirements: NFR-09. Depends on: AIFACTORY-US-1042, AIFACTORY-US-1044, feature:run-control-service. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given pools of the four kinds in two regions and a tenant whose residency allows one region, when an `attempt`, a `build`, a `sandbox` and a `browser` lease are requested through `ExecutionCapacityService/Capacity.AcquireLease`, then each `ExecutionCapacityService/CapacityLease` is granted from a pool of its kind in the allowed region with `ExecutionCapacityService/CapacityLeaseGranted`, never from a dedicated pool of another tenant (ADR-0015, ADR-0017).",
        "AC2: Given a browser lease and a sandbox lease with egress to the internet, and pools whose boundary does or does not allow them, when they are requested through `ExecutionCapacityService/Capacity.AcquireLease`, then they are placed only in the pools whose boundary allows them, and the residency stub that cannot be read fails the request fast with nothing written (model/services/runtime-cloud/ExecutionCapacityService.yaml).",
        "AC3: Given an Active attempt lease, when `RunControlService/AttemptOutcomeRecorded` of that attempt is consumed, then the lease is released with `ExecutionCapacityService/CapacityLeaseReleased`; given the worker had already released it through `ExecutionCapacityService/Capacity.ReleaseLease`, or the event is redelivered, then nothing is written a second time (model/services/control-plane/RunControlService.yaml).",
        "AC4: Given leases of every kind in several pools whose holders stop renewing, when `LeaseExpirer` runs, then each moves to Expired in its own pool with `ExecutionCapacityService/CapacityLeaseReleased` and its capacity returns to that pool, and a lease of any kind that names a run leaves the workspace of the run in place (ADR-0024, D121).",
        "AC5: Given an attempt lease granted through `ExecutionCapacityService/Capacity.AcquireLease`, when its holder calls `ExecutionCapacityService/Capacity.RenewLease` for the first time, then the `ExecutionCapacityService/CapacityLease` moves from Granted to Active by `HolderStarted`; when the holder then calls `ExecutionCapacityService/Capacity.ReleaseLease`, then the lease moves to Released and `ExecutionCapacityService/CapacityLeaseReleased` carries the state Released and `executionSeconds`; given a request for a kind that no Ready or Scaling pool serves, then the lease is Denied with the kind named, and given a browser lease for which no visible pool has a boundary that allows it, then the call is refused with FAILED_PRECONDITION and nothing is written."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-338",
        "AIFACTORY-TASK-284",
        "AIFACTORY-TASK-4190",
        "AIFACTORY-TASK-4191"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9806,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "AgentRuntimeService",
          "AgentRuntimeWorker",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "ExecutionCapacityService/CapacityLease",
          "ExecutionCapacityService/WorkerPool"
        ],
        "apis": [
          "ExecutionCapacityService/Capacity.AcquireLease",
          "ExecutionCapacityService/Capacity.RenewLease",
          "ExecutionCapacityService/Capacity.ReleaseLease"
        ],
        "events": [
          "ExecutionCapacityService/CapacityLeaseGranted",
          "ExecutionCapacityService/CapacityLeaseReleased",
          "RunControlService/AttemptOutcomeRecorded"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0024"
        ],
        "requirements": [
          "NFR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1042",
        "AIFACTORY-US-1044",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1045]",
      "number": 1045
    },
    {
      "id": "AIFACTORY-TASK-338",
      "type": "task",
      "parent": "AIFACTORY-US-1045",
      "title": "Lease placement, renewal and expiry for every holder kind and every pool",
      "sequence": "09.02.06.01",
      "description": "Lease placement, renewal and expiry for every holder kind and every pool. Expected output: AcquireLease places attempt, build, sandbox and browser leases in a Ready or Scaling pool of the requested kind, in a region the residency stub allows and a boundary that allows the holder, never in a dedicated pool of another tenant; a sandbox lease with a non-empty egress allow list or a browser lease that no visible pool boundary allows is refused with FAILED_PRECONDITION, and a kind that no Ready or Scaling pool serves is answered Denied with the kind named as on an exhausted pool; the first RenewLease of a Granted attempt, build or browser lease moves it to Active by HolderStarted, the reading of D129 that AIFACTORY-US-1045 states, so that an attempt lease reaches Released with executionSeconds through ReleaseLease; leases are renewed by their holders and expired by LeaseExpirer and the lease-expiry reminder of each PoolGrain when they are not, and every lease that names a run keeps receiving the one workspace of the run.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "AcquireLease places attempt, build, sandbox and browser leases in a Ready or Scaling pool of the requested kind, in a region the residency stub allows and a boundary that allows the holder, never in a dedicated pool of another tenant; a sandbox lease with a non-empty egress allow list or a browser lease that no visible pool boundary allows is refused with FAILED_PRECONDITION, and a kind that no Ready or Scaling pool serves is answered Denied with the kind named as on an exhausted pool; the first RenewLease of a Granted attempt, build or browser lease moves it to Active by HolderStarted, the reading of D129 that AIFACTORY-US-1045 states, so that an attempt lease reaches Released with executionSeconds through ReleaseLease; leases are renewed by their holders and expired by LeaseExpirer and the lease-expiry reminder of each PoolGrain when they are not, and every lease that names a run keeps receiving the one workspace of the run."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-338]",
      "number": 338
    },
    {
      "id": "AIFACTORY-TASK-284",
      "type": "task",
      "parent": "AIFACTORY-US-1045",
      "title": "Messaging: publishes 5 events, handles 6",
      "sequence": "09.02.06.02",
      "description": "Messaging: publishes 5 events, handles 6. Expected output: Events are published through the outbox of the profile execution-capacity with the run envelope (WorkerPoolStateChanged, QuotaChanged, QuotaExceeded, CapacityLeaseGranted, CapacityLeaseReleased); the six consumed events, AttemptOutcomeRecorded, RunCompleted, RunFailed and RunCancelled of RunControlService, SandboxReleased of ToolAdapterService and ProvisioningApplied of IaCProvisioningService, are handled idempotently through its inbox and inbox_lag reports the oldest unprocessed message.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Events are published through the outbox of the profile execution-capacity with the run envelope (WorkerPoolStateChanged, QuotaChanged, QuotaExceeded, CapacityLeaseGranted, CapacityLeaseReleased); the six consumed events, AttemptOutcomeRecorded, RunCompleted, RunFailed and RunCancelled of RunControlService, SandboxReleased of ToolAdapterService and ProvisioningApplied of IaCProvisioningService, are handled idempotently through its inbox and inbox_lag reports the oldest unprocessed message."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-284]",
      "number": 284
    },
    {
      "id": "AIFACTORY-TASK-4190",
      "type": "task",
      "parent": "AIFACTORY-US-1045",
      "title": "ReleaseAttemptLease inbox handler on AttemptOutcomeRecorded",
      "sequence": "09.02.06.03",
      "description": "ReleaseAttemptLease inbox handler on AttemptOutcomeRecorded. Expected output: The handler of AttemptOutcomeRecorded takes the tenant from the run event envelope of the event, finds the open lease by attemptId within that tenant under the tenant row filter and releases it through the release command of the thin delivery, idempotent on the event id and on the lease state, so a lease the worker already released or an event redelivered writes nothing a second time.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "The handler of AttemptOutcomeRecorded takes the tenant from the run event envelope of the event, finds the open lease by attemptId within that tenant under the tenant row filter and releases it through the release command of the thin delivery, idempotent on the event id and on the lease state, so a lease the worker already released or an event redelivered writes nothing a second time."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4190]",
      "number": 4190
    },
    {
      "id": "AIFACTORY-TASK-4191",
      "type": "task",
      "parent": "AIFACTORY-US-1045",
      "title": "Verify the leases of every holder kind through the acceptance suite",
      "sequence": "09.02.06.04",
      "description": "Verify the leases of every holder kind through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=LeasesOfEveryKind\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1045 with pool fixtures of four kinds in two regions and a fake attempt-lease caller: the placement by kind, region and boundary, the fail-fast residency stub, the attempt lease released on a fixture RunControlService/AttemptOutcomeRecorded found by attemptId in the tenant of its envelope and not twice, the expiry in every pool that leaves the workspace in place, an attempt lease moved from Granted to Active by its first renewal and to Released with executionSeconds, the Denied answer for a kind no pool serves and the FAILED_PRECONDITION refusal of a browser lease that no boundary allows.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=LeasesOfEveryKind\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1045 with pool fixtures of four kinds in two regions and a fake attempt-lease caller: the placement by kind, region and boundary, the fail-fast residency stub, the attempt lease released on a fixture RunControlService/AttemptOutcomeRecorded found by attemptId in the tenant of its envelope and not twice, the expiry in every pool that leaves the workspace in place, an attempt lease moved from Granted to Active by its first renewal and to Released with executionSeconds, the Denied answer for a kind no pool serves and the FAILED_PRECONDITION refusal of a browser lease that no boundary allows."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9806,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4191]",
      "number": 4191
    },
    {
      "id": "AIFACTORY-US-1046",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "List the active and recent capacity leases of a tenant by holder, pool and state",
      "sequence": "09.02.07",
      "description": "As an operator, I want to see who holds capacity in which pool and in which state, so that I can tell why a run waits and which holder keeps a pool busy. A caller whose scope carries `factory.capacity.read`, reached through the route GW-03 of RuntimeCloudHost, lists capacity leases through `ExecutionCapacityService/ListCapacityLeases`: the active leases and the recent ones within the retention of 90 days of `CapacityLeases`, which the query applies as a filter because the model declares no worker that purges the rows (reported), each with its holder kind and holder id, pool, state, cpu and memory, grant, expiry and release times, filtered by holder, pool and state. Under the tenant row filter only the leases of the caller tenant are listed; a lease of another tenant never appears, also when it holds capacity in a shared pool the caller can see. A denied lease is listed with the state Denied, so an operator sees which holder waits; the limit that denied it is named by `QuotaExceeded` and by the reply to the holder (AIFACTORY-US-1044). A caller without the scope is refused with 403. Nothing is written by the read, and the answer holds references and numbers only, never the content of a workspace (ADR-0019). The Studio view of capacity and quotas that reads this operation is built by StudioBff in its own increment. Kind: behavior. Traces: services: ExecutionCapacityService, RuntimeCloudHost; aggregates: ExecutionCapacityService/CapacityLease; apis: ExecutionCapacityService/ListCapacityLeases; adrs: ADR-0015, ADR-0019; scenarios: SCN-ExecutionCapacityService-005. Relates: screens: capacity. Depends on: AIFACTORY-US-1045, feature:runtime-cloud-host. Sources: model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/planes/execution/environments/services/execution-capacity-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given leases of the caller tenant in several pools and states and leases of another tenant in a shared pool, when a caller with `factory.capacity.read` calls `ExecutionCapacityService/ListCapacityLeases` filtered by pool and state, then the response is 200 with the matching leases of the caller tenant only, each with holder kind, holder id, pool, state, cpu, memory and its times, and the leases of the other tenant never appear (SCN-ExecutionCapacityService-005, ADR-0015).",
        "AC2: Given a caller without `factory.capacity.read`, when `ExecutionCapacityService/ListCapacityLeases` is called, then the response is 403 with a problem response and nothing is written; given a denied lease of the tenant, then it is listed with the state Denied (SCN-ExecutionCapacityService-005).",
        "AC3: Given leases released more than 90 days ago and active leases, when `ExecutionCapacityService/ListCapacityLeases` is called without a state filter, then the active and the recent leases are listed and none beyond the retention of `CapacityLeases`, and no record of the answer or of its telemetry holds workspace content (ADR-0019, model/services/runtime-cloud/ExecutionCapacityService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4192",
        "AIFACTORY-TASK-4193"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9807,
      "kind": "behavior",
      "traces": {
        "services": [
          "ExecutionCapacityService",
          "RuntimeCloudHost"
        ],
        "aggregates": [
          "ExecutionCapacityService/CapacityLease"
        ],
        "apis": [
          "ExecutionCapacityService/ListCapacityLeases"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "scenarios": [
          "SCN-ExecutionCapacityService-005"
        ]
      },
      "relates": {
        "screens": [
          "capacity"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1045",
        "feature:runtime-cloud-host"
      ],
      "source": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/execution/environments/services/execution-capacity-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1046]",
      "number": 1046
    },
    {
      "id": "AIFACTORY-TASK-4192",
      "type": "task",
      "parent": "AIFACTORY-US-1046",
      "title": "ListCapacityLeases with filters by holder, pool and state under the tenant row filter",
      "sequence": "09.02.07.01",
      "description": "ListCapacityLeases with filters by holder, pool and state under the tenant row filter. Expected output: ListCapacityLeases returns the active and recent leases of the caller tenant, filtering out in the query every lease released, expired or denied more than 90 days ago, the retention window of CapacityLeases, whether or not its row still exists, filtered by holder, pool and state, with holder kind, holder id, pool, state, cpu, memory and the grant, expiry and release times, Denied leases included, answers 403 without the scope and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "ListCapacityLeases returns the active and recent leases of the caller tenant, filtering out in the query every lease released, expired or denied more than 90 days ago, the retention window of CapacityLeases, whether or not its row still exists, filtered by holder, pool and state, with holder kind, holder id, pool, state, cpu, memory and the grant, expiry and release times, Denied leases included, answers 403 without the scope and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9807,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4192]",
      "number": 4192
    },
    {
      "id": "AIFACTORY-TASK-4193",
      "type": "task",
      "parent": "AIFACTORY-US-1046",
      "title": "Verify the operator view of leases through the acceptance suite",
      "sequence": "09.02.07.02",
      "description": "Verify the operator view of leases through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1046: the filtered list of the caller tenant only, the 403 refusal, the denied lease in the list and the retention boundary.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ExecutionCapacityService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1046: the filtered list of the caller tenant only, the 403 refusal, the denied lease in the list and the retention boundary."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9807,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4193]",
      "number": 4193
    },
    {
      "id": "AIFACTORY-US-1609",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "RunControlService dispatches no further attempt of a project while a quota denies the attempt leases of that project, and counts no attempt",
      "sequence": "09.02.08",
      "description": "As a workspace administrator, I want the steps of my project to wait Pending while a quota denies the capacity of its attempts, so that no attempt is spent on capacity my project does not have and my runs go on when capacity frees. The inbox handler `HoldDispatchOnQuota` of RunControlService takes `ExecutionCapacityService/QuotaExceeded`, which carries `tenantId`, `projectId`, `holderKind`, `holderId` and `limit`. RunControlService itself is delivered in I1 by feature `run-control-service`, but the producer of quotas arrives with this feature in I2, so the handler is delivered here and its tasks are written in the repository ConnectSoft.AI.SoftwareFactory.RunControlService (D140). The handler registers the event in the inbox of the messaging profile `run-control`, idempotent on the event id. The purpose the model gives the handler is to keep the step Pending while a quota denies its lease, with no attempt counted. The model keeps no record of a waiting step and names no key for it, and `holderId` of an attempt lease is not stated, so this PBI reads the hold per project and keeps it, like the other announced states the dispatcher reads, in `GateStates` (D114): for `holderKind` `attempt` the handler writes the row of the tenant with the subject kind `quota`, the project of the event as the subject, the state `exceeded` and the limit of the event in `Class`, a reading reported to the owner because the model describes `Class` as the class of an environment. While the row of a project is `exceeded`, the `RunDispatcher` creates no attempt and no lease for a Pending step of a Running run of that project and does not dispatch the first attempt of an Accepted child run of that project: the step stays Pending, no attempt is counted against `maxAttempts`, and no `AttemptDispatched` and no `RunStateChanged` are written. The attempt whose capacity lease was denied is neither settled nor counted again by the handler; it keeps the rules of its attempt and its lease in RunControlService (D113, D114). A denial of a `sandbox`, `build` or `browser` lease changes nothing here, because its holder waits on its own lease. A concurrency limit frees when a lease of the project is released and the model announces no quota change for it, so this PBI also lifts the hold when the outcome of an attempt of a run of the project is recorded: the `RunDispatcher`, which `AttemptOutcomeRecorded` already triggers, removes the row of that project before it evaluates, and a next attempt that the quota still denies writes a new `QuotaExceeded` and sets the hold again; this reading is reported to the owner. A quota change lifts the hold through `ResumeDispatchOnQuota` (AIFACTORY-US-1610). The row belongs to one tenant, so a denial for tenant B holds no project of tenant A, also under the same project id (ADR-0015). When `run-control-sql` does not answer, the inbox keeps the event and retries it, and the event is applied once. Kind: behavior. Traces: services: RunControlService, ExecutionCapacityService; aggregates: RunControlService/Run, RunControlService/Step, RunControlService/Attempt; events: ExecutionCapacityService/QuotaExceeded, RunControlService/AttemptDispatched, RunControlService/AttemptOutcomeRecorded; adrs: ADR-0012, ADR-0015; requirements: FUX-08, NFR-09. Depends on: AIFACTORY-US-1044, feature:run-control-service, feature:contracts-package. Sources: model/services/control-plane/RunControlService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a Running `RunControlService/Run` of tenant A in project P with a Pending `RunControlService/Step` and no open attempt, when `ExecutionCapacityService/QuotaExceeded` names tenant A, project P, the holder kind `attempt` and the limit `concurrentRuns` and `HoldDispatchOnQuota` handles it, then the hold of project P is kept with the limit, the `RunDispatcher` creates no `RunControlService/Attempt` and no lease for that step, the step stays Pending, no attempt is counted against `maxAttempts` and no `RunControlService/AttemptDispatched` is written; a redelivery under the same event id changes nothing (model/services/control-plane/RunControlService.yaml, FUX-08).",
        "AC2: Given project P is held, when `RunControlService/AttemptOutcomeRecorded` is written for an attempt of a run of project P, then the `RunDispatcher` removes the hold of project P and dispatches the Pending step with `RunControlService/AttemptDispatched`, and when the next attempt lease is denied again a new `ExecutionCapacityService/QuotaExceeded` sets the hold again.",
        "AC3: Given `ExecutionCapacityService/QuotaExceeded` with the holder kind `sandbox`, `build` or `browser`, an event of tenant B for a project id that tenant A also uses, or `run-control-sql` stopped while the event arrives, when `HoldDispatchOnQuota` handles it, then the first two hold no step of tenant A and change no dispatch of tenant A, and the last is retried by the inbox until the store answers and is applied once under its event id (ADR-0012, ADR-0015, NFR-09)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6509",
        "AIFACTORY-TASK-6510",
        "AIFACTORY-TASK-6511",
        "AIFACTORY-TASK-6512"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9808,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "ExecutionCapacityService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Step",
          "RunControlService/Attempt"
        ],
        "events": [
          "ExecutionCapacityService/QuotaExceeded",
          "RunControlService/AttemptDispatched",
          "RunControlService/AttemptOutcomeRecorded"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-08",
          "NFR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1044",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1609]",
      "number": 1609
    },
    {
      "id": "AIFACTORY-TASK-6509",
      "type": "task",
      "parent": "AIFACTORY-US-1609",
      "title": "HoldDispatchOnQuota of RunControlService for QuotaExceeded",
      "sequence": "09.02.08.01",
      "description": "HoldDispatchOnQuota of RunControlService for QuotaExceeded. Expected output: The inbox of the RunControlService messaging profile registers QuotaExceeded with idempotency on the event id; HoldDispatchOnQuota writes for the holder kind attempt the GateStates row of the tenant with the subject kind quota, the project of the event as the subject, the state exceeded and the limit in Class, upserted under the tenant row filter, and changes nothing for the holder kinds sandbox, build and browser.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox of the RunControlService messaging profile registers QuotaExceeded with idempotency on the event id; HoldDispatchOnQuota writes for the holder kind attempt the GateStates row of the tenant with the subject kind quota, the project of the event as the subject, the state exceeded and the limit in Class, upserted under the tenant row filter, and changes nothing for the holder kinds sandbox, build and browser."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9808,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6509]",
      "number": 6509
    },
    {
      "id": "AIFACTORY-TASK-6510",
      "type": "task",
      "parent": "AIFACTORY-US-1609",
      "title": "RunDispatcher honours and lifts the quota hold of a project",
      "sequence": "09.02.08.02",
      "description": "RunDispatcher honours and lifts the quota hold of a project. Expected output: The RunDispatcher reads the quota hold of the project of each run it evaluates and, while it is exceeded, creates no attempt and no lease for a Pending step of a Running run and no first attempt of an Accepted child run of that project, counts no attempt and writes no AttemptDispatched or RunStateChanged; when AttemptOutcomeRecorded of an attempt of a run of the project triggers it, it removes the hold row of that project before it evaluates.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The RunDispatcher reads the quota hold of the project of each run it evaluates and, while it is exceeded, creates no attempt and no lease for a Pending step of a Running run and no first attempt of an Accepted child run of that project, counts no attempt and writes no AttemptDispatched or RunStateChanged; when AttemptOutcomeRecorded of an attempt of a run of the project triggers it, it removes the hold row of that project before it evaluates."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9808,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6510]",
      "number": 6510
    },
    {
      "id": "AIFACTORY-TASK-6511",
      "type": "task",
      "parent": "AIFACTORY-US-1609",
      "title": "Fixture quota events and held projects of the quota dispatch suite",
      "sequence": "09.02.08.03",
      "description": "Fixture quota events and held projects of the quota dispatch suite. Expected output: The acceptance suite of RunControlService holds fixture events QuotaExceeded for the holder kinds attempt, sandbox, build and browser and QuotaChanged with and without a project, for two tenants that share a project id, built from the event types of the pinned contracts package under the run event envelope, Running runs with a Pending step and no open attempt, an Accepted child run whose first step is ready, and a switch that stops run-control-sql while an event arrives.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The acceptance suite of RunControlService holds fixture events QuotaExceeded for the holder kinds attempt, sandbox, build and browser and QuotaChanged with and without a project, for two tenants that share a project id, built from the event types of the pinned contracts package under the run event envelope, Running runs with a Pending step and no open attempt, an Accepted child run whose first step is ready, and a switch that stops run-control-sql while an event arrives."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9808,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6511]",
      "number": 6511
    },
    {
      "id": "AIFACTORY-TASK-6512",
      "type": "task",
      "parent": "AIFACTORY-US-1609",
      "title": "Verify hold-dispatch-while-a-quota-denies-attempts through the acceptance suite",
      "sequence": "09.02.08.04",
      "description": "Verify hold-dispatch-while-a-quota-denies-attempts through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=HoldDispatchOnQuota\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1609 with the fixture of AIFACTORY-TASK-6511: the Pending step with no attempt counted while the project is held, the hold lifted on a recorded outcome and set again by a new denial, the holder kinds and the tenant that change nothing, and the retry while the store is stopped with one application under the event id.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=HoldDispatchOnQuota\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1609 with the fixture of AIFACTORY-TASK-6511: the Pending step with no attempt counted while the project is held, the hold lifted on a recorded outcome and set again by a new denial, the holder kinds and the tenant that change nothing, and the retry while the store is stopped with one application under the event id."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9808,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6512]",
      "number": 6512
    },
    {
      "id": "AIFACTORY-US-1610",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-047",
      "title": "RunControlService dispatches the waiting steps of a held project again when a quota of its scope changes",
      "sequence": "09.02.09",
      "description": "As a workspace administrator, I want the steps that wait for capacity dispatched again as soon as I change a quota, so that a raised quota is used at once and my runs never wait on a limit that no longer applies. The inbox handler `ResumeDispatchOnQuota` of RunControlService takes `ExecutionCapacityService/QuotaChanged`, which carries `quotaId`, `tenantId`, the optional `projectId`, `concurrentRuns` and `concurrentSandboxes`. Like `HoldDispatchOnQuota` (AIFACTORY-US-1609), it is delivered with this feature and its tasks are written in the repository ConnectSoft.AI.SoftwareFactory.RunControlService (D140). The handler registers the event in the inbox of the messaging profile `run-control`, idempotent on the event id. The purpose the model gives the handler is to evaluate again the steps that wait for capacity after a quota change. When the event names a project, the handler removes the quota hold of that project from `GateStates`; when it names none, the quota is the one of the tenant and the handler removes the quota holds of every project of the tenant. It then asks the `RunDispatcher` to evaluate the Running runs with a Pending step and no open attempt and the Accepted child runs whose first step is ready in that scope, as `GateRunsByEnvironment` asks it for the runs of an environment that is active again (D117); the trigger list of the `RunDispatcher` in the model does not name `QuotaChanged`, and this call is reported as the reading. The dispatcher dispatches as capacity allows, with `AttemptDispatched` and a new lease for each attempt, and `RunStateChanged` when the first attempt moves an Accepted run to Running. RunControlService does not compare the limits of the event with any count: ExecutionCapacityService stays the judge at lease time (AIFACTORY-US-1044), so a limit that still denies the next attempt lease writes a new `QuotaExceeded` and sets the hold again. A change of a quota of another tenant lifts no hold of this tenant (ADR-0015), and a change for a scope without a hold dispatches nothing the dispatcher would not dispatch anyway. When `run-control-sql` does not answer, the inbox keeps the event and retries it, and the event is applied once. Kind: behavior. Traces: services: RunControlService, ExecutionCapacityService; aggregates: RunControlService/Run, RunControlService/Step; events: ExecutionCapacityService/QuotaChanged, RunControlService/AttemptDispatched, RunControlService/RunStateChanged; adrs: ADR-0012, ADR-0015; requirements: FUX-08. Depends on: AIFACTORY-US-1043, AIFACTORY-US-1609, feature:run-control-service, feature:contracts-package. Sources: model/services/control-plane/RunControlService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given project P of tenant A is held by a quota and a Running `RunControlService/Run` of project P has a Pending `RunControlService/Step` with no open attempt, when `ExecutionCapacityService/QuotaChanged` names tenant A and project P and `ResumeDispatchOnQuota` handles it, then the hold of project P is removed and the `RunDispatcher` dispatches the step with `RunControlService/AttemptDispatched` and a new lease; a redelivery under the same event id changes nothing (model/services/control-plane/RunControlService.yaml, FUX-08).",
        "AC2: Given projects P and Q of tenant A are held and an Accepted child `RunControlService/Run` of project Q has its first step ready, when `ExecutionCapacityService/QuotaChanged` names tenant A and no project, then both holds are removed, the steps of both projects are dispatched, and the first attempt of the child run moves it to Running with `RunControlService/RunStateChanged`.",
        "AC3: Given `ExecutionCapacityService/QuotaChanged` of tenant B for a project id that tenant A also holds, or `run-control-sql` stopped while the event arrives, when `ResumeDispatchOnQuota` handles it, then the first lifts no hold of tenant A and dispatches no step of tenant A, and the last is retried by the inbox until the store answers and is applied once under its event id (ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6513",
        "AIFACTORY-TASK-6515"
      ],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9809,
      "kind": "behavior",
      "traces": {
        "services": [
          "RunControlService",
          "ExecutionCapacityService"
        ],
        "aggregates": [
          "RunControlService/Run",
          "RunControlService/Step"
        ],
        "events": [
          "ExecutionCapacityService/QuotaChanged",
          "RunControlService/AttemptDispatched",
          "RunControlService/RunStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1043",
        "AIFACTORY-US-1609",
        "feature:run-control-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/control-plane/RunControlService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1610]",
      "number": 1610
    },
    {
      "id": "AIFACTORY-TASK-6513",
      "type": "task",
      "parent": "AIFACTORY-US-1610",
      "title": "ResumeDispatchOnQuota of RunControlService for QuotaChanged",
      "sequence": "09.02.09.01",
      "description": "ResumeDispatchOnQuota of RunControlService for QuotaChanged. Expected output: The inbox of the RunControlService messaging profile registers QuotaChanged with idempotency on the event id; ResumeDispatchOnQuota removes the quota hold of the project the event names, or of every project of the tenant when it names none, under the tenant row filter, and asks the RunDispatcher to evaluate the Running runs with a Pending step and no open attempt and the Accepted child runs whose first step is ready in that scope, without comparing the limits of the event with any count.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox of the RunControlService messaging profile registers QuotaChanged with idempotency on the event id; ResumeDispatchOnQuota removes the quota hold of the project the event names, or of every project of the tenant when it names none, under the tenant row filter, and asks the RunDispatcher to evaluate the Running runs with a Pending step and no open attempt and the Accepted child runs whose first step is ready in that scope, without comparing the limits of the event with any count."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9809,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6513]",
      "number": 6513
    },
    {
      "id": "AIFACTORY-TASK-6515",
      "type": "task",
      "parent": "AIFACTORY-US-1610",
      "title": "Verify resume-dispatch-on-a-quota-change through the acceptance suite",
      "sequence": "09.02.09.02",
      "description": "Verify resume-dispatch-on-a-quota-change through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ResumeDispatchOnQuota\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1610 with the fixture of AIFACTORY-TASK-6511: the step of the held project dispatched after a quota change of the project, both projects and the child run dispatched after a quota change of the tenant, the change of another tenant that lifts nothing, and the retry while the store is stopped with one application under the event id.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ResumeDispatchOnQuota\"` in the repository of RunControlService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1610 with the fixture of AIFACTORY-TASK-6511: the step of the held project dispatched after a quota change of the project, both projects and the child run dispatched after a quota change of the tenant, the change of another tenant that lifts nothing, and the retry while the store is stopped with one application under the event id."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 98,
      "phase": "factory",
      "stackRank": 9809,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6515]",
      "number": 6515
    },
    {
      "id": "AIFACTORY-FEAT-048",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-009",
      "title": "IaCProvisioningService: complete delivery",
      "sequence": "09.03",
      "description": "IaCProvisioningService is the service of bounded context BC-25 (Provisioning & Reconciliation). The single provisioning owner: deployment specifications (desired state declared in Git, versioned), provisioning runs with plan and apply receipts from the IaC runner (Pulumi, ADR-0004), production applies gated by the promotion's approval, and GitOps reconciliation that re-plans the declared state on a schedule (BC-25; manifest, deployment and GitOps sync rows merged). Its own repository is ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Delivers: IaCProvisioningService (complete). Increment I2: Deliver it. Build order 99 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-025",
        "AIFACTORY-US-1071",
        "AIFACTORY-US-1072",
        "AIFACTORY-US-1073",
        "AIFACTORY-US-1074",
        "AIFACTORY-US-1075",
        "AIFACTORY-US-1076"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9900,
      "titlePrefix": "[AIFACTORY-FEAT-048]",
      "number": 48
    },
    {
      "id": "AIFACTORY-US-025",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-048",
      "title": "IaCProvisioningService provisions an environment from its declared specification end to end",
      "sequence": "09.03.01",
      "description": "As an operator, I want an environment provisioned from the specification declared in Git, with a plan I can read before anything is applied, so that infrastructure changes are reviewed, receipted and repeatable, and nothing changes in a cloud account without the decision the policy requires. This is the integration PBI of IaCProvisioningService, the single provisioning owner of the bounded context Provisioning and Reconciliation (BC-25). The service keeps the desired state of each environment as versioned deployment specifications that refer to a Pulumi program and its commit in Git (ADR-0004), plans and applies provisioning runs through the IaC runner with a plan receipt and an apply receipt, gates every apply on the decision of PolicyEngineService or on the approval a promotion carries, and re-plans the declared state on a schedule. The repository ConnectSoft.AI.SoftwareFactory.IaCProvisioningService is created by the first task of this feature by the steps of the repository checklist of feature `repository-and-pipeline-conventions`: it is scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`, consumed by pin), so token validation, the role policies, the scope chain with its 401, 403 and 404 answers, the tenant row filter, the Orleans messaging profile with the service name `iac-provisioning`, the scheduler, health, readiness and the telemetry wiring come from the profile and are not written again. Every integration event of the service is written as the run event envelope of the pinned contracts package to the Orleans outbox in the transaction of its command (ADR-0014). The public REST operations are reached through RuntimeCloudHost, which forwards the user token unchanged; the service accepts the audience of its own gateway and exchanges no token (ADR-0015 amendment D117). A resource of another tenant is answered 404, over gRPC NOT_FOUND, the same answer as for an unknown identifier, and a missing scope or project role inside the tenant of the caller 403 (ADR-0015 amendment D113). No REST route of the service names a project in its path, a query parameter or a body member: a list returns the rows of the projects in which the token holds a role, every project of the tenant for a Platform admin, and a run or a specification addressed by identifier is checked against the role of the caller in its project. The feature is delivered by six further PBIs: declared specifications and their reads (AIFACTORY-US-1071), reading provisioning runs (AIFACTORY-US-1072), planning a run and its gate (AIFACTORY-US-1073), applying with receipts (AIFACTORY-US-1074), cancelling a planned run (AIFACTORY-US-1075) and the hand-offs with the GitOps reconciliation (AIFACTORY-US-1076). Credentials of a cloud account are reached only by reference through SecretBrokerService; a secret value never reaches telemetry, an event, an artifact, a log record, a receipt or a reply. The inbox registers the four consumed events of the model, `EnvironmentCreated`, `ApprovalDecided`, `PromotionApproved` and `ReconciliationDecided`; the feature builds and registers no handler of a deletion order, which is built in I4 with RetentionResidencyService. Telemetry carries tenant and project on metrics by default and run, step and attempt on activities and log records where the work has them, and no stored or generated content, a plan or its outputs included, reaches telemetry by default (ADR-0019). Kind: behavior. Traces: services: IaCProvisioningService, RuntimeCloudHost, SecretBrokerService, ArtifactService, PolicyEngineService, RunControlService; aggregates: IaCProvisioningService/DeploymentSpecification, IaCProvisioningService/ProvisioningRun; apis: IaCProvisioningService/ListSpecifications, IaCProvisioningService/ListProvisioningRuns, IaCProvisioningService/GetProvisioningRun, IaCProvisioningService/PlanProvisioning, IaCProvisioningService/CancelProvisioning, IaCProvisioningService/Provisioning.GetCurrentSpecification; events: IaCProvisioningService/SpecificationDeclared, IaCProvisioningService/ProvisioningPlanned, IaCProvisioningService/ProvisioningApplied, IaCProvisioningService/ProvisioningFailed; descriptors: run-event-envelope-v1; adrs: ADR-0004, ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: FR-08, NFR-08, NFR-09, XL-04, XL-10. Relates: screens: provisioning. Depends on: AIFACTORY-US-1071, AIFACTORY-US-1072, AIFACTORY-US-1073, AIFACTORY-US-1074, AIFACTORY-US-1075, AIFACTORY-US-1076, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-extensions-ai, feature:component-observability-factory-conventions, feature:contracts-package. Sources: model/services/runtime-cloud/IaCProvisioningService.yaml, docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#purpose-and-responsibilities, docs/architecture/adr/0004-pulumi-over-bicep-iac.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.IaCProvisioningService created by the steps of the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IaCProvisioningService --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 with complete reports and a container image is published (ADR-0028, model/services/runtime-cloud/IaCProvisioningService.yaml).",
        "AC2: Given the service descriptor of the repository, when the contract test compares it with the hosted surface, then `IaCProvisioningService/ListSpecifications`, `IaCProvisioningService/ListProvisioningRuns`, `IaCProvisioningService/GetProvisioningRun`, `IaCProvisioningService/PlanProvisioning`, `IaCProvisioningService/CancelProvisioning` and `IaCProvisioningService/Provisioning.GetCurrentSpecification` are hosted with the scope, side-effect class, idempotency and response codes of model/services/runtime-cloud/IaCProvisioningService.yaml, and the test fails on an operation the file does not name.",
        "AC3: Given specifications and runs of two tenants and a caller of one, when an operation addresses a run or a specification of the other tenant, then the answer is 404, over gRPC NOT_FOUND, exactly as for an unknown identifier; given a caller without the scope of the operation or without a role in the project of the resource, then the answer is 403; given no token, then 401; in no case a state changes; a user token that RuntimeCloudHost forwards unchanged, whose audience is that gateway, is accepted without a token exchange (ADR-0015).",
        "AC4: Given the outbox and the inbox of the service after the acceptance suite, when their records are read, then `IaCProvisioningService/SpecificationDeclared`, `IaCProvisioningService/ProvisioningPlanned`, `IaCProvisioningService/ProvisioningApplied` and `IaCProvisioningService/ProvisioningFailed` and the audit evidence event `AuditEvidenceSubmitted` are the only event types the outbox holds, each written in the transaction of its command under the run event envelope, and the inbox registers the four consumed events and no handler of a deletion order (ADR-0014).",
        "AC5: Given the service starts, when liveness and readiness are probed and the acceptance suite has run, then readiness is unready until `iac-provisioning-sql` is migrated and while the outbox check of the messaging profile is unhealthy, the four metrics of the model are emitted with tenant and project from the instrument helper, and a scan of the captured log records, activities, metrics, events, receipts and stored artifacts finds no secret value and no plan or output content in telemetry (ADR-0019, model/services/runtime-cloud/IaCProvisioningService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0004-pulumi-over-bicep-iac.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-288",
        "AIFACTORY-TASK-289",
        "AIFACTORY-TASK-290",
        "AIFACTORY-TASK-291",
        "AIFACTORY-TASK-292",
        "AIFACTORY-TASK-293",
        "AIFACTORY-TASK-294",
        "AIFACTORY-TASK-783"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "behavior",
      "traces": {
        "services": [
          "IaCProvisioningService",
          "RuntimeCloudHost",
          "SecretBrokerService",
          "ArtifactService",
          "PolicyEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "IaCProvisioningService/DeploymentSpecification",
          "IaCProvisioningService/ProvisioningRun"
        ],
        "apis": [
          "IaCProvisioningService/ListSpecifications",
          "IaCProvisioningService/ListProvisioningRuns",
          "IaCProvisioningService/GetProvisioningRun",
          "IaCProvisioningService/PlanProvisioning",
          "IaCProvisioningService/CancelProvisioning",
          "IaCProvisioningService/Provisioning.GetCurrentSpecification"
        ],
        "events": [
          "IaCProvisioningService/SpecificationDeclared",
          "IaCProvisioningService/ProvisioningPlanned",
          "IaCProvisioningService/ProvisioningApplied",
          "IaCProvisioningService/ProvisioningFailed"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "NFR-08",
          "NFR-09",
          "XL-04",
          "XL-10"
        ]
      },
      "relates": {
        "screens": [
          "provisioning"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1071",
        "AIFACTORY-US-1072",
        "AIFACTORY-US-1073",
        "AIFACTORY-US-1074",
        "AIFACTORY-US-1075",
        "AIFACTORY-US-1076",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-extensions-ai",
        "feature:component-observability-factory-conventions",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0004-pulumi-over-bicep-iac.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-025]",
      "number": 25
    },
    {
      "id": "AIFACTORY-TASK-288",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.IaCProvisioningService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "09.03.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.IaCProvisioningService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IaCProvisioningService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `iac-provisioning`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the work of this feature is added.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IaCProvisioningService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IaCProvisioningService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `iac-provisioning`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the work of this feature is added."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-288]",
      "number": 288
    },
    {
      "id": "AIFACTORY-TASK-289",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "Domain model: DeploymentSpecification and ProvisioningRun with the seven transitions of ProvisioningState",
      "sequence": "09.03.01.02",
      "description": "Domain model: DeploymentSpecification and ProvisioningRun with the seven transitions of ProvisioningState. Expected output: The DeploymentSpecification aggregate holds the fields of the model with its configuration and secret references as references only, keeps every declared version and never edits a program; the ProvisioningRun aggregate holds the transitions Planned to AwaitingApproval, Planned to Applying, AwaitingApproval to Applying, AwaitingApproval to Rejected, Applying to Applied, Applying to Failed and Planned to Cancelled, and the move from Planned to Failed that the failure mode of a missing program version names (AIFACTORY-US-1073); receipts are immutable once written and a re-run is a new run; unit tests cover every transition, every rejected pair of states and every invariant of model/services/runtime-cloud/IaCProvisioningService.yaml.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The DeploymentSpecification aggregate holds the fields of the model with its configuration and secret references as references only, keeps every declared version and never edits a program; the ProvisioningRun aggregate holds the transitions Planned to AwaitingApproval, Planned to Applying, AwaitingApproval to Applying, AwaitingApproval to Rejected, Applying to Applied, Applying to Failed and Planned to Cancelled, and the move from Planned to Failed that the failure mode of a missing program version names (AIFACTORY-US-1073); receipts are immutable once written and a re-run is a new run; unit tests cover every transition, every rejected pair of states and every invariant of model/services/runtime-cloud/IaCProvisioningService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-289]",
      "number": 289
    },
    {
      "id": "AIFACTORY-TASK-290",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "Persistence in iac-provisioning-sql: DeploymentSpecifications and ProvisioningRuns with the tenant filter and the modelled indexes",
      "sequence": "09.03.01.03",
      "description": "Persistence in iac-provisioning-sql: DeploymentSpecifications and ProvisioningRuns with the tenant filter and the modelled indexes. Expected output: Mappings and migrations for the two modelled tables with the tenant column and row filter, the key of specification and version, the indexes IX_Specs_Env_Kind, IX_ProvRuns_Env_State and IX_ProvRuns_Promotion and a row version as optimistic concurrency token on a run; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the two modelled tables with the tenant column and row filter, the key of specification and version, the indexes IX_Specs_Env_Kind, IX_ProvRuns_Env_State and IX_ProvRuns_Promotion and a row version as optimistic concurrency token on a run; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-290]",
      "number": 290
    },
    {
      "id": "AIFACTORY-TASK-291",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 5 REST and 1 gRPC operations",
      "sequence": "09.03.01.04",
      "description": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 5 REST and 1 gRPC operations. Expected output: The service descriptor file lists ListSpecifications, ListProvisioningRuns, GetProvisioningRun, PlanProvisioning, CancelProvisioning and Provisioning.GetCurrentSpecification with scope, side-effect class, idempotency and response codes; the five REST routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code, the Idempotency-Key filter of PlanProvisioning and the workload scope check of the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-1071 to AIFACTORY-US-1075, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists ListSpecifications, ListProvisioningRuns, GetProvisioningRun, PlanProvisioning, CancelProvisioning and Provisioning.GetCurrentSpecification with scope, side-effect class, idempotency and response codes; the five REST routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code, the Idempotency-Key filter of PlanProvisioning and the workload scope check of the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-1071 to AIFACTORY-US-1075, not here."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-291]",
      "number": 291
    },
    {
      "id": "AIFACTORY-TASK-292",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "Messaging skeleton: outbox and inbox wiring of the iac-provisioning profile for 4 published and 4 consumed events",
      "sequence": "09.03.01.05",
      "description": "Messaging skeleton: outbox and inbox wiring of the iac-provisioning profile for 4 published and 4 consumed events. Expected output: The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the iac-provisioning messaging profile publishes SpecificationDeclared, ProvisioningPlanned, ProvisioningApplied, ProvisioningFailed and the audit evidence event AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted under the run event envelope of the pinned contracts package; the inbox registers EnvironmentCreated, ApprovalDecided, PromotionApproved and ReconciliationDecided with idempotency on the event id and no handler of a deletion order; what each handler does is delivered by AIFACTORY-US-1073 and AIFACTORY-US-1076.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the iac-provisioning messaging profile publishes SpecificationDeclared, ProvisioningPlanned, ProvisioningApplied, ProvisioningFailed and the audit evidence event AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted under the run event envelope of the pinned contracts package; the inbox registers EnvironmentCreated, ApprovalDecided, PromotionApproved and ReconciliationDecided with idempotency on the event id and no handler of a deletion order; what each handler does is delivered by AIFACTORY-US-1073 and AIFACTORY-US-1076."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-292]",
      "number": 292
    },
    {
      "id": "AIFACTORY-TASK-293",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "Worker hosting skeleton: triggers, partitioning and retry policies of Planner, Applier and GitOpsReconciler",
      "sequence": "09.03.01.06",
      "description": "Worker hosting skeleton: triggers, partitioning and retry policies of Planner, Applier and GitOpsReconciler. Expected output: The three workers are hosted with their modelled triggers, idempotency keys and partitioning: the Planner with exponential retry, the Applier with no retry and one attempt, and the GitOpsReconciler on its schedule with fixed retry; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1073, AIFACTORY-US-1074 and AIFACTORY-US-1076.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three workers are hosted with their modelled triggers, idempotency keys and partitioning: the Planner with exponential retry, the Applier with no retry and one attempt, and the GitOpsReconciler on its schedule with fixed retry; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1073, AIFACTORY-US-1074 and AIFACTORY-US-1076."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-293]",
      "number": 293
    },
    {
      "id": "AIFACTORY-TASK-294",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "Security, tenancy and telemetry of IaCProvisioningService",
      "sequence": "09.03.01.07",
      "description": "Security, tenancy and telemetry of IaCProvisioningService. Expected output: The scopes factory.provisioning.read and factory.provisioning.apply and the roles Operator, Platform admin and Observer are enforced per route; a user token forwarded by RuntimeCloudHost is accepted with the audience of that gateway; every query is tenant-filtered so a resource of another tenant is answered 404; the iac-runner-identity and messaging-transport secrets come from secret references of the key vault and never appear in configuration files; connectsoft.factory.provisioning.runs, apply_duration, reconciliation_diffs and inbox_lag are created through the instrument helper of the observability library with tenant and project; a redaction test fails when a log record, an activity or a metric holds a secret value, a plan or an output.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The scopes factory.provisioning.read and factory.provisioning.apply and the roles Operator, Platform admin and Observer are enforced per route; a user token forwarded by RuntimeCloudHost is accepted with the audience of that gateway; every query is tenant-filtered so a resource of another tenant is answered 404; the iac-runner-identity and messaging-transport secrets come from secret references of the key vault and never appear in configuration files; connectsoft.factory.provisioning.runs, apply_duration, reconciliation_diffs and inbox_lag are created through the instrument helper of the observability library with tenant and project; a redaction test fails when a log record, an activity or a metric holds a secret value, a plan or an output."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-294]",
      "number": 294
    },
    {
      "id": "AIFACTORY-TASK-783",
      "type": "task",
      "parent": "AIFACTORY-US-025",
      "title": "Verify provision-from-specification by running the declared command",
      "sequence": "09.03.01.08",
      "description": "Verify provision-from-specification by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-025, that is the scaffold, the hosted surface against the service descriptor, the two-tenant matrix with its 404, 403 and 401 answers, the event types of the outbox and the inbox, readiness and the redaction scan.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-025, that is the scaffold, the hosted surface against the service descriptor, the two-tenant matrix with its 404, 403 and 401 answers, the event types of the outbox and the inbox, readiness and the redaction scan."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-783]",
      "number": 783
    },
    {
      "id": "AIFACTORY-US-1071",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-048",
      "title": "A deployment specification is declared once per program commit and read by people and by the services that compare against it",
      "sequence": "09.03.02",
      "description": "As an operator, I want every desired state of an environment kept as a version that names the program commit it came from, so that I can see what is declared for an environment and every service compares against the same applied version. A `DeploymentSpecification` keeps the desired state of one environment or workload: the reference to the Pulumi program (`programRef`, the repository and path of the InfrastructureModel project) and its commit (`programVersion`), the release it deploys, the strategy, the configuration references of the Config Platform and the secret references of SecretBrokerService, never a value. A new version is declared when a hand-off of AIFACTORY-US-1076 names a program commit the specification of that environment and kind does not hold yet: the version is incremented, `declaredAt` is set, and `SpecificationDeclared` is written to the outbox in the same transaction with `specificationId`, `tenantId`, `environmentId`, `kind`, `version` and `programVersion` under the run event envelope; the same commit named again declares nothing and publishes nothing. Every version is kept, and the service records which version was acted on and never edits the program. An Operator, a Platform admin or an Observer whose scope carries `factory.provisioning.read` lists the specifications per environment with their versions and program references through `ListSpecifications`, filtered to the tenant of the token and the projects in which the token holds a role, every project of the tenant for a Platform admin; secret and configuration references are listed as references. A caller without the scope is refused with 403 and nothing changes. A workload calls the internal `Provisioning.GetCurrentSpecification` with `execution-scope-v1` naming the tenant, the project and the environment and receives the specification versions last applied to that environment, one per specification kind the environment holds, each the version of the last run of that kind of specification that reached Applied, with its kind, program reference, program commit and release; an environment can hold specifications of the kinds EnvironmentBaseline, Workload, Network, Data and Observability, but in this feature only EnvironmentBaseline and Workload are declared, by the hand-offs of AIFACTORY-US-1076, and the model gives no declaration path for the kinds Network, Data and Observability and no creation path for a run of kind Rollback, which are reported as gaps; EnvironmentPromotionService and RuntimeEnvironmentService read it in this increment and FleetInventoryService in its own increment. The token must be a workload token holding the service scope the method names; the tenant and the project the workload forwards are read only under that scope (ADR-0015 amendment D114). A call without workload identity is answered UNAUTHENTICATED, a token without the scope PERMISSION_DENIED, a request that fails validation INVALID_ARGUMENT, and an environment of another tenant NOT_FOUND, the same answer as for an unknown environment (ADR-0015 amendment D113); an environment with a declared and no applied version is answered with a reply that names no applied version. The method is a read: it writes nothing and publishes nothing. The model names `ack-v1` as its reply, a descriptor that has no member for a specification version; the proto carries the reply in the shape of that schema and adds the members of the applied version beside it, and a contract test states the difference, which is reported as a correction of the descriptor row of the model. Kind: behavior. Traces: services: IaCProvisioningService; aggregates: IaCProvisioningService/DeploymentSpecification; apis: IaCProvisioningService/ListSpecifications, IaCProvisioningService/Provisioning.GetCurrentSpecification; events: IaCProvisioningService/SpecificationDeclared; descriptors: execution-scope-v1, ack-v1, run-event-envelope-v1; adrs: ADR-0004, ADR-0012, ADR-0014, ADR-0015; requirements: FR-08, XL-04; scenarios: SCN-IaCProvisioningService-001, SCN-IaCProvisioningService-006, SCN-IaCProvisioningService-007. Relates: screens: provisioning. Depends on: feature:contracts-package, feature:component-base-template-factory-profile. Sources: model/services/runtime-cloud/IaCProvisioningService.yaml, docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#domain-model, docs/reference/schemas/run-event-envelope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given specifications of two projects of one tenant and of a second tenant, and a caller with `factory.provisioning.read` and a role in one project, when `IaCProvisioningService/ListSpecifications` is called, then the response is 200 with the specifications of that project per environment with every version, its program reference and commit, and secret and configuration references as references only; a Platform admin receives every project of the tenant and no row of the other tenant appears (SCN-IaCProvisioningService-001, ADR-0015).",
        "AC2: Given a caller without `factory.provisioning.read`, when `IaCProvisioningService/ListSpecifications` is called, then the response is 403 with a problem response and no state changes (SCN-IaCProvisioningService-001).",
        "AC3: Given a hand-off that names a program commit the `IaCProvisioningService/DeploymentSpecification` of the environment and kind does not hold, when it is handled, then a new version is written with `declaredAt` and the `IaCProvisioningService/SpecificationDeclared` outbox record in the same transaction; given the same commit named again, then no version and no record is written (SCN-IaCProvisioningService-007, ADR-0014).",
        "AC4: Given a declared version, when the dispatcher of the `iac-provisioning` messaging profile publishes `IaCProvisioningService/SpecificationDeclared` on `provisioning.specifications.v1.specification-declared`, then the event is sent under the run event envelope with `specificationId`, `tenantId`, `environmentId`, `kind`, `version` and `programVersion`, no secret value is in it, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-IaCProvisioningService-007, ADR-0012).",
        "AC5: Given a workload token with the service scope of the method and an environment with an applied EnvironmentBaseline version and an applied and a newer declared Workload version, when `IaCProvisioningService/Provisioning.GetCurrentSpecification` is called, then the reply names the last applied version per specification kind, each with its kind, program reference, commit and release, never a declared version that was not applied, and nothing is written; given no workload identity, a token without the scope, an invalid request or an environment of another tenant, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND and no state changes (SCN-IaCProvisioningService-006, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#domain-model",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-327",
        "AIFACTORY-TASK-4311",
        "AIFACTORY-TASK-4312",
        "AIFACTORY-TASK-4313"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9902,
      "kind": "behavior",
      "traces": {
        "services": [
          "IaCProvisioningService"
        ],
        "aggregates": [
          "IaCProvisioningService/DeploymentSpecification"
        ],
        "apis": [
          "IaCProvisioningService/ListSpecifications",
          "IaCProvisioningService/Provisioning.GetCurrentSpecification"
        ],
        "events": [
          "IaCProvisioningService/SpecificationDeclared"
        ],
        "descriptors": [
          "execution-scope-v1",
          "ack-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08",
          "XL-04"
        ],
        "scenarios": [
          "SCN-IaCProvisioningService-001",
          "SCN-IaCProvisioningService-006",
          "SCN-IaCProvisioningService-007"
        ]
      },
      "relates": {
        "screens": [
          "provisioning"
        ]
      },
      "dependsOn": [
        "feature:contracts-package",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#domain-model",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1071]",
      "number": 1071
    },
    {
      "id": "AIFACTORY-TASK-327",
      "type": "task",
      "parent": "AIFACTORY-US-1071",
      "title": "Specifications declared once per program commit with the SpecificationDeclared outbox record",
      "sequence": "09.03.02.01",
      "description": "Specifications declared once per program commit with the SpecificationDeclared outbox record. Expected output: A specification version is recorded for a program commit of an environment and kind with declaredAt and the SpecificationDeclared outbox record in one transaction; the same commit is recorded once; configuration and secret references are stored as references and a value offered in their place is refused by the aggregate; every version is kept.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "A specification version is recorded for a program commit of an environment and kind with declaredAt and the SpecificationDeclared outbox record in one transaction; the same commit is recorded once; configuration and secret references are stored as references and a value offered in their place is refused by the aggregate; every version is kept."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-327]",
      "number": 327
    },
    {
      "id": "AIFACTORY-TASK-4311",
      "type": "task",
      "parent": "AIFACTORY-US-1071",
      "title": "ListSpecifications read model and the GetCurrentSpecification method with its proto reply",
      "sequence": "09.03.02.02",
      "description": "ListSpecifications read model and the GetCurrentSpecification method with its proto reply. Expected output: ListSpecifications returns the specifications per environment with versions, program references and references only, filtered by the tenant row filter and the projects in which the token holds a role, every project for a Platform admin; Provisioning.GetCurrentSpecification admits a workload token with its service scope only, reads the forwarded tenant, project and environment under it and returns the last applied version per specification kind of the environment, or a reply that names no applied version, with NOT_FOUND for an environment of another tenant; the proto adds the members of the applied version beside the shape of ack-v1, and a contract test states the difference reported as a correction of the model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "ListSpecifications returns the specifications per environment with versions, program references and references only, filtered by the tenant row filter and the projects in which the token holds a role, every project for a Platform admin; Provisioning.GetCurrentSpecification admits a workload token with its service scope only, reads the forwarded tenant, project and environment under it and returns the last applied version per specification kind of the environment, or a reply that names no applied version, with NOT_FOUND for an environment of another tenant; the proto adds the members of the applied version beside the shape of ack-v1, and a contract test states the difference reported as a correction of the model."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4311]",
      "number": 4311
    },
    {
      "id": "AIFACTORY-TASK-4312",
      "type": "task",
      "parent": "AIFACTORY-US-1071",
      "title": "Contract of SpecificationDeclared against the run event envelope of the contracts package",
      "sequence": "09.03.02.03",
      "description": "Contract of SpecificationDeclared against the run event envelope of the contracts package. Expected output: A golden file fixes SpecificationDeclared on the topic provisioning.specifications.v1.specification-declared under run-event-envelope-v1 with specificationId, tenantId, environmentId, kind, version and programVersion and the tenant and project in the envelope; a contract test fails when the serialised event differs from the file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "A golden file fixes SpecificationDeclared on the topic provisioning.specifications.v1.specification-declared under run-event-envelope-v1 with specificationId, tenantId, environmentId, kind, version and programVersion and the tenant and project in the envelope; a contract test fails when the serialised event differs from the file or from docs/reference/schemas/run-event-envelope.schema.json, and the envelope type comes from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9902,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4312]",
      "number": 4312
    },
    {
      "id": "AIFACTORY-TASK-4313",
      "type": "task",
      "parent": "AIFACTORY-US-1071",
      "title": "Verify declared-provisioning-specifications through the acceptance suite",
      "sequence": "09.03.02.04",
      "description": "Verify declared-provisioning-specifications through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-001|Scenario=SCN-IaCProvisioningService-006|Scenario=SCN-IaCProvisioningService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1071, including the one declaration per commit, the publication and payload of SpecificationDeclared and the four gRPC refusals; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-001|Scenario=SCN-IaCProvisioningService-006|Scenario=SCN-IaCProvisioningService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1071, including the one declaration per commit, the publication and payload of SpecificationDeclared and the four gRPC refusals; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4313]",
      "number": 4313
    },
    {
      "id": "AIFACTORY-US-1072",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-048",
      "title": "Read provisioning runs with their plan, approval and apply receipts under the tenant and the projects of the caller",
      "sequence": "09.03.03",
      "description": "As an operator, I want to list the provisioning runs of my environments and open one with its plan, its approval and its apply receipt, so that I see what was planned, who approved it and what was changed before I act on an environment. An Operator, a Platform admin or an Observer whose scope carries `factory.provisioning.read` lists provisioning runs through `ListProvisioningRuns`, filtered by environment, kind and state and paged, and receives each run with its kind, state, specification version, the promotion that requested it, and the summaries of its plan receipt and apply receipt. The list holds the runs of the tenant of the token in the projects in which the token holds a role, every project of the tenant for a Platform admin; a run of another tenant never appears. The same caller reads one run through `GetProvisioningRun` and receives its plan receipt (adds, changes, deletes, the hash of the inputs and the program version), the approval reference when the run waited for one, the apply receipt (outputs, duration, result and runner version) and the reference of its logs and state artifacts in ArtifactService, which a person opens through the artifact routes of its own platform under the scope of those routes. A run of another tenant is answered 404, the same answer as for an unknown `provisioningRunId`, and never confirmed (ADR-0015 amendment D113); a caller without the scope, or without a role in the project of the run, is refused with 403. No receipt holds a secret value: outputs the program marks as secret are absent from the stored apply receipt and are therefore absent from every reply. Both reads write nothing and publish nothing. These are the read models of the Provisioning screen of the Studio, which StudioBff reads in its own increment. Kind: behavior. Traces: services: IaCProvisioningService; aggregates: IaCProvisioningService/ProvisioningRun; apis: IaCProvisioningService/ListProvisioningRuns, IaCProvisioningService/GetProvisioningRun; adrs: ADR-0015, ADR-0019; requirements: FR-08, XL-10; scenarios: SCN-IaCProvisioningService-002, SCN-IaCProvisioningService-003. Relates: screens: provisioning. Depends on: AIFACTORY-US-1071, feature:component-base-template-factory-profile. Sources: model/services/runtime-cloud/IaCProvisioningService.yaml, docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given runs of several environments, kinds and states in two projects and two tenants, and a caller with `factory.provisioning.read` and a role in one project, when `IaCProvisioningService/ListProvisioningRuns` is called with a filter of environment, kind and state and a page cursor, then the response is 200 with only the matching runs of that project, each with state, kind, specification version and receipt summaries, and no run of the other project or tenant appears (SCN-IaCProvisioningService-002, ADR-0015).",
        "AC2: Given a caller without `factory.provisioning.read`, when `IaCProvisioningService/ListProvisioningRuns` or `IaCProvisioningService/GetProvisioningRun` is called, then the response is 403 with a problem response and no state changes (SCN-IaCProvisioningService-002, SCN-IaCProvisioningService-003).",
        "AC3: Given an applied run whose program marked one output as secret, when `IaCProvisioningService/GetProvisioningRun` is called by a caller with the scope and a role in its project, then the response is 200 with the plan receipt, the approval reference, the apply receipt and the logs reference of the `IaCProvisioningService/ProvisioningRun`, and the secret output is absent from the reply (SCN-IaCProvisioningService-003, ADR-0019).",
        "AC4: Given a `provisioningRunId` of another tenant, an unknown one, and a run of a project in which the caller holds no role, when `IaCProvisioningService/GetProvisioningRun` is called, then the first two are answered 404 alike and the third 403, each with a problem response and no state change (SCN-IaCProvisioningService-003, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4314",
        "AIFACTORY-TASK-4315",
        "AIFACTORY-TASK-4316"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9903,
      "kind": "behavior",
      "traces": {
        "services": [
          "IaCProvisioningService"
        ],
        "aggregates": [
          "IaCProvisioningService/ProvisioningRun"
        ],
        "apis": [
          "IaCProvisioningService/ListProvisioningRuns",
          "IaCProvisioningService/GetProvisioningRun"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-08",
          "XL-10"
        ],
        "scenarios": [
          "SCN-IaCProvisioningService-002",
          "SCN-IaCProvisioningService-003"
        ]
      },
      "relates": {
        "screens": [
          "provisioning"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1071",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1072]",
      "number": 1072
    },
    {
      "id": "AIFACTORY-TASK-4314",
      "type": "task",
      "parent": "AIFACTORY-US-1072",
      "title": "ListProvisioningRuns and GetProvisioningRun read models with filters, paging and the project rule",
      "sequence": "09.03.03.01",
      "description": "ListProvisioningRuns and GetProvisioningRun read models with filters, paging and the project rule. Expected output: ListProvisioningRuns returns the runs paged and filtered by environment, kind and state with receipt summaries, and GetProvisioningRun one run with its plan receipt, approval reference, apply receipt and logs reference; both apply the tenant row filter and the project roles of the token, answer 404 for a run of another tenant as for an unknown id and 403 for a missing scope or project role, and never return a secret output.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "ListProvisioningRuns returns the runs paged and filtered by environment, kind and state with receipt summaries, and GetProvisioningRun one run with its plan receipt, approval reference, apply receipt and logs reference; both apply the tenant row filter and the project roles of the token, answer 404 for a run of another tenant as for an unknown id and 403 for a missing scope or project role, and never return a secret output."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4314]",
      "number": 4314
    },
    {
      "id": "AIFACTORY-TASK-4315",
      "type": "task",
      "parent": "AIFACTORY-US-1072",
      "title": "Contract of the run list and the run view in the OpenAPI document of the service",
      "sequence": "09.03.03.02",
      "description": "Contract of the run list and the run view in the OpenAPI document of the service. Expected output: The OpenAPI document of the service describes the paged run list with its filters and the run view with plan receipt, approval reference, apply receipt and logs reference as model/services/runtime-cloud/IaCProvisioningService.yaml names them, and a contract test fails when the hosted responses differ from the document.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service describes the paged run list with its filters and the run view with plan receipt, approval reference, apply receipt and logs reference as model/services/runtime-cloud/IaCProvisioningService.yaml names them, and a contract test fails when the hosted responses differ from the document."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9903,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4315]",
      "number": 4315
    },
    {
      "id": "AIFACTORY-TASK-4316",
      "type": "task",
      "parent": "AIFACTORY-US-1072",
      "title": "Verify read-provisioning-runs through the acceptance suite",
      "sequence": "09.03.03.03",
      "description": "Verify read-provisioning-runs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-002|Scenario=SCN-IaCProvisioningService-003)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1072, including the absent secret output, the 404 alike for a foreign and an unknown run and the 403 for a project without a role.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-002|Scenario=SCN-IaCProvisioningService-003)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1072, including the absent secret output, the 404 alike for a foreign and an unknown run and the 403 for a project without a role."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4316]",
      "number": 4316
    },
    {
      "id": "AIFACTORY-US-1073",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-048",
      "title": "Plan a provisioning run, record its plan receipt and route the apply by the policy decision or the approval it requires",
      "sequence": "09.03.04",
      "description": "As an operator, I want to plan a specification version against an environment and read the plan before anything changes, so that an apply happens only when the policy allows it or the approval it requires was granted for exactly that plan. An Operator or a Platform admin whose scope carries `factory.provisioning.apply` plans a specification version against an environment through `PlanProvisioning` with an `Idempotency-Key`. The body names the specification, its version, the environment and the kind of the run; the operation admits the three kinds its summary names, EnvironmentBaseline, Reconciliation and Decommission, while a run of kind Promotion is created only by the hand-off of a promotion (AIFACTORY-US-1076). A body that fails validation, a version the specification does not hold or a kind the operation does not admit is refused with 422; the same key with a different body is refused with 409; a caller without the scope or without the Operator or Platform admin role in the project of the specification is refused with 403; a specification of another tenant is answered 404, the same answer as for an unknown one (ADR-0015 amendment D113), a code the code list of the operation does not name, which is reported as a correction of the model. An accepted call writes the `ProvisioningRun` in state Planned and returns 202 with its location; the same key with the same body returns the same run and changes nothing. The Planner resolves the program version, the configuration references and the secret references by reference, runs the IaC planner and records the plan receipt (adds, changes, deletes, the hash of the inputs and the program version), stores the plan log through `Artifacts.Store`, and writes `ProvisioningPlanned` with `provisioningRunId`, `tenantId`, `environmentId`, `kind`, the optional `promotionId` and `planSummary` in the same transaction; no resource changes before the plan is recorded. A plan without adds, changes or deletes is an empty plan, and one rule holds for it in this feature: the Planner records its receipt and writes `ProvisioningPlanned` with an empty `planSummary`, and in the same transaction the run moves Planned to Cancelled with the reason `no-changes`, so an empty plan never reaches the gate or the runner and nothing is applied; the model gives no trigger for that end, and the use of the transition Cancel is reported as a correction (AIFACTORY-US-1074 and AIFACTORY-US-1076 follow this rule). The gate follows. A run of kind Promotion that carries the approval of a promotion moves Planned to Applying (ApprovedOrAllowed), because the promotion approval is reused for the production apply. Every other run, a Promotion run without an approval included, asks PolicyEngineService through `Policy.Decide`; the service never decides an approval itself. The request is a `policy-decision-request-v1` with the action kind `provisioning-apply`, which pairs with the domain `Deployment` so that the service names no domain, the target `provisioning-apply`, the side-effect class of the plan before any raising (D127, D129), the environment of the run, the run as the resource, the hash of the plan receipt as the inputs hash, the `runId` of the envelope where the run has one, and as subject the workload identity of the service with the tenant and the project of the run; the engine raises the class by the class of the environment it reads through `Environments.GetPolicyClass`, so the service sends the class of its plan and never a class of the environment. An allow moves the run Planned to Applying (ApprovedOrAllowed). An allow-with-constraints moves it Planned to Applying only when the service can honour every listed constraint: the repository keeps a table of the constraint names it honours, each mapped to a check of the plan receipt or a setting of the apply, and the constraints are recorded on the run; a constraint outside the table applies nothing and ends the run Failed with the constraint named, writing `AuditEvidenceSubmitted` with the action `policy-constraint-unmet` and `ProvisioningFailed` in the same transaction (D129). On an allow and on an honoured allow-with-constraints the `decisionId` of the decision is recorded in the plan receipt, and `AuditEvidenceSubmitted` with the action `policy-allowed` naming the decision id is written on `audit.evidence.v1.evidence-submitted` in the transaction of the move Planned to Applying, which is the evidence the invariant of the model asks of a baseline or reconciliation apply. An allow-with-approval, which the seeded tenant bundle answers for a provisioning apply of the class production or external (D127, D129), moves it Planned to AwaitingApproval (ProductionWithoutApproval) and requests the approval from RunControlService through `RunControl.RequestApproval` with the subject kind `provisioning-run` and the provisioning run id as its subject, the service identity of IaCProvisioningService as the requesting service, the hash of the plan receipt as the proposal hash and the Operator or Platform admin as approvers; the approval reference is kept on the run. `ApprovalDecided` of RunControlService is handled by `ApplyApproval` idempotently on the event id. An approved decision moves the run AwaitingApproval to Applying (ApprovalGranted) only when its `proposalHash` equals the hash of the plan receipt, because an approval binds to the exact proposal; on a mismatch nothing is applied, the run stays AwaitingApproval and the mismatch is logged with the run and approval identifiers and without content. A rejected, expired, stale or cancelled decision moves the run AwaitingApproval to Rejected (ApprovalRejectedOrExpired), and so does a ChangesRequested decision, with the reason of the reviewer recorded on the run: a provisioning run cannot regenerate its plan, so a new plan is a new run. A decision for an approval no run holds changes nothing. A deny or a prohibited answer applies nothing and ends the run Failed with the reason `policy-denied`, writing `AuditEvidenceSubmitted` with the action `policy-denied` naming the decision id on `audit.evidence.v1.evidence-submitted` and `ProvisioningFailed` in the transaction that records the decision on the run (D129). The approval request names the provisioning run as its subject, so `runId` is optional in `approval-request-v1`: a run handed over from work of a Factory run carries the `runId` of its envelope, and a run without one, a baseline of a new environment or a run of the GitOpsReconciler (AIFACTORY-US-1076), is put to approval all the same; `ApprovalDecided` names the subject, so the decision returns to this service (D129, D135). PolicyEngineService and RunControlService are fail-fast dependencies: an answer INVALID_ARGUMENT, FAILED_PRECONDITION or UNAVAILABLE of `Policy.Decide` is treated as not allowed, and while either service gives no usable answer the Planner retries with its exponential policy and nothing is applied; a gate without a usable answer past the retries, a planner failure that outlasts the retries, and a program version that is not found, move the run to Failed with the reason, as the failure mode of the model states, a move from Planned that the state machine of the model does not list and that is reported as a correction. When the Config Platform does not answer, the planner records the configuration references as unresolved in the plan receipt and the run continues to its gate (degrade). Kind: behavior. Traces: services: IaCProvisioningService, PolicyEngineService, RunControlService, ArtifactService; aggregates: IaCProvisioningService/ProvisioningRun; apis: IaCProvisioningService/PlanProvisioning, PolicyEngineService/Policy.Decide, RunControlService/RunControl.RequestApproval, ArtifactService/Artifacts.Store; events: IaCProvisioningService/ProvisioningPlanned, IaCProvisioningService/ProvisioningFailed, RunControlService/ApprovalDecided; descriptors: policy-decision-v1, policy-decision-request-v1, approval-request-v1, run-event-envelope-v1; adrs: ADR-0004, ADR-0012, ADR-0014, ADR-0015; requirements: FR-08, NFR-08, XL-04; scenarios: SCN-IaCProvisioningService-004, SCN-IaCProvisioningService-008. Relates: screens: provisioning. Depends on: AIFACTORY-US-1071, feature:policy-engine-service, feature:run-control-service, feature:artifact-service, feature:contracts-package. Sources: model/services/runtime-cloud/IaCProvisioningService.yaml, model/services/governance/PolicyEngineService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/policy-decision.schema.json, docs/reference/schemas/approval.schema.json, docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.provisioning.apply` and the Operator role in the project of a specification, when `IaCProvisioningService/PlanProvisioning` is called with an `Idempotency-Key` and a body naming that specification, a version it holds, its environment and the kind Reconciliation, then the response is 202 with the run location and the `IaCProvisioningService/ProvisioningRun` is in state Planned; the same call repeated returns the same run and changes nothing (SCN-IaCProvisioningService-004).",
        "AC2: Given the same key with a different body, an invalid body, a version the specification does not hold or the kind Promotion, a caller without the scope or the role, and a specification of another tenant, when `IaCProvisioningService/PlanProvisioning` is called, then the answers are 409, 422, 422, 422, 403 and 404 respectively, each with a problem response, and no run is written and nothing is published (SCN-IaCProvisioningService-004, ADR-0015).",
        "AC3: Given a planned run, when the Planner records its plan receipt, then the plan log is stored through `ArtifactService/Artifacts.Store`, the `IaCProvisioningService/ProvisioningPlanned` outbox record is written in the same transaction with `planSummary`, and the dispatcher publishes it on `provisioning.runs.v1.provisioning-planned` under the run event envelope with `provisioningRunId`, `tenantId`, `environmentId`, `kind` and the optional `promotionId`, retrying a transport outage with backoff so the event is neither lost nor published twice; no resource changed before the record; given the same specification planned again without a change, then the plan is empty, `IaCProvisioningService/ProvisioningPlanned` carries an empty `planSummary`, the run is Cancelled with the reason `no-changes` in the same transaction and neither the gate nor the runner was called (SCN-IaCProvisioningService-008, ADR-0012).",
        "AC4: Given fakes of `PolicyEngineService/Policy.Decide` that answer allow, allow-with-constraints with a constraint the table of the service holds and with one it does not, allow-with-approval, deny, INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE, when a run without a promotion approval passes its gate, then every request was a `policy-decision-request-v1` with the action kind `provisioning-apply`, no domain, the target `provisioning-apply`, the side-effect class of the plan, the environment and the hash of the plan receipt as inputs hash; allow and the honoured constraints move the run to Applying with the `decisionId` in the plan receipt, the constraints recorded on the run and `AuditEvidenceSubmitted` with the action `policy-allowed` in the transaction of the move; the unhonoured constraint ends the run Failed with the constraint named, `policy-constraint-unmet` evidence and `IaCProvisioningService/ProvisioningFailed`; allow-with-approval moves it to AwaitingApproval and requests the approval through `RunControlService/RunControl.RequestApproval` with the subject kind `provisioning-run`, the provisioning run as subject, also for a run without a Factory run, bound to the hash of the plan receipt; deny ends the run Failed with `policy-denied` evidence and `IaCProvisioningService/ProvisioningFailed`; the three error answers apply nothing and, past the retries of the Planner, leave the run Failed with the reason; a run carrying the approval of a promotion moves to Applying without a decision (SCN-IaCProvisioningService-004, ADR-0015).",
        "AC5: Given a run in AwaitingApproval, when `RunControlService/ApprovalDecided` arrives approved with the hash of its plan receipt, approved with another `proposalHash`, rejected, expired, stale, cancelled or ChangesRequested, then the first moves the run to Applying, the second applies nothing, leaves the run AwaitingApproval and logs the mismatch without content, and the others move the run to Rejected, ChangesRequested with the reason of the reviewer recorded on the run; a repeated event changes nothing; given the planner fails past the retries of the Planner, or the program version is not found, then nothing is applied and the run is Failed with the reason (SCN-IaCProvisioningService-004, model/services/control-plane/RunControlService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4317",
        "AIFACTORY-TASK-4318",
        "AIFACTORY-TASK-329",
        "AIFACTORY-TASK-4319"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9904,
      "kind": "behavior",
      "traces": {
        "services": [
          "IaCProvisioningService",
          "PolicyEngineService",
          "RunControlService",
          "ArtifactService"
        ],
        "aggregates": [
          "IaCProvisioningService/ProvisioningRun"
        ],
        "apis": [
          "IaCProvisioningService/PlanProvisioning",
          "PolicyEngineService/Policy.Decide",
          "RunControlService/RunControl.RequestApproval",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "IaCProvisioningService/ProvisioningPlanned",
          "IaCProvisioningService/ProvisioningFailed",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "policy-decision-v1",
          "policy-decision-request-v1",
          "approval-request-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08",
          "NFR-08",
          "XL-04"
        ],
        "scenarios": [
          "SCN-IaCProvisioningService-004",
          "SCN-IaCProvisioningService-008"
        ]
      },
      "relates": {
        "screens": [
          "provisioning"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1071",
        "feature:policy-engine-service",
        "feature:run-control-service",
        "feature:artifact-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1073]",
      "number": 1073
    },
    {
      "id": "AIFACTORY-TASK-4317",
      "type": "task",
      "parent": "AIFACTORY-US-1073",
      "title": "PlanProvisioning with its idempotency key, admitted kinds and refusals",
      "sequence": "09.03.04.01",
      "description": "PlanProvisioning with its idempotency key, admitted kinds and refusals. Expected output: The operation validates the body, admits the kinds EnvironmentBaseline, Reconciliation and Decommission, writes the ProvisioningRun in state Planned and returns 202 with the location; the idempotent repeat, the 409 for a reused key with a different body, the 422 for an invalid body, an unknown version or an inadmissible kind, the 403 for a missing scope or project role and the 404 for a specification of another tenant are covered by acceptance tests, and none of them writes a run or an outbox record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The operation validates the body, admits the kinds EnvironmentBaseline, Reconciliation and Decommission, writes the ProvisioningRun in state Planned and returns 202 with the location; the idempotent repeat, the 409 for a reused key with a different body, the 422 for an invalid body, an unknown version or an inadmissible kind, the 403 for a missing scope or project role and the 404 for a specification of another tenant are covered by acceptance tests, and none of them writes a run or an outbox record."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4317]",
      "number": 4317
    },
    {
      "id": "AIFACTORY-TASK-4318",
      "type": "task",
      "parent": "AIFACTORY-US-1073",
      "title": "Planner with the plan receipt, the plan log artifact and the ProvisioningPlanned outbox record",
      "sequence": "09.03.04.02",
      "description": "Planner with the plan receipt, the plan log artifact and the ProvisioningPlanned outbox record. Expected output: The Planner resolves the program version and the references by reference, runs the IaC planner, stores the plan log through Artifacts.Store, records the plan receipt and writes ProvisioningPlanned in one transaction; an empty plan writes ProvisioningPlanned with an empty planSummary and moves the run to Cancelled with the reason no-changes in that transaction, so it reaches neither the gate nor the runner; unresolved configuration references are recorded as such when the Config Platform does not answer; a planner failure past the exponential retries or a missing program version moves the run to Failed with the reason; a golden file fixes ProvisioningPlanned under run-event-envelope-v1.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The Planner resolves the program version and the references by reference, runs the IaC planner, stores the plan log through Artifacts.Store, records the plan receipt and writes ProvisioningPlanned in one transaction; an empty plan writes ProvisioningPlanned with an empty planSummary and moves the run to Cancelled with the reason no-changes in that transaction, so it reaches neither the gate nor the runner; unresolved configuration references are recorded as such when the Config Platform does not answer; a planner failure past the exponential retries or a missing program version moves the run to Failed with the reason; a golden file fixes ProvisioningPlanned under run-event-envelope-v1."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4318]",
      "number": 4318
    },
    {
      "id": "AIFACTORY-TASK-329",
      "type": "task",
      "parent": "AIFACTORY-US-1073",
      "title": "Gate of an apply by the policy decision, the promotion approval or the approval it requires",
      "sequence": "09.03.04.03",
      "description": "Gate of an apply by the policy decision, the promotion approval or the approval it requires. Expected output: A Promotion run with a promotion approval moves to Applying; every other run asks Policy.Decide with a policy-decision-request-v1 of the action kind provisioning-apply, no domain, the target provisioning-apply, the side-effect class of the plan, the environment, the run as resource, the hash of the plan receipt as inputs hash, the runId of the envelope where present and the workload identity of the service as subject; allow moves it to Applying, allow-with-constraints moves it to Applying only when every constraint is in the table of honoured constraint names and records the constraints on the run, and an unhonoured constraint ends it Failed with the constraint named, AuditEvidenceSubmitted with the action policy-constraint-unmet and ProvisioningFailed in one transaction; on allow and honoured constraints the decisionId is recorded in the plan receipt and AuditEvidenceSubmitted with the action policy-allowed naming it is written in the transaction of the move to Applying; allow-with-approval moves the run to AwaitingApproval with an approval requested through RunControl.RequestApproval with the subject kind provisioning-run, the provisioning run id as subject and the service identity as the requesting service, bound to the plan hash; deny and prohibited end the run Failed with the reason policy-denied, AuditEvidenceSubmitted with the action policy-denied naming the decision id and ProvisioningFailed in one transaction; INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE count as not allowed and follow the retry and Failed rule of the Planner; the ApplyApproval handler of ApprovalDecided moves the run to Applying only for an approved decision whose proposalHash equals the hash of the plan receipt, leaves it AwaitingApproval and logs a mismatch without content otherwise, and moves it to Rejected on rejected, expired, stale, cancelled and ChangesRequested, the last with the reason of the reviewer, idempotently on the event id; a run without a Factory run id is put to approval by its subject like any other; the service decides no approval itself.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "A Promotion run with a promotion approval moves to Applying; every other run asks Policy.Decide with a policy-decision-request-v1 of the action kind provisioning-apply, no domain, the target provisioning-apply, the side-effect class of the plan, the environment, the run as resource, the hash of the plan receipt as inputs hash, the runId of the envelope where present and the workload identity of the service as subject; allow moves it to Applying, allow-with-constraints moves it to Applying only when every constraint is in the table of honoured constraint names and records the constraints on the run, and an unhonoured constraint ends it Failed with the constraint named, AuditEvidenceSubmitted with the action policy-constraint-unmet and ProvisioningFailed in one transaction; on allow and honoured constraints the decisionId is recorded in the plan receipt and AuditEvidenceSubmitted with the action policy-allowed naming it is written in the transaction of the move to Applying; allow-with-approval moves the run to AwaitingApproval with an approval requested through RunControl.RequestApproval with the subject kind provisioning-run, the provisioning run id as subject and the service identity as the requesting service, bound to the plan hash; deny and prohibited end the run Failed with the reason policy-denied, AuditEvidenceSubmitted with the action policy-denied naming the decision id and ProvisioningFailed in one transaction; INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE count as not allowed and follow the retry and Failed rule of the Planner; the ApplyApproval handler of ApprovalDecided moves the run to Applying only for an approved decision whose proposalHash equals the hash of the plan receipt, leaves it AwaitingApproval and logs a mismatch without content otherwise, and moves it to Rejected on rejected, expired, stale, cancelled and ChangesRequested, the last with the reason of the reviewer, idempotently on the event id; a run without a Factory run id is put to approval by its subject like any other; the service decides no approval itself."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-329]",
      "number": 329
    },
    {
      "id": "AIFACTORY-TASK-4319",
      "type": "task",
      "parent": "AIFACTORY-US-1073",
      "title": "Verify plan-a-provisioning-run-and-its-gate through the acceptance suite",
      "sequence": "09.03.04.04",
      "description": "Verify plan-a-provisioning-run-and-its-gate through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-004|Scenario=SCN-IaCProvisioningService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1073 with fakes of Policy.Decide, RunControl.RequestApproval and Artifacts.Store that can answer each outcome and stop answering, a fake Policy.Decide that answers allow-with-constraints with an honoured and an unhonoured constraint and the errors INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE, and ApprovalDecided fixtures for an approval of the plan hash, an approval of another proposalHash and a ChangesRequested decision, including the empty plan of a specification planned twice, the publication and payload of ProvisioningPlanned and the policy-allowed, policy-constraint-unmet and policy-denied evidence; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-004|Scenario=SCN-IaCProvisioningService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1073 with fakes of Policy.Decide, RunControl.RequestApproval and Artifacts.Store that can answer each outcome and stop answering, a fake Policy.Decide that answers allow-with-constraints with an honoured and an unhonoured constraint and the errors INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE, and ApprovalDecided fixtures for an approval of the plan hash, an approval of another proposalHash and a ChangesRequested decision, including the empty plan of a specification planned twice, the publication and payload of ProvisioningPlanned and the policy-allowed, policy-constraint-unmet and policy-denied evidence; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4319]",
      "number": 4319
    },
    {
      "id": "AIFACTORY-US-1074",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-048",
      "title": "Apply a provisioning run once through the IaC runner with brokered credentials, store its receipts and announce the outcome",
      "sequence": "09.03.05",
      "description": "As an operator, I want an allowed or approved run applied once with a receipt that names what changed or which resource failed, so that a failed apply is never retried blindly and a credential of a cloud account never leaves the runner. The Applier takes a run in state Applying, triggered by `ProvisioningPlanned` or by the decision that moved the run to Applying, under the idempotency key of the run and the apply, so a duplicate trigger has no second effect. It resolves the secret references of the specification through SecretBrokerService with `SecretBroker.Issue` at apply time, hands the issued short-lived credential to the IaC runner for this apply only and revokes the issuance through `SecretBroker.Revoke` when the apply ends; the runner identity itself is the `iac-runner-identity` reference of the key vault. The runner applies the recorded plan of the program version with the configuration references the Config Platform resolves and stops at the timeout of the option `RuntimeCloud:Provisioning:ApplyTimeoutMinutes`. The apply logs and the state snapshot are stored through `Artifacts.Store`, and the apply receipt records outputs, duration, result and runner version; outputs the program marks as secret are never recorded. When the runner succeeds the run moves Applying to Applied (RunnerSucceeded) and `ProvisioningApplied` is written in the same transaction with `provisioningRunId`, `tenantId`, `projectId`, `environmentId`, `kind`, the optional `promotionId`, `specificationVersion` and `outputs`; that version becomes the current specification of the environment. When the runner fails, times out or the cloud control plane does not answer, the run moves Applying to Failed (RunnerFailed) with a receipt that records the partial state and names the failing resource, and `ProvisioningFailed` is written in the same transaction with `provisioningRunId`, `tenantId`, `environmentId`, `kind`, the optional `promotionId` and a `reason` that holds no secret value. A failed run marks nothing as done and is never retried by the service: the Applier has no retry, a promotion rolls back through EnvironmentPromotionService, the reconciliation proposes the fix through RuntimeEnvironmentService, and a re-run is a new provisioning run. When SecretBrokerService does not answer, or a reference does not resolve, the runner is not started and the run is Failed with a receipt that names the reference and never a value (fail-fast). When ArtifactService does not answer when the logs or the state snapshot are stored, the run is settled from the result of the runner in the transaction of the service all the same: on success it moves to Applied with its apply receipt and `ProvisioningApplied`, on failure to Failed with `ProvisioningFailed`, and a logs or state artifact that could not be stored is recorded in the receipt as not stored with the reason; the store is a fail-fast dependency and such an artifact is never retried in a loop, and the cloud apply is never repeated. The model has no path to store such an artifact later, which is reported to the owner. An empty plan never reaches the Applier, because the Planner ends it Cancelled with the reason `no-changes` by the rule of AIFACTORY-US-1073. `connectsoft.factory.provisioning.runs` counts the outcome by tenant, kind and state and `connectsoft.factory.provisioning.apply_duration` records the duration by kind. These events are the input of EnvironmentService, EnvironmentPromotionService, RuntimeEnvironmentService, ExecutionCapacityService, StudioBff, AuditService and AlertRuleService, each in its own increment and PBIs; this PBI proves what the publisher can prove. Kind: behavior. Traces: services: IaCProvisioningService, SecretBrokerService, ArtifactService; aggregates: IaCProvisioningService/ProvisioningRun; apis: SecretBrokerService/SecretBroker.Issue, SecretBrokerService/SecretBroker.Revoke, ArtifactService/Artifacts.Store; events: IaCProvisioningService/ProvisioningApplied, IaCProvisioningService/ProvisioningFailed; descriptors: run-event-envelope-v1; adrs: ADR-0004, ADR-0012, ADR-0014, ADR-0019; requirements: FR-08, NFR-08, NFR-09; scenarios: SCN-IaCProvisioningService-009, SCN-IaCProvisioningService-010. Relates: screens: provisioning. Depends on: AIFACTORY-US-1073, feature:secret-broker-service, feature:artifact-service, feature:contracts-package. Sources: model/services/runtime-cloud/IaCProvisioningService.yaml, docs/architecture/adr/0004-pulumi-over-bicep-iac.md, docs/architecture/adr/0019-data-governance.md, docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a run in Applying, when the Applier applies it against a fake runner that succeeds, then the secret references were issued through `SecretBrokerService/SecretBroker.Issue` and revoked through `SecretBrokerService/SecretBroker.Revoke`, the logs and the state snapshot were stored through `ArtifactService/Artifacts.Store`, the run is Applied with its apply receipt and the `IaCProvisioningService/ProvisioningApplied` outbox record is written in the same transaction; a duplicate trigger applies nothing a second time (SCN-IaCProvisioningService-009, ADR-0004).",
        "AC2: Given a fake runner that fails on one resource, one that exceeds the apply timeout and an unreachable cloud control plane, when the Applier applies, then each run is Failed with a receipt that records the partial state and names the failing resource, the `IaCProvisioningService/ProvisioningFailed` outbox record is written in the same transaction, and the runner was called once per run and never again (SCN-IaCProvisioningService-010, model/services/runtime-cloud/IaCProvisioningService.yaml).",
        "AC3: Given an applied and a failed run, when the dispatcher publishes `IaCProvisioningService/ProvisioningApplied` on `provisioning.runs.v1.provisioning-applied` and `IaCProvisioningService/ProvisioningFailed` on `provisioning.runs.v1.provisioning-failed`, then each is sent under the run event envelope with the payload of the model, `specificationVersion` and `outputs` for the first and `reason` for the second, and a transport outage is retried with backoff so neither event is lost or published twice under its event id (SCN-IaCProvisioningService-009, SCN-IaCProvisioningService-010, ADR-0012).",
        "AC4: Given a program output marked secret and a secret reference issued for the apply, when the receipts, the events, the stored artifacts, the log records and the activities of the apply are scanned, then no secret value is found in any of them; given `SecretBrokerService/SecretBroker.Issue` does not answer, then the runner is not started and the run is Failed with a receipt naming the reference (SCN-IaCProvisioningService-010, ADR-0019).",
        "AC5: Given `ArtifactService/Artifacts.Store` does not answer when the Applier stores the logs and the state of a run whose fake runner succeeded and of a run whose fake runner failed, when the Applier settles them, then the first is Applied with `IaCProvisioningService/ProvisioningApplied` and the second Failed with `IaCProvisioningService/ProvisioningFailed`, each written once in the transaction of the service, each receipt records the logs and the state artifact as not stored with the reason, the store was called once per artifact and never again, and the cloud apply was not repeated (SCN-IaCProvisioningService-009, model/services/runtime-cloud/IaCProvisioningService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/architecture/adr/0004-pulumi-over-bicep-iac.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-328",
        "AIFACTORY-TASK-4320",
        "AIFACTORY-TASK-4321",
        "AIFACTORY-TASK-4322"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9905,
      "kind": "behavior",
      "traces": {
        "services": [
          "IaCProvisioningService",
          "SecretBrokerService",
          "ArtifactService"
        ],
        "aggregates": [
          "IaCProvisioningService/ProvisioningRun"
        ],
        "apis": [
          "SecretBrokerService/SecretBroker.Issue",
          "SecretBrokerService/SecretBroker.Revoke",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "IaCProvisioningService/ProvisioningApplied",
          "IaCProvisioningService/ProvisioningFailed"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014",
          "ADR-0019"
        ],
        "requirements": [
          "FR-08",
          "NFR-08",
          "NFR-09"
        ],
        "scenarios": [
          "SCN-IaCProvisioningService-009",
          "SCN-IaCProvisioningService-010"
        ]
      },
      "relates": {
        "screens": [
          "provisioning"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1073",
        "feature:secret-broker-service",
        "feature:artifact-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/architecture/adr/0004-pulumi-over-bicep-iac.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1074]",
      "number": 1074
    },
    {
      "id": "AIFACTORY-TASK-328",
      "type": "task",
      "parent": "AIFACTORY-US-1074",
      "title": "Applier with brokered credentials, the runner timeout and the apply receipt",
      "sequence": "09.03.05.01",
      "description": "Applier with brokered credentials, the runner timeout and the apply receipt. Expected output: The Applier takes runs in Applying under the key of run and apply, issues the secret references through SecretBroker.Issue for this apply only and revokes them through SecretBroker.Revoke, runs the IaC apply of the recorded plan with the runner workload identity and the apply timeout of the option, stores logs and state through Artifacts.Store, records outputs without secret outputs, duration, result and runner version, and moves the run to Applied or Failed with ProvisioningApplied or ProvisioningFailed in the same transaction; it never retries an apply, and an unavailable ArtifactService does not hold the run: the run is settled from the result of the runner and the receipt records each artifact that could not be stored as not stored with the reason, never retried in a loop.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The Applier takes runs in Applying under the key of run and apply, issues the secret references through SecretBroker.Issue for this apply only and revokes them through SecretBroker.Revoke, runs the IaC apply of the recorded plan with the runner workload identity and the apply timeout of the option, stores logs and state through Artifacts.Store, records outputs without secret outputs, duration, result and runner version, and moves the run to Applied or Failed with ProvisioningApplied or ProvisioningFailed in the same transaction; it never retries an apply, and an unavailable ArtifactService does not hold the run: the run is settled from the result of the runner and the receipt records each artifact that could not be stored as not stored with the reason, never retried in a loop."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9905,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-328]",
      "number": 328
    },
    {
      "id": "AIFACTORY-TASK-4320",
      "type": "task",
      "parent": "AIFACTORY-US-1074",
      "title": "Fake IaC runner, fake cloud control plane and the secret scan of the acceptance suite",
      "sequence": "09.03.05.02",
      "description": "Fake IaC runner, fake cloud control plane and the secret scan of the acceptance suite. Expected output: The acceptance suite holds a fake runner that succeeds, fails on a named resource with a partial state, exceeds the timeout and returns an output marked secret, a switch that makes the cloud control plane unreachable, fakes of SecretBroker.Issue, SecretBroker.Revoke and Artifacts.Store that record calls and can stop answering, and a scan of receipts, events, stored artifacts, log records and activities for the planted secret value.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake runner that succeeds, fails on a named resource with a partial state, exceeds the timeout and returns an output marked secret, a switch that makes the cloud control plane unreachable, fakes of SecretBroker.Issue, SecretBroker.Revoke and Artifacts.Store that record calls and can stop answering, and a scan of receipts, events, stored artifacts, log records and activities for the planted secret value."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9905,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4320]",
      "number": 4320
    },
    {
      "id": "AIFACTORY-TASK-4321",
      "type": "task",
      "parent": "AIFACTORY-US-1074",
      "title": "Contracts of ProvisioningApplied and ProvisioningFailed against the run event envelope",
      "sequence": "09.03.05.03",
      "description": "Contracts of ProvisioningApplied and ProvisioningFailed against the run event envelope. Expected output: Golden files fix ProvisioningApplied on provisioning.runs.v1.provisioning-applied and ProvisioningFailed on provisioning.runs.v1.provisioning-failed under run-event-envelope-v1 with the payload of model/services/runtime-cloud/IaCProvisioningService.yaml; a contract test fails when a serialised event differs from its file.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Golden files fix ProvisioningApplied on provisioning.runs.v1.provisioning-applied and ProvisioningFailed on provisioning.runs.v1.provisioning-failed under run-event-envelope-v1 with the payload of model/services/runtime-cloud/IaCProvisioningService.yaml; a contract test fails when a serialised event differs from its file."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9905,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4321]",
      "number": 4321
    },
    {
      "id": "AIFACTORY-TASK-4322",
      "type": "task",
      "parent": "AIFACTORY-US-1074",
      "title": "Verify apply-a-provisioning-run-with-receipts through the acceptance suite",
      "sequence": "09.03.05.04",
      "description": "Verify apply-a-provisioning-run-with-receipts through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-009|Scenario=SCN-IaCProvisioningService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1074 against the fakes of AIFACTORY-TASK-4320, including the single runner call per run, the secret scan, the fail-fast of the broker and the settlement with artifacts recorded as not stored while the artifact store does not answer; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-IaCProvisioningService-009|Scenario=SCN-IaCProvisioningService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1074 against the fakes of AIFACTORY-TASK-4320, including the single runner call per run, the secret scan, the fail-fast of the broker and the settlement with artifacts recorded as not stored while the artifact store does not answer; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4322]",
      "number": 4322
    },
    {
      "id": "AIFACTORY-US-1075",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-048",
      "title": "Cancel a planned provisioning run before anything is applied",
      "sequence": "09.03.06",
      "description": "As an operator, I want to cancel a provisioning run that was planned and not yet applied, so that a plan I no longer want, or one the policy denied, never reaches a cloud account. An Operator or a Platform admin whose scope carries `factory.provisioning.apply` cancels a run through `CancelProvisioning` with its `provisioningRunId`. A run in state Planned moves to Cancelled (Cancel) and the response is 200 with the run; nothing was applied and nothing will be, so the Applier never takes it. The operation is naturally idempotent: cancelling a run that is already Cancelled returns 200 with the same run and changes nothing. A run in any other state is refused with 409 and a problem response that names its state, because the model cancels only before apply: a run in AwaitingApproval, Applying, Applied, Failed or Rejected cannot be cancelled, and an approval that is still pending is decided or expires in RunControlService. A run of another tenant is answered 404, the same answer as for an unknown `provisioningRunId` (ADR-0015 amendment D113); a caller without the scope, or without the Operator or Platform admin role in the project of the run, is refused with 403. The model gives the command no event, so a cancellation publishes nothing; `connectsoft.factory.provisioning.runs` counts it under the state Cancelled. This is also how an Operator ends a run the policy denied, or one with a constraint the service cannot honour, which stays Planned (AIFACTORY-US-1073). Kind: behavior. Traces: services: IaCProvisioningService; aggregates: IaCProvisioningService/ProvisioningRun; apis: IaCProvisioningService/CancelProvisioning; adrs: ADR-0015; requirements: FR-08; scenarios: SCN-IaCProvisioningService-005. Relates: screens: provisioning. Depends on: AIFACTORY-US-1073. Sources: model/services/runtime-cloud/IaCProvisioningService.yaml, docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a run in state Planned and a caller with `factory.provisioning.apply` and the Operator role in its project, when `IaCProvisioningService/CancelProvisioning` is called, then the response is 200, the `IaCProvisioningService/ProvisioningRun` is Cancelled, the Applier never takes it and no event is written; the same call repeated returns 200 and changes nothing (SCN-IaCProvisioningService-005).",
        "AC2: Given runs in AwaitingApproval, Applying and Applied, when `IaCProvisioningService/CancelProvisioning` is called, then each answer is 409 with a problem response that names the state and the run is unchanged (SCN-IaCProvisioningService-005, model/services/runtime-cloud/IaCProvisioningService.yaml).",
        "AC3: Given a caller without `factory.provisioning.apply` or without a role in the project, a run of another tenant and an unknown `provisioningRunId`, when `IaCProvisioningService/CancelProvisioning` is called, then the first is answered 403 and the other two 404 alike, each with a problem response and no state change (SCN-IaCProvisioningService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4323",
        "AIFACTORY-TASK-4324"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9906,
      "kind": "behavior",
      "traces": {
        "services": [
          "IaCProvisioningService"
        ],
        "aggregates": [
          "IaCProvisioningService/ProvisioningRun"
        ],
        "apis": [
          "IaCProvisioningService/CancelProvisioning"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-08"
        ],
        "scenarios": [
          "SCN-IaCProvisioningService-005"
        ]
      },
      "relates": {
        "screens": [
          "provisioning"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1073"
      ],
      "source": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1075]",
      "number": 1075
    },
    {
      "id": "AIFACTORY-TASK-4323",
      "type": "task",
      "parent": "AIFACTORY-US-1075",
      "title": "CancelProvisioning with the transition Planned to Cancelled and its refusals",
      "sequence": "09.03.06.01",
      "description": "CancelProvisioning with the transition Planned to Cancelled and its refusals. Expected output: The operation moves a Planned run to Cancelled under the row version of the run, returns 200 and repeats idempotently, answers 409 naming the state for any other state, 404 for a run of another tenant as for an unknown id and 403 for a missing scope or project role, writes no outbox record and counts the run under the state Cancelled.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The operation moves a Planned run to Cancelled under the row version of the run, returns 200 and repeats idempotently, answers 409 naming the state for any other state, 404 for a run of another tenant as for an unknown id and 403 for a missing scope or project role, writes no outbox record and counts the run under the state Cancelled."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9906,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4323]",
      "number": 4323
    },
    {
      "id": "AIFACTORY-TASK-4324",
      "type": "task",
      "parent": "AIFACTORY-US-1075",
      "title": "Verify cancel-a-planned-provisioning-run through the acceptance suite",
      "sequence": "09.03.06.02",
      "description": "Verify cancel-a-planned-provisioning-run through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IaCProvisioningService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1075, including a cancel that races the move of the gate from Planned to Applying, which loses on the row version and leaves the run in the state the winner wrote.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-IaCProvisioningService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1075, including a cancel that races the move of the gate from Planned to Applying, which loses on the row version and leaves the run in the state the winner wrote."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9906,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4324]",
      "number": 4324
    },
    {
      "id": "AIFACTORY-US-1076",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-048",
      "title": "Plan runs from the hand-offs of a new environment, a promotion and an accepted reconciliation, and re-plan the declared state on a schedule",
      "sequence": "09.03.07",
      "description": "As an operator, I want new environments, approved promotions and accepted reconciliations to become provisioning runs without anyone planning them by hand, so that the declared state is planned through one path and a destructive difference never reaches a cloud account automatically. Three consumed events and one schedule start provisioning runs; each handler is idempotent on the event id through the inbox of the `iac-provisioning` profile, and every run they start passes the gate of AIFACTORY-US-1073. `EnvironmentCreated` of EnvironmentService is handled by `ProvisionBaseline`: the new environment gets a specification of kind EnvironmentBaseline declared for the program of the environment stack of the estate (feature `component-platform-template-environment-stack`) and a run of kind EnvironmentBaseline planned against it. The event carries the environment, the project, the tenant and the class and no program reference; where the handler takes the program reference and commit of the baseline from is not decided by the model and is reported to the owner, and until it is decided the acceptance suite proves the handler with a fixture reference, while a reference that does not resolve fails the run with the reference named, as for a program version that is not found. `PromotionApproved` of EnvironmentPromotionService is handled by `ProvisionPromotion`: its `desiredStateRef` declares a Workload specification version with the `releaseId` and the `strategy` of the event when it names a new commit, and a run of kind Promotion with the `promotionId` of the promotion is planned. `approvalId` is optional in the event, because only a production promotion carries an approval: a run that carries one has it reused for the production apply and no second approval is requested, and a run without one, a non-production promotion, is gated by `Policy.Decide` like every other run, the `runId` of the envelope being the run an approval request names. `ReconciliationDecided` of RuntimeEnvironmentService is handled by `ProvisionReconciliation`: an accepted proposal carries the `provisioningRunId` that RuntimeEnvironmentService assigned on acceptance, and the handler creates a run of kind Reconciliation of the current specification of the environment under that id, idempotently, so a run that already holds the id is not created again and RuntimeEnvironmentService relates the outcome to the proposal by that id in `ProvisioningApplied`; an accepted decision without a `provisioningRunId` creates nothing and is logged; a rejected one changes nothing. The model gives RuntimeEnvironmentService an outbound gRPC dependency on this service to plan accepted proposals, but this service has no gRPC method to plan, so the hand-off goes through the event and the missing method is reported as a gap. The event carries neither the direction of the proposal nor a specification version, so the handler always plans the declared state; adopting an observed state is a change of the program in Git, and the missing members are reported as a correction of the model. The two producers of these events are delivered in this increment and depend on this service, so their event types are taken from the pinned contracts package and proven against fixture events; their own suites prove the publication. The GitOpsReconciler re-plans the declared specification of every environment on its schedule, once per environment and window: it records a run of kind Reconciliation with its plan receipt and `ProvisioningPlanned`, and counts the differences in `connectsoft.factory.provisioning.reconciliation_diffs` by tenant and whether they are destructive. An empty plan ends Cancelled with the reason `no-changes` by the rule of AIFACTORY-US-1073. The reconciler plans no run for an environment that already has a Reconciliation run of the reconciler still Planned or AwaitingApproval, so a waiting run is never joined by a second one. A plan whose differences are only adds and changes goes to the gate when the option `RuntimeCloud:Provisioning:AutoApplyNonDestructive` is true and is applied only when the policy decision allows it; with the option false the reconciler applies nothing automatically. Under the seeded tenant bundle the decision for these runs is allow-with-approval for a plan of the class production or external, and a reconciler run is put to approval with the provisioning run as its subject although it has no Factory `runId` (D129, D135, AIFACTORY-US-1073); at most one of its runs waits per environment, as stated above, and the option applies a run without an approval once the tenant bundle answers allow for it. A plan with deletes, and any plan against a production environment, is never applied by the reconciler: the run stays Planned with its receipt as the record of the difference, and the reviewable correction is the reconciliation proposal that RuntimeEnvironmentService raises from its own drift findings; whether the reconciler should cancel such a run is reported as an open point. Kind: behavior. Traces: services: IaCProvisioningService, EnvironmentService, EnvironmentPromotionService, RuntimeEnvironmentService; aggregates: IaCProvisioningService/DeploymentSpecification, IaCProvisioningService/ProvisioningRun; apis: PolicyEngineService/Policy.Decide, RunControlService/RunControl.RequestApproval; events: EnvironmentService/EnvironmentCreated, IaCProvisioningService/SpecificationDeclared, IaCProvisioningService/ProvisioningPlanned; adrs: ADR-0004, ADR-0012, ADR-0014; requirements: FR-08, XL-10. Depends on: AIFACTORY-US-1071, AIFACTORY-US-1073, feature:policy-engine-service, feature:run-control-service, feature:environment-service, feature:component-platform-template-environment-stack, feature:contracts-package. Sources: model/services/runtime-cloud/IaCProvisioningService.yaml, model/services/control-plane/EnvironmentService.yaml, model/services/devops-gitops/EnvironmentPromotionService.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a fixture `EnvironmentService/EnvironmentCreated` for a new environment and a fixture baseline program reference, when `ProvisionBaseline` handles it, then a specification of kind EnvironmentBaseline is declared with `IaCProvisioningService/SpecificationDeclared`, a run of kind EnvironmentBaseline is planned with `IaCProvisioningService/ProvisioningPlanned`, and the same event delivered again changes nothing; given a reference that does not resolve, then the run is Failed with the reference named (model/services/runtime-cloud/IaCProvisioningService.yaml).",
        "AC2: Given fixtures `PromotionApproved` from the pinned contracts package naming a new commit, one with an `approvalId` and one without, when `ProvisionPromotion` handles them, then each declares a Workload specification version with the `releaseId` and the `strategy` of the event and plans a run of kind Promotion with its `promotionId`; the run with the approval passes its gate without a policy decision or a second approval, the run without it asks `PolicyEngineService/Policy.Decide` like every other run and, on allow-with-approval, requests the approval naming the `runId` of the envelope; `IaCProvisioningService/ProvisioningPlanned` carries the `promotionId` (model/services/runtime-cloud/IaCProvisioningService.yaml, ADR-0014).",
        "AC3: Given a fixture `ReconciliationDecided` accepted with a `provisioningRunId`, the same event delivered again, and one rejected, when `ProvisionReconciliation` handles them, then the accepted one creates a run of kind Reconciliation of the current specification under that `provisioningRunId` and announces it with `IaCProvisioningService/ProvisioningPlanned` carrying that id, the repeat creates nothing, and the rejected one changes nothing (ADR-0014, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC4: Given environments whose declared state differs from the observed resources by adds only, by a delete, and an environment of class Production, when the GitOpsReconciler runs twice in one window, then each environment gets one run with `IaCProvisioningService/ProvisioningPlanned`, the adds-only plan is applied when the option is true and the fake policy answers allow, the plans with a delete and against Production stay Planned and apply nothing, and the differences are counted by tenant and destructive; given the fake policy answers allow-with-approval, then the adds-only run waits in AwaitingApproval with an approval requested through `RunControlService/RunControl.RequestApproval` for the subject kind `provisioning-run`, nothing is applied and the next window plans no second run of that environment while it waits (model/services/runtime-cloud/IaCProvisioningService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4325",
        "AIFACTORY-TASK-4326",
        "AIFACTORY-TASK-4327",
        "AIFACTORY-TASK-4328"
      ],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9907,
      "kind": "behavior",
      "traces": {
        "services": [
          "IaCProvisioningService",
          "EnvironmentService",
          "EnvironmentPromotionService",
          "RuntimeEnvironmentService"
        ],
        "aggregates": [
          "IaCProvisioningService/DeploymentSpecification",
          "IaCProvisioningService/ProvisioningRun"
        ],
        "apis": [
          "PolicyEngineService/Policy.Decide",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "EnvironmentService/EnvironmentCreated",
          "IaCProvisioningService/SpecificationDeclared",
          "IaCProvisioningService/ProvisioningPlanned"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1071",
        "AIFACTORY-US-1073",
        "feature:policy-engine-service",
        "feature:run-control-service",
        "feature:environment-service",
        "feature:component-platform-template-environment-stack",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/ia-c-provisioning-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1076]",
      "number": 1076
    },
    {
      "id": "AIFACTORY-TASK-4325",
      "type": "task",
      "parent": "AIFACTORY-US-1076",
      "title": "Inbox handlers ProvisionBaseline, ProvisionPromotion and ProvisionReconciliation",
      "sequence": "09.03.07.01",
      "description": "Inbox handlers ProvisionBaseline, ProvisionPromotion and ProvisionReconciliation. Expected output: ProvisionBaseline declares an EnvironmentBaseline specification for the program reference of the estate and plans a baseline run; ProvisionPromotion declares a Workload version with the releaseId and the strategy of the event for a new commit of desiredStateRef and plans a Promotion run carrying the promotionId and, where present, the approvalId, a run without an approvalId passing the policy gate of AIFACTORY-US-1073 with the runId of the envelope; ProvisionReconciliation creates a Reconciliation run of the current specification under the provisioningRunId of an accepted decision, creates nothing for an id that already exists or an accepted decision without one, and ignores a rejected one; each handler is idempotent on the event id and takes its event type from the pinned contracts package.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "ProvisionBaseline declares an EnvironmentBaseline specification for the program reference of the estate and plans a baseline run; ProvisionPromotion declares a Workload version with the releaseId and the strategy of the event for a new commit of desiredStateRef and plans a Promotion run carrying the promotionId and, where present, the approvalId, a run without an approvalId passing the policy gate of AIFACTORY-US-1073 with the runId of the envelope; ProvisionReconciliation creates a Reconciliation run of the current specification under the provisioningRunId of an accepted decision, creates nothing for an id that already exists or an accepted decision without one, and ignores a rejected one; each handler is idempotent on the event id and takes its event type from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9907,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4325]",
      "number": 4325
    },
    {
      "id": "AIFACTORY-TASK-4326",
      "type": "task",
      "parent": "AIFACTORY-US-1076",
      "title": "GitOpsReconciler with the window key, the option and the destructive rule",
      "sequence": "09.03.07.02",
      "description": "GitOpsReconciler with the window key, the option and the destructive rule. Expected output: The GitOpsReconciler plans one Reconciliation run per environment with a declared specification and window, and none for an environment that still has a reconciler run Planned or AwaitingApproval; it counts differences in connectsoft.factory.provisioning.reconciliation_diffs by tenant and destructive, ends an empty plan Cancelled with the reason no-changes, sends an adds-and-changes plan to the policy gate only when RuntimeCloud:Provisioning:AutoApplyNonDestructive is true, puts a run the gate answers with allow-with-approval to approval with the subject kind provisioning-run and leaves it in AwaitingApproval, and never lets a plan with deletes or against a production environment reach the Applier.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The GitOpsReconciler plans one Reconciliation run per environment with a declared specification and window, and none for an environment that still has a reconciler run Planned or AwaitingApproval; it counts differences in connectsoft.factory.provisioning.reconciliation_diffs by tenant and destructive, ends an empty plan Cancelled with the reason no-changes, sends an adds-and-changes plan to the policy gate only when RuntimeCloud:Provisioning:AutoApplyNonDestructive is true, puts a run the gate answers with allow-with-approval to approval with the subject kind provisioning-run and leaves it in AwaitingApproval, and never lets a plan with deletes or against a production environment reach the Applier."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9907,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4326]",
      "number": 4326
    },
    {
      "id": "AIFACTORY-TASK-4327",
      "type": "task",
      "parent": "AIFACTORY-US-1076",
      "title": "Fixture events of the three hand-offs and a fixture baseline program reference",
      "sequence": "09.03.07.03",
      "description": "Fixture events of the three hand-offs and a fixture baseline program reference. Expected output: The acceptance suite holds fixture events EnvironmentCreated, PromotionApproved with and without an approvalId, and ReconciliationDecided accepted with a provisioningRunId and rejected, built from the event types of the pinned contracts package under the run event envelope with a correlation id, a fake Policy.Decide that answers allow and allow-with-approval, a fixture baseline program reference and commit for the environment stack, and a fake planner whose differences are configured per environment.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fixture events EnvironmentCreated, PromotionApproved with and without an approvalId, and ReconciliationDecided accepted with a provisioningRunId and rejected, built from the event types of the pinned contracts package under the run event envelope with a correlation id, a fake Policy.Decide that answers allow and allow-with-approval, a fixture baseline program reference and commit for the environment stack, and a fake planner whose differences are configured per environment."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9907,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4327]",
      "number": 4327
    },
    {
      "id": "AIFACTORY-TASK-4328",
      "type": "task",
      "parent": "AIFACTORY-US-1076",
      "title": "Verify provisioning-hand-offs-and-gitops-reconciliation through the acceptance suite",
      "sequence": "09.03.07.04",
      "description": "Verify provisioning-hand-offs-and-gitops-reconciliation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=HandOffsAndReconciliation\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1076, including the repeated delivery of each hand-off, the unresolved baseline reference, the reuse of the promotion approval and the policy gate of a promotion without one, the run created under the provisioningRunId of the decision, the two reconciler runs in one window and the run waiting in AwaitingApproval under allow-with-approval with no second run planned beside it.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IaCProvisioningService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=HandOffsAndReconciliation\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1076, including the repeated delivery of each hand-off, the unresolved baseline reference, the reuse of the promotion approval and the policy gate of a promotion without one, the run created under the provisioningRunId of the decision, the two reconciler runs in one window and the run waiting in AwaitingApproval under allow-with-approval with no second run planned beside it."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/IaCProvisioningService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IaCProvisioningService"
      ],
      "children": [],
      "buildOrder": 99,
      "phase": "factory",
      "stackRank": 9907,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4328]",
      "number": 4328
    },
    {
      "id": "AIFACTORY-FEAT-049",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-009",
      "title": "RuntimeCloudHost: gateway delivery",
      "sequence": "09.04",
      "description": "RuntimeCloudHost is the platform API gateway of bounded context BC-25 (Provisioning & Reconciliation). The API gateway of the Runtime Cloud platform (ADR-0028): routes public REST and internal gRPC calls to the 3 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost. Delivers: RuntimeCloudHost (complete). Increment I2: Deliver it. Build order 100 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-076",
        "AIFACTORY-US-1082",
        "AIFACTORY-US-1083",
        "AIFACTORY-US-1084",
        "AIFACTORY-US-1085",
        "AIFACTORY-US-1086"
      ],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10000,
      "titlePrefix": "[AIFACTORY-FEAT-049]",
      "number": 49
    },
    {
      "id": "AIFACTORY-US-076",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-049",
      "title": "RuntimeCloudHost routes the calls of its platform under a trusted scope",
      "sequence": "09.04.01",
      "description": "As an operator, I want one gateway in front of ExecutionCapacityService, IaCProvisioningService and RuntimeEnvironmentService that validates tokens and scopes, so that no service of the platform is reachable from outside the cluster except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the Runtime Cloud platform. ADR-0028 makes RuntimeCloudHost the API gateway of its platform: it routes public REST and internal gRPC calls to the three services the model lists under `deployment.fronts`, ExecutionCapacityService, IaCProvisioningService and RuntimeEnvironmentService, validates tokens and scopes and owns no business state, no relational store and no secret (gateway role GW-03). The repository ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost is created by the first task of this feature by the steps of the repository checklist of feature `repository-and-pipeline-conventions`: it is scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway therefore has no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`); the gateway copies neither the accessor nor the token contract. A user token has one audience, this gateway, and the gateway forwards it unchanged to the fronted service, which accepts the audience of its own gateway, and exchanges no token (ADR-0015 amendments D114 and D117). A workload token carries service scopes and no tenant claim and is admitted only on an internal gRPC route whose operation names a scope the token holds. The feature is delivered by five further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-1082), token, tenant and scope on every read route (AIFACTORY-US-1083), the pass-through of a shared-write call (AIFACTORY-US-1084), the production routes whose gate stays in the fronted service (AIFACTORY-US-1085), and health, targets, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-1086). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. A project-scoped route names its project in the path, a query parameter or a body member and never in a header the caller types, and the gateway checks it against the roles of the token; no operation of the three service files names a project that way, so every route either addresses a resource by its identifier or reads under the tenant of the token, the gateway forwards it under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged; a project header a caller sends is dropped on every route. All three fronted services are delivered complete in this increment, ExecutionCapacityService by feature `execution-capacity-service-complete` after its thin delivery of I1, so every route serves from the start. The inbound list of model/services/runtime-cloud/RuntimeCloudHost.yaml names DeliveryHost, AgentRuntimeWorker, ToolExecutorHost and StudioBff: ToolExecutorHost is delivered in I1, DeliveryHost in this increment, and AgentRuntimeWorker and StudioBff in I3. The row of DeliveryHost has the kind event, while a gateway consumes and publishes no event, so that row describes no call this gateway serves and is reported as a correction of the model. Apart from that list, EnvironmentPromotionService, delivered in this increment, calls the two internal gRPC read routes for promotion verification. Each caller calls the gateway in its own PBIs, and this feature waits for none of them. The feature adds no direct public route to any service of the platform. The gateway invents no response. Kind: enabling. Traces: services: RuntimeCloudHost, ExecutionCapacityService, IaCProvisioningService, RuntimeEnvironmentService; apis: RuntimeCloudHost/RuntimeCloudHealth; adrs: ADR-0004, ADR-0012, ADR-0014, ADR-0015, ADR-0017, ADR-0028; requirements: FR-08, FR-09. Depends on: AIFACTORY-US-1082, AIFACTORY-US-1083, AIFACTORY-US-1084, AIFACTORY-US-1085, AIFACTORY-US-1086, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai, feature:execution-capacity-service-thin, feature:execution-capacity-service-complete, feature:ia-cprovisioning-service, feature:runtime-environment-service. Sources: model/services/runtime-cloud/RuntimeCloudHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/execution/environments/services/runtime-cloud-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost created by the steps of the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/runtime-cloud/RuntimeCloudHost.yaml).",
        "AC2: Given a valid token for a route of each fronted service, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with the token unchanged, the tenant of the token, the correlation id and the trace context, the fronted service answers and the response returns unchanged, as AIFACTORY-US-1083 to AIFACTORY-US-1085 prove per route class (ADR-0015, FR-08).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret, and no event of the model lists RuntimeCloudHost as a consumer (ADR-0028, model/services/runtime-cloud/RuntimeCloudHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `RuntimeCloudHost/RuntimeCloudHealth` is probed and one replica is stopped, then health reports the identity platform and the three fronted services, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/runtime-cloud/RuntimeCloudHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-295",
        "AIFACTORY-TASK-4343",
        "AIFACTORY-TASK-784"
      ],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10001,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeCloudHost",
          "ExecutionCapacityService",
          "IaCProvisioningService",
          "RuntimeEnvironmentService"
        ],
        "apis": [
          "RuntimeCloudHost/RuntimeCloudHealth"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1082",
        "AIFACTORY-US-1083",
        "AIFACTORY-US-1084",
        "AIFACTORY-US-1085",
        "AIFACTORY-US-1086",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:execution-capacity-service-thin",
        "feature:execution-capacity-service-complete",
        "feature:ia-cprovisioning-service",
        "feature:runtime-environment-service"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-076]",
      "number": 76
    },
    {
      "id": "AIFACTORY-TASK-295",
      "type": "task",
      "parent": "AIFACTORY-US-076",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "09.04.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-296 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-296 is written."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-295]",
      "number": 295
    },
    {
      "id": "AIFACTORY-TASK-4343",
      "type": "task",
      "parent": "AIFACTORY-US-076",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "09.04.01.02",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range, the https and grpc ports, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/runtime-cloud/RuntimeCloudHost.yaml records them; it leaves RuntimeCloud:Host:FrontedServices at its default, the three service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, supplies the entries of RuntimeCloud:Host:Targets from the values of the installation, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range, the https and grpc ports, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/runtime-cloud/RuntimeCloudHost.yaml records them; it leaves RuntimeCloud:Host:FrontedServices at its default, the three service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, supplies the entries of RuntimeCloud:Host:Targets from the values of the installation, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10001,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-4343]",
      "number": 4343
    },
    {
      "id": "AIFACTORY-TASK-784",
      "type": "task",
      "parent": "AIFACTORY-US-076",
      "title": "Verify runtime-cloud-host-routes-its-platform by running the declared command",
      "sequence": "09.04.01.03",
      "description": "Verify runtime-cloud-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-076, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances behind one test balancer with the fakes of the fronted services, stops one and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-076, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances behind one test balancer with the fakes of the fronted services, stops one and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-784]",
      "number": 784
    },
    {
      "id": "AIFACTORY-US-1082",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-049",
      "title": "Runtime Cloud fronts file: named clients and REST and gRPC routes of the three fronted services, generated at build",
      "sequence": "09.04.02",
      "description": "As a platform admin, I want the route table of the Runtime Cloud gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Runtime Cloud platform. It lists the three services of `deployment.fronts` in model/services/runtime-cloud/RuntimeCloudHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method with its streaming mode, scope, side-effect class and idempotency. For ExecutionCapacityService these are the five REST operations `ListWorkerPools`, `SetWorkerPool`, `GetQuotas`, `SetQuota` and `ListCapacityLeases` and the three gRPC methods `Capacity.AcquireLease`, `Capacity.RenewLease` and `Capacity.ReleaseLease`. For IaCProvisioningService these are the five REST operations `ListSpecifications`, `ListProvisioningRuns`, `GetProvisioningRun`, `PlanProvisioning` and `CancelProvisioning` and the gRPC method `Provisioning.GetCurrentSpecification`. For RuntimeEnvironmentService these are the five REST operations `GetRuntimeInventory`, `ListDrift`, `ObserveEnvironment`, `ListReconciliationProposals` and `DecideReconciliation` and the gRPC method `Inventory.GetObservedState`. That is fifteen REST routes and five unary gRPC routes. By side-effect class ten REST routes and two gRPC routes are read, two REST routes and the three lease methods are shared-write, and three REST routes, `SetWorkerPool`, `PlanProvisioning` and `DecideReconciliation`, are production. Each REST entry also states how its operation addresses a project. No operation of the three service files names a project in its path, a query parameter or a body member. Nine are marked as addressed by a resource identifier only, because their path or body names a run, a specification, an environment, a proposal, a pool or a quota scope: `GetProvisioningRun`, `CancelProvisioning`, `PlanProvisioning`, `GetRuntimeInventory`, `ListDrift`, `ObserveEnvironment`, `DecideReconciliation`, `SetWorkerPool` and `SetQuota`. The path parameter `scope` of `SetQuota` names a project quota, a tenant quota or an edition default, and the model does not state how a project is told from the others in it, so the gateway cannot check a project there and the gap is reported as a correction of the service file. Six read under the scope of the caller and are marked as scoped by the tenant of the token: `ListSpecifications`, `ListProvisioningRuns`, `ListReconciliationProposals`, `ListWorkerPools`, `GetQuotas` and `ListCapacityLeases`. Each gRPC route names the scope a workload token must hold: the security section of model/services/runtime-cloud/ExecutionCapacityService.yaml names `factory.capacity.lease` for the three lease methods, and the model names no scope for `Provisioning.GetCurrentSpecification` and `Inventory.GetObservedState`; the rule proposed here is that their routes require the read scope of their service, `factory.provisioning.read` and `factory.runtime.read`, held by the workload token, and the owner may choose another scope. A test lists the emitted route table against the file and against the three service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `RuntimeCloudHealth` and `RuntimeCloudTargets`, transforms no payload and composes no response from two services. The option `RuntimeCloud:Host:FrontedServices` is bound at startup and compared with the service names of the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name; its default names the three service identifiers of `deployment.fronts`, so the deployment manifest does not set it. The pipeline publishes the OpenAPI document of the fifteen public REST operations as a build output, checked against the fronts file and the three service files. The typed client of this gateway belongs to this feature (D140): one library in the repository `ConnectSoft.AI.SoftwareFactory.Clients`, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the user-token layout from that published document, by the rules of feature `typed-gateway-clients` (AIFACTORY-US-381 to AIFACTORY-US-383), which it applies and does not repeat. It holds the fifteen public REST operations and no internal gRPC method, is checked against the model by the contract check of that feature, takes the shared types from the pinned contracts package, attaches the token issued for this gateway only to requests to the base address of this gateway, is versioned with the contracts package, published to the ConnectSoft feed and recorded on the Runbook page with the consumer that pins it. No workload layout is generated, because no public REST operation of this gateway admits a workload token; the workload callers of the platform, EnvironmentPromotionService, AgentRuntimeWorker and ToolExecutorHost, call its internal gRPC routes and pin no REST client. The caller of the package is StudioBff, which holds a user token and pins it in its own repository for the provisioning, inventory and capacity screens (AIFACTORY-US-1363); no caller writes a client of this gateway by hand. Kind: enabling. Traces: services: RuntimeCloudHost, ExecutionCapacityService, IaCProvisioningService, RuntimeEnvironmentService; adrs: ADR-0015, ADR-0028; requirements: FR-08, FR-09. Depends on: feature:component-api-gateway-template, feature:execution-capacity-service-complete, feature:ia-cprovisioning-service, feature:runtime-environment-service, feature:typed-gateway-clients, feature:component-api-library-template-factory-clients. Sources: model/services/runtime-cloud/RuntimeCloudHost.yaml, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/architecture/api-governance.md, docs/planes/execution/environments/services/runtime-cloud-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Runtime Cloud platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, fifteen REST routes and five gRPC routes, each with the scope, side-effect class, idempotency and streaming mode of the operation, and the route table test passes against model/services/runtime-cloud/RuntimeCloudHost.yaml and the three service files under model/services/runtime-cloud (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `RuntimeCloud:Host:FrontedServices` at its default, when the gateway starts, then startup succeeds; given a value that names no service of the fronts file or omits one, then startup fails with the differing name; given a path no route matches, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header carrying the token of the caller unchanged, the tenant, the correlation id and the trace context, a project header sent by the caller has been dropped, and the response of the fake returns unchanged (ADR-0015, FR-08).",
        "AC4: Given the built gateway, when its pipeline publishes the OpenAPI document of the public REST routes, then the document holds exactly the fifteen REST operations of the fronts file with their methods, paths, scopes and response codes and no internal gRPC method, and a contract check fails the build when it differs from the three service files under model/services/runtime-cloud (docs/architecture/api-governance.md).",
        "AC5: Given the published OpenAPI document and the pinned API library template, when the client of this gateway is generated, built and published in the repository ConnectSoft.AI.SoftwareFactory.Clients, then it holds the fifteen public REST operations in the user-token layout and no internal gRPC method, the contract check against the three service files under model/services/runtime-cloud passes, the token issued for RuntimeCloudHost is attached only to requests to its base address, and the package is on the ConnectSoft feed with a version tied to the contracts package and recorded on the Runbook page with StudioBff as its consumer (model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-296",
        "AIFACTORY-TASK-4344",
        "AIFACTORY-TASK-4345",
        "AIFACTORY-TASK-6602",
        "AIFACTORY-TASK-4346"
      ],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10002,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeCloudHost",
          "ExecutionCapacityService",
          "IaCProvisioningService",
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:execution-capacity-service-complete",
        "feature:ia-cprovisioning-service",
        "feature:runtime-environment-service",
        "feature:typed-gateway-clients",
        "feature:component-api-library-template-factory-clients"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-1082]",
      "number": 1082
    },
    {
      "id": "AIFACTORY-TASK-296",
      "type": "task",
      "parent": "AIFACTORY-US-1082",
      "title": "Fronts file with the REST and gRPC operations of ExecutionCapacityService, IaCProvisioningService and RuntimeEnvironmentService",
      "sequence": "09.04.02.01",
      "description": "Fronts file with the REST and gRPC operations of ExecutionCapacityService, IaCProvisioningService and RuntimeEnvironmentService. Expected output: The fronts file lists the three services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; each REST operation carries one of two markings, by a resource identifier only for the nine operations whose path or body names a run, a specification, an environment, a proposal, a pool or a quota scope, or by the tenant of the token for the six list and read operations, and a test fails when an operation carries none or two; each gRPC route names the scope a workload token must hold; the build emits the named clients, the fifteen REST routes, the five gRPC routes and the route table; RuntimeCloud:Host:FrontedServices is compared with the fronts file at startup; a project header of a caller is dropped on every route; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the three services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; each REST operation carries one of two markings, by a resource identifier only for the nine operations whose path or body names a run, a specification, an environment, a proposal, a pool or a quota scope, or by the tenant of the token for the six list and read operations, and a test fails when an operation carries none or two; each gRPC route names the scope a workload token must hold; the build emits the named clients, the fifteen REST routes, the five gRPC routes and the route table; RuntimeCloud:Host:FrontedServices is compared with the fronts file at startup; a project header of a caller is dropped on every route; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-296]",
      "number": 296
    },
    {
      "id": "AIFACTORY-TASK-4344",
      "type": "task",
      "parent": "AIFACTORY-US-1082",
      "title": "Fakes of the three fronted services and the token matrix of the acceptance suite",
      "sequence": "09.04.02.02",
      "description": "Fakes of the three fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and can stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the scope of each gRPC route.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and can stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the scope of each gRPC route."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10002,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4344]",
      "number": 4344
    },
    {
      "id": "AIFACTORY-TASK-4345",
      "type": "task",
      "parent": "AIFACTORY-US-1082",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "09.04.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the fifteen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the three service files under model/services/runtime-cloud and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, and the document is the input of the client of AIFACTORY-TASK-6602; no client package is built in this repository.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the fifteen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the three service files under model/services/runtime-cloud and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, and the document is the input of the client of AIFACTORY-TASK-6602; no client package is built in this repository."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10002,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4345]",
      "number": 4345
    },
    {
      "id": "AIFACTORY-TASK-6602",
      "type": "task",
      "parent": "AIFACTORY-US-1082",
      "title": "Typed client of RuntimeCloudHost in the user-token layout, generated from the published document and published to the ConnectSoft feed",
      "sequence": "09.04.02.04",
      "description": "Typed client of RuntimeCloudHost in the user-token layout, generated from the published document and published to the ConnectSoft feed. Expected output: One client library in the repository ConnectSoft.AI.SoftwareFactory.Clients, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template from the OpenAPI document of AIFACTORY-TASK-4345, holds the fifteen public REST operations of ExecutionCapacityService, IaCProvisioningService and RuntimeEnvironmentService and no internal gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; the contract check of AIFACTORY-TASK-1556 covers its document; a stub of the gateway in the fixture of the client solution answers 401, 403, 404 and a redirect to a second host, and the token issued for RuntimeCloudHost is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with StudioBff as the consumer that pins it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One client library in the repository ConnectSoft.AI.SoftwareFactory.Clients, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template from the OpenAPI document of AIFACTORY-TASK-4345, holds the fifteen public REST operations of ExecutionCapacityService, IaCProvisioningService and RuntimeEnvironmentService and no internal gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; the contract check of AIFACTORY-TASK-1556 covers its document; a stub of the gateway in the fixture of the client solution answers 401, 403, 404 and a redirect to a second host, and the token issued for RuntimeCloudHost is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with StudioBff as the consumer that pins it."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6602]",
      "number": 6602
    },
    {
      "id": "AIFACTORY-TASK-4346",
      "type": "task",
      "parent": "AIFACTORY-US-1082",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "09.04.02.05",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1082: one route per operation of the three service files under model/services/runtime-cloud, the failing builds, the start with the option at its default and the failing startup on a differing value, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller, and the contract check of the published OpenAPI document; AC5 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6602.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1082: one route per operation of the three service files under model/services/runtime-cloud, the failing builds, the start with the option at its default and the failing startup on a differing value, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller, and the contract check of the published OpenAPI document; AC5 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6602."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4346]",
      "number": 4346
    },
    {
      "id": "AIFACTORY-US-1083",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-049",
      "title": "A read route of the Runtime Cloud gateway forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "09.04.03",
      "description": "As an operator, I want my reads of pools, quotas, leases, specifications, provisioning runs, inventories, drift and proposals to reach the services only with the tenant and the scope my token grants, so that nobody reads across a tenant through the gateway and every read is served by the service that owns the state. A caller reaches a read operation of the Runtime Cloud platform through the gateway: an Operator, a Workspace admin, a Platform admin or an Observer reads worker pools, quotas and leases, deployment specifications and provisioning runs, the runtime inventory and the drift of an environment and the reconciliation proposals, and an Operator asks for an observation now, an operation the model gives the class read. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment D114). The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names: `factory.capacity.read` for `ListWorkerPools`, `GetQuotas` and `ListCapacityLeases`, `factory.provisioning.read` for `ListSpecifications`, `ListProvisioningRuns` and `GetProvisioningRun`, `factory.runtime.read` for `GetRuntimeInventory`, `ListDrift` and `ListReconciliationProposals`, and `factory.runtime.operate` for `ObserveEnvironment`. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. No read operation names a project in its path, a query parameter or a body member: four name a run or an environment by identifier and six read under the scope of the caller, and a gateway without business state cannot know the tenant or the project of such a resource, so it forwards the call under the tenant of the token and the scope of the operation; the fronted service answers 403 for a missing role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. A project header a caller sends is dropped and establishes nothing. Every public REST operation names a `factory.` scope a user holds, so a workload token on a REST route is answered 403. The scope is established once with the scope accessor of the pinned abstractions package and forwarded: the authorization header with the user token itself, the tenant, the correlation id and the trace context; the gateway exchanges no token and the fronted service applies its own tenant filter and role policies (ADR-0015 amendment D117). The internal gRPC surface has two read methods, `Provisioning.GetCurrentSpecification` and `Inventory.GetObservedState`, which EnvironmentPromotionService calls in this increment for promotion verification and FleetInventoryService in its own increment; a workload token that holds the scope of the route (AIFACTORY-US-1082) is forwarded with the `tenant-id` and the project metadata of the caller unchanged, and a workload token without it, or a user token, is answered PERMISSION_DENIED and no fronted service is called. For every read route the response is served by the fronted service with no side effect and returns unchanged with the correlation id; the gateway keeps nothing of the call. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope 403; in each case no fronted service is called and the refusal is counted for the route and logged with the correlation id and without the token. When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a retry hint that names the service and never its address, and the routes of the other services keep serving. Kind: behavior. Traces: services: RuntimeCloudHost, ExecutionCapacityService, IaCProvisioningService, RuntimeEnvironmentService; adrs: ADR-0015, ADR-0028; requirements: FR-08, FR-09, XL-14; scenarios: SCN-RuntimeCloudHost-004. Relates: screens: capacity, provisioning, inventory. Depends on: AIFACTORY-US-1082, feature:component-api-gateway-template, feature:component-extensions-ai, feature:execution-capacity-service-complete, feature:ia-cprovisioning-service, feature:runtime-environment-service. Sources: model/services/runtime-cloud/RuntimeCloudHost.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/execution/environments/services/runtime-cloud-host/index.md#security.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with `factory.provisioning.read`, when the read route of `GetProvisioningRun` is called, then the gateway forwards the call with the user token unchanged in the authorization header, the tenant of the `tid` claim, the correlation id and the trace context, IaCProvisioningService answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-RuntimeCloudHost-004, ADR-0015).",
        "AC2: Given the token matrix of the acceptance suite, when the ten read routes are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope of the operation and a workload token on a REST route are answered 403, and in none of these cases a fronted service is called; each refusal is counted for its route and logged with the correlation id and without the token (SCN-RuntimeCloudHost-004, ADR-0015).",
        "AC3: Given a valid user token, a tenant header of the caller that names another tenant and a project header of the caller, when the routes of `GetRuntimeInventory` and `ListProvisioningRuns` are called, then the tenant header is overwritten with the `tid` claim, the project header is dropped, the calls are forwarded under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged (SCN-RuntimeCloudHost-004, model/services/runtime-cloud/RuntimeCloudHost.yaml).",
        "AC4: Given a workload token that holds the scope of the route, when the gRPC routes of `Provisioning.GetCurrentSpecification` and `Inventory.GetObservedState` are called with `tenant-id` and project metadata, then each is forwarded with that metadata unchanged and the reply, a NOT_FOUND for an environment outside the forwarded tenant included, returns unchanged; given a workload token without the scope, or a user token, then the answer is PERMISSION_DENIED and no fronted service is called (SCN-RuntimeCloudHost-004, ADR-0015).",
        "AC5: Given the fake of RuntimeEnvironmentService does not answer, when its read routes are called, then the gateway answers 503, over gRPC UNAVAILABLE, with a problem response that carries a retry hint and names the service and never its address, no response is invented, and the read routes of ExecutionCapacityService and IaCProvisioningService keep serving (SCN-RuntimeCloudHost-004, model/services/runtime-cloud/RuntimeCloudHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#security"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4347",
        "AIFACTORY-TASK-4348"
      ],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10003,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeCloudHost",
          "ExecutionCapacityService",
          "IaCProvisioningService",
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FR-09",
          "XL-14"
        ],
        "scenarios": [
          "SCN-RuntimeCloudHost-004"
        ]
      },
      "relates": {
        "screens": [
          "capacity",
          "provisioning",
          "inventory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1082",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:execution-capacity-service-complete",
        "feature:ia-cprovisioning-service",
        "feature:runtime-environment-service"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#security"
      ],
      "titlePrefix": "[AIFACTORY-US-1083]",
      "number": 1083
    },
    {
      "id": "AIFACTORY-TASK-4347",
      "type": "task",
      "parent": "AIFACTORY-US-1083",
      "title": "Issuer, audience, scope and tenant configuration of the read routes",
      "sequence": "09.04.03.01",
      "description": "Issuer, audience, scope and tenant configuration of the read routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route; a route addressed by a resource identifier or scoped by the tenant of the token is forwarded under the tenant of the token and leaves the role and the tenant of the resource to the fronted service; a workload token is refused with 403 on a REST route; the two gRPC read routes admit a workload token with the scope of the route and forward the tenant-id and project metadata unchanged; the user token is forwarded unchanged and no token is exchanged; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route; a route addressed by a resource identifier or scoped by the tenant of the token is forwarded under the tenant of the token and leaves the role and the tenant of the resource to the fronted service; a workload token is refused with 403 on a REST route; the two gRPC read routes admit a workload token with the scope of the route and forward the tenant-id and project metadata unchanged; the user token is forwarded unchanged and no token is exchanged; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4347]",
      "number": 4347
    },
    {
      "id": "AIFACTORY-TASK-4348",
      "type": "task",
      "parent": "AIFACTORY-US-1083",
      "title": "Verify the read routes through the acceptance suite",
      "sequence": "09.04.03.02",
      "description": "Verify the read routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeCloudHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1083 over the token matrix: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, the 403 and 404 of the fakes returned unchanged, a workload token refused on a REST route, the two gRPC read routes with and without the scope, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeCloudHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1083 over the token matrix: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, the 403 and 404 of the fakes returned unchanged, a workload token refused on a REST route, the two gRPC read routes with and without the scope, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4348]",
      "number": 4348
    },
    {
      "id": "AIFACTORY-US-1084",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-049",
      "title": "A shared-write route of the Runtime Cloud gateway passes the call through and the gateway keeps nothing between calls",
      "sequence": "09.04.04",
      "description": "As an operator, I want a cancellation, a quota change or a capacity lease I repeat after a failure to be applied once, so that a lost answer or a restarted gateway never cancels twice, changes a quota twice or grants a second lease. A shared-write operation changes state that others read. The Runtime Cloud platform has two on its public surface, `SetQuota` of ExecutionCapacityService and `CancelProvisioning` of IaCProvisioningService, and three on its internal gRPC surface, `Capacity.AcquireLease`, `Capacity.RenewLease` and `Capacity.ReleaseLease` of ExecutionCapacityService, which the runtime workers and the tool executor call for the capacity of an attempt, a sandbox, a build or a browser session. The caller sends each through the gateway under the token, tenant and scope rules of AIFACTORY-US-1083: `factory.capacity.admin` for `SetQuota`, `factory.provisioning.apply` for `CancelProvisioning`, and on a gRPC route a workload token that holds `factory.capacity.lease`. `SetQuota` names a quota scope and `CancelProvisioning` a run by identifier, so the gateway forwards them under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. None of these operations declares idempotency by key header: `SetQuota` and `CancelProvisioning` are naturally idempotent, so a repeated call finds the state the first one left and the fronted service answers it once, and the three lease methods carry the lease in their messages under the idempotency rule of ExecutionCapacityService. Where a caller sends an `Idempotency-Key` anyway the gateway forwards it unchanged and gives it no meaning. The gateway is no party to idempotency. It stores neither a key nor a result, keeps no session, no lease and no pending call, has no outbox and writes no event, so a gateway replica that crashes during a call loses nothing: the replica restarts, nothing is replayed, and the caller repeats the call and receives from the service the result of the one application (failure mode of a gateway replica crash in the model). When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a problem response that names the service and carries a retry hint, the other routes keep serving, and the caller repeats the call. A refusal by the gateway, 401 or 403, reaches no fronted service, so it applies nothing. An invalid body and every domain refusal, the 409 of `CancelProvisioning` for a run that is no longer Planned and the 422 of `SetQuota` among them, are answers of the fronted service and return unchanged with the correlation id. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: RuntimeCloudHost, ExecutionCapacityService, IaCProvisioningService; adrs: ADR-0015, ADR-0028; requirements: FR-08, FR-09; scenarios: SCN-RuntimeCloudHost-005. Relates: screens: capacity, provisioning. Depends on: AIFACTORY-US-1082, AIFACTORY-US-1083, feature:component-api-gateway-template, feature:execution-capacity-service-complete, feature:ia-cprovisioning-service. Sources: model/services/runtime-cloud/RuntimeCloudHost.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/execution/environments/services/runtime-cloud-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a valid token with `factory.provisioning.apply` and the route of `CancelProvisioning`, when the call arrives and is repeated after the first answer was lost, then the gateway forwards both with the body and the established scope unchanged, the fake of IaCProvisioningService answers the second from the state the first left, and both responses return unchanged with the correlation id (SCN-RuntimeCloudHost-005, ADR-0015).",
        "AC2: Given a workload token that holds `factory.capacity.lease`, when a gateway replica is stopped while a call of `Capacity.AcquireLease` is in flight and the caller repeats it through another replica, then the second replica forwards the repeated call unchanged, the gateway replayed nothing, and an inspection of the shared cache finds no key, no lease and no result; that ExecutionCapacityService grants one lease is the rule of that service and is proven by its own suite (SCN-RuntimeCloudHost-005, model/services/runtime-cloud/RuntimeCloudHost.yaml).",
        "AC3: Given the fakes answer 409 for `CancelProvisioning` of a run that is no longer Planned, 422 for an invalid `SetQuota`, 403 for a missing role and 404 for a resource of another tenant, when the calls pass the gateway, then each answer returns unchanged with its body and the correlation id (SCN-RuntimeCloudHost-005, ADR-0015).",
        "AC4: Given a call without a token, a token that lacks the scope, a user token on a lease route and a fronted service that does not answer, when a shared-write route is called, then the answer is 401, 403, PERMISSION_DENIED or 503 respectively, a call the gateway refuses reaches no fronted service and applies nothing, and the 503 names the service and carries a retry hint while the other routes keep serving (SCN-RuntimeCloudHost-005, model/services/runtime-cloud/RuntimeCloudHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4349",
        "AIFACTORY-TASK-4350"
      ],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10004,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeCloudHost",
          "ExecutionCapacityService",
          "IaCProvisioningService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FR-09"
        ],
        "scenarios": [
          "SCN-RuntimeCloudHost-005"
        ]
      },
      "relates": {
        "screens": [
          "capacity",
          "provisioning"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1082",
        "AIFACTORY-US-1083",
        "feature:component-api-gateway-template",
        "feature:execution-capacity-service-complete",
        "feature:ia-cprovisioning-service"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1084]",
      "number": 1084
    },
    {
      "id": "AIFACTORY-TASK-4349",
      "type": "task",
      "parent": "AIFACTORY-US-1084",
      "title": "Forwarded body, headers and metadata of a shared-write route and a stateless call path",
      "sequence": "09.04.04.01",
      "description": "Forwarded body, headers and metadata of a shared-write route and a stateless call path. Expected output: A shared-write route forwards the body, any Idempotency-Key header and the established scope unchanged and returns the status and the body of the fronted service unchanged; the three lease routes admit a workload token with factory.capacity.lease only and forward the tenant-id and project metadata unchanged; no key, body, lease or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "A shared-write route forwards the body, any Idempotency-Key header and the established scope unchanged and returns the status and the body of the fronted service unchanged; the three lease routes admit a workload token with factory.capacity.lease only and forward the tenant-id and project metadata unchanged; no key, body, lease or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4349]",
      "number": 4349
    },
    {
      "id": "AIFACTORY-TASK-4350",
      "type": "task",
      "parent": "AIFACTORY-US-1084",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "09.04.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeCloudHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1084 with a repeated cancellation, a replica stopped during a lease call and the repeat through the second replica, the 409, 422, 403 and 404 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, a fake that stops answering and an inspection of the shared cache that finds no key, lease or result.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeCloudHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1084 with a repeated cancellation, a replica stopped during a lease call and the repeat through the second replica, the 409, 422, 403 and 404 of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, a fake that stops answering and an inspection of the shared cache that finds no key, lease or result."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4350]",
      "number": 4350
    },
    {
      "id": "AIFACTORY-US-1085",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-049",
      "title": "A production route of the Runtime Cloud gateway is forwarded under its scope and the gate of the action stays in the fronted service",
      "sequence": "09.04.05",
      "description": "As an operator, I want a provisioning plan, a reconciliation decision or a pool change to be gated by the service that owns its state, with the gateway only checking who I am and what I may call, so that an approval is never decided twice or by a component that holds no state. Three operations of the Runtime Cloud platform are of side-effect class production: `PlanProvisioning` of IaCProvisioningService, which plans a specification version against an environment and leads to an apply in a cloud account, `DecideReconciliation` of RuntimeEnvironmentService, whose acceptance of a production proposal leads to such a run, and `SetWorkerPool` of ExecutionCapacityService, which creates or changes the bounds and autoscaling of a pool and is applied through provisioning. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, requires the scope the operation names, `factory.provisioning.apply` for `PlanProvisioning`, `factory.runtime.operate` for `DecideReconciliation` and `factory.capacity.admin` for `SetWorkerPool`, and forwards the call with the established scope. Each of them names a specification, a proposal or a pool by identifier, so the gateway forwards it under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. The gate itself is decided where the state is. Whether an apply needs an approval is decided by the policy decision of PolicyEngineService alone, asked by IaCProvisioningService for the run, or carried by the approval of the promotion that handed the desired state over; the approval is requested from and decided in RunControlService and reaches the service as an event. RuntimeEnvironmentService records the decision of the Operator and writes nothing to infrastructure. The gateway evaluates no policy and no approval, holds no approval reference, refuses nothing for a missing approval, calls no cloud account, writes no receipt and no audit evidence; where a command leaves audit evidence, the service that owns the command writes it to its own outbox in the transaction of the command, as the event `AuditEvidenceSubmitted` on the topic `audit.evidence.v1.evidence-submitted`. The `Idempotency-Key` of `PlanProvisioning` passes through unchanged. The answer of the fronted service, the 202 of an accepted plan, the 409 of a reused key or of a decided proposal, the 422 of an invalid plan, decision or pool among them, returns unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. Kind: behavior. Traces: services: RuntimeCloudHost, ExecutionCapacityService, IaCProvisioningService, RuntimeEnvironmentService; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: FR-08, FR-09, XL-04; scenarios: SCN-RuntimeCloudHost-003. Relates: screens: provisioning, inventory, capacity. Depends on: AIFACTORY-US-1082, AIFACTORY-US-1083, feature:component-api-gateway-template, feature:execution-capacity-service-complete, feature:ia-cprovisioning-service, feature:runtime-environment-service. Sources: model/services/runtime-cloud/RuntimeCloudHost.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a token with `factory.provisioning.apply`, when the production route of `PlanProvisioning` is called with an `Idempotency-Key` against the fake of IaCProvisioningService that answers 202, 409, 422, 403 and 404, then the gateway forwards the call with the key and the body unchanged under the tenant of the token and returns each answer unchanged with the correlation id; the gateway evaluated no policy, held no approval and wrote nothing (SCN-RuntimeCloudHost-003, ADR-0028).",
        "AC2: Given a token with `factory.runtime.operate`, when the production route of `DecideReconciliation` is called against the fake of RuntimeEnvironmentService that answers 200, 409, 422, 403 and 404, and a token with `factory.capacity.admin` calls the route of `SetWorkerPool` against the fake of ExecutionCapacityService that answers 200, 201 and 422, then every answer returns unchanged and no route was refused by the gateway for a missing approval (SCN-RuntimeCloudHost-003, model/services/runtime-cloud/RuntimeCloudHost.yaml).",
        "AC3: Given a call without a token or with an expired token, or a token that lacks the scope of the operation, when a production route is called, then the gateway answers 401 or 403, no fronted service is called and the refusal is counted for the route (SCN-RuntimeCloudHost-003, ADR-0015).",
        "AC4: Given the route table, when the register test lists every route of class production, then it finds exactly the routes of `PlanProvisioning`, `DecideReconciliation` and `SetWorkerPool`, each with its scope, and fails when the gateway holds a handler, a cache entry or a store for a policy decision, an approval, a receipt or an evidence record (SCN-RuntimeCloudHost-003, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4351",
        "AIFACTORY-TASK-4352",
        "AIFACTORY-TASK-4353"
      ],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10005,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeCloudHost",
          "ExecutionCapacityService",
          "IaCProvisioningService",
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-08",
          "FR-09",
          "XL-04"
        ],
        "scenarios": [
          "SCN-RuntimeCloudHost-003"
        ]
      },
      "relates": {
        "screens": [
          "provisioning",
          "inventory",
          "capacity"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1082",
        "AIFACTORY-US-1083",
        "feature:component-api-gateway-template",
        "feature:execution-capacity-service-complete",
        "feature:ia-cprovisioning-service",
        "feature:runtime-environment-service"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1085]",
      "number": 1085
    },
    {
      "id": "AIFACTORY-TASK-4351",
      "type": "task",
      "parent": "AIFACTORY-US-1085",
      "title": "Production routes forwarded under their scope and the register of production routes",
      "sequence": "09.04.05.01",
      "description": "Production routes forwarded under their scope and the register of production routes. Expected output: The routes of PlanProvisioning, DecideReconciliation and SetWorkerPool require factory.provisioning.apply, factory.runtime.operate and factory.capacity.admin, forward the body, the Idempotency-Key of PlanProvisioning and the established scope unchanged and return the answer of the fronted service unchanged; a register test lists every route of class production from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for a policy decision, an approval, a receipt or an evidence record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "The routes of PlanProvisioning, DecideReconciliation and SetWorkerPool require factory.provisioning.apply, factory.runtime.operate and factory.capacity.admin, forward the body, the Idempotency-Key of PlanProvisioning and the established scope unchanged and return the answer of the fronted service unchanged; a register test lists every route of class production from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for a policy decision, an approval, a receipt or an evidence record."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4351]",
      "number": 4351
    },
    {
      "id": "AIFACTORY-TASK-4352",
      "type": "task",
      "parent": "AIFACTORY-US-1085",
      "title": "Fakes of the three production operations for the acceptance suite",
      "sequence": "09.04.05.02",
      "description": "Fakes of the three production operations for the acceptance suite. Expected output: The acceptance suite holds a fake of PlanProvisioning that answers 202, 409, 422, 403 and 404, a fake of DecideReconciliation that answers 200, 409, 422, 403 and 404 and a fake of SetWorkerPool that answers 200, 201 and 422, each generated from its fronts entry and recording the headers and body it received.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of PlanProvisioning that answers 202, 409, 422, 403 and 404, a fake of DecideReconciliation that answers 200, 409, 422, 403 and 404 and a fake of SetWorkerPool that answers 200, 201 and 422, each generated from its fronts entry and recording the headers and body it received."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10005,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4352]",
      "number": 4352
    },
    {
      "id": "AIFACTORY-TASK-4353",
      "type": "task",
      "parent": "AIFACTORY-US-1085",
      "title": "Verify the production routes through the acceptance suite",
      "sequence": "09.04.05.03",
      "description": "Verify the production routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeCloudHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1085: the plan forwarded with its key, the answers of the three fakes returned unchanged, the refusals of the gateway without a call to a fronted service and the register of production routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeCloudHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1085: the plan forwarded with its key, the answers of the three fakes returned unchanged, the refusals of the gateway without a call to a fronted service and the register of production routes."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4353]",
      "number": 4353
    },
    {
      "id": "AIFACTORY-US-1086",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-049",
      "title": "Health, targets, limits and telemetry of the Runtime Cloud gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "09.04.06",
      "description": "As an operator, I want to see whether the Runtime Cloud gateway, the identity platform and each fronted service answer, and which provisioning targets this installation has, so that I can tell a failing service from a failing gateway and act on the right one. An operator and the probes of the cluster read the state of the gateway through its two own operations. `RuntimeCloudHost/RuntimeCloudHealth` reports liveness and readiness of the gateway with the aggregated health of the three services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe the health operation answers 200 with the health degraded and a detail that names the identity platform as unreachable (ADR-0015 amendment D117). The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, the health operation answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency: when it does not answer, health reports it as unavailable in the detail and the answer stays 200, its routes answer 503 with a retry hint, and the routes of the other services keep serving. `RuntimeCloudHost/RuntimeCloudTargets` returns to a caller whose scope carries `factory.meta.read` the provisioning targets configured for the installation, Azure subscriptions, clusters and on-prem endpoints, and the version of the IaC runner. The targets are bound to the configuration section `RuntimeCloud:Host:Targets` of the gateway: a list with one entry per target of the installation, each the identifier and the kind of the target, `azure-subscription`, `cluster` or `on-prem-endpoint` after the three the model names, with no default value, every entry supplied by the deployment of the installation. An entry without an identifier or a kind, or with another kind, fails startup with the entry named, and a deployment that supplies no entry is answered with an empty list. An entry holds no credential or connection secret, and the reply names each target by its identifier and kind only. The model names this section nowhere, so it is reported as an option the model omits. The model names no operation of IaCProvisioningService that returns the runner version, and the gateway holds no state, so the runner version alone stays an open point reported to the owner; until it is decided the reply states it as not reported and invents no value. The model lists only 200 for the operation; the 401 for a call without a token and the 403 for a token without the scope are given by the host and are reported as codes the model omits; when no valid signing key remains the call is refused with the 503 of the failing-closed gateway. A call that exceeds the rate limit configured for the rate-limit class of its route (ADR-0018) is refused with 429, over gRPC RESOURCE_EXHAUSTED, through the pinned rate-limiting library, from the configuration of the deployment, and calls no fronted service. The gateway emits `connectsoft.factory.runtime_cloud.host.requests` with the dimensions service, route and status and `connectsoft.factory.runtime_cloud.host.request_duration` with service and route, the latency including the fronted service, each recorded through the helper of the pinned observability library, which puts the tenant, and the project where a call carries one, on the instrument by default (ADR-0019); the gateway carries the trace context to the service. Logs, activities and metrics never contain a token, a plan, an inventory or any other payload. A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed and callers repeat their call. Kind: behavior. Traces: services: RuntimeCloudHost, ExecutionCapacityService, IaCProvisioningService, RuntimeEnvironmentService; apis: RuntimeCloudHost/RuntimeCloudHealth, RuntimeCloudHost/RuntimeCloudTargets; adrs: ADR-0004, ADR-0015, ADR-0017, ADR-0018, ADR-0019, ADR-0028; requirements: NFR-06, NFR-08, NFR-09; scenarios: SCN-RuntimeCloudHost-001, SCN-RuntimeCloudHost-002. Depends on: AIFACTORY-US-1082, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/runtime-cloud/RuntimeCloudHost.yaml, docs/architecture/adr/0017-deployment-profiles.md, docs/architecture/adr/0018-nfr-baseline.md, docs/planes/execution/environments/services/runtime-cloud-host/index.md#metrics-and-observability, docs/planes/execution/environments/services/runtime-cloud-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and the fronted services reachable, when `RuntimeCloudHost/RuntimeCloudHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the three fronted services and of the identity platform; a call for the detail without a token is answered 401 and a token without the scope 403 (SCN-RuntimeCloudHost-001).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `RuntimeCloudHost/RuntimeCloudHealth` is probed, then already issued tokens pass, readiness stays ready and health answers 200 degraded with a detail that names the identity platform; given no valid key remains, when calls arrive, then they are refused, readiness is unready, `RuntimeCloudHost/RuntimeCloudHealth` answers 503 with a problem response that names the identity platform and liveness keeps answering 200 (SCN-RuntimeCloudHost-001, model/services/runtime-cloud/RuntimeCloudHost.yaml).",
        "AC3: Given one fronted service does not answer, when `RuntimeCloudHost/RuntimeCloudHealth` and the routes are called, then health answers 200 and reports the service as unavailable in its detail, its routes answer 503 with a retry hint that names the service, over gRPC UNAVAILABLE, the routes of the other services keep serving and the gateway invents no response (SCN-RuntimeCloudHost-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read` and the section `RuntimeCloud:Host:Targets` with two entries supplied by the deployment, when `RuntimeCloudHost/RuntimeCloudTargets` is called, then the response is 200 with the two targets by identifier and kind, no credential, and the runner version stated as not reported; given the section without entries, then the list is empty; given an entry without a kind, then startup fails with the entry named; given no token, a token without the scope, or no valid signing key, then the answer is 401, 403 or 503 and nothing is written (SCN-RuntimeCloudHost-002, ADR-0004).",
        "AC5: Given routed calls and a call above the rate limit of the rate-limit class of its route (ADR-0018), when the metrics and logs are read, then `connectsoft.factory.runtime_cloud.host.requests` counts every call by service, route and status, the call above the limit was refused with 429 and called no fronted service, `connectsoft.factory.runtime_cloud.host.request_duration` holds the latency by service and route, both carry the tenant of the call from the helper of the pinned observability library, and no log record, activity or metric holds a token or a payload (ADR-0019, model/services/runtime-cloud/RuntimeCloudHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0018-nfr-baseline.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#metrics-and-observability",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-297",
        "AIFACTORY-TASK-4354",
        "AIFACTORY-TASK-4355",
        "AIFACTORY-TASK-4356"
      ],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10006,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeCloudHost",
          "ExecutionCapacityService",
          "IaCProvisioningService",
          "RuntimeEnvironmentService"
        ],
        "apis": [
          "RuntimeCloudHost/RuntimeCloudHealth",
          "RuntimeCloudHost/RuntimeCloudTargets"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0015",
          "ADR-0017",
          "ADR-0018",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-06",
          "NFR-08",
          "NFR-09"
        ],
        "scenarios": [
          "SCN-RuntimeCloudHost-001",
          "SCN-RuntimeCloudHost-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1082",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0018-nfr-baseline.md",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#metrics-and-observability",
        "docs/planes/execution/environments/services/runtime-cloud-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1086]",
      "number": 1086
    },
    {
      "id": "AIFACTORY-TASK-297",
      "type": "task",
      "parent": "AIFACTORY-US-1086",
      "title": "Health, targets and telemetry of the gateway",
      "sequence": "09.04.06.01",
      "description": "Health, targets and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 degraded naming the identity platform; when no valid key remains, readiness turns unready and the operation answers 503 naming the identity platform (D117); the targets operation serves, under factory.meta.read, the targets bound from the configuration section RuntimeCloud:Host:Targets by identifier and kind, an empty list when the deployment supplies no entry, and the runner version as not reported, and never returns a credential; the section has no default value, and an entry without an identifier or a kind, or with a kind other than azure-subscription, cluster or on-prem-endpoint, fails startup with the entry named; every routed call records connectsoft.factory.runtime_cloud.host.requests and request_duration with their modelled dimensions and the tenant of the call, and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 degraded naming the identity platform; when no valid key remains, readiness turns unready and the operation answers 503 naming the identity platform (D117); the targets operation serves, under factory.meta.read, the targets bound from the configuration section RuntimeCloud:Host:Targets by identifier and kind, an empty list when the deployment supplies no entry, and the runner version as not reported, and never returns a credential; the section has no default value, and an entry without an identifier or a kind, or with a kind other than azure-subscription, cluster or on-prem-endpoint, fails startup with the entry named; every routed call records connectsoft.factory.runtime_cloud.host.requests and request_duration with their modelled dimensions and the tenant of the call, and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10006,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-297]",
      "number": 297
    },
    {
      "id": "AIFACTORY-TASK-4354",
      "type": "task",
      "parent": "AIFACTORY-US-1086",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "09.04.06.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the deployment through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.runtime_cloud.host.requests; no limit value is fixed in code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the deployment through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.runtime_cloud.host.requests; no limit value is fixed in code."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10006,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4354]",
      "number": 4354
    },
    {
      "id": "AIFACTORY-TASK-4355",
      "type": "task",
      "parent": "AIFACTORY-US-1086",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "09.04.06.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/runtime-cloud/RuntimeCloudHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains; the entry of the replica crash states that nothing is replayed and that callers repeat their call.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/runtime-cloud/RuntimeCloudHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains; the entry of the replica crash states that nothing is replayed and that callers repeat their call."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10006,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-4355]",
      "number": 4355
    },
    {
      "id": "AIFACTORY-TASK-4356",
      "type": "task",
      "parent": "AIFACTORY-US-1086",
      "title": "Verify health, targets, limits and telemetry through the acceptance suite",
      "sequence": "09.04.06.04",
      "description": "Verify health, targets, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeCloudHost-001|Scenario=SCN-RuntimeCloudHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1086 with the identity platform stopped while a cached key validates tokens, without a cached key and after the cached key expired, one fake stopped, the targets operation with two configured entries, with none, with an entry without a kind and without its scope, a call above its limit, the two series with service, route, status and tenant, and a scan of the captured logs and activities for token and payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeCloudHost-001|Scenario=SCN-RuntimeCloudHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1086 with the identity platform stopped while a cached key validates tokens, without a cached key and after the cached key expired, one fake stopped, the targets operation with two configured entries, with none, with an entry without a kind and without its scope, a call above its limit, the two series with service, route, status and tenant, and a scan of the captured logs and activities for token and payload content."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeCloudHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeCloudHost"
      ],
      "children": [],
      "buildOrder": 100,
      "phase": "factory",
      "stackRank": 10006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4356]",
      "number": 4356
    },
    {
      "id": "AIFACTORY-FEAT-050",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-009",
      "title": "RuntimeEnvironmentService: complete delivery",
      "sequence": "09.05",
      "description": "RuntimeEnvironmentService is the service of bounded context BC-25 (Provisioning & Reconciliation). The inventory of what actually runs where — workloads, versions, replicas, configuration and secret bindings by reference, endpoints — observed from the clusters and cloud APIs, compared with the declared specification to produce drift findings, and turned into reviewable reconciliation proposals, never automatic writes (BC-25; drift detection and runtime service catalog rows merged). Its own repository is ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Delivers: RuntimeEnvironmentService (complete). Increment I2: Deliver it. Build order 101 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-026",
        "AIFACTORY-US-1077",
        "AIFACTORY-US-1078",
        "AIFACTORY-US-1079",
        "AIFACTORY-US-1080",
        "AIFACTORY-US-1081"
      ],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10100,
      "titlePrefix": "[AIFACTORY-FEAT-050]",
      "number": 50
    },
    {
      "id": "AIFACTORY-US-026",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-050",
      "title": "RuntimeEnvironmentService shows what runs where and turns drift into a reviewable proposal end to end",
      "sequence": "09.05.01",
      "description": "As an operator, I want an inventory of what actually runs in each environment and a finding when it differs from the declared state, so that I act on observed facts, and a difference is corrected by a decision, never silently. This is the integration PBI of RuntimeEnvironmentService in the bounded context Provisioning and Reconciliation (BC-25). The service keeps the inventory of what actually runs in each environment, the workloads with their versions, replicas, endpoints, health and configuration and secret bindings by reference, observed from the clusters and cloud APIs through the IaC runner (ADR-0004); it compares each observation with the declared specification of IaCProvisioningService, records the differences as drift findings and groups them into reviewable reconciliation proposals, and it never writes to infrastructure itself: an accepted proposal is handed to IaCProvisioningService as an event and becomes a provisioning run there. The repository ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService is created by the first task of this feature by the steps of the repository checklist of feature `repository-and-pipeline-conventions`: it is scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`, consumed by pin), so token validation, the role policies, the scope chain with its 401, 403 and 404 answers, the tenant row filter, the Orleans messaging profile with the service name `runtime-environment`, the scheduler, health and the telemetry wiring come from the profile. Every integration event is written as the run event envelope of the pinned contracts package to the Orleans outbox in the transaction of its command (ADR-0014). The public REST operations are reached through RuntimeCloudHost, which forwards the user token unchanged; the service accepts the audience of its own gateway (ADR-0015 amendment D117). A resource of another tenant is answered 404, over gRPC NOT_FOUND, the same answer as for an unknown identifier, and a missing scope or project role inside the tenant 403 (ADR-0015 amendment D113). The environment routes name the environment in the path and the proposal routes name the proposal, never a project: the service checks the role of the caller in the project of the environment, and the list of proposals returns the rows of the projects in which the token holds a role, every project of the tenant for a Platform admin. The feature is delivered by five further PBIs: observing an environment (AIFACTORY-US-1077), reading the inventory and the drift (AIFACTORY-US-1078), detecting drift (AIFACTORY-US-1079), raising and listing proposals (AIFACTORY-US-1080) and deciding a proposal (AIFACTORY-US-1081). Secret bindings are references; a secret value never enters the inventory, a finding, an event, a log record or telemetry. The inbox registers the four consumed events of the model, `SpecificationDeclared`, `ProvisioningApplied` and `ProvisioningFailed` of IaCProvisioningService and `EnvironmentCreated` of EnvironmentService; the feature builds and registers no handler of a deletion order, which is built in I4 with RetentionResidencyService. Telemetry carries tenant and project on metrics by default and run, step and attempt on activities and log records where the work has them, and no observed configuration content reaches telemetry by default (ADR-0019). Kind: behavior. Traces: services: RuntimeEnvironmentService, IaCProvisioningService, EnvironmentService, RuntimeCloudHost, PolicyEngineService; aggregates: RuntimeEnvironmentService/RuntimeInventory, RuntimeEnvironmentService/DriftFinding, RuntimeEnvironmentService/ReconciliationProposal; apis: RuntimeEnvironmentService/GetRuntimeInventory, RuntimeEnvironmentService/ListDrift, RuntimeEnvironmentService/ObserveEnvironment, RuntimeEnvironmentService/ListReconciliationProposals, RuntimeEnvironmentService/DecideReconciliation, RuntimeEnvironmentService/Inventory.GetObservedState; events: RuntimeEnvironmentService/ObservedStateChanged, RuntimeEnvironmentService/RuntimeDriftDetected, RuntimeEnvironmentService/ReconciliationProposed, RuntimeEnvironmentService/ReconciliationDecided; descriptors: run-event-envelope-v1; adrs: ADR-0004, ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: FR-09, NFR-06, NFR-09, XL-10. Relates: screens: inventory. Depends on: AIFACTORY-US-1077, AIFACTORY-US-1078, AIFACTORY-US-1079, AIFACTORY-US-1080, AIFACTORY-US-1081, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-extensions-ai, feature:component-observability-factory-conventions, feature:contracts-package. Sources: model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/planes/execution/environments/services/runtime-environment-service/index.md#purpose-and-responsibilities, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService created by the steps of the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService --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 with complete reports and a container image is published (ADR-0028, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC2: Given the service descriptor of the repository, when the contract test compares it with the hosted surface, then `RuntimeEnvironmentService/GetRuntimeInventory`, `RuntimeEnvironmentService/ListDrift`, `RuntimeEnvironmentService/ObserveEnvironment`, `RuntimeEnvironmentService/ListReconciliationProposals`, `RuntimeEnvironmentService/DecideReconciliation` and `RuntimeEnvironmentService/Inventory.GetObservedState` are hosted with the scope, side-effect class, idempotency and response codes of model/services/runtime-cloud/RuntimeEnvironmentService.yaml, and the test fails on an operation the file does not name.",
        "AC3: Given inventories and proposals of two tenants and a caller of one, when an operation addresses an environment or a proposal of the other tenant, then the answer is 404, over gRPC NOT_FOUND, exactly as for an unknown identifier; given a caller without the scope or without a role in the project of the environment, then 403; given no token, then 401; in no case a state changes; a user token that RuntimeCloudHost forwards unchanged is accepted without a token exchange (ADR-0015).",
        "AC4: Given the outbox and the inbox of the service after the acceptance suite, when their records are read, then `RuntimeEnvironmentService/ObservedStateChanged`, `RuntimeEnvironmentService/RuntimeDriftDetected`, `RuntimeEnvironmentService/ReconciliationProposed` and `RuntimeEnvironmentService/ReconciliationDecided` are the only event types the outbox holds, each written in the transaction of its command under the run event envelope, and the inbox registers the four consumed events and no handler of a deletion order (ADR-0014).",
        "AC5: Given the service starts, when liveness and readiness are probed and the acceptance suite has run, then readiness is unready until `runtime-environment-sql` is migrated and while the outbox check of the messaging profile is unhealthy, the four metrics of the model are emitted with tenant and project from the instrument helper, and a scan of the captured log records, activities, metrics, events and stored rows finds no secret value (ADR-0019, model/services/runtime-cloud/RuntimeEnvironmentService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-298",
        "AIFACTORY-TASK-299",
        "AIFACTORY-TASK-300",
        "AIFACTORY-TASK-301",
        "AIFACTORY-TASK-302",
        "AIFACTORY-TASK-303",
        "AIFACTORY-TASK-304",
        "AIFACTORY-TASK-785"
      ],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeEnvironmentService",
          "IaCProvisioningService",
          "EnvironmentService",
          "RuntimeCloudHost",
          "PolicyEngineService"
        ],
        "aggregates": [
          "RuntimeEnvironmentService/RuntimeInventory",
          "RuntimeEnvironmentService/DriftFinding",
          "RuntimeEnvironmentService/ReconciliationProposal"
        ],
        "apis": [
          "RuntimeEnvironmentService/GetRuntimeInventory",
          "RuntimeEnvironmentService/ListDrift",
          "RuntimeEnvironmentService/ObserveEnvironment",
          "RuntimeEnvironmentService/ListReconciliationProposals",
          "RuntimeEnvironmentService/DecideReconciliation",
          "RuntimeEnvironmentService/Inventory.GetObservedState"
        ],
        "events": [
          "RuntimeEnvironmentService/ObservedStateChanged",
          "RuntimeEnvironmentService/RuntimeDriftDetected",
          "RuntimeEnvironmentService/ReconciliationProposed",
          "RuntimeEnvironmentService/ReconciliationDecided"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-09",
          "NFR-06",
          "NFR-09",
          "XL-10"
        ]
      },
      "relates": {
        "screens": [
          "inventory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1077",
        "AIFACTORY-US-1078",
        "AIFACTORY-US-1079",
        "AIFACTORY-US-1080",
        "AIFACTORY-US-1081",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-extensions-ai",
        "feature:component-observability-factory-conventions",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-026]",
      "number": 26
    },
    {
      "id": "AIFACTORY-TASK-298",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "09.05.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `runtime-environment`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `runtime-environment`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-298]",
      "number": 298
    },
    {
      "id": "AIFACTORY-TASK-299",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "Domain model: RuntimeInventory, DriftFinding and ReconciliationProposal with the four transitions of ProposalState",
      "sequence": "09.05.01.02",
      "description": "Domain model: RuntimeInventory, DriftFinding and ReconciliationProposal with the four transitions of ProposalState. Expected output: The RuntimeInventory aggregate holds its observed workloads with bindings as references only and its staleness; the DriftFinding aggregate is resolved only by a re-observation that no longer shows it, never by hand; the ReconciliationProposal aggregate holds the transitions Proposed to Accepted, Proposed to Rejected, Accepted to Applied and Proposed to Superseded and no other, and never writes to infrastructure; unit tests cover every transition, every rejected pair of states and every invariant of model/services/runtime-cloud/RuntimeEnvironmentService.yaml.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The RuntimeInventory aggregate holds its observed workloads with bindings as references only and its staleness; the DriftFinding aggregate is resolved only by a re-observation that no longer shows it, never by hand; the ReconciliationProposal aggregate holds the transitions Proposed to Accepted, Proposed to Rejected, Accepted to Applied and Proposed to Superseded and no other, and never writes to infrastructure; unit tests cover every transition, every rejected pair of states and every invariant of model/services/runtime-cloud/RuntimeEnvironmentService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-299]",
      "number": 299
    },
    {
      "id": "AIFACTORY-TASK-300",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "Persistence in runtime-environment-sql: RuntimeInventories, ObservedWorkloads, DriftFindings, ReconciliationProposals",
      "sequence": "09.05.01.03",
      "description": "Persistence in runtime-environment-sql: RuntimeInventories, ObservedWorkloads, DriftFindings, ReconciliationProposals. Expected output: Mappings and migrations for the four modelled tables with the tenant column and row filter, the indexes IX_Drift_Env_Open and IX_Reconcile_Env_State and a row version as optimistic concurrency token on a proposal; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the four modelled tables with the tenant column and row filter, the indexes IX_Drift_Env_Open and IX_Reconcile_Env_State and a row version as optimistic concurrency token on a proposal; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-300]",
      "number": 300
    },
    {
      "id": "AIFACTORY-TASK-301",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 5 REST and 1 gRPC operations",
      "sequence": "09.05.01.04",
      "description": "API hosting skeleton: service descriptor, REST and gRPC hosts, scope policies and problem responses of the 5 REST and 1 gRPC operations. Expected output: The service descriptor file lists GetRuntimeInventory, ListDrift, ObserveEnvironment, ListReconciliationProposals, DecideReconciliation and Inventory.GetObservedState with scope, side-effect class, idempotency and response codes; the five REST routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code and the workload scope check of the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-1077, AIFACTORY-US-1078, AIFACTORY-US-1080 and AIFACTORY-US-1081, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists GetRuntimeInventory, ListDrift, ObserveEnvironment, ListReconciliationProposals, DecideReconciliation and Inventory.GetObservedState with scope, side-effect class, idempotency and response codes; the five REST routes and the gRPC method are hosted with the scope policy of each route, problem responses for every modelled refusal code and the workload scope check of the gRPC method; the behaviour of each operation is delivered by AIFACTORY-US-1077, AIFACTORY-US-1078, AIFACTORY-US-1080 and AIFACTORY-US-1081, not here."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-301]",
      "number": 301
    },
    {
      "id": "AIFACTORY-TASK-302",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "Messaging skeleton: outbox and inbox wiring of the runtime-environment profile for 4 published and 4 consumed events",
      "sequence": "09.05.01.05",
      "description": "Messaging skeleton: outbox and inbox wiring of the runtime-environment profile for 4 published and 4 consumed events. Expected output: The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the runtime-environment messaging profile publishes ObservedStateChanged, RuntimeDriftDetected, ReconciliationProposed and ReconciliationDecided under the run event envelope of the pinned contracts package; the inbox registers SpecificationDeclared, ProvisioningApplied, ProvisioningFailed and EnvironmentCreated with idempotency on the event id and no handler of a deletion order; what each handler does is delivered by AIFACTORY-US-1077, AIFACTORY-US-1079 and AIFACTORY-US-1081.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the runtime-environment messaging profile publishes ObservedStateChanged, RuntimeDriftDetected, ReconciliationProposed and ReconciliationDecided under the run event envelope of the pinned contracts package; the inbox registers SpecificationDeclared, ProvisioningApplied, ProvisioningFailed and EnvironmentCreated with idempotency on the event id and no handler of a deletion order; what each handler does is delivered by AIFACTORY-US-1077, AIFACTORY-US-1079 and AIFACTORY-US-1081."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-302]",
      "number": 302
    },
    {
      "id": "AIFACTORY-TASK-303",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "Worker hosting skeleton: triggers, partitioning and retry policies of Observer and DriftComparer",
      "sequence": "09.05.01.06",
      "description": "Worker hosting skeleton: triggers, partitioning and retry policies of Observer and DriftComparer. Expected output: The Observer is hosted on its schedule with the key of environment and observation window and the DriftComparer on ObservedStateChanged with the key of environment and observation time, each with its fixed retry policy and partitioned by environment; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1077 and AIFACTORY-US-1079.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Observer is hosted on its schedule with the key of environment and observation window and the DriftComparer on ObservedStateChanged with the key of environment and observation time, each with its fixed retry policy and partitioned by environment; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1077 and AIFACTORY-US-1079."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-303]",
      "number": 303
    },
    {
      "id": "AIFACTORY-TASK-304",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "Security, tenancy and telemetry of RuntimeEnvironmentService",
      "sequence": "09.05.01.07",
      "description": "Security, tenancy and telemetry of RuntimeEnvironmentService. Expected output: The scopes factory.runtime.read and factory.runtime.operate and the roles Operator, Platform admin, Workspace admin and Observer are enforced per route; a user token forwarded by RuntimeCloudHost is accepted with the audience of that gateway; every query is tenant-filtered so a resource of another tenant is answered 404; the messaging-transport secret comes from a secret reference of the key vault; environments_stale, drift_open, reconciliation_proposals and inbox_lag are created through the instrument helper of the observability library with tenant and project; a redaction test fails when a log record, an activity or a metric holds a secret value or observed configuration content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The scopes factory.runtime.read and factory.runtime.operate and the roles Operator, Platform admin, Workspace admin and Observer are enforced per route; a user token forwarded by RuntimeCloudHost is accepted with the audience of that gateway; every query is tenant-filtered so a resource of another tenant is answered 404; the messaging-transport secret comes from a secret reference of the key vault; environments_stale, drift_open, reconciliation_proposals and inbox_lag are created through the instrument helper of the observability library with tenant and project; a redaction test fails when a log record, an activity or a metric holds a secret value or observed configuration content."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-304]",
      "number": 304
    },
    {
      "id": "AIFACTORY-TASK-785",
      "type": "task",
      "parent": "AIFACTORY-US-026",
      "title": "Verify observed-state-and-drift by running the declared command",
      "sequence": "09.05.01.08",
      "description": "Verify observed-state-and-drift by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-026, that is the scaffold, the hosted surface against the service descriptor, the two-tenant matrix with its 404, 403 and 401 answers, the event types of the outbox and the inbox, readiness and the redaction scan.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-026, that is the scaffold, the hosted surface against the service descriptor, the two-tenant matrix with its 404, 403 and 401 answers, the event types of the outbox and the inbox, readiness and the redaction scan."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-785]",
      "number": 785
    },
    {
      "id": "AIFACTORY-US-1077",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-050",
      "title": "Observe an environment on a schedule, after an apply or on request, keep its inventory and mark it stale when it cannot be observed",
      "sequence": "09.05.02",
      "description": "As an operator, I want the inventory of an environment refreshed on a schedule, right after every apply and when I ask for it, so that what I read is observed, never assumed, and an environment that cannot be reached shows as stale. The Observer reads the clusters and cloud APIs of every environment in scope on its schedule through the IaC runner and updates the `RuntimeInventory` of the environment: every workload with its kind, image or package version, ready and desired replicas, endpoints, configuration and secret bindings by reference and health, the current release and the observation time. When the observation changed something, versions, replicas, health, release or staleness, `ObservedStateChanged` is written to the outbox in the same transaction with `environmentId`, `tenantId`, `projectId`, `currentReleaseId`, `changes` and `stale`; an observation that changed nothing writes no event. Secret bindings are references and a value never enters the inventory or `changes`. The service holds no credential of a cloud account; the model gives it no dependency on SecretBrokerService, so how the runner reads a cloud account for an observation is reported to the owner. A caller whose scope carries `factory.runtime.operate` and whose role in the project of the environment is Operator or a role above it in the role order of ADR-0015 amendment D114, Workspace admin or Platform admin, triggers an observation now through `ObserveEnvironment`; the answer is 202 and the observation runs under the key of the environment and the observation window, so a second call in the same window joins the pending observation and starts no second one. An environment of another tenant is answered 404, the same answer as for an environment without an inventory (ADR-0015 amendment D113); a caller without the scope, or whose role in the project of the environment is only one below Operator or not comparable with it, Observer, Requester, Reviewer or Asset maintainer, is refused with 403. Three consumed events drive the inventory too, each idempotent on the event id: `EnvironmentCreated` of EnvironmentService opens the inventory of the new environment with no workloads, stale until its first observation (`TrackDeclared`); `ProvisioningApplied` of IaCProvisioningService records the applied `specificationVersion` and re-observes the environment at once (`ObserveAfterApply`); `ProvisioningFailed` re-observes at once to capture the partial state of the failed apply (`ObserveAfterFailure`). When the cluster or cloud API cannot be reached, the observation fails after its fixed retry, the last observed state is kept and its observation time is not refreshed, no finding is raised from the failed observation, and an environment whose last successful observation is older than the window of the option `RuntimeCloud:Inventory:StalenessMinutes` is marked stale, announced by `ObservedStateChanged` with `stale` true and counted in `connectsoft.factory.runtime.environments_stale`; the alert rule on that signal belongs to AlertRuleService in its own increment. `ObservedStateChanged` is the input of EnvironmentService, EnvironmentPromotionService, FleetInventoryService, SloService, StudioBff and DashboardService, each in its own increment and PBIs; this PBI proves what the publisher can prove. Kind: behavior. Traces: services: RuntimeEnvironmentService, EnvironmentService, IaCProvisioningService; aggregates: RuntimeEnvironmentService/RuntimeInventory; apis: RuntimeEnvironmentService/ObserveEnvironment; events: RuntimeEnvironmentService/ObservedStateChanged, EnvironmentService/EnvironmentCreated, IaCProvisioningService/ProvisioningApplied, IaCProvisioningService/ProvisioningFailed; descriptors: run-event-envelope-v1; adrs: ADR-0004, ADR-0012, ADR-0014, ADR-0015; requirements: FR-09, NFR-06; scenarios: SCN-RuntimeEnvironmentService-003, SCN-RuntimeEnvironmentService-007. Relates: screens: inventory. Depends on: feature:ia-cprovisioning-service, feature:environment-service, feature:contracts-package, feature:component-base-template-factory-profile. Sources: model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/planes/execution/environments/services/runtime-environment-service/index.md#workers-and-jobs, docs/planes/execution/environments/services/runtime-environment-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given an environment whose fake cluster reports a new version of one workload, when the Observer observes it, then the `RuntimeEnvironmentService/RuntimeInventory` holds every workload with version, replicas, endpoints, health and bindings as references, and the `RuntimeEnvironmentService/ObservedStateChanged` outbox record is written in the same transaction; a second observation without a change writes no record (SCN-RuntimeEnvironmentService-007, ADR-0014).",
        "AC2: Given an observed environment, when the dispatcher of the `runtime-environment` messaging profile publishes `RuntimeEnvironmentService/ObservedStateChanged` on `provisioning.inventory.v1.observed-state-changed`, then it is sent under the run event envelope with `environmentId`, `tenantId`, `projectId`, `currentReleaseId`, `changes` and `stale`, no secret value is in it, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-RuntimeEnvironmentService-007, ADR-0012).",
        "AC3: Given a caller with `factory.runtime.operate` and the Operator role in the project of an environment, when `RuntimeEnvironmentService/ObserveEnvironment` is called twice in one observation window, then both answers are 202 and one observation runs, and a Workspace admin and a Platform admin are admitted alike; given a caller without the scope, a caller whose only role in the project is Observer or Reviewer, an environment of another tenant and an unknown environment, then the answers are 403, 403, 404 and 404, each with a problem response and no observation (SCN-RuntimeEnvironmentService-003, ADR-0015).",
        "AC4: Given a fake cluster that stops answering, when observations fail past the staleness window, then no finding is raised, the last observed workloads are kept, the inventory is marked stale and `RuntimeEnvironmentService/ObservedStateChanged` announces `stale` true once (SCN-RuntimeEnvironmentService-007, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC5: Given fixture events `EnvironmentService/EnvironmentCreated`, `IaCProvisioningService/ProvisioningApplied` and `IaCProvisioningService/ProvisioningFailed`, when they are handled, then the first opens an inventory with no workloads that is stale until observed, the second records the applied `specificationVersion` and observes at once, the third observes at once, and each event delivered again changes nothing (model/services/runtime-cloud/RuntimeEnvironmentService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#workers-and-jobs",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-330",
        "AIFACTORY-TASK-4329",
        "AIFACTORY-TASK-4330",
        "AIFACTORY-TASK-4331"
      ],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10102,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeEnvironmentService",
          "EnvironmentService",
          "IaCProvisioningService"
        ],
        "aggregates": [
          "RuntimeEnvironmentService/RuntimeInventory"
        ],
        "apis": [
          "RuntimeEnvironmentService/ObserveEnvironment"
        ],
        "events": [
          "RuntimeEnvironmentService/ObservedStateChanged",
          "EnvironmentService/EnvironmentCreated",
          "IaCProvisioningService/ProvisioningApplied",
          "IaCProvisioningService/ProvisioningFailed"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-09",
          "NFR-06"
        ],
        "scenarios": [
          "SCN-RuntimeEnvironmentService-003",
          "SCN-RuntimeEnvironmentService-007"
        ]
      },
      "relates": {
        "screens": [
          "inventory"
        ]
      },
      "dependsOn": [
        "feature:ia-cprovisioning-service",
        "feature:environment-service",
        "feature:contracts-package",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#workers-and-jobs",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1077]",
      "number": 1077
    },
    {
      "id": "AIFACTORY-TASK-330",
      "type": "task",
      "parent": "AIFACTORY-US-1077",
      "title": "Observer and inventory with staleness",
      "sequence": "09.05.02.01",
      "description": "Observer and inventory with staleness. Expected output: The Observer reads the cluster and cloud APIs of each environment through the IaC runner under the key of environment and observation window, stores the workloads with bindings as references, writes ObservedStateChanged only when something changed, keeps the last state and raises no finding when an observation fails, and marks an environment stale once its last successful observation is older than the window of RuntimeCloud:Inventory:StalenessMinutes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "The Observer reads the cluster and cloud APIs of each environment through the IaC runner under the key of environment and observation window, stores the workloads with bindings as references, writes ObservedStateChanged only when something changed, keeps the last state and raises no finding when an observation fails, and marks an environment stale once its last successful observation is older than the window of RuntimeCloud:Inventory:StalenessMinutes."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-330]",
      "number": 330
    },
    {
      "id": "AIFACTORY-TASK-4329",
      "type": "task",
      "parent": "AIFACTORY-US-1077",
      "title": "ObserveEnvironment and the handlers of EnvironmentCreated, ProvisioningApplied and ProvisioningFailed",
      "sequence": "09.05.02.02",
      "description": "ObserveEnvironment and the handlers of EnvironmentCreated, ProvisioningApplied and ProvisioningFailed. Expected output: ObserveEnvironment admits the Operator role and the roles above it in the order of D114, Workspace admin and Platform admin, answers 202 and joins the observation of the current window, 404 for an environment of another tenant or without an inventory and 403 for a missing scope or a project role below Operator or not comparable with it; TrackDeclared on EnvironmentCreated opens an empty stale inventory, ObserveAfterApply records the applied specificationVersion and observes at once, ObserveAfterFailure observes at once; each handler is idempotent on the event id and takes its event type from the pinned contracts package.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "ObserveEnvironment admits the Operator role and the roles above it in the order of D114, Workspace admin and Platform admin, answers 202 and joins the observation of the current window, 404 for an environment of another tenant or without an inventory and 403 for a missing scope or a project role below Operator or not comparable with it; TrackDeclared on EnvironmentCreated opens an empty stale inventory, ObserveAfterApply records the applied specificationVersion and observes at once, ObserveAfterFailure observes at once; each handler is idempotent on the event id and takes its event type from the pinned contracts package."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4329]",
      "number": 4329
    },
    {
      "id": "AIFACTORY-TASK-4330",
      "type": "task",
      "parent": "AIFACTORY-US-1077",
      "title": "Fake cluster, contract of ObservedStateChanged and the fixture events of the observation suite",
      "sequence": "09.05.02.03",
      "description": "Fake cluster, contract of ObservedStateChanged and the fixture events of the observation suite. Expected output: The acceptance suite holds a fake cluster and cloud API behind the runner port that reports configured workloads, versions, replicas and health and can stop answering, fixture events EnvironmentCreated, ProvisioningApplied and ProvisioningFailed under the run event envelope, and a golden file that fixes ObservedStateChanged on provisioning.inventory.v1.observed-state-changed with the payload of model/services/runtime-cloud/RuntimeEnvironmentService.yaml.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake cluster and cloud API behind the runner port that reports configured workloads, versions, replicas and health and can stop answering, fixture events EnvironmentCreated, ProvisioningApplied and ProvisioningFailed under the run event envelope, and a golden file that fixes ObservedStateChanged on provisioning.inventory.v1.observed-state-changed with the payload of model/services/runtime-cloud/RuntimeEnvironmentService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4330]",
      "number": 4330
    },
    {
      "id": "AIFACTORY-TASK-4331",
      "type": "task",
      "parent": "AIFACTORY-US-1077",
      "title": "Verify observe-an-environment through the acceptance suite",
      "sequence": "09.05.02.04",
      "description": "Verify observe-an-environment through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-003|Scenario=SCN-RuntimeEnvironmentService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1077, including the observation joined within one window, the stale marking without findings and the publication and payload of ObservedStateChanged; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-003|Scenario=SCN-RuntimeEnvironmentService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1077, including the observation joined within one window, the stale marking without findings and the publication and payload of ObservedStateChanged; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4331]",
      "number": 4331
    },
    {
      "id": "AIFACTORY-US-1078",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-050",
      "title": "Read the runtime inventory and the drift of an environment, and serve the observed state to the services that verify and inventory",
      "sequence": "09.05.03",
      "description": "As an operator, I want to read what runs in an environment with its staleness and the drift found there, so that I judge an environment by what was observed and when, never by what was declared. An Operator, a Workspace admin, a Platform admin or an Observer whose scope carries `factory.runtime.read` reads the inventory of an environment through `GetRuntimeInventory` and receives its observed workloads with kind, version, ready and desired replicas, endpoints, health and configuration and secret bindings as references, the current release, the specification version last applied, the observation time and whether the inventory is stale. The same caller lists the drift findings of the environment through `ListDrift`, open and resolved, each with its kind, resource, declared and observed values, detection time, resolution time and the proposal it belongs to; declared and observed values of a secret binding are references, never values. An environment of another tenant is answered 404, the same answer as for an unknown environment (ADR-0015 amendment D113); a caller without the scope, or without a role in the project of the environment, is refused with 403; both reads write nothing. A workload calls the internal `Inventory.GetObservedState` with `execution-scope-v1` naming the tenant, the project and the environment and receives the observed state of the environment, its workloads, current release, applied specification version, observation time and staleness; EnvironmentPromotionService reads it in this increment for promotion verification, and FleetInventoryService in its own increment. The token must be a workload token holding the service scope the method names, and the forwarded tenant and project are read only under it (ADR-0015 amendment D114); a call without workload identity is answered UNAUTHENTICATED, a token without the scope PERMISSION_DENIED, a request that fails validation INVALID_ARGUMENT, and an environment of another tenant NOT_FOUND, as for an unknown environment. A stale inventory is answered with `stale` true and never as fresh. The method is a read and writes nothing. The model names `ack-v1` as its reply, a descriptor without a member for an observed state; the proto carries the reply in the shape of that schema and adds the observed state beside it, and a contract test states the difference, reported as a correction of the descriptor row of the model. Kind: behavior. Traces: services: RuntimeEnvironmentService; aggregates: RuntimeEnvironmentService/RuntimeInventory, RuntimeEnvironmentService/DriftFinding; apis: RuntimeEnvironmentService/GetRuntimeInventory, RuntimeEnvironmentService/ListDrift, RuntimeEnvironmentService/Inventory.GetObservedState; descriptors: execution-scope-v1, ack-v1; adrs: ADR-0015, ADR-0019; requirements: FR-09, XL-14; scenarios: SCN-RuntimeEnvironmentService-001, SCN-RuntimeEnvironmentService-002, SCN-RuntimeEnvironmentService-006. Relates: screens: inventory. Depends on: AIFACTORY-US-1077, feature:component-base-template-factory-profile. Sources: model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/planes/execution/environments/services/runtime-environment-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given an observed environment and a caller with `factory.runtime.read` and a role in its project, when `RuntimeEnvironmentService/GetRuntimeInventory` is called, then the response is 200 with every workload of the `RuntimeEnvironmentService/RuntimeInventory`, its bindings as references, the current release, the applied specification version, the observation time and the staleness (SCN-RuntimeEnvironmentService-001).",
        "AC2: Given open and resolved findings of an environment, when `RuntimeEnvironmentService/ListDrift` is called by a caller with the scope and a role, then the response is 200 with both, each with kind, resource, declared and observed values, detection and resolution time and its proposal, and no secret value (SCN-RuntimeEnvironmentService-002, ADR-0019).",
        "AC3: Given a caller without `factory.runtime.read` or without a role in the project, an environment of another tenant and an unknown environment, when `RuntimeEnvironmentService/GetRuntimeInventory` and `RuntimeEnvironmentService/ListDrift` are called, then the answers are 403, 404 and 404, each with a problem response and no state change (SCN-RuntimeEnvironmentService-001, SCN-RuntimeEnvironmentService-002, ADR-0015).",
        "AC4: Given a workload token with the service scope of the method, when `RuntimeEnvironmentService/Inventory.GetObservedState` is called for a fresh and for a stale environment, then each reply holds the observed state with its observation time and `stale` false or true and nothing is written; given no workload identity, a token without the scope, an invalid request or an environment of another tenant, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND and no state changes (SCN-RuntimeEnvironmentService-006, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4332",
        "AIFACTORY-TASK-4333",
        "AIFACTORY-TASK-4334"
      ],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10103,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "aggregates": [
          "RuntimeEnvironmentService/RuntimeInventory",
          "RuntimeEnvironmentService/DriftFinding"
        ],
        "apis": [
          "RuntimeEnvironmentService/GetRuntimeInventory",
          "RuntimeEnvironmentService/ListDrift",
          "RuntimeEnvironmentService/Inventory.GetObservedState"
        ],
        "descriptors": [
          "execution-scope-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-09",
          "XL-14"
        ],
        "scenarios": [
          "SCN-RuntimeEnvironmentService-001",
          "SCN-RuntimeEnvironmentService-002",
          "SCN-RuntimeEnvironmentService-006"
        ]
      },
      "relates": {
        "screens": [
          "inventory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1077",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1078]",
      "number": 1078
    },
    {
      "id": "AIFACTORY-TASK-4332",
      "type": "task",
      "parent": "AIFACTORY-US-1078",
      "title": "GetRuntimeInventory, ListDrift and Inventory.GetObservedState with the tenant filter and the project rule",
      "sequence": "09.05.03.01",
      "description": "GetRuntimeInventory, ListDrift and Inventory.GetObservedState with the tenant filter and the project rule. Expected output: GetRuntimeInventory returns the workloads, release, applied version, observation time and staleness; ListDrift the open and resolved findings with references only; both apply the tenant row filter and the project roles of the token, answer 404 for an environment of another tenant as for an unknown one and 403 for a missing scope or role; Inventory.GetObservedState admits a workload token with its service scope only, reads the forwarded scope under it and answers NOT_FOUND for an environment of another tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "GetRuntimeInventory returns the workloads, release, applied version, observation time and staleness; ListDrift the open and resolved findings with references only; both apply the tenant row filter and the project roles of the token, answer 404 for an environment of another tenant as for an unknown one and 403 for a missing scope or role; Inventory.GetObservedState admits a workload token with its service scope only, reads the forwarded scope under it and answers NOT_FOUND for an environment of another tenant."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4332]",
      "number": 4332
    },
    {
      "id": "AIFACTORY-TASK-4333",
      "type": "task",
      "parent": "AIFACTORY-US-1078",
      "title": "Contract of the inventory view, the drift list and the proto reply of GetObservedState",
      "sequence": "09.05.03.02",
      "description": "Contract of the inventory view, the drift list and the proto reply of GetObservedState. Expected output: The OpenAPI document describes the inventory view and the drift list as model/services/runtime-cloud/RuntimeEnvironmentService.yaml names them; the proto of Inventory.GetObservedState carries the shape of ack-v1 and adds the observed state beside it, and a contract test states the difference reported as a correction of the descriptor row of the model.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "The OpenAPI document describes the inventory view and the drift list as model/services/runtime-cloud/RuntimeEnvironmentService.yaml names them; the proto of Inventory.GetObservedState carries the shape of ack-v1 and adds the observed state beside it, and a contract test states the difference reported as a correction of the descriptor row of the model."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10103,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4333]",
      "number": 4333
    },
    {
      "id": "AIFACTORY-TASK-4334",
      "type": "task",
      "parent": "AIFACTORY-US-1078",
      "title": "Verify read-runtime-inventory-and-drift through the acceptance suite",
      "sequence": "09.05.03.03",
      "description": "Verify read-runtime-inventory-and-drift through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-001|Scenario=SCN-RuntimeEnvironmentService-002|Scenario=SCN-RuntimeEnvironmentService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1078, including the stale reply and the four gRPC refusals.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-001|Scenario=SCN-RuntimeEnvironmentService-002|Scenario=SCN-RuntimeEnvironmentService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1078, including the stale reply and the four gRPC refusals."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4334]",
      "number": 4334
    },
    {
      "id": "AIFACTORY-US-1079",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-050",
      "title": "Compare each fresh observation with the applied specification, raise a drift finding per difference and resolve it only by re-observation",
      "sequence": "09.05.04",
      "description": "As an operator, I want every difference between what runs and what was declared recorded as a finding, so that drift is visible as a fact with its declared and observed values and disappears only when it is no longer observed. The DriftComparer runs on every `ObservedStateChanged` of a fresh observation, under the key of the environment and the observation time, so a duplicate trigger has no second effect. It reads the specifications last applied to the environment, one per specification kind, through `Provisioning.GetCurrentSpecification` of IaCProvisioningService, reads the declared values of those program versions through the IaC runner and the configuration references through the Config Platform, and compares them with the observed workloads. Each difference becomes a `DriftFinding` of one of the kinds VersionMismatch, ReplicaMismatch, ConfigMismatch, MissingResource, UnmanagedResource or SecretBindingMismatch, with the resource, the declared and the observed values and the detection time; a difference already open for the same resource and kind raises no second finding. Each new finding writes `RuntimeDriftDetected` to the outbox in the same transaction with `findingId`, `tenantId`, `environmentId`, `kind` and `resource`, and `connectsoft.factory.runtime.drift_open` counts the open findings by tenant and kind. A SecretBindingMismatch compares references and never a value. A finding is resolved only by a re-observation that no longer shows it: the Observer sets its resolution time and nothing resolves a finding by hand. No finding is raised from a stale or failed observation. `SpecificationDeclared` of IaCProvisioningService is handled by `TrackDeclared`, idempotent on the event id: it records that a newer declared version exists for the environment, so the next comparison reads the current specification again and never compares against a cached one. IaCProvisioningService is a fail-fast dependency: while it does not answer, the comparison is retried with its fixed policy and raises no finding, and the next fresh observation compares again. The Config Platform is optional: while it does not answer, configuration is not compared and no ConfigMismatch is raised from the missing source. `RuntimeDriftDetected` is the input of StudioBff, AuditService, AlertRuleService and DashboardService, each in its own increment and PBIs; this PBI proves what the publisher can prove. Kind: behavior. Traces: services: RuntimeEnvironmentService, IaCProvisioningService; aggregates: RuntimeEnvironmentService/DriftFinding; apis: IaCProvisioningService/Provisioning.GetCurrentSpecification; events: RuntimeEnvironmentService/RuntimeDriftDetected, IaCProvisioningService/SpecificationDeclared; descriptors: run-event-envelope-v1; adrs: ADR-0004, ADR-0012, ADR-0014; requirements: FR-09, XL-10; scenarios: SCN-RuntimeEnvironmentService-008. Relates: screens: inventory. Depends on: AIFACTORY-US-1077, feature:ia-cprovisioning-service, feature:contracts-package. Sources: model/services/runtime-cloud/RuntimeEnvironmentService.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, docs/planes/execution/environments/services/runtime-environment-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given a fresh observation whose workload version, replica count and one secret binding reference differ from the applied specification read through `IaCProvisioningService/Provisioning.GetCurrentSpecification`, when the DriftComparer runs, then three `RuntimeEnvironmentService/DriftFinding` rows of kinds VersionMismatch, ReplicaMismatch and SecretBindingMismatch are written with declared and observed values as references, each with its `RuntimeEnvironmentService/RuntimeDriftDetected` outbox record in the same transaction; the same observation compared again raises nothing (SCN-RuntimeEnvironmentService-008, ADR-0014).",
        "AC2: Given a new finding, when the dispatcher publishes `RuntimeEnvironmentService/RuntimeDriftDetected` on `provisioning.inventory.v1.runtime-drift-detected`, then it is sent under the run event envelope with `findingId`, `tenantId`, `environmentId`, `kind` and `resource`, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-RuntimeEnvironmentService-008, ADR-0012).",
        "AC3: Given open findings, when a later observation no longer shows one of them, then that finding has its resolution time set by the observation and the others stay open; no operation resolves a finding by hand (SCN-RuntimeEnvironmentService-008, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC4: Given `IaCProvisioningService/Provisioning.GetCurrentSpecification` does not answer, a stale observation, and the Config Platform does not answer, when the DriftComparer runs, then no finding is raised from the first two and no ConfigMismatch from the third; given a fixture `IaCProvisioningService/SpecificationDeclared`, when it is handled, then the next comparison reads the current specification again and the event delivered again changes nothing (SCN-RuntimeEnvironmentService-008)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-331",
        "AIFACTORY-TASK-4335",
        "AIFACTORY-TASK-4336"
      ],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10104,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeEnvironmentService",
          "IaCProvisioningService"
        ],
        "aggregates": [
          "RuntimeEnvironmentService/DriftFinding"
        ],
        "apis": [
          "IaCProvisioningService/Provisioning.GetCurrentSpecification"
        ],
        "events": [
          "RuntimeEnvironmentService/RuntimeDriftDetected",
          "IaCProvisioningService/SpecificationDeclared"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-09",
          "XL-10"
        ],
        "scenarios": [
          "SCN-RuntimeEnvironmentService-008"
        ]
      },
      "relates": {
        "screens": [
          "inventory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1077",
        "feature:ia-cprovisioning-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-1079]",
      "number": 1079
    },
    {
      "id": "AIFACTORY-TASK-331",
      "type": "task",
      "parent": "AIFACTORY-US-1079",
      "title": "Drift comparison and findings",
      "sequence": "09.05.04.01",
      "description": "Drift comparison and findings. Expected output: The DriftComparer reads the applied specification through Provisioning.GetCurrentSpecification, the declared values through the runner and the configuration references through the Config Platform, writes one DriftFinding per new difference of the six kinds with RuntimeDriftDetected in the same transaction, compares secret bindings by reference, raises nothing from a stale or failed observation or while IaCProvisioningService does not answer, and TrackDeclared on SpecificationDeclared invalidates the cached specification idempotently on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "The DriftComparer reads the applied specification through Provisioning.GetCurrentSpecification, the declared values through the runner and the configuration references through the Config Platform, writes one DriftFinding per new difference of the six kinds with RuntimeDriftDetected in the same transaction, compares secret bindings by reference, raises nothing from a stale or failed observation or while IaCProvisioningService does not answer, and TrackDeclared on SpecificationDeclared invalidates the cached specification idempotently on the event id."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-331]",
      "number": 331
    },
    {
      "id": "AIFACTORY-TASK-4335",
      "type": "task",
      "parent": "AIFACTORY-US-1079",
      "title": "Fake of GetCurrentSpecification, fake declared values and the contract of RuntimeDriftDetected",
      "sequence": "09.05.04.02",
      "description": "Fake of GetCurrentSpecification, fake declared values and the contract of RuntimeDriftDetected. Expected output: The acceptance suite holds a fake of Provisioning.GetCurrentSpecification and a fake runner port for declared values, each configurable per environment and able to stop answering, a fake Config Platform that can stop answering, and a golden file that fixes RuntimeDriftDetected on provisioning.inventory.v1.runtime-drift-detected with the payload of model/services/runtime-cloud/RuntimeEnvironmentService.yaml.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of Provisioning.GetCurrentSpecification and a fake runner port for declared values, each configurable per environment and able to stop answering, a fake Config Platform that can stop answering, and a golden file that fixes RuntimeDriftDetected on provisioning.inventory.v1.runtime-drift-detected with the payload of model/services/runtime-cloud/RuntimeEnvironmentService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10104,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4335]",
      "number": 4335
    },
    {
      "id": "AIFACTORY-TASK-4336",
      "type": "task",
      "parent": "AIFACTORY-US-1079",
      "title": "Verify detect-runtime-drift through the acceptance suite",
      "sequence": "09.05.04.03",
      "description": "Verify detect-runtime-drift through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeEnvironmentService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1079, including one finding per difference, the resolution by re-observation, no finding while a source does not answer and the publication and payload of RuntimeDriftDetected; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RuntimeEnvironmentService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1079, including one finding per difference, the resolution by re-observation, no finding while a source does not answer and the publication and payload of RuntimeDriftDetected; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4336]",
      "number": 4336
    },
    {
      "id": "AIFACTORY-US-1080",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-050",
      "title": "Group drift findings into a reviewable reconciliation proposal, auto-accept only what the option and the policy allow, and list the proposals",
      "sequence": "09.05.05",
      "description": "As an operator, I want the findings of an environment grouped into one proposal I can review, with what it would change and whether it is destructive, so that nothing is reconciled without a decision, and only harmless corrections outside production are accepted for me where the policy allows it. After it records new findings, the DriftComparer groups the open findings of the environment that belong to no proposal or to a proposal still Proposed into one `ReconciliationProposal` in state Proposed: the findings it covers, the direction apply-declared, which brings the observed state back to the declared state, the specification version it would apply, a plan summary of the resources it would add, change or delete, and `destructive` true when it would delete a resource. It writes `ReconciliationProposed` to the outbox in the same transaction with `proposalId`, `tenantId`, `environmentId`, `direction` and `destructive`, and `connectsoft.factory.runtime.reconciliation_proposals` counts proposals by tenant, state and destructive. The direction adopt-observed, which declares what is observed, needs a change of the program in Git that the service cannot make; which findings are proposed that way is not decided by the model and is reported. The new proposal takes over the findings of every older proposal still Proposed, and each such older proposal moves to Superseded (NewerProposal) in the same transaction; the model gives that move no event. Findings that belong to an Accepted proposal are never taken over. A non-destructive proposal is accepted without an Operator only when the option `RuntimeCloud:Inventory:AutoAcceptNonDestructiveOutsideProduction` is true and PolicyEngineService answers allow through `Policy.Decide` for the environment. The request has the shape AIFACTORY-US-1073 of feature `ia-cprovisioning-service` fixes for a provisioning apply: the domain `Deployment`, the action kind `publication` with the fixed target `reconciliation-auto-accept`, the side-effect class `production` of `DecideReconciliation`, the environment of the proposal, the proposal as the resource, the hash of its findings and plan summary as the inputs hash, and as subject the workload identity of the service with the tenant and the project of the environment; the interim kind is reported with the same correction of the descriptor. The service does not hold the class of an environment and leaves it to the policy decision, which raises the class by it, and the seeded tenant bundle answers allow-with-approval for the classes production and external, so the acceptance stays with an Operator until the tenant bundle changes. An auto-accepted proposal moves Proposed to Accepted with a new `provisioningRunId` and is announced by `ReconciliationDecided` as AIFACTORY-US-1081 describes. Any other outcome leaves it Proposed: an allow-with-constraints is no allow for an auto-acceptance, because the service applies nothing it could constrain, and an allow-with-approval or a deny needs the decision of an Operator. A destructive proposal, or one the decision does not allow, is always reviewed by an Operator. PolicyEngineService is a fail-fast dependency: an answer INVALID_ARGUMENT, FAILED_PRECONDITION or UNAVAILABLE is treated as not allowed, nothing is auto-accepted and the proposal waits for an Operator. An Operator, a Workspace admin, a Platform admin or an Observer whose scope carries `factory.runtime.read` lists proposals through `ListReconciliationProposals` by environment and state with their plan summaries, filtered to the tenant of the token and the projects in which the token holds a role, every project of the tenant for a Platform admin; a caller without the scope is refused with 403 and the list writes nothing. `ReconciliationProposed` is the input of StudioBff, StudioNotificationService and AuditService, each in its own increment and PBIs; this PBI proves what the publisher can prove. Kind: behavior. Traces: services: RuntimeEnvironmentService, PolicyEngineService; aggregates: RuntimeEnvironmentService/ReconciliationProposal, RuntimeEnvironmentService/DriftFinding; apis: RuntimeEnvironmentService/ListReconciliationProposals, PolicyEngineService/Policy.Decide; events: RuntimeEnvironmentService/ReconciliationProposed, RuntimeEnvironmentService/ReconciliationDecided; descriptors: policy-decision-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-09, XL-10; scenarios: SCN-RuntimeEnvironmentService-004, SCN-RuntimeEnvironmentService-009. Relates: screens: inventory. Depends on: AIFACTORY-US-1079, feature:policy-engine-service, feature:contracts-package. Sources: model/services/runtime-cloud/RuntimeEnvironmentService.yaml, model/services/governance/PolicyEngineService.yaml, docs/planes/execution/environments/services/runtime-environment-service/index.md#options-and-configuration.",
      "acceptanceCriteria": [
        "AC1: Given new findings of an environment that belong to no proposal, one of kind UnmanagedResource, an older proposal still Proposed whose findings are open, and an Accepted proposal with open findings, when the DriftComparer groups them, then one new `RuntimeEnvironmentService/ReconciliationProposal` in state Proposed covers the new findings and those of the older Proposed proposal with direction apply-declared, a plan summary and `destructive` true, the older proposal is Superseded and the `RuntimeEnvironmentService/ReconciliationProposed` outbox record is written, both in the same transaction, and the findings of the Accepted proposal stay with it (SCN-RuntimeEnvironmentService-009, ADR-0014).",
        "AC2: Given a raised proposal, when the dispatcher publishes `RuntimeEnvironmentService/ReconciliationProposed` on `provisioning.inventory.v1.reconciliation-proposed`, then it is sent under the run event envelope with `proposalId`, `tenantId`, `environmentId`, `direction` and `destructive`, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-RuntimeEnvironmentService-009, ADR-0012).",
        "AC3: Given a non-destructive proposal, the option true and fakes of `PolicyEngineService/Policy.Decide` answering allow, allow-with-constraints, allow-with-approval, deny, INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE, when the proposal is raised, then every request named the domain `Deployment`, the action kind `publication` with the target `reconciliation-auto-accept`, the class `production`, the environment and the hash of the proposal as inputs hash; only the allow moves it to Accepted with a new `provisioningRunId` and `RuntimeEnvironmentService/ReconciliationDecided`, and the others leave it Proposed for an Operator; a destructive proposal or the option false is never auto-accepted (SCN-RuntimeEnvironmentService-009, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC4: Given proposals of two projects and two tenants in several states, when `RuntimeEnvironmentService/ListReconciliationProposals` is called with a filter of environment and state by a caller with `factory.runtime.read` and a role in one project, then the response is 200 with the matching proposals of that project and their plan summaries only; a caller without the scope is answered 403 with a problem response and no state changes (SCN-RuntimeEnvironmentService-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#options-and-configuration"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4337",
        "AIFACTORY-TASK-4338",
        "AIFACTORY-TASK-4339"
      ],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10105,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeEnvironmentService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "RuntimeEnvironmentService/ReconciliationProposal",
          "RuntimeEnvironmentService/DriftFinding"
        ],
        "apis": [
          "RuntimeEnvironmentService/ListReconciliationProposals",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "RuntimeEnvironmentService/ReconciliationProposed",
          "RuntimeEnvironmentService/ReconciliationDecided"
        ],
        "descriptors": [
          "policy-decision-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-09",
          "XL-10"
        ],
        "scenarios": [
          "SCN-RuntimeEnvironmentService-004",
          "SCN-RuntimeEnvironmentService-009"
        ]
      },
      "relates": {
        "screens": [
          "inventory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1079",
        "feature:policy-engine-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#options-and-configuration"
      ],
      "titlePrefix": "[AIFACTORY-US-1080]",
      "number": 1080
    },
    {
      "id": "AIFACTORY-TASK-4337",
      "type": "task",
      "parent": "AIFACTORY-US-1080",
      "title": "Proposal grouping, supersession and the auto-accept by option and policy decision",
      "sequence": "09.05.05.01",
      "description": "Proposal grouping, supersession and the auto-accept by option and policy decision. Expected output: The DriftComparer groups the open findings that belong to no proposal or to a proposal still Proposed into one new Proposed proposal with direction apply-declared, plan summary and destructive flag, takes those findings over and moves every older Proposed proposal whose findings it took to Superseded, writing ReconciliationProposed in the same transaction and never taking a finding of an Accepted proposal; it auto-accepts a non-destructive proposal with a new provisioningRunId only when RuntimeCloud:Inventory:AutoAcceptNonDestructiveOutsideProduction is true and Policy.Decide, asked with the domain Deployment, the action kind publication with the target reconciliation-auto-accept, the class production, the environment and the hash of the proposal, answers allow; allow-with-constraints, allow-with-approval, deny, INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE leave it Proposed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "The DriftComparer groups the open findings that belong to no proposal or to a proposal still Proposed into one new Proposed proposal with direction apply-declared, plan summary and destructive flag, takes those findings over and moves every older Proposed proposal whose findings it took to Superseded, writing ReconciliationProposed in the same transaction and never taking a finding of an Accepted proposal; it auto-accepts a non-destructive proposal with a new provisioningRunId only when RuntimeCloud:Inventory:AutoAcceptNonDestructiveOutsideProduction is true and Policy.Decide, asked with the domain Deployment, the action kind publication with the target reconciliation-auto-accept, the class production, the environment and the hash of the proposal, answers allow; allow-with-constraints, allow-with-approval, deny, INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE leave it Proposed."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4337]",
      "number": 4337
    },
    {
      "id": "AIFACTORY-TASK-4338",
      "type": "task",
      "parent": "AIFACTORY-US-1080",
      "title": "ListReconciliationProposals and the contract of ReconciliationProposed",
      "sequence": "09.05.05.02",
      "description": "ListReconciliationProposals and the contract of ReconciliationProposed. Expected output: ListReconciliationProposals returns the proposals by environment and state with plan summaries under the tenant row filter and the project roles of the token and answers 403 for a missing scope; a golden file fixes ReconciliationProposed on provisioning.inventory.v1.reconciliation-proposed under run-event-envelope-v1 with the payload of model/services/runtime-cloud/RuntimeEnvironmentService.yaml.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "ListReconciliationProposals returns the proposals by environment and state with plan summaries under the tenant row filter and the project roles of the token and answers 403 for a missing scope; a golden file fixes ReconciliationProposed on provisioning.inventory.v1.reconciliation-proposed under run-event-envelope-v1 with the payload of model/services/runtime-cloud/RuntimeEnvironmentService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4338]",
      "number": 4338
    },
    {
      "id": "AIFACTORY-TASK-4339",
      "type": "task",
      "parent": "AIFACTORY-US-1080",
      "title": "Verify raise-and-list-reconciliation-proposals through the acceptance suite",
      "sequence": "09.05.05.03",
      "description": "Verify raise-and-list-reconciliation-proposals through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-004|Scenario=SCN-RuntimeEnvironmentService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1080 with a fake of Policy.Decide that answers each outcome and stops answering, including the takeover of the findings of an older Proposed proposal with its supersession, the findings of an Accepted proposal left with it, the request shape of the auto-accept and the publication and payload of ReconciliationProposed; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-004|Scenario=SCN-RuntimeEnvironmentService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1080 with a fake of Policy.Decide that answers each outcome and stops answering, including the takeover of the findings of an older Proposed proposal with its supersession, the findings of an Accepted proposal left with it, the request shape of the auto-accept and the publication and payload of ReconciliationProposed; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4339]",
      "number": 4339
    },
    {
      "id": "AIFACTORY-US-1081",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-050",
      "title": "Accept or reject a reconciliation proposal, hand an accepted one to provisioning and mark it applied when its run is applied",
      "sequence": "09.05.06",
      "description": "As an operator, I want to accept a proposal so that provisioning plans it, or reject it with a reason, so that a difference is corrected by my decision through the one provisioning path, never by a write of the inventory service. A caller whose scope carries `factory.runtime.operate` and whose role in the project of the environment is Operator or a role above it in the role order of ADR-0015 amendment D114, Workspace admin or Platform admin, decides a proposal through `DecideReconciliation` with the decision accept or reject and, for a rejection, a reason. A rejection without a reason, a decision value other than accept or reject, or a malformed body is refused with 422 and a problem response, and no state changes; the code list of the model, 200, 403, 404 and 409, has no validation code, so 422 is reported as a code the model omits. A proposal in state Proposed moves to Accepted (OperatorAccepts) or to Rejected (OperatorRejects) with `decidedBy`, the response is 200 with the proposal, and `ReconciliationDecided` is written to the outbox in the same transaction with `proposalId`, `tenantId`, `environmentId` and `state`. On acceptance the service assigns a new `provisioningRunId`, stores it on the proposal, whose model holds that field, and publishes it in `ReconciliationDecided`; IaCProvisioningService creates the run of kind Reconciliation under that id when it handles the event (AIFACTORY-US-1076 of feature `ia-cprovisioning-service`). The model gives this service an outbound gRPC dependency on IaCProvisioningService to plan accepted proposals, but IaCProvisioningService has no gRPC method to plan, so the hand-off goes through the event and the missing method is reported as a gap. The operation is naturally idempotent: the decision that is already recorded, repeated, returns 200 with the same proposal and changes nothing, also once an accepted proposal is Applied; any other decision on a proposal that is no longer Proposed, a rejection of an Accepted or Applied proposal, an acceptance of a Rejected one or any decision on a Superseded one, is refused with 409 and a problem response that names its state. A proposal of another tenant is answered 404, the same answer as for an unknown `proposalId` (ADR-0015 amendment D113); a caller without the scope, or whose role in the project of the environment is only one below Operator or not comparable with it, Observer, Requester, Reviewer or Asset maintainer, is refused with 403. The acceptance of a production proposal is of class production but writes nothing to infrastructure: the apply it leads to is a provisioning run whose gate is the policy decision of PolicyEngineService, and the approval that decision may require, asked by IaCProvisioningService; this service neither decides nor requests an approval. When `ProvisioningApplied` of IaCProvisioningService arrives with the `provisioningRunId` stored on an Accepted proposal, the proposal moves Accepted to Applied (ProvisioningApplied), idempotently on the event id; an event of another `provisioningRunId` changes no proposal. A failed reconciliation run leaves the proposal Accepted with its findings still open and attached to it, and no new proposal is raised for them, because the grouping of AIFACTORY-US-1080 never takes a finding of an Accepted proposal; the model has no path back from Accepted to Proposed or Superseded, which is reported to the owner. `ReconciliationDecided` is the input of IaCProvisioningService, StudioBff and AuditService, each in its own PBIs; this PBI proves what the publisher can prove. Kind: behavior. Traces: services: RuntimeEnvironmentService, IaCProvisioningService; aggregates: RuntimeEnvironmentService/ReconciliationProposal; apis: RuntimeEnvironmentService/DecideReconciliation; events: RuntimeEnvironmentService/ReconciliationDecided, IaCProvisioningService/ProvisioningApplied, IaCProvisioningService/ProvisioningFailed; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-09, FUX-05; scenarios: SCN-RuntimeEnvironmentService-005, SCN-RuntimeEnvironmentService-010. Relates: screens: inventory. Depends on: AIFACTORY-US-1080, feature:ia-cprovisioning-service, feature:contracts-package. Sources: model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/reference/schemas/run-event-envelope.schema.json, docs/planes/execution/environments/services/runtime-environment-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a proposal in state Proposed and a caller with `factory.runtime.operate` and the Operator role in the project of its environment, when `RuntimeEnvironmentService/DecideReconciliation` is called with accept, then the response is 200, the `RuntimeEnvironmentService/ReconciliationProposal` is Accepted with `decidedBy`, and the `RuntimeEnvironmentService/ReconciliationDecided` outbox record is written in the same transaction; with reject and a reason, then it is Rejected; the same decision repeated returns 200 and changes nothing (SCN-RuntimeEnvironmentService-005, ADR-0014).",
        "AC2: Given a Rejected and a Superseded proposal called with accept, an Accepted proposal called with reject, a rejection without a reason, an unknown decision value, a malformed body, a caller without the scope, a caller whose only role in the project is Observer, a proposal of another tenant and an unknown `proposalId`, when `RuntimeEnvironmentService/DecideReconciliation` is called, then the answers are 409 naming the state for the first three, 422 for the next three, 403, 403, 404 and 404, each with a problem response and no state change; a Workspace admin is admitted like an Operator (SCN-RuntimeEnvironmentService-005, ADR-0015).",
        "AC3: Given an accepted and a rejected proposal, when the dispatcher publishes `RuntimeEnvironmentService/ReconciliationDecided` on `provisioning.inventory.v1.reconciliation-decided`, then each is sent under the run event envelope with `proposalId`, `tenantId`, `environmentId` and `state`, the accepted one with the `provisioningRunId` assigned on acceptance and stored on the proposal and the rejected one without it, and a transport outage is retried with backoff so the event is neither lost nor published twice under its event id (SCN-RuntimeEnvironmentService-010, ADR-0012).",
        "AC4: Given an Accepted proposal with its `provisioningRunId`, when a fixture `IaCProvisioningService/ProvisioningApplied` carrying that `provisioningRunId` arrives, then the proposal is Applied and the event delivered again changes nothing; given a `IaCProvisioningService/ProvisioningApplied` of another `provisioningRunId` or a `IaCProvisioningService/ProvisioningFailed` of the same, then the proposal stays Accepted with its findings open and attached to it, and no new proposal is raised for them (SCN-RuntimeEnvironmentService-010, model/services/runtime-cloud/RuntimeEnvironmentService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-332",
        "AIFACTORY-TASK-4340",
        "AIFACTORY-TASK-4341",
        "AIFACTORY-TASK-4342"
      ],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10106,
      "kind": "behavior",
      "traces": {
        "services": [
          "RuntimeEnvironmentService",
          "IaCProvisioningService"
        ],
        "aggregates": [
          "RuntimeEnvironmentService/ReconciliationProposal"
        ],
        "apis": [
          "RuntimeEnvironmentService/DecideReconciliation"
        ],
        "events": [
          "RuntimeEnvironmentService/ReconciliationDecided",
          "IaCProvisioningService/ProvisioningApplied",
          "IaCProvisioningService/ProvisioningFailed"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-09",
          "FUX-05"
        ],
        "scenarios": [
          "SCN-RuntimeEnvironmentService-005",
          "SCN-RuntimeEnvironmentService-010"
        ]
      },
      "relates": {
        "screens": [
          "inventory"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1080",
        "feature:ia-cprovisioning-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/execution/environments/services/runtime-environment-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1081]",
      "number": 1081
    },
    {
      "id": "AIFACTORY-TASK-332",
      "type": "task",
      "parent": "AIFACTORY-US-1081",
      "title": "Reconciliation decisions with their refusals and the ReconciliationDecided outbox record",
      "sequence": "09.05.06.01",
      "description": "Reconciliation decisions with their refusals and the ReconciliationDecided outbox record. Expected output: DecideReconciliation admits the Operator role and the roles above it in the order of D114, Workspace admin and Platform admin, moves a Proposed proposal to Accepted or Rejected with decidedBy and a required reason for a rejection under the row version of the proposal, assigns a new provisioningRunId on acceptance and stores it on the proposal, writes ReconciliationDecided with that id for an accepted proposal in the same transaction, repeats the same decision idempotently, answers 422 for a rejection without a reason, an unknown decision value or a malformed body, 409 naming the state for a different decision, 404 for a proposal of another tenant as for an unknown id and 403 for a missing scope or a role below Operator or not comparable with it, and neither decides nor requests an approval.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "DecideReconciliation admits the Operator role and the roles above it in the order of D114, Workspace admin and Platform admin, moves a Proposed proposal to Accepted or Rejected with decidedBy and a required reason for a rejection under the row version of the proposal, assigns a new provisioningRunId on acceptance and stores it on the proposal, writes ReconciliationDecided with that id for an accepted proposal in the same transaction, repeats the same decision idempotently, answers 422 for a rejection without a reason, an unknown decision value or a malformed body, 409 naming the state for a different decision, 404 for a proposal of another tenant as for an unknown id and 403 for a missing scope or a role below Operator or not comparable with it, and neither decides nor requests an approval."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-332]",
      "number": 332
    },
    {
      "id": "AIFACTORY-TASK-4340",
      "type": "task",
      "parent": "AIFACTORY-US-1081",
      "title": "Transition Accepted to Applied from ProvisioningApplied by the provisioningRunId of the proposal",
      "sequence": "09.05.06.02",
      "description": "Transition Accepted to Applied from ProvisioningApplied by the provisioningRunId of the proposal. Expected output: The handler of ProvisioningApplied moves the Accepted proposal whose stored provisioningRunId equals the provisioningRunId of the event to Applied, idempotently on the event id; an event of another provisioningRunId or a ProvisioningFailed leaves the proposal Accepted with its findings open and attached to it, and raises no new proposal.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "The handler of ProvisioningApplied moves the Accepted proposal whose stored provisioningRunId equals the provisioningRunId of the event to Applied, idempotently on the event id; an event of another provisioningRunId or a ProvisioningFailed leaves the proposal Accepted with its findings open and attached to it, and raises no new proposal."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4340]",
      "number": 4340
    },
    {
      "id": "AIFACTORY-TASK-4341",
      "type": "task",
      "parent": "AIFACTORY-US-1081",
      "title": "Contract of ReconciliationDecided against the run event envelope",
      "sequence": "09.05.06.03",
      "description": "Contract of ReconciliationDecided against the run event envelope. Expected output: Golden files fix ReconciliationDecided on provisioning.inventory.v1.reconciliation-decided under run-event-envelope-v1 with proposalId, tenantId, environmentId and state, one for an accepted proposal with the provisioningRunId assigned on acceptance and one for a rejected proposal without it; a contract test fails when the serialised event differs from its file.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "Golden files fix ReconciliationDecided on provisioning.inventory.v1.reconciliation-decided under run-event-envelope-v1 with proposalId, tenantId, environmentId and state, one for an accepted proposal with the provisioningRunId assigned on acceptance and one for a rejected proposal without it; a contract test fails when the serialised event differs from its file."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10106,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4341]",
      "number": 4341
    },
    {
      "id": "AIFACTORY-TASK-4342",
      "type": "task",
      "parent": "AIFACTORY-US-1081",
      "title": "Verify decide-a-reconciliation-proposal through the acceptance suite",
      "sequence": "09.05.06.04",
      "description": "Verify decide-a-reconciliation-proposal through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-005|Scenario=SCN-RuntimeEnvironmentService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1081, including the idempotent repeat, the 422 of an invalid decision, the 409 naming the state, the admission of a Workspace admin, the provisioningRunId assigned on acceptance and matched by ProvisioningApplied, the proposal left Accepted after a failed run and the publication and payload of ReconciliationDecided; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RuntimeEnvironmentService-005|Scenario=SCN-RuntimeEnvironmentService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1081, including the idempotent repeat, the 422 of an invalid decision, the 409 naming the state, the admission of a Workspace admin, the provisioningRunId assigned on acceptance and matched by ProvisioningApplied, the proposal left Accepted after a failed run and the publication and payload of ReconciliationDecided; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:runtime-cloud",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RuntimeEnvironmentService"
      ],
      "children": [],
      "buildOrder": 101,
      "phase": "factory",
      "stackRank": 10106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4342]",
      "number": 4342
    },
    {
      "id": "AIFACTORY-EPIC-010",
      "type": "epic",
      "parent": null,
      "title": "Product Fleet Operations (PF-10)",
      "sequence": "10",
      "description": "Everything that builds the Product Fleet Operations platform (PF-10): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Operating generated products as a managed service — fleet inventory, SLOs, incidents, upgrade rollouts, off-boarding (decision D33). Done when: Every service of the platform has its complete delivery accepted (FleetIncidentService, FleetInventoryService, FleetOperationsHost, FleetRolloutService), the platform gateway routes them under a trusted scope, and the outcome verification of I7 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (FleetIncidentService, FleetInventoryService, FleetOperationsHost, FleetRolloutService), the platform gateway routes them under a trusted scope, and the outcome verification of I7 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:fleet-operations",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-051",
        "AIFACTORY-FEAT-052",
        "AIFACTORY-FEAT-053",
        "AIFACTORY-FEAT-054"
      ],
      "stackRank": 17499,
      "titlePrefix": "[AIFACTORY-EPIC-010]",
      "number": 10
    },
    {
      "id": "AIFACTORY-FEAT-051",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-010",
      "title": "FleetIncidentService: complete delivery",
      "sequence": "10.01",
      "description": "FleetIncidentService is the service of bounded context BC-37 (Fleet Incidents & Off-boarding). Incidents on operated products with severity, timeline, linked alerts, runs and rollouts, on-call records per edition, customer notifications through connectors and post-incident reviews; and off-boarding of a customer tenant or a whole product with data handover through export and deletion orders (BC-37, D33). Its own repository is ConnectSoft.AI.SoftwareFactory.FleetIncidentService. Delivers: FleetIncidentService (complete). Increment I7: Operate and commercialise. Build order 175 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/fleet-operations/FleetIncidentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:fleet-operations",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 175,
      "phase": "factory",
      "stackRank": 17500,
      "titlePrefix": "[AIFACTORY-FEAT-051]",
      "number": 51
    },
    {
      "id": "AIFACTORY-FEAT-052",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-010",
      "title": "FleetInventoryService: complete delivery",
      "sequence": "10.02",
      "description": "FleetInventoryService is the service of bounded context BC-35 (Fleet Inventory & SLOs). The inventory of every generated product ConnectSoft operates — product, its instances per customer tenant and environment, the release each instance runs, the template and library versions it was generated from, its managed-service edition, objectives and health — derived from delivery, runtime cloud and observability events and the product's own health endpoints (BC-35, D33). Its own repository is ConnectSoft.AI.SoftwareFactory.FleetInventoryService. Delivers: FleetInventoryService (complete). Increment I7: Operate and commercialise. Build order 176 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/fleet-operations/FleetInventoryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:fleet-operations",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 176,
      "phase": "factory",
      "stackRank": 17600,
      "titlePrefix": "[AIFACTORY-FEAT-052]",
      "number": 52
    },
    {
      "id": "AIFACTORY-FEAT-053",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-010",
      "title": "FleetOperationsHost: gateway delivery",
      "sequence": "10.03",
      "description": "FleetOperationsHost is the platform API gateway of bounded context BC-35 (Fleet Inventory & SLOs). The API gateway of the Product Fleet Operations platform (ADR-0028): routes public REST and internal gRPC calls to the 3 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.FleetOperationsHost. Delivers: FleetOperationsHost (complete). Increment I7: Operate and commercialise. Build order 177 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/fleet-operations/FleetOperationsHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:fleet-operations",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 177,
      "phase": "factory",
      "stackRank": 17700,
      "titlePrefix": "[AIFACTORY-FEAT-053]",
      "number": 53
    },
    {
      "id": "AIFACTORY-FEAT-054",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-010",
      "title": "FleetRolloutService: complete delivery",
      "sequence": "10.04",
      "description": "FleetRolloutService is the service of bounded context BC-36 (Fleet Upgrades & Rollouts). Rollouts of a product release, a template or library upgrade, or a re-scaffold across the instances of an operated product in waves — each wave a set of promotions with the same gates, a bake time against the product's objectives, automatic halt and rollback on breach, and a production-class approval for production waves (BC-36). Its own repository is ConnectSoft.AI.SoftwareFactory.FleetRolloutService. Delivers: FleetRolloutService (complete). Increment I7: Operate and commercialise. Build order 178 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/fleet-operations/FleetRolloutService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:fleet-operations",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 178,
      "phase": "factory",
      "stackRank": 17800,
      "titlePrefix": "[AIFACTORY-FEAT-054]",
      "number": 54
    },
    {
      "id": "AIFACTORY-EPIC-011",
      "type": "epic",
      "parent": null,
      "title": "Data & Event Platform (PF-11)",
      "sequence": "11",
      "description": "Everything that builds the Data & Event Platform platform (PF-11): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Store profiles, event envelope and topics, outbox and inbox per messaging profile, retention and residency. Done when: Every service of the platform has its complete delivery accepted (DataEventFoundations, EnvelopeRegistryService, RetentionResidencyService, StoreProfileService), the platform gateway routes them under a trusted scope, and the outcome verification of I4 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (DataEventFoundations, EnvelopeRegistryService, RetentionResidencyService, StoreProfileService), the platform gateway routes them under a trusted scope, and the outcome verification of I4 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-055",
        "AIFACTORY-FEAT-056",
        "AIFACTORY-FEAT-057",
        "AIFACTORY-FEAT-058"
      ],
      "stackRank": 12499,
      "titlePrefix": "[AIFACTORY-EPIC-011]",
      "number": 11
    },
    {
      "id": "AIFACTORY-FEAT-055",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-011",
      "title": "DataEventFoundations: gateway delivery",
      "sequence": "11.01",
      "description": "DataEventFoundations is the platform API gateway of bounded context BC-42 (Data & Event Foundations). The API gateway of the Data & Event platform (ADR-0028): routes public REST and internal gRPC calls to the 3 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.DataEventFoundations. Delivers: DataEventFoundations (complete). Increment I4: Trust and accountability. Build order 125 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-086",
        "AIFACTORY-US-1441",
        "AIFACTORY-US-1442",
        "AIFACTORY-US-1443",
        "AIFACTORY-US-1444",
        "AIFACTORY-US-1445"
      ],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12500,
      "titlePrefix": "[AIFACTORY-FEAT-055]",
      "number": 55
    },
    {
      "id": "AIFACTORY-US-086",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-055",
      "title": "DataEventFoundations routes its platform's calls under a trusted scope",
      "sequence": "11.01.01",
      "description": "As a platform admin, I want one gateway in front of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService that validates tokens and scopes, so that no service of the platform is reachable except through its gateway and every call arrives with a scope it can trust. This is the integration PBI of the Data & Event gateway. ADR-0028 makes DataEventFoundations the API gateway of its platform: it routes public REST and internal gRPC calls to the three services the model lists under `deployment.fronts` (EnvelopeRegistryService, RetentionResidencyService and StoreProfileService), validates tokens and scopes and owns no business state. The repository ConnectSoft.AI.SoftwareFactory.DataEventFoundations is created by the repository checklist of feature `repository-and-pipeline-conventions` and scaffolded from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform, which fixes persistence, messaging and the actor model to none: the gateway has no relational store, no outbox and no inbox and consumes no event (ADR-0028 amendment on gateways and events). The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package, never copied. The gateway forwards the user token to the fronted service unchanged and exchanges no token, and the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). The feature is delivered by five PBIs: the fronts file and the routes generated from it (AIFACTORY-US-1441), token, tenant and scope on every read route and on the internal gRPC routes (AIFACTORY-US-1442), the pass-through of a shared-write call (AIFACTORY-US-1443), the production routes whose gate stays in the fronted service (AIFACTORY-US-1444), and health, profiles, limits and telemetry with the three failure modes of a gateway (AIFACTORY-US-1445). None of the routes of this platform names a project in its path; the tenant comes from the token, and a route that names a resource id (a topic, a store, an order) is forwarded under the tenant of the token, the fronted service answering 404 for a resource of another tenant (ADR-0015 amendment D113). The three fronted services are delivered in the same increment, so every route reaches its real service. The gateway invents no response. Kind: enabling. Traces: services: DataEventFoundations, EnvelopeRegistryService, RetentionResidencyService, StoreProfileService; apis: DataEventFoundations/DataEventHealth; adrs: ADR-0006, ADR-0012, ADR-0013, ADR-0015, ADR-0017, ADR-0018, ADR-0028; requirements: FR-10, FR-12. Depends on: AIFACTORY-US-1441, AIFACTORY-US-1442, AIFACTORY-US-1443, AIFACTORY-US-1444, AIFACTORY-US-1445, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai. Sources: model/services/data-event/DataEventFoundations.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/data-event/services/data-event-foundations/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.DataEventFoundations, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DataEventFoundations --UseFactoryProfile true --GatewayRole Platform` 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 tests pass and a container image is published (ADR-0028, model/services/data-event/DataEventFoundations.yaml).",
        "AC2: Given a valid token for a route of each of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService, when the call passes the gateway, then the scope is established once from the token, the call is forwarded with the user token unchanged, the tenant and the correlation id, the fronted service answers and the response returns unchanged, as AIFACTORY-US-1442 to AIFACTORY-US-1444 prove per route class (ADR-0015, model/scenarios/DataEventFoundations.yaml).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, and no event of the model lists DataEventFoundations as a consumer (ADR-0028, model/services/data-event/DataEventFoundations.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `DataEventFoundations/DataEventHealth` is probed and one replica is stopped, then health reports the identity platform and the three fronted services, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/data-event/DataEventFoundations.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/data-event/services/data-event-foundations/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-371",
        "AIFACTORY-TASK-5861",
        "AIFACTORY-TASK-703"
      ],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12501,
      "kind": "enabling",
      "traces": {
        "services": [
          "DataEventFoundations",
          "EnvelopeRegistryService",
          "RetentionResidencyService",
          "StoreProfileService"
        ],
        "apis": [
          "DataEventFoundations/DataEventHealth"
        ],
        "adrs": [
          "ADR-0006",
          "ADR-0012",
          "ADR-0013",
          "ADR-0015",
          "ADR-0017",
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "FR-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1441",
        "AIFACTORY-US-1442",
        "AIFACTORY-US-1443",
        "AIFACTORY-US-1444",
        "AIFACTORY-US-1445",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/services/data-event/DataEventFoundations.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/data-event/services/data-event-foundations/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-086]",
      "number": 86
    },
    {
      "id": "AIFACTORY-TASK-371",
      "type": "task",
      "parent": "AIFACTORY-US-086",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.DataEventFoundations and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the Factory profile and the Platform role",
      "sequence": "11.01.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.DataEventFoundations and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the Factory profile and the Platform role. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DataEventFoundations --UseFactoryProfile true --GatewayRole Platform` from the pinned template package is committed unchanged, the repository records the template version, the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DataEventFoundations --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.DataEventFoundations --UseFactoryProfile true --GatewayRole Platform` from the pinned template package is committed unchanged, the repository records the template version, the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-371]",
      "number": 371
    },
    {
      "id": "AIFACTORY-TASK-5861",
      "type": "task",
      "parent": "AIFACTORY-US-086",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "11.01.01.02",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 4, the ports https 8110 and grpc 8112, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/data-event/DataEventFoundations.yaml records them, and leaves DataEvent:Host:FrontedServices at its modelled default; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 4, the ports https 8110 and grpc 8112, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/data-event/DataEventFoundations.yaml records them, and leaves DataEvent:Host:FrontedServices at its modelled default; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies with the identity authority of the profile (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12501,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5861]",
      "number": 5861
    },
    {
      "id": "AIFACTORY-TASK-703",
      "type": "task",
      "parent": "AIFACTORY-US-086",
      "title": "Verify data-event-foundations-routes-its-platform by running the declared command",
      "sequence": "11.01.01.03",
      "description": "Verify data-event-foundations-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, then `dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-086: the scaffold of the Platform role, the scope established once and forwarded, the architecture test, and two gateway instances behind one test balancer with the fakes of the fronted services, one of them stopped while the other keeps serving and no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, then `dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-086: the scaffold of the Platform role, the scope established once and forwarded, the architecture test, and two gateway instances behind one test balancer with the fakes of the fronted services, one of them stopped while the other keeps serving and no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-703]",
      "number": 703
    },
    {
      "id": "AIFACTORY-US-1441",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-055",
      "title": "Data & Event fronts file: named clients and REST and gRPC routes of the three fronted services, generated at build",
      "sequence": "11.01.02",
      "description": "As a platform admin, I want the route table of the Data & Event gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Data & Event platform. It lists the three services of `deployment.fronts` in model/services/data-event/DataEventFoundations.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: the five REST operations and two gRPC methods of EnvelopeRegistryService, the seven REST operations and one gRPC method of RetentionResidencyService and the three REST operations and one gRPC method of StoreProfileService, each with name, method and path or gRPC method, scope, side-effect class and idempotency. A test lists the emitted route table against the file and against the three service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404 and reaches no service. The gateway adds no operation of its own beyond `DataEventHealth` and `DataEventProfiles` and transforms no payload. The option `DataEvent:Host:FrontedServices` is bound at startup and compared with the fronts file through the short name each service carries in the file, as the modelled default lists them: `envelopes` for EnvelopeRegistryService, `stores` for StoreProfileService and `retention` for RetentionResidencyService. A value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable. The typed client of this gateway belongs to this feature (D140): one library in the repository `ConnectSoft.AI.SoftwareFactory.Clients`, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the user-token layout by the rules of feature `typed-gateway-clients` (AIFACTORY-US-381 to AIFACTORY-US-383), which it applies and does not repeat. This gateway publishes no OpenAPI document of its own, so the input of the library is a document written contract-first in the client repository from the intake of the model, as that feature does for a gateway that publishes none. The library holds the fourteen public REST operations of the three services: of EnvelopeRegistryService `ListTopics`, `GetTopic`, `RegisterTopic`, `PublishSchemaVersion` and `ListEnvelopeProfiles`; of RetentionResidencyService `ListRetentionRules`, `SetRetentionRule`, `GetResidency`, `SetResidency`, `IssueGovernanceOrder` and `GetGovernanceOrder`; of StoreProfileService `ListStoreBindings`, `ListStoreProfiles` and `SetStoreBinding`. The internal REST route `AcknowledgeOrderTask` and the four gRPC methods are not in it. It is checked against the model by the contract check of that feature, takes the shared types from the pinned contracts package, attaches the token issued for this gateway only to requests to the base address of this gateway, is versioned with the contracts package, published to the ConnectSoft feed and recorded on the Runbook page with the consumer that pins it. The caller of the package is StudioBff, which holds a user token and reads this gateway through a static stub in I3 (AIFACTORY-TASK-5485) until this package exists; no caller writes a client of this gateway by hand. In this feature StudioBff replaces that static stub with the pinned client package, so a screen whose source is a service fronted by this gateway shows its data and freshness instead of Unknown (AIFACTORY-TASK-6641, D141). Kind: enabling. Traces: services: DataEventFoundations, EnvelopeRegistryService, RetentionResidencyService, StoreProfileService, StudioBff; adrs: ADR-0015, ADR-0028; requirements: FR-10. Depends on: feature:component-api-gateway-template, feature:envelope-registry-service, feature:retention-residency-service, feature:store-profile-service, feature:typed-gateway-clients, feature:component-api-library-template-factory-clients, feature:studio-bff. Sources: model/services/data-event/DataEventFoundations.yaml, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, model/services/data-event/EnvelopeRegistryService.yaml, model/services/data-event/RetentionResidencyService.yaml, model/services/data-event/StoreProfileService.yaml, docs/architecture/catalogs/gateways.md.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Data & Event platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of the three services, each with the scope, side-effect class and idempotency of the operation, and the route table test passes against model/services/data-event/DataEventFoundations.yaml and the service files it fronts (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `DataEvent:Host:FrontedServices` at its default `[envelopes, stores, retention]`, when the gateway starts, then startup succeeds; given a value that differs from the short names of the fronts file, when the gateway starts, then startup fails with the differing name; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (model/services/data-event/DataEventFoundations.yaml, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, which carries the token of the caller unchanged, the tenant, the correlation id and the trace context, and the response of the fake returns unchanged (ADR-0015, FR-10).",
        "AC4: Given the contract-first OpenAPI document of this gateway and the pinned API library template, when the client of this gateway is generated, built and published in the repository ConnectSoft.AI.SoftwareFactory.Clients, then it holds the fourteen public REST operations in the user-token layout, without `AcknowledgeOrderTask` and without a gRPC method, the contract check against the three service files under model/services/data-event passes, the token issued for DataEventFoundations is attached only to requests to its base address, and the package is on the ConnectSoft feed with a version tied to the contracts package and recorded on the Runbook page with StudioBff as its consumer (model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, ADR-0015).",
        "AC5: Given the client package of DataEventFoundations published by AIFACTORY-TASK-6604, when StudioBff is built with that package pinned, then the static stub of DataEventFoundations of AIFACTORY-TASK-5485 is removed, StudioBff reads the gateway through the package with the user token issued for DataEventFoundations, attached only to requests to its base address, and a screen whose source is EnvelopeRegistryService, RetentionResidencyService or StoreProfileService shows the data and freshness of that source instead of Unknown (D141, model/backlog/pbis/factory-studio/studio-bff.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "model/services/data-event/StoreProfileService.yaml",
        "docs/architecture/catalogs/gateways.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-372",
        "AIFACTORY-TASK-5851",
        "AIFACTORY-TASK-5852",
        "AIFACTORY-TASK-6604",
        "AIFACTORY-TASK-6641"
      ],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12502,
      "kind": "enabling",
      "traces": {
        "services": [
          "DataEventFoundations",
          "EnvelopeRegistryService",
          "RetentionResidencyService",
          "StoreProfileService",
          "StudioBff"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:envelope-registry-service",
        "feature:retention-residency-service",
        "feature:store-profile-service",
        "feature:typed-gateway-clients",
        "feature:component-api-library-template-factory-clients",
        "feature:studio-bff"
      ],
      "source": [
        "model/services/data-event/DataEventFoundations.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "model/services/data-event/StoreProfileService.yaml",
        "docs/architecture/catalogs/gateways.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1441]",
      "number": 1441
    },
    {
      "id": "AIFACTORY-TASK-372",
      "type": "task",
      "parent": "AIFACTORY-US-1441",
      "title": "Fronts file with the REST and gRPC operations of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService",
      "sequence": "11.01.02.01",
      "description": "Fronts file with the REST and gRPC operations of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService. Expected output: The fronts file lists the three services of deployment.fronts with their short names envelopes, retention and stores, their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class and idempotency; the build emits the named clients, the routes and the route table; at startup the option DataEvent:Host:FrontedServices is compared with the short names of the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the three services of deployment.fronts with their short names envelopes, retention and stores, their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, scope, side-effect class and idempotency; the build emits the named clients, the routes and the route table; at startup the option DataEvent:Host:FrontedServices is compared with the short names of the fronts file and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-372]",
      "number": 372
    },
    {
      "id": "AIFACTORY-TASK-5851",
      "type": "task",
      "parent": "AIFACTORY-US-1441",
      "title": "Fakes of the three fronted services and the token matrix of the acceptance suite",
      "sequence": "11.01.02.02",
      "description": "Fakes of the three fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers it received and answers a configured status, a switch that makes a fake stop answering, and tokens for the matrix of role and tenant, including an expired token, an identity token, a user token of another audience and a workload token with and without the scope of each internal route, the four gRPC methods and the internal REST route of RetentionResidencyService/AcknowledgeOrderTask, and of the production routes that admit a workload caller.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers it received and answers a configured status, a switch that makes a fake stop answering, and tokens for the matrix of role and tenant, including an expired token, an identity token, a user token of another audience and a workload token with and without the scope of each internal route, the four gRPC methods and the internal REST route of RetentionResidencyService/AcknowledgeOrderTask, and of the production routes that admit a workload caller."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5851]",
      "number": 5851
    },
    {
      "id": "AIFACTORY-TASK-5852",
      "type": "task",
      "parent": "AIFACTORY-US-1441",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "11.01.02.03",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1441: one route per operation of model/services/data-event/EnvelopeRegistryService.yaml, model/services/data-event/RetentionResidencyService.yaml and model/services/data-event/StoreProfileService.yaml, the failing builds, the start with the option at its default, the failing startup on a differing value, the 404 of an unknown path and one forwarded call per service and protocol; AC4 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6604.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1441: one route per operation of model/services/data-event/EnvelopeRegistryService.yaml, model/services/data-event/RetentionResidencyService.yaml and model/services/data-event/StoreProfileService.yaml, the failing builds, the start with the option at its default, the failing startup on a differing value, the 404 of an unknown path and one forwarded call per service and protocol; AC4 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6604."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5852]",
      "number": 5852
    },
    {
      "id": "AIFACTORY-TASK-6604",
      "type": "task",
      "parent": "AIFACTORY-US-1441",
      "title": "Typed client of DataEventFoundations in the user-token layout from a contract-first document, published to the ConnectSoft feed",
      "sequence": "11.01.02.04",
      "description": "Typed client of DataEventFoundations in the user-token layout from a contract-first document, published to the ConnectSoft feed. Expected output: The client repository ConnectSoft.AI.SoftwareFactory.Clients holds one OpenAPI document of DataEventFoundations with its content hash, written contract-first from the intake of the model like the documents of AIFACTORY-TASK-1556 and covered by its contract check; one client library generated from it with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template holds the fourteen public REST operations of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService, without AcknowledgeOrderTask and without a gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; a stub of the gateway in the fixture of the client solution answers 401, 403, 404 and a redirect to a second host, and the token issued for DataEventFoundations is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with StudioBff as the consumer that pins it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The client repository ConnectSoft.AI.SoftwareFactory.Clients holds one OpenAPI document of DataEventFoundations with its content hash, written contract-first from the intake of the model like the documents of AIFACTORY-TASK-1556 and covered by its contract check; one client library generated from it with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template holds the fourteen public REST operations of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService, without AcknowledgeOrderTask and without a gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; a stub of the gateway in the fixture of the client solution answers 401, 403, 404 and a redirect to a second host, and the token issued for DataEventFoundations is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with StudioBff as the consumer that pins it."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6604]",
      "number": 6604
    },
    {
      "id": "AIFACTORY-TASK-6641",
      "type": "task",
      "parent": "AIFACTORY-US-1441",
      "title": "Replace the I3 static stub of DataEventFoundations in StudioBff with the pinned client package",
      "sequence": "11.01.02.05",
      "description": "Replace the I3 static stub of DataEventFoundations in StudioBff with the pinned client package. Expected output: StudioBff pins the client package of DataEventFoundations that AIFACTORY-TASK-6604 published to the ConnectSoft feed, registers it with the base address of the gateway and the user token issued for DataEventFoundations as its one audience, and removes the static stub of DataEventFoundations of AIFACTORY-TASK-5485, so the read models of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService that a screen names are read through the gateway and show their data and freshness instead of Unknown; the static stub of FleetOperationsHost stays until I7; no client of the gateway is written by hand; the tests of the StudioBff solution prove AC5 of AIFACTORY-US-1441 (D141).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff pins the client package of DataEventFoundations that AIFACTORY-TASK-6604 published to the ConnectSoft feed, registers it with the base address of the gateway and the user token issued for DataEventFoundations as its one audience, and removes the static stub of DataEventFoundations of AIFACTORY-TASK-5485, so the read models of EnvelopeRegistryService, RetentionResidencyService and StoreProfileService that a screen names are read through the gateway and show their data and freshness instead of Unknown; the static stub of FleetOperationsHost stays until I7; no client of the gateway is written by hand; the tests of the StudioBff solution prove AC5 of AIFACTORY-US-1441 (D141)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6641]",
      "number": 6641
    },
    {
      "id": "AIFACTORY-US-1442",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-055",
      "title": "A read route of the Data & Event platform forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "11.01.03",
      "description": "As an observer or a workload of another platform, I want my reads of topics, stores, rules and orders to reach the service only with the tenant and scope my token grants, so that nobody reads the data governance of another tenant through the gateway. A caller reaches a read operation of the Data & Event platform through the gateway: an observer lists topics, store bindings, retention rules or reads an order, StudioBff serves the views `topic-registry`, `stores`, `retention-residency` and `governance-orders`, and the hosts of every platform call the internal gRPC methods `Envelopes.ResolveTopic`, `Envelopes.ValidateEnvelope`, `Stores.ResolveBinding` and `Retention.EvaluateResidency`, all of side-effect class read. A user presents an access token whose one audience is this gateway (ADR-0015 amendment D114); a workload presents a workload token, which carries service scopes, no audience of a user API and no tenant claim, and is admitted on the internal routes, meaning the four gRPC methods above and the internal REST route of `RetentionResidencyService/AcknowledgeOrderTask` (AIFACTORY-US-1443), when it holds the scope that the route names, and on the production routes whose model names a workload caller, the release pipeline on `RegisterTopic` and `PublishSchemaVersion` and provisioning on `SetStoreBinding`, under the same rule (AIFACTORY-US-1444). The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names (`factory.data.read` on the REST reads). For a user token it takes the tenant from the `tid` claim and overwrites any tenant header of the caller; for a workload token that holds the service scope it forwards the `tenant-id` metadata of the caller unchanged, because the fronted service reads a forwarded tenant only under that scope (D114), and without the scope the answer is PERMISSION_DENIED and no service is called. The user token is forwarded unchanged and no token is exchanged (D117). The fronted service serves the read with no side effect; the gateway returns the response unchanged with the correlation id and keeps nothing. A call without a token, with an expired token, with an identity token or with a user token of another gateway is answered 401 and a token without the scope 403, and no fronted service is called. No route of this platform names a project or a tenant in its path, so the gateway refuses no project itself: a route addressed by a topic, a store or an order id is forwarded under the tenant of the token, and the 404 the fronted service gives for a resource of another tenant, the same answer as for an id that does not exist (ADR-0015 amendment D113), returns unchanged. When the fronted service does not answer, its routes answer 503 with a retry hint and the routes of the other services keep serving. Kind: behavior. Traces: services: DataEventFoundations, EnvelopeRegistryService, RetentionResidencyService, StoreProfileService; apis: EnvelopeRegistryService/Envelopes.ResolveTopic, EnvelopeRegistryService/Envelopes.ValidateEnvelope, StoreProfileService/Stores.ResolveBinding, RetentionResidencyService/Retention.EvaluateResidency; adrs: ADR-0015, ADR-0028; requirements: FR-10, NFR-14; scenarios: SCN-DataEventFoundations-004. Relates: screens: topic-registry, stores, retention-residency, governance-orders. Depends on: AIFACTORY-US-1441, feature:component-api-gateway-template, feature:component-extensions-ai, feature:envelope-registry-service, feature:retention-residency-service, feature:store-profile-service. Sources: model/services/data-event/DataEventFoundations.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway with `factory.data.read`, when a read route of each fronted service is called, then the gateway forwards the call with the user token unchanged, the tenant of the `tid` claim, the correlation id and the trace context, the fronted service answers and the response returns unchanged, and nothing is written by the gateway (SCN-DataEventFoundations-004, ADR-0015).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without `factory.data.read` 403, and no fronted service is called; given a route addressed by a topic, a store id or an order id of another tenant, when it is called, then the gateway forwards it under the tenant of the token and the 404 of the fronted service returns unchanged (SCN-DataEventFoundations-004, ADR-0015).",
        "AC3: Given a user token and a tenant header of the caller that names another tenant, when a read route is called, then the header is overwritten with the `tid` claim; given a workload token on the gRPC route of `EnvelopeRegistryService/Envelopes.ResolveTopic`, `EnvelopeRegistryService/Envelopes.ValidateEnvelope`, `StoreProfileService/Stores.ResolveBinding` or `RetentionResidencyService/Retention.EvaluateResidency`, when the token holds the service scope of the method, then the `tenant-id` metadata is forwarded unchanged, and when it lacks the scope the answer is PERMISSION_DENIED and no fronted service is called (SCN-DataEventFoundations-004, ADR-0015).",
        "AC4: Given a fronted service that does not answer, when one of its read routes is called, then the gateway answers 503 with a problem response that carries a retry hint and names the service and never its address, invents no response, and the read routes of the other two services keep serving (SCN-DataEventFoundations-004, model/services/data-event/DataEventFoundations.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5853",
        "AIFACTORY-TASK-5854"
      ],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12503,
      "kind": "behavior",
      "traces": {
        "services": [
          "DataEventFoundations",
          "EnvelopeRegistryService",
          "RetentionResidencyService",
          "StoreProfileService"
        ],
        "apis": [
          "EnvelopeRegistryService/Envelopes.ResolveTopic",
          "EnvelopeRegistryService/Envelopes.ValidateEnvelope",
          "StoreProfileService/Stores.ResolveBinding",
          "RetentionResidencyService/Retention.EvaluateResidency"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "NFR-14"
        ],
        "scenarios": [
          "SCN-DataEventFoundations-004"
        ]
      },
      "relates": {
        "screens": [
          "topic-registry",
          "stores",
          "retention-residency",
          "governance-orders"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1441",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:envelope-registry-service",
        "feature:retention-residency-service",
        "feature:store-profile-service"
      ],
      "source": [
        "model/services/data-event/DataEventFoundations.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1442]",
      "number": 1442
    },
    {
      "id": "AIFACTORY-TASK-5853",
      "type": "task",
      "parent": "AIFACTORY-US-1442",
      "title": "Issuer, audience, tenant and workload scope configuration of the read routes",
      "sequence": "11.01.03.01",
      "description": "Issuer, audience, tenant and workload scope configuration of the read routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; every REST read route requires factory.data.read; a workload token is admitted on the internal routes, the four gRPC methods and the internal REST route of AcknowledgeOrderTask, and on the production routes of RegisterTopic, PublishSchemaVersion and SetStoreBinding, only when it holds the scope that the route names, and on no other route; for a user token the tenant header is overwritten with the tid claim, for a workload token that holds the service scope the tenant-id metadata of the caller is forwarded unchanged, and a workload token without the scope is answered PERMISSION_DENIED before any call; routes addressed by a resource id are forwarded under the tenant of the token; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; every REST read route requires factory.data.read; a workload token is admitted on the internal routes, the four gRPC methods and the internal REST route of AcknowledgeOrderTask, and on the production routes of RegisterTopic, PublishSchemaVersion and SetStoreBinding, only when it holds the scope that the route names, and on no other route; for a user token the tenant header is overwritten with the tid claim, for a workload token that holds the service scope the tenant-id metadata of the caller is forwarded unchanged, and a workload token without the scope is answered PERMISSION_DENIED before any call; routes addressed by a resource id are forwarded under the tenant of the token; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5853]",
      "number": 5853
    },
    {
      "id": "AIFACTORY-TASK-5854",
      "type": "task",
      "parent": "AIFACTORY-US-1442",
      "title": "Verify the read routes through the acceptance suite",
      "sequence": "11.01.03.02",
      "description": "Verify the read routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DataEventFoundations-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1442 over the token matrix, the token received by the fake equal to the user token of the caller, the 404 of a fake for a resource of another tenant returned unchanged, the overwritten tenant header, a workload token with and without the service scope on the four gRPC read routes, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DataEventFoundations-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1442 over the token matrix, the token received by the fake equal to the user token of the caller, the 404 of a fake for a resource of another tenant returned unchanged, the overwritten tenant header, a workload token with and without the service scope on the four gRPC read routes, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5854]",
      "number": 5854
    },
    {
      "id": "AIFACTORY-US-1443",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-055",
      "title": "A shared-write route of the Data & Event platform is forwarded unchanged and the gateway keeps nothing between calls",
      "sequence": "11.01.04",
      "description": "As a workspace admin, or an owning service acknowledging an order, I want a rule change or an acknowledgement I repeat after a failure to be applied once, so that a lost answer or a restarted gateway never changes a retention rule or an order task twice. Two operations of the platform are of class shared-write, both fronted on RetentionResidencyService: `SetRetentionRule`, which a Workspace admin calls with `factory.data.admin` to shorten a retention of the tenant and a Platform admin calls to set a platform default, and `AcknowledgeOrderTask`, which an owning service calls with its workload token and `factory.data.acknowledge` to acknowledge its task of a governance order with a receipt. Both declare idempotency natural: the same PUT of a rule and the same acknowledgement repeated change nothing the second time, and no `Idempotency-Key` is needed; a key the caller sends anyway is forwarded unchanged. The gateway validates the token under the rules of AIFACTORY-US-1442, takes the tenant from the `tid` claim of a user token or forwards the tenant of a workload token that holds `factory.data.acknowledge` (ADR-0015 amendment D114), and forwards body and headers unchanged. It is no party to idempotency: it stores neither a request nor a result, keeps no session and no pending call, has no outbox and writes no event, so a replica that crashes during a call loses nothing; the replica restarts, nothing is replayed, and the caller repeats the call and receives the answer of the one application. When RetentionResidencyService does not answer, the route answers 503 with a retry hint that names the service. A refusal by the gateway (401, 403) reaches no fronted service, so it applies nothing; a 422 of a rule that would lengthen a platform ceiling and a 404 for an order of another tenant are answers of the fronted service and return unchanged with the correlation id (ADR-0015 amendment D113). Kind: behavior. Traces: services: DataEventFoundations, RetentionResidencyService; apis: RetentionResidencyService/SetRetentionRule, RetentionResidencyService/AcknowledgeOrderTask; adrs: ADR-0015, ADR-0028; requirements: FR-12; scenarios: SCN-DataEventFoundations-005. Relates: screens: retention-residency. Depends on: AIFACTORY-US-1441, AIFACTORY-US-1442, feature:component-api-gateway-template, feature:retention-residency-service. Sources: model/services/data-event/DataEventFoundations.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a user token with `factory.data.admin`, when the route of `RetentionResidencyService/SetRetentionRule` is called and then repeated with the same body, then the gateway forwards both unchanged, the fronted service applies the rule once and both answers return unchanged with the correlation id; the gateway stored nothing (SCN-DataEventFoundations-005, ADR-0028).",
        "AC2: Given a workload token with `factory.data.acknowledge`, when the route of `RetentionResidencyService/AcknowledgeOrderTask` is called with the tenant of the order, then the tenant is forwarded unchanged and the answer of the fronted service returns unchanged; given the same token without the scope, then the answer is 403 and no fronted service is called (SCN-DataEventFoundations-005, ADR-0015).",
        "AC3: Given a gateway replica stopped while a shared-write call is in flight, when the caller repeats the call through another replica, then the fronted service returns the result of the one application, nothing is replayed by the gateway and no second state change exists (SCN-DataEventFoundations-005, model/services/data-event/DataEventFoundations.yaml).",
        "AC4: Given a call without a token, a token without the scope, or a fronted service that does not answer, when a shared-write route is called, then the answer is 401, 403 or 503 respectively, a call the gateway refuses reaches no fronted service, and the 422 and the 404 of the fronted service return unchanged (SCN-DataEventFoundations-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5855",
        "AIFACTORY-TASK-5856"
      ],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12504,
      "kind": "behavior",
      "traces": {
        "services": [
          "DataEventFoundations",
          "RetentionResidencyService"
        ],
        "apis": [
          "RetentionResidencyService/SetRetentionRule",
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-12"
        ],
        "scenarios": [
          "SCN-DataEventFoundations-005"
        ]
      },
      "relates": {
        "screens": [
          "retention-residency"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1441",
        "AIFACTORY-US-1442",
        "feature:component-api-gateway-template",
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/data-event/DataEventFoundations.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1443]",
      "number": 1443
    },
    {
      "id": "AIFACTORY-TASK-5855",
      "type": "task",
      "parent": "AIFACTORY-US-1443",
      "title": "Forwarded headers of a shared-write route and a stateless call path",
      "sequence": "11.01.04.01",
      "description": "Forwarded headers of a shared-write route and a stateless call path. Expected output: The routes of SetRetentionRule and AcknowledgeOrderTask forward the body, an Idempotency-Key header when the caller sends one and the established scope unchanged and return the status and the body of RetentionResidencyService unchanged; no request, body or result is written to a cache or a store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "The routes of SetRetentionRule and AcknowledgeOrderTask forward the body, an Idempotency-Key header when the caller sends one and the established scope unchanged and return the status and the body of RetentionResidencyService unchanged; no request, body or result is written to a cache or a store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5855]",
      "number": 5855
    },
    {
      "id": "AIFACTORY-TASK-5856",
      "type": "task",
      "parent": "AIFACTORY-US-1443",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "11.01.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DataEventFoundations-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1443 with a fake of RetentionResidencyService that applies a request once, a workload token with and without factory.data.acknowledge, a replica stopped during a call and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DataEventFoundations-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1443 with a fake of RetentionResidencyService that applies a request once, a workload token with and without factory.data.acknowledge, a replica stopped during a call and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5856]",
      "number": 5856
    },
    {
      "id": "AIFACTORY-US-1444",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-055",
      "title": "A production route of the Data & Event platform is forwarded under its scope and the gate of the action stays in the fronted service",
      "sequence": "11.01.05",
      "description": "As a platform admin or a workspace admin, I want a topic registration, a schema publication, a residency selection, a governance order or a store binding to be decided by the service that owns its state, so that an approval or a refusal is never decided twice or by a component that holds no state. Five operations of the platform are of class production: `RegisterTopic` and `PublishSchemaVersion` of EnvelopeRegistryService, `SetResidency` and `IssueGovernanceOrder` of RetentionResidencyService and `SetStoreBinding` of StoreProfileService, each under `factory.data.admin`. The model names a workload caller for three of them, the release pipeline for `RegisterTopic` and `PublishSchemaVersion` and provisioning for `SetStoreBinding`; the gateway admits a workload token on these three routes when it holds `factory.data.admin` as a service scope, forwards the `tenant-id` of the caller unchanged under that scope (D114), and leaves to the fronted service the user role a user caller needs. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, so the gateway treats these routes as it treats every route: it validates the token, takes the tenant from it, requires the scope and forwards the call with the established scope, the body and an `Idempotency-Key` unchanged; `PublishSchemaVersion` and `IssueGovernanceOrder` declare idempotency `key-header`, and the key is applied by the fronted service. The gate of each action is decided where the state is. EnvelopeRegistryService refuses a Forward or Breaking schema version that a registered consumer has not acknowledged; RetentionResidencyService decides the role of the caller (Workspace admin for the tenant, Platform admin for defaults), refuses a tenant deletion without its approval with 412 and records the evidence of an order through AuditService; StoreProfileService refuses a binding that violates the residency of the tenant with 422 and the rule id. The gateway evaluates no approval, holds no approval reference, writes no audit evidence and refuses nothing on behalf of a missing approval: the derived default of the scenario, which had the gateway refuse a production call without an approval, is replaced by this rule. The answers of the fronted service, 201, 202, 409, 412 and 422 included, return unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. Every production route of this platform names at most a topic, a store id or nothing in its path, so the gateway forwards it under the tenant of the token and the fronted service answers 404 for a resource of another tenant (ADR-0015 amendment D113). Kind: behavior. Traces: services: DataEventFoundations, EnvelopeRegistryService, RetentionResidencyService, StoreProfileService; apis: EnvelopeRegistryService/RegisterTopic, EnvelopeRegistryService/PublishSchemaVersion, RetentionResidencyService/SetResidency, RetentionResidencyService/IssueGovernanceOrder, StoreProfileService/SetStoreBinding; adrs: ADR-0015, ADR-0028; requirements: FR-10, FR-12; scenarios: SCN-DataEventFoundations-003. Relates: screens: governance-orders, retention-residency. Depends on: AIFACTORY-US-1441, AIFACTORY-US-1442, feature:component-api-gateway-template, feature:envelope-registry-service, feature:retention-residency-service, feature:store-profile-service. Sources: model/services/data-event/DataEventFoundations.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a token with `factory.data.admin`, when the routes of `EnvelopeRegistryService/RegisterTopic`, `EnvelopeRegistryService/PublishSchemaVersion`, `RetentionResidencyService/SetResidency`, `RetentionResidencyService/IssueGovernanceOrder` and `StoreProfileService/SetStoreBinding` are called, then each call is forwarded under the tenant of the token with the body and the `Idempotency-Key` unchanged and the answer of the fronted service returns unchanged with the correlation id; the gateway evaluates no approval and writes nothing (SCN-DataEventFoundations-003, ADR-0028).",
        "AC2: Given fakes that answer 409, 412 and 422 on these routes, when the routes are called, then each answer returns unchanged, and the gateway holds no approval reference, no cache entry and no store for an approval, which a register test of the route classes checks over the route table (SCN-DataEventFoundations-003, model/services/data-event/DataEventFoundations.yaml).",
        "AC3: Given a call without a token or with an expired token, or a token that lacks `factory.data.admin`, when a production route is called, then the gateway answers 401 or 403 and no fronted service is called; given a workload token that holds the service scope `factory.data.admin`, when the route of `EnvelopeRegistryService/RegisterTopic`, `EnvelopeRegistryService/PublishSchemaVersion` or `StoreProfileService/SetStoreBinding` is called, then it is forwarded, and on `RetentionResidencyService/SetResidency` or `RetentionResidencyService/IssueGovernanceOrder` it is refused with 403; given a topic or a store id of another tenant, when its route is called, then the call is forwarded and the 404 of the fronted service returns unchanged (SCN-DataEventFoundations-003, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5857",
        "AIFACTORY-TASK-5858"
      ],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12505,
      "kind": "behavior",
      "traces": {
        "services": [
          "DataEventFoundations",
          "EnvelopeRegistryService",
          "RetentionResidencyService",
          "StoreProfileService"
        ],
        "apis": [
          "EnvelopeRegistryService/RegisterTopic",
          "EnvelopeRegistryService/PublishSchemaVersion",
          "RetentionResidencyService/SetResidency",
          "RetentionResidencyService/IssueGovernanceOrder",
          "StoreProfileService/SetStoreBinding"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "FR-12"
        ],
        "scenarios": [
          "SCN-DataEventFoundations-003"
        ]
      },
      "relates": {
        "screens": [
          "governance-orders",
          "retention-residency"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1441",
        "AIFACTORY-US-1442",
        "feature:component-api-gateway-template",
        "feature:envelope-registry-service",
        "feature:retention-residency-service",
        "feature:store-profile-service"
      ],
      "source": [
        "model/services/data-event/DataEventFoundations.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1444]",
      "number": 1444
    },
    {
      "id": "AIFACTORY-TASK-5857",
      "type": "task",
      "parent": "AIFACTORY-US-1444",
      "title": "Register of the production routes and fakes that answer the gate refusals",
      "sequence": "11.01.05.01",
      "description": "Register of the production routes and fakes that answer the gate refusals. Expected output: The acceptance suite holds fakes of the five production operations that answer 201, 202, 409, 412 and 422 as configured; a register test lists every route of class production from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval or an evidence record.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "The acceptance suite holds fakes of the five production operations that answer 201, 202, 409, 412 and 422 as configured; a register test lists every route of class production from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval or an evidence record."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12505,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5857]",
      "number": 5857
    },
    {
      "id": "AIFACTORY-TASK-5858",
      "type": "task",
      "parent": "AIFACTORY-US-1444",
      "title": "Verify the production routes through the acceptance suite",
      "sequence": "11.01.05.02",
      "description": "Verify the production routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DataEventFoundations-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1444: the five routes forwarded under their scope with the Idempotency-Key unchanged, the refusals of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, a workload token with factory.data.admin forwarded on RegisterTopic, PublishSchemaVersion and SetStoreBinding and refused on SetResidency and IssueGovernanceOrder, the 404 of a fake for a resource of another tenant, and the register of production routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DataEventFoundations-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1444: the five routes forwarded under their scope with the Idempotency-Key unchanged, the refusals of the fakes returned unchanged, the refusals of the gateway without a call to a fronted service, a workload token with factory.data.admin forwarded on RegisterTopic, PublishSchemaVersion and SetStoreBinding and refused on SetResidency and IssueGovernanceOrder, the 404 of a fake for a resource of another tenant, and the register of production routes."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5858]",
      "number": 5858
    },
    {
      "id": "AIFACTORY-US-1445",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-055",
      "title": "Health, installation profiles, limits and telemetry of the Data & Event gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "11.01.06",
      "description": "As an operator, I want to see whether the gateway, the identity platform and each fronted service answer, and which messaging and store profiles the installation runs, so that I can tell a failing service from a failing gateway and know which adapters the installation uses. An operator, the Studio about page and the probes of the cluster read the state of the gateway through its two own operations. `DataEventFoundations/DataEventHealth` reports liveness and readiness of the gateway with the aggregated health of the three services it fronts and of the identity platform; liveness needs no token and the detail is served under `factory.health.read`. The identity platform is the one required dependency, and the gateway follows the two phases the ADR-0015 amendment D117 sets for every gateway: while a cached signing key still validates tokens, readiness stays ready, already issued tokens keep passing and health answers 200 degraded with a detail that names the identity platform as unreachable; when no valid key remains, readiness turns unready, health answers 503 with a problem response that names the identity platform and calls are refused, so the gateway fails closed. A fronted service is an optional dependency: when it does not answer, health reports it unavailable, its routes answer 503 with a retry hint and the other routes keep serving. `DataEventFoundations/DataEventProfiles` answers a caller with `factory.meta.read` with the messaging profile and the store profiles the installation runs and their adapter versions (ADR-0012, ADR-0013): the gateway composes them from the active envelope profile that `EnvelopeRegistryService/ListEnvelopeProfiles` returns and from the store profiles of the topology of the installation that `StoreProfileService/ListStoreProfiles` returns, keeping nothing; where this answer comes from for a gateway without state is reported to the owner, and the operation answers 503 with the service named when one of the two does not answer. A call above the rate limit of its route is refused with 429 (ADR-0018). The gateway emits `connectsoft.factory.data_event.host.requests` with the dimensions service, route and status and `connectsoft.factory.data_event.host.request_duration` with service and route, the latency including the fronted service, carries the trace context, and never logs a token or a payload. A replica that crashes is detected by the readiness probe and restarts; nothing is replayed. Kind: behavior. Traces: services: DataEventFoundations, EnvelopeRegistryService, StoreProfileService; apis: DataEventFoundations/DataEventHealth, DataEventFoundations/DataEventProfiles, EnvelopeRegistryService/ListEnvelopeProfiles, StoreProfileService/ListStoreProfiles; adrs: ADR-0012, ADR-0013, ADR-0015, ADR-0018, ADR-0028; requirements: NFR-05, NFR-16; scenarios: SCN-DataEventFoundations-001, SCN-DataEventFoundations-002. Depends on: AIFACTORY-US-1441, feature:component-api-gateway-template, feature:component-observability-factory-conventions, feature:envelope-registry-service, feature:store-profile-service. Sources: model/services/data-event/DataEventFoundations.yaml, docs/planes/data-event/services/data-event-foundations/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the identity platform and the three fronted services reachable, when `DataEventFoundations/DataEventHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each fronted service and of the identity platform; given one fronted service down, then health reports it unavailable, its routes answer 503 with a retry hint and the other routes keep serving (SCN-DataEventFoundations-001, ADR-0028).",
        "AC2: Given the identity platform unreachable and a cached signing key that still validates tokens, when calls arrive and health is probed, then issued tokens pass, readiness stays ready and health answers 200 degraded naming the identity platform; given no valid key remains, then calls are refused, readiness is unready and `DataEventFoundations/DataEventHealth` answers 503 with a problem response that names the identity platform, while liveness keeps answering 200 (SCN-DataEventFoundations-001, ADR-0015).",
        "AC3: Given a caller with `factory.meta.read`, when `DataEventFoundations/DataEventProfiles` is called, then the response is 200 with the messaging profile of the installation and its envelope schema version from `EnvelopeRegistryService/ListEnvelopeProfiles` and the store profiles of the topology with engine and adapter library from `StoreProfileService/ListStoreProfiles`; a call without a token is 401, without the scope 403, and an unanswering source service is named in a 503; nothing is written (SCN-DataEventFoundations-002, ADR-0012, ADR-0013).",
        "AC4: Given routed calls and a call above the rate limit of its route, when metrics and logs are read, then `connectsoft.factory.data_event.host.requests` counts every call by service, route and status, the call above the limit was refused with 429, `connectsoft.factory.data_event.host.request_duration` holds the latency by service and route, and no log record holds a token or a payload (ADR-0018, model/services/data-event/DataEventFoundations.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml",
        "docs/planes/data-event/services/data-event-foundations/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-373",
        "AIFACTORY-TASK-5859",
        "AIFACTORY-TASK-5860"
      ],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12506,
      "kind": "behavior",
      "traces": {
        "services": [
          "DataEventFoundations",
          "EnvelopeRegistryService",
          "StoreProfileService"
        ],
        "apis": [
          "DataEventFoundations/DataEventHealth",
          "DataEventFoundations/DataEventProfiles",
          "EnvelopeRegistryService/ListEnvelopeProfiles",
          "StoreProfileService/ListStoreProfiles"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0013",
          "ADR-0015",
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-05",
          "NFR-16"
        ],
        "scenarios": [
          "SCN-DataEventFoundations-001",
          "SCN-DataEventFoundations-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1441",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions",
        "feature:envelope-registry-service",
        "feature:store-profile-service"
      ],
      "source": [
        "model/services/data-event/DataEventFoundations.yaml",
        "docs/planes/data-event/services/data-event-foundations/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1445]",
      "number": 1445
    },
    {
      "id": "AIFACTORY-TASK-373",
      "type": "task",
      "parent": "AIFACTORY-US-1445",
      "title": "Health, installation profiles and telemetry of the gateway",
      "sequence": "11.01.06.01",
      "description": "Health, installation profiles and telemetry of the gateway. Expected output: DataEventHealth serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform, degraded and in rotation while a cached signing key validates tokens and 503 and out of rotation when none remains (D117); DataEventProfiles answers under factory.meta.read with the active envelope profile and the store profiles of the topology read from the two fronted services, keeping nothing; every route takes its rate limit from configuration through the pinned rate-limiting library and answers 429 above it; every routed call records connectsoft.factory.data_event.host.requests and connectsoft.factory.data_event.host.request_duration with their modelled dimensions and carries the trace context.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "DataEventHealth serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform, degraded and in rotation while a cached signing key validates tokens and 503 and out of rotation when none remains (D117); DataEventProfiles answers under factory.meta.read with the active envelope profile and the store profiles of the topology read from the two fronted services, keeping nothing; every route takes its rate limit from configuration through the pinned rate-limiting library and answers 429 above it; every routed call records connectsoft.factory.data_event.host.requests and connectsoft.factory.data_event.host.request_duration with their modelled dimensions and carries the trace context."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12506,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-373]",
      "number": 373
    },
    {
      "id": "AIFACTORY-TASK-5859",
      "type": "task",
      "parent": "AIFACTORY-US-1445",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "11.01.06.02",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/data-event/DataEventFoundations.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step, the identity platform entry stating its two phases (D117).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/data-event/DataEventFoundations.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step, the identity platform entry stating its two phases (D117)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12506,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-5859]",
      "number": 5859
    },
    {
      "id": "AIFACTORY-TASK-5860",
      "type": "task",
      "parent": "AIFACTORY-US-1445",
      "title": "Verify health, profiles, limits and telemetry through the acceptance suite",
      "sequence": "11.01.06.03",
      "description": "Verify health, profiles, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DataEventFoundations-001|Scenario=SCN-DataEventFoundations-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1445 with the identity platform stopped while a cached key validates tokens and after it expired, one fake stopped, the profiles composed from the fakes of EnvelopeRegistryService and StoreProfileService and a call above its limit.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DataEventFoundations.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DataEventFoundations-001|Scenario=SCN-DataEventFoundations-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1445 with the identity platform stopped while a cached key validates tokens and after it expired, one fake stopped, the profiles composed from the fakes of EnvelopeRegistryService and StoreProfileService and a call above its limit."
      ],
      "sourceArtifacts": [
        "model/services/data-event/DataEventFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DataEventFoundations"
      ],
      "children": [],
      "buildOrder": 125,
      "phase": "factory",
      "stackRank": 12506,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5860]",
      "number": 5860
    },
    {
      "id": "AIFACTORY-FEAT-056",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-011",
      "title": "EnvelopeRegistryService: complete delivery",
      "sequence": "11.02",
      "description": "EnvelopeRegistryService is the service of bounded context BC-42 (Data & Event Foundations). The registry of every integration topic (context.area.vN.event-name), its producer, consumers and payload schema versions, the port-level envelope (ADR-0014) with its mapping per messaging profile, the outbox and inbox table contracts per profile, and compatibility checks that fail a release which would break a consumer (BC-42). Its own repository is ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Delivers: EnvelopeRegistryService (complete). Increment I4: Trust and accountability. Build order 126 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-047",
        "AIFACTORY-US-1446",
        "AIFACTORY-US-1447",
        "AIFACTORY-US-1448",
        "AIFACTORY-US-1449",
        "AIFACTORY-US-1450",
        "AIFACTORY-US-1451"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12600,
      "titlePrefix": "[AIFACTORY-FEAT-056]",
      "number": 56
    },
    {
      "id": "AIFACTORY-US-047",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-056",
      "title": "Every topic and its schema versions are registered",
      "sequence": "11.02.01",
      "description": "As a platform administrator, I want one registry of the integration topics, their producers, consumers and schema versions, so that a breaking change of an event is refused before it reaches a consumer. This is the integration PBI of the feature. EnvelopeRegistryService is the service of bounded context BC-42 that makes the event architecture of ADR-0012 and ADR-0014 enforceable at runtime. It owns two aggregates in `envelope-registry-sql`: `TopicDefinition`, one integration topic `context.area.vN.event-name` with its one producer, its registered consumers, its payload schema versions with their compatibility and its state Draft, Active, Deprecated or Retired, and `EnvelopeProfile`, the carriage of the port-level envelope on one messaging profile with its outbox and inbox table contracts and deduplication window. Topics, schema versions and envelope profiles are platform-wide: the model holds them under the platform tenant, so the registry keeps no data of a customer tenant. Callers reach its five REST operations through the gateway DataEventFoundations under `factory.data.read` and `factory.data.admin`, and the hosts of every platform call its two internal gRPC methods with a workload identity. The behaviour is delivered by the behaviour PBIs of this feature: topics are read (AIFACTORY-US-1446), registered and synchronised from the model (AIFACTORY-US-1447), receive schema versions under the compatibility check (AIFACTORY-US-1448), are deprecated and retired (AIFACTORY-US-1449), the envelope profiles are listed and activated (AIFACTORY-US-1450) and the publish-time resolution and validation answer the hosts (AIFACTORY-US-1451). Every state change and its outbox record commit in one transaction and the four events leave through the outbox of the `envelope-registry` messaging profile under the canonical envelope; the service consumes no event. Messaging, persistence and telemetry come from the base template with the Factory profile and the pinned observability packages, never forked. The service store is restored from backup with a recovery point of 15 minutes, and because the registrations are also in the architecture model, `ModelSync` can apply them again. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService, created by the repository checklist of feature `repository-and-pipeline-conventions` from the base template with the Factory profile. Kind: behavior. Traces: services: EnvelopeRegistryService, DataEventFoundations; aggregates: EnvelopeRegistryService/TopicDefinition, EnvelopeRegistryService/EnvelopeProfile; apis: EnvelopeRegistryService/ListTopics, EnvelopeRegistryService/GetTopic, EnvelopeRegistryService/RegisterTopic, EnvelopeRegistryService/PublishSchemaVersion, EnvelopeRegistryService/ListEnvelopeProfiles, EnvelopeRegistryService/Envelopes.ResolveTopic, EnvelopeRegistryService/Envelopes.ValidateEnvelope; events: EnvelopeRegistryService/TopicRegistered, EnvelopeRegistryService/SchemaVersionPublished, EnvelopeRegistryService/TopicDeprecated, EnvelopeRegistryService/EnvelopeProfileActivated; adrs: ADR-0012, ADR-0014, ADR-0028; requirements: FR-10, NFR-05, XL-02. Relates: screens: topic-registry; nfrs: NFR-14. Depends on: AIFACTORY-US-1446, AIFACTORY-US-1447, AIFACTORY-US-1448, AIFACTORY-US-1449, AIFACTORY-US-1450, AIFACTORY-US-1451, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/data-event/EnvelopeRegistryService.yaml, model/scenarios/EnvelopeRegistryService.yaml, docs/planes/data-event/services/envelope-registry-service/index.md#purpose-and-responsibilities, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService --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-1446 to AIFACTORY-US-1451, when they run in the pipeline, then each of the eleven scenarios of EnvelopeRegistryService has a passing test that names its id, and a filter that discovers no test counts as a failure (model/scenarios/EnvelopeRegistryService.yaml).",
        "AC3: Given the outbox of the `envelope-registry` messaging profile after the acceptance suites, when its records are read, then `EnvelopeRegistryService/TopicRegistered`, `EnvelopeRegistryService/SchemaVersionPublished`, `EnvelopeRegistryService/TopicDeprecated` and `EnvelopeRegistryService/EnvelopeProfileActivated` were each written in the transaction of the state change they announce and published under the canonical envelope, and the inbox registers no subscription, because the model lists no consumed event (ADR-0012, ADR-0014).",
        "AC4: Given the service starts, when liveness and readiness are probed, then readiness reports `envelope-registry-sql` and the messaging transport, the telemetry conformance test of the pinned observability packages passes with `connectsoft.factory.data_event.topics` tagged with state and `connectsoft.factory.data_event.envelope_validation_failures` tagged with producer and topic, and no payload appears in a metric, an activity or a log record (NFR-05, model/services/data-event/EnvelopeRegistryService.yaml).",
        "AC5: Given an empty `envelope-registry-sql` after a restore, when `ModelSync` runs on the architecture model, then every topic of the generated topic catalog is registered again with its producer, its consumers and its schema references, as the failure mode of a lost service store states (ADR-0012, model/services/data-event/EnvelopeRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "model/scenarios/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-374",
        "AIFACTORY-TASK-375",
        "AIFACTORY-TASK-376",
        "AIFACTORY-TASK-377",
        "AIFACTORY-TASK-378",
        "AIFACTORY-TASK-379",
        "AIFACTORY-TASK-380",
        "AIFACTORY-TASK-704"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvelopeRegistryService",
          "DataEventFoundations"
        ],
        "aggregates": [
          "EnvelopeRegistryService/TopicDefinition",
          "EnvelopeRegistryService/EnvelopeProfile"
        ],
        "apis": [
          "EnvelopeRegistryService/ListTopics",
          "EnvelopeRegistryService/GetTopic",
          "EnvelopeRegistryService/RegisterTopic",
          "EnvelopeRegistryService/PublishSchemaVersion",
          "EnvelopeRegistryService/ListEnvelopeProfiles",
          "EnvelopeRegistryService/Envelopes.ResolveTopic",
          "EnvelopeRegistryService/Envelopes.ValidateEnvelope"
        ],
        "events": [
          "EnvelopeRegistryService/TopicRegistered",
          "EnvelopeRegistryService/SchemaVersionPublished",
          "EnvelopeRegistryService/TopicDeprecated",
          "EnvelopeRegistryService/EnvelopeProfileActivated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "NFR-05",
          "XL-02"
        ]
      },
      "relates": {
        "screens": [
          "topic-registry"
        ],
        "nfrs": [
          "NFR-14"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1446",
        "AIFACTORY-US-1447",
        "AIFACTORY-US-1448",
        "AIFACTORY-US-1449",
        "AIFACTORY-US-1450",
        "AIFACTORY-US-1451",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "model/scenarios/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-047]",
      "number": 47
    },
    {
      "id": "AIFACTORY-TASK-374",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "11.02.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `envelope-registry`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `envelope-registry`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-374]",
      "number": 374
    },
    {
      "id": "AIFACTORY-TASK-375",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "Domain model: TopicDefinition, EnvelopeProfile",
      "sequence": "11.02.01.02",
      "description": "Domain model: TopicDefinition, EnvelopeProfile. Expected output: The aggregates hold the fields and the invariants of the model (exactly one producer per topic whose bounded-context slug is the context segment, a new schema version Active only when backward compatible or acknowledged by every registered consumer, Retired topics reject publication, identical envelope fields on every profile) and the three transitions of TopicState (Draft to Active, Active to Deprecated, Deprecated to Retired); unit tests cover every invariant and every transition and refuse every transition the model does not list.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates hold the fields and the invariants of the model (exactly one producer per topic whose bounded-context slug is the context segment, a new schema version Active only when backward compatible or acknowledged by every registered consumer, Retired topics reject publication, identical envelope fields on every profile) and the three transitions of TopicState (Draft to Active, Active to Deprecated, Deprecated to Retired); unit tests cover every invariant and every transition and refuse every transition the model does not list."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-375]",
      "number": 375
    },
    {
      "id": "AIFACTORY-TASK-376",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "Persistence in envelope-registry-sql: Topics, SchemaVersions, TopicConsumers, EnvelopeProfiles",
      "sequence": "11.02.01.03",
      "description": "Persistence in envelope-registry-sql: Topics, SchemaVersions, TopicConsumers, EnvelopeProfiles. Expected output: Mappings and migrations for the four modelled tables with the tenant column, the index on producer and the unique index on event name; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the four modelled tables with the tenant column, the index on producer and the unique index on event name; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-376]",
      "number": 376
    },
    {
      "id": "AIFACTORY-TASK-377",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "API hosting skeleton: the 5 REST and 2 gRPC operations with scope enforcement and problem responses",
      "sequence": "11.02.01.04",
      "description": "API hosting skeleton: the 5 REST and 2 gRPC operations with scope enforcement and problem responses. Expected output: ListTopics, GetTopic, RegisterTopic, PublishSchemaVersion and ListEnvelopeProfiles are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, the Idempotency-Key filter of PublishSchemaVersion and problem responses for every modelled refusal code; Envelopes.ResolveTopic and Envelopes.ValidateEnvelope are hosted with workload identity checks; the OpenAPI and proto documents are published; the behaviour of each operation is delivered by AIFACTORY-US-1446 to AIFACTORY-US-1451, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ListTopics, GetTopic, RegisterTopic, PublishSchemaVersion and ListEnvelopeProfiles are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, the Idempotency-Key filter of PublishSchemaVersion and problem responses for every modelled refusal code; Envelopes.ResolveTopic and Envelopes.ValidateEnvelope are hosted with workload identity checks; the OpenAPI and proto documents are published; the behaviour of each operation is delivered by AIFACTORY-US-1446 to AIFACTORY-US-1451, not here."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-377]",
      "number": 377
    },
    {
      "id": "AIFACTORY-TASK-378",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "Messaging skeleton: outbox of the envelope-registry profile for 4 published events, no consumed event",
      "sequence": "11.02.01.05",
      "description": "Messaging skeleton: outbox of the envelope-registry profile for 4 published events, no consumed event. Expected output: The outbox writer enlists in the transaction of each state change and the dispatcher publishes TopicRegistered, SchemaVersionPublished, TopicDeprecated and EnvelopeProfileActivated on their modelled topics under the canonical envelope; the inbox registers no subscription because the model lists no consumed event, and a test fails when a subscription appears that the model does not list.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of each state change and the dispatcher publishes TopicRegistered, SchemaVersionPublished, TopicDeprecated and EnvelopeProfileActivated on their modelled topics under the canonical envelope; the inbox registers no subscription because the model lists no consumed event, and a test fails when a subscription appears that the model does not list."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-378]",
      "number": 378
    },
    {
      "id": "AIFACTORY-TASK-379",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "Worker hosting skeleton: triggers, retry policies and idempotency keys of ModelSync and DeprecationSweeper",
      "sequence": "11.02.01.06",
      "description": "Worker hosting skeleton: triggers, retry policies and idempotency keys of ModelSync and DeprecationSweeper. Expected output: ModelSync is hosted with its manual trigger on release of the architecture model, a fixed retry of two attempts and the idempotency key topic plus schema version; DeprecationSweeper with its daily schedule, no retry and the idempotency key topic plus day; both run one at a time and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1447 and AIFACTORY-US-1449.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ModelSync is hosted with its manual trigger on release of the architecture model, a fixed retry of two attempts and the idempotency key topic plus schema version; DeprecationSweeper with its daily schedule, no retry and the idempotency key topic plus day; both run one at a time and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1447 and AIFACTORY-US-1449."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-379]",
      "number": 379
    },
    {
      "id": "AIFACTORY-TASK-380",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "Security, tenancy and telemetry of EnvelopeRegistryService",
      "sequence": "11.02.01.07",
      "description": "Security, tenancy and telemetry of EnvelopeRegistryService. Expected output: The two scopes and three roles of the model are enforced, every query runs under the tenant filter with the platform tenant the registry rows carry, the messaging transport secret comes from a secret reference, the host makes the one call of the registration of the pinned observability packages, creates connectsoft.factory.data_event.topics and connectsoft.factory.data_event.envelope_validation_failures through its instrument helper and references the conformance test package from its architecture tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two scopes and three roles of the model are enforced, every query runs under the tenant filter with the platform tenant the registry rows carry, the messaging transport secret comes from a secret reference, the host makes the one call of the registration of the pinned observability packages, creates connectsoft.factory.data_event.topics and connectsoft.factory.data_event.envelope_validation_failures through its instrument helper and references the conformance test package from its architecture tests."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-380]",
      "number": 380
    },
    {
      "id": "AIFACTORY-TASK-704",
      "type": "task",
      "parent": "AIFACTORY-US-047",
      "title": "Verify topics-and-envelopes-registered by running the declared command",
      "sequence": "11.02.01.08",
      "description": "Verify topics-and-envelopes-registered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService, then `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-EnvelopeRegistryService\"`; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-047, with a test for each of SCN-EnvelopeRegistryService-001 to SCN-EnvelopeRegistryService-011.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService, then `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-EnvelopeRegistryService\"`; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-047, with a test for each of SCN-EnvelopeRegistryService-001 to SCN-EnvelopeRegistryService-011."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-704]",
      "number": 704
    },
    {
      "id": "AIFACTORY-US-1446",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-056",
      "title": "List the registered topics and read one topic with its schema versions and compatibility history",
      "sequence": "11.02.02",
      "description": "As an observer, a platform admin or the Studio topic registry view, I want to list the integration topics with their producer, consumers, schema version and state and to read one with its history, so that I see the event architecture that runs, not only the one that was designed. A caller whose scope carries `factory.data.read` lists topics through `EnvelopeRegistryService/ListTopics` and receives every registered topic with its producer, its registered consumers, its current schema version and its state, optionally filtered by context, the producing bounded-context slug, or by producer, paged. The same caller reads one topic through `EnvelopeRegistryService/GetTopic`, addressed by its name `context.area.vN.event-name`, and receives the topic with every schema version it ever had, each with its schema reference, its compatibility against the previous version (Backward, Forward, Full or Breaking), the moment it was published and, where it applies, the moment it was deprecated, together with the version each consumer has acknowledged. StudioBff serves both through the view `topic-registry`, and the DSL studio reads the topic list. Topics are platform-wide rows of the registry, held under the platform tenant as the table `Topics` states, so both reads return the same registry to every caller with the scope and there is no topic of another tenant to hide. A caller without the scope is refused with 403 and a topic the registry does not hold is answered 404 with a problem response. Nothing is written by either read. Through the gateway the route is a read route (AIFACTORY-US-1442 of feature `data-event-foundations`). Kind: behavior. Traces: services: EnvelopeRegistryService; aggregates: EnvelopeRegistryService/TopicDefinition; apis: EnvelopeRegistryService/ListTopics, EnvelopeRegistryService/GetTopic; adrs: ADR-0012, ADR-0015; requirements: FR-10, FUX-11; scenarios: SCN-EnvelopeRegistryService-001, SCN-EnvelopeRegistryService-002. Relates: screens: topic-registry, dsl-studio. Sources: model/services/data-event/EnvelopeRegistryService.yaml, docs/planes/data-event/services/envelope-registry-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given registered topics of several producing contexts and a caller with `factory.data.read`, when `EnvelopeRegistryService/ListTopics` is called without a filter and then filtered by context and by producer, then each response is 200 with the matching topics, each with producer, consumers, current schema version and state, and nothing is written (SCN-EnvelopeRegistryService-001).",
        "AC2: Given a topic with three schema versions, one of them Breaking and acknowledged by every consumer, when `EnvelopeRegistryService/GetTopic` is called with its name, then the response is 200 with the three versions in order, each with schema reference, compatibility and publication moment, and the acknowledged version of each consumer (SCN-EnvelopeRegistryService-002).",
        "AC3: Given a caller without `factory.data.read`, or a topic name the registry does not hold, when `EnvelopeRegistryService/ListTopics` or `EnvelopeRegistryService/GetTopic` is called, then the response is 403 or 404 respectively with a problem response and no state change (SCN-EnvelopeRegistryService-001, SCN-EnvelopeRegistryService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5862",
        "AIFACTORY-TASK-5863"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12602,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvelopeRegistryService"
        ],
        "aggregates": [
          "EnvelopeRegistryService/TopicDefinition"
        ],
        "apis": [
          "EnvelopeRegistryService/ListTopics",
          "EnvelopeRegistryService/GetTopic"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "FUX-11"
        ],
        "scenarios": [
          "SCN-EnvelopeRegistryService-001",
          "SCN-EnvelopeRegistryService-002"
        ]
      },
      "relates": {
        "screens": [
          "topic-registry",
          "dsl-studio"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1446]",
      "number": 1446
    },
    {
      "id": "AIFACTORY-TASK-5862",
      "type": "task",
      "parent": "AIFACTORY-US-1446",
      "title": "ListTopics and GetTopic read model with filters, paging and schema history",
      "sequence": "11.02.02.01",
      "description": "ListTopics and GetTopic read model with filters, paging and schema history. Expected output: ListTopics returns the topics of the registry with producer, consumers, current schema version and state, filtered by context or producer and paged; GetTopic returns one topic with every schema version, its schema reference, compatibility and publication and deprecation moments and the acknowledged version per consumer; a missing scope is 403 and an unknown topic 404 with a problem response; neither read writes anything.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "ListTopics returns the topics of the registry with producer, consumers, current schema version and state, filtered by context or producer and paged; GetTopic returns one topic with every schema version, its schema reference, compatibility and publication and deprecation moments and the acknowledged version per consumer; a missing scope is 403 and an unknown topic 404 with a problem response; neither read writes anything."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5862]",
      "number": 5862
    },
    {
      "id": "AIFACTORY-TASK-5863",
      "type": "task",
      "parent": "AIFACTORY-US-1446",
      "title": "Verify the topic reads through the acceptance suite",
      "sequence": "11.02.02.02",
      "description": "Verify the topic reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-001|Scenario=SCN-EnvelopeRegistryService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1446 with topics of several contexts, a topic with a Breaking version, a caller without the scope and an unknown topic.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-001|Scenario=SCN-EnvelopeRegistryService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1446 with topics of several contexts, a topic with a Breaking version, a caller without the scope and an unknown topic."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5863]",
      "number": 5863
    },
    {
      "id": "AIFACTORY-US-1447",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-056",
      "title": "Register or update a topic from the architecture model and announce it with TopicRegistered",
      "sequence": "11.02.03",
      "description": "As a platform admin or the release pipeline, I want every topic of the architecture model registered with its producer and consumers, so that the registry at runtime holds the same facts as the model and drift is reported. A Platform admin, or the release pipeline that normally applies the architecture model, calls `EnvelopeRegistryService/RegisterTopic` with `factory.data.admin` on `PUT /factory/data/topics/{topic}`. A user caller needs `factory.data.admin` and the Platform admin role; the release pipeline calls with a workload token, which carries service scopes and no user role (ADR-0015), and is admitted when its token holds the service scope `factory.data.admin` that names the operation. The body names the producing service, the registered consumers and the envelope profile of the topic; the context, area, version and event name are taken from the topic name `context.area.vN.event-name` of the path. A topic the registry does not hold is created in state Draft and the answer is 201; a topic it holds is updated in its producer or consumers and the answer is 200; a repeated PUT with the same content changes nothing and publishes nothing, which is the natural idempotency of the operation. The service refuses with 409 a topic whose context segment is not the bounded-context slug of the producing service, a second producer for a topic, an event name that another topic already carries (the unique index of `Topics`) and a change to a Retired topic; a user caller without the scope or without the Platform admin role, and a workload token without the scope, are refused with 403. A registration or a change of producer or consumers writes `EnvelopeRegistryService/TopicRegistered` with `topic`, `producer`, `currentSchemaVersion` and `state` in the same transaction; StudioBff refreshes the topic view and AuditService records the evidence in their own suites. The worker `ModelSync` applies the generated topic catalog of the architecture model at release: it registers or updates every topic with its producer, consumers and schema references through the same commands, so each change is announced by `TopicRegistered` and each new schema version goes through the compatibility check of AIFACTORY-US-1448, and it reports as drift every topic the registry holds that the catalog does not list and every difference it could not apply. It runs one at a time, retries twice with a fixed backoff and is idempotent on topic plus schema version. `connectsoft.factory.data_event.topics` moves with every change of state. Kind: behavior. Traces: services: EnvelopeRegistryService; aggregates: EnvelopeRegistryService/TopicDefinition; apis: EnvelopeRegistryService/RegisterTopic; events: EnvelopeRegistryService/TopicRegistered; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-10, XL-02; scenarios: SCN-EnvelopeRegistryService-003, SCN-EnvelopeRegistryService-008. Relates: screens: topic-registry. Depends on: AIFACTORY-US-1446. Sources: model/services/data-event/EnvelopeRegistryService.yaml, docs/planes/data-event/services/envelope-registry-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a user caller with `factory.data.admin` and the Platform admin role, or the release pipeline with a workload token that holds the service scope `factory.data.admin`, when `EnvelopeRegistryService/RegisterTopic` is called for a new topic, then the response is 201, the `EnvelopeRegistryService/TopicDefinition` is in state Draft with its producer and consumers, and `EnvelopeRegistryService/TopicRegistered` is written in the same transaction; when it is called again with changed consumers, the response is 200 and one more event is written; when it is repeated unchanged, nothing is written (SCN-EnvelopeRegistryService-003, ADR-0012, ADR-0015).",
        "AC2: Given a topic whose context segment is not the slug of the producer, a second producer, an event name carried by another topic, or a Retired topic, when `EnvelopeRegistryService/RegisterTopic` is called, then the response is 409 with a problem response that names the rule; given a user caller without the scope or the Platform admin role, or a workload token without the service scope, then the response is 403, while the workload token of the release pipeline with the scope is not refused for lacking a user role; no refusal writes a row or an event (SCN-EnvelopeRegistryService-003, ADR-0015).",
        "AC3: Given a registration committed, when the outbox dispatcher of the `envelope-registry` messaging profile publishes `EnvelopeRegistryService/TopicRegistered` on `data-foundations.topics.v1.topic-registered`, then the event is sent under the canonical envelope with `topic`, `producer`, `currentSchemaVersion` and `state`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-EnvelopeRegistryService-008, ADR-0014).",
        "AC4: Given a generated topic catalog of the model and a registry that holds one extra topic and misses two, when `ModelSync` runs, then the two topics are registered with their producers, consumers and schema references, the extra topic is reported as drift and left unchanged, and a second run of the same catalog writes nothing and publishes nothing (SCN-EnvelopeRegistryService-008, model/services/data-event/EnvelopeRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-555",
        "AIFACTORY-TASK-5864",
        "AIFACTORY-TASK-5865"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12603,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvelopeRegistryService"
        ],
        "aggregates": [
          "EnvelopeRegistryService/TopicDefinition"
        ],
        "apis": [
          "EnvelopeRegistryService/RegisterTopic"
        ],
        "events": [
          "EnvelopeRegistryService/TopicRegistered"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "XL-02"
        ],
        "scenarios": [
          "SCN-EnvelopeRegistryService-003",
          "SCN-EnvelopeRegistryService-008"
        ]
      },
      "relates": {
        "screens": [
          "topic-registry"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1446"
      ],
      "source": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1447]",
      "number": 1447
    },
    {
      "id": "AIFACTORY-TASK-555",
      "type": "task",
      "parent": "AIFACTORY-US-1447",
      "title": "Topic registry synchronised from the model by ModelSync",
      "sequence": "11.02.03.01",
      "description": "Topic registry synchronised from the model by ModelSync. Expected output: ModelSync reads the generated topic catalog of the architecture model at release and applies every topic with producer, consumers and schema references through RegisterTopic and PublishSchemaVersion; topics the registry holds that the catalog does not list, and differences it could not apply, are reported as drift in the run report; a second run of the same catalog has no effect.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "ModelSync reads the generated topic catalog of the architecture model at release and applies every topic with producer, consumers and schema references through RegisterTopic and PublishSchemaVersion; topics the registry holds that the catalog does not list, and differences it could not apply, are reported as drift in the run report; a second run of the same catalog has no effect."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-555]",
      "number": 555
    },
    {
      "id": "AIFACTORY-TASK-5864",
      "type": "task",
      "parent": "AIFACTORY-US-1447",
      "title": "RegisterTopic with the topic invariants and the TopicRegistered outbox record",
      "sequence": "11.02.03.02",
      "description": "RegisterTopic with the topic invariants and the TopicRegistered outbox record. Expected output: RegisterTopic creates a Draft topic with 201 or updates producer and consumers with 200, writes TopicRegistered in the same transaction, changes nothing on an unchanged repeat, refuses with 409 a context segment that is not the producer slug, a second producer, an event name of another topic and a Retired topic, and with 403 a user caller without factory.data.admin or the Platform admin role and a workload token without the service scope factory.data.admin; the workload token of the release pipeline with that scope is admitted without a user role, and an acceptance test covers it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "RegisterTopic creates a Draft topic with 201 or updates producer and consumers with 200, writes TopicRegistered in the same transaction, changes nothing on an unchanged repeat, refuses with 409 a context segment that is not the producer slug, a second producer, an event name of another topic and a Retired topic, and with 403 a user caller without factory.data.admin or the Platform admin role and a workload token without the service scope factory.data.admin; the workload token of the release pipeline with that scope is admitted without a user role, and an acceptance test covers it."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5864]",
      "number": 5864
    },
    {
      "id": "AIFACTORY-TASK-5865",
      "type": "task",
      "parent": "AIFACTORY-US-1447",
      "title": "Verify registration and synchronisation through the acceptance suite",
      "sequence": "11.02.03.03",
      "description": "Verify registration and synchronisation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-003|Scenario=SCN-EnvelopeRegistryService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1447, including the publication and payload of TopicRegistered under a transport outage and a ModelSync run on a fixture catalog with drift; consumer handling is proven by the suites of StudioBff and AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-003|Scenario=SCN-EnvelopeRegistryService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1447, including the publication and payload of TopicRegistered under a transport outage and a ModelSync run on a fixture catalog with drift; consumer handling is proven by the suites of StudioBff and AuditService."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5865]",
      "number": 5865
    },
    {
      "id": "AIFACTORY-US-1448",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-056",
      "title": "Publish a payload schema version, refuse a breaking one that a consumer has not acknowledged, and announce SchemaVersionPublished",
      "sequence": "11.02.04",
      "description": "As a platform admin or the release pipeline, I want a new payload schema version compared with the current one and refused when it would break a consumer that has not acknowledged it, so that no release of a producer breaks a consumer at runtime. A Platform admin or the release pipeline calls `EnvelopeRegistryService/PublishSchemaVersion` with `factory.data.admin` on `POST /factory/data/topics/{topic}/schema-versions` with an `Idempotency-Key`. The body names the version and the reference of its JSON Schema document; the service reads the document from ArtifactService and compares it with the current version of the topic, recording the result as Backward, Forward, Full or Breaking. The invariant of `TopicDefinition` admits a new version only when it is backward compatible with the current one or acknowledged by every registered consumer: a Backward or Full version becomes the current version at once; a Forward or Breaking version, which is not backward compatible, becomes current only when every row of `TopicConsumers` of the topic records that version as `AcknowledgedSchemaVersion`, and otherwise the publish is refused with 409 and a problem response that lists the unacknowledged consumers (the failure mode of the model). The first version of a Draft topic activates it (trigger Activate, Draft to Active). The answer is 201 with the version and its compatibility, and `EnvelopeRegistryService/SchemaVersionPublished` with `topic`, `version` and `compatibility` is written in the same transaction as the `SchemaVersion` row and the new current version. A repeat under the same key and body returns the same 201 and changes nothing; the same key with a different body is refused with 409; a Retired topic is refused with 409; a version that does not parse, a schema document that cannot be read as JSON Schema or a topic the registry does not hold is refused with 422; a caller without the scope or the role is refused with 403. When ArtifactService does not answer, the document cannot be compared, so no `SchemaVersion` row, current version or event is written, the caller receives 503 with a problem response that names ArtifactService, as D137 rules for a dependency the call cannot do without, and a repeat under the same `Idempotency-Key` after ArtifactService is back is applied once. The model names no operation through which a consumer records its acknowledgement of a breaking version, and this PBI does not decide one; it reads what `TopicConsumers` holds. Kind: behavior. Traces: services: EnvelopeRegistryService, ArtifactService; aggregates: EnvelopeRegistryService/TopicDefinition; apis: EnvelopeRegistryService/PublishSchemaVersion; events: EnvelopeRegistryService/SchemaVersionPublished; adrs: ADR-0012, ADR-0014; requirements: FR-10, XL-02; scenarios: SCN-EnvelopeRegistryService-004, SCN-EnvelopeRegistryService-009. Relates: screens: topic-registry. Depends on: AIFACTORY-US-1447, feature:artifact-service. Sources: model/services/data-event/EnvelopeRegistryService.yaml, docs/planes/data-event/services/envelope-registry-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given an Active topic and a Backward compatible version, when `EnvelopeRegistryService/PublishSchemaVersion` is called with an `Idempotency-Key`, then the response is 201 with compatibility Backward, the version is the current version of the `EnvelopeRegistryService/TopicDefinition` and `EnvelopeRegistryService/SchemaVersionPublished` is written in the same transaction; given a Draft topic, its first version activates it (SCN-EnvelopeRegistryService-004).",
        "AC2: Given a Breaking version and one registered consumer that has not acknowledged it, or a Forward version that one registered consumer has not acknowledged, when it is published, then the response is 409 with a problem response that names that consumer and nothing is written; given every row of `TopicConsumers` acknowledges it, then it is published with compatibility Breaking or Forward respectively; given a Full version, then it becomes current at once like a Backward one (SCN-EnvelopeRegistryService-004, ADR-0012).",
        "AC3: Given the same call repeated with the same key and body, a different body under the same key, a Retired topic, an unparseable version or unreadable schema, an unknown topic, or a caller without `factory.data.admin`, when `EnvelopeRegistryService/PublishSchemaVersion` is called, then the repeat returns the first 201 and changes nothing and the others are refused with 409, 409, 422, 422 and 403 respectively, none of them writing a row or an event; given ArtifactService does not answer, then no row, current version or event is written, the caller receives 503 with a problem response that names ArtifactService, and a repeat under the same `Idempotency-Key` once ArtifactService answers is applied once (SCN-EnvelopeRegistryService-004, D137).",
        "AC4: Given a version published, when the outbox dispatcher publishes `EnvelopeRegistryService/SchemaVersionPublished` on `data-foundations.topics.v1.schema-version-published`, then the event is sent under the canonical envelope with `topic`, `version` and `compatibility`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-EnvelopeRegistryService-009, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-556",
        "AIFACTORY-TASK-5866",
        "AIFACTORY-TASK-5867"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12604,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvelopeRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "EnvelopeRegistryService/TopicDefinition"
        ],
        "apis": [
          "EnvelopeRegistryService/PublishSchemaVersion"
        ],
        "events": [
          "EnvelopeRegistryService/SchemaVersionPublished"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10",
          "XL-02"
        ],
        "scenarios": [
          "SCN-EnvelopeRegistryService-004",
          "SCN-EnvelopeRegistryService-009"
        ]
      },
      "relates": {
        "screens": [
          "topic-registry"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1447",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1448]",
      "number": 1448
    },
    {
      "id": "AIFACTORY-TASK-556",
      "type": "task",
      "parent": "AIFACTORY-US-1448",
      "title": "Schema version compatibility check",
      "sequence": "11.02.04.01",
      "description": "Schema version compatibility check. Expected output: A comparator reads two JSON Schema documents and returns Backward, Forward, Full or Breaking with the list of changed members; golden test pairs cover each result, including a removed required member, an added optional member, a changed type, a Forward pair (a new version that old readers can read but that cannot read data of the current version, such as a member that becomes required) and a Full pair, and the comparison result is what SchemaVersions stores.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "A comparator reads two JSON Schema documents and returns Backward, Forward, Full or Breaking with the list of changed members; golden test pairs cover each result, including a removed required member, an added optional member, a changed type, a Forward pair (a new version that old readers can read but that cannot read data of the current version, such as a member that becomes required) and a Full pair, and the comparison result is what SchemaVersions stores."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12604,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-556]",
      "number": 556
    },
    {
      "id": "AIFACTORY-TASK-5866",
      "type": "task",
      "parent": "AIFACTORY-US-1448",
      "title": "PublishSchemaVersion with the acknowledgement rule, Activate and the SchemaVersionPublished outbox record",
      "sequence": "11.02.04.02",
      "description": "PublishSchemaVersion with the acknowledgement rule, Activate and the SchemaVersionPublished outbox record. Expected output: PublishSchemaVersion reads the schema document from ArtifactService, compares it with the current version, makes a Backward or Full version current at once and a Forward or Breaking version only when every row of TopicConsumers acknowledges it, otherwise answering 409 with the unacknowledged consumers, activates a Draft topic on its first version, writes SchemaVersionPublished in the same transaction and answers 201; the 409 with the unacknowledged consumers for a Forward and for a Breaking version, the 409 for a reused key with a different body and for a Retired topic, the 422 refusals and the 403 are covered by acceptance tests; with a fake of ArtifactService that does not answer, nothing is written, the answer is 503 with a problem response naming ArtifactService (D137) and a repeat under the same Idempotency-Key after the fake answers is applied once.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "PublishSchemaVersion reads the schema document from ArtifactService, compares it with the current version, makes a Backward or Full version current at once and a Forward or Breaking version only when every row of TopicConsumers acknowledges it, otherwise answering 409 with the unacknowledged consumers, activates a Draft topic on its first version, writes SchemaVersionPublished in the same transaction and answers 201; the 409 with the unacknowledged consumers for a Forward and for a Breaking version, the 409 for a reused key with a different body and for a Retired topic, the 422 refusals and the 403 are covered by acceptance tests; with a fake of ArtifactService that does not answer, nothing is written, the answer is 503 with a problem response naming ArtifactService (D137) and a repeat under the same Idempotency-Key after the fake answers is applied once."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5866]",
      "number": 5866
    },
    {
      "id": "AIFACTORY-TASK-5867",
      "type": "task",
      "parent": "AIFACTORY-US-1448",
      "title": "Verify schema publication through the acceptance suite",
      "sequence": "11.02.04.03",
      "description": "Verify schema publication through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-004|Scenario=SCN-EnvelopeRegistryService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1448, including the refused breaking version, the idempotent repeat and the publication and payload of SchemaVersionPublished; consumer handling is proven by the suites of StudioBff and AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-004|Scenario=SCN-EnvelopeRegistryService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1448, including the refused breaking version, the idempotent repeat and the publication and payload of SchemaVersionPublished; consumer handling is proven by the suites of StudioBff and AuditService."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5867]",
      "number": 5867
    },
    {
      "id": "AIFACTORY-US-1449",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-056",
      "title": "Deprecate a topic with its deprecation window, announce TopicDeprecated and retire it when the window elapses",
      "sequence": "11.02.05",
      "description": "As a platform admin, I want a deprecated topic to keep delivering for its window and then be retired, so that consumers have time to move and no host publishes on a topic that is gone. A topic leaves service in two steps. The transition Deprecate moves an Active `TopicDefinition` to Deprecated, sets `deprecatedAt` on its current schema version and writes `EnvelopeRegistryService/TopicDeprecated` with `topic` and `retiresAt`, the moment of the transition plus `DataEvent:Envelopes:DeprecationWindowDays` (90 days by default), in the same transaction; a Deprecated topic keeps delivering for the whole window, so `Envelopes.ResolveTopic` still resolves it with its state and `Envelopes.ValidateEnvelope` still accepts envelopes on it. The worker `DeprecationSweeper` runs daily as the model schedules it, one at a time, without retry and idempotent on topic plus day: it moves every Deprecated topic whose `retiresAt` has passed to Retired through the trigger WindowElapsed, publishes no event, as the model gives the worker none, and moves `connectsoft.factory.data_event.topics`; a Retired topic rejects publication, which `Envelopes.ValidateEnvelope` and `Envelopes.ResolveTopic` report to the outbox writer of a host (AIFACTORY-US-1451). A second run on the same day changes nothing. Deprecate applies only to an Active topic, and no transition leaves Retired. The model names no operation that applies Deprecate to a topic; this PBI builds the transition, its event and the sweep, and which operation deprecates a topic is reported to the owner. Kind: behavior. Traces: services: EnvelopeRegistryService; aggregates: EnvelopeRegistryService/TopicDefinition; apis: EnvelopeRegistryService/Envelopes.ResolveTopic; events: EnvelopeRegistryService/TopicDeprecated; adrs: ADR-0012, ADR-0014; requirements: FR-10; scenarios: SCN-EnvelopeRegistryService-010. Depends on: AIFACTORY-US-1447. Sources: model/services/data-event/EnvelopeRegistryService.yaml, docs/planes/data-event/services/envelope-registry-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given an Active topic, when the transition Deprecate is applied, then the `EnvelopeRegistryService/TopicDefinition` is Deprecated, its current schema version carries `deprecatedAt`, and `EnvelopeRegistryService/TopicDeprecated` is written in the same transaction with `retiresAt` at the transition plus `DataEvent:Envelopes:DeprecationWindowDays`; Deprecate on a Draft or Retired topic is refused (SCN-EnvelopeRegistryService-010).",
        "AC2: Given a topic Deprecated, when the outbox dispatcher publishes `EnvelopeRegistryService/TopicDeprecated` on `data-foundations.topics.v1.topic-deprecated`, then the event is sent under the canonical envelope with `topic` and `retiresAt`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-EnvelopeRegistryService-010, ADR-0014).",
        "AC3: Given one Deprecated topic whose window elapsed and one whose window has not, when `DeprecationSweeper` runs, then only the first moves to Retired, no event is published and `connectsoft.factory.data_event.topics` moves by state; a second run on the same day changes nothing, and `EnvelopeRegistryService/Envelopes.ResolveTopic` reports the Retired state (SCN-EnvelopeRegistryService-010, model/services/data-event/EnvelopeRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5868",
        "AIFACTORY-TASK-5869"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12605,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvelopeRegistryService"
        ],
        "aggregates": [
          "EnvelopeRegistryService/TopicDefinition"
        ],
        "apis": [
          "EnvelopeRegistryService/Envelopes.ResolveTopic"
        ],
        "events": [
          "EnvelopeRegistryService/TopicDeprecated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10"
        ],
        "scenarios": [
          "SCN-EnvelopeRegistryService-010"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1447"
      ],
      "source": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/planes/data-event/services/envelope-registry-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1449]",
      "number": 1449
    },
    {
      "id": "AIFACTORY-TASK-5868",
      "type": "task",
      "parent": "AIFACTORY-US-1449",
      "title": "Deprecate transition, TopicDeprecated outbox record and the DeprecationSweeper worker",
      "sequence": "11.02.05.01",
      "description": "Deprecate transition, TopicDeprecated outbox record and the DeprecationSweeper worker. Expected output: The Deprecate transition of an Active topic sets deprecatedAt on its current schema version and writes TopicDeprecated with retiresAt from DataEvent:Envelopes:DeprecationWindowDays in the same transaction; DeprecationSweeper moves the Deprecated topics whose retiresAt passed to Retired through WindowElapsed once per topic and day, publishes nothing and updates connectsoft.factory.data_event.topics.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "The Deprecate transition of an Active topic sets deprecatedAt on its current schema version and writes TopicDeprecated with retiresAt from DataEvent:Envelopes:DeprecationWindowDays in the same transaction; DeprecationSweeper moves the Deprecated topics whose retiresAt passed to Retired through WindowElapsed once per topic and day, publishes nothing and updates connectsoft.factory.data_event.topics."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5868]",
      "number": 5868
    },
    {
      "id": "AIFACTORY-TASK-5869",
      "type": "task",
      "parent": "AIFACTORY-US-1449",
      "title": "Verify deprecation and retirement through the acceptance suite",
      "sequence": "11.02.05.02",
      "description": "Verify deprecation and retirement through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-EnvelopeRegistryService-010\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1449 with a controlled clock, including the publication and payload of TopicDeprecated and two sweeps on the same day.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-EnvelopeRegistryService-010\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1449 with a controlled clock, including the publication and payload of TopicDeprecated and two sweeps on the same day."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5869]",
      "number": 5869
    },
    {
      "id": "AIFACTORY-US-1450",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-056",
      "title": "List the envelope carriage per messaging profile and announce the active profile of the installation with EnvelopeProfileActivated",
      "sequence": "11.02.06",
      "description": "As a platform admin or an operator, I want to see how the one envelope is carried on each messaging profile and which profile this installation runs, so that every host writes the same envelope and deduplicates the same way whatever transport the installation uses. The port-level envelope `run-event-envelope-v1` of ADR-0014, whose schema docs/reference/schemas/run-event-envelope.schema.json is canonical (D137), has the same members on every messaging profile: eventId, eventType, topic, schemaVersion, occurredAt, producer (service, instance, boundedContext), tenantId, projectId, runId, stepId, attemptId, aggregate (type, id, version), correlationId, causationId, traceId, orderingKey, classification and payload, of which eventId, eventType, schemaVersion, occurredAt, producer, tenantId, correlationId and payload are required; what differs per profile is its carriage, and `EnvelopeProfile` records it: the body fields, the transport properties mirrored from the envelope (such as `cs-event-type`, `cs-tenant-id` and `cs-schema-version`), the outbox and inbox table contracts and the deduplication window in hours. The service holds one profile per value of `MessagingProfile` (OrleansOutboxInbox, MassTransitAzureServiceBus, NServiceBus, ADR-0012). A caller with `factory.data.read` lists them through `EnvelopeRegistryService/ListEnvelopeProfiles` and receives each profile with its carriage and contracts and the flag of the active one; a caller without the scope is refused with 403 and nothing is written. Under the reading of D137, the service activates at start-up the profile that `DataEvent:Messaging:Profile` names for the installation: when the active profile changes or the contracts of the active profile differ from what the service holds, it activates that profile, deactivates the others and writes `EnvelopeRegistryService/EnvelopeProfileActivated` with `profile` and `envelopeSchemaVersion` in the same transaction; a start with nothing changed writes nothing. A test checks the first invariant of the aggregate: the envelope members are identical across the three profiles and equal the members of the canonical schema listed above, with the same required members, and only their carriage differs. No profile promises exactly-once external effects or replay, and consumers deduplicate on `eventId` within the window (ADR-0014). Kind: behavior. Traces: services: EnvelopeRegistryService; aggregates: EnvelopeRegistryService/EnvelopeProfile; apis: EnvelopeRegistryService/ListEnvelopeProfiles; events: EnvelopeRegistryService/EnvelopeProfileActivated; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014; requirements: FR-10, XL-02; scenarios: SCN-EnvelopeRegistryService-005, SCN-EnvelopeRegistryService-011. Relates: screens: topic-registry. Sources: model/services/data-event/EnvelopeRegistryService.yaml, docs/reference/schemas/run-event-envelope.schema.json, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md.",
      "acceptanceCriteria": [
        "AC1: Given the three envelope profiles and a caller with `factory.data.read`, when `EnvelopeRegistryService/ListEnvelopeProfiles` is called, then the response is 200 with each profile, its body fields, mirrored transport properties, outbox and inbox contracts and deduplication window and the flag of the active profile; a caller without the scope is refused with 403 and nothing is written (SCN-EnvelopeRegistryService-005).",
        "AC2: Given `DataEvent:Messaging:Profile` set to `orleans-outbox-inbox` and another profile active, or changed contracts of the active profile, when the service starts, then the `EnvelopeRegistryService/EnvelopeProfile` of that profile is active, the others are not, and `EnvelopeRegistryService/EnvelopeProfileActivated` is written in the same transaction; a second start with nothing changed writes nothing (SCN-EnvelopeRegistryService-011, ADR-0012, D137).",
        "AC3: Given a profile activated, when the outbox dispatcher publishes `EnvelopeRegistryService/EnvelopeProfileActivated` on `data-foundations.envelopes.v1.envelope-profile-activated`, then the event is sent under the canonical envelope with `profile` and `envelopeSchemaVersion`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-EnvelopeRegistryService-011, ADR-0014).",
        "AC4: Given the three profiles, when the invariant test of `EnvelopeRegistryService/EnvelopeProfile` runs, then the envelope members are identical across the three profiles and equal the members and required members of docs/reference/schemas/run-event-envelope.schema.json, the canonical schema (D137), only their carriage differs, and no profile states an exactly-once or replay guarantee; a profile with a missing or extra member fails the test (ADR-0014, model/services/data-event/EnvelopeRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-557",
        "AIFACTORY-TASK-5870",
        "AIFACTORY-TASK-5871"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12606,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvelopeRegistryService"
        ],
        "aggregates": [
          "EnvelopeRegistryService/EnvelopeProfile"
        ],
        "apis": [
          "EnvelopeRegistryService/ListEnvelopeProfiles"
        ],
        "events": [
          "EnvelopeRegistryService/EnvelopeProfileActivated"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10",
          "XL-02"
        ],
        "scenarios": [
          "SCN-EnvelopeRegistryService-005",
          "SCN-EnvelopeRegistryService-011"
        ]
      },
      "relates": {
        "screens": [
          "topic-registry"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1450]",
      "number": 1450
    },
    {
      "id": "AIFACTORY-TASK-557",
      "type": "task",
      "parent": "AIFACTORY-US-1450",
      "title": "Envelope profiles per messaging profile",
      "sequence": "11.02.06.01",
      "description": "Envelope profiles per messaging profile. Expected output: The three envelope profiles of MessagingProfile are held with their body fields, mirrored transport properties, outbox and inbox contracts and deduplication window; ListEnvelopeProfiles returns them with the active flag under factory.data.read; under the reading of D137, at start-up the profile of DataEvent:Messaging:Profile is applied and EnvelopeProfileActivated is written in the same transaction only when the active profile or its contracts changed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "The three envelope profiles of MessagingProfile are held with their body fields, mirrored transport properties, outbox and inbox contracts and deduplication window; ListEnvelopeProfiles returns them with the active flag under factory.data.read; under the reading of D137, at start-up the profile of DataEvent:Messaging:Profile is applied and EnvelopeProfileActivated is written in the same transaction only when the active profile or its contracts changed."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12606,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-557]",
      "number": 557
    },
    {
      "id": "AIFACTORY-TASK-5870",
      "type": "task",
      "parent": "AIFACTORY-US-1450",
      "title": "Invariant test of the envelope fields across the three envelope profiles",
      "sequence": "11.02.06.02",
      "description": "Invariant test of the envelope fields across the three envelope profiles. Expected output: A test compares the envelope members of each of the three profiles with each other and with the members and required members of docs/reference/schemas/run-event-envelope.schema.json, the canonical schema that the EnvelopeProfile summary in model/services/data-event/EnvelopeRegistryService.yaml restates (D137); it fails on a member missing from or added to any profile and on a profile that states exactly-once or replay.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "A test compares the envelope members of each of the three profiles with each other and with the members and required members of docs/reference/schemas/run-event-envelope.schema.json, the canonical schema that the EnvelopeProfile summary in model/services/data-event/EnvelopeRegistryService.yaml restates (D137); it fails on a member missing from or added to any profile and on a profile that states exactly-once or replay."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12606,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5870]",
      "number": 5870
    },
    {
      "id": "AIFACTORY-TASK-5871",
      "type": "task",
      "parent": "AIFACTORY-US-1450",
      "title": "Verify the envelope profiles through the acceptance suite",
      "sequence": "11.02.06.03",
      "description": "Verify the envelope profiles through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-005|Scenario=SCN-EnvelopeRegistryService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1450, including two starts with and without a change and the publication and payload of EnvelopeProfileActivated.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-005|Scenario=SCN-EnvelopeRegistryService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1450, including two starts with and without a change and the publication and payload of EnvelopeProfileActivated."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12606,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5871]",
      "number": 5871
    },
    {
      "id": "AIFACTORY-US-1451",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-056",
      "title": "Resolve an event name to its topic and validate an envelope and payload for the outbox writer of a host",
      "sequence": "11.02.07",
      "description": "As a platform admin who relies on the publish-time checks of every Factory host, I want the outbox writer of each host to resolve the topic, schema version and state of an event and to validate an envelope before it enters the outbox, so that no event is written on a retired topic, with a missing scope field or with a payload its consumers cannot read. The hosts of every platform call two internal gRPC methods with a workload identity through the gateway DataEventFoundations. `EnvelopeRegistryService/Envelopes.ResolveTopic` resolves an event name to its topic, its current schema version and its state at publish time; its request `topic-resolution-request-v1` names the event type and the producer, and its reply `topic-resolution-v1` carries the event type, the topic, the producer, the current schema version and the state (D137). `EnvelopeRegistryService/Envelopes.ValidateEnvelope` takes `envelope-validation-request-v1`, which carries an envelope of `run-event-envelope-v1` and the strict mode, and answers `envelope-validation-v1` with the event id, the verdict and every violation, each with its path and rule (D137). These dedicated descriptors replace the borrowed `run-event-v1` and `ack-v1`. A host caches the resolution, and while the registry is unavailable it keeps publishing with its cached topic and schema set, as the failure mode of the model states. `EnvelopeRegistryService/Envelopes.ValidateEnvelope` checks that every envelope field is present, the scope fields `tenantId` and, where the event family carries them, `projectId`, `runId`, `stepId` and `attemptId`, and the correlation fields `correlationId` and `causationId`, that the producer of the envelope is the producer of the topic, that the topic is not Retired, and that the payload is valid against the registered schema version the envelope names; the envelope is accepted or refused, each failed rule is a violation of `envelope-validation-v1` with its path and rule, and every refused envelope increments `connectsoft.factory.data_event.envelope_validation_failures` by producer and topic. The option `DataEvent:Envelopes:StrictValidation`, on in non-production profiles, says whether every outbox write is validated. Both methods are of class read and change nothing in the registry. A caller without a workload identity is refused with UNAUTHENTICATED and an invalid request with INVALID_ARGUMENT; an event name or a topic the registry does not hold is answered NOT_FOUND. The outbox writer that calls these methods belongs to the messaging library of the base template with the Factory profile, consumed by version pin and never forked; which feature makes it call them is reported to the owner, and this PBI delivers the service side and the proto of the `Envelopes` service. Kind: behavior. Traces: services: EnvelopeRegistryService; apis: EnvelopeRegistryService/Envelopes.ResolveTopic, EnvelopeRegistryService/Envelopes.ValidateEnvelope; descriptors: topic-resolution-request-v1, topic-resolution-v1, envelope-validation-request-v1, envelope-validation-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: XL-02, NFR-05; scenarios: SCN-EnvelopeRegistryService-006, SCN-EnvelopeRegistryService-007. Depends on: AIFACTORY-US-1448, AIFACTORY-US-1449, feature:contracts-package. Sources: model/services/data-event/EnvelopeRegistryService.yaml, docs/reference/schemas/run-event-envelope.schema.json, docs/reference/schemas/topic-resolution.schema.json, docs/reference/schemas/envelope-validation.schema.json, docs/planes/data-event/services/envelope-registry-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a workload identity and the event name of an Active topic, when `EnvelopeRegistryService/Envelopes.ResolveTopic` is called, then the reply `topic-resolution-v1` carries the topic, its current schema version and the state Active; for a Deprecated or Retired topic it carries that state; an unknown event name is answered NOT_FOUND, and nothing is written (SCN-EnvelopeRegistryService-006, D137).",
        "AC2: Given a valid envelope and payload for an Active topic, when `EnvelopeRegistryService/Envelopes.ValidateEnvelope` is called, then the reply `envelope-validation-v1` is valid with no violation; given an envelope without `tenantId` or `correlationId`, a producer that is not the producer of the topic, a Retired topic or a payload that violates the registered schema version, then the reply is not valid, each failed rule is a violation with its path and rule, and `connectsoft.factory.data_event.envelope_validation_failures` is incremented by producer and topic (SCN-EnvelopeRegistryService-007, ADR-0014, D137).",
        "AC3: Given a caller without workload identity or an invalid request, when either method is called, then it is refused with UNAUTHENTICATED or INVALID_ARGUMENT and no state changes (SCN-EnvelopeRegistryService-006, SCN-EnvelopeRegistryService-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/reference/schemas/topic-resolution.schema.json",
        "docs/reference/schemas/envelope-validation.schema.json",
        "docs/planes/data-event/services/envelope-registry-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5872",
        "AIFACTORY-TASK-5873",
        "AIFACTORY-TASK-5874"
      ],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12607,
      "kind": "behavior",
      "traces": {
        "services": [
          "EnvelopeRegistryService"
        ],
        "apis": [
          "EnvelopeRegistryService/Envelopes.ResolveTopic",
          "EnvelopeRegistryService/Envelopes.ValidateEnvelope"
        ],
        "descriptors": [
          "topic-resolution-request-v1",
          "topic-resolution-v1",
          "envelope-validation-request-v1",
          "envelope-validation-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "XL-02",
          "NFR-05"
        ],
        "scenarios": [
          "SCN-EnvelopeRegistryService-006",
          "SCN-EnvelopeRegistryService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1448",
        "AIFACTORY-US-1449",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/data-event/EnvelopeRegistryService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/reference/schemas/topic-resolution.schema.json",
        "docs/reference/schemas/envelope-validation.schema.json",
        "docs/planes/data-event/services/envelope-registry-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-1451]",
      "number": 1451
    },
    {
      "id": "AIFACTORY-TASK-5872",
      "type": "task",
      "parent": "AIFACTORY-US-1451",
      "title": "Proto of the Envelopes service with the methods and the dedicated descriptors of the model",
      "sequence": "11.02.07.01",
      "description": "Proto of the Envelopes service with the methods and the dedicated descriptors of the model. Expected output: The proto of the Envelopes service declares ResolveTopic with the messages of topic-resolution-request-v1 and topic-resolution-v1 and ValidateEnvelope with the messages of envelope-validation-request-v1, which carries the envelope of run-event-envelope-v1, and envelope-validation-v1 with the verdict and the violations, as model/services/data-event/EnvelopeRegistryService.yaml and docs/reference/schemas/topic-resolution.schema.json and envelope-validation.schema.json record them (D137); it defines no field the schemas do not hold and is published from the repository as the contract the outbox writers of the hosts build against.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "The proto of the Envelopes service declares ResolveTopic with the messages of topic-resolution-request-v1 and topic-resolution-v1 and ValidateEnvelope with the messages of envelope-validation-request-v1, which carries the envelope of run-event-envelope-v1, and envelope-validation-v1 with the verdict and the violations, as model/services/data-event/EnvelopeRegistryService.yaml and docs/reference/schemas/topic-resolution.schema.json and envelope-validation.schema.json record them (D137); it defines no field the schemas do not hold and is published from the repository as the contract the outbox writers of the hosts build against."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12607,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5872]",
      "number": 5872
    },
    {
      "id": "AIFACTORY-TASK-5873",
      "type": "task",
      "parent": "AIFACTORY-US-1451",
      "title": "ResolveTopic and ValidateEnvelope against the registered topics and schema versions",
      "sequence": "11.02.07.02",
      "description": "ResolveTopic and ValidateEnvelope against the registered topics and schema versions. Expected output: ResolveTopic answers topic-resolution-v1 with topic, current schema version and state for an event name and NOT_FOUND for an unknown one; ValidateEnvelope checks the envelope fields, the scope and correlation fields, the producer of the topic, the Retired state and the payload against the registered schema version and answers envelope-validation-v1 with the verdict and every failed rule as a violation with its path and rule, incrementing connectsoft.factory.data_event.envelope_validation_failures; callers without workload identity and invalid requests are refused with UNAUTHENTICATED and INVALID_ARGUMENT; neither method writes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "ResolveTopic answers topic-resolution-v1 with topic, current schema version and state for an event name and NOT_FOUND for an unknown one; ValidateEnvelope checks the envelope fields, the scope and correlation fields, the producer of the topic, the Retired state and the payload against the registered schema version and answers envelope-validation-v1 with the verdict and every failed rule as a violation with its path and rule, incrementing connectsoft.factory.data_event.envelope_validation_failures; callers without workload identity and invalid requests are refused with UNAUTHENTICATED and INVALID_ARGUMENT; neither method writes."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12607,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5873]",
      "number": 5873
    },
    {
      "id": "AIFACTORY-TASK-5874",
      "type": "task",
      "parent": "AIFACTORY-US-1451",
      "title": "Verify publish-time resolution and validation through the acceptance suite",
      "sequence": "11.02.07.03",
      "description": "Verify publish-time resolution and validation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-006|Scenario=SCN-EnvelopeRegistryService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1451 over an Active, a Deprecated and a Retired topic and an envelope matrix of missing fields, a foreign producer and an invalid payload.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-EnvelopeRegistryService-006|Scenario=SCN-EnvelopeRegistryService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1451 over an Active, a Deprecated and a Retired topic and an envelope matrix of missing fields, a foreign producer and an invalid payload."
      ],
      "sourceArtifacts": [
        "model/services/data-event/EnvelopeRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvelopeRegistryService"
      ],
      "children": [],
      "buildOrder": 126,
      "phase": "factory",
      "stackRank": 12607,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5874]",
      "number": 5874
    },
    {
      "id": "AIFACTORY-FEAT-057",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-011",
      "title": "RetentionResidencyService: complete delivery",
      "sequence": "11.03",
      "description": "RetentionResidencyService is the service of bounded context BC-42 (Data & Event Foundations). Retention rules per store class and classification (traces 30 days, audit 7 years redacted, runs and artifacts 1 year tenant-configurable), residency rules per tenant (selected region, allowed engines), deletion orders that fan out to every owning service and complete within 30 days with acknowledgements, and export orders in open formats — data governance (D31, ADR-0019) as a service (BC-42). Its own repository is ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Delivers: RetentionResidencyService (complete). Increment I4: Trust and accountability. Build order 127 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-048",
        "AIFACTORY-US-1452",
        "AIFACTORY-US-1453",
        "AIFACTORY-US-1454",
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "AIFACTORY-US-1457",
        "AIFACTORY-US-1458",
        "AIFACTORY-US-1459",
        "AIFACTORY-US-1460",
        "AIFACTORY-US-1461",
        "AIFACTORY-US-1462",
        "AIFACTORY-US-1463",
        "AIFACTORY-US-1464",
        "AIFACTORY-US-1465"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12700,
      "titlePrefix": "[AIFACTORY-FEAT-057]",
      "number": 57
    },
    {
      "id": "AIFACTORY-US-048",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Data is kept, placed and deleted by rule, with proof",
      "sequence": "11.03.01",
      "description": "As a workspace administrator, I want retention and residency rules for my tenant and deletion orders that every owning service acknowledges, so that I can prove where data lives, how long it is kept and that a deletion happened. This is the integration PBI of the feature. RetentionResidencyService is the service of bounded context BC-42 that turns the data governance of ADR-0019 into rules and orders. It owns three aggregates in `retention-residency-sql`: `RetentionRule`, how long a store class keeps data of a classification for a tenant, under the platform defaults that are the ceiling; `ResidencyRule`, the region of a tenant with its allowed regions and engines per store class and the residency class it gives the model router; and `GovernanceOrder`, a tenant deletion, project deletion, run purge, export or legal hold for a scope, fanned out to every owning service as a task that completes only when that owner acknowledges with a receipt and becomes Overdue when `DataEvent:Retention:DeletionWindowDays` elapses. Callers reach its seven REST operations through the gateway DataEventFoundations under `factory.data.read`, `factory.data.admin` and, for owning services, `factory.data.acknowledge`; StoreProfileService and the model router call `Retention.EvaluateResidency`. The behaviour is delivered by the behaviour PBIs of this feature: retention rules (AIFACTORY-US-1452), residency (AIFACTORY-US-1453), residency checks (AIFACTORY-US-1454), issuing orders (AIFACTORY-US-1455), dispatch, acknowledgement and the tenant deletion saga (AIFACTORY-US-1456), export (AIFACTORY-US-1457) and the retention sweep (AIFACTORY-US-1458); the deletion-order handlers of the services delivered before this increment, their legal-hold handlers where the feature of the service does not already build one (D137), and the retention and legal-hold handlers of ArtifactService (D125), are built by AIFACTORY-US-1459 to AIFACTORY-US-1465 in the repositories of those services, one PBI per group of owners, proven by the deletion and hold scenarios SCN-RetentionResidencyService-011 and SCN-RetentionResidencyService-014. The six events leave through the outbox of the `retention-residency` messaging profile under the canonical envelope, and the one consumed event enters through its inbox. Messaging, persistence, scheduling and telemetry come from the base template with the Factory profile and the pinned observability packages, never forked. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService, created by the repository checklist of feature `repository-and-pipeline-conventions`. Kind: behavior. Traces: services: RetentionResidencyService, DataEventFoundations; aggregates: RetentionResidencyService/RetentionRule, RetentionResidencyService/ResidencyRule, RetentionResidencyService/GovernanceOrder; apis: RetentionResidencyService/ListRetentionRules, RetentionResidencyService/SetRetentionRule, RetentionResidencyService/GetResidency, RetentionResidencyService/SetResidency, RetentionResidencyService/IssueGovernanceOrder, RetentionResidencyService/GetGovernanceOrder, RetentionResidencyService/AcknowledgeOrderTask, RetentionResidencyService/Retention.EvaluateResidency; events: RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/ResidencyRuleChanged, RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/DeletionOrderCompleted, RetentionResidencyService/ExportCompleted, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0015, ADR-0018, ADR-0019, ADR-0028; requirements: FR-12, NFR-14, NFR-15, NFR-16. Relates: screens: retention-residency, governance-orders. Depends on: AIFACTORY-US-1452, AIFACTORY-US-1453, AIFACTORY-US-1454, AIFACTORY-US-1455, AIFACTORY-US-1456, AIFACTORY-US-1457, AIFACTORY-US-1458, AIFACTORY-US-1459, AIFACTORY-US-1460, AIFACTORY-US-1461, AIFACTORY-US-1462, AIFACTORY-US-1463, AIFACTORY-US-1464, AIFACTORY-US-1465, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/data-event/RetentionResidencyService.yaml, model/scenarios/RetentionResidencyService.yaml, docs/planes/data-event/services/retention-residency-service/index.md#purpose-and-responsibilities, docs/architecture/data-governance.md#retention-and-deletion, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.RetentionResidencyService, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RetentionResidencyService --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-1452 to AIFACTORY-US-1458, when they run in the pipeline, then each of the fourteen scenarios of RetentionResidencyService has a passing test that names its id, and a filter that discovers no test counts as a failure (model/scenarios/RetentionResidencyService.yaml).",
        "AC3: Given the outbox and inbox of the `retention-residency` messaging profile after the acceptance suites, when their records are read, then `RetentionResidencyService/RetentionRuleChanged`, `RetentionResidencyService/ResidencyRuleChanged`, `RetentionResidencyService/DeletionOrderIssued`, `RetentionResidencyService/DeletionOrderCompleted`, `RetentionResidencyService/ExportCompleted` and `RetentionResidencyService/LegalHoldChanged` were written in the transaction of the state change they announce, and the inbox registers exactly the one subscription the model lists (ADR-0019, model/services/data-event/RetentionResidencyService.yaml).",
        "AC4: Given the acceptance suites of AIFACTORY-US-1459 to AIFACTORY-US-1465 in the repositories of the owning services, when they run, then each owning service named there deletes an ordered scope from the stores it owns and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask`, and a repeated order changes nothing (ADR-0019).",
        "AC5: Given the service starts, when liveness and readiness are probed, then readiness reports `retention-residency-sql` and the messaging transport, and the telemetry conformance test of the pinned observability packages passes with `connectsoft.factory.data_event.orders`, `connectsoft.factory.data_event.order_completion_days` and `connectsoft.factory.data_event.residency_violations`, none of them carrying a scope value or a personal datum (ADR-0018, model/services/data-event/RetentionResidencyService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "model/scenarios/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#purpose-and-responsibilities",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-381",
        "AIFACTORY-TASK-382",
        "AIFACTORY-TASK-383",
        "AIFACTORY-TASK-384",
        "AIFACTORY-TASK-385",
        "AIFACTORY-TASK-386",
        "AIFACTORY-TASK-387",
        "AIFACTORY-TASK-705"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService",
          "DataEventFoundations"
        ],
        "aggregates": [
          "RetentionResidencyService/RetentionRule",
          "RetentionResidencyService/ResidencyRule",
          "RetentionResidencyService/GovernanceOrder"
        ],
        "apis": [
          "RetentionResidencyService/ListRetentionRules",
          "RetentionResidencyService/SetRetentionRule",
          "RetentionResidencyService/GetResidency",
          "RetentionResidencyService/SetResidency",
          "RetentionResidencyService/IssueGovernanceOrder",
          "RetentionResidencyService/GetGovernanceOrder",
          "RetentionResidencyService/AcknowledgeOrderTask",
          "RetentionResidencyService/Retention.EvaluateResidency"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/ResidencyRuleChanged",
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/DeletionOrderCompleted",
          "RetentionResidencyService/ExportCompleted",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0018",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-12",
          "NFR-14",
          "NFR-15",
          "NFR-16"
        ]
      },
      "relates": {
        "screens": [
          "retention-residency",
          "governance-orders"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1452",
        "AIFACTORY-US-1453",
        "AIFACTORY-US-1454",
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "AIFACTORY-US-1457",
        "AIFACTORY-US-1458",
        "AIFACTORY-US-1459",
        "AIFACTORY-US-1460",
        "AIFACTORY-US-1461",
        "AIFACTORY-US-1462",
        "AIFACTORY-US-1463",
        "AIFACTORY-US-1464",
        "AIFACTORY-US-1465",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "model/scenarios/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#purpose-and-responsibilities",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-048]",
      "number": 48
    },
    {
      "id": "AIFACTORY-TASK-381",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.RetentionResidencyService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "11.03.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.RetentionResidencyService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RetentionResidencyService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `retention-residency`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RetentionResidencyService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RetentionResidencyService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `retention-residency`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-381]",
      "number": 381
    },
    {
      "id": "AIFACTORY-TASK-382",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "Domain model: RetentionRule, ResidencyRule, GovernanceOrder",
      "sequence": "11.03.01.02",
      "description": "Domain model: RetentionRule, ResidencyRule, GovernanceOrder. Expected output: The aggregates hold the fields and invariants of the model (a tenant rule never longer than the platform default of its class, audit evidence redacted and kept at least 2555 days, a held scope never expires, deletion includes derived indexes and memory, an export carries a manifest) and the six transitions of OrderState; unit tests cover every invariant and every transition and refuse every transition the model does not list.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates hold the fields and invariants of the model (a tenant rule never longer than the platform default of its class, audit evidence redacted and kept at least 2555 days, a held scope never expires, deletion includes derived indexes and memory, an export carries a manifest) and the six transitions of OrderState; unit tests cover every invariant and every transition and refuse every transition the model does not list."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-382]",
      "number": 382
    },
    {
      "id": "AIFACTORY-TASK-383",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "Persistence in retention-residency-sql: RetentionRules, ResidencyRules, GovernanceOrders, GovernanceOrderTasks",
      "sequence": "11.03.01.03",
      "description": "Persistence in retention-residency-sql: RetentionRules, ResidencyRules, GovernanceOrders, GovernanceOrderTasks. Expected output: Mappings and migrations for the four modelled tables with the tenant row filter, the unique index on tenant, store class and classification and the index on tenant, state and due moment; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the four modelled tables with the tenant row filter, the unique index on tenant, store class and classification and the index on tenant, state and due moment; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-383]",
      "number": 383
    },
    {
      "id": "AIFACTORY-TASK-384",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "API hosting skeleton: the 7 REST and 1 gRPC operations with scope enforcement and problem responses",
      "sequence": "11.03.01.04",
      "description": "API hosting skeleton: the 7 REST and 1 gRPC operations with scope enforcement and problem responses. Expected output: The seven REST operations are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, the Idempotency-Key filter of IssueGovernanceOrder, the internal visibility of AcknowledgeOrderTask and problem responses for every modelled refusal code; Retention.EvaluateResidency is hosted with workload identity checks; the OpenAPI and proto documents are published; the behaviour of each operation is delivered by AIFACTORY-US-1452 to AIFACTORY-US-1456, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The seven REST operations are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, the Idempotency-Key filter of IssueGovernanceOrder, the internal visibility of AcknowledgeOrderTask and problem responses for every modelled refusal code; Retention.EvaluateResidency is hosted with workload identity checks; the OpenAPI and proto documents are published; the behaviour of each operation is delivered by AIFACTORY-US-1452 to AIFACTORY-US-1456, not here."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-384]",
      "number": 384
    },
    {
      "id": "AIFACTORY-TASK-385",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "Messaging skeleton: outbox of the retention-residency profile for 6 published events, inbox for StoreBindingChanged",
      "sequence": "11.03.01.05",
      "description": "Messaging skeleton: outbox of the retention-residency profile for 6 published events, inbox for StoreBindingChanged. Expected output: The outbox writer enlists in the transaction of each state change and the dispatcher publishes the six events on their modelled topics under the canonical envelope; the inbox registers the one subscription to StoreBindingChanged with deduplication on the event id, and a test fails when a subscription appears that the model does not list.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of each state change and the dispatcher publishes the six events on their modelled topics under the canonical envelope; the inbox registers the one subscription to StoreBindingChanged with deduplication on the event id, and a test fails when a subscription appears that the model does not list."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-385]",
      "number": 385
    },
    {
      "id": "AIFACTORY-TASK-386",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "Worker hosting skeleton: RetentionSweeper, OrderDispatcher, Exporter",
      "sequence": "11.03.01.06",
      "description": "Worker hosting skeleton: RetentionSweeper, OrderDispatcher, Exporter. Expected output: Each worker is hosted with its modelled trigger, retry policy, idempotency key and partition by tenant (RetentionSweeper daily with ruleId plus day, OrderDispatcher and Exporter on DeletionOrderIssued with orderId plus owner service and orderId); a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1456 to AIFACTORY-US-1458.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Each worker is hosted with its modelled trigger, retry policy, idempotency key and partition by tenant (RetentionSweeper daily with ruleId plus day, OrderDispatcher and Exporter on DeletionOrderIssued with orderId plus owner service and orderId); a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1456 to AIFACTORY-US-1458."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-386]",
      "number": 386
    },
    {
      "id": "AIFACTORY-TASK-387",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "Security, tenancy and telemetry of RetentionResidencyService",
      "sequence": "11.03.01.07",
      "description": "Security, tenancy and telemetry of RetentionResidencyService. Expected output: The three scopes and four roles of the model are enforced, every query runs under the tenant row filter so an order or rule 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 three metrics of the model through its instrument helper and references the conformance test package from its architecture tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three scopes and four roles of the model are enforced, every query runs under the tenant row filter so an order or rule 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 three metrics of the model through its instrument helper and references the conformance test package from its architecture tests."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-387]",
      "number": 387
    },
    {
      "id": "AIFACTORY-TASK-705",
      "type": "task",
      "parent": "AIFACTORY-US-048",
      "title": "Verify retention-residency-and-deletion by running the declared command",
      "sequence": "11.03.01.08",
      "description": "Verify retention-residency-and-deletion by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.RetentionResidencyService, then `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-RetentionResidencyService\"`; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-048, with a test for each of SCN-RetentionResidencyService-001 to SCN-RetentionResidencyService-014.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.RetentionResidencyService, then `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-RetentionResidencyService\"`; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-048, with a test for each of SCN-RetentionResidencyService-001 to SCN-RetentionResidencyService-014."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-705]",
      "number": 705
    },
    {
      "id": "AIFACTORY-US-1452",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Read the effective retention per store class and shorten it for a tenant, announced by RetentionRuleChanged",
      "sequence": "11.03.02",
      "description": "As a workspace admin or a platform admin, I want to see how long each store class keeps data of each classification and to shorten it for my tenant, so that the tenant keeps data no longer than it chose and never longer than the platform allows. A caller with `factory.data.read` reads `RetentionResidencyService/ListRetentionRules` on `GET /factory/data/retention` and receives, for the tenant of the token, the effective retention of every store class and classification: the platform default of `DataEvent:Retention:PlatformDefaults` (traces 30 days, runs and artifacts 365, projections 395, audit 2555) where the tenant has no rule, and the tenant rule where it has one, each with its expiry action (delete, redact or archive) and whether it is exempt from legal holds. A Workspace admin calls `RetentionResidencyService/SetRetentionRule` with `factory.data.admin` on `PUT /factory/data/retention/{storeClass}/{classification}` to set the retention days and expiry action of the tenant for that class and classification; the platform default is the ceiling, so a value longer than the default of the class is refused with 422 and the rule named, as is an unknown store class or classification, a negative value or, for the class `audit`, a value below 2555 days or an expiry action other than redact. A Platform admin sets the platform default of a class through the same operation under the platform tenant. The operation is idempotent by nature: the same value again returns 200 and publishes nothing. A change writes `RetentionResidencyService/RetentionRuleChanged` with `ruleId`, `tenantId`, `storeClass`, `classification` and `retentionDays` in the same transaction; the owning services apply it in their own handlers, and for ArtifactService a tenant rule of the class `artifacts` replaces the default one-year retention of its own sweep (AIFACTORY-US-1462). A caller without the scope, or a Workspace admin who sets a platform default, is refused with 403. StudioBff serves the reads and the edit through the view `retention-residency`. Kind: behavior. Traces: services: RetentionResidencyService; aggregates: RetentionResidencyService/RetentionRule; apis: RetentionResidencyService/ListRetentionRules, RetentionResidencyService/SetRetentionRule; events: RetentionResidencyService/RetentionRuleChanged; adrs: ADR-0012, ADR-0019; requirements: FR-12, NFR-14; scenarios: SCN-RetentionResidencyService-001, SCN-RetentionResidencyService-002, SCN-RetentionResidencyService-009. Relates: screens: retention-residency. Sources: model/services/data-event/RetentionResidencyService.yaml, docs/architecture/data-governance.md#retention-and-deletion.",
      "acceptanceCriteria": [
        "AC1: Given a tenant with one rule of its own and a caller with `factory.data.read`, when `RetentionResidencyService/ListRetentionRules` is called, then the response is 200 with the platform default for every class without a tenant rule and the tenant rule for the one it set, each with its expiry action, and nothing is written; a caller without the scope is refused with 403 (SCN-RetentionResidencyService-001).",
        "AC2: Given a Workspace admin with `factory.data.admin`, when `RetentionResidencyService/SetRetentionRule` shortens runs of classification internal to 180 days, then the response is 200, the `RetentionResidencyService/RetentionRule` holds 180 and `RetentionResidencyService/RetentionRuleChanged` is written in the same transaction; the same call again returns 200 and writes nothing (SCN-RetentionResidencyService-002, ADR-0019).",
        "AC3: Given a value longer than the platform default of the class, an audit value below 2555 days or with an expiry action other than redact, or an unknown class or classification, when `RetentionResidencyService/SetRetentionRule` is called, then the response is 422 naming the rule; given a caller without the scope, or a Workspace admin setting a platform default, then 403; no refusal writes a row or an event (SCN-RetentionResidencyService-002).",
        "AC4: Given a rule changed, when the outbox dispatcher publishes `RetentionResidencyService/RetentionRuleChanged` on `data-foundations.retention.v1.retention-rule-changed`, then the event is sent under the canonical envelope with `ruleId`, `tenantId`, `storeClass`, `classification` and `retentionDays`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RetentionResidencyService-009, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-558",
        "AIFACTORY-TASK-5875",
        "AIFACTORY-TASK-5876"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12702,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService"
        ],
        "aggregates": [
          "RetentionResidencyService/RetentionRule"
        ],
        "apis": [
          "RetentionResidencyService/ListRetentionRules",
          "RetentionResidencyService/SetRetentionRule"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ],
        "requirements": [
          "FR-12",
          "NFR-14"
        ],
        "scenarios": [
          "SCN-RetentionResidencyService-001",
          "SCN-RetentionResidencyService-002",
          "SCN-RetentionResidencyService-009"
        ]
      },
      "relates": {
        "screens": [
          "retention-residency"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion"
      ],
      "titlePrefix": "[AIFACTORY-US-1452]",
      "number": 1452
    },
    {
      "id": "AIFACTORY-TASK-558",
      "type": "task",
      "parent": "AIFACTORY-US-1452",
      "title": "Retention and residency rules",
      "sequence": "11.03.02.01",
      "description": "Retention and residency rules. Expected output: Retention rules are stored per tenant, store class and classification under the platform defaults of DataEvent:Retention:PlatformDefaults, ListRetentionRules returns the effective rule per class and classification and SetRetentionRule changes it and writes RetentionRuleChanged in the same transaction.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Retention rules are stored per tenant, store class and classification under the platform defaults of DataEvent:Retention:PlatformDefaults, ListRetentionRules returns the effective rule per class and classification and SetRetentionRule changes it and writes RetentionRuleChanged in the same transaction."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-558]",
      "number": 558
    },
    {
      "id": "AIFACTORY-TASK-5875",
      "type": "task",
      "parent": "AIFACTORY-US-1452",
      "title": "Ceiling, audit floor and refusals of SetRetentionRule",
      "sequence": "11.03.02.02",
      "description": "Ceiling, audit floor and refusals of SetRetentionRule. Expected output: SetRetentionRule refuses with 422 a value above the platform default of the class, an audit rule below 2555 days or with an expiry action other than redact and an unknown class or classification, refuses with 403 a missing scope and a Workspace admin who sets a platform default, and changes nothing on an unchanged repeat; unit tests cover each rule.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "SetRetentionRule refuses with 422 a value above the platform default of the class, an audit rule below 2555 days or with an expiry action other than redact and an unknown class or classification, refuses with 403 a missing scope and a Workspace admin who sets a platform default, and changes nothing on an unchanged repeat; unit tests cover each rule."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5875]",
      "number": 5875
    },
    {
      "id": "AIFACTORY-TASK-5876",
      "type": "task",
      "parent": "AIFACTORY-US-1452",
      "title": "Verify retention rules through the acceptance suite",
      "sequence": "11.03.02.03",
      "description": "Verify retention rules through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-001|Scenario=SCN-RetentionResidencyService-002|Scenario=SCN-RetentionResidencyService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1452, including the publication and payload of RetentionRuleChanged under a transport outage; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-001|Scenario=SCN-RetentionResidencyService-002|Scenario=SCN-RetentionResidencyService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1452, including the publication and payload of RetentionRuleChanged under a transport outage; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5876]",
      "number": 5876
    },
    {
      "id": "AIFACTORY-US-1453",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Read the residency of a tenant and select its region, announced by ResidencyRuleChanged",
      "sequence": "11.03.03",
      "description": "As a platform admin or a workspace admin, I want to select the region of a tenant and the engines allowed per store class, so that every store, model deployment and connector of the tenant is placed where its rule allows. A caller with `factory.data.read` reads `RetentionResidencyService/GetResidency` on `GET /factory/data/residency` and receives the residency rule of the tenant of the token: its region, its allowed regions, the allowed engines per store class and its model data residency (same-region, eu or any), which feeds the privacy class of the model router. A tenant without a rule is answered with the default region of the installation and nothing is written. An admin with `factory.data.admin` selects the region through `RetentionResidencyService/SetResidency` on `PUT /factory/data/residency`, a production-class operation; the body names the region, the allowed regions and engines and the model data residency. The first selection of a tenant creates the `ResidencyRule` and answers 200, and the same body again answers 200 and changes nothing. A region that the installation does not offer, an allowed region list that does not contain the region, an engine that is not a store profile of its class or an unknown model data residency is refused with 422 and the rule named. The model says that a later change of region issues a migration order, but no order kind carries a migration and residency migration orders are a later capability of the service; until the owner decides, a change of region of a tenant that already has one is refused with 422 naming that rule and no data moves, while a change of the allowed engines or of the model data residency in the same region is applied. Every applied change writes `RetentionResidencyService/ResidencyRuleChanged` with `tenantId`, `region` and `modelDataResidency` in the same transaction. A caller without the scope is refused with 403. StudioBff serves the view `retention-residency`. Kind: behavior. Traces: services: RetentionResidencyService; aggregates: RetentionResidencyService/ResidencyRule; apis: RetentionResidencyService/GetResidency, RetentionResidencyService/SetResidency; events: RetentionResidencyService/ResidencyRuleChanged; adrs: ADR-0012, ADR-0019; requirements: FR-12, NFR-15; scenarios: SCN-RetentionResidencyService-003, SCN-RetentionResidencyService-004, SCN-RetentionResidencyService-010. Relates: screens: retention-residency. Sources: model/services/data-event/RetentionResidencyService.yaml, docs/planes/data-event/services/retention-residency-service/index.md#later-capabilities.",
      "acceptanceCriteria": [
        "AC1: Given a tenant with a residency rule and a caller with `factory.data.read`, when `RetentionResidencyService/GetResidency` is called, then the response is 200 with region, allowed regions, allowed engines per class and model data residency, and nothing is written; a caller without the scope is refused with 403 (SCN-RetentionResidencyService-003).",
        "AC2: Given a tenant without a residency rule and an admin with `factory.data.admin`, when `RetentionResidencyService/SetResidency` selects westeurope, then the response is 200, the `RetentionResidencyService/ResidencyRule` exists and `RetentionResidencyService/ResidencyRuleChanged` is written in the same transaction; the same body again answers 200 and writes nothing (SCN-RetentionResidencyService-004, ADR-0019).",
        "AC3: Given a region the installation does not offer, an allowed list without the region, an engine that is not a profile of its class, or a change of region of a tenant that already has one, when `RetentionResidencyService/SetResidency` is called, then the response is 422 naming the rule and no data moves; a caller without the scope is refused with 403; no refusal writes a row or an event (SCN-RetentionResidencyService-004).",
        "AC4: Given a residency change applied, when the outbox dispatcher publishes `RetentionResidencyService/ResidencyRuleChanged` on `data-foundations.residency.v1.residency-rule-changed`, then the event is sent under the canonical envelope with `tenantId`, `region` and `modelDataResidency`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-RetentionResidencyService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#later-capabilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5877",
        "AIFACTORY-TASK-5878"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12703,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService"
        ],
        "aggregates": [
          "RetentionResidencyService/ResidencyRule"
        ],
        "apis": [
          "RetentionResidencyService/GetResidency",
          "RetentionResidencyService/SetResidency"
        ],
        "events": [
          "RetentionResidencyService/ResidencyRuleChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ],
        "requirements": [
          "FR-12",
          "NFR-15"
        ],
        "scenarios": [
          "SCN-RetentionResidencyService-003",
          "SCN-RetentionResidencyService-004",
          "SCN-RetentionResidencyService-010"
        ]
      },
      "relates": {
        "screens": [
          "retention-residency"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#later-capabilities"
      ],
      "titlePrefix": "[AIFACTORY-US-1453]",
      "number": 1453
    },
    {
      "id": "AIFACTORY-TASK-5877",
      "type": "task",
      "parent": "AIFACTORY-US-1453",
      "title": "GetResidency and SetResidency with the first selection, the same-region changes and the ResidencyRuleChanged outbox record",
      "sequence": "11.03.03.01",
      "description": "GetResidency and SetResidency with the first selection, the same-region changes and the ResidencyRuleChanged outbox record. Expected output: GetResidency returns the rule of the tenant or the installation default; SetResidency creates the rule on the first selection, applies engine and model data residency changes in the same region, writes ResidencyRuleChanged in the same transaction, changes nothing on an unchanged repeat and refuses with 422 an unknown region, an inconsistent allowed list, an engine outside its class and a change of region of a tenant that has one, and with 403 a missing scope.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "GetResidency returns the rule of the tenant or the installation default; SetResidency creates the rule on the first selection, applies engine and model data residency changes in the same region, writes ResidencyRuleChanged in the same transaction, changes nothing on an unchanged repeat and refuses with 422 an unknown region, an inconsistent allowed list, an engine outside its class and a change of region of a tenant that has one, and with 403 a missing scope."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5877]",
      "number": 5877
    },
    {
      "id": "AIFACTORY-TASK-5878",
      "type": "task",
      "parent": "AIFACTORY-US-1453",
      "title": "Verify residency through the acceptance suite",
      "sequence": "11.03.03.02",
      "description": "Verify residency through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-003|Scenario=SCN-RetentionResidencyService-004|Scenario=SCN-RetentionResidencyService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1453, including the refused change of region and the publication and payload of ResidencyRuleChanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-003|Scenario=SCN-RetentionResidencyService-004|Scenario=SCN-RetentionResidencyService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1453, including the refused change of region and the publication and payload of ResidencyRuleChanged."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5878]",
      "number": 5878
    },
    {
      "id": "AIFACTORY-US-1454",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Evaluate a store binding, model deployment or connector region against the residency of its tenant",
      "sequence": "11.03.04",
      "description": "As a platform admin who relies on StoreProfileService and the model router to check residency, I want each of them to ask whether a candidate region and engine satisfy the residency of a tenant before it binds or selects it, so that no data of a tenant is placed outside the regions it allows. StoreProfileService before it binds a store and the model router before it selects a deployment call the internal gRPC method `RetentionResidencyService/Retention.EvaluateResidency` with a workload identity and the request `residency-evaluation-request-v1`, which names the tenant, which must be the one the workload forwards under its service scope, and the candidate: its kind (store-binding, model-deployment or connector), its id, its region and, for a store, its store class and engine. The reply `residency-evaluation-v1` carries the tenant, the candidate, the verdict `allowed` and the rule it applied: the region of the tenant, its allowed regions, its model data residency and, for a refusal, the reason (D137); these dedicated descriptors replace the borrowed `execution-scope-v1` and `ack-v1`. The service reads the residency rule of that tenant and accepts the candidate when the region is in the allowed regions and the engine is allowed for the class, and refuses it otherwise, naming the rule that refused it in the reply. Every refusal increments `connectsoft.factory.data_event.residency_violations` by tenant and kind; the method is of class read and writes nothing else. A tenant without a residency rule is evaluated against the default region of the installation. A caller without a workload identity is refused with UNAUTHENTICATED and an invalid request with INVALID_ARGUMENT. The service also consumes `StoreBindingChanged` of StoreProfileService through its handler `CheckResidency`, idempotent on the event id through the inbox: it evaluates the binding of the event against the rule of its tenant in the same way, and a binding that violates the rule increments the same metric and is recorded as evidence with AuditService, so a binding made while this service was unavailable is still found. The event itself is traced by the feature of StoreProfileService; this PBI does not depend on that feature, because StoreProfileService depends on this one. Kind: behavior. Traces: services: RetentionResidencyService, StoreProfileService, ModelRouterService; aggregates: RetentionResidencyService/ResidencyRule; apis: RetentionResidencyService/Retention.EvaluateResidency; descriptors: residency-evaluation-request-v1, residency-evaluation-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: NFR-15; scenarios: SCN-RetentionResidencyService-008. Depends on: AIFACTORY-US-1453, feature:audit-service-complete. Sources: model/services/data-event/RetentionResidencyService.yaml, docs/reference/schemas/residency-evaluation.schema.json, docs/planes/data-event/services/retention-residency-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a tenant whose rule allows westeurope and a workload identity, when `RetentionResidencyService/Retention.EvaluateResidency` is called for a store binding in westeurope with an allowed engine, then the reply `residency-evaluation-v1` is allowed and nothing is written; for a binding in another region or with an engine not allowed for its class, the reply is not allowed with the region, the allowed regions and the reason of the refusing rule, and `connectsoft.factory.data_event.residency_violations` is incremented by tenant and kind (SCN-RetentionResidencyService-008, ADR-0019, D137).",
        "AC2: Given a caller without workload identity or an invalid request, when the method is called, then it is refused with UNAUTHENTICATED or INVALID_ARGUMENT and no state changes (SCN-RetentionResidencyService-008, ADR-0015).",
        "AC3: Given a delivery of `StoreBindingChanged` for a binding that violates the residency of its tenant, when `CheckResidency` handles it, then the violation is counted and recorded as evidence once, and a redelivery of the same event changes nothing (model/services/data-event/RetentionResidencyService.yaml, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/reference/schemas/residency-evaluation.schema.json",
        "docs/planes/data-event/services/retention-residency-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5879",
        "AIFACTORY-TASK-5880",
        "AIFACTORY-TASK-5881"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12704,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService",
          "StoreProfileService",
          "ModelRouterService"
        ],
        "aggregates": [
          "RetentionResidencyService/ResidencyRule"
        ],
        "apis": [
          "RetentionResidencyService/Retention.EvaluateResidency"
        ],
        "descriptors": [
          "residency-evaluation-request-v1",
          "residency-evaluation-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-15"
        ],
        "scenarios": [
          "SCN-RetentionResidencyService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1453",
        "feature:audit-service-complete"
      ],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/reference/schemas/residency-evaluation.schema.json",
        "docs/planes/data-event/services/retention-residency-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1454]",
      "number": 1454
    },
    {
      "id": "AIFACTORY-TASK-5879",
      "type": "task",
      "parent": "AIFACTORY-US-1454",
      "title": "Retention.EvaluateResidency against the residency rule of the forwarded tenant",
      "sequence": "11.03.04.01",
      "description": "Retention.EvaluateResidency against the residency rule of the forwarded tenant. Expected output: EvaluateResidency takes residency-evaluation-request-v1, checks its tenant against the tenant the workload forwards under its service scope, evaluates the candidate region and engine against the rule or the installation default and answers residency-evaluation-v1 with the verdict, the region, allowed regions and model data residency of the rule it applied and the reason of a refusal (D137), increments connectsoft.factory.data_event.residency_violations on a refusal and refuses callers without workload identity and invalid requests with UNAUTHENTICATED and INVALID_ARGUMENT.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "EvaluateResidency takes residency-evaluation-request-v1, checks its tenant against the tenant the workload forwards under its service scope, evaluates the candidate region and engine against the rule or the installation default and answers residency-evaluation-v1 with the verdict, the region, allowed regions and model data residency of the rule it applied and the reason of a refusal (D137), increments connectsoft.factory.data_event.residency_violations on a refusal and refuses callers without workload identity and invalid requests with UNAUTHENTICATED and INVALID_ARGUMENT."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5879]",
      "number": 5879
    },
    {
      "id": "AIFACTORY-TASK-5880",
      "type": "task",
      "parent": "AIFACTORY-US-1454",
      "title": "CheckResidency handler of StoreBindingChanged",
      "sequence": "11.03.04.02",
      "description": "CheckResidency handler of StoreBindingChanged. Expected output: The inbox handler CheckResidency evaluates the binding of each StoreBindingChanged against the rule of its tenant, counts a violation and records it as evidence with AuditService once per event id, and a redelivery changes nothing; a test uses a fixture event of the published contract of StoreProfileService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "The inbox handler CheckResidency evaluates the binding of each StoreBindingChanged against the rule of its tenant, counts a violation and records it as evidence with AuditService once per event id, and a redelivery changes nothing; a test uses a fixture event of the published contract of StoreProfileService."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5880]",
      "number": 5880
    },
    {
      "id": "AIFACTORY-TASK-5881",
      "type": "task",
      "parent": "AIFACTORY-US-1454",
      "title": "Verify residency evaluation through the acceptance suite",
      "sequence": "11.03.04.03",
      "description": "Verify residency evaluation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RetentionResidencyService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1454 with an allowed and a refused binding, a refused deployment region, a call without workload identity and a redelivered StoreBindingChanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RetentionResidencyService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1454 with an allowed and a refused binding, a refused deployment region, a call without workload identity and a redelivered StoreBindingChanged."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5881]",
      "number": 5881
    },
    {
      "id": "AIFACTORY-US-1455",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Issue a deletion, purge, export or legal-hold order for a scope, with tenant deletion gated by its approval",
      "sequence": "11.03.05",
      "description": "As a workspace admin or a platform admin, I want to issue an order that deletes, purges, exports or holds the data of a scope, so that the tenant can leave, clean up or keep data on legal grounds with one act that every owner follows. An admin with `factory.data.admin` calls `RetentionResidencyService/IssueGovernanceOrder` on `POST /factory/data/orders` with an `Idempotency-Key`. The body names the kind (TenantDeletion, ProjectDeletion, RunPurge, Export or LegalHold), the scope (the tenant, a project, a run set or a classification, always inside the tenant of the token) and, for an export, the format (JsonLines, Parquet, Markdown or Zip). As the model gives `factory.data.admin` to the Workspace admin for the tenant, a Workspace admin of the tenant issues any order kind for a scope of the tenant, a tenant deletion included, and a Platform admin may do the same; a TenantDeletion is additionally gated by its approval. The service creates the `GovernanceOrder` in state Issued with `issuedBy` and `dueAt` at the issue plus `DataEvent:Retention:DeletionWindowDays`, and answers 202 with the order id; the order then runs asynchronously (AIFACTORY-US-1456). A deletion, purge or export writes `RetentionResidencyService/DeletionOrderIssued` with `orderId`, `tenantId`, `kind`, `scope` and `dueAt`; a legal hold writes `RetentionResidencyService/LegalHoldChanged` with `orderId`, `tenantId`, `scope` and `active` true; each in the same transaction as the order. A tenant deletion is a production-class action: the body names the approval bound to it, the service checks it with RunControlService, a required dependency that fails fast, and records it as `approvalId`; a tenant deletion without an approval, or with one that is not granted for this order, is refused with 412. A legal hold suspends deletion and expiry, not reading, so a deletion or purge of a scope under an active legal hold is refused with 409 naming the hold, while an export of a held scope, which deletes nothing, is accepted; a key reused with a different body is refused with 409; a repeat with the same key and body returns the first 202 and changes nothing. A hold placed after a deletion order was issued does not cancel that order: as the reading of D137 states, a deletion task stays open while a legal hold holds it, so the owner whose records are held leaves them in place and keeps its task open, not acknowledged, until the hold is lifted (AIFACTORY-US-1459 to AIFACTORY-US-1465), and the order does not complete while held data remains. A scope outside the tenant of the token is not found for the caller and refused with 404 in line with ADR-0015; a caller without the scope, or without the Workspace admin or Platform admin role, is refused with 403. Every order is recorded as evidence with AuditService. RunControlService (for a TenantDeletion) and AuditService are required dependencies that fail fast: when either does not answer, no order, task or event is written, the caller receives 503 with a problem response that names the dependency (D137), and a repeat under the same `Idempotency-Key` once the dependency answers is applied once. StudioBff serves the views `governance-orders` and `offboardings`. Kind: behavior. Traces: services: RetentionResidencyService, RunControlService, AuditService; aggregates: RetentionResidencyService/GovernanceOrder; apis: RetentionResidencyService/IssueGovernanceOrder; events: RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: FR-12, NFR-16; scenarios: SCN-RetentionResidencyService-005, SCN-RetentionResidencyService-011, SCN-RetentionResidencyService-014. Relates: screens: governance-orders, offboardings. Depends on: AIFACTORY-US-1452, feature:run-control-service, feature:audit-service-complete. Sources: model/services/data-event/RetentionResidencyService.yaml, docs/architecture/data-governance.md#retention-and-deletion.",
      "acceptanceCriteria": [
        "AC1: Given a Workspace admin with `factory.data.admin`, when `RetentionResidencyService/IssueGovernanceOrder` issues a ProjectDeletion with an `Idempotency-Key`, then the response is 202 with the order id, the `RetentionResidencyService/GovernanceOrder` is Issued with `dueAt` at the issue plus `DataEvent:Retention:DeletionWindowDays`, and `RetentionResidencyService/DeletionOrderIssued` is written in the same transaction; the same key and body again returns the first 202 and writes nothing (SCN-RetentionResidencyService-005, ADR-0019).",
        "AC2: Given a Workspace admin of the tenant and a TenantDeletion without an approval, or with one RunControlService does not report as granted for it, when the order is issued, then the response is 412 and nothing is written; with a granted approval it is 202 and the order records `approvalId` (SCN-RetentionResidencyService-005, ADR-0015).",
        "AC3: Given a deletion or purge of a scope under an active legal hold, a key reused with a different body, a caller without the scope or without the Workspace admin or Platform admin role, or a scope of another tenant, when `RetentionResidencyService/IssueGovernanceOrder` is called, then the response is 409, 409, 403 or 404 respectively with a problem response and no row or event is written; given an Export of a held scope, then it is accepted with 202 (SCN-RetentionResidencyService-005, ADR-0015).",
        "AC4: Given RunControlService does not answer for a TenantDeletion, or AuditService does not answer, when `RetentionResidencyService/IssueGovernanceOrder` is called, then no order, task or event is written, the response is 503 with a problem response that names the dependency, and a repeat under the same `Idempotency-Key` once the dependency answers is applied once (SCN-RetentionResidencyService-005, D137, model/services/data-event/RetentionResidencyService.yaml).",
        "AC5: Given a deletion order and a legal hold issued, when the outbox dispatcher publishes `RetentionResidencyService/DeletionOrderIssued` on `data-foundations.orders.v1.deletion-order-issued` and `RetentionResidencyService/LegalHoldChanged` on `data-foundations.orders.v1.legal-hold-changed`, then each is sent under the canonical envelope, the first with `orderId`, `tenantId`, `kind`, `scope` and `dueAt` and the second with `orderId`, `tenantId`, `scope` and `active` true, and a transport outage is retried with backoff so neither is lost or duplicated under its event id (SCN-RetentionResidencyService-011, SCN-RetentionResidencyService-014, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5882",
        "AIFACTORY-TASK-5883"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12705,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService",
          "RunControlService",
          "AuditService"
        ],
        "aggregates": [
          "RetentionResidencyService/GovernanceOrder"
        ],
        "apis": [
          "RetentionResidencyService/IssueGovernanceOrder"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-12",
          "NFR-16"
        ],
        "scenarios": [
          "SCN-RetentionResidencyService-005",
          "SCN-RetentionResidencyService-011",
          "SCN-RetentionResidencyService-014"
        ]
      },
      "relates": {
        "screens": [
          "governance-orders",
          "offboardings"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1452",
        "feature:run-control-service",
        "feature:audit-service-complete"
      ],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion"
      ],
      "titlePrefix": "[AIFACTORY-US-1455]",
      "number": 1455
    },
    {
      "id": "AIFACTORY-TASK-5882",
      "type": "task",
      "parent": "AIFACTORY-US-1455",
      "title": "IssueGovernanceOrder with the approval gate, the hold check and the DeletionOrderIssued and LegalHoldChanged outbox records",
      "sequence": "11.03.05.01",
      "description": "IssueGovernanceOrder with the approval gate, the hold check and the DeletionOrderIssued and LegalHoldChanged outbox records. Expected output: IssueGovernanceOrder creates an Issued order with dueAt from DataEvent:Retention:DeletionWindowDays, answers 202, writes DeletionOrderIssued or LegalHoldChanged in the same transaction and records the order as evidence; a Workspace admin of the tenant may issue every kind, a tenant deletion included; a tenant deletion is checked with RunControlService and refused with 412 without a granted approval; a deletion or purge of a held scope and a reused key with another body are 409 while an export of a held scope is accepted, another tenant 404 and a missing scope or a caller without the Workspace admin or Platform admin role 403; a repeat under the same key returns the first answer; with a fake of RunControlService and a fake of AuditService that do not answer, nothing is written, the answer is 503 with a problem response naming the dependency (D137) and a repeat under the same Idempotency-Key after the fake answers is applied once.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "IssueGovernanceOrder creates an Issued order with dueAt from DataEvent:Retention:DeletionWindowDays, answers 202, writes DeletionOrderIssued or LegalHoldChanged in the same transaction and records the order as evidence; a Workspace admin of the tenant may issue every kind, a tenant deletion included; a tenant deletion is checked with RunControlService and refused with 412 without a granted approval; a deletion or purge of a held scope and a reused key with another body are 409 while an export of a held scope is accepted, another tenant 404 and a missing scope or a caller without the Workspace admin or Platform admin role 403; a repeat under the same key returns the first answer; with a fake of RunControlService and a fake of AuditService that do not answer, nothing is written, the answer is 503 with a problem response naming the dependency (D137) and a repeat under the same Idempotency-Key after the fake answers is applied once."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5882]",
      "number": 5882
    },
    {
      "id": "AIFACTORY-TASK-5883",
      "type": "task",
      "parent": "AIFACTORY-US-1455",
      "title": "Verify order issuing through the acceptance suite",
      "sequence": "11.03.05.02",
      "description": "Verify order issuing through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-005|Scenario=SCN-RetentionResidencyService-011|Scenario=SCN-RetentionResidencyService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1455 with fakes of RunControlService and AuditService, including fakes that do not answer, the export of a held scope and the publication and payload of both events.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-005|Scenario=SCN-RetentionResidencyService-011|Scenario=SCN-RetentionResidencyService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1455 with fakes of RunControlService and AuditService, including fakes that do not answer, the export of a held scope and the publication and payload of both events."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5883]",
      "number": 5883
    },
    {
      "id": "AIFACTORY-US-1456",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Dispatch an order to every owner, record their acknowledgements, complete or mark it Overdue, and read it",
      "sequence": "11.03.06",
      "description": "As a workspace admin, I want an order to reach every service that holds data of its scope and to complete only when each acknowledged, so that I can prove that a deletion happened and see which owner is late. The worker `OrderDispatcher` starts on `DeletionOrderIssued`. It creates one row of `GovernanceOrderTasks` per owning service of the order, as the consumers of the event in the model list them for the services deployed in the installation, moves the order from Issued to InProgress (TasksDispatched) and, once every task is created, to AwaitingAcknowledgements (AllTasksSent); it is idempotent on order plus owner service and retries five times with an exponential backoff. For a TenantDeletion the `TenantDeletionSaga` keeps the dependency order of the model: its first step verifies the approval bound to the order with RunControlService, and when RunControlService no longer reports it as granted, the compensation of that step applies: the order moves from Issued to Cancelled (trigger Cancel), no task is dispatched, the evidence of the refusal is recorded with AuditService and `connectsoft.factory.data_event.orders` counts the order as Cancelled. With the approval verified, it opens the tasks of the derived stores first (projections, indexes, memory, cache), then ArtifactService and the authoritative stores, then the governance services, with AuditService redacting and never purging the evidence of the scope, and records completion evidence. An owning service calls `RetentionResidencyService/AcknowledgeOrderTask` on `POST /factory/data/orders/{orderId}/acknowledge` with its workload token under `factory.data.acknowledge`; the owner is taken from the workload identity of the caller, never from the body, and the body carries the reference of its receipt, which is all that `GovernanceOrderTasks` holds of it besides the moment (`ReceiptRef`, `AcknowledgedAt`). The task is marked acknowledged with its receipt and moment and the answer is 200; a repeated acknowledgement returns 200 and changes nothing; an order of another tenant, or one with no task for the calling owner, is answered 404. When the last task is acknowledged, the order moves to Completed (AllAcknowledged) with `completedAt` and `RetentionResidencyService/DeletionOrderCompleted` with `orderId`, `tenantId` and `completedAt` is written in the same transaction. Besides its start on the event, `OrderDispatcher` runs a scheduled due check over the orders AwaitingAcknowledgements, the reading of D137. When `dueAt` passes first, the order moves to Overdue (DueElapsed), the missing owners are named in the order and in the evidence, the task of each missing owner is dispatched again, and, as the failure mode of the model requires, the overdue order is handed to AlertRuleService on its queued path (an optional dependency of kind event that queues) with the order id and the missing owners so the Operator is alerted; while AlertRuleService is unavailable the alert stays queued and is not lost. The model names no event or operation that carries this alert, which is reported to the owner. `connectsoft.factory.data_event.orders` counts the order by state Overdue, and a later acknowledgement of the last owner still completes it (Overdue to Completed). A caller with `factory.data.read` reads `RetentionResidencyService/GetGovernanceOrder` on `GET /factory/data/orders/{orderId}` and receives the state, the tasks with their owners, states and receipts, the due moment and, for an export, the bundle reference; an order of another tenant is answered 404 in line with ADR-0015. `connectsoft.factory.data_event.order_completion_days` records the time to completion by kind. Kind: behavior. Traces: services: RetentionResidencyService, AuditService, RunControlService, AlertRuleService; aggregates: RetentionResidencyService/GovernanceOrder; apis: RetentionResidencyService/GetGovernanceOrder, RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/DeletionOrderCompleted; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: FR-12, NFR-16; scenarios: SCN-RetentionResidencyService-006, SCN-RetentionResidencyService-007, SCN-RetentionResidencyService-012. Relates: screens: governance-orders, offboardings. Depends on: AIFACTORY-US-1455. Sources: model/services/data-event/RetentionResidencyService.yaml, docs/planes/data-event/services/retention-residency-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a ProjectDeletion Issued, when `OrderDispatcher` handles `RetentionResidencyService/DeletionOrderIssued`, then one task per owning service exists, the `RetentionResidencyService/GovernanceOrder` is AwaitingAcknowledgements, and a redelivery creates no second task; given an owning service with `factory.data.acknowledge`, when it calls `RetentionResidencyService/AcknowledgeOrderTask` with a receipt reference, then the response is 200 and its task holds the receipt reference and moment; a repeat answers 200 and changes nothing; an order of another tenant or without a task for that owner is answered 404, and a caller without the scope 403 (SCN-RetentionResidencyService-007, ADR-0015).",
        "AC2: Given the last task acknowledged, when the acknowledgement commits, then the order is Completed with `completedAt` and `RetentionResidencyService/DeletionOrderCompleted` is written in the same transaction; when the outbox dispatcher publishes it on `data-foundations.orders.v1.deletion-order-completed`, the event carries `orderId`, `tenantId` and `completedAt` under the canonical envelope and a transport outage is retried without loss or duplicate (SCN-RetentionResidencyService-012, ADR-0012).",
        "AC3: Given one owner that never acknowledges, when the scheduled due check of `OrderDispatcher` (D137) runs after `dueAt`, then the order is Overdue naming that owner in the order and in the evidence, the task of that owner is dispatched again, the overdue order is handed to AlertRuleService on its queued path with the order id and the missing owner so the Operator is alerted, `connectsoft.factory.data_event.orders` counts it as Overdue, and a late acknowledgement still completes it; given AlertRuleService unavailable, then the alert is queued and delivered once it is back, not lost (model/services/data-event/RetentionResidencyService.yaml, ADR-0019).",
        "AC4: Given a TenantDeletion whose bound approval RunControlService no longer reports as granted when the saga starts, then the order moves from Issued to Cancelled, no task is dispatched, evidence of the refusal is recorded with AuditService and `connectsoft.factory.data_event.orders` counts it as Cancelled; given a TenantDeletion with its approval granted, when the saga runs, then no authoritative task opens before every derived-store task is acknowledged, the AuditService task redacts and opens last, and a failing owner stops the remaining dispatches and leaves the order Overdue with acknowledged deletions kept (ADR-0019, docs/planes/data-event/services/retention-residency-service/index.md#sagas-and-long-running-flows).",
        "AC5: Given an order with acknowledged and open tasks and a caller with `factory.data.read`, when `RetentionResidencyService/GetGovernanceOrder` is called, then the response is 200 with state, tasks, owners, receipts and due moment; an order of another tenant or an unknown id is answered 404 and a caller without the scope 403 (SCN-RetentionResidencyService-006, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-559",
        "AIFACTORY-TASK-560",
        "AIFACTORY-TASK-5884",
        "AIFACTORY-TASK-5885"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12706,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService",
          "AuditService",
          "RunControlService",
          "AlertRuleService"
        ],
        "aggregates": [
          "RetentionResidencyService/GovernanceOrder"
        ],
        "apis": [
          "RetentionResidencyService/GetGovernanceOrder",
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/DeletionOrderCompleted"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-12",
          "NFR-16"
        ],
        "scenarios": [
          "SCN-RetentionResidencyService-006",
          "SCN-RetentionResidencyService-007",
          "SCN-RetentionResidencyService-012"
        ]
      },
      "relates": {
        "screens": [
          "governance-orders",
          "offboardings"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1455"
      ],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1456]",
      "number": 1456
    },
    {
      "id": "AIFACTORY-TASK-559",
      "type": "task",
      "parent": "AIFACTORY-US-1456",
      "title": "Order dispatch with acknowledgements",
      "sequence": "11.03.06.01",
      "description": "Order dispatch with acknowledgements. Expected output: OrderDispatcher creates one task per owning service of an order once per order and owner and moves the order to AwaitingAcknowledgements; AcknowledgeOrderTask records the receipt reference of the owner taken from the workload identity and completes the order with DeletionOrderCompleted when the last task is acknowledged; the scheduled due check of OrderDispatcher, the reading of D137, moves an order whose dueAt passed to Overdue, names the missing owners in the order and the evidence, dispatches the task of each missing owner again and hands the overdue order with its id and missing owners to AlertRuleService on its queued path, keeping the alert queued while AlertRuleService is unavailable.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "OrderDispatcher creates one task per owning service of an order once per order and owner and moves the order to AwaitingAcknowledgements; AcknowledgeOrderTask records the receipt reference of the owner taken from the workload identity and completes the order with DeletionOrderCompleted when the last task is acknowledged; the scheduled due check of OrderDispatcher, the reading of D137, moves an order whose dueAt passed to Overdue, names the missing owners in the order and the evidence, dispatches the task of each missing owner again and hands the overdue order with its id and missing owners to AlertRuleService on its queued path, keeping the alert queued while AlertRuleService is unavailable."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-559]",
      "number": 559
    },
    {
      "id": "AIFACTORY-TASK-560",
      "type": "task",
      "parent": "AIFACTORY-US-1456",
      "title": "Contract of the acknowledgement and receipt used by the owning services",
      "sequence": "11.03.06.02",
      "description": "Contract of the acknowledgement and receipt used by the owning services. Expected output: The request of AcknowledgeOrderTask (order id in the path, the receipt reference in the body, which is what GovernanceOrderTasks holds as ReceiptRef, owner taken from the workload identity) is published in the OpenAPI document of the service with a test fixture the handlers of AIFACTORY-US-1459 to AIFACTORY-US-1465 build against; a contract test fails when the body changes incompatibly.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "The request of AcknowledgeOrderTask (order id in the path, the receipt reference in the body, which is what GovernanceOrderTasks holds as ReceiptRef, owner taken from the workload identity) is published in the OpenAPI document of the service with a test fixture the handlers of AIFACTORY-US-1459 to AIFACTORY-US-1465 build against; a contract test fails when the body changes incompatibly."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12706,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-560]",
      "number": 560
    },
    {
      "id": "AIFACTORY-TASK-5884",
      "type": "task",
      "parent": "AIFACTORY-US-1456",
      "title": "TenantDeletionSaga with the dependency order, the approval check and GetGovernanceOrder",
      "sequence": "11.03.06.03",
      "description": "TenantDeletionSaga with the dependency order, the approval check and GetGovernanceOrder. Expected output: The saga correlated by order id verifies the approval of a TenantDeletion with RunControlService and, when it is no longer granted, moves the order from Issued to Cancelled, dispatches no task, records the evidence of the refusal with AuditService and counts the order as Cancelled in connectsoft.factory.data_event.orders; otherwise it opens the derived-store tasks first, then ArtifactService and the authoritative owners, then the governance owners with AuditService last, stops on a failing owner leaving the order Overdue, and records completion evidence; GetGovernanceOrder returns state, tasks, receipts, due moment and export reference and answers 404 for another tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "The saga correlated by order id verifies the approval of a TenantDeletion with RunControlService and, when it is no longer granted, moves the order from Issued to Cancelled, dispatches no task, records the evidence of the refusal with AuditService and counts the order as Cancelled in connectsoft.factory.data_event.orders; otherwise it opens the derived-store tasks first, then ArtifactService and the authoritative owners, then the governance owners with AuditService last, stops on a failing owner leaving the order Overdue, and records completion evidence; GetGovernanceOrder returns state, tasks, receipts, due moment and export reference and answers 404 for another tenant."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5884]",
      "number": 5884
    },
    {
      "id": "AIFACTORY-TASK-5885",
      "type": "task",
      "parent": "AIFACTORY-US-1456",
      "title": "Verify dispatch, acknowledgement, completion and the saga through the acceptance suite",
      "sequence": "11.03.06.04",
      "description": "Verify dispatch, acknowledgement, completion and the saga through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-006|Scenario=SCN-RetentionResidencyService-007|Scenario=SCN-RetentionResidencyService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1456 with a controlled clock and fake owners, including an Overdue order whose missing task is dispatched again and handed to a fake of AlertRuleService that is first unavailable, an Overdue order completed late, a tenant deletion cancelled because its approval is no longer granted, and a tenant deletion whose derived owner fails.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-RetentionResidencyService-006|Scenario=SCN-RetentionResidencyService-007|Scenario=SCN-RetentionResidencyService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1456 with a controlled clock and fake owners, including an Overdue order whose missing task is dispatched again and handed to a fake of AlertRuleService that is first unavailable, an Overdue order completed late, a tenant deletion cancelled because its approval is no longer granted, and a tenant deletion whose derived owner fails."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12706,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5885]",
      "number": 5885
    },
    {
      "id": "AIFACTORY-US-1457",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Collect the export bundles of the owners into one archive in an open format with a manifest, announced by ExportCompleted",
      "sequence": "11.03.07",
      "description": "As a workspace admin, I want an export of my scope in an open format with a manifest of what is and is not in it, so that the tenant can take its data with it and audit what was left out. The worker `Exporter` starts on `DeletionOrderIssued` and acts only on orders of kind Export; it is idempotent on the order id and retries three times with an exponential backoff. As the owning services acknowledge the tasks of an export order, each receipt references the bundle of that owner. The exporter collects the bundles into one archive in the format of the order (JsonLines, Parquet, Markdown or Zip) with a manifest that lists every owner, what it exported and what it did not, including that audit evidence is exported redacted; it stores the archive through ArtifactService, records the reference as `exportRef` of the order and writes `RetentionResidencyService/ExportCompleted` with `orderId`, `tenantId`, `exportRef` and `format` in the same transaction. ArtifactService is a required dependency that degrades: while it does not answer, the archive is kept pending and retried, and the order stays open. An export deletes nothing. How an owning service produces its bundle for an export order is not stated by the model; the handlers of AIFACTORY-US-1459 to AIFACTORY-US-1465 acknowledge an export task with the reference of a bundle, and the owner is asked to confirm that contract. Kind: behavior. Traces: services: RetentionResidencyService, ArtifactService; aggregates: RetentionResidencyService/GovernanceOrder; events: RetentionResidencyService/ExportCompleted; adrs: ADR-0012, ADR-0019; requirements: FR-12; scenarios: SCN-RetentionResidencyService-013. Relates: screens: offboardings. Depends on: AIFACTORY-US-1456, feature:artifact-service. Sources: model/services/data-event/RetentionResidencyService.yaml, docs/architecture/data-governance.md#retention-and-deletion.",
      "acceptanceCriteria": [
        "AC1: Given an Export order in JsonLines whose owners acknowledged with bundle references, when `Exporter` runs, then one archive in JsonLines with a manifest of every owner and its exported and omitted content is stored through ArtifactService, `exportRef` is set on the `RetentionResidencyService/GovernanceOrder` and `RetentionResidencyService/ExportCompleted` is written in the same transaction; a second run for the same order writes nothing (SCN-RetentionResidencyService-013, ADR-0019).",
        "AC2: Given an export completed, when the outbox dispatcher publishes `RetentionResidencyService/ExportCompleted` on `data-foundations.orders.v1.export-completed`, then the event is sent under the canonical envelope with `orderId`, `tenantId`, `exportRef` and `format`, and a transport outage is retried with backoff so the event is neither lost nor duplicated (SCN-RetentionResidencyService-013, ADR-0012).",
        "AC3: Given ArtifactService does not answer, when `Exporter` runs, then the archive is not lost, the order stays open and the worker retries, and no record of any owner is deleted by the export (model/services/data-event/RetentionResidencyService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-561",
        "AIFACTORY-TASK-5886"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12707,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService",
          "ArtifactService"
        ],
        "aggregates": [
          "RetentionResidencyService/GovernanceOrder"
        ],
        "events": [
          "RetentionResidencyService/ExportCompleted"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ],
        "requirements": [
          "FR-12"
        ],
        "scenarios": [
          "SCN-RetentionResidencyService-013"
        ]
      },
      "relates": {
        "screens": [
          "offboardings"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1456",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion"
      ],
      "titlePrefix": "[AIFACTORY-US-1457]",
      "number": 1457
    },
    {
      "id": "AIFACTORY-TASK-561",
      "type": "task",
      "parent": "AIFACTORY-US-1457",
      "title": "Export archive in open formats",
      "sequence": "11.03.07.01",
      "description": "Export archive in open formats. Expected output: The Exporter collects the bundles referenced by the receipts of an Export order into one archive in the format of the order with a manifest of exported and omitted content, stores it through ArtifactService, records exportRef and writes ExportCompleted in the same transaction, once per order, and keeps the archive pending while ArtifactService does not answer.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "The Exporter collects the bundles referenced by the receipts of an Export order into one archive in the format of the order with a manifest of exported and omitted content, stores it through ArtifactService, records exportRef and writes ExportCompleted in the same transaction, once per order, and keeps the archive pending while ArtifactService does not answer."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12707,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-561]",
      "number": 561
    },
    {
      "id": "AIFACTORY-TASK-5886",
      "type": "task",
      "parent": "AIFACTORY-US-1457",
      "title": "Verify export through the acceptance suite",
      "sequence": "11.03.07.02",
      "description": "Verify export through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RetentionResidencyService-013\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1457 with a fake of ArtifactService that first does not answer, including the manifest content and the publication and payload of ExportCompleted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-RetentionResidencyService-013\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1457 with a fake of ArtifactService that first does not answer, including the manifest content and the publication and payload of ExportCompleted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12707,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5886]",
      "number": 5886
    },
    {
      "id": "AIFACTORY-US-1458",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Sweep expired data by rule into run purge orders, sparing held scopes",
      "sequence": "11.03.08",
      "description": "As a workspace admin, I want data past its retention to be purged, redacted or archived without a manual order, so that the tenant keeps no data longer than its rules allow. The worker `RetentionSweeper` runs daily at the hour the model schedules, partitioned by tenant, two at a time, retrying twice with a fixed backoff and idempotent on rule plus day. The key is applied within the tenant partition the model gives the worker (`TenantId`), so the effective key is tenant plus rule plus day: a platform default is one rule under the platform tenant, and two tenants that rely on the same default on the same day each receive their own order. The class `artifacts` is not swept by order: ArtifactService applies the tenant rule in its own sweep, which runs from the first increment, spares the artifacts that audit evidence or an unexpired run references and keeps metadata and lineage (D125, AIFACTORY-US-1462), so `RetentionSweeper` issues no RunPurge for that class. Every consumer of `RetentionRuleChanged` has an `ApplyRetentionRule` handler in the model, which may mean that other owners also expire their records themselves; which other classes are left to the sweep of their owner is not stated by the model and is reported to the owner, and until it decides this PBI sweeps by order every class except `artifacts`. For every other active retention rule of a tenant, or the platform default where the tenant has none, it computes the expiry moment of the class and issues one `GovernanceOrder` of kind RunPurge whose scope names the store class, the classification, the expiry moment and the expiry action of the rule (delete, redact or archive); the order is created and `RetentionResidencyService/DeletionOrderIssued` written in the same transaction, and from there it is dispatched and acknowledged like any other order (AIFACTORY-US-1456). Scopes under an active legal hold are excluded from the order, so expiry is suspended for them, and a rule marked exempt from legal holds is swept as usual. Audit evidence is never purged: for the class `audit` the action is always redact and the expiry never earlier than 2555 days. A second run on the same day issues no second order for the same rule. Kind: behavior. Traces: services: RetentionResidencyService; aggregates: RetentionResidencyService/RetentionRule, RetentionResidencyService/GovernanceOrder; events: RetentionResidencyService/DeletionOrderIssued; adrs: ADR-0019; requirements: NFR-14. Depends on: AIFACTORY-US-1452, AIFACTORY-US-1456. Sources: model/services/data-event/RetentionResidencyService.yaml, docs/planes/data-event/services/retention-residency-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a tenant rule for runs of 180 days and a platform default for traces of 30 days, when `RetentionSweeper` runs, then one RunPurge `RetentionResidencyService/GovernanceOrder` per rule is created with the class, classification, expiry moment and action, and `RetentionResidencyService/DeletionOrderIssued` is written for each in the same transaction; a second run on the same day creates nothing; given two tenants without a rule for traces, then each tenant receives its own RunPurge order for the platform default and a second run that day creates none; given a tenant rule for the class `artifacts`, then no RunPurge order is issued for that class (ADR-0019, model/services/data-event/RetentionResidencyService.yaml).",
        "AC2: Given a project under an active legal hold and a rule that is not exempt, when the sweeper runs, then that project is excluded from the scope of the order; given an exempt rule, it is included (ADR-0019).",
        "AC3: Given the class `audit`, when the sweeper runs, then its order carries the action redact and no expiry earlier than 2555 days, and no purge of audit evidence is ordered (docs/architecture/data-governance.md#retention-and-deletion)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5887",
        "AIFACTORY-TASK-5888"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12708,
      "kind": "behavior",
      "traces": {
        "services": [
          "RetentionResidencyService"
        ],
        "aggregates": [
          "RetentionResidencyService/RetentionRule",
          "RetentionResidencyService/GovernanceOrder"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued"
        ],
        "adrs": [
          "ADR-0019"
        ],
        "requirements": [
          "NFR-14"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1452",
        "AIFACTORY-US-1456"
      ],
      "source": [
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/planes/data-event/services/retention-residency-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1458]",
      "number": 1458
    },
    {
      "id": "AIFACTORY-TASK-5887",
      "type": "task",
      "parent": "AIFACTORY-US-1458",
      "title": "RetentionSweeper issuing RunPurge orders by rule",
      "sequence": "11.03.08.01",
      "description": "RetentionSweeper issuing RunPurge orders by rule. Expected output: RetentionSweeper computes the expiry per active rule or platform default per tenant, issues one RunPurge order per tenant, rule and day, the idempotency key applied within the TenantId partition so a platform default yields one order per tenant, with class, classification, expiry moment and action and DeletionOrderIssued in the same transaction, issues no RunPurge for the class artifacts, which ArtifactService sweeps itself (D125, AIFACTORY-US-1462), excludes scopes under an active hold unless the rule is exempt, and never orders a purge of audit evidence.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "RetentionSweeper computes the expiry per active rule or platform default per tenant, issues one RunPurge order per tenant, rule and day, the idempotency key applied within the TenantId partition so a platform default yields one order per tenant, with class, classification, expiry moment and action and DeletionOrderIssued in the same transaction, issues no RunPurge for the class artifacts, which ArtifactService sweeps itself (D125, AIFACTORY-US-1462), excludes scopes under an active hold unless the rule is exempt, and never orders a purge of audit evidence."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12708,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5887]",
      "number": 5887
    },
    {
      "id": "AIFACTORY-TASK-5888",
      "type": "task",
      "parent": "AIFACTORY-US-1458",
      "title": "Verify the retention sweep against AC1 to AC3",
      "sequence": "11.03.08.02",
      "description": "Verify the retention sweep against AC1 to AC3. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~RetentionSweeper\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1458 with a controlled clock, two tenants on the same platform default, a tenant rule for artifacts, a held project, an exempt rule and the audit class, and two runs on the same day.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RetentionResidencyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~RetentionSweeper\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1458 with a controlled clock, two tenants on the same platform default, a tenant rule for artifacts, a held project, an exempt rule and the audit class, and two runs on the same day."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RetentionResidencyService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12708,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5888]",
      "number": 5888
    },
    {
      "id": "AIFACTORY-US-1459",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Deletion-order handlers of ProjectService, EnvironmentService and RunControlService, and the legal-hold handlers of ProjectService and RunControlService",
      "sequence": "11.03.09",
      "description": "As a workspace admin, I want the control plane services to delete an ordered scope from their stores and acknowledge it, so that a deletion order completes for projects, environments and runs. ProjectService, EnvironmentService and RunControlService consume `RetentionResidencyService/DeletionOrderIssued` through their handler `ExecuteDeletionOrder`; the model delivers these handlers in this increment with RetentionResidencyService, so this PBI builds them in the repository of each service. Each handler enters through the inbox of its service, idempotent on the event id, and acts only on the scope of the order inside its tenant: a ProjectDeletion removes the project and everything the service holds for it, a TenantDeletion removes every record of the tenant, a RunPurge removes, redacts or archives the run records the scope names, and an Export produces the bundle of the service and deletes nothing. The issue of a deletion order is refused for a scope that is held at that moment (AIFACTORY-US-1455); a legal hold placed after the order was issued, which each of these services learns through its own `ApplyLegalHold` handler of `LegalHoldChanged`, leaves the held records in place and keeps the task of the service open, not acknowledged, until `LegalHoldChanged` lifts the hold; then the handler deletes them and acknowledges, so the order never completes while held data remains. After the deletion commits, the handler calls `RetentionResidencyService/AcknowledgeOrderTask` with the workload token of its service under `factory.data.acknowledge` and the reference of its receipt; a repeated order changes nothing and acknowledges again, which the service answers 200 without change. A deletion that fails is retried by the inbox and not acknowledged, so the order becomes Overdue naming the service. As D137 decides, this PBI also builds the legal-hold handler `ApplyLegalHold` of `LegalHoldChanged` in the repositories of ProjectService and RunControlService: once per event id it records the hold of the scope inside its tenant on the records the service owns, suspends deletion and retention expiry for that scope while the hold is active and resumes them when a later `LegalHoldChanged` lifts it; the deletion handler reads that hold state, and a deletion task stays open while a hold holds it, the reading of D137. The `ApplyLegalHold` handler of EnvironmentService is built by its own feature environment-service, and the retention handlers stay with the feature of each service, except the handler `ApplyRetentionRule` of RunControlService and the retention sweep of its recovery journal, which feature run-control-service defers to this feature (D140) and this PBI builds in the repository of RunControlService. The table `RecoveryJournal` is partitioned by month and append-only for the service: its service identity keeps UPDATE and DELETE denied. `ApplyRetentionRule` records, once per event id, the effective retention that `RetentionRuleChanged` announces for the store class of the journal within its tenant, and `RunControl:Journal RetentionDays`, 365 days by default, applies where no rule is announced; the sweep runs under a separate retention identity, which may only drop whole monthly partitions whose newest entry is older than that retention, never deletes or updates a row, and leaves a partition that holds an entry of a run under an active legal hold in place until the hold is lifted (D141). Kind: behavior. Traces: services: ProjectService, EnvironmentService, RunControlService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged, RetentionResidencyService/RetentionRuleChanged; adrs: ADR-0012, ADR-0019. Depends on: AIFACTORY-US-1455, AIFACTORY-US-1456, feature:project-service, feature:environment-service, feature:run-control-service. Sources: model/services/control-plane/ProjectService.yaml, model/services/control-plane/EnvironmentService.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a ProjectDeletion for a project with environments and runs, when `RetentionResidencyService/DeletionOrderIssued` is delivered to ProjectService, EnvironmentService and RunControlService, then each deletes the records of that project from the stores it owns, keeps the records of other projects and tenants, and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt (ADR-0019).",
        "AC2: Given the same order delivered twice, a hold placed by `RetentionResidencyService/LegalHoldChanged` on the scope after the order was issued, or an Export order, when the handlers run, then a redelivery changes nothing, held records stay and the task of the service stays open, not acknowledged as deleted, until the hold is lifted, after which the records are deleted and the task acknowledged; an export deletes nothing and acknowledges with a bundle reference; a failing deletion is not acknowledged (ADR-0019, ADR-0012).",
        "AC3: Given `RetentionResidencyService/LegalHoldChanged` placing a hold on a scope and a later one lifting it, when the `ApplyLegalHold` handler of ProjectService and of RunControlService runs, then the hold is recorded once per event id on the records of that scope inside the tenant, their deletion and retention expiry are suspended while it is active and resumed when it is lifted, and the records of other scopes are untouched (RetentionResidencyService/LegalHoldChanged, D137, ADR-0019).",
        "AC4: Given the table `RecoveryJournal` of RunControlService partitioned by month with partitions older and newer than `RunControl:Journal RetentionDays` and a partition that holds an entry of a run under an active legal hold, when `RetentionResidencyService/RetentionRuleChanged` is handled by `ApplyRetentionRule` of RunControlService and the journal sweep runs under its separate retention identity, then only the whole partitions older than the effective retention and free of held entries are dropped, no row of a kept partition is deleted or updated, a DELETE or UPDATE of a row under the service identity of RunControlService is refused, and a redelivered event changes nothing (D140, D141, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5889",
        "AIFACTORY-TASK-5890",
        "AIFACTORY-TASK-5891",
        "AIFACTORY-TASK-5892",
        "AIFACTORY-TASK-5926",
        "AIFACTORY-TASK-5927",
        "AIFACTORY-TASK-6281",
        "AIFACTORY-TASK-6282",
        "AIFACTORY-TASK-6283",
        "AIFACTORY-TASK-6284",
        "AIFACTORY-TASK-6672",
        "AIFACTORY-TASK-6673"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "behavior",
      "traces": {
        "services": [
          "ProjectService",
          "EnvironmentService",
          "RunControlService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged",
          "RetentionResidencyService/RetentionRuleChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "feature:project-service",
        "feature:environment-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1459]",
      "number": 1459
    },
    {
      "id": "AIFACTORY-TASK-5889",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "ExecuteDeletionOrder handler of ProjectService",
      "sequence": "11.03.09.01",
      "description": "ExecuteDeletionOrder handler of ProjectService. Expected output: The inbox handler deletes the ordered scope from the stores of ProjectService once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask with the workload token of the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the ordered scope from the stores of ProjectService once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask with the workload token of the service."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5889]",
      "number": 5889
    },
    {
      "id": "AIFACTORY-TASK-5890",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "ExecuteDeletionOrder handler of EnvironmentService",
      "sequence": "11.03.09.02",
      "description": "ExecuteDeletionOrder handler of EnvironmentService. Expected output: The inbox handler deletes the ordered scope from the stores of EnvironmentService once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask with the workload token of the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the ordered scope from the stores of EnvironmentService once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask with the workload token of the service."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5890]",
      "number": 5890
    },
    {
      "id": "AIFACTORY-TASK-5891",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "ExecuteDeletionOrder handler of RunControlService",
      "sequence": "11.03.09.03",
      "description": "ExecuteDeletionOrder handler of RunControlService. Expected output: The inbox handler deletes, redacts or archives the run records of the ordered scope from the stores of RunControlService once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask with the workload token of the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox handler deletes, redacts or archives the run records of the ordered scope from the stores of RunControlService once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask with the workload token of the service."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5891]",
      "number": 5891
    },
    {
      "id": "AIFACTORY-TASK-5892",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "Verify the deletion handler of ProjectService",
      "sequence": "11.03.09.04",
      "description": "Verify the deletion handler of ProjectService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ProjectService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1459 for ProjectService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ProjectService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1459 for ProjectService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5892]",
      "number": 5892
    },
    {
      "id": "AIFACTORY-TASK-5926",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "Verify the deletion handler of EnvironmentService",
      "sequence": "11.03.09.05",
      "description": "Verify the deletion handler of EnvironmentService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.EnvironmentService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1459 for EnvironmentService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.EnvironmentService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1459 for EnvironmentService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5926]",
      "number": 5926
    },
    {
      "id": "AIFACTORY-TASK-5927",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "Verify the deletion handler of RunControlService",
      "sequence": "11.03.09.06",
      "description": "Verify the deletion handler of RunControlService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1459 for RunControlService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1459 for RunControlService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5927]",
      "number": 5927
    },
    {
      "id": "AIFACTORY-TASK-6281",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "ApplyLegalHold handler of ProjectService",
      "sequence": "11.03.09.07",
      "description": "ApplyLegalHold handler of ProjectService. Expected output: The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the records ProjectService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the records ProjectService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6281]",
      "number": 6281
    },
    {
      "id": "AIFACTORY-TASK-6282",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "ApplyLegalHold handler of RunControlService",
      "sequence": "11.03.09.08",
      "description": "ApplyLegalHold handler of RunControlService. Expected output: The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the run records RunControlService owns, suspends their deletion, redaction and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the run records RunControlService owns, suspends their deletion, redaction and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6282]",
      "number": 6282
    },
    {
      "id": "AIFACTORY-TASK-6283",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "Verify the legal-hold handler of ProjectService",
      "sequence": "11.03.09.09",
      "description": "Verify the legal-hold handler of ProjectService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.ProjectService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1459 for ProjectService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.ProjectService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1459 for ProjectService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6283]",
      "number": 6283
    },
    {
      "id": "AIFACTORY-TASK-6284",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "Verify the legal-hold handler of RunControlService",
      "sequence": "11.03.09.10",
      "description": "Verify the legal-hold handler of RunControlService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1459 for RunControlService with a hold placed, redelivered and lifted on the runs of one project while the runs of another project are untouched (SCN-RetentionResidencyService-014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1459 for RunControlService with a hold placed, redelivered and lifted on the runs of one project while the runs of another project are untouched (SCN-RetentionResidencyService-014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6284]",
      "number": 6284
    },
    {
      "id": "AIFACTORY-TASK-6672",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "ApplyRetentionRule handler of RunControlService and the partition sweep of the recovery journal",
      "sequence": "11.03.09.11",
      "description": "ApplyRetentionRule handler of RunControlService and the partition sweep of the recovery journal. Expected output: The inbox of RunControlService registers RetentionRuleChanged with idempotency on the event id; ApplyRetentionRule records the effective retention of the store class of the journal within its tenant, RunControl:Journal RetentionDays applying where no rule is announced; the sweep runs under a separate retention identity of run-control-sql that may only drop a whole monthly partition of RecoveryJournal whose newest entry is older than that retention, holds no UPDATE, no DELETE of rows and no other right, and skips a partition that holds an entry of a run under an active legal hold kept by ApplyLegalHold; the service identity keeps UPDATE and DELETE denied on RecoveryJournal, so the journal stays append-only for the service (D140, D141).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The inbox of RunControlService registers RetentionRuleChanged with idempotency on the event id; ApplyRetentionRule records the effective retention of the store class of the journal within its tenant, RunControl:Journal RetentionDays applying where no rule is announced; the sweep runs under a separate retention identity of run-control-sql that may only drop a whole monthly partition of RecoveryJournal whose newest entry is older than that retention, holds no UPDATE, no DELETE of rows and no other right, and skips a partition that holds an entry of a run under an active legal hold kept by ApplyLegalHold; the service identity keeps UPDATE and DELETE denied on RecoveryJournal, so the journal stays append-only for the service (D140, D141)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6672]",
      "number": 6672
    },
    {
      "id": "AIFACTORY-TASK-6673",
      "type": "task",
      "parent": "AIFACTORY-US-1459",
      "title": "Verify the journal retention sweep of RunControlService",
      "sequence": "11.03.09.12",
      "description": "Verify the journal retention sweep of RunControlService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyRetentionRule\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC4 of AIFACTORY-US-1459 against an isolated test database with monthly partitions on both sides of the retention, a partition holding an entry of a held run, a controlled clock, a redelivered RetentionRuleChanged, and a DELETE and an UPDATE attempted under the service identity that are refused (D141).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyRetentionRule\"` in ConnectSoft.AI.SoftwareFactory.RunControlService; a zero-match filter counts as a failure; the tests prove AC4 of AIFACTORY-US-1459 against an isolated test database with monthly partitions on both sides of the retention, a partition holding an entry of a held run, a controlled clock, a redelivered RetentionRuleChanged, and a DELETE and an UPDATE attempted under the service identity that are refused (D141)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6673]",
      "number": 6673
    },
    {
      "id": "AIFACTORY-US-1460",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Deletion-order handlers of CostUsageService, PolicyEngineService and SecretBrokerService, and the legal-hold handler of CostUsageService",
      "sequence": "11.03.10",
      "description": "As a workspace admin, I want usage records, policy bundles and secret references of an ordered scope deleted and acknowledged, so that a deletion order completes for cost, policy and secret data. CostUsageService, PolicyEngineService and SecretBrokerService consume `RetentionResidencyService/DeletionOrderIssued` through their handler `ExecuteDeletionOrder`, delivered by this PBI in the repository of each service. Each handler enters through the inbox of its service, idempotent on the event id, and acts only on the scope of the order inside its tenant: usage records and budgets of the scope, the policy bundle and decisions of the scope, and the secret references of the scope with the secret material they point at in the vault the broker owns. A TenantDeletion removes the policy bundle of the tenant as well, so a later decision for that tenant would seed a new one as ADR-0015 states. The issue of a deletion order is refused for a scope held at that moment (AIFACTORY-US-1455). CostUsageService learns of a hold placed after issue through its own `ApplyLegalHold` handler of `LegalHoldChanged`, which this PBI builds in its repository as D137 decides: once per event id it records the hold of the scope on the usage records and budgets the service owns, suspends their deletion and retention expiry while it is active and resumes them when a later `LegalHoldChanged` lifts it; the held records stay and the task stays open, not acknowledged, until the hold is lifted, then the deletion handler deletes and acknowledges. PolicyEngineService and SecretBrokerService do not consume `LegalHoldChanged` in the model, so their handlers cannot see a hold placed after issue; this is reported to the owner. An Export produces the bundle of the service and deletes nothing, and after the deletion commits the handler acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with its workload token and a receipt; a redelivery changes nothing and a failing deletion is not acknowledged. Kind: behavior. Traces: services: CostUsageService, PolicyEngineService, SecretBrokerService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0015, ADR-0019. Depends on: AIFACTORY-US-1455, AIFACTORY-US-1456, feature:cost-usage-service-complete, feature:policy-engine-service, feature:secret-broker-service. Sources: model/services/control-plane/CostUsageService.yaml, model/services/governance/PolicyEngineService.yaml, model/services/governance/SecretBrokerService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a ProjectDeletion, when `RetentionResidencyService/DeletionOrderIssued` is delivered to CostUsageService, PolicyEngineService and SecretBrokerService, then each deletes the records of that project from the stores it owns, keeps those of other projects and tenants, and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt (ADR-0019).",
        "AC2: Given the same order delivered twice, a hold placed by `RetentionResidencyService/LegalHoldChanged` on the scope after the order was issued, or an Export order, when the handlers run, then a redelivery changes nothing, the held records of CostUsageService stay and its task stays open, not acknowledged as deleted, until the hold is lifted, an export deletes nothing, and a failing deletion is not acknowledged (ADR-0019, ADR-0015).",
        "AC3: Given `RetentionResidencyService/LegalHoldChanged` placing a hold on a scope and a later one lifting it, when the `ApplyLegalHold` handler of CostUsageService runs, then the hold is recorded once per event id on the usage records and budgets of that scope inside the tenant, their deletion and retention expiry are suspended while it is active and resumed when it is lifted, and the records of other scopes are untouched (RetentionResidencyService/LegalHoldChanged, D137, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5893",
        "AIFACTORY-TASK-5894",
        "AIFACTORY-TASK-5895",
        "AIFACTORY-TASK-5896",
        "AIFACTORY-TASK-5928",
        "AIFACTORY-TASK-5929",
        "AIFACTORY-TASK-6285",
        "AIFACTORY-TASK-6286"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService",
          "PolicyEngineService",
          "SecretBrokerService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "feature:cost-usage-service-complete",
        "feature:policy-engine-service",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1460]",
      "number": 1460
    },
    {
      "id": "AIFACTORY-TASK-5893",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "ExecuteDeletionOrder handler of CostUsageService",
      "sequence": "11.03.10.01",
      "description": "ExecuteDeletionOrder handler of CostUsageService. Expected output: The inbox handler deletes the usage records and budgets of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the usage records and budgets of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5893]",
      "number": 5893
    },
    {
      "id": "AIFACTORY-TASK-5894",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "ExecuteDeletionOrder handler of PolicyEngineService",
      "sequence": "11.03.10.02",
      "description": "ExecuteDeletionOrder handler of PolicyEngineService. Expected output: The inbox handler deletes the policy bundle and decisions of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask; it does not consume LegalHoldChanged in the model and relies on the refusal of a held scope at issue.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the policy bundle and decisions of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask; it does not consume LegalHoldChanged in the model and relies on the refusal of a held scope at issue."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5894]",
      "number": 5894
    },
    {
      "id": "AIFACTORY-TASK-5895",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "ExecuteDeletionOrder handler of SecretBrokerService",
      "sequence": "11.03.10.03",
      "description": "ExecuteDeletionOrder handler of SecretBrokerService. Expected output: The inbox handler deletes the secret references of the ordered scope and the secret material they point at once per event id, never exports secret material, and acknowledges with a receipt through AcknowledgeOrderTask; it does not consume LegalHoldChanged in the model and relies on the refusal of a held scope at issue.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the secret references of the ordered scope and the secret material they point at once per event id, never exports secret material, and acknowledges with a receipt through AcknowledgeOrderTask; it does not consume LegalHoldChanged in the model and relies on the refusal of a held scope at issue."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5895]",
      "number": 5895
    },
    {
      "id": "AIFACTORY-TASK-5896",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "Verify the deletion handler of CostUsageService",
      "sequence": "11.03.10.04",
      "description": "Verify the deletion handler of CostUsageService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.CostUsageService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1460 for CostUsageService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.CostUsageService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1460 for CostUsageService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5896]",
      "number": 5896
    },
    {
      "id": "AIFACTORY-TASK-5928",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "Verify the deletion handler of PolicyEngineService",
      "sequence": "11.03.10.05",
      "description": "Verify the deletion handler of PolicyEngineService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.PolicyEngineService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1460 for PolicyEngineService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.PolicyEngineService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1460 for PolicyEngineService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5928]",
      "number": 5928
    },
    {
      "id": "AIFACTORY-TASK-5929",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "Verify the deletion handler of SecretBrokerService",
      "sequence": "11.03.10.06",
      "description": "Verify the deletion handler of SecretBrokerService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.SecretBrokerService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1460 for SecretBrokerService against the acknowledgement fixture of AIFACTORY-TASK-560, including that no secret material is exported.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.SecretBrokerService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1460 for SecretBrokerService against the acknowledgement fixture of AIFACTORY-TASK-560, including that no secret material is exported."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5929]",
      "number": 5929
    },
    {
      "id": "AIFACTORY-TASK-6285",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "ApplyLegalHold handler of CostUsageService",
      "sequence": "11.03.10.07",
      "description": "ApplyLegalHold handler of CostUsageService. Expected output: The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the usage records and budgets CostUsageService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the usage records and budgets CostUsageService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6285]",
      "number": 6285
    },
    {
      "id": "AIFACTORY-TASK-6286",
      "type": "task",
      "parent": "AIFACTORY-US-1460",
      "title": "Verify the legal-hold handler of CostUsageService",
      "sequence": "11.03.10.08",
      "description": "Verify the legal-hold handler of CostUsageService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.CostUsageService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1460 with a hold placed, redelivered and lifted on the usage of one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.CostUsageService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1460 with a hold placed, redelivered and lifted on the usage of one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12710,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6286]",
      "number": 6286
    },
    {
      "id": "AIFACTORY-US-1461",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Deletion-order handlers of AgentRuntimeService, WorkflowEngineService and ModelRouterService",
      "sequence": "11.03.11",
      "description": "As a workspace admin, I want agent executions, workflow state and routing records of an ordered scope deleted and acknowledged, so that a deletion order completes for the agent runtime and model platforms. AgentRuntimeService, WorkflowEngineService and ModelRouterService consume `RetentionResidencyService/DeletionOrderIssued` through their handler `ExecuteDeletionOrder`; the model delivers the first two in this increment with RetentionResidencyService, and this PBI builds all three in the repository of each service. Each handler enters through the inbox of its service, idempotent on the event id, and acts only on the scope of the order inside its tenant: the executions, attempts and transcripts of the agent runtime, the workflow instances and their state, and the routing decisions and usage the router records. The issue of a deletion order is refused for a scope held at that moment (AIFACTORY-US-1455); none of these three services consumes `LegalHoldChanged` in the model, so their handlers cannot see a hold placed after issue, which is reported to the owner. An Export produces the bundle of the service and deletes nothing, and after the deletion commits the handler acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with its workload token and a receipt; a redelivery changes nothing and a failing deletion is not acknowledged. Kind: behavior. Traces: services: AgentRuntimeService, WorkflowEngineService, ModelRouterService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued; adrs: ADR-0012, ADR-0019. Depends on: AIFACTORY-US-1455, AIFACTORY-US-1456, feature:agent-runtime-service, feature:workflow-engine-service, feature:model-router-service. Sources: model/services/agent-mesh/AgentRuntimeService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/services/model-compute/ModelRouterService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a RunPurge for a run set, when `RetentionResidencyService/DeletionOrderIssued` is delivered to AgentRuntimeService, WorkflowEngineService and ModelRouterService, then each deletes, redacts or archives the records of those runs from the stores it owns, keeps every other run, and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt (ADR-0019).",
        "AC2: Given the same order delivered twice, an Export order, or a deletion that fails, when the handlers run, then a redelivery changes nothing, an export deletes nothing and acknowledges with a bundle reference, and a failing deletion is not acknowledged, so the order is never reported complete for a scope these services did not delete (ADR-0019, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5897",
        "AIFACTORY-TASK-5898",
        "AIFACTORY-TASK-5899",
        "AIFACTORY-TASK-5900",
        "AIFACTORY-TASK-5930",
        "AIFACTORY-TASK-5931"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12711,
      "kind": "behavior",
      "traces": {
        "services": [
          "AgentRuntimeService",
          "WorkflowEngineService",
          "ModelRouterService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service",
        "feature:model-router-service"
      ],
      "source": [
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/model-compute/ModelRouterService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1461]",
      "number": 1461
    },
    {
      "id": "AIFACTORY-TASK-5897",
      "type": "task",
      "parent": "AIFACTORY-US-1461",
      "title": "ExecuteDeletionOrder handler of AgentRuntimeService",
      "sequence": "11.03.11.01",
      "description": "ExecuteDeletionOrder handler of AgentRuntimeService. Expected output: The inbox handler deletes, redacts or archives the executions, attempts and transcripts of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The inbox handler deletes, redacts or archives the executions, attempts and transcripts of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12711,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5897]",
      "number": 5897
    },
    {
      "id": "AIFACTORY-TASK-5898",
      "type": "task",
      "parent": "AIFACTORY-US-1461",
      "title": "ExecuteDeletionOrder handler of WorkflowEngineService",
      "sequence": "11.03.11.02",
      "description": "ExecuteDeletionOrder handler of WorkflowEngineService. Expected output: The inbox handler deletes the workflow instances and state of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the workflow instances and state of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12711,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5898]",
      "number": 5898
    },
    {
      "id": "AIFACTORY-TASK-5899",
      "type": "task",
      "parent": "AIFACTORY-US-1461",
      "title": "ExecuteDeletionOrder handler of ModelRouterService",
      "sequence": "11.03.11.03",
      "description": "ExecuteDeletionOrder handler of ModelRouterService. Expected output: The inbox handler deletes the routing decisions and usage of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the routing decisions and usage of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12711,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5899]",
      "number": 5899
    },
    {
      "id": "AIFACTORY-TASK-5900",
      "type": "task",
      "parent": "AIFACTORY-US-1461",
      "title": "Verify the deletion handler of AgentRuntimeService",
      "sequence": "11.03.11.04",
      "description": "Verify the deletion handler of AgentRuntimeService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.AgentRuntimeService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1461 for AgentRuntimeService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.AgentRuntimeService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1461 for AgentRuntimeService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12711,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5900]",
      "number": 5900
    },
    {
      "id": "AIFACTORY-TASK-5930",
      "type": "task",
      "parent": "AIFACTORY-US-1461",
      "title": "Verify the deletion handler of WorkflowEngineService",
      "sequence": "11.03.11.05",
      "description": "Verify the deletion handler of WorkflowEngineService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.WorkflowEngineService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1461 for WorkflowEngineService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.WorkflowEngineService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1461 for WorkflowEngineService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12711,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5930]",
      "number": 5930
    },
    {
      "id": "AIFACTORY-TASK-5931",
      "type": "task",
      "parent": "AIFACTORY-US-1461",
      "title": "Verify the deletion handler of ModelRouterService",
      "sequence": "11.03.11.06",
      "description": "Verify the deletion handler of ModelRouterService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ModelRouterService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1461 for ModelRouterService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ModelRouterService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1461 for ModelRouterService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12711,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5931]",
      "number": 5931
    },
    {
      "id": "AIFACTORY-US-1462",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Retention, legal-hold and deletion handlers of ArtifactService and the redaction handler of AuditService",
      "sequence": "11.03.12",
      "description": "As a workspace admin, I want artifacts kept, held and deleted by the rules of my tenant and the audit evidence of a deleted scope redacted, so that artifacts follow the same rules as every other store and the evidence survives without personal data. ArtifactService consumes `RetentionResidencyService/RetentionRuleChanged` through `ApplyRetentionRule`, `RetentionResidencyService/LegalHoldChanged` through `ApplyLegalHold` and `RetentionResidencyService/DeletionOrderIssued` through `ExecuteDeletionOrder`; by owner decision all three are built by this feature in the repository of ArtifactService. ArtifactService runs its own retention sweep from the first increment with a default retention of one year (`Knowledge:Artifacts:DefaultRetentionDays`, ADR-0019 as amended by D125); the sweep removes only the content of artifacts past retention that no audit evidence record and no unexpired run references, as its `ArtifactReferences` record, keeps metadata and lineage marked Deleted, and never takes a tenant-level artifact as a candidate. `RetentionSweeper` of RetentionResidencyService issues no purge order for the class `artifacts` (AIFACTORY-US-1458), so this sweep is the one expiry path of artifacts. `ApplyRetentionRule` records the rule of a tenant for the store class `artifacts` and its classification, and from then on that rule replaces the default for the artifacts of that tenant, while tenants without a rule keep the default. `ApplyLegalHold` marks the artifacts of the held scope so the sweep and every deletion skip them, and lifts the mark when the event says the hold is no longer active. `ExecuteDeletionOrder` deletes the artifacts and their blobs of the ordered scope and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask`; when a hold placed after the order was issued covers part of the scope, the held artifacts stay and the task of ArtifactService stays open, not acknowledged, until the hold is lifted, then the handler deletes them and acknowledges. An artifact of a tenant without a project belongs to its tenant (D125): it is deleted only by a TenantDeletion of that tenant, never by a ProjectDeletion or a RunPurge, and it is not a candidate of the retention sweep of a project; the artifacts of the platform tenant are never deleted by an order of a customer tenant. AuditService consumes `DeletionOrderIssued` through `RedactOnDeletionOrder`: it records the order as evidence and redacts the personal data of the scope in the evidence that must be kept, never purging it, then acknowledges with its receipt. All handlers enter through the inbox of their service and are idempotent on the event id. Kind: behavior. Traces: services: ArtifactService, AuditService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0015, ADR-0019. Depends on: AIFACTORY-US-1452, AIFACTORY-US-1455, AIFACTORY-US-1456, feature:artifact-service, feature:audit-service-complete. Sources: model/services/knowledge/ArtifactService.yaml, model/services/governance/AuditService.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given ArtifactService with the default retention of one year and a delivery of `RetentionResidencyService/RetentionRuleChanged` for the class `artifacts` of a tenant at 90 days, when the sweep of ArtifactService runs, then the artifacts of that tenant past 90 days whose content no audit evidence record and no unexpired run references lose their content with metadata and lineage kept, an artifact past 90 days that audit evidence or an unexpired run references stays, a tenant-level artifact stays, and a tenant without a rule follows `Knowledge:Artifacts:DefaultRetentionDays`; a redelivery changes nothing (ADR-0019, model/services/knowledge/ArtifactService.yaml).",
        "AC2: Given a delivery of `RetentionResidencyService/LegalHoldChanged` with `active` true for a project, when the sweep runs and a ProjectDeletion of that project issued before the hold is handled, then no held artifact is deleted and the task of ArtifactService stays open, not acknowledged as deleted; after the hold is lifted by the event, the held artifacts are deleted and the task is acknowledged, and artifacts of a lifted hold that no order covers are again candidates of the sweep (ADR-0019).",
        "AC3: Given a ProjectDeletion and an artifact of the same tenant without a project, when `RetentionResidencyService/DeletionOrderIssued` is handled, then the artifacts and blobs of the project are deleted, the tenant-level artifact stays, and ArtifactService acknowledges through `RetentionResidencyService/AcknowledgeOrderTask`; a TenantDeletion of that tenant deletes the tenant-level artifact too, and no artifact of the platform tenant is deleted (ADR-0019, ADR-0015).",
        "AC4: Given a TenantDeletion, when AuditService handles the order, then the evidence of the scope is redacted, never purged, the order itself is recorded as evidence, and AuditService acknowledges with its receipt; a redelivery changes nothing (ADR-0019, docs/architecture/data-governance.md#retention-and-deletion)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5901",
        "AIFACTORY-TASK-5902",
        "AIFACTORY-TASK-5903",
        "AIFACTORY-TASK-5904",
        "AIFACTORY-TASK-5932"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12712,
      "kind": "behavior",
      "traces": {
        "services": [
          "ArtifactService",
          "AuditService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1452",
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "feature:artifact-service",
        "feature:audit-service-complete"
      ],
      "source": [
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1462]",
      "number": 1462
    },
    {
      "id": "AIFACTORY-TASK-5901",
      "type": "task",
      "parent": "AIFACTORY-US-1462",
      "title": "ApplyRetentionRule and ApplyLegalHold handlers of ArtifactService",
      "sequence": "11.03.12.01",
      "description": "ApplyRetentionRule and ApplyLegalHold handlers of ArtifactService. Expected output: ApplyRetentionRule records the tenant rule of the class artifacts so the sweep of ArtifactService uses it in place of Knowledge:Artifacts:DefaultRetentionDays for that tenant, while the sweep still removes only content past retention that no audit evidence record and no unexpired run references, keeps metadata and lineage, and spares tenant-level artifacts; ApplyLegalHold marks and unmarks the artifacts of the held scope so the sweep and deletions skip them; both once per event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "ApplyRetentionRule records the tenant rule of the class artifacts so the sweep of ArtifactService uses it in place of Knowledge:Artifacts:DefaultRetentionDays for that tenant, while the sweep still removes only content past retention that no audit evidence record and no unexpired run references, keeps metadata and lineage, and spares tenant-level artifacts; ApplyLegalHold marks and unmarks the artifacts of the held scope so the sweep and deletions skip them; both once per event id."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12712,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5901]",
      "number": 5901
    },
    {
      "id": "AIFACTORY-TASK-5902",
      "type": "task",
      "parent": "AIFACTORY-US-1462",
      "title": "ExecuteDeletionOrder handler of ArtifactService with tenant-level artifacts",
      "sequence": "11.03.12.02",
      "description": "ExecuteDeletionOrder handler of ArtifactService with tenant-level artifacts. Expected output: The inbox handler deletes the artifacts and blobs of the ordered scope once per event id, deletes tenant-level artifacts only on a TenantDeletion of their tenant, never deletes artifacts of the platform tenant on a customer order, leaves artifacts held after issue in place with its task open until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "The inbox handler deletes the artifacts and blobs of the ordered scope once per event id, deletes tenant-level artifacts only on a TenantDeletion of their tenant, never deletes artifacts of the platform tenant on a customer order, leaves artifacts held after issue in place with its task open until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12712,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5902]",
      "number": 5902
    },
    {
      "id": "AIFACTORY-TASK-5903",
      "type": "task",
      "parent": "AIFACTORY-US-1462",
      "title": "RedactOnDeletionOrder handler of AuditService",
      "sequence": "11.03.12.03",
      "description": "RedactOnDeletionOrder handler of AuditService. Expected output: The inbox handler records the order as evidence, redacts the personal data of the scope in the retained evidence without purging it, once per event id, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The inbox handler records the order as evidence, redacts the personal data of the scope in the retained evidence without purging it, once per event id, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12712,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5903]",
      "number": 5903
    },
    {
      "id": "AIFACTORY-TASK-5904",
      "type": "task",
      "parent": "AIFACTORY-US-1462",
      "title": "Verify the retention, legal-hold and deletion handlers of ArtifactService",
      "sequence": "11.03.12.04",
      "description": "Verify the retention, legal-hold and deletion handlers of ArtifactService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(FullyQualifiedName~ApplyRetentionRule|FullyQualifiedName~ApplyLegalHold|FullyQualifiedName~ExecuteDeletionOrder)\"` in ConnectSoft.AI.SoftwareFactory.ArtifactService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1462 with a controlled clock, an artifact referenced by audit evidence, one referenced by an unexpired run, a tenant-level artifact and a hold placed after issue.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(FullyQualifiedName~ApplyRetentionRule|FullyQualifiedName~ApplyLegalHold|FullyQualifiedName~ExecuteDeletionOrder)\"` in ConnectSoft.AI.SoftwareFactory.ArtifactService; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1462 with a controlled clock, an artifact referenced by audit evidence, one referenced by an unexpired run, a tenant-level artifact and a hold placed after issue."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12712,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5904]",
      "number": 5904
    },
    {
      "id": "AIFACTORY-TASK-5932",
      "type": "task",
      "parent": "AIFACTORY-US-1462",
      "title": "Verify the redaction handler of AuditService",
      "sequence": "11.03.12.05",
      "description": "Verify the redaction handler of AuditService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~RedactOnDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.AuditService; a zero-match filter counts as a failure; the tests prove AC4 of AIFACTORY-US-1462 against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~RedactOnDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.AuditService; a zero-match filter counts as a failure; the tests prove AC4 of AIFACTORY-US-1462 against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12712,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5932]",
      "number": 5932
    },
    {
      "id": "AIFACTORY-US-1463",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Deletion-order and legal-hold handlers of ContextBuilderService, KnowledgeIngestionService and RepositoryIntelligenceService",
      "sequence": "11.03.13",
      "description": "As a workspace admin, I want context packs, ingested sources and repository indexes of an ordered scope deleted and acknowledged, so that no derived knowledge of a deleted scope survives its source. ContextBuilderService, KnowledgeIngestionService and RepositoryIntelligenceService, delivered thin before this increment, consume `RetentionResidencyService/DeletionOrderIssued` through their handler `ExecuteDeletionOrder`, built by this PBI in the repository of each service. They hold derived stores, which a tenant deletion empties first. Each handler enters through the inbox of its service, idempotent on the event id, and removes the context packs and caches, the ingested sources and their chunks, and the repository indexes and graphs of the scope inside its tenant, including every derived index, as ADR-0019 requires. The issue of a deletion order is refused for a scope held at that moment (AIFACTORY-US-1455); each of these services learns of a hold placed after issue through its own `ApplyLegalHold` handler of `LegalHoldChanged`, which this PBI builds in the repository of each service as D137 decides: once per event id it records the hold of the scope on the records and derived indexes the service owns, suspends their deletion and retention expiry while it is active and resumes them when a later `LegalHoldChanged` lifts it. The held records stay and the task stays open, not acknowledged, until the hold is lifted, then the deletion handler deletes them and acknowledges. An Export produces the bundle of the service and deletes nothing, and after the deletion commits the handler acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with its workload token and a receipt; a redelivery changes nothing and a failing deletion is not acknowledged. Kind: behavior. Traces: services: ContextBuilderService, KnowledgeIngestionService, RepositoryIntelligenceService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0012, ADR-0019. Depends on: AIFACTORY-US-1455, AIFACTORY-US-1456, feature:context-builder-service-thin, feature:knowledge-ingestion-service-thin, feature:repository-intelligence-service-thin. Sources: model/services/knowledge/ContextBuilderService.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/services/knowledge/RepositoryIntelligenceService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a ProjectDeletion, when `RetentionResidencyService/DeletionOrderIssued` is delivered to ContextBuilderService, KnowledgeIngestionService and RepositoryIntelligenceService, then each removes the derived records and indexes of that project, keeps those of other projects and tenants, and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt (ADR-0019).",
        "AC2: Given the same order delivered twice, a hold placed by `RetentionResidencyService/LegalHoldChanged` on the scope after the order was issued, or an Export order, when the handlers run, then a redelivery changes nothing, held records stay and the task of the service stays open, not acknowledged as deleted, until the hold is lifted, an export deletes nothing, and a failing deletion is not acknowledged (ADR-0019, ADR-0012).",
        "AC3: Given `RetentionResidencyService/LegalHoldChanged` placing a hold on a scope and a later one lifting it, when the `ApplyLegalHold` handler of ContextBuilderService, KnowledgeIngestionService and RepositoryIntelligenceService runs, then each records the hold once per event id on the records and derived indexes of that scope inside the tenant, suspends their deletion and retention expiry while it is active and resumes them when it is lifted, and leaves the records of other scopes untouched (RetentionResidencyService/LegalHoldChanged, D137, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5905",
        "AIFACTORY-TASK-5906",
        "AIFACTORY-TASK-5907",
        "AIFACTORY-TASK-5908",
        "AIFACTORY-TASK-5933",
        "AIFACTORY-TASK-5934",
        "AIFACTORY-TASK-6287",
        "AIFACTORY-TASK-6288",
        "AIFACTORY-TASK-6289",
        "AIFACTORY-TASK-6290",
        "AIFACTORY-TASK-6291",
        "AIFACTORY-TASK-6292"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "behavior",
      "traces": {
        "services": [
          "ContextBuilderService",
          "KnowledgeIngestionService",
          "RepositoryIntelligenceService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "feature:context-builder-service-thin",
        "feature:knowledge-ingestion-service-thin",
        "feature:repository-intelligence-service-thin"
      ],
      "source": [
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1463]",
      "number": 1463
    },
    {
      "id": "AIFACTORY-TASK-5905",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "ExecuteDeletionOrder handler of ContextBuilderService",
      "sequence": "11.03.13.01",
      "description": "ExecuteDeletionOrder handler of ContextBuilderService. Expected output: The inbox handler removes the context packs and caches of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "The inbox handler removes the context packs and caches of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5905]",
      "number": 5905
    },
    {
      "id": "AIFACTORY-TASK-5906",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "ExecuteDeletionOrder handler of KnowledgeIngestionService",
      "sequence": "11.03.13.02",
      "description": "ExecuteDeletionOrder handler of KnowledgeIngestionService. Expected output: The inbox handler removes the ingested sources and chunks of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "The inbox handler removes the ingested sources and chunks of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5906]",
      "number": 5906
    },
    {
      "id": "AIFACTORY-TASK-5907",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "ExecuteDeletionOrder handler of RepositoryIntelligenceService",
      "sequence": "11.03.13.03",
      "description": "ExecuteDeletionOrder handler of RepositoryIntelligenceService. Expected output: The inbox handler removes the repository indexes and graphs of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The inbox handler removes the repository indexes and graphs of the ordered scope once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5907]",
      "number": 5907
    },
    {
      "id": "AIFACTORY-TASK-5908",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "Verify the deletion handler of ContextBuilderService",
      "sequence": "11.03.13.04",
      "description": "Verify the deletion handler of ContextBuilderService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ContextBuilderService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1463 for ContextBuilderService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ContextBuilderService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1463 for ContextBuilderService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5908]",
      "number": 5908
    },
    {
      "id": "AIFACTORY-TASK-5933",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "Verify the deletion handler of KnowledgeIngestionService",
      "sequence": "11.03.13.05",
      "description": "Verify the deletion handler of KnowledgeIngestionService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1463 for KnowledgeIngestionService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1463 for KnowledgeIngestionService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5933]",
      "number": 5933
    },
    {
      "id": "AIFACTORY-TASK-5934",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "Verify the deletion handler of RepositoryIntelligenceService",
      "sequence": "11.03.13.06",
      "description": "Verify the deletion handler of RepositoryIntelligenceService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1463 for RepositoryIntelligenceService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1463 for RepositoryIntelligenceService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5934]",
      "number": 5934
    },
    {
      "id": "AIFACTORY-TASK-6287",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "ApplyLegalHold handler of ContextBuilderService",
      "sequence": "11.03.13.07",
      "description": "ApplyLegalHold handler of ContextBuilderService. Expected output: The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the context packs and caches ContextBuilderService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the context packs and caches ContextBuilderService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6287]",
      "number": 6287
    },
    {
      "id": "AIFACTORY-TASK-6288",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "ApplyLegalHold handler of KnowledgeIngestionService",
      "sequence": "11.03.13.08",
      "description": "ApplyLegalHold handler of KnowledgeIngestionService. Expected output: The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the ingested sources and chunks KnowledgeIngestionService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the ingested sources and chunks KnowledgeIngestionService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6288]",
      "number": 6288
    },
    {
      "id": "AIFACTORY-TASK-6289",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "ApplyLegalHold handler of RepositoryIntelligenceService",
      "sequence": "11.03.13.09",
      "description": "ApplyLegalHold handler of RepositoryIntelligenceService. Expected output: The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the repository indexes and graphs RepositoryIntelligenceService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the repository indexes and graphs RepositoryIntelligenceService owns, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6289]",
      "number": 6289
    },
    {
      "id": "AIFACTORY-TASK-6290",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "Verify the legal-hold handler of ContextBuilderService",
      "sequence": "11.03.13.10",
      "description": "Verify the legal-hold handler of ContextBuilderService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.ContextBuilderService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1463 for ContextBuilderService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.ContextBuilderService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1463 for ContextBuilderService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6290]",
      "number": 6290
    },
    {
      "id": "AIFACTORY-TASK-6291",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "Verify the legal-hold handler of KnowledgeIngestionService",
      "sequence": "11.03.13.11",
      "description": "Verify the legal-hold handler of KnowledgeIngestionService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1463 for KnowledgeIngestionService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1463 for KnowledgeIngestionService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6291]",
      "number": 6291
    },
    {
      "id": "AIFACTORY-TASK-6292",
      "type": "task",
      "parent": "AIFACTORY-US-1463",
      "title": "Verify the legal-hold handler of RepositoryIntelligenceService",
      "sequence": "11.03.13.12",
      "description": "Verify the legal-hold handler of RepositoryIntelligenceService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1463 for RepositoryIntelligenceService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1463 for RepositoryIntelligenceService with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12713,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6292]",
      "number": 6292
    },
    {
      "id": "AIFACTORY-US-1464",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Deletion-order handlers of VectorMemoryService, McpServerRegistryService and ToolAdapterService, and the legal-hold handler of VectorMemoryService",
      "sequence": "11.03.14",
      "description": "As a workspace admin, I want vector memory, MCP registrations and tool records of an ordered scope deleted and acknowledged, so that no memory or tool data of a deleted scope survives. VectorMemoryService, McpServerRegistryService and ToolAdapterService consume `RetentionResidencyService/DeletionOrderIssued` through their handler `ExecuteDeletionOrder`, built by this PBI in the repository of each service. Each handler enters through the inbox of its service, idempotent on the event id, and removes the vectors and memory entries, the MCP server registrations and the tool bindings and invocation records of the scope inside its tenant; vector memory is a derived store and is emptied with its source, as ADR-0019 requires. The issue of a deletion order is refused for a scope held at that moment (AIFACTORY-US-1455). VectorMemoryService learns of a hold placed after issue through its own `ApplyLegalHold` handler of `LegalHoldChanged`, which this PBI builds in its repository as D137 decides: once per event id it records the hold of the scope on the vectors and memory entries the service owns, suspends their deletion and retention expiry while it is active and resumes them when a later `LegalHoldChanged` lifts it; its held records stay and its task stays open, not acknowledged, until the hold is lifted. McpServerRegistryService and ToolAdapterService do not consume `LegalHoldChanged` in the model, so their handlers cannot see a hold placed after issue; this is reported to the owner. An Export produces the bundle of the service and deletes nothing, and after the deletion commits the handler acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with its workload token and a receipt; a redelivery changes nothing and a failing deletion is not acknowledged. Kind: behavior. Traces: services: VectorMemoryService, McpServerRegistryService, ToolAdapterService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0012, ADR-0013, ADR-0019. Depends on: AIFACTORY-US-1455, AIFACTORY-US-1456, feature:vector-memory-service-thin, feature:mcp-server-registry-service-thin, feature:tool-adapter-service. Sources: model/services/knowledge/VectorMemoryService.yaml, model/services/tools-mcp/McpServerRegistryService.yaml, model/services/tools-mcp/ToolAdapterService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a ProjectDeletion, when `RetentionResidencyService/DeletionOrderIssued` is delivered to VectorMemoryService, McpServerRegistryService and ToolAdapterService, then each removes the records of that project from the stores it owns, keeps those of other projects and tenants, and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt (ADR-0019, ADR-0013).",
        "AC2: Given the same order delivered twice, a hold placed by `RetentionResidencyService/LegalHoldChanged` on the scope after the order was issued, or an Export order, when the handlers run, then a redelivery changes nothing, the held records of VectorMemoryService stay and its task stays open, not acknowledged as deleted, until the hold is lifted, an export deletes nothing, and a failing deletion is not acknowledged (ADR-0019, ADR-0012).",
        "AC3: Given `RetentionResidencyService/LegalHoldChanged` placing a hold on a scope and a later one lifting it, when the `ApplyLegalHold` handler of VectorMemoryService runs, then the hold is recorded once per event id on the vectors and memory entries of that scope inside the tenant in every collection of its vector store profile, their deletion and retention expiry are suspended while it is active and resumed when it is lifted, and the records of other scopes are untouched (RetentionResidencyService/LegalHoldChanged, D137, ADR-0013)."
      ],
      "sourceArtifacts": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5909",
        "AIFACTORY-TASK-5910",
        "AIFACTORY-TASK-5911",
        "AIFACTORY-TASK-5912",
        "AIFACTORY-TASK-5935",
        "AIFACTORY-TASK-5936",
        "AIFACTORY-TASK-6293",
        "AIFACTORY-TASK-6294"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "behavior",
      "traces": {
        "services": [
          "VectorMemoryService",
          "McpServerRegistryService",
          "ToolAdapterService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0013",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "feature:vector-memory-service-thin",
        "feature:mcp-server-registry-service-thin",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1464]",
      "number": 1464
    },
    {
      "id": "AIFACTORY-TASK-5909",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "ExecuteDeletionOrder handler of VectorMemoryService",
      "sequence": "11.03.14.01",
      "description": "ExecuteDeletionOrder handler of VectorMemoryService. Expected output: The inbox handler removes the vectors and memory entries of the ordered scope from every collection of its vector store profile once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "The inbox handler removes the vectors and memory entries of the ordered scope from every collection of its vector store profile once per event id, leaves records held after issue in place with its task open, not acknowledged, until the hold is lifted, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5909]",
      "number": 5909
    },
    {
      "id": "AIFACTORY-TASK-5910",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "ExecuteDeletionOrder handler of McpServerRegistryService",
      "sequence": "11.03.14.02",
      "description": "ExecuteDeletionOrder handler of McpServerRegistryService. Expected output: The inbox handler removes the MCP server registrations of the ordered scope once per event id, relies on the refusal of a held scope at issue because it does not consume LegalHoldChanged in the model, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "The inbox handler removes the MCP server registrations of the ordered scope once per event id, relies on the refusal of a held scope at issue because it does not consume LegalHoldChanged in the model, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5910]",
      "number": 5910
    },
    {
      "id": "AIFACTORY-TASK-5911",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "ExecuteDeletionOrder handler of ToolAdapterService",
      "sequence": "11.03.14.03",
      "description": "ExecuteDeletionOrder handler of ToolAdapterService. Expected output: The inbox handler removes the tool bindings and invocation records of the ordered scope once per event id, relies on the refusal of a held scope at issue because it does not consume LegalHoldChanged in the model, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The inbox handler removes the tool bindings and invocation records of the ordered scope once per event id, relies on the refusal of a held scope at issue because it does not consume LegalHoldChanged in the model, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5911]",
      "number": 5911
    },
    {
      "id": "AIFACTORY-TASK-5912",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "Verify the deletion handler of VectorMemoryService",
      "sequence": "11.03.14.04",
      "description": "Verify the deletion handler of VectorMemoryService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.VectorMemoryService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1464 for VectorMemoryService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.VectorMemoryService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1464 for VectorMemoryService against the acknowledgement fixture of AIFACTORY-TASK-560, including a hold placed after issue that keeps the task open until it is lifted."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5912]",
      "number": 5912
    },
    {
      "id": "AIFACTORY-TASK-5935",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "Verify the deletion handler of McpServerRegistryService",
      "sequence": "11.03.14.05",
      "description": "Verify the deletion handler of McpServerRegistryService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.McpServerRegistryService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1464 for McpServerRegistryService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.McpServerRegistryService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1464 for McpServerRegistryService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5935]",
      "number": 5935
    },
    {
      "id": "AIFACTORY-TASK-5936",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "Verify the deletion handler of ToolAdapterService",
      "sequence": "11.03.14.06",
      "description": "Verify the deletion handler of ToolAdapterService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ToolAdapterService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1464 for ToolAdapterService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ToolAdapterService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1464 for ToolAdapterService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5936]",
      "number": 5936
    },
    {
      "id": "AIFACTORY-TASK-6293",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "ApplyLegalHold handler of VectorMemoryService",
      "sequence": "11.03.14.07",
      "description": "ApplyLegalHold handler of VectorMemoryService. Expected output: The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the vectors and memory entries of every collection of its vector store profile, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "The inbox handler of LegalHoldChanged records, once per event id, the hold of the scope inside its tenant on the vectors and memory entries of every collection of its vector store profile, suspends their deletion and retention expiry while the hold is active and resumes them when a later LegalHoldChanged lifts it; ExecuteDeletionOrder reads that hold state (D137)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6293]",
      "number": 6293
    },
    {
      "id": "AIFACTORY-TASK-6294",
      "type": "task",
      "parent": "AIFACTORY-US-1464",
      "title": "Verify the legal-hold handler of VectorMemoryService",
      "sequence": "11.03.14.08",
      "description": "Verify the legal-hold handler of VectorMemoryService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.VectorMemoryService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1464 with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ApplyLegalHold\"` in ConnectSoft.AI.SoftwareFactory.VectorMemoryService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1464 with a hold placed, redelivered and lifted on one project while another project of the tenant is untouched (SCN-RetentionResidencyService-014)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12714,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6294]",
      "number": 6294
    },
    {
      "id": "AIFACTORY-US-1465",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-057",
      "title": "Deletion-order handlers of ConnectorRegistryService and IntegrationService",
      "sequence": "11.03.15",
      "description": "As a workspace admin, I want connector registrations and integration records of an ordered scope deleted and acknowledged, so that a deletion order completes for the integration platform. ConnectorRegistryService and IntegrationService, delivered thin before this increment, consume `RetentionResidencyService/DeletionOrderIssued` through their handler `ExecuteDeletionOrder`, built by this PBI in the repository of each service. Each handler enters through the inbox of its service, idempotent on the event id, and removes the connector registrations and their settings, and the integration subscriptions, deliveries and logs of the scope inside its tenant; credentials of a connector are secret references, and the secret material is removed by SecretBrokerService under its own handler. The issue of a deletion order is refused for a scope held at that moment (AIFACTORY-US-1455); neither service consumes `LegalHoldChanged` in the model, so their handlers cannot see a hold placed after issue, which is reported to the owner. An Export produces the bundle of the service and deletes nothing, and after the deletion commits the handler acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with its workload token and a receipt; a redelivery changes nothing and a failing deletion is not acknowledged. Kind: behavior. Traces: services: ConnectorRegistryService, IntegrationService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/DeletionOrderIssued; adrs: ADR-0012, ADR-0019. Depends on: AIFACTORY-US-1455, AIFACTORY-US-1456, feature:connector-registry-service-thin, feature:integration-service-thin. Sources: model/services/integration/ConnectorRegistryService.yaml, model/services/integration/IntegrationService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a ProjectDeletion, when `RetentionResidencyService/DeletionOrderIssued` is delivered to ConnectorRegistryService and IntegrationService, then each removes the records of that project from the stores it owns, keeps those of other projects and tenants, and acknowledges through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt (ADR-0019).",
        "AC2: Given the same order delivered twice, an Export order, or a deletion that fails, when the handlers run, then a redelivery changes nothing, an export deletes nothing and carries no secret material, and a failing deletion is not acknowledged, so the order is never reported complete for a scope these services did not delete (ADR-0019, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5913",
        "AIFACTORY-TASK-5914",
        "AIFACTORY-TASK-5915",
        "AIFACTORY-TASK-5937"
      ],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12715,
      "kind": "behavior",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "IntegrationService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/DeletionOrderIssued"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1455",
        "AIFACTORY-US-1456",
        "feature:connector-registry-service-thin",
        "feature:integration-service-thin"
      ],
      "source": [
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1465]",
      "number": 1465
    },
    {
      "id": "AIFACTORY-TASK-5913",
      "type": "task",
      "parent": "AIFACTORY-US-1465",
      "title": "ExecuteDeletionOrder handler of ConnectorRegistryService",
      "sequence": "11.03.15.01",
      "description": "ExecuteDeletionOrder handler of ConnectorRegistryService. Expected output: The inbox handler removes the connector registrations and settings of the ordered scope once per event id, produces a bundle for an export without secret material, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "The inbox handler removes the connector registrations and settings of the ordered scope once per event id, produces a bundle for an export without secret material, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12715,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5913]",
      "number": 5913
    },
    {
      "id": "AIFACTORY-TASK-5914",
      "type": "task",
      "parent": "AIFACTORY-US-1465",
      "title": "ExecuteDeletionOrder handler of IntegrationService",
      "sequence": "11.03.15.02",
      "description": "ExecuteDeletionOrder handler of IntegrationService. Expected output: The inbox handler removes the integration subscriptions, deliveries and logs of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "The inbox handler removes the integration subscriptions, deliveries and logs of the ordered scope once per event id, produces a bundle for an export, and acknowledges with a receipt through AcknowledgeOrderTask."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12715,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5914]",
      "number": 5914
    },
    {
      "id": "AIFACTORY-TASK-5915",
      "type": "task",
      "parent": "AIFACTORY-US-1465",
      "title": "Verify the deletion handler of ConnectorRegistryService",
      "sequence": "11.03.15.03",
      "description": "Verify the deletion handler of ConnectorRegistryService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1465 for ConnectorRegistryService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1465 for ConnectorRegistryService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12715,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5915]",
      "number": 5915
    },
    {
      "id": "AIFACTORY-TASK-5937",
      "type": "task",
      "parent": "AIFACTORY-US-1465",
      "title": "Verify the deletion handler of IntegrationService",
      "sequence": "11.03.15.04",
      "description": "Verify the deletion handler of IntegrationService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.IntegrationService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1465 for IntegrationService against the acknowledgement fixture of AIFACTORY-TASK-560.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&FullyQualifiedName~ExecuteDeletionOrder\"` in ConnectSoft.AI.SoftwareFactory.IntegrationService; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1465 for IntegrationService against the acknowledgement fixture of AIFACTORY-TASK-560."
      ],
      "sourceArtifacts": [
        "model/services/data-event/RetentionResidencyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 127,
      "phase": "factory",
      "stackRank": 12715,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5937]",
      "number": 5937
    },
    {
      "id": "AIFACTORY-FEAT-058",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-011",
      "title": "StoreProfileService: complete delivery",
      "sequence": "11.04",
      "description": "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). Increment I4: Trust and accountability. Build order 128 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-049",
        "AIFACTORY-US-1466",
        "AIFACTORY-US-1467",
        "AIFACTORY-US-1468",
        "AIFACTORY-US-1469",
        "AIFACTORY-US-1470"
      ],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12800,
      "titlePrefix": "[AIFACTORY-FEAT-058]",
      "number": 58
    },
    {
      "id": "AIFACTORY-US-049",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-058",
      "title": "Each service is bound to a store that fits the topology and the region",
      "sequence": "11.04.01",
      "description": "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`. Kind: behavior. Traces: services: StoreProfileService, RetentionResidencyService, SecretBrokerService, DataEventFoundations; aggregates: StoreProfileService/StoreProfile, StoreProfileService/StoreBinding; apis: StoreProfileService/ListStoreBindings, StoreProfileService/ListStoreProfiles, StoreProfileService/SetStoreBinding, StoreProfileService/Stores.ResolveBinding; events: StoreProfileService/StoreProfileActivated, StoreProfileService/StoreBindingChanged, RetentionResidencyService/ResidencyRuleChanged; adrs: ADR-0006, ADR-0012, ADR-0013, ADR-0017, ADR-0018, ADR-0028; 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "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"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-388",
        "AIFACTORY-TASK-389",
        "AIFACTORY-TASK-390",
        "AIFACTORY-TASK-391",
        "AIFACTORY-TASK-392",
        "AIFACTORY-TASK-393",
        "AIFACTORY-TASK-394",
        "AIFACTORY-TASK-706",
        "AIFACTORY-TASK-6607"
      ],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "behavior",
      "traces": {
        "services": [
          "StoreProfileService",
          "RetentionResidencyService",
          "SecretBrokerService",
          "DataEventFoundations"
        ],
        "aggregates": [
          "StoreProfileService/StoreProfile",
          "StoreProfileService/StoreBinding"
        ],
        "apis": [
          "StoreProfileService/ListStoreBindings",
          "StoreProfileService/ListStoreProfiles",
          "StoreProfileService/SetStoreBinding",
          "StoreProfileService/Stores.ResolveBinding"
        ],
        "events": [
          "StoreProfileService/StoreProfileActivated",
          "StoreProfileService/StoreBindingChanged",
          "RetentionResidencyService/ResidencyRuleChanged"
        ],
        "adrs": [
          "ADR-0006",
          "ADR-0012",
          "ADR-0013",
          "ADR-0017",
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "FR-12",
          "NFR-05",
          "NFR-06",
          "NFR-16"
        ]
      },
      "relates": {
        "screens": [
          "stores"
        ]
      },
      "dependsOn": [
        "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"
      ],
      "source": [
        "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"
      ],
      "titlePrefix": "[AIFACTORY-US-049]",
      "number": 49
    },
    {
      "id": "AIFACTORY-TASK-388",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.StoreProfileService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "11.04.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.StoreProfileService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StoreProfileService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-388]",
      "number": 388
    },
    {
      "id": "AIFACTORY-TASK-389",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Domain model: StoreProfile, StoreBinding",
      "sequence": "11.04.01.02",
      "description": "Domain model: StoreProfile, StoreBinding. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-389]",
      "number": 389
    },
    {
      "id": "AIFACTORY-TASK-390",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Persistence in store-profile-sql: StoreProfiles, StoreBindings",
      "sequence": "11.04.01.03",
      "description": "Persistence in store-profile-sql: StoreProfiles, StoreBindings. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-390]",
      "number": 390
    },
    {
      "id": "AIFACTORY-TASK-391",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "API hosting skeleton: the 3 REST and 1 gRPC operations with scope enforcement and problem responses",
      "sequence": "11.04.01.04",
      "description": "API hosting skeleton: the 3 REST and 1 gRPC operations with scope enforcement and problem responses. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-391]",
      "number": 391
    },
    {
      "id": "AIFACTORY-TASK-392",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Messaging skeleton: outbox of the store-profile profile for 2 published events, inbox for ResidencyRuleChanged",
      "sequence": "11.04.01.05",
      "description": "Messaging skeleton: outbox of the store-profile profile for 2 published events, inbox for ResidencyRuleChanged. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-392]",
      "number": 392
    },
    {
      "id": "AIFACTORY-TASK-393",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Worker hosting skeleton: trigger, retry policy and idempotency key of BindingReconciler",
      "sequence": "11.04.01.06",
      "description": "Worker hosting skeleton: trigger, retry policy and idempotency key of BindingReconciler. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-393]",
      "number": 393
    },
    {
      "id": "AIFACTORY-TASK-394",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Security, tenancy and telemetry of StoreProfileService",
      "sequence": "11.04.01.07",
      "description": "Security, tenancy and telemetry of StoreProfileService. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-394]",
      "number": 394
    },
    {
      "id": "AIFACTORY-TASK-706",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Verify store-bindings-follow-residency by running the declared command",
      "sequence": "11.04.01.08",
      "description": "Verify store-bindings-follow-residency by running the declared command. Expected output: 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.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-706]",
      "number": 706
    },
    {
      "id": "AIFACTORY-TASK-6607",
      "type": "task",
      "parent": "AIFACTORY-US-049",
      "title": "Region options DataEvent:Stores DefaultRegion and AllowedRegions, the tenant-region source of ProjectService",
      "sequence": "11.04.01.09",
      "description": "Region options DataEvent:Stores DefaultRegion and AllowedRegions, the tenant-region source of ProjectService. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6607]",
      "number": 6607
    },
    {
      "id": "AIFACTORY-US-1466",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-058",
      "title": "List the store bindings and the engine profiles that run them",
      "sequence": "11.04.02",
      "description": "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`. Kind: behavior. Traces: services: StoreProfileService; aggregates: StoreProfileService/StoreBinding, StoreProfileService/StoreProfile; apis: StoreProfileService/ListStoreBindings, StoreProfileService/ListStoreProfiles; adrs: ADR-0006, ADR-0013, ADR-0015; requirements: FR-12, FUX-11; 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/planes/data-event/services/store-profile-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5916",
        "AIFACTORY-TASK-5917"
      ],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12802,
      "kind": "behavior",
      "traces": {
        "services": [
          "StoreProfileService"
        ],
        "aggregates": [
          "StoreProfileService/StoreBinding",
          "StoreProfileService/StoreProfile"
        ],
        "apis": [
          "StoreProfileService/ListStoreBindings",
          "StoreProfileService/ListStoreProfiles"
        ],
        "adrs": [
          "ADR-0006",
          "ADR-0013",
          "ADR-0015"
        ],
        "requirements": [
          "FR-12",
          "FUX-11"
        ],
        "scenarios": [
          "SCN-StoreProfileService-001",
          "SCN-StoreProfileService-002"
        ]
      },
      "relates": {
        "screens": [
          "stores"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/planes/data-event/services/store-profile-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1466]",
      "number": 1466
    },
    {
      "id": "AIFACTORY-TASK-5916",
      "type": "task",
      "parent": "AIFACTORY-US-1466",
      "title": "ListStoreBindings and ListStoreProfiles read models",
      "sequence": "11.04.02.01",
      "description": "ListStoreBindings and ListStoreProfiles read models. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5916]",
      "number": 5916
    },
    {
      "id": "AIFACTORY-TASK-5917",
      "type": "task",
      "parent": "AIFACTORY-US-1466",
      "title": "Verify the store reads through the acceptance suite",
      "sequence": "11.04.02.02",
      "description": "Verify the store reads through the acceptance suite. Expected output: 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.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5917]",
      "number": 5917
    },
    {
      "id": "AIFACTORY-US-1467",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-058",
      "title": "Hold the engine profile per store class and topology and announce an activated profile with StoreProfileActivated",
      "sequence": "11.04.03",
      "description": "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. Kind: behavior. Traces: services: StoreProfileService; aggregates: StoreProfileService/StoreProfile; events: StoreProfileService/StoreProfileActivated; adrs: ADR-0006, ADR-0012, ADR-0013, ADR-0017; requirements: NFR-06; scenarios: SCN-StoreProfileService-005. Relates: screens: stores. Sources: model/services/data-event/StoreProfileService.yaml, docs/architecture/catalogs/stores.md.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/architecture/catalogs/stores.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-562",
        "AIFACTORY-TASK-5918"
      ],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12803,
      "kind": "behavior",
      "traces": {
        "services": [
          "StoreProfileService"
        ],
        "aggregates": [
          "StoreProfileService/StoreProfile"
        ],
        "events": [
          "StoreProfileService/StoreProfileActivated"
        ],
        "adrs": [
          "ADR-0006",
          "ADR-0012",
          "ADR-0013",
          "ADR-0017"
        ],
        "requirements": [
          "NFR-06"
        ],
        "scenarios": [
          "SCN-StoreProfileService-005"
        ]
      },
      "relates": {
        "screens": [
          "stores"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/architecture/catalogs/stores.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1467]",
      "number": 1467
    },
    {
      "id": "AIFACTORY-TASK-562",
      "type": "task",
      "parent": "AIFACTORY-US-1467",
      "title": "Store profiles per class and topology",
      "sequence": "11.04.03.01",
      "description": "Store profiles per class and topology. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-562]",
      "number": 562
    },
    {
      "id": "AIFACTORY-TASK-5918",
      "type": "task",
      "parent": "AIFACTORY-US-1467",
      "title": "Verify the profile catalogue through the acceptance suite",
      "sequence": "11.04.03.02",
      "description": "Verify the profile catalogue through the acceptance suite. Expected output: 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.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5918]",
      "number": 5918
    },
    {
      "id": "AIFACTORY-US-1468",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-058",
      "title": "Bind a logical store to its owner, profile, region and key under the residency check, announced by StoreBindingChanged",
      "sequence": "11.04.04",
      "description": "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`. Kind: behavior. Traces: services: StoreProfileService, RetentionResidencyService, SecretBrokerService; aggregates: StoreProfileService/StoreBinding; apis: StoreProfileService/SetStoreBinding, RetentionResidencyService/Retention.EvaluateResidency; events: StoreProfileService/StoreBindingChanged; adrs: ADR-0012, ADR-0019; requirements: FR-12, NFR-16; 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/planes/data-event/services/store-profile-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-563",
        "AIFACTORY-TASK-5919",
        "AIFACTORY-TASK-5920"
      ],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12804,
      "kind": "behavior",
      "traces": {
        "services": [
          "StoreProfileService",
          "RetentionResidencyService",
          "SecretBrokerService"
        ],
        "aggregates": [
          "StoreProfileService/StoreBinding"
        ],
        "apis": [
          "StoreProfileService/SetStoreBinding",
          "RetentionResidencyService/Retention.EvaluateResidency"
        ],
        "events": [
          "StoreProfileService/StoreBindingChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ],
        "requirements": [
          "FR-12",
          "NFR-16"
        ],
        "scenarios": [
          "SCN-StoreProfileService-003",
          "SCN-StoreProfileService-006"
        ]
      },
      "relates": {
        "screens": [
          "stores"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1467",
        "feature:retention-residency-service",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/planes/data-event/services/store-profile-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1468]",
      "number": 1468
    },
    {
      "id": "AIFACTORY-TASK-563",
      "type": "task",
      "parent": "AIFACTORY-US-1468",
      "title": "Bindings with the residency check",
      "sequence": "11.04.04.01",
      "description": "Bindings with the residency check. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-563]",
      "number": 563
    },
    {
      "id": "AIFACTORY-TASK-5919",
      "type": "task",
      "parent": "AIFACTORY-US-1468",
      "title": "Ownership, schema, profile and key reference rules of SetStoreBinding",
      "sequence": "11.04.04.02",
      "description": "Ownership, schema, profile and key reference rules of SetStoreBinding. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5919]",
      "number": 5919
    },
    {
      "id": "AIFACTORY-TASK-5920",
      "type": "task",
      "parent": "AIFACTORY-US-1468",
      "title": "Verify store binding through the acceptance suite",
      "sequence": "11.04.04.03",
      "description": "Verify store binding through the acceptance suite. Expected output: 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.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5920]",
      "number": 5920
    },
    {
      "id": "AIFACTORY-US-1469",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-058",
      "title": "Resolve a logical store to its connection and key references, region and state for a tenant",
      "sequence": "11.04.05",
      "description": "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. Kind: behavior. Traces: services: StoreProfileService; aggregates: StoreProfileService/StoreBinding; apis: StoreProfileService/Stores.ResolveBinding; descriptors: store-binding-resolution-request-v1, store-binding-resolution-v1; adrs: ADR-0015, ADR-0028; requirements: NFR-05; 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "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"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5921",
        "AIFACTORY-TASK-5922"
      ],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12805,
      "kind": "behavior",
      "traces": {
        "services": [
          "StoreProfileService"
        ],
        "aggregates": [
          "StoreProfileService/StoreBinding"
        ],
        "apis": [
          "StoreProfileService/Stores.ResolveBinding"
        ],
        "descriptors": [
          "store-binding-resolution-request-v1",
          "store-binding-resolution-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-05"
        ],
        "scenarios": [
          "SCN-StoreProfileService-004"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1468"
      ],
      "source": [
        "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"
      ],
      "titlePrefix": "[AIFACTORY-US-1469]",
      "number": 1469
    },
    {
      "id": "AIFACTORY-TASK-5921",
      "type": "task",
      "parent": "AIFACTORY-US-1469",
      "title": "Stores.ResolveBinding for the owning workload and provisioning with tenant and ownership checks",
      "sequence": "11.04.05.01",
      "description": "Stores.ResolveBinding for the owning workload and provisioning with tenant and ownership checks. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12805,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5921]",
      "number": 5921
    },
    {
      "id": "AIFACTORY-TASK-5922",
      "type": "task",
      "parent": "AIFACTORY-US-1469",
      "title": "Verify binding resolution through the acceptance suite",
      "sequence": "11.04.05.02",
      "description": "Verify binding resolution through the acceptance suite. Expected output: 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.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5922]",
      "number": 5922
    },
    {
      "id": "AIFACTORY-US-1470",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-058",
      "title": "Re-evaluate the bindings of a tenant when its residency changes and reconcile bindings against their stores",
      "sequence": "11.04.06",
      "description": "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. Kind: behavior. Traces: services: StoreProfileService, RetentionResidencyService; aggregates: StoreProfileService/StoreBinding; events: StoreProfileService/StoreBindingChanged, RetentionResidencyService/ResidencyRuleChanged; adrs: ADR-0012, ADR-0019; 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/planes/data-event/services/store-profile-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5923",
        "AIFACTORY-TASK-5924",
        "AIFACTORY-TASK-5925"
      ],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12806,
      "kind": "behavior",
      "traces": {
        "services": [
          "StoreProfileService",
          "RetentionResidencyService"
        ],
        "aggregates": [
          "StoreProfileService/StoreBinding"
        ],
        "events": [
          "StoreProfileService/StoreBindingChanged",
          "RetentionResidencyService/ResidencyRuleChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-16"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1468",
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/data-event/StoreProfileService.yaml",
        "docs/planes/data-event/services/store-profile-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1470]",
      "number": 1470
    },
    {
      "id": "AIFACTORY-TASK-5923",
      "type": "task",
      "parent": "AIFACTORY-US-1470",
      "title": "ApplyResidencyRule handler of ResidencyRuleChanged",
      "sequence": "11.04.06.01",
      "description": "ApplyResidencyRule handler of ResidencyRuleChanged. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5923]",
      "number": 5923
    },
    {
      "id": "AIFACTORY-TASK-5924",
      "type": "task",
      "parent": "AIFACTORY-US-1470",
      "title": "BindingReconciler drift detection",
      "sequence": "11.04.06.02",
      "description": "BindingReconciler drift detection. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5924]",
      "number": 5924
    },
    {
      "id": "AIFACTORY-TASK-5925",
      "type": "task",
      "parent": "AIFACTORY-US-1470",
      "title": "Verify re-evaluation and reconciliation against AC1 and AC2",
      "sequence": "11.04.06.03",
      "description": "Verify re-evaluation and reconciliation against AC1 and AC2. Expected output: 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.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StoreProfileService.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/services/data-event/StoreProfileService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:data-event",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StoreProfileService"
      ],
      "children": [],
      "buildOrder": 128,
      "phase": "factory",
      "stackRank": 12806,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5925]",
      "number": 5925
    },
    {
      "id": "AIFACTORY-EPIC-012",
      "type": "epic",
      "parent": null,
      "title": "Governance (PF-12)",
      "sequence": "12",
      "description": "Everything that builds the Governance platform (PF-12): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Policy definitions and decisions, approval policy, audit, risk and compliance, data classification, secret broker. Done when: Every service of the platform has its complete delivery accepted (ApprovalPolicyService, AuditService, GovernanceHost, PolicyEngineService, SecretBrokerService), the platform gateway routes them under a trusted scope, and the outcome verification of I4 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (ApprovalPolicyService, AuditService, GovernanceHost, PolicyEngineService, SecretBrokerService), the platform gateway routes them under a trusted scope, and the outcome verification of I4 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-060",
        "AIFACTORY-FEAT-061",
        "AIFACTORY-FEAT-064",
        "AIFACTORY-FEAT-062",
        "AIFACTORY-FEAT-063"
      ],
      "stackRank": 7499,
      "titlePrefix": "[AIFACTORY-EPIC-012]",
      "number": 12
    },
    {
      "id": "AIFACTORY-FEAT-060",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-012",
      "title": "PolicyEngineService: complete delivery",
      "sequence": "12.01",
      "description": "PolicyEngineService is the service of bounded context BC-18 (Policy). Central policy — Published policy bundles per scope (platform, tenant, project, where a project may only tighten) that answer who may run which agent with which models against which data with which tools in which environment under which budget, and immutable recorded decisions with effects allow, deny, require-approval or prohibited and obligations (BC-18, original design §43). Its own repository is ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Delivers: PolicyEngineService (complete). Increment I1: Generate a microservice. Build order 75 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-069",
        "AIFACTORY-US-916",
        "AIFACTORY-US-917",
        "AIFACTORY-US-918",
        "AIFACTORY-US-919",
        "AIFACTORY-US-920",
        "AIFACTORY-US-921",
        "AIFACTORY-US-922"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7500,
      "titlePrefix": "[AIFACTORY-FEAT-060]",
      "number": 60
    },
    {
      "id": "AIFACTORY-US-069",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "PolicyEngineService serves its scope end to end",
      "sequence": "12.01.01",
      "description": "As a platform admin, I want one service that holds the policy bundles of the platform, of each tenant and of each project and records every decision it gives, so that the Policy context has one owner that the rest of the Factory calls through its contract and every gated action is decided in one place. This is the integration PBI of the feature. PolicyEngineService is the service of bounded context BC-18 and the one place where the Factory decides who may run which agent with which models against which data with which tools in which environment under which budget. It holds policy bundles, one active revision per scope (platform, tenant, project), where a narrower scope may only tighten a wider one (D18), and it records every decision immutably as `policy-decision-v1`. The repository ConnectSoft.AI.SoftwareFactory.PolicyEngineService is created and scaffolded in I0 by AIFACTORY-TASK-101 of feature `repository-and-pipeline-conventions` (D140), by the steps of its repository checklist, once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`), so token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again. The service writes its three integration events in the run event envelope of the pinned contracts package (feature `contracts-package`) through the Orleans outbox of the messaging profile `policy-engine`, in the transaction of the command that causes them (ADR-0014 amendment D114). The feature is delivered by seven further PBIs: activation and retirement of a bundle revision with the seed of this increment (AIFACTORY-US-916), the platform bundle and the seeded tenant bundle as authored documents with their decision table (AIFACTORY-US-917), `Policy.Decide` with the recorded decision (AIFACTORY-US-918), the active revision and the tightening check for other services (AIFACTORY-US-919), the reads of bundles (AIFACTORY-US-920), the validation of a project override and the simulation (AIFACTORY-US-921), and the decisions of a run with the retention sweep (AIFACTORY-US-922). This PBI proves that they compose on one deployed instance: the platform bundle is active from the start, the tenant bundle of a tenant is seeded by the service itself at the first decision asked for that tenant, once, idempotently, without an event and without an operator step (D127), the service names the revision a new run pins, a tool call of the first chain is decided, and the decision is recorded and announced. `Policy.Decide` is the only gate of a tool call for every side-effect class (D123): the outcome `allow-with-approval` is what asks for an approval, the policy engine opens no approval request, and ToolAdapterService opens it in RunControlService, where approval requests live (D121). In this increment every caller reaches the service inside the cluster over gRPC with a workload token that carries service scopes and no tenant claim; a caller forwards the tenant and the project in the call metadata and the service reads them only under the service scope that names PolicyEngineService (ADR-0015 amendment D114). The five REST operations are reached by a person through the gateway GovernanceHost, which is delivered in I1 like the other gateways (D127), and this feature builds no direct public route. A resource of another tenant is answered 404, over gRPC NOT_FOUND, and a missing scope or right inside the tenant 403 (ADR-0015 amendment D113). Three things of the model arrive later and are stated here so that nothing is assumed. AgentRegistryService is thin in I1: its publication path with `AssetReleasePublished` arrives in I2 with feature `agent-registry-service-publication`, and `AssetReleaseRevoked` and the evaluation gate arrive with its complete delivery in I4 (D140), so in this feature the two inbox handlers of this service are proven against a fixture publisher, and I1 to I3 run on the seeded bundles (D127). ApprovalPolicyService arrives in I4, and no behaviour of this increment depends on it. The handler of `DeletionOrderIssued` of RetentionResidencyService is built and proven in I4 with that service, and this feature registers none (D121), so of the three consumed events of the model the feature registers two. Telemetry follows ADR-0019: tenant and project on metrics by default, run, step and attempt on activities and log records, and no prompt text, secret, rule document content or payload in a decision, a log record, an activity or a metric. Kind: behavior. Traces: services: PolicyEngineService, ProjectService, EnvironmentService, AuditService, RunControlService, ToolAdapterService; aggregates: PolicyEngineService/PolicyBundle, PolicyEngineService/PolicyDecision; apis: PolicyEngineService/Policy.Decide, PolicyEngineService/Policy.GetActiveRevision; events: PolicyEngineService/PolicyRevisionActivated, PolicyEngineService/PolicyDecisionRecorded; tools: propose-change-set, blueprint-submit-version; descriptors: policy-decision-request-v1, policy-decision-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0019, ADR-0021, ADR-0022, ADR-0028; requirements: FR-05, FR-06, NFR-01, NFR-04. Depends on: AIFACTORY-US-916, AIFACTORY-US-917, AIFACTORY-US-918, AIFACTORY-US-919, AIFACTORY-US-920, AIFACTORY-US-921, AIFACTORY-US-922, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:component-observability-factory-conventions, feature:component-compliance-factory-classifications, feature:project-service, feature:environment-service. Sources: model/services/governance/PolicyEngineService.yaml, model/backlog/features/governance.yaml, docs/reference/schemas/policy-decision.schema.json, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/trust-operations/governance/services/policy-engine-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.PolicyEngineService created and scaffolded in I0 by AIFACTORY-TASK-101 of feature repository-and-pipeline-conventions by the steps of the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PolicyEngineService --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 with complete reports and a container image is published (ADR-0028, model/services/governance/PolicyEngineService.yaml).",
        "AC2: Given a deployed instance with an empty `policy-engine-sql`, when the service starts, then the platform bundle is an active `PolicyEngineService/PolicyBundle` revision with `PolicyEngineService/PolicyRevisionActivated` written in the transaction of its activation and readiness turned ready only after it; when the first `PolicyEngineService/Policy.Decide` is asked for a tenant that has no tenant bundle, then the tenant bundle of that tenant is seeded once with the platform revision as its parent, no event is published for the seed and no operator step ran, and `PolicyEngineService/Policy.GetActiveRevision` names the revision a new run of that tenant pins (ADR-0014, model/services/governance/PolicyEngineService.yaml).",
        "AC3: Given that instance and a workload token that holds the service scope that names PolicyEngineService, when `PolicyEngineService/Policy.Decide` is asked for a call of the tool `propose-change-set` and for a call of `blueprint-submit-version` on a Draft version, then the first answers `allow-with-approval` and the second `allow`, each decision is one immutable `PolicyEngineService/PolicyDecision` with its `PolicyEngineService/PolicyDecisionRecorded` outbox record in the same transaction, and the service opened no approval request and called RunControlService for none (FR-05, ADR-0022).",
        "AC4: Given a call without a workload identity, a workload token without the service scope and a request that names a revision of another tenant, when a gRPC method of the service is called, then the answers are UNAUTHENTICATED, PERMISSION_DENIED and NOT_FOUND; given a REST call with a token that lacks the scope of the operation and a call for a revision of another tenant, then the answers are 403 and 404; in none of these cases a row, a decision or an outbox record is written (ADR-0015, NFR-01).",
        "AC5: Given decisions of two tenants and two projects, when the telemetry conformance test reads the metrics, activities and log records of the instance, then the four metrics of model/services/governance/PolicyEngineService.yaml are recorded with their modelled dimensions and with tenant and project, activities and log records carry run, step and attempt where the request names them, and no prompt text, secret, rule document content or payload is found in a decision row, a metric, an activity or a log record (ADR-0019, NFR-04)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/backlog/features/governance.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-102",
        "AIFACTORY-TASK-103",
        "AIFACTORY-TASK-104",
        "AIFACTORY-TASK-105",
        "AIFACTORY-TASK-107",
        "AIFACTORY-TASK-3691",
        "AIFACTORY-TASK-755"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "behavior",
      "traces": {
        "services": [
          "PolicyEngineService",
          "ProjectService",
          "EnvironmentService",
          "AuditService",
          "RunControlService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyBundle",
          "PolicyEngineService/PolicyDecision"
        ],
        "apis": [
          "PolicyEngineService/Policy.Decide",
          "PolicyEngineService/Policy.GetActiveRevision"
        ],
        "events": [
          "PolicyEngineService/PolicyRevisionActivated",
          "PolicyEngineService/PolicyDecisionRecorded"
        ],
        "tools": [
          "propose-change-set",
          "blueprint-submit-version"
        ],
        "descriptors": [
          "policy-decision-request-v1",
          "policy-decision-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0021",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "NFR-01",
          "NFR-04"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-916",
        "AIFACTORY-US-917",
        "AIFACTORY-US-918",
        "AIFACTORY-US-919",
        "AIFACTORY-US-920",
        "AIFACTORY-US-921",
        "AIFACTORY-US-922",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions",
        "feature:component-compliance-factory-classifications",
        "feature:project-service",
        "feature:environment-service"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/backlog/features/governance.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-069]",
      "number": 69
    },
    {
      "id": "AIFACTORY-TASK-102",
      "type": "task",
      "parent": "AIFACTORY-US-069",
      "title": "Domain model: PolicyBundle with its PolicyRule entities, and PolicyDecision",
      "sequence": "12.01.01.01",
      "description": "Domain model: PolicyBundle with its PolicyRule entities, and PolicyDecision. Expected output: The two aggregates and the PolicyRule entity carry the fields and the invariants of model/services/governance/PolicyEngineService.yaml: a bundle is immutable per revision and is only activated or retired, a narrower scope only tightens a wider one, a Prohibited effect is never overridden, an AllowWithApproval rule names the action class of its approval, and a decision is immutable, names its exact revision and holds hashes and identifiers and never prompt text, secrets or payloads; the enums PolicyScope, PolicyEffect (Allow, AllowWithConstraints, AllowWithApproval, Deny, Prohibited, identical to the outcomes of policy-decision-v1) and PolicyDomain are closed; unit tests cover every invariant, the two transitions of a bundle (activated, retired) and the refusal of any change to a stored revision or decision.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two aggregates and the PolicyRule entity carry the fields and the invariants of model/services/governance/PolicyEngineService.yaml: a bundle is immutable per revision and is only activated or retired, a narrower scope only tightens a wider one, a Prohibited effect is never overridden, an AllowWithApproval rule names the action class of its approval, and a decision is immutable, names its exact revision and holds hashes and identifiers and never prompt text, secrets or payloads; the enums PolicyScope, PolicyEffect (Allow, AllowWithConstraints, AllowWithApproval, Deny, Prohibited, identical to the outcomes of policy-decision-v1) and PolicyDomain are closed; unit tests cover every invariant, the two transitions of a bundle (activated, retired) and the refusal of any change to a stored revision or decision."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-102]",
      "number": 102
    },
    {
      "id": "AIFACTORY-TASK-103",
      "type": "task",
      "parent": "AIFACTORY-US-069",
      "title": "Persistence in policy-engine-sql: PolicyBundles, PolicyRules and PolicyDecisions",
      "sequence": "12.01.01.02",
      "description": "Persistence in policy-engine-sql: PolicyBundles, PolicyRules and PolicyDecisions. Expected output: Mappings and migrations for the three modelled tables with their tenant columns under the row filter, the index IX_PolicyBundles_Scope_Active on tenant, scope, scope id and active flag, the indexes IX_Decisions_Run and IX_Decisions_Tenant_EvaluatedAt, and the foreign key of PolicyRules to PolicyBundles; the platform bundle of the platform tenant is the one row the filter admits for every tenant, read only; the revision id is a derived key and never a generated one, and the columns ReleaseId and RulesRef, which the model declares not nullable, hold for a seeded bundle the seed marker and the document path AIFACTORY-US-916 states; no column holds prompt text, a secret or a payload; the mapping of PolicyDecisions allows insert and delete and no update; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the three modelled tables with their tenant columns under the row filter, the index IX_PolicyBundles_Scope_Active on tenant, scope, scope id and active flag, the indexes IX_Decisions_Run and IX_Decisions_Tenant_EvaluatedAt, and the foreign key of PolicyRules to PolicyBundles; the platform bundle of the platform tenant is the one row the filter admits for every tenant, read only; the revision id is a derived key and never a generated one, and the columns ReleaseId and RulesRef, which the model declares not nullable, hold for a seeded bundle the seed marker and the document path AIFACTORY-US-916 states; no column holds prompt text, a secret or a payload; the mapping of PolicyDecisions allows insert and delete and no update; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-103]",
      "number": 103
    },
    {
      "id": "AIFACTORY-TASK-104",
      "type": "task",
      "parent": "AIFACTORY-US-069",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 5 REST and 3 gRPC operations",
      "sequence": "12.01.01.03",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 5 REST and 3 gRPC operations. Expected output: The five REST routes (ListPolicyBundles, GetPolicyBundle, ValidateProjectPolicy, SimulatePolicy, ListRunDecisions) and the three gRPC methods of the service Policy (Decide, GetActiveRevision, ValidateTightening) are hosted with JWT validation, the scope of each route (factory.policies.read, factory.policies.write, factory.runs.read), problem responses for every modelled refusal code and for the 404 of a resource of another tenant, workload identity and service scope checks on the three gRPC methods, which read the tenant and the project of the call metadata only under the service scope that names PolicyEngineService, and the OpenAPI and proto documents; a REST route admits no workload token; the behaviour of each operation is delivered by AIFACTORY-US-918 to AIFACTORY-US-922, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The five REST routes (ListPolicyBundles, GetPolicyBundle, ValidateProjectPolicy, SimulatePolicy, ListRunDecisions) and the three gRPC methods of the service Policy (Decide, GetActiveRevision, ValidateTightening) are hosted with JWT validation, the scope of each route (factory.policies.read, factory.policies.write, factory.runs.read), problem responses for every modelled refusal code and for the 404 of a resource of another tenant, workload identity and service scope checks on the three gRPC methods, which read the tenant and the project of the call metadata only under the service scope that names PolicyEngineService, and the OpenAPI and proto documents; a REST route admits no workload token; the behaviour of each operation is delivered by AIFACTORY-US-918 to AIFACTORY-US-922, not here."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-104]",
      "number": 104
    },
    {
      "id": "AIFACTORY-TASK-105",
      "type": "task",
      "parent": "AIFACTORY-US-069",
      "title": "Messaging skeleton: outbox and inbox wiring of the policy-engine profile for 3 published and 2 of the 3 consumed events",
      "sequence": "12.01.01.04",
      "description": "Messaging skeleton: outbox and inbox wiring of the policy-engine profile for 3 published and 2 of the 3 consumed events. Expected output: The outbox writer enlists in the transaction of the commands ActivateRevision and Decide and the dispatcher of the policy-engine messaging profile publishes the three modelled events in the run event envelope of the pinned contracts package (PolicyRevisionActivated, PolicyRevisionRetired, PolicyDecisionRecorded) on their modelled topics; the inbox registers AssetReleasePublished and AssetReleaseRevoked with idempotency on the event id, and DeletionOrderIssued is not registered, because its handler is built in I4 with RetentionResidencyService (D121); what each handler does is delivered by AIFACTORY-US-916.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of the commands ActivateRevision and Decide and the dispatcher of the policy-engine messaging profile publishes the three modelled events in the run event envelope of the pinned contracts package (PolicyRevisionActivated, PolicyRevisionRetired, PolicyDecisionRecorded) on their modelled topics; the inbox registers AssetReleasePublished and AssetReleaseRevoked with idempotency on the event id, and DeletionOrderIssued is not registered, because its handler is built in I4 with RetentionResidencyService (D121); what each handler does is delivered by AIFACTORY-US-916."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-105]",
      "number": 105
    },
    {
      "id": "AIFACTORY-TASK-107",
      "type": "task",
      "parent": "AIFACTORY-US-069",
      "title": "Security, tenancy and telemetry of PolicyEngineService",
      "sequence": "12.01.01.05",
      "description": "Security, tenancy and telemetry of PolicyEngineService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered, a resource of another tenant is answered 404 and NOT_FOUND, the secret messaging-transport comes from its secret reference, and the four metrics of the model (connectsoft.factory.policy.decisions, connectsoft.factory.policy.decision_latency, connectsoft.factory.policy.active_revisions, connectsoft.factory.policy.tightening_rejections) are recorded through the helper of the pinned observability packages with their modelled dimensions and with tenant and project; activities and log records carry run, step and attempt where a request names them, and a conformance test fails when prompt text, a secret, rule document content or a payload reaches a metric, an activity or a log record (ADR-0019).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered, a resource of another tenant is answered 404 and NOT_FOUND, the secret messaging-transport comes from its secret reference, and the four metrics of the model (connectsoft.factory.policy.decisions, connectsoft.factory.policy.decision_latency, connectsoft.factory.policy.active_revisions, connectsoft.factory.policy.tightening_rejections) are recorded through the helper of the pinned observability packages with their modelled dimensions and with tenant and project; activities and log records carry run, step and attempt where a request names them, and a conformance test fails when prompt text, a secret, rule document content or a payload reaches a metric, an activity or a log record (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-107]",
      "number": 107
    },
    {
      "id": "AIFACTORY-TASK-3691",
      "type": "task",
      "parent": "AIFACTORY-US-069",
      "title": "Deployment values of the service: replica range, options, probes and the addresses of its dependencies",
      "sequence": "12.01.01.06",
      "description": "Deployment values of the service: replica range, options, probes and the addresses of its dependencies. Expected output: The deployment manifest of the service states the replica range 3 to 10 of model/services/governance/PolicyEngineService.yaml, the liveness and readiness probes, the options Governance:Policy:DecisionCacheSeconds, Governance:Policy:PlatformSpendThresholdUsd and Governance:Host:FailClosed at the defaults of the model, OrleansMessaging:ServiceName policy-engine, the addresses of ProjectService and EnvironmentService and the store bindings policy-engine-sql, audit-immutable and cache from configuration; readiness reports the store, ProjectService and EnvironmentService and stays unready until the platform bundle is active; the Config Platform and the store binding cache are optional, and each degrades health and never readiness; no rule of this increment references Governance:Policy:PlatformSpendThresholdUsd, which stays bound for the delivery that brings the first caller of a Spend decision; the list of internal projects of the waiver rule is a value the installation passes to the seed, for which the model names no option and the repository fixes no entry; the manifest holds no secret value; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The deployment manifest of the service states the replica range 3 to 10 of model/services/governance/PolicyEngineService.yaml, the liveness and readiness probes, the options Governance:Policy:DecisionCacheSeconds, Governance:Policy:PlatformSpendThresholdUsd and Governance:Host:FailClosed at the defaults of the model, OrleansMessaging:ServiceName policy-engine, the addresses of ProjectService and EnvironmentService and the store bindings policy-engine-sql, audit-immutable and cache from configuration; readiness reports the store, ProjectService and EnvironmentService and stays unready until the platform bundle is active; the Config Platform and the store binding cache are optional, and each degrades health and never readiness; no rule of this increment references Governance:Policy:PlatformSpendThresholdUsd, which stays bound for the delivery that brings the first caller of a Spend decision; the list of internal projects of the waiver rule is a value the installation passes to the seed, for which the model names no option and the repository fixes no entry; the manifest holds no secret value; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-3691]",
      "number": 3691
    },
    {
      "id": "AIFACTORY-TASK-755",
      "type": "task",
      "parent": "AIFACTORY-US-069",
      "title": "Verify policy-engine-service-serves-its-scope by running the declared command",
      "sequence": "12.01.01.07",
      "description": "Verify policy-engine-service-serves-its-scope by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-069: the scaffold with the Factory profile, the platform bundle with PolicyEngineService/PolicyRevisionActivated and the tenant bundle seeded at the first decision without an event, the revision named by PolicyEngineService/Policy.GetActiveRevision, the decisions of propose-change-set and of blueprint-submit-version on a Draft version through PolicyEngineService/Policy.Decide with their recorded decisions, the refusals over two tenants, and the telemetry conformance test.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-069: the scaffold with the Factory profile, the platform bundle with PolicyEngineService/PolicyRevisionActivated and the tenant bundle seeded at the first decision without an event, the revision named by PolicyEngineService/Policy.GetActiveRevision, the decisions of propose-change-set and of blueprint-submit-version on a Draft version through PolicyEngineService/Policy.Decide with their recorded decisions, the refusals over two tenants, and the telemetry conformance test."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-755]",
      "number": 755
    },
    {
      "id": "AIFACTORY-US-916",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "Activate a policy bundle revision after tightening validation, retire the revision it replaces and announce both",
      "sequence": "12.01.02",
      "description": "As a platform admin, I want a policy bundle to come into force only as a whole revision that tightens its parent, with the revision it replaces retired and both announced, so that new runs pin a revision that never loosens the policy above it and runs that pinned an older revision finish on it. A policy bundle is the runtime read model of a policy asset: a versioned set of typed rules per domain for one scope, platform, tenant or project, with the revision id runs pin at acceptance. One command of the service changes it, `ActivateRevision`, and nothing else does: no REST or gRPC operation writes a bundle. The command takes a rule document, the scope it applies to, the release it comes from and the parent revision it tightens. It reads the document into `PolicyRule` rows, each with rule id, domain, match, effect, obligations and priority, computes `rulesHash`, and validates the bundle before anything is written. The document is readable, and every rule names a domain of `PolicyDomain` and an effect of `PolicyEffect`. A rule with the effect AllowWithApproval names in its obligations the action class the approval must bind to (D21, D127). A tenant bundle only tightens the active platform bundle and a project bundle only tightens the active tenant bundle of its tenant, rule by rule, in the order Allow, AllowWithConstraints, AllowWithApproval, Deny, Prohibited: a narrower rule never has a looser effect than the wider rule that matches the same action, a Prohibited effect is never overridden, and an obligation of the wider rule is never dropped. A valid bundle is written as a new `PolicyBundle` row with its rules, `active` true and `activatedAt`; the revision that was active for the same scope and scope id is set to `active` false; and the outbox records `PolicyRevisionActivated` (revision, tenantId, scope, scopeId, rulesHash) and, where a revision was replaced, `PolicyRevisionRetired` (revision, tenantId, scope) are written in the same transaction. A tenant or project document whose parent scope has no active bundle is refused whole. The revision id is the primary key runs pin, so it is derived and never drawn: a hash, in a fixed text form within the 64 characters of the column, of the tenant, the scope, the scope id, the release id, the parent revision and `rulesHash`, so that two replicas that handle the same document compute the same key and the primary key of `PolicyBundles` refuses the second insert, which the command reads as done. A bundle is immutable per revision: the command never changes the rules of a stored revision, an activation whose derived revision id is stored and active changes nothing and publishes nothing, an activation whose id is stored and retired sets that revision active again, retires the one in force and announces both without writing its rules a second time, and a retired revision keeps its rules, because runs that pinned it finish on it. An invalid bundle is refused whole: no row and no event is written, the previous revision stays active (failure mode Rule document unreadable of the model), `connectsoft.factory.policy.tightening_rejections` counts a refusal for loosening by tenant, and the refusal is logged with the rule ids and without rule content. `connectsoft.factory.policy.active_revisions` follows every activation and retirement by scope. Three callers reach the command. The first is the startup seed of the platform bundle. When the service starts it activates the platform bundle document that the rule document port serves for the platform scope, under the platform tenant. The tenant bundle is not activated by this command: PolicyEngineService seeds the bundle of a tenant itself, once and idempotently, at the first decision asked for a tenant that has none, with no event and no operator step (D127), and AIFACTORY-US-918 delivers that seed; it reuses the validation, the seed marker and the derived revision id of this PBI, and the platform tenant is seeded the same way at its first decision. The two authored documents are delivered by AIFACTORY-US-917; this PBI proves the seed with fixture documents in the same typed shape, so neither PBI waits for the other. Before the platform document is activated the seed renders into the match of its waiver rule the internal projects the installation supplies (ADR-0021 amendment D83), so the activated rule names them, `rulesHash` covers them and a changed list is a new revision. The model declares `releaseId` and `rulesRef` as required, a published asset release and the artifact reference of the rule document, and a seeded bundle has neither: for a seeded bundle `releaseId` holds a seed marker with the name and the version of the document and `rulesRef` the path of the document in the repository of the service with that version, and the mismatch is reported as a correction of the model. The platform seed runs through the command and its validation and is idempotent through the derived revision id: the same document under the same parent gives the same id and changes nothing. When a new platform revision replaces the active one, the tenant bundles keep the parent they were validated against, because the parent is part of the id (AIFACTORY-US-918 states what a decision follows meanwhile). Readiness stays unready until the platform bundle is active, so the service never answers a decision without one. The second and the third caller are the inbox handlers. `ActivatePolicyBundle` handles `AssetReleasePublished` of AgentRegistryService for a release of the asset kind Policy and ignores every other kind. `RetirePolicyBundle` handles `AssetReleaseRevoked` and retires the revision of the revoked release with `PolicyRevisionRetired`; a revoked release that no bundle names is ignored. Both are idempotent on the event id through the inbox. What a scope is decided under when its active revision is retired without a successor is not stated by the model: this PBI leaves the scope without an active bundle, so a tenant in that state fails closed like an unseeded one, and the point is reported to the owner. The event of the registry names a release and carries no rule document, and the model lists no dependency through which the service reads the document of a release, so the handler reads it through one rule document port. In this increment the port is bound to the seeded documents of the repository; its binding to a published release is reported to the owner and arrives with the complete registry. AgentRegistryService is thin in I1; it publishes `AssetReleasePublished` from I2 through the publication path of feature `agent-registry-service-publication` and `AssetReleaseRevoked` only in I4 (D140), so in this I1 feature the two handlers are registered and proven against a fixture publisher built from the pinned contracts package. I1 to I3 run on the seeded bundles: until the publication gate of I4 no tenant and no project can activate a bundle of its own, so a tenant cannot drop an approval of its seeded bundle and a project cannot add one (D127). This PBI proves what the publisher of the two events can prove: the outbox record in the transaction of the command, the run event envelope, the payload, and a transport outage retried with backoff without loss or duplicate under the event id (ADR-0012). RunControlService pins the activated revision for new runs and AuditService records the evidence in their own PBIs; StudioBff and ApprovalPolicyService, which also consume the activation, arrive in I3 and I4. Kind: behavior. Traces: services: PolicyEngineService, AgentRegistryService, RunControlService, AuditService; aggregates: PolicyEngineService/PolicyBundle; events: PolicyEngineService/PolicyRevisionActivated, PolicyEngineService/PolicyRevisionRetired; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-06, NFR-04; scenarios: SCN-PolicyEngineService-009, SCN-PolicyEngineService-010. Depends on: feature:contracts-package, feature:component-base-template-factory-profile. Sources: model/services/governance/PolicyEngineService.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/trust-operations/governance/services/policy-engine-service/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given an empty `policy-engine-sql`, the fixture platform and tenant documents of the acceptance suite and a list of internal projects, when the service starts, then one active `PolicyEngineService/PolicyBundle` of scope Platform exists with its rule rows, its `rulesHash`, a revision id derived from tenant, scope, scope id, release id, parent revision and `rulesHash`, the seed marker in `releaseId` and the document path in `rulesRef`, its waiver rule names the supplied projects, `PolicyEngineService/PolicyRevisionActivated` was written to the outbox in the same transaction and readiness turned ready only after it; no tenant bundle is activated at startup, because the first decision of a tenant seeds it (AIFACTORY-US-918); a second start and two replicas that start together change nothing and publish nothing, and a start with a changed list activates a new platform revision and retires the previous one (SCN-PolicyEngineService-009, model/services/governance/PolicyEngineService.yaml).",
        "AC2: Given an active tenant revision and a fixture `AssetReleasePublished` of the asset kind Policy whose document tightens the platform bundle, when `ActivatePolicyBundle` handles it, then the new revision is active, the previous one has `active` false and keeps its rules, and the outbox records `PolicyEngineService/PolicyRevisionActivated` with revision, tenantId, scope, scopeId and rulesHash and `PolicyEngineService/PolicyRevisionRetired` with revision, tenantId and scope are written in that one transaction; a redelivery of the event and an event of another asset kind change nothing (SCN-PolicyEngineService-009, SCN-PolicyEngineService-010, ADR-0014).",
        "AC3: Given a document that cannot be read, a rule with an unknown domain or effect, an AllowWithApproval rule without an action class, and a tenant document one of whose rules is looser than the platform rule for the same action, overrides a Prohibited effect or drops an obligation, when an activation is attempted, then each is refused whole, no bundle row, rule row or outbox record is written, the previous revision stays active, a refusal for loosening is counted in `connectsoft.factory.policy.tightening_rejections`, and the log names the rule ids and no rule content (SCN-PolicyEngineService-009, model/services/governance/PolicyEngineService.yaml).",
        "AC4: Given a fixture `AssetReleaseRevoked` for the release of an active project revision, when `RetirePolicyBundle` handles it, then the revision has `active` false and keeps its rules, `PolicyEngineService/PolicyRevisionRetired` is written in the same transaction, and a request that names the retired revision as pinned is still decided under it; a revoked release that no bundle names and a redelivered event change nothing (SCN-PolicyEngineService-010, ADR-0014).",
        "AC5: Given outbox records of both events and a transport that is unavailable, when the dispatcher of the `policy-engine` messaging profile runs, then each event is published on its topic, `policy.bundles.v1.policy-revision-activated` or `policy.bundles.v1.policy-revision-retired`, in the run event envelope with its tenant and its payload, the outage is retried with backoff, and no event is lost or published twice under its event id (SCN-PolicyEngineService-009, SCN-PolicyEngineService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3692",
        "AIFACTORY-TASK-3693",
        "AIFACTORY-TASK-3694",
        "AIFACTORY-TASK-3695"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7502,
      "kind": "behavior",
      "traces": {
        "services": [
          "PolicyEngineService",
          "AgentRegistryService",
          "RunControlService",
          "AuditService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyBundle"
        ],
        "events": [
          "PolicyEngineService/PolicyRevisionActivated",
          "PolicyEngineService/PolicyRevisionRetired"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-PolicyEngineService-009",
          "SCN-PolicyEngineService-010"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:contracts-package",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-916]",
      "number": 916
    },
    {
      "id": "AIFACTORY-TASK-3692",
      "type": "task",
      "parent": "AIFACTORY-US-916",
      "title": "ActivateRevision command with the tightening comparer, the two inbox handlers and the rule document port",
      "sequence": "12.01.02.01",
      "description": "ActivateRevision command with the tightening comparer, the two inbox handlers and the rule document port. Expected output: The command reads a rule document into PolicyRule rows, computes rulesHash, derives the revision id as a hash of tenant, scope, scope id, release id, parent revision and rulesHash in a fixed text form within 64 characters, so that two replicas produce the same key, refuses a tenant or project document whose parent scope has no active bundle, validates readability, domains, effects, the action class of every AllowWithApproval rule and, through one tightening comparer that AIFACTORY-US-918, AIFACTORY-US-919 and AIFACTORY-US-921 reuse, the monotonic tightening of a tenant bundle against the active platform bundle and of a project bundle against the active tenant bundle, in the order Allow, AllowWithConstraints, AllowWithApproval, Deny, Prohibited with no Prohibited effect overridden and no obligation dropped; it writes the new revision, sets the replaced revision inactive and writes PolicyRevisionActivated and PolicyRevisionRetired in one transaction, changes nothing when the derived revision id is stored and active, sets a stored retired revision of that id active again without a second write of its rules, and refuses an invalid document whole; ActivatePolicyBundle and RetirePolicyBundle call it from the inbox for a release of the asset kind Policy, idempotent on the event id, and read the document of a release through one rule document port whose binding of this increment serves the seeded documents of the repository; the two metrics active_revisions and tightening_rejections are recorded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The command reads a rule document into PolicyRule rows, computes rulesHash, derives the revision id as a hash of tenant, scope, scope id, release id, parent revision and rulesHash in a fixed text form within 64 characters, so that two replicas produce the same key, refuses a tenant or project document whose parent scope has no active bundle, validates readability, domains, effects, the action class of every AllowWithApproval rule and, through one tightening comparer that AIFACTORY-US-918, AIFACTORY-US-919 and AIFACTORY-US-921 reuse, the monotonic tightening of a tenant bundle against the active platform bundle and of a project bundle against the active tenant bundle, in the order Allow, AllowWithConstraints, AllowWithApproval, Deny, Prohibited with no Prohibited effect overridden and no obligation dropped; it writes the new revision, sets the replaced revision inactive and writes PolicyRevisionActivated and PolicyRevisionRetired in one transaction, changes nothing when the derived revision id is stored and active, sets a stored retired revision of that id active again without a second write of its rules, and refuses an invalid document whole; ActivatePolicyBundle and RetirePolicyBundle call it from the inbox for a release of the asset kind Policy, idempotent on the event id, and read the document of a release through one rule document port whose binding of this increment serves the seeded documents of the repository; the two metrics active_revisions and tightening_rejections are recorded."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3692]",
      "number": 3692
    },
    {
      "id": "AIFACTORY-TASK-3693",
      "type": "task",
      "parent": "AIFACTORY-US-916",
      "title": "Seed of the platform bundle at startup",
      "sequence": "12.01.02.02",
      "description": "Seed of the platform bundle at startup. Expected output: At startup the service host takes the platform bundle document the rule document port serves, renders the internal projects the installation supplies into the match of its waiver rule, so that the activated rule names them and rulesHash covers them, and activates it for the platform scope under the platform tenant through ActivateRevision with the seed marker (name and version of the document) as ReleaseId and the path of the document with its version as RulesRef; the activation is idempotent through the derived revision id, also when replicas start together, and readiness stays unready until the platform bundle is active; a failed seed is retried in the running process with backoff and logged, and liveness keeps answering; no tenant bundle is activated at startup and the host has no seed job, because the tenant bundle is seeded at the first decision of its tenant (AIFACTORY-TASK-3700, D127).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "At startup the service host takes the platform bundle document the rule document port serves, renders the internal projects the installation supplies into the match of its waiver rule, so that the activated rule names them and rulesHash covers them, and activates it for the platform scope under the platform tenant through ActivateRevision with the seed marker (name and version of the document) as ReleaseId and the path of the document with its version as RulesRef; the activation is idempotent through the derived revision id, also when replicas start together, and readiness stays unready until the platform bundle is active; a failed seed is retried in the running process with backoff and logged, and liveness keeps answering; no tenant bundle is activated at startup and the host has no seed job, because the tenant bundle is seeded at the first decision of its tenant (AIFACTORY-TASK-3700, D127)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7502,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-3693]",
      "number": 3693
    },
    {
      "id": "AIFACTORY-TASK-3694",
      "type": "task",
      "parent": "AIFACTORY-US-916",
      "title": "Fixture publisher of the asset release events and the invalid bundle documents of the acceptance suite",
      "sequence": "12.01.02.03",
      "description": "Fixture publisher of the asset release events and the invalid bundle documents of the acceptance suite. Expected output: The acceptance suite holds a publisher that builds AssetReleasePublished and AssetReleaseRevoked in the run event envelope from the pinned contracts package for the asset kind Policy and for another kind, a binding of the rule document port that returns a document per release id and can be made to fail, a fixture platform document with a waiver rule and a fixture seeded tenant document in the typed shape of the model, with which the seed is proven before the authored documents of AIFACTORY-US-917 exist, two lists of internal projects, valid tenant and project documents that tighten their parent, and one invalid document per refusal of AIFACTORY-US-916 (unreadable, unknown domain, unknown effect, AllowWithApproval without an action class, a looser effect, an overridden Prohibited effect, a dropped obligation).. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a publisher that builds AssetReleasePublished and AssetReleaseRevoked in the run event envelope from the pinned contracts package for the asset kind Policy and for another kind, a binding of the rule document port that returns a document per release id and can be made to fail, a fixture platform document with a waiver rule and a fixture seeded tenant document in the typed shape of the model, with which the seed is proven before the authored documents of AIFACTORY-US-917 exist, two lists of internal projects, valid tenant and project documents that tighten their parent, and one invalid document per refusal of AIFACTORY-US-916 (unreadable, unknown domain, unknown effect, AllowWithApproval without an action class, a looser effect, an overridden Prohibited effect, a dropped obligation)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3694]",
      "number": 3694
    },
    {
      "id": "AIFACTORY-TASK-3695",
      "type": "task",
      "parent": "AIFACTORY-US-916",
      "title": "Verify activation and retirement through the acceptance suite",
      "sequence": "12.01.02.04",
      "description": "Verify activation and retirement through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-009|Scenario=SCN-PolicyEngineService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-916 with the fixture documents of AIFACTORY-TASK-3694: the seed at startup with readiness, the derived revision id equal on two replicas, the seed marker and the document path of a seeded bundle, the waiver rule that names the supplied projects and the new platform revision after a changed list, the repeated start that changes nothing, an activation that retires its predecessor in one transaction, every refusal of an invalid document with the stores and the outbox unchanged, the retirement on a revoked release with a pinned decision still served, and the publication of both events with their payloads under a transport outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-009|Scenario=SCN-PolicyEngineService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-916 with the fixture documents of AIFACTORY-TASK-3694: the seed at startup with readiness, the derived revision id equal on two replicas, the seed marker and the document path of a seeded bundle, the waiver rule that names the supplied projects and the new platform revision after a changed list, the repeated start that changes nothing, an activation that retires its predecessor in one transaction, every refusal of an invalid document with the stores and the outbox unchanged, the retirement on a revoked release with a pinned decision still served, and the publication of both events with their payloads under a transport outage."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3695]",
      "number": 3695
    },
    {
      "id": "AIFACTORY-US-917",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "Author the platform bundle and the seeded tenant bundle as documents and prove their decisions with a decision table",
      "sequence": "12.01.03",
      "description": "As a platform admin, I want the policy of the first increment written as two bundle documents whose decisions are proven case by case, so that every tenant starts with the default approvals, a tenant can later drop them only by changing its own bundle, and the first chain is gated exactly as decided. Which calls the policy gates is the matter of the policy bundles, and the bundles of the first increment are authored documents of this repository, because the publication path of AgentRegistryService arrives only in I2 (D140) and I1 to I3 run on the seeded bundles (D127). This PBI delivers two documents in the typed shape of the model, scope, parent and rules with id, domain, match, effect, obligations and priority, and the table that proves them. The platform bundle is the ceiling every tenant inherits. For tool calls, domain ToolExecution, it allows every side-effect class: read and sandbox work is autonomous within scope and budget (D21), and it leaves the classes shared-write, production, publication, external and spend allowed (D123, D125), because a tenant bundle may only tighten the platform bundle (D18) and only this reading lets a tenant decide which approvals it keeps. For run acceptance it holds the waiver rule of ADR-0021 amendment D83: a Draft workflow or agent release may run only in the acceptance environment and in the projects the rule names as internal, the decision of such a run records the waiver in its matched rules and its reason, so that the audit entry carries it, and any other run of a Draft release is denied; the rule is removed when the evaluation gate of I4 is delivered. A run acceptance reaches the rule as a request of the action kind `run-acceptance`, which pairs with the domain RunAcceptance in the one pairing list of the model (D127). The internal projects are an input of the owner. The authored document names none: the seed renders the projects the installation supplies into the match of the waiver rule before it activates the document (AIFACTORY-US-916), so the activated rule names them as decided, `rulesHash` covers them, the same inputs under one revision give one effect, and a change of the list is a new revision. With an empty list the waiver allows no run. Neither document holds a rule of the domain Spend in this increment. No service of I1 asks a Spend decision, because CostUsageService announces a run above its spend threshold itself and RunControlService opens the spend approval from that event (D117), so a Spend rule would have no caller, no match and no row in the decision table. The option `Governance:Policy:PlatformSpendThresholdUsd` stays bound for the delivery that brings the first caller, and this is reported to the owner; the Allow rule for a tool call of the class spend is a rule of the domain ToolExecution and stays. The platform bundle also holds the Allow rules without which no step of the first chain proceeds, each named with the caller that asks it: the declared action classes of a workflow definition at load (WorkflowEngineService), model invocation under a seeded model profile (ModelRouterService), the store and the preview of an artifact, the action kinds `store` and `preview` of `policy-decision-v1` (ArtifactService, D125), retrieval (ContextBuilderService) and approval eligibility for the roles ADR-0015 names, Reviewer and Workspace admin of the project for an approval and Operator for an operator decision (RunControlService). The approval eligibility rules match the action kind `approval-eligibility`, which pairs with the domain RunAcceptance (D127), with the target `approval` or `operator-decision`; the rule id of the eligibility rule for an approval is the approver rule reference a decision of `allow-with-approval` names. Four more Allow rules are needed outside the first chain, each fixed by a decision. ArtifactService asks `Policy.Decide` for the export of the artifacts of a project with the action kind `export`, the target `artifact-export` and the class external and starts an export for the outcome `allow` only (model/services/knowledge/ArtifactService.yaml), and the Knowledge gateway of I1 is the route by which a person exports (D125), so without a rule every export of I1 would be answered 403. A tenant takes along what it submitted on request (D31), so the platform bundle holds an Allow rule in the domain DataHandling for that kind and target, for a subject who is Workspace admin of the project or Platform admin, the callers `ExportArtifacts` admits (D127). SecretBrokerService asks a decision per issuance with the action kind `credential-issuance` and the purpose of the issuance, and the platform bundle allows the purposes `tool-call` and `sandbox` in the domain DataHandling, without which the first outcome cannot issue a credential (D127), and the purpose `delivery` only for a subject that is the service identity of ConnectorRegistryService or WebhookGatewayService, for the certification of a connector, the delivery reads and the webhook signing secret (D139). IntegrationService asks a decision per grant with the action kind `connection-grant`, and the platform bundle allows it in the domain ConnectionGrant for a subject who is Workspace admin of the project or the Platform admin (D129). IaCProvisioningService asks a decision per apply with the action kind `provisioning-apply` and the side-effect class of its plan, and the platform bundle allows it in the domain Deployment (D129). EnvironmentPromotionService, delivered in I2, asks the Policy gate of each promotion with the action kind `promotion`, which pairs with the domain Deployment, and the class of the target environment, and the platform bundle allows it in that domain for a subject who is Operator or Workspace admin of the project; the rule is authored in this increment so that the bundles in force when promotions start already decide them (D140). The request carries the class of the target environment in `action.environment`, the environment id in `environmentId` and the release in `action.target`. When the subject is a workload acting for a run, the deploy-environment tool through `EnvironmentPromotionService/Promotions.Request`, the call metadata forwards the requester of the run as `delegatedUserId` beside the tenant and the project, and the rule checks the role of that delegated user, Operator or Workspace admin of the project, while the decision records the workload as the actor; a workload subject without a delegated user matches no rule and is denied (D127, D141). The seeded tenant bundle is the document PolicyEngineService seeds for a tenant at the first decision asked for it, once and without an event, with the platform revision as its parent (D127, AIFACTORY-US-918). It tightens the platform bundle with the default approvals. A tool call of effective class production, publication, external or spend is answered AllowWithApproval, which `Policy.Decide` returns as `allow-with-approval` with the class in `obligations.approvalClass` and the rule id of the approval eligibility rule in `obligations.approverRule`, the member `obligations` of `policy-decision-v1`; the stored decision keeps the same obligations (D123, D127). A provisioning apply of the class production or external is answered AllowWithApproval the same way, and one of another class keeps the Allow of the platform bundle (D129). A promotion into an environment of the class production is answered AllowWithApproval the same way with the class production, and that approval is the one production approval of the approval gate of the promotion, which EnvironmentPromotionService requests in RunControlService with the revision and the approver rule of the decision, never a second one; a promotion into an environment of another class keeps the Allow of the platform bundle (D133, D140). A call of the tool `propose-change-set` is answered AllowWithApproval with the class shared-write, returned the same way. A call of `blueprint-submit-version` for a Draft version is answered Allow, because a Draft blueprint version is autonomous by default (D64). For a shared-write tool other than these two the document holds the default of D21, AllowWithApproval with the class shared-write; the first chain calls no such tool, and this reading is reported to the owner. Only a change of the tenant bundle drops one of these approvals and a project bundle can only add approvals, so the tightening rule holds; I1 to I3 run on the seeded bundles and no path changes a tenant or project bundle before the publication gate of I4 (D127). Neither document holds a threshold, a limit, a quota or a price. An action for which no decision fixes an effect, which today are deletion, the publication of an asset and memory promotion, gets no rule, and `Policy.Decide` denies an action that no rule of the bundle and its parents matches (D127); a credential issuance for a purpose other than `tool-call` and `sandbox`, or of the purpose `delivery` by a subject other than those two connector services, matches no rule and is denied the same way, and so does a promotion asked for a subject who is neither Operator nor Workspace admin of the project (D140), or for a workload subject whose delegated user holds neither role or that names no delegated user (D141). The proof is a decision table of the acceptance suite: one row per rule and per decided case with subject, action, environment class and expected outcome, evaluated through `Policy.Decide` against the two documents as the seed activated them. The table also proves the layering: the tenant document passes the tightening validation against the platform document; a copy of it without the production approval passes as well, which is how a tenant drops that approval; a project document that answers Allow for a production tool call under the seeded tenant bundle is refused as loosening; and a project document that gates blueprint drafts passes and turns the decision of `blueprint-submit-version` into `allow-with-approval`. The policy engine opens no approval request for any of these outcomes: for a tool call ToolAdapterService opens it in RunControlService (D121). Kind: enabling. Traces: services: PolicyEngineService, ToolAdapterService, RunControlService, ArtifactService, SecretBrokerService, IntegrationService, IaCProvisioningService, EnvironmentPromotionService; aggregates: PolicyEngineService/PolicyBundle; apis: PolicyEngineService/Policy.Decide; tools: propose-change-set, blueprint-submit-version; descriptors: policy-decision-request-v1, policy-decision-v1; adrs: ADR-0015, ADR-0021, ADR-0022; requirements: FR-05, FR-06, XL-10. Depends on: AIFACTORY-US-916, AIFACTORY-US-918. Sources: model/services/governance/PolicyEngineService.yaml, docs/reference/schemas/policy-decision.schema.json, docs/architecture/adr/0021-quality-gates.md, docs/planes/control/approvals.md, docs/planes/capability-tools/tool-policies.md, model/services/knowledge/ArtifactService.yaml, model/tools/propose-change-set.yaml, model/tools/blueprint-submit-version.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the two documents activated by the seed, when `PolicyEngineService/Policy.Decide` is asked for a tool call of each side-effect class in the seeded tenant, then read and sandbox answer `allow` and production, publication, external and spend answer `allow-with-approval` with the class in `obligations.approvalClass` and the approval eligibility rule in `obligations.approverRule`, each reply valid against docs/reference/schemas/policy-decision.schema.json; and when the same four calls are evaluated against the platform document alone, then each answers `allow`, as model/services/governance/PolicyEngineService.yaml states for the two bundles (FR-05).",
        "AC2: Given the seeded tenant, when `PolicyEngineService/Policy.Decide` is asked for a call of the tool `propose-change-set` and for a call of `blueprint-submit-version` on a Draft version, then the first answers `allow-with-approval` with `obligations.approvalClass` naming shared-write and `obligations.approverRule` naming the approval eligibility rule, and the second `allow`; given a project bundle that gates blueprint drafts, then the second answers `allow-with-approval`; in no case the service opens an approval request (ADR-0022, XL-10).",
        "AC3: Given a Draft workflow release and a platform revision whose waiver rule names the internal projects the installation supplied, when `PolicyEngineService/Policy.Decide` is asked for a run acceptance, a request of the action kind `run-acceptance` whose decision names the domain RunAcceptance, in the acceptance environment and in a named project, then the outcome is `allow` and the matched rules and the reason of the decision name the waiver; given the same release in another environment or in a project the rule does not name, then the outcome is `deny`; the repository fixes no project, the activated rule names the projects the installation supplied, and a changed list gives a new revision with a new `rulesHash` (ADR-0021).",
        "AC4: Given the two documents, when the tightening comparer checks them, then the tenant document passes against the platform document and so does a copy of it without the production approval; a project document that answers Allow for a production tool call under the seeded tenant bundle is refused as loosening with the rule named, and a project document that adds an approval passes, so that `PolicyEngineService/PolicyBundle` revisions keep the layering of ADR-0015; and a document test fails when either authored document holds a threshold, a limit, a quota, a price or a project id, when it holds a rule of the domain Spend, when a rule of either document has no row in the decision table, or when a rule names an action kind outside docs/reference/schemas/policy-decision.schema.json.",
        "AC5: Given the seeded tenant, when `PolicyEngineService/Policy.Decide` is asked for the action kind `export` with the target `artifact-export` by a Workspace admin of the project, by the Platform admin and by a member with neither role, then the outcomes are `allow`, `allow` and `deny`, as `ExportArtifacts` of model/services/knowledge/ArtifactService.yaml needs, and the same three subjects asking the action kind `connection-grant` are answered `allow`, `allow` and `deny` in the domain ConnectionGrant; when it is asked for the action kind `credential-issuance`, then the purposes `tool-call` and `sandbox` answer `allow` in the domain DataHandling, the purpose `delivery` answers `allow` for the service identities of ConnectorRegistryService and WebhookGatewayService and `deny` for any other subject (D139), and any other purpose `deny`; when it is asked for the action kind `provisioning-apply`, then the class sandbox answers `allow` and the classes production and external answer `allow-with-approval` in the domain Deployment; when it is asked for the action kind `promotion` with the class of the target environment, then an Operator and a Workspace admin of the project are answered `allow` for the classes development, test and staging and `allow-with-approval` with `obligations.approvalClass` production for the class production, and a member with neither role `deny`, each in the domain Deployment (D140); a workload subject whose `delegatedUserId` names an Operator or a Workspace admin of the project is answered the same as that user with the workload recorded as the actor of the decision, and a workload subject whose delegated user holds neither role or that names no delegated user `deny` (D141); when it is asked for the action kind `approval-eligibility`, then a Reviewer and a Workspace admin of the project are answered `allow` for the target `approval`, an Operator for the target `operator-decision`, and every other role `deny`, each in the domain RunAcceptance; and an action no rule of the chain matches, such as a deletion, is answered `deny` with the reason that no rule matched (ADR-0015, model/services/governance/PolicyEngineService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/control/approvals.md",
        "docs/planes/capability-tools/tool-policies.md",
        "model/services/knowledge/ArtifactService.yaml",
        "model/tools/propose-change-set.yaml",
        "model/tools/blueprint-submit-version.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-3696",
        "AIFACTORY-TASK-3697",
        "AIFACTORY-TASK-343",
        "AIFACTORY-TASK-3698"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7503,
      "kind": "enabling",
      "traces": {
        "services": [
          "PolicyEngineService",
          "ToolAdapterService",
          "RunControlService",
          "ArtifactService",
          "SecretBrokerService",
          "IntegrationService",
          "IaCProvisioningService",
          "EnvironmentPromotionService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyBundle"
        ],
        "apis": [
          "PolicyEngineService/Policy.Decide"
        ],
        "tools": [
          "propose-change-set",
          "blueprint-submit-version"
        ],
        "descriptors": [
          "policy-decision-request-v1",
          "policy-decision-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021",
          "ADR-0022"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-916",
        "AIFACTORY-US-918"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/control/approvals.md",
        "docs/planes/capability-tools/tool-policies.md",
        "model/services/knowledge/ArtifactService.yaml",
        "model/tools/propose-change-set.yaml",
        "model/tools/blueprint-submit-version.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-917]",
      "number": 917
    },
    {
      "id": "AIFACTORY-TASK-3696",
      "type": "task",
      "parent": "AIFACTORY-US-917",
      "title": "Platform bundle document of the first increment",
      "sequence": "12.01.03.01",
      "description": "Platform bundle document of the first increment. Expected output: The repository holds the platform bundle as one versioned document in the typed shape of the model, with scope Platform and no parent: for the domain ToolExecution one Allow rule per side-effect class read, sandbox, shared-write, production, publication, external and spend (D21, D123, D125); for RunAcceptance the waiver rule of AIFACTORY-TASK-343 and its deny rule, which match the action kind run-acceptance, and the approval eligibility rules, which match the action kind approval-eligibility and allow a Reviewer and a Workspace admin of the project for the target approval and an Operator of the project for the target operator-decision, the rule id of the first being the approver rule reference of an allow-with-approval decision; the Allow rules of the first chain for the declared action classes of a workflow definition, model invocation under a seeded model profile, the action kinds store and preview and retrieval; and in DataHandling one Allow rule for the action kind export with the target artifact-export for a subject who is Workspace admin of the project or Platform admin, which cites D31, D127 and model/services/knowledge/ArtifactService.yaml, and one Allow rule for the action kind credential-issuance with the purposes tool-call and sandbox (D127) and one for the purpose delivery whose subject is the service identity of ConnectorRegistryService or WebhookGatewayService (D139); in ConnectionGrant one Allow rule for the action kind connection-grant for a subject who is Workspace admin of the project or Platform admin (D129); in Deployment one Allow rule for the action kind provisioning-apply (D129) and one Allow rule for the action kind promotion for a subject who is Operator or Workspace admin of the project (D140), which for a workload subject matches the role of the delegated user named by delegatedUserId, records the workload as the actor and matches no workload subject without a delegated user (D127, D141); the document holds no rule of the domain Spend, because no service of this increment asks a Spend decision, and no rule for deletion, the publication of an asset or memory promotion, which are therefore denied as unmatched; it holds no threshold, limit, quota, price or project id, and each rule carries the decision that fixes it in its id or its comment.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The repository holds the platform bundle as one versioned document in the typed shape of the model, with scope Platform and no parent: for the domain ToolExecution one Allow rule per side-effect class read, sandbox, shared-write, production, publication, external and spend (D21, D123, D125); for RunAcceptance the waiver rule of AIFACTORY-TASK-343 and its deny rule, which match the action kind run-acceptance, and the approval eligibility rules, which match the action kind approval-eligibility and allow a Reviewer and a Workspace admin of the project for the target approval and an Operator of the project for the target operator-decision, the rule id of the first being the approver rule reference of an allow-with-approval decision; the Allow rules of the first chain for the declared action classes of a workflow definition, model invocation under a seeded model profile, the action kinds store and preview and retrieval; and in DataHandling one Allow rule for the action kind export with the target artifact-export for a subject who is Workspace admin of the project or Platform admin, which cites D31, D127 and model/services/knowledge/ArtifactService.yaml, and one Allow rule for the action kind credential-issuance with the purposes tool-call and sandbox (D127) and one for the purpose delivery whose subject is the service identity of ConnectorRegistryService or WebhookGatewayService (D139); in ConnectionGrant one Allow rule for the action kind connection-grant for a subject who is Workspace admin of the project or Platform admin (D129); in Deployment one Allow rule for the action kind provisioning-apply (D129) and one Allow rule for the action kind promotion for a subject who is Operator or Workspace admin of the project (D140), which for a workload subject matches the role of the delegated user named by delegatedUserId, records the workload as the actor and matches no workload subject without a delegated user (D127, D141); the document holds no rule of the domain Spend, because no service of this increment asks a Spend decision, and no rule for deletion, the publication of an asset or memory promotion, which are therefore denied as unmatched; it holds no threshold, limit, quota, price or project id, and each rule carries the decision that fixes it in its id or its comment."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7503,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3696]",
      "number": 3696
    },
    {
      "id": "AIFACTORY-TASK-3697",
      "type": "task",
      "parent": "AIFACTORY-US-917",
      "title": "Seeded tenant bundle document of the first increment",
      "sequence": "12.01.03.02",
      "description": "Seeded tenant bundle document of the first increment. Expected output: The repository holds the seeded tenant bundle as one versioned document with scope Tenant and the platform revision as parent, the document the service seeds for a tenant at its first decision (D127): AllowWithApproval, with the action class and the reference of the approval eligibility rule of the platform document named in the obligations, for a tool call of effective class production, publication, external or spend (D123, D125), for a provisioning apply of the class production or external (D129) and for a promotion into an environment of the class production, whose approval is the one production approval of the approval gate of the promotion (D133, D140); AllowWithApproval with the class shared-write for the tool propose-change-set and, as the default of D21, for every other shared-write tool; and, with a higher priority, Allow for the tool blueprint-submit-version on a Draft version (D64); the document adds nothing else, holds no threshold, limit, quota or price, and passes the tightening comparer against the platform bundle document.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The repository holds the seeded tenant bundle as one versioned document with scope Tenant and the platform revision as parent, the document the service seeds for a tenant at its first decision (D127): AllowWithApproval, with the action class and the reference of the approval eligibility rule of the platform document named in the obligations, for a tool call of effective class production, publication, external or spend (D123, D125), for a provisioning apply of the class production or external (D129) and for a promotion into an environment of the class production, whose approval is the one production approval of the approval gate of the promotion (D133, D140); AllowWithApproval with the class shared-write for the tool propose-change-set and, as the default of D21, for every other shared-write tool; and, with a higher priority, Allow for the tool blueprint-submit-version on a Draft version (D64); the document adds nothing else, holds no threshold, limit, quota or price, and passes the tightening comparer against the platform bundle document."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7503,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3697]",
      "number": 3697
    },
    {
      "id": "AIFACTORY-TASK-343",
      "type": "task",
      "parent": "AIFACTORY-US-917",
      "title": "Waiver rule for Draft releases before the evaluation gate exists",
      "sequence": "12.01.03.03",
      "description": "Waiver rule for Draft releases before the evaluation gate exists. Expected output: The platform bundle document holds one RunAcceptance rule that allows a Draft workflow or agent release to run only in the acceptance environment and in the projects its match names as internal, and one that denies every other run of a Draft release; the authored document names no project and marks the place in the match of the rule into which the seed of AIFACTORY-TASK-3693 renders the projects the installation supplies before activation, so the activated rule names them, rulesHash covers them, one revision gives one effect for the same inputs and a changed list is a new revision; with an empty list the rule allows no run; a decision under the waiver names the waiver rule in its matched rules and its reason, so that the policy decision and the audit entry AuditService records from PolicyDecisionRecorded both carry it (decision D83, docs/architecture/adr/0021-quality-gates.md); the rule is marked for removal with the evaluation gate of I4.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The platform bundle document holds one RunAcceptance rule that allows a Draft workflow or agent release to run only in the acceptance environment and in the projects its match names as internal, and one that denies every other run of a Draft release; the authored document names no project and marks the place in the match of the rule into which the seed of AIFACTORY-TASK-3693 renders the projects the installation supplies before activation, so the activated rule names them, rulesHash covers them, one revision gives one effect for the same inputs and a changed list is a new revision; with an empty list the rule allows no run; a decision under the waiver names the waiver rule in its matched rules and its reason, so that the policy decision and the audit entry AuditService records from PolicyDecisionRecorded both carry it (decision D83, docs/architecture/adr/0021-quality-gates.md); the rule is marked for removal with the evaluation gate of I4."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-343]",
      "number": 343
    },
    {
      "id": "AIFACTORY-TASK-3698",
      "type": "task",
      "parent": "AIFACTORY-US-917",
      "title": "Verify the two bundle documents with the decision table",
      "sequence": "12.01.03.04",
      "description": "Verify the two bundle documents with the decision table. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SeededBundles\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-917 from one decision table file of the suite, evaluated through PolicyEngineService/Policy.Decide against the documents as the seed activated them: the seven side-effect classes of a tool call under the tenant bundle and under the platform bundle alone, propose-change-set with obligations.approvalClass and obligations.approverRule of its reply, blueprint-submit-version on a Draft version with and without a project bundle that gates drafts, the run acceptance request of the action kind run-acceptance under the waiver with its two denials and under a changed list of internal projects, the approval eligibility request of the action kind approval-eligibility for a Reviewer, a Workspace admin, an Operator and a role without eligibility, the export and the connection-grant requests for a Workspace admin, a Platform admin and a member with neither role, the credential-issuance request for the purposes tool-call, sandbox and another purpose and for the purpose delivery by the two connector service identities and by another subject, the provisioning-apply request for the classes sandbox, production and external, the promotion request for the classes development, test, staging and production by an Operator, a Workspace admin and a member with neither role, and by a workload subject whose delegated user is an Operator, a Workspace admin or neither and by one without a delegated user (D141), the four layering cases of the tightening comparer, the deny of an unmatched action, and the document test for amounts, project ids, a rule of the domain Spend, uncovered rules and unknown action kinds.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=SeededBundles\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-917 from one decision table file of the suite, evaluated through PolicyEngineService/Policy.Decide against the documents as the seed activated them: the seven side-effect classes of a tool call under the tenant bundle and under the platform bundle alone, propose-change-set with obligations.approvalClass and obligations.approverRule of its reply, blueprint-submit-version on a Draft version with and without a project bundle that gates drafts, the run acceptance request of the action kind run-acceptance under the waiver with its two denials and under a changed list of internal projects, the approval eligibility request of the action kind approval-eligibility for a Reviewer, a Workspace admin, an Operator and a role without eligibility, the export and the connection-grant requests for a Workspace admin, a Platform admin and a member with neither role, the credential-issuance request for the purposes tool-call, sandbox and another purpose and for the purpose delivery by the two connector service identities and by another subject, the provisioning-apply request for the classes sandbox, production and external, the promotion request for the classes development, test, staging and production by an Operator, a Workspace admin and a member with neither role, and by a workload subject whose delegated user is an Operator, a Workspace admin or neither and by one without a delegated user (D141), the four layering cases of the tightening comparer, the deny of an unmatched action, and the document test for amounts, project ids, a rule of the domain Spend, uncovered rules and unknown action kinds."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3698]",
      "number": 3698
    },
    {
      "id": "AIFACTORY-US-918",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "Decide a subject, an action and a resource under the pinned or the active revision and record the decision",
      "sequence": "12.01.04",
      "description": "As a reviewer, I want every gated action of a run decided by one evaluation under the policy revision the run pinned, with the decision recorded as it was given, so that I can see afterwards which rule allowed, gated or denied an action and no service decides a gate on its own. `Policy.Decide` is the one evaluation of the Factory and the only gate of a tool call for every side-effect class (D123). Its callers are services: RunControlService at acceptance and for the approver rule of an approval, WorkflowEngineService when it loads a definition, AgentRuntimeService before a gated call, ModelRouterService per route plan and per invocation, ToolAdapterService per tool call and ArtifactService for a store, a preview and an export; ContextBuilderService, IntegrationService and MemoryPromotionService call it as their deliveries reach it. A caller presents a workload token that carries service scopes and no tenant claim and forwards the tenant and the project in the call metadata, which the service reads only when the token holds the service scope that names PolicyEngineService (ADR-0015 amendment D114); in this increment the call arrives inside the cluster. The gateway GovernanceHost, delivered in I1 like the other gateways (D127), also routes internal gRPC calls to this method, but the callers of I1 keep the in-cluster address they were delivered with; no feature of the backlog switches them to the gateway, which would be a deployment value of each caller, and the point is reported to the owner. The request is `policy-decision-request-v1` (docs/reference/schemas/policy-decision-request.schema.json) and the reply the recorded `policy-decision-v1` (D127). The request carries the subject (caller id, caller kind, delegated user, tenant, project, agent, roles), the action (`kind`, `target`, `sideEffectClass`, `classification`, `environment`, `purpose`), the resource, the run, the environment, an inputs hash and an optional `policyRevision`, and it names no domain. The values of `classification` are the Factory data classes of the pinned compliance library (feature `component-compliance-factory-classifications`), and the service defines none of its own. Each of the sixteen action kinds of the schema pairs with exactly one value of `PolicyDomain`, and the PolicyDecision invariant of the model is the one place of that pairing: `run-acceptance` and `approval-eligibility` with RunAcceptance, `model-invocation` with ModelAccess, `tool-invocation` with ToolExecution, `retrieval` with KnowledgeAccess, `memory-promotion` with MemoryPromotion, `connection-grant` with ConnectionGrant, `publication`, `provisioning-apply` and `promotion` with Deployment, `spend` with Spend, and `export`, `deletion`, `store`, `preview` and `credential-issuance` with DataHandling (D127, D129, D140). The repository holds that pairing as one table that a contract test compares with the model, and the decision records the domain of its kind in `domain`; a caller never supplies one. RunControlService asks a run acceptance with the kind `run-acceptance` and the eligibility of a decider with the kind `approval-eligibility` and the target `approval` or `operator-decision`; SecretBrokerService asks `credential-issuance` with the purpose of the issuance, IntegrationService `connection-grant`, IaCProvisioningService `provisioning-apply` with the side-effect class of its plan, and EnvironmentPromotionService, from I2, `promotion` with the class of the target environment in `action.environment`, the environment id in `environmentId`, the release in `action.target` and, for a promotion a run requested, the workload as subject with the requester of the run as `delegatedUserId` (D140, D141). The service evaluates in a fixed order. When the tenant of the request has no tenant bundle, the service first seeds it, once and idempotently: it validates the seeded tenant document of AIFACTORY-US-917 against the active platform revision with the comparer of AIFACTORY-US-916 and writes it as the active tenant bundle with the platform revision as its parent and a revision id derived from the tenant, the scope and the release, so that a concurrent first decision on another replica meets the primary key and reads the stored bundle; the seed publishes no event and needs no operator step (D127). The platform tenant is seeded the same way at its first decision. It then resolves the revision: the `policyRevision` the request names, which is the revision the run pinned and may be retired, or else the active revision of the scope; a named revision that the tenant does not hold is answered NOT_FOUND. From that revision it follows the stored `parentRevision` to the tenant bundle and the platform bundle, for a pinned and for an active revision alike, so a decision under one revision is reproducible. This is the interim rule for a case the model leaves open: when a wider scope activates a newer revision, the active bundles below it keep the parent they were validated against, their decisions follow that stored parent, and the rules of the newer wider revision reach a scope only when its own bundle is activated again under the new parent. What the activation of a tenant or platform revision must do to the active bundles below it is reported to the owner. It reads the roles and the delegated scope of the subject through `Projects.ResolveScope` of ProjectService when the request does not carry them, and the class of the environment the action names through `Environments.GetPolicyClass` of EnvironmentService, and raises the side-effect class of the action by that class and never lowers it; the raised class is the `actionClass` of the decision. In each bundle of the chain the matching rule of the highest priority gives the effect of that bundle, and across the chain the strictest effect decides, in the order Prohibited, Deny, AllowWithApproval, AllowWithConstraints, Allow, which is what tightening means at decision time; an action that no rule of the bundle and its parents matches is denied (D127). The service then writes one immutable `PolicyDecision` with tenant, project, environment, run, subject, domain, action, action class, resource, inputs hash, revision, effect, obligations, matched rules, reasons and `evaluatedAt`, and the `PolicyDecisionRecorded` outbox record with decisionId, tenantId, runId, domain, action, actionClass, effect and policyRevision, in one transaction, and replies. The five values of `PolicyEffect` are the five outcomes of the schema, one to one (D127): Allow is `allow`, AllowWithConstraints is `allow-with-constraints` with its constraints listed, AllowWithApproval is `allow-with-approval`, Deny is `deny` and Prohibited is `prohibited`, which no approval can override. A decision of AllowWithApproval names in its obligations the action class the approval must bind to and the reference of the approval rule, and the approval that follows binds to this decision id. The reply returns the obligations of the matched rules in the member `obligations` of `policy-decision-v1`: `approvalClass` and `approverRule` for an approval, the further terms an approval rule states (approver roles, quorum, expiry, re-requests, author exclusion, break glass), redactions, limits and logging, and `action.sideEffectClass` holds the raised class; the stored `PolicyDecision` keeps the same obligations. RunControlService reads the approval rule of a request from `obligations.approverRule` and asks the eligibility of a decider with a request of the kind `approval-eligibility`. The policy engine opens no approval request and calls RunControlService for none: for a tool call ToolAdapterService opens the request in RunControlService, where approval requests live (D121). A decision never contains prompt text, secrets or payloads: the request has no member for arguments or content, only for their hash, and the decision holds identifiers, classes, rule ids and hashes. The same inputs under the same revision give the same effect. `Governance:Policy:DecisionCacheSeconds` caches a decision per revision and never across revisions: a repeat of the same request, with the same subject, action, resource, run and inputs hash, within that time returns the recorded decision with its decision id and writes no second row and no second event, so a caller that retries after a lost reply within that time, with the cache reachable, receives the one decision. The cache is the store binding `cache` of the model and never the authority: when it does not answer, or the entry has ended, the request is evaluated and recorded anew with a new decision id and its own event, with the same effect, because evaluation is deterministic; health reports the cache degraded and readiness does not depend on it. A call without a workload identity is refused with UNAUTHENTICATED; a workload token without the service scope, and a user token, with PERMISSION_DENIED; a request without a subject, an action kind or a tenant, or with an unknown action kind, with INVALID_ARGUMENT; in each case nothing is recorded and no bundle is seeded. The service fails closed (`Governance:Host:FailClosed`): when ProjectService, EnvironmentService or `policy-engine-sql` does not answer the call ends UNAVAILABLE, and when the tenant holds a tenant bundle but none is active, because its revision was retired without a successor, it ends FAILED_PRECONDITION; no decision is recorded, no outcome is returned and the caller treats the action as not allowed. The service retries no call on its own. The Config Platform is an optional dependency: when it does not answer, the service keeps deciding from the bundles it holds and health reports it degraded. The service records `connectsoft.factory.policy.decisions` by tenant, domain and effect and `connectsoft.factory.policy.decision_latency` by domain, the series the objective of the model, 50 ms at p95, is measured against once the system is deployed; no value is claimed here. This PBI proves what the publisher of `PolicyDecisionRecorded` can prove: the outbox record in the transaction of the decision, the run event envelope, the payload and a transport outage retried without loss or duplicate. AuditService, the one consumer of the event, records the evidence in its own PBIs. Kind: behavior. Traces: services: PolicyEngineService, ProjectService, EnvironmentService, AuditService, ToolAdapterService, RunControlService; aggregates: PolicyEngineService/PolicyDecision, PolicyEngineService/PolicyBundle; apis: PolicyEngineService/Policy.Decide, ProjectService/Projects.ResolveScope, EnvironmentService/Environments.GetPolicyClass; events: PolicyEngineService/PolicyDecisionRecorded; descriptors: policy-decision-request-v1, policy-decision-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019, ADR-0022; requirements: FR-04, FR-05, NFR-04, XL-04; scenarios: SCN-PolicyEngineService-006, SCN-PolicyEngineService-011. Depends on: AIFACTORY-US-916, feature:project-service, feature:environment-service, feature:contracts-package, feature:component-observability-factory-conventions, feature:component-compliance-factory-classifications. Sources: model/services/governance/PolicyEngineService.yaml, docs/reference/schemas/policy-decision.schema.json, docs/reference/schemas/policy-decision-request.schema.json, model/services/control-plane/ProjectService.yaml, model/services/control-plane/EnvironmentService.yaml, docs/architecture/adr/0019-data-governance.md, docs/planes/trust-operations/governance/services/policy-engine-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given active bundles of the platform and of a tenant and a workload token that holds the service scope that names PolicyEngineService, when `PolicyEngineService/Policy.Decide` is called with a `policy-decision-request-v1` for a tool call with the tenant and the project in the call metadata, then the reply is a `policy-decision-v1` document with decisionId, policyRevision, subject, action, domain, outcome, matchedRules, reason, evaluatedAt and evaluator, the domain being the one its action kind pairs with, one immutable `PolicyEngineService/PolicyDecision` row holds the same decision with its domain, action class and inputs hash, and the `PolicyEngineService/PolicyDecisionRecorded` outbox record is written in the same transaction; given a tenant that has no tenant bundle, then its first decision, also when two replicas receive it together, seeds one active tenant bundle with the platform revision as parent before it is evaluated, writes no outbox record for the seed and needs no operator step (SCN-PolicyEngineService-006, SCN-PolicyEngineService-011, ADR-0014).",
        "AC2: Given a request that names a retired revision a run pinned and an environment whose class `EnvironmentService/Environments.GetPolicyClass` returns as Production, when `PolicyEngineService/Policy.Decide` is called, then the decision is evaluated under the pinned revision and its parents and not under the active one, the `actionClass` of the decision is raised to production and never lowered, the roles of a subject the request does not carry were read through `ProjectService/Projects.ResolveScope`, and the effects Allow, AllowWithConstraints, AllowWithApproval, Deny and Prohibited are returned as `allow`, `allow-with-constraints`, `allow-with-approval`, `deny` and `prohibited`; the reply of `allow-with-approval` carries the raised class in `action.sideEffectClass` and in `obligations.approvalClass` and the approval rule in `obligations.approverRule`, the stored decision holds the same obligations, an action no rule matches is answered `deny`, and every reply is valid against docs/reference/schemas/policy-decision.schema.json (SCN-PolicyEngineService-006, FR-05).",
        "AC3: Given the same request repeated within `Governance:Policy:DecisionCacheSeconds`, when `PolicyEngineService/Policy.Decide` is called again, then the reply carries the decision id of the first call and no second row or outbox record exists; given the cache stopped or the entry ended, then the request is evaluated and recorded anew with a new decision id and the same effect, health reports the cache degraded and readiness stays ready; given a newer revision became active for the scope in between, then a request that names no revision is evaluated anew under the new revision; and no decision row, event, log record, activity or metric holds prompt text, a secret or a payload (SCN-PolicyEngineService-006, ADR-0019).",
        "AC4: Given a call without a workload identity, a workload token without the service scope or a user token, a request without a subject or with an unknown action kind, a named revision of another tenant, a tenant whose tenant revision was retired without a successor, and ProjectService, EnvironmentService or `policy-engine-sql` stopped, when `PolicyEngineService/Policy.Decide` is called, then the answers are UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND, FAILED_PRECONDITION and UNAVAILABLE respectively, no `PolicyEngineService/PolicyDecision` is written, nothing is published and the service retried nothing (SCN-PolicyEngineService-006, ADR-0015).",
        "AC5: Given the outbox record of a decision and a transport that is unavailable, when the dispatcher of the `policy-engine` messaging profile runs, then `PolicyEngineService/PolicyDecisionRecorded` is published on `policy.decisions.v1.policy-decision-recorded` in the run event envelope with decisionId, tenantId, runId, domain, action, actionClass, effect and policyRevision, the outage is retried with backoff, and the event is neither lost nor published twice under its event id (SCN-PolicyEngineService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3699",
        "AIFACTORY-TASK-3700",
        "AIFACTORY-TASK-3701",
        "AIFACTORY-TASK-3702"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7504,
      "kind": "behavior",
      "traces": {
        "services": [
          "PolicyEngineService",
          "ProjectService",
          "EnvironmentService",
          "AuditService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyDecision",
          "PolicyEngineService/PolicyBundle"
        ],
        "apis": [
          "PolicyEngineService/Policy.Decide",
          "ProjectService/Projects.ResolveScope",
          "EnvironmentService/Environments.GetPolicyClass"
        ],
        "events": [
          "PolicyEngineService/PolicyDecisionRecorded"
        ],
        "descriptors": [
          "policy-decision-request-v1",
          "policy-decision-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0022"
        ],
        "requirements": [
          "FR-04",
          "FR-05",
          "NFR-04",
          "XL-04"
        ],
        "scenarios": [
          "SCN-PolicyEngineService-006",
          "SCN-PolicyEngineService-011"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-916",
        "feature:project-service",
        "feature:environment-service",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions",
        "feature:component-compliance-factory-classifications"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-918]",
      "number": 918
    },
    {
      "id": "AIFACTORY-TASK-3699",
      "type": "task",
      "parent": "AIFACTORY-US-918",
      "title": "Proto of the Policy service, the kind to domain pairing table and the contract test of the request and the reply",
      "sequence": "12.01.04.01",
      "description": "Proto of the Policy service, the kind to domain pairing table and the contract test of the request and the reply. Expected output: The proto of the gRPC service Policy fixes the request message of Decide as policy-decision-request-v1 (subject with caller id, caller kind, delegated user, tenant, project, agent and roles; action with kind, target, sideEffectClass, classification, environment and purpose; resource, run, environment, inputs hash, optional policyRevision) with no member for a domain, arguments or content, and its reply message as the policy-decision-v1 document with its members domain and obligations; one pairing table of the repository pairs each of the sixteen action kinds, promotion with Deployment among them, with exactly one PolicyDomain value as the PolicyDecision invariant of model/services/governance/PolicyEngineService.yaml states it (D127, D129, D140); a contract test validates every request and every reply of the suite against docs/reference/schemas/policy-decision-request.schema.json and docs/reference/schemas/policy-decision.schema.json, holds the proto with golden files, and fails when the schema gains an action kind the table does not list or the table differs from the invariant of the model.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The proto of the gRPC service Policy fixes the request message of Decide as policy-decision-request-v1 (subject with caller id, caller kind, delegated user, tenant, project, agent and roles; action with kind, target, sideEffectClass, classification, environment and purpose; resource, run, environment, inputs hash, optional policyRevision) with no member for a domain, arguments or content, and its reply message as the policy-decision-v1 document with its members domain and obligations; one pairing table of the repository pairs each of the sixteen action kinds, promotion with Deployment among them, with exactly one PolicyDomain value as the PolicyDecision invariant of model/services/governance/PolicyEngineService.yaml states it (D127, D129, D140); a contract test validates every request and every reply of the suite against docs/reference/schemas/policy-decision-request.schema.json and docs/reference/schemas/policy-decision.schema.json, holds the proto with golden files, and fails when the schema gains an action kind the table does not list or the table differs from the invariant of the model."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7504,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3699]",
      "number": 3699
    },
    {
      "id": "AIFACTORY-TASK-3700",
      "type": "task",
      "parent": "AIFACTORY-US-918",
      "title": "Evaluation and recording of a decision in Policy.Decide",
      "sequence": "12.01.04.02",
      "description": "Evaluation and recording of a decision in Policy.Decide. Expected output: Policy.Decide first seeds the tenant bundle of a tenant that has none, once and idempotently with a revision id derived from tenant, scope and release, validated by the tightening comparer of AIFACTORY-TASK-3692 against the active platform revision and written without an outbox record, so that two replicas that receive a first decision together seed one bundle (D127); it resolves the named or the active revision and its parents through the stored parentRevision, also when a wider scope has activated a newer revision since, derives the domain from the pairing table, reads missing roles through a typed client of Projects.ResolveScope and the environment class through a typed client of Environments.GetPolicyClass, raises the action class and never lowers it, takes in each bundle the matching rule of the highest priority and across the chain the strictest effect, denies an unmatched action, writes the immutable PolicyDecision and the PolicyDecisionRecorded outbox record in one transaction and returns the effect as the outcome of the same name, with the obligations of the matched rules in the member obligations of the reply, approvalClass and approverRule for an AllowWithApproval decision; within Governance:Policy:DecisionCacheSeconds a repeat of the same request under the same revision returns the recorded decision and writes nothing, and the cache is keyed by revision; when the store binding cache does not answer or the entry has ended the request is evaluated and recorded anew with a new decision id, health reports the cache degraded and readiness does not depend on it; the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND, FAILED_PRECONDITION and UNAVAILABLE record nothing; the metrics decisions and decision_latency are recorded; no call is retried by the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Policy.Decide first seeds the tenant bundle of a tenant that has none, once and idempotently with a revision id derived from tenant, scope and release, validated by the tightening comparer of AIFACTORY-TASK-3692 against the active platform revision and written without an outbox record, so that two replicas that receive a first decision together seed one bundle (D127); it resolves the named or the active revision and its parents through the stored parentRevision, also when a wider scope has activated a newer revision since, derives the domain from the pairing table, reads missing roles through a typed client of Projects.ResolveScope and the environment class through a typed client of Environments.GetPolicyClass, raises the action class and never lowers it, takes in each bundle the matching rule of the highest priority and across the chain the strictest effect, denies an unmatched action, writes the immutable PolicyDecision and the PolicyDecisionRecorded outbox record in one transaction and returns the effect as the outcome of the same name, with the obligations of the matched rules in the member obligations of the reply, approvalClass and approverRule for an AllowWithApproval decision; within Governance:Policy:DecisionCacheSeconds a repeat of the same request under the same revision returns the recorded decision and writes nothing, and the cache is keyed by revision; when the store binding cache does not answer or the entry has ended the request is evaluated and recorded anew with a new decision id, health reports the cache degraded and readiness does not depend on it; the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND, FAILED_PRECONDITION and UNAVAILABLE record nothing; the metrics decisions and decision_latency are recorded; no call is retried by the service."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3700]",
      "number": 3700
    },
    {
      "id": "AIFACTORY-TASK-3701",
      "type": "task",
      "parent": "AIFACTORY-US-918",
      "title": "Fakes of ProjectService and EnvironmentService, the two-tenant bundle fixture and the token matrix of the acceptance suite",
      "sequence": "12.01.04.03",
      "description": "Fakes of ProjectService and EnvironmentService, the two-tenant bundle fixture and the token matrix of the acceptance suite. Expected output: The acceptance suite holds a fake of Projects.ResolveScope that returns roles and delegated scope per subject and can be stopped, a fake of Environments.GetPolicyClass that returns each environment class and can be stopped, bundles of the platform, of two tenants and of two projects with one retired revision, a tenant without a tenant bundle, a switch that fails the transaction of policy-engine-sql, a switch that stops the cache, and tokens for the matrix: no token, a workload token with and without the service scope that names PolicyEngineService, and user tokens of each role, of two tenants and with a role in one project and none in another.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of Projects.ResolveScope that returns roles and delegated scope per subject and can be stopped, a fake of Environments.GetPolicyClass that returns each environment class and can be stopped, bundles of the platform, of two tenants and of two projects with one retired revision, a tenant without a tenant bundle, a switch that fails the transaction of policy-engine-sql, a switch that stops the cache, and tokens for the matrix: no token, a workload token with and without the service scope that names PolicyEngineService, and user tokens of each role, of two tenants and with a role in one project and none in another."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3701]",
      "number": 3701
    },
    {
      "id": "AIFACTORY-TASK-3702",
      "type": "task",
      "parent": "AIFACTORY-US-918",
      "title": "Verify Policy.Decide and the publication of its event through the acceptance suite",
      "sequence": "12.01.04.04",
      "description": "Verify Policy.Decide and the publication of its event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-006|Scenario=SCN-PolicyEngineService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-918 with the fixtures of AIFACTORY-TASK-3701: a recorded decision with its outbox record and its paired domain, the seed of a tenant bundle at the first decision of a tenant on two replicas without an outbox record, a decision under a pinned retired revision, the raised action class, the five effects returned as the five outcomes, the deny of an unmatched action, obligations.approvalClass and obligations.approverRule of an allow-with-approval reply and the validity of request and reply against their schemas, the cached repeat with one decision id, the repeat with the cache stopped and after the entry ended, every refusal with the store and the outbox unchanged, the fail-closed answers while a dependency is stopped, a scan of the rows, the events and the captured telemetry for content, and the publication of PolicyEngineService/PolicyDecisionRecorded under a transport outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-006|Scenario=SCN-PolicyEngineService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-918 with the fixtures of AIFACTORY-TASK-3701: a recorded decision with its outbox record and its paired domain, the seed of a tenant bundle at the first decision of a tenant on two replicas without an outbox record, a decision under a pinned retired revision, the raised action class, the five effects returned as the five outcomes, the deny of an unmatched action, obligations.approvalClass and obligations.approverRule of an allow-with-approval reply and the validity of request and reply against their schemas, the cached repeat with one decision id, the repeat with the cache stopped and after the entry ended, every refusal with the store and the outbox unchanged, the fail-closed answers while a dependency is stopped, a scan of the rows, the events and the captured telemetry for content, and the publication of PolicyEngineService/PolicyDecisionRecorded under a transport outage."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3702]",
      "number": 3702
    },
    {
      "id": "AIFACTORY-US-919",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "Name the revision a new run pins for its scope and check that a candidate bundle only tightens its parent",
      "sequence": "12.01.05",
      "description": "As a platform admin, I want run control to ask which policy revision a new run pins and the asset registry to ask whether a candidate policy only tightens its parent, so that every run is pinned to one exact revision and no policy that loosens the one above it is ever published. Two internal gRPC methods serve other services and write nothing. `Policy.GetActiveRevision` answers RunControlService, which pins a policy revision on every run at acceptance. For the scope of an `execution-scope-v1` request, a tenant with or without a project, it returns the revision a new run of that scope must pin: the active revision of the narrowest scope that has a bundle, the project bundle where the project has one and else the tenant bundle, together with the scope of that bundle, its `rulesHash` and the revisions of its parents up to the platform bundle. The parents are the stored ones, as for a decision (AIFACTORY-US-918): when the tenant has activated a newer revision since a project bundle was activated, the reply for that project still names the project revision with the tenant revision it was validated against, so runs of that project are not yet decided under the newer tenant rules until the project bundle is activated again; the model does not say what a new tenant revision does to the active project revisions of the tenant, and the point is reported to the owner. A seeded tenant bundle publishes no event (D127), so RunControlService learns its revision from this method and not from the event. For a tenant that has no tenant bundle yet the method runs the same seed as the first decision (AIFACTORY-US-918), once and idempotently and without an event, before it answers, so that a first run of a tenant pins the seeded revision whichever of the two calls RunControlService makes first; this reading is reported to the owner. The platform tenant is treated the same way. The model names `policy-decision-v1` as the reply descriptor of this method although the method records no decision and returns no outcome; the proto of this feature fixes a reply message with those members, and the descriptor is reported as a correction of the model. RunControlService also hears `PolicyRevisionActivated` and keeps the activated revision for new runs through its handler `PinActivePolicyRevision`; the method is the answer for a scope it has not heard of yet, and both name the same revision. A tenant that holds a tenant bundle but none active, because its revision was retired without a successor, is answered FAILED_PRECONDITION, so no run is accepted under the platform bundle alone and without the default approvals of the seeded tenant bundle. `Policy.ValidateTightening` answers the publication of policy assets: before AgentRegistryService publishes a release of the asset kind Policy it asks whether the candidate bundle only tightens its parent. The request carries the candidate document, its scope and its scope id. The service resolves the parent, the active platform bundle for a tenant candidate and the active tenant bundle for a project candidate. A candidate whose parent scope has no active bundle, which is a project candidate of a tenant without an active tenant bundle, is answered FAILED_PRECONDITION, nothing is written, and the registry publishes no policy release for it. For a candidate with a parent the service runs the comparison the activation runs (AIFACTORY-US-916): rule by rule in the order Allow, AllowWithConstraints, AllowWithApproval, Deny, Prohibited, with no obligation dropped and no Prohibited effect overridden. It replies with an acknowledgement in the shape of `ack-v1`: accepted, or a conflict that lists every loosening rule with its rule id, the parent rule it loosens and the reason. Nothing is stored, no bundle changes and no event is published; a conflict for loosening counts in `connectsoft.factory.policy.tightening_rejections`. The model names `asset-manifests-v1` as the request descriptor, which model/descriptors.yaml does not list, and this is reported. The publication gate of AgentRegistryService arrives in I4, so in this increment no service calls the method: it is hosted, and its contract and its comparison are proven by the suite, so that the complete registry binds to it without a change of the message. Both methods are called with a workload token that carries service scopes and no tenant claim, with the tenant and the project in the call metadata, read only under the service scope that names PolicyEngineService. A call without a workload identity is refused with UNAUTHENTICATED; a token without the service scope, and a user token, with PERMISSION_DENIED; a request without a tenant with INVALID_ARGUMENT; and a candidate document that cannot be read with INVALID_ARGUMENT, the position named and no document content in the log. When `policy-engine-sql` does not answer, both methods end UNAVAILABLE and the caller fails closed: RunControlService accepts no run and the registry publishes no policy release. The service retries nothing on its own. Kind: behavior. Traces: services: PolicyEngineService, RunControlService, AgentRegistryService; aggregates: PolicyEngineService/PolicyBundle; apis: PolicyEngineService/Policy.GetActiveRevision, PolicyEngineService/Policy.ValidateTightening; events: PolicyEngineService/PolicyRevisionActivated; descriptors: execution-scope-v1, ack-v1; adrs: ADR-0014, ADR-0015, ADR-0021; requirements: NFR-04, XL-02; scenarios: SCN-PolicyEngineService-007, SCN-PolicyEngineService-008. Depends on: AIFACTORY-US-916, feature:component-base-template-factory-profile. Sources: model/services/governance/PolicyEngineService.yaml, model/services/control-plane/RunControlService.yaml, model/descriptors.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/trust-operations/governance/services/policy-engine-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given active bundles of the platform, of a tenant and of one of its projects, when `PolicyEngineService/Policy.GetActiveRevision` is called for the tenant with that project, with a project that has no bundle and for the tenant alone, then the replies name the project revision, the tenant revision and the tenant revision, each with its scope, its `rulesHash` and the revisions of its parents up to the platform bundle, and nothing is written; after a new tenant revision is activated the next call for the tenant names it, and it is the revision `PolicyEngineService/PolicyRevisionActivated` announced, while the call for the project with a bundle still names the project revision with the tenant revision it was validated against as its stored parent; for a tenant that has no tenant bundle yet the call seeds it once without an outbox record and names the seeded revision, and a later first decision of that tenant seeds nothing more (SCN-PolicyEngineService-007, ADR-0014).",
        "AC2: Given a tenant whose tenant revision was retired without a successor, a call without a workload identity, a workload token without the service scope or a user token, a request without a tenant, and `policy-engine-sql` stopped, when `PolicyEngineService/Policy.GetActiveRevision` or `PolicyEngineService/Policy.ValidateTightening` is called, then the answers are FAILED_PRECONDITION, for the first method and for a project candidate of that tenant sent to the second, whose parent scope has no active bundle, and UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and UNAVAILABLE for both, and no state changes (SCN-PolicyEngineService-007, SCN-PolicyEngineService-008, ADR-0015).",
        "AC3: Given a project candidate that only tightens the active tenant bundle, when `PolicyEngineService/Policy.ValidateTightening` is called, then the reply is accepted; given a candidate with a rule that is looser than its parent rule, that overrides a Prohibited effect or that drops an obligation, then the reply is a conflict that lists each loosening rule with its rule id, the parent rule and the reason, and `connectsoft.factory.policy.tightening_rejections` is incremented; in both cases no `PolicyEngineService/PolicyBundle`, rule row or outbox record is written (SCN-PolicyEngineService-008, model/services/governance/PolicyEngineService.yaml).",
        "AC4: Given a candidate document that cannot be read, when `PolicyEngineService/Policy.ValidateTightening` is called, then the answer is INVALID_ARGUMENT with the position named and the log holds no document content; given one candidate sent to this method and to the activation of AIFACTORY-US-916, then both give the same verdict, because one comparer serves both (SCN-PolicyEngineService-008, ADR-0021)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/descriptors.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3703",
        "AIFACTORY-TASK-3704",
        "AIFACTORY-TASK-3705"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7505,
      "kind": "behavior",
      "traces": {
        "services": [
          "PolicyEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyBundle"
        ],
        "apis": [
          "PolicyEngineService/Policy.GetActiveRevision",
          "PolicyEngineService/Policy.ValidateTightening"
        ],
        "events": [
          "PolicyEngineService/PolicyRevisionActivated"
        ],
        "descriptors": [
          "execution-scope-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "NFR-04",
          "XL-02"
        ],
        "scenarios": [
          "SCN-PolicyEngineService-007",
          "SCN-PolicyEngineService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-916",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/descriptors.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-919]",
      "number": 919
    },
    {
      "id": "AIFACTORY-TASK-3703",
      "type": "task",
      "parent": "AIFACTORY-US-919",
      "title": "Policy.GetActiveRevision for the scope of a new run",
      "sequence": "12.01.05.01",
      "description": "Policy.GetActiveRevision for the scope of a new run. Expected output: Policy.GetActiveRevision reads the active revision of the narrowest scope of the request that has a bundle, the project bundle and else the tenant bundle, and returns it with its scope, rulesHash and the revisions of its stored parents up to the platform bundle in the reply message the proto fixes, also when a wider scope has activated a newer revision since; for a tenant without a tenant bundle, the platform tenant included, it runs the seed of AIFACTORY-TASK-3700 first and names the seeded revision, it answers FAILED_PRECONDITION for a tenant whose tenant revision was retired without a successor, writes nothing else, and maps the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and UNAVAILABLE; the proto is held with golden files.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Policy.GetActiveRevision reads the active revision of the narrowest scope of the request that has a bundle, the project bundle and else the tenant bundle, and returns it with its scope, rulesHash and the revisions of its stored parents up to the platform bundle in the reply message the proto fixes, also when a wider scope has activated a newer revision since; for a tenant without a tenant bundle, the platform tenant included, it runs the seed of AIFACTORY-TASK-3700 first and names the seeded revision, it answers FAILED_PRECONDITION for a tenant whose tenant revision was retired without a successor, writes nothing else, and maps the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and UNAVAILABLE; the proto is held with golden files."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3703]",
      "number": 3703
    },
    {
      "id": "AIFACTORY-TASK-3704",
      "type": "task",
      "parent": "AIFACTORY-US-919",
      "title": "Policy.ValidateTightening on the tightening comparer of the activation",
      "sequence": "12.01.05.02",
      "description": "Policy.ValidateTightening on the tightening comparer of the activation. Expected output: Policy.ValidateTightening reads the candidate document of the request, resolves the active parent of its scope, answers FAILED_PRECONDITION and writes nothing when that parent scope has no active bundle, and otherwise runs the tightening comparer of AIFACTORY-TASK-3692; it replies accepted or a conflict that lists every loosening rule with its rule id, the parent rule and the reason, counts a conflict in connectsoft.factory.policy.tightening_rejections, answers INVALID_ARGUMENT with the position for an unreadable document, and stores, activates and publishes nothing; no document content is logged.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Policy.ValidateTightening reads the candidate document of the request, resolves the active parent of its scope, answers FAILED_PRECONDITION and writes nothing when that parent scope has no active bundle, and otherwise runs the tightening comparer of AIFACTORY-TASK-3692; it replies accepted or a conflict that lists every loosening rule with its rule id, the parent rule and the reason, counts a conflict in connectsoft.factory.policy.tightening_rejections, answers INVALID_ARGUMENT with the position for an unreadable document, and stores, activates and publishes nothing; no document content is logged."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3704]",
      "number": 3704
    },
    {
      "id": "AIFACTORY-TASK-3705",
      "type": "task",
      "parent": "AIFACTORY-US-919",
      "title": "Verify the active revision and the tightening check through the acceptance suite",
      "sequence": "12.01.05.03",
      "description": "Verify the active revision and the tightening check through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-007|Scenario=SCN-PolicyEngineService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-919 with the fixtures of AIFACTORY-TASK-3694 and AIFACTORY-TASK-3701: the revision named for a project with a bundle, a project without one and a tenant, the revision after a new activation, the stored parents of a project revision after a newer tenant revision, the seed of a tenant without a tenant bundle, the tenant whose revision was retired without a successor for both methods, every refusal, an accepted candidate, each kind of loosening candidate with its listed rules, an unreadable candidate, the equal verdict of the method and of the activation, and the stores and the outbox unchanged after every call.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-007|Scenario=SCN-PolicyEngineService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-919 with the fixtures of AIFACTORY-TASK-3694 and AIFACTORY-TASK-3701: the revision named for a project with a bundle, a project without one and a tenant, the revision after a new activation, the stored parents of a project revision after a newer tenant revision, the seed of a tenant without a tenant bundle, the tenant whose revision was retired without a successor for both methods, every refusal, an accepted candidate, each kind of loosening candidate with its listed rules, an unreadable candidate, the equal verdict of the method and of the activation, and the stores and the outbox unchanged after every call."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3705]",
      "number": 3705
    },
    {
      "id": "AIFACTORY-US-920",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "Read the active and the retired policy bundles and the rules of one revision",
      "sequence": "12.01.06",
      "description": "As an observer, I want to read which policy bundles are in force for the platform, my tenant and my projects and what rules a revision holds, so that I can tell under which rules a run was decided without being able to change them. A person reads which policy is in force. `ListPolicyBundles`, GET `/factory/policies`, returns the active and the retired bundles the caller may see, each with revision, scope, scope id, release, parent revision, domains, `rulesHash`, the active flag and `activatedAt`. `GetPolicyBundle`, GET `/factory/policies/{revision}`, returns the rules of one revision as the typed view of its document: rule id, domain, match, effect, obligations and priority. Both are of class read, need the scope `factory.policies.read` and write nothing. The callers are the roles the model names for the service, Reviewer, Operator, Workspace admin, Platform admin and Observer, and the Studio screen `policies` reads both. A user token has one audience, the gateway GovernanceHost, which forwards it unchanged, and the service accepts the audience of its own gateway and applies its own tenant filter and role rules (ADR-0015 amendment D117). A person reaches the two routes through the Governance gateway, which is delivered in I1 like the other gateways (D127); the feature builds no direct route. What a caller sees follows the scope hierarchy. Every caller with the scope sees the platform bundle and the tenant bundles of the tenant of the token. A project bundle is listed and served only to a caller who holds a role in that project or the tenant-wide Platform admin role, so a member of one project does not learn the rules of another. The platform bundle belongs to the platform tenant and is the one row of another tenant the tenant filter admits, read only. `ListPolicyBundles` is paged and may be filtered by scope and by the active flag. The model names no parameter for a project on it, so the call is served under the tenant of the token and filtered by the role claims, and the gap is reported as a correction of the service file. A call without a token or with an expired token is answered 401 and a token without `factory.policies.read` 403. `GetPolicyBundle` for a project bundle of a project in which the caller holds no role is answered 403. A revision that does not exist and a revision of another tenant are both answered 404, so the response never confirms that a foreign revision exists (ADR-0015 amendment D113). A workload token is refused with 403, because a REST operation names no service scope. A retired revision stays readable, because runs that pinned it finish on it and their decisions name it. When `policy-engine-sql` does not answer, the response is 503 with a problem response and nothing is served from a stale copy. The reads are counted and timed by the request telemetry of the Factory profile with tenant and project, and the rules of a bundle never reach a log record, an activity or a metric. Kind: behavior. Traces: services: PolicyEngineService; aggregates: PolicyEngineService/PolicyBundle; apis: PolicyEngineService/ListPolicyBundles, PolicyEngineService/GetPolicyBundle; adrs: ADR-0015, ADR-0019; requirements: FR-01, FUX-01, NFR-01; scenarios: SCN-PolicyEngineService-001, SCN-PolicyEngineService-002. Relates: screens: policies. Depends on: AIFACTORY-US-916, feature:component-base-template-factory-profile. Sources: model/services/governance/PolicyEngineService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/trust-operations/governance/services/policy-engine-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given active and retired bundles of the platform, of a tenant and of two of its projects and a caller with `factory.policies.read` and a role in one of the projects, when `PolicyEngineService/ListPolicyBundles` is called, then the response is 200 with the platform bundle, the tenant bundles and the bundles of that one project, each with revision, scope, scopeId, parentRevision, domains, rulesHash, active and activatedAt, paged; the filter by the active flag narrows the list; a Platform admin of the tenant is served every project bundle of the tenant; nothing is written (SCN-PolicyEngineService-001, FUX-01).",
        "AC2: Given a caller with `factory.policies.read`, when `PolicyEngineService/GetPolicyBundle` is called for an active and for a retired revision the caller may see, then each response is 200 with the typed rules of the revision, ruleId, domain, match, effect, obligations and priority, equal to the rule rows of that `PolicyEngineService/PolicyBundle` (SCN-PolicyEngineService-002).",
        "AC3: Given bundles of two tenants, when both operations are called with a token of one tenant, then no bundle of the other tenant is listed, the platform bundle is, and a revision of the other tenant is answered 404 exactly as an unknown revision is (SCN-PolicyEngineService-001, SCN-PolicyEngineService-002, ADR-0015, NFR-01).",
        "AC4: Given a call without a token or with an expired token, a token without the scope, a workload token, a project bundle of a project in which the caller holds no role, and `policy-engine-sql` stopped, when `PolicyEngineService/ListPolicyBundles` or `PolicyEngineService/GetPolicyBundle` is called, then the answers are 401, 403, 403, 403 and 503 with a problem response, no state changes and no rule content is found in the captured log records (SCN-PolicyEngineService-001, SCN-PolicyEngineService-002, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3706",
        "AIFACTORY-TASK-3707"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7506,
      "kind": "behavior",
      "traces": {
        "services": [
          "PolicyEngineService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyBundle"
        ],
        "apis": [
          "PolicyEngineService/ListPolicyBundles",
          "PolicyEngineService/GetPolicyBundle"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-01",
          "FUX-01",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-PolicyEngineService-001",
          "SCN-PolicyEngineService-002"
        ]
      },
      "relates": {
        "screens": [
          "policies"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-916",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-920]",
      "number": 920
    },
    {
      "id": "AIFACTORY-TASK-3706",
      "type": "task",
      "parent": "AIFACTORY-US-920",
      "title": "ListPolicyBundles and GetPolicyBundle with the visibility of project bundles",
      "sequence": "12.01.06.01",
      "description": "ListPolicyBundles and GetPolicyBundle with the visibility of project bundles. Expected output: ListPolicyBundles returns, paged and filterable by scope and by the active flag, the platform bundle, the tenant bundles of the tenant of the token and the project bundles of the projects in which the token holds a role, all project bundles of the tenant for the Platform admin; GetPolicyBundle returns the typed rules of one revision, active or retired; both answer 401, 403 and 404 as AIFACTORY-US-920 states, with 404 for an unknown revision and for a revision of another tenant alike, refuse a workload token with 403, answer 503 while the store does not answer, and log no rule content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "ListPolicyBundles returns, paged and filterable by scope and by the active flag, the platform bundle, the tenant bundles of the tenant of the token and the project bundles of the projects in which the token holds a role, all project bundles of the tenant for the Platform admin; GetPolicyBundle returns the typed rules of one revision, active or retired; both answer 401, 403 and 404 as AIFACTORY-US-920 states, with 404 for an unknown revision and for a revision of another tenant alike, refuse a workload token with 403, answer 503 while the store does not answer, and log no rule content."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7506,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3706]",
      "number": 3706
    },
    {
      "id": "AIFACTORY-TASK-3707",
      "type": "task",
      "parent": "AIFACTORY-US-920",
      "title": "Verify the reads of policy bundles through the acceptance suite",
      "sequence": "12.01.06.02",
      "description": "Verify the reads of policy bundles through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-001|Scenario=SCN-PolicyEngineService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-920 over the token matrix and the two-tenant fixture of AIFACTORY-TASK-3701: the list for a member of one project and for a Platform admin, the paging and the filter, the typed rules of an active and of a retired revision, the 404 of a foreign and of an unknown revision, every refusal, the 503 while the store is stopped, and a scan of the captured log records for rule content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-001|Scenario=SCN-PolicyEngineService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-920 over the token matrix and the two-tenant fixture of AIFACTORY-TASK-3701: the list for a member of one project and for a Platform admin, the paging and the filter, the typed rules of an active and of a retired revision, the 404 of a foreign and of an unknown revision, every refusal, the 503 while the store is stopped, and a scan of the captured log records for rule content."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7506,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3707]",
      "number": 3707
    },
    {
      "id": "AIFACTORY-US-921",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "Validate a project override against the tenant bundle and simulate a candidate bundle against recorded decisions",
      "sequence": "12.01.07",
      "description": "As a workspace admin, I want to check that the policy I plan for my project only tightens the policy of my tenant and to see which past decisions a candidate bundle would change, so that I never propose a policy that will be refused and I know its effect before it is in force. Before a project policy is published it can be checked, and before a bundle changes, its effect on past work can be seen. Both operations are of class sandbox: they evaluate a candidate and store nothing, activate nothing and publish nothing. `ValidateProjectPolicy`, POST `/factory/projects/{projectId}/policy/validate`, takes a candidate project override in the typed shape of a bundle document and validates it against the active tenant bundle of the tenant of the token: every rule must tighten and none may loosen (D18). The scope is `factory.policies.write`, and the callers are the Workspace admin of the project and the Platform admin. The route names its project in the path. The gateway GovernanceHost of I1 (D127) admits it only for a token whose roles grant that project, and the service compares the path with the project roles of the forwarded token again and answers 403 for a project in which the caller is neither Workspace admin nor Platform admin of the tenant. The comparison is the one comparer of the activation and of `Policy.ValidateTightening` (AIFACTORY-US-916, AIFACTORY-US-919), so the three give one verdict for one document. The response is 200 with the result: valid, or not valid with every loosening rule listed with its rule id, the tenant rule it loosens and the reason; a not valid result counts in `connectsoft.factory.policy.tightening_rejections`. The model lists the codes 200, 400 and 403 and does not say which of them answers a loosening override. This PBI fixes 200 with a not valid result for a readable document that loosens, and 400 for a body that cannot be read as a bundle document, that names an unknown domain or effect or that names a scope other than the project of the path, and the reading is reported. The service holds no project registry. A Workspace admin is known from the role claim of the token for the project of the path. For a Platform admin, whose role is tenant-wide, the service asks `Projects.ResolveScope` of ProjectService for the tenant and the project of the path: a project that ProjectService answers as not existing in the tenant is answered 404 (ADR-0015 amendment D113), and when ProjectService does not answer the response is 503 and nothing is validated. A tenant that has no tenant bundle yet is seeded first, as at its first decision (AIFACTORY-US-918, D127). A tenant whose tenant revision was retired without a successor has nothing to validate against: the response is 409 with a problem response that names the missing tenant bundle, the REST form of the FAILED_PRECONDITION of AIFACTORY-US-919. When `policy-engine-sql` does not answer the response is 503. The code list of the model lacks 404 and 409, which is reported as a correction. A validated override is not in force: a project bundle becomes active only through the publication of a policy asset, which arrives with the complete registry in I4. `SimulatePolicy`, POST `/factory/policies/simulate`, answers what a candidate bundle would have decided. For a candidate document, its scope and a period, the service evaluates the recorded decisions of that scope and period that `PolicyDecisions` holds again under the candidate with its parents, and returns how many decisions were read, how many would change and, for each changed one, the decision id, the recorded effect, the simulated effect and the rules that matched. The inputs of a recorded decision are its stored subject, domain, action, action class and resource. No call to ProjectService or EnvironmentService is made, no decision is recorded, no cache entry is written and no event is published, and a simulated effect never leaves the response. The model calls the depth of this operation later-stage: this delivery simulates over the decisions of the hot window only, and simulation over the evidence copies of older decisions is a later capability the service page names. The model names no parameter for a project, so a candidate of project scope names its project in the body, and the service checks it against the roles of the token as above. A call without a token or with an expired token is answered 401; a token without `factory.policies.write`, a caller without the role and a workload token 403; an unreadable candidate or a period without a start or an end 400, a code the list of `SimulatePolicy` lacks and that is reported with the correction above; and a store that does not answer 503. Nothing changes state in any of these cases. A person reaches the two routes through the gateway GovernanceHost, delivered in I1 (D127). Kind: behavior. Traces: services: PolicyEngineService, ProjectService; aggregates: PolicyEngineService/PolicyBundle, PolicyEngineService/PolicyDecision; apis: PolicyEngineService/ValidateProjectPolicy, PolicyEngineService/SimulatePolicy, ProjectService/Projects.ResolveScope; adrs: ADR-0015; requirements: FR-01, NFR-01, NFR-04; scenarios: SCN-PolicyEngineService-003, SCN-PolicyEngineService-004. Relates: screens: policies. Depends on: AIFACTORY-US-916, AIFACTORY-US-918, AIFACTORY-US-919, feature:project-service. Sources: model/services/governance/PolicyEngineService.yaml, model/services/control-plane/ProjectService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/trust-operations/governance/services/policy-engine-service/index.md#later-capabilities.",
      "acceptanceCriteria": [
        "AC1: Given an active tenant bundle and a candidate project override every rule of which tightens it, when `PolicyEngineService/ValidateProjectPolicy` is called by the Workspace admin of the project of the path, then the response is 200 with the result valid, and no `PolicyEngineService/PolicyBundle`, rule row, decision, cache entry or outbox record was written (SCN-PolicyEngineService-003, model/services/governance/PolicyEngineService.yaml).",
        "AC2: Given a candidate override with a rule that is looser than the tenant rule, that overrides a Prohibited effect or that drops an obligation, when `PolicyEngineService/ValidateProjectPolicy` is called, then the response is 200 with the result not valid and every loosening rule listed with its rule id, the tenant rule it loosens and the reason, `connectsoft.factory.policy.tightening_rejections` is incremented, and the same document sent to `Policy.ValidateTightening` gives the same verdict (SCN-PolicyEngineService-003).",
        "AC3: Given a body that cannot be read as a bundle document, that names an unknown domain or effect or a scope other than the project of the path, a caller who is neither Workspace admin of the project nor Platform admin, a token without `factory.policies.write`, a call without a token, a Platform admin who names a project that `ProjectService/Projects.ResolveScope` answers as not existing in the tenant, a tenant whose tenant revision was retired without a successor, and `policy-engine-sql` stopped or, for the call of that Platform admin, ProjectService stopped, when `PolicyEngineService/ValidateProjectPolicy` is called, then the answers are 400, 403, 403, 401, 404, 409 and 503 with a problem response and no state changes (SCN-PolicyEngineService-003, ADR-0015).",
        "AC4: Given recorded decisions of a tenant and a candidate tenant document that turns one Allow rule into AllowWithApproval, when `PolicyEngineService/SimulatePolicy` is called for a period, then the response is 200 with the count of decisions read, the count that would change and, for each changed `PolicyEngineService/PolicyDecision`, its decision id, the recorded effect, the simulated effect and the matched rules; the tables, the cache and the outbox are unchanged and neither ProjectService nor EnvironmentService was called (SCN-PolicyEngineService-004).",
        "AC5: Given a call without a token, a token without the scope or a workload token, a candidate of project scope whose project the roles of the token do not grant, an unreadable candidate or a period without a start or an end, and `policy-engine-sql` stopped, when `PolicyEngineService/SimulatePolicy` is called, then the answers are 401, 403, 403, 400 and 503, no decision of another tenant was read and no state changes (SCN-PolicyEngineService-004, NFR-01)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#later-capabilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3708",
        "AIFACTORY-TASK-3709",
        "AIFACTORY-TASK-3710"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7507,
      "kind": "behavior",
      "traces": {
        "services": [
          "PolicyEngineService",
          "ProjectService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyBundle",
          "PolicyEngineService/PolicyDecision"
        ],
        "apis": [
          "PolicyEngineService/ValidateProjectPolicy",
          "PolicyEngineService/SimulatePolicy",
          "ProjectService/Projects.ResolveScope"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "NFR-01",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-PolicyEngineService-003",
          "SCN-PolicyEngineService-004"
        ]
      },
      "relates": {
        "screens": [
          "policies"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-916",
        "AIFACTORY-US-918",
        "AIFACTORY-US-919",
        "feature:project-service"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#later-capabilities"
      ],
      "titlePrefix": "[AIFACTORY-US-921]",
      "number": 921
    },
    {
      "id": "AIFACTORY-TASK-3708",
      "type": "task",
      "parent": "AIFACTORY-US-921",
      "title": "ValidateProjectPolicy on the tightening comparer",
      "sequence": "12.01.07.01",
      "description": "ValidateProjectPolicy on the tightening comparer. Expected output: ValidateProjectPolicy reads the candidate override of the body, checks that its scope is the project of the path and that the caller is Workspace admin of that project or Platform admin of the tenant, runs the tightening comparer of AIFACTORY-TASK-3692 against the active tenant bundle and answers 200 with valid or with not valid and every loosening rule listed; it answers 400 for an unreadable document, an unknown domain or effect and a foreign scope, 403 and 401 as AIFACTORY-US-921 states, 404 for a project that a typed client of Projects.ResolveScope, asked for a Platform admin only, answers as not existing in the tenant, 409 with the missing tenant bundle named for a tenant without an active tenant bundle, and 503 while policy-engine-sql or, for the call of a Platform admin, ProjectService does not answer; it stores, activates and publishes nothing and counts a not valid result in connectsoft.factory.policy.tightening_rejections.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "ValidateProjectPolicy reads the candidate override of the body, checks that its scope is the project of the path and that the caller is Workspace admin of that project or Platform admin of the tenant, runs the tightening comparer of AIFACTORY-TASK-3692 against the active tenant bundle and answers 200 with valid or with not valid and every loosening rule listed; it answers 400 for an unreadable document, an unknown domain or effect and a foreign scope, 403 and 401 as AIFACTORY-US-921 states, 404 for a project that a typed client of Projects.ResolveScope, asked for a Platform admin only, answers as not existing in the tenant, 409 with the missing tenant bundle named for a tenant without an active tenant bundle, and 503 while policy-engine-sql or, for the call of a Platform admin, ProjectService does not answer; it stores, activates and publishes nothing and counts a not valid result in connectsoft.factory.policy.tightening_rejections."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7507,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3708]",
      "number": 3708
    },
    {
      "id": "AIFACTORY-TASK-3709",
      "type": "task",
      "parent": "AIFACTORY-US-921",
      "title": "SimulatePolicy over the recorded decisions of the hot window",
      "sequence": "12.01.07.02",
      "description": "SimulatePolicy over the recorded decisions of the hot window. Expected output: SimulatePolicy reads the recorded decisions of the scope and the period of the request from PolicyDecisions under the tenant filter, evaluates each again under the candidate document and its parents from the stored subject, domain, action, action class and resource without a call to ProjectService or EnvironmentService, and returns the count read, the count changed and each changed decision with its id, the recorded effect, the simulated effect and the matched rules; it checks the project of a project candidate against the roles of the token, answers 400 for an unreadable candidate and for a period without a start or an end, and writes no decision, no cache entry and no outbox record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "SimulatePolicy reads the recorded decisions of the scope and the period of the request from PolicyDecisions under the tenant filter, evaluates each again under the candidate document and its parents from the stored subject, domain, action, action class and resource without a call to ProjectService or EnvironmentService, and returns the count read, the count changed and each changed decision with its id, the recorded effect, the simulated effect and the matched rules; it checks the project of a project candidate against the roles of the token, answers 400 for an unreadable candidate and for a period without a start or an end, and writes no decision, no cache entry and no outbox record."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7507,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3709]",
      "number": 3709
    },
    {
      "id": "AIFACTORY-TASK-3710",
      "type": "task",
      "parent": "AIFACTORY-US-921",
      "title": "Verify the validation of a project override and the simulation through the acceptance suite",
      "sequence": "12.01.07.03",
      "description": "Verify the validation of a project override and the simulation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-003|Scenario=SCN-PolicyEngineService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-921 with the documents of AIFACTORY-TASK-3694 and the fixtures of AIFACTORY-TASK-3701: a valid override, each kind of loosening override with its listed rules and the equal verdict of Policy.ValidateTightening, every refusal of both operations, among them the 404 the fake of Projects.ResolveScope gives for a Platform admin, the 409 of the tenant without a tenant bundle and the 503 while the store or ProjectService is stopped, a simulation that names the changed decisions, a simulation over two tenants that reads one, and a comparison of the tables, the cache and the outbox before and after every call.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-PolicyEngineService-003|Scenario=SCN-PolicyEngineService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-921 with the documents of AIFACTORY-TASK-3694 and the fixtures of AIFACTORY-TASK-3701: a valid override, each kind of loosening override with its listed rules and the equal verdict of Policy.ValidateTightening, every refusal of both operations, among them the 404 the fake of Projects.ResolveScope gives for a Platform admin, the 409 of the tenant without a tenant bundle and the 503 while the store or ProjectService is stopped, a simulation that names the changed decisions, a simulation over two tenants that reads one, and a comparison of the tables, the cache and the outbox before and after every call."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7507,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3710]",
      "number": 3710
    },
    {
      "id": "AIFACTORY-US-922",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-060",
      "title": "Read the policy decisions of a run and move decisions past the hot window to the immutable store",
      "sequence": "12.01.08",
      "description": "As a reviewer, I want to read every policy decision of a run of my project with its effect, its rules and its reasons, so that I understand why an action of the run was allowed, gated or denied, and the decision is still evidence years later. Every decision of a run can be read, and a decision is kept as evidence long after its run. `ListRunDecisions`, GET `/factory/runs/{runId}/policy-decisions`, returns the decisions recorded for a run in the order they were evaluated, each with decision id, domain, action, action class, effect, policy revision, obligations, matched rules, reasons and `evaluatedAt`. It is of class read, needs the scope `factory.runs.read` and writes nothing. The Studio screens `run-detail` and `policies` read it, and the callers are the roles the model lists for the service: Reviewer, Operator, Workspace admin and Observer of the project of the run and the Platform admin. The role Requester is not among them, so a member who holds only that role cannot read the decisions of a run that member requested; whether the role belongs in the service file is reported to the owner. The route names a run and no project. The service holds no run registry, only the tenant, the project and the run id each decision carries, so it answers from its own rows: a caller without a role in the project of the decisions is refused with 403, and a run id for which the tenant of the token holds no decision is answered 404, whether the run belongs to another tenant, does not exist or has no decision yet, so the response never confirms a foreign run (ADR-0015 amendment D113). A call without a token or with an expired token is answered 401, a token without `factory.runs.read` 403, a workload token 403, and a store that does not answer 503. The response holds what a decision holds, identifiers, classes, rule ids, reasons and hashes, and never prompt text, a secret or a payload, because a decision never contains them. A person reaches the route through the gateway GovernanceHost, delivered in I1 (D127). A decision is immutable: no operation of the service updates one, and a test fails when the mapping of `PolicyDecisions` allows an update. The worker `DecisionRetentionSweeper` keeps the table small without losing evidence. It runs on the schedule `0 2 * * *` of the model and takes the decisions older than the hot window of 90 days the model states, partitioned by tenant with at most two partitions in parallel. It writes each decision as an evidence copy to the immutable audit store, the store binding `audit-immutable` the model lists for this service, where it is kept seven years (D31), and removes the row from `PolicyDecisions` only after the copy is confirmed. It is idempotent on the decision id: a decision whose copy exists is not written twice, a run that is interrupted between the copy and the removal removes the row on the next run, and a duplicate trigger has no second effect. A failed batch is retried by the fixed policy of the model, three attempts with a backoff of 300 seconds. When the attempts are used up the rows stay in the table, the failure is logged with the tenant and the count and without decision content, and the next scheduled run takes them again, so nothing is lost. The worker publishes no event. After the move `ListRunDecisions` no longer lists the decision, because it reads `PolicyDecisions`. The model does not say whether the read must also serve moved decisions, and the store `audit-immutable` is owned by AuditService while this service binds it; both points are reported to the owner. AuditService holds its own evidence of every decision from `PolicyDecisionRecorded`. Kind: behavior. Traces: services: PolicyEngineService, AuditService; aggregates: PolicyEngineService/PolicyDecision; apis: PolicyEngineService/ListRunDecisions; adrs: ADR-0015, ADR-0019; requirements: NFR-04, NFR-10; scenarios: SCN-PolicyEngineService-005. Relates: screens: run-detail, policies. Depends on: AIFACTORY-US-918, feature:component-base-template-factory-profile. Sources: model/services/governance/PolicyEngineService.yaml, model/stores.yaml, docs/architecture/adr/0019-data-governance.md, docs/planes/trust-operations/governance/services/policy-engine-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given decisions of one run under two revisions and a caller with `factory.runs.read` and a role in the project of the run, when `PolicyEngineService/ListRunDecisions` is called, then the response is 200 with the decisions in the order of their evaluation, each `PolicyEngineService/PolicyDecision` with decision id, domain, action, action class, effect, policy revision, obligations, matched rules, reasons and evaluatedAt, and nothing is written (SCN-PolicyEngineService-005, NFR-04).",
        "AC2: Given a call without a token, a token without `factory.runs.read` or a workload token, a caller without a role in the project of the decisions, a run id for which the tenant of the token holds no decision, which includes a run of another tenant, and `policy-engine-sql` stopped, when `PolicyEngineService/ListRunDecisions` is called, then the answers are 401, 403, 403, 404 and 503 with a problem response and no state changes (SCN-PolicyEngineService-005, ADR-0015).",
        "AC3: Given decisions older and younger than the hot window of model/services/governance/PolicyEngineService.yaml in two tenants, when `DecisionRetentionSweeper` runs, then each older decision exists as an evidence copy in the immutable store and no longer in `PolicyDecisions`, the younger ones are untouched, at most two tenant partitions ran in parallel, and a second run and a duplicate trigger write no second copy and publish nothing.",
        "AC4: Given the immutable store refuses writes, when the worker runs, then after three attempts with the backoff of the model the rows are still in `PolicyDecisions`, the failure is logged with the tenant and the count and without decision content, and the next run moves them; given a run interrupted between the copy and the removal, then the next run removes the row without a second copy, so no `PolicyEngineService/PolicyDecision` is lost or duplicated (ADR-0019, NFR-10)."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3711",
        "AIFACTORY-TASK-106",
        "AIFACTORY-TASK-3712"
      ],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7508,
      "kind": "behavior",
      "traces": {
        "services": [
          "PolicyEngineService",
          "AuditService"
        ],
        "aggregates": [
          "PolicyEngineService/PolicyDecision"
        ],
        "apis": [
          "PolicyEngineService/ListRunDecisions"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-04",
          "NFR-10"
        ],
        "scenarios": [
          "SCN-PolicyEngineService-005"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "policies"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-918",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/governance/PolicyEngineService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/policy-engine-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-922]",
      "number": 922
    },
    {
      "id": "AIFACTORY-TASK-3711",
      "type": "task",
      "parent": "AIFACTORY-US-922",
      "title": "ListRunDecisions from the decision rows of the tenant",
      "sequence": "12.01.08.01",
      "description": "ListRunDecisions from the decision rows of the tenant. Expected output: ListRunDecisions returns the decisions of a run id under the tenant filter in the order of evaluatedAt with decision id, domain, action, action class, effect, policy revision, obligations, matched rules and reasons; it answers 403 for a caller without a role in the project the decisions carry, 404 for a run id without a decision in the tenant of the token, 401, 403 for a token without factory.runs.read and for a workload token, and 503 while the store does not answer; it writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "ListRunDecisions returns the decisions of a run id under the tenant filter in the order of evaluatedAt with decision id, domain, action, action class, effect, policy revision, obligations, matched rules and reasons; it answers 403 for a caller without a role in the project the decisions carry, 404 for a run id without a decision in the tenant of the token, 401, 403 for a token without factory.runs.read and for a workload token, and 503 while the store does not answer; it writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7508,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3711]",
      "number": 3711
    },
    {
      "id": "AIFACTORY-TASK-106",
      "type": "task",
      "parent": "AIFACTORY-US-922",
      "title": "Worker: DecisionRetentionSweeper",
      "sequence": "12.01.08.02",
      "description": "Worker: DecisionRetentionSweeper. Expected output: The worker runs on the schedule 0 2 * * * with the fixed retry policy of the model, three attempts with a backoff of 300 seconds, partitioned by TenantId with at most two partitions in parallel and idempotent on decisionId; it writes each decision older than the hot window of 90 days as an evidence copy to the store binding audit-immutable, removes the row from PolicyDecisions only after the copy is confirmed, leaves the rows in place when the attempts are used up, logs the tenant and the count without decision content, and publishes no event; a duplicate trigger has no second effect.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The worker runs on the schedule 0 2 * * * with the fixed retry policy of the model, three attempts with a backoff of 300 seconds, partitioned by TenantId with at most two partitions in parallel and idempotent on decisionId; it writes each decision older than the hot window of 90 days as an evidence copy to the store binding audit-immutable, removes the row from PolicyDecisions only after the copy is confirmed, leaves the rows in place when the attempts are used up, logs the tenant and the count without decision content, and publishes no event; a duplicate trigger has no second effect."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7508,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-106]",
      "number": 106
    },
    {
      "id": "AIFACTORY-TASK-3712",
      "type": "task",
      "parent": "AIFACTORY-US-922",
      "title": "Verify the decisions of a run and the retention sweep through the acceptance suite",
      "sequence": "12.01.08.03",
      "description": "Verify the decisions of a run and the retention sweep through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PolicyEngineService-005\"` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=DecisionRetention\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-922: the ordered decisions of a run, every refusal over the token matrix and the two-tenant fixture of AIFACTORY-TASK-3701, the move of old decisions with the clock of the suite and a blob store double, the repeated and the duplicate run, the refused write with its three attempts, and the interrupted run.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-PolicyEngineService-005\"` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=DecisionRetention\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-922: the ordered decisions of a run, every refusal over the token matrix and the two-tenant fixture of AIFACTORY-TASK-3701, the move of old decisions with the clock of the suite and a blob store double, the repeated and the duplicate run, the refused write with its three attempts, and the interrupted run."
      ],
      "sourceArtifacts": [
        "model/services/governance/PolicyEngineService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 75,
      "phase": "factory",
      "stackRank": 7508,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3712]",
      "number": 3712
    },
    {
      "id": "AIFACTORY-FEAT-061",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-012",
      "title": "SecretBrokerService: complete delivery",
      "sequence": "12.02",
      "description": "SecretBrokerService is the service of bounded context BC-40 (Secret Broker). Short-lived, scoped credential issuance against secret references — agents, tools, sandboxes, the model gateway and source connectors request a capability, policy validates, the broker obtains the credential from Key Vault or a token exchange, injects it with an expiry and records the issuance; raw long-lived secrets never reach prompts, workers or sandboxes (BC-40, original design §46). Its own repository is ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Delivers: SecretBrokerService (complete). Increment I1: Generate a microservice. Build order 76 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-070",
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-954",
        "AIFACTORY-US-955",
        "AIFACTORY-US-956",
        "AIFACTORY-US-957",
        "AIFACTORY-US-958",
        "AIFACTORY-US-959",
        "AIFACTORY-US-960"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7600,
      "titlePrefix": "[AIFACTORY-FEAT-061]",
      "number": 61
    },
    {
      "id": "AIFACTORY-US-070",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "SecretBrokerService serves its scope end to end",
      "sequence": "12.02.01",
      "description": "As a platform admin, I want every credential a run, a tool, a sandbox, the model gateway or a connector uses issued for one use from a reference I registered, short-lived, bound to its lease and never visible as a value, so that no long-lived secret reaches a prompt, a worker, a sandbox or a tool result and one revocation ends every credential that came from a reference. This is the integration PBI of the feature: it proves on a deployed instance that SecretBrokerService is the one place of bounded context BC-40 where a Factory service obtains a credential. A reference names a secret held in Azure Key Vault, or an identity that can be exchanged for a token, with its kind, owner, allowed purposes, maximum lifetime and rotation period; the value is never in the store of the service. A subject receives an issuance: one short-lived credential for one purpose and one narrowed scope, delivered once over the authenticated gRPC channel, recorded as metadata only and ended at its expiry, with its lease or by a revocation. In this increment the callers are services, not people. Each presents a workload token that holds the service scope naming SecretBrokerService and forwards the tenant of its work; such a token carries no tenant claim, and the forwarded tenant is read only under that service scope (ADR-0015). ToolAdapterService reaches a secret for a tool call and presents the tool invocation and the sandbox lease it acts for, and ModelRouterService, IntegrationService, KnowledgeIngestionService, McpServerRegistryService and ConnectorRegistryService ask for the credentials of their own calls; this feature adds no caller and keeps no list of callers, because the policy decision of each issuance says which subject may use which reference for which purpose. The proof of this PBI is the hand-over of the first outcome through the deployed service, and its criteria state only what a deployed instance can prove; what the repository suites of AIFACTORY-US-951 to AIFACTORY-US-960 prove is not proven again here. The suite registers one reference of the fixture tenant through the REST route of the deployed instance, with a Platform admin token whose audience is the one of the Governance gateway, issued by the authorization server of the acceptance environment; a person reaches that route through GovernanceHost, which fronts the service from I1 (D127), and this feature builds no direct public route. A workload shaped like ToolAdapterService then asks for a credential of that reference twice for the purpose tool-call, in the order in which that service brokers a call (AIFACTORY-US-605 of feature `tool-adapter-service`): first for an invocation of an attempt before any sandbox is leased, with the invocation, its run and its attempt in the subject, and then for a second invocation of the same attempt that also names the sandbox lease opened in between. It receives the fixture secret of the vault of the environment each time as its own issuance. The fixture then publishes the release of the sandbox lease, which revokes the issuance that names it, and the expiry of the lease of the attempt, which revokes the other. A workload that forwards another tenant is answered NOT_FOUND over the real channel, a redelivered event changes nothing, the revocation of the reference is announced once, the state stands after a restart, and no log record, activity, metric, outbox record or row of the deployed instance holds the fixture secret (ADR-0019). The policy decisions of the hand-over are given by the PolicyEngineService of the acceptance environment: each issuance asks `Policy.Decide` with the action kind `credential-issuance` and the purpose tool-call, which the platform bundle of feature `policy-engine-service` allows, so the first outcome issues its credentials under the real policy (D127). Each issuance leaves exactly one audit entry, the one AuditService records from `CredentialIssued`, and the service submits no evidence record of its own for it (D126, D135). Kind: behavior. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; apis: SecretBrokerService/RegisterSecretReference, SecretBrokerService/RevokeSecretReference, SecretBrokerService/SecretBroker.Issue, SecretBrokerService/SecretBroker.Revoke, PolicyEngineService/Policy.Decide; events: SecretBrokerService/CredentialIssued, SecretBrokerService/CredentialRevoked, SecretBrokerService/SecretReferenceRevoked, ToolAdapterService/SandboxReleased, RunControlService/LeaseExpired; descriptors: run-event-envelope-v1, policy-decision-request-v1; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: FR-05, NFR-01, NFR-02. Relates: nfrs: NFR-01. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953, AIFACTORY-US-954, AIFACTORY-US-955, AIFACTORY-US-956, AIFACTORY-US-957, AIFACTORY-US-958, AIFACTORY-US-959, AIFACTORY-US-960, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:tool-adapter-service, feature:run-control-service, feature:policy-engine-service. Sources: model/services/governance/SecretBrokerService.yaml, model/backlog/features/governance.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/index.md, docs/planes/trust-operations/governance/security.md#secret-custody, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the container image that the pipeline of the repository published (AIFACTORY-US-951), deployed in the acceptance environment with its secret references `vault-access` and `messaging-transport`, when the instance starts against `secret-broker-sql`, the Key Vault and the identity authority of that environment, then its readiness turns ready and the hand-over suite of this PBI calls that instance over the network and no in-process host; the scaffold, the hosted surface, tenancy, the vault binding and telemetry are proven by AIFACTORY-US-951, AIFACTORY-US-952 and AIFACTORY-US-953 and are not proven again here (ADR-0028, model/services/governance/SecretBrokerService.yaml).",
        "AC2: Given a reference registered through `SecretBrokerService/RegisterSecretReference` on the deployed instance and a workload with the service scope, when it calls `SecretBrokerService/SecretBroker.Issue` twice for the purpose tool-call, first for an invocation of an attempt with its run and no sandbox lease and then for a second invocation of the same attempt that names a sandbox lease, then each reply carries the fixture secret of the vault of the environment, two `SecretBrokerService/Issuance` rows are Issued with an expiry not above `maxTtlSeconds` of the reference, only the second with a sandbox lease in its subject, each naming the decision of `PolicyEngineService/Policy.Decide` that answered `allow` for the action kind `credential-issuance` and the purpose tool-call, and the subscriber of the fixture receives exactly one `SecretBrokerService/CredentialIssued` per issuance in the run event envelope, none of which carries a value, and no evidence record of the broker for either issuance (ADR-0019).",
        "AC3: Given the two issuances of AC2, when the fixture publishes `ToolAdapterService/SandboxReleased` for the sandbox lease on the deployed transport, then the issuance that names the lease is Revoked and the other stays Issued; when the fixture then publishes `RunControlService/LeaseExpired` for the lease of the attempt, then the other is Revoked as well, and exactly one `SecretBrokerService/CredentialRevoked` per issuance is received; and when `SecretBrokerService/SecretBroker.Revoke` is then called for one of them, it is acknowledged and no second event is published.",
        "AC4: Given the reference of AC2 on the deployed instance and workload tokens issued by the authorization server of the acceptance environment, when a workload that forwards another tenant calls `SecretBrokerService/SecretBroker.Issue` with the identifier of that reference, a workload whose token lacks the service scope calls it, and the fixture delivers the `ToolAdapterService/SandboxReleased` of AC3 a second time on the deployed transport, then the first is answered NOT_FOUND over the real channel and no credential is delivered, the second is refused by the token validation of the deployed instance, and the redelivery changes no row and publishes no second `SecretBrokerService/CredentialRevoked`; the refusals themselves are owned by AC1 of AIFACTORY-US-953, AC2 of AIFACTORY-US-952 and AC3 of AIFACTORY-US-955 and the deduplication by AC3 of AIFACTORY-US-956, and none is enumerated again here (ADR-0015).",
        "AC5: Given the state of AC2 to AC4 and the reference then revoked through `SecretBrokerService/RevokeSecretReference` on the deployed instance, when the subscriber of the fixture is read and the instance is restarted, then exactly one `SecretBrokerService/SecretReferenceRevoked` was received, every `SecretBrokerService/SecretReference` and `SecretBrokerService/Issuance` row stands as before the restart with the reference still revoked, no operation delivers a credential again for an existing issuance, and a scan of the log records, activities, metrics, outbox records and rows of the instance for the fixture secret finds it in none; the refusal of a later issue from the revoked reference is owned by AC3 of AIFACTORY-US-958 (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/backlog/features/governance.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md",
        "docs/planes/trust-operations/governance/security.md#secret-custody",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3831",
        "AIFACTORY-TASK-756"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7601,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/RegisterSecretReference",
          "SecretBrokerService/RevokeSecretReference",
          "SecretBrokerService/SecretBroker.Issue",
          "SecretBrokerService/SecretBroker.Revoke",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "SecretBrokerService/CredentialIssued",
          "SecretBrokerService/CredentialRevoked",
          "SecretBrokerService/SecretReferenceRevoked",
          "ToolAdapterService/SandboxReleased",
          "RunControlService/LeaseExpired"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "policy-decision-request-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-05",
          "NFR-01",
          "NFR-02"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-954",
        "AIFACTORY-US-955",
        "AIFACTORY-US-956",
        "AIFACTORY-US-957",
        "AIFACTORY-US-958",
        "AIFACTORY-US-959",
        "AIFACTORY-US-960",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:tool-adapter-service",
        "feature:run-control-service",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/backlog/features/governance.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md",
        "docs/planes/trust-operations/governance/security.md#secret-custody",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-070]",
      "number": 70
    },
    {
      "id": "AIFACTORY-TASK-3831",
      "type": "task",
      "parent": "AIFACTORY-US-070",
      "title": "Hand-over fixture of the first outcome for the deployed secret broker",
      "sequence": "12.02.01.01",
      "description": "Hand-over fixture of the first outcome for the deployed secret broker. Expected output: The acceptance suite holds one secret with a marker value in the Key Vault of the acceptance environment, a Platform admin user token of the fixture tenant with the audience of the Governance gateway and the scope factory.secrets.admin from the authorization server of the environment, a workload identity shaped like ToolAdapterService and one that forwards another tenant, each with a token of that authorization server that holds the service scope naming SecretBrokerService, a workload token without that scope, subjects of two tool invocations of one attempt of one run, the first without and the second with a sandbox lease, the address of the PolicyEngineService of the acceptance environment with its platform bundle active, a subscriber on the five topics of the secret-broker profile of the deployed transport that records every delivered envelope, publishers of SandboxReleased and LeaseExpired built from the pinned contracts package that can deliver an event a second time, a step that restarts the deployed instance and waits for its readiness, and a scan of the log records, activities, metrics, outbox records and rows of the instance for the marker value, so that AC2 to AC5 of AIFACTORY-US-070 run against the deployed service and the deployed PolicyEngineService without ToolAdapterService or RunControlService.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The acceptance suite holds one secret with a marker value in the Key Vault of the acceptance environment, a Platform admin user token of the fixture tenant with the audience of the Governance gateway and the scope factory.secrets.admin from the authorization server of the environment, a workload identity shaped like ToolAdapterService and one that forwards another tenant, each with a token of that authorization server that holds the service scope naming SecretBrokerService, a workload token without that scope, subjects of two tool invocations of one attempt of one run, the first without and the second with a sandbox lease, the address of the PolicyEngineService of the acceptance environment with its platform bundle active, a subscriber on the five topics of the secret-broker profile of the deployed transport that records every delivered envelope, publishers of SandboxReleased and LeaseExpired built from the pinned contracts package that can deliver an event a second time, a step that restarts the deployed instance and waits for its readiness, and a scan of the log records, activities, metrics, outbox records and rows of the instance for the marker value, so that AC2 to AC5 of AIFACTORY-US-070 run against the deployed service and the deployed PolicyEngineService without ToolAdapterService or RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7601,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3831]",
      "number": 3831
    },
    {
      "id": "AIFACTORY-TASK-756",
      "type": "task",
      "parent": "AIFACTORY-US-070",
      "title": "Verify secret-broker-service-serves-its-scope by running the declared command",
      "sequence": "12.02.01.02",
      "description": "Verify secret-broker-service-serves-its-scope by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=SecretHandOver\"` against the deployed service; a run that discovers no test and a zero-match filter count as failures; the run against the deployed instance proves AC1 to AC5 of AIFACTORY-US-070, that is the readiness of the deployed image, two issuances of one reference through `SecretBrokerService/SecretBroker.Issue` each with its own delivery, the first without and the second with a sandbox lease, the second revoked by the release of its sandbox lease and the first by the expiry of the lease of its attempt, NOT_FOUND over the real channel for the workload of another tenant, the token validation of the deployed instance, the redelivered event without a second effect, the one SecretReferenceRevoked, the state after a restart and the scan for the marker value; the thirteen scenarios SCN-SecretBrokerService-001 to SCN-SecretBrokerService-013 are proven by the suites of AIFACTORY-US-954 to AIFACTORY-US-960.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=SecretHandOver\"` against the deployed service; a run that discovers no test and a zero-match filter count as failures; the run against the deployed instance proves AC1 to AC5 of AIFACTORY-US-070, that is the readiness of the deployed image, two issuances of one reference through `SecretBrokerService/SecretBroker.Issue` each with its own delivery, the first without and the second with a sandbox lease, the second revoked by the release of its sandbox lease and the first by the expiry of the lease of its attempt, NOT_FOUND over the real channel for the workload of another tenant, the token validation of the deployed instance, the redelivered event without a second effect, the one SecretReferenceRevoked, the state after a restart and the scan for the marker value; the thirteen scenarios SCN-SecretBrokerService-001 to SCN-SecretBrokerService-013 are proven by the suites of AIFACTORY-US-954 to AIFACTORY-US-960."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-756]",
      "number": 756
    },
    {
      "id": "AIFACTORY-US-951",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "SecretBrokerService repository: scaffolded from the base template with the Factory profile, with the SecretReference and Issuance aggregates and the store secret-broker-sql",
      "sequence": "12.02.02",
      "description": "SecretBrokerService has its own repository, ConnectSoft.AI.SoftwareFactory.SecretBrokerService, its own deployable and its own relational store (ADR-0028). The repository is created and scaffolded in I0 by AIFACTORY-TASK-108 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SecretBrokerService --UseFactoryProfile true`, generated from the template package at the version the gate of feature `component-base-template-factory-profile` published, with the messaging service name `secret-broker`, the default of `OrleansMessaging:ServiceName` in the model. Token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again; the repository pins the contracts package, from which it takes the run event envelope, the topic constants and the event types. On that scaffold this PBI builds the domain model and the relational store and delivers no behaviour of an operation. The aggregate `SecretReference` holds the eleven fields of the model: `referenceId`, `tenantId`, `kind`, `vaultRef`, `ownerKind`, `ownerId`, `allowedPurposes`, `maxTtlSeconds`, `rotationDays`, the optional `lastRotatedAt` and `revoked`, with the enum `SecretKind` and its eight values. The aggregate `Issuance` holds `issuanceId`, `tenantId`, `referenceId`, `subject`, `purpose`, `scope`, `policyDecisionId`, `state`, `issuedAt`, `expiresAt` and the optional `revokedAt`, with the enum `IssuanceState`. The model lists no transition table for either aggregate, so the state changes are the ones its commands, its enum and its invariants give. A reference is registered with `revoked` false, a rotation sets `lastRotatedAt` and replaces `vaultRef` and leaves the reference usable, and a revocation sets `revoked` and is final: no command clears it and a revoked reference is neither rotated nor issued from. An issuance is created Issued and leaves that state once, to Expired when its expiry passed or to Revoked with `revokedAt`; nothing leaves Expired or Revoked. The invariants hold in the aggregates: neither has a member that can hold a secret value, an issuance is created only for a purpose in `allowedPurposes` of its reference, with a policy decision and with an expiry not later than `issuedAt` plus `maxTtlSeconds`, and never from a revoked reference. The store `secret-broker-sql` receives the three tables of the model, `SecretReferences`, `RotationReceipts` and `Issuances`, with their columns, foreign keys and the indexes `IX_SecretRefs_Owner`, `IX_Issuances_Reference_State` and `IX_Issuances_Expiry`, under the tenant row filter of the profile. The key of `SecretReferences` is a correction of the model on which this PBI is built and which is reported to the owner. The model keys the table by `ReferenceId` alone, while a tool descriptor names a secret dependency by one identifier that each tenant registers for itself; a registration that collides with a reference of another tenant could then only be answered by confirming that the other exists, against the rule that a resource of another tenant is not found (ADR-0015 amendment D113), and `RegisterSecretReference` lists 409 for a collision. The primary key is therefore `TenantId` and `ReferenceId`, and the foreign keys of `RotationReceipts` and `Issuances` carry both columns. The correction belongs in model/services/governance/SecretBrokerService.yaml, from which the data definition page of the service is generated, so that the page, the data model and the migration agree; until that page is regenerated from the corrected model, this PBI cites it for columns and indexes only and states the key here. `Issuances` rows are issuance metadata only and are kept for the period the model states for them as audit evidence; no sweep of this delivery deletes one. Kind: enabling. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; adrs: ADR-0015, ADR-0028; requirements: NFR-01. Depends on: feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:repository-and-pipeline-conventions. Sources: model/services/governance/SecretBrokerService.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/ddl.md, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#data-model-and-storage, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-108 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SecretBrokerService --UseFactoryProfile true` from the template package at its published version with the messaging service name `secret-broker`, when the pipeline of the repository runs with the work of this feature, then the solution builds, the generated tests pass with complete reports and a container image is published (ADR-0028).",
        "AC2: Given the aggregate `SecretBrokerService/SecretReference`, when it is registered, rotated and revoked, then registration leaves `revoked` false, a rotation sets `lastRotatedAt` and the new `vaultRef`, and a revocation sets `revoked`; a rotation and an issuance from a revoked reference are refused with the reference unchanged, a second revocation changes nothing, and no member of the aggregate can hold a secret value (model/services/governance/SecretBrokerService.yaml).",
        "AC3: Given the aggregate `SecretBrokerService/Issuance`, when it is created and then expired or revoked, then it moves from Issued to Expired or from Issued to Revoked with `revokedAt` and every other pair of states is refused; a creation for a purpose outside `allowedPurposes` of its reference, without a policy decision or with an expiry later than `issuedAt` plus `maxTtlSeconds` is refused and writes nothing (model/services/governance/SecretBrokerService.yaml).",
        "AC4: Given an empty `secret-broker-sql`, when the migrations run, then `SecretReferences`, `RotationReceipts` and `Issuances` exist with the columns and indexes of docs/planes/trust-operations/governance/services/secret-broker-service/ddl.md, the primary key of `SecretReferences` is `TenantId` and `ReferenceId` and the foreign keys of `RotationReceipts` and `Issuances` carry both columns, which is the correction of the key of the model reported under ADR-0015 amendment D113, two tenants hold a reference of the same identifier as two rows, rows of two tenants read under the scope of one tenant return only the rows of that tenant, and no table has a column that holds a secret value (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/ddl.md",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#data-model-and-storage",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-109",
        "AIFACTORY-TASK-110",
        "AIFACTORY-TASK-3832"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7602,
      "kind": "enabling",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/ddl.md",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#data-model-and-storage",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-951]",
      "number": 951
    },
    {
      "id": "AIFACTORY-TASK-109",
      "type": "task",
      "parent": "AIFACTORY-US-951",
      "title": "Domain model: the SecretReference and Issuance aggregates with SecretKind, IssuanceState and their state changes",
      "sequence": "12.02.02.01",
      "description": "Domain model: the SecretReference and Issuance aggregates with SecretKind, IssuanceState and their state changes. Expected output: The aggregates SecretReference and Issuance with the fields and the enums SecretKind and IssuanceState of model/services/governance/SecretBrokerService.yaml; a reference is registered, rotated and revoked, and a revoked reference refuses a rotation and an issuance; an issuance moves from Issued to Expired or to Revoked and nowhere else; the purpose, the policy decision and the expiry bound are checked at creation; neither aggregate has a member for a secret value; unit tests cover every state change, every refused pair and every invariant the aggregates can enforce.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates SecretReference and Issuance with the fields and the enums SecretKind and IssuanceState of model/services/governance/SecretBrokerService.yaml; a reference is registered, rotated and revoked, and a revoked reference refuses a rotation and an issuance; an issuance moves from Issued to Expired or to Revoked and nowhere else; the purpose, the policy decision and the expiry bound are checked at creation; neither aggregate has a member for a secret value; unit tests cover every state change, every refused pair and every invariant the aggregates can enforce."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-109]",
      "number": 109
    },
    {
      "id": "AIFACTORY-TASK-110",
      "type": "task",
      "parent": "AIFACTORY-US-951",
      "title": "Persistence in secret-broker-sql: migrations and mappings of SecretReferences, RotationReceipts and Issuances",
      "sequence": "12.02.02.02",
      "description": "Persistence in secret-broker-sql: migrations and mappings of SecretReferences, RotationReceipts and Issuances. Expected output: Migrations and mappings of the three tables of the model with their columns and the indexes IX_SecretRefs_Owner, IX_Issuances_Reference_State and IX_Issuances_Expiry; the primary key of SecretReferences is TenantId and ReferenceId and the foreign keys of RotationReceipts and Issuances carry both columns, the correction of the key of model/services/governance/SecretBrokerService.yaml reported under ADR-0015 amendment D113, so the data definition page is cited for columns and indexes only until it is regenerated; every mapping carries the tenant row filter of the Factory profile and no column holds a secret value; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Migrations and mappings of the three tables of the model with their columns and the indexes IX_SecretRefs_Owner, IX_Issuances_Reference_State and IX_Issuances_Expiry; the primary key of SecretReferences is TenantId and ReferenceId and the foreign keys of RotationReceipts and Issuances carry both columns, the correction of the key of model/services/governance/SecretBrokerService.yaml reported under ADR-0015 amendment D113, so the data definition page is cited for columns and indexes only until it is regenerated; every mapping carries the tenant row filter of the Factory profile and no column holds a secret value; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7602,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-110]",
      "number": 110
    },
    {
      "id": "AIFACTORY-TASK-3832",
      "type": "task",
      "parent": "AIFACTORY-US-951",
      "title": "Verify the scaffold, the aggregates and the store of SecretBrokerService",
      "sequence": "12.02.02.03",
      "description": "Verify the scaffold, the aggregates and the store of SecretBrokerService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"` in the pipeline of the repository; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-951: the unchanged scaffold with the Factory profile, the state changes and the refused pairs of both aggregates, the three tables with their indexes, the key by tenant and reference identifier and the tenant row filter against an isolated database, and the absence of a column for a secret value.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"` in the pipeline of the repository; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-951: the unchanged scaffold with the Factory profile, the state changes and the refused pairs of both aggregates, the three tables with their indexes, the key by tenant and reference identifier and the tenant row filter against an isolated database, and the absence of a column for a secret value."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3832]",
      "number": 3832
    },
    {
      "id": "AIFACTORY-US-952",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "SecretBrokerService host: five REST routes and three gRPC methods behind scope policies, messaging with the five events of the model and the audit evidence event, and two hosted workers",
      "sequence": "12.02.03",
      "description": "This PBI hosts the surface of the service and delivers the behaviour of no operation. The service descriptor file of the repository lists the eight operations as the model does. The REST operations are `ListSecretReferences`, `RegisterSecretReference`, `RotateSecret` and `RevokeSecretReference` under the scope `factory.secrets.admin` and `ListRunIssuances` under `factory.runs.read`; `RegisterSecretReference` and `RotateSecret` are of class production and idempotent on the `Idempotency-Key` header, `RevokeSecretReference` is of class production with natural idempotency, and the two lists are reads. The internal gRPC methods of the service `SecretBroker` are `Issue` and `Revoke`, of class shared-write, and `Verify`, of class external, none of them streaming. The contract test of the profile compares the hosted endpoints with that file in both directions. Each REST route sits behind the policy of its scope: a call without a token is answered 401, a valid user token without the scope is answered 403, and the audience a user token must carry is the one of the Governance gateway that fronts the service from I1 (D127), because a user token has one audience and a gateway forwards it unchanged (ADR-0015). A workload token carries service scopes and never satisfies a REST scope policy. Each gRPC method requires a workload token that holds the service scope naming SecretBrokerService: a call without a workload identity is refused with UNAUTHENTICATED and a token without that scope with PERMISSION_DENIED, and the tenant a workload forwards is read only under that scope. The answers the model does not list for an operation are given by the host and reported to the owner as codes the model omits: 401 for a missing token, 400 for a body that fails validation or a call to `RegisterSecretReference` or `RotateSecret` without its key header, 409 on `RotateSecret` for a key reused with another input and for a revoked reference, and 503 while a required dependency does not answer. The OpenAPI document and the proto fix the messages. The model names `execution-scope-v1` as the request of the three methods and as the reply of `Issue`, and `ack-v1` as the reply of `Revoke` and `Verify`. The schema of `execution-scope-v1` holds the trusted scope and has no member for a reference, a subject, a purpose, a narrowed scope, a lifetime, an issuance or a credential, so the proto carries the scope in the shape of that schema and adds those members as fields of the request and of the reply of `Issue` beside it. The schema also requires `projectId`, while a reference belongs to no project and a caller forwards a project only where its work has one, a provider or a pool credential having none, so `projectId` is optional in the proto. Both differences are stated by a contract test and reported as corrections of the descriptor rows of the model. Only the reply of `Issue` has a field that can hold a credential. Messaging follows the Orleans profile of the base template: the outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the `secret-broker` messaging profile publishes the five events of the model in the run event envelope of the pinned contracts package, each on the topic the model names. The sixth declared event is the audit evidence event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted`, with the event type and the topic constant of the contracts package, so that the sink of the pinned audit library writes an `audit-evidence-v1` record to the outbox of the service in the transaction of a command (D115). The inbox registers three of the four consumed events of the model with deduplication on the event id: `RunCancelled` and `LeaseExpired` of RunControlService and `SandboxReleased` of ToolAdapterService. The fourth, `DeletionOrderIssued` of RetentionResidencyService, is not registered: its handler is built in I4 with that service. The two workers are hosted with their modelled triggers: `ExpirySweeper` every minute with a fixed retry of three attempts thirty seconds apart, the idempotency key `issuanceId` and at most four parallel executions partitioned by tenant, and `RotationScheduler` daily at five with a fixed retry of two attempts six hundred seconds apart, the idempotency key of reference and day and at most two parallel executions partitioned by tenant. What each operation, handler and worker does is delivered by AIFACTORY-US-954 to AIFACTORY-US-960. Kind: enabling. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; apis: SecretBrokerService/ListSecretReferences, SecretBrokerService/RegisterSecretReference, SecretBrokerService/RotateSecret, SecretBrokerService/RevokeSecretReference, SecretBrokerService/ListRunIssuances, SecretBrokerService/SecretBroker.Issue, SecretBrokerService/SecretBroker.Revoke, SecretBrokerService/SecretBroker.Verify; events: SecretBrokerService/SecretReferenceRegistered, SecretBrokerService/SecretRotated, SecretBrokerService/SecretReferenceRevoked, SecretBrokerService/CredentialIssued, SecretBrokerService/CredentialRevoked; descriptors: execution-scope-v1, ack-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-951, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-audit-factory-evidence. Sources: model/services/governance/SecretBrokerService.yaml, docs/reference/schemas/execution-scope.schema.json, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#messages, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given the service descriptor file and the hosted surface, when the contract test of the profile runs, then exactly the routes of `SecretBrokerService/ListSecretReferences`, `SecretBrokerService/RegisterSecretReference`, `SecretBrokerService/RotateSecret`, `SecretBrokerService/RevokeSecretReference` and `SecretBrokerService/ListRunIssuances` and the methods `SecretBrokerService/SecretBroker.Issue`, `SecretBrokerService/SecretBroker.Revoke` and `SecretBrokerService/SecretBroker.Verify` are hosted with the scope, the side-effect class and the idempotency rule of model/services/governance/SecretBrokerService.yaml, and the test fails on an endpoint the file does not name and on an operation without an endpoint.",
        "AC2: Given each REST route called without a token, with a valid user token that lacks the scope of the route and with a user token of another audience, and each gRPC method called without a workload identity and with a workload token that lacks the service scope, when the call arrives, then it is answered 401, 403, 401, UNAUTHENTICATED and PERMISSION_DENIED respectively before any handler runs, and nothing is read or written (ADR-0015).",
        "AC3: Given a command that changes a `SecretBrokerService/SecretReference` and is rolled back and one that commits, when the outbox of the `secret-broker` messaging profile is read, then the first left no record and the second left its record in the transaction of the change, and the dispatcher publishes it in the run event envelope on the topic the model names for the event; the `OrleansMessaging` section declares the five events of the model and the audit evidence event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` with its route to the Audit service, an `audit-evidence-v1` record written through the sink of the audit library in the transaction of a command leaves the outbox on that topic, and a publish of a message the section does not declare is refused (ADR-0014, ADR-0012).",
        "AC4: Given fixture publishers of the three subscribed events built from the pinned contracts package, when the same event id is delivered twice or the schedule of `ExpirySweeper` or of `RotationScheduler` fires twice under one idempotency key, then the handler or the worker runs once, a handler that keeps failing is retried with backoff and never applied twice, and an event of RetentionResidencyService reaches no handler (model/services/governance/SecretBrokerService.yaml).",
        "AC5: Given the golden files of the proto and of the OpenAPI document, when the contract test compares the scope members of the three gRPC requests with docs/reference/schemas/execution-scope.schema.json, then they are equal in name and type, the test lists every difference, that is `projectId`, which the schema requires and the proto leaves optional, and the members the schema does not have, the reference, the subject, the purpose, the narrowed scope, the lifetime, the issuance and the credential, only the reply of `SecretBrokerService/SecretBroker.Issue` has a field that can hold a credential, and a change of either side fails the test."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#messages",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-111",
        "AIFACTORY-TASK-112",
        "AIFACTORY-TASK-113",
        "AIFACTORY-TASK-3833"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7603,
      "kind": "enabling",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/ListSecretReferences",
          "SecretBrokerService/RegisterSecretReference",
          "SecretBrokerService/RotateSecret",
          "SecretBrokerService/RevokeSecretReference",
          "SecretBrokerService/ListRunIssuances",
          "SecretBrokerService/SecretBroker.Issue",
          "SecretBrokerService/SecretBroker.Revoke",
          "SecretBrokerService/SecretBroker.Verify"
        ],
        "events": [
          "SecretBrokerService/SecretReferenceRegistered",
          "SecretBrokerService/SecretRotated",
          "SecretBrokerService/SecretReferenceRevoked",
          "SecretBrokerService/CredentialIssued",
          "SecretBrokerService/CredentialRevoked"
        ],
        "descriptors": [
          "execution-scope-v1",
          "ack-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-951",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#messages",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-952]",
      "number": 952
    },
    {
      "id": "AIFACTORY-TASK-111",
      "type": "task",
      "parent": "AIFACTORY-US-952",
      "title": "Contract and hosting of the surface: service descriptor, OpenAPI document and proto of the 5 REST and 3 gRPC operations behind their scope policies",
      "sequence": "12.02.03.01",
      "description": "Contract and hosting of the surface: service descriptor, OpenAPI document and proto of the 5 REST and 3 gRPC operations behind their scope policies. Expected output: The service descriptor file lists ListSecretReferences, RegisterSecretReference, RotateSecret, RevokeSecretReference, ListRunIssuances and SecretBroker.Issue, SecretBroker.Revoke and SecretBroker.Verify with scope, side-effect class, idempotency and response codes as model/services/governance/SecretBrokerService.yaml does; the five routes are hosted behind the policies of factory.secrets.admin and factory.runs.read with problem responses, the Idempotency-Key filter of RegisterSecretReference and RotateSecret and the audience of the Governance gateway for user tokens; the three methods are hosted behind the workload policy of the service scope; the OpenAPI document and the proto fix the messages by golden files, the proto carrying the scope in the shape of execution-scope-v1 with projectId optional although the schema requires it and, as fields beside it, the reference, the subject, the purpose, the narrowed scope, the lifetime, the issuance and, in the reply of Issue alone, the credential; the contract test compares the scope members with docs/reference/schemas/execution-scope.schema.json and lists every difference, the optional projectId and every member the schema does not have; the behaviour of each operation is delivered by AIFACTORY-US-954 to AIFACTORY-US-960, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists ListSecretReferences, RegisterSecretReference, RotateSecret, RevokeSecretReference, ListRunIssuances and SecretBroker.Issue, SecretBroker.Revoke and SecretBroker.Verify with scope, side-effect class, idempotency and response codes as model/services/governance/SecretBrokerService.yaml does; the five routes are hosted behind the policies of factory.secrets.admin and factory.runs.read with problem responses, the Idempotency-Key filter of RegisterSecretReference and RotateSecret and the audience of the Governance gateway for user tokens; the three methods are hosted behind the workload policy of the service scope; the OpenAPI document and the proto fix the messages by golden files, the proto carrying the scope in the shape of execution-scope-v1 with projectId optional although the schema requires it and, as fields beside it, the reference, the subject, the purpose, the narrowed scope, the lifetime, the issuance and, in the reply of Issue alone, the credential; the contract test compares the scope members with docs/reference/schemas/execution-scope.schema.json and lists every difference, the optional projectId and every member the schema does not have; the behaviour of each operation is delivered by AIFACTORY-US-954 to AIFACTORY-US-960, not here."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7603,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-111]",
      "number": 111
    },
    {
      "id": "AIFACTORY-TASK-112",
      "type": "task",
      "parent": "AIFACTORY-US-952",
      "title": "Messaging skeleton: outbox and inbox wiring of the secret-broker profile for the 5 events of the model, the audit evidence event and 3 consumed events",
      "sequence": "12.02.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the secret-broker profile for the 5 events of the model, the audit evidence event and 3 consumed events. Expected output: The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the secret-broker messaging profile publishes SecretReferenceRegistered, SecretRotated, SecretReferenceRevoked, CredentialIssued and CredentialRevoked in the run event envelope of the pinned contracts package, each declared with its topic and route under PublishedEvents of the OrleansMessaging section; the section declares a sixth published event, AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, with the event type and the topic constant of the pinned contracts package and its route to AuditService, so that the sink of the pinned audit library writes audit-evidence-v1 records to the outbox of the service without an undeclared publish; the inbox registers RunCancelled and LeaseExpired of RunControlService and SandboxReleased of ToolAdapterService with deduplication on the event id; DeletionOrderIssued of RetentionResidencyService is not subscribed, its handler being built in I4 with that service; what each handler does is delivered by AIFACTORY-US-956.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the secret-broker messaging profile publishes SecretReferenceRegistered, SecretRotated, SecretReferenceRevoked, CredentialIssued and CredentialRevoked in the run event envelope of the pinned contracts package, each declared with its topic and route under PublishedEvents of the OrleansMessaging section; the section declares a sixth published event, AuditEvidenceSubmitted on audit.evidence.v1.evidence-submitted, with the event type and the topic constant of the pinned contracts package and its route to AuditService, so that the sink of the pinned audit library writes audit-evidence-v1 records to the outbox of the service without an undeclared publish; the inbox registers RunCancelled and LeaseExpired of RunControlService and SandboxReleased of ToolAdapterService with deduplication on the event id; DeletionOrderIssued of RetentionResidencyService is not subscribed, its handler being built in I4 with that service; what each handler does is delivered by AIFACTORY-US-956."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-112]",
      "number": 112
    },
    {
      "id": "AIFACTORY-TASK-113",
      "type": "task",
      "parent": "AIFACTORY-US-952",
      "title": "Worker hosting skeleton: schedules, retry policies and partitioning of ExpirySweeper and RotationScheduler",
      "sequence": "12.02.03.03",
      "description": "Worker hosting skeleton: schedules, retry policies and partitioning of ExpirySweeper and RotationScheduler. Expected output: ExpirySweeper is hosted on the schedule */1 * * * * with a fixed retry of three attempts thirty seconds apart, the idempotency key issuanceId and at most four parallel executions partitioned by tenant; RotationScheduler is hosted on the schedule 0 5 * * * with a fixed retry of two attempts six hundred seconds apart, the idempotency key of reference and day and at most two parallel executions partitioned by tenant; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-956 and AIFACTORY-US-957.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ExpirySweeper is hosted on the schedule */1 * * * * with a fixed retry of three attempts thirty seconds apart, the idempotency key issuanceId and at most four parallel executions partitioned by tenant; RotationScheduler is hosted on the schedule 0 5 * * * with a fixed retry of two attempts six hundred seconds apart, the idempotency key of reference and day and at most two parallel executions partitioned by tenant; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-956 and AIFACTORY-US-957."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-113]",
      "number": 113
    },
    {
      "id": "AIFACTORY-TASK-3833",
      "type": "task",
      "parent": "AIFACTORY-US-952",
      "title": "Verify the hosted surface, the messaging profile and the hosted workers of SecretBrokerService",
      "sequence": "12.02.03.04",
      "description": "Verify the hosted surface, the messaging profile and the hosted workers of SecretBrokerService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-952: the surface compared with the service descriptor in both directions, the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every operation, the outbox record committed and rolled back with its change, the six declared entries of the OrleansMessaging section with the audit evidence event among them, an evidence record that leaves the outbox on audit.evidence.v1.evidence-submitted, the refused undeclared publish, the deduplicated inbox under fixture publishers of the three subscribed events, the duplicate worker trigger, and the golden files compared with docs/reference/schemas/execution-scope.schema.json with the complete list of differences, the optional projectId and the members the schema does not have.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-952: the surface compared with the service descriptor in both directions, the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every operation, the outbox record committed and rolled back with its change, the six declared entries of the OrleansMessaging section with the audit evidence event among them, an evidence record that leaves the outbox on audit.evidence.v1.evidence-submitted, the refused undeclared publish, the deduplicated inbox under fixture publishers of the three subscribed events, the duplicate worker trigger, and the golden files compared with docs/reference/schemas/execution-scope.schema.json with the complete list of differences, the optional projectId and the members the schema does not have."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3833]",
      "number": 3833
    },
    {
      "id": "AIFACTORY-US-953",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "SecretBrokerService filters every query by tenant, answers a foreign reference as not found, binds Azure Key Vault as its one vault and keeps every secret value out of telemetry",
      "sequence": "12.02.04",
      "description": "SecretBrokerService is the custodian of every credential of the Factory, and the model classifies its data as restricted, so isolation, the binding of the vault and the silence of its telemetry are deliverables of their own. Tenant isolation is the row filter of the profile: every query on `SecretReferences`, `RotationReceipts` and `Issuances` carries the tenant of the trusted scope, so a reference, a receipt or an issuance of another tenant is invisible. A request that addresses one by identifier is answered 404, over gRPC the status NOT_FOUND, the same answer as for an identifier that does not exist, and nothing in the answer confirms that it exists; a caller that receives NOT_FOUND for an attempt takes the failure class permanent (ADR-0015). A reference belongs to its tenant and to no project, and `factory.secrets.admin` is a scope of the tenant-wide Platform admin role, so the reference operations know no project boundary. An issuance names its project in its subject when the caller forwards one, and the read of the issuances of a run admits a user token with the role Operator or Observer in that project, with an Observer role assigned at the tenant or with the Platform admin role: these are the three roles the model lists for the service, at the two levels at which ADR-0015 assigns Observer. Another role of the project, Requester or Reviewer for example, and no role in it are answered 403, because a missing right inside the own tenant is never answered as not found. The vault is the one the model binds: the store `secrets`, Azure Key Vault, which is also the external dependency of the service for secret values, key operations and token exchange. The service reaches it through one vault port with one adapter and builds no second vault, no local secret store and no cache of values. A value is held in memory only for the duration of one issuance, between the read from the vault and the reply, and no type other than the adapter and the handler of `Issue` can see one; an architecture test fails when another type references the vault client or when a persisted, logged or published type gains a member that could hold a value. `vaultRef` is a secret reference: it is stored, it selects the vault object, and it leaves the service in no response, event, log record or metric. The two secrets of the model reach the service as secret references and never as values in the repository or in configuration: `vault-access`, the workload identity with which the service reads the vault, and `messaging-transport`; their rotation periods are the ones the model states and are applied by the platform, not by this service. The service is unready while a reference cannot be resolved, and readiness names each required dependency that does not answer: the store, Key Vault, PolicyEngineService and the identity platform, all of which the model marks required and fail-fast. When Key Vault does not answer, the service fails closed as the model describes: a new issuance is refused with UNAVAILABLE and the failure class transient, the refusal is counted, issuances that were delivered keep working until their expiry, and nothing is retried by the service. Telemetry follows the Factory conventions through the single enrichment registration of the pinned observability libraries. The four instruments of the model are created through the instrument helper: `connectsoft.factory.secrets.issuances` with the dimensions tenant, kind, purpose and outcome, counting issuances and refusals, `connectsoft.factory.secrets.live_issuances` with tenant and kind, `connectsoft.factory.secrets.rotation_due` with tenant, and `connectsoft.factory.secrets.issue_latency` with kind, on which the objective of the model for the issuance, two hundred milliseconds at the 95th percentile, is read. Metrics carry tenant and, where the call names one, project by default; activities and log records carry tenant and project, and run, step and attempt when the subject of an issuance names them. No secret value, no credential and no `vaultRef` reaches a metric, an activity or a log record: the reference identifier and the issuance identifier stand in their place (ADR-0019). Kind: enabling. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; apis: SecretBrokerService/RotateSecret, SecretBrokerService/RevokeSecretReference, SecretBrokerService/SecretBroker.Issue, SecretBrokerService/SecretBroker.Revoke, SecretBrokerService/SecretBroker.Verify; adrs: ADR-0015, ADR-0019; requirements: NFR-01, NFR-02. Relates: nfrs: NFR-01. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, feature:component-base-template-factory-profile, feature:component-observability-factory-conventions. Sources: model/services/governance/SecretBrokerService.yaml, model/stores.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/data-governance.md#logging-and-telemetry, docs/planes/trust-operations/governance/security.md#secret-custody, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#failure-and-recovery, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#metrics-and-observability.",
      "acceptanceCriteria": [
        "AC1: Given references and issuances of two tenants, when a caller of the first tenant addresses a reference of the second through `SecretBrokerService/RotateSecret`, `SecretBrokerService/RevokeSecretReference`, `SecretBrokerService/SecretBroker.Issue` or `SecretBrokerService/SecretBroker.Verify`, or an issuance of the second through `SecretBrokerService/SecretBroker.Revoke`, then the answer is 404 over REST and NOT_FOUND over gRPC, byte for byte the answer for an identifier that does not exist, no list of the first tenant ever holds a row of the second, and nothing of the second tenant changes (ADR-0015).",
        "AC2: Given the solution, when the architecture test runs, then the vault adapter is the only type that references the Key Vault client, no persisted, logged or published type has a member that can hold a secret value, and a start with a second vault provider or a local secret store configured is refused with the setting named, so that the store `secrets` of model/services/governance/SecretBrokerService.yaml is the one vault of the service.",
        "AC3: Given a start without a resolvable secret reference for `vault-access` or for `messaging-transport`, when readiness is probed, then the service is unready and names the missing reference; given Key Vault, PolicyEngineService or the identity platform does not answer, then readiness names that dependency; and neither the configuration of the repository nor any log record holds a secret value (model/services/governance/SecretBrokerService.yaml).",
        "AC4: Given fixture secrets that carry a marker value and a run that registers, issues, verifies, rotates, revokes and lists with debug logging on and with one failing vault call, when the collected metrics, activities, log records, outbox records and rows are scanned, then none holds the marker or a `vaultRef`, the metrics carry their modelled dimensions with tenant, and the activities and log records of an issuance whose subject names a run carry run, step and attempt (ADR-0019).",
        "AC5: Given Key Vault stops answering, when `SecretBrokerService/SecretBroker.Issue` is called, then it is refused with UNAVAILABLE and the failure class transient, `connectsoft.factory.secrets.issuances` counts the refusal by its outcome, no `SecretBrokerService/Issuance` row and no event is written, the service does not retry, issuances delivered before stay Issued until their expiry, and after the vault answers again the next call issues (docs/planes/trust-operations/governance/security.md)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/data-governance.md#logging-and-telemetry",
        "docs/planes/trust-operations/governance/security.md#secret-custody",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#failure-and-recovery",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#metrics-and-observability"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-114",
        "AIFACTORY-TASK-3834",
        "AIFACTORY-TASK-3835"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7604,
      "kind": "enabling",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/RotateSecret",
          "SecretBrokerService/RevokeSecretReference",
          "SecretBrokerService/SecretBroker.Issue",
          "SecretBrokerService/SecretBroker.Revoke",
          "SecretBrokerService/SecretBroker.Verify"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-01",
          "NFR-02"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/data-governance.md#logging-and-telemetry",
        "docs/planes/trust-operations/governance/security.md#secret-custody",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#failure-and-recovery",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#metrics-and-observability"
      ],
      "titlePrefix": "[AIFACTORY-US-953]",
      "number": 953
    },
    {
      "id": "AIFACTORY-TASK-114",
      "type": "task",
      "parent": "AIFACTORY-US-953",
      "title": "Security, tenancy, vault binding and telemetry of SecretBrokerService",
      "sequence": "12.02.04.01",
      "description": "Security, tenancy, vault binding and telemetry of SecretBrokerService. Expected output: Every query of the three tables runs under the tenant row filter of the Factory profile, so a reference or an issuance of another tenant is answered 404 and NOT_FOUND exactly as an unknown one; the one vault port has one adapter for Azure Key Vault, the store secrets of the model, and a start with a second vault provider or a local secret store configured is refused; a value lives in memory between the vault read and the reply of Issue only, and an architecture test fails on any other type that references the vault client or can hold a value; vaultRef leaves the service in no response, event, log record or metric; vault-access and messaging-transport are read as secret references and a missing reference keeps the service unready; readiness names the store, Key Vault, PolicyEngineService and the identity platform; a vault that does not answer refuses an issuance with UNAVAILABLE and the failure class transient without a retry; the instruments connectsoft.factory.secrets.issuances, connectsoft.factory.secrets.live_issuances, connectsoft.factory.secrets.rotation_due and connectsoft.factory.secrets.issue_latency are created through the instrument helper with their modelled dimensions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Every query of the three tables runs under the tenant row filter of the Factory profile, so a reference or an issuance of another tenant is answered 404 and NOT_FOUND exactly as an unknown one; the one vault port has one adapter for Azure Key Vault, the store secrets of the model, and a start with a second vault provider or a local secret store configured is refused; a value lives in memory between the vault read and the reply of Issue only, and an architecture test fails on any other type that references the vault client or can hold a value; vaultRef leaves the service in no response, event, log record or metric; vault-access and messaging-transport are read as secret references and a missing reference keeps the service unready; readiness names the store, Key Vault, PolicyEngineService and the identity platform; a vault that does not answer refuses an issuance with UNAVAILABLE and the failure class transient without a retry; the instruments connectsoft.factory.secrets.issuances, connectsoft.factory.secrets.live_issuances, connectsoft.factory.secrets.rotation_due and connectsoft.factory.secrets.issue_latency are created through the instrument helper with their modelled dimensions."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-114]",
      "number": 114
    },
    {
      "id": "AIFACTORY-TASK-3834",
      "type": "task",
      "parent": "AIFACTORY-US-953",
      "title": "Two-tenant fixture with user and workload tokens, a fake vault with marker secrets, policy and identity fakes and a telemetry collector",
      "sequence": "12.02.04.02",
      "description": "Two-tenant fixture with user and workload tokens, a fake vault with marker secrets, policy and identity fakes and a telemetry collector. Expected output: The acceptance suite holds two tenants with two projects each, user tokens of the Governance gateway audience with and without factory.secrets.admin and factory.runs.read, with the role Operator, with the role Observer and with the role Reviewer in one project, with an Observer role assigned at the tenant and with the Platform admin role, workload tokens with and without the service scope naming SecretBrokerService, a fake vault behind the vault port that holds secrets with a marker value in several versions, exchanges a token for an exchangeable identity, records every read and can stop answering, a fake of PolicyEngineService that answers each of the four outcomes of policy-decision-v1, can refuse a request with INVALID_ARGUMENT, records its requests and can stop answering, references of every purpose and of the kind SandboxToken, subjects of a tool invocation with its run and its attempt, without and with a sandbox lease, and of the purpose sandbox with a sandbox lease, a fake of the identity platform that validates a subject, revokes a token and can stop answering, fixture publishers of RunCancelled, LeaseExpired and SandboxReleased built from the pinned contracts package, a clock the suite moves, and an in-memory collector of metrics, activities, log records and outbox records; the fixture serves the suites of AIFACTORY-US-953 to AIFACTORY-US-960.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The acceptance suite holds two tenants with two projects each, user tokens of the Governance gateway audience with and without factory.secrets.admin and factory.runs.read, with the role Operator, with the role Observer and with the role Reviewer in one project, with an Observer role assigned at the tenant and with the Platform admin role, workload tokens with and without the service scope naming SecretBrokerService, a fake vault behind the vault port that holds secrets with a marker value in several versions, exchanges a token for an exchangeable identity, records every read and can stop answering, a fake of PolicyEngineService that answers each of the four outcomes of policy-decision-v1, can refuse a request with INVALID_ARGUMENT, records its requests and can stop answering, references of every purpose and of the kind SandboxToken, subjects of a tool invocation with its run and its attempt, without and with a sandbox lease, and of the purpose sandbox with a sandbox lease, a fake of the identity platform that validates a subject, revokes a token and can stop answering, fixture publishers of RunCancelled, LeaseExpired and SandboxReleased built from the pinned contracts package, a clock the suite moves, and an in-memory collector of metrics, activities, log records and outbox records; the fixture serves the suites of AIFACTORY-US-953 to AIFACTORY-US-960."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7604,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3834]",
      "number": 3834
    },
    {
      "id": "AIFACTORY-TASK-3835",
      "type": "task",
      "parent": "AIFACTORY-US-953",
      "title": "Verify tenancy, the vault binding, secret references and telemetry of SecretBrokerService",
      "sequence": "12.02.04.03",
      "description": "Verify tenancy, the vault binding, secret references and telemetry of SecretBrokerService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenancyVaultAndTelemetry\"` and the architecture tests; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-953: 404 and NOT_FOUND for a foreign reference and a foreign issuance equal to the answer for an unknown one, the single vault adapter and the refused second vault, the unready start without a secret reference and the named dependency, the scan of metrics, activities, log records, outbox records and rows for the marker value and for a vaultRef, and the fail-closed refusal of `SecretBrokerService/SecretBroker.Issue` with UNAVAILABLE while the fake vault does not answer.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenancyVaultAndTelemetry\"` and the architecture tests; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-953: 404 and NOT_FOUND for a foreign reference and a foreign issuance equal to the answer for an unknown one, the single vault adapter and the refused second vault, the unready start without a secret reference and the named dependency, the scan of metrics, activities, log records, outbox records and rows for the marker value and for a vaultRef, and the fail-closed refusal of `SecretBrokerService/SecretBroker.Issue` with UNAVAILABLE while the fake vault does not answer."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3835]",
      "number": 3835
    },
    {
      "id": "AIFACTORY-US-954",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "Register a secret reference with its owner, purposes, lifetime and rotation period, and list the references of a tenant without any value",
      "sequence": "12.02.05",
      "description": "A caller whose token carries the scope `factory.secrets.admin`, the Platform admin of a tenant, registers a reference through `SecretBrokerService/RegisterSecretReference` with an `Idempotency-Key`. The body names the `referenceId` under which connections, deployments, pools and hosts will address the secret, the `kind` out of the eight values of `SecretKind`, the `vaultRef` that identifies the secret or key in Azure Key Vault or the identity that can be exchanged for a token, the owner as `ownerKind` (connection, model-deployment, compute-pool, host or webhook-scheme) and `ownerId`, the `allowedPurposes` out of source-sync, tool-call, model-invoke, sandbox, delivery and handshake, the `maxTtlSeconds` and the `rotationDays`. The tenant comes from the trusted scope and never from the body (ADR-0015). A body without `maxTtlSeconds` takes `Governance:Secrets:DefaultMaxTtlSeconds`, the default maximum lifetime of the model, except for a reference of kind SandboxToken, which takes `Governance:Secrets:SandboxTokenTtlSeconds`, the lifetime the model binds to the sandbox lease, so that a sandbox token registered without a lifetime can reach it; `rotationDays` is an input of the owner of the secret and is never defaulted. The body has no member for a secret value and an unknown member is refused, so a value cannot be posted to the service, and the registration reads nothing from the vault: whether the reference resolves is what `SecretBroker.Verify` answers (AIFACTORY-US-959). The service writes the `SecretReference` with `revoked` false and no `lastRotatedAt` together with its `SecretReferenceRegistered` outbox record in one transaction and answers 201 with the metadata of the reference. A repeated call under the same key and the same body returns the same result and writes nothing; the same key with another body is refused with 409, and so is a `referenceId` that the tenant already holds. A body that fails validation, an unknown kind, owner kind or purpose among it, or a call without the key header is refused with 400, a code the model omits and AIFACTORY-US-952 reports; a caller without the scope is refused with 403; no refusal writes or publishes anything. The same caller lists the references of the tenant through `SecretBrokerService/ListSecretReferences` and receives, in pages, what the model names: kind, owner, purposes, `maxTtlSeconds`, `rotationDays`, `lastRotatedAt`, whether a rotation is due, whether the reference is revoked, and the number of its issuances that are Issued. The list never returns a value or a `vaultRef`, and no reference of another tenant appears in it. `SecretReferenceRegistered` carries `referenceId`, `tenantId`, `kind`, `ownerKind` and `ownerId` and is published on `secret-broker.references.v1.secret-reference-registered`; AuditService records it as evidence and StudioBff refreshes its view, each in its own suite. The closed `action` list of `audit-evidence-v1` names no value for a registration, so the service submits no evidence record of its own for it and the event is the evidence of the act; the missing value is reported to the owner. A person reaches these routes through GovernanceHost, which fronts the service from I1 (D127), so the first references of the first outcome are registered through the gateway; no direct route is built, and the suites call the routes with tokens of the gateway audience. Kind: behavior. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference; apis: SecretBrokerService/RegisterSecretReference, SecretBrokerService/ListSecretReferences; events: SecretBrokerService/SecretReferenceRegistered; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FUX-01, NFR-01; scenarios: SCN-SecretBrokerService-001, SCN-SecretBrokerService-002, SCN-SecretBrokerService-009. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953. Sources: model/services/governance/SecretBrokerService.yaml, model/scenarios/SecretBrokerService.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.secrets.admin` and a valid body with an `Idempotency-Key`, when `SecretBrokerService/RegisterSecretReference` is called, then the response is 201 with the metadata of the reference, the `SecretBrokerService/SecretReference` exists in the tenant of the trusted scope with `revoked` false, `maxTtlSeconds` from the body, without one from `Governance:Secrets:DefaultMaxTtlSeconds` and for a reference of kind SandboxToken from `Governance:Secrets:SandboxTokenTtlSeconds`, and the `SecretBrokerService/SecretReferenceRegistered` outbox record was written in the same transaction; the fake vault recorded no read (SCN-SecretBrokerService-002).",
        "AC2: Given the same call repeated with the same key and body, then the same result is returned and no second row or outbox record exists; given the same key with another body or a `referenceId` the tenant already holds, the response is 409; given a body with a member for a value, an unknown kind, owner kind or purpose, no `rotationDays` or no key header, the response is 400; given a caller without the scope, the response is 403; and no refusal of `SecretBrokerService/RegisterSecretReference` writes or publishes anything (SCN-SecretBrokerService-002, ADR-0014).",
        "AC3: Given references of two tenants, some rotated, one revoked and one with two Issued issuances, when `SecretBrokerService/ListSecretReferences` is called by a caller with `factory.secrets.admin`, then the response is 200 with only the references of the tenant of the caller, each with kind, owner, purposes, `maxTtlSeconds`, `rotationDays`, `lastRotatedAt`, the due flag, `revoked` and its count of Issued issuances, and without a value or a `vaultRef`; a caller without the scope is answered 403 and nothing is written (SCN-SecretBrokerService-001, ADR-0015).",
        "AC4: Given a registered reference, when the outbox dispatcher publishes `SecretBrokerService/SecretReferenceRegistered` on `secret-broker.references.v1.secret-reference-registered`, then the event is sent in the run event envelope with `referenceId`, `tenantId`, `kind`, `ownerKind` and `ownerId` and without `vaultRef`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SecretBrokerService-009, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3836",
        "AIFACTORY-TASK-3837",
        "AIFACTORY-TASK-3838"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7605,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference"
        ],
        "apis": [
          "SecretBrokerService/RegisterSecretReference",
          "SecretBrokerService/ListSecretReferences"
        ],
        "events": [
          "SecretBrokerService/SecretReferenceRegistered"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-SecretBrokerService-001",
          "SCN-SecretBrokerService-002",
          "SCN-SecretBrokerService-009"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-954]",
      "number": 954
    },
    {
      "id": "AIFACTORY-TASK-3836",
      "type": "task",
      "parent": "AIFACTORY-US-954",
      "title": "RegisterSecretReference with the idempotency key, the closed body and the SecretReferenceRegistered outbox record",
      "sequence": "12.02.05.01",
      "description": "RegisterSecretReference with the idempotency key, the closed body and the SecretReferenceRegistered outbox record. Expected output: The operation takes the tenant from the trusted scope, validates the body against the closed shape (referenceId, kind, vaultRef, ownerKind, ownerId, allowedPurposes, maxTtlSeconds, rotationDays; no member for a value, unknown members refused), takes Governance:Secrets:DefaultMaxTtlSeconds when maxTtlSeconds is absent, or Governance:Secrets:SandboxTokenTtlSeconds for a reference of kind SandboxToken, and never defaults rotationDays, reads nothing from the vault, writes the SecretReference and its SecretReferenceRegistered outbox record in one transaction and answers 201; the same key with the same body returns the first result, the same key with another body and an existing referenceId of the tenant answer 409, an invalid body and a missing key header answer 400, a missing scope answers 403, and no refusal writes anything.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The operation takes the tenant from the trusted scope, validates the body against the closed shape (referenceId, kind, vaultRef, ownerKind, ownerId, allowedPurposes, maxTtlSeconds, rotationDays; no member for a value, unknown members refused), takes Governance:Secrets:DefaultMaxTtlSeconds when maxTtlSeconds is absent, or Governance:Secrets:SandboxTokenTtlSeconds for a reference of kind SandboxToken, and never defaults rotationDays, reads nothing from the vault, writes the SecretReference and its SecretReferenceRegistered outbox record in one transaction and answers 201; the same key with the same body returns the first result, the same key with another body and an existing referenceId of the tenant answer 409, an invalid body and a missing key header answer 400, a missing scope answers 403, and no refusal writes anything."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3836]",
      "number": 3836
    },
    {
      "id": "AIFACTORY-TASK-3837",
      "type": "task",
      "parent": "AIFACTORY-US-954",
      "title": "ListSecretReferences read model with the rotation flag and the count of Issued issuances",
      "sequence": "12.02.05.02",
      "description": "ListSecretReferences read model with the rotation flag and the count of Issued issuances. Expected output: The read returns the references of the tenant of the caller in pages with kind, owner, purposes, maxTtlSeconds, rotationDays, lastRotatedAt, the due flag computed from lastRotatedAt and rotationDays, revoked and the count of Issued issuances read through IX_Issuances_Reference_State; the response type has no member for a value or a vaultRef; the query runs under the tenant row filter and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The read returns the references of the tenant of the caller in pages with kind, owner, purposes, maxTtlSeconds, rotationDays, lastRotatedAt, the due flag computed from lastRotatedAt and rotationDays, revoked and the count of Issued issuances read through IX_Issuances_Reference_State; the response type has no member for a value or a vaultRef; the query runs under the tenant row filter and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3837]",
      "number": 3837
    },
    {
      "id": "AIFACTORY-TASK-3838",
      "type": "task",
      "parent": "AIFACTORY-US-954",
      "title": "Verify the registration and the list of secret references through the acceptance suite",
      "sequence": "12.02.05.03",
      "description": "Verify the registration and the list of secret references through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-001|Scenario=SCN-SecretBrokerService-002|Scenario=SCN-SecretBrokerService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-954 with the fixture of AIFACTORY-TASK-3834: the 201 with the row and its outbox record in one transaction and no vault read, the lifetime taken from the body, from the default and from the sandbox token setting, the idempotent repeat, the 409, 400 and 403 refusals, the list of one tenant without a value or a vaultRef, and the publication and payload of SecretReferenceRegistered with a transport outage; consumer handling is proven by the suites of AuditService and StudioBff.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-001|Scenario=SCN-SecretBrokerService-002|Scenario=SCN-SecretBrokerService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-954 with the fixture of AIFACTORY-TASK-3834: the 201 with the row and its outbox record in one transaction and no vault read, the lifetime taken from the body, from the default and from the sandbox token setting, the idempotent repeat, the 409, 400 and 403 refusals, the list of one tenant without a value or a vaultRef, and the publication and payload of SecretReferenceRegistered with a transport outage; consumer handling is proven by the suites of AuditService and StudioBff."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3838]",
      "number": 3838
    },
    {
      "id": "AIFACTORY-US-955",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "Issue a short-lived, scoped credential for one subject and one purpose after a policy decision, delivered once and recorded as metadata only",
      "sequence": "12.02.06",
      "description": "A Factory service calls `SecretBrokerService/SecretBroker.Issue` with a workload token that holds the service scope naming SecretBrokerService and forwards the tenant of its work, and the project and the run where it has them. The request names the reference, the subject, the purpose, the narrowed scope and the lifetime it asks for. The subject is the workload identity of the caller together with what it acts for: the run and the attempt, the invocation and the sandbox lease. The model makes none of these members mandatory, and which of them a purpose needs follows from what ends the issuance. A tool call reaches a secret through ToolAdapterService alone. That service asks the broker before it leases a sandbox and leases none for a read-class native tool, whose sandbox kind is None (AIFACTORY-US-605 of feature `tool-adapter-service`). A request for the purpose tool-call therefore names the tool invocation and the run and the attempt it belongs to, the attempt whose lease RunControlService holds, and carries the sandbox lease as an optional member that is recorded in the subject when the invocation already has one; a tool-call request without an invocation, its run or its attempt is refused with INVALID_ARGUMENT. A request for the purpose sandbox, which a reference of kind SandboxToken serves, names the sandbox lease and is refused with INVALID_ARGUMENT without it. Each such issuance has an end besides its lifetime: one whose subject names a sandbox lease ends with `SandboxReleased` for that lease, and one without it ends with `LeaseExpired` for its attempt, with `RunCancelled` for its run, with `SecretBroker.Revoke` or at its expiry (AIFACTORY-US-956). Callers that hold a policy decision for their own call pass its identifier, which is kept with the subject. The service loads the reference under the tenant row filter: an unknown reference and a reference of another tenant are both answered NOT_FOUND (ADR-0015). A revoked reference is refused with FAILED_PRECONDITION, a purpose outside `allowedPurposes` and a subject whose workload identity is not the one of the validated token with PERMISSION_DENIED, and a lifetime above `maxTtlSeconds` of the reference with INVALID_ARGUMENT naming the limit. A request without a lifetime takes `maxTtlSeconds`; a reference of kind SandboxToken takes `Governance:Secrets:SandboxTokenTtlSeconds`, the lifetime of a sandbox token bound to its lease, never above `maxTtlSeconds`. The service then asks `PolicyEngineService/Policy.Decide` whether this subject may use this reference for this purpose, once per issuance, with a `policy-decision-request-v1` whose action has the kind `credential-issuance`, the reference as target and the purpose of the request in `purpose` (D127). The platform bundle allows the purposes tool-call and sandbox, and an issuance that no rule allows is denied, because an action no rule matches is denied (D127). The service issues only when the outcome is `allow`, as the invariant of the aggregate requires; every other outcome is refused with PERMISSION_DENIED and the decision identifier. The service decides no approval and waits for none: whether the call that needs the credential requires an approval was decided by the policy decision of that call before the caller came here. The model admits an issuance for the outcome Allow only, so this delivery refuses `allow-with-constraints`, `allow-with-approval`, `deny` and `prohibited` alike, which fails closed. An answer of `Policy.Decide` that is neither a decision nor UNAVAILABLE is treated as no decision: the call is refused with FAILED_PRECONDITION and the failure class permanent, the refusal is counted by its outcome, the vault is not read and nothing is written. Only then is the credential obtained: the value of the vault object that `vaultRef` names is read from Azure Key Vault, or the identity that `vaultRef` names is exchanged for a token at the identity platform. In one transaction the service writes the `Issuance` in state Issued with `subject`, `purpose`, `scope`, `policyDecisionId` of its own decision, `issuedAt` and `expiresAt`, and the `CredentialIssued` outbox record; after the commit the reply carries the credential, the issuance identifier and the expiry. An issuance leaves exactly one audit entry, the one AuditService records from `CredentialIssued`, which names the policy decision that allowed it; the broker submits no evidence record of its own for an issuance (D126, D135), as for a registration, a rotation and a revocation, whose event is likewise the evidence of the act. The credential is delivered exactly once: it is in no row, no event, no evidence record, no log record and no metric, a failed commit discards it and fails the call, and no operation returns it again. A repeated request is therefore a new issuance with its own decision; an issuance whose reply was lost stays Issued until its expiry or its revocation and is never re-delivered. When PolicyEngineService, Key Vault or the identity platform does not answer, the call fails fast with UNAVAILABLE and the failure class transient, nothing is written and the service does not retry; without a decision no credential issues. `connectsoft.factory.secrets.issuances` counts every issuance and every refusal by tenant, kind, purpose and outcome, `connectsoft.factory.secrets.live_issuances` rises, and `connectsoft.factory.secrets.issue_latency` records the call. `CredentialIssued` carries `issuanceId`, `tenantId`, `referenceId`, `purpose`, the optional `runId`, `expiresAt` and `policyDecisionId`, metadata only, and is published on `secret-broker.issuances.v1.credential-issued`; AuditService, its one consumer, handles it in its own suite. Kind: behavior. Traces: services: SecretBrokerService, PolicyEngineService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; apis: SecretBrokerService/SecretBroker.Issue, PolicyEngineService/Policy.Decide; events: SecretBrokerService/CredentialIssued; descriptors: execution-scope-v1, policy-decision-request-v1, policy-decision-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019; requirements: FR-05, NFR-02; scenarios: SCN-SecretBrokerService-006, SCN-SecretBrokerService-012. Relates: nfrs: NFR-02. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953, AIFACTORY-US-954, feature:policy-engine-service, feature:contracts-package. Sources: model/services/governance/SecretBrokerService.yaml, model/scenarios/SecretBrokerService.yaml, docs/reference/schemas/policy-decision.schema.json, docs/reference/schemas/policy-decision-request.schema.json, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#context-and-boundaries, docs/planes/trust-operations/governance/security.md#fail-closed.",
      "acceptanceCriteria": [
        "AC1: Given a registered reference, a workload with the service scope whose subject names its own identity and a decision of `allow` from `PolicyEngineService/Policy.Decide`, when `SecretBrokerService/SecretBroker.Issue` is called for an allowed purpose, among them the purpose tool-call with an invocation, its run and its attempt and without a sandbox lease, the same with a sandbox lease, and the purpose sandbox with a sandbox lease, then the reply carries the credential read from the vault, the issuance identifier and an expiry not above `maxTtlSeconds`, the `SecretBrokerService/Issuance` is Issued with `subject`, `purpose`, `scope` and the `policyDecisionId` of that decision, its subject holding a sandbox lease only when the request named one, the request of the decision carried the action kind `credential-issuance` and the purpose, the `SecretBrokerService/CredentialIssued` outbox record was written in the same transaction without the credential, and the service wrote no evidence record of its own for the issuance (SCN-SecretBrokerService-006, ADR-0014).",
        "AC2: Given an issuance was delivered, when the same request is sent again, then a second `SecretBrokerService/Issuance` with its own decision exists and no operation of the service returns the credential of the first again; given the commit of an issuance fails, then the call fails, nothing is delivered and no row exists; given the reply is lost, then the issuance stays Issued until its expiry and is never re-delivered (SCN-SecretBrokerService-006).",
        "AC3: Given a call to `SecretBrokerService/SecretBroker.Issue` without a workload identity, with a token that lacks the service scope, with a subject that names another workload identity, for a purpose outside `allowedPurposes`, with a decision other than `allow`, with a lifetime above `maxTtlSeconds`, for the purpose tool-call without an invocation, its run or its attempt, for the purpose sandbox without a sandbox lease, for an unknown reference or one of another tenant, or for a revoked reference, when it arrives, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED four times, INVALID_ARGUMENT three times, NOT_FOUND and FAILED_PRECONDITION respectively, no credential is read from the vault after a refusal by policy, no row or event is written, and `connectsoft.factory.secrets.issuances` counts the refusal (SCN-SecretBrokerService-006, ADR-0015).",
        "AC4: Given `PolicyEngineService/Policy.Decide`, Key Vault or the identity platform does not answer, when `SecretBrokerService/SecretBroker.Issue` is called, then it fails fast with UNAVAILABLE and the failure class transient, the fakes record one call and no repetition by the service, and no `SecretBrokerService/Issuance` or outbox record exists; given `PolicyEngineService/Policy.Decide` refuses the request with a status that is neither a decision nor UNAVAILABLE, then the call is refused with FAILED_PRECONDITION and the failure class permanent, `connectsoft.factory.secrets.issuances` counts the refusal by its outcome, the fake vault recorded no read and nothing is written; and given the decision answers `deny` for a purpose no rule allows, such as delivery under the platform bundle alone, then the call is refused with PERMISSION_DENIED and the decision identifier (SCN-SecretBrokerService-006, docs/planes/trust-operations/governance/security.md).",
        "AC5: Given an issuance was committed, when the outbox dispatcher publishes `SecretBrokerService/CredentialIssued` on `secret-broker.issuances.v1.credential-issued`, then the event is sent in the run event envelope with `issuanceId`, `tenantId`, `referenceId`, `purpose`, `expiresAt`, `policyDecisionId` and, for a subject that names a run, `runId`, it holds no credential and no `vaultRef`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SecretBrokerService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#context-and-boundaries",
        "docs/planes/trust-operations/governance/security.md#fail-closed"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3839",
        "AIFACTORY-TASK-3840",
        "AIFACTORY-TASK-3841"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7606,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/SecretBroker.Issue",
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "SecretBrokerService/CredentialIssued"
        ],
        "descriptors": [
          "execution-scope-v1",
          "policy-decision-request-v1",
          "policy-decision-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-SecretBrokerService-006",
          "SCN-SecretBrokerService-012"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-02"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-954",
        "feature:policy-engine-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#context-and-boundaries",
        "docs/planes/trust-operations/governance/security.md#fail-closed"
      ],
      "titlePrefix": "[AIFACTORY-US-955]",
      "number": 955
    },
    {
      "id": "AIFACTORY-TASK-3839",
      "type": "task",
      "parent": "AIFACTORY-US-955",
      "title": "Policy client port and the decision request of an issuance",
      "sequence": "12.02.06.01",
      "description": "Policy client port and the decision request of an issuance. Expected output: A typed gRPC client of Policy.Decide behind one port; the request is a policy-decision-request-v1 document whose subject is the workload identity of the caller with the forwarded tenant and project and whose action has the kind credential-issuance, the reference as target and the purpose of the issuance in purpose, as docs/reference/schemas/policy-decision-request.schema.json fixes it (D127); a golden file fixes the request; the port returns the outcome and the decision identifier, maps a dependency that does not answer to the failure class transient and maps an answer that is neither a decision nor UNAVAILABLE to no decision with the failure class permanent; only the outcome allow admits an issuance and every other outcome is refused.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "A typed gRPC client of Policy.Decide behind one port; the request is a policy-decision-request-v1 document whose subject is the workload identity of the caller with the forwarded tenant and project and whose action has the kind credential-issuance, the reference as target and the purpose of the issuance in purpose, as docs/reference/schemas/policy-decision-request.schema.json fixes it (D127); a golden file fixes the request; the port returns the outcome and the decision identifier, maps a dependency that does not answer to the failure class transient and maps an answer that is neither a decision nor UNAVAILABLE to no decision with the failure class permanent; only the outcome allow admits an issuance and every other outcome is refused."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7606,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3839]",
      "number": 3839
    },
    {
      "id": "AIFACTORY-TASK-3840",
      "type": "task",
      "parent": "AIFACTORY-US-955",
      "title": "SecretBroker.Issue with the subject, purpose and lifetime checks, the decision, the vault read or token exchange and the single delivery",
      "sequence": "12.02.06.02",
      "description": "SecretBroker.Issue with the subject, purpose and lifetime checks, the decision, the vault read or token exchange and the single delivery. Expected output: The method validates the request, loads the reference under the tenant row filter, refuses a revoked reference, a purpose outside allowedPurposes, a foreign workload identity in the subject, a lifetime above maxTtlSeconds, a tool-call purpose without an invocation, its run and its attempt and a sandbox purpose without a sandbox lease, records the sandbox lease of a tool-call request in the subject when the request names one, takes Governance:Secrets:SandboxTokenTtlSeconds for a reference of kind SandboxToken, asks the policy port once, refuses with FAILED_PRECONDITION and the failure class permanent and without a vault read when the port returns no decision, reads the value from Azure Key Vault through the vault port or exchanges the identity at the identity platform, writes the Issuance in state Issued and its CredentialIssued outbox record with policyDecisionId in one transaction and no evidence record of its own (D126, D135), and returns the credential, the issuance identifier and the expiry once; the credential is held in memory until the reply and written nowhere; a failed commit discards it; a dependency that does not answer fails the call with UNAVAILABLE without a retry; the three instruments of the hot path are recorded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The method validates the request, loads the reference under the tenant row filter, refuses a revoked reference, a purpose outside allowedPurposes, a foreign workload identity in the subject, a lifetime above maxTtlSeconds, a tool-call purpose without an invocation, its run and its attempt and a sandbox purpose without a sandbox lease, records the sandbox lease of a tool-call request in the subject when the request names one, takes Governance:Secrets:SandboxTokenTtlSeconds for a reference of kind SandboxToken, asks the policy port once, refuses with FAILED_PRECONDITION and the failure class permanent and without a vault read when the port returns no decision, reads the value from Azure Key Vault through the vault port or exchanges the identity at the identity platform, writes the Issuance in state Issued and its CredentialIssued outbox record with policyDecisionId in one transaction and no evidence record of its own (D126, D135), and returns the credential, the issuance identifier and the expiry once; the credential is held in memory until the reply and written nowhere; a failed commit discards it; a dependency that does not answer fails the call with UNAVAILABLE without a retry; the three instruments of the hot path are recorded."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7606,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3840]",
      "number": 3840
    },
    {
      "id": "AIFACTORY-TASK-3841",
      "type": "task",
      "parent": "AIFACTORY-US-955",
      "title": "Verify the issuance, its refusals and its event through the acceptance suite",
      "sequence": "12.02.06.03",
      "description": "Verify the issuance, its refusals and its event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-006|Scenario=SCN-SecretBrokerService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-955 with the fakes of AIFACTORY-TASK-3834: the delivered credential with the Issued row and the CredentialIssued record in one transaction and no evidence record of the broker, the decision request with the kind credential-issuance and the purpose, the tool-call issuance without and with a sandbox lease and the sandbox issuance with one, the second issuance for a repeated request and no re-delivery, each refusal of AC3 with its status and no vault read after a refusal by policy, UNAVAILABLE without a retry while the policy fake, the fake vault or the identity fake does not answer, FAILED_PRECONDITION without a vault read when the policy fake refuses the request with a status that is no decision, PERMISSION_DENIED for a purpose the policy denies, and the publication and payload of CredentialIssued with policyDecisionId under a transport outage; consumer handling is proven by the suite of AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-006|Scenario=SCN-SecretBrokerService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-955 with the fakes of AIFACTORY-TASK-3834: the delivered credential with the Issued row and the CredentialIssued record in one transaction and no evidence record of the broker, the decision request with the kind credential-issuance and the purpose, the tool-call issuance without and with a sandbox lease and the sandbox issuance with one, the second issuance for a repeated request and no re-delivery, each refusal of AC3 with its status and no vault read after a refusal by policy, UNAVAILABLE without a retry while the policy fake, the fake vault or the identity fake does not answer, FAILED_PRECONDITION without a vault read when the policy fake refuses the request with a status that is no decision, PERMISSION_DENIED for a purpose the policy denies, and the publication and payload of CredentialIssued with policyDecisionId under a transport outage; consumer handling is proven by the suite of AuditService."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7606,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3841]",
      "number": 3841
    },
    {
      "id": "AIFACTORY-US-956",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "Revoke an issuance on request, when its run is cancelled, when its lease expires or its sandbox is released, and mark it expired at the end of its lifetime",
      "sequence": "12.02.07",
      "description": "An issuance never outlives its lease or its lifetime, and this PBI delivers every way it ends. The first is the request of a caller. A service with a workload token that holds the service scope calls `SecretBrokerService/SecretBroker.Revoke` with the issuance identifier and a reason, because the lease ended, the work was cancelled or an incident occurred; the last is the case of a credential that a redaction detector found in a tool result, where ToolAdapterService revokes at once. The service moves the `Issuance` from Issued to Revoked with `revokedAt` and writes the `CredentialRevoked` outbox record in the same transaction, `connectsoft.factory.secrets.live_issuances` falls, and the reply is `ack-v1`. Where the provider supports it, the credential is then withdrawn at the provider: a token obtained by exchange is revoked at the identity platform, while a value read from the vault cannot be withdrawn for one issuance and ends with its expiry or with a rotation. A provider that does not answer does not undo the revocation: the record stays Revoked, the failed withdrawal is logged and counted, and the bounded lifetime ends the credential at `expiresAt` at the latest. A revocation of an issuance that is already Revoked or Expired is acknowledged and changes nothing; an unknown issuance and an issuance of another tenant are answered NOT_FOUND (ADR-0015), a call without a workload identity UNAUTHENTICATED, a token without the service scope PERMISSION_DENIED and a request without an issuance identifier INVALID_ARGUMENT. The second way is the end of what the issuance was bound to, announced by an event and applied by an inbox handler, each idempotent on the event id. `RevokeRunIssuances` handles `RunCancelled` of RunControlService and revokes every Issued issuance whose subject names the run. `RevokeLeaseIssuances` handles `LeaseExpired` and revokes the Issued issuances whose subject names the attempt of the expired lease. `RevokeSandboxIssuances` handles `SandboxReleased` of ToolAdapterService and revokes the Issued issuances whose subject names the released sandbox lease. A tool-call issuance made before a sandbox was leased names no sandbox lease and is therefore never matched by `SandboxReleased`: it ends with `LeaseExpired` for its attempt, with `RunCancelled` for its run, with a call of the method or at its expiry. ToolAdapterService issues before it leases (AIFACTORY-US-605 of feature `tool-adapter-service`), so `RevokeSandboxIssuances` matches only the issuances made while a lease of the attempt was already open and those of the purpose sandbox; this, and the absence of a consumed event for the regular end of an attempt, after which such an issuance lives until ToolAdapterService revokes it or it expires, are reported to the owner. Each handler acts inside the tenant of the envelope and revokes with the same transaction and event as the method; an event that matches no Issued issuance changes nothing, and a handler that keeps failing is retried by the inbox and never applied twice. The third way is the lifetime. `ExpirySweeper`, hosted by AIFACTORY-US-952 every minute, selects through `IX_Issuances_Expiry` the Issued issuances whose `expiresAt` has passed and, in one transaction per issuance under the idempotency key `issuanceId`, moves it to Expired and writes the `CredentialRevoked` outbox record with `issuanceId`, `tenantId` and the reason expired, because the worker row of the model lists that event as the output of the sweeper; the state stays Expired and `revokedAt` stays empty. `connectsoft.factory.secrets.live_issuances` falls, and the worker then asks the provider to withdraw the credential where it supports that: a token obtained by exchange is revoked at the identity platform, and a provider that does not answer leaves the issuance Expired, with the failed withdrawal logged and counted. The summary of the event in the model says it announces a revocation before expiry, which contradicts the worker row. This delivery follows the worker row, so that an expiry leaves evidence in AuditService, which consumes the event, and the contradiction is reported to the owner as a correction of the model. The model also names a finding for a leaked credential and a handler `ExecuteDeletionOrder`: the finding has no modelled path from this service to the Audit service, which is reported, and the deletion-order handler is built in I4 with RetentionResidencyService and is not registered here. `CredentialRevoked` carries `issuanceId`, `tenantId` and `reason` and is published on `secret-broker.issuances.v1.credential-revoked`; AuditService records it as evidence in its own suite. The service never retries a revocation on its own beyond the retry policy of the inbox and of the worker. Kind: behavior. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/Issuance; apis: SecretBrokerService/SecretBroker.Revoke; events: SecretBrokerService/CredentialRevoked, RunControlService/RunCancelled, RunControlService/LeaseExpired, ToolAdapterService/SandboxReleased; descriptors: ack-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0015; requirements: FR-05, NFR-02; scenarios: SCN-SecretBrokerService-007, SCN-SecretBrokerService-013. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953, AIFACTORY-US-955, feature:run-control-service, feature:tool-adapter-service, feature:contracts-package. Sources: model/services/governance/SecretBrokerService.yaml, model/scenarios/SecretBrokerService.yaml, model/services/control-plane/RunControlService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given an Issued `SecretBrokerService/Issuance` and a workload with the service scope, when `SecretBrokerService/SecretBroker.Revoke` is called with its identifier and a reason, then the reply is `ack-v1`, the issuance is Revoked with `revokedAt`, the `SecretBrokerService/CredentialRevoked` outbox record was written in the same transaction, `connectsoft.factory.secrets.live_issuances` fell, a token obtained by exchange was revoked at the identity fake, and a provider that does not answer leaves the issuance Revoked (SCN-SecretBrokerService-007).",
        "AC2: Given an issuance that is already Revoked or Expired, when `SecretBrokerService/SecretBroker.Revoke` is called, then it is acknowledged and no row changes and no event is written; given an unknown issuance or one of another tenant, the answer is NOT_FOUND; given no workload identity, a token without the service scope or no issuance identifier, the answer is UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT, and nothing changes (SCN-SecretBrokerService-007, ADR-0015).",
        "AC3: Given Issued issuances whose subjects name a run, an attempt and a sandbox lease, and a tool-call issuance of that attempt whose subject names no sandbox lease, when the fixture publishes, each in a case of its own, `RunControlService/RunCancelled` for the run, `RunControlService/LeaseExpired` for the lease of the attempt and `ToolAdapterService/SandboxReleased` for the sandbox lease, then exactly the issuances bound to each are Revoked with one `SecretBrokerService/CredentialRevoked` each, the issuance without a sandbox lease is untouched by the release and revoked by the expiry of the lease of its attempt, an event delivered twice under one event id has no second effect, an event that matches no Issued issuance changes nothing, and issuances of another tenant with the same identifiers in their subjects are untouched.",
        "AC4: Given Issued issuances, some past their `expiresAt`, when `ExpirySweeper` runs, then exactly those past their expiry are Expired with `revokedAt` empty, one `SecretBrokerService/CredentialRevoked` with `issuanceId`, `tenantId` and the reason expired was written for each in the transaction of its change, `connectsoft.factory.secrets.live_issuances` fell by their number, a token obtained by exchange was withdrawn at the identity fake, a provider that does not answer leaves the issuance Expired, a second run under the same `issuanceId` changes nothing and writes no second event, a failing run is repeated at most three times thirty seconds apart, and `SecretBrokerService/SecretBroker.Revoke` on an Expired issuance is acknowledged without a change (model/services/governance/SecretBrokerService.yaml).",
        "AC5: Given an issuance was revoked, when the outbox dispatcher publishes `SecretBrokerService/CredentialRevoked` on `secret-broker.issuances.v1.credential-revoked`, then the event is sent in the run event envelope with `issuanceId`, `tenantId` and `reason`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SecretBrokerService-013, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3842",
        "AIFACTORY-TASK-3843",
        "AIFACTORY-TASK-3844",
        "AIFACTORY-TASK-3845"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7607,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/SecretBroker.Revoke"
        ],
        "events": [
          "SecretBrokerService/CredentialRevoked",
          "RunControlService/RunCancelled",
          "RunControlService/LeaseExpired",
          "ToolAdapterService/SandboxReleased"
        ],
        "descriptors": [
          "ack-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FR-05",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-SecretBrokerService-007",
          "SCN-SecretBrokerService-013"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-955",
        "feature:run-control-service",
        "feature:tool-adapter-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-956]",
      "number": 956
    },
    {
      "id": "AIFACTORY-TASK-3842",
      "type": "task",
      "parent": "AIFACTORY-US-956",
      "title": "SecretBroker.Revoke with the CredentialRevoked outbox record and the withdrawal at the provider",
      "sequence": "12.02.07.01",
      "description": "SecretBroker.Revoke with the CredentialRevoked outbox record and the withdrawal at the provider. Expected output: The method moves an Issued issuance of the forwarded tenant to Revoked with revokedAt and writes CredentialRevoked with issuanceId, tenantId and reason in one transaction, replies ack-v1, lets connectsoft.factory.secrets.live_issuances fall, then revokes a token obtained by exchange at the identity platform and logs and counts a withdrawal the provider did not answer without undoing the record; a Revoked or Expired issuance is acknowledged without a change, an unknown or foreign one is answered NOT_FOUND and a request without an identifier INVALID_ARGUMENT; one revocation routine serves the method, the three handlers and the rotation and revocation of a reference.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The method moves an Issued issuance of the forwarded tenant to Revoked with revokedAt and writes CredentialRevoked with issuanceId, tenantId and reason in one transaction, replies ack-v1, lets connectsoft.factory.secrets.live_issuances fall, then revokes a token obtained by exchange at the identity platform and logs and counts a withdrawal the provider did not answer without undoing the record; a Revoked or Expired issuance is acknowledged without a change, an unknown or foreign one is answered NOT_FOUND and a request without an identifier INVALID_ARGUMENT; one revocation routine serves the method, the three handlers and the rotation and revocation of a reference."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7607,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3842]",
      "number": 3842
    },
    {
      "id": "AIFACTORY-TASK-3843",
      "type": "task",
      "parent": "AIFACTORY-US-956",
      "title": "Inbox handlers RevokeRunIssuances, RevokeLeaseIssuances and RevokeSandboxIssuances",
      "sequence": "12.02.07.02",
      "description": "Inbox handlers RevokeRunIssuances, RevokeLeaseIssuances and RevokeSandboxIssuances. Expected output: The handler of RunCancelled revokes every Issued issuance whose subject names the run, the handler of LeaseExpired those whose subject names the attempt of the expired lease, and the handler of SandboxReleased those whose subject names the released sandbox lease, so that a tool-call issuance without a sandbox lease in its subject is matched by the handlers of LeaseExpired and RunCancelled only, each inside the tenant of the envelope, through the revocation routine of AIFACTORY-TASK-3842 and idempotently on the event id; an event that matches nothing changes nothing; no handler of DeletionOrderIssued exists, because it is built in I4 with RetentionResidencyService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The handler of RunCancelled revokes every Issued issuance whose subject names the run, the handler of LeaseExpired those whose subject names the attempt of the expired lease, and the handler of SandboxReleased those whose subject names the released sandbox lease, so that a tool-call issuance without a sandbox lease in its subject is matched by the handlers of LeaseExpired and RunCancelled only, each inside the tenant of the envelope, through the revocation routine of AIFACTORY-TASK-3842 and idempotently on the event id; an event that matches nothing changes nothing; no handler of DeletionOrderIssued exists, because it is built in I4 with RetentionResidencyService."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7607,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3843]",
      "number": 3843
    },
    {
      "id": "AIFACTORY-TASK-3844",
      "type": "task",
      "parent": "AIFACTORY-US-956",
      "title": "ExpirySweeper marks issuances past their lifetime as Expired and writes CredentialRevoked with the reason expired",
      "sequence": "12.02.07.03",
      "description": "ExpirySweeper marks issuances past their lifetime as Expired and writes CredentialRevoked with the reason expired. Expected output: On its schedule the worker selects through IX_Issuances_Expiry the Issued issuances past expiresAt, per tenant partition with at most four in parallel, and in one transaction per issuance under the idempotency key issuanceId moves it to Expired, with revokedAt empty, and writes CredentialRevoked with issuanceId, tenantId and the reason expired, as the worker row of model/services/governance/SecretBrokerService.yaml lists the event as its output; it lets connectsoft.factory.secrets.live_issuances fall and then revokes a token obtained by exchange at the identity platform, a provider that does not answer leaving the issuance Expired with the failed withdrawal logged and counted; the summary of the event, a revocation before expiry, contradicts the worker row and is reported as a correction of the model; a failing run is repeated three times thirty seconds apart and a second run for the same issuance changes nothing and writes no second event.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "On its schedule the worker selects through IX_Issuances_Expiry the Issued issuances past expiresAt, per tenant partition with at most four in parallel, and in one transaction per issuance under the idempotency key issuanceId moves it to Expired, with revokedAt empty, and writes CredentialRevoked with issuanceId, tenantId and the reason expired, as the worker row of model/services/governance/SecretBrokerService.yaml lists the event as its output; it lets connectsoft.factory.secrets.live_issuances fall and then revokes a token obtained by exchange at the identity platform, a provider that does not answer leaving the issuance Expired with the failed withdrawal logged and counted; the summary of the event, a revocation before expiry, contradicts the worker row and is reported as a correction of the model; a failing run is repeated three times thirty seconds apart and a second run for the same issuance changes nothing and writes no second event."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7607,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3844]",
      "number": 3844
    },
    {
      "id": "AIFACTORY-TASK-3845",
      "type": "task",
      "parent": "AIFACTORY-US-956",
      "title": "Verify the revocation, the three handlers, the expiry sweep and the event through the acceptance suite",
      "sequence": "12.02.07.04",
      "description": "Verify the revocation, the three handlers, the expiry sweep and the event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-007|Scenario=SCN-SecretBrokerService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-956 with the fixture of AIFACTORY-TASK-3834: the revocation with its outbox record in one transaction and the withdrawal at the identity fake, the acknowledged repeat, NOT_FOUND for an unknown and a foreign issuance, the issuances revoked by fixture events of RunCancelled, LeaseExpired and SandboxReleased with redeliveries and a second tenant, the tool-call issuance without a sandbox lease that the release leaves and the expiry of the lease of its attempt revokes, the sweep of expired issuances under a moved clock with one CredentialRevoked of the reason expired each, the withdrawal at the identity fake on expiry and the provider that does not answer, and the publication and payload of CredentialRevoked with a transport outage; consumer handling is proven by the suite of AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-007|Scenario=SCN-SecretBrokerService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-956 with the fixture of AIFACTORY-TASK-3834: the revocation with its outbox record in one transaction and the withdrawal at the identity fake, the acknowledged repeat, NOT_FOUND for an unknown and a foreign issuance, the issuances revoked by fixture events of RunCancelled, LeaseExpired and SandboxReleased with redeliveries and a second tenant, the tool-call issuance without a sandbox lease that the release leaves and the expiry of the lease of its attempt revokes, the sweep of expired issuances under a moved clock with one CredentialRevoked of the reason expired each, the withdrawal at the identity fake on expiry and the provider that does not answer, and the publication and payload of CredentialRevoked with a transport outage; consumer handling is proven by the suite of AuditService."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7607,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3845]",
      "number": 3845
    },
    {
      "id": "AIFACTORY-US-957",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "Record the rotation of a secret to a new vault version, revoke the live issuances of the old one and count the references whose rotation is due",
      "sequence": "12.02.08",
      "description": "A caller whose token carries `factory.secrets.admin` records a rotation through `SecretBrokerService/RotateSecret` with an `Idempotency-Key`. The secret itself is rotated where it lives, in Azure Key Vault or at its provider; the body names the new vault version, and the service never receives, reads or writes a value for it. In one transaction the service replaces `vaultRef` of the `SecretReference` by the new version, sets `lastRotatedAt`, writes a row to `RotationReceipts` with `RotatedAt`, `RotatedBy`, the caller of the trusted scope, and `PreviousVersionRef`, revokes every Issued issuance of the reference, each with its `CredentialRevoked` outbox record as AIFACTORY-US-956 defines the revocation, and writes the `SecretRotated` outbox record; the answer is 200 with the metadata of the reference. From then on an issuance reads the new version, and the old version is never read again. A repeated call under the same key and the same body returns the same result and writes no second receipt. The reference is addressed by the path: an unknown `referenceId` and a reference of another tenant are answered 404 (ADR-0015), and a caller without the scope 403. Three answers are codes the model omits for this operation and AIFACTORY-US-952 reports: 400 for a body without the new version or a call without the key header, and 409 for the same key with another body and for a revoked reference, which is never rotated. The second part is the schedule. `RotationScheduler`, hosted by AIFACTORY-US-952 daily, finds the references that are past their rotation period, which is `lastRotatedAt` plus `rotationDays`, and sets `connectsoft.factory.secrets.rotation_due` per tenant to their number, so that an overdue rotation is visible. The model adds that the worker rotates on its own the kinds the vault can rotate and lists no such kind. The set of kinds is therefore one setting of the service that names no kind until the owner fills it: for a reference of a named kind the worker asks the vault port for the current version of the vault object, and when the vault holds a newer version than `vaultRef` it records the rotation exactly as the operation does, with the identity of the worker as `RotatedBy`, under the idempotency key of reference and day. The worker never writes a value. Four points the model leaves open are reported to the owner and decided nowhere here: which kinds the vault rotates, to whom the rotation tasks the worker raises are addressed, since the model names no event and no receiver for them, from which time the rotation period of a reference that was never rotated counts, since `SecretReferences` has no registration time and this delivery counts such a reference as not yet due, and which path turns an overdue rotation into the finding the Audit service names. `SecretRotated` carries `referenceId`, `tenantId` and `rotatedAt` and is published on `secret-broker.references.v1.secret-rotated`; IntegrationService, ModelRouterService and ComputePoolService use the new version for their next calls and AuditService records the event as evidence, each in its own suite. The closed `action` list of `audit-evidence-v1` names no value for a rotation, so the event is the evidence of the act and the missing value is reported. Kind: behavior. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; apis: SecretBrokerService/RotateSecret, SecretBrokerService/SecretBroker.Issue; events: SecretBrokerService/SecretRotated, SecretBrokerService/CredentialRevoked; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: NFR-02; scenarios: SCN-SecretBrokerService-003, SCN-SecretBrokerService-010. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953, AIFACTORY-US-954, AIFACTORY-US-955, AIFACTORY-US-956. Sources: model/services/governance/SecretBrokerService.yaml, model/scenarios/SecretBrokerService.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a reference with two Issued issuances and a caller with `factory.secrets.admin`, when `SecretBrokerService/RotateSecret` is called with the new vault version and an `Idempotency-Key`, then the response is 200, the `SecretBrokerService/SecretReference` holds the new `vaultRef` and `lastRotatedAt`, one row of `RotationReceipts` holds `RotatedBy` and `PreviousVersionRef`, both issuances are Revoked with one `SecretBrokerService/CredentialRevoked` each, and the `SecretBrokerService/SecretRotated` outbox record was written in the same transaction; the fake vault recorded no read and no write (SCN-SecretBrokerService-003).",
        "AC2: Given the same call repeated with the same key and body, then the same result is returned and no second receipt, revocation or event exists; given the same key with another body or a revoked reference, the response is 409; given no new version or no key header, 400; given an unknown `referenceId` or a reference of another tenant, 404; given a caller without the scope, 403; and no refusal of `SecretBrokerService/RotateSecret` writes or publishes anything (SCN-SecretBrokerService-003, ADR-0014, ADR-0015).",
        "AC3: Given a recorded rotation, when `SecretBrokerService/SecretBroker.Issue` is called for the reference, then the fake vault records a read of the new version only, and no later call reads the version that `PreviousVersionRef` names (model/services/governance/SecretBrokerService.yaml).",
        "AC4: Given references of two tenants, some past `lastRotatedAt` plus `rotationDays`, one never rotated and one revoked, when `RotationScheduler` runs, then `connectsoft.factory.secrets.rotation_due` holds the number of due references per tenant and counts neither the never rotated nor the revoked one; with no kind configured nothing is rotated; with the kind of a due reference configured and a newer version in the fake vault, one receipt with the worker as `RotatedBy` and one `SecretBrokerService/SecretRotated` are written, and a second run on the same day changes nothing (model/services/governance/SecretBrokerService.yaml).",
        "AC5: Given a recorded rotation, when the outbox dispatcher publishes `SecretBrokerService/SecretRotated` on `secret-broker.references.v1.secret-rotated`, then the event is sent in the run event envelope with `referenceId`, `tenantId` and `rotatedAt` and without a vault version, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SecretBrokerService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3846",
        "AIFACTORY-TASK-3847",
        "AIFACTORY-TASK-3848"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7608,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/RotateSecret",
          "SecretBrokerService/SecretBroker.Issue"
        ],
        "events": [
          "SecretBrokerService/SecretRotated",
          "SecretBrokerService/CredentialRevoked"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "NFR-02"
        ],
        "scenarios": [
          "SCN-SecretBrokerService-003",
          "SCN-SecretBrokerService-010"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-954",
        "AIFACTORY-US-955",
        "AIFACTORY-US-956"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-957]",
      "number": 957
    },
    {
      "id": "AIFACTORY-TASK-3846",
      "type": "task",
      "parent": "AIFACTORY-US-957",
      "title": "RotateSecret with the rotation receipt, the revocation of live issuances and the SecretRotated outbox record",
      "sequence": "12.02.08.01",
      "description": "RotateSecret with the rotation receipt, the revocation of live issuances and the SecretRotated outbox record. Expected output: The operation replaces vaultRef by the new version of the body, sets lastRotatedAt, writes the RotationReceipts row with RotatedAt, RotatedBy and PreviousVersionRef, revokes every Issued issuance of the reference through the revocation routine of AIFACTORY-TASK-3842 and writes SecretRotated with referenceId, tenantId and rotatedAt, all in one transaction, and answers 200; it reads and writes no value; the same key with the same body returns the first result, the same key with another body and a revoked reference answer 409, a missing version or key header 400, an unknown or foreign reference 404 and a missing scope 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The operation replaces vaultRef by the new version of the body, sets lastRotatedAt, writes the RotationReceipts row with RotatedAt, RotatedBy and PreviousVersionRef, revokes every Issued issuance of the reference through the revocation routine of AIFACTORY-TASK-3842 and writes SecretRotated with referenceId, tenantId and rotatedAt, all in one transaction, and answers 200; it reads and writes no value; the same key with the same body returns the first result, the same key with another body and a revoked reference answer 409, a missing version or key header 400, an unknown or foreign reference 404 and a missing scope 403."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7608,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3846]",
      "number": 3846
    },
    {
      "id": "AIFACTORY-TASK-3847",
      "type": "task",
      "parent": "AIFACTORY-US-957",
      "title": "RotationScheduler counts due references and records the rotations of the kinds configured for vault rotation",
      "sequence": "12.02.08.02",
      "description": "RotationScheduler counts due references and records the rotations of the kinds configured for vault rotation. Expected output: On its daily schedule the worker computes per tenant the references past lastRotatedAt plus rotationDays, leaves a never rotated and a revoked reference out, and sets connectsoft.factory.secrets.rotation_due; for a due reference whose kind the setting of vault-rotated kinds names, a setting that names no kind by default, it reads the current version of the vault object through the vault port and, when it is newer than vaultRef, records the rotation through the routine of AIFACTORY-TASK-3846 with the worker identity as RotatedBy, under the idempotency key of reference and day and with two attempts six hundred seconds apart; it writes no value and raises no message the model does not name.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "On its daily schedule the worker computes per tenant the references past lastRotatedAt plus rotationDays, leaves a never rotated and a revoked reference out, and sets connectsoft.factory.secrets.rotation_due; for a due reference whose kind the setting of vault-rotated kinds names, a setting that names no kind by default, it reads the current version of the vault object through the vault port and, when it is newer than vaultRef, records the rotation through the routine of AIFACTORY-TASK-3846 with the worker identity as RotatedBy, under the idempotency key of reference and day and with two attempts six hundred seconds apart; it writes no value and raises no message the model does not name."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7608,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3847]",
      "number": 3847
    },
    {
      "id": "AIFACTORY-TASK-3848",
      "type": "task",
      "parent": "AIFACTORY-US-957",
      "title": "Verify the rotation, the rotation schedule and the event through the acceptance suite",
      "sequence": "12.02.08.03",
      "description": "Verify the rotation, the rotation schedule and the event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-003|Scenario=SCN-SecretBrokerService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-957 with the fixture of AIFACTORY-TASK-3834: the rotation with its receipt, the revoked issuances and the SecretRotated record in one transaction, the idempotent repeat, the 409, 400, 404 and 403 refusals, the read of the new version only by the next issuance, the gauge and the configured rotation of RotationScheduler under a moved clock with a second run on the same day, and the publication and payload of SecretRotated with a transport outage; consumer handling is proven by the suites of IntegrationService, ModelRouterService, ComputePoolService and AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-003|Scenario=SCN-SecretBrokerService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-957 with the fixture of AIFACTORY-TASK-3834: the rotation with its receipt, the revoked issuances and the SecretRotated record in one transaction, the idempotent repeat, the 409, 400, 404 and 403 refusals, the read of the new version only by the next issuance, the gauge and the configured rotation of RotationScheduler under a moved clock with a second run on the same day, and the publication and payload of SecretRotated with a transport outage; consumer handling is proven by the suites of IntegrationService, ModelRouterService, ComputePoolService and AuditService."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7608,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3848]",
      "number": 3848
    },
    {
      "id": "AIFACTORY-US-958",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "Revoke a secret reference with a reason, revoke every live issuance from it and refuse every later use",
      "sequence": "12.02.09",
      "description": "A caller whose token carries `factory.secrets.admin` revokes a reference through `SecretBrokerService/RevokeSecretReference` with a reason. The reference is addressed by the path under the tenant row filter: an unknown `referenceId` and a reference of another tenant are answered 404, the same answer for both (ADR-0015), and a caller without the scope 403. In one transaction the service sets `revoked` on the `SecretReference`, revokes every Issued issuance of the reference, each with its `CredentialRevoked` outbox record as AIFACTORY-US-956 defines the revocation, and writes the `SecretReferenceRevoked` outbox record with the reason; the answer is 200 with the metadata of the reference. The invariant of the aggregate is thereby kept: revoking a reference invalidates every live issuance and emits an event the owners act on. The operation has natural idempotency: a repeated revocation of a revoked reference answers 200 and writes no second event and no second revocation. A body without a reason is refused with 400, a code the model omits and AIFACTORY-US-952 reports, because the event carries the reason. The revocation is final. No operation of the service clears it, a later `SecretBroker.Issue` for the reference is refused with FAILED_PRECONDITION, a later `RotateSecret` with 409, `SecretBroker.Verify` reports the reference as revoked without a call to the vault, and `ListSecretReferences` shows it revoked with no Issued issuance. The service does not touch the secret in the vault: disabling or deleting the vault object is an act of its owner in the vault, and the service reads the object no more. `SecretReferenceRevoked` carries `referenceId`, `tenantId` and `reason` and is published on `secret-broker.references.v1.secret-reference-revoked`. Its consumers act in their own suites: IntegrationService suspends the connections that depend on the reference, ModelRouterService takes the deployments out of routing, ComputePoolService drains the pools, ToolAdapterService refuses the tools whose descriptors name it, and AuditService records the event as evidence. The closed `action` list of `audit-evidence-v1` names no value for the revocation of a reference, so the event is the evidence of the act and the missing value is reported to the owner. Kind: behavior. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; apis: SecretBrokerService/RevokeSecretReference, SecretBrokerService/SecretBroker.Issue, SecretBrokerService/RotateSecret, SecretBrokerService/SecretBroker.Verify, SecretBrokerService/ListSecretReferences; events: SecretBrokerService/SecretReferenceRevoked, SecretBrokerService/CredentialRevoked; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015; requirements: XL-13, NFR-02; scenarios: SCN-SecretBrokerService-004, SCN-SecretBrokerService-011. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953, AIFACTORY-US-954, AIFACTORY-US-956. Sources: model/services/governance/SecretBrokerService.yaml, model/scenarios/SecretBrokerService.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a reference with two Issued issuances and a caller with `factory.secrets.admin`, when `SecretBrokerService/RevokeSecretReference` is called with a reason, then the response is 200, the `SecretBrokerService/SecretReference` has `revoked` set, both issuances are Revoked with one `SecretBrokerService/CredentialRevoked` each, and the `SecretBrokerService/SecretReferenceRevoked` outbox record with the reason was written in the same transaction; the fake vault recorded no call (SCN-SecretBrokerService-004).",
        "AC2: Given a revoked reference, when `SecretBrokerService/RevokeSecretReference` is called again, then the response is 200 and no row changes and no event is written; given an unknown `referenceId` or a reference of another tenant, the response is 404; given a caller without the scope, 403; given no reason, 400; and no refusal writes or publishes anything (SCN-SecretBrokerService-004, ADR-0015).",
        "AC3: Given a revoked reference, when `SecretBrokerService/SecretBroker.Issue`, `SecretBrokerService/RotateSecret`, `SecretBrokerService/SecretBroker.Verify` and `SecretBrokerService/ListSecretReferences` are called, then the issue is refused with FAILED_PRECONDITION, the rotation with 409, the verification reports the reference as revoked without a vault call, the list shows it revoked with no Issued issuance, and no operation of the service clears `revoked` (model/services/governance/SecretBrokerService.yaml).",
        "AC4: Given a revoked reference, when the outbox dispatcher publishes `SecretBrokerService/SecretReferenceRevoked` on `secret-broker.references.v1.secret-reference-revoked`, then the event is sent in the run event envelope with `referenceId`, `tenantId` and `reason`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SecretBrokerService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3849",
        "AIFACTORY-TASK-3850"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7609,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/RevokeSecretReference",
          "SecretBrokerService/SecretBroker.Issue",
          "SecretBrokerService/RotateSecret",
          "SecretBrokerService/SecretBroker.Verify",
          "SecretBrokerService/ListSecretReferences"
        ],
        "events": [
          "SecretBrokerService/SecretReferenceRevoked",
          "SecretBrokerService/CredentialRevoked"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "XL-13",
          "NFR-02"
        ],
        "scenarios": [
          "SCN-SecretBrokerService-004",
          "SCN-SecretBrokerService-011"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-954",
        "AIFACTORY-US-956"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-958]",
      "number": 958
    },
    {
      "id": "AIFACTORY-TASK-3849",
      "type": "task",
      "parent": "AIFACTORY-US-958",
      "title": "RevokeSecretReference with the revocation of every live issuance and the SecretReferenceRevoked outbox record",
      "sequence": "12.02.09.01",
      "description": "RevokeSecretReference with the revocation of every live issuance and the SecretReferenceRevoked outbox record. Expected output: The operation sets revoked on the reference of the path, revokes every Issued issuance of it through the revocation routine of AIFACTORY-TASK-3842 and writes SecretReferenceRevoked with referenceId, tenantId and reason, all in one transaction, and answers 200; a repeated call answers 200 without a change; a missing reason answers 400, an unknown or foreign reference 404 and a missing scope 403; the vault is not called; Issue, RotateSecret and Verify refuse or report a revoked reference as AIFACTORY-US-955, AIFACTORY-US-957 and AIFACTORY-US-959 state.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The operation sets revoked on the reference of the path, revokes every Issued issuance of it through the revocation routine of AIFACTORY-TASK-3842 and writes SecretReferenceRevoked with referenceId, tenantId and reason, all in one transaction, and answers 200; a repeated call answers 200 without a change; a missing reason answers 400, an unknown or foreign reference 404 and a missing scope 403; the vault is not called; Issue, RotateSecret and Verify refuse or report a revoked reference as AIFACTORY-US-955, AIFACTORY-US-957 and AIFACTORY-US-959 state."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7609,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3849]",
      "number": 3849
    },
    {
      "id": "AIFACTORY-TASK-3850",
      "type": "task",
      "parent": "AIFACTORY-US-958",
      "title": "Verify the revocation of a reference, the later refusals and the event through the acceptance suite",
      "sequence": "12.02.09.02",
      "description": "Verify the revocation of a reference, the later refusals and the event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-004|Scenario=SCN-SecretBrokerService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-958 with the fixture of AIFACTORY-TASK-3834: the revocation with the revoked issuances and the SecretReferenceRevoked record in one transaction, the repeat without a change, the 404, 403 and 400 refusals, the refused issue and rotation and the reported verification of a revoked reference, and the publication and payload of SecretReferenceRevoked with a transport outage; consumer handling is proven by the suites of IntegrationService, ModelRouterService, ComputePoolService, ToolAdapterService and AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SecretBrokerService-004|Scenario=SCN-SecretBrokerService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-958 with the fixture of AIFACTORY-TASK-3834: the revocation with the revoked issuances and the SecretReferenceRevoked record in one transaction, the repeat without a change, the 404, 403 and 400 refusals, the refused issue and rotation and the reported verification of a revoked reference, and the publication and payload of SecretReferenceRevoked with a transport outage; consumer handling is proven by the suites of IntegrationService, ModelRouterService, ComputePoolService, ToolAdapterService and AuditService."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7609,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3850]",
      "number": 3850
    },
    {
      "id": "AIFACTORY-US-959",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "Verify that a secret reference resolves in the vault without issuing a credential to the caller",
      "sequence": "12.02.10",
      "description": "A Factory service that is about to depend on a reference, IntegrationService for a connection among them, asks whether the reference can be used before it relies on it. It calls `SecretBrokerService/SecretBroker.Verify` with a workload token that holds the service scope naming SecretBrokerService and the forwarded tenant, and names the reference. The method is a probe of class external, because it calls the vault or the identity platform, and it is read-only for the service: it creates no `Issuance`, publishes no event, submits no evidence record and returns no credential and no `vaultRef`. The service loads the reference under the tenant row filter, so an unknown reference and a reference of another tenant are both answered NOT_FOUND (ADR-0015). For a reference that names a vault object it asks Azure Key Vault through the vault port whether the object exists, is enabled and is inside its validity; for a reference that names an exchangeable identity it performs the exchange at the identity platform and discards the token at once. The reply is `ack-v1` and says whether the reference was verified and, when it was not, why: the vault object is missing, disabled or outside its validity, the exchange was refused, or the reference is revoked, which is answered from the row without a call. A value read during the probe is held in memory for the probe alone and reaches no row, reply, log record or metric. The model asks more of this method than the service can know: it says the method verifies that the credential works. A reference describes the secret and its owner and not the system the credential opens, so the service has no target against which a provider key or a connection secret could be tried. This delivery verifies that the reference resolves and, for an exchangeable identity, that the exchange succeeds, and reports to the owner that a functional probe of the credential needs a target the model does not give. A call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED and a request without a reference with INVALID_ARGUMENT. When the vault or the identity platform does not answer, the call fails fast with UNAVAILABLE and the failure class transient and the service does not retry; the caller decides whether to ask again. A verification is no issuance: `connectsoft.factory.secrets.issuances` does not count it, and no policy decision is asked for it, because nothing is handed out. Kind: behavior. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/SecretReference, SecretBrokerService/Issuance; apis: SecretBrokerService/SecretBroker.Verify; descriptors: ack-v1; adrs: ADR-0015, ADR-0019; requirements: NFR-02; scenarios: SCN-SecretBrokerService-008. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953, AIFACTORY-US-954. Sources: model/services/governance/SecretBrokerService.yaml, model/scenarios/SecretBrokerService.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a registered reference whose vault object exists, is enabled and valid, and a workload with the service scope, when `SecretBrokerService/SecretBroker.Verify` is called, then the reply is `ack-v1` and reports the reference as verified, the fake vault recorded one probe, and no `SecretBrokerService/Issuance`, outbox record or evidence record was written and the reply holds no credential and no `vaultRef` (SCN-SecretBrokerService-008).",
        "AC2: Given a reference whose vault object is missing, disabled or outside its validity, an exchangeable identity whose exchange is refused, and a revoked reference, when `SecretBrokerService/SecretBroker.Verify` is called for each, then the reply reports it as not verified with that cause, the revoked reference is answered without a call to the vault, a token obtained by a successful exchange is discarded and appears nowhere, and nothing is written (SCN-SecretBrokerService-008, ADR-0019).",
        "AC3: Given a call to `SecretBrokerService/SecretBroker.Verify` without a workload identity, with a token that lacks the service scope, without a reference, or for an unknown reference or one of another tenant, when it arrives, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND respectively and the vault is not called (SCN-SecretBrokerService-008, ADR-0015).",
        "AC4: Given the fake vault or the identity fake does not answer, when `SecretBrokerService/SecretBroker.Verify` is called, then it fails fast with UNAVAILABLE and the failure class transient, the fake records one call and no repetition by the service, and `connectsoft.factory.secrets.issuances` is unchanged (SCN-SecretBrokerService-008, model/services/governance/SecretBrokerService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3851",
        "AIFACTORY-TASK-3852"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7610,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/SecretReference",
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/SecretBroker.Verify"
        ],
        "descriptors": [
          "ack-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-02"
        ],
        "scenarios": [
          "SCN-SecretBrokerService-008"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-954"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-959]",
      "number": 959
    },
    {
      "id": "AIFACTORY-TASK-3851",
      "type": "task",
      "parent": "AIFACTORY-US-959",
      "title": "SecretBroker.Verify as a read-only probe of the vault object or of the token exchange",
      "sequence": "12.02.10.01",
      "description": "SecretBroker.Verify as a read-only probe of the vault object or of the token exchange. Expected output: The method loads the reference under the tenant row filter, answers a revoked reference from the row, asks the vault port whether the vault object exists, is enabled and is inside its validity or performs the token exchange at the identity platform and discards the token, and replies ack-v1 with the verified flag and the cause of a failure; it writes no Issuance, no outbox record and no evidence record, returns no credential and no vaultRef, asks no policy decision and does not move connectsoft.factory.secrets.issuances; an unknown or foreign reference is answered NOT_FOUND, a missing reference INVALID_ARGUMENT and a dependency that does not answer UNAVAILABLE without a retry.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The method loads the reference under the tenant row filter, answers a revoked reference from the row, asks the vault port whether the vault object exists, is enabled and is inside its validity or performs the token exchange at the identity platform and discards the token, and replies ack-v1 with the verified flag and the cause of a failure; it writes no Issuance, no outbox record and no evidence record, returns no credential and no vaultRef, asks no policy decision and does not move connectsoft.factory.secrets.issuances; an unknown or foreign reference is answered NOT_FOUND, a missing reference INVALID_ARGUMENT and a dependency that does not answer UNAVAILABLE without a retry."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7610,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3851]",
      "number": 3851
    },
    {
      "id": "AIFACTORY-TASK-3852",
      "type": "task",
      "parent": "AIFACTORY-US-959",
      "title": "Verify the reference probe and its refusals through the acceptance suite",
      "sequence": "12.02.10.02",
      "description": "Verify the reference probe and its refusals through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-SecretBrokerService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-959 with the fakes of AIFACTORY-TASK-3834: the verified reference with one probe and nothing written, each cause of a failed verification, the revoked reference answered without a vault call, the discarded exchange token, the four refusals with their status, and UNAVAILABLE without a retry while the fake vault or the identity fake does not answer.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-SecretBrokerService-008\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-959 with the fakes of AIFACTORY-TASK-3834: the verified reference with one probe and nothing written, each cause of a failed verification, the revoked reference answered without a vault call, the discarded exchange token, the four refusals with their status, and UNAVAILABLE without a retry while the fake vault or the identity fake does not answer."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7610,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3852]",
      "number": 3852
    },
    {
      "id": "AIFACTORY-US-960",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-061",
      "title": "Read the credential issuances made for a run as metadata only",
      "sequence": "12.02.11",
      "description": "A caller whose token carries the scope `factory.runs.read` reads which credentials were issued for a run through `SecretBrokerService/ListRunIssuances`. The answer is metadata only: for every issuance whose subject names the run it gives the issuance identifier, the reference identifier, the purpose, the subject with its workload identity, attempt, invocation and sandbox lease, the narrowed scope, the policy decision identifier, the state Issued, Expired or Revoked, `issuedAt`, `expiresAt` and `revokedAt`. It never holds a credential, which the service does not store, and never a `vaultRef`. The query runs under the tenant row filter, so an issuance of another tenant is never returned. Inside the tenant the project is the second boundary: the subject of an issuance names the project the caller of the issuance forwarded, and a user token reads the issuances of a run with the role Operator or Observer in that project, with an Observer role assigned at the tenant or with the tenant-wide Platform admin role, the three roles the model lists for the service at the levels at which ADR-0015 assigns them. A caller of the same tenant with another role of the project, Requester or Reviewer for example, or with no role in it is answered 403, because a missing right inside the own tenant is never answered as not found, and so is a caller without the scope (ADR-0015). An issuance whose subject names the run and no project is returned to the two tenant-wide roles only. The service keeps no runs. It cannot tell a run that does not exist from a run of another tenant or from a run for which no credential was issued, so in all three cases it holds no issuance for the `runId` in the tenant of the caller and answers 404, the one answer the model lists besides 200 and 403; that a run without any issuance is answered 404 and not with an empty list is reported to the owner. The read writes nothing. The model gives `Issuances` no column and no index for the run or the project: both are members of `SubjectJson`, and `CredentialIssued` takes its `runId` from there. This delivery reads them from the subject and adds no column; the missing column and index are reported, because the list scans the issuances of the tenant by a member of a JSON document. A person reaches this route through GovernanceHost, which fronts the service from I1 (D127); no direct route is built, and the suite calls it with tokens of the gateway audience. Kind: behavior. Traces: services: SecretBrokerService; aggregates: SecretBrokerService/Issuance; apis: SecretBrokerService/ListRunIssuances; adrs: ADR-0015; requirements: FUX-01, NFR-01; scenarios: SCN-SecretBrokerService-005. Depends on: AIFACTORY-US-951, AIFACTORY-US-952, AIFACTORY-US-953, AIFACTORY-US-955. Sources: model/services/governance/SecretBrokerService.yaml, model/scenarios/SecretBrokerService.yaml, docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a run of a project with three issuances, one Issued, one Expired and one Revoked, and a caller with `factory.runs.read` and the role Operator in that project, when `SecretBrokerService/ListRunIssuances` is called with the `runId`, then the response is 200 with the three issuances, each with its reference identifier, purpose, subject, scope, policy decision identifier, state and times, and without a credential or a `vaultRef`, and nothing is written (SCN-SecretBrokerService-005).",
        "AC2: Given a caller without `factory.runs.read`, a caller of the same tenant without a role in the project the subjects name, or a caller whose only role in that project is Reviewer, a role outside the list of model/services/governance/SecretBrokerService.yaml, when `SecretBrokerService/ListRunIssuances` is called, then the response is 403; given a `runId` for which the tenant of the caller holds no issuance, whether the run is unknown, belongs to another tenant or used no credential, the response is 404, the same for the three (SCN-SecretBrokerService-005, ADR-0015).",
        "AC3: Given issuances of two tenants whose subjects name the same `runId`, when each tenant calls `SecretBrokerService/ListRunIssuances`, then each receives only its own `SecretBrokerService/Issuance` rows; a caller with the Platform admin role of a tenant and a caller with an Observer role assigned at the tenant each read the issuances of every project of that tenant, and an Observer of one project reads those of its project and is answered 403 for a run of another (SCN-SecretBrokerService-005, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md)."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3853",
        "AIFACTORY-TASK-3854"
      ],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7611,
      "kind": "behavior",
      "traces": {
        "services": [
          "SecretBrokerService"
        ],
        "aggregates": [
          "SecretBrokerService/Issuance"
        ],
        "apis": [
          "SecretBrokerService/ListRunIssuances"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01",
          "NFR-01"
        ],
        "scenarios": [
          "SCN-SecretBrokerService-005"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-951",
        "AIFACTORY-US-952",
        "AIFACTORY-US-953",
        "AIFACTORY-US-955"
      ],
      "source": [
        "model/services/governance/SecretBrokerService.yaml",
        "model/scenarios/SecretBrokerService.yaml",
        "docs/planes/trust-operations/governance/services/secret-broker-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-960]",
      "number": 960
    },
    {
      "id": "AIFACTORY-TASK-3853",
      "type": "task",
      "parent": "AIFACTORY-US-960",
      "title": "ListRunIssuances read model over the subject of the issuances",
      "sequence": "12.02.11.01",
      "description": "ListRunIssuances read model over the subject of the issuances. Expected output: The read returns the issuances of the tenant of the caller whose subject names the runId of the path, with issuance identifier, reference identifier, purpose, subject, scope, policy decision identifier, state, issuedAt, expiresAt and revokedAt; the response type has no member for a credential or a vaultRef; the project is read from the subject and a user token is admitted with the role Operator or Observer in it, with an Observer role assigned at the tenant or with the Platform admin role, and answered 403 with another role of the project or with none; an issuance without a project in its subject is returned to the two tenant-wide roles only; a runId without an issuance in the tenant is answered 404; the run and the project are read from SubjectJson and no column is added; the query runs under the tenant row filter and writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "The read returns the issuances of the tenant of the caller whose subject names the runId of the path, with issuance identifier, reference identifier, purpose, subject, scope, policy decision identifier, state, issuedAt, expiresAt and revokedAt; the response type has no member for a credential or a vaultRef; the project is read from the subject and a user token is admitted with the role Operator or Observer in it, with an Observer role assigned at the tenant or with the Platform admin role, and answered 403 with another role of the project or with none; an issuance without a project in its subject is returned to the two tenant-wide roles only; a runId without an issuance in the tenant is answered 404; the run and the project are read from SubjectJson and no column is added; the query runs under the tenant row filter and writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7611,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3853]",
      "number": 3853
    },
    {
      "id": "AIFACTORY-TASK-3854",
      "type": "task",
      "parent": "AIFACTORY-US-960",
      "title": "Verify the issuances of a run and their refusals through the acceptance suite",
      "sequence": "12.02.11.02",
      "description": "Verify the issuances of a run and their refusals through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-SecretBrokerService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-960 with the fixture of AIFACTORY-TASK-3834: the three issuances of a run in their states without a credential or a vaultRef, 403 for a missing scope, for another project of the tenant and for the role Reviewer in the project, 404 alike for an unknown run, a run of another tenant and a run without an issuance, the two tenants that each read only their own rows, the Operator and the Observer of the project, and the Platform admin and the Observer assigned at the tenant who each read every project of the tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-SecretBrokerService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-960 with the fixture of AIFACTORY-TASK-3834: the three issuances of a run in their states without a credential or a vaultRef, 403 for a missing scope, for another project of the tenant and for the role Reviewer in the project, 404 alike for an unknown run, a run of another tenant and a run without an issuance, the two tenants that each read only their own rows, the Operator and the Observer of the project, and the Platform admin and the Observer assigned at the tenant who each read every project of the tenant."
      ],
      "sourceArtifacts": [
        "model/services/governance/SecretBrokerService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 76,
      "phase": "factory",
      "stackRank": 7611,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3854]",
      "number": 3854
    },
    {
      "id": "AIFACTORY-FEAT-064",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-012",
      "title": "AuditService: complete delivery",
      "sequence": "12.03",
      "description": "AuditService is the service of bounded context BC-19 (Audit). Append-only audit evidence with a hash chain in the immutable store for every command, decision, approval, publication, credential issuance and effect; the data classification registry with retention and redaction rules that other services obey; findings and exports for tenants and auditors (BC-19, audit-evidence-v1, D31). It is delivered complete in the first outcome by owner decision (D80), so that every run is audited from its first command. Its own repository is ConnectSoft.AI.SoftwareFactory.AuditService. Delivers: AuditService (complete). Increment I1: Generate a microservice. Build order 77 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-019",
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "AIFACTORY-US-965",
        "AIFACTORY-US-966",
        "AIFACTORY-US-967",
        "AIFACTORY-US-968",
        "AIFACTORY-US-969",
        "AIFACTORY-US-970",
        "AIFACTORY-US-1516"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7700,
      "titlePrefix": "[AIFACTORY-FEAT-064]",
      "number": 64
    },
    {
      "id": "AIFACTORY-US-019",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Every run leaves verifiable audit evidence",
      "sequence": "12.03.01",
      "description": "As an observer, I want every command, decision, approval and effect of a run recorded as append-only evidence with a chain I can verify, so that I can show afterwards who did what, under which authority, and that nothing was altered. This is the integration PBI of the feature: it proves on a deployed instance that AuditService turns what the Factory does into evidence that can be verified. AuditService is the authoritative writer of bounded context BC-19 and is delivered complete in the first outcome by owner decision D80, so that every run is audited from its first command. Evidence reaches it on three paths that end in one append. A Factory service writes an `audit-evidence-v1` record to its own outbox in the transaction of its command, and the record arrives as the event `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted`, where the command `SubmitEvidence` appends it once per evidence identifier (D115). The integration events the model lists under the consumed events of the service are recorded as evidence by `RecordEvidence`. And `Audit.Record` appends evidence of a command that is not an event. Every entry takes the next sequence of its tenant and the hash of its predecessor, is mirrored to the immutable store, and the head of each tenant chain is verified and signed daily with a key that stays in Azure Key Vault. In this increment the callers are services, not people. The proof of this PBI is the hand-over of the first outcome through the deployed service, and its criteria state only what a deployed instance can prove; what the repository suites of AIFACTORY-US-961 to AIFACTORY-US-970 prove is not proven again here. Producers of the fixture, shaped like RunControlService, PolicyEngineService, ToolAdapterService and SecretBrokerService and built from the pinned contracts package, publish on the deployed transport the events of five acts of one run: its submission, a policy decision, an approval decision, a tool invocation and a credential issuance. The submission of a run is audited through `RunAccepted` of RunControlService, which `RecordEvidence` appends as the evidence of the submission (D126, D135). The issuance arrives once, as the event `CredentialIssued`, which names the policy decision that allowed it: it leaves exactly one audit entry, and SecretBrokerService submits no evidence record of its own for it (D126, D135). The `SubmitEvidence` path is proven with one `audit-evidence-v1` record of the closed `action` list for an act no consumed event announces, the action `break-glass`, which a producer shaped like RunControlService submits on the evidence topic. The suite then reads the trail of the run through `SearchAudit`, verifies the chain positions it returns, waits for a run of `ChainVerifier` and checks the signed head against the key of the vault of the environment. No dependency of the feature delivers an on-demand trigger of a scheduled worker, and ADR-0015 reserves worker triggers for the Platform admin, so the suite triggers nothing: the acceptance deployment sets the schedule of the worker through the configuration of the instance, `Governance:Audit:ChainVerifierSchedule` (AIFACTORY-US-962), so that a run falls inside the suite, and the fixture tenant is new for every run of the suite, because the worker runs once per tenant and day. That a run of the real chain leaves an entry for each of these acts is proven where the real services run together, by the outcome verification of the increment (feature `verify-generate-a-microservice`); this PBI proves that the deployed Audit service records, chains, verifies and returns them. The suite reads through the REST route of the deployed instance with an Observer token whose audience is the one of the Governance gateway, issued by the authorization server of the acceptance environment. A person reaches that route through GovernanceHost, which fronts the service from I1 (D127), and this feature builds no direct public route. The audit commands of the command-line client, which search the trail of a run and request an export, are written against the client port and reach the deployed service through the Governance gateway with a token of its audience, because the token of the client for the control plane gateway has that one audience and the Governance gateway needs a token of its own; the suite proves them against a fake of the gateway routes, and the acceptance stage of the increment calls them against the deployed gateway. Kind: behavior. Traces: services: AuditService, PolicyEngineService, RunControlService, ToolAdapterService, SecretBrokerService; aggregates: AuditService/AuditEntry; apis: AuditService/SearchAudit, AuditService/ExportAudit, AuditService/Audit.Record; events: AuditService/AuditEntryRecorded, AuditService/AuditChainVerified, RunControlService/RunAccepted, PolicyEngineService/PolicyDecisionRecorded, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvoked, SecretBrokerService/CredentialIssued; descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: FR-06, NFR-04, NFR-10. Relates: nfrs: NFR-04. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, AIFACTORY-US-965, AIFACTORY-US-966, AIFACTORY-US-967, AIFACTORY-US-968, AIFACTORY-US-969, AIFACTORY-US-970, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:policy-engine-service, feature:run-control-service, feature:tool-adapter-service, feature:secret-broker-service, feature:artifact-service. Sources: model/services/governance/AuditService.yaml, model/backlog/features/governance.yaml, docs/planes/trust-operations/governance/services/audit-service/index.md, docs/planes/trust-operations/governance/security.md#evidence-integrity, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given the container image that the pipeline of the repository published (AIFACTORY-US-961), deployed in the acceptance environment with its secret references `audit-chain-key` and `messaging-transport`, when the instance starts against `audit-sql`, `audit-immutable`, the Key Vault, the identity authority and the deployed ArtifactService of that environment, the required dependency that readiness names by AIFACTORY-US-963, then its readiness turns ready and the hand-over suite of this PBI calls that instance over the network and no in-process host; the scaffold, the hosted surface, tenancy and telemetry are proven by AIFACTORY-US-961, AIFACTORY-US-962 and AIFACTORY-US-963 and are not proven again here (ADR-0019, model/services/governance/AuditService.yaml).",
        "AC2: Given the fixture producers publish for one run the events `RunControlService/RunAccepted`, `PolicyEngineService/PolicyDecisionRecorded`, `RunControlService/ApprovalDecided`, `ToolAdapterService/ToolInvoked` and `SecretBrokerService/CredentialIssued` and one `audit-evidence-v1` record with the action `break-glass` of the closed list of docs/reference/schemas/audit-evidence.schema.json as `AuditEvidenceSubmitted` on the deployed transport, when `AuditService/SearchAudit` is called for the run, then it returns one `AuditService/AuditEntry` per delivery, six in all, the submission of the run from `RunAccepted` and the issuance exactly once from its event with the policy decision it names, each with tenant, project, run and actor and with consecutive sequences of the tenant, each entry hash follows from its record and the hash of its predecessor, and the subscriber of the fixture received exactly one `AuditService/AuditEntryRecorded` per entry in the run event envelope (ADR-0014).",
        "AC3: Given the entries of AC2 and an acceptance deployment whose configuration sets `Governance:Audit:ChainVerifierSchedule` so that a run of `ChainVerifier` falls inside the suite, when the suite waits for that run and triggers nothing itself, then `AuditService/AuditChainVerified` is received with `valid` true and the sequence of the last entry of the fixture tenant as head sequence, one verification entry follows that head in the trail, and the signature of the head verifies with the public part of the key the vault of the environment holds, a key that never left the vault (docs/planes/trust-operations/governance/security.md).",
        "AC4: Given the entries of AC2 on the deployed instance and tokens issued by the authorization server of the acceptance environment, when an Observer of another tenant searches for the run over the real route, a workload with the service scope appends one record through `AuditService/Audit.Record` over the real channel, and the events and the record of AC2 are delivered again on the deployed transport after a restart of the instance, then the search returns an empty page, the appended record is in the trail of its tenant, no second entry exists for a redelivered event or record, every entry and the signed head stand as before the restart and the sequence of the tenant continues without a gap, and a scan of the entries, the log records, the activities and the metrics of the instance for the marker text of the fixture finds it in none; the isolation rules are owned by AC1 of AIFACTORY-US-963 and the deduplication and the refusals of the three paths by AC1 to AC3 of AIFACTORY-US-964, and none is enumerated again here (ADR-0015, ADR-0019).",
        "AC5: Given the command-line client and a fake of the gateway routes of `AuditService/SearchAudit` and `AuditService/ExportAudit`, when the audit commands search the trail of a run and request an export of a project, then each sends the modelled request with the token of the Governance gateway audience, the export with an `Idempotency-Key`, prints the entries with their chain positions or the export request, exits with a non-zero code on 403 and 404, and no command addresses the service without the gateway (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/backlog/features/governance.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/index.md",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3855",
        "AIFACTORY-TASK-309",
        "AIFACTORY-TASK-3856",
        "AIFACTORY-TASK-753"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7701,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService",
          "PolicyEngineService",
          "RunControlService",
          "ToolAdapterService",
          "SecretBrokerService"
        ],
        "aggregates": [
          "AuditService/AuditEntry"
        ],
        "apis": [
          "AuditService/SearchAudit",
          "AuditService/ExportAudit",
          "AuditService/Audit.Record"
        ],
        "events": [
          "AuditService/AuditEntryRecorded",
          "AuditService/AuditChainVerified",
          "RunControlService/RunAccepted",
          "PolicyEngineService/PolicyDecisionRecorded",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvoked",
          "SecretBrokerService/CredentialIssued"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-06",
          "NFR-04",
          "NFR-10"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "AIFACTORY-US-965",
        "AIFACTORY-US-966",
        "AIFACTORY-US-967",
        "AIFACTORY-US-968",
        "AIFACTORY-US-969",
        "AIFACTORY-US-970",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:policy-engine-service",
        "feature:run-control-service",
        "feature:tool-adapter-service",
        "feature:secret-broker-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/backlog/features/governance.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/index.md",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-019]",
      "number": 19
    },
    {
      "id": "AIFACTORY-TASK-3855",
      "type": "task",
      "parent": "AIFACTORY-US-019",
      "title": "Hand-over fixture of the first outcome for the deployed audit service",
      "sequence": "12.03.01.01",
      "description": "Hand-over fixture of the first outcome for the deployed audit service. Expected output: The acceptance suite holds producers shaped like RunControlService, PolicyEngineService, ToolAdapterService and SecretBrokerService that publish on the deployed transport, built from the pinned contracts package, the events RunAccepted, PolicyDecisionRecorded, ApprovalDecided, ToolInvoked and CredentialIssued of one run and one audit-evidence-v1 submission with the action break-glass as AuditEvidenceSubmitted, each with a marker text in a member that must not be stored, and that can deliver each a second time; a fixture tenant that is new for every run of the suite, an Observer user token of that tenant and one of another tenant with the audience of the Governance gateway and the scope factory.audit.read from the authorization server of the environment, a workload identity with the service scope naming AuditService and a token of that authorization server, the deployed ArtifactService of the acceptance environment as the required dependency of readiness, a subscriber on the five topics of the audit profile that records every delivered envelope, the deployment configuration that sets Governance:Audit:ChainVerifierSchedule so that a run of ChainVerifier falls inside the suite and a wait for AuditChainVerified of the fixture tenant, with no trigger of a worker by the suite, a check of the head signature against the public part of the key in the vault of the environment, a step that restarts the deployed instance and waits for its readiness, and a scan for the marker text, so that AC2 to AC4 of AIFACTORY-US-019 run against the deployed service without the four real producers.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The acceptance suite holds producers shaped like RunControlService, PolicyEngineService, ToolAdapterService and SecretBrokerService that publish on the deployed transport, built from the pinned contracts package, the events RunAccepted, PolicyDecisionRecorded, ApprovalDecided, ToolInvoked and CredentialIssued of one run and one audit-evidence-v1 submission with the action break-glass as AuditEvidenceSubmitted, each with a marker text in a member that must not be stored, and that can deliver each a second time; a fixture tenant that is new for every run of the suite, an Observer user token of that tenant and one of another tenant with the audience of the Governance gateway and the scope factory.audit.read from the authorization server of the environment, a workload identity with the service scope naming AuditService and a token of that authorization server, the deployed ArtifactService of the acceptance environment as the required dependency of readiness, a subscriber on the five topics of the audit profile that records every delivered envelope, the deployment configuration that sets Governance:Audit:ChainVerifierSchedule so that a run of ChainVerifier falls inside the suite and a wait for AuditChainVerified of the fixture tenant, with no trigger of a worker by the suite, a check of the head signature against the public part of the key in the vault of the environment, a step that restarts the deployed instance and waits for its readiness, and a scan for the marker text, so that AC2 to AC4 of AIFACTORY-US-019 run against the deployed service without the four real producers."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7701,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3855]",
      "number": 3855
    },
    {
      "id": "AIFACTORY-TASK-309",
      "type": "task",
      "parent": "AIFACTORY-US-019",
      "title": "Audit commands in the command-line client",
      "sequence": "12.03.01.02",
      "description": "Audit commands in the command-line client. Expected output: The client searches the trail of a run through the gateway route of SearchAudit and requests an export of a project through the gateway route of ExportAudit with an Idempotency-Key generated once and reused on a retry, prints the entries with sequence, kind, actor, action, outcome and chain position or the export request identifier, and exits with a non-zero code on 403 and 404; both commands go through the client port, ask for a token of the Governance gateway audience, because a user token has one audience, and address no service directly; GovernanceHost fronts the service from I1 (D127), so the commands are proven against a fake of the two gateway routes in the repository suite and reach the deployed gateway in the acceptance stage of the increment.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client searches the trail of a run through the gateway route of SearchAudit and requests an export of a project through the gateway route of ExportAudit with an Idempotency-Key generated once and reused on a retry, prints the entries with sequence, kind, actor, action, outcome and chain position or the export request identifier, and exits with a non-zero code on 403 and 404; both commands go through the client port, ask for a token of the Governance gateway audience, because a user token has one audience, and address no service directly; GovernanceHost fronts the service from I1 (D127), so the commands are proven against a fake of the two gateway routes in the repository suite and reach the deployed gateway in the acceptance stage of the increment."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-309]",
      "number": 309
    },
    {
      "id": "AIFACTORY-TASK-3856",
      "type": "task",
      "parent": "AIFACTORY-US-019",
      "title": "Verify the audit commands of the command-line client against a fake of the gateway",
      "sequence": "12.03.01.03",
      "description": "Verify the audit commands of the command-line client against a fake of the gateway. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AuditCommands\"` in ConnectSoft.AI.SoftwareFactory.Cli; a zero-match filter counts as a failure; the tests prove AC5 of AIFACTORY-US-019 against a fake of the gateway routes of `AuditService/SearchAudit` and `AuditService/ExportAudit`: the modelled request of each command, the token of the Governance gateway audience, the Idempotency-Key of an export reused on a retry, the printed entries and export request, and a non-zero exit code on 403 and 404.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=AuditCommands\"` in ConnectSoft.AI.SoftwareFactory.Cli; a zero-match filter counts as a failure; the tests prove AC5 of AIFACTORY-US-019 against a fake of the gateway routes of `AuditService/SearchAudit` and `AuditService/ExportAudit`: the modelled request of each command, the token of the Governance gateway audience, the Idempotency-Key of an export reused on a retry, the printed entries and export request, and a non-zero exit code on 403 and 404."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3856]",
      "number": 3856
    },
    {
      "id": "AIFACTORY-TASK-753",
      "type": "task",
      "parent": "AIFACTORY-US-019",
      "title": "Verify run-is-audited by running the declared command",
      "sequence": "12.03.01.04",
      "description": "Verify run-is-audited by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=AuditHandOver\"` against the deployed service; a run that discovers no test and a zero-match filter count as failures; the run against the deployed instance proves AC1 to AC4 of AIFACTORY-US-019, that is the readiness of the deployed image with the deployed ArtifactService, one chained entry per delivery of the fixture run returned by `AuditService/SearchAudit`, the submission of the run from RunAccepted, the issuance exactly once from CredentialIssued and the break-glass record through SubmitEvidence, one AuditEntryRecorded per entry, the scheduled verification with a head signature that verifies against the vault of the environment and its verification entry, the empty search of another tenant over the real route, the record appended over the real channel, no second entry after redelivery and restart, and the scan for the marker text; the fifteen scenarios SCN-AuditService-001 to SCN-AuditService-015 are proven by the suites of AIFACTORY-US-964 to AIFACTORY-US-970 and AIFACTORY-US-1516.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository, and `dotnet test -c Release --filter \"Category=Acceptance&Feature=AuditHandOver\"` against the deployed service; a run that discovers no test and a zero-match filter count as failures; the run against the deployed instance proves AC1 to AC4 of AIFACTORY-US-019, that is the readiness of the deployed image with the deployed ArtifactService, one chained entry per delivery of the fixture run returned by `AuditService/SearchAudit`, the submission of the run from RunAccepted, the issuance exactly once from CredentialIssued and the break-glass record through SubmitEvidence, one AuditEntryRecorded per entry, the scheduled verification with a head signature that verifies against the vault of the environment and its verification entry, the empty search of another tenant over the real route, the record appended over the real channel, no second entry after redelivery and restart, and the scan for the marker text; the fifteen scenarios SCN-AuditService-001 to SCN-AuditService-015 are proven by the suites of AIFACTORY-US-964 to AIFACTORY-US-970 and AIFACTORY-US-1516."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-753]",
      "number": 753
    },
    {
      "id": "AIFACTORY-US-961",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "AuditService repository: scaffolded from the base template with the Factory profile, with the AuditEntry, ClassificationLabel and Finding aggregates and the stores audit-sql and audit-immutable",
      "sequence": "12.03.02",
      "description": "AuditService has its own repository, ConnectSoft.AI.SoftwareFactory.AuditService, its own deployable and its own stores (ADR-0028). The repository is created and scaffolded in I0 by AIFACTORY-TASK-231 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AuditService --UseFactoryProfile true`, generated from the template package at the version the gate of feature `component-base-template-factory-profile` published, with the messaging service name `audit`, the default of `OrleansMessaging:ServiceName` in the model. Token validation, the scope chain with its 401, 403 and 404 answers, the tenant row filter, health, readiness and the telemetry wiring come from the profile and are not written again; the repository pins the contracts package, from which it takes the run event envelope, the topic constants, the event types and the two shapes of `audit-evidence-v1`, the submitted one and the stored one. On that scaffold this PBI builds the domain model and the stores and delivers no behaviour of an operation. The aggregate `AuditEntry` holds the seventeen fields of the model, from `entryId`, `tenantId`, the optional `projectId`, `sequence` and `kind` over `actor`, `action`, `target`, the optional `reason`, `outcome`, `correlationId`, the optional `causationId` and `runId` and `sourceEvent` to `previousHash`, `entryHash` and `recordedAt`, with the enum `EvidenceKind` and its nine families. It is append-only: the aggregate has no operation that changes or removes an entry, with the one exception the invariant of the model names, the redaction of a personal identifier after the retention window, which leaves every hashed member as it was (AIFACTORY-US-969). The aggregate `ClassificationLabel` holds `labelId`, `tenantId`, `resourceType`, the optional `resourceId`, which is empty for the default of a type, `dataClass`, `retentionDays`, `redactionRuleIds`, `residency`, `setBy` and `setAt`, with the entity `RedactionRule` (rule identifier, detector, action, the projections it applies to) and the enum `DataClass`, ordered Public, Internal, Confidential, Restricted; it refuses an instance label weaker than the default of its type. The aggregate `Finding` holds `findingId`, `tenantId`, `severity`, `category`, `evidenceEntryIds`, the optional `owner`, `state`, `raisedAt` and the optional `resolvedAt`, with the enum `FindingSeverity`. The model names four values of `state`, open, acknowledged, resolved and accepted-risk, and lists no transition table. A finding is raised open with at least one evidence entry, and it ends resolved or accepted-risk with `resolvedAt`; nothing leaves those two. The model has no operation that acknowledges a finding or sets its owner, so this delivery reaches open, resolved and accepted-risk only, keeps the fourth value in the type and reports the gap to the owner. The store `audit-sql` receives the five tables of the model, `AuditEntries`, `ChainHeads`, `Classifications`, `RedactionRules` and `Findings`, with their columns, the unique indexes `UX_Audit_Tenant_Sequence` and `UX_Classifications_Resource` and the indexes `IX_Audit_Run`, `IX_Audit_Tenant_RecordedAt` and `IX_Findings_Tenant_State`, under the tenant row filter of the profile. The key of `RedactionRules` is a correction of the model on which this PBI is built and which is reported to the owner. The model keys the table by `RuleId` alone with `TenantId` as a plain column, while each tenant names its rules itself: a second tenant that uses an identifier another tenant already holds cannot see that row under the tenant row filter, and its insert would fail on the primary key, an error that confirms a resource of another tenant (ADR-0015 amendment D113). The primary key is therefore `TenantId` and `RuleId`. The correction belongs in model/services/governance/AuditService.yaml, from which the data definition page of the service is generated; until that page is regenerated from the corrected model, this PBI cites it for columns and indexes only and states the key here. The store `audit-immutable`, the write-once blob store of the model, receives its container with the write-once policy; what is written to it is delivered by AIFACTORY-US-964. No table has a column for prompt text, a payload or a secret value, as the invariant of `AuditEntry` requires. Kind: enabling. Traces: services: AuditService; aggregates: AuditService/AuditEntry, AuditService/ClassificationLabel, AuditService/Finding; descriptors: audit-evidence-v1; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: NFR-04. Depends on: feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:repository-and-pipeline-conventions. Sources: model/services/governance/AuditService.yaml, model/stores.yaml, docs/planes/trust-operations/governance/services/audit-service/ddl.md, docs/planes/trust-operations/governance/services/audit-service/index.md#data-model-and-storage, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-231 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AuditService --UseFactoryProfile true` from the template package at its published version with the messaging service name `audit`, when the pipeline of the repository runs with the work of this feature, then the solution builds, the generated tests pass with complete reports and a container image is published (ADR-0028).",
        "AC2: Given the aggregate `AuditService/AuditEntry`, when an entry was created, then no operation of the aggregate changes `sequence`, `kind`, `action`, `target`, `outcome`, `previousHash` or `entryHash` or removes the entry, and the only change it admits is the redaction of a personal identifier of `actor` that leaves `entryHash` valid (model/services/governance/AuditService.yaml).",
        "AC3: Given the aggregates `AuditService/ClassificationLabel` and `AuditService/Finding`, when an instance label weaker than the default of its type is set, then it is refused; and when a finding is raised and then resolved or accepted as a risk, then it moves from open to resolved or to accepted-risk with `resolvedAt`, a finding without an evidence entry is refused, and nothing leaves resolved or accepted-risk (model/services/governance/AuditService.yaml).",
        "AC4: Given an empty `audit-sql`, when the migrations run, then `AuditEntries`, `ChainHeads`, `Classifications`, `RedactionRules` and `Findings` exist with the columns and indexes of docs/planes/trust-operations/governance/services/audit-service/ddl.md, the primary key of `RedactionRules` is `TenantId` and `RuleId`, which is the correction of the key of the model reported under ADR-0015 amendment D113, so that two tenants hold a rule of the same identifier as two rows, a second entry with the same tenant and sequence and a second label for the same tenant, resource type and resource are refused by their unique indexes, rows of two tenants read under the scope of one tenant return only the rows of that tenant, and a blob written to `audit-immutable` can be neither overwritten nor removed (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/stores.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/ddl.md",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#data-model-and-storage",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-232",
        "AIFACTORY-TASK-233",
        "AIFACTORY-TASK-3857"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7702,
      "kind": "enabling",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/AuditEntry",
          "AuditService/ClassificationLabel",
          "AuditService/Finding"
        ],
        "descriptors": [
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-04"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/stores.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/ddl.md",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#data-model-and-storage",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-961]",
      "number": 961
    },
    {
      "id": "AIFACTORY-TASK-232",
      "type": "task",
      "parent": "AIFACTORY-US-961",
      "title": "Domain model: the AuditEntry, ClassificationLabel and Finding aggregates with RedactionRule, EvidenceKind, DataClass and FindingSeverity",
      "sequence": "12.03.02.01",
      "description": "Domain model: the AuditEntry, ClassificationLabel and Finding aggregates with RedactionRule, EvidenceKind, DataClass and FindingSeverity. Expected output: The aggregates AuditEntry, ClassificationLabel with its entity RedactionRule, and Finding with the fields and the enums EvidenceKind, DataClass and FindingSeverity of model/services/governance/AuditService.yaml; an entry is append-only and admits only the redaction of a personal identifier of its actor; an instance label weaker than the default of its type is refused; a finding is raised open with at least one evidence entry and ends resolved or accepted-risk, the value acknowledged being kept in the type and reached by no operation; unit tests cover every state change, every refusal and every invariant the aggregates can enforce.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates AuditEntry, ClassificationLabel with its entity RedactionRule, and Finding with the fields and the enums EvidenceKind, DataClass and FindingSeverity of model/services/governance/AuditService.yaml; an entry is append-only and admits only the redaction of a personal identifier of its actor; an instance label weaker than the default of its type is refused; a finding is raised open with at least one evidence entry and ends resolved or accepted-risk, the value acknowledged being kept in the type and reached by no operation; unit tests cover every state change, every refusal and every invariant the aggregates can enforce."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-232]",
      "number": 232
    },
    {
      "id": "AIFACTORY-TASK-233",
      "type": "task",
      "parent": "AIFACTORY-US-961",
      "title": "Persistence in audit-sql and audit-immutable: migrations and mappings of AuditEntries, ChainHeads, Classifications, RedactionRules and Findings and the write-once container",
      "sequence": "12.03.02.02",
      "description": "Persistence in audit-sql and audit-immutable: migrations and mappings of AuditEntries, ChainHeads, Classifications, RedactionRules and Findings and the write-once container. Expected output: Migrations and mappings of the five tables of the model with their columns, the unique indexes UX_Audit_Tenant_Sequence and UX_Classifications_Resource and the indexes IX_Audit_Run, IX_Audit_Tenant_RecordedAt and IX_Findings_Tenant_State; the primary key of RedactionRules is TenantId and RuleId, the correction of the key of model/services/governance/AuditService.yaml reported under ADR-0015 amendment D113, so the data definition page is cited for columns and indexes only until it is regenerated; every mapping carries the tenant row filter of the Factory profile; the mapping of AuditEntries has no update and no delete beyond the redaction of AIFACTORY-US-969; no column holds prompt text, a payload or a secret value; the container of audit-immutable is provisioned with its write-once policy behind one mirror port; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.AuditService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Migrations and mappings of the five tables of the model with their columns, the unique indexes UX_Audit_Tenant_Sequence and UX_Classifications_Resource and the indexes IX_Audit_Run, IX_Audit_Tenant_RecordedAt and IX_Findings_Tenant_State; the primary key of RedactionRules is TenantId and RuleId, the correction of the key of model/services/governance/AuditService.yaml reported under ADR-0015 amendment D113, so the data definition page is cited for columns and indexes only until it is regenerated; every mapping carries the tenant row filter of the Factory profile; the mapping of AuditEntries has no update and no delete beyond the redaction of AIFACTORY-US-969; no column holds prompt text, a payload or a secret value; the container of audit-immutable is provisioned with its write-once policy behind one mirror port; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7702,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-233]",
      "number": 233
    },
    {
      "id": "AIFACTORY-TASK-3857",
      "type": "task",
      "parent": "AIFACTORY-US-961",
      "title": "Verify the scaffold, the aggregates and the stores of AuditService",
      "sequence": "12.03.02.03",
      "description": "Verify the scaffold, the aggregates and the stores of AuditService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"` in the pipeline of the repository; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-961: the unchanged scaffold with the Factory profile, the append-only entry, the refused weaker instance label, the state changes of a finding, the five tables with their unique indexes and the tenant row filter against an isolated database, the two tenants that hold a redaction rule of the same identifier as two rows, and the write-once behaviour of the mirror container.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Unit|Category=Mapping\"` in the pipeline of the repository; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-961: the unchanged scaffold with the Factory profile, the append-only entry, the refused weaker instance label, the state changes of a finding, the five tables with their unique indexes and the tenant row filter against an isolated database, the two tenants that hold a redaction rule of the same identifier as two rows, and the write-once behaviour of the mirror container."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3857]",
      "number": 3857
    },
    {
      "id": "AIFACTORY-US-962",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "AuditService host: six REST routes and four gRPC methods behind scope policies, messaging with the five events of the model, the evidence topic and the consumed events, and four hosted workers",
      "sequence": "12.03.03",
      "description": "This PBI hosts the surface of the service and delivers the behaviour of no operation. The service descriptor file of the repository lists the ten operations as the model does. The REST operations are `SearchAudit`, `ListClassifications` and `ListFindings` under the scope `factory.audit.read`, `ExportAudit` under `factory.audit.export`, of class external and idempotent on the `Idempotency-Key` header, and `SetClassification`, of class production, and `ResolveFinding`, of class shared-write, under `factory.audit.admin`, both with natural idempotency. The internal gRPC methods of the service `Audit` are `Record`, `Redact` and `RaiseFindings`, of class shared-write, and `Classify`, a read, none of them streaming; `RaiseFindings` takes `findings-v1`, replies `ack-v1` and requires the service scope `factory.audit.write` (D133). The contract test of the profile compares the hosted endpoints with that file in both directions. Each REST route sits behind the policy of its scope: a call without a token is answered 401, a valid user token without the scope is answered 403, and the audience a user token must carry is the one of the Governance gateway that fronts the service from I1 (D127), because a user token has one audience and a gateway forwards it unchanged (ADR-0015). A workload token carries service scopes and never satisfies a REST scope policy. Each gRPC method requires a workload token that holds the service scope naming AuditService, and `RaiseFindings` the scope `factory.audit.write`: a call without a workload identity is refused with UNAUTHENTICATED and a token without that scope with PERMISSION_DENIED, and the tenant and the project a workload forwards are read only under that scope. The answers the model does not list for an operation are given by the host and reported to the owner as codes the model omits: 401 for a missing token, 400 for a request that fails validation or an `ExportAudit` call without its key header, 409 on `ExportAudit` for a key reused with another input and on `ResolveFinding` for a second, different resolution, and 503 while a required dependency does not answer. The OpenAPI document and the proto fix the messages, and three differences between the descriptors the model names and what the methods carry are stated by a contract test and reported. `Audit.Record` takes the submitted shape of `audit-evidence-v1`, the record without `chainHash`, which the contracts package holds beside the stored shape, and replies `ack-v1`. `Audit.Classify` is modelled with `execution-scope-v1` as its request and `policy-decision-v1` as its reply; neither schema has a member for a resource, a data class, a retention, a redaction rule or a residency, so the proto carries the scope in the shape of the first and adds the resource to the request and the class, the retention, the rule identifiers and the residency to the reply as fields. `Audit.Redact` is modelled with `artifact-v1` on both sides, and the proto adds the resource whose label applies and the projection to the request and the applied rule identifiers to the reply. The schema of `audit-evidence-v1` and the aggregate `AuditEntry` also differ, and the contract test lists every member they do not share: `evidenceId` against `entryId`, `occurredAt` against `recordedAt`, `subject` against `target`, `chainHash` against `entryHash`; `policyDecisionId`, `redactions` and the approval identifier of the correlation, which only the schema has; and `sequence`, `kind`, `sourceEvent`, `correlationId`, `causationId` and `previousHash`, which only the aggregate has. Messaging follows the Orleans profile of the base template: the outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the `audit` messaging profile publishes the five events of the model in the run event envelope of the pinned contracts package. The service subscribes to `audit.evidence.v1.evidence-submitted`, the topic of the command `SubmitEvidence`, with the event type and the topic constant of the contracts package, and publishes nothing on it: its own acts are appended directly. The inbox registers 126 of the 127 consumed events of the model, from 45 producers, with deduplication on the event id: the 125 that `RecordEvidence` handles, `RunAccepted` of RunControlService among them (D126, D135), and `ToolEffectUncertain` for `RaiseUncertainFinding`. A producer that arrives in a later increment is registered now, because the model lists its event for this service, and its handler is proven with a fixture event built from the contracts package. The one event that is not registered is `DeletionOrderIssued` of RetentionResidencyService: its handler `RedactOnDeletionOrder` is built in I4 with that service. A test compares the registrations with the consumed events of the model in both directions. A handler that keeps failing is retried with back-off, and its delivery is poisoned at `MaxAttempts` of the subscriber, a contract failure at once; a poisoned delivery is visible in the poison metric of the adapter and is recovered through `IOutboxRecovery`, as AIFACTORY-US-226 of feature `component-base-template-factory-profile` delivers. This poisoned state is what the PBIs of this feature mean when an event is kept and never dropped; the feature builds no failed work store of its own. The section also declares the internal work messages of the service, each with a subscription of the service itself: the mirror write and the export work. No message of the service depends on deferred delivery. The four workers are hosted with their modelled triggers: `EvidenceWriter` on the consumed events with an exponential retry of ten attempts from ten seconds, the idempotency key of source event and event id and one execution at a time per tenant; `ChainVerifier` daily at one with a fixed retry of three attempts six hundred seconds apart, the key of tenant and day and at most two parallel executions; `RetentionAndRedactionSweeper` daily at three with the same retry, the key `entryId` and at most two parallel executions; and `ExportWorker` on an export request with an exponential retry of five attempts from three hundred seconds, the key of project and export request and one execution at a time per tenant. The schedule of each of the two scheduled workers is read from configuration, `Governance:Audit:ChainVerifierSchedule` and `Governance:Audit:RetentionSweeperSchedule`, with the schedule of the model as its default, so that an acceptance deployment lets a run fall inside its suite without a trigger (AIFACTORY-US-019); the options of the model list neither key, which is reported to the owner. The host offers no route that triggers a worker on demand. A fifth schedule, the sweep of unresolved uncertain effects, has no worker row in the model; AIFACTORY-US-970 hosts it and reports the missing row. What each operation, handler and worker does is delivered by AIFACTORY-US-964 to AIFACTORY-US-970. Kind: enabling. Traces: services: AuditService; aggregates: AuditService/AuditEntry; apis: AuditService/SearchAudit, AuditService/ExportAudit, AuditService/ListClassifications, AuditService/SetClassification, AuditService/ListFindings, AuditService/ResolveFinding, AuditService/Audit.Record, AuditService/Audit.Classify, AuditService/Audit.Redact, AuditService/Audit.RaiseFindings; events: AuditService/AuditEntryRecorded, AuditService/AuditChainVerified, AuditService/ClassificationChanged, AuditService/FindingRaised, AuditService/FindingResolved; descriptors: audit-evidence-v1, findings-v1, ack-v1, execution-scope-v1, policy-decision-v1, artifact-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-961, feature:component-base-template-factory-profile, feature:contracts-package. Sources: model/services/governance/AuditService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/reference/schemas/execution-scope.schema.json, docs/reference/schemas/policy-decision.schema.json, docs/reference/schemas/artifact.schema.json, docs/planes/trust-operations/governance/services/audit-service/index.md#apis, docs/planes/trust-operations/governance/services/audit-service/index.md#messages, docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given the service descriptor file and the hosted surface, when the contract test of the profile runs, then exactly the routes of `AuditService/SearchAudit`, `AuditService/ExportAudit`, `AuditService/ListClassifications`, `AuditService/SetClassification`, `AuditService/ListFindings` and `AuditService/ResolveFinding` and the methods `AuditService/Audit.Record`, `AuditService/Audit.Classify`, `AuditService/Audit.Redact` and `AuditService/Audit.RaiseFindings` are hosted with the scope, the side-effect class and the idempotency rule of model/services/governance/AuditService.yaml, and the test fails on an endpoint the file does not name and on an operation without an endpoint.",
        "AC2: Given each REST route called without a token, with a valid user token that lacks the scope of the route and with a user token of another audience, and each gRPC method called without a workload identity and with a workload token that lacks the service scope, when the call arrives, then it is answered 401, 403, 401, UNAUTHENTICATED and PERMISSION_DENIED respectively before any handler runs, and nothing is read or written (ADR-0015).",
        "AC3: Given a command that appends an `AuditService/AuditEntry` and is rolled back and one that commits, when the outbox of the `audit` messaging profile is read, then the first left no record and the second left its record in the transaction of the change, and the dispatcher publishes it in the run event envelope on the topic the model names for the event; the `OrleansMessaging` section declares the five events of the model, the subscription to `audit.evidence.v1.evidence-submitted` and the internal work messages of the service, declares no publication of the evidence event, and a publish of a message the section does not declare is refused (ADR-0014, ADR-0012).",
        "AC4: Given the consumed events of model/services/governance/AuditService.yaml and a fixture publisher for each, built from the pinned contracts package, when the registrations of the inbox are compared with the model and each event is delivered twice under one event id, then 126 events are registered, each reaches its handler once, a consumed event of the model without a registration and a registration without a consumed event fail the test, `DeletionOrderIssued` reaches no handler, a handler that keeps failing is poisoned at `MaxAttempts` and recovered through `IOutboxRecovery` without a second effect, a schedule of `ChainVerifier` or `RetentionAndRedactionSweeper` that fires twice under one idempotency key runs once, and a schedule set through `Governance:Audit:ChainVerifierSchedule` replaces the default of the model.",
        "AC5: Given the golden files of the proto and of the OpenAPI document, when the contract test compares the message of `AuditService/Audit.Record` with the submitted shape of docs/reference/schemas/audit-evidence.schema.json, then the shared members are equal in name and type, a request that carries `chainHash` is refused, the test lists every member the schema and the aggregate `AuditService/AuditEntry` do not share and every field the proto adds to the descriptors of `AuditService/Audit.Classify` and `AuditService/Audit.Redact`, and a change of either side fails it."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/artifact.schema.json",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#apis",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#messages",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-234",
        "AIFACTORY-TASK-235",
        "AIFACTORY-TASK-236",
        "AIFACTORY-TASK-3858"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7703,
      "kind": "enabling",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/AuditEntry"
        ],
        "apis": [
          "AuditService/SearchAudit",
          "AuditService/ExportAudit",
          "AuditService/ListClassifications",
          "AuditService/SetClassification",
          "AuditService/ListFindings",
          "AuditService/ResolveFinding",
          "AuditService/Audit.Record",
          "AuditService/Audit.Classify",
          "AuditService/Audit.Redact",
          "AuditService/Audit.RaiseFindings"
        ],
        "events": [
          "AuditService/AuditEntryRecorded",
          "AuditService/AuditChainVerified",
          "AuditService/ClassificationChanged",
          "AuditService/FindingRaised",
          "AuditService/FindingResolved"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "findings-v1",
          "ack-v1",
          "execution-scope-v1",
          "policy-decision-v1",
          "artifact-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-961",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/artifact.schema.json",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#apis",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#messages",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-962]",
      "number": 962
    },
    {
      "id": "AIFACTORY-TASK-234",
      "type": "task",
      "parent": "AIFACTORY-US-962",
      "title": "Contract and hosting of the surface: service descriptor, OpenAPI document and proto of the 6 REST and 4 gRPC operations behind their scope policies",
      "sequence": "12.03.03.01",
      "description": "Contract and hosting of the surface: service descriptor, OpenAPI document and proto of the 6 REST and 4 gRPC operations behind their scope policies. Expected output: The service descriptor file lists SearchAudit, ExportAudit, ListClassifications, SetClassification, ListFindings, ResolveFinding and Audit.Record, Audit.Classify, Audit.Redact and Audit.RaiseFindings with scope, side-effect class, idempotency and response codes as model/services/governance/AuditService.yaml does; the six routes are hosted behind the policies of factory.audit.read, factory.audit.export and factory.audit.admin with problem responses, the Idempotency-Key filter of ExportAudit and the audience of the Governance gateway for user tokens; the four methods are hosted behind the workload policy of the service scope, Audit.RaiseFindings behind factory.audit.write with findings-v1 as request and ack-v1 as reply; the OpenAPI document and the proto fix the messages by golden files: Audit.Record takes the submitted shape of audit-evidence-v1 without chainHash and replies ack-v1, Audit.Classify carries the scope in the shape of execution-scope-v1 with the resource as a field and replies the class, the retention, the rule identifiers and the residency as fields, and Audit.Redact carries artifact-v1 with the resource and the projection in the request and the applied rule identifiers in the reply; the contract test lists every member docs/reference/schemas/audit-evidence.schema.json and the aggregate AuditEntry do not share and every field added to a descriptor; the behaviour of each operation is delivered by AIFACTORY-US-964 to AIFACTORY-US-970, not here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AuditService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service descriptor file lists SearchAudit, ExportAudit, ListClassifications, SetClassification, ListFindings, ResolveFinding and Audit.Record, Audit.Classify, Audit.Redact and Audit.RaiseFindings with scope, side-effect class, idempotency and response codes as model/services/governance/AuditService.yaml does; the six routes are hosted behind the policies of factory.audit.read, factory.audit.export and factory.audit.admin with problem responses, the Idempotency-Key filter of ExportAudit and the audience of the Governance gateway for user tokens; the four methods are hosted behind the workload policy of the service scope, Audit.RaiseFindings behind factory.audit.write with findings-v1 as request and ack-v1 as reply; the OpenAPI document and the proto fix the messages by golden files: Audit.Record takes the submitted shape of audit-evidence-v1 without chainHash and replies ack-v1, Audit.Classify carries the scope in the shape of execution-scope-v1 with the resource as a field and replies the class, the retention, the rule identifiers and the residency as fields, and Audit.Redact carries artifact-v1 with the resource and the projection in the request and the applied rule identifiers in the reply; the contract test lists every member docs/reference/schemas/audit-evidence.schema.json and the aggregate AuditEntry do not share and every field added to a descriptor; the behaviour of each operation is delivered by AIFACTORY-US-964 to AIFACTORY-US-970, not here."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7703,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-234]",
      "number": 234
    },
    {
      "id": "AIFACTORY-TASK-235",
      "type": "task",
      "parent": "AIFACTORY-US-962",
      "title": "Messaging skeleton: outbox and inbox wiring of the audit profile for the 5 events of the model, the evidence topic, the internal work messages and 126 consumed events",
      "sequence": "12.03.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the audit profile for the 5 events of the model, the evidence topic, the internal work messages and 126 consumed events. Expected output: The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the audit messaging profile publishes AuditEntryRecorded, AuditChainVerified, ClassificationChanged, FindingRaised and FindingResolved in the run event envelope of the pinned contracts package, each declared with its topic and route under PublishedEvents of the OrleansMessaging section; the section declares the subscription to audit.evidence.v1.evidence-submitted with the event type and the topic constant of the pinned contracts package and no publication on it, and the internal work messages of the mirror write and the export work, each with a subscription of the service itself, none of them deferred; the inbox registers 126 of the 127 consumed events of the model with deduplication on the event id, the 125 of RecordEvidence with RunAccepted among them and ToolEffectUncertain, the events of producers of later increments among them; DeletionOrderIssued of RetentionResidencyService is not subscribed, its handler RedactOnDeletionOrder being built in I4 with that service; a test compares the registrations with the consumed events of the model in both directions; what each handler does is delivered by AIFACTORY-US-964 and AIFACTORY-US-970.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the audit messaging profile publishes AuditEntryRecorded, AuditChainVerified, ClassificationChanged, FindingRaised and FindingResolved in the run event envelope of the pinned contracts package, each declared with its topic and route under PublishedEvents of the OrleansMessaging section; the section declares the subscription to audit.evidence.v1.evidence-submitted with the event type and the topic constant of the pinned contracts package and no publication on it, and the internal work messages of the mirror write and the export work, each with a subscription of the service itself, none of them deferred; the inbox registers 126 of the 127 consumed events of the model with deduplication on the event id, the 125 of RecordEvidence with RunAccepted among them and ToolEffectUncertain, the events of producers of later increments among them; DeletionOrderIssued of RetentionResidencyService is not subscribed, its handler RedactOnDeletionOrder being built in I4 with that service; a test compares the registrations with the consumed events of the model in both directions; what each handler does is delivered by AIFACTORY-US-964 and AIFACTORY-US-970."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-235]",
      "number": 235
    },
    {
      "id": "AIFACTORY-TASK-236",
      "type": "task",
      "parent": "AIFACTORY-US-962",
      "title": "Worker hosting skeleton: triggers, retry policies and partitioning of EvidenceWriter, ChainVerifier, RetentionAndRedactionSweeper and ExportWorker",
      "sequence": "12.03.03.03",
      "description": "Worker hosting skeleton: triggers, retry policies and partitioning of EvidenceWriter, ChainVerifier, RetentionAndRedactionSweeper and ExportWorker. Expected output: EvidenceWriter is hosted on the consumed events with an exponential retry of ten attempts from ten seconds, the idempotency key of source event and event id and one execution at a time per tenant partition; ChainVerifier on the schedule 0 1 * * * with a fixed retry of three attempts six hundred seconds apart, the key of tenant and day and at most two parallel executions partitioned by tenant; RetentionAndRedactionSweeper on the schedule 0 3 * * * with the same retry, the key entryId and at most two parallel executions; ExportWorker as the consumer of the export work message with an exponential retry of five attempts from three hundred seconds, the key of project and export request and one execution at a time per tenant; the schedules of ChainVerifier and RetentionAndRedactionSweeper are read from Governance:Audit:ChainVerifierSchedule and Governance:Audit:RetentionSweeperSchedule with the schedule of the model as default, two keys the options of the model do not list, and no route triggers a worker on demand; a duplicate trigger and a redelivered work message have no second effect; what each worker does is delivered by AIFACTORY-US-964, AIFACTORY-US-965, AIFACTORY-US-967 and AIFACTORY-US-969.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "EvidenceWriter is hosted on the consumed events with an exponential retry of ten attempts from ten seconds, the idempotency key of source event and event id and one execution at a time per tenant partition; ChainVerifier on the schedule 0 1 * * * with a fixed retry of three attempts six hundred seconds apart, the key of tenant and day and at most two parallel executions partitioned by tenant; RetentionAndRedactionSweeper on the schedule 0 3 * * * with the same retry, the key entryId and at most two parallel executions; ExportWorker as the consumer of the export work message with an exponential retry of five attempts from three hundred seconds, the key of project and export request and one execution at a time per tenant; the schedules of ChainVerifier and RetentionAndRedactionSweeper are read from Governance:Audit:ChainVerifierSchedule and Governance:Audit:RetentionSweeperSchedule with the schedule of the model as default, two keys the options of the model do not list, and no route triggers a worker on demand; a duplicate trigger and a redelivered work message have no second effect; what each worker does is delivered by AIFACTORY-US-964, AIFACTORY-US-965, AIFACTORY-US-967 and AIFACTORY-US-969."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-236]",
      "number": 236
    },
    {
      "id": "AIFACTORY-TASK-3858",
      "type": "task",
      "parent": "AIFACTORY-US-962",
      "title": "Verify the hosted surface, the messaging profile and the hosted workers of AuditService",
      "sequence": "12.03.03.04",
      "description": "Verify the hosted surface, the messaging profile and the hosted workers of AuditService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-962: the surface compared with the service descriptor in both directions, the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every operation, the outbox record committed and rolled back with its change, the declared entries of the OrleansMessaging section with the evidence subscription and without a publication of the evidence event, the refused undeclared publish, the 126 registrations compared with model/services/governance/AuditService.yaml in both directions and deduplicated under fixture publishers, the unregistered DeletionOrderIssued, the poisoned and recovered delivery of a failing handler, the duplicate worker trigger, the schedule read from configuration, and the golden files compared with docs/reference/schemas/audit-evidence.schema.json with the complete list of members that are not shared.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-962: the surface compared with the service descriptor in both directions, the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every operation, the outbox record committed and rolled back with its change, the declared entries of the OrleansMessaging section with the evidence subscription and without a publication of the evidence event, the refused undeclared publish, the 126 registrations compared with model/services/governance/AuditService.yaml in both directions and deduplicated under fixture publishers, the unregistered DeletionOrderIssued, the poisoned and recovered delivery of a failing handler, the duplicate worker trigger, the schedule read from configuration, and the golden files compared with docs/reference/schemas/audit-evidence.schema.json with the complete list of members that are not shared."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3858]",
      "number": 3858
    },
    {
      "id": "AIFACTORY-US-963",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "AuditService keeps one chain per tenant, filters every query by tenant and project, signs with a key that stays in the vault and keeps evidence text and content out of telemetry",
      "sequence": "12.03.04",
      "description": "AuditService holds the evidence of every tenant, and the model classifies its data as restricted, so isolation, the custody of the signing key and the silence of its telemetry are deliverables of their own. Tenant isolation is the row filter of the profile: every query on `AuditEntries`, `ChainHeads`, `Classifications`, `RedactionRules` and `Findings` carries the tenant of the trusted scope, so an entry, a label, a rule or a finding of another tenant is invisible. A request that addresses a finding by identifier is answered 404 for a finding of another tenant, the same answer as for an identifier that does not exist, and a search or a list returns nothing of another tenant and never confirms that it exists (ADR-0015). The chain is per tenant as well: an entry is appended to the chain of the tenant its evidence names and to no other. The tenant of an evidence event is the trusted tenant of its envelope; a record whose `tenantId` differs from it is not appended: its delivery is a contract failure that the inbox poisons at once, where it stays visible in the poison metric and recoverable through `IOutboxRecovery` (AIFACTORY-US-226 of feature `component-base-template-factory-profile`), and `Audit.Record` refuses a record whose tenant is not the one the workload forwards with INVALID_ARGUMENT, because the tenant never comes from a body. Inside a tenant the project is the second boundary for evidence. An entry carries the optional project of the act; a user token reads the entries of a project only with one of the roles of the model in that project, Reviewer, Operator, Workspace admin or Observer, or with the tenant-wide Platform admin role. An entry without a project belongs to its tenant and is read only with a tenant-wide role, Platform admin or an Observer assigned at the tenant, as the role table of ADR-0015 allows. A caller that names a project of its own tenant in which it holds no role is answered 403, because a missing right inside the own tenant is never answered as not found. Classification labels and findings belong to the tenant and carry no project; `factory.audit.admin` and `factory.audit.export` are scopes the model gives to the Platform admin and to tenant auditors. The two secrets of the model reach the service as secret references and never as values: `audit-chain-key`, the key in Azure Key Vault that signs the head of a chain and that `Governance:Audit:ChainSigningKeyId` names, and `messaging-transport`; their rotation periods are the ones the model states and are applied by the platform. The signing key never leaves the vault: the service asks the vault to sign through one signing port, holds no key material, and an architecture test fails when another type references the vault client. The service is unready while a reference cannot be resolved, and readiness names each required dependency that does not answer: `audit-sql`, `audit-immutable`, Key Vault and ArtifactService, which the model marks required. Telemetry follows the Factory conventions through the single enrichment registration of the pinned observability libraries. The four instruments of the model are created through the instrument helper: `connectsoft.factory.audit.entries` with tenant and kind, `connectsoft.factory.audit.chain_lag` with tenant, the age of the oldest consumed event not yet appended, `connectsoft.factory.audit.chain_valid` with tenant, and `connectsoft.factory.audit.findings_open` with tenant and severity. The two objectives of the model are read on them: the evidence lag from event to chain, thirty seconds at the 95th percentile, for which the model gives no histogram and which is watched on `chain_lag`, and a valid chain verification every day, watched on `chain_valid`. Metrics carry tenant and, where an entry names one, project; activities and log records carry tenant and project, and run, step and attempt when the evidence names a run. No reason text, no actor identifier, no target and no content that `Audit.Redact` handles reaches a metric, an activity or a log record: the entry identifier, the sequence and the kind stand in their place (ADR-0019). Kind: enabling. Traces: services: AuditService; aggregates: AuditService/AuditEntry, AuditService/Finding; apis: AuditService/SearchAudit, AuditService/ResolveFinding, AuditService/Audit.Record, AuditService/Audit.Redact; adrs: ADR-0015, ADR-0019; requirements: NFR-03, NFR-10. Relates: nfrs: NFR-10. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, feature:component-base-template-factory-profile, feature:component-observability-factory-conventions. Sources: model/services/governance/AuditService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/data-governance.md#logging-and-telemetry, docs/planes/trust-operations/governance/security.md#evidence-integrity, docs/planes/trust-operations/governance/services/audit-service/index.md#security, docs/planes/trust-operations/governance/services/audit-service/index.md#metrics-and-observability.",
      "acceptanceCriteria": [
        "AC1: Given entries, labels and findings of two tenants, when a caller of the first tenant searches through `AuditService/SearchAudit` for a run of the second, lists findings and labels, and addresses a finding of the second through `AuditService/ResolveFinding`, then the search and the lists return nothing of the second tenant, the finding is answered 404 exactly as an unknown identifier, an evidence event whose record names another tenant than its envelope is not appended and its delivery is poisoned in the inbox as a contract failure, and `AuditService/Audit.Record` with a record of another tenant than the forwarded one is refused with INVALID_ARGUMENT (ADR-0015).",
        "AC2: Given entries of two projects of one tenant and entries without a project, when `AuditService/SearchAudit` is called with a token that holds a role in the first project only, with the Platform admin role and with an Observer role assigned at the tenant, then the first receives the entries of its project and is answered 403 when it names the second project, and the two tenant-wide roles receive the entries of both projects and the entries without a project (docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC3: Given a start without a resolvable secret reference for `audit-chain-key` or for `messaging-transport`, when readiness is probed, then the service is unready and names the missing reference; and when the architecture test runs, then the signing port is the only type that references the vault client, no type of the solution holds key material, and neither the configuration of the repository nor any log record holds a secret value (model/services/governance/AuditService.yaml).",
        "AC4: Given evidence whose reason, actor and target carry a marker text and content with a marker that is redacted through `AuditService/Audit.Redact`, when the collected metrics, activities and log records of an append, a search, an export, a verification and a redaction are scanned, then none holds a marker, the metrics carry their modelled dimensions with tenant, and the activities and log records of an entry that names a run carry run, step and attempt (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/data-governance.md#logging-and-telemetry",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#security",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#metrics-and-observability"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-237",
        "AIFACTORY-TASK-3859",
        "AIFACTORY-TASK-3860"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7704,
      "kind": "enabling",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/AuditEntry",
          "AuditService/Finding"
        ],
        "apis": [
          "AuditService/SearchAudit",
          "AuditService/ResolveFinding",
          "AuditService/Audit.Record",
          "AuditService/Audit.Redact"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03",
          "NFR-10"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "feature:component-base-template-factory-profile",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/data-governance.md#logging-and-telemetry",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#security",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#metrics-and-observability"
      ],
      "titlePrefix": "[AIFACTORY-US-963]",
      "number": 963
    },
    {
      "id": "AIFACTORY-TASK-237",
      "type": "task",
      "parent": "AIFACTORY-US-963",
      "title": "Security, tenancy and telemetry of AuditService",
      "sequence": "12.03.04.01",
      "description": "Security, tenancy and telemetry of AuditService. Expected output: Every query of the five tables runs under the tenant row filter of the Factory profile, so a finding of another tenant is answered 404 exactly as an unknown one and no search or list returns a row of another tenant; an entry is appended to the chain of the tenant of its envelope or of the forwarded scope only, a record of another tenant being poisoned in the inbox as a contract failure or refused with INVALID_ARGUMENT; the entries of a project are read with one of the roles Reviewer, Operator, Workspace admin or Observer in that project, with an Observer role assigned at the tenant or with the Platform admin role, the entries without a project with a tenant-wide role only, and another project of the own tenant is answered 403; audit-chain-key and messaging-transport are read as secret references, a missing reference keeps the service unready, and one signing port asks Azure Key Vault to sign, so that no key material is in the service; readiness names audit-sql, audit-immutable, Key Vault and ArtifactService; the instruments connectsoft.factory.audit.entries, connectsoft.factory.audit.chain_lag, connectsoft.factory.audit.chain_valid and connectsoft.factory.audit.findings_open are created through the instrument helper with their modelled dimensions; no reason text, actor identifier, target or content reaches a metric, an activity or a log record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Every query of the five tables runs under the tenant row filter of the Factory profile, so a finding of another tenant is answered 404 exactly as an unknown one and no search or list returns a row of another tenant; an entry is appended to the chain of the tenant of its envelope or of the forwarded scope only, a record of another tenant being poisoned in the inbox as a contract failure or refused with INVALID_ARGUMENT; the entries of a project are read with one of the roles Reviewer, Operator, Workspace admin or Observer in that project, with an Observer role assigned at the tenant or with the Platform admin role, the entries without a project with a tenant-wide role only, and another project of the own tenant is answered 403; audit-chain-key and messaging-transport are read as secret references, a missing reference keeps the service unready, and one signing port asks Azure Key Vault to sign, so that no key material is in the service; readiness names audit-sql, audit-immutable, Key Vault and ArtifactService; the instruments connectsoft.factory.audit.entries, connectsoft.factory.audit.chain_lag, connectsoft.factory.audit.chain_valid and connectsoft.factory.audit.findings_open are created through the instrument helper with their modelled dimensions; no reason text, actor identifier, target or content reaches a metric, an activity or a log record."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-237]",
      "number": 237
    },
    {
      "id": "AIFACTORY-TASK-3859",
      "type": "task",
      "parent": "AIFACTORY-US-963",
      "title": "Two-tenant fixture with user and workload tokens, publishers of every consumed event, fakes of the artifact store, the mirror and the signing key, and a telemetry collector",
      "sequence": "12.03.04.02",
      "description": "Two-tenant fixture with user and workload tokens, publishers of every consumed event, fakes of the artifact store, the mirror and the signing key, and a telemetry collector. Expected output: The acceptance suite holds two tenants with two projects each, user tokens of the Governance gateway audience with and without factory.audit.read, factory.audit.export and factory.audit.admin, with a role in one project, with the Platform admin role and with an Observer role assigned at the tenant, workload tokens with and without the service scope naming AuditService, a publisher for every consumed event of model/services/governance/AuditService.yaml and for AuditEvidenceSubmitted built from the pinned contracts package, evidence and content that carry a marker text, a fake of ArtifactService that records Artifacts.Store and Artifacts.Fetch, keeps stored content by hash and can stop answering, a fake mirror behind the mirror port that is write-once and can stop answering, a fake of the signing port that signs and verifies with a test key, names the key version and can stop answering, a clock the suite moves, and an in-memory collector of metrics, activities, log records and outbox records; the fixture serves the suites of AIFACTORY-US-963 to AIFACTORY-US-970.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The acceptance suite holds two tenants with two projects each, user tokens of the Governance gateway audience with and without factory.audit.read, factory.audit.export and factory.audit.admin, with a role in one project, with the Platform admin role and with an Observer role assigned at the tenant, workload tokens with and without the service scope naming AuditService, a publisher for every consumed event of model/services/governance/AuditService.yaml and for AuditEvidenceSubmitted built from the pinned contracts package, evidence and content that carry a marker text, a fake of ArtifactService that records Artifacts.Store and Artifacts.Fetch, keeps stored content by hash and can stop answering, a fake mirror behind the mirror port that is write-once and can stop answering, a fake of the signing port that signs and verifies with a test key, names the key version and can stop answering, a clock the suite moves, and an in-memory collector of metrics, activities, log records and outbox records; the fixture serves the suites of AIFACTORY-US-963 to AIFACTORY-US-970."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7704,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3859]",
      "number": 3859
    },
    {
      "id": "AIFACTORY-TASK-3860",
      "type": "task",
      "parent": "AIFACTORY-US-963",
      "title": "Verify tenancy, the project boundary, secret references and telemetry of AuditService",
      "sequence": "12.03.04.03",
      "description": "Verify tenancy, the project boundary, secret references and telemetry of AuditService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenancyAndTelemetry\"` and the architecture tests; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-963: the empty search and lists for another tenant, 404 for a foreign finding equal to the answer for an unknown one, the record of another tenant that is not appended, the entries of a project read with a role in it and 403 for another project of the tenant, the entries without a project read with a tenant-wide role only, the unready start without a secret reference, the single signing port, and the scan of metrics, activities and log records for the marker text.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=TenancyAndTelemetry\"` and the architecture tests; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-963: the empty search and lists for another tenant, 404 for a foreign finding equal to the answer for an unknown one, the record of another tenant that is not appended, the entries of a project read with a role in it and 403 for another project of the tenant, the entries without a project read with a tenant-wide role only, the unready start without a secret reference, the single signing port, and the scan of metrics, activities and log records for the marker text."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3860]",
      "number": 3860
    },
    {
      "id": "AIFACTORY-US-964",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Append submitted evidence, recorded events and directly recorded commands once each to the hash chain of their tenant and mirror every entry to the immutable store",
      "sequence": "12.03.05",
      "description": "Every piece of evidence ends in one append, whichever of three paths it arrives on. The first path is the evidence event. A Factory service writes an `audit-evidence-v1` record to its own outbox in the transaction of its command, and the record arrives as `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted` in the run event envelope; the command `SubmitEvidence` appends it once per evidence identifier, which is also the event id (D115). The second path is the consumed events. `RecordEvidence`, run by the worker `EvidenceWriter`, turns each of the 125 integration events the model lists for it into one entry. A mapping table, one reviewed file of the repository with one row per consumed event of the model and fixed by a golden file, gives the entry its `kind`, its `action`, the payload member that names the target with its version or hash, the member that names the acting identity where the payload has one, and the outcome. The rows follow one default rule, applied in this order, so that no developer classifies the trail anew. The family is ApprovalDecision for the approval events, PolicyDecision for `PolicyDecisionRecorded`, Publication for publications and activations, CredentialIssuance for the events of SecretBrokerService, ToolEffect for the tool events, DataLifecycle for deletions, retention and offboarding, AccessChange for membership, delegation and grant changes, Export for exports, and Command for every other event. The `action` is the event name. The target is the payload member that identifies the aggregate of the event, with the version or hash member where the payload has one. The outcome is the value of the payload member that names a state, a decision or a result where the event has one, and the fixed value recorded where it has none. Tenant, project, run, correlation and causation come from the envelope, `sourceEvent` is the producing service and the event name, and no other member of the payload is copied, because evidence never holds prompt text, payloads or secret values. The third path is `AuditService/Audit.Record`, by which a service with a workload token that holds the service scope appends evidence of a command that is not an event; in this increment no service of the model calls it, so it is proven with a workload of the fixture. All three use one append routine. It takes the chain of the tenant exclusively, so that one entry is appended per tenant at a time whichever path it came by, gives the entry the next `sequence` of the tenant and the `entryHash` of its predecessor as `previousHash`, the first entry of a tenant taking a fixed starting value, and computes `entryHash` over the canonical form of the record together with `previousHash`, in the text form the Factory uses for a hash, fixed by a golden file. Before hashing, the text members pass the audit profile of the pinned Compliance library once more, so that a record that arrives unredacted is stored redacted. A personal identifier of the actor enters the hash as a salted digest that is kept beside it, so that the later redaction of the identifier leaves the hash valid (AIFACTORY-US-969). In one transaction the routine writes the `AuditEntries` row, the `AuditEntryRecorded` outbox record and the mirror work message; the unique index on tenant and sequence refuses what the exclusive append missed, and the append is repeated. A mirror writer then writes each entry in the order of its sequence to `audit-immutable` as the canonical record with its hash, with the digest in place of a personal identifier, so that the write-once store never holds one. The members of `audit-evidence-v1` for which the model gives `AuditEntries` no column, `occurredAt`, `policyDecisionId`, `redactions` and the approval identifier, are part of the canonical record and of the mirror and are not columns; this is reported. Duplicates add nothing: an evidence identifier that is already an entry and an event whose source event and event id were already recorded are acknowledged and skipped, and `Audit.Record` answers a repeated record with the same content with OK and `ack-v1` and the same identifier with other content with ALREADY_EXISTS. A record that fails the schema, that carries `chainHash`, or whose tenant is not the tenant of its envelope or of the forwarded scope is not appended: over gRPC it is refused with INVALID_ARGUMENT, and as an event its delivery is a contract failure that the inbox poisons at once and counts, the poisoned state AIFACTORY-US-962 describes. The failure modes of the model are kept. When `audit-immutable` does not answer, appends to `audit-sql` continue, the mirror work waits in the outbox and is written in order when the store returns, and the chain is not broken. When `audit-sql` does not answer, a handler fails and the inbox redelivers it by the retry policy of `EvidenceWriter`; an event whose attempts are used up is poisoned in the inbox, visible in the poison metric of the adapter and recoverable through `IOutboxRecovery` (AIFACTORY-US-226 of feature `component-base-template-factory-profile`), and is never dropped, and `connectsoft.factory.audit.chain_lag` shows the age of the oldest event not yet appended while the partitions of other tenants keep writing. Two acts are fixed by decision. A run submission is audited through `RunAccepted` of RunControlService, which `RecordEvidence` appends as the evidence of the submission, with the family Command by the default rule and the requester, the pinned release and the policy revision of the accepted run in its target and outcome (D126, D135). A credential issuance leaves exactly one entry, the one `RecordEvidence` appends for `CredentialIssued`, which names the policy decision that allowed it, because SecretBrokerService submits no evidence record of its own for an issuance (D126, D135). `AuditEntryRecorded` carries `entryId`, `tenantId`, `sequence`, `kind`, `action` and the optional `runId` and is published on `audit.evidence.v1.audit-entry-recorded`; since the dashboards of I4 keep the run projections and the overviews only (D131), the model lists no consumer of it. Three points are reported to the owner and decided nowhere here: the stored record is `audit-evidence-v1` with a closed list of fourteen actions while the consumed events name many more acts and several fit none of the nine families of `EvidenceKind`, so the default rule sends them to Command and the mapping file needs the confirmation of the owner; the two representatives of generated products among the producers have no Factory repository; and the model gives the lag objective no instrument of its own. Kind: behavior. Traces: services: AuditService; aggregates: AuditService/AuditEntry; apis: AuditService/Audit.Record; events: AuditService/AuditEntryRecorded, RunControlService/RunAccepted, RunControlService/ApprovalDecided, PolicyEngineService/PolicyDecisionRecorded, ToolAdapterService/ToolInvoked, SecretBrokerService/CredentialIssued; descriptors: audit-evidence-v1, ack-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0019; requirements: FR-06, NFR-04; scenarios: SCN-AuditService-007, SCN-AuditService-010. Relates: nfrs: NFR-04. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, feature:contracts-package, feature:component-compliance-factory-classifications, feature:run-control-service, feature:policy-engine-service, feature:tool-adapter-service, feature:secret-broker-service. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/planes/trust-operations/governance/events.md, docs/planes/trust-operations/governance/services/audit-service/index.md#failure-and-recovery, docs/planes/trust-operations/governance/security.md#evidence-integrity.",
      "acceptanceCriteria": [
        "AC1: Given an `audit-evidence-v1` submission delivered as `AuditEvidenceSubmitted` on `audit.evidence.v1.evidence-submitted`, when `SubmitEvidence` handles it, then one `AuditService/AuditEntry` exists whose identifier is the evidence identifier, with the next sequence of the tenant of the envelope, the hash of its predecessor as `previousHash` and an `entryHash` that follows from the canonical record, and the `AuditService/AuditEntryRecorded` outbox record was written in the same transaction; the same event delivered twice leaves one entry, and a record that fails docs/reference/schemas/audit-evidence.schema.json or names another tenant than its envelope is not appended and its delivery is poisoned in the inbox as a contract failure.",
        "AC2: Given the mapping file with its golden file and a fixture event for each of its 125 rows, `RunControlService/RunAccepted`, `RunControlService/ApprovalDecided`, `PolicyEngineService/PolicyDecisionRecorded`, `ToolAdapterService/ToolInvoked` and `SecretBrokerService/CredentialIssued` among them, when `RecordEvidence` handles it, then one `AuditService/AuditEntry` exists and the test compares its `kind`, `action`, target and outcome with the row of that file, the five named events taking the families Command, ApprovalDecision, PolicyDecision, ToolEffect and CredentialIssuance, the issuance once only and with the policy decision it names, and each `action` being the event name, with tenant, project, run and correlation of the envelope and `sourceEvent` naming the producer and the event, no other payload member is stored, the same event id delivered twice leaves one entry, and a consumed event of model/services/governance/AuditService.yaml without a row, a row without a consumed event and a row that departs from the golden file each fail the test.",
        "AC3: Given a workload with the service scope, when `AuditService/Audit.Record` is called with a valid submission, then the reply is `ack-v1` after the entry is committed in the chain of the forwarded tenant; a repeated call with the same record is answered OK with `ack-v1` and leaves one entry, the same evidence identifier with other content is answered ALREADY_EXISTS and changes nothing, and a call without a workload identity, without the service scope, with an invalid record, with `chainHash` or with the tenant of another scope is refused with UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT and appends nothing (SCN-AuditService-007, ADR-0015).",
        "AC4: Given evidence of two tenants arrives on all three paths at once, when the entries are read, then each tenant has consecutive sequences without a gap or a duplicate and every `previousHash` equals the `entryHash` before it; given the mirror stops answering, then appends continue, the mirror work waits and is written in sequence order when it returns, and the mirror holds every entry once with its hash and without a personal identifier; given `audit-sql` stops answering, then the event is redelivered by the retry policy of `EvidenceWriter`, nothing is dropped and `connectsoft.factory.audit.chain_lag` rises for that tenant only (docs/planes/trust-operations/governance/services/audit-service/index.md).",
        "AC5: Given an entry was appended, when the outbox dispatcher publishes `AuditService/AuditEntryRecorded` on `audit.evidence.v1.audit-entry-recorded`, then the event is sent in the run event envelope with `entryId`, `tenantId`, `sequence`, `kind`, `action` and, for an entry that names a run, `runId`, it holds no reason, actor or target, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AuditService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/trust-operations/governance/events.md",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#failure-and-recovery",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3861",
        "AIFACTORY-TASK-306",
        "AIFACTORY-TASK-3879",
        "AIFACTORY-TASK-3862",
        "AIFACTORY-TASK-3863"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7705,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/AuditEntry"
        ],
        "apis": [
          "AuditService/Audit.Record"
        ],
        "events": [
          "AuditService/AuditEntryRecorded",
          "RunControlService/RunAccepted",
          "RunControlService/ApprovalDecided",
          "PolicyEngineService/PolicyDecisionRecorded",
          "ToolAdapterService/ToolInvoked",
          "SecretBrokerService/CredentialIssued"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "ack-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-06",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-AuditService-007",
          "SCN-AuditService-010"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "feature:contracts-package",
        "feature:component-compliance-factory-classifications",
        "feature:run-control-service",
        "feature:policy-engine-service",
        "feature:tool-adapter-service",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/planes/trust-operations/governance/events.md",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#failure-and-recovery",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity"
      ],
      "titlePrefix": "[AIFACTORY-US-964]",
      "number": 964
    },
    {
      "id": "AIFACTORY-TASK-3861",
      "type": "task",
      "parent": "AIFACTORY-US-964",
      "title": "Append routine of the tenant chain and Audit.Record",
      "sequence": "12.03.05.01",
      "description": "Append routine of the tenant chain and Audit.Record. Expected output: One append routine takes the chain of a tenant exclusively, assigns the next sequence, sets previousHash to the entryHash of the predecessor or to the fixed starting value, passes the text members through the audit profile of the pinned Compliance library, represents a personal identifier of the actor by a salted digest kept beside it, computes entryHash over the canonical record and previousHash in the hash text form a golden file fixes, and writes the AuditEntries row, the AuditEntryRecorded outbox record and the mirror work message in one transaction, repeating on a refusal of UX_Audit_Tenant_Sequence; Audit.Record validates the submitted shape of audit-evidence-v1, refuses chainHash and a tenant other than the forwarded one with INVALID_ARGUMENT, appends through the routine and replies ack-v1, answers OK with ack-v1 for a repeated record with the same content and ALREADY_EXISTS for the same identifier with other content; connectsoft.factory.audit.entries is recorded by tenant and kind.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "One append routine takes the chain of a tenant exclusively, assigns the next sequence, sets previousHash to the entryHash of the predecessor or to the fixed starting value, passes the text members through the audit profile of the pinned Compliance library, represents a personal identifier of the actor by a salted digest kept beside it, computes entryHash over the canonical record and previousHash in the hash text form a golden file fixes, and writes the AuditEntries row, the AuditEntryRecorded outbox record and the mirror work message in one transaction, repeating on a refusal of UX_Audit_Tenant_Sequence; Audit.Record validates the submitted shape of audit-evidence-v1, refuses chainHash and a tenant other than the forwarded one with INVALID_ARGUMENT, appends through the routine and replies ack-v1, answers OK with ack-v1 for a repeated record with the same content and ALREADY_EXISTS for the same identifier with other content; connectsoft.factory.audit.entries is recorded by tenant and kind."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3861]",
      "number": 3861
    },
    {
      "id": "AIFACTORY-TASK-306",
      "type": "task",
      "parent": "AIFACTORY-US-964",
      "title": "Evidence writer over the submitted evidence and the consumed events",
      "sequence": "12.03.05.02",
      "description": "Evidence writer over the submitted evidence and the consumed events. Expected output: The handler of SubmitEvidence appends each audit-evidence-v1 submission that arrives as AuditEvidenceSubmitted once per evidence identifier through the routine of AIFACTORY-TASK-3861; RecordEvidence, run by EvidenceWriter, appends one entry per consumed event from the mapping file of AIFACTORY-TASK-3879, whose row gives kind, action, the target member with its version or hash, the acting identity where the payload has one and the outcome, takes tenant, project, run, correlation and causation from the envelope and sourceEvent from producer and event name, and copies no other payload member; a repeated evidence identifier and a repeated source event and event id add no entry; a record that fails the schema or names another tenant than its envelope is a contract failure that the inbox poisons at once and counts, and an event whose attempts are used up is poisoned and recoverable through IOutboxRecovery, never dropped; connectsoft.factory.audit.chain_lag reports the age of the oldest event not yet appended per tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The handler of SubmitEvidence appends each audit-evidence-v1 submission that arrives as AuditEvidenceSubmitted once per evidence identifier through the routine of AIFACTORY-TASK-3861; RecordEvidence, run by EvidenceWriter, appends one entry per consumed event from the mapping file of AIFACTORY-TASK-3879, whose row gives kind, action, the target member with its version or hash, the acting identity where the payload has one and the outcome, takes tenant, project, run, correlation and causation from the envelope and sourceEvent from producer and event name, and copies no other payload member; a repeated evidence identifier and a repeated source event and event id add no entry; a record that fails the schema or names another tenant than its envelope is a contract failure that the inbox poisons at once and counts, and an event whose attempts are used up is poisoned and recoverable through IOutboxRecovery, never dropped; connectsoft.factory.audit.chain_lag reports the age of the oldest event not yet appended per tenant."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-306]",
      "number": 306
    },
    {
      "id": "AIFACTORY-TASK-3879",
      "type": "task",
      "parent": "AIFACTORY-US-964",
      "title": "Evidence mapping file of the 124 consumed events with its default rule and its golden file",
      "sequence": "12.03.05.03",
      "description": "Evidence mapping file of the 124 consumed events with its default rule and its golden file. Expected output: One reviewed file of the repository holds one row for each of the 125 events that model/services/governance/AuditService.yaml lists for RecordEvidence, with kind, action, the target member with its version or hash, the member of the acting identity where the payload has one and the outcome; the rows are written by the default rule in this order: ApprovalDecision for the approval events, PolicyDecision for PolicyDecisionRecorded, Publication for publications and activations, CredentialIssuance for the events of SecretBrokerService, ToolEffect for the tool events, DataLifecycle for deletions, retention and offboarding, AccessChange for membership, delegation and grant changes, Export for exports and Command for every other event; the action is the event name, the target is the payload member that identifies the aggregate of the event, and the outcome is the payload member that names a state, a decision or a result, or the fixed value recorded where the event has none; a golden file fixes the file, so that a changed row fails the contract test until the golden file is reviewed again; the test also fails on a consumed event without a row and on a row without a consumed event; the confirmation of the rows by the owner is reported as open.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "One reviewed file of the repository holds one row for each of the 125 events that model/services/governance/AuditService.yaml lists for RecordEvidence, with kind, action, the target member with its version or hash, the member of the acting identity where the payload has one and the outcome; the rows are written by the default rule in this order: ApprovalDecision for the approval events, PolicyDecision for PolicyDecisionRecorded, Publication for publications and activations, CredentialIssuance for the events of SecretBrokerService, ToolEffect for the tool events, DataLifecycle for deletions, retention and offboarding, AccessChange for membership, delegation and grant changes, Export for exports and Command for every other event; the action is the event name, the target is the payload member that identifies the aggregate of the event, and the outcome is the payload member that names a state, a decision or a result, or the fixed value recorded where the event has none; a golden file fixes the file, so that a changed row fails the contract test until the golden file is reviewed again; the test also fails on a consumed event without a row and on a row without a consumed event; the confirmation of the rows by the owner is reported as open."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7705,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3879]",
      "number": 3879
    },
    {
      "id": "AIFACTORY-TASK-3862",
      "type": "task",
      "parent": "AIFACTORY-US-964",
      "title": "Mirror writer to the immutable store in the order of the tenant sequence",
      "sequence": "12.03.05.04",
      "description": "Mirror writer to the immutable store in the order of the tenant sequence. Expected output: The consumer of the mirror work message writes each entry to audit-immutable through the mirror port as the canonical record with its entryHash, with the digest in place of a personal identifier and with the members of audit-evidence-v1 that have no column, once per entry and in the order of the tenant sequence; while the store does not answer the work waits in the outbox and appends to audit-sql continue; when it returns the waiting entries are written in order; a second delivery of the work of an entry writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The consumer of the mirror work message writes each entry to audit-immutable through the mirror port as the canonical record with its entryHash, with the digest in place of a personal identifier and with the members of audit-evidence-v1 that have no column, once per entry and in the order of the tenant sequence; while the store does not answer the work waits in the outbox and appends to audit-sql continue; when it returns the waiting entries are written in order; a second delivery of the work of an entry writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3862]",
      "number": 3862
    },
    {
      "id": "AIFACTORY-TASK-3863",
      "type": "task",
      "parent": "AIFACTORY-US-964",
      "title": "Verify the three append paths, the mirror and the event through the acceptance suite",
      "sequence": "12.03.05.05",
      "description": "Verify the three append paths, the mirror and the event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AuditService-007|Scenario=SCN-AuditService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-964 with the fixture of AIFACTORY-TASK-3859: the entry of a submitted record with its chain members and its outbox record in one transaction, one entry per fixture event of the 125 mapped events, compared with its row of the mapping file of AIFACTORY-TASK-3879, with redeliveries, the accepted call of Audit.Record, the repeated call answered OK, the conflicting call answered ALREADY_EXISTS and its refusals, consecutive sequences of two tenants under concurrent appends on the three paths, the mirror written in order after an outage of the fake mirror, the redelivery after an outage of the store, and the publication and payload of AuditEntryRecorded with a transport outage; the model lists no consumer of the event (D131).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AuditService-007|Scenario=SCN-AuditService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-964 with the fixture of AIFACTORY-TASK-3859: the entry of a submitted record with its chain members and its outbox record in one transaction, one entry per fixture event of the 125 mapped events, compared with its row of the mapping file of AIFACTORY-TASK-3879, with redeliveries, the accepted call of Audit.Record, the repeated call answered OK, the conflicting call answered ALREADY_EXISTS and its refusals, consecutive sequences of two tenants under concurrent appends on the three paths, the mirror written in order after an outage of the fake mirror, the redelivery after an outage of the store, and the publication and payload of AuditEntryRecorded with a transport outage; the model lists no consumer of the event (D131)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3863]",
      "number": 3863
    },
    {
      "id": "AIFACTORY-US-965",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Verify the hash chain of every tenant daily, sign its head with the key in the vault and raise a Critical finding on a break",
      "sequence": "12.03.06",
      "description": "The chain is proof only when it is checked. The worker `ChainVerifier`, hosted by AIFACTORY-US-962 daily, takes each tenant that has entries and verifies its chain since the last signed head, the row of the tenant in `ChainHeads`. It recomputes the `entryHash` of every entry from its stored record and its `previousHash`, checks that each `previousHash` is the `entryHash` of the entry before it and that the sequences have no gap, and so finds an altered entry, a removed entry and a relinked entry alike. When the span is intact, the worker asks Azure Key Vault through the signing port to sign the hash of the last entry of the span with the key that `Governance:Audit:ChainSigningKeyId` names; the key never leaves the vault. In one transaction it replaces the head of the tenant, with `HeadSequence` and `HeadHash` of that last entry, `SignedAt` and `Signature`, writes the `AuditChainVerified` outbox record with `valid` true and that head sequence, and appends one entry of the verification through the append routine of AIFACTORY-US-964, because a verification result is itself evidence. The order is exact. The head covers the entries up to the last entry before the verification entry. The verification entry is the first entry after the signed head: it takes the hash of the head as its `previousHash`, the `kind` Command and the action `chain-verified`, names the chain of the tenant with the head sequence and the head hash as its target and the worker as its actor, and has its own `AuditEntryRecorded` outbox record. The worker holds the chain of the tenant exclusively, as the append routine does, from the check of the last entry to the commit, so that no other entry comes between the signed head and the verification entry. The next run starts with that entry. A span that holds nothing but the verification entry of the previous run is verified and signed, so that the head moves onto that entry, and appends no new verification entry; a tenant whose head already covers its last entry has no span, and a run writes, signs and appends nothing for it. The chain of an idle tenant therefore stops growing after its second run. Two points are corrections of the model and are reported to the owner: the worker row of `ChainVerifier` lists `AuditChainVerified` and `FindingRaised` as its output and not the `AuditEntryRecorded` of the verification entry, and `EvidenceKind` has no family for an act of the Audit service itself, so the entry takes Command by the default rule of AIFACTORY-US-964. The stored signature names the version of the key beside the signature bytes, so that a head signed before a rotation of the key still verifies; `ChainHeads` has no column for the key version, which is reported. `connectsoft.factory.audit.chain_valid` is set to one for the tenant. When the span is broken, the head is not moved. In one transaction the worker writes `AuditChainVerified` with `valid` false and the sequence of the last valid head and raises a finding of severity Critical, the severity the model fixes for a broken chain, in the category of a chain break, with the entries at the break as its evidence; the finding is raised through the routine of AIFACTORY-US-970 with its `FindingRaised` outbox record, and `chain_valid` is set to zero. While that finding is open no second one is raised for the same entries. Evidence writing does not stop: as the failure mode of the model says, it continues on a new segment anchored to the last valid head, so the next entry appended for the tenant takes the hash of that head as its `previousHash`. On a later run the worker recognises the entry that is anchored to the signed head as the start of the new segment, verifies from there and signs the head of the new segment, while the broken span stays named by the finding and is investigated from the immutable mirror, which holds every entry as it was written. The model gives no column that marks a segment, which is reported. When Key Vault does not answer, no head is signed and no `AuditChainVerified` is written, because the event says the chain was verified and its head signed; the run is repeated by the retry policy of the worker, three attempts six hundred seconds apart, and when they are used up the run ends as failed, which is logged as an error that names the tenant, and the next daily run covers the longer span; the feature builds no failed work store for a scheduled worker. A second trigger for the same tenant and day changes nothing. `AuditChainVerified` carries `tenantId`, `headSequence` and `valid` and is published on `audit.evidence.v1.audit-chain-verified`; the model lists no consumer of it, because the dashboards of I4 keep the run projections and the overviews only (D131). Kind: behavior. Traces: services: AuditService; aggregates: AuditService/AuditEntry, AuditService/Finding; events: AuditService/AuditChainVerified, AuditService/FindingRaised, AuditService/AuditEntryRecorded; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0019; requirements: NFR-04, NFR-10; scenarios: SCN-AuditService-011. Relates: nfrs: NFR-04. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, AIFACTORY-US-970. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, docs/planes/trust-operations/governance/security.md#evidence-integrity, docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs, docs/planes/trust-operations/governance/services/audit-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a tenant with an intact chain beyond its last signed head, when `ChainVerifier` runs, then the row of the tenant in `ChainHeads` holds the sequence and the hash of the last `AuditService/AuditEntry` of the verified span, a signature made by the signing port that names the key version and verifies, and `SignedAt`, the `AuditService/AuditChainVerified` outbox record with `valid` true and that head sequence was written in the same transaction, and one verification entry with the `kind` Command and the action `chain-verified` was appended as the first entry after the head, with the head hash as its `previousHash` and its own `AuditService/AuditEntryRecorded` record, also while evidence of the same tenant is appended concurrently; a later run whose span holds only that verification entry moves the signed head onto it and appends none, a run for a tenant without a span writes nothing, and `connectsoft.factory.audit.chain_valid` is one for the tenant (SCN-AuditService-011).",
        "AC2: Given a chain in which one entry was altered, one was removed or one was relinked after the last signed head, when `ChainVerifier` runs, then the head is unchanged, `AuditService/AuditChainVerified` is written with `valid` false and the sequence of the last valid head, one `AuditService/Finding` of severity Critical with the entries at the break as its evidence is raised with its `AuditService/FindingRaised` outbox record in the same transaction, `connectsoft.factory.audit.chain_valid` is zero, and a run on the next day raises no second finding for the same entries while the first is open (SCN-AuditService-011, docs/planes/trust-operations/governance/security.md).",
        "AC3: Given a broken span and a Critical finding for it, when evidence arrives for the tenant and `ChainVerifier` runs again, then the next `AuditService/AuditEntry` took the hash of the last valid head as its `previousHash`, the worker verifies the new segment from that entry and signs its head, the entries of the broken span are unchanged in `audit-sql` and in the mirror, and the chains of other tenants were verified and signed in the same runs (model/services/governance/AuditService.yaml).",
        "AC4: Given the signing port does not answer, when `ChainVerifier` runs, then no head is written and no `AuditService/AuditChainVerified` is published, the run is repeated at most three times six hundred seconds apart and then ends as failed, logged as an error that names the tenant, a second trigger for the same tenant and day changes nothing, and the next daily run verifies the whole span since the last signed head; no key material is in the service at any time (SCN-AuditService-011).",
        "AC5: Given a verification was committed, when the outbox dispatcher publishes `AuditService/AuditChainVerified` on `audit.evidence.v1.audit-chain-verified`, then the event is sent in the run event envelope with `tenantId`, `headSequence` and `valid`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AuditService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-307",
        "AIFACTORY-TASK-3864",
        "AIFACTORY-TASK-3865"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7706,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/AuditEntry",
          "AuditService/Finding"
        ],
        "events": [
          "AuditService/AuditChainVerified",
          "AuditService/FindingRaised",
          "AuditService/AuditEntryRecorded"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-04",
          "NFR-10"
        ],
        "scenarios": [
          "SCN-AuditService-011"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "AIFACTORY-US-970"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-965]",
      "number": 965
    },
    {
      "id": "AIFACTORY-TASK-307",
      "type": "task",
      "parent": "AIFACTORY-US-965",
      "title": "Chain verifier with the daily head signature and the Critical finding on a break",
      "sequence": "12.03.06.01",
      "description": "Chain verifier with the daily head signature and the Critical finding on a break. Expected output: On its daily schedule the worker verifies per tenant the entries since the head in ChainHeads by recomputing each entryHash, following each previousHash and checking the sequences for a gap; for an intact span it holds the chain of the tenant exclusively, has the hash of the last entry of the span signed through the signing port with the key of Governance:Audit:ChainSigningKeyId, and in one transaction stores the head of that entry with a signature that names the key version, writes AuditChainVerified with valid true and that head sequence and appends through the routine of AIFACTORY-TASK-3861 one verification entry as the first entry after the head, with the kind Command, the action chain-verified, the head hash as previousHash and its own AuditEntryRecorded record, and sets connectsoft.factory.audit.chain_valid to one; a span that holds only the verification entry of the previous run is verified and signed and appends no verification entry, and a tenant without a span is left untouched; the missing AuditEntryRecorded in the worker row of the model and the missing family of EvidenceKind for an act of the service itself are reported as corrections of the model; for a broken span it leaves the head, writes AuditChainVerified with valid false and raises one Critical finding with the entries at the break through the routine of AIFACTORY-TASK-3876 in one transaction, sets the gauge to zero and raises no second finding for the same entries while the first is open; it recognises the entry anchored to the signed head as the start of a new segment; a signing port that does not answer writes nothing and is retried three times six hundred seconds apart under the idempotency key of tenant and day, after which the run ends as failed and is logged as an error that names the tenant; the chaining of the entries themselves is delivered by AIFACTORY-TASK-3861.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "On its daily schedule the worker verifies per tenant the entries since the head in ChainHeads by recomputing each entryHash, following each previousHash and checking the sequences for a gap; for an intact span it holds the chain of the tenant exclusively, has the hash of the last entry of the span signed through the signing port with the key of Governance:Audit:ChainSigningKeyId, and in one transaction stores the head of that entry with a signature that names the key version, writes AuditChainVerified with valid true and that head sequence and appends through the routine of AIFACTORY-TASK-3861 one verification entry as the first entry after the head, with the kind Command, the action chain-verified, the head hash as previousHash and its own AuditEntryRecorded record, and sets connectsoft.factory.audit.chain_valid to one; a span that holds only the verification entry of the previous run is verified and signed and appends no verification entry, and a tenant without a span is left untouched; the missing AuditEntryRecorded in the worker row of the model and the missing family of EvidenceKind for an act of the service itself are reported as corrections of the model; for a broken span it leaves the head, writes AuditChainVerified with valid false and raises one Critical finding with the entries at the break through the routine of AIFACTORY-TASK-3876 in one transaction, sets the gauge to zero and raises no second finding for the same entries while the first is open; it recognises the entry anchored to the signed head as the start of a new segment; a signing port that does not answer writes nothing and is retried three times six hundred seconds apart under the idempotency key of tenant and day, after which the run ends as failed and is logged as an error that names the tenant; the chaining of the entries themselves is delivered by AIFACTORY-TASK-3861."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-307]",
      "number": 307
    },
    {
      "id": "AIFACTORY-TASK-3864",
      "type": "task",
      "parent": "AIFACTORY-US-965",
      "title": "Segment anchoring of the append after a broken span",
      "sequence": "12.03.06.02",
      "description": "Segment anchoring of the append after a broken span. Expected output: The append routine of AIFACTORY-TASK-3861 reads whether the last verification of the tenant found a break and, when it did, gives the next entry the hash of the last valid signed head as previousHash, once per break, so that evidence writing continues on a new segment as the failure mode of the model states; the entries of the broken span are neither changed nor removed; the acceptance suite gains helpers that alter, remove and relink an entry of a fixture chain directly in the isolated test database.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The append routine of AIFACTORY-TASK-3861 reads whether the last verification of the tenant found a break and, when it did, gives the next entry the hash of the last valid signed head as previousHash, once per break, so that evidence writing continues on a new segment as the failure mode of the model states; the entries of the broken span are neither changed nor removed; the acceptance suite gains helpers that alter, remove and relink an entry of a fixture chain directly in the isolated test database."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3864]",
      "number": 3864
    },
    {
      "id": "AIFACTORY-TASK-3865",
      "type": "task",
      "parent": "AIFACTORY-US-965",
      "title": "Verify the chain verification, the signed head, the break and the event through the acceptance suite",
      "sequence": "12.03.06.03",
      "description": "Verify the chain verification, the signed head, the break and the event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-965 with the fixture of AIFACTORY-TASK-3859: the signed head of an intact chain on the last entry of the span with its AuditChainVerified record and its verification entry as the first entry after the head in one transaction, under concurrent appends of the tenant, the later run that moves the head onto that entry and appends none, the run without a span that writes nothing, the unchanged head, the valid false event and the one Critical finding for an altered, a removed and a relinked entry, the new segment anchored to the last valid head and its signed head on a later run, the run without a head while the fake signing port does not answer with its three attempts and the second trigger of the same day, and the publication and payload of AuditChainVerified with a transport outage; the model lists no consumer of the event (D131).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-965 with the fixture of AIFACTORY-TASK-3859: the signed head of an intact chain on the last entry of the span with its AuditChainVerified record and its verification entry as the first entry after the head in one transaction, under concurrent appends of the tenant, the later run that moves the head onto that entry and appends none, the run without a span that writes nothing, the unchanged head, the valid false event and the one Critical finding for an altered, a removed and a relinked entry, the new segment anchored to the last valid head and its signed head on a later run, the run without a head while the fake signing port does not answer with its three attempts and the second trigger of the same day, and the publication and payload of AuditChainVerified with a transport outage; the model lists no consumer of the event (D131)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7706,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3865]",
      "number": 3865
    },
    {
      "id": "AIFACTORY-US-966",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Search the evidence of a tenant by project, kind, actor, run and time and receive every entry with a chain position that can be verified",
      "sequence": "12.03.07",
      "description": "A caller whose token carries the scope `factory.audit.read` searches evidence through `AuditService/SearchAudit`. The filters are the ones the model names: the scope, which is the project, the kind out of the nine families of `EvidenceKind`, the actor, the run and a time range over `recordedAt`. The answer is given in pages in the order of the tenant sequence, and each entry carries what the aggregate holds: `entryId`, `sequence`, `kind`, `actor`, `action`, `target` with its version or hash, the redacted `reason`, `outcome`, `correlationId`, `causationId`, `runId`, `sourceEvent` and `recordedAt`. With it comes the chain position that makes the entry verifiable: its `previousHash` and `entryHash`, and the signed head of the tenant that covers it, with head sequence, head hash, signature and signing time, or the statement that no signed head covers the entry yet. A caller that recomputes the hash of a returned entry and follows the links to the head therefore needs to trust nothing but the signature. The search runs under the tenant row filter, so evidence of another tenant is never returned, and a filter that names a run or an actor of another tenant returns an empty page and never an error that would confirm that it exists (ADR-0015). Inside the tenant the project boundary of AIFACTORY-US-963 applies: a token with a role in a project reads the entries of that project, a tenant-wide role reads every project and the entries without a project, and a search that names a project of the tenant in which the caller holds no role is answered 403, as is a caller without the scope. A search without a project filter by a caller with project roles returns the entries of the projects its token grants and nothing else. A filter that cannot be parsed, an unknown kind or a time range whose end is before its start, is refused with 400, a code the model omits for this operation and AIFACTORY-US-962 reports. The search reads through `IX_Audit_Run` and `IX_Audit_Tenant_RecordedAt`, writes nothing and appends no evidence of its own, because the model lists a read as no act to record. An entry whose personal identifier was redacted after its retention window is returned in its redacted form, and its position verifies as before (AIFACTORY-US-969). The response is a projection of restricted data: it holds what the entry holds and nothing of the event or the record the entry was made from. A person reaches this route through GovernanceHost, which fronts the service from I1 (D127), and no direct route is built; the suites and the hand-over of AIFACTORY-US-019 call it with tokens of the gateway audience. Kind: behavior. Traces: services: AuditService; aggregates: AuditService/AuditEntry; apis: AuditService/SearchAudit; adrs: ADR-0015, ADR-0019; requirements: NFR-04, NFR-10; scenarios: SCN-AuditService-001. Relates: nfrs: NFR-10. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, AIFACTORY-US-965. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, docs/planes/trust-operations/governance/services/audit-service/index.md#apis, docs/planes/trust-operations/governance/security.md#evidence-integrity.",
      "acceptanceCriteria": [
        "AC1: Given entries of a run in a project and a caller with `factory.audit.read` and a role in that project, when `AuditService/SearchAudit` is called with the run as filter, then the response is 200 with the entries of the run in the order of their sequence, each with `kind`, `actor`, `action`, `target`, `outcome`, `sourceEvent`, `recordedAt`, `previousHash` and `entryHash`, and with the signed head that covers it or the statement that none does yet; nothing is written (SCN-AuditService-001).",
        "AC2: Given entries of several kinds, actors and times, when `AuditService/SearchAudit` is called with a kind, an actor, a time range and a page cursor, then only the matching `AuditService/AuditEntry` rows are returned, page after page without a gap or a repetition, and an unknown kind or a time range whose end is before its start is answered 400 (SCN-AuditService-001).",
        "AC3: Given entries of two tenants and of two projects of one tenant, when `AuditService/SearchAudit` is called without the scope, with a role in the first project only and with a filter that names a run of the other tenant, then the first call is answered 403, the second returns the entries of the first project only and is answered 403 when it names the second project, and the third returns an empty page exactly as for a run that does not exist (SCN-AuditService-001, ADR-0015).",
        "AC4: Given a page returned by `AuditService/SearchAudit` for a chain with a signed head, when the suite recomputes the hash of each returned entry from its members, follows `previousHash` to the head and checks the signature of the head, then every position verifies; and an entry whose personal identifier was redacted is returned redacted and verifies as well (SCN-AuditService-001, docs/planes/trust-operations/governance/security.md)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#apis",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3866",
        "AIFACTORY-TASK-3867"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7707,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/AuditEntry"
        ],
        "apis": [
          "AuditService/SearchAudit"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-04",
          "NFR-10"
        ],
        "scenarios": [
          "SCN-AuditService-001"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "AIFACTORY-US-965"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#apis",
        "docs/planes/trust-operations/governance/security.md#evidence-integrity"
      ],
      "titlePrefix": "[AIFACTORY-US-966]",
      "number": 966
    },
    {
      "id": "AIFACTORY-TASK-3866",
      "type": "task",
      "parent": "AIFACTORY-US-966",
      "title": "SearchAudit read model with the filters of the model and the chain position of every entry",
      "sequence": "12.03.07.01",
      "description": "SearchAudit read model with the filters of the model and the chain position of every entry. Expected output: The read filters the entries of the tenant of the caller by project, kind, actor, run and a time range over recordedAt through IX_Audit_Run and IX_Audit_Tenant_RecordedAt, applies the project boundary of the token, returns pages in the order of the tenant sequence and gives each entry its previousHash, its entryHash and the signed head of ChainHeads that covers it, or the statement that none does yet; a filter that names a run or an actor of another tenant returns an empty page, a project of the tenant without a role of the caller 403, a missing scope 403 and a filter that cannot be parsed 400; the query writes nothing and returns no member of the source event or record beyond the entry.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The read filters the entries of the tenant of the caller by project, kind, actor, run and a time range over recordedAt through IX_Audit_Run and IX_Audit_Tenant_RecordedAt, applies the project boundary of the token, returns pages in the order of the tenant sequence and gives each entry its previousHash, its entryHash and the signed head of ChainHeads that covers it, or the statement that none does yet; a filter that names a run or an actor of another tenant returns an empty page, a project of the tenant without a role of the caller 403, a missing scope 403 and a filter that cannot be parsed 400; the query writes nothing and returns no member of the source event or record beyond the entry."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7707,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3866]",
      "number": 3866
    },
    {
      "id": "AIFACTORY-TASK-3867",
      "type": "task",
      "parent": "AIFACTORY-US-966",
      "title": "Verify the search, its boundaries and the returned chain positions through the acceptance suite",
      "sequence": "12.03.07.02",
      "description": "Verify the search, its boundaries and the returned chain positions through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-966 with the fixture of AIFACTORY-TASK-3859: the entries of a run in sequence order with their chain positions, the filters by kind, actor and time with paging, 400 for a filter that cannot be parsed, 403 for a missing scope and for another project of the tenant, the empty page for a run of another tenant, and the recomputed hashes and the head signature of a returned page, a redacted entry included.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-966 with the fixture of AIFACTORY-TASK-3859: the entries of a run in sequence order with their chain positions, the filters by kind, actor and time with paging, 400 for a filter that cannot be parsed, 403 for a missing scope and for another project of the tenant, the empty page for a run of another tenant, and the recomputed hashes and the head signature of a returned page, a redacted entry included."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7707,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3867]",
      "number": 3867
    },
    {
      "id": "AIFACTORY-US-967",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Export the evidence of a project in an open format with chain proofs as a package stored by reference in the artifact store",
      "sequence": "12.03.08",
      "description": "A tenant owns its evidence and receives it in an open format on request (ADR-0019 decision 5). A caller whose token carries the scope `factory.audit.export`, the Platform admin or an auditor of the tenant, requests the export of one project through `AuditService/ExportAudit` with an `Idempotency-Key`. The project is addressed by the path under the tenant row filter. The service keeps no projects: it knows a project by the evidence it holds for it, so a project for which the tenant of the caller holds no entry is answered 404, the same answer for a project that does not exist and for a project of another tenant (ADR-0015). In one transaction the service records the export request with the sequence of the last entry of the tenant at that moment, appends one entry of the request to the chain with the action `export-requested`, the caller as actor and the project as target, writes its `AuditEntryRecorded` outbox record and the export work message, and answers 202 with the identifier of the request. The model lists no table for export requests; this delivery adds one by migration, `ExportRequests`, with the request identifier, tenant, project, key, input hash, state, requesting caller, the sequence up to which the export reaches, the signed head the package is proven against and the reference and hash of the package, and reports the table to the owner. A repeated call under the same key and the same input returns the same request and writes nothing; the same key with another input is refused with 409 and a call without the key header with 400, codes the model omits for this operation; a caller without the scope is refused with 403. The worker `ExportWorker`, hosted by AIFACTORY-US-962, builds the package once per project and request. It reads the entries of the project up to the recorded sequence and writes them as JSON records, the open format docs/architecture/data-governance.md names for records, in the redacted form in which they are stored and after applying the redaction rules of the labels that classify the exported members; an identifier redacted after its retention window is exported redacted. The package carries chain proofs: for every exported entry its `previousHash` and `entryHash`, for the entries of other projects that lie between them in the tenant chain their hashes alone and none of their content, and the signed head the package is proven against, so that a reader verifies the exported entries up to a signed head without seeing evidence of another project. The content of a package is a function of the request alone. At its first attempt the worker records on the request the signed head of the tenant at that moment, with head sequence, head hash, signature and signing time, and every later attempt proves against the recorded head, although `ChainVerifier` may have moved the head of the tenant in between; an exported entry beyond the recorded head is stated as not yet covered by a signed head. The JSON form is canonical, with a fixed order of members and no time of the build, so that a second attempt for the same request yields the same bytes and the same hash. Two inputs can still change between attempts, a label that classifies an exported member and the redaction of an identifier past its retention window; an attempt after such a change may store a package with another hash, the request names the one its completing transaction recorded, and the case is reported to the owner. The package is stored through `ArtifactService/Artifacts.Store` as an artifact of kind Export of the project, by reference and hash; AuditService keeps no copy. In one transaction the worker then marks the request completed with the reference and the hash of the package and appends one entry of the completed export, whose target is the artifact with its hash, with its `AuditEntryRecorded` outbox record. The model has no operation that returns the state or the package of an export, so the requester finds the completed export as that entry through `SearchAudit` and reads the package from the artifact store under its own scopes; the missing read is reported. The entries of the request and of the completed export are appended directly in the transaction of the act, as every act of the Audit service itself is, and are no evidence events on the evidence topic; the artifact store therefore does not record the completed export as a reference that spares the package from its retention sweep, and the package, a derived copy that can be exported again, follows the retention of the project. Whether the acts of the Audit service itself should travel over the evidence topic as the evidence of every other service does (D115) is reported to the owner. When ArtifactService does not answer, the worker fails the attempt and is repeated by its retry policy, five attempts with exponential backoff from three hundred seconds; the store is idempotent on tenant and hash and the content is fixed by the request, so a repeat leaves one package, also a repeat after a package was stored and the completing transaction failed. When the attempts are used up the last attempt marks the request failed in `ExportRequests`, whose state names it, the work message is poisoned in the inbox as AIFACTORY-US-962 describes, and a new request under a new key starts again. A redelivered work message of a completed request writes nothing. The content of a package reaches no log record, activity or metric. The service decides no approval for an export and asks none: whether an export needs one is not stated by the model for this service, which has no dependency on the policy service, and is reported. Kind: behavior. Traces: services: AuditService, ArtifactService; aggregates: AuditService/AuditEntry; apis: AuditService/ExportAudit, ArtifactService/Artifacts.Store; events: AuditService/AuditEntryRecorded; descriptors: artifact-v1, audit-evidence-v1; adrs: ADR-0014, ADR-0015, ADR-0019; requirements: XL-14, NFR-03; scenarios: SCN-AuditService-002. Relates: nfrs: NFR-03. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, AIFACTORY-US-965, AIFACTORY-US-968, feature:artifact-service. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, model/services/knowledge/ArtifactService.yaml, docs/architecture/data-governance.md#retention-and-deletion, docs/architecture/adr/0019-data-governance.md, docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a project with entries and a caller with `factory.audit.export`, when `AuditService/ExportAudit` is called with an `Idempotency-Key`, then the response is 202 with the identifier of the request, the request is recorded with the sequence of the last entry of the tenant, one `AuditService/AuditEntry` with the action `export-requested`, the caller as actor and the project as target was appended, and its `AuditService/AuditEntryRecorded` outbox record and the export work message were written in the same transaction (SCN-AuditService-002).",
        "AC2: Given the same call repeated with the same key and input, then the same request is returned and no second request, entry or work message exists; given the same key with another input, the response is 409; given no key header, 400; given a caller without the scope, 403; given a project for which the tenant of the caller holds no entry, whether it does not exist or belongs to another tenant, 404; and no refusal of `AuditService/ExportAudit` writes anything (SCN-AuditService-002, ADR-0014, ADR-0015).",
        "AC3: Given a recorded request, when `ExportWorker` runs, then one package is stored through `ArtifactService/Artifacts.Store` as an artifact of kind Export of the project, it holds the entries of that project up to the recorded sequence as JSON records in their redacted form and no content of an entry of another project, its chain proofs verify every exported entry up to the signed head recorded on the request, the request is completed with the reference and the hash of the package, and one entry of the completed export with the artifact and its hash as target was appended with its `AuditService/AuditEntryRecorded` record in the same transaction; a redelivered work message writes nothing (SCN-AuditService-002, docs/architecture/data-governance.md).",
        "AC4: Given `ArtifactService/Artifacts.Store` does not answer, when `ExportWorker` runs, then the request stays open, the attempt is repeated by the retry policy up to five times, and a recovery in between completes the export with exactly one package; given a package was stored, the completing transaction failed and `ChainVerifier` moved the head of the tenant before the next attempt, then that attempt builds the same bytes against the head recorded on the request, the store returns the stored artifact and exactly one package exists; used-up attempts mark the request failed in `ExportRequests`, and no log record, activity or metric holds content of the package (SCN-AuditService-002, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3868",
        "AIFACTORY-TASK-3869",
        "AIFACTORY-TASK-3870"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7708,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService",
          "ArtifactService"
        ],
        "aggregates": [
          "AuditService/AuditEntry"
        ],
        "apis": [
          "AuditService/ExportAudit",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "AuditService/AuditEntryRecorded"
        ],
        "descriptors": [
          "artifact-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "XL-14",
          "NFR-03"
        ],
        "scenarios": [
          "SCN-AuditService-002"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "AIFACTORY-US-965",
        "AIFACTORY-US-968",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/data-governance.md#retention-and-deletion",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-967]",
      "number": 967
    },
    {
      "id": "AIFACTORY-TASK-3868",
      "type": "task",
      "parent": "AIFACTORY-US-967",
      "title": "Migration and mapping of the export request table",
      "sequence": "12.03.08.01",
      "description": "Migration and mapping of the export request table. Expected output: A migration adds the table ExportRequests to audit-sql with the request identifier, tenant, project, idempotency key, input hash, state, requesting caller, the sequence up to which the export reaches, the signed head recorded at the first attempt of the worker (head sequence, head hash, signature and signing time), the reference and the hash of the package and the times of request and completion, with a unique index on tenant and idempotency key and the tenant row filter of the profile; the model lists no table for export requests, so the table is reported to the owner as an addition; mapping tests run against an isolated test database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "A migration adds the table ExportRequests to audit-sql with the request identifier, tenant, project, idempotency key, input hash, state, requesting caller, the sequence up to which the export reaches, the signed head recorded at the first attempt of the worker (head sequence, head hash, signature and signing time), the reference and the hash of the package and the times of request and completion, with a unique index on tenant and idempotency key and the tenant row filter of the profile; the model lists no table for export requests, so the table is reported to the owner as an addition; mapping tests run against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7708,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-3868]",
      "number": 3868
    },
    {
      "id": "AIFACTORY-TASK-3869",
      "type": "task",
      "parent": "AIFACTORY-US-967",
      "title": "ExportAudit and ExportWorker with the package of JSON records, chain proofs and the store by reference",
      "sequence": "12.03.08.02",
      "description": "ExportAudit and ExportWorker with the package of JSON records, chain proofs and the store by reference. Expected output: ExportAudit answers 404 for a project without an entry in the tenant of the caller, records the request with the last sequence of the tenant, appends the entry of the request with the action export-requested and writes its AuditEntryRecorded record and the export work message in one transaction, answers 202, returns the first request for the same key and input and 409 for the same key with another input; ExportWorker reads the entries of the project up to the recorded sequence, writes them as JSON records in their redacted form with the redaction rules of the classifying labels applied, records on the request at its first attempt the signed head of the tenant and proves every attempt against that recorded head, adds the chain proofs, that is the hashes of the exported entries, the hashes alone of the entries of other projects between them and the recorded signed head, writes the package in a canonical JSON form without a time of the build so that every attempt for one request yields the same hash, stores the package once through a typed gRPC client of Artifacts.Store as an artifact of kind Export, and completes the request and appends the entry of the completed export in one transaction; an attempt that fails on the artifact store is repeated five times with exponential backoff and then marks the request failed in ExportRequests; an attempt after a stored package and a failed completing transaction stores nothing new; no content of a package is logged.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "ExportAudit answers 404 for a project without an entry in the tenant of the caller, records the request with the last sequence of the tenant, appends the entry of the request with the action export-requested and writes its AuditEntryRecorded record and the export work message in one transaction, answers 202, returns the first request for the same key and input and 409 for the same key with another input; ExportWorker reads the entries of the project up to the recorded sequence, writes them as JSON records in their redacted form with the redaction rules of the classifying labels applied, records on the request at its first attempt the signed head of the tenant and proves every attempt against that recorded head, adds the chain proofs, that is the hashes of the exported entries, the hashes alone of the entries of other projects between them and the recorded signed head, writes the package in a canonical JSON form without a time of the build so that every attempt for one request yields the same hash, stores the package once through a typed gRPC client of Artifacts.Store as an artifact of kind Export, and completes the request and appends the entry of the completed export in one transaction; an attempt that fails on the artifact store is repeated five times with exponential backoff and then marks the request failed in ExportRequests; an attempt after a stored package and a failed completing transaction stores nothing new; no content of a package is logged."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7708,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3869]",
      "number": 3869
    },
    {
      "id": "AIFACTORY-TASK-3870",
      "type": "task",
      "parent": "AIFACTORY-US-967",
      "title": "Verify the export request, the package with its proofs and the failure of the artifact store through the acceptance suite",
      "sequence": "12.03.08.03",
      "description": "Verify the export request, the package with its proofs and the failure of the artifact store through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-967 with the fixture of AIFACTORY-TASK-3859: the 202 with the request, its entry and its work message in one transaction, the idempotent repeat, the 409, 400, 403 and 404 answers, the one package in the fake of ArtifactService with the entries of one project in redacted form and proofs that verify to a signed head, the completed request with its entry, the redelivered work message, the retries, the recovery and the failed request while Artifacts.Store does not answer, and the attempt after a stored package and a moved head that leaves one package.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-967 with the fixture of AIFACTORY-TASK-3859: the 202 with the request, its entry and its work message in one transaction, the idempotent repeat, the 409, 400, 403 and 404 answers, the one package in the fake of ArtifactService with the entries of one project in redacted form and proofs that verify to a signed head, the completed request with its entry, the redelivered work message, the retries, the recovery and the failed request while Artifacts.Store does not answer, and the attempt after a stored package and a moved head that leaves one package."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7708,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3870]",
      "number": 3870
    },
    {
      "id": "AIFACTORY-US-968",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Set, list and resolve the classification label of a resource type or instance with its retention, redaction rules and residency, and announce every change",
      "sequence": "12.03.09",
      "description": "AuditService owns the classification registry that the other services obey: which data class a resource type or one resource has, how long it is retained, which redaction rules apply and where it may reside (ADR-0019 decision 2). A caller whose token carries the scope `factory.audit.admin`, the Platform admin, sets a label through `AuditService/SetClassification`. The path names the resource type; the body names the optional `resourceId`, which is absent for the default of the type, the `dataClass` out of Public, Internal, Confidential and Restricted, the `retentionDays`, the redaction rules and the `residency`. The retention and the residency are inputs of the owner of the data and are never defaulted. Each rule is given with its identifier, its detector out of regex, pii-detector, secret-pattern and custom, its action out of mask, drop and hash, and the projections it applies to out of prompt, context, tool-result, artifact and log; the rules are written to `RedactionRules` under the key of tenant and rule identifier that AIFACTORY-US-961 builds, and the label holds their identifiers, so a rule identifier that another tenant also uses is accepted as a rule of the caller and changes nothing of that tenant. The model gives a rule no member for a pattern, so the service resolves pii-detector and secret-pattern to the redactors of the pinned Compliance library and a regex or custom rule by its identifier to a redactor registered under that name; a rule whose redactor is not registered is refused, and the missing member is reported to the owner. In one transaction the service writes the label with `setBy` and `setAt`, its rules, the `ClassificationChanged` outbox record and one entry of the change in the chain of the tenant, because a change of a classification is itself evidence; the answer is 200 with the label. The invariant of the aggregate decides the refusal the model lists: a label of one resource may only be stricter than the default of its type, so an instance label weaker than that default is refused with 409, and so is a new default of a type that would leave an existing instance label weaker than it. A type without a label of its own has the class of `Governance:Classification:DefaultClass` as its default. The operation has natural idempotency: a call that sets what the label already holds answers 200 and writes no event and no entry. A body with an unknown class, detector, action or projection, without `retentionDays` or without `residency` is refused with 400, a code the model omits and AIFACTORY-US-962 reports, and a caller without the scope with 403. A caller with `factory.audit.read` lists the labels of the tenant with their rules through `AuditService/ListClassifications`, by resource type, and never a label of another tenant. A service resolves the classification of a resource through `AuditService/Audit.Classify` with a workload token that holds the service scope and the forwarded tenant: the label of the resource when it has one, else the default of its type, else the configured default class with no retention, no rule and no residency of its own, which the reply states as the default. The reply carries the class, the retention, the rule identifiers and the residency; the method is a read, writes nothing and resolves labels of the forwarded tenant only. The model lists ContextBuilderService and ArtifactService as its callers, while neither of them lists the Audit service as a dependency: ContextBuilderService names the policy service for classification decisions and ArtifactService asks the policy service on store and preview and applies `ClassificationChanged`. The method is therefore built for any workload with the service scope and proven with a workload of the fixture, and the two rows are reported as a correction of the model. `ClassificationChanged` carries `labelId`, `tenantId`, `resourceType`, the optional `resourceId`, `dataClass` and `retentionDays` and is published on `audit.classification.v1.classification-changed`; ContextBuilderService, ArtifactService, KnowledgeIngestionService, ModelRouterService and StudioBff apply it from their next operation on, each in its own suite. Kind: behavior. Traces: services: AuditService; aggregates: AuditService/ClassificationLabel; apis: AuditService/SetClassification, AuditService/ListClassifications, AuditService/Audit.Classify; events: AuditService/ClassificationChanged; descriptors: execution-scope-v1, policy-decision-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: NFR-03, FR-08; scenarios: SCN-AuditService-003, SCN-AuditService-004, SCN-AuditService-008, SCN-AuditService-012. Relates: nfrs: NFR-03. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, feature:component-compliance-factory-classifications. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, model/services/knowledge/ContextBuilderService.yaml, model/services/knowledge/ArtifactService.yaml, docs/architecture/data-governance.md#classification, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.audit.admin`, when `AuditService/SetClassification` is called for a resource type with a class, a retention, two rules and a residency, then the response is 200, the `AuditService/ClassificationLabel` of the type exists in the tenant of the trusted scope with `setBy` and `setAt`, the rules are in `RedactionRules` under the tenant of the caller, a rule identifier that another tenant also uses is accepted and leaves the rule of that tenant unchanged, and the `AuditService/ClassificationChanged` outbox record and one entry of the change were written in the same transaction (SCN-AuditService-004).",
        "AC2: Given a type whose default is Confidential, when `AuditService/SetClassification` sets an instance label of class Internal, or sets the default of a type to Restricted while an instance label of class Confidential exists, then the response is 409 and nothing changes; given a call that sets what the label already holds, the response is 200 and no event or entry is written; given an unknown class, detector, action or projection, a rule whose redactor is not registered, no `retentionDays` or no `residency`, the response is 400; given a caller without the scope, 403 (SCN-AuditService-004, model/services/governance/AuditService.yaml).",
        "AC3: Given labels of two tenants for several resource types, some for a type and some for one resource, when `AuditService/ListClassifications` is called by a caller with `factory.audit.read`, then the response is 200 with the labels of the tenant of the caller and their rules per resource type, no label of the other tenant is returned, a caller without the scope is answered 403, and nothing is written (SCN-AuditService-003, ADR-0015).",
        "AC4: Given a resource with a label of its own, a resource whose type has a default and a resource of a type without any label, when a workload with the service scope calls `AuditService/Audit.Classify` for each, then the reply carries the class, the retention, the rule identifiers and the residency of the instance label, of the type default, and the class of `Governance:Classification:DefaultClass` stated as the default with no retention and no rule; a call without a workload identity, without the service scope or without a resource type is refused with UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT, and a label of another tenant is never resolved (SCN-AuditService-008, ADR-0015).",
        "AC5: Given a label was changed, when the outbox dispatcher publishes `AuditService/ClassificationChanged` on `audit.classification.v1.classification-changed`, then the event is sent in the run event envelope with `labelId`, `tenantId`, `resourceType`, `dataClass`, `retentionDays` and, for the label of one resource, `resourceId`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AuditService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/data-governance.md#classification",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-308",
        "AIFACTORY-TASK-3871",
        "AIFACTORY-TASK-3872"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7709,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/ClassificationLabel"
        ],
        "apis": [
          "AuditService/SetClassification",
          "AuditService/ListClassifications",
          "AuditService/Audit.Classify"
        ],
        "events": [
          "AuditService/ClassificationChanged"
        ],
        "descriptors": [
          "execution-scope-v1",
          "policy-decision-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03",
          "FR-08"
        ],
        "scenarios": [
          "SCN-AuditService-003",
          "SCN-AuditService-004",
          "SCN-AuditService-008",
          "SCN-AuditService-012"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "feature:component-compliance-factory-classifications"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/data-governance.md#classification",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-968]",
      "number": 968
    },
    {
      "id": "AIFACTORY-TASK-308",
      "type": "task",
      "parent": "AIFACTORY-US-968",
      "title": "Classification registry: SetClassification and ListClassifications with redaction rules and the ClassificationChanged outbox record",
      "sequence": "12.03.09.01",
      "description": "Classification registry: SetClassification and ListClassifications with redaction rules and the ClassificationChanged outbox record. Expected output: SetClassification writes the label of a resource type or of one resource with dataClass, retentionDays, residency, setBy and setAt, upserts its rules in RedactionRules by tenant and rule identifier, the key AIFACTORY-TASK-233 builds, so that an identifier another tenant uses is a rule of the caller alone, and writes ClassificationChanged and one entry of the change through the append routine of AIFACTORY-TASK-3861 in one transaction; it resolves pii-detector and secret-pattern to the redactors of the pinned Compliance library and a regex or custom rule by its identifier to a registered redactor, and refuses a rule without one; an instance label weaker than the default of its type, and a default that would leave an instance label weaker, answer 409, the default of a type without a label being Governance:Classification:DefaultClass; a call that changes nothing answers 200 without an event; an invalid body, one without retentionDays or without residency among them, answers 400 and a missing scope 403; ListClassifications returns the labels of the tenant with their rules per resource type under the tenant row filter; redaction of content, findings and the export are delivered by AIFACTORY-US-969, AIFACTORY-US-970 and AIFACTORY-US-967.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "SetClassification writes the label of a resource type or of one resource with dataClass, retentionDays, residency, setBy and setAt, upserts its rules in RedactionRules by tenant and rule identifier, the key AIFACTORY-TASK-233 builds, so that an identifier another tenant uses is a rule of the caller alone, and writes ClassificationChanged and one entry of the change through the append routine of AIFACTORY-TASK-3861 in one transaction; it resolves pii-detector and secret-pattern to the redactors of the pinned Compliance library and a regex or custom rule by its identifier to a registered redactor, and refuses a rule without one; an instance label weaker than the default of its type, and a default that would leave an instance label weaker, answer 409, the default of a type without a label being Governance:Classification:DefaultClass; a call that changes nothing answers 200 without an event; an invalid body, one without retentionDays or without residency among them, answers 400 and a missing scope 403; ListClassifications returns the labels of the tenant with their rules per resource type under the tenant row filter; redaction of content, findings and the export are delivered by AIFACTORY-US-969, AIFACTORY-US-970 and AIFACTORY-US-967."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-308]",
      "number": 308
    },
    {
      "id": "AIFACTORY-TASK-3871",
      "type": "task",
      "parent": "AIFACTORY-US-968",
      "title": "Audit.Classify resolution from the instance label over the type default to the configured default class",
      "sequence": "12.03.09.02",
      "description": "Audit.Classify resolution from the instance label over the type default to the configured default class. Expected output: The method reads the forwarded tenant under the service scope and resolves the resource of the request to its instance label, else to the default of its type, else to the class of Governance:Classification:DefaultClass, and replies the class, the retention, the rule identifiers and the residency, with the configured default stated as such and carrying no retention and no rule; it writes nothing and resolves no label of another tenant; a request without a resource type is refused with INVALID_ARGUMENT; one resolution routine serves the method, the redaction of AIFACTORY-US-969 and the export of AIFACTORY-US-967.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The method reads the forwarded tenant under the service scope and resolves the resource of the request to its instance label, else to the default of its type, else to the class of Governance:Classification:DefaultClass, and replies the class, the retention, the rule identifiers and the residency, with the configured default stated as such and carrying no retention and no rule; it writes nothing and resolves no label of another tenant; a request without a resource type is refused with INVALID_ARGUMENT; one resolution routine serves the method, the redaction of AIFACTORY-US-969 and the export of AIFACTORY-US-967."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7709,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3871]",
      "number": 3871
    },
    {
      "id": "AIFACTORY-TASK-3872",
      "type": "task",
      "parent": "AIFACTORY-US-968",
      "title": "Verify the registry, the resolution and the event through the acceptance suite",
      "sequence": "12.03.09.03",
      "description": "Verify the registry, the resolution and the event through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AuditService-003|Scenario=SCN-AuditService-004|Scenario=SCN-AuditService-008|Scenario=SCN-AuditService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-968 with the fixture of AIFACTORY-TASK-3859: the label with its rules, its ClassificationChanged record and its entry in one transaction, the rule identifier that two tenants use without touching each other, the 409 for a weaker instance label in both directions, the unchanged call without an event, the 400 and 403 refusals, the list of one tenant with rules, the three resolutions of Audit.Classify with its refusals, and the publication and payload of ClassificationChanged with a transport outage; consumer handling is proven by the suites of ContextBuilderService, ArtifactService, KnowledgeIngestionService, ModelRouterService and StudioBff.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AuditService-003|Scenario=SCN-AuditService-004|Scenario=SCN-AuditService-008|Scenario=SCN-AuditService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-968 with the fixture of AIFACTORY-TASK-3859: the label with its rules, its ClassificationChanged record and its entry in one transaction, the rule identifier that two tenants use without touching each other, the 409 for a weaker instance label in both directions, the unchanged call without an event, the 400 and 403 refusals, the list of one tenant with rules, the three resolutions of Audit.Classify with its refusals, and the publication and payload of ClassificationChanged with a transport outage; consumer handling is proven by the suites of ContextBuilderService, ArtifactService, KnowledgeIngestionService, ModelRouterService and StudioBff."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7709,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3872]",
      "number": 3872
    },
    {
      "id": "AIFACTORY-US-969",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Redact content by the rules of its classification and return the redacted artifact, and redact personal identifiers in evidence past retention while the chain stays verifiable",
      "sequence": "12.03.10",
      "description": "Redaction is applied in two places, and this PBI delivers both. The first is the method `AuditService/Audit.Redact`. A service with a workload token that holds the service scope naming AuditService and the forwarded tenant and project names a content reference as `artifact-v1`, the resource whose label applies and the projection the redacted form is meant for. The service resolves the label of the resource as `Audit.Classify` does (AIFACTORY-US-968) and takes the rules of that label that apply to the projection. It reads the content through `ArtifactService/Artifacts.Fetch`, applies each rule with the redactor of the pinned Compliance library that its detector names and with its action, mask, drop or hash, and stores the result through `ArtifactService/Artifacts.Store` as a new artifact of the same project with a lineage edge to its input. The reply is the `artifact-v1` of the redacted artifact with its reference and hash and the identifiers of the rules that were applied. The content is in the memory of the service for the duration of the call and nowhere else: no row, no event, no log record, no activity and no metric of the service holds it (ADR-0019). The store is idempotent on tenant and hash, so the same content redacted by the same rules returns the same artifact and writes nothing new. When no rule of the label applies to the projection, nothing is stored and the reply names the input artifact and states that nothing was redacted. The method fails closed: when a redactor fails, nothing is stored and the call fails, so that content is never returned as redacted when it is not. An artifact that does not exist or belongs to another tenant is answered NOT_FOUND, the answer the artifact store gives (ADR-0015); a call without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED and a request without a reference, a resource or a projection with INVALID_ARGUMENT. When ArtifactService does not answer, the call fails fast with UNAVAILABLE and the failure class transient and the service does not retry. The model lists ContextBuilderService as the caller of this method, while that service lists the policy service and not the Audit service among its dependencies; the method is built for any workload with the service scope and proven with a workload of the fixture, and the row is reported with the rows of `Audit.Classify`. The model also names the artifact store as a dependency of this service while the artifact store does not list this service among its callers, which is reported as well. The second place is evidence itself. The worker `RetentionAndRedactionSweeper`, hosted by AIFACTORY-US-962 daily, redacts the personal identifiers in the entries of a project that are past the retention window of that project. It removes the actor identifier, a delegating identity and their salts from `ActorJson` and keeps the digests under which they entered the hash (AIFACTORY-US-964), so `entryHash` still follows from the stored record and `ChainVerifier` passes over a redacted entry as before; the mirror never held the identifier. A redacted entry is never redacted twice, under the idempotency key `entryId`, and no entry is deleted: audit evidence is retained for the period ADR-0019 decision 3 states. Three points the model leaves open are reported to the owner and decided nowhere here. The model names no source for the retention window of a project in this increment, because retention rules arrive with RetentionResidencyService in I4; the window is therefore a setting without a built-in value, and while it is not set the sweeper redacts nothing, which is the safe side of an act that cannot be undone. The worker is also said to enforce the retention of classifications across stores by emitting lifecycle tasks, for which the model names no event and no receiver and lists no output; this delivery emits none, and the retention of a class reaches the other stores through `ClassificationChanged`. And the handler `RedactOnDeletionOrder` is built in I4 with RetentionResidencyService and is not registered here. Kind: behavior. Traces: services: AuditService, ArtifactService; aggregates: AuditService/AuditEntry, AuditService/ClassificationLabel; apis: AuditService/Audit.Redact, ArtifactService/Artifacts.Fetch, ArtifactService/Artifacts.Store; descriptors: artifact-v1; adrs: ADR-0015, ADR-0019; requirements: NFR-03, NFR-10; scenarios: SCN-AuditService-009. Relates: nfrs: NFR-03. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, AIFACTORY-US-968, feature:artifact-service, feature:component-compliance-factory-classifications. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, model/services/knowledge/ArtifactService.yaml, docs/reference/schemas/artifact.schema.json, docs/architecture/data-governance.md#classification, docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given an artifact of a project whose content holds a marker that a rule of its label matches for the projection named, when a workload with the service scope calls `AuditService/Audit.Redact`, then the content was read once through `ArtifactService/Artifacts.Fetch`, the redacted content was stored once through `ArtifactService/Artifacts.Store` as a new artifact of the project with a lineage edge to the input, the reply is its `artifact-v1` with reference, hash and the applied rule identifiers, the stored content holds no marker, and the input artifact is unchanged (SCN-AuditService-009).",
        "AC2: Given the same request repeated, then the same redacted artifact is returned and the fake of the artifact store holds one; given a label without a rule for the projection, then nothing is stored and the reply names the input artifact and states that nothing was redacted; and after both, no row, outbox record, log record, activity or metric of the service holds the marker or any other content (SCN-AuditService-009, ADR-0019).",
        "AC3: Given a call to `AuditService/Audit.Redact` without a workload identity, without the service scope, without a reference, a resource or a projection, for an artifact that does not exist or belongs to another tenant, with a redactor that fails, or while `ArtifactService/Artifacts.Fetch` or `ArtifactService/Artifacts.Store` does not answer, when it arrives, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND, fails without storing anything, or fails fast with UNAVAILABLE and the failure class transient without a repetition by the service (SCN-AuditService-009, ADR-0015).",
        "AC4: Given entries of a project older and younger than the retention window the fixture sets, when `RetentionAndRedactionSweeper` runs, then the older `AuditService/AuditEntry` rows hold no actor identifier and no salt and keep their digests, their `entryHash` still follows from the stored record, the younger entries and the entries of other projects are unchanged, a second run changes nothing, and no entry was deleted; with no window set, a run redacts nothing (model/services/governance/AuditService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/artifact.schema.json",
        "docs/architecture/data-governance.md#classification",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3873",
        "AIFACTORY-TASK-3874",
        "AIFACTORY-TASK-3875"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7710,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService",
          "ArtifactService"
        ],
        "aggregates": [
          "AuditService/AuditEntry",
          "AuditService/ClassificationLabel"
        ],
        "apis": [
          "AuditService/Audit.Redact",
          "ArtifactService/Artifacts.Fetch",
          "ArtifactService/Artifacts.Store"
        ],
        "descriptors": [
          "artifact-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03",
          "NFR-10"
        ],
        "scenarios": [
          "SCN-AuditService-009"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "AIFACTORY-US-968",
        "feature:artifact-service",
        "feature:component-compliance-factory-classifications"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/artifact.schema.json",
        "docs/architecture/data-governance.md#classification",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-969]",
      "number": 969
    },
    {
      "id": "AIFACTORY-TASK-3873",
      "type": "task",
      "parent": "AIFACTORY-US-969",
      "title": "Audit.Redact over the artifact store with the redactors of the Compliance library",
      "sequence": "12.03.10.01",
      "description": "Audit.Redact over the artifact store with the redactors of the Compliance library. Expected output: The method resolves the label of the resource through the routine of AIFACTORY-TASK-3871, takes its rules for the projection named, reads the content through a typed gRPC client of Artifacts.Fetch, applies each rule with the redactor its detector names and its action, stores the result through Artifacts.Store as a new artifact of the project with a lineage edge to the input and replies its artifact-v1 with the applied rule identifiers; with no applicable rule it stores nothing and names the input; a failing redactor stores nothing and fails the call; the content is held in memory for the call only and written to no row, event, log record, activity or metric; an unknown or foreign artifact is answered NOT_FOUND, an incomplete request INVALID_ARGUMENT and an artifact store that does not answer UNAVAILABLE without a retry.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The method resolves the label of the resource through the routine of AIFACTORY-TASK-3871, takes its rules for the projection named, reads the content through a typed gRPC client of Artifacts.Fetch, applies each rule with the redactor its detector names and its action, stores the result through Artifacts.Store as a new artifact of the project with a lineage edge to the input and replies its artifact-v1 with the applied rule identifiers; with no applicable rule it stores nothing and names the input; a failing redactor stores nothing and fails the call; the content is held in memory for the call only and written to no row, event, log record, activity or metric; an unknown or foreign artifact is answered NOT_FOUND, an incomplete request INVALID_ARGUMENT and an artifact store that does not answer UNAVAILABLE without a retry."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3873]",
      "number": 3873
    },
    {
      "id": "AIFACTORY-TASK-3874",
      "type": "task",
      "parent": "AIFACTORY-US-969",
      "title": "RetentionAndRedactionSweeper redacts personal identifiers of entries past the retention window of their project",
      "sequence": "12.03.10.02",
      "description": "RetentionAndRedactionSweeper redacts personal identifiers of entries past the retention window of their project. Expected output: On its daily schedule the worker selects per tenant the entries of a project that are older than the retention window of the project, a setting without a built-in value that the model gives no source for in this increment, removes the actor identifier, a delegating identity and their salts from ActorJson and keeps their digests, under the idempotency key entryId and with three attempts six hundred seconds apart; entryHash stays valid and the entry is neither deleted nor redacted twice; with no window set nothing is redacted; the worker emits no lifecycle task, because the model names no event and no receiver for one, and no handler of DeletionOrderIssued exists, because RedactOnDeletionOrder is built in I4 with RetentionResidencyService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "On its daily schedule the worker selects per tenant the entries of a project that are older than the retention window of the project, a setting without a built-in value that the model gives no source for in this increment, removes the actor identifier, a delegating identity and their salts from ActorJson and keeps their digests, under the idempotency key entryId and with three attempts six hundred seconds apart; entryHash stays valid and the entry is neither deleted nor redacted twice; with no window set nothing is redacted; the worker emits no lifecycle task, because the model names no event and no receiver for one, and no handler of DeletionOrderIssued exists, because RedactOnDeletionOrder is built in I4 with RetentionResidencyService."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7710,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3874]",
      "number": 3874
    },
    {
      "id": "AIFACTORY-TASK-3875",
      "type": "task",
      "parent": "AIFACTORY-US-969",
      "title": "Verify the redaction of content and of evidence identifiers through the acceptance suite",
      "sequence": "12.03.10.03",
      "description": "Verify the redaction of content and of evidence identifiers through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-969 with the fixture of AIFACTORY-TASK-3859: the redacted artifact stored once in the fake of ArtifactService with its lineage edge and without the marker, the repeated request, the label without an applicable rule, the scan of rows, outbox records and telemetry for content, the refusals with their status, the failing redactor that stores nothing, UNAVAILABLE without a retry while the fake does not answer, and the sweep under a moved clock after which the redacted entries still verify through ChainVerifier and no entry is missing.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-009\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-969 with the fixture of AIFACTORY-TASK-3859: the redacted artifact stored once in the fake of ArtifactService with its lineage edge and without the marker, the repeated request, the label without an applicable rule, the scan of rows, outbox records and telemetry for content, the refusals with their status, the failing redactor that stores nothing, UNAVAILABLE without a retry while the fake does not answer, and the sweep under a moved clock after which the redacted entries still verify through ChainVerifier and no entry is missing."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7710,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3875]",
      "number": 3875
    },
    {
      "id": "AIFACTORY-US-970",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Raise a finding from evidence, among them an uncertain tool effect that stays unresolved, list the findings of a tenant and resolve one or accept its risk with a reason",
      "sequence": "12.03.11",
      "description": "A finding is what evidence raises when something needs a person: it names its severity, its category and the evidence entries that justify it. One routine raises it. In one transaction it writes the `Finding` in the state open with `raisedAt` and at least one evidence entry and the `FindingRaised` outbox record, and `connectsoft.factory.audit.findings_open` rises for the tenant and the severity; while a finding of the same category for the same entries is open, no second one is raised. Three paths of the model use it. `Audit.RaiseFindings` records the findings a workflow step raises as a `findings-v1` document (D133), which AIFACTORY-US-1516 delivers. `ChainVerifier` raises a Critical finding for a broken chain (AIFACTORY-US-965). The handler `RaiseUncertainFinding` and a scheduled sweep raise one when the effect of a tool call stays unknown. The handler handles `ToolEffectUncertain` of ToolAdapterService, the announcement that an effect may have happened and could not be confirmed, idempotently on the event id: it appends one entry of the uncertain effect with the `kind` ToolEffect and the invocation as target. An uncertain effect is resolved when the Operator decides and the tool service settles the invocation, which arrives as `ToolInvoked` with the state Observed or Failed and is recorded as evidence. The finding is raised when the sweep runs. The sweep, `UncertainEffectSweeper`, is hosted like the other scheduled workers of the service. It selects per tenant the entries recorded from `ToolEffectUncertain` that are older than the window `Governance:Audit:UncertainFindingAfterHours`, twenty-four hours by default and read when the sweep runs, and for which the chain of the tenant holds no entry recorded from `ToolInvoked` with the state Observed or Failed for the same invocation. For each it raises a finding in the category of unresolved uncertain effects with the entry of the uncertain effect as its evidence, under the idempotency key of the invocation: an invocation for which a finding of that category exists, open or ended, raises no second one. The service depends on no deferred delivery of a message, a capability neither the Orleans messaging profile of the base template nor a library feature of the backlog states. The model names the handler and no worker for the sweep, so the worker row is reported to the owner as a correction of the model with the values this delivery proposes: the name `UncertainEffectSweeper`, an hourly schedule read from `Governance:Audit:UncertainEffectSweeperSchedule`, the fixed retry of three attempts six hundred seconds apart and the two parallel executions partitioned by tenant that the two scheduled workers of the model have, the idempotency key `invocationId` and `FindingRaised` as its output. The model also gives `AuditEntries` no column for the invocation and no index on `SourceEvent`, so the sweep reads the entries of a tenant through `IX_Audit_Tenant_RecordedAt` and the invocation from `TargetJson`, which is reported as well. The severity is an input the model gives for one category only: a broken chain is Critical. The severity of an unresolved uncertain effect is therefore a setting without a built-in value, the service is unready while it is not set, and the open point is reported. The model names two further causes of a finding, a prohibited attempt and an overdue rotation, and no handler, worker or event that raises them; this delivery builds no path for them and reports both. A caller whose token carries `factory.audit.read` lists the findings of the tenant through `AuditService/ListFindings`, open and resolved, filtered by severity, category and state, in pages; a finding belongs to its tenant, carries no project, and a finding of another tenant is never listed. A caller whose token carries `factory.audit.admin`, the Platform admin, ends a finding through `AuditService/ResolveFinding` with a state, resolved or accepted-risk, and a reason. In one transaction the service moves the open `Finding` to that state with `resolvedAt`, writes the `FindingResolved` outbox record and appends one entry of the resolution with the caller as actor and the reason, because a resolution is itself evidence; `findings_open` falls. The operation has natural idempotency: a repeated call with the same state answers 200 and changes nothing. A second, different resolution of an ended finding is refused with 409 and a body without a reason or with another state with 400, codes the model omits and AIFACTORY-US-962 reports; an unknown finding and a finding of another tenant are answered 404, the same answer for both (ADR-0015), and a caller without the scope 403. The owner of a finding is set by `Audit.RaiseFindings` from the document (AIFACTORY-US-1516); the model names the state acknowledged and no operation that sets it, which AIFACTORY-US-961 reports. `FindingRaised` carries `findingId`, `tenantId`, `severity` and `category` and is published on `audit.findings.v1.finding-raised`; AlertRuleService, StudioNotificationService and StudioBff handle it in their own suites. `FindingResolved` carries `findingId`, `tenantId` and `state` and is published on `audit.findings.v1.finding-resolved` for StudioBff. Kind: behavior. Traces: services: AuditService; aggregates: AuditService/Finding, AuditService/AuditEntry; apis: AuditService/ListFindings, AuditService/ResolveFinding; events: AuditService/FindingRaised, AuditService/FindingResolved, ToolAdapterService/ToolEffectUncertain, ToolAdapterService/ToolInvoked; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0015; requirements: NFR-04, FUX-05; scenarios: SCN-AuditService-005, SCN-AuditService-006, SCN-AuditService-013, SCN-AuditService-014. Relates: nfrs: NFR-04. Depends on: AIFACTORY-US-961, AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, feature:tool-adapter-service, feature:contracts-package. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/planes/trust-operations/governance/services/audit-service/index.md#messages, docs/planes/trust-operations/governance/services/audit-service/index.md#options-and-configuration.",
      "acceptanceCriteria": [
        "AC1: Given `ToolAdapterService/ToolEffectUncertain` for an invocation and no later `ToolAdapterService/ToolInvoked` that settles it, when the window `Governance:Audit:UncertainFindingAfterHours` has passed and the sweep `UncertainEffectSweeper` runs, then one `AuditService/Finding` is open with the configured severity, the category of unresolved uncertain effects and the entry of the uncertain effect as its evidence, its `AuditService/FindingRaised` outbox record was written in the same transaction and `connectsoft.factory.audit.findings_open` rose; given the settling event arrived before the sweep found the entry past its window, no finding is raised; and the event delivered twice, a second run of the sweep and a run after the finding was ended raise no second finding for the invocation (model/services/governance/AuditService.yaml).",
        "AC2: Given open and ended findings of two tenants with several severities and categories, when `AuditService/ListFindings` is called by a caller with `factory.audit.read` with a filter by severity, category and state, then the response is 200 with the matching findings of the tenant of the caller in pages, each with severity, category, evidence entries, state and times, no finding of the other tenant is returned, a caller without the scope is answered 403, and nothing is written (SCN-AuditService-005, ADR-0015).",
        "AC3: Given an open finding and a caller with `factory.audit.admin`, when `AuditService/ResolveFinding` is called with the state resolved or accepted-risk and a reason, then the response is 200, the `AuditService/Finding` holds that state and `resolvedAt`, the `AuditService/FindingResolved` outbox record and one entry of the resolution with the caller as actor and the reason were written in the same transaction, and `connectsoft.factory.audit.findings_open` fell (SCN-AuditService-006).",
        "AC4: Given an ended finding, when `AuditService/ResolveFinding` is called again with the same state, then the response is 200 and nothing changes; with the other state the response is 409; without a reason or with a state other than resolved and accepted-risk, 400; for an unknown finding or one of another tenant, 404; for a caller without the scope, 403; and no refusal writes or publishes anything (SCN-AuditService-006, ADR-0015).",
        "AC5: Given a finding was raised and later ended, when the outbox dispatcher publishes `AuditService/FindingRaised` on `audit.findings.v1.finding-raised` and `AuditService/FindingResolved` on `audit.findings.v1.finding-resolved`, then the first is sent in the run event envelope with `findingId`, `tenantId`, `severity` and `category` and the second with `findingId`, `tenantId` and `state`, neither holds a reason or evidence text, and a transport outage is retried with backoff so neither event is lost or duplicated under its event id (SCN-AuditService-013, SCN-AuditService-014, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#messages",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#options-and-configuration"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3876",
        "AIFACTORY-TASK-3877",
        "AIFACTORY-TASK-3878"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7711,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService"
        ],
        "aggregates": [
          "AuditService/Finding",
          "AuditService/AuditEntry"
        ],
        "apis": [
          "AuditService/ListFindings",
          "AuditService/ResolveFinding"
        ],
        "events": [
          "AuditService/FindingRaised",
          "AuditService/FindingResolved",
          "ToolAdapterService/ToolEffectUncertain",
          "ToolAdapterService/ToolInvoked"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "NFR-04",
          "FUX-05"
        ],
        "scenarios": [
          "SCN-AuditService-005",
          "SCN-AuditService-006",
          "SCN-AuditService-013",
          "SCN-AuditService-014"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-961",
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "feature:tool-adapter-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#messages",
        "docs/planes/trust-operations/governance/services/audit-service/index.md#options-and-configuration"
      ],
      "titlePrefix": "[AIFACTORY-US-970]",
      "number": 970
    },
    {
      "id": "AIFACTORY-TASK-3876",
      "type": "task",
      "parent": "AIFACTORY-US-970",
      "title": "Finding routine, ListFindings and ResolveFinding with the FindingRaised and FindingResolved outbox records",
      "sequence": "12.03.11.01",
      "description": "Finding routine, ListFindings and ResolveFinding with the FindingRaised and FindingResolved outbox records. Expected output: One routine raises a finding in the state open with severity, category, at least one evidence entry and raisedAt together with its FindingRaised outbox record in one transaction, raises no second finding of the same category for the same entries while one is open, and moves connectsoft.factory.audit.findings_open; ListFindings returns the findings of the tenant of the caller filtered by severity, category and state in pages through IX_Findings_Tenant_State; ResolveFinding moves an open finding to resolved or accepted-risk with resolvedAt and writes FindingResolved and one entry of the resolution through the append routine of AIFACTORY-TASK-3861 in one transaction, answers 200 without a change for a repeat with the same state, 409 for the other state, 400 without a reason or with another state, 404 for an unknown or foreign finding and 403 for a missing scope; the routine serves ChainVerifier of AIFACTORY-TASK-307, the handler of AIFACTORY-TASK-3877 and Audit.RaiseFindings of AIFACTORY-TASK-6161.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "One routine raises a finding in the state open with severity, category, at least one evidence entry and raisedAt together with its FindingRaised outbox record in one transaction, raises no second finding of the same category for the same entries while one is open, and moves connectsoft.factory.audit.findings_open; ListFindings returns the findings of the tenant of the caller filtered by severity, category and state in pages through IX_Findings_Tenant_State; ResolveFinding moves an open finding to resolved or accepted-risk with resolvedAt and writes FindingResolved and one entry of the resolution through the append routine of AIFACTORY-TASK-3861 in one transaction, answers 200 without a change for a repeat with the same state, 409 for the other state, 400 without a reason or with another state, 404 for an unknown or foreign finding and 403 for a missing scope; the routine serves ChainVerifier of AIFACTORY-TASK-307, the handler of AIFACTORY-TASK-3877 and Audit.RaiseFindings of AIFACTORY-TASK-6161."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7711,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3876]",
      "number": 3876
    },
    {
      "id": "AIFACTORY-TASK-3877",
      "type": "task",
      "parent": "AIFACTORY-US-970",
      "title": "RaiseUncertainFinding and the scheduled sweep UncertainEffectSweeper of unresolved uncertain effects",
      "sequence": "12.03.11.02",
      "description": "RaiseUncertainFinding and the scheduled sweep UncertainEffectSweeper of unresolved uncertain effects. Expected output: The handler of ToolEffectUncertain appends one entry of the uncertain effect with the kind ToolEffect and the invocation as target, idempotently on the event id, and writes no deferred message; the worker UncertainEffectSweeper is hosted like the scheduled workers of AIFACTORY-TASK-236, on an hourly schedule read from Governance:Audit:UncertainEffectSweeperSchedule, with a fixed retry of three attempts six hundred seconds apart, the idempotency key invocationId and at most two parallel executions partitioned by tenant, values this delivery proposes because model/services/governance/AuditService.yaml has no worker row for the sweep, which is reported as a correction of the model; on each run it selects through IX_Audit_Tenant_RecordedAt the entries recorded from ToolEffectUncertain that are older than Governance:Audit:UncertainFindingAfterHours, read when the sweep runs, and have no entry recorded from ToolInvoked with the state Observed or Failed for the same invocation, and raises for each a finding through the routine of AIFACTORY-TASK-3876 in the category of unresolved uncertain effects with the severity of a setting that has no built-in value and keeps the service unready while it is missing; an invocation that already has a finding of that category, open or ended, raises none, so a redelivered event and a repeated run raise one finding; no path is built for a prohibited attempt or an overdue rotation, for which the model names no source.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The handler of ToolEffectUncertain appends one entry of the uncertain effect with the kind ToolEffect and the invocation as target, idempotently on the event id, and writes no deferred message; the worker UncertainEffectSweeper is hosted like the scheduled workers of AIFACTORY-TASK-236, on an hourly schedule read from Governance:Audit:UncertainEffectSweeperSchedule, with a fixed retry of three attempts six hundred seconds apart, the idempotency key invocationId and at most two parallel executions partitioned by tenant, values this delivery proposes because model/services/governance/AuditService.yaml has no worker row for the sweep, which is reported as a correction of the model; on each run it selects through IX_Audit_Tenant_RecordedAt the entries recorded from ToolEffectUncertain that are older than Governance:Audit:UncertainFindingAfterHours, read when the sweep runs, and have no entry recorded from ToolInvoked with the state Observed or Failed for the same invocation, and raises for each a finding through the routine of AIFACTORY-TASK-3876 in the category of unresolved uncertain effects with the severity of a setting that has no built-in value and keeps the service unready while it is missing; an invocation that already has a finding of that category, open or ended, raises none, so a redelivered event and a repeated run raise one finding; no path is built for a prohibited attempt or an overdue rotation, for which the model names no source."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7711,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3877]",
      "number": 3877
    },
    {
      "id": "AIFACTORY-TASK-3878",
      "type": "task",
      "parent": "AIFACTORY-US-970",
      "title": "Verify the raised finding, the list, the resolution and the two events through the acceptance suite",
      "sequence": "12.03.11.03",
      "description": "Verify the raised finding, the list, the resolution and the two events through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AuditService-005|Scenario=SCN-AuditService-006|Scenario=SCN-AuditService-013|Scenario=SCN-AuditService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-970 with the fixture of AIFACTORY-TASK-3859: the finding raised by the sweep from a fixture event of ToolEffectUncertain after the window under a moved clock, none when ToolInvoked settled the invocation before the sweep, the redelivered event, the repeated run and the run after the finding was ended, the unready start without the severity setting, the filtered list of one tenant, the resolution with its FindingResolved record and its entry in one transaction, the repeat, the 409, 400, 404 and 403 answers, and the publication and payload of FindingRaised and FindingResolved with a transport outage; consumer handling is proven by the suites of AlertRuleService, StudioNotificationService and StudioBff.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AuditService-005|Scenario=SCN-AuditService-006|Scenario=SCN-AuditService-013|Scenario=SCN-AuditService-014)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-970 with the fixture of AIFACTORY-TASK-3859: the finding raised by the sweep from a fixture event of ToolEffectUncertain after the window under a moved clock, none when ToolInvoked settled the invocation before the sweep, the redelivered event, the repeated run and the run after the finding was ended, the unready start without the severity setting, the filtered list of one tenant, the resolution with its FindingResolved record and its entry in one transaction, the repeat, the 409, 400, 404 and 403 answers, and the publication and payload of FindingRaised and FindingResolved with a transport outage; consumer handling is proven by the suites of AlertRuleService, StudioNotificationService and StudioBff."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7711,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3878]",
      "number": 3878
    },
    {
      "id": "AIFACTORY-US-1516",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-064",
      "title": "Record the findings a workflow step raises as a findings-v1 document, once per finding id, with one audit entry for the call and one FindingRaised per recorded finding",
      "sequence": "12.03.12",
      "description": "The steps `raise-findings` of the workflows `compliance-check` and `debt-review` end with a list of findings, and these findings get a descriptor of their own and are raised through an operation of AuditService that publishes `FindingRaised` (D133). The descriptor is `findings-v1`: a list of findings, each with id, category, severity, owner, evidence references and a redacted summary, and the count `critical` of the findings of severity critical, which the condition step after `raise-findings` reads. The operation is the internal gRPC method `AuditService/Audit.RaiseFindings`, of class shared-write. Its caller is ToolAdapterService, the tool executor, which runs the step and calls the method with its workload token; the token holds the service scope `factory.audit.write` and forwards the tenant, the project and the run of the step, which the service reads only under that scope (ADR-0015 amendment D114). The service validates the document against docs/reference/schemas/findings.schema.json and checks that `critical` equals the number of findings of severity critical it lists; a document that fails either check is refused whole with INVALID_ARGUMENT and nothing is recorded. For a valid document the service records, in one transaction, each finding whose id the tenant does not hold yet as an open `Finding` with its category, its severity, the matching value of `FindingSeverity`, its owner, its evidence references and its summary, appends through the append routine of AIFACTORY-US-964 one audit entry for the call, which every finding it records names in `evidenceEntryIds`, and writes one `FindingRaised` outbox record per recorded finding, through the finding routine of AIFACTORY-US-970, so that `connectsoft.factory.audit.findings_open` rises. The reply is `ack-v1`. The finding id is the idempotency key of the step: a finding id already recorded is recorded and published again by no call, so a retried step raises nothing twice, and a call whose findings are all recorded already appends no entry, publishes nothing and answers `ack-v1`. The summary is redacted by the audit profile of the pinned Compliance library before it is stored and never holds content; evidence is referenced, never copied. A finding of another tenant is never touched, because the id is looked up under the tenant row filter. A call without a workload identity is refused with UNAUTHENTICATED, a token without `factory.audit.write` with PERMISSION_DENIED, and while `audit-sql` does not answer the call ends UNAVAILABLE, nothing is recorded and the step retries under its own retry policy. The two workflows belong to I4 and their steps bind no tool for the call yet in model/workflows, so in this delivery the method is proven with a workload shaped like ToolAdapterService; the tool binding of the steps belongs to the workflow and tool features. Kind: behavior. Traces: services: AuditService, ToolAdapterService; aggregates: AuditService/Finding, AuditService/AuditEntry; apis: AuditService/Audit.RaiseFindings; events: AuditService/FindingRaised, AuditService/AuditEntryRecorded; workflows: compliance-check, debt-review; descriptors: findings-v1, ack-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0015, ADR-0019; requirements: FR-06, NFR-04; scenarios: SCN-AuditService-015. Depends on: AIFACTORY-US-962, AIFACTORY-US-963, AIFACTORY-US-964, AIFACTORY-US-970, feature:contracts-package. Sources: model/services/governance/AuditService.yaml, model/scenarios/AuditService.yaml, docs/reference/schemas/findings.schema.json, model/workflows/compliance-check.yaml, model/workflows/debt-review.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds `factory.audit.write` and a valid `findings-v1` document of three findings, one of severity critical, with `critical` equal to one, when `AuditService/Audit.RaiseFindings` is called, then the reply is `ack-v1`, three open `AuditService/Finding` rows hold the category, severity, owner, evidence references and redacted summary of the document, one `AuditService/AuditEntry` for the call is named in the `evidenceEntryIds` of each, and three `AuditService/FindingRaised` outbox records and the `AuditService/AuditEntryRecorded` record were written in the same transaction (SCN-AuditService-015, docs/reference/schemas/findings.schema.json).",
        "AC2: Given the same document sent again, and a document that repeats two of those ids and adds one new finding, when `AuditService/Audit.RaiseFindings` is called, then the first call answers `ack-v1`, appends no entry and publishes nothing, and the second records and publishes only the new finding with one entry for the call, so no finding id is recorded or published twice (SCN-AuditService-015).",
        "AC3: Given a document that fails the schema, one whose `critical` differs from the findings of severity critical it lists, a call without a workload identity, a token without `factory.audit.write`, and `audit-sql` stopped, when `AuditService/Audit.RaiseFindings` is called, then the answers are INVALID_ARGUMENT, INVALID_ARGUMENT, UNAUTHENTICATED, PERMISSION_DENIED and UNAVAILABLE, and no finding, entry or outbox record is written (SCN-AuditService-015, ADR-0015).",
        "AC4: Given a finding id the tenant of the call does not hold but another tenant does, and a summary that carries a personal identifier, when `AuditService/Audit.RaiseFindings` records the finding, then a new `AuditService/Finding` of the tenant of the call is written and the finding of the other tenant is unchanged, the stored summary is redacted, and no summary or evidence text reaches a log record, an activity, a metric or the payload of `AuditService/FindingRaised` (ADR-0019, model/services/governance/AuditService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/reference/schemas/findings.schema.json",
        "model/workflows/compliance-check.yaml",
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6161",
        "AIFACTORY-TASK-6162",
        "AIFACTORY-TASK-6163"
      ],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7712,
      "kind": "behavior",
      "traces": {
        "services": [
          "AuditService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "AuditService/Finding",
          "AuditService/AuditEntry"
        ],
        "apis": [
          "AuditService/Audit.RaiseFindings"
        ],
        "events": [
          "AuditService/FindingRaised",
          "AuditService/AuditEntryRecorded"
        ],
        "workflows": [
          "compliance-check",
          "debt-review"
        ],
        "descriptors": [
          "findings-v1",
          "ack-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FR-06",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-AuditService-015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-962",
        "AIFACTORY-US-963",
        "AIFACTORY-US-964",
        "AIFACTORY-US-970",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/AuditService.yaml",
        "model/scenarios/AuditService.yaml",
        "docs/reference/schemas/findings.schema.json",
        "model/workflows/compliance-check.yaml",
        "model/workflows/debt-review.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1516]",
      "number": 1516
    },
    {
      "id": "AIFACTORY-TASK-6161",
      "type": "task",
      "parent": "AIFACTORY-US-1516",
      "title": "Audit.RaiseFindings with the findings-v1 validation, the record once per finding id and one audit entry per call",
      "sequence": "12.03.12.01",
      "description": "Audit.RaiseFindings with the findings-v1 validation, the record once per finding id and one audit entry per call. Expected output: Audit.RaiseFindings validates the request against docs/reference/schemas/findings.schema.json and the count critical, records each finding whose id the tenant does not hold as an open Finding with category, severity, owner, evidence references and the redacted summary through the finding routine of AIFACTORY-TASK-3876, appends one audit entry for the call through the append routine of AIFACTORY-TASK-3861 that every recorded finding names in evidenceEntryIds, writes one FindingRaised outbox record per recorded finding in the same transaction and replies ack-v1; a call whose ids are all recorded writes and publishes nothing; the refusals INVALID_ARGUMENT, UNAUTHENTICATED, PERMISSION_DENIED for a token without factory.audit.write and UNAVAILABLE write nothing; the proto takes findings-v1 and is held with golden files.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Audit.RaiseFindings validates the request against docs/reference/schemas/findings.schema.json and the count critical, records each finding whose id the tenant does not hold as an open Finding with category, severity, owner, evidence references and the redacted summary through the finding routine of AIFACTORY-TASK-3876, appends one audit entry for the call through the append routine of AIFACTORY-TASK-3861 that every recorded finding names in evidenceEntryIds, writes one FindingRaised outbox record per recorded finding in the same transaction and replies ack-v1; a call whose ids are all recorded writes and publishes nothing; the refusals INVALID_ARGUMENT, UNAUTHENTICATED, PERMISSION_DENIED for a token without factory.audit.write and UNAVAILABLE write nothing; the proto takes findings-v1 and is held with golden files."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7712,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6161]",
      "number": 6161
    },
    {
      "id": "AIFACTORY-TASK-6162",
      "type": "task",
      "parent": "AIFACTORY-US-1516",
      "title": "Fixture workload of the tool executor and the findings documents of the acceptance suite",
      "sequence": "12.03.12.02",
      "description": "Fixture workload of the tool executor and the findings documents of the acceptance suite. Expected output: The acceptance suite holds a workload identity shaped like ToolAdapterService with a token that holds factory.audit.write, one without it, a valid findings-v1 document of three findings with one critical, a document that repeats two of its ids and adds one, a document that fails the schema, one whose critical count is wrong, one whose summary carries a personal identifier, and a finding id held by a second tenant.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a workload identity shaped like ToolAdapterService with a token that holds factory.audit.write, one without it, a valid findings-v1 document of three findings with one critical, a document that repeats two of its ids and adds one, a document that fails the schema, one whose critical count is wrong, one whose summary carries a personal identifier, and a finding id held by a second tenant."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7712,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6162]",
      "number": 6162
    },
    {
      "id": "AIFACTORY-TASK-6163",
      "type": "task",
      "parent": "AIFACTORY-US-1516",
      "title": "Verify Audit.RaiseFindings through the acceptance suite",
      "sequence": "12.03.12.03",
      "description": "Verify Audit.RaiseFindings through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-015\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1516 with the fixture of AIFACTORY-TASK-6162: the recorded findings with one entry and their FindingRaised records in one transaction, the repeated and the partly repeated document, every refusal with the stores and the outbox unchanged, the tenant boundary of a finding id and the redacted summary absent from the telemetry and the event payload.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuditService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AuditService-015\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1516 with the fixture of AIFACTORY-TASK-6162: the recorded findings with one entry and their FindingRaised records in one transaction, the repeated and the partly repeated document, every refusal with the stores and the outbox unchanged, the tenant boundary of a finding id and the redacted summary absent from the telemetry and the event payload."
      ],
      "sourceArtifacts": [
        "model/services/governance/AuditService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 77,
      "phase": "factory",
      "stackRank": 7712,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6163]",
      "number": 6163
    },
    {
      "id": "AIFACTORY-FEAT-062",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-012",
      "title": "GovernanceHost: gateway delivery",
      "sequence": "12.04",
      "description": "GovernanceHost is the platform API gateway of bounded context BC-18 (Policy). The API gateway of the Governance platform (ADR-0028): routes public REST and internal gRPC calls to the 4 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.GovernanceHost. Delivers: GovernanceHost (complete). Increment I1: Generate a microservice. Build order 78 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-083",
        "AIFACTORY-US-928",
        "AIFACTORY-US-929",
        "AIFACTORY-US-930",
        "AIFACTORY-US-931",
        "AIFACTORY-US-932"
      ],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7800,
      "titlePrefix": "[AIFACTORY-FEAT-062]",
      "number": 62
    },
    {
      "id": "AIFACTORY-US-083",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-062",
      "title": "GovernanceHost routes the calls of its platform under a trusted scope",
      "sequence": "12.04.01",
      "description": "As a platform admin, I want one gateway in front of the four services of the Governance platform that validates tokens and scopes, so that no service of the platform is reachable from outside the cluster except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the Governance platform. ADR-0028 re-scopes the former composition host as the API gateway of its platform: GovernanceHost routes public REST and internal gRPC calls to the four services the model lists under `deployment.fronts`, ApprovalPolicyService, AuditService, PolicyEngineService and SecretBrokerService, validates tokens and scopes and owns no business state, no relational store and no secret (gateway role GW-03). It stands in front of the decision point of the Factory: decisions are made by PolicyEngineService, approval routing and decision validation by ApprovalPolicyService, evidence, classification and redaction by AuditService and credential issuance by SecretBrokerService, and the gateway decides none of it. The repository ConnectSoft.AI.SoftwareFactory.GovernanceHost is created and scaffolded in I0 by AIFACTORY-TASK-454 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold: it is scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway therefore has no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`); the gateway copies neither the accessor nor the token contract. A user token has one audience, this gateway, and the gateway forwards it to the fronted service unchanged and exchanges no token, because the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). A workload token carries service scopes and no tenant claim and is admitted only on an internal gRPC route whose operation names a service scope the token holds (ADR-0015 amendment D114). The feature is delivered by five further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-928), token, tenant, project and scope on every read and sandbox route (AIFACTORY-US-929), the pass-through of a shared-write call (AIFACTORY-US-930), the production and external routes whose gate stays in the fronted service (AIFACTORY-US-931), and health, revisions, limits and telemetry with the four failure modes of the model (AIFACTORY-US-932). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. A project-scoped route names its project in the path, in a query parameter or in a body member and never in a header the caller types. Three operations of the platform name the project in their path, `ValidateProjectPolicy` of PolicyEngineService, `ValidateProjectApprovalRules` of ApprovalPolicyService and `ExportAudit` of AuditService: the gateway admits the named project only for a token that holds a role claim for it or the tenant-wide Platform admin role, answers 403 itself for a project the token does not grant and calls no service, and sets the project header of the abstractions package itself from the admitted project; a project header a caller sends is dropped on every route. Every other route addresses a resource by its identifier or reads under the tenant of the token: a gateway without business state cannot know the project or the tenant of a revision, a run, a finding or a secret reference, so it forwards under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing right and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. The feature is of increment I1, like the other gateways (D127), so the public routes of the platform are reached through this gateway from the first delivery: a tenant administrator who reads or validates a policy bundle, registers a secret reference or reads audit evidence calls a route of this gateway, and the fronted services build no direct public route. PolicyEngineService, AuditService and SecretBrokerService are delivered complete in I1, and ApprovalPolicyService arrives in I4: until then a route of ApprovalPolicyService answers 503 with a problem response that names the service, and the refusals and the failure branches of every route class are proven against fakes generated from the fronts file. This feature delivers the routes and moves no internal caller onto them. The services of I1 that ask the platform, among them RunControlService, ToolAdapterService, ModelRouterService and ArtifactService, keep the in-cluster address of PolicyEngineService, AuditService and SecretBrokerService they were delivered with, and no PBI of the backlog switches them to this gateway. That switch would be a deployment value of each caller; it is out of scope of this feature, and which feature makes it is reported to the owner. The internal gRPC routes are therefore proven against the fakes of the fronted services, and their first caller on a deployed installation is RunControlService of I4, which asks `ApprovalPolicy.Route` and `ApprovalPolicy.ValidateDecision` through this gateway in the feature of ApprovalPolicyService. When this gateway is unavailable every caller fails closed by design, no run is accepted, no tool executes and no credential is issued, which is why the model sets at least three replicas. The gateway invents no response. Kind: enabling. Traces: services: GovernanceHost, ApprovalPolicyService, AuditService, PolicyEngineService, SecretBrokerService; apis: GovernanceHost/GovernanceHealth; adrs: ADR-0012, ADR-0015, ADR-0016, ADR-0017, ADR-0028; requirements: FR-06, NFR-01. Depends on: AIFACTORY-US-928, AIFACTORY-US-929, AIFACTORY-US-930, AIFACTORY-US-931, AIFACTORY-US-932, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai, feature:policy-engine-service, feature:audit-service-complete, feature:secret-broker-service. Sources: model/services/governance/GovernanceHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/trust-operations/governance/services/governance-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.GovernanceHost created and scaffolded in I0 by AIFACTORY-TASK-454 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.GovernanceHost --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/governance/GovernanceHost.yaml).",
        "AC2: Given a valid token for a route of each fronted service deployed in the increment, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with the token unchanged, the tenant, the project the gateway admitted where the route names one, the correlation id and the trace context, the fronted service answers and the response returns unchanged, as AIFACTORY-US-929 to AIFACTORY-US-931 prove per route class (ADR-0015, FR-06).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret, and no event of the model lists GovernanceHost as a consumer (ADR-0012, ADR-0028, model/services/governance/GovernanceHost.yaml).",
        "AC4: Given the gateway deployed with three replicas, when `GovernanceHost/GovernanceHealth` is probed and one replica is stopped, then health reports the identity platform and the four fronted services, a replica stays in rotation while it can validate tokens, the other replicas keep serving and nothing is replayed, because the gateway holds no state (ADR-0017, NFR-01, model/services/governance/GovernanceHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-3728",
        "AIFACTORY-TASK-754"
      ],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7801,
      "kind": "enabling",
      "traces": {
        "services": [
          "GovernanceHost",
          "ApprovalPolicyService",
          "AuditService",
          "PolicyEngineService",
          "SecretBrokerService"
        ],
        "apis": [
          "GovernanceHost/GovernanceHealth"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0016",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FR-06",
          "NFR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-928",
        "AIFACTORY-US-929",
        "AIFACTORY-US-930",
        "AIFACTORY-US-931",
        "AIFACTORY-US-932",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:policy-engine-service",
        "feature:audit-service-complete",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/governance/GovernanceHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-083]",
      "number": 83
    },
    {
      "id": "AIFACTORY-TASK-3728",
      "type": "task",
      "parent": "AIFACTORY-US-083",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "12.04.01.01",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 3 to 10, the ports https 8000 and grpc 8002, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/governance/GovernanceHost.yaml records them; it leaves Governance:Host:FrontedServices at its default, the four service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 3 to 10, the ports https 8000 and grpc 8002, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/governance/GovernanceHost.yaml records them; it leaves Governance:Host:FrontedServices at its default, the four service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7801,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-3728]",
      "number": 3728
    },
    {
      "id": "AIFACTORY-TASK-754",
      "type": "task",
      "parent": "AIFACTORY-US-083",
      "title": "Verify governance-host-routes-its-platform by running the declared command",
      "sequence": "12.04.01.02",
      "description": "Verify governance-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-083, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature ThreeReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=ThreeReplicas\"`), which hosts three instances of the gateway behind one test balancer with the fakes of the fronted services, probes GovernanceHost/GovernanceHealth on each, stops one instance and asserts that the others keep serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-083, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature ThreeReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=ThreeReplicas\"`), which hosts three instances of the gateway behind one test balancer with the fakes of the fronted services, probes GovernanceHost/GovernanceHealth on each, stops one instance and asserts that the others keep serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-754]",
      "number": 754
    },
    {
      "id": "AIFACTORY-US-928",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-062",
      "title": "Governance fronts file: named clients and REST and gRPC routes of the four fronted services, generated at build",
      "sequence": "12.04.02",
      "description": "As a platform admin, I want the route table of the governance gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Governance platform. It lists the four services of `deployment.fronts` in model/services/governance/GovernanceHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method with its streaming mode, scope, side-effect class and idempotency. For PolicyEngineService these are the five REST operations `ListPolicyBundles`, `GetPolicyBundle`, `ValidateProjectPolicy`, `SimulatePolicy` and `ListRunDecisions` and the three gRPC methods `Policy.Decide`, `Policy.GetActiveRevision` and `Policy.ValidateTightening`. For ApprovalPolicyService these are `ListApprovalRules`, `ValidateProjectApprovalRules` and `GetApprovalRouting` and the gRPC methods `ApprovalPolicy.Route` and `ApprovalPolicy.ValidateDecision`. For AuditService these are the six REST operations `SearchAudit`, `ExportAudit`, `ListClassifications`, `SetClassification`, `ListFindings` and `ResolveFinding` and the gRPC methods `Audit.Record`, `Audit.Classify` and `Audit.Redact`. For SecretBrokerService these are the five REST operations `ListSecretReferences`, `RegisterSecretReference`, `RotateSecret`, `RevokeSecretReference` and `ListRunIssuances` and the gRPC methods `SecretBroker.Issue`, `SecretBroker.Revoke` and `SecretBroker.Verify`. That is nineteen REST routes and eleven gRPC routes, all eleven unary. The file holds the whole surface of the model, also for ApprovalPolicyService, which arrives in I4: the route exists, and what it answers until then is 503 with the service named (AIFACTORY-US-083). The REST operations are the public surface that StudioBff and a typed client call; the gRPC methods are the internal surface over which the gateways of the other platforms ask for decisions, approval routing, evidence, classification and credentials. Each route carries the scope and the side-effect class of its operation, which is what the route class PBIs of this feature enforce; an internal gRPC route names the service scope a workload token must hold. Each REST entry also states how its operation addresses a project. A project-scoped route names its project in the path, in a query parameter or in a body member and never in a header the caller types, and the gateway checks it against the roles of the token. `ValidateProjectPolicy`, `ValidateProjectApprovalRules` and `ExportAudit` name it in the path parameter `projectId`. Eight operations name a revision, a run, an approval, a resource type, a finding or a secret reference in their path and are marked as addressed by a resource identifier only: `GetPolicyBundle`, `ListRunDecisions`, `GetApprovalRouting`, `SetClassification`, `ResolveFinding`, `RotateSecret`, `RevokeSecretReference` and `ListRunIssuances`. `ListPolicyBundles`, `SimulatePolicy`, `ListApprovalRules`, `SearchAudit` and `ListFindings` read under the scope of the caller, and their service files name no path parameter, query parameter or body member for a project; until the model names one they are marked as scoped by the tenant of the token, and the gap is reported as a correction of the service files. `ListClassifications`, `ListSecretReferences` and `RegisterSecretReference` act on the classification registry and the secret references of the tenant, which a Platform admin owns tenant-wide, so they are marked as tenant-wide by design, a fourth marking that is no gap of the model. The four markings cover all nineteen REST operations: three by the path parameter `projectId`, eight by a resource identifier only, five by the tenant of the token until their service files name a project parameter, and three tenant-wide by design. A test lists the emitted route table against the file and against the four service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `GovernanceHealth` and `GovernanceRevisions`, transforms no payload and composes no response from two services. The option `Governance:Host:FrontedServices` is bound at startup and compared with the service names of the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable. The fronts file names its services by their identifiers, as `deployment.fronts` lists them, and the default of a fronted-services option equals that set by decision. model/services/governance/GovernanceHost.yaml shows that default as the four service identifiers, and the deployment manifest does not set the option. The pipeline of this repository publishes the OpenAPI document of the nineteen public REST operations as a build output, checked against the fronts file and the four service files. This feature builds and publishes no client package: the typed client of a gateway is published by feature `typed-gateway-clients`, and the package version in which it adds the governance gateway is reported to the owner. Kind: enabling. Traces: services: GovernanceHost, ApprovalPolicyService, AuditService, PolicyEngineService, SecretBrokerService; adrs: ADR-0015, ADR-0028; requirements: FR-06. Depends on: feature:component-api-gateway-template, feature:policy-engine-service, feature:audit-service-complete, feature:secret-broker-service. Sources: model/services/governance/GovernanceHost.yaml, model/services/governance/PolicyEngineService.yaml, model/services/governance/ApprovalPolicyService.yaml, model/services/governance/AuditService.yaml, model/services/governance/SecretBrokerService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/architecture/api-governance.md, docs/planes/trust-operations/governance/services/governance-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Governance platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, nineteen REST routes and eleven unary gRPC routes, each with the scope, side-effect class and idempotency of the operation, and the route table test passes against model/services/governance/GovernanceHost.yaml and the four service files under model/services/governance (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `Governance:Host:FrontedServices` at its default, the four service identifiers of `deployment.fronts` in model/services/governance/GovernanceHost.yaml, when the gateway starts, then startup succeeds; given a value of the option that names no service of the fronts file or omits one, when the gateway starts, then startup fails with the differing name; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, which carries the token of the caller unchanged because the gateway exchanges no token, the tenant, the correlation id and the trace context, a project header sent by the caller has been dropped, and the response of the fake returns unchanged (ADR-0015, FR-06).",
        "AC4: Given the built gateway, when its pipeline publishes the OpenAPI document of the public REST routes, then the document holds exactly the nineteen REST operations of the fronts file with their methods, paths, scopes and response codes and no internal gRPC method, and a contract check fails the build when it differs from the four service files under model/services/governance (docs/architecture/api-governance.md)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-455",
        "AIFACTORY-TASK-3729",
        "AIFACTORY-TASK-3730",
        "AIFACTORY-TASK-3731"
      ],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7802,
      "kind": "enabling",
      "traces": {
        "services": [
          "GovernanceHost",
          "ApprovalPolicyService",
          "AuditService",
          "PolicyEngineService",
          "SecretBrokerService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:policy-engine-service",
        "feature:audit-service-complete",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-928]",
      "number": 928
    },
    {
      "id": "AIFACTORY-TASK-455",
      "type": "task",
      "parent": "AIFACTORY-US-928",
      "title": "Fronts file with the REST and gRPC operations of ApprovalPolicyService, AuditService, PolicyEngineService and SecretBrokerService",
      "sequence": "12.04.02.01",
      "description": "Fronts file with the REST and gRPC operations of ApprovalPolicyService, AuditService, PolicyEngineService and SecretBrokerService. Expected output: The fronts file lists the four services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation how it addresses a project, one of four markings that together cover all nineteen operations: by the path parameter projectId for ValidateProjectPolicy, ValidateProjectApprovalRules and ExportAudit; by a resource identifier only for GetPolicyBundle, ListRunDecisions, GetApprovalRouting, SetClassification, ResolveFinding, RotateSecret, RevokeSecretReference and ListRunIssuances; by the tenant of the token for ListPolicyBundles, SimulatePolicy, ListApprovalRules, SearchAudit and ListFindings, whose service files name no project parameter, which is reported as a correction of those files; and tenant-wide by design for ListClassifications, ListSecretReferences and RegisterSecretReference; a test fails when a REST operation carries none or more than one of the four markings; the build emits the named clients, the nineteen REST routes, the eleven gRPC routes and the route table; at startup the option Governance:Host:FrontedServices, whose default is the four service identifiers of deployment.fronts, is compared with the service names of the fronts file, the gateway starts with the option at its default, and a difference in either direction fails startup with the name; a project header of a caller is dropped on every route; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the four services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation how it addresses a project, one of four markings that together cover all nineteen operations: by the path parameter projectId for ValidateProjectPolicy, ValidateProjectApprovalRules and ExportAudit; by a resource identifier only for GetPolicyBundle, ListRunDecisions, GetApprovalRouting, SetClassification, ResolveFinding, RotateSecret, RevokeSecretReference and ListRunIssuances; by the tenant of the token for ListPolicyBundles, SimulatePolicy, ListApprovalRules, SearchAudit and ListFindings, whose service files name no project parameter, which is reported as a correction of those files; and tenant-wide by design for ListClassifications, ListSecretReferences and RegisterSecretReference; a test fails when a REST operation carries none or more than one of the four markings; the build emits the named clients, the nineteen REST routes, the eleven gRPC routes and the route table; at startup the option Governance:Host:FrontedServices, whose default is the four service identifiers of deployment.fronts, is compared with the service names of the fronts file, the gateway starts with the option at its default, and a difference in either direction fails startup with the name; a project header of a caller is dropped on every route; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-455]",
      "number": 455
    },
    {
      "id": "AIFACTORY-TASK-3729",
      "type": "task",
      "parent": "AIFACTORY-US-928",
      "title": "Fakes of the four fronted services and the token matrix of the acceptance suite",
      "sequence": "12.04.02.02",
      "description": "Fakes of the four fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received and answers a configured status and body, a switch that makes a fake stop answering, a configuration in which ApprovalPolicyService has no instance behind its base address, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received and answers a configured status and body, a switch that makes a fake stop answering, a configuration in which ApprovalPolicyService has no instance behind its base address, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3729]",
      "number": 3729
    },
    {
      "id": "AIFACTORY-TASK-3730",
      "type": "task",
      "parent": "AIFACTORY-US-928",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "12.04.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the nineteen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the four service files under model/services/governance and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can be the input from which feature typed-gateway-clients generates the client of this gateway; no client package is built here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the nineteen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with the four service files under model/services/governance and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can be the input from which feature typed-gateway-clients generates the client of this gateway; no client package is built here."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7802,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3730]",
      "number": 3730
    },
    {
      "id": "AIFACTORY-TASK-3731",
      "type": "task",
      "parent": "AIFACTORY-US-928",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "12.04.02.04",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-928: one route per operation of the four service files under model/services/governance, the failing builds, the start with the option at its default, the failing startup on a value that names no service of the fronts file or omits one, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller, and the contract check of the published OpenAPI document.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-928: one route per operation of the four service files under model/services/governance, the failing builds, the start with the option at its default, the failing startup on a value that names no service of the fronts file or omits one, the 404 of an unknown path, one forwarded call per service and protocol with the dropped project header of the caller, and the contract check of the published OpenAPI document."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3731]",
      "number": 3731
    },
    {
      "id": "AIFACTORY-US-929",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-062",
      "title": "A read or sandbox route of the governance gateway forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "12.04.03",
      "description": "As an observer, I want my read calls to reach the policy, approval policy, audit and secret broker services only with the tenant and the scope my token grants, so that I see the bundles, rules, decisions, evidence and references I am entitled to and nobody reads across a tenant through the gateway. A caller reaches a read or a sandbox operation of the Governance platform through the gateway. A person reads the policy bundles in force and the rules of a revision, the policy decisions and the credential issuances of a run, the approval rules and the routing of an approval, audit evidence, classifications, findings and secret references; a Workspace admin validates a project policy or project approval rules and simulates a candidate bundle; and the gateways of the other platforms ask for decisions over gRPC. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment D114); a client that also calls the Control Plane gateway requests a second token for it. The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names: `factory.policies.read` for `ListPolicyBundles`, `GetPolicyBundle` and `ListApprovalRules`, `factory.runs.read` for `ListRunDecisions` and `ListRunIssuances`, `factory.approvals.read` for `GetApprovalRouting`, `factory.audit.read` for `SearchAudit`, `ListClassifications` and `ListFindings`, `factory.secrets.admin` for `ListSecretReferences`, and `factory.policies.write` for the three sandbox operations `ValidateProjectPolicy`, `SimulatePolicy` and `ValidateProjectApprovalRules`. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. Of these thirteen operations two name their project in the path, `ValidateProjectPolicy` and `ValidateProjectApprovalRules`: the gateway admits the project only for a token that holds a role claim for it or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself for a project the token does not grant, calling no service. Four name a resource by identifier, a revision, a run or an approval, and a gateway without business state cannot know the tenant or the project of such a resource: it forwards the call under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. `ListPolicyBundles`, `SimulatePolicy`, `ListApprovalRules`, `SearchAudit` and `ListFindings` read under the scope of the caller and name no resource; until their service files name the parameter that carries a project (AIFACTORY-US-928), the gateway forwards them under the tenant of the token, and the fronted service, which validates the forwarded token again, applies its own project rule from the role claims of that token. `ListClassifications` and `ListSecretReferences` are tenant-wide by design. A project header a caller sends is dropped and establishes nothing. A sandbox route of this platform belongs to no run and to no workspace: the fronted service validates or simulates a candidate, stores nothing, activates nothing and publishes nothing, and its result, valid or not valid, returns unchanged with its status; the gateway reads no candidate and keeps none. Every public REST operation names a `factory.` scope and none names a service scope, so no REST route admits a workload token; a workload token on such a route is answered 403. The scope is established once with the scope accessor of the pinned abstractions package and forwarded: the authorization header with the user token itself, the tenant in `X-Tenant-Id`, the correlation id and the trace context. The gateway exchanges no token; the fronted service accepts the audience of its own gateway, which is this one, and applies its own tenant filter and role policies (ADR-0015 amendment D117). The internal gRPC surface has six methods of class read: `Policy.Decide`, `Policy.GetActiveRevision`, `Policy.ValidateTightening`, `ApprovalPolicy.Route`, `ApprovalPolicy.ValidateDecision` and `Audit.Classify`. They are the decision path of the Factory: run control asks through them whether a run may be accepted and who may approve, and the runtime, the model gateway and the tool executor ask before every gated call. A workload presents a token that carries service scopes, no audience of a user API and no tenant claim, and each gRPC route names the service scope the token must hold. For a workload token that holds it, the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope; for a workload token without it, and for a user token, which holds no service scope, the answer is PERMISSION_DENIED and no fronted service is called. The gateway decides nothing on this path and remembers nothing of it: it caches no decision, no revision and no routing, because the decision cache per revision belongs to PolicyEngineService, and that `Policy.Decide`, `ApprovalPolicy.Route` and `ApprovalPolicy.ValidateDecision` record a decision or an evaluation in their own store is the matter of those services. For every route of this PBI the response is served by the fronted service and returns unchanged with the correlation id; the gateway keeps nothing of the call and records `connectsoft.factory.governance.host.requests` and `connectsoft.factory.governance.host.request_duration` for the route. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope of the operation 403; in each case no fronted service is called and the refusal is counted for the route and logged with the correlation id and without the token. When the fronted service does not answer, or is not deployed yet as ApprovalPolicyService is until I4, the route answers 503, over gRPC UNAVAILABLE, with a retry hint that names the service and never its address, and the routes of the other services keep serving. The gateway never answers a decision in place of the policy engine: a caller that receives UNAVAILABLE fails closed. Kind: behavior. Traces: services: GovernanceHost, ApprovalPolicyService, AuditService, PolicyEngineService, SecretBrokerService; adrs: ADR-0015, ADR-0028; requirements: FR-06, FUX-05, NFR-01, NFR-04; scenarios: SCN-GovernanceHost-005, SCN-GovernanceHost-006. Relates: screens: policies, approval-policy, audit, findings, secrets-references, run-detail. Depends on: AIFACTORY-US-928, feature:component-api-gateway-template, feature:component-extensions-ai, feature:policy-engine-service, feature:audit-service-complete, feature:secret-broker-service. Sources: model/services/governance/GovernanceHost.yaml, model/services/governance/PolicyEngineService.yaml, model/services/governance/ApprovalPolicyService.yaml, model/services/governance/AuditService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/trust-operations/governance/services/governance-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with `factory.policies.read`, when the read route of `GetPolicyBundle` is called, then the gateway forwards the call with the user token unchanged in the authorization header, without a token exchange, the tenant of the `tid` claim, the correlation id and the trace context, PolicyEngineService answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-GovernanceHost-005, ADR-0015, FUX-05).",
        "AC2: Given the token matrix of the acceptance suite, when the read and the sandbox routes of the four fronted services are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope of the operation and a workload token on a REST route are answered 403, and in none of these cases a fronted service is called; each refusal is counted for its route and logged with the correlation id and without the token (SCN-GovernanceHost-005, SCN-GovernanceHost-006, ADR-0015).",
        "AC3: Given a token with `factory.policies.write`, when the sandbox route of `ValidateProjectPolicy` is called with a `projectId` in its path, then a token that holds a role claim for that project or the tenant-wide Platform admin role is forwarded with the project in the project header the gateway sets and the body unchanged, the result of the fake of PolicyEngineService, valid or not valid, returns unchanged with its status, and a token that grants no role in that project is answered 403 by the gateway itself without a call; the gateway stored no candidate, and the route of `SimulatePolicy` is forwarded under the tenant of the token, as model/services/governance/GovernanceHost.yaml and the service files name no project parameter for it (SCN-GovernanceHost-006).",
        "AC4: Given a valid user token, a tenant header of the caller that names another tenant and a project header of the caller, when a read route addressed by a `revision`, a `runId` or an `approvalId` is called, then the tenant header is overwritten with the `tid` claim, the project header of the caller is dropped, the call is forwarded under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant return unchanged; given a workload token that holds the service scope the route names, when the gRPC routes of `Policy.Decide` and `Audit.Classify` are called with `tenant-id` and project metadata, then the gateway forwards each call with that metadata unchanged and returns the reply unchanged, and a workload token without the scope and a user token are answered PERMISSION_DENIED without a call (SCN-GovernanceHost-005, NFR-01).",
        "AC5: Given a fronted service that does not answer and the routes of ApprovalPolicyService while that service is not deployed, when their read and sandbox routes are called, then the gateway answers 503, over gRPC UNAVAILABLE, with a problem response that carries a retry hint and names the service and never its address, no response and no decision is invented, the shared cache holds no decision, revision or routing, and the routes of the other services keep serving (SCN-GovernanceHost-005, SCN-GovernanceHost-006, model/services/governance/GovernanceHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3732",
        "AIFACTORY-TASK-3733"
      ],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7803,
      "kind": "behavior",
      "traces": {
        "services": [
          "GovernanceHost",
          "ApprovalPolicyService",
          "AuditService",
          "PolicyEngineService",
          "SecretBrokerService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "NFR-01",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-GovernanceHost-005",
          "SCN-GovernanceHost-006"
        ]
      },
      "relates": {
        "screens": [
          "policies",
          "approval-policy",
          "audit",
          "findings",
          "secrets-references",
          "run-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-928",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:policy-engine-service",
        "feature:audit-service-complete",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-929]",
      "number": 929
    },
    {
      "id": "AIFACTORY-TASK-3732",
      "type": "task",
      "parent": "AIFACTORY-US-929",
      "title": "Issuer, audience, scope, tenant and project configuration of the read and sandbox routes",
      "sequence": "12.04.03.01",
      "description": "Issuer, audience, scope, tenant and project configuration of the read and sandbox routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route and the project header is set only from a project the gateway admitted from a path parameter, a query parameter or a body member; the routes of ValidateProjectPolicy and ValidateProjectApprovalRules admit the projectId of their path only for a token with a role claim for it or the tenant-wide Platform admin role and answer 403 themselves otherwise; a route addressed by a resource identifier is marked as such, so the gateway checks token and scope and leaves the role and the tenant of the resource to the fronted service; ListPolicyBundles, SimulatePolicy, ListApprovalRules, SearchAudit and ListFindings are forwarded under the tenant of the token until their service files name a project parameter; a workload token is refused with 403 on a REST route; a gRPC route names the service scope a workload token must hold and forwards the tenant-id and project metadata unchanged with it (ADR-0015 amendment D114); the user token is forwarded unchanged and no token is exchanged (ADR-0015 amendment D117); no decision, revision or routing is cached; refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read and sandbox route requires the scope of its operation; the tenant header is overwritten with the tid claim; a project header of a caller is dropped on every route and the project header is set only from a project the gateway admitted from a path parameter, a query parameter or a body member; the routes of ValidateProjectPolicy and ValidateProjectApprovalRules admit the projectId of their path only for a token with a role claim for it or the tenant-wide Platform admin role and answer 403 themselves otherwise; a route addressed by a resource identifier is marked as such, so the gateway checks token and scope and leaves the role and the tenant of the resource to the fronted service; ListPolicyBundles, SimulatePolicy, ListApprovalRules, SearchAudit and ListFindings are forwarded under the tenant of the token until their service files name a project parameter; a workload token is refused with 403 on a REST route; a gRPC route names the service scope a workload token must hold and forwards the tenant-id and project metadata unchanged with it (ADR-0015 amendment D114); the user token is forwarded unchanged and no token is exchanged (ADR-0015 amendment D117); no decision, revision or routing is cached; refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3732]",
      "number": 3732
    },
    {
      "id": "AIFACTORY-TASK-3733",
      "type": "task",
      "parent": "AIFACTORY-US-929",
      "title": "Verify the read and sandbox routes through the acceptance suite",
      "sequence": "12.04.03.02",
      "description": "Verify the read and sandbox routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GovernanceHost-005|Scenario=SCN-GovernanceHost-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-929 over the token matrix of AIFACTORY-TASK-3729: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the routes forwarded under the tenant of the token, the sandbox route of ValidateProjectPolicy with a granted and a refused project and with both results of the fake, a workload token refused on a REST route, the gRPC routes of Policy.Decide and Audit.Classify with and without the service scope, a fake that stops answering, the routes of the service that is not deployed and an inspection of the shared cache.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GovernanceHost-005|Scenario=SCN-GovernanceHost-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-929 over the token matrix of AIFACTORY-TASK-3729: the token received by the fake equal to the user token of the caller, the overwritten tenant header and the dropped project header, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, the routes forwarded under the tenant of the token, the sandbox route of ValidateProjectPolicy with a granted and a refused project and with both results of the fake, a workload token refused on a REST route, the gRPC routes of Policy.Decide and Audit.Classify with and without the service scope, a fake that stops answering, the routes of the service that is not deployed and an inspection of the shared cache."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3733]",
      "number": 3733
    },
    {
      "id": "AIFACTORY-US-930",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-062",
      "title": "A shared-write route of the governance gateway passes the call through and the gateway keeps nothing between calls, a credential least of all",
      "sequence": "12.04.04",
      "description": "As a platform admin, I want a write that is repeated after a failure to be applied once by the service that owns it, and a credential that passes the gateway to stay nowhere in it, so that a lost answer or a restarted gateway never appends evidence twice, and no secret can be read from the gateway. A shared-write operation changes state that others read. The Governance platform has one on its public surface, `ResolveFinding` of AuditService, by which a holder of `factory.audit.admin` resolves a finding or accepts its risk with a reason, and four on its internal gRPC surface: `Audit.Record`, which appends evidence for a command that is not an event, `Audit.Redact`, which applies the redaction rules of a class to a content reference and returns the reference of the redacted artifact, `SecretBroker.Issue`, which issues a short-lived scoped credential for a subject and a purpose after a policy decision, and `SecretBroker.Revoke`, which revokes an issuance. The caller sends each through the gateway under the token, tenant and scope rules of AIFACTORY-US-929: `factory.audit.admin` for `ResolveFinding`, and on a gRPC route a workload token that holds the service scope the route names. `ResolveFinding` names a finding by identifier, so the gateway forwards it under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a finding of another tenant (ADR-0015 amendment D113) return unchanged. None of the five declares the idempotency `key-header`: `ResolveFinding` is naturally idempotent, `Audit.Record` appends once per evidence id, and what `SecretBroker.Issue` and `SecretBroker.Revoke` do with a repeated request is the rule of SecretBrokerService. The gateway is no party to idempotency. It forwards the request with its body, its headers and its metadata unchanged, stores neither a request nor a result, keeps no session and no pending call, has no outbox and writes no event and no audit evidence of its own. A gateway replica that crashes during a call therefore loses nothing it owned: the replica restarts, nothing is replayed, and the caller repeats the call and receives from the service the answer of its own rule (failure mode Gateway replica crash of the model). The reply of `SecretBroker.Issue` carries a credential, delivered once over the authenticated channel. The gateway passes it through as it arrives. It writes the credential to no log record, no activity, no metric and no cache entry, and neither the request nor the reply of the four gRPC routes is logged with its body; a conformance test scans the captured telemetry and the shared cache for the marker credential of the suite. Raw secrets never reach the gateway at rest: it has no secret of its own and no store that could hold one. When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a problem response that names the service and carries a retry hint, the other routes keep serving and the caller fails closed: no credential is issued and no evidence is assumed recorded. A refusal by the gateway, 401, 403 or PERMISSION_DENIED, reaches no fronted service, so it applies nothing. An invalid body and every domain refusal are answers of the fronted service and return unchanged with the correlation id. AuditService and SecretBrokerService were delivered complete in I1 and answer these routes on a deployed instance; the pass-through, the refusals and the failure branches are proven against the fakes generated from the fronts entries. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: GovernanceHost, AuditService, SecretBrokerService; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: NFR-01, NFR-04; scenarios: SCN-GovernanceHost-007. Relates: screens: findings. Depends on: AIFACTORY-US-928, AIFACTORY-US-929, feature:component-api-gateway-template, feature:audit-service-complete, feature:secret-broker-service. Sources: model/services/governance/GovernanceHost.yaml, model/services/governance/AuditService.yaml, model/services/governance/SecretBrokerService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/trust-operations/governance/services/governance-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a valid token with `factory.audit.admin`, when the shared-write route of `ResolveFinding` is called, then the gateway forwards the request with the body unchanged under the tenant of the token, the fake of AuditService applies it and the response returns unchanged with the correlation id; the 403 of the fake for a missing role and its 404 for a finding of another tenant return unchanged (SCN-GovernanceHost-007, ADR-0015).",
        "AC2: Given a workload token that holds the service scope the route names, when the gRPC routes of `Audit.Record`, `Audit.Redact`, `SecretBroker.Issue` and `SecretBroker.Revoke` are called with `tenant-id` and project metadata, then each call reaches its fake with that metadata and the message unchanged and the reply returns unchanged; a workload token without the scope and a user token are answered PERMISSION_DENIED and no fronted service is called (SCN-GovernanceHost-007, ADR-0028).",
        "AC3: Given the reply of `SecretBroker.Issue` that carries the marker credential of the suite, when it passes the gateway, then the caller receives it unchanged and a scan of the captured log records, activities and metrics and of the shared cache finds the marker nowhere; the gateway holds no secret and binds no store that could hold one, as model/services/governance/GovernanceHost.yaml states (SCN-GovernanceHost-007, ADR-0019).",
        "AC4: Given a gateway replica stopped while a shared-write call is in flight, when the caller repeats the call through another replica, then the second replica forwards it as a new call, the fake received two calls, the gateway replayed nothing and stored neither a request nor a result; given a fronted service that does not answer, then the route answers 503, over gRPC UNAVAILABLE, with a retry hint that names the service while the other routes keep serving (SCN-GovernanceHost-007, NFR-01)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3734",
        "AIFACTORY-TASK-3735"
      ],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7804,
      "kind": "behavior",
      "traces": {
        "services": [
          "GovernanceHost",
          "AuditService",
          "SecretBrokerService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-01",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-GovernanceHost-007"
        ]
      },
      "relates": {
        "screens": [
          "findings"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-928",
        "AIFACTORY-US-929",
        "feature:component-api-gateway-template",
        "feature:audit-service-complete",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-930]",
      "number": 930
    },
    {
      "id": "AIFACTORY-TASK-3734",
      "type": "task",
      "parent": "AIFACTORY-US-930",
      "title": "Forwarded headers and metadata of a write route and a call path that keeps no body and no credential",
      "sequence": "12.04.04.01",
      "description": "Forwarded headers and metadata of a write route and a call path that keeps no body and no credential. Expected output: A shared-write route forwards the body, the headers and the metadata of the call and the established scope unchanged and returns the status and the body of the fronted service unchanged; the four gRPC routes Audit.Record, Audit.Redact, SecretBroker.Issue and SecretBroker.Revoke are excluded from body logging in both directions; no request, result or credential is written to the shared cache, to a log record, to an activity or to a metric; the gateway writes no event and no audit evidence of its own; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "A shared-write route forwards the body, the headers and the metadata of the call and the established scope unchanged and returns the status and the body of the fronted service unchanged; the four gRPC routes Audit.Record, Audit.Redact, SecretBroker.Issue and SecretBroker.Revoke are excluded from body logging in both directions; no request, result or credential is written to the shared cache, to a log record, to an activity or to a metric; the gateway writes no event and no audit evidence of its own; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3734]",
      "number": 3734
    },
    {
      "id": "AIFACTORY-TASK-3735",
      "type": "task",
      "parent": "AIFACTORY-US-930",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "12.04.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-GovernanceHost-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-930 with the fakes of AIFACTORY-TASK-3729: the route of ResolveFinding with the 403 and the 404 of the fake returned unchanged, the four gRPC routes with and without the service scope, the marker credential in the reply of SecretBroker.Issue with the scan of the captured telemetry and of the shared cache, a replica stopped during a call with the repeated call forwarded as a new one, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-GovernanceHost-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-930 with the fakes of AIFACTORY-TASK-3729: the route of ResolveFinding with the 403 and the 404 of the fake returned unchanged, the four gRPC routes with and without the service scope, the marker credential in the reply of SecretBroker.Issue with the scan of the captured telemetry and of the shared cache, a replica stopped during a call with the repeated call forwarded as a new one, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3735]",
      "number": 3735
    },
    {
      "id": "AIFACTORY-US-931",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-062",
      "title": "A production or external route of the governance gateway is forwarded under its scope and the gate of the action stays in the fronted service",
      "sequence": "12.04.05",
      "description": "As a platform admin, I want a classification change, a secret reference change or an audit export to be decided by the service that owns its state, with the gateway only checking who I am and what I may call, so that a gate is never decided twice or by a component that holds no state. Two side-effect classes of the Governance platform carry a gate beyond the scope. The production routes are `SetClassification` of AuditService, by which a Platform admin sets the data class, the retention, the redaction rules and the residency of a resource type or instance, and three operations of SecretBrokerService on secret references: `RegisterSecretReference`, which registers a reference to a vault secret or an exchangeable identity, `RotateSecret`, which records a rotation and revokes the live issuances of the old version, and `RevokeSecretReference`, which revokes a reference and every live issuance. The external routes are `ExportAudit` of AuditService, the export of the evidence of a project in open formats with chain proofs (D31, XL-14), and the internal gRPC method `SecretBroker.Verify`, a probe that a reference resolves and its credential works without issuing it to the caller. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, requires the scope the operation names, `factory.audit.admin` for `SetClassification`, `factory.secrets.admin` for the three operations on secret references and `factory.audit.export` for `ExportAudit`, and forwards the call with the established scope; on the gRPC route of `SecretBroker.Verify` it requires a workload token that holds the service scope the route names. `ExportAudit` names its project in the path parameter `projectId`: the gateway admits it only for a token that holds a role claim for that project or the tenant-wide Platform admin role, sets the project header from it and answers 403 itself for a project the token does not grant. `SetClassification`, `RotateSecret` and `RevokeSecretReference` name a resource type or a secret reference by identifier, and `RegisterSecretReference` acts on the secret references of the tenant of the token, so the gateway forwards them under the tenant of the token and the scope of the operation, and the 403 of the fronted service for a missing role and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. `ExportAudit`, `RegisterSecretReference` and `RotateSecret` declare the idempotency `key-header`: the gateway forwards the `Idempotency-Key` unchanged, the fronted service applies the request once under its own rule, and its answer for a reused key returns unchanged, whatever its status. The gate itself is decided where the state is. AuditService decides a classification change and answers 409 where it conflicts, accepts an export with 202 and has its own worker produce the package. SecretBrokerService decides the registration, the rotation and the revocation of a reference, answers 409 where a command conflicts with the state of a reference, and talks to the vault itself. Whatever gate one of these commands has is decided by the fronted service that owns it. The gateway evaluates no policy and no approval, holds no approval reference, no classification and no secret reference, calls no vault and no connector, and writes no receipt and no audit evidence. Where a command leaves audit evidence, the service that owns the command writes it to its own outbox in the transaction of the command, as the event `AuditEvidenceSubmitted` on the topic `audit.evidence.v1.evidence-submitted`; the gateway has no outbox. The answer of the fronted service, including 201, 202 and 409, returns unchanged with the correlation id. A call without a token is answered 401 and a token without the scope 403, and no fronted service is called. The body of a request to register or rotate a reference names a vault location and never a secret value, and the gateway logs no body of these routes all the same. In this increment AuditService and SecretBrokerService are deployed, delivered complete in I1; the refusals and the failure branches are proven against fakes generated from the fronts entries. When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with a problem response that names the service and a retry hint, and the caller retries with its key. Kind: behavior. Traces: services: GovernanceHost, AuditService, SecretBrokerService; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: NFR-04, XL-14; scenarios: SCN-GovernanceHost-003, SCN-GovernanceHost-004. Relates: screens: audit, findings, secrets-references. Depends on: AIFACTORY-US-928, AIFACTORY-US-929, feature:component-api-gateway-template, feature:audit-service-complete, feature:secret-broker-service. Sources: model/services/governance/GovernanceHost.yaml, model/services/governance/AuditService.yaml, model/services/governance/SecretBrokerService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a token with `factory.audit.export` and a role claim for the project of the path, when the external route of `ExportAudit` is called with an `Idempotency-Key`, then the gateway forwards the call with the key unchanged and the project in the project header it sets, the fake of AuditService accepts the export and answers 202, and that answer returns unchanged with the correlation id; the gateway called no connector and wrote no receipt and no evidence; given a token without a role in that project, then the gateway answers 403 itself and AuditService is not called (SCN-GovernanceHost-003, ADR-0028, XL-14).",
        "AC2: Given a token with `factory.secrets.admin`, when the production routes of `RegisterSecretReference` and `RotateSecret` are called with an `Idempotency-Key` against the fake of SecretBrokerService that answers 201, 200, 404 or 409, then the gateway forwards each call with the key and the body unchanged under the tenant of the token and returns each answer unchanged; given a token with `factory.audit.admin`, when the production route of `SetClassification` is called against the fake of AuditService that answers 200, 403 or 409, then each answer returns unchanged; the gateway evaluated no approval and no policy and holds no classification and no secret reference (SCN-GovernanceHost-004, ADR-0028).",
        "AC3: Given a workload token that holds the service scope the route names, when the external gRPC route of `SecretBroker.Verify` is called, then the call reaches the fake with its metadata unchanged and the reply returns unchanged; a workload token without the scope and a user token are answered PERMISSION_DENIED and no fronted service is called (SCN-GovernanceHost-003, ADR-0015).",
        "AC4: Given a call without a token or with an expired token, or a token that lacks the scope of the operation, when a production or external route is called, then the gateway answers 401 or 403 and no fronted service is called; given a route that names only a resource id, such as the `referenceId` of a rotation or a revocation, when the fronted service answers 403 for a missing role or 404 for a resource of another tenant, then the gateway returns that answer unchanged (SCN-GovernanceHost-003, SCN-GovernanceHost-004, ADR-0015).",
        "AC5: Given a fronted service that does not answer, when a production or external route of it is called, then the gateway answers 503, over gRPC UNAVAILABLE, with a problem response that names the service and carries a retry hint, invents no response, and the routes of the other services keep serving; and the register of gated routes fails the build when a route of class production or external has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a classification, a secret reference, an export or a receipt (SCN-GovernanceHost-003, SCN-GovernanceHost-004, model/services/governance/GovernanceHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3736",
        "AIFACTORY-TASK-3737",
        "AIFACTORY-TASK-3738"
      ],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7805,
      "kind": "behavior",
      "traces": {
        "services": [
          "GovernanceHost",
          "AuditService",
          "SecretBrokerService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-04",
          "XL-14"
        ],
        "scenarios": [
          "SCN-GovernanceHost-003",
          "SCN-GovernanceHost-004"
        ]
      },
      "relates": {
        "screens": [
          "audit",
          "findings",
          "secrets-references"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-928",
        "AIFACTORY-US-929",
        "feature:component-api-gateway-template",
        "feature:audit-service-complete",
        "feature:secret-broker-service"
      ],
      "source": [
        "model/services/governance/GovernanceHost.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-931]",
      "number": 931
    },
    {
      "id": "AIFACTORY-TASK-3736",
      "type": "task",
      "parent": "AIFACTORY-US-931",
      "title": "Project check of the audit export route and the route class register of the gateway",
      "sequence": "12.04.05.01",
      "description": "Project check of the audit export route and the route class register of the gateway. Expected output: The route of ExportAudit admits the projectId of its path only for a token with a role claim for it or the tenant-wide Platform admin role, sets the project header from it, forwards the Idempotency-Key unchanged and answers 403 itself otherwise; the routes of RegisterSecretReference and RotateSecret forward their Idempotency-Key unchanged; no body of a production or external route is logged; a register test lists every route of class production and external from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a classification, a secret reference, an export or a receipt.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "The route of ExportAudit admits the projectId of its path only for a token with a role claim for it or the tenant-wide Platform admin role, sets the project header from it, forwards the Idempotency-Key unchanged and answers 403 itself otherwise; the routes of RegisterSecretReference and RotateSecret forward their Idempotency-Key unchanged; no body of a production or external route is logged; a register test lists every route of class production and external from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a classification, a secret reference, an export or a receipt."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7805,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3736]",
      "number": 3736
    },
    {
      "id": "AIFACTORY-TASK-3737",
      "type": "task",
      "parent": "AIFACTORY-US-931",
      "title": "Fakes of the production and external routes for the acceptance suite",
      "sequence": "12.04.05.02",
      "description": "Fakes of the production and external routes for the acceptance suite. Expected output: The acceptance suite holds a fake of ExportAudit of AuditService that answers 202, 403 and 404, a fake of SetClassification that answers 200, 403 and 409, fakes of RegisterSecretReference, RotateSecret and RevokeSecretReference of SecretBrokerService that answer 201, 200, 403, 404 and 409 and apply an Idempotency-Key once, and a fake of SecretBroker.Verify, each generated from its fronts entry and each recording the headers, the metadata and the body it received.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of ExportAudit of AuditService that answers 202, 403 and 404, a fake of SetClassification that answers 200, 403 and 409, fakes of RegisterSecretReference, RotateSecret and RevokeSecretReference of SecretBrokerService that answer 201, 200, 403, 404 and 409 and apply an Idempotency-Key once, and a fake of SecretBroker.Verify, each generated from its fronts entry and each recording the headers, the metadata and the body it received."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7805,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3737]",
      "number": 3737
    },
    {
      "id": "AIFACTORY-TASK-3738",
      "type": "task",
      "parent": "AIFACTORY-US-931",
      "title": "Verify the production and external routes through the acceptance suite",
      "sequence": "12.04.05.03",
      "description": "Verify the production and external routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GovernanceHost-003|Scenario=SCN-GovernanceHost-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-931: the export forwarded with its key and its admitted project and refused for a project without a role, the answers 200, 201, 202, 403, 404 and 409 of the fakes returned unchanged, the gRPC route of SecretBroker.Verify with and without the service scope, the refusals of the gateway without a call to a fronted service, a fake that stops answering and the register of gated routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GovernanceHost-003|Scenario=SCN-GovernanceHost-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-931: the export forwarded with its key and its admitted project and refused for a project without a role, the answers 200, 201, 202, 403, 404 and 409 of the fakes returned unchanged, the gRPC route of SecretBroker.Verify with and without the service scope, the refusals of the gateway without a call to a fronted service, a fake that stops answering and the register of gated routes."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3738]",
      "number": 3738
    },
    {
      "id": "AIFACTORY-US-932",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-062",
      "title": "Health, revisions, limits and telemetry of the governance gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "12.04.06",
      "description": "As an operator, I want to see whether the governance gateway, the identity platform and each fronted service answer, and which policy and approval rule revisions are in force, so that I can tell a failing service from a failing gateway and act on the right one before callers fail closed. An operator and the probes of the cluster read the state of the gateway through its two own operations. `GovernanceHost/GovernanceHealth` reports liveness and readiness of the gateway with the aggregated health of the four services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. What the gateway does when it is unreachable is decided (ADR-0015 amendment D117). While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe `GovernanceHealth` answers 200 with the health degraded and a detail that names the identity platform as unreachable, so the operator sees the failure in health while calls still pass. The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, `GovernanceHealth` answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency: when it does not answer, or is not deployed yet as ApprovalPolicyService is until I4, health reports it as unavailable in the detail and the answer stays 200, its routes answer 503 with a retry hint, and the routes of the other services keep serving. `GovernanceHost/GovernanceRevisions` returns to a caller whose scope carries `factory.meta.read`, an operator or the Studio about page, three members the model names: the active policy revisions per scope, the approval rule revisions per scope and the head of the audit hash chain. The gateway holds no state and reads no store. The three values belong to PolicyEngineService, ApprovalPolicyService and AuditService. `Policy.GetActiveRevision` answers for one scope a caller names, and the model gives no operation that lists the active revisions per scope, none that returns the approval rule revisions and none that returns the chain head, so the source of the three members is an open point reported to the owner. Until it is decided the members are part of the reply and are read through one metadata port of the gateway that has no production binding: a deployed instance answers 200 and states each member as not reported, and invents no value; the reply with the members filled is proven against a fake metadata source of the acceptance suite only. The model lists the code 200 alone for this operation; a call without a token is answered 401 and a token without the scope 403 all the same. A call that exceeds the rate limit configured for its route is refused with 429, over gRPC RESOURCE_EXHAUSTED, through the pinned rate-limiting library, from the configuration of the gateway, and calls no fronted service; the limit values are configuration of the deployment and none is fixed here. The gateway emits `connectsoft.factory.governance.host.requests` with the dimensions service, method and status and `connectsoft.factory.governance.host.request_duration` with service and route, the latency including the fronted service, each recorded through the helper of the pinned observability library, which puts the tenant, and the project where the route names one, on the instrument by default (ADR-0019); the gateway carries the trace context to the service. The gateway belongs to the class `pilot-interactive` of model/nfr-targets.yaml with an availability of 99.9 percent as its override; the duration series is what the class is measured against once the system is deployed, and no value is claimed here. Logs, activities and metrics never contain a token, a credential, a rule, evidence or any other payload. The model names four failure modes, and the runbook of the repository holds one entry for each. The identity platform is unreachable, in its two phases. A fronted service is unavailable. A replica crashes: the readiness probe detects it, the replica restarts and, because the gateway holds no state, nothing is replayed and callers retry. The gateway as a whole is unavailable: decision calls fail and every caller fails closed, no run is accepted, no tool executes and no credential is issued, which three replicas and regional placement are there to prevent. The roles of the gateway are Observer, Operator and Platform admin. Kind: behavior. Traces: services: GovernanceHost, PolicyEngineService, ApprovalPolicyService, AuditService; apis: GovernanceHost/GovernanceHealth, GovernanceHost/GovernanceRevisions; adrs: ADR-0015, ADR-0017, ADR-0019, ADR-0028; requirements: NFR-04, NFR-10, NFR-18; scenarios: SCN-GovernanceHost-001, SCN-GovernanceHost-002. Depends on: AIFACTORY-US-928, feature:component-api-gateway-template, feature:component-observability-factory-conventions. Sources: model/services/governance/GovernanceHost.yaml, model/nfr-targets.yaml, docs/architecture/adr/0017-deployment-profiles.md, docs/planes/trust-operations/governance/services/governance-host/index.md#metrics-and-observability, docs/planes/trust-operations/governance/services/governance-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and the fronted services reachable, when `GovernanceHost/GovernanceHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the four fronted services and of the identity platform; a call for the detail without a token is answered 401 and a token without the scope 403 (SCN-GovernanceHost-001, NFR-18).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `GovernanceHost/GovernanceHealth` is probed, then tokens that were already issued are validated with the cached key, readiness stays ready so the replica stays in rotation, and from the first failed probe health answers 200 with the health degraded and a detail that names the identity platform as unreachable, while liveness keeps answering 200; given no valid key remains, because none was cached or the cached keys expired, when calls arrive, then they are refused, readiness is unready so the replica leaves rotation, `GovernanceHost/GovernanceHealth` answers 503 with a problem response that names the identity platform and no state changes (SCN-GovernanceHost-001, model/services/governance/GovernanceHost.yaml).",
        "AC3: Given one fronted service does not answer and ApprovalPolicyService is not deployed, when `GovernanceHost/GovernanceHealth` and the routes are called, then health answers 200 and reports both services as unavailable in its detail, their routes answer 503 with a retry hint that names the service, over gRPC UNAVAILABLE, the routes of the other services keep serving and the gateway invents no response (SCN-GovernanceHost-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read`, when `GovernanceHost/GovernanceRevisions` is called on an instance whose metadata port has no source, then the response is 200 with the active policy revisions, the approval rule revisions and the head of the audit hash chain each stated as not reported; given the fake metadata source of the acceptance suite bound to the port, then the reply names the revisions per scope and the chain head the source reported; a call without a token is answered 401 and a token without the scope 403, no operation of a fronted service was called and nothing is written (SCN-GovernanceHost-002, NFR-04).",
        "AC5: Given routed calls and a call above the rate limit of its route, when the metrics and logs are read, then `connectsoft.factory.governance.host.requests` counts every call by service, method and status, the call above the limit was refused with 429 and called no fronted service, `connectsoft.factory.governance.host.request_duration` holds the latency by service and route, both series carry the tenant of the call, and the project where the route names one, as the helper of the pinned observability library adds them, and no log record, activity or metric holds a token, a credential or a payload (ADR-0019, NFR-10, model/services/governance/GovernanceHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml",
        "model/nfr-targets.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#metrics-and-observability",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-456",
        "AIFACTORY-TASK-3739",
        "AIFACTORY-TASK-3740",
        "AIFACTORY-TASK-3741"
      ],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7806,
      "kind": "behavior",
      "traces": {
        "services": [
          "GovernanceHost",
          "PolicyEngineService",
          "ApprovalPolicyService",
          "AuditService"
        ],
        "apis": [
          "GovernanceHost/GovernanceHealth",
          "GovernanceHost/GovernanceRevisions"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-04",
          "NFR-10",
          "NFR-18"
        ],
        "scenarios": [
          "SCN-GovernanceHost-001",
          "SCN-GovernanceHost-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-928",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/governance/GovernanceHost.yaml",
        "model/nfr-targets.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#metrics-and-observability",
        "docs/planes/trust-operations/governance/services/governance-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-932]",
      "number": 932
    },
    {
      "id": "AIFACTORY-TASK-456",
      "type": "task",
      "parent": "AIFACTORY-US-932",
      "title": "Health, revisions and telemetry of the gateway",
      "sequence": "12.04.06.01",
      "description": "Health, revisions and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the four fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the revisions operation serves, under factory.meta.read, the active policy revisions, the approval rule revisions and the head of the audit hash chain its metadata port returns, states each as not reported when the port has no source, and calls no operation of a fronted service; the port has no production binding; every routed call records connectsoft.factory.governance.host.requests and connectsoft.factory.governance.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, with the tenant of the call and the project where the route names one (ADR-0019), and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the four fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the revisions operation serves, under factory.meta.read, the active policy revisions, the approval rule revisions and the head of the audit hash chain its metadata port returns, states each as not reported when the port has no source, and calls no operation of a fronted service; the port has no production binding; every routed call records connectsoft.factory.governance.host.requests and connectsoft.factory.governance.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, with the tenant of the call and the project where the route names one (ADR-0019), and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-456]",
      "number": 456
    },
    {
      "id": "AIFACTORY-TASK-3739",
      "type": "task",
      "parent": "AIFACTORY-US-932",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "12.04.06.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.governance.host.requests; the limit values are configuration of the deployment and none is fixed in code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.governance.host.requests; the limit values are configuration of the deployment and none is fixed in code."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7806,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3739]",
      "number": 3739
    },
    {
      "id": "AIFACTORY-TASK-3740",
      "type": "task",
      "parent": "AIFACTORY-US-932",
      "title": "Runbook of the four failure modes of the gateway",
      "sequence": "12.04.06.03",
      "description": "Runbook of the four failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/governance/GovernanceHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash, gateway unavailable) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the fronted service names ApprovalPolicyService as not deployed before I4; the entry of the replica crash states that nothing is replayed and that callers retry; the entry of the unavailable gateway states that every caller fails closed, so that no run is accepted, no tool executes and no credential is issued, and names the three replicas and the regional placement as the protection (NFR-18).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/governance/GovernanceHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash, gateway unavailable) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the fronted service names ApprovalPolicyService as not deployed before I4; the entry of the replica crash states that nothing is replayed and that callers retry; the entry of the unavailable gateway states that every caller fails closed, so that no run is accepted, no tool executes and no credential is issued, and names the three replicas and the regional placement as the protection (NFR-18)."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7806,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-3740]",
      "number": 3740
    },
    {
      "id": "AIFACTORY-TASK-3741",
      "type": "task",
      "parent": "AIFACTORY-US-932",
      "title": "Verify health, revisions, limits and telemetry through the acceptance suite",
      "sequence": "12.04.06.04",
      "description": "Verify health, revisions, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GovernanceHost-001|Scenario=SCN-GovernanceHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-932 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped and one service without an instance, the revisions operation without a metadata source, with the fake metadata source and without its scope, a call above its limit, the two series connectsoft.factory.governance.host.requests and connectsoft.factory.governance.host.request_duration with their dimensions, the tenant of the call and the project of a project-scoped route, and a scan of the captured logs and activities for token, credential and payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GovernanceHost-001|Scenario=SCN-GovernanceHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-932 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped and one service without an instance, the revisions operation without a metadata source, with the fake metadata source and without its scope, a call above its limit, the two series connectsoft.factory.governance.host.requests and connectsoft.factory.governance.host.request_duration with their dimensions, the tenant of the call and the project of a project-scoped route, and a scan of the captured logs and activities for token, credential and payload content."
      ],
      "sourceArtifacts": [
        "model/services/governance/GovernanceHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 78,
      "phase": "factory",
      "stackRank": 7806,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3741]",
      "number": 3741
    },
    {
      "id": "AIFACTORY-FEAT-063",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-012",
      "title": "ApprovalPolicyService: complete delivery",
      "sequence": "12.05",
      "description": "ApprovalPolicyService is the service of bounded context BC-20 (Approval Policy). The rules of human decisions — which roles may approve which action class in which scope, separation of duties (never the requester, never the author), quorum, expiry, break-glass conditions — and the routing evaluations that tell Run Control who may decide a given request and whether a given decision is valid; instances and decisions stay in BC-03 (BC-20, ADR-0015). Its own repository is ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService. Delivers: ApprovalPolicyService (complete). Increment I4: Trust and accountability. Build order 129 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-043",
        "AIFACTORY-US-923",
        "AIFACTORY-US-924",
        "AIFACTORY-US-925",
        "AIFACTORY-US-926",
        "AIFACTORY-US-927"
      ],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12900,
      "titlePrefix": "[AIFACTORY-FEAT-063]",
      "number": 63
    },
    {
      "id": "AIFACTORY-US-043",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-063",
      "title": "An approval reaches the reviewers the rule names, never the requester",
      "sequence": "12.05.01",
      "description": "As a reviewer, I want approvals routed by the rules of my project for the class of the action, so that the right people decide and nobody approves their own work. This is the integration PBI of the feature. Approvals are split in two by the ownership map. The instances, the votes and the decisions live in RunControlService, in the aggregate `ApprovalRequest` with its kinds approval and operator-decision. The policy of human decisions lives here, in bounded context BC-20: ApprovalPolicyService holds the rules per scope and action class (shared-write, external, production, publication, spend), which roles may approve, the separation of duties, never the requester and never the author, the quorum, the expiry, what happens on expiry and whether a Platform admin may break glass. The rules are authored in the policy bundles and in no other place: for the policy revision a request names, the service asks `Policy.Decide` of PolicyEngineService with the action kind `approval-eligibility`, takes the rule from the obligations of the decision and keeps it per revision as it was read (D126, D127, D136). The holders of a role in a project are read through `Projects.ListRoleHolders` of ProjectService, at routing for the eligible approvers and at decision time for the eligibility of the decider (D126, D136). At request time the service routes, naming the rule, the eligible approvers, the quorum and the expiry; at decision time it validates that the decider is eligible now. It decides nothing itself and stores no approval request, no vote and no decision. The service arrives in I4, and RunControlService depends on it from I4, as model/services/control-plane/RunControlService.yaml states. Until then the earlier increments work without it, as their own PBIs state and the model says: RunControlService resolves the approver rule and checks the eligibility of a decider through PolicyEngineService under the policy revision the run pinned, applies the requester exclusion itself, and every request carries the quorum one, `onExpiry` fail and `reRequestsLeft` 0 while no approval rule is supplied (D115, D127). No feature of an earlier increment depends on this one. With this feature RunControlService asks `ApprovalPolicy.Route` when it opens an approval request of kind approval and `ApprovalPolicy.ValidateDecision` before it records a decision on one, through the gateway GovernanceHost with a workload token that holds the service scope that names ApprovalPolicyService, copies the quorum, `onExpiry` and `maxReRequests` of the routed rule onto the request and keeps the evaluation id with it (AIFACTORY-TASK-545). A request is routed for every subject of the closed list of `approval-request-v1`, a run, a provisioning run, an evaluation run, an asset release and a promotion: routing and validation read the subject, the project and the requester from the request and need no run, a request of another subject is routed and validated under the same rules as a run request, and its requester is never eligible (D129, D131, D135). Only a request that keeps an evaluation id is validated here. When `ApprovalPolicy.Route` answers FAILED_PRECONDITION, because the decision of PolicyEngineService for the pinned revision carries no approval rule for the action class, RunControlService opens the request as in the earlier increments, with the approver rule of the policy decision, the quorum one, `onExpiry` fail, `reRequestsLeft` 0 and no evaluation id. For a request without an evaluation id it does not call `ApprovalPolicy.ValidateDecision`, which answers NOT_FOUND for an approval that was never routed: it checks the approver rule through PolicyEngineService and applies the requester exclusion itself, exactly as in I1, so such a request can always be decided. The quorum is held by votes (D127): RunControlService records each approve of an eligible approver as one vote in `ApprovalVotes`, one per approver and request, passes the count of the votes already recorded to `ApprovalPolicy.ValidateDecision`, keeps the request Pending until the votes reach the quorum and ends it Approved with the vote that reaches it; one reject of an eligible approver ends it Rejected, and a second vote of the same approver is answered 409; what ApprovalPolicyService replies for each count is proven in AIFACTORY-US-926. A request of kind operator-decision is not routed here. Its approver rule names the Operator of the project, the enum `ApproverRole` holds Reviewer, Workspace admin and Platform admin and no Operator, and the member who requested a run may take the operator decision of that run (D121), so RunControlService keeps applying that rule itself. The member who requested a run therefore never decides an approval of a proposal or of spend, and may take the operator decision. The publication gate of AgentRegistryService arrives in the same increment, so the author exclusion of a publication approval has its first caller with it. The repository ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService is created by the first task of this feature, by the steps of the repository checklist of feature `repository-and-pipeline-conventions`, and scaffolded once from the pinned base template package with `UseFactoryProfile` (features `component-base-template-factory-profile` and `component-base-template-findings`). The service writes its three events in the run event envelope of the pinned contracts package through the Orleans outbox of the messaging profile `approval-policy`, in the transaction of the command that causes them. The feature is delivered by five further PBIs: the rules put in force from an activated policy revision (AIFACTORY-US-923), the reads of rules and the validation of project rules (AIFACTORY-US-924), the routing of a request (AIFACTORY-US-925), the validation of a decision with break-glass (AIFACTORY-US-926) and the inbox handlers for membership, delegation and deletion orders (AIFACTORY-US-927). This PBI proves the chain with the acceptance suites of the two repositories, in which `Policy.Decide` and `Projects.ListRoleHolders` are bound to fakes: a rule is in force, an approval request that a run opens is routed to the reviewers of the rule, the requester and the author are refused, a request for which no rule exists is opened and decided by the path of the earlier increments, a request with a quorum of two is approved by the second eligible vote, and weaker project rules are refused. On a deployed installation both reads are bound to the operations the model names (D126, D136). Two points of the model are reported as corrections: the model names `approval-v1` as the descriptor of both gRPC methods, which model/descriptors.yaml does not list, and the evaluation id a routed request keeps is a field the model of `ApprovalRequest` does not list. Two further corrections are reported with the PBIs that meet them: the project of a routing evaluation (AIFACTORY-US-925) and the `cache` store of the service (AIFACTORY-US-927). A resource of another tenant is answered 404, over gRPC NOT_FOUND, and a missing scope inside the tenant 403 (ADR-0015 amendment D113). Telemetry follows ADR-0019: tenant and project on metrics by default, run on activities and log records where a request names it, and no reason text, proposal content or rule content in telemetry. Kind: behavior. Traces: services: ApprovalPolicyService, RunControlService, PolicyEngineService, ProjectService, GovernanceHost; aggregates: ApprovalPolicyService/ApprovalRule, ApprovalPolicyService/RoutingEvaluation, RunControlService/ApprovalRequest; apis: ApprovalPolicyService/ApprovalPolicy.Route, ApprovalPolicyService/ApprovalPolicy.ValidateDecision, ApprovalPolicyService/ValidateProjectApprovalRules, RunControlService/DecideApproval, PolicyEngineService/Policy.Decide, ProjectService/Projects.ListRoleHolders; events: ApprovalPolicyService/ApprovalRouted, ApprovalPolicyService/ApprovalDecisionValidated, RunControlService/ApprovalRequested; descriptors: approval-request-v1, policy-decision-request-v1; adrs: ADR-0014, ADR-0015, ADR-0019, ADR-0028; requirements: FR-06, FUX-05, NFR-04, XL-05. Relates: screens: approvals-list, approval-card, approval-policy. Depends on: AIFACTORY-US-923, AIFACTORY-US-924, AIFACTORY-US-925, AIFACTORY-US-926, AIFACTORY-US-927, feature:run-control-service, feature:policy-engine-service, feature:project-service, feature:governance-host, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/governance/ApprovalPolicyService.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/approval.schema.json, docs/planes/control/approvals.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/trust-operations/governance/services/approval-policy-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a rule in force for the class shared-write in a project and an approval request of that class that RunControlService opens for a run, when `ApprovalPolicyService/ApprovalPolicy.Route` is called, then the reply names the rule and the eligible approvers without the requester and without the author, `ApprovalPolicyService/ApprovalRouted` announces the evaluation with the outcome Eligible and the expiry, and the `RunControlService/ApprovalRequest` keeps the quorum, the `onExpiry`, the re-request limit of the rule and the evaluation id; when no member is eligible, then the outcome is NoEligibleApprover and the request stays Pending; when the reply is FAILED_PRECONDITION because no rule exists, then the request is opened with `onExpiry` fail and no evaluation id, a decision on it is checked through PolicyEngineService and the requester exclusion of RunControlService without a call to `ApprovalPolicyService/ApprovalPolicy.ValidateDecision`, and the approval of an eligible reviewer is recorded (FR-06, ADR-0014).",
        "AC2: Given the requester of the run or the author of the proposal, with whatever role, when the decision is submitted through `RunControlService/DecideApproval`, then `ApprovalPolicyService/ApprovalPolicy.ValidateDecision` answers RequesterExcluded or AuthorExcluded, `ApprovalPolicyService/ApprovalDecisionValidated` records the refused attempt, RunControlService answers 403 and the request stays Pending; given a request of kind operator-decision, then the member who requested the run may decide it and ApprovalPolicyService is not asked (ADR-0015, XL-05).",
        "AC3: Given a routed rule with a quorum of two, when two eligible reviewers approve one after the other through `RunControlService/DecideApproval`, then `ApprovalPolicyService/ApprovalPolicy.ValidateDecision`, asked with the count of the votes already recorded, answers Eligible with the quorum not met for the first and met for the second, the first approve is recorded as a vote and the request stays Pending, and the second ends the `RunControlService/ApprovalRequest` Approved; a second approve of the same reviewer is answered 409 and records nothing, and a reject by one eligible reviewer ends the request Rejected (FUX-05, model/services/control-plane/RunControlService.yaml).",
        "AC4: Given project rules that are weaker than the rules of the tenant, when `ApprovalPolicyService/ValidateProjectApprovalRules` is called, then the result is not valid and names every rule that loosens; and when a policy revision that carries such rules is activated, then no `ApprovalPolicyService/ApprovalRule` of it comes into force and the rules of the previous revision stay (model/services/governance/ApprovalPolicyService.yaml).",
        "AC5: Given the repository ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService --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 tests pass with complete reports, a container image is published, and the telemetry conformance test finds the three metrics of the model with tenant and project and no reason text, proposal content or rule content in a metric, an activity or a log record (ADR-0019, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/control/approvals.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-545",
        "AIFACTORY-TASK-752",
        "AIFACTORY-TASK-457",
        "AIFACTORY-TASK-458",
        "AIFACTORY-TASK-459",
        "AIFACTORY-TASK-460",
        "AIFACTORY-TASK-461",
        "AIFACTORY-TASK-462",
        "AIFACTORY-TASK-3713"
      ],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "behavior",
      "traces": {
        "services": [
          "ApprovalPolicyService",
          "RunControlService",
          "PolicyEngineService",
          "ProjectService",
          "GovernanceHost"
        ],
        "aggregates": [
          "ApprovalPolicyService/ApprovalRule",
          "ApprovalPolicyService/RoutingEvaluation",
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "ApprovalPolicyService/ApprovalPolicy.Route",
          "ApprovalPolicyService/ApprovalPolicy.ValidateDecision",
          "ApprovalPolicyService/ValidateProjectApprovalRules",
          "RunControlService/DecideApproval",
          "PolicyEngineService/Policy.Decide",
          "ProjectService/Projects.ListRoleHolders"
        ],
        "events": [
          "ApprovalPolicyService/ApprovalRouted",
          "ApprovalPolicyService/ApprovalDecisionValidated",
          "RunControlService/ApprovalRequested"
        ],
        "descriptors": [
          "approval-request-v1",
          "policy-decision-request-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "NFR-04",
          "XL-05"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list",
          "approval-card",
          "approval-policy"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-923",
        "AIFACTORY-US-924",
        "AIFACTORY-US-925",
        "AIFACTORY-US-926",
        "AIFACTORY-US-927",
        "feature:run-control-service",
        "feature:policy-engine-service",
        "feature:project-service",
        "feature:governance-host",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/planes/control/approvals.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-043]",
      "number": 43
    },
    {
      "id": "AIFACTORY-TASK-545",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Decision validation in Run Control",
      "sequence": "12.05.01.01",
      "description": "Decision validation in Run Control. Expected output: For a request of kind approval RunControlService calls ApprovalPolicy.Route through the gateway GovernanceHost when it opens the request, for every subject of the closed list of approval-request-v1, with the subject, the project and the requester of the request, copies the rule id, the quorum, the expiry, onExpiry and maxReRequests of the reply onto the request and keeps the evaluation id with it; for a request that keeps an evaluation id it calls ApprovalPolicy.ValidateDecision before it records a decision, with the count of the votes already recorded in ApprovalVotes, records an approve of an eligible decider as one vote, ends the request Approved with the vote that reaches the quorum and keeps it Pending before, ends it Rejected on one reject of an eligible decider, records a request for changes of an eligible decider, answers a second vote of the same approver with 409 and records nothing, and answers 403 for the outcomes RequesterExcluded, AuthorExcluded and Invalid and 410 for Expired; both calls carry a workload token that holds the service scope that names ApprovalPolicyService; when the routing reply is FAILED_PRECONDITION because the decision of PolicyEngineService carries no approval rule for the action class, the request is opened as in the earlier increments, with the approver rule of the policy decision, the quorum one, onExpiry fail, reRequestsLeft 0 and no evaluation id, and a decision on a request without an evaluation id is never sent to ApprovalPolicy.ValidateDecision: RunControlService checks the approver rule through PolicyEngineService and applies the requester exclusion itself, exactly as in I1, and records the decision; a request of kind operator-decision is neither routed nor validated there; when ApprovalPolicyService or the gateway does not answer, or a call ends UNAVAILABLE, no request is opened, and for a request with an evaluation id no decision is recorded; where the evaluation id is kept on the request is a field the model of ApprovalRequest does not list and is reported with the corrections of AIFACTORY-US-043.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "For a request of kind approval RunControlService calls ApprovalPolicy.Route through the gateway GovernanceHost when it opens the request, for every subject of the closed list of approval-request-v1, with the subject, the project and the requester of the request, copies the rule id, the quorum, the expiry, onExpiry and maxReRequests of the reply onto the request and keeps the evaluation id with it; for a request that keeps an evaluation id it calls ApprovalPolicy.ValidateDecision before it records a decision, with the count of the votes already recorded in ApprovalVotes, records an approve of an eligible decider as one vote, ends the request Approved with the vote that reaches the quorum and keeps it Pending before, ends it Rejected on one reject of an eligible decider, records a request for changes of an eligible decider, answers a second vote of the same approver with 409 and records nothing, and answers 403 for the outcomes RequesterExcluded, AuthorExcluded and Invalid and 410 for Expired; both calls carry a workload token that holds the service scope that names ApprovalPolicyService; when the routing reply is FAILED_PRECONDITION because the decision of PolicyEngineService carries no approval rule for the action class, the request is opened as in the earlier increments, with the approver rule of the policy decision, the quorum one, onExpiry fail, reRequestsLeft 0 and no evaluation id, and a decision on a request without an evaluation id is never sent to ApprovalPolicy.ValidateDecision: RunControlService checks the approver rule through PolicyEngineService and applies the requester exclusion itself, exactly as in I1, and records the decision; a request of kind operator-decision is neither routed nor validated there; when ApprovalPolicyService or the gateway does not answer, or a call ends UNAVAILABLE, no request is opened, and for a request with an evaluation id no decision is recorded; where the evaluation id is kept on the request is a field the model of ApprovalRequest does not list and is reported with the corrections of AIFACTORY-US-043."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-545]",
      "number": 545
    },
    {
      "id": "AIFACTORY-TASK-752",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Verify approval-routed-by-rule by running the declared command",
      "sequence": "12.05.01.02",
      "description": "Verify approval-routed-by-rule by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` in the pipelines of ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService and ConnectSoft.AI.SoftwareFactory.RunControlService; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-043 with PolicyEngineService/Policy.Decide bound to the fake of AIFACTORY-TASK-3715 and ProjectService/Projects.ListRoleHolders to the fake of AIFACTORY-TASK-3720, and in the suite of RunControlService with a fake of the two gRPC methods: a request routed by ApprovalPolicyService/ApprovalPolicy.Route with the fields and the evaluation id copied onto RunControlService/ApprovalRequest, a request opened after FAILED_PRECONDITION without an evaluation id and decided through PolicyEngineService and the requester exclusion with no call to ApprovalPolicyService/ApprovalPolicy.ValidateDecision, the refused requester and author, the operator decision that is not routed, a request with a quorum of two kept Pending after the first vote and Approved by the second, the 409 of a second vote of the same reviewer, the reject that ends the request Rejected, the refused weaker project rules, the scaffold and the telemetry conformance test.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` in the pipelines of ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService and ConnectSoft.AI.SoftwareFactory.RunControlService; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC5 of AIFACTORY-US-043 with PolicyEngineService/Policy.Decide bound to the fake of AIFACTORY-TASK-3715 and ProjectService/Projects.ListRoleHolders to the fake of AIFACTORY-TASK-3720, and in the suite of RunControlService with a fake of the two gRPC methods: a request routed by ApprovalPolicyService/ApprovalPolicy.Route with the fields and the evaluation id copied onto RunControlService/ApprovalRequest, a request opened after FAILED_PRECONDITION without an evaluation id and decided through PolicyEngineService and the requester exclusion with no call to ApprovalPolicyService/ApprovalPolicy.ValidateDecision, the refused requester and author, the operator decision that is not routed, a request with a quorum of two kept Pending after the first vote and Approved by the second, the 409 of a second vote of the same reviewer, the reject that ends the request Rejected, the refused weaker project rules, the scaffold and the telemetry conformance test."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-752]",
      "number": 752
    },
    {
      "id": "AIFACTORY-TASK-457",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "12.05.01.03",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `approval-policy`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `approval-policy`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-457]",
      "number": 457
    },
    {
      "id": "AIFACTORY-TASK-458",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Domain model: ApprovalRule and RoutingEvaluation",
      "sequence": "12.05.01.04",
      "description": "Domain model: ApprovalRule and RoutingEvaluation. Expected output: The two aggregates carry the fields and the invariants of model/services/governance/ApprovalPolicyService.yaml: excludeRequester is always true, a project rule only tightens the tenant rule, the expiry never exceeds the platform maximum and an expired request is never revived, a decision by the requester or the author is invalid regardless of role, a break-glass decision of a Platform admin is valid only with a reason and where the rule allows it, eligibility is evaluated at decision time, and a request of any subject of the closed list is routed and validated without a run; the enums ApproverRole and RoutingOutcome are closed; a rule is kept per policy revision as it was read from the obligations of a decision of PolicyEngineService, activated and retired and never edited, and a routing evaluation is written once and never changed; the field projectId of RoutingEvaluation, the reported correction, is added once the model carries it; unit tests cover every invariant and both transitions of a rule.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two aggregates carry the fields and the invariants of model/services/governance/ApprovalPolicyService.yaml: excludeRequester is always true, a project rule only tightens the tenant rule, the expiry never exceeds the platform maximum and an expired request is never revived, a decision by the requester or the author is invalid regardless of role, a break-glass decision of a Platform admin is valid only with a reason and where the rule allows it, eligibility is evaluated at decision time, and a request of any subject of the closed list is routed and validated without a run; the enums ApproverRole and RoutingOutcome are closed; a rule is kept per policy revision as it was read from the obligations of a decision of PolicyEngineService, activated and retired and never edited, and a routing evaluation is written once and never changed; the field projectId of RoutingEvaluation, the reported correction, is added once the model carries it; unit tests cover every invariant and both transitions of a rule."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-458]",
      "number": 458
    },
    {
      "id": "AIFACTORY-TASK-459",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Persistence in approval-policy-sql: ApprovalRules and RoutingEvaluations",
      "sequence": "12.05.01.05",
      "description": "Persistence in approval-policy-sql: ApprovalRules and RoutingEvaluations. Expected output: Mappings and migrations for the two modelled tables with their tenant columns under the row filter, the defaults of the model (ExcludeRequester 1, ExcludeAuthor 1, Quorum 1, OnExpiry fail, MaxReRequests 0, BreakGlassAllowed 0, Active 1), the index IX_ApprovalRules_Scope_Class on tenant, scope, action class and active flag and the index IX_Routing_Approval; the rules of a revision are stored per revision as they were read, under the tenant of the revision; the column ProjectId of RoutingEvaluations, filled from the project metadata of ApprovalPolicy.Route, is added with its migration once the model carries it, and until then the table is mapped as modelled, without a project; no column holds a reason text or proposal content; the mapping of RoutingEvaluations allows insert and delete and no update; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the two modelled tables with their tenant columns under the row filter, the defaults of the model (ExcludeRequester 1, ExcludeAuthor 1, Quorum 1, OnExpiry fail, MaxReRequests 0, BreakGlassAllowed 0, Active 1), the index IX_ApprovalRules_Scope_Class on tenant, scope, action class and active flag and the index IX_Routing_Approval; the rules of a revision are stored per revision as they were read, under the tenant of the revision; the column ProjectId of RoutingEvaluations, filled from the project metadata of ApprovalPolicy.Route, is added with its migration once the model carries it, and until then the table is mapped as modelled, without a project; no column holds a reason text or proposal content; the mapping of RoutingEvaluations allows insert and delete and no update; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-459]",
      "number": 459
    },
    {
      "id": "AIFACTORY-TASK-460",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 3 REST and 2 gRPC operations",
      "sequence": "12.05.01.06",
      "description": "API hosting skeleton: REST and gRPC hosts, scope enforcement, problem responses and contract documents for the 3 REST and 2 gRPC operations. Expected output: The three REST routes (ListApprovalRules, ValidateProjectApprovalRules, GetApprovalRouting) and the two gRPC methods of the service ApprovalPolicy (Route, ValidateDecision) are hosted with JWT validation, the scope of each route (factory.policies.read, factory.policies.write, factory.approvals.read), problem responses for every modelled refusal code and for the 404 of a resource of another tenant, workload identity and service scope checks on the two gRPC methods, which read the tenant and the project of the call metadata only under the service scope that names ApprovalPolicyService, and the OpenAPI and proto documents; the proto fixes the request and reply messages of both methods, because the descriptor approval-v1 the model names is not listed in model/descriptors.yaml; a REST route admits no workload token; the behaviour of each operation is delivered by AIFACTORY-US-924 to AIFACTORY-US-926, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three REST routes (ListApprovalRules, ValidateProjectApprovalRules, GetApprovalRouting) and the two gRPC methods of the service ApprovalPolicy (Route, ValidateDecision) are hosted with JWT validation, the scope of each route (factory.policies.read, factory.policies.write, factory.approvals.read), problem responses for every modelled refusal code and for the 404 of a resource of another tenant, workload identity and service scope checks on the two gRPC methods, which read the tenant and the project of the call metadata only under the service scope that names ApprovalPolicyService, and the OpenAPI and proto documents; the proto fixes the request and reply messages of both methods, because the descriptor approval-v1 the model names is not listed in model/descriptors.yaml; a REST route admits no workload token; the behaviour of each operation is delivered by AIFACTORY-US-924 to AIFACTORY-US-926, not here."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-460]",
      "number": 460
    },
    {
      "id": "AIFACTORY-TASK-461",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Messaging skeleton: outbox and inbox wiring of the approval-policy profile for 3 published and 4 consumed events",
      "sequence": "12.05.01.07",
      "description": "Messaging skeleton: outbox and inbox wiring of the approval-policy profile for 3 published and 4 consumed events. Expected output: The outbox writer enlists in the transaction of the rule activation and of the commands Route and ValidateDecision, and the dispatcher of the approval-policy messaging profile publishes the three modelled events in the run event envelope of the pinned contracts package (ApprovalRuleActivated, ApprovalRouted, ApprovalDecisionValidated) on their modelled topics; the inbox registers the four consumed events of the model with idempotency on the event id (PolicyRevisionActivated, MembershipChanged, DelegationChanged and DeletionOrderIssued, whose handler is built in this increment with the order contract of RetentionResidencyService); what each handler does is delivered by AIFACTORY-US-923 and AIFACTORY-US-927.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of the rule activation and of the commands Route and ValidateDecision, and the dispatcher of the approval-policy messaging profile publishes the three modelled events in the run event envelope of the pinned contracts package (ApprovalRuleActivated, ApprovalRouted, ApprovalDecisionValidated) on their modelled topics; the inbox registers the four consumed events of the model with idempotency on the event id (PolicyRevisionActivated, MembershipChanged, DelegationChanged and DeletionOrderIssued, whose handler is built in this increment with the order contract of RetentionResidencyService); what each handler does is delivered by AIFACTORY-US-923 and AIFACTORY-US-927."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-461]",
      "number": 461
    },
    {
      "id": "AIFACTORY-TASK-462",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Security, tenancy and telemetry of ApprovalPolicyService",
      "sequence": "12.05.01.08",
      "description": "Security, tenancy and telemetry of ApprovalPolicyService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered, a resource of another tenant is answered 404 and NOT_FOUND, the secret messaging-transport comes from its secret reference, and the three metrics of the model (connectsoft.factory.approval_policy.routings, connectsoft.factory.approval_policy.invalid_decisions, connectsoft.factory.approval_policy.break_glass) are recorded through the helper of the pinned observability packages with their modelled dimensions and with tenant and project; activities and log records carry the run where a request names it, and a conformance test fails when a reason text, proposal content or rule content reaches a metric, an activity or a log record (ADR-0019).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered, a resource of another tenant is answered 404 and NOT_FOUND, the secret messaging-transport comes from its secret reference, and the three metrics of the model (connectsoft.factory.approval_policy.routings, connectsoft.factory.approval_policy.invalid_decisions, connectsoft.factory.approval_policy.break_glass) are recorded through the helper of the pinned observability packages with their modelled dimensions and with tenant and project; activities and log records carry the run where a request names it, and a conformance test fails when a reason text, proposal content or rule content reaches a metric, an activity or a log record (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-462]",
      "number": 462
    },
    {
      "id": "AIFACTORY-TASK-3713",
      "type": "task",
      "parent": "AIFACTORY-US-043",
      "title": "Deployment values of the service: replica range, options, probes and the addresses of its dependencies",
      "sequence": "12.05.01.09",
      "description": "Deployment values of the service: replica range, options, probes and the addresses of its dependencies. Expected output: The deployment manifest of the service states the replica range 3 to 10 of model/services/governance/ApprovalPolicyService.yaml, the liveness and readiness probes, the options Governance:Approvals:MaxExpiryMinutes and Governance:Approvals:BreakGlassRequiresReason at the defaults of the model, OrleansMessaging:ServiceName approval-policy, the addresses of PolicyEngineService and ProjectService, the authority of the identity platform and the store bindings approval-policy-sql and cache from configuration, the second being the shared cache of the eligibility cache, which the stores of the model do not list for this service and which is reported as a correction of the service file; readiness reports the store, PolicyEngineService, ProjectService and the identity platform; health reports the cache as degraded when it does not answer, which does not turn readiness unready; the manifest holds no secret value and fixes no cache lifetime in code; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "The deployment manifest of the service states the replica range 3 to 10 of model/services/governance/ApprovalPolicyService.yaml, the liveness and readiness probes, the options Governance:Approvals:MaxExpiryMinutes and Governance:Approvals:BreakGlassRequiresReason at the defaults of the model, OrleansMessaging:ServiceName approval-policy, the addresses of PolicyEngineService and ProjectService, the authority of the identity platform and the store bindings approval-policy-sql and cache from configuration, the second being the shared cache of the eligibility cache, which the stores of the model do not list for this service and which is reported as a correction of the service file; readiness reports the store, PolicyEngineService, ProjectService and the identity platform; health reports the cache as degraded when it does not answer, which does not turn readiness unready; the manifest holds no secret value and fixes no cache lifetime in code; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12901,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-3713]",
      "number": 3713
    },
    {
      "id": "AIFACTORY-US-923",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-063",
      "title": "Put the approval rules of an activated policy revision in force and announce each rule",
      "sequence": "12.05.02",
      "description": "As a platform admin, I want the approval rules of a policy revision to come into force as one validated set when the revision is activated, so that the rules that route and validate approvals always belong to an exact policy revision and never loosen the rules above them. Approval rules are part of a policy bundle revision and are authored in the policy bundles and in no other place (D126, D127, D136). When PolicyEngineService activates a revision it publishes `PolicyRevisionActivated` with revision, tenantId, scope, scopeId and rulesHash, and the inbox handler `LoadApprovalRules` of this service puts the approval rules of that revision in force. The event carries no rule content, so the handler reads the rules through `Policy.Decide` of PolicyEngineService with the workload token of this service: for each of the five action classes, shared-write, external, production, publication and spend, it asks a decision with the action kind `approval-eligibility`, which pairs with the domain RunAcceptance, the target `approval`, the action class and the activated revision, and takes the rule from the obligations of the decision: the approver rule reference, the approver roles, `excludeAuthor`, `quorum`, `expiryMinutes`, `onExpiry`, `maxReRequests` and `breakGlassAllowed`. PolicyEngineService evaluates a revision along the chain of its bundles and refuses at activation a bundle that loosens its parent, so the rule a decision returns is the rule in force for that revision and this service follows no parent chain of its own. A decision whose obligations carry no approval rule, a deny among them, means that the revision holds no rule for that action class, and the handler writes none for it. A rule is one `ApprovalRule` for one scope, platform, tenant or a project with its id, and one action class, optionally narrowed by an action pattern to a tool, a workflow or an environment class, with the fields above, `excludeRequester` and the policy revision it belongs to. The handler validates every rule of the revision before it writes one. `excludeRequester` is always true, and obligations that state it false are refused (ADR-0015 point 6). The approver roles are values of `ApproverRole`. The quorum is at least one. `expiryMinutes` does not exceed `Governance:Approvals:MaxExpiryMinutes`. `maxReRequests` is 0 when `onExpiry` is fail (D114). A valid set is written in one transaction: the rules of the revision are inserted with `active` true, the rules of the revision that was in force for the same scope are set to `active` false, and one `ApprovalRuleActivated` outbox record per rule in force (ruleId, tenantId, scope, actionClass, policyRevision) is written with them. An invalid set is refused whole: no rule is written, the rules of the previous revision stay in force, the refusal is logged with the revision and the rule ids, and the event is acknowledged, because a set that can never become valid must not be redelivered. The handler is idempotent on the event id through the inbox and on the revision: a redelivered event and a revision already in force change nothing and publish nothing. A rule set belongs to its revision for good. An approval request names the policy revision its run pinned, and routing and validation use the rules of that revision, so a retired rule stays readable and usable for the requests that name its revision and is never deleted by a later activation. A seeded tenant bundle publishes no event (D127), so the rules of a revision this handler never saw are read by `ApprovalPolicy.Route` through the same decision and kept per revision as they were read (AIFACTORY-US-925). When PolicyEngineService does not answer, or a decision ends UNAVAILABLE, the handler fails without a write and the inbox retries with backoff, and the rules of the previous revision stay in force meanwhile. The acceptance suite binds `Policy.Decide` to a fake that answers per revision and action class. This PBI proves what the publisher of `ApprovalRuleActivated` can prove: the outbox record in the transaction of the activation, the run event envelope, the payload and a transport outage retried with backoff without loss or duplicate under the event id (ADR-0012). StudioBff refreshes its view and AuditService records the evidence in their own PBIs. Kind: behavior. Traces: services: ApprovalPolicyService, PolicyEngineService, AuditService; aggregates: ApprovalPolicyService/ApprovalRule; apis: PolicyEngineService/Policy.Decide; events: ApprovalPolicyService/ApprovalRuleActivated, PolicyEngineService/PolicyRevisionActivated; descriptors: run-event-envelope-v1, policy-decision-request-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-06, NFR-04; scenarios: SCN-ApprovalPolicyService-006. Depends on: feature:policy-engine-service, feature:contracts-package. Sources: model/services/governance/ApprovalPolicyService.yaml, model/services/governance/PolicyEngineService.yaml, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/planes/trust-operations/governance/services/approval-policy-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given `PolicyEngineService/PolicyRevisionActivated` for a tenant revision for which `PolicyEngineService/Policy.Decide`, asked with the action kind `approval-eligibility` per action class, returns approval rules in its obligations, when `LoadApprovalRules` handles it, then one active `ApprovalPolicyService/ApprovalRule` exists per rule with its roles, exclusions, quorum, expiry, on-expiry rule, re-request limit, break-glass allowance and policy revision, no rule exists for an action class whose decision carries none, the rules of the previous revision of that scope are inactive and still stored, and one `ApprovalPolicyService/ApprovalRuleActivated` outbox record per rule is written in the same transaction (SCN-ApprovalPolicyService-006, ADR-0014).",
        "AC2: Given a revision one of whose rules states `excludeRequester` false, names a role outside `ApproverRole`, has a quorum below one, an expiry above `Governance:Approvals:MaxExpiryMinutes` or re-requests with the on-expiry rule fail, when `LoadApprovalRules` handles the event, then the whole set is refused, no `ApprovalPolicyService/ApprovalRule` and no outbox record is written, the rules of the previous revision stay in force and the log names the revision and the rule ids (SCN-ApprovalPolicyService-006, ADR-0015, model/services/governance/ApprovalPolicyService.yaml).",
        "AC3: Given a redelivered event, a revision already in force and two replicas that handle the same event, when the handler runs, then nothing changes and nothing is published; given `PolicyEngineService/Policy.Decide` that does not answer or ends UNAVAILABLE, then the handler fails without a write, the inbox retries with backoff, the rules of the previous revision stay in force and, once the decision answers, the rules of the revision are in force once (SCN-ApprovalPolicyService-006).",
        "AC4: Given the outbox records of an activation and a transport that is unavailable, when the dispatcher of the `approval-policy` messaging profile runs, then each `ApprovalPolicyService/ApprovalRuleActivated` is published on `approval-policy.rules.v1.approval-rule-activated` in the run event envelope with ruleId, tenantId, scope, actionClass and policyRevision, the outage is retried with backoff, and no event is lost or published twice under its event id (SCN-ApprovalPolicyService-006, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-543",
        "AIFACTORY-TASK-3714",
        "AIFACTORY-TASK-3715",
        "AIFACTORY-TASK-3716"
      ],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12902,
      "kind": "behavior",
      "traces": {
        "services": [
          "ApprovalPolicyService",
          "PolicyEngineService",
          "AuditService"
        ],
        "aggregates": [
          "ApprovalPolicyService/ApprovalRule"
        ],
        "apis": [
          "PolicyEngineService/Policy.Decide"
        ],
        "events": [
          "ApprovalPolicyService/ApprovalRuleActivated",
          "PolicyEngineService/PolicyRevisionActivated"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "policy-decision-request-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-ApprovalPolicyService-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:policy-engine-service",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-923]",
      "number": 923
    },
    {
      "id": "AIFACTORY-TASK-543",
      "type": "task",
      "parent": "AIFACTORY-US-923",
      "title": "Rules per action class and scope",
      "sequence": "12.05.02.01",
      "description": "Rules per action class and scope. Expected output: One rule validator and one tightening comparer of the repository check a set of approval rules: each rule names an action class of the five, approver roles of ApproverRole, excludeRequester true, a quorum of at least one, an expiry within Governance:Approvals:MaxExpiryMinutes and maxReRequests 0 with onExpiry fail, and a narrower scope only tightens a wider one (no role added, no exclusion dropped, no lower quorum, no longer expiry, no more re-requests, no break-glass the wider rule forbids); the result lists every offending rule with the member that offends; LoadApprovalRules and ValidateProjectApprovalRules use the same validator, so one rule gets one verdict, and ValidateProjectApprovalRules uses the comparer against the tenant rules in force.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "One rule validator and one tightening comparer of the repository check a set of approval rules: each rule names an action class of the five, approver roles of ApproverRole, excludeRequester true, a quorum of at least one, an expiry within Governance:Approvals:MaxExpiryMinutes and maxReRequests 0 with onExpiry fail, and a narrower scope only tightens a wider one (no role added, no exclusion dropped, no lower quorum, no longer expiry, no more re-requests, no break-glass the wider rule forbids); the result lists every offending rule with the member that offends; LoadApprovalRules and ValidateProjectApprovalRules use the same validator, so one rule gets one verdict, and ValidateProjectApprovalRules uses the comparer against the tenant rules in force."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-543]",
      "number": 543
    },
    {
      "id": "AIFACTORY-TASK-3714",
      "type": "task",
      "parent": "AIFACTORY-US-923",
      "title": "LoadApprovalRules handler that reads the rules of a revision through Policy.Decide and activates the rule set",
      "sequence": "12.05.02.02",
      "description": "LoadApprovalRules handler that reads the rules of a revision through Policy.Decide and activates the rule set. Expected output: The inbox handler of PolicyRevisionActivated reads the approval rules of the revision through a typed client of PolicyEngineService/Policy.Decide, one decision per action class with the action kind approval-eligibility, the target approval and the activated revision, takes each rule from the obligations of its decision and writes none for a class whose decision carries none, validates the set with the validator of AIFACTORY-TASK-543, and in one transaction inserts the rules as active, sets the rules of the previous revision of the scope inactive without deleting them and writes one ApprovalRuleActivated outbox record per rule; an invalid set is refused whole, logged and acknowledged; a redelivered event and a revision already in force change nothing; a decision that does not answer or ends UNAVAILABLE fails the handler without a write so that the inbox retries.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "The inbox handler of PolicyRevisionActivated reads the approval rules of the revision through a typed client of PolicyEngineService/Policy.Decide, one decision per action class with the action kind approval-eligibility, the target approval and the activated revision, takes each rule from the obligations of its decision and writes none for a class whose decision carries none, validates the set with the validator of AIFACTORY-TASK-543, and in one transaction inserts the rules as active, sets the rules of the previous revision of the scope inactive without deleting them and writes one ApprovalRuleActivated outbox record per rule; an invalid set is refused whole, logged and acknowledged; a redelivered event and a revision already in force change nothing; a decision that does not answer or ends UNAVAILABLE fails the handler without a write so that the inbox retries."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3714]",
      "number": 3714
    },
    {
      "id": "AIFACTORY-TASK-3715",
      "type": "task",
      "parent": "AIFACTORY-US-923",
      "title": "Fake of Policy.Decide, publisher of PolicyRevisionActivated and the invalid rule sets of the acceptance suite",
      "sequence": "12.05.02.03",
      "description": "Fake of Policy.Decide, publisher of PolicyRevisionActivated and the invalid rule sets of the acceptance suite. Expected output: The acceptance suite holds a fake of PolicyEngineService/Policy.Decide that answers a decision with the action kind approval-eligibility per revision and action class with an approval rule in its obligations or with none, can be made to fail and counts its calls, a publisher that builds PolicyRevisionActivated in the run event envelope from the pinned contracts package, valid rule sets of the platform, of two tenants and of two projects, a revision whose decisions carry a rule for some action classes only, and one invalid set per refusal of AIFACTORY-US-923 (requester exclusion off, unknown role, quorum of zero, expiry above the maximum, re-requests with fail), and project candidate sets with one per kind of loosening for AIFACTORY-US-924.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of PolicyEngineService/Policy.Decide that answers a decision with the action kind approval-eligibility per revision and action class with an approval rule in its obligations or with none, can be made to fail and counts its calls, a publisher that builds PolicyRevisionActivated in the run event envelope from the pinned contracts package, valid rule sets of the platform, of two tenants and of two projects, a revision whose decisions carry a rule for some action classes only, and one invalid set per refusal of AIFACTORY-US-923 (requester exclusion off, unknown role, quorum of zero, expiry above the maximum, re-requests with fail), and project candidate sets with one per kind of loosening for AIFACTORY-US-924."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3715]",
      "number": 3715
    },
    {
      "id": "AIFACTORY-TASK-3716",
      "type": "task",
      "parent": "AIFACTORY-US-923",
      "title": "Verify the activation of approval rules through the acceptance suite",
      "sequence": "12.05.02.04",
      "description": "Verify the activation of approval rules through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ApprovalPolicyService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-923 with the fixtures of AIFACTORY-TASK-3715: a rule set read through PolicyEngineService/Policy.Decide and put in force with its predecessor kept inactive, an action class without a rule, every refused set with the table and the outbox unchanged, the redelivered event, the two replicas, the decision that fails and recovers, and the publication of ApprovalPolicyService/ApprovalRuleActivated with its payload under a transport outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ApprovalPolicyService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-923 with the fixtures of AIFACTORY-TASK-3715: a rule set read through PolicyEngineService/Policy.Decide and put in force with its predecessor kept inactive, an action class without a rule, every refused set with the table and the outbox unchanged, the redelivered event, the two replicas, the decision that fails and recovers, and the publication of ApprovalPolicyService/ApprovalRuleActivated with its payload under a transport outage."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3716]",
      "number": 3716
    },
    {
      "id": "AIFACTORY-US-924",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-063",
      "title": "Read the approval rules in force and validate project rules against the tenant rules",
      "sequence": "12.05.03",
      "description": "As a workspace admin, I want to read the approval rules that apply to my project and to check the rules I plan against the rules of my tenant, so that I know who may approve what and never propose rules that will be refused as weaker. `ListApprovalRules`, GET `/factory/approval-rules`, returns the rules per scope and action class with their approver roles, exclusions, quorum, expiry, on-expiry rule, re-request limit, break-glass allowance, policy revision and active flag. It is of class read and needs `factory.policies.read`. The callers are Reviewer, Workspace admin, Platform admin and Observer, and the Studio screen `approval-policy` reads it. Every caller with the scope sees the platform rules and the tenant rules of the tenant of the token; a project rule is listed only for a caller who holds a role in that project or the tenant-wide Platform admin role. The list is paged and may be filtered by action class and by the active flag. The model names no parameter for a project on it, so the gateway forwards the call under the tenant of the token and the service filters by the role claims, and the gap is reported as a correction of the service file. `ValidateProjectApprovalRules`, POST `/factory/projects/{projectId}/approval-rules/validate`, checks candidate rules of a project against the tenant rules in force before they are published with a policy revision. It is of class sandbox and needs `factory.policies.write`. The callers are the Workspace admin of the project and the Platform admin; the gateway admits the project of the path against the roles of the token, and the service compares the path with the project roles of the forwarded token again. The check is the validator and the comparer of the activation (AIFACTORY-TASK-543). Each candidate rule is validated on its own: requester exclusion true, known roles, a quorum of at least one, an expiry within the platform maximum, and re-requests consistent with the on-expiry rule. It is then compared with the tenant rule of the same action class, the rule of the active tenant revision that the service holds or, when it holds none, as for a seeded tenant bundle, reads through `Policy.Decide` with the action kind `approval-eligibility` (D127, D136), which it may only tighten: more roles excluded, a shorter expiry, a higher quorum, break-glass disabled, and never the opposite. The response is 200 with the result: valid, or not valid with every offending rule listed with its action class, the member that loosens and the tenant value it loosens. The model lists the codes 200, 400 and 403 and does not say which of them answers weaker rules. This PBI fixes 200 with a not valid result for readable rules that loosen, and 400 for a body that cannot be read as rules, that names an unknown action class or role or that names a scope other than the project of the path; it is the same reading as for `ValidateProjectPolicy` of PolicyEngineService, and it is reported. Nothing is stored, no rule changes and no event is published, so a validated rule is not in force until a policy revision that carries it is activated (AIFACTORY-US-923). A call without a token or with an expired token is answered 401; a token without the scope of the operation, a caller without the role and a workload token 403; a Platform admin who names a project that does not exist in the tenant 404 (ADR-0015 amendment D113), a code the list of the model lacks and that is reported; and a store that does not answer 503. Rules of another tenant are never listed and never used as the parent of a validation. Both routes are public routes of the gateway GovernanceHost, which forwards the user token unchanged, and the service accepts the audience of its own gateway (ADR-0015 amendment D117). Kind: behavior. Traces: services: ApprovalPolicyService, GovernanceHost; aggregates: ApprovalPolicyService/ApprovalRule; apis: ApprovalPolicyService/ListApprovalRules, ApprovalPolicyService/ValidateProjectApprovalRules; adrs: ADR-0015; requirements: FR-06, FUX-05, NFR-04; scenarios: SCN-ApprovalPolicyService-001, SCN-ApprovalPolicyService-002. Relates: screens: approval-policy. Depends on: AIFACTORY-US-923, feature:governance-host, feature:component-base-template-factory-profile. Sources: model/services/governance/ApprovalPolicyService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/trust-operations/governance/services/approval-policy-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given rules in force for the platform, a tenant and two of its projects and a caller with `factory.policies.read` and a role in one of the projects, when `ApprovalPolicyService/ListApprovalRules` is called, then the response is 200 with the platform rules, the tenant rules and the rules of that one project, each `ApprovalPolicyService/ApprovalRule` with scope, action class, roles, exclusions, quorum, expiry, on-expiry rule, re-request limit, break-glass allowance, policy revision and active flag, paged; a Platform admin of the tenant is served the rules of every project of the tenant; nothing is written (SCN-ApprovalPolicyService-001, FUX-05).",
        "AC2: Given tenant rules in force and candidate project rules each of which tightens its tenant rule, when `ApprovalPolicyService/ValidateProjectApprovalRules` is called by the Workspace admin of the project of the path, then the response is 200 with the result valid; given candidates one of which adds an approver role, drops an exclusion, lowers the quorum, lengthens the expiry or enables break-glass against the tenant rule, then the response is 200 with the result not valid and each offending rule listed with its action class, the member and the tenant value; in both cases no rule, evaluation or outbox record is written (SCN-ApprovalPolicyService-002, model/services/governance/ApprovalPolicyService.yaml).",
        "AC3: Given a body that cannot be read as rules or that names an unknown action class, a caller who is neither Workspace admin of the project nor Platform admin, a token without the scope of the operation or a workload token, a call without a token, a Platform admin who names a project that does not exist in the tenant, and `approval-policy-sql` stopped, when either operation is called, then the answers are 400, 403, 403, 401, 404 and 503 with a problem response and no state changes (SCN-ApprovalPolicyService-001, SCN-ApprovalPolicyService-002, ADR-0015).",
        "AC4: Given rules of two tenants, when `ApprovalPolicyService/ListApprovalRules` and `ApprovalPolicyService/ValidateProjectApprovalRules` are called with a token of one tenant, then no rule of the other tenant is listed or used as the parent of the validation; and one rule sent to the validation and to the activation of AIFACTORY-US-923 gets the same verdict from the validator (SCN-ApprovalPolicyService-001, SCN-ApprovalPolicyService-002, NFR-04)."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3717",
        "AIFACTORY-TASK-3718"
      ],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12903,
      "kind": "behavior",
      "traces": {
        "services": [
          "ApprovalPolicyService",
          "GovernanceHost"
        ],
        "aggregates": [
          "ApprovalPolicyService/ApprovalRule"
        ],
        "apis": [
          "ApprovalPolicyService/ListApprovalRules",
          "ApprovalPolicyService/ValidateProjectApprovalRules"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "NFR-04"
        ],
        "scenarios": [
          "SCN-ApprovalPolicyService-001",
          "SCN-ApprovalPolicyService-002"
        ]
      },
      "relates": {
        "screens": [
          "approval-policy"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-923",
        "feature:governance-host",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-924]",
      "number": 924
    },
    {
      "id": "AIFACTORY-TASK-3717",
      "type": "task",
      "parent": "AIFACTORY-US-924",
      "title": "ListApprovalRules and ValidateProjectApprovalRules",
      "sequence": "12.05.03.01",
      "description": "ListApprovalRules and ValidateProjectApprovalRules. Expected output: ListApprovalRules returns, paged and filterable by action class and by the active flag, the platform rules, the tenant rules of the tenant of the token and the project rules of the projects in which the token holds a role, all project rules of the tenant for the Platform admin; ValidateProjectApprovalRules checks that the scope of the candidates is the project of the path and that the caller is Workspace admin of that project or Platform admin of the tenant, runs the validator and the comparer of AIFACTORY-TASK-543 against the tenant rules in force and answers 200 with valid or with not valid and every offending rule; it answers 400, 401, 403, 404 and 503 as AIFACTORY-US-924 states and stores, activates and publishes nothing; a workload token is refused with 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "ListApprovalRules returns, paged and filterable by action class and by the active flag, the platform rules, the tenant rules of the tenant of the token and the project rules of the projects in which the token holds a role, all project rules of the tenant for the Platform admin; ValidateProjectApprovalRules checks that the scope of the candidates is the project of the path and that the caller is Workspace admin of that project or Platform admin of the tenant, runs the validator and the comparer of AIFACTORY-TASK-543 against the tenant rules in force and answers 200 with valid or with not valid and every offending rule; it answers 400, 401, 403, 404 and 503 as AIFACTORY-US-924 states and stores, activates and publishes nothing; a workload token is refused with 403."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3717]",
      "number": 3717
    },
    {
      "id": "AIFACTORY-TASK-3718",
      "type": "task",
      "parent": "AIFACTORY-US-924",
      "title": "Verify the reads and the validation of approval rules through the acceptance suite",
      "sequence": "12.05.03.02",
      "description": "Verify the reads and the validation of approval rules through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ApprovalPolicyService-001|Scenario=SCN-ApprovalPolicyService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-924 with the rule sets of AIFACTORY-TASK-3715 and the token matrix of AIFACTORY-TASK-3720: the list for a member of one project and for a Platform admin, the paging and the filters, a valid set, each kind of loosening set with its listed rules, every refusal, the two-tenant case, the equal verdict of validation and activation, and the tables and the outbox unchanged after every call.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ApprovalPolicyService-001|Scenario=SCN-ApprovalPolicyService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-924 with the rule sets of AIFACTORY-TASK-3715 and the token matrix of AIFACTORY-TASK-3720: the list for a member of one project and for a Platform admin, the paging and the filters, a valid set, each kind of loosening set with its listed rules, every refusal, the two-tenant case, the equal verdict of validation and activation, and the tables and the outbox unchanged after every call."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3718]",
      "number": 3718
    },
    {
      "id": "AIFACTORY-US-925",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-063",
      "title": "Route an approval request to the approvers its rule makes eligible and show who may decide",
      "sequence": "12.05.04",
      "description": "As a reviewer, I want an approval request routed to the members the rule of its action class makes eligible, with its expiry, so that the request reaches people who may decide it, and I can see who they are and until when. When a gated action reaches its approval, RunControlService opens an approval request and asks who may decide it. `ApprovalPolicy.Route` is that question: an internal gRPC method called through the gateway GovernanceHost with a workload token that holds the service scope that names ApprovalPolicyService, with the tenant and the project in the call metadata. The request names the approval id, the subject of the closed list of `approval-request-v1` with its kind and id, a run, a provisioning run, an evaluation run, an asset release or a promotion, the run where the subject is or belongs to one, the action class, the action, the scope, the policy revision the request names, the requester and, for a publication, the author of the asset. Routing reads the subject, the project and the requester from the request and needs no run, and a request of another subject is routed under the same rules as a run request (D129, D131, D135). The model names `approval-v1` as the request and reply descriptor, which model/descriptors.yaml does not list; the proto of this feature fixes both messages and the descriptor is reported. The service takes the rule of the pinned revision and the action class. When it holds rules of that revision, put in force by `LoadApprovalRules` (AIFACTORY-US-923), it takes the rule of the action class, one whose action pattern matches before one without a pattern. For a revision it does not hold, which is the case of every seeded tenant bundle because a seeded bundle publishes no event (D127), it asks `Policy.Decide` of PolicyEngineService with the action kind `approval-eligibility`, the target `approval`, the action class and the pinned revision, takes the rule from the obligations of the decision and keeps it in `ApprovalRules` under that revision as it was read, in the transaction of the evaluation (D126, D136). PolicyEngineService evaluates the revision along the chain of its bundles, so the rule is the rule in force for the revision the request names, and the rules of a newer revision are never used, even when they are active for the tenant now. It then resolves the eligible approvers through `Projects.ListRoleHolders` of ProjectService, which lists the members of the project who hold one of the approver roles of the rule, directly or by a delegation in force (D126, D136), without the requester, because `excludeRequester` is always set, and without the author when `excludeAuthor` is set. A Platform admin is not listed as an approver; the role decides only as break-glass (AIFACTORY-US-926). The expiry is `expiryMinutes` of the rule from now and never beyond `Governance:Approvals:MaxExpiryMinutes`. The service writes one `RoutingEvaluation` with evaluation id, tenant, approval id, the run where the request names one, rule id, action class, requester, author, the eligible approvers, the outcome, `expiresAt` and `evaluatedAt`, and the `ApprovalRouted` outbox record (evaluationId, approvalId, tenantId, outcome, expiresAt) in one transaction, and replies with the rule id, the eligible approvers, the quorum, the expiry, `onExpiry` and `maxReRequests`, which RunControlService copies onto its request. The evaluation also needs the project of the approval, which the call metadata carry and the aggregate of the model does not hold: `RoutingEvaluation` and its table have no project, and a tenant rule may route an approval of any project, so neither the project check of the read below nor the project-scoped delete of AIFACTORY-US-927 can be met from the modelled table. This feature reports a field `projectId` with its column `ProjectId` as a correction of the model, filled from the project metadata of `ApprovalPolicy.Route`; the domain and persistence tasks add it once the model carries it, and the two criteria that rest on it are worded against that column and are accepted with it. The outcome is Eligible when at least as many approvers are eligible as the quorum needs. When fewer are, the outcome is NoEligibleApprover: the evaluation and the event are written all the same, the reply says so, and the request stays Pending in RunControlService. StudioNotificationService, which consumes `ApprovalRouted`, raises the task for the Workspace admin to grant a Reviewer, and the expiry of the request fails the run, as the failure mode of the model states. A repeat of the call for the same approval id returns the evaluation already written and writes and publishes nothing, so a caller that retries after a lost reply receives one routing; a new routing of the same approval is written only when the request asks for a re-route (AIFACTORY-US-927). When the decision of PolicyEngineService carries no approval rule for the action class, a deny among them, the reply is FAILED_PRECONDITION and nothing is written. A pinned revision the tenant of the call does not hold is answered the same, so the answer never confirms a foreign revision, and the method, which addresses no stored resource by id, has no NOT_FOUND answer. RunControlService then opens the request as in the earlier increments, with the approver rule of the policy decision, the quorum one, `onExpiry` fail and no evaluation id, which is what the model states for a request without a supplied rule, and decides it without `ApprovalPolicy.ValidateDecision` (AIFACTORY-US-043). A call without a workload identity is refused with UNAUTHENTICATED; a token without the service scope, and a user token, with PERMISSION_DENIED; and a request without an approval id, a subject, a requester or an action class, with a subject kind outside the closed list or with an action class outside the five, with INVALID_ARGUMENT. PolicyEngineService and ProjectService are required dependencies that fail fast: when either does not answer the call ends UNAVAILABLE, nothing is written and RunControlService does not open the request. The same holds when `approval-policy-sql` does not answer or the transaction of the evaluation fails: the call ends UNAVAILABLE, no evaluation, no kept rule and no event exist and RunControlService opens no request. The service retries nothing on its own. `GetApprovalRouting`, GET `/factory/approvals/{approvalId}/routing`, shows a person who may decide a request: the latest routing evaluation of the approval with the rule applied, the eligible approvers, the quorum, the expiry and the outcome. It is of class read and needs `factory.approvals.read`; the Studio screens `approval-card` and `approval-policy` read it. A caller without a role in the project the evaluation holds in `ProjectId`, the column of the reported correction, is refused with 403, and an approval id for which the tenant of the token holds no evaluation is answered 404, whether it belongs to another tenant or was never routed (ADR-0015 amendment D113); an approval opened after FAILED_PRECONDITION has no evaluation and is answered 404 here, and its approver rule is read from the request in RunControlService. When `approval-policy-sql` does not answer the response is 503. `connectsoft.factory.approval_policy.routings` counts every routing by tenant, action class and outcome. This PBI proves what the publisher of `ApprovalRouted` can prove; consumer handling is proven by the suites of StudioNotificationService and AuditService. Kind: behavior. Traces: services: ApprovalPolicyService, RunControlService, PolicyEngineService, ProjectService, StudioNotificationService, GovernanceHost; aggregates: ApprovalPolicyService/RoutingEvaluation, ApprovalPolicyService/ApprovalRule; apis: ApprovalPolicyService/ApprovalPolicy.Route, ApprovalPolicyService/GetApprovalRouting, PolicyEngineService/Policy.Decide, ProjectService/Projects.ListRoleHolders; events: ApprovalPolicyService/ApprovalRouted; descriptors: run-event-envelope-v1, approval-request-v1, policy-decision-request-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-06, FUX-05, XL-05; scenarios: SCN-ApprovalPolicyService-003, SCN-ApprovalPolicyService-004, SCN-ApprovalPolicyService-007. Relates: screens: approval-card, approval-policy. Depends on: AIFACTORY-US-923, feature:policy-engine-service, feature:project-service, feature:run-control-service, feature:governance-host, feature:contracts-package. Sources: model/services/governance/ApprovalPolicyService.yaml, model/services/governance/PolicyEngineService.yaml, model/services/control-plane/ProjectService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/approvals.md, docs/planes/trust-operations/governance/services/approval-policy-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a pinned tenant revision that the service does not hold and for which `PolicyEngineService/Policy.Decide`, asked with the action kind `approval-eligibility`, returns a rule for the class shared-write in its obligations, and a workload token that holds the service scope that names ApprovalPolicyService, when `ApprovalPolicyService/ApprovalPolicy.Route` is called for an approval of the class shared-write in a project of that tenant, then the rule of the decision is applied and kept as an `ApprovalPolicyService/ApprovalRule` of that revision, a second routing under the same revision uses the kept rule without a new decision, a rule of a newer revision is not used, the reply names the rule id, the eligible approvers, the quorum, the expiry, `onExpiry` and `maxReRequests`, one `ApprovalPolicyService/RoutingEvaluation` with the outcome Eligible is written, and the `ApprovalPolicyService/ApprovalRouted` outbox record with evaluationId, approvalId, tenantId, outcome and expiresAt is written in the same transaction (SCN-ApprovalPolicyService-004, SCN-ApprovalPolicyService-007, ADR-0014).",
        "AC2: Given a rule with the approver roles Reviewer and Workspace admin, a requester who holds Reviewer, an author who holds Workspace admin and a member who holds Reviewer by a delegation in force, as `ProjectService/Projects.ListRoleHolders` lists them, when `ApprovalPolicyService/ApprovalPolicy.Route` is called for a publication, then the eligible approvers hold the delegate and neither the requester nor the author nor a Platform admin, and the expiry is `expiryMinutes` of the rule from now and never beyond `Governance:Approvals:MaxExpiryMinutes`; given a request whose subject is a provisioning run and that names no run, then it is routed under the same rule and its requester is excluded (SCN-ApprovalPolicyService-004, ADR-0015).",
        "AC3: Given a project in which fewer members are eligible than the quorum needs, when `ApprovalPolicyService/ApprovalPolicy.Route` is called, then the evaluation and `ApprovalPolicyService/ApprovalRouted` are written with the outcome NoEligibleApprover and the reply says so; given the same call repeated for the same approval id, then the first evaluation is returned and nothing is written or published; `connectsoft.factory.approval_policy.routings` counts each routing once by tenant, action class and outcome (SCN-ApprovalPolicyService-004, SCN-ApprovalPolicyService-007, model/services/governance/ApprovalPolicyService.yaml).",
        "AC4: Given a call without a workload identity, a token without the service scope or a user token, a request without a requester, with a subject kind outside the closed list or with an action class outside the five, a decision of `PolicyEngineService/Policy.Decide` that carries no approval rule for the action class or a pinned revision the tenant of the call does not hold, and PolicyEngineService stopped, ProjectService stopped, or `approval-policy-sql` stopped or its transaction failing, when `ApprovalPolicyService/ApprovalPolicy.Route` is called, then the answers are UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, FAILED_PRECONDITION and UNAVAILABLE, no evaluation, no kept rule and no event exist, the service retried nothing, and RunControlService opens no request except after FAILED_PRECONDITION (SCN-ApprovalPolicyService-004, ADR-0015).",
        "AC5: Given a routed approval whose evaluation holds the project of the routing call in `ProjectId`, the column this feature reports as a correction of model/services/governance/ApprovalPolicyService.yaml, and a caller with `factory.approvals.read` and a role in that project, when `ApprovalPolicyService/GetApprovalRouting` is called, then the response is 200 with the latest routing of the approval, the rule applied, the eligible approvers, the quorum, the expiry and the outcome; a call without a token is answered 401, a token without the scope or a caller without a role in the project of that column 403, and an approval id without an evaluation in the tenant of the token, which includes an approval of another tenant, 404; and under a transport outage the dispatcher publishes `ApprovalPolicyService/ApprovalRouted` on `approval-policy.routing.v1.approval-routed` with retry and without loss or duplicate (SCN-ApprovalPolicyService-003, SCN-ApprovalPolicyService-007, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/approvals.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-544",
        "AIFACTORY-TASK-3719",
        "AIFACTORY-TASK-3720",
        "AIFACTORY-TASK-3721"
      ],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12904,
      "kind": "behavior",
      "traces": {
        "services": [
          "ApprovalPolicyService",
          "RunControlService",
          "PolicyEngineService",
          "ProjectService",
          "StudioNotificationService",
          "GovernanceHost"
        ],
        "aggregates": [
          "ApprovalPolicyService/RoutingEvaluation",
          "ApprovalPolicyService/ApprovalRule"
        ],
        "apis": [
          "ApprovalPolicyService/ApprovalPolicy.Route",
          "ApprovalPolicyService/GetApprovalRouting",
          "PolicyEngineService/Policy.Decide",
          "ProjectService/Projects.ListRoleHolders"
        ],
        "events": [
          "ApprovalPolicyService/ApprovalRouted"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "approval-request-v1",
          "policy-decision-request-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "XL-05"
        ],
        "scenarios": [
          "SCN-ApprovalPolicyService-003",
          "SCN-ApprovalPolicyService-004",
          "SCN-ApprovalPolicyService-007"
        ]
      },
      "relates": {
        "screens": [
          "approval-card",
          "approval-policy"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-923",
        "feature:policy-engine-service",
        "feature:project-service",
        "feature:run-control-service",
        "feature:governance-host",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/approvals.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-925]",
      "number": 925
    },
    {
      "id": "AIFACTORY-TASK-544",
      "type": "task",
      "parent": "AIFACTORY-US-925",
      "title": "Routing evaluation on each request",
      "sequence": "12.05.04.01",
      "description": "Routing evaluation on each request. Expected output: ApprovalPolicy.Route takes the rule of the pinned revision and the action class from ApprovalRules, with a matching action pattern first, and for a revision the service does not hold asks PolicyEngineService/Policy.Decide through a typed client with the action kind approval-eligibility, the target approval, the action class and the pinned revision, takes the rule from the obligations of the decision and keeps it in ApprovalRules under that revision in the transaction of the evaluation; it never uses a rule of another revision; it answers FAILED_PRECONDITION and writes nothing when the decision carries no approval rule for the action class or the pinned revision is not held by the tenant of the call; with a rule found it resolves the eligible approvers through a typed client of ProjectService/Projects.ListRoleHolders without the requester, without the author where the rule excludes the author and without a Platform admin, for every subject of the closed list of approval-request-v1 and without a run, sets the expiry within Governance:Approvals:MaxExpiryMinutes, writes the RoutingEvaluation, with the project of the call metadata once the model carries the column ProjectId, and the ApprovalRouted outbox record in one transaction and replies with evaluation id, rule id, approvers, quorum, expiry, onExpiry and maxReRequests, so that Run Control stores the evaluation id with its request; the outcome is Eligible or NoEligibleApprover; a repeat for the same approval id returns the first evaluation; it ends UNAVAILABLE, with nothing written and no event, when PolicyEngineService or ProjectService does not answer and when approval-policy-sql does not answer or the transaction fails; the refusals UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT write nothing, and the method has no NOT_FOUND answer; the metric routings is recorded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "ApprovalPolicy.Route takes the rule of the pinned revision and the action class from ApprovalRules, with a matching action pattern first, and for a revision the service does not hold asks PolicyEngineService/Policy.Decide through a typed client with the action kind approval-eligibility, the target approval, the action class and the pinned revision, takes the rule from the obligations of the decision and keeps it in ApprovalRules under that revision in the transaction of the evaluation; it never uses a rule of another revision; it answers FAILED_PRECONDITION and writes nothing when the decision carries no approval rule for the action class or the pinned revision is not held by the tenant of the call; with a rule found it resolves the eligible approvers through a typed client of ProjectService/Projects.ListRoleHolders without the requester, without the author where the rule excludes the author and without a Platform admin, for every subject of the closed list of approval-request-v1 and without a run, sets the expiry within Governance:Approvals:MaxExpiryMinutes, writes the RoutingEvaluation, with the project of the call metadata once the model carries the column ProjectId, and the ApprovalRouted outbox record in one transaction and replies with evaluation id, rule id, approvers, quorum, expiry, onExpiry and maxReRequests, so that Run Control stores the evaluation id with its request; the outcome is Eligible or NoEligibleApprover; a repeat for the same approval id returns the first evaluation; it ends UNAVAILABLE, with nothing written and no event, when PolicyEngineService or ProjectService does not answer and when approval-policy-sql does not answer or the transaction fails; the refusals UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT write nothing, and the method has no NOT_FOUND answer; the metric routings is recorded."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-544]",
      "number": 544
    },
    {
      "id": "AIFACTORY-TASK-3719",
      "type": "task",
      "parent": "AIFACTORY-US-925",
      "title": "GetApprovalRouting read of the latest routing of an approval",
      "sequence": "12.05.04.02",
      "description": "GetApprovalRouting read of the latest routing of an approval. Expected output: GetApprovalRouting returns the latest routing evaluation of an approval id under the tenant filter with the rule applied, the eligible approvers, the quorum, the expiry and the outcome; it answers 403 for a caller without a role in the project the evaluation holds in the column ProjectId of the reported correction, a check that is built with that column once the model carries it and cannot be made from the modelled table, 404 for an approval id without an evaluation in the tenant of the token, 401, 403 for a token without factory.approvals.read and for a workload token, and 503 while the store does not answer; it writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "GetApprovalRouting returns the latest routing evaluation of an approval id under the tenant filter with the rule applied, the eligible approvers, the quorum, the expiry and the outcome; it answers 403 for a caller without a role in the project the evaluation holds in the column ProjectId of the reported correction, a check that is built with that column once the model carries it and cannot be made from the modelled table, 404 for an approval id without an evaluation in the tenant of the token, 401, 403 for a token without factory.approvals.read and for a workload token, and 503 while the store does not answer; it writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3719]",
      "number": 3719
    },
    {
      "id": "AIFACTORY-TASK-3720",
      "type": "task",
      "parent": "AIFACTORY-US-925",
      "title": "Fakes of Projects.ListRoleHolders and of the identity platform, and the token matrix of the acceptance suite",
      "sequence": "12.05.04.03",
      "description": "Fakes of Projects.ListRoleHolders and of the identity platform, and the token matrix of the acceptance suite. Expected output: The acceptance suite holds a fake of ProjectService/Projects.ListRoleHolders that lists the holders of a role in a project, by membership and by a delegation in force, can change them between two calls and can be stopped, a fake of the identity platform that confirms or denies the Platform admin role and can be stopped, a switch that fails the transaction of approval-policy-sql, requests of every subject kind of the closed list of approval-request-v1, with and without a run, and tokens for the matrix: no token, a workload token with and without the service scope that names ApprovalPolicyService, and user tokens of each role, of two tenants and with a role in one project and none in another.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of ProjectService/Projects.ListRoleHolders that lists the holders of a role in a project, by membership and by a delegation in force, can change them between two calls and can be stopped, a fake of the identity platform that confirms or denies the Platform admin role and can be stopped, a switch that fails the transaction of approval-policy-sql, requests of every subject kind of the closed list of approval-request-v1, with and without a run, and tokens for the matrix: no token, a workload token with and without the service scope that names ApprovalPolicyService, and user tokens of each role, of two tenants and with a role in one project and none in another."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12904,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3720]",
      "number": 3720
    },
    {
      "id": "AIFACTORY-TASK-3721",
      "type": "task",
      "parent": "AIFACTORY-US-925",
      "title": "Verify the routing of an approval request through the acceptance suite",
      "sequence": "12.05.04.04",
      "description": "Verify the routing of an approval request through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ApprovalPolicyService-003|Scenario=SCN-ApprovalPolicyService-004|Scenario=SCN-ApprovalPolicyService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-925 with the fixtures of AIFACTORY-TASK-3715 and AIFACTORY-TASK-3720: a routing under a rule read through PolicyEngineService/Policy.Decide and kept for its revision, a second routing that uses the kept rule, a rule of a newer revision that is not used, a request of a provisioning run without a run, the excluded requester and author, the delegate, the capped expiry, the outcome NoEligibleApprover, the repeated call, FAILED_PRECONDITION for a decision without a rule and for a revision of another tenant, UNAVAILABLE for PolicyEngineService stopped, for ProjectService stopped and for the failed transaction of approval-policy-sql, every refusal with the table and the outbox unchanged, the read of the latest routing with its refusals, the project check of which runs against the column ProjectId, and the publication of ApprovalPolicyService/ApprovalRouted under a transport outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ApprovalPolicyService-003|Scenario=SCN-ApprovalPolicyService-004|Scenario=SCN-ApprovalPolicyService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-925 with the fixtures of AIFACTORY-TASK-3715 and AIFACTORY-TASK-3720: a routing under a rule read through PolicyEngineService/Policy.Decide and kept for its revision, a second routing that uses the kept rule, a rule of a newer revision that is not used, a request of a provisioning run without a run, the excluded requester and author, the delegate, the capped expiry, the outcome NoEligibleApprover, the repeated call, FAILED_PRECONDITION for a decision without a rule and for a revision of another tenant, UNAVAILABLE for PolicyEngineService stopped, for ProjectService stopped and for the failed transaction of approval-policy-sql, every refusal with the table and the outbox unchanged, the read of the latest routing with its refusals, the project check of which runs against the column ProjectId, and the publication of ApprovalPolicyService/ApprovalRouted under a transport outage."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3721]",
      "number": 3721
    },
    {
      "id": "AIFACTORY-US-926",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-063",
      "title": "Validate that a decider is eligible now, is neither requester nor author, decides in time and meets the quorum",
      "sequence": "12.05.05",
      "description": "As a reviewer, I want my decision accepted only when I am eligible at the moment I decide, and the decision of a requester, an author or a member whose role was revoked refused, so that nobody approves their own work and an approval always rests on a role that still holds. A decision on an approval request is recorded by RunControlService, and before it records one it asks whether the decider may decide. `ApprovalPolicy.ValidateDecision` is that question: an internal gRPC method called through the gateway GovernanceHost with a workload token that holds the service scope that names ApprovalPolicyService. The request names the approval id, the decider, the decision (approve, reject or request changes), whether it is a break-glass decision and whether it carries a reason, and the count of valid approvals the request already holds. The service reads the routing evaluation of the approval and its rule and checks in a fixed order. The decider is not the requester of the run: a decision by the requester is invalid with the outcome RequesterExcluded, whatever role the decider holds (ADR-0015 point 6). The decider is not the author where the rule excludes the author: AuthorExcluded. The request is not past `expiresAt` of its routing: Expired, and an expired request is never revived. The decider holds one of the approver roles of the rule in the project now: eligibility is evaluated against the memberships and delegations at decision time, read through `Projects.ListRoleHolders` of ProjectService (D126, D136), and not against the list of routing time, so a role or a delegation revoked since the routing makes the decision Invalid, and a member granted the role since then is eligible. For an eligible decider the outcome is Eligible, and the reply states whether the quorum of the rule is met with this approval; RunControlService keeps the request Pending until it is. A reject or a request for changes by one eligible decider is valid without a quorum. A Platform admin decides only as break-glass. The decision is valid only when the rule sets `breakGlassAllowed`, the Platform admin role is confirmed by the claims and groups of the identity platform and, with `Governance:Approvals:BreakGlassRequiresReason` at its default, the request carries a reason; it is then Eligible with `breakGlass` true whatever the quorum, and otherwise Invalid. A break-glass decision by the requester of the run stays RequesterExcluded. Every validation, valid or not, writes one `RoutingEvaluation` of the decision with the decider, the outcome, `breakGlass` and `evaluatedAt`, and the `ApprovalDecisionValidated` outbox record (evaluationId, approvalId, tenantId, deciderId, outcome, breakGlass) in one transaction. Every attempt to decide, the refused ones included, therefore reaches AuditService as evidence through its handler, and a break-glass decision is always audited. The reason of a break-glass decision is kept by RunControlService with the decision; the evaluation holds no free text. `connectsoft.factory.approval_policy.invalid_decisions` counts the refused validations by tenant and outcome and `connectsoft.factory.approval_policy.break_glass` the break-glass decisions by tenant. A repeat of the call for the same approval, decider and decision returns the evaluation already written and writes nothing. The service validates and records its evaluation; it does not record the decision, change the request or advance the run, which stay in RunControlService. A request of kind operator-decision is not validated here, and neither is a request that keeps no evaluation id because it was opened after `ApprovalPolicy.Route` answered FAILED_PRECONDITION: RunControlService decides such a request through PolicyEngineService and its own requester exclusion, exactly as in I1, so a request without a routing can always be decided (AIFACTORY-US-043). The count of valid approvals is the count of the votes RunControlService recorded on the request in `ApprovalVotes`, one per eligible approver, and RunControlService ends the request Approved with the vote that meets the quorum (D127). Validation reads the subject, the project and the requester from the request and needs no run, so a request of any subject of the closed list of `approval-request-v1` is validated under the same rules (D129, D131, D135). A call without a workload identity is refused with UNAUTHENTICATED; a token without the service scope, and a user token, with PERMISSION_DENIED; a request without an approval id, a decider or a decision with INVALID_ARGUMENT; and an approval that was never routed in the tenant of the call, which includes an approval of another tenant, with NOT_FOUND. ProjectService and the identity platform are required dependencies that fail fast: when ProjectService does not answer, or the identity platform does not answer for a break-glass decision, the call ends UNAVAILABLE, no evaluation is written and RunControlService records no decision, so a decision is never accepted on an eligibility that could not be checked. The same holds when `approval-policy-sql` does not answer or the transaction of the evaluation fails: the call ends UNAVAILABLE, no evaluation and no event exist and RunControlService records no decision. The service retries nothing on its own. This PBI proves what the publisher of `ApprovalDecisionValidated` can prove; consumer handling is proven by the suite of AuditService. Kind: behavior. Traces: services: ApprovalPolicyService, RunControlService, ProjectService, AuditService, GovernanceHost; aggregates: ApprovalPolicyService/RoutingEvaluation, ApprovalPolicyService/ApprovalRule; apis: ApprovalPolicyService/ApprovalPolicy.ValidateDecision, ProjectService/Projects.ListRoleHolders; events: ApprovalPolicyService/ApprovalDecisionValidated; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-06, FUX-05, NFR-04, XL-05; scenarios: SCN-ApprovalPolicyService-005, SCN-ApprovalPolicyService-008. Relates: screens: approval-card. Depends on: AIFACTORY-US-923, AIFACTORY-US-925, feature:project-service, feature:run-control-service, feature:governance-host, feature:contracts-package. Sources: model/services/governance/ApprovalPolicyService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/control/approvals.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/trust-operations/governance/services/approval-policy-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a routed approval and a decider who holds an approver role of its rule in the project now, when `ApprovalPolicyService/ApprovalPolicy.ValidateDecision` is called with a workload token that holds the service scope, then the outcome is Eligible, one `ApprovalPolicyService/RoutingEvaluation` of the decision is written with the decider and `evaluatedAt`, and the `ApprovalPolicyService/ApprovalDecisionValidated` outbox record with evaluationId, approvalId, tenantId, deciderId, outcome and breakGlass is written in the same transaction (SCN-ApprovalPolicyService-005, SCN-ApprovalPolicyService-008, ADR-0014).",
        "AC2: Given the requester of the run, the author under a rule that excludes the author, a request past the `expiresAt` of its routing, and a member whose role or delegation was revoked after the routing, when `ApprovalPolicyService/ApprovalPolicy.ValidateDecision` is called for each, then the outcomes are RequesterExcluded, AuthorExcluded, Expired and Invalid, each is written as an evaluation with its `ApprovalPolicyService/ApprovalDecisionValidated` record, and `connectsoft.factory.approval_policy.invalid_decisions` counts each by tenant and outcome; a member granted the role after the routing is Eligible (SCN-ApprovalPolicyService-005, SCN-ApprovalPolicyService-008, ADR-0015).",
        "AC3: Given a rule with a quorum of two, when `ApprovalPolicyService/ApprovalPolicy.ValidateDecision` is called for an approve by an eligible decider while the request holds no valid approval, then the reply is Eligible with the quorum not met, and with one valid approval of another decider it is Eligible with the quorum met; a reject by one eligible decider is valid without a quorum; a repeat for the same approval, decider and decision returns the first evaluation and writes nothing (SCN-ApprovalPolicyService-005, FR-06).",
        "AC4: Given a rule that allows break-glass and a decider whose Platform admin role the identity platform confirms, when `ApprovalPolicyService/ApprovalPolicy.ValidateDecision` is called for a break-glass decision that carries a reason, then the outcome is Eligible with `breakGlass` true whatever the quorum, the `ApprovalPolicyService/ApprovalDecisionValidated` record carries `breakGlass` true and `connectsoft.factory.approval_policy.break_glass` is incremented; without a reason, under a rule that forbids break-glass or for a role the identity platform does not confirm the outcome is Invalid, and for the requester of the run it is RequesterExcluded (SCN-ApprovalPolicyService-005, SCN-ApprovalPolicyService-008, model/services/governance/ApprovalPolicyService.yaml).",
        "AC5: Given a call without a workload identity, a token without the service scope or a user token, a request without a decider, an approval never routed in the tenant of the call, and ProjectService stopped, the identity platform stopped for a break-glass decision, or `approval-policy-sql` stopped or its transaction failing, when `ApprovalPolicyService/ApprovalPolicy.ValidateDecision` is called, then the answers are UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND and UNAVAILABLE, no evaluation and no event exist and RunControlService records no decision; and under a transport outage the dispatcher publishes `ApprovalPolicyService/ApprovalDecisionValidated` on `approval-policy.routing.v1.approval-decision-validated` with retry and without loss or duplicate (SCN-ApprovalPolicyService-005, SCN-ApprovalPolicyService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/approvals.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3722",
        "AIFACTORY-TASK-3723",
        "AIFACTORY-TASK-3724"
      ],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12905,
      "kind": "behavior",
      "traces": {
        "services": [
          "ApprovalPolicyService",
          "RunControlService",
          "ProjectService",
          "AuditService",
          "GovernanceHost"
        ],
        "aggregates": [
          "ApprovalPolicyService/RoutingEvaluation",
          "ApprovalPolicyService/ApprovalRule"
        ],
        "apis": [
          "ApprovalPolicyService/ApprovalPolicy.ValidateDecision",
          "ProjectService/Projects.ListRoleHolders"
        ],
        "events": [
          "ApprovalPolicyService/ApprovalDecisionValidated"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "NFR-04",
          "XL-05"
        ],
        "scenarios": [
          "SCN-ApprovalPolicyService-005",
          "SCN-ApprovalPolicyService-008"
        ]
      },
      "relates": {
        "screens": [
          "approval-card"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-923",
        "AIFACTORY-US-925",
        "feature:project-service",
        "feature:run-control-service",
        "feature:governance-host",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/control/approvals.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-926]",
      "number": 926
    },
    {
      "id": "AIFACTORY-TASK-3722",
      "type": "task",
      "parent": "AIFACTORY-US-926",
      "title": "ApprovalPolicy.ValidateDecision with eligibility at decision time and the quorum",
      "sequence": "12.05.05.01",
      "description": "ApprovalPolicy.ValidateDecision with eligibility at decision time and the quorum. Expected output: ApprovalPolicy.ValidateDecision reads the routing evaluation and the rule of the approval and checks, in this order, the requester exclusion, the author exclusion, the expiry of the routing and the roles and delegations of the decider now through a typed client of Projects.ListRoleHolders; it answers Eligible with the quorum met or not met from the count of the votes RunControlService recorded on the request, treats a reject and a request for changes as valid without a quorum, writes the RoutingEvaluation of the decision and the ApprovalDecisionValidated outbox record in one transaction for every outcome, returns the first evaluation for a repeat, records the metric invalid_decisions, and writes nothing for the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND and UNAVAILABLE; it ends UNAVAILABLE with no evaluation and no event when ProjectService or approval-policy-sql does not answer or the transaction fails.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "ApprovalPolicy.ValidateDecision reads the routing evaluation and the rule of the approval and checks, in this order, the requester exclusion, the author exclusion, the expiry of the routing and the roles and delegations of the decider now through a typed client of Projects.ListRoleHolders; it answers Eligible with the quorum met or not met from the count of the votes RunControlService recorded on the request, treats a reject and a request for changes as valid without a quorum, writes the RoutingEvaluation of the decision and the ApprovalDecisionValidated outbox record in one transaction for every outcome, returns the first evaluation for a repeat, records the metric invalid_decisions, and writes nothing for the refusals UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND and UNAVAILABLE; it ends UNAVAILABLE with no evaluation and no event when ProjectService or approval-policy-sql does not answer or the transaction fails."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12905,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3722]",
      "number": 3722
    },
    {
      "id": "AIFACTORY-TASK-3723",
      "type": "task",
      "parent": "AIFACTORY-US-926",
      "title": "Break-glass decision of a Platform admin with the identity platform check",
      "sequence": "12.05.05.02",
      "description": "Break-glass decision of a Platform admin with the identity platform check. Expected output: A break-glass decision is valid only when the rule sets breakGlassAllowed, the Platform admin role of the decider is confirmed through the client of the identity platform and, with Governance:Approvals:BreakGlassRequiresReason true, the request states that it carries a reason; it is then Eligible with breakGlass true whatever the quorum, and Invalid otherwise; the requester of the run stays RequesterExcluded; the evaluation and the event carry breakGlass and no reason text; the metric break_glass is recorded; when the identity platform does not answer the call ends UNAVAILABLE and nothing is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "A break-glass decision is valid only when the rule sets breakGlassAllowed, the Platform admin role of the decider is confirmed through the client of the identity platform and, with Governance:Approvals:BreakGlassRequiresReason true, the request states that it carries a reason; it is then Eligible with breakGlass true whatever the quorum, and Invalid otherwise; the requester of the run stays RequesterExcluded; the evaluation and the event carry breakGlass and no reason text; the metric break_glass is recorded; when the identity platform does not answer the call ends UNAVAILABLE and nothing is written."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12905,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3723]",
      "number": 3723
    },
    {
      "id": "AIFACTORY-TASK-3724",
      "type": "task",
      "parent": "AIFACTORY-US-926",
      "title": "Verify the validation of a decision through the acceptance suite",
      "sequence": "12.05.05.03",
      "description": "Verify the validation of a decision through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ApprovalPolicyService-005|Scenario=SCN-ApprovalPolicyService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-926 with the fixtures of AIFACTORY-TASK-3720 and the clock of the suite: an eligible decider, the requester, the author, an expired routing, a role revoked and a role granted between routing and decision, a quorum of two before and after it is met, a reject, the repeated call, break-glass with and without a reason, under a rule that forbids it and for an unconfirmed role, every refusal with the table and the outbox unchanged, UNAVAILABLE with the transaction of approval-policy-sql failed by the switch of AIFACTORY-TASK-3720, and the publication of ApprovalPolicyService/ApprovalDecisionValidated under a transport outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ApprovalPolicyService-005|Scenario=SCN-ApprovalPolicyService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-926 with the fixtures of AIFACTORY-TASK-3720 and the clock of the suite: an eligible decider, the requester, the author, an expired routing, a role revoked and a role granted between routing and decision, a quorum of two before and after it is met, a reject, the repeated call, break-glass with and without a reason, under a rule that forbids it and for an unconfirmed role, every refusal with the table and the outbox unchanged, UNAVAILABLE with the transaction of approval-policy-sql failed by the switch of AIFACTORY-TASK-3720, and the publication of ApprovalPolicyService/ApprovalDecisionValidated under a transport outage."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3724]",
      "number": 3724
    },
    {
      "id": "AIFACTORY-US-927",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-063",
      "title": "Follow membership and delegation changes of a project and execute a deletion order on the stores of the service",
      "sequence": "12.05.06",
      "description": "As a workspace admin, I want a role or a delegation I revoke to stop counting for approvals at once, and the approval data of a deleted scope removed on order, so that access I took away never decides an approval and nothing of a deleted project stays behind. Three consumed events keep the service right after the fact. `MembershipChanged` and `DelegationChanged` of ProjectService say that a role was granted, changed or removed and that a delegation was granted, expired or revoked (D18). The service caches what it read from ProjectService about the roles of a subject in a project, in the shared cache and never as the authority, and the inbox handler `InvalidateEligibilityCache` removes the entries of the project and the subject the event names, so the next routing or validation reads the memberships again. The handler is idempotent on the event id and writes no row and no event. It closes the failure mode of the model, a membership revoked while a decision is pending: a validation after the event finds the decider no longer eligible and answers Invalid (AIFACTORY-US-926), and the request is routed again. The model does not say which side starts the re-route. This PBI delivers the routing side: a re-route flag on the request of `ApprovalPolicy.Route`, with which the service writes a new routing evaluation and a new `ApprovalRouted` for the same approval, with the approvers eligible now and the expiry of the first routing unchanged, where a plain repeat returns the first evaluation. The trigger in RunControlService, which holds the Pending requests, is reported to the owner. A cache entry also ends on its own after a lifetime taken from the configuration of the deployment, so an event that was lost delays a change and never keeps a revoked role eligible for good; the lifetime is a deployment value and none is fixed here. When the cache does not answer, the service reads ProjectService on every call and stays correct. `DeletionOrderIssued` of RetentionResidencyService orders every owning service to delete a scope from the stores it owns and to acknowledge. The handlers of the services of earlier increments are built in I4 with that service. ApprovalPolicyService is created in I4, so its handler `ExecuteDeletionOrder` is built here against the order contract of feature `retention-residency-service`. For an order of tenant scope it deletes the rows of that tenant in `ApprovalRules` and `RoutingEvaluations` of `approval-policy-sql`. For an order of project scope it deletes the rules of project scope whose scope id is that project and the routing evaluations whose column `ProjectId` names that project. That column is the correction AIFACTORY-US-925 reports: the modelled `RoutingEvaluation` holds no project, so the project-scoped delete of evaluations is built with the column once the model carries it, and until then a project order deletes the project rules only and its receipt states that the evaluations of the project were not deleted, which is reported to the owner. The handler removes the cache entries of the scope and acknowledges its task through `AcknowledgeOrderTask`, an internal operation of RetentionResidencyService that needs the scope `factory.data.acknowledge`, called with the workload token of this service, with a receipt that names the order, the service, the tables and the row counts. An answer 403 or 404 of the acknowledgement leaves the task unacknowledged: the handler logs it with the order id and without content, deletes nothing a second time and fails, so the inbox retries with backoff, and the order stays open in RetentionResidencyService, which marks it overdue after its deletion window, so the failure is surfaced and never hidden. The handler is idempotent on the order id: a redelivered order deletes nothing more and acknowledges with the same receipt, and a failure before the acknowledgement is retried by the inbox, so an order is neither lost nor half acknowledged. Every delete carries the tenant of the order, so an order never touches the rows of another tenant. The model keeps `RoutingEvaluations` seven years as audit evidence and lists no retention worker for this service. The evidence itself is held by AuditService, which records every evaluation from the events of this service. The handler deletes exactly what an order names and nothing by a schedule of its own, and how an order relates to the evidence retention of the table is decided by the order rules of RetentionResidencyService; the missing retention worker is reported to the owner. Kind: behavior. Traces: services: ApprovalPolicyService, ProjectService, RetentionResidencyService, RunControlService; aggregates: ApprovalPolicyService/RoutingEvaluation, ApprovalPolicyService/ApprovalRule; apis: ApprovalPolicyService/ApprovalPolicy.Route, ApprovalPolicyService/ApprovalPolicy.ValidateDecision, RetentionResidencyService/AcknowledgeOrderTask; events: ProjectService/MembershipChanged, ProjectService/DelegationChanged, RetentionResidencyService/DeletionOrderIssued, ApprovalPolicyService/ApprovalRouted; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: NFR-04, XL-13, XL-14. Depends on: AIFACTORY-US-925, AIFACTORY-US-926, feature:project-service, feature:retention-residency-service. Sources: model/services/governance/ApprovalPolicyService.yaml, model/services/control-plane/ProjectService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/architecture/adr/0019-data-governance.md, docs/planes/trust-operations/governance/services/approval-policy-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a cached eligibility of a reviewer and `ProjectService/MembershipChanged` that removes the role, when `InvalidateEligibilityCache` handles it, then the cache entries of that project and subject are removed and the next `ApprovalPolicyService/ApprovalPolicy.ValidateDecision` for that decider answers Invalid from a fresh read of ProjectService; a redelivered event changes nothing, and the handler writes no row and no event (model/services/governance/ApprovalPolicyService.yaml).",
        "AC2: Given `ProjectService/DelegationChanged` that grants a delegation of the Reviewer role, when the next validation runs for the delegate, then the delegate is Eligible; given the same event for an expired or a revoked delegation, then the delegate is Invalid; given the cache does not answer, then the service reads ProjectService on every call and gives the same answers (ADR-0015, XL-13).",
        "AC3: Given a Pending approval whose routing lists a subject whose membership was revoked, when `ApprovalPolicyService/ApprovalPolicy.Route` is called for the same approval id with the re-route flag, then a new `ApprovalPolicyService/RoutingEvaluation` and a new `ApprovalPolicyService/ApprovalRouted` are written for the approval with the approvers eligible now and the expiry of the first routing; without the flag the first evaluation is returned and nothing is written (model/services/governance/ApprovalPolicyService.yaml).",
        "AC4: Given `RetentionResidencyService/DeletionOrderIssued` for a project of a tenant, when `ExecuteDeletionOrder` handles it, then the rules of project scope of that project in `ApprovalRules` are deleted and, against the column `ProjectId` this feature reports as a correction of model/services/governance/ApprovalPolicyService.yaml, the routing evaluations of that project in `RoutingEvaluations`, while the receipt of an order handled before that column exists states that the evaluations were not deleted; the rows of other projects and of other tenants are untouched, the cache entries of the scope are removed and the task is acknowledged through `RetentionResidencyService/AcknowledgeOrderTask` with a workload token that holds `factory.data.acknowledge` and a receipt that names the order, the service, the tables and the row counts; given an order of tenant scope, then every row of the tenant in both tables is deleted; a redelivered order deletes nothing more and acknowledges with the same receipt, and a failure before the acknowledgement or an answer 403 or 404 of the acknowledgement leaves the task unacknowledged, is logged with the order id, deletes nothing a second time and is retried by the inbox (ADR-0019, XL-14)."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-3725",
        "AIFACTORY-TASK-3726",
        "AIFACTORY-TASK-3727"
      ],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12906,
      "kind": "behavior",
      "traces": {
        "services": [
          "ApprovalPolicyService",
          "ProjectService",
          "RetentionResidencyService",
          "RunControlService"
        ],
        "aggregates": [
          "ApprovalPolicyService/RoutingEvaluation",
          "ApprovalPolicyService/ApprovalRule"
        ],
        "apis": [
          "ApprovalPolicyService/ApprovalPolicy.Route",
          "ApprovalPolicyService/ApprovalPolicy.ValidateDecision",
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "ProjectService/MembershipChanged",
          "ProjectService/DelegationChanged",
          "RetentionResidencyService/DeletionOrderIssued",
          "ApprovalPolicyService/ApprovalRouted"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-04",
          "XL-13",
          "XL-14"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-925",
        "AIFACTORY-US-926",
        "feature:project-service",
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/trust-operations/governance/services/approval-policy-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-927]",
      "number": 927
    },
    {
      "id": "AIFACTORY-TASK-3725",
      "type": "task",
      "parent": "AIFACTORY-US-927",
      "title": "Eligibility cache with the InvalidateEligibilityCache handler and the re-route flag of Route",
      "sequence": "12.05.06.01",
      "description": "Eligibility cache with the InvalidateEligibilityCache handler and the re-route flag of Route. Expected output: The roles and delegations the service read from ProjectService are cached in the shared cache per tenant, project and subject with a lifetime from the configuration of the deployment, through the store binding cache that the stores of model/services/governance/ApprovalPolicyService.yaml do not list and that is reported as a correction of the service file; the inbox handler of MembershipChanged and DelegationChanged removes the entries of the project and the subject the event names, idempotent on the event id, and writes no row and no event; when the cache does not answer the service reads ProjectService on every call; ApprovalPolicy.Route accepts a re-route flag with which it writes a new RoutingEvaluation and a new ApprovalRouted for the same approval with the approvers eligible now and the expiry of the first routing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "The roles and delegations the service read from ProjectService are cached in the shared cache per tenant, project and subject with a lifetime from the configuration of the deployment, through the store binding cache that the stores of model/services/governance/ApprovalPolicyService.yaml do not list and that is reported as a correction of the service file; the inbox handler of MembershipChanged and DelegationChanged removes the entries of the project and the subject the event names, idempotent on the event id, and writes no row and no event; when the cache does not answer the service reads ProjectService on every call; ApprovalPolicy.Route accepts a re-route flag with which it writes a new RoutingEvaluation and a new ApprovalRouted for the same approval with the approvers eligible now and the expiry of the first routing."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12906,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3725]",
      "number": 3725
    },
    {
      "id": "AIFACTORY-TASK-3726",
      "type": "task",
      "parent": "AIFACTORY-US-927",
      "title": "ExecuteDeletionOrder handler with the acknowledgement of the order task",
      "sequence": "12.05.06.02",
      "description": "ExecuteDeletionOrder handler with the acknowledgement of the order task. Expected output: The inbox handler of DeletionOrderIssued deletes, for an order of tenant scope, every row of the tenant in ApprovalRules and RoutingEvaluations of approval-policy-sql and, for an order of project scope, the rules of project scope of that project and the routing evaluations whose column ProjectId names it, a delete built with that column once the model carries it, the receipt stating until then that the evaluations of the project were not deleted; it removes the cache entries of the scope, every delete carrying the tenant of the order, and acknowledges its task through a typed client of AcknowledgeOrderTask, called with the workload token of the service that holds the scope factory.data.acknowledge, with a receipt that names the order, the service, the tables and the row counts; an answer 403 or 404 of the acknowledgement leaves the task unacknowledged, is logged with the order id and without content, deletes nothing a second time and fails the handler so that the inbox retries; it is idempotent on the order id, acknowledges a redelivered order with the same receipt and leaves a failure before the acknowledgement to the retry of the inbox; it deletes nothing by a schedule of its own.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "The inbox handler of DeletionOrderIssued deletes, for an order of tenant scope, every row of the tenant in ApprovalRules and RoutingEvaluations of approval-policy-sql and, for an order of project scope, the rules of project scope of that project and the routing evaluations whose column ProjectId names it, a delete built with that column once the model carries it, the receipt stating until then that the evaluations of the project were not deleted; it removes the cache entries of the scope, every delete carrying the tenant of the order, and acknowledges its task through a typed client of AcknowledgeOrderTask, called with the workload token of the service that holds the scope factory.data.acknowledge, with a receipt that names the order, the service, the tables and the row counts; an answer 403 or 404 of the acknowledgement leaves the task unacknowledged, is logged with the order id and without content, deletes nothing a second time and fails the handler so that the inbox retries; it is idempotent on the order id, acknowledges a redelivered order with the same receipt and leaves a failure before the acknowledgement to the retry of the inbox; it deletes nothing by a schedule of its own."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12906,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3726]",
      "number": 3726
    },
    {
      "id": "AIFACTORY-TASK-3727",
      "type": "task",
      "parent": "AIFACTORY-US-927",
      "title": "Verify the inbox handlers of the service through the acceptance suite",
      "sequence": "12.05.06.03",
      "description": "Verify the inbox handlers of the service through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-927 with events built from the pinned contracts package and the fakes of AIFACTORY-TASK-3720: ProjectService/MembershipChanged and ProjectService/DelegationChanged that revoke and grant, the stopped cache, the re-route of a Pending approval with and without the flag, RetentionResidencyService/DeletionOrderIssued for a project and for a tenant over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and the scope of the token and can answer 403 and 404, the receipt of a project order that states the evaluations not deleted while the column ProjectId is absent, the redelivered order and the failure before the acknowledgement.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-927 with events built from the pinned contracts package and the fakes of AIFACTORY-TASK-3720: ProjectService/MembershipChanged and ProjectService/DelegationChanged that revoke and grant, the stopped cache, the re-route of a Pending approval with and without the flag, RetentionResidencyService/DeletionOrderIssued for a project and for a tenant over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and the scope of the token and can answer 403 and 404, the receipt of a project order that states the evaluations not deleted while the column ProjectId is absent, the redelivered order and the failure before the acknowledgement."
      ],
      "sourceArtifacts": [
        "model/services/governance/ApprovalPolicyService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:governance",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ApprovalPolicyService"
      ],
      "children": [],
      "buildOrder": 129,
      "phase": "factory",
      "stackRank": 12906,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3727]",
      "number": 3727
    },
    {
      "id": "AIFACTORY-EPIC-013",
      "type": "epic",
      "parent": null,
      "title": "Observability (PF-13)",
      "sequence": "13",
      "description": "Everything that builds the Observability platform (PF-13): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Operations read models, SLOs, incidents, evaluation and learning, FinOps projections. Done when: Every service of the platform has its complete delivery accepted (AlertRuleService, DashboardService, FeedbackService, ObservabilityHost, QualityScoreService, SloService), the platform gateway routes them under a trusted scope, and the outcome verification of I4 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (AlertRuleService, DashboardService, FeedbackService, ObservabilityHost, QualityScoreService, SloService), the platform gateway routes them under a trusted scope, and the outcome verification of I4 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-065",
        "AIFACTORY-FEAT-066",
        "AIFACTORY-FEAT-067",
        "AIFACTORY-FEAT-068",
        "AIFACTORY-FEAT-069",
        "AIFACTORY-FEAT-070",
        "AIFACTORY-FEAT-071"
      ],
      "stackRank": 7899,
      "titlePrefix": "[AIFACTORY-EPIC-013]",
      "number": 13
    },
    {
      "id": "AIFACTORY-FEAT-065",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-013",
      "title": "QualityScoreService: thin delivery for the first outcome",
      "sequence": "13.01",
      "description": "QualityScoreService is the service of bounded context BC-22 (Evaluation & Learning). Evaluation as a core capability: suites per target (models, agents, skills, tools, workflows, context and memory strategies, policies) with the quality-gate metrics, evaluation runs over datasets of historical tasks, verdicts with baseline comparison, waivers, drift monitoring and the evidence records publication reads (BC-22, D32, original design §47–49). In this increment it is delivered thin: Accepts evaluation and outcome events and stores them; no gate and no scoring. Its own repository is ConnectSoft.AI.SoftwareFactory.QualityScoreService. Delivers: QualityScoreService (thin: Accepts evaluation and outcome events and stores them; no gate and no scoring.). Stubbed in this increment: FeedbackService (contract-stub, completed in I4). Increment I1: Generate a microservice. Build order 79 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-071",
        "AIFACTORY-US-1087",
        "AIFACTORY-US-1088",
        "AIFACTORY-US-1089"
      ],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7900,
      "titlePrefix": "[AIFACTORY-FEAT-065]",
      "number": 65
    },
    {
      "id": "AIFACTORY-US-071",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-065",
      "title": "QualityScoreService accepts the evaluation and outcome events of the first outcome and stores them, with no gate and no scoring",
      "sequence": "13.01.01",
      "description": "As an asset maintainer, I want the outcomes of the first runs and the reliability signals of their model, tool, context and validation calls kept from the first outcome on, so that the evaluation gate and the drift monitor of the fourth increment start from real history instead of an empty store. This is the integration PBI of the thin delivery of QualityScoreService, the service of bounded context BC-22 (Evaluation and Learning). The scope of the thin delivery is stated in model/backlog/features/observability.yaml and is exactly this: the service accepts evaluation and outcome events and stores them; it applies no gate and computes no score. Ten consumed events of model/services/observability/QualityScoreService.yaml are in that scope, all published by services delivered in I1: `RunCompleted` and `AttemptOutcomeRecorded` of RunControlService, `AttemptStarted` and `AttemptOutcomeReported` of AgentRuntimeService (AIFACTORY-US-1087), and `ModelInvoked` of ModelRouterService, `ToolInvoked` of ToolAdapterService, `ContextAssembled` of ContextBuilderService, `RetrievalExecuted` of VectorMemoryService, `ArtifactValidated` of ArtifactService and `PipelineRunCompleted` of PipelineExecutionService (AIFACTORY-US-1088). Each is handled once through the inbox of the `quality-score` messaging profile, idempotent on the event id, and stored under the tenant of its envelope in `quality-score-sql`, the primary store of the service (AIFACTORY-US-1089). Nothing else of the model is delivered here. The service hosts none of its five REST operations and none of its two gRPC methods, writes no `EvaluationSuite` and no `EvaluationRun` and publishes none of its five events; the handlers of `AssetReleaseSubmitted` (the release gate), `ApprovalDecided` (waivers), `DatasetPublished` of FeedbackService and the three retention events of RetentionResidencyService are not registered, and `Evaluation.GetVerdict` is not called in this increment, nor later by the Published gate of AgentRegistryService, which from I4 checks the evidence it recorded itself from `EvaluationCompleted` (D141); under the ADR-0021 amendment (D83) a Draft workflow or agent release runs only in the acceptance environment and the internal projects the platform rule names, and publication itself is never waived. Every one of the twelve scenarios of the service is therefore delivered by feature quality-score-service-complete in I4, against the same model, so the complete delivery adds operations and events without changing what the thin delivery stores. The feature declares a contract stub of FeedbackService that completes in I4; the thin scope calls no operation of FeedbackService, so the stub is a compiled client and a stub server of its internal dataset method kept in the test suite and nothing in the running service. The thin delivery applies no retention period of its own: the handlers of the three retention events are not registered, and the rules of ADR-0019 are applied to the records it stores by AIFACTORY-US-1097 of feature quality-score-service-complete in I4. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService, created and scaffolded in I0 by AIFACTORY-TASK-115 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist; this feature starts from that scaffold. Kind: behavior. Traces: services: QualityScoreService; events: RunControlService/RunCompleted, RunControlService/AttemptOutcomeRecorded, AgentRuntimeService/AttemptStarted, AgentRuntimeService/AttemptOutcomeReported, ModelRouterService/ModelInvoked, ToolAdapterService/ToolInvoked; adrs: ADR-0014, ADR-0015, ADR-0021, ADR-0028; requirements: NFR-11, XL-08. Depends on: AIFACTORY-US-1087, AIFACTORY-US-1088, AIFACTORY-US-1089, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:run-control-service, feature:agent-runtime-service, feature:model-router-service, feature:tool-adapter-service. Sources: model/services/observability/QualityScoreService.yaml, model/backlog/features/observability.yaml, docs/architecture/adr/0021-quality-gates.md, docs/planes/trust-operations/observability/services/quality-score-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.QualityScoreService created and scaffolded in I0 by AIFACTORY-TASK-115 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.QualityScoreService --UseFactoryProfile true` from the pinned template package, when its pipeline runs with the work of this feature, then the solution builds, the unit and acceptance tests pass with complete reports and a container image is published (ADR-0028, model/services/observability/QualityScoreService.yaml).",
        "AC2: Given an I1 run of the chain that ends, when its events reach the service, then `RunControlService/RunCompleted`, `RunControlService/AttemptOutcomeRecorded`, `AgentRuntimeService/AttemptStarted`, `AgentRuntimeService/AttemptOutcomeReported`, `ModelRouterService/ModelInvoked` and `ToolAdapterService/ToolInvoked` are each stored once under the tenant of their envelope, as AIFACTORY-US-1087 and AIFACTORY-US-1088 prove event by event, and no score, verdict or evaluation run exists afterwards (ADR-0014, ADR-0021).",
        "AC3: Given the thin service deployed in the chain, when the descriptor test of AIFACTORY-US-1089 runs in its pipeline, then the hosted surface is the thin scope of model/backlog/features/observability.yaml and nothing more, as AIFACTORY-US-1089 proves (ADR-0028).",
        "AC4: Given the service deployed in the chain, when it starts, then readiness waits for `quality-score-sql` and the transport and the records of the chain run are read only under the tenant row filter, as AIFACTORY-US-1089 proves (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/backlog/features/observability.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-116",
        "AIFACTORY-TASK-773"
      ],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7901,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService"
        ],
        "events": [
          "RunControlService/RunCompleted",
          "RunControlService/AttemptOutcomeRecorded",
          "AgentRuntimeService/AttemptStarted",
          "AgentRuntimeService/AttemptOutcomeReported",
          "ModelRouterService/ModelInvoked",
          "ToolAdapterService/ToolInvoked"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-11",
          "XL-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1087",
        "AIFACTORY-US-1088",
        "AIFACTORY-US-1089",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:run-control-service",
        "feature:agent-runtime-service",
        "feature:model-router-service",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/backlog/features/observability.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-071]",
      "number": 71
    },
    {
      "id": "AIFACTORY-TASK-116",
      "type": "task",
      "parent": "AIFACTORY-US-071",
      "title": "Implement the thin scope of QualityScoreService for the first outcome",
      "sequence": "13.01.01.01",
      "description": "Implement the thin scope of QualityScoreService for the first outcome. Expected output: The service accepts the ten evaluation and outcome events of the thin scope and stores them, with no gate and no scoring; it hosts no operation and publishes no event, so the complete delivery of I4 adds the five REST operations, the two gRPC methods, the five events and the remaining handlers of model/services/observability/QualityScoreService.yaml without changing what is stored here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service accepts the ten evaluation and outcome events of the thin scope and stores them, with no gate and no scoring; it hosts no operation and publishes no event, so the complete delivery of I4 adds the five REST operations, the two gRPC methods, the five events and the remaining handlers of model/services/observability/QualityScoreService.yaml without changing what is stored here."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-116]",
      "number": 116
    },
    {
      "id": "AIFACTORY-TASK-773",
      "type": "task",
      "parent": "AIFACTORY-US-071",
      "title": "Verify quality-score-service-thin-contract by running the declared command",
      "sequence": "13.01.01.02",
      "description": "Verify quality-score-service-thin-contract by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; they pass and prove AC1 to AC4 of AIFACTORY-US-071: the scaffold with the Factory profile, one chain run whose events are stored once each with no score or verdict, and the thin surface, readiness and tenant row filter proven by AIFACTORY-US-1089 holding in the deployed chain.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; they pass and prove AC1 to AC4 of AIFACTORY-US-071: the scaffold with the Factory profile, one chain run whose events are stored once each with no score or verdict, and the thin surface, readiness and tenant row filter proven by AIFACTORY-US-1089 holding in the deployed chain."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-773]",
      "number": 773
    },
    {
      "id": "AIFACTORY-US-1087",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-065",
      "title": "Run and attempt outcome events are accepted once and stored per attempt and release, without scoring",
      "sequence": "13.01.02",
      "description": "As an asset maintainer, I want every run end and every attempt outcome of the first outcome kept with the release that produced it, so that the drift monitor of the complete delivery can compare production outcomes per release with evaluated scores from the first run on. Four consumed events of model/services/observability/QualityScoreService.yaml carry the outcomes of runs and attempts, and the thin delivery accepts and stores them. `AttemptStarted` of AgentRuntimeService (handler `CollectRuntimeStats`) opens the runtime sample of an attempt with its `attemptId`, `runId`, `stepId`, `releaseId` and `snapshotId`; it is the only one of the four that names the release, so the release of an attempt is taken from it. `AttemptOutcomeReported` of AgentRuntimeService (handler `CollectRuntimeStats`) adds the state, the failure class, the outcome hash and the counts of corrections, model calls and tool calls of the attempt. `AttemptOutcomeRecorded` of RunControlService (handler `CollectOutcome`) adds the authoritative outcome and failure class that Run Control recorded exactly once. `RunCompleted` of RunControlService (handler `ScoreEvaluationTask`) records the end of a run with its outcome hash and, when present, its output reference; in the complete delivery the same handler scores the tasks of evaluation runs, but no evaluation run exists in this increment, so here it only stores the run end as a production outcome. Each event arrives through the inbox of the `quality-score` messaging profile and is applied once, idempotent on its event id, so a redelivered event changes nothing. The tenant and the project come from the run envelope of the event, never from a payload field, and every record is written and read under the tenant row filter of the service (ADR-0015). The events of one attempt may arrive in any order: an outcome that arrives before its `AttemptStarted` is stored under its `attemptId` and joins the release when the start arrives, and no record is dropped for order. Nothing is scored, no threshold is read, no `EvaluationRun` is written and no event is published; the comparison of these outcomes with evaluated scores is the drift monitor of feature quality-score-service-complete in I4. When the store is unavailable the inbox does not acknowledge the event, the transport redelivers it and it is applied once when the store is back (ADR-0012). The records hold identifiers, states, classes, hashes and counts, never a prompt, a tool argument or an artifact body. Kind: behavior. Traces: services: QualityScoreService, RunControlService, AgentRuntimeService; events: RunControlService/RunCompleted, RunControlService/AttemptOutcomeRecorded, AgentRuntimeService/AttemptStarted, AgentRuntimeService/AttemptOutcomeReported; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0021; requirements: NFR-11, XL-08. Depends on: AIFACTORY-US-1089, feature:run-control-service, feature:agent-runtime-service. Sources: model/services/observability/QualityScoreService.yaml, model/services/control-plane/RunControlService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, docs/planes/trust-operations/observability/services/quality-score-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given an attempt of an I1 run, when `AgentRuntimeService/AttemptStarted`, `AgentRuntimeService/AttemptOutcomeReported` and `RunControlService/AttemptOutcomeRecorded` arrive, then one record of the attempt exists with its run, step, release and snapshot, the reported state, failure class, outcome hash and counts of corrections, model calls and tool calls, and the recorded outcome of Run Control, under the tenant and project of the run envelope (model/services/observability/QualityScoreService.yaml, ADR-0014).",
        "AC2: Given the outcome events of an attempt arrive before its `AgentRuntimeService/AttemptStarted`, when the start arrives later, then the stored outcome joins the release and snapshot of the start and nothing is lost; given any of the four events delivered twice, then the second delivery changes nothing (ADR-0012).",
        "AC3: Given a run ends, when `RunControlService/RunCompleted` arrives, then the run end is stored with its outcome hash and output reference as a production outcome, no evaluation task is scored, no `EvaluationRun` is written and no event of QualityScoreService is published (ADR-0021, model/backlog/features/observability.yaml).",
        "AC4: Given `quality-score-sql` is unavailable while `RunControlService/AttemptOutcomeRecorded` arrives, when the store returns, then the event is redelivered and applied once; given records of two tenants, then a read under one tenant returns only its own records, and no record holds a prompt, a tool argument or an artifact body (ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4357",
        "AIFACTORY-TASK-4358",
        "AIFACTORY-TASK-4359"
      ],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7902,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "RunControlService",
          "AgentRuntimeService"
        ],
        "events": [
          "RunControlService/RunCompleted",
          "RunControlService/AttemptOutcomeRecorded",
          "AgentRuntimeService/AttemptStarted",
          "AgentRuntimeService/AttemptOutcomeReported"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "NFR-11",
          "XL-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1089",
        "feature:run-control-service",
        "feature:agent-runtime-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1087]",
      "number": 1087
    },
    {
      "id": "AIFACTORY-TASK-4357",
      "type": "task",
      "parent": "AIFACTORY-US-1087",
      "title": "Handlers CollectRuntimeStats, CollectOutcome and the storing half of ScoreEvaluationTask",
      "sequence": "13.01.02.01",
      "description": "Handlers CollectRuntimeStats, CollectOutcome and the storing half of ScoreEvaluationTask. Expected output: The handlers of AttemptStarted and AttemptOutcomeReported (CollectRuntimeStats), AttemptOutcomeRecorded (CollectOutcome) and RunCompleted (ScoreEvaluationTask, storing only) write one record per attempt and one per run end, keyed by attemptId and runId, with the tenant and project of the run envelope, join an early outcome to the release of a later start, are idempotent on the event id through the inbox, and score nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The handlers of AttemptStarted and AttemptOutcomeReported (CollectRuntimeStats), AttemptOutcomeRecorded (CollectOutcome) and RunCompleted (ScoreEvaluationTask, storing only) write one record per attempt and one per run end, keyed by attemptId and runId, with the tenant and project of the run envelope, join an early outcome to the release of a later start, are idempotent on the event id through the inbox, and score nothing."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4357]",
      "number": 4357
    },
    {
      "id": "AIFACTORY-TASK-4358",
      "type": "task",
      "parent": "AIFACTORY-US-1087",
      "title": "Event fixtures of the four run and attempt events in every arrival order",
      "sequence": "13.01.02.02",
      "description": "Event fixtures of the four run and attempt events in every arrival order. Expected output: The acceptance suite holds fixtures of AttemptStarted, AttemptOutcomeReported, AttemptOutcomeRecorded and RunCompleted built from the contracts package under the run envelope of two tenants, in order, out of order and redelivered, and a switch that makes quality-score-sql unavailable.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fixtures of AttemptStarted, AttemptOutcomeReported, AttemptOutcomeRecorded and RunCompleted built from the contracts package under the run envelope of two tenants, in order, out of order and redelivered, and a switch that makes quality-score-sql unavailable."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4358]",
      "number": 4358
    },
    {
      "id": "AIFACTORY-TASK-4359",
      "type": "task",
      "parent": "AIFACTORY-US-1087",
      "title": "Verify the run and attempt outcome records through the acceptance suite",
      "sequence": "13.01.02.03",
      "description": "Verify the run and attempt outcome records through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RunAndAttemptOutcomes\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1087 for RunControlService/RunCompleted, RunControlService/AttemptOutcomeRecorded, AgentRuntimeService/AttemptStarted and AgentRuntimeService/AttemptOutcomeReported: the joined record, arrival out of order, the redelivery without a second effect, the store outage and the tenant row filter, with no EvaluationRun written and no event published.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RunAndAttemptOutcomes\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1087 for RunControlService/RunCompleted, RunControlService/AttemptOutcomeRecorded, AgentRuntimeService/AttemptStarted and AgentRuntimeService/AttemptOutcomeReported: the joined record, arrival out of order, the redelivery without a second effect, the store outage and the tenant row filter, with no EvaluationRun written and no event published."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4359]",
      "number": 4359
    },
    {
      "id": "AIFACTORY-US-1088",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-065",
      "title": "Model, tool, context, retrieval and validation events are accepted once and stored as reliability signals, without scoring",
      "sequence": "13.01.03",
      "description": "As an asset maintainer, I want the reliability signals of model calls, tool calls, context assembly, retrieval and validators kept per run and attempt, so that the quality-gate metrics of the complete delivery can be computed over history the Factory already has. Six consumed events of model/services/observability/QualityScoreService.yaml carry the signals from which the quality-gate metrics of ADR-0021 are computed later, and the thin delivery accepts and stores them. `ModelInvoked` of ModelRouterService (handler `CollectModelStats`) gives the receipt of a model call with its profile, deployment and outcome, the reliability of structured output and tool calls per deployment; a receipt of a call outside a run names no run and no attempt and is stored under its tenant and project without one. `ToolInvoked` of ToolAdapterService (handler `CollectToolStats`) gives the receipt of a tool call with the tool, its version, the effective class and the state, the signal of tool selection and argument validity. `ContextAssembled` of ContextBuilderService (handler `CollectContextStats`) gives the status of a context snapshot and the tokens used against the budget. `RetrievalExecuted` of VectorMemoryService (handler `CollectRetrievalStats`) gives the result count and the latency of a retrieval. `ArtifactValidated` of ArtifactService and `PipelineRunCompleted` of PipelineExecutionService (handler `CollectValidationStats`) give validator outcomes and build and test results. Each event is applied once through the inbox of the `quality-score` messaging profile, idempotent on its event id, and stored under the tenant of its envelope. `ModelInvoked` of a call in a run, `ToolInvoked` and `ContextAssembled` name their run and attempt and are stored with them, so these signals are later attributed to the release of the attempt through the records of AIFACTORY-US-1087. `RetrievalExecuted` names at most a run and no attempt, `ArtifactValidated` names an artifact and `PipelineRunCompleted` a project and a commit; these three are stored by tenant and project with the run, artifact or commit reference they carry where present, and are not attributed to a release. The results of a pipeline run are stored as its state and the counts of its build and test results, never as the results body. The handlers are registered for all six events from the start; the thin deliveries of ContextBuilderService and VectorMemoryService and the thin PipelineExecutionService of this increment may publish few or none of their events, and the handlers store what arrives without waiting for them. Nothing is scored and no threshold, suite or verdict is read or written. A record holds identifiers, classes, states, counts, latencies and hashes; it never holds a prompt, a completion, a tool argument, retrieved content or a validator report body, which stay with their owners and are referenced only. Kind: behavior. Traces: services: QualityScoreService, ModelRouterService, ToolAdapterService, ContextBuilderService, VectorMemoryService, ArtifactService, PipelineExecutionService; events: ModelRouterService/ModelInvoked, ToolAdapterService/ToolInvoked, ContextBuilderService/ContextAssembled, VectorMemoryService/RetrievalExecuted, ArtifactService/ArtifactValidated, PipelineExecutionService/PipelineRunCompleted; adrs: ADR-0012, ADR-0019, ADR-0021; requirements: FR-04, NFR-11. Depends on: AIFACTORY-US-1089, feature:model-router-service, feature:tool-adapter-service, feature:context-builder-service-thin, feature:vector-memory-service-thin, feature:artifact-service, feature:pipeline-execution-service-thin. Sources: model/services/observability/QualityScoreService.yaml, model/services/model-compute/ModelRouterService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, docs/planes/trust-operations/observability/services/quality-score-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a model call and a tool call of an attempt, when `ModelRouterService/ModelInvoked` and `ToolAdapterService/ToolInvoked` arrive, then each is stored once with its run, attempt, tenant and project and the profile, deployment, tool, version, effective class and state of its receipt; given a `ModelRouterService/ModelInvoked` of a call outside a run, then it is stored under its tenant and project without a run (model/services/observability/QualityScoreService.yaml).",
        "AC2: Given `ContextBuilderService/ContextAssembled`, `VectorMemoryService/RetrievalExecuted`, `ArtifactService/ArtifactValidated` and `PipelineExecutionService/PipelineRunCompleted`, when each arrives, then it is stored once with the status and tokens of the snapshot, the result count and latency of the retrieval, the validator verdict with its artifact and validation reference, and the state, commit and counts of build and test results of the pipeline run without the results body, under the tenant and project of its envelope and without a release (model/services/observability/QualityScoreService.yaml).",
        "AC3: Given any of the six events delivered twice, when the second delivery is handled, then nothing changes; given a stored signal, then it holds no prompt, completion, tool argument, retrieved content or report body, and no threshold, suite, verdict or score is read or written (ADR-0012, ADR-0021)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4360",
        "AIFACTORY-TASK-4361",
        "AIFACTORY-TASK-4362"
      ],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7903,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "ModelRouterService",
          "ToolAdapterService",
          "ContextBuilderService",
          "VectorMemoryService",
          "ArtifactService",
          "PipelineExecutionService"
        ],
        "events": [
          "ModelRouterService/ModelInvoked",
          "ToolAdapterService/ToolInvoked",
          "ContextBuilderService/ContextAssembled",
          "VectorMemoryService/RetrievalExecuted",
          "ArtifactService/ArtifactValidated",
          "PipelineExecutionService/PipelineRunCompleted"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0019",
          "ADR-0021"
        ],
        "requirements": [
          "FR-04",
          "NFR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1089",
        "feature:model-router-service",
        "feature:tool-adapter-service",
        "feature:context-builder-service-thin",
        "feature:vector-memory-service-thin",
        "feature:artifact-service",
        "feature:pipeline-execution-service-thin"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1088]",
      "number": 1088
    },
    {
      "id": "AIFACTORY-TASK-4360",
      "type": "task",
      "parent": "AIFACTORY-US-1088",
      "title": "Handlers CollectModelStats, CollectToolStats, CollectContextStats, CollectRetrievalStats and CollectValidationStats",
      "sequence": "13.01.03.01",
      "description": "Handlers CollectModelStats, CollectToolStats, CollectContextStats, CollectRetrievalStats and CollectValidationStats. Expected output: The five handlers store ModelInvoked, ToolInvoked, ContextAssembled, RetrievalExecuted, ArtifactValidated and PipelineRunCompleted once each, idempotent on the event id, with tenant and project from the envelope, run and attempt only where the event names them, the artifact or commit reference of a validation or pipeline signal, pipeline results as state and counts, a model receipt outside a run without a run, and no payload content beyond identifiers, classes, states, counts, latencies and hashes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The five handlers store ModelInvoked, ToolInvoked, ContextAssembled, RetrievalExecuted, ArtifactValidated and PipelineRunCompleted once each, idempotent on the event id, with tenant and project from the envelope, run and attempt only where the event names them, the artifact or commit reference of a validation or pipeline signal, pipeline results as state and counts, a model receipt outside a run without a run, and no payload content beyond identifiers, classes, states, counts, latencies and hashes."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4360]",
      "number": 4360
    },
    {
      "id": "AIFACTORY-TASK-4361",
      "type": "task",
      "parent": "AIFACTORY-US-1088",
      "title": "Event fixtures of the six signal events from the contracts package",
      "sequence": "13.01.03.02",
      "description": "Event fixtures of the six signal events from the contracts package. Expected output: The acceptance suite holds fixtures of the six events built from the contracts package, a model receipt with and without a run, a redelivered event of each kind, and a scan helper that fails when a stored record holds a field outside the allowed identifiers, classes, states, counts, latencies and hashes.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The acceptance suite holds fixtures of the six events built from the contracts package, a model receipt with and without a run, a redelivered event of each kind, and a scan helper that fails when a stored record holds a field outside the allowed identifiers, classes, states, counts, latencies and hashes."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7903,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4361]",
      "number": 4361
    },
    {
      "id": "AIFACTORY-TASK-4362",
      "type": "task",
      "parent": "AIFACTORY-US-1088",
      "title": "Verify the stored reliability signals through the acceptance suite",
      "sequence": "13.01.03.03",
      "description": "Verify the stored reliability signals through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=CapabilitySignals\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1088 for ModelRouterService/ModelInvoked, ToolAdapterService/ToolInvoked, ContextBuilderService/ContextAssembled, VectorMemoryService/RetrievalExecuted, ArtifactService/ArtifactValidated and PipelineExecutionService/PipelineRunCompleted, the redelivery without effect and the scan for payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=CapabilitySignals\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1088 for ModelRouterService/ModelInvoked, ToolAdapterService/ToolInvoked, ContextBuilderService/ContextAssembled, VectorMemoryService/RetrievalExecuted, ArtifactService/ArtifactValidated and PipelineExecutionService/PipelineRunCompleted, the redelivery without effect and the scan for payload content."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4362]",
      "number": 4362
    },
    {
      "id": "AIFACTORY-US-1089",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-065",
      "title": "Thin surface of QualityScoreService: the inbox of ten handlers, the store of accepted events, no operation and no published event",
      "sequence": "13.01.04",
      "description": "As a platform admin, I want the thin QualityScoreService to host exactly its stated scope and nothing that looks like a gate, so that no caller mistakes the thin service for an evaluation gate and the complete delivery adds the gate without changing what is stored. This PBI sets up what the two behaviour PBIs of the thin delivery run on. The inbox of the `quality-score` messaging profile (option `OrleansMessaging:ServiceName`, default `quality-score`, the inbox and the outbox belonging to this service alone under ADR-0028) registers exactly the ten handlers of the thin scope and no other; the outbox is wired in the transaction pipeline but declares no event type, because the thin delivery publishes none of the five events of the model. The REST and gRPC hosts are configured with token validation and the problem-response pipeline but map no operation, so a call to any path of the model, among them `ListEvaluationSuites`, `StartEvaluation` and `Evaluation.GetVerdict`, is answered as an unknown route and no handler runs. The store `quality-score-sql` is migrated with the tenant row filter of the service and holds the records of the accepted events. The model of QualityScoreService names three tables, `EvaluationSuites`, `EvaluationRuns` and `EvaluationResults`, and none of them fits a record of a run, an attempt or a call that belongs to no evaluation, so the table that holds these records is an open point of the model reported with this feature; the migration of this PBI creates it under a name the owner may change, and the complete delivery reads it for drift without a second migration of the records. A descriptor test compares the hosted surface, the registered handlers and the declared event types with the thin scope in model/backlog/features/observability.yaml and fails when anything outside it appears. The contract stub of FeedbackService that the feature declares lives in the test suite only, as a compiled client of the dataset method and a stub server answering it, since nothing in the thin service calls FeedbackService. Metrics follow the observability conventions and carry tenant and project by default (D115); the inbox lag of the service is reported as `connectsoft.factory.evaluation.inbox_lag`. Kind: enabling. Traces: services: QualityScoreService; adrs: ADR-0012, ADR-0015, ADR-0018, ADR-0028. Depends on: feature:component-base-template-factory-profile, feature:component-extensions-ai, feature:component-observability-factory-conventions. Sources: model/services/observability/QualityScoreService.yaml, model/backlog/features/observability.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the built service, when its descriptor test runs, then the inbox registers exactly the ten handlers of the thin scope, the outbox declares no event type, no REST operation and no gRPC method of model/services/observability/QualityScoreService.yaml is mapped, and a call to the path of any of them runs no handler and changes nothing (ADR-0028, model/backlog/features/observability.yaml).",
        "AC2: Given a fresh database, when the service starts, then `quality-score-sql` is migrated with the table of accepted events under the tenant row filter, a query without a tenant in scope returns nothing, and readiness turns ready only after the migration and the transport check pass (ADR-0015, model/services/observability/QualityScoreService.yaml).",
        "AC3: Given messages waiting in the inbox, when the metrics are read, then `connectsoft.factory.evaluation.inbox_lag` reports the age of the oldest unprocessed message with the dimension service, and the series carry tenant and project as the helper of the pinned observability library adds them (ADR-0018, model/services/observability/QualityScoreService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/backlog/features/observability.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-117",
        "AIFACTORY-TASK-4363",
        "AIFACTORY-TASK-4364"
      ],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7904,
      "kind": "enabling",
      "traces": {
        "services": [
          "QualityScoreService"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0018",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-extensions-ai",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/backlog/features/observability.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1089]",
      "number": 1089
    },
    {
      "id": "AIFACTORY-TASK-117",
      "type": "task",
      "parent": "AIFACTORY-US-1089",
      "title": "Descriptor test of the thin surface of QualityScoreService",
      "sequence": "13.01.04.01",
      "description": "Descriptor test of the thin surface of QualityScoreService. Expected output: A test compares the mapped REST and gRPC operations, the registered inbox handlers and the declared outbox event types with the thin scope of model/backlog/features/observability.yaml and fails, naming the entry, when an operation, a published event or a handler outside the ten of the scope appears; the compiled client and stub server of the FeedbackService dataset method live in the test suite only.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "A test compares the mapped REST and gRPC operations, the registered inbox handlers and the declared outbox event types with the thin scope of model/backlog/features/observability.yaml and fails, naming the entry, when an operation, a published event or a handler outside the ten of the scope appears; the compiled client and stub server of the FeedbackService dataset method live in the test suite only."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-117]",
      "number": 117
    },
    {
      "id": "AIFACTORY-TASK-4363",
      "type": "task",
      "parent": "AIFACTORY-US-1089",
      "title": "Messaging profile, hosts without operations and the migration of the accepted-event store",
      "sequence": "13.01.04.02",
      "description": "Messaging profile, hosts without operations and the migration of the accepted-event store. Expected output: The quality-score messaging profile registers the ten handlers through the inbox with idempotency on the event id and wires an outbox with no event type; the REST and gRPC hosts validate tokens and map no operation; the migration of quality-score-sql creates the table of accepted events with tenant, project, run, attempt and event id columns, the tenant row filter and the index by tenant and attempt; readiness waits for the migration and the transport; the inbox lag gauge is emitted.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The quality-score messaging profile registers the ten handlers through the inbox with idempotency on the event id and wires an outbox with no event type; the REST and gRPC hosts validate tokens and map no operation; the migration of quality-score-sql creates the table of accepted events with tenant, project, run, attempt and event id columns, the tenant row filter and the index by tenant and attempt; readiness waits for the migration and the transport; the inbox lag gauge is emitted."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4363]",
      "number": 4363
    },
    {
      "id": "AIFACTORY-TASK-4364",
      "type": "task",
      "parent": "AIFACTORY-US-1089",
      "title": "Verify the thin surface, the store and the inbox lag",
      "sequence": "13.01.04.03",
      "description": "Verify the thin surface, the store and the inbox lag. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1089: the ten handlers and nothing more, unmapped operations that run no handler, the migrated store under the tenant row filter, readiness after migration and transport, and connectsoft.factory.evaluation.inbox_lag as model/services/observability/QualityScoreService.yaml names it.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ThinSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1089: the ten handlers and nothing more, unmapped operations that run no handler, the migrated store under the tenant row filter, readiness after migration and transport, and connectsoft.factory.evaluation.inbox_lag as model/services/observability/QualityScoreService.yaml names it."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 79,
      "phase": "factory",
      "stackRank": 7904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4364]",
      "number": 4364
    },
    {
      "id": "AIFACTORY-FEAT-066",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-013",
      "title": "ObservabilityHost: gateway delivery",
      "sequence": "13.02",
      "description": "ObservabilityHost is the platform API gateway of bounded context BC-21 (Operations). The API gateway of the Observability platform (ADR-0028): routes public REST and internal gRPC calls to the 5 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.ObservabilityHost. Delivers: ObservabilityHost (complete). Increment I3: Studio. Build order 111 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:feature",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-084",
        "AIFACTORY-US-1104",
        "AIFACTORY-US-1105",
        "AIFACTORY-US-1106",
        "AIFACTORY-US-1107",
        "AIFACTORY-US-1108"
      ],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11100,
      "titlePrefix": "[AIFACTORY-FEAT-066]",
      "number": 66
    },
    {
      "id": "AIFACTORY-US-084",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-066",
      "title": "ObservabilityHost routes the calls of its platform under a trusted scope",
      "sequence": "13.02.01",
      "description": "As an operator, I want one gateway in front of the five services of the Observability platform that validates tokens and scopes, so that no service of the platform is reachable from outside the cluster except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the Observability platform. ADR-0028 makes ObservabilityHost the API gateway of its platform: it routes public REST and internal gRPC calls to the five services the model lists under `deployment.fronts`, AlertRuleService, DashboardService, FeedbackService, QualityScoreService and SloService, validates tokens and scopes and owns no business state, no relational store and no secret. The repository ConnectSoft.AI.SoftwareFactory.ObservabilityHost is created by the first task of this feature with the steps of the repository checklist of feature `repository-and-pipeline-conventions` and is scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway has no outbox and no inbox, consumes and publishes no event (D129), and its only store is the shared cache; the model of the gateway lists no event and no consumed event, so nothing is to be corrected there. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`, feature `trusted-scope-chain`). A user token has one audience, this gateway, and is forwarded to the fronted service unchanged with no token exchange (ADR-0015 amendments D114 and D117); the tenant comes from the `tid` claim and a project header a caller sends is dropped. A call without a token or with an expired token is answered 401, a missing scope 403, and no fronted service is called; a resource of another tenant is answered 404 by the fronted service (ADR-0015 amendment D113) and the gateway returns that answer unchanged. The feature is delivered by five further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-1104), the read routes (AIFACTORY-US-1105), the shared-write routes (AIFACTORY-US-1106), the sandbox and publication routes of QualityScoreService (AIFACTORY-US-1107), and health, backends, limits and telemetry with the three failure modes of the gateway (AIFACTORY-US-1108). The gateway is delivered in I3 together with StudioBff, its first caller. In this increment no fronted service hosts a public route yet: QualityScoreService is delivered thin in I1 and hosts no operation before its complete delivery in I4, and the other four services arrive in I4. The fronts file holds the routes of all five services from the start, and they begin to serve as the services appear in I4 without a change of the gateway. One rule decides the answer of a route whose operation is not served: a route of a service that is deployed but does not host the operation returns the not-found answer of that service unchanged, so in I3 the routes of the thin QualityScoreService return its unknown-route 404 (AIFACTORY-US-1089); only a service that is not deployed or does not answer gives 503 with a retry hint that names the service. Every route class is proven against fakes generated from the fronts file. The gateway invents no response. The model of the gateway declares the ports silo 12100 and gateway 31100, which belong to an actor host, while the Platform gateway role fixes the actor model to none; the deployment leaves them out, and their removal from model/services/observability/ObservabilityHost.yaml is a correction reported with this feature. Kind: enabling. Traces: services: ObservabilityHost, AlertRuleService, DashboardService, FeedbackService, QualityScoreService, SloService; apis: ObservabilityHost/ObservabilityHealth; adrs: ADR-0015, ADR-0016, ADR-0018, ADR-0028; requirements: FR-10, FUX-04, FUX-10, NFR-10, NFR-17. Depends on: AIFACTORY-US-1104, AIFACTORY-US-1105, AIFACTORY-US-1106, AIFACTORY-US-1107, AIFACTORY-US-1108, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai, feature:component-observability-factory-conventions, feature:trusted-scope-chain, feature:quality-score-service-thin. Sources: model/services/observability/ObservabilityHost.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/planes/trust-operations/observability/services/observability-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.ObservabilityHost created by the steps of the repository checklist, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ObservabilityHost --UseFactoryProfile true --GatewayRole Platform`, when its pipeline runs with the work of this feature, then the solution builds, the tests pass and a container image is published (ADR-0028, model/services/observability/ObservabilityHost.yaml).",
        "AC2: Given a valid token for a route of each fronted service, when the call passes the gateway, then the scope is established once from the token, the call is forwarded with the token unchanged, the tenant, the correlation id and the trace context, and the response of the fronted service returns unchanged, as AIFACTORY-US-1105 to AIFACTORY-US-1107 prove per route class (ADR-0015).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret, and no event of the model lists ObservabilityHost as a publisher or a consumer (ADR-0028, model/services/observability/ObservabilityHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `ObservabilityHost/ObservabilityHealth` is probed and one replica is stopped, then health reports the identity platform and the five fronted services, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0016, model/services/observability/ObservabilityHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-469",
        "AIFACTORY-TASK-4395",
        "AIFACTORY-TASK-771"
      ],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11101,
      "kind": "enabling",
      "traces": {
        "services": [
          "ObservabilityHost",
          "AlertRuleService",
          "DashboardService",
          "FeedbackService",
          "QualityScoreService",
          "SloService"
        ],
        "apis": [
          "ObservabilityHost/ObservabilityHealth"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0016",
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "FUX-04",
          "FUX-10",
          "NFR-10",
          "NFR-17"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1104",
        "AIFACTORY-US-1105",
        "AIFACTORY-US-1106",
        "AIFACTORY-US-1107",
        "AIFACTORY-US-1108",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:component-observability-factory-conventions",
        "feature:trusted-scope-chain",
        "feature:quality-score-service-thin"
      ],
      "source": [
        "model/services/observability/ObservabilityHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-084]",
      "number": 84
    },
    {
      "id": "AIFACTORY-TASK-469",
      "type": "task",
      "parent": "AIFACTORY-US-084",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ObservabilityHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "13.02.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ObservabilityHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ObservabilityHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ObservabilityHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ObservabilityHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-469]",
      "number": 469
    },
    {
      "id": "AIFACTORY-TASK-4395",
      "type": "task",
      "parent": "AIFACTORY-US-084",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "13.02.01.02",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest states the replica range 2 to 8, the ports https 8100 and grpc 8102 and leaves out the silo port 12100 and the gateway port 31100 that the model also declares, because the Platform gateway role has no actor model, a correction of the model reported with this feature; it states the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/observability/ObservabilityHost.yaml records them; it sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "The deployment manifest states the replica range 2 to 8, the ports https 8100 and grpc 8102 and leaves out the silo port 12100 and the gateway port 31100 that the model also declares, because the Platform gateway role has no actor model, a correction of the model reported with this feature; it states the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/observability/ObservabilityHost.yaml records them; it sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, holds no secret and binds the shared cache as its only store; the same image runs in the saas-default, hybrid, on-prem and hybrid-compute topologies."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11101,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-4395]",
      "number": 4395
    },
    {
      "id": "AIFACTORY-TASK-771",
      "type": "task",
      "parent": "AIFACTORY-US-084",
      "title": "Verify observability-host-routes-its-platform by running the declared command",
      "sequence": "13.02.01.03",
      "description": "Verify observability-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-084, AC4 through the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances behind one test balancer with the fakes of the fronted services, probes ObservabilityHost/ObservabilityHealth on both, stops one and asserts that the other keeps serving and nothing is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-084, AC4 through the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances behind one test balancer with the fakes of the fronted services, probes ObservabilityHost/ObservabilityHealth on both, stops one and asserts that the other keeps serving and nothing is replayed."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-771]",
      "number": 771
    },
    {
      "id": "AIFACTORY-US-1104",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-066",
      "title": "Observability fronts file: named clients and REST and gRPC routes of the five fronted services, generated at build",
      "sequence": "13.02.02",
      "description": "As a platform admin, I want the route table of the observability gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers and named clients, not a reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` a build-time generator reads a fronts file and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Observability platform from the `apis` sections of the five service files. For AlertRuleService these are `ListAlerts` and `ListAlertRules` (read) and `AcknowledgeAlert`, `ResolveAlert` and `SetAlertRule` (shared-write). For DashboardService these are `ListRunProjections`, `GetRunTimeline`, `GetOverview` and `GetSubjectOverview` (read), `RebuildRunProjection` (shared-write) and the gRPC server stream `Operations.Subscribe`. For FeedbackService these are `ListFeedback`, `ListDatasets` and `ListLearningProposals` (read), `RecordFeedback`, `SnapshotDataset` and `DecideLearningProposal` (shared-write) and the gRPC method `Learning.GetDatasetSnapshot`. For QualityScoreService these are `ListEvaluationSuites`, `GetEvaluation` and `ListReleaseEvaluations` (read), `StartEvaluation` (sandbox), `WaiveEvaluation` (publication) and the gRPC methods `Evaluation.GetVerdict` and `Evaluation.RunSuite`. For SloService these are `ListSlos` and `ListServiceHealth` (read) and `SetSlo` (shared-write). That is twenty-four REST routes and four gRPC routes; `Operations.Subscribe` is a server stream and the other three are unary. Each route carries the scope, side-effect class and idempotency of its operation, which the route class PBIs of this feature enforce. No operation of the five service files names a project in its path; each route is forwarded under the tenant of the token and the fronted service applies its project rule from the role claims of the forwarded token. A test lists the emitted route table against the file and against the five service files, so an operation without a route, a route without an operation or a name used twice fails the build with the entry named. A path no route matches is answered 404. The gateway adds no operation of its own beyond `ObservabilityHealth` and `ObservabilityBackends`, transforms no payload and composes no response from two services. The option `Observability:Host:FrontedServices` is compared at startup with the service names of the fronts file, and a difference fails startup with the name. Its default in the model, `[dashboards, slos, alerts, evaluation, feedback]`, names short names and not the service identifiers of `deployment.fronts`, which the governance gateway rule of D127 requires, so a correction of the default to the five identifiers is reported with this feature, and until it is made the deployment manifest sets the option to the five identifiers. The pipeline publishes the OpenAPI document of the twenty-four public REST operations, checked against the fronts file and the service files. The typed client of this gateway belongs to this feature (D140): one library in the repository `ConnectSoft.AI.SoftwareFactory.Clients`, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the user-token layout from that published document, by the rules of feature `typed-gateway-clients` (AIFACTORY-US-381 to AIFACTORY-US-383), which it applies and does not repeat. It holds the twenty-four public REST operations and no internal gRPC method, because the routes exist from I3 and begin to serve as the fronted services appear in I4 without a change of the gateway or of the client; until then a call returns the answer of the route, the unknown-route 404 of the thin QualityScoreService or the 503 of a service that is not deployed, as a typed error. It is checked against the model by the contract check of that feature, takes the shared types from the pinned contracts package, attaches the token issued for this gateway only to requests to the base address of this gateway, is versioned with the contracts package, published to the ConnectSoft feed and recorded on the Runbook page with the consumer that pins it. No workload layout is generated, because no public REST operation of this gateway admits a workload token. The caller of the package is StudioBff, which holds a user token and pins it in its own repository for the operations, SLO, alert, evaluation and feedback views and the search of alerts (AIFACTORY-US-1363, AIFACTORY-US-037); no caller writes a client of this gateway by hand. Kind: enabling. Traces: services: ObservabilityHost, AlertRuleService, DashboardService, FeedbackService, QualityScoreService, SloService; adrs: ADR-0015, ADR-0028; requirements: FR-10. Depends on: feature:component-api-gateway-template, feature:quality-score-service-thin, feature:typed-gateway-clients, feature:component-api-library-template-factory-clients. Sources: model/services/observability/ObservabilityHost.yaml, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, model/services/observability/AlertRuleService.yaml, model/services/observability/DashboardService.yaml, model/services/observability/FeedbackService.yaml, model/services/observability/QualityScoreService.yaml, model/services/observability/SloService.yaml, docs/architecture/catalogs/gateways.md, docs/architecture/api-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Observability platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per operation, twenty-four REST routes and four gRPC routes, each with the scope, side-effect class, idempotency and streaming mode of the operation, and the route table test passes against model/services/observability/ObservabilityHost.yaml and the five service files under model/services/observability (ADR-0028).",
        "AC2: Given an operation removed from the file or a name used twice, when the gateway builds, then the build fails with the entry named; given `Observability:Host:FrontedServices` set to the five service identifiers, when the gateway starts, then startup succeeds, and a value that names no service of the file or omits one fails startup with the name; given a path no route matches, then the answer is 404 and no fronted service is called (docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one route per service is called with a valid token, then the call reaches the fake with the token of the caller unchanged, the tenant of the token, the correlation id and the trace context, a project header of the caller has been dropped, and the response of the fake returns unchanged; the published OpenAPI document holds exactly the twenty-four REST operations and no gRPC method (ADR-0015, docs/architecture/api-governance.md).",
        "AC4: Given the published OpenAPI document and the pinned API library template, when the client of this gateway is generated, built and published in the repository ConnectSoft.AI.SoftwareFactory.Clients, then it holds the twenty-four public REST operations in the user-token layout and no internal gRPC method, the contract check against the five service files under model/services/observability passes, the token issued for ObservabilityHost is attached only to requests to its base address, a 404 or a 503 of a route surfaces as a typed error, and the package is on the ConnectSoft feed with a version tied to the contracts package and recorded on the Runbook page with StudioBff as its consumer (model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/observability/AlertRuleService.yaml",
        "model/services/observability/DashboardService.yaml",
        "model/services/observability/FeedbackService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "model/services/observability/SloService.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-470",
        "AIFACTORY-TASK-4396",
        "AIFACTORY-TASK-4397",
        "AIFACTORY-TASK-6603",
        "AIFACTORY-TASK-4398"
      ],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11102,
      "kind": "enabling",
      "traces": {
        "services": [
          "ObservabilityHost",
          "AlertRuleService",
          "DashboardService",
          "FeedbackService",
          "QualityScoreService",
          "SloService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:quality-score-service-thin",
        "feature:typed-gateway-clients",
        "feature:component-api-library-template-factory-clients"
      ],
      "source": [
        "model/services/observability/ObservabilityHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "model/services/observability/AlertRuleService.yaml",
        "model/services/observability/DashboardService.yaml",
        "model/services/observability/FeedbackService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "model/services/observability/SloService.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1104]",
      "number": 1104
    },
    {
      "id": "AIFACTORY-TASK-470",
      "type": "task",
      "parent": "AIFACTORY-US-1104",
      "title": "Fronts file with the REST and gRPC operations of AlertRuleService, DashboardService, FeedbackService, QualityScoreService and SloService",
      "sequence": "13.02.02.01",
      "description": "Fronts file with the REST and gRPC operations of AlertRuleService, DashboardService, FeedbackService, QualityScoreService and SloService. Expected output: The fronts file lists the five services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; the build emits the named clients, the twenty-four REST routes, the four gRPC routes and the route table; at startup Observability:Host:FrontedServices is compared with the service names of the file and a difference fails startup with the name; a project header of a caller is dropped on every route; a call without a valid token or scope is refused by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the five services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency; the build emits the named clients, the twenty-four REST routes, the four gRPC routes and the route table; at startup Observability:Host:FrontedServices is compared with the service names of the file and a difference fails startup with the name; a project header of a caller is dropped on every route; a call without a valid token or scope is refused by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-470]",
      "number": 470
    },
    {
      "id": "AIFACTORY-TASK-4396",
      "type": "task",
      "parent": "AIFACTORY-US-1104",
      "title": "Fakes of the five fronted services and the token matrix of the acceptance suite",
      "sequence": "13.02.02.02",
      "description": "Fakes of the five fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and serves the server stream of Operations.Subscribe, a switch that makes a fake stop answering, also in the middle of a stream, and tokens for the matrix of role, tenant and project, including an expired token, a user token of another audience and a workload token with and without the service scope of a gRPC route.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds one fake per fronted service, generated from its fronts entry, that records the headers and metadata it received, answers a configured status and serves the server stream of Operations.Subscribe, a switch that makes a fake stop answering, also in the middle of a stream, and tokens for the matrix of role, tenant and project, including an expired token, a user token of another audience and a workload token with and without the service scope of a gRPC route."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4396]",
      "number": 4396
    },
    {
      "id": "AIFACTORY-TASK-4397",
      "type": "task",
      "parent": "AIFACTORY-US-1104",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "13.02.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the twenty-four public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes and no gRPC method; a contract check compares it with the five service files under model/services/observability and fails the build on a difference; the document is the input of the client of AIFACTORY-TASK-6603, and no client package is built in this repository.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the twenty-four public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes and no gRPC method; a contract check compares it with the five service files under model/services/observability and fails the build on a difference; the document is the input of the client of AIFACTORY-TASK-6603, and no client package is built in this repository."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11102,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4397]",
      "number": 4397
    },
    {
      "id": "AIFACTORY-TASK-6603",
      "type": "task",
      "parent": "AIFACTORY-US-1104",
      "title": "Typed client of ObservabilityHost in the user-token layout, generated from the published document and published to the ConnectSoft feed",
      "sequence": "13.02.02.04",
      "description": "Typed client of ObservabilityHost in the user-token layout, generated from the published document and published to the ConnectSoft feed. Expected output: One client library in the repository ConnectSoft.AI.SoftwareFactory.Clients, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template from the OpenAPI document of AIFACTORY-TASK-4397, holds the twenty-four public REST operations of AlertRuleService, DashboardService, FeedbackService, QualityScoreService and SloService and no internal gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; the contract check of AIFACTORY-TASK-1556 covers its document; a stub of the gateway in the fixture of the client solution answers 401, 403, 404, 503 and a redirect to a second host, a 404 and a 503 surface as typed errors, and the token issued for ObservabilityHost is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with StudioBff as the consumer that pins it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One client library in the repository ConnectSoft.AI.SoftwareFactory.Clients, generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` in the JWT bearer layout of the template from the OpenAPI document of AIFACTORY-TASK-4397, holds the twenty-four public REST operations of AlertRuleService, DashboardService, FeedbackService, QualityScoreService and SloService and no internal gRPC method, takes the shared types from the pinned contracts package and declares no handler, header name or claim name of its own; the contract check of AIFACTORY-TASK-1556 covers its document; a stub of the gateway in the fixture of the client solution answers 401, 403, 404, 503 and a redirect to a second host, a 404 and a 503 surface as typed errors, and the token issued for ObservabilityHost is attached only to requests to its base address; the package is versioned with the contracts package, published to the ConnectSoft feed by the generated pipeline after its tests pass and restored by the probe consumer from the feed alone; the Runbook page records its version with StudioBff as the consumer that pins it."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6603]",
      "number": 6603
    },
    {
      "id": "AIFACTORY-TASK-4398",
      "type": "task",
      "parent": "AIFACTORY-US-1104",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "13.02.02.05",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1104: one route per operation of the five service files under model/services/observability, the failing builds and startups, the 404 of an unknown path, one forwarded call per service with the dropped project header, and the contract check of the OpenAPI document; AC4 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6603.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1104: one route per operation of the five service files under model/services/observability, the failing builds and startups, the 404 of an unknown path, one forwarded call per service with the dropped project header, and the contract check of the OpenAPI document; AC4 is proven in the pipeline of ConnectSoft.AI.SoftwareFactory.Clients by the build, the tests and the probe stage of AIFACTORY-TASK-6603."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4398]",
      "number": 4398
    },
    {
      "id": "AIFACTORY-US-1105",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-066",
      "title": "A read route of the observability gateway forwards a call only under a validated token, the tenant of the token and the scope of its operation",
      "sequence": "13.02.03",
      "description": "As an observer, I want my read calls to reach the alert, dashboard, feedback, evaluation and objective services only with the tenant and the scope my token grants, so that I see the runs, alerts, objectives, evaluations and feedback I am entitled to and nobody reads across a tenant through the gateway. A person reaches the read operations of the Observability platform through StudioBff and the gateway: run projections and timelines, overviews, alerts and alert rules, objectives and service health, evaluation suites, evaluations and the evaluations of a release, feedback, datasets and learning proposals. The gateway validates issuer, signature, lifetime and audience of the user token and requires the scope the operation names: `factory.runs.read` for `ListRunProjections` and `GetRunTimeline`, `factory.operations.read` for `GetOverview`, `GetSubjectOverview`, `ListAlerts`, `ListAlertRules`, `ListSlos` and `ListServiceHealth`, `factory.evaluation.read` for `ListEvaluationSuites`, `GetEvaluation`, `ListReleaseEvaluations`, `ListDatasets` and `ListLearningProposals`, and `factory.feedback.read` for `ListFeedback`. It takes the tenant from the `tid` claim, overwrites any tenant header of the caller, drops a project header of the caller, and forwards the user token unchanged with the correlation id and the trace context (ADR-0015 amendment D117). Every public REST operation names a `factory.` scope, so a workload token on a REST route is answered 403. The fronted service answers 403 for a missing role and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. The internal gRPC surface has three read methods, `Operations.Subscribe` of DashboardService, a server stream that StudioRealtimeGateway holds open, `Evaluation.GetVerdict` of QualityScoreService, a read for internal callers that the Published gate of AgentRegistryService does not call, since the gate checks the evidence the registry recorded from EvaluationCompleted (D141), and `Learning.GetDatasetSnapshot` of FeedbackService. A workload token carries service scopes and no tenant claim; the gateway forwards the `tenant-id` and project metadata of a workload whose token holds the service scope that names the fronted service (D114), and answers PERMISSION_DENIED to a workload without it and to a user token. The stream is passed through as messages arrive, nothing is buffered or cached, and when the service fails in the middle of a stream the stream ends with UNAVAILABLE and nothing is replayed. Each read is served by the fronted service with no side effect, the gateway keeps nothing of the call and records `connectsoft.factory.observability.host.requests` and `connectsoft.factory.observability.host.request_duration` for the route. A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a token without the scope 403, and no fronted service is called. In this increment the read routes follow the rule of AIFACTORY-US-084: the routes of the thin QualityScoreService, which is deployed and hosts no operation before I4, return its unknown-route 404 unchanged (AIFACTORY-US-1089), and the routes of the four services not yet deployed answer 503 with a retry hint that names the service. Kind: behavior. Traces: services: ObservabilityHost, AlertRuleService, DashboardService, FeedbackService, QualityScoreService, SloService; adrs: ADR-0015, ADR-0028; requirements: FUX-04, FUX-10, NFR-11; scenarios: SCN-ObservabilityHost-004. Relates: screens: evaluation-runs, release-evidence, status-objectives, alerts, feedback. Depends on: AIFACTORY-US-1104, feature:quality-score-service-thin, feature:trusted-scope-chain. Sources: model/services/observability/ObservabilityHost.yaml, docs/planes/trust-operations/observability/services/observability-host/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway with `factory.evaluation.read`, when the read route of `GetEvaluation` of QualityScoreService is called, then the gateway forwards the call with the user token unchanged, the tenant of the `tid` claim, the correlation id and the trace context, the fake of QualityScoreService answers, and the response returns unchanged with the correlation id; the 404 of the service for an evaluation of another tenant returns unchanged (SCN-ObservabilityHost-004, model/services/observability/QualityScoreService.yaml).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes of the fronted services are called, then a call without a token, with an expired token or with a user token for another gateway is answered 401, a token without the scope and a workload token on a REST route are answered 403, a tenant header of the caller is overwritten and a project header dropped, and in no refusal a fronted service is called (SCN-ObservabilityHost-004, ADR-0015).",
        "AC3: Given a workload token that holds the service scope naming the fronted service, when `Evaluation.GetVerdict` of QualityScoreService and the server stream of `Operations.Subscribe` of DashboardService are called with `tenant-id` metadata, then the metadata is forwarded unchanged and the stream is passed through without buffering; given a workload token without the scope or a user token, then the answer is PERMISSION_DENIED and no service is called; given the fake stopping in the middle of the stream, then the stream ends with UNAVAILABLE and is not replayed (SCN-ObservabilityHost-004, model/services/observability/QualityScoreService.yaml).",
        "AC4: Given a fronted service that does not answer or is not deployed, when its read routes are called, then the answer is 503, over gRPC UNAVAILABLE, with a retry hint that names the service and never its address, no response is invented, and the read routes of the other services keep serving; given the thin QualityScoreService of I3, deployed and hosting no operation, when the read route of `ListEvaluationSuites` is called, then its unknown-route 404 returns unchanged and is not turned into 503 (SCN-ObservabilityHost-004, model/services/observability/ObservabilityHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4399",
        "AIFACTORY-TASK-4400"
      ],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11103,
      "kind": "behavior",
      "traces": {
        "services": [
          "ObservabilityHost",
          "AlertRuleService",
          "DashboardService",
          "FeedbackService",
          "QualityScoreService",
          "SloService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-04",
          "FUX-10",
          "NFR-11"
        ],
        "scenarios": [
          "SCN-ObservabilityHost-004"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs",
          "release-evidence",
          "status-objectives",
          "alerts",
          "feedback"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1104",
        "feature:quality-score-service-thin",
        "feature:trusted-scope-chain"
      ],
      "source": [
        "model/services/observability/ObservabilityHost.yaml",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1105]",
      "number": 1105
    },
    {
      "id": "AIFACTORY-TASK-4399",
      "type": "task",
      "parent": "AIFACTORY-US-1105",
      "title": "Read routes with token, tenant and scope checks and the pass-through of the server stream",
      "sequence": "13.02.03.01",
      "description": "Read routes with token, tenant and scope checks and the pass-through of the server stream. Expected output: The fourteen REST read routes require the scope of their operation, take the tenant from the tid claim, drop a project header of the caller, forward the user token unchanged and refuse a workload token with 403; the three gRPC read routes forward the tenant-id and project metadata of a workload whose token holds the service scope naming the fronted service and answer PERMISSION_DENIED otherwise; Operations.Subscribe is passed through without buffering; an absent or failing service answers 503 or UNAVAILABLE with a retry hint naming it, while the not-found answer of a deployed service that does not host the operation returns unchanged.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "The fourteen REST read routes require the scope of their operation, take the tenant from the tid claim, drop a project header of the caller, forward the user token unchanged and refuse a workload token with 403; the three gRPC read routes forward the tenant-id and project metadata of a workload whose token holds the service scope naming the fronted service and answer PERMISSION_DENIED otherwise; Operations.Subscribe is passed through without buffering; an absent or failing service answers 503 or UNAVAILABLE with a retry hint naming it, while the not-found answer of a deployed service that does not host the operation returns unchanged."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4399]",
      "number": 4399
    },
    {
      "id": "AIFACTORY-TASK-4400",
      "type": "task",
      "parent": "AIFACTORY-US-1105",
      "title": "Verify the read route class through the acceptance suite",
      "sequence": "13.02.03.02",
      "description": "Verify the read route class through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ObservabilityHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1105 against the fakes of the five services: the forwarded read and its unchanged 404, the token matrix refusals without a call, the gRPC metadata and stream pass-through with PERMISSION_DENIED and the interrupted stream, the 503 of an absent service while the others serve, and the unknown-route 404 of the thin QualityScoreService returned unchanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ObservabilityHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1105 against the fakes of the five services: the forwarded read and its unchanged 404, the token matrix refusals without a call, the gRPC metadata and stream pass-through with PERMISSION_DENIED and the interrupted stream, the 503 of an absent service while the others serve, and the unknown-route 404 of the thin QualityScoreService returned unchanged."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4400]",
      "number": 4400
    },
    {
      "id": "AIFACTORY-US-1106",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-066",
      "title": "A shared-write route of the observability gateway passes the call and its idempotency key through unchanged",
      "sequence": "13.02.04",
      "description": "As an operator, I want my acknowledgements, resolutions, rule and objective changes, rebuilds, feedback, snapshots and proposal decisions to reach their service once, so that a retry after a lost answer never applies a change twice and the gateway never decides what the change means. The platform has eight shared-write operations: `AcknowledgeAlert`, `ResolveAlert` and `SetAlertRule` of AlertRuleService, `RebuildRunProjection` of DashboardService, `RecordFeedback`, `SnapshotDataset` and `DecideLearningProposal` of FeedbackService, and `SetSlo` of SloService. The gateway requires the scope the operation names (`factory.operations.operate` for acknowledging and resolving alerts, `factory.operations.admin` for alert rules, objectives and rebuilds, `factory.feedback.write` for feedback, `factory.evaluation.run` for snapshots and `factory.assets.write` for proposal decisions), establishes the tenant from the token and forwards the user token unchanged. Two of the operations, `RecordFeedback` and `SnapshotDataset`, take an `Idempotency-Key` header; the gateway forwards the header unchanged, keeps no record of it and is no party to idempotency: the fronted service applies the call once and answers a repeat with the same result. The other six are idempotent by their natural key, the alert, the rule name, the run, the proposal or the objective, and the gateway adds no key. A conflict answer of the service, such as 409 for a decided proposal or a conflicting objective, and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged. The gateway never retries a shared-write call itself: when the fronted service does not answer, the route answers 503 with a retry hint naming the service, and the caller repeats the call with the same key or the same natural target. A call without a token or with an expired token is answered 401 and a token without the scope 403, and no fronted service is called. Kind: behavior. Traces: services: ObservabilityHost, AlertRuleService, DashboardService, FeedbackService, SloService; adrs: ADR-0015, ADR-0028; requirements: NFR-10; scenarios: SCN-ObservabilityHost-006. Relates: screens: alerts, status-objectives, feedback, datasets, learning-proposals. Depends on: AIFACTORY-US-1104. Sources: model/services/observability/ObservabilityHost.yaml, docs/architecture/api-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a user token with `factory.feedback.write` and an `Idempotency-Key`, when the route of `RecordFeedback` is called twice with the same key and body, then both calls reach the fake of FeedbackService with the key and the token unchanged, the gateway stores nothing, and each answer of the fake returns unchanged (SCN-ObservabilityHost-006, ADR-0015).",
        "AC2: Given the routes of `AcknowledgeAlert`, `SetSlo` and `DecideLearningProposal`, when they are called with a valid token and scope, then the call is forwarded without an added key and a 409 or a 404 of the fronted service returns unchanged; given a token without the scope of the operation, then the answer is 403 and no service is called (SCN-ObservabilityHost-006, ADR-0015).",
        "AC3: Given a fronted service that does not answer, when a shared-write route is called, then the gateway answers 503 with a retry hint naming the service, does not retry the call itself and invents no response (SCN-ObservabilityHost-006, model/services/observability/ObservabilityHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml",
        "docs/architecture/api-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4401",
        "AIFACTORY-TASK-4402"
      ],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11104,
      "kind": "behavior",
      "traces": {
        "services": [
          "ObservabilityHost",
          "AlertRuleService",
          "DashboardService",
          "FeedbackService",
          "SloService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-10"
        ],
        "scenarios": [
          "SCN-ObservabilityHost-006"
        ]
      },
      "relates": {
        "screens": [
          "alerts",
          "status-objectives",
          "feedback",
          "datasets",
          "learning-proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1104"
      ],
      "source": [
        "model/services/observability/ObservabilityHost.yaml",
        "docs/architecture/api-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1106]",
      "number": 1106
    },
    {
      "id": "AIFACTORY-TASK-4401",
      "type": "task",
      "parent": "AIFACTORY-US-1106",
      "title": "Shared-write routes with pass-through of the idempotency key",
      "sequence": "13.02.04.01",
      "description": "Shared-write routes with pass-through of the idempotency key. Expected output: The eight shared-write routes require the scope of their operation, forward the user token and an Idempotency-Key header unchanged, add no key to a naturally idempotent call, store nothing of the call, never retry it and answer 503 with a retry hint naming the service when it does not answer; conflict and not-found answers of the service return unchanged.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "The eight shared-write routes require the scope of their operation, forward the user token and an Idempotency-Key header unchanged, add no key to a naturally idempotent call, store nothing of the call, never retry it and answer 503 with a retry hint naming the service when it does not answer; conflict and not-found answers of the service return unchanged."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4401]",
      "number": 4401
    },
    {
      "id": "AIFACTORY-TASK-4402",
      "type": "task",
      "parent": "AIFACTORY-US-1106",
      "title": "Verify the shared-write route class through the acceptance suite",
      "sequence": "13.02.04.02",
      "description": "Verify the shared-write route class through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ObservabilityHost-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1106: the key passed through on both calls, the unchanged 409 and 404, the 403 without a call, and the 503 without a retry by the gateway.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-ObservabilityHost-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1106: the key passed through on both calls, the unchanged 409 and 404, the 403 without a call, and the 503 without a retry by the gateway."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4402]",
      "number": 4402
    },
    {
      "id": "AIFACTORY-US-1107",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-066",
      "title": "The sandbox and publication routes of QualityScoreService pass through the gateway while the service keeps its gate",
      "sequence": "13.02.05",
      "description": "As an asset maintainer, I want to start evaluations and have a reviewer waive a failed verdict through the gateway, so that evaluations and waivers reach the evaluation service with my scope while the approval and the evidence stay with that service. Three operations of QualityScoreService carry a side-effect class above shared-write. `StartEvaluation` (sandbox, scope `factory.evaluation.run`, `Idempotency-Key`, answers 202, 403 and 409) starts an evaluation whose tasks run as sandbox-class Factory runs in their isolated workspaces; `Evaluation.RunSuite` (sandbox, internal gRPC) lets an internal caller start a suite with `release-manifest-v1` and receive `ack-v1`; `WaiveEvaluation` (publication, scope `factory.evaluation.waive`, answers 200, 403, 404, 409 and 412) records the waiver of a failed verdict by a Reviewer who is not the author, under an approval of class publication bound to the evaluation. The gateway admits each call only with the scope of the operation and forwards it with the user token unchanged, or with the `tenant-id` metadata of a workload whose token holds the service scope naming QualityScoreService (D114) for `Evaluation.RunSuite`. The gateway holds no approval reference, checks no approval and is no party to idempotency: the approval gate, the author rule and the evidence are decided by QualityScoreService, and its 412 for a missing approval, its 409 for a decided or running evaluation and its 404 for an evaluation of another tenant (ADR-0015 amendment D113) return unchanged. The gateway never retries such a call; when the service does not answer, the route answers 503 or UNAVAILABLE with a retry hint naming the service. A call without a token or with an expired token is answered 401, a token without the scope 403, a user token on the gRPC route PERMISSION_DENIED, and no service is called. Until the complete delivery of QualityScoreService in I4, the thin delivery is deployed and hosts none of the three operations, so by the rule of AIFACTORY-US-084 the routes return its unknown-route 404 (AIFACTORY-US-1089) unchanged and never 503; only when QualityScoreService is not deployed or does not answer is the answer 503 or UNAVAILABLE. Kind: behavior. Traces: services: ObservabilityHost, QualityScoreService; descriptors: release-manifest-v1, ack-v1; adrs: ADR-0015, ADR-0021, ADR-0028; requirements: FR-10; scenarios: SCN-ObservabilityHost-003, SCN-ObservabilityHost-005. Relates: screens: evaluation-runs, release-evidence. Depends on: AIFACTORY-US-1104, feature:quality-score-service-thin. Sources: model/services/observability/ObservabilityHost.yaml, model/services/observability/QualityScoreService.yaml, docs/architecture/quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given a user token with `factory.evaluation.run` and an `Idempotency-Key`, when the route of `StartEvaluation` of QualityScoreService is called, then the call is forwarded with the token and the key unchanged, the 202 or the 409 of the service returns unchanged and the gateway stores nothing; given a workload token holding the service scope naming QualityScoreService, when `Evaluation.RunSuite` is called, then it is forwarded with its tenant metadata and the `ack-v1` reply returns unchanged; a user token on that route gets PERMISSION_DENIED (SCN-ObservabilityHost-005, model/services/observability/QualityScoreService.yaml).",
        "AC2: Given a user token with `factory.evaluation.waive`, when the route of `WaiveEvaluation` of QualityScoreService is called, then the gateway forwards it without an approval reference of its own, and the 200, 412, 409 or 404 of the service returns unchanged; given a token without the scope, then the answer is 403 and no service is called (SCN-ObservabilityHost-003, ADR-0015).",
        "AC3: Given QualityScoreService not answering, when a sandbox or publication route is called, then the answer is 503 or UNAVAILABLE with a retry hint naming the service, the gateway does not retry and invents no response; given the thin QualityScoreService of I3, deployed and hosting none of the three operations, then its unknown-route 404 returns unchanged and is not turned into 503 (SCN-ObservabilityHost-003, SCN-ObservabilityHost-005, model/services/observability/ObservabilityHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4403",
        "AIFACTORY-TASK-4404"
      ],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11105,
      "kind": "behavior",
      "traces": {
        "services": [
          "ObservabilityHost",
          "QualityScoreService"
        ],
        "descriptors": [
          "release-manifest-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10"
        ],
        "scenarios": [
          "SCN-ObservabilityHost-003",
          "SCN-ObservabilityHost-005"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs",
          "release-evidence"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1104",
        "feature:quality-score-service-thin"
      ],
      "source": [
        "model/services/observability/ObservabilityHost.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1107]",
      "number": 1107
    },
    {
      "id": "AIFACTORY-TASK-4403",
      "type": "task",
      "parent": "AIFACTORY-US-1107",
      "title": "Sandbox and publication routes of QualityScoreService without a gate in the gateway",
      "sequence": "13.02.05.01",
      "description": "Sandbox and publication routes of QualityScoreService without a gate in the gateway. Expected output: The routes of StartEvaluation, Evaluation.RunSuite and WaiveEvaluation require the scope of their operation, forward the user token, the Idempotency-Key and the tenant metadata of an admitted workload unchanged, hold no approval reference, never retry and answer 503 or UNAVAILABLE with a retry hint naming the service when it does not answer; the 202, 409, 412 and 404 answers of the service, the unknown-route 404 of the thin delivery included, return unchanged.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "The routes of StartEvaluation, Evaluation.RunSuite and WaiveEvaluation require the scope of their operation, forward the user token, the Idempotency-Key and the tenant metadata of an admitted workload unchanged, hold no approval reference, never retry and answer 503 or UNAVAILABLE with a retry hint naming the service when it does not answer; the 202, 409, 412 and 404 answers of the service, the unknown-route 404 of the thin delivery included, return unchanged."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4403]",
      "number": 4403
    },
    {
      "id": "AIFACTORY-TASK-4404",
      "type": "task",
      "parent": "AIFACTORY-US-1107",
      "title": "Verify the sandbox and publication route classes through the acceptance suite",
      "sequence": "13.02.05.02",
      "description": "Verify the sandbox and publication route classes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ObservabilityHost-003|Scenario=SCN-ObservabilityHost-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1107 against the fake of QualityScoreService: the forwarded start with its key, the gRPC start with PERMISSION_DENIED for a user token, the waiver forwarded without an approval reference with the unchanged 412, 409 and 404, the 403, the 503 without a retry, and the unknown-route 404 of the thin QualityScoreService returned unchanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ObservabilityHost-003|Scenario=SCN-ObservabilityHost-005)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1107 against the fake of QualityScoreService: the forwarded start with its key, the gRPC start with PERMISSION_DENIED for a user token, the waiver forwarded without an approval reference with the unchanged 412, 409 and 404, the 403, the 503 without a retry, and the unknown-route 404 of the thin QualityScoreService returned unchanged."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4404]",
      "number": 4404
    },
    {
      "id": "AIFACTORY-US-1108",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-066",
      "title": "Health, backends metadata, rate limits and telemetry of the observability gateway with its three failure modes",
      "sequence": "13.02.06",
      "description": "As an operator, I want the gateway to report its own health and that of the services behind it, show which telemetry backends are configured, and limit the rate of calls, so that I can tell at a glance whether the platform is reachable and a noisy caller cannot starve the others. `ObservabilityHealth` (`GET /observability/health`, scope `factory.health.read`, internal, gateway role GW-01) reports liveness and readiness of the gateway with the aggregated health of the five fronted services and of the identity platform. It answers 200 while the gateway can validate tokens, also with a cached signing key while the identity platform is unreachable, in which case it reports degraded, and 503 with readiness false when no valid key remains (D117). A fronted service that does not answer is reported as degraded and does not take the gateway out of rotation. `ObservabilityBackends` (`GET /observability/meta/backends`, scope `factory.meta.read`, internal, GW-03) returns the configured OpenTelemetry backends for traces, metrics and logs and the GenAI semantic-convention version in use, from configuration and without a call to a fronted service; it answers 200, and fails fast with a problem response when the token cannot be validated: 401 for a token the gateway cannot validate, and 503 when no valid signing key remains (D117). The model lists only 200 for this operation, so the omission of 401 and 503 from its response codes is reported with this feature. Both are read-only and keep no state. Every route belongs to a rate-limit class of ADR-0018 through the pinned rate-limiting library; a call beyond the limit is answered 429, over gRPC RESOURCE_EXHAUSTED, with a retry hint, and is counted. The gateway records `connectsoft.factory.observability.host.requests` by service, route and status and `connectsoft.factory.observability.host.request_duration` by service and route, and passes the trace context to the fronted service, following the observability conventions of the Factory. The three failure modes of the model hold: when the identity platform is unreachable the gateway fails closed and cached signing keys validate already-issued tokens until they expire; when a fronted service is unavailable its routes answer 503 with a retry hint and the other routes keep serving; when a replica crashes it restarts and nothing is replayed, because the gateway holds no state. Kind: behavior. Traces: services: ObservabilityHost; apis: ObservabilityHost/ObservabilityHealth, ObservabilityHost/ObservabilityBackends; adrs: ADR-0016, ADR-0018; requirements: NFR-10, NFR-17, XL-16; scenarios: SCN-ObservabilityHost-001, SCN-ObservabilityHost-002. Depends on: AIFACTORY-US-1104, feature:component-observability-factory-conventions. Sources: model/services/observability/ObservabilityHost.yaml, docs/planes/trust-operations/observability/services/observability-host/index.md#failure-and-recovery, docs/planes/trust-operations/observability/services/observability-host/index.md#metrics-and-observability.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.health.read`, when `ObservabilityHost/ObservabilityHealth` is called with all dependencies up, then the answer is 200 with the five fronted services and the identity platform; with the identity platform unreachable and a cached key valid, then 200 degraded; with no valid key left, then 503 with readiness false; with one fronted service down, then 200 with that service degraded (SCN-ObservabilityHost-001, ADR-0016).",
        "AC2: Given a caller with `factory.meta.read`, when `ObservabilityHost/ObservabilityBackends` is called, then the answer is 200 with the configured trace, metric and log backends and the GenAI semantic-convention version and no fronted service is called; given a token the gateway cannot validate, then the call fails fast with 401 and a problem response, and given no valid signing key left, then with 503 (D117), in both cases with no state change (SCN-ObservabilityHost-002, model/services/observability/ObservabilityHost.yaml).",
        "AC3: Given a route whose rate-limit class is exceeded, when further calls arrive, then they are answered 429 or RESOURCE_EXHAUSTED with a retry hint and counted in `connectsoft.factory.observability.host.requests` with their status; every forwarded call carries the trace context and is measured in the request duration (ADR-0018, model/services/observability/ObservabilityHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#failure-and-recovery",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#metrics-and-observability"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-471",
        "AIFACTORY-TASK-4405",
        "AIFACTORY-TASK-4406"
      ],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11106,
      "kind": "behavior",
      "traces": {
        "services": [
          "ObservabilityHost"
        ],
        "apis": [
          "ObservabilityHost/ObservabilityHealth",
          "ObservabilityHost/ObservabilityBackends"
        ],
        "adrs": [
          "ADR-0016",
          "ADR-0018"
        ],
        "requirements": [
          "NFR-10",
          "NFR-17",
          "XL-16"
        ],
        "scenarios": [
          "SCN-ObservabilityHost-001",
          "SCN-ObservabilityHost-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1104",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/observability/ObservabilityHost.yaml",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#failure-and-recovery",
        "docs/planes/trust-operations/observability/services/observability-host/index.md#metrics-and-observability"
      ],
      "titlePrefix": "[AIFACTORY-US-1108]",
      "number": 1108
    },
    {
      "id": "AIFACTORY-TASK-471",
      "type": "task",
      "parent": "AIFACTORY-US-1108",
      "title": "Health, backends metadata and telemetry of the gateway",
      "sequence": "13.02.06.01",
      "description": "Health, backends metadata and telemetry of the gateway. Expected output: ObservabilityHealth aggregates the identity platform and the five fronted services and answers 200, 200 degraded or 503 by the rules of D117; ObservabilityBackends returns the configured OpenTelemetry backends and the GenAI semantic-convention version from configuration; the two modelled metrics are recorded per route and the trace context is passed to the fronted service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ObservabilityHealth aggregates the identity platform and the five fronted services and answers 200, 200 degraded or 503 by the rules of D117; ObservabilityBackends returns the configured OpenTelemetry backends and the GenAI semantic-convention version from configuration; the two modelled metrics are recorded per route and the trace context is passed to the fronted service."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-471]",
      "number": 471
    },
    {
      "id": "AIFACTORY-TASK-4405",
      "type": "task",
      "parent": "AIFACTORY-US-1108",
      "title": "Rate-limit classes of the routes and the alerts of the three failure modes",
      "sequence": "13.02.06.02",
      "description": "Rate-limit classes of the routes and the alerts of the three failure modes. Expected output: Each route of the fronts file is assigned its rate-limit class of ADR-0018 in configuration, with 429 and RESOURCE_EXHAUSTED carrying a retry hint; the operations configuration of the gateway holds alerts on token validation failures, the error rate per fronted service and the readiness probe, the detections the model names for its three failure modes.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "Each route of the fronts file is assigned its rate-limit class of ADR-0018 in configuration, with 429 and RESOURCE_EXHAUSTED carrying a retry hint; the operations configuration of the gateway holds alerts on token validation failures, the error rate per fronted service and the readiness probe, the detections the model names for its three failure modes."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11106,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-4405]",
      "number": 4405
    },
    {
      "id": "AIFACTORY-TASK-4406",
      "type": "task",
      "parent": "AIFACTORY-US-1108",
      "title": "Verify health, backends, limits and telemetry through the acceptance suite",
      "sequence": "13.02.06.03",
      "description": "Verify health, backends, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ObservabilityHost-001|Scenario=SCN-ObservabilityHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1108: the four health answers, the backends answer and its fail-fast with 401 and 503, the 429 with its count, and the trace context and duration of a forwarded call.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ObservabilityHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-ObservabilityHost-001|Scenario=SCN-ObservabilityHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1108: the four health answers, the backends answer and its fail-fast with 401 and 503, the 429 with its count, and the trace context and duration of a forwarded call."
      ],
      "sourceArtifacts": [
        "model/services/observability/ObservabilityHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ObservabilityHost"
      ],
      "children": [],
      "buildOrder": 111,
      "phase": "factory",
      "stackRank": 11106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4406]",
      "number": 4406
    },
    {
      "id": "AIFACTORY-FEAT-067",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-013",
      "title": "AlertRuleService: complete delivery",
      "sequence": "13.03",
      "description": "AlertRuleService is the service of bounded context BC-21 (Operations). Alert rules over SLO breaches, host health, uncertain tool effects, audit findings and metric conditions, with deduplication, severity, acknowledgement and routing to the Studio, chat and email connectors and, later, incidents (BC-21). Its own repository is ConnectSoft.AI.SoftwareFactory.AlertRuleService. Delivers: AlertRuleService (complete). Increment I4: Trust and accountability. Build order 130 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-087",
        "AIFACTORY-US-1116",
        "AIFACTORY-US-1117",
        "AIFACTORY-US-1118",
        "AIFACTORY-US-1119",
        "AIFACTORY-US-1120",
        "AIFACTORY-US-1121",
        "AIFACTORY-US-1122"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13000,
      "titlePrefix": "[AIFACTORY-FEAT-067]",
      "number": 67
    },
    {
      "id": "AIFACTORY-US-087",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "AlertRuleService serves its scope end to end",
      "sequence": "13.03.01",
      "description": "As an operator, I want AlertRuleService in place as the one owner of alert rules and alert instances, with deduplication, severity, acknowledgement and routing to the Studio and, later, to chat and email connectors, so that every other service reaches alert state through the contract of AlertRuleService and none keeps a copy of it. This is the integration PBI of the feature. AlertRuleService is the service of bounded context BC-21 (Operations) and the one place an operator is told that something needs them. It owns two aggregates in `alert-rule-sql`: `AlertRule`, a rule with a source kind, a condition, a severity, a deduplication key template, routes and suppression windows, and `AlertInstance`, one fired alert with its deduplication key, severity, source reference, state, acknowledgement and resolution. Callers reach its five REST operations through the route GW-03 of the gateway ObservabilityHost, which forwards the user token (D117), under the scopes `factory.operations.read`, `factory.operations.operate` and `factory.operations.admin`; every query runs under the tenant row filter, and an alert of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015, D113). The behaviour is delivered by the behaviour PBIs of this feature: rules are set and listed (AIFACTORY-US-1116), alerts fire deduplicated from the operations sources (AIFACTORY-US-1117), from metric conditions (AIFACTORY-US-1118) and from the delivery and runtime sources (AIFACTORY-US-1119), an operator lists, acknowledges and resolves them (AIFACTORY-US-1120), the Notifier delivers them (AIFACTORY-US-1121) and the retention and deletion orders of RetentionResidencyService are applied (AIFACTORY-US-1122). Every state change and its outbox record commit in one transaction and the three events leave through the outbox of the `alert-rule` messaging profile under the canonical envelope (ADR-0012, ADR-0014, ADR-0028). Of the 17 consumed events of the model, three come from producers of later increments: `DeliveryFailed` of ConnectorRegistryService arrives with feature `connector-registry-service-complete` in I5, and `IncidentOpened` of FleetIncidentService and `RolloutHalted` of FleetRolloutService arrive in I7; this feature registers no handler for them, and which feature registers them is reported to the owner. Telemetry follows the conventions of feature `component-observability-factory-conventions`, taken by the version pin of its packages and never forked. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService, created by the repository checklist of feature `repository-and-pipeline-conventions` from the base template with the Factory profile. Kind: behavior. Traces: services: AlertRuleService, ObservabilityHost; aggregates: AlertRuleService/AlertRule, AlertRuleService/AlertInstance; apis: AlertRuleService/ListAlerts, AlertRuleService/AcknowledgeAlert, AlertRuleService/ResolveAlert, AlertRuleService/ListAlertRules, AlertRuleService/SetAlertRule; events: AlertRuleService/AlertRuleChanged, AlertRuleService/AlertFired, AlertRuleService/AlertResolved; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0018, ADR-0028; requirements: FR-10, FUX-04, XL-06, XL-16. Relates: screens: alerts; nfrs: NFR-10, NFR-17. Depends on: AIFACTORY-US-1116, AIFACTORY-US-1117, AIFACTORY-US-1118, AIFACTORY-US-1119, AIFACTORY-US-1120, AIFACTORY-US-1121, AIFACTORY-US-1122, feature:observability-host, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/observability/AlertRuleService.yaml, model/scenarios/AlertRuleService.yaml, docs/planes/trust-operations/observability/services/alert-rule-service/index.md#purpose-and-responsibilities, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.AlertRuleService, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AlertRuleService --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-1116 to AIFACTORY-US-1122, when they run in the pipeline, then each of the eight scenarios of AlertRuleService has a passing test that names its id, and a filter that discovers no test counts as a failure (model/scenarios/AlertRuleService.yaml).",
        "AC3: Given alerts and rules of two tenants, when any of `AlertRuleService/ListAlerts`, `AlertRuleService/ListAlertRules`, `AlertRuleService/AcknowledgeAlert`, `AlertRuleService/ResolveAlert` or `AlertRuleService/SetAlertRule` is called by a member of one tenant, then only the rows of that tenant are read or written, and an alert of the other tenant addressed by id is answered 404, the same answer as for an id that does not exist (ADR-0015).",
        "AC4: Given the outbox and the inbox of the `alert-rule` messaging profile after the acceptance suites, when their records are read, then `AlertRuleService/AlertRuleChanged`, `AlertRuleService/AlertFired` and `AlertRuleService/AlertResolved` were each written in the transaction of the state change they announce and published under the canonical envelope, and every consumed event was handled once per event id (ADR-0012, ADR-0014).",
        "AC5: Given the service starts, when liveness and readiness are probed, then readiness reports `alert-rule-sql` and the messaging transport with the ready tag, the telemetry conformance test of the pinned observability packages passes with `connectsoft.factory.alerts.fired` tagged with tenant, source kind and severity, `connectsoft.factory.alerts.open` and `connectsoft.factory.alerts.time_to_acknowledge` tagged with tenant and severity, and `connectsoft.factory.alerts.inbox_lag` tagged with service, as model/services/observability/AlertRuleService.yaml declares, and no rule condition, source payload or receipt content appears in a metric, an activity or a log record (ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "model/scenarios/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-472",
        "AIFACTORY-TASK-473",
        "AIFACTORY-TASK-474",
        "AIFACTORY-TASK-475",
        "AIFACTORY-TASK-476",
        "AIFACTORY-TASK-477",
        "AIFACTORY-TASK-478",
        "AIFACTORY-TASK-768"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService",
          "ObservabilityHost"
        ],
        "aggregates": [
          "AlertRuleService/AlertRule",
          "AlertRuleService/AlertInstance"
        ],
        "apis": [
          "AlertRuleService/ListAlerts",
          "AlertRuleService/AcknowledgeAlert",
          "AlertRuleService/ResolveAlert",
          "AlertRuleService/ListAlertRules",
          "AlertRuleService/SetAlertRule"
        ],
        "events": [
          "AlertRuleService/AlertRuleChanged",
          "AlertRuleService/AlertFired",
          "AlertRuleService/AlertResolved"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "FUX-04",
          "XL-06",
          "XL-16"
        ]
      },
      "relates": {
        "screens": [
          "alerts"
        ],
        "nfrs": [
          "NFR-10",
          "NFR-17"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1116",
        "AIFACTORY-US-1117",
        "AIFACTORY-US-1118",
        "AIFACTORY-US-1119",
        "AIFACTORY-US-1120",
        "AIFACTORY-US-1121",
        "AIFACTORY-US-1122",
        "feature:observability-host",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "model/scenarios/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-087]",
      "number": 87
    },
    {
      "id": "AIFACTORY-TASK-472",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.AlertRuleService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "13.03.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.AlertRuleService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AlertRuleService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `alert-rule`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AlertRuleService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AlertRuleService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `alert-rule`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-472]",
      "number": 472
    },
    {
      "id": "AIFACTORY-TASK-473",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "Domain model: AlertRule, AlertInstance",
      "sequence": "13.03.01.02",
      "description": "Domain model: AlertRule, AlertInstance. Expected output: The aggregates hold the fields, the invariants and the four modelled transitions of AlertState (Fired to Acknowledged, Fired to Resolved, Acknowledged to Resolved, Fired to Suppressed); unit tests cover every invariant and every transition and refuse every transition the model does not list.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates hold the fields, the invariants and the four modelled transitions of AlertState (Fired to Acknowledged, Fired to Resolved, Acknowledged to Resolved, Fired to Suppressed); unit tests cover every invariant and every transition and refuse every transition the model does not list."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-473]",
      "number": 473
    },
    {
      "id": "AIFACTORY-TASK-474",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "Persistence in alert-rule-sql: AlertRules, AlertInstances",
      "sequence": "13.03.01.03",
      "description": "Persistence in alert-rule-sql: AlertRules, AlertInstances. Expected output: Mappings and migrations for the two modelled tables with the tenant filter, the unique index on tenant and name and the open-deduplication index; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the two modelled tables with the tenant filter, the unique index on tenant and name and the open-deduplication index; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-474]",
      "number": 474
    },
    {
      "id": "AIFACTORY-TASK-475",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "API hosting skeleton: the 5 REST operations with scope enforcement and problem responses",
      "sequence": "13.03.01.04",
      "description": "API hosting skeleton: the 5 REST operations with scope enforcement and problem responses. Expected output: ListAlerts, AcknowledgeAlert, ResolveAlert, ListAlertRules and SetAlertRule are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, problem responses for every modelled refusal code and the OpenAPI document; the behaviour of each operation is delivered by AIFACTORY-US-1116 and AIFACTORY-US-1120, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ListAlerts, AcknowledgeAlert, ResolveAlert, ListAlertRules and SetAlertRule are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, problem responses for every modelled refusal code and the OpenAPI document; the behaviour of each operation is delivered by AIFACTORY-US-1116 and AIFACTORY-US-1120, not here."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-475]",
      "number": 475
    },
    {
      "id": "AIFACTORY-TASK-476",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "Messaging skeleton: outbox and inbox of the alert-rule profile for 3 published and 14 consumed events",
      "sequence": "13.03.01.05",
      "description": "Messaging skeleton: outbox and inbox of the alert-rule profile for 3 published and 14 consumed events. Expected output: The outbox writer enlists in the transaction of each state change and the dispatcher publishes AlertRuleChanged, AlertFired and AlertResolved under the canonical envelope; the inbox registers the 14 consumed events whose producers are delivered by I4 with idempotency on the event id; DeliveryFailed, IncidentOpened and RolloutHalted are not registered; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of each state change and the dispatcher publishes AlertRuleChanged, AlertFired and AlertResolved under the canonical envelope; the inbox registers the 14 consumed events whose producers are delivered by I4 with idempotency on the event id; DeliveryFailed, IncidentOpened and RolloutHalted are not registered; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-476]",
      "number": 476
    },
    {
      "id": "AIFACTORY-TASK-477",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "Worker hosting skeleton: triggers, partitioning and retry policies of MetricRuleEvaluator and Notifier",
      "sequence": "13.03.01.06",
      "description": "Worker hosting skeleton: triggers, partitioning and retry policies of MetricRuleEvaluator and Notifier. Expected output: The two workers are hosted with their modelled triggers (a schedule every minute, the AlertFired event), retry policies, partitioning by tenant and idempotency keys (ruleId plus minute, alertId plus route), and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1118 and AIFACTORY-US-1121.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two workers are hosted with their modelled triggers (a schedule every minute, the AlertFired event), retry policies, partitioning by tenant and idempotency keys (ruleId plus minute, alertId plus route), and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1118 and AIFACTORY-US-1121."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-477]",
      "number": 477
    },
    {
      "id": "AIFACTORY-TASK-478",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "Security, tenancy and telemetry of AlertRuleService",
      "sequence": "13.03.01.07",
      "description": "Security, tenancy and telemetry of AlertRuleService. Expected output: The three scopes and four roles of the model are enforced, every query is tenant-filtered, 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 four modelled metrics through its instrument helper and references the conformance test package from its architecture tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three scopes and four roles of the model are enforced, every query is tenant-filtered, 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 four modelled metrics through its instrument helper and references the conformance test package from its architecture tests."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-478]",
      "number": 478
    },
    {
      "id": "AIFACTORY-TASK-768",
      "type": "task",
      "parent": "AIFACTORY-US-087",
      "title": "Verify alert-rule-service-serves-its-scope by running the declared command",
      "sequence": "13.03.01.08",
      "description": "Verify alert-rule-service-serves-its-scope by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.AlertRuleService, then `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-AlertRuleService\"`; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-087, with a test for each of SCN-AlertRuleService-001 to SCN-AlertRuleService-008.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of ConnectSoft.AI.SoftwareFactory.AlertRuleService, then `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-AlertRuleService\"`; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-087, with a test for each of SCN-AlertRuleService-001 to SCN-AlertRuleService-008."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-768]",
      "number": 768
    },
    {
      "id": "AIFACTORY-US-1116",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "Set a tenant alert rule with its routes and list the rules in scope",
      "sequence": "13.03.02",
      "description": "As a workspace admin, I want to create, change and deactivate the alert rules of my tenant and see every rule that applies to it, so that the alerts my operators receive follow rules I can read and change, beside the platform rules that are always on. A Workspace admin or a Platform admin whose scope carries `factory.operations.admin` creates or changes a rule of the trusted tenant through `AlertRuleService/SetAlertRule`, a PUT on `/factory/alert-rules/{name}`. The body carries the source kind (`AlertSourceKind`), the condition, an event filter or a metric threshold with a duration, the severity (`AlertSeverity`), the deduplication key template, the routes and the optional suppression windows, and whether the rule is active. The rule is addressed by its name within the tenant of the token, which the unique index on tenant and name enforces, so a PUT never reaches a rule of another tenant: the same name in another tenant is another rule. A new name creates the rule, a known name changes it, and a body that sets `active` false deactivates it; each of these writes the `AlertRule` and its `AlertRuleChanged` outbox record with `ruleId`, `tenantId`, `name` and `active` in one transaction and answers 200. The operation is naturally idempotent: a repeat with the same body changes nothing and publishes nothing. Two invariants of the model refuse a write: a route to an external channel names a connector of the Integration platform with the tenant connection and never a raw webhook, and the platform rules for host health, chain validity and uncertain effects stay active and cannot be deleted per tenant. The model lists only 200 and 403 for this operation, so the status of these two refusals is reported to the owner; they write nothing and publish nothing. A caller without the scope is refused with 403. A caller whose scope carries `factory.operations.read` lists the rules of its tenant through `AlertRuleService/ListAlertRules`, read under the tenant row filter; a caller without the scope is refused with 403. StudioBff and AuditService consume `AlertRuleChanged` in their own PBIs. Kind: behavior. Traces: services: AlertRuleService; aggregates: AlertRuleService/AlertRule; apis: AlertRuleService/SetAlertRule, AlertRuleService/ListAlertRules; events: AlertRuleService/AlertRuleChanged; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-10, FUX-04; scenarios: SCN-AlertRuleService-004, SCN-AlertRuleService-005, SCN-AlertRuleService-006. Relates: screens: alerts. Sources: model/services/observability/AlertRuleService.yaml, docs/planes/trust-operations/observability/services/alert-rule-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.operations.admin` and a valid rule body for a name unknown in the trusted tenant, when `AlertRuleService/SetAlertRule` is called, then the response is 200, one `AlertRuleService/AlertRule` row exists for the tenant and the name with the source kind, condition, severity, deduplication key template, routes and suppression of the body, and the `AlertRuleService/AlertRuleChanged` outbox record is written in the same transaction; a second call with a changed severity changes the row and writes a second record, a call with `active` false deactivates it, and a repeat of the same body changes nothing and writes no record (SCN-AlertRuleService-005).",
        "AC2: Given a caller without `factory.operations.admin`, or a body with a route to an external channel that names no connector, or a body that deactivates a platform rule, when `AlertRuleService/SetAlertRule` is called, then the first is refused with 403 and the other two with a problem response, and in each case no row is written and nothing is published; given a rule with the same name in another tenant, then the call of the first tenant creates its own rule and leaves the other untouched (SCN-AlertRuleService-005, ADR-0015).",
        "AC3: Given rules of two tenants, when `AlertRuleService/ListAlertRules` is called with `factory.operations.read`, then the response is 200 with the rules of the trusted tenant only, each with name, source kind, severity, routes and whether it is active, and nothing is written; a caller without the scope is refused with 403 (SCN-AlertRuleService-004, ADR-0015).",
        "AC4: Given a rule was created, changed or deactivated, when the outbox dispatcher publishes `AlertRuleService/AlertRuleChanged` on `operations.alerts.v1.alert-rule-changed`, then the event is sent under the canonical envelope with `ruleId`, `tenantId`, `name` and `active`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AlertRuleService-006, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4471",
        "AIFACTORY-TASK-4472",
        "AIFACTORY-TASK-4473"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13002,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService"
        ],
        "aggregates": [
          "AlertRuleService/AlertRule"
        ],
        "apis": [
          "AlertRuleService/SetAlertRule",
          "AlertRuleService/ListAlertRules"
        ],
        "events": [
          "AlertRuleService/AlertRuleChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "FUX-04"
        ],
        "scenarios": [
          "SCN-AlertRuleService-004",
          "SCN-AlertRuleService-005",
          "SCN-AlertRuleService-006"
        ]
      },
      "relates": {
        "screens": [
          "alerts"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1116]",
      "number": 1116
    },
    {
      "id": "AIFACTORY-TASK-4471",
      "type": "task",
      "parent": "AIFACTORY-US-1116",
      "title": "SetAlertRule and ListAlertRules with the rule invariants and the AlertRuleChanged outbox record",
      "sequence": "13.03.02.01",
      "description": "SetAlertRule and ListAlertRules with the rule invariants and the AlertRuleChanged outbox record. Expected output: SetAlertRule creates, changes or deactivates the rule of the trusted tenant addressed by name, writes the AlertRule and its AlertRuleChanged outbox record in one transaction, changes and publishes nothing on a repeat of the same body, refuses a route to an external channel that names no connector and the deactivation of a platform rule with a problem response, and answers 403 without the scope; ListAlertRules returns the rules of the tenant under the row filter and answers 403 without the scope.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "SetAlertRule creates, changes or deactivates the rule of the trusted tenant addressed by name, writes the AlertRule and its AlertRuleChanged outbox record in one transaction, changes and publishes nothing on a repeat of the same body, refuses a route to an external channel that names no connector and the deactivation of a platform rule with a problem response, and answers 403 without the scope; ListAlertRules returns the rules of the tenant under the row filter and answers 403 without the scope."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4471]",
      "number": 4471
    },
    {
      "id": "AIFACTORY-TASK-4472",
      "type": "task",
      "parent": "AIFACTORY-US-1116",
      "title": "Contract of the rule body and of the AlertRuleChanged event",
      "sequence": "13.03.02.02",
      "description": "Contract of the rule body and of the AlertRuleChanged event. Expected output: The OpenAPI document describes the rule body of SetAlertRule and the rule list of ListAlertRules with the AlertSourceKind and AlertSeverity values of model/services/observability/AlertRuleService.yaml, and the contracts package carries AlertRuleChanged with ruleId, tenantId, name and active on its modelled topic.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "The OpenAPI document describes the rule body of SetAlertRule and the rule list of ListAlertRules with the AlertSourceKind and AlertSeverity values of model/services/observability/AlertRuleService.yaml, and the contracts package carries AlertRuleChanged with ruleId, tenantId, name and active on its modelled topic."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13002,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4472]",
      "number": 4472
    },
    {
      "id": "AIFACTORY-TASK-4473",
      "type": "task",
      "parent": "AIFACTORY-US-1116",
      "title": "Verify alert-rules-set-and-listed through the acceptance suite",
      "sequence": "13.03.02.03",
      "description": "Verify alert-rules-set-and-listed through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AlertRuleService-004|Scenario=SCN-AlertRuleService-005|Scenario=SCN-AlertRuleService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1116 over a two-tenant fixture, including the repeat that publishes nothing, the two invariant refusals and the payload of AlertRuleChanged; consumer handling is proven by the suites of StudioBff and AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AlertRuleService-004|Scenario=SCN-AlertRuleService-005|Scenario=SCN-AlertRuleService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1116 over a two-tenant fixture, including the repeat that publishes nothing, the two invariant refusals and the payload of AlertRuleChanged; consumer handling is proven by the suites of StudioBff and AuditService."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4473]",
      "number": 4473
    },
    {
      "id": "AIFACTORY-US-1117",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "Fire one deduplicated alert from an SLO breach, a health change, an uncertain tool effect or an audit finding, and resolve it on recovery",
      "sequence": "13.03.03",
      "description": "As an operator, I want one alert per problem, however often its source reports it, and the alert closed when the source recovers, so that I am told once that something needs me and the list of open alerts shows what is still wrong. Five inbox handlers turn the events of the operations sources into alert instances, each idempotent on the event id. `FireFromSlo` handles `SloBreached` of SloService (a breach or a fast burn), `FireFromHealth` handles `ServiceHealthChanged` of SloService (a host degradation), `FireFromUncertain` handles `ToolEffectUncertain` of ToolAdapterService (an effect that needs an operator), and `FireFromFinding` handles `FindingRaised` of AuditService (findings of severity High and Critical). Each handler selects the active rules of the tenant of the event whose source kind and condition match it, the platform rules among them, computes the deduplication key from the key template of the rule and the event, and keeps the source reference: the SLO id, the host id, the invocation id or the finding id. When no instance with that key is Fired or Acknowledged, it writes a new `AlertInstance` in state Fired with the severity of the rule and `firedAt`, and writes `AlertFired` with `alertId`, `tenantId`, `ruleId`, `severity`, `sourceRef` and `dedupKey` in the same transaction; when one is open, it fires nothing and counts the occurrence on it (the invariant of the model, whose occurrence count has no field in the model and is reported as a correction). Within the suppression after a resolution, `Observability:Alerts:DefaultSuppressionMinutes` unless the rule names its own, an event for the same key opens no instance; a Fired instance whose rule enters a suppression window moves to Suppressed through the trigger `SuppressionWindow` and is not delivered. Resolution is automatic on the recovery event of the source: `ResolveFromSlo` handles `SloRecovered` and moves the open instance of that SLO from Fired or Acknowledged to Resolved through `SourceRecovered` or `SourceRecoveredOrManual`, sets `resolvedAt` and writes `AlertResolved` without `resolvedBy`, which is optional. The model gives health no resolve handler: `FireFromHealth` has the purpose of host health degradations only, so this PBI applies the invariant that resolution is automatic on the recovery event of the source through `FireFromHealth` itself, and a `ServiceHealthChanged` whose `toState` is Healthy resolves the open health instance of that host the same way; the owner is asked to confirm this reading. The handlers of the SloService events are built against the event contract of model/services/observability/SloService.yaml, because feature `slo-service` depends on this one; the breach that raises one alert end to end is proven by AIFACTORY-US-044. `connectsoft.factory.alerts.fired` counts by tenant, source kind and severity and `connectsoft.factory.alerts.open` moves with every open and close. StudioBff, StudioNotificationService and StudioRealtimeGateway consume `AlertFired` in their own PBIs and FleetIncidentService in I7; DashboardService declares the handler `ProjectAlertInstance`, which feature `dashboard-service` does not register while the owner decides the projections the model does not hold. Kind: behavior. Traces: services: AlertRuleService, ToolAdapterService, AuditService; aggregates: AlertRuleService/AlertRule, AlertRuleService/AlertInstance; events: AlertRuleService/AlertFired, AlertRuleService/AlertResolved, ToolAdapterService/ToolEffectUncertain, AuditService/FindingRaised; adrs: ADR-0012, ADR-0014; requirements: FR-10, XL-06; scenarios: SCN-AlertRuleService-007. Relates: screens: alerts. Depends on: AIFACTORY-US-1116, feature:tool-adapter-service, feature:audit-service-complete. Sources: model/services/observability/AlertRuleService.yaml, model/services/observability/SloService.yaml, docs/planes/trust-operations/observability/services/alert-rule-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given an active rule for uncertain effects in a tenant and `ToolAdapterService/ToolEffectUncertain` of that tenant, when `FireFromUncertain` handles it, then one `AlertRuleService/AlertInstance` in state Fired exists with the deduplication key of the template, the severity of the rule and the invocation id as `sourceRef`, and the `AlertRuleService/AlertFired` outbox record is written in the same transaction; a redelivery of the same event id writes nothing (SCN-AlertRuleService-007).",
        "AC2: Given an open instance for a deduplication key, when a further event of the same source yields the same key, as a repeated breach of the same SLO through `FireFromSlo` or a repeated `AuditService/FindingRaised` through `FireFromFinding`, then no second instance and no second `AlertRuleService/AlertFired` are written and the occurrence is counted on the open instance; a finding below High fires nothing; within the suppression after a resolution an event for that key opens no instance, and a Fired instance whose rule enters a suppression window moves to Suppressed (model/services/observability/AlertRuleService.yaml).",
        "AC3: Given an open instance fired by a breach, when `ResolveFromSlo` handles the recovery event of the same SLO, then the instance moves to Resolved from Fired or from Acknowledged with `resolvedAt` set and the `AlertRuleService/AlertResolved` outbox record is written without `resolvedBy`; given a health instance, a `ServiceHealthChanged` of that host with `toState` Healthy, handled by `FireFromHealth` under the resolution invariant, resolves it the same way (model/services/observability/SloService.yaml).",
        "AC4: Given an instance fired, when the outbox dispatcher publishes `AlertRuleService/AlertFired` on `operations.alerts.v1.alert-fired`, then the event is sent under the canonical envelope with `alertId`, `tenantId`, `ruleId`, `severity`, `sourceRef` and `dedupKey`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AlertRuleService-007, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "model/services/observability/SloService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-547",
        "AIFACTORY-TASK-4474",
        "AIFACTORY-TASK-4475",
        "AIFACTORY-TASK-4476"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13003,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService",
          "ToolAdapterService",
          "AuditService"
        ],
        "aggregates": [
          "AlertRuleService/AlertRule",
          "AlertRuleService/AlertInstance"
        ],
        "events": [
          "AlertRuleService/AlertFired",
          "AlertRuleService/AlertResolved",
          "ToolAdapterService/ToolEffectUncertain",
          "AuditService/FindingRaised"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10",
          "XL-06"
        ],
        "scenarios": [
          "SCN-AlertRuleService-007"
        ]
      },
      "relates": {
        "screens": [
          "alerts"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1116",
        "feature:tool-adapter-service",
        "feature:audit-service-complete"
      ],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "model/services/observability/SloService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1117]",
      "number": 1117
    },
    {
      "id": "AIFACTORY-TASK-547",
      "type": "task",
      "parent": "AIFACTORY-US-1117",
      "title": "Alert rules with deduplication and suppression",
      "sequence": "13.03.03.01",
      "description": "Alert rules with deduplication and suppression. Expected output: A rule matcher selects the active rules of the tenant by source kind and condition, computes the deduplication key from the template, opens one AlertInstance per key while none is Fired or Acknowledged, counts a repeated occurrence on the open instance, opens nothing within the suppression after a resolution and moves a Fired instance to Suppressed when its rule enters a suppression window.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "A rule matcher selects the active rules of the tenant by source kind and condition, computes the deduplication key from the template, opens one AlertInstance per key while none is Fired or Acknowledged, counts a repeated occurrence on the open instance, opens nothing within the suppression after a resolution and moves a Fired instance to Suppressed when its rule enters a suppression window."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-547]",
      "number": 547
    },
    {
      "id": "AIFACTORY-TASK-4474",
      "type": "task",
      "parent": "AIFACTORY-US-1117",
      "title": "Inbox handlers FireFromSlo, ResolveFromSlo, FireFromHealth, FireFromUncertain and FireFromFinding",
      "sequence": "13.03.03.02",
      "description": "Inbox handlers FireFromSlo, ResolveFromSlo, FireFromHealth, FireFromUncertain and FireFromFinding. Expected output: Each handler maps its event to the source kind and the source reference, fires through the rule matcher or resolves the open instance of the source through SourceRecovered or SourceRecoveredOrManual, writes AlertFired or AlertResolved in the transaction of the change, fires nothing for a finding below High, is idempotent on the event id and moves connectsoft.factory.alerts.fired and connectsoft.factory.alerts.open.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Each handler maps its event to the source kind and the source reference, fires through the rule matcher or resolves the open instance of the source through SourceRecovered or SourceRecoveredOrManual, writes AlertFired or AlertResolved in the transaction of the change, fires nothing for a finding below High, is idempotent on the event id and moves connectsoft.factory.alerts.fired and connectsoft.factory.alerts.open."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4474]",
      "number": 4474
    },
    {
      "id": "AIFACTORY-TASK-4475",
      "type": "task",
      "parent": "AIFACTORY-US-1117",
      "title": "Source events built from the pinned contracts package for the firing suite",
      "sequence": "13.03.03.03",
      "description": "Source events built from the pinned contracts package for the firing suite. Expected output: A fixture builds SloBreached, SloRecovered and ServiceHealthChanged from the contract of model/services/observability/SloService.yaml, ToolEffectUncertain and FindingRaised from the pinned contracts package, and delivers each once and twice under the same event id.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "A fixture builds SloBreached, SloRecovered and ServiceHealthChanged from the contract of model/services/observability/SloService.yaml, ToolEffectUncertain and FindingRaised from the pinned contracts package, and delivers each once and twice under the same event id."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13003,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4475]",
      "number": 4475
    },
    {
      "id": "AIFACTORY-TASK-4476",
      "type": "task",
      "parent": "AIFACTORY-US-1117",
      "title": "Verify alerts-fire-deduplicated-from-operations-sources through the acceptance suite",
      "sequence": "13.03.03.04",
      "description": "Verify alerts-fire-deduplicated-from-operations-sources through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AlertRuleService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1117: one instance per key, the counted repeat, the suppression, the automatic resolution and the publication and payload of AlertFired; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-AlertRuleService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1117: one instance per key, the counted repeat, the suppression, the automatic resolution and the publication and payload of AlertFired; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4476]",
      "number": 4476
    },
    {
      "id": "AIFACTORY-US-1118",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "Evaluate metric-threshold rules every minute against the telemetry backend and fire or resolve their alerts",
      "sequence": "13.03.04",
      "description": "As an operator, I want rules on metric conditions evaluated on a schedule against the telemetry backend, so that a condition no event announces still reaches me as an alert and closes when it clears. The `MetricRuleEvaluator` worker runs every minute and evaluates the active rules of source kind Metric, partitioned by tenant with at most four in parallel. For each rule it queries the telemetry backend (`ext-otel-backend`, sync HTTP, required, degrade) with the metric threshold and the duration of the condition. When the condition holds for its duration, it fires through the rule matcher of AIFACTORY-US-1117: one `AlertInstance` per deduplication key, the metric query as `sourceRef`, and `AlertFired` written in the same transaction. When the condition no longer holds, it resolves the open instance of that rule and key through `SourceRecovered` or `SourceRecoveredOrManual` and writes `AlertResolved` without `resolvedBy`. The worker is idempotent on the rule id and the minute, so a duplicate trigger in the same minute evaluates nothing twice. A query that fails is attempted twice in all with the modelled fixed backoff of 30 seconds; when the backend stays unavailable, the rule is skipped for that minute, no instance is fired or resolved from a missing value, the failure is logged with the rule id and without content, and the next minute evaluates again. The rule conditions and the query results never enter a metric, an activity or a log record. Kind: behavior. Traces: services: AlertRuleService; aggregates: AlertRuleService/AlertInstance; events: AlertRuleService/AlertFired, AlertRuleService/AlertResolved; adrs: ADR-0018; requirements: FR-10. Depends on: AIFACTORY-US-1117. Sources: model/services/observability/AlertRuleService.yaml, docs/planes/trust-operations/observability/services/alert-rule-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given an active rule of source kind Metric whose threshold holds for its duration in the fake telemetry backend, when `MetricRuleEvaluator` runs, then one `AlertRuleService/AlertInstance` in state Fired exists with the metric query as `sourceRef` and the `AlertRuleService/AlertFired` outbox record is written in the same transaction; a second run while the condition holds fires nothing more (model/services/observability/AlertRuleService.yaml).",
        "AC2: Given the condition of that rule no longer holds, when `MetricRuleEvaluator` runs, then the open instance moves to Resolved with `resolvedAt` set and the `AlertRuleService/AlertResolved` outbox record is written without `resolvedBy`; a duplicate trigger in the same minute changes nothing (model/services/observability/AlertRuleService.yaml).",
        "AC3: Given the telemetry backend answers errors, when `MetricRuleEvaluator` runs, then each query is attempted twice in all with the modelled fixed backoff, the rule is skipped for that minute without firing or resolving any `AlertRuleService/AlertInstance`, the failure is logged with the rule id and without the condition or any value, and the next run evaluates the rule again once the backend answers (ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4477",
        "AIFACTORY-TASK-4478",
        "AIFACTORY-TASK-4479"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13004,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService"
        ],
        "aggregates": [
          "AlertRuleService/AlertInstance"
        ],
        "events": [
          "AlertRuleService/AlertFired",
          "AlertRuleService/AlertResolved"
        ],
        "adrs": [
          "ADR-0018"
        ],
        "requirements": [
          "FR-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1117"
      ],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1118]",
      "number": 1118
    },
    {
      "id": "AIFACTORY-TASK-4477",
      "type": "task",
      "parent": "AIFACTORY-US-1118",
      "title": "MetricRuleEvaluator against the telemetry backend",
      "sequence": "13.03.04.01",
      "description": "MetricRuleEvaluator against the telemetry backend. Expected output: The worker evaluates the active Metric rules every minute per tenant through a typed client of the telemetry backend, fires or resolves through the rule matcher, is idempotent on the rule id and the minute, attempts a failed query twice in all with a 30 second backoff and skips the rule for the minute when the backend stays unavailable, logging the rule id without content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "The worker evaluates the active Metric rules every minute per tenant through a typed client of the telemetry backend, fires or resolves through the rule matcher, is idempotent on the rule id and the minute, attempts a failed query twice in all with a 30 second backoff and skips the rule for the minute when the backend stays unavailable, logging the rule id without content."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4477]",
      "number": 4477
    },
    {
      "id": "AIFACTORY-TASK-4478",
      "type": "task",
      "parent": "AIFACTORY-US-1118",
      "title": "Fake telemetry backend for the metric rule suite",
      "sequence": "13.03.04.02",
      "description": "Fake telemetry backend for the metric rule suite. Expected output: A fake of the query endpoint of the telemetry backend answers configured series per query, can hold a value above a threshold for a duration, and can answer errors, so that the suite drives the condition and the outage.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "A fake of the query endpoint of the telemetry backend answers configured series per query, can hold a value above a threshold for a duration, and can answer errors, so that the suite drives the condition and the outage."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13004,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4478]",
      "number": 4478
    },
    {
      "id": "AIFACTORY-TASK-4479",
      "type": "task",
      "parent": "AIFACTORY-US-1118",
      "title": "Verify metric-rules-evaluated-every-minute through the acceptance suite",
      "sequence": "13.03.04.03",
      "description": "Verify metric-rules-evaluated-every-minute through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=MetricRules\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1118 against the fake telemetry backend, including the duplicate trigger and the outage that fires and resolves nothing.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=MetricRules\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1118 against the fake telemetry backend, including the duplicate trigger and the outage that fires and resolves nothing."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4479]",
      "number": 4479
    },
    {
      "id": "AIFACTORY-US-1119",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "Consume the promotion, worker pool, provisioning and drift events once each and fire their alerts once their source kinds are modelled",
      "sequence": "13.03.05",
      "description": "As an operator, I want failed promotions and provisioning runs, worker pool trouble and drift of a release or an environment to reach me through the same alert rules, so that delivery and runtime problems are deduplicated, acknowledged and resolved like every other alert. Six inbox handlers bind the delivery and runtime platforms of the earlier increments to the rules, each idempotent on the event id and each firing through the rule matcher of AIFACTORY-US-1117. Each maps its event to a source reference from its payload: `FireFromPromotion` takes `promotionId` of `PromotionFailed` of EnvironmentPromotionService and `ResolveFromPromotion` takes `promotionId` of `RollbackCompleted`, `FireFromCapacity` takes `poolId` of `WorkerPoolStateChanged` of ExecutionCapacityService, `FireFromProvisioning` takes `provisioningRunId` of `ProvisioningFailed` of IaCProvisioningService, and `FireFromDrift` takes `targetReleaseId` of `DriftDetected` of QualityScoreService and `findingId` of `RuntimeDriftDetected` of RuntimeEnvironmentService. The model gives `AlertSourceKind` the values Slo, Health, UncertainEffect, Finding, Metric and DeliveryFailure only, so no rule can name a promotion, capacity, provisioning, quality drift or runtime drift source. What I4 delivers and proves is therefore the idempotent no-fire path: each handler maps the event, selects the active rules of the tenant whose source kind matches its producer, finds none, records the event once per event id in the inbox and fires nothing, and a redelivery changes nothing. The firing and the resolution that the model purposes describe, an alert on a failed promotion resolved on the rollback, an alert on a pool state resolved when the pool leaves it, and the alerts on failed provisioning, quality drift and runtime drift, wait on the owner correction of `AlertSourceKind` in model/services/observability/AlertRuleService.yaml; their criteria below are marked as waiting on it, and their tests are listed and skipped with that reason until the correction is made. `DeliveryFailed`, `IncidentOpened` and `RolloutHalted` are not handled here because their producers arrive in I5 and I7. Kind: behavior. Traces: services: AlertRuleService, EnvironmentPromotionService, ExecutionCapacityService, IaCProvisioningService, QualityScoreService, RuntimeEnvironmentService; aggregates: AlertRuleService/AlertInstance; events: AlertRuleService/AlertFired, AlertRuleService/AlertResolved, EnvironmentPromotionService/PromotionFailed, EnvironmentPromotionService/RollbackCompleted, ExecutionCapacityService/WorkerPoolStateChanged, IaCProvisioningService/ProvisioningFailed, QualityScoreService/DriftDetected, RuntimeEnvironmentService/RuntimeDriftDetected; adrs: ADR-0012; requirements: FR-10, XL-06. Depends on: AIFACTORY-US-1117, feature:environment-promotion-service, feature:execution-capacity-service-complete, feature:ia-cprovisioning-service, feature:quality-score-service-complete, feature:runtime-environment-service. Sources: model/services/observability/AlertRuleService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an active rule of every modelled source kind in a tenant and `EnvironmentPromotionService/PromotionFailed`, `EnvironmentPromotionService/RollbackCompleted`, `ExecutionCapacityService/WorkerPoolStateChanged`, `IaCProvisioningService/ProvisioningFailed`, `QualityScoreService/DriftDetected` and `RuntimeEnvironmentService/RuntimeDriftDetected` of that tenant, when their handlers consume them, then each event is recorded in the inbox once per event id with the source reference mapped from its payload, no rule matches, no `AlertRuleService/AlertInstance` is written and no `AlertRuleService/AlertFired` or `AlertRuleService/AlertResolved` is published, and a redelivery of the same event id changes nothing (model/services/observability/AlertRuleService.yaml).",
        "AC2: Waiting on the owner correction of `AlertSourceKind`: given an active rule bound to failed promotions and `EnvironmentPromotionService/PromotionFailed` of that tenant, when `FireFromPromotion` handles it, then one `AlertRuleService/AlertInstance` in state Fired exists with the promotion id as `sourceRef` and the `AlertRuleService/AlertFired` outbox record is written; when `EnvironmentPromotionService/RollbackCompleted` of the same promotion is handled by `ResolveFromPromotion`, then the instance moves to Resolved and `AlertRuleService/AlertResolved` is written (model/services/observability/AlertRuleService.yaml).",
        "AC3: Waiting on the owner correction of `AlertSourceKind`: given a rule bound to the state of a worker pool, when `FireFromCapacity` handles `ExecutionCapacityService/WorkerPoolStateChanged` into a state the rule names, then an instance fires with the pool id as `sourceRef`, and when a later change of the same pool leaves that state, then the open instance is resolved (model/services/runtime-cloud/ExecutionCapacityService.yaml).",
        "AC4: Waiting on the owner correction of `AlertSourceKind`: given rules bound to failed provisioning, quality drift and runtime drift, when `IaCProvisioningService/ProvisioningFailed`, `QualityScoreService/DriftDetected` and `RuntimeEnvironmentService/RuntimeDriftDetected` are handled, then each fires one deduplicated instance with the provisioning run id, the release id and the drift finding id as `sourceRef`, and a repeated event with the same key counts an occurrence and fires nothing more (model/services/observability/AlertRuleService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4480",
        "AIFACTORY-TASK-4481"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13005,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService",
          "EnvironmentPromotionService",
          "ExecutionCapacityService",
          "IaCProvisioningService",
          "QualityScoreService",
          "RuntimeEnvironmentService"
        ],
        "aggregates": [
          "AlertRuleService/AlertInstance"
        ],
        "events": [
          "AlertRuleService/AlertFired",
          "AlertRuleService/AlertResolved",
          "EnvironmentPromotionService/PromotionFailed",
          "EnvironmentPromotionService/RollbackCompleted",
          "ExecutionCapacityService/WorkerPoolStateChanged",
          "IaCProvisioningService/ProvisioningFailed",
          "QualityScoreService/DriftDetected",
          "RuntimeEnvironmentService/RuntimeDriftDetected"
        ],
        "adrs": [
          "ADR-0012"
        ],
        "requirements": [
          "FR-10",
          "XL-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1117",
        "feature:environment-promotion-service",
        "feature:execution-capacity-service-complete",
        "feature:ia-cprovisioning-service",
        "feature:quality-score-service-complete",
        "feature:runtime-environment-service"
      ],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1119]",
      "number": 1119
    },
    {
      "id": "AIFACTORY-TASK-4480",
      "type": "task",
      "parent": "AIFACTORY-US-1119",
      "title": "Inbox handlers FireFromPromotion, ResolveFromPromotion, FireFromCapacity, FireFromProvisioning and FireFromDrift",
      "sequence": "13.03.05.01",
      "description": "Inbox handlers FireFromPromotion, ResolveFromPromotion, FireFromCapacity, FireFromProvisioning and FireFromDrift. Expected output: Each handler maps its event to the source reference of its payload (promotionId for PromotionFailed and RollbackCompleted, poolId for WorkerPoolStateChanged, provisioningRunId for ProvisioningFailed, targetReleaseId for DriftDetected, findingId for RuntimeDriftDetected), selects the active rules of the tenant whose source kind matches its producer through the rule matcher, records the event once per event id in the inbox, and on no match writes no AlertInstance and publishes nothing; a redelivered event id changes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Each handler maps its event to the source reference of its payload (promotionId for PromotionFailed and RollbackCompleted, poolId for WorkerPoolStateChanged, provisioningRunId for ProvisioningFailed, targetReleaseId for DriftDetected, findingId for RuntimeDriftDetected), selects the active rules of the tenant whose source kind matches its producer through the rule matcher, records the event once per event id in the inbox, and on no match writes no AlertInstance and publishes nothing; a redelivered event id changes nothing."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4480]",
      "number": 4480
    },
    {
      "id": "AIFACTORY-TASK-4481",
      "type": "task",
      "parent": "AIFACTORY-US-1119",
      "title": "Verify alerts-fire-from-delivery-and-runtime-sources through the acceptance suite",
      "sequence": "13.03.05.02",
      "description": "Verify alerts-fire-from-delivery-and-runtime-sources through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=DeliveryAndRuntimeSources\"`; a zero-match filter counts as a failure; the tests prove AC1 of AIFACTORY-US-1119 with the six events built from the pinned contracts package against rules of every modelled source kind, including the redelivered event id that changes nothing; the tests of AC2 to AC4 are present in the suite, each skipped with the reason that names the owner correction of AlertSourceKind, so that none of them is silently absent.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=DeliveryAndRuntimeSources\"`; a zero-match filter counts as a failure; the tests prove AC1 of AIFACTORY-US-1119 with the six events built from the pinned contracts package against rules of every modelled source kind, including the redelivered event id that changes nothing; the tests of AC2 to AC4 are present in the suite, each skipped with the reason that names the owner correction of AlertSourceKind, so that none of them is silently absent."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4481]",
      "number": 4481
    },
    {
      "id": "AIFACTORY-US-1120",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "List the alerts of my tenant, acknowledge one and resolve it by hand with a reason",
      "sequence": "13.03.06",
      "description": "As an operator, I want to see the alerts of my tenant by state and severity, acknowledge the one I take and resolve it with a reason when it is handled, so that everyone sees who owns an alert and why it was closed. A caller whose scope carries `factory.operations.read` lists the alert instances of the trusted tenant through `AlertRuleService/ListAlerts`, filtered by state and severity, each with its rule, deduplication key, source reference, `firedAt`, acknowledgement, resolution and the deliveries recorded per route; the read runs under the tenant row filter and writes nothing. An Operator whose scope carries `factory.operations.operate` acknowledges an alert through `AlertRuleService/AcknowledgeAlert` on `/factory/alerts/{alertId}/acknowledge`: a Fired instance moves to Acknowledged through the trigger `Acknowledge`, `acknowledgedBy` takes the caller of the token, and `connectsoft.factory.alerts.time_to_acknowledge` records the time since `firedAt`; the model gives the command no result event, so an acknowledgement publishes nothing. The same Operator resolves an alert by hand through `AlertRuleService/ResolveAlert` with a reason: an Acknowledged instance moves to Resolved through `SourceRecoveredOrManual`, `resolvedAt` is set and `AlertResolved` with `alertId`, `tenantId` and `resolvedBy`, the caller, is written in the same transaction. The model has no manual transition from Fired, so a Fired alert is acknowledged first, and the reason has no field in `AlertInstance`, which is reported as a correction of the model. Both operations are naturally idempotent: acknowledging an Acknowledged alert and resolving a Resolved one return 200 and change nothing. An alert that is Resolved or Suppressed has no Acknowledge transition and a Fired or Suppressed alert has no manual Resolve transition; the model lists 200, 403 and 404 only, so the status of these refusals is reported to the owner, and they change nothing. A caller without the scope is refused with 403; an alert of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015, D113). StudioBff and StudioRealtimeGateway consume `AlertResolved` in their own PBIs; DashboardService declares the handler `ProjectAlertInstance`, which feature `dashboard-service` does not register while the owner decides the projections the model does not hold. Kind: behavior. Traces: services: AlertRuleService; aggregates: AlertRuleService/AlertInstance; apis: AlertRuleService/ListAlerts, AlertRuleService/AcknowledgeAlert, AlertRuleService/ResolveAlert; events: AlertRuleService/AlertResolved; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FR-10, FUX-04; scenarios: SCN-AlertRuleService-001, SCN-AlertRuleService-002, SCN-AlertRuleService-003, SCN-AlertRuleService-008. Relates: screens: alerts. Depends on: AIFACTORY-US-1117. Sources: model/services/observability/AlertRuleService.yaml, docs/planes/trust-operations/observability/services/alert-rule-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given open and resolved alerts of two tenants and of several severities, when `AlertRuleService/ListAlerts` is called with `factory.operations.read` and a state and severity filter, then the response is 200 with the instances of the trusted tenant that match, each with rule, key, source reference, state, acknowledgement and deliveries, and nothing is written; a caller without the scope is refused with 403 (SCN-AlertRuleService-001, ADR-0015).",
        "AC2: Given a Fired alert of my tenant, when `AlertRuleService/AcknowledgeAlert` is called with `factory.operations.operate`, then the response is 200, the `AlertRuleService/AlertInstance` is Acknowledged with `acknowledgedBy` set to the caller, the time to acknowledge is recorded and no event is published; a repeat returns 200 and changes nothing (SCN-AlertRuleService-002).",
        "AC3: Given an Acknowledged alert of my tenant, when `AlertRuleService/ResolveAlert` is called with a reason, then the response is 200, the instance is Resolved with `resolvedAt` set and the `AlertRuleService/AlertResolved` outbox record with `resolvedBy` is written in the same transaction; given a Fired or Suppressed alert asked to resolve, or a Resolved or Suppressed alert asked to acknowledge, then nothing changes and nothing is published (status code open, see open_questions) (SCN-AlertRuleService-003).",
        "AC4: Given a caller without `factory.operations.operate`, an alert id of another tenant or an id that does not exist, when `AlertRuleService/AcknowledgeAlert` or `AlertRuleService/ResolveAlert` is called, then the response is 403 for the missing scope and 404 for the foreign and the unknown id alike, with a problem response and no state change (SCN-AlertRuleService-002, SCN-AlertRuleService-003, ADR-0015).",
        "AC5: Given an alert was resolved by hand or automatically, when the outbox dispatcher publishes `AlertRuleService/AlertResolved` on `operations.alerts.v1.alert-resolved`, then the event is sent under the canonical envelope with `alertId`, `tenantId` and, for a manual resolution, `resolvedBy`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-AlertRuleService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4482",
        "AIFACTORY-TASK-4483",
        "AIFACTORY-TASK-4484"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13006,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService"
        ],
        "aggregates": [
          "AlertRuleService/AlertInstance"
        ],
        "apis": [
          "AlertRuleService/ListAlerts",
          "AlertRuleService/AcknowledgeAlert",
          "AlertRuleService/ResolveAlert"
        ],
        "events": [
          "AlertRuleService/AlertResolved"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "FUX-04"
        ],
        "scenarios": [
          "SCN-AlertRuleService-001",
          "SCN-AlertRuleService-002",
          "SCN-AlertRuleService-003",
          "SCN-AlertRuleService-008"
        ]
      },
      "relates": {
        "screens": [
          "alerts"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1117"
      ],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1120]",
      "number": 1120
    },
    {
      "id": "AIFACTORY-TASK-4482",
      "type": "task",
      "parent": "AIFACTORY-US-1120",
      "title": "ListAlerts, AcknowledgeAlert and ResolveAlert with the AlertState transitions",
      "sequence": "13.03.06.01",
      "description": "ListAlerts, AcknowledgeAlert and ResolveAlert with the AlertState transitions. Expected output: ListAlerts returns the instances of the trusted tenant filtered by state and severity; AcknowledgeAlert applies Acknowledge to a Fired instance with acknowledgedBy and records connectsoft.factory.alerts.time_to_acknowledge without publishing; ResolveAlert applies SourceRecoveredOrManual to an Acknowledged instance with resolvedAt and writes AlertResolved with resolvedBy in the same transaction; repeats change nothing, an unmodelled transition changes nothing, a missing scope is 403 and a foreign or unknown id is 404.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "ListAlerts returns the instances of the trusted tenant filtered by state and severity; AcknowledgeAlert applies Acknowledge to a Fired instance with acknowledgedBy and records connectsoft.factory.alerts.time_to_acknowledge without publishing; ResolveAlert applies SourceRecoveredOrManual to an Acknowledged instance with resolvedAt and writes AlertResolved with resolvedBy in the same transaction; repeats change nothing, an unmodelled transition changes nothing, a missing scope is 403 and a foreign or unknown id is 404."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13006,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4482]",
      "number": 4482
    },
    {
      "id": "AIFACTORY-TASK-4483",
      "type": "task",
      "parent": "AIFACTORY-US-1120",
      "title": "Contract of the alert list, the resolve body and the AlertResolved event",
      "sequence": "13.03.06.02",
      "description": "Contract of the alert list, the resolve body and the AlertResolved event. Expected output: The OpenAPI document describes the alert list of ListAlerts with its state and severity filters and the resolve body with its reason, and the contracts package carries AlertResolved with alertId, tenantId and the optional resolvedBy on its modelled topic.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "The OpenAPI document describes the alert list of ListAlerts with its state and severity filters and the resolve body with its reason, and the contracts package carries AlertResolved with alertId, tenantId and the optional resolvedBy on its modelled topic."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13006,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4483]",
      "number": 4483
    },
    {
      "id": "AIFACTORY-TASK-4484",
      "type": "task",
      "parent": "AIFACTORY-US-1120",
      "title": "Verify operator-lists-acknowledges-and-resolves-alerts through the acceptance suite",
      "sequence": "13.03.06.03",
      "description": "Verify operator-lists-acknowledges-and-resolves-alerts through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AlertRuleService-001|Scenario=SCN-AlertRuleService-002|Scenario=SCN-AlertRuleService-003|Scenario=SCN-AlertRuleService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1120 over a two-tenant fixture, including the 404 for a foreign alert, the unmodelled transitions that change nothing and the payload of AlertResolved.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-AlertRuleService-001|Scenario=SCN-AlertRuleService-002|Scenario=SCN-AlertRuleService-003|Scenario=SCN-AlertRuleService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1120 over a two-tenant fixture, including the 404 for a foreign alert, the unmodelled transitions that change nothing and the payload of AlertResolved."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4484]",
      "number": 4484
    },
    {
      "id": "AIFACTORY-US-1121",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "Deliver a fired alert on every route of its rule and record a receipt per route",
      "sequence": "13.03.07",
      "description": "As an operator, I want every fired alert delivered to the Studio and to the channels its rule names, with a record of what was delivered, so that I am reached even when an external channel is down and I can see which delivery failed. The `Notifier` worker is triggered by `AlertFired` of this service and delivers the fired instance on each route of its rule, idempotent on the alert id and the route, partitioned by tenant with at most four in parallel. The Studio route is the required dependency on StudioNotificationService, which consumes `AlertFired` through its handler `NotifyOperators` and queues the notification for the operators in scope; the Notifier records that route as delivered in `notifications` of the instance. Chat and email routes go through a connector of the Integration platform with the external action class and the tenant connection, never a raw webhook, over the optional gRPC dependency on ConnectorRegistryService with the failure mode degrade. That delivery, `Connectors.Deliver`, is hosted only by feature `connector-registry-service-complete` in I5, and it asks for a policy decision for which `policy-decision-v1` has no fitting action kind; both are reported to the owner and no action kind is borrowed (D129). Until then a chat or email route is the modelled failure mode of a notification channel that is down: the Notifier attempts it five times in all with the modelled exponential backoff from 30 seconds, then records the failure in the receipt of that route, while the Studio notification is always delivered. A Suppressed instance is not delivered. Each receipt names the route, the outcome and the time, and no alert content beyond the references reaches a log record. Kind: behavior. Traces: services: AlertRuleService, StudioNotificationService, ConnectorRegistryService; aggregates: AlertRuleService/AlertInstance; events: AlertRuleService/AlertFired; adrs: ADR-0018; requirements: FUX-04, XL-16. Depends on: AIFACTORY-US-1117, feature:studio-notification-service. Sources: model/services/observability/AlertRuleService.yaml, docs/planes/trust-operations/observability/services/alert-rule-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given an `AlertRuleService/AlertFired` of an instance whose rule routes to the Studio, when the `Notifier` runs, then the Studio route is recorded as delivered in `notifications` of the `AlertRuleService/AlertInstance`, the notification itself being queued by StudioNotificationService from the same event, and a duplicate trigger for the same alert and route records nothing twice (model/services/observability/AlertRuleService.yaml).",
        "AC2: Given a rule that routes to the Studio and to a chat connector and a connector delivery that fails, as before feature `connector-registry-service-complete` hosts it, when the `Notifier` runs, then the chat route is attempted five times in all with the modelled exponential backoff and its receipt records the failure, the Studio route is recorded as delivered, and no other route of the instance is held back (docs/planes/trust-operations/observability/services/alert-rule-service/index.md).",
        "AC3: Given an instance that moved to Suppressed before delivery, when the `Notifier` is triggered for its `AlertRuleService/AlertFired`, then no route is delivered and the receipts record the suppression; no receipt and no log record carries more than the alert id, the route and the outcome (ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4485",
        "AIFACTORY-TASK-4486"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13007,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService",
          "StudioNotificationService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "AlertRuleService/AlertInstance"
        ],
        "events": [
          "AlertRuleService/AlertFired"
        ],
        "adrs": [
          "ADR-0018"
        ],
        "requirements": [
          "FUX-04",
          "XL-16"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1117",
        "feature:studio-notification-service"
      ],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "docs/planes/trust-operations/observability/services/alert-rule-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1121]",
      "number": 1121
    },
    {
      "id": "AIFACTORY-TASK-4485",
      "type": "task",
      "parent": "AIFACTORY-US-1121",
      "title": "Notifier with receipts per route and the degraded connector routes",
      "sequence": "13.03.07.01",
      "description": "Notifier with receipts per route and the degraded connector routes. Expected output: The Notifier records the Studio route of a fired instance as delivered, attempts chat and email routes through a typed gRPC client of the connector delivery with exponential retries from 30 seconds over five attempts and records the failure in the receipt of the route when they fail, skips a Suppressed instance, is idempotent on alert id plus route and writes no alert content beyond references to a log record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "The Notifier records the Studio route of a fired instance as delivered, attempts chat and email routes through a typed gRPC client of the connector delivery with exponential retries from 30 seconds over five attempts and records the failure in the receipt of the route when they fail, skips a Suppressed instance, is idempotent on alert id plus route and writes no alert content beyond references to a log record."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13007,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4485]",
      "number": 4485
    },
    {
      "id": "AIFACTORY-TASK-4486",
      "type": "task",
      "parent": "AIFACTORY-US-1121",
      "title": "Verify fired-alerts-delivered-with-receipts through the acceptance suite",
      "sequence": "13.03.07.02",
      "description": "Verify fired-alerts-delivered-with-receipts through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=Notifier\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1121 with a fake connector delivery that answers UNIMPLEMENTED and UNAVAILABLE, including the duplicate trigger and the suppressed instance.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=Notifier\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1121 with a fake connector delivery that answers UNIMPLEMENTED and UNAVAILABLE, including the duplicate trigger and the suppressed instance."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13007,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4486]",
      "number": 4486
    },
    {
      "id": "AIFACTORY-US-1122",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-067",
      "title": "Apply retention rules, legal holds and deletion orders to the alert rules and alert instances of a tenant",
      "sequence": "13.03.08",
      "description": "As a workspace admin, I want the alert data of my tenant kept no longer than my retention rule, held when a legal hold says so and deleted on order, so that alerting follows the same data governance as every other store of the Factory. Three inbox handlers apply the orders of RetentionResidencyService to `alert-rule-sql`, each idempotent on the event id. `ApplyRetentionRule` handles `RetentionRuleChanged` and applies the effective retention period of the rule to the records of the store class of the rule; the model keeps alert instances 13 months, and a tenant rule may only shorten that, so instances resolved longer ago than the effective period are deleted by the retention job of the service. `ApplyLegalHold` handles `LegalHoldChanged` and suspends deletion and retention expiry for the held scope while the hold is active, and resumes them when it is lifted. `ExecuteDeletionOrder` handles `DeletionOrderIssued`: for an order of tenant scope it deletes every row of the tenant in `AlertRules` and `AlertInstances`; an order of project scope finds no rows, because alert rules and instances carry no project in the model, and its receipt says so; a run purge finds no rows, because alert rules and instances carry no run, and is acknowledged through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt that says so; a held scope is not deleted and the receipt names the hold. The handler then acknowledges its task through `RetentionResidencyService/AcknowledgeOrderTask` with the workload token of the service, which holds `factory.data.acknowledge`, and a receipt that names the order, the service, the tables and the row counts. A redelivered order deletes nothing more and acknowledges with the same receipt; an answer 403 or 404 of the acknowledgement or a failure before it leaves the task unacknowledged, is logged with the order id and is retried by the inbox. Platform rules are not deleted by a tenant order. Kind: behavior. Traces: services: AlertRuleService, RetentionResidencyService; aggregates: AlertRuleService/AlertRule, AlertRuleService/AlertInstance; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/LegalHoldChanged, RetentionResidencyService/DeletionOrderIssued; adrs: ADR-0019; requirements: XL-14. Depends on: AIFACTORY-US-1116, feature:retention-residency-service. Sources: model/services/observability/AlertRuleService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given `RetentionResidencyService/DeletionOrderIssued` of tenant scope for one of two tenants, when `ExecuteDeletionOrder` handles it, then every row of that tenant in `AlertRules` and `AlertInstances` is deleted, the rows of the other tenant and the platform rules are untouched, and the task is acknowledged through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt that names the order, the service, the tables and the row counts; a redelivered order deletes nothing more and acknowledges with the same receipt (ADR-0019, XL-14).",
        "AC2: Given an order of project scope, when `ExecuteDeletionOrder` handles it, then nothing is deleted and the receipt states that the tables of the service carry no project; given a run purge, then it finds no rows, because alert rules and instances carry no run, and is acknowledged through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt that says so; given an acknowledgement answered 403 or 404, then the task stays unacknowledged, the failure is logged with the order id and the inbox retries it (model/services/data-event/RetentionResidencyService.yaml).",
        "AC3: Given `RetentionResidencyService/RetentionRuleChanged` that shortens the retention of the store class of `alert-rule-sql` for a tenant and `RetentionResidencyService/LegalHoldChanged` that holds that tenant, when the retention job runs, then no instance of the held tenant is deleted, and once a further `RetentionResidencyService/LegalHoldChanged` lifts the hold, the instances resolved longer ago than the effective period are deleted (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4487",
        "AIFACTORY-TASK-4488"
      ],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13008,
      "kind": "behavior",
      "traces": {
        "services": [
          "AlertRuleService",
          "RetentionResidencyService"
        ],
        "aggregates": [
          "AlertRuleService/AlertRule",
          "AlertRuleService/AlertInstance"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/LegalHoldChanged",
          "RetentionResidencyService/DeletionOrderIssued"
        ],
        "adrs": [
          "ADR-0019"
        ],
        "requirements": [
          "XL-14"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1116",
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/observability/AlertRuleService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1122]",
      "number": 1122
    },
    {
      "id": "AIFACTORY-TASK-4487",
      "type": "task",
      "parent": "AIFACTORY-US-1122",
      "title": "ApplyRetentionRule, ApplyLegalHold and ExecuteDeletionOrder with the acknowledgement of the order task",
      "sequence": "13.03.08.01",
      "description": "ApplyRetentionRule, ApplyLegalHold and ExecuteDeletionOrder with the acknowledgement of the order task. Expected output: The three handlers apply the effective retention period through a retention job of the service, suspend and resume expiry and deletion for a held scope, delete the rows of a tenant order in AlertRules and AlertInstances without touching platform rules, answer a project order and a run purge each with a receipt that names no rows and says why, acknowledge through a typed client of AcknowledgeOrderTask with the workload token that holds factory.data.acknowledge, and are idempotent on the order id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "The three handlers apply the effective retention period through a retention job of the service, suspend and resume expiry and deletion for a held scope, delete the rows of a tenant order in AlertRules and AlertInstances without touching platform rules, answer a project order and a run purge each with a receipt that names no rows and says why, acknowledge through a typed client of AcknowledgeOrderTask with the workload token that holds factory.data.acknowledge, and are idempotent on the order id."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13008,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4487]",
      "number": 4487
    },
    {
      "id": "AIFACTORY-TASK-4488",
      "type": "task",
      "parent": "AIFACTORY-US-1122",
      "title": "Verify alert-data-follows-retention-and-deletion-orders through the acceptance suite",
      "sequence": "13.03.08.02",
      "description": "Verify alert-data-follows-retention-and-deletion-orders through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1122 over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and can answer 403 and 404, including the project order and the run purge acknowledged with receipts that name no rows, the redelivered order and the hold that blocks expiry.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AlertRuleService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1122 over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and can answer 403 and 404, including the project order and the run purge acknowledged with receipts that name no rows, the redelivered order and the hold that blocks expiry."
      ],
      "sourceArtifacts": [
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AlertRuleService"
      ],
      "children": [],
      "buildOrder": 130,
      "phase": "factory",
      "stackRank": 13008,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4488]",
      "number": 4488
    },
    {
      "id": "AIFACTORY-FEAT-068",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-013",
      "title": "DashboardService: complete delivery",
      "sequence": "13.04",
      "description": "DashboardService is the service of bounded context BC-21 (Operations). Read models for operating the Factory — per-run timelines that join Run Control truth with runtime, model, tool, context and usage events, tenant and project overviews (task success, cost, tokens, latency, tool failure, fallback and human-intervention rates) and live subscriptions for the Studio; projections are rebuildable and never the truth (BC-21, original design §51). Its own repository is ConnectSoft.AI.SoftwareFactory.DashboardService. Delivers: DashboardService (complete). Increment I4: Trust and accountability. Build order 131 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-045",
        "AIFACTORY-US-1123",
        "AIFACTORY-US-1124",
        "AIFACTORY-US-1125",
        "AIFACTORY-US-1126",
        "AIFACTORY-US-1127",
        "AIFACTORY-US-1128"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13100,
      "titlePrefix": "[AIFACTORY-FEAT-068]",
      "number": 68
    },
    {
      "id": "AIFACTORY-US-045",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-068",
      "title": "I read the timeline of a run and the overview of a project",
      "sequence": "13.04.01",
      "description": "As an operator, I want the timeline of a run and overviews per tenant and project, built from the events of the platforms, so that I see what a run did, what it cost and where it failed, in one place. This is the integration PBI of the feature. DashboardService is the service of bounded context BC-21 (Operations) that builds the read models for operating the Factory, and it is a projection by design and by rule: the journal of Run Control is the truth of a run, the receipts of the producers are the truth of each call, and a projection that disagrees is rebuilt, never edited (ADR-0014). It owns two aggregates in `dashboard-sql`: `RunProjection`, the joined view of one run with its `TimelineEntry` rows, and `OverviewProjection`, the rolling aggregates per tenant, project and subject for a window. Callers reach its five REST operations through the route GW-03 of the gateway ObservabilityHost, which forwards the user token (D117), under `factory.runs.read`, `factory.operations.read` and `factory.operations.admin`; the Studio BFF opens the internal stream `Operations.Subscribe` with its workload identity. Every query runs under the tenant row filter, and a run or a subject of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015, D113). The behaviour is delivered by the behaviour PBIs of this feature: the run projection from the run events (AIFACTORY-US-1123), the run list and the timeline (AIFACTORY-US-1124), the overviews and their digest (AIFACTORY-US-1125), the rebuild (AIFACTORY-US-1126), the operations stream that ends the answer that the stream is unavailable, which AIFACTORY-US-036 AC4 gives until I4 (AIFACTORY-US-1127), and the retention and deletion orders (AIFACTORY-US-1128). In I4 the model consumes 29 events, and this feature registers all of them (D131): the handlers whose events carry a run in the run event envelope and fold into `RunProjection`, and the three orders of RetentionResidencyService. They are the handlers `ProjectRun`, `ProjectAttempt`, `ProjectLease`, `ProjectExecutionAttempt`, `ProjectReceipt`, `ProjectInvocationReceipt`, `ProjectToolInvocation`, `ProjectContext`, `ProjectWorkflow`, `ProjectUsage` and `ProjectUsageRecord`, and `ApplyRetentionRule`, `ApplyLegalHold` and `ExecuteDeletionOrder`; the execution attempt, lease, usage record, invocation receipt and tool invocation projections their purposes name are folded into `RunProjection` and its timeline. The projection handlers of the other 48 events, among them `ProjectAlertInstance`, `ProjectSloDefinition` and `ProjectServiceHealth`, name a projection that is not about one run and that no table or aggregate of the service holds; they leave the I4 model and arrive in a later increment (D131), so this feature registers none of them. Every projection shows the time of its last update, content never enters a projection, and telemetry follows the conventions of feature `component-observability-factory-conventions`, taken by the version pin of its packages and never forked. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService, created by the repository checklist of feature `repository-and-pipeline-conventions` from the base template with the Factory profile. Kind: behavior. Traces: services: DashboardService, RunControlService, StudioRealtimeGateway, ObservabilityHost; aggregates: DashboardService/RunProjection, DashboardService/OverviewProjection; apis: DashboardService/ListRunProjections, DashboardService/GetRunTimeline, DashboardService/GetOverview, DashboardService/GetSubjectOverview, DashboardService/RebuildRunProjection, DashboardService/Operations.Subscribe; events: DashboardService/RunProjectionUpdated, DashboardService/OperationsDigestProduced; adrs: ADR-0014, ADR-0015, ADR-0018, ADR-0028; requirements: FR-10, FUX-04, FUX-07, FUX-08, XL-06, XL-12, XL-16. Relates: screens: run-list, run-timeline, overview; nfrs: NFR-07, NFR-10. Depends on: AIFACTORY-US-1123, AIFACTORY-US-1124, AIFACTORY-US-1125, AIFACTORY-US-1126, AIFACTORY-US-1127, AIFACTORY-US-1128, feature:observability-host, feature:studio-realtime-gateway, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/observability/DashboardService.yaml, model/scenarios/DashboardService.yaml, docs/planes/trust-operations/observability/services/dashboard-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a run whose events are consumed, when `DashboardService/GetRunTimeline` is called, then the `DashboardService/RunProjection` joins the state of Run Control with the runtime, model, tool, context and usage events of the run, entries hold references and hashes and never content, and the projection carries the time of its last update (ADR-0014, FUX-04).",
        "AC2: Given a project with runs in the last window, when the aggregator has run and `DashboardService/GetOverview` is called, then the `DashboardService/OverviewProjection` of the project shows task success, cost per task, tokens, latency and tool failures for the window with its `computedAt` (FUX-08).",
        "AC3: Given a rebuild requested through `DashboardService/RebuildRunProjection`, when it completes, then the projection equals the one built from the same events before (model/services/observability/DashboardService.yaml).",
        "AC4: Given the repository ConnectSoft.AI.SoftwareFactory.DashboardService, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.DashboardService --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 tests pass, a container image is published and each of the eight scenarios of DashboardService has a passing test that names its id (model/scenarios/DashboardService.yaml, ADR-0028).",
        "AC5: Given the service starts, when liveness and readiness are probed, then readiness reports `dashboard-sql` and the messaging transport with the ready tag, and the telemetry conformance test of the pinned observability packages passes with the five metrics of model/services/observability/DashboardService.yaml tagged as modelled: `connectsoft.factory.operations.projection_lag` by tenant, `connectsoft.factory.operations.task_success_rate`, `connectsoft.factory.operations.human_intervention_rate` and `connectsoft.factory.operations.cost_per_task_usd` by tenant and window, and `connectsoft.factory.operations.inbox_lag` by service (ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml",
        "model/scenarios/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-769",
        "AIFACTORY-TASK-479",
        "AIFACTORY-TASK-480",
        "AIFACTORY-TASK-481",
        "AIFACTORY-TASK-482",
        "AIFACTORY-TASK-483",
        "AIFACTORY-TASK-484",
        "AIFACTORY-TASK-485"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "behavior",
      "traces": {
        "services": [
          "DashboardService",
          "RunControlService",
          "StudioRealtimeGateway",
          "ObservabilityHost"
        ],
        "aggregates": [
          "DashboardService/RunProjection",
          "DashboardService/OverviewProjection"
        ],
        "apis": [
          "DashboardService/ListRunProjections",
          "DashboardService/GetRunTimeline",
          "DashboardService/GetOverview",
          "DashboardService/GetSubjectOverview",
          "DashboardService/RebuildRunProjection",
          "DashboardService/Operations.Subscribe"
        ],
        "events": [
          "DashboardService/RunProjectionUpdated",
          "DashboardService/OperationsDigestProduced"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "FUX-04",
          "FUX-07",
          "FUX-08",
          "XL-06",
          "XL-12",
          "XL-16"
        ]
      },
      "relates": {
        "screens": [
          "run-list",
          "run-timeline",
          "overview"
        ],
        "nfrs": [
          "NFR-07",
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1123",
        "AIFACTORY-US-1124",
        "AIFACTORY-US-1125",
        "AIFACTORY-US-1126",
        "AIFACTORY-US-1127",
        "AIFACTORY-US-1128",
        "feature:observability-host",
        "feature:studio-realtime-gateway",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/observability/DashboardService.yaml",
        "model/scenarios/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-045]",
      "number": 45
    },
    {
      "id": "AIFACTORY-TASK-769",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "Verify operations-read-models by running the declared command",
      "sequence": "13.04.01.01",
      "description": "Verify operations-read-models by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-DashboardService\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.DashboardService; a filter that discovers no test counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-045, with a test for each of SCN-DashboardService-001 to SCN-DashboardService-008.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-DashboardService\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.DashboardService; a filter that discovers no test counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-045, with a test for each of SCN-DashboardService-001 to SCN-DashboardService-008."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-769]",
      "number": 769
    },
    {
      "id": "AIFACTORY-TASK-479",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.DashboardService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "13.04.01.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.DashboardService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.DashboardService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `dashboard`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.DashboardService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.DashboardService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `dashboard`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-479]",
      "number": 479
    },
    {
      "id": "AIFACTORY-TASK-480",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "Domain model: RunProjection, OverviewProjection",
      "sequence": "13.04.01.03",
      "description": "Domain model: RunProjection, OverviewProjection. Expected output: The aggregates hold the fields and the invariants of the model: a projection is changed only from events or by a rebuild, usage amounts carry their status and uncertain amounts are never folded into totals, and an entry holds references and hashes and never content; unit tests cover every invariant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates hold the fields and the invariants of the model: a projection is changed only from events or by a rebuild, usage amounts carry their status and uncertain amounts are never folded into totals, and an entry holds references and hashes and never content; unit tests cover every invariant."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-480]",
      "number": 480
    },
    {
      "id": "AIFACTORY-TASK-481",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "Persistence in dashboard-sql: RunProjections, TimelineEntries, ProjectionCheckpoints, OverviewProjections",
      "sequence": "13.04.01.04",
      "description": "Persistence in dashboard-sql: RunProjections, TimelineEntries, ProjectionCheckpoints, OverviewProjections. Expected output: Mappings and migrations for the four modelled tables with the tenant filter, the indexes on tenant, state and update time and on project, and the unique index of an overview per tenant, kind, subject and window; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the four modelled tables with the tenant filter, the indexes on tenant, state and update time and on project, and the unique index of an overview per tenant, kind, subject and window; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-481]",
      "number": 481
    },
    {
      "id": "AIFACTORY-TASK-482",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "API hosting skeleton: 5 REST and 1 gRPC operations with scope enforcement, problem responses and contract documents",
      "sequence": "13.04.01.05",
      "description": "API hosting skeleton: 5 REST and 1 gRPC operations with scope enforcement, problem responses and contract documents. Expected output: ListRunProjections, GetRunTimeline, GetOverview, GetSubjectOverview and RebuildRunProjection are hosted with JWT validation of the token the gateway forwards, scope enforcement per route and problem responses for every modelled refusal code, and Operations.Subscribe with the workload identity check, with the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-1124 to AIFACTORY-US-1127, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ListRunProjections, GetRunTimeline, GetOverview, GetSubjectOverview and RebuildRunProjection are hosted with JWT validation of the token the gateway forwards, scope enforcement per route and problem responses for every modelled refusal code, and Operations.Subscribe with the workload identity check, with the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-1124 to AIFACTORY-US-1127, not here."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-482]",
      "number": 482
    },
    {
      "id": "AIFACTORY-TASK-483",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "Messaging skeleton: outbox and inbox of the dashboard profile for 2 published and 29 consumed events",
      "sequence": "13.04.01.06",
      "description": "Messaging skeleton: outbox and inbox of the dashboard profile for 2 published and 29 consumed events. Expected output: The outbox writer enlists in the transaction of each projection change and the dispatcher publishes RunProjectionUpdated and OperationsDigestProduced under the canonical envelope; the inbox registers, with idempotency on the event id, the 26 run events of the handlers ProjectRun, ProjectAttempt, ProjectLease, ProjectExecutionAttempt, ProjectReceipt, ProjectInvocationReceipt, ProjectToolInvocation, ProjectContext, ProjectWorkflow, ProjectUsage and ProjectUsageRecord and the three orders of RetentionResidencyService, and no other handler of the model; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of each projection change and the dispatcher publishes RunProjectionUpdated and OperationsDigestProduced under the canonical envelope; the inbox registers, with idempotency on the event id, the 26 run events of the handlers ProjectRun, ProjectAttempt, ProjectLease, ProjectExecutionAttempt, ProjectReceipt, ProjectInvocationReceipt, ProjectToolInvocation, ProjectContext, ProjectWorkflow, ProjectUsage and ProjectUsageRecord and the three orders of RetentionResidencyService, and no other handler of the model; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-483]",
      "number": 483
    },
    {
      "id": "AIFACTORY-TASK-484",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "Worker hosting skeleton: triggers, partitioning and retry policies of ProjectionRebuilder and OverviewAggregator",
      "sequence": "13.04.01.07",
      "description": "Worker hosting skeleton: triggers, partitioning and retry policies of ProjectionRebuilder and OverviewAggregator. Expected output: The two workers are hosted with their modelled triggers (on request or restore, a schedule every five minutes), retry policies, partitioning by tenant and idempotency keys (runId plus lastEventSequence, tenantId plus window plus computedAt), and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1125 and AIFACTORY-US-1126.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two workers are hosted with their modelled triggers (on request or restore, a schedule every five minutes), retry policies, partitioning by tenant and idempotency keys (runId plus lastEventSequence, tenantId plus window plus computedAt), and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1125 and AIFACTORY-US-1126."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-484]",
      "number": 484
    },
    {
      "id": "AIFACTORY-TASK-485",
      "type": "task",
      "parent": "AIFACTORY-US-045",
      "title": "Security, tenancy and telemetry of DashboardService",
      "sequence": "13.04.01.08",
      "description": "Security, tenancy and telemetry of DashboardService. Expected output: The three scopes and six roles of the model are enforced, every query is tenant-filtered, the messaging transport and telemetry backend secrets come from secret references, the host makes the one call of the registration of the pinned observability packages, creates the five modelled metrics through its instrument helper and references the conformance test package from its architecture tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three scopes and six roles of the model are enforced, every query is tenant-filtered, the messaging transport and telemetry backend secrets come from secret references, the host makes the one call of the registration of the pinned observability packages, creates the five modelled metrics through its instrument helper and references the conformance test package from its architecture tests."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-485]",
      "number": 485
    },
    {
      "id": "AIFACTORY-US-1123",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-068",
      "title": "Build the projection and the timeline of a run from the events of Run Control, the runtime, the model router, the tool adapter, context and usage",
      "sequence": "13.04.02",
      "description": "As an operator, I want the projection of a run kept current from the events of every platform that touches it, so that one view shows the state, the steps, the attempts, the receipts and the cost of a run without asking each service. The inbox handlers of the run projection each consume one family of events, idempotent on the event id, and join an event to its run by the `runId` and `tenantId` of the run event envelope (ADR-0014). `runId` is optional in docs/reference/schemas/run-event-envelope.schema.json: an event that arrives without it is recorded once in the inbox, projected onto no run, logged with its event id and type and counted, and nothing else changes; which producers may omit it is reported to the owner. `ProjectRun` opens the `RunProjection` on `RunAccepted` with the tenant, project and workflow and follows `RunStateChanged`, `RunCompleted` and `RunFailed` for the state in the vocabulary of Run Control, the duration and the failure class; `approvalsWaiting` is derived from `RunStateChanged` into and out of the state WaitingForApproval, since the service consumes no approval event of Run Control. `ProjectAttempt` records the attempts from `AttemptDispatched`, `AttemptOutcomeRecorded` and `AttemptPhaseChanged`, `ProjectLease` the expired leases from `LeaseExpired`, and `ProjectExecutionAttempt` the attempt start, checkpoints, decisions requested, cancellations observed, reported outcomes and delegations of AgentRuntimeService. `ProjectReceipt` records model receipts with tokens and cost from `ModelInvoked` and tool receipts from `ToolInvoked`, and `ProjectInvocationReceipt` marks the model receipt of `ModelFallbackUsed` as answered by a fallback; `ProjectToolInvocation` records the denied invocations from `ToolInvocationDenied`, counts the uncertain effects from `ToolEffectUncertain` and records the sandbox lease and release of an invocation from `SandboxLeased` and `SandboxReleased`. `ProjectContext` records the snapshots of `ContextAssembled`, `ProjectWorkflow` the step states of `StepRunStateChanged`, and `ProjectUsage` and `ProjectUsageRecord` the usage by status from `UsageRecorded`, `ReservationSettled` and `UsageReconciled`. Each handler appends a `TimelineEntry` with its kind, a receipt, snapshot, approval or decision reference and a summary, updates the counts, the tokens, the cost by status and `lastEventSequence`, sets `updatedAt`, and writes `RunProjectionUpdated` with `runId`, `tenantId`, `state` and `lastEventSequence` in the same transaction. The envelope has no sequence field: the projection assigns the `sequence` of each entry in commit order and `lastEventSequence` is the sequence of the latest entry, while the order of the run itself is read from `aggregate.version` of the envelope on the events whose aggregate is the run, `RunAccepted`, `RunStateChanged`, `RunCompleted` and `RunFailed`; events of other producers take no part in gap detection, and the source of a sequence across producers is reported to the owner. Uncertain amounts are kept by status and never folded into totals (FUX-08), and no content enters a projection. A gap in the run versions is the failure mode out-of-order events: the projection waits for the gap within a window and then rebuilds the run through the rebuilder of AIFACTORY-US-1126. A backlog shows as `connectsoft.factory.operations.projection_lag` and `connectsoft.factory.operations.inbox_lag`, while the truth stays in the producers. The archival to artifacts that `Observability:Operations:TimelineMaxEntries` names has no dependency on ArtifactService in the model and is reported to the owner. StudioBff and StudioRealtimeGateway consume `RunProjectionUpdated` in their own PBIs. Kind: behavior. Traces: services: DashboardService, RunControlService, AgentRuntimeService, ModelRouterService, ToolAdapterService, ContextBuilderService, CostUsageService, WorkflowEngineService; aggregates: DashboardService/RunProjection; events: DashboardService/RunProjectionUpdated, RunControlService/RunAccepted, RunControlService/RunStateChanged, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/AttemptDispatched, RunControlService/AttemptOutcomeRecorded, RunControlService/LeaseExpired, AgentRuntimeService/AttemptPhaseChanged, ModelRouterService/ModelInvoked, ModelRouterService/ModelFallbackUsed, ToolAdapterService/ToolInvoked, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain, ToolAdapterService/SandboxLeased, ToolAdapterService/SandboxReleased, ContextBuilderService/ContextAssembled, CostUsageService/UsageRecorded, CostUsageService/ReservationSettled, CostUsageService/UsageReconciled, WorkflowEngineService/StepRunStateChanged; adrs: ADR-0012, ADR-0014; requirements: FR-10, FUX-07, FUX-08, XL-06; scenarios: SCN-DashboardService-007. Relates: nfrs: NFR-07. Depends on: feature:run-control-service, feature:agent-runtime-service, feature:model-router-service, feature:tool-adapter-service, feature:context-builder-service-thin, feature:cost-usage-service-complete, feature:workflow-engine-service. Sources: model/services/observability/DashboardService.yaml, docs/reference/schemas/run-event-envelope.schema.json, docs/planes/trust-operations/observability/services/dashboard-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given `RunControlService/RunAccepted` of a run, then `RunControlService/AttemptDispatched`, `ModelRouterService/ModelInvoked`, `ToolAdapterService/ToolInvoked`, `ContextBuilderService/ContextAssembled`, `CostUsageService/UsageRecorded` and `RunControlService/RunCompleted` of the same run in sequence, when the handlers consume them, then one `DashboardService/RunProjection` holds the state Completed, the counts of steps, attempts, model calls and tool calls, the tokens, the cost by status and the duration, with one `TimelineEntry` per event in sequence order holding references and hashes and no content; a redelivered event id changes nothing (SCN-DashboardService-007, ADR-0014).",
        "AC2: Given `ToolAdapterService/ToolEffectUncertain` and a `CostUsageService/UsageRecorded` with an uncertain amount for a run, when they are projected, then `uncertainEffects` counts the effect and the uncertain amount is kept under its status in the cost by status and is not part of any total; given `RunControlService/RunStateChanged` into WaitingForApproval and later out of it, then `approvalsWaiting` rises and falls with it; given a `ModelRouterService/ModelFallbackUsed` of an invocation of the run, then its model receipt is marked as a fallback; given an event without `runId` in its envelope, then it is recorded once in the inbox and no projection changes (FUX-08).",
        "AC3: Given a `RunControlService/RunStateChanged` whose `aggregate.version` leaves a gap in the versions of its run, when the gap is not filled within the window, then the run is rebuilt through the rebuilder and the projection afterwards equals the projection built from the complete sequence; while events wait in the inbox, `connectsoft.factory.operations.projection_lag` reports the lag (model/services/observability/DashboardService.yaml).",
        "AC4: Given the projection of a run changed, when the outbox dispatcher publishes `DashboardService/RunProjectionUpdated` on `operations.projections.v1.run-projection-updated`, then the outbox record was written in the transaction of the change, the event is sent under the canonical envelope with `runId`, `tenantId`, `state` and `lastEventSequence`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-DashboardService-007, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-549",
        "AIFACTORY-TASK-4489",
        "AIFACTORY-TASK-4490"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13102,
      "kind": "behavior",
      "traces": {
        "services": [
          "DashboardService",
          "RunControlService",
          "AgentRuntimeService",
          "ModelRouterService",
          "ToolAdapterService",
          "ContextBuilderService",
          "CostUsageService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "DashboardService/RunProjection"
        ],
        "events": [
          "DashboardService/RunProjectionUpdated",
          "RunControlService/RunAccepted",
          "RunControlService/RunStateChanged",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/AttemptDispatched",
          "RunControlService/AttemptOutcomeRecorded",
          "RunControlService/LeaseExpired",
          "AgentRuntimeService/AttemptPhaseChanged",
          "ModelRouterService/ModelInvoked",
          "ModelRouterService/ModelFallbackUsed",
          "ToolAdapterService/ToolInvoked",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain",
          "ToolAdapterService/SandboxLeased",
          "ToolAdapterService/SandboxReleased",
          "ContextBuilderService/ContextAssembled",
          "CostUsageService/UsageRecorded",
          "CostUsageService/ReservationSettled",
          "CostUsageService/UsageReconciled",
          "WorkflowEngineService/StepRunStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ],
        "requirements": [
          "FR-10",
          "FUX-07",
          "FUX-08",
          "XL-06"
        ],
        "scenarios": [
          "SCN-DashboardService-007"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-07"
        ]
      },
      "dependsOn": [
        "feature:run-control-service",
        "feature:agent-runtime-service",
        "feature:model-router-service",
        "feature:tool-adapter-service",
        "feature:context-builder-service-thin",
        "feature:cost-usage-service-complete",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/services/observability/DashboardService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1123]",
      "number": 1123
    },
    {
      "id": "AIFACTORY-TASK-549",
      "type": "task",
      "parent": "AIFACTORY-US-1123",
      "title": "Run projection from the consumed events",
      "sequence": "13.04.02.01",
      "description": "Run projection from the consumed events. Expected output: The handlers ProjectRun, ProjectAttempt, ProjectLease, ProjectExecutionAttempt, ProjectReceipt, ProjectInvocationReceipt, ProjectToolInvocation, ProjectContext, ProjectWorkflow, ProjectUsage and ProjectUsageRecord update the RunProjection of the runId of the envelope and append its TimelineEntry rows in commit order idempotently on the event id, derive approvalsWaiting from RunStateChanged into and out of WaitingForApproval, keep usage by status without folding uncertain amounts, write RunProjectionUpdated in the transaction of the change, record an event without runId in the inbox only, and hand a run whose aggregate versions show a gap that outlasts the window to the rebuilder.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "The handlers ProjectRun, ProjectAttempt, ProjectLease, ProjectExecutionAttempt, ProjectReceipt, ProjectInvocationReceipt, ProjectToolInvocation, ProjectContext, ProjectWorkflow, ProjectUsage and ProjectUsageRecord update the RunProjection of the runId of the envelope and append its TimelineEntry rows in commit order idempotently on the event id, derive approvalsWaiting from RunStateChanged into and out of WaitingForApproval, keep usage by status without folding uncertain amounts, write RunProjectionUpdated in the transaction of the change, record an event without runId in the inbox only, and hand a run whose aggregate versions show a gap that outlasts the window to the rebuilder."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-549]",
      "number": 549
    },
    {
      "id": "AIFACTORY-TASK-4489",
      "type": "task",
      "parent": "AIFACTORY-US-1123",
      "title": "Run event sequences built from the pinned contracts package",
      "sequence": "13.04.02.02",
      "description": "Run event sequences built from the pinned contracts package. Expected output: A fixture builds the consumed events of a run from the pinned contracts package under the run event envelope in a complete sequence, with a redelivered event id, with an uncertain usage amount, with a run that waits for an approval, with a gap in the run versions and with an event without runId, so that the suites of the projection and the rebuild replay the same runs.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "A fixture builds the consumed events of a run from the pinned contracts package under the run event envelope in a complete sequence, with a redelivered event id, with an uncertain usage amount, with a run that waits for an approval, with a gap in the run versions and with an event without runId, so that the suites of the projection and the rebuild replay the same runs."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4489]",
      "number": 4489
    },
    {
      "id": "AIFACTORY-TASK-4490",
      "type": "task",
      "parent": "AIFACTORY-US-1123",
      "title": "Verify run-projection-built-from-run-events through the acceptance suite",
      "sequence": "13.04.02.03",
      "description": "Verify run-projection-built-from-run-events through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DashboardService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1123 with the sequences of AIFACTORY-TASK-4489, including the redelivered event, the uncertain amount kept apart, the gap that leads to a rebuild and the payload of RunProjectionUpdated; consumer handling is proven by the suites of StudioBff and StudioRealtimeGateway.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DashboardService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1123 with the sequences of AIFACTORY-TASK-4489, including the redelivered event, the uncertain amount kept apart, the gap that leads to a rebuild and the payload of RunProjectionUpdated; consumer handling is proven by the suites of StudioBff and StudioRealtimeGateway."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4490]",
      "number": 4490
    },
    {
      "id": "AIFACTORY-US-1124",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-068",
      "title": "List the runs in my scope and read the timeline of one run with its freshness",
      "sequence": "13.04.03",
      "description": "As a requester, I want the runs of my projects with state, counts, cost by status and waits, and the timeline of one run, so that I follow my runs in the Studio and see where one spent its time and money. A caller whose scope carries `factory.runs.read`, a Requester, Reviewer, Operator or Observer, lists the run projections of the trusted tenant and the projects in scope through `DashboardService/ListRunProjections`, the run list of the Studio: each run with its state in the vocabulary of Run Control, the counts of steps, attempts, model and tool calls, the approvals waiting, the uncertain effects, the tokens, the cost by status and `updatedAt`. The read runs under the tenant row filter and the project scope, so runs of another tenant never appear. The same caller reads one run through `DashboardService/GetRunTimeline`: the projection with its `TimelineEntry` rows in sequence order, the original design trace tree as rows of steps, attempts, model and tool receipts, context snapshots, approvals, decisions and usage, each entry with its reference, summary, time, duration and cost and never content, and the `traceId` of the run. Both responses carry the time of the last update and the projection lag, so the Studio shows how fresh the view is. When the telemetry backend answers, the timeline carries a drill-down link for the trace; when it is unavailable, the timeline is served from the store and the link is absent, which is the modelled degradation. The drill-down is built from the model of the service (D140): the option `Observability:Backends:TraceBackend` names the trace and log backend of the installation, Azure Monitor by default and Jaeger or Seq where an installation runs one, and `Observability:Backends:GenAiConventionsVersion` names the version of the OpenTelemetry GenAI semantic conventions the spans follow, 1.x by default; both are bound at startup and neither is reloadable. The link is built for the configured backend from the `traceId` of the run and states the conventions version beside it. The backend is reached as the optional dependency `ext-otel-backend` with the failure mode degrade, and its credential is the secret `otel-backend`, read from its key-vault reference, rotated every 90 days and never written to a log record, an activity, a metric or a response. A backend that does not answer is the failure mode OpenTelemetry backend unavailable, detected by query errors: the projections keep serving from the store, the link is left out and readiness does not change. A caller without the scope is refused with 403; a run of another tenant or outside the projects in scope is answered 404, the same answer as for a `runId` that does not exist (ADR-0015, D113). Nothing is written by these reads. Kind: behavior. Traces: services: DashboardService; aggregates: DashboardService/RunProjection; apis: DashboardService/ListRunProjections, DashboardService/GetRunTimeline; adrs: ADR-0014, ADR-0015; requirements: FUX-04, FUX-07, FUX-08; scenarios: SCN-DashboardService-001, SCN-DashboardService-002. Relates: screens: run-list, run-timeline, run-detail; nfrs: NFR-07. Depends on: AIFACTORY-US-1123. Sources: model/services/observability/DashboardService.yaml, docs/planes/trust-operations/observability/services/dashboard-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given run projections in two projects of my tenant and in another tenant, when `DashboardService/ListRunProjections` is called with `factory.runs.read` for one project in scope, then the response is 200 with the runs of that project only, each with state, counts, approvals waiting, uncertain effects, tokens, cost by status and `updatedAt`, and the projection lag is stated; nothing is written; a caller without the scope is refused with 403 (SCN-DashboardService-001, ADR-0015).",
        "AC2: Given a run of my tenant and project with timeline entries, when `DashboardService/GetRunTimeline` is called, then the response is 200 with the `DashboardService/RunProjection` and its entries in sequence order, each with its kind, reference, summary, time, duration and cost and no content, the `traceId` and a drill-down link while the telemetry backend answers, and `updatedAt` with the projection lag (SCN-DashboardService-002, FUX-04).",
        "AC3: Given the telemetry backend is unavailable, when `DashboardService/GetRunTimeline` is called, then the response is 200 from the store without the drill-down link; given a caller without `factory.runs.read`, a `runId` of another tenant or a `runId` that does not exist, then the response is 403 for the missing scope and 404 for the other two alike, with a problem response and no state change (SCN-DashboardService-002, ADR-0015).",
        "AC4: Given `Observability:Backends:TraceBackend` set in turn to azure-monitor, jaeger and seq and `Observability:Backends:GenAiConventionsVersion` at its default, when `DashboardService/GetRunTimeline` is called for a run with a `traceId`, then the drill-down link has the form of the configured backend for that `traceId` and states the conventions version; the credential of `ext-otel-backend` is read from the key-vault reference of the secret `otel-backend` and appears in no log record, activity, metric or response; given the backend answers with query errors, then the timeline is served without the link and readiness does not change (model/services/observability/DashboardService.yaml, SCN-DashboardService-002)."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4491",
        "AIFACTORY-TASK-6606",
        "AIFACTORY-TASK-4492"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13103,
      "kind": "behavior",
      "traces": {
        "services": [
          "DashboardService"
        ],
        "aggregates": [
          "DashboardService/RunProjection"
        ],
        "apis": [
          "DashboardService/ListRunProjections",
          "DashboardService/GetRunTimeline"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04",
          "FUX-07",
          "FUX-08"
        ],
        "scenarios": [
          "SCN-DashboardService-001",
          "SCN-DashboardService-002"
        ]
      },
      "relates": {
        "screens": [
          "run-list",
          "run-timeline",
          "run-detail"
        ],
        "nfrs": [
          "NFR-07"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1123"
      ],
      "source": [
        "model/services/observability/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1124]",
      "number": 1124
    },
    {
      "id": "AIFACTORY-TASK-4491",
      "type": "task",
      "parent": "AIFACTORY-US-1124",
      "title": "ListRunProjections and GetRunTimeline with project scope, freshness and the degraded drill-down",
      "sequence": "13.04.03.01",
      "description": "ListRunProjections and GetRunTimeline with project scope, freshness and the degraded drill-down. Expected output: ListRunProjections returns the projections of the trusted tenant and the projects in scope with counts, cost by status, updatedAt and the projection lag; GetRunTimeline returns the projection with its entries in sequence order, the traceId and a drill-down link from a typed client of the telemetry backend that is left out when the backend fails; a missing scope is 403 and a foreign, out-of-scope or unknown run is 404.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "ListRunProjections returns the projections of the trusted tenant and the projects in scope with counts, cost by status, updatedAt and the projection lag; GetRunTimeline returns the projection with its entries in sequence order, the traceId and a drill-down link from a typed client of the telemetry backend that is left out when the backend fails; a missing scope is 403 and a foreign, out-of-scope or unknown run is 404."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4491]",
      "number": 4491
    },
    {
      "id": "AIFACTORY-TASK-6606",
      "type": "task",
      "parent": "AIFACTORY-US-1124",
      "title": "Trace drill-down: Observability:Backends TraceBackend and GenAiConventionsVersion, the secret otel-backend and the dependency ext-otel-backend",
      "sequence": "13.04.03.02",
      "description": "Trace drill-down: Observability:Backends TraceBackend and GenAiConventionsVersion, the secret otel-backend and the dependency ext-otel-backend. Expected output: The service binds Observability:Backends:TraceBackend (default azure-monitor; azure-monitor, jaeger or seq) and Observability:Backends:GenAiConventionsVersion (default 1.x) at startup, validates them and fails startup with the value named for a backend it does not know, reloads neither, reads the credential of the backend from the key-vault reference of the secret otel-backend with its rotation of 90 days, and calls ext-otel-backend through a typed client registered as an optional dependency with the failure mode degrade; GetRunTimeline builds the drill-down link from the traceId of the run in the form of the configured backend and states the conventions version beside it, leaves the link out when the backend answers with query errors and logs the failure with the correlation id, and the readiness probe does not report the backend; the credential appears in no log record, activity, metric or response.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "The service binds Observability:Backends:TraceBackend (default azure-monitor; azure-monitor, jaeger or seq) and Observability:Backends:GenAiConventionsVersion (default 1.x) at startup, validates them and fails startup with the value named for a backend it does not know, reloads neither, reads the credential of the backend from the key-vault reference of the secret otel-backend with its rotation of 90 days, and calls ext-otel-backend through a typed client registered as an optional dependency with the failure mode degrade; GetRunTimeline builds the drill-down link from the traceId of the run in the form of the configured backend and states the conventions version beside it, leaves the link out when the backend answers with query errors and logs the failure with the correlation id, and the readiness probe does not report the backend; the credential appears in no log record, activity, metric or response."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6606]",
      "number": 6606
    },
    {
      "id": "AIFACTORY-TASK-4492",
      "type": "task",
      "parent": "AIFACTORY-US-1124",
      "title": "Verify run-list-and-run-timeline-read through the acceptance suite",
      "sequence": "13.04.03.03",
      "description": "Verify run-list-and-run-timeline-read through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DashboardService-001|Scenario=SCN-DashboardService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1124 over a two-tenant fixture with a fake telemetry backend that can fail, including the 404 for a foreign run, the link built for each of the three backends with the conventions version, and a scan of the captured telemetry for the marker credential of otel-backend.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DashboardService-001|Scenario=SCN-DashboardService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1124 over a two-tenant fixture with a fake telemetry backend that can fail, including the 404 for a foreign run, the link built for each of the three backends with the conventions version, and a scan of the captured telemetry for the marker credential of otel-backend."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4492]",
      "number": 4492
    },
    {
      "id": "AIFACTORY-US-1125",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-068",
      "title": "Aggregate tenant, project and subject overviews per window, serve them and announce each digest",
      "sequence": "13.04.04",
      "description": "As a workspace admin, I want success, cost, tokens, latency and tool failures of my tenant and projects over a window, so that I see whether the Factory serves my teams well and what it costs, without counting runs by hand. The `OverviewAggregator` worker runs every five minutes, partitioned by tenant with at most two in parallel, and recomputes the `OverviewProjection` of every tenant and project for each window of `Observability:Operations:Windows` (1h, 24h, 7d, 30d by default) from the run projections updated in the window; aggregates are never written by hand. It computes the metrics whose inputs the run projection holds: task success, cost per task from reconciled amounts, latency per task, tokens per task, tool failure rate, model fallback rate and human intervention rate. Each overview is written once per tenant, kind, subject and window under the unique index, with `computedAt`, and `OperationsDigestProduced` with `tenantId`, `window` and `computedAt` is written in the same transaction; the worker is idempotent on tenant, window and `computedAt` and attempts a failed pass three times in all with the modelled fixed backoff of 60 seconds. The gauges `connectsoft.factory.operations.task_success_rate`, `human_intervention_rate` and `cost_per_task_usd` follow the tenant and window. A caller whose scope carries `factory.operations.read` reads the tenant and project overviews per window through `DashboardService/GetOverview`, and the overview of one subject through `DashboardService/GetSubjectOverview` on `/factory/operations/overview/{kind}/{subjectId}`. In I4 an overview is kept only of the kinds ProjectOverview and TenantOverview (D131): `GetSubjectOverview` serves a ProjectOverview with a project id of the trusted tenant as `subjectId` and a TenantOverview with the id of the trusted tenant, and answers 404 for any other kind, among them AgentPerformance, ToolReliability, ModelUsage and RunTimeline. The overviews AgentPerformance, ToolReliability and ModelUsage, and the metrics agent success, sandbox failures, context retrieval quality and evaluation score for which the run projection holds no input, leave the I4 model and arrive in a later increment. A caller without the scope is refused with 403; a subject of another tenant is answered 404, the same answer as for one that does not exist (ADR-0015, D113). StudioBff and SloService consume `OperationsDigestProduced` in their own PBIs. Kind: behavior. Traces: services: DashboardService; aggregates: DashboardService/OverviewProjection, DashboardService/RunProjection; apis: DashboardService/GetOverview, DashboardService/GetSubjectOverview; events: DashboardService/OperationsDigestProduced; adrs: ADR-0012, ADR-0015; requirements: FR-10, FUX-04, FUX-08; scenarios: SCN-DashboardService-003, SCN-DashboardService-004, SCN-DashboardService-008. Relates: screens: overview; nfrs: NFR-10. Depends on: AIFACTORY-US-1123. Sources: model/services/observability/DashboardService.yaml, docs/planes/trust-operations/observability/services/dashboard-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given run projections of two projects updated within the last hour, when the `OverviewAggregator` runs, then one `DashboardService/OverviewProjection` per tenant and project and per window holds task success, cost per task from reconciled amounts, latency, tokens per task, tool failure rate, model fallback rate and human intervention rate with `computedAt`, and the `DashboardService/OperationsDigestProduced` outbox record is written in the same transaction; a duplicate trigger for the same tenant, window and `computedAt` writes nothing more (SCN-DashboardService-008).",
        "AC2: Given the overviews of my tenant, when `DashboardService/GetOverview` is called with `factory.operations.read`, then the response is 200 with the tenant and project overviews per window, each with `computedAt`, and nothing is written; a caller without the scope is refused with 403 (SCN-DashboardService-003, FUX-08).",
        "AC3: Given the aggregator has written the ProjectOverview of a project of my tenant, when `DashboardService/GetSubjectOverview` is called with the kind ProjectOverview and the project id, then the response is 200 with the metrics of each window and `computedAt`; given the kind AgentPerformance, ToolReliability or ModelUsage with any subject id, a project of another tenant or a project without an overview, then the response is 404 alike, and a caller without the scope is refused with 403, with a problem response and no state change (SCN-DashboardService-004, ADR-0015).",
        "AC4: Given an overview was recomputed, when the outbox dispatcher publishes `DashboardService/OperationsDigestProduced` on `operations.projections.v1.operations-digest-produced`, then the event is sent under the canonical envelope with `tenantId`, `window` and `computedAt`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-DashboardService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-550",
        "AIFACTORY-TASK-4493",
        "AIFACTORY-TASK-4494"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13104,
      "kind": "behavior",
      "traces": {
        "services": [
          "DashboardService"
        ],
        "aggregates": [
          "DashboardService/OverviewProjection",
          "DashboardService/RunProjection"
        ],
        "apis": [
          "DashboardService/GetOverview",
          "DashboardService/GetSubjectOverview"
        ],
        "events": [
          "DashboardService/OperationsDigestProduced"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FR-10",
          "FUX-04",
          "FUX-08"
        ],
        "scenarios": [
          "SCN-DashboardService-003",
          "SCN-DashboardService-004",
          "SCN-DashboardService-008"
        ]
      },
      "relates": {
        "screens": [
          "overview"
        ],
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1123"
      ],
      "source": [
        "model/services/observability/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1125]",
      "number": 1125
    },
    {
      "id": "AIFACTORY-TASK-550",
      "type": "task",
      "parent": "AIFACTORY-US-1125",
      "title": "Overview aggregation per tenant, project and subject",
      "sequence": "13.04.04.01",
      "description": "Overview aggregation per tenant, project and subject. Expected output: The OverviewAggregator recomputes the tenant and project overviews for every configured window from the run projections updated in it, writes each overview under the unique index with computedAt and the OperationsDigestProduced outbox record in one transaction, is idempotent on tenantId, window and computedAt, attempts a failed pass three times in all with a 60 second backoff and sets the three overview gauges.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "The OverviewAggregator recomputes the tenant and project overviews for every configured window from the run projections updated in it, writes each overview under the unique index with computedAt and the OperationsDigestProduced outbox record in one transaction, is idempotent on tenantId, window and computedAt, attempts a failed pass three times in all with a 60 second backoff and sets the three overview gauges."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-550]",
      "number": 550
    },
    {
      "id": "AIFACTORY-TASK-4493",
      "type": "task",
      "parent": "AIFACTORY-US-1125",
      "title": "GetOverview and GetSubjectOverview under the tenant row filter",
      "sequence": "13.04.04.02",
      "description": "GetOverview and GetSubjectOverview under the tenant row filter. Expected output: GetOverview returns the tenant and project overviews of the trusted tenant per window with computedAt; GetSubjectOverview returns the ProjectOverview of a project or the TenantOverview of the trusted tenant addressed by kind and subject id and answers 404 for the kinds AgentPerformance, ToolReliability, ModelUsage and RunTimeline, for a foreign subject and for a subject without an overview alike; a missing scope is 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "GetOverview returns the tenant and project overviews of the trusted tenant per window with computedAt; GetSubjectOverview returns the ProjectOverview of a project or the TenantOverview of the trusted tenant addressed by kind and subject id and answers 404 for the kinds AgentPerformance, ToolReliability, ModelUsage and RunTimeline, for a foreign subject and for a subject without an overview alike; a missing scope is 403."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4493]",
      "number": 4493
    },
    {
      "id": "AIFACTORY-TASK-4494",
      "type": "task",
      "parent": "AIFACTORY-US-1125",
      "title": "Verify overviews-aggregated-per-window through the acceptance suite",
      "sequence": "13.04.04.03",
      "description": "Verify overviews-aggregated-per-window through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DashboardService-003|Scenario=SCN-DashboardService-004|Scenario=SCN-DashboardService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1125 over a two-tenant fixture, including the duplicate trigger, the 200 for a ProjectOverview, the 404 for the kinds AgentPerformance, ToolReliability and ModelUsage and for a foreign subject, and the payload of OperationsDigestProduced; consumer handling is proven by the suites of StudioBff and SloService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-DashboardService-003|Scenario=SCN-DashboardService-004|Scenario=SCN-DashboardService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1125 over a two-tenant fixture, including the duplicate trigger, the 200 for a ProjectOverview, the 404 for the kinds AgentPerformance, ToolReliability and ModelUsage and for a foreign subject, and the payload of OperationsDigestProduced; consumer handling is proven by the suites of StudioBff and SloService."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4494]",
      "number": 4494
    },
    {
      "id": "AIFACTORY-US-1126",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-068",
      "title": "Rebuild the projection of one run from the journal of Run Control and the events of the producers",
      "sequence": "13.04.05",
      "description": "As an operator, I want to rebuild the projection of a run that looks wrong, so that the view returns to what the truth of the run says, without anyone editing a projection by hand. An Operator whose scope carries `factory.operations.admin` asks for the rebuild of one run of the trusted tenant through `DashboardService/RebuildRunProjection` on `/factory/operations/runs/{runId}/rebuild`. The service answers 202 and the `ProjectionRebuilder` worker rebuilds the `RunProjection` and its `TimelineEntry` rows from the journal of Run Control and the events of the producers, replaces the stored rows in one transaction with the `RunProjectionUpdated` outbox record of the rebuilt state, and the rebuilt projection equals the one built from the same events before. The worker is idempotent on the run id and `lastEventSequence`, so a repeated request while a rebuild of the same state is pending answers 202 and rebuilds once; a failed rebuild is attempted five times in all with the modelled exponential backoff from 60 seconds, and the existing projection keeps serving until the rebuild commits. The same worker rebuilds a run whose sequence gap outlasts its window (AIFACTORY-US-1123) and, after a restore, every projection when the projection store was lost, which readiness detects and which comes last in the restore order. The model gives the service a required gRPC dependency on RunControlService for journal reads with the failure mode degrade, but RunControlService models no gRPC method that returns its journal: its one stream, `RunControl.WatchRun`, is a live server stream of run and approval state changes from the moment of the call, not a replay of the journal from the start of the run, so it cannot rebuild a projection; and the model does not say where the events of the producers are read again; both are reported to the owner, and this PBI builds the rebuilder behind a journal port that the acceptance suite binds to a fake. A caller without the scope is refused with 403; a run of another tenant is answered 404, the same answer as for a `runId` that does not exist (ADR-0015, D113). Kind: behavior. Traces: services: DashboardService, RunControlService; aggregates: DashboardService/RunProjection; apis: DashboardService/RebuildRunProjection, DashboardService/GetRunTimeline; events: DashboardService/RunProjectionUpdated; adrs: ADR-0014, ADR-0015, ADR-0018; requirements: FR-10, XL-12; scenarios: SCN-DashboardService-005. Relates: screens: run-list. Depends on: AIFACTORY-US-1123. Sources: model/services/observability/DashboardService.yaml, docs/planes/trust-operations/observability/services/dashboard-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a run of my tenant whose projection was built from a sequence of events, when `DashboardService/RebuildRunProjection` is called with `factory.operations.admin`, then the response is 202, the `ProjectionRebuilder` replaces the `DashboardService/RunProjection` and its entries with the state rebuilt from the journal port and the same events, the result equals the projection built before, and `DashboardService/RunProjectionUpdated` is written in the same transaction (SCN-DashboardService-005).",
        "AC2: Given a rebuild of the same run and `lastEventSequence` already pending, when the request is repeated, then the response is 202 and one rebuild runs; given the journal port fails, then the rebuild is retried with exponential backoff and the existing projection keeps serving `DashboardService/GetRunTimeline` until a rebuild commits (model/services/observability/DashboardService.yaml).",
        "AC3: Given a caller without `factory.operations.admin`, a `runId` of another tenant or a `runId` that does not exist, when `DashboardService/RebuildRunProjection` is called, then the response is 403 for the missing scope and 404 for the other two alike, with a problem response, and no rebuild is started (SCN-DashboardService-005, ADR-0015).",
        "AC4: Given the projection store was restored empty, when readiness reports it and the restore trigger runs, then the `ProjectionRebuilder` rebuilds every run projection from the journal port and the events, partitioned by tenant with at most four in parallel, and each rebuilt run equals its projection before the loss (ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4495",
        "AIFACTORY-TASK-4496",
        "AIFACTORY-TASK-4497"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13105,
      "kind": "behavior",
      "traces": {
        "services": [
          "DashboardService",
          "RunControlService"
        ],
        "aggregates": [
          "DashboardService/RunProjection"
        ],
        "apis": [
          "DashboardService/RebuildRunProjection",
          "DashboardService/GetRunTimeline"
        ],
        "events": [
          "DashboardService/RunProjectionUpdated"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0018"
        ],
        "requirements": [
          "FR-10",
          "XL-12"
        ],
        "scenarios": [
          "SCN-DashboardService-005"
        ]
      },
      "relates": {
        "screens": [
          "run-list"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1123"
      ],
      "source": [
        "model/services/observability/DashboardService.yaml",
        "docs/planes/trust-operations/observability/services/dashboard-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1126]",
      "number": 1126
    },
    {
      "id": "AIFACTORY-TASK-4495",
      "type": "task",
      "parent": "AIFACTORY-US-1126",
      "title": "RebuildRunProjection and the ProjectionRebuilder behind a journal port",
      "sequence": "13.04.05.01",
      "description": "RebuildRunProjection and the ProjectionRebuilder behind a journal port. Expected output: RebuildRunProjection answers 202 and queues the rebuild of a run of the trusted tenant, 403 without the scope and 404 for a foreign or unknown run; the ProjectionRebuilder reads the run through a journal port, replays the events of the run through the handlers of AIFACTORY-US-1123 into a fresh projection, replaces the stored rows with the RunProjectionUpdated outbox record in one transaction, is idempotent on runId plus lastEventSequence, attempts a failed rebuild five times in all with a 60 second exponential backoff and rebuilds every projection on the restore trigger.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "RebuildRunProjection answers 202 and queues the rebuild of a run of the trusted tenant, 403 without the scope and 404 for a foreign or unknown run; the ProjectionRebuilder reads the run through a journal port, replays the events of the run through the handlers of AIFACTORY-US-1123 into a fresh projection, replaces the stored rows with the RunProjectionUpdated outbox record in one transaction, is idempotent on runId plus lastEventSequence, attempts a failed rebuild five times in all with a 60 second exponential backoff and rebuilds every projection on the restore trigger."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4495]",
      "number": 4495
    },
    {
      "id": "AIFACTORY-TASK-4496",
      "type": "task",
      "parent": "AIFACTORY-US-1126",
      "title": "Fake journal port for the rebuild suite",
      "sequence": "13.04.05.02",
      "description": "Fake journal port for the rebuild suite. Expected output: A fake of the journal port returns the journal of the runs of the fixture of AIFACTORY-TASK-4489 and can fail, so that the suite proves the rebuild, the retry and the restore without a deployed Run Control.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "A fake of the journal port returns the journal of the runs of the fixture of AIFACTORY-TASK-4489 and can fail, so that the suite proves the rebuild, the retry and the restore without a deployed Run Control."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13105,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4496]",
      "number": 4496
    },
    {
      "id": "AIFACTORY-TASK-4497",
      "type": "task",
      "parent": "AIFACTORY-US-1126",
      "title": "Verify run-projection-rebuilt-on-request through the acceptance suite",
      "sequence": "13.04.05.03",
      "description": "Verify run-projection-rebuilt-on-request through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DashboardService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1126 against the fake journal port, including the equality of the rebuilt projection, the repeated request, the failing port and the restore of an empty store.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DashboardService-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1126 against the fake journal port, including the equality of the rebuilt projection, the repeated request, the failing port and the restore of an empty store."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4497]",
      "number": 4497
    },
    {
      "id": "AIFACTORY-US-1127",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-068",
      "title": "Stream the projection updates of the runs in scope to the Studio BFF",
      "sequence": "13.04.06",
      "description": "As a requester, I want the run pages of the Studio to move as the run moves, so that I see each change of my run without reloading the page. The Studio BFF opens the internal server stream `DashboardService/Operations.Subscribe` with its workload identity and an `execution-scope-v1` that names the tenant and the projects of the user it serves. The service reads that tenant and project only when the workload token holds the service scope that names DashboardService (D114), and then streams one `run-event-envelope-v1` per committed change of a run projection in scope, carrying the run id, the tenant, the state and `lastEventSequence` of the change, in commit order, until the caller cancels. The stream reads the store under the tenant row filter, so a run of another tenant is never sent, and it writes nothing. A caller without a workload identity is refused with UNAUTHENTICATED, a token without the service scope with PERMISSION_DENIED and a request that fails the validation of `execution-scope-v1` with INVALID_ARGUMENT; no stream is opened. With this operation the service ends the reason for the answer that the operations stream is unavailable, which AIFACTORY-US-036 AC4 of feature `studio-realtime-gateway` gives until the operations projections are delivered. Switching the stream bridge of ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway from that answer to this stream is a change of that repository and is left to feature `studio-realtime-gateway`, which is reported to the owner; StudioRealtimeGateway consumes `RunProjectionUpdated` through its handler `PushRun` in its own PBI. Kind: behavior. Traces: services: DashboardService, StudioBff, StudioRealtimeGateway; aggregates: DashboardService/RunProjection; apis: DashboardService/Operations.Subscribe; descriptors: execution-scope-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015; requirements: FUX-04, FUX-07; scenarios: SCN-DashboardService-006. Relates: screens: run-list, run-timeline. Depends on: AIFACTORY-US-1123. Sources: model/services/observability/DashboardService.yaml, docs/reference/schemas/run-event-envelope.schema.json, docs/reference/schemas/execution-scope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the Studio BFF with a workload token that holds the service scope of DashboardService and an `execution-scope-v1` naming one tenant and project, when `DashboardService/Operations.Subscribe` is called and two runs of that project change, then the stream delivers one `run-event-envelope-v1` per committed change with run id, tenant, state and `lastEventSequence` in commit order, and nothing is written (SCN-DashboardService-006).",
        "AC2: Given a run of another tenant and a run of a project outside the scope change while the stream is open, when the changes commit, then neither is delivered on the stream (SCN-DashboardService-006, ADR-0015).",
        "AC3: Given a caller without workload identity, a token without the service scope of DashboardService or a request that fails validation, when `DashboardService/Operations.Subscribe` is called, then the call is refused with UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT respectively and no stream is opened (SCN-DashboardService-006, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-551",
        "AIFACTORY-TASK-4498"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13106,
      "kind": "behavior",
      "traces": {
        "services": [
          "DashboardService",
          "StudioBff",
          "StudioRealtimeGateway"
        ],
        "aggregates": [
          "DashboardService/RunProjection"
        ],
        "apis": [
          "DashboardService/Operations.Subscribe"
        ],
        "descriptors": [
          "execution-scope-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04",
          "FUX-07"
        ],
        "scenarios": [
          "SCN-DashboardService-006"
        ]
      },
      "relates": {
        "screens": [
          "run-list",
          "run-timeline"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1123"
      ],
      "source": [
        "model/services/observability/DashboardService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-1127]",
      "number": 1127
    },
    {
      "id": "AIFACTORY-TASK-551",
      "type": "task",
      "parent": "AIFACTORY-US-1127",
      "title": "The operations stream to the Studio BFF",
      "sequence": "13.04.06.01",
      "description": "The operations stream to the Studio BFF. Expected output: Operations.Subscribe streams one run-event-envelope-v1 per committed change of a run projection of the tenant and projects of the execution-scope-v1 the caller forwards, in commit order and until the caller cancels, reading the forwarded scope only when the workload token holds the service scope of DashboardService; a caller without identity is UNAUTHENTICATED, a token without the scope PERMISSION_DENIED and an invalid request INVALID_ARGUMENT.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Operations.Subscribe streams one run-event-envelope-v1 per committed change of a run projection of the tenant and projects of the execution-scope-v1 the caller forwards, in commit order and until the caller cancels, reading the forwarded scope only when the workload token holds the service scope of DashboardService; a caller without identity is UNAUTHENTICATED, a token without the scope PERMISSION_DENIED and an invalid request INVALID_ARGUMENT."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-551]",
      "number": 551
    },
    {
      "id": "AIFACTORY-TASK-4498",
      "type": "task",
      "parent": "AIFACTORY-US-1127",
      "title": "Verify operations-stream-for-the-studio through the acceptance suite",
      "sequence": "13.04.06.02",
      "description": "Verify operations-stream-for-the-studio through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DashboardService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1127 with an in-process gRPC client, including the run of another tenant that is never streamed and the three refusals.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-DashboardService-006\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1127 with an in-process gRPC client, including the run of another tenant that is never streamed and the three refusals."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4498]",
      "number": 4498
    },
    {
      "id": "AIFACTORY-US-1128",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-068",
      "title": "Apply retention rules, legal holds and deletion orders to the run projections and overviews of a tenant",
      "sequence": "13.04.07",
      "description": "As a workspace admin, I want the projections of my tenant kept no longer than the retention of the runs, held on a legal hold and deleted on order, so that a deleted run or project leaves no copy behind in the operations views. Three inbox handlers apply the orders of RetentionResidencyService to `dashboard-sql`, each idempotent on the event id. `ApplyRetentionRule` handles `RetentionRuleChanged` and applies the effective retention period of the rule to the records of its store class; run projections follow the retention of the run, one year by default, and the retention job of the service deletes the projections and timeline entries older than the effective period. `ApplyLegalHold` handles `LegalHoldChanged` and suspends deletion and expiry for the held scope while the hold is active. `ExecuteDeletionOrder` handles `DeletionOrderIssued`: an order of tenant scope deletes every row of the tenant in `RunProjections`, `TimelineEntries`, `ProjectionCheckpoints` and `OverviewProjections`; an order of project scope deletes the run projections of the project with their timeline entries and the overviews whose subject is the project; a run purge deletes the projection and the timeline of the run. A held scope is not deleted and the receipt names the hold. The handler acknowledges its task through `RetentionResidencyService/AcknowledgeOrderTask` with the workload token of the service, which holds `factory.data.acknowledge`, and a receipt that names the order, the service, the tables and the row counts; a redelivered order deletes nothing more and acknowledges with the same receipt, and an answer 403 or 404 or a failure before the acknowledgement leaves the task unacknowledged, is logged with the order id and is retried by the inbox. A deleted projection is not rebuilt for a scope the order removed. Kind: behavior. Traces: services: DashboardService, RetentionResidencyService; aggregates: DashboardService/RunProjection, DashboardService/OverviewProjection; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/LegalHoldChanged, RetentionResidencyService/DeletionOrderIssued; adrs: ADR-0019; requirements: XL-14. Depends on: AIFACTORY-US-1123, feature:retention-residency-service. Sources: model/services/observability/DashboardService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given `RetentionResidencyService/DeletionOrderIssued` of project scope for one of two projects, when `ExecuteDeletionOrder` handles it, then the `DashboardService/RunProjection` rows of that project with their timeline entries and the `DashboardService/OverviewProjection` rows whose subject is that project are deleted, the other project and other tenants are untouched, and the task is acknowledged through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt that names the tables and row counts (ADR-0019, XL-14).",
        "AC2: Given an order of tenant scope and a run purge, when they are handled, then every row of the tenant in the four tables, and the projection and timeline of the purged run, are deleted; a redelivered order deletes nothing more and acknowledges with the same receipt; an acknowledgement answered 403 or 404 leaves the task unacknowledged and the inbox retries it (model/services/data-event/RetentionResidencyService.yaml).",
        "AC3: Given `RetentionResidencyService/LegalHoldChanged` that holds a project and `RetentionResidencyService/RetentionRuleChanged` that shortens the retention of the store class of `dashboard-sql`, when the retention job runs, then no projection of the held project is deleted, and after the hold is lifted the projections older than the effective period are deleted (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4499",
        "AIFACTORY-TASK-4500"
      ],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13107,
      "kind": "behavior",
      "traces": {
        "services": [
          "DashboardService",
          "RetentionResidencyService"
        ],
        "aggregates": [
          "DashboardService/RunProjection",
          "DashboardService/OverviewProjection"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/LegalHoldChanged",
          "RetentionResidencyService/DeletionOrderIssued"
        ],
        "adrs": [
          "ADR-0019"
        ],
        "requirements": [
          "XL-14"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1123",
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/observability/DashboardService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1128]",
      "number": 1128
    },
    {
      "id": "AIFACTORY-TASK-4499",
      "type": "task",
      "parent": "AIFACTORY-US-1128",
      "title": "ApplyRetentionRule, ApplyLegalHold and ExecuteDeletionOrder over the four projection tables",
      "sequence": "13.04.07.01",
      "description": "ApplyRetentionRule, ApplyLegalHold and ExecuteDeletionOrder over the four projection tables. Expected output: The three handlers apply the effective retention period through a retention job of the service, suspend and resume expiry and deletion for a held scope, delete the rows of a tenant order, a project order and a run purge in RunProjections, TimelineEntries, ProjectionCheckpoints and OverviewProjections, acknowledge through a typed client of AcknowledgeOrderTask with the workload token that holds factory.data.acknowledge, and are idempotent on the order id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "The three handlers apply the effective retention period through a retention job of the service, suspend and resume expiry and deletion for a held scope, delete the rows of a tenant order, a project order and a run purge in RunProjections, TimelineEntries, ProjectionCheckpoints and OverviewProjections, acknowledge through a typed client of AcknowledgeOrderTask with the workload token that holds factory.data.acknowledge, and are idempotent on the order id."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13107,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4499]",
      "number": 4499
    },
    {
      "id": "AIFACTORY-TASK-4500",
      "type": "task",
      "parent": "AIFACTORY-US-1128",
      "title": "Verify projections-follow-retention-and-deletion-orders through the acceptance suite",
      "sequence": "13.04.07.02",
      "description": "Verify projections-follow-retention-and-deletion-orders through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1128 over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and can answer 403 and 404, including the redelivered order and the hold that blocks expiry.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.DashboardService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1128 over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and can answer 403 and 404, including the redelivered order and the hold that blocks expiry."
      ],
      "sourceArtifacts": [
        "model/services/observability/DashboardService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.DashboardService"
      ],
      "children": [],
      "buildOrder": 131,
      "phase": "factory",
      "stackRank": 13107,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4500]",
      "number": 4500
    },
    {
      "id": "AIFACTORY-FEAT-069",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-013",
      "title": "FeedbackService: complete delivery",
      "sequence": "13.05",
      "description": "FeedbackService is the service of bounded context BC-22 (Evaluation & Learning). Human feedback on runs and artifacts, evaluation datasets built from historical tasks and completed runs, and learning proposals (prompt, skill and context-strategy improvements, threshold changes, dataset additions) raised from feedback, drift and reinforced memory for Asset maintainers to review; nothing changes an asset without a release (BC-22, original design §32). Its own repository is ConnectSoft.AI.SoftwareFactory.FeedbackService. Delivers: FeedbackService (complete). Increment I4: Trust and accountability. Build order 132 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-046",
        "AIFACTORY-US-1098",
        "AIFACTORY-US-1099",
        "AIFACTORY-US-1100",
        "AIFACTORY-US-1101",
        "AIFACTORY-US-1102",
        "AIFACTORY-US-1103"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13200,
      "titlePrefix": "[AIFACTORY-FEAT-069]",
      "number": 69
    },
    {
      "id": "AIFACTORY-US-046",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-069",
      "title": "Feedback becomes datasets and proposals that a person decides",
      "sequence": "13.05.01",
      "description": "As an asset maintainer, I want the feedback of people and the failures of runs collected into datasets and improvement proposals, so that the next release of an agent is better for a reason I can inspect. This is the integration PBI of the complete delivery of FeedbackService, the service of bounded context BC-22 that closes the learning loop of model/services/observability/FeedbackService.yaml, in which nothing changes an asset without a release. A requester, reviewer or operator records feedback on a run, an attempt, an artifact, a memory or an evaluation, and the feedback is listed by subject and kind (AIFACTORY-US-1098). Completed runs, validator outcomes and merged changes are harvested as dataset tasks, and an Asset maintainer or Platform admin snapshots a dataset into a new immutable version stored as an artifact and announced to the suites (AIFACTORY-US-1099), which QualityScoreService resolves to its snapshot artifact through an internal method (AIFACTORY-US-1100). The ProposalGenerator worker clusters feedback, drift and failed evaluations per asset and raises learning proposals with evidence and an expected effect, which maintainers list (AIFACTORY-US-1101), and an Asset maintainer accepts a proposal, for which AgentRegistryService opens a Draft release in BC-04 that FeedbackService records from `LearningReleaseOpened` (D131), or rejects it with a reason (AIFACTORY-US-1102). Retention, deletion and legal hold orders are applied to the records of the service (AIFACTORY-US-1103). Every query runs under the tenant row filter of the service and a resource of another tenant is answered 404, the same answer as for one that does not exist (ADR-0015 amendment D113); tasks derived from tenant runs stay tenant-scoped (D32). Two consumed events of the model come from services delivered after this increment, `SkillCandidateProposed` of MemoryPromotionService (I5) and `IncidentResolved` of FleetIncidentService (I7); separately, the optional consent check of MemoryPromotionService for shared datasets also arrives with that service. Both handlers and the consent client are built against the contracts package here and receive their first events when those services arrive, and until then no dataset is shared across tenants. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService, created by the first task of this feature with the steps of the repository checklist. Kind: behavior. Traces: services: FeedbackService, QualityScoreService, AgentRegistryService; aggregates: FeedbackService/HumanFeedback, FeedbackService/Dataset, FeedbackService/LearningProposal; apis: FeedbackService/RecordFeedback, FeedbackService/ListFeedback, FeedbackService/ListDatasets, FeedbackService/SnapshotDataset, FeedbackService/ListLearningProposals, FeedbackService/DecideLearningProposal, FeedbackService/Learning.GetDatasetSnapshot; events: FeedbackService/FeedbackRecorded, FeedbackService/DatasetPublished, FeedbackService/LearningProposalRaised, FeedbackService/LearningProposalDecided; adrs: ADR-0015, ADR-0021; requirements: FR-11, FUX-09, FUX-10, NFR-11, NFR-16, XL-08. Relates: screens: feedback, datasets, learning-proposals. Depends on: AIFACTORY-US-1098, AIFACTORY-US-1099, AIFACTORY-US-1100, AIFACTORY-US-1101, AIFACTORY-US-1102, AIFACTORY-US-1103, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile. Sources: model/services/observability/FeedbackService.yaml, docs/architecture/adr/0021-quality-gates.md, docs/planes/trust-operations/observability/services/feedback-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a run or an artifact, when a person records feedback on it, then `FeedbackService/FeedbackRecorded` is published with the tenant and the subject, as AIFACTORY-US-1098 proves (ADR-0021).",
        "AC2: Given a dataset, when a snapshot is taken through `FeedbackService/SnapshotDataset`, then the snapshot is immutable, stored as an artifact and published as a version through `FeedbackService/DatasetPublished`, as AIFACTORY-US-1099 proves (ADR-0021).",
        "AC3: Given failed evaluations or detected drift with enough evidence, when the generator runs, then a learning proposal is raised with its evidence through `FeedbackService/LearningProposalRaised`, as AIFACTORY-US-1101 proves (ADR-0021).",
        "AC4: Given a learning proposal in review, when a maintainer accepts it through `FeedbackService/DecideLearningProposal`, then `FeedbackService/LearningProposalDecided` is published and AgentRegistryService opens the release candidate; a rejection is recorded with its reason, as AIFACTORY-US-1102 proves (ADR-0021)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-486",
        "AIFACTORY-TASK-487",
        "AIFACTORY-TASK-488",
        "AIFACTORY-TASK-489",
        "AIFACTORY-TASK-490",
        "AIFACTORY-TASK-491",
        "AIFACTORY-TASK-492",
        "AIFACTORY-TASK-770"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "behavior",
      "traces": {
        "services": [
          "FeedbackService",
          "QualityScoreService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "FeedbackService/HumanFeedback",
          "FeedbackService/Dataset",
          "FeedbackService/LearningProposal"
        ],
        "apis": [
          "FeedbackService/RecordFeedback",
          "FeedbackService/ListFeedback",
          "FeedbackService/ListDatasets",
          "FeedbackService/SnapshotDataset",
          "FeedbackService/ListLearningProposals",
          "FeedbackService/DecideLearningProposal",
          "FeedbackService/Learning.GetDatasetSnapshot"
        ],
        "events": [
          "FeedbackService/FeedbackRecorded",
          "FeedbackService/DatasetPublished",
          "FeedbackService/LearningProposalRaised",
          "FeedbackService/LearningProposalDecided"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-11",
          "FUX-09",
          "FUX-10",
          "NFR-11",
          "NFR-16",
          "XL-08"
        ]
      },
      "relates": {
        "screens": [
          "feedback",
          "datasets",
          "learning-proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1098",
        "AIFACTORY-US-1099",
        "AIFACTORY-US-1100",
        "AIFACTORY-US-1101",
        "AIFACTORY-US-1102",
        "AIFACTORY-US-1103",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/services/observability/FeedbackService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-046]",
      "number": 46
    },
    {
      "id": "AIFACTORY-TASK-486",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.FeedbackService and scaffold it from the base template with the Factory profile",
      "sequence": "13.05.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.FeedbackService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.FeedbackService --UseFactoryProfile true` from the pinned template package, whose version the repository records; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.FeedbackService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.FeedbackService --UseFactoryProfile true` from the pinned template package, whose version the repository records; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-486]",
      "number": 486
    },
    {
      "id": "AIFACTORY-TASK-487",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "Domain model: HumanFeedback, Dataset, LearningProposal",
      "sequence": "13.05.01.02",
      "description": "Domain model: HumanFeedback, Dataset, LearningProposal. Expected output: Aggregates with their invariants and the four transitions of ProposalState as modelled; unit tests cover every invariant and every transition, and a transition the model does not list is refused.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Aggregates with their invariants and the four transitions of ProposalState as modelled; unit tests cover every invariant and every transition, and a transition the model does not list is refused."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-487]",
      "number": 487
    },
    {
      "id": "AIFACTORY-TASK-488",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "Persistence in feedback-sql: HumanFeedback, Datasets, DatasetTasks, LearningProposals",
      "sequence": "13.05.01.03",
      "description": "Persistence in feedback-sql: HumanFeedback, Datasets, DatasetTasks, LearningProposals. Expected output: Mappings and migrations for the modelled tables with tenant filters and the indexes IX_Feedback_Subject, UX_Datasets_Name_Version, IX_Proposals_Tenant_State and IX_Proposals_Target; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the modelled tables with tenant filters and the indexes IX_Feedback_Subject, UX_Datasets_Name_Version, IX_Proposals_Tenant_State and IX_Proposals_Target; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-488]",
      "number": 488
    },
    {
      "id": "AIFACTORY-TASK-489",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "API hosting: 6 REST and 1 gRPC operations (RecordFeedback, ListFeedback, ListDatasets, SnapshotDataset, ListLearningProposals, DecideLearningProposal, Learning.GetDatasetSnapshot)",
      "sequence": "13.05.01.04",
      "description": "API hosting: 6 REST and 1 gRPC operations (RecordFeedback, ListFeedback, ListDatasets, SnapshotDataset, ListLearningProposals, DecideLearningProposal, Learning.GetDatasetSnapshot). Expected output: The six REST routes and the gRPC method are hosted with JWT validation, scope enforcement per route, workload identity checks on the gRPC method, problem responses for every modelled refusal code and the Idempotency-Key filter of RecordFeedback and SnapshotDataset; the behaviour of each operation is delivered by AIFACTORY-US-1098 to AIFACTORY-US-1102.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The six REST routes and the gRPC method are hosted with JWT validation, scope enforcement per route, workload identity checks on the gRPC method, problem responses for every modelled refusal code and the Idempotency-Key filter of RecordFeedback and SnapshotDataset; the behaviour of each operation is delivered by AIFACTORY-US-1098 to AIFACTORY-US-1102."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-489]",
      "number": 489
    },
    {
      "id": "AIFACTORY-TASK-490",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "Messaging: publishes 4 events, handles 11",
      "sequence": "13.05.01.05",
      "description": "Messaging: publishes 4 events, handles 11. Expected output: Events are published through the outbox of the feedback profile under the run envelope (FeedbackRecorded, DatasetPublished, LearningProposalRaised, LearningProposalDecided); the inbox registers the eleven consumed events idempotently on the event id; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Events are published through the outbox of the feedback profile under the run envelope (FeedbackRecorded, DatasetPublished, LearningProposalRaised, LearningProposalDecided); the inbox registers the eleven consumed events idempotently on the event id; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-490]",
      "number": 490
    },
    {
      "id": "AIFACTORY-TASK-491",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "Workers: ProposalGenerator, DatasetSnapshotter",
      "sequence": "13.05.01.06",
      "description": "Workers: ProposalGenerator, DatasetSnapshotter. Expected output: Each worker runs with its modelled trigger, retry policy, idempotency key and concurrency partitioned by tenant; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1099 and AIFACTORY-US-1101.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Each worker runs with its modelled trigger, retry policy, idempotency key and concurrency partitioned by tenant; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1099 and AIFACTORY-US-1101."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-491]",
      "number": 491
    },
    {
      "id": "AIFACTORY-TASK-492",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "Security, tenancy and telemetry of FeedbackService",
      "sequence": "13.05.01.07",
      "description": "Security, tenancy and telemetry of FeedbackService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered and a resource of another tenant is answered 404 (ADR-0015 amendment D113), secrets come from secret references, and traces, metrics and health checks follow the observability conventions with the four modelled metrics, among them the gauge connectsoft.factory.learning.inbox_lag, the age in seconds of the oldest unprocessed inbox message of the service, measured by the inbox of the messaging profile (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered and a resource of another tenant is answered 404 (ADR-0015 amendment D113), secrets come from secret references, and traces, metrics and health checks follow the observability conventions with the four modelled metrics, among them the gauge connectsoft.factory.learning.inbox_lag, the age in seconds of the oldest unprocessed inbox message of the service, measured by the inbox of the messaging profile (D140)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-492]",
      "number": 492
    },
    {
      "id": "AIFACTORY-TASK-770",
      "type": "task",
      "parent": "AIFACTORY-US-046",
      "title": "Verify feedback-to-learning-proposal by running the declared command",
      "sequence": "13.05.01.08",
      "description": "Verify feedback-to-learning-proposal by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance`; a zero-match filter counts as a failure; it passes and proves AC1 to AC4 of AIFACTORY-US-046 end to end: feedback recorded and published, a dataset snapshot published as a version, a proposal raised from evaluation and drift evidence, and a proposal accepted and rejected.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance`; a zero-match filter counts as a failure; it passes and proves AC1 to AC4 of AIFACTORY-US-046 end to end: feedback recorded and published, a dataset snapshot published as a version, a proposal raised from evaluation and drift evidence, and a proposal accepted and rejected."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-770]",
      "number": 770
    },
    {
      "id": "AIFACTORY-US-1098",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-069",
      "title": "Record feedback on a run, attempt, artifact, memory or evaluation and list it by subject and kind",
      "sequence": "13.05.02",
      "description": "As a reviewer, I want to rate, correct, comment on or escalate what a run produced, and see the feedback others gave on the same subject, so that what people think of a result is kept as evidence for datasets and proposals without changing the result itself. A requester, reviewer or operator whose scope carries `factory.feedback.write` records feedback through `RecordFeedback` with an `Idempotency-Key`. The body names the subject kind (run, attempt, artifact, memory or evaluation) and the subject reference, the feedback kind (Rating, Correction, Comment or Escalation), a rating where the kind is Rating, the comment text and optionally a corrected artifact. The tenant and the project come from the trusted scope and `givenBy` from the token, never from the body (ADR-0015). The comment text is stored as an artifact through ArtifactService, a required dependency that fails fast, and only its reference is kept; feedback references its subject by id and never alters it. The service writes the `HumanFeedback` row with `givenAt` and the `FeedbackRecorded` outbox record with `feedbackId`, `tenantId`, `subjectKind`, `subjectRef`, `kind` and `rating` in one transaction and answers 201 with the feedback location. A repeated call under the same key and body returns the same feedback and changes nothing; a caller without the scope is refused with 403. The model lists only 201 and 403 for this operation, so the answer to a body that fails validation and to a key reused with a different body is an open point reported with this feature; whatever the code, neither writes a row or publishes. When ArtifactService is unreachable the call fails fast and nothing is written, and the caller repeats it under the same key. A caller whose scope carries `factory.feedback.read` lists feedback through `ListFeedback`, filtered by subject and kind, under the tenant row filter and the projects in scope; a caller without the scope is refused with 403. The resolved incidents of FleetIncidentService become feedback on the releases involved through the handler `HarvestIncident`, built here against the contracts package, which receives its first event when that service arrives in I7. The counter `connectsoft.factory.learning.feedback` moves with each recorded feedback. Kind: behavior. Traces: services: FeedbackService, ArtifactService; aggregates: FeedbackService/HumanFeedback; apis: FeedbackService/RecordFeedback, FeedbackService/ListFeedback; events: FeedbackService/FeedbackRecorded; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FUX-09, NFR-16; scenarios: SCN-FeedbackService-001, SCN-FeedbackService-002, SCN-FeedbackService-008. Relates: screens: feedback. Depends on: feature:artifact-service. Sources: model/services/observability/FeedbackService.yaml, docs/planes/trust-operations/observability/services/feedback-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.feedback.write` and a valid body naming a run, when `FeedbackService/RecordFeedback` is called with an `Idempotency-Key`, then the response is 201, the `FeedbackService/HumanFeedback` row holds tenant and project from the trusted scope, `givenBy` from the token and the reference of the comment stored through ArtifactService, and the `FeedbackService/FeedbackRecorded` outbox record is written in the same transaction; the same key and body return the same feedback and change nothing (SCN-FeedbackService-001, ADR-0015).",
        "AC2: Given a caller without `factory.feedback.write`, a body that fails validation, or a key reused with a different body, when `FeedbackService/RecordFeedback` is called, then it is refused with a problem response, 403 for the missing scope, and no row is written and nothing is published; given ArtifactService unreachable, then the call fails fast and nothing is written (SCN-FeedbackService-001).",
        "AC3: Given feedback on several subjects in two tenants, when `FeedbackService/ListFeedback` is called with `factory.feedback.read` and a subject and kind filter, then the response is 200 with the matching feedback of the caller tenant and projects only; a caller without the scope is refused with 403 and nothing is written (SCN-FeedbackService-002, ADR-0015).",
        "AC4: Given the record was written, when the dispatcher of the `feedback` profile publishes `FeedbackService/FeedbackRecorded` on `evaluation.feedback.v1.feedback-recorded`, then it is sent under the canonical envelope with `feedbackId`, `tenantId`, `subjectKind`, `subjectRef`, `kind` and `rating`, and an outage is retried so it is neither lost nor duplicated under its event id (SCN-FeedbackService-008, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-552",
        "AIFACTORY-TASK-4383"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13202,
      "kind": "behavior",
      "traces": {
        "services": [
          "FeedbackService",
          "ArtifactService"
        ],
        "aggregates": [
          "FeedbackService/HumanFeedback"
        ],
        "apis": [
          "FeedbackService/RecordFeedback",
          "FeedbackService/ListFeedback"
        ],
        "events": [
          "FeedbackService/FeedbackRecorded"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FUX-09",
          "NFR-16"
        ],
        "scenarios": [
          "SCN-FeedbackService-001",
          "SCN-FeedbackService-002",
          "SCN-FeedbackService-008"
        ]
      },
      "relates": {
        "screens": [
          "feedback"
        ]
      },
      "dependsOn": [
        "feature:artifact-service"
      ],
      "source": [
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1098]",
      "number": 1098
    },
    {
      "id": "AIFACTORY-TASK-552",
      "type": "task",
      "parent": "AIFACTORY-US-1098",
      "title": "Feedback on runs, attempts, artifacts, memories and evaluations",
      "sequence": "13.05.02.01",
      "description": "Feedback on runs, attempts, artifacts, memories and evaluations. Expected output: RecordFeedback takes tenant, project and author from the trusted scope, stores the comment through ArtifactService, writes HumanFeedback with its FeedbackRecorded outbox record in one transaction and answers 201, repeats under the same key without a second row and fails fast without a write when ArtifactService is unreachable; ListFeedback returns feedback by subject and kind under the tenant row filter; HarvestIncident is registered against the contracts package; the feedback counter moves with each record.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "RecordFeedback takes tenant, project and author from the trusted scope, stores the comment through ArtifactService, writes HumanFeedback with its FeedbackRecorded outbox record in one transaction and answers 201, repeats under the same key without a second row and fails fast without a write when ArtifactService is unreachable; ListFeedback returns feedback by subject and kind under the tenant row filter; HarvestIncident is registered against the contracts package; the feedback counter moves with each record."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-552]",
      "number": 552
    },
    {
      "id": "AIFACTORY-TASK-4383",
      "type": "task",
      "parent": "AIFACTORY-US-1098",
      "title": "Verify recording and listing feedback through the acceptance suite",
      "sequence": "13.05.02.02",
      "description": "Verify recording and listing feedback through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-001|Scenario=SCN-FeedbackService-002|Scenario=SCN-FeedbackService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1098 with a fake ArtifactService: the recorded feedback and its repeat, the refusals without a write, the fail-fast store, the listing by subject and kind across two tenants, and the publication and payload of FeedbackRecorded through an outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-001|Scenario=SCN-FeedbackService-002|Scenario=SCN-FeedbackService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1098 with a fake ArtifactService: the recorded feedback and its repeat, the refusals without a write, the fail-fast store, the listing by subject and kind across two tenants, and the publication and payload of FeedbackRecorded through an outage."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4383]",
      "number": 4383
    },
    {
      "id": "AIFACTORY-US-1099",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-069",
      "title": "Harvest dataset tasks from runs, validations and merged changes and snapshot a dataset into an immutable published version",
      "sequence": "13.05.03",
      "description": "As an asset maintainer, I want datasets of historical tasks built from what the Factory actually ran, and a new immutable version when I snapshot one, so that suites evaluate releases on real tasks of my tenant and every evaluation names the exact data it used. Datasets are built from completed runs, validator outcomes, merged changes and curated additions. `RunCompleted` of RunControlService (handler `HarvestTask`) makes a completed run a dataset task candidate with its source run and the references of its input and outcome; `ArtifactValidated` of ArtifactService (handler `HarvestValidation`) enriches a candidate with the validator verdict; `ChangeProposalMerged` of PipelineExecutionService (handler `HarvestTask`) harvests a merged change as an accepted task outcome. Each handler is idempotent on the event id and keeps the task in the tenant of the run (D32). A caller whose scope carries `factory.evaluation.read` lists the datasets of the tenant through `ListDatasets` with their versions, task counts and classification; a caller without the scope is refused with 403. An Asset maintainer or Platform admin whose scope carries `factory.evaluation.run` snapshots a dataset through `SnapshotDataset` with an `Idempotency-Key`; the service answers 202 and the DatasetSnapshotter worker, triggered by the operation, builds the snapshot from the tasks and the curated additions of the dataset, stores it through ArtifactService as an immutable artifact, and writes a new `Datasets` row, with a new `DatasetId`, the same tenant and name, the version of the addressed row plus one, the task count, `snapshotRef` and `publishedAt`, and the `DatasetTasks` rows of that version under the new `DatasetId`, together with the `DatasetPublished` outbox record with `datasetId`, `tenantId`, `name`, `version` and `taskCount`, in one transaction. Earlier rows are never updated, so the snapshot reference and the tasks of an earlier version stay as they were, and the path `{datasetId}` names any version of the dataset whose next version is to be written. `SnapshotRef` is non-null and `DatasetTasks` has a foreign key to `Datasets`, so no row can hold harvested tasks before the first snapshot of a dataset: until the owner decides, harvested candidates are held in a candidate table of the service keyed by tenant, dataset name and task id, outside the tables of the model, and are copied into `DatasetTasks` of the version the snapshot writes. The non-null `SnapshotRef`, the per-version identity of `datasetId`, the pin of `EvaluationSuites` on `DatasetId` alone, which then pins one version, and how the first version of a new dataset is created when no row exists for the path to address are open points reported with this feature. The idempotency key of the worker is `datasetId` plus the version, so a repeated call or a duplicate trigger publishes one version; its retry policy is exponential with three attempts, and when they are exhausted no version is written and nothing is published. A dataset of another tenant and an unknown dataset are answered 404, the same answer for both (ADR-0015 amendment D113); a caller without the scope is refused with 403. A snapshot is never changed after it is written, and a suite pins a snapshot version. Sharing a dataset across tenants needs anonymisation and consent, checked through MemoryPromotionService, which arrives in I5; until then every dataset stays in its tenant. The gauge `connectsoft.factory.learning.datasets` moves with each version. Kind: behavior. Traces: services: FeedbackService, ArtifactService, RunControlService, PipelineExecutionService; aggregates: FeedbackService/Dataset; apis: FeedbackService/ListDatasets, FeedbackService/SnapshotDataset; events: FeedbackService/DatasetPublished, RunControlService/RunCompleted, ArtifactService/ArtifactValidated, PipelineExecutionService/ChangeProposalMerged; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: NFR-16, XL-08; scenarios: SCN-FeedbackService-003, SCN-FeedbackService-004, SCN-FeedbackService-009. Relates: screens: datasets. Depends on: feature:artifact-service, feature:run-control-service, feature:pipeline-execution-service-complete. Sources: model/services/observability/FeedbackService.yaml, docs/planes/trust-operations/observability/services/feedback-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given `RunControlService/RunCompleted`, `ArtifactService/ArtifactValidated` and `PipelineExecutionService/ChangeProposalMerged` of one tenant, when the harvest handlers run, then dataset task candidates exist in that tenant with their source run, input, outcome and validator verdict, and a redelivered event adds nothing (model/services/observability/FeedbackService.yaml, ADR-0015).",
        "AC2: Given a caller with `factory.evaluation.run` and a dataset of the caller tenant, when `FeedbackService/SnapshotDataset` is called with an `Idempotency-Key`, then the response is 202, the snapshot is stored once through ArtifactService as an immutable artifact, a new `FeedbackService/Dataset` row with a new `datasetId`, the same tenant and name, the version plus one, its task count, `snapshotRef` and tasks is written while every earlier row stays unchanged, and the `FeedbackService/DatasetPublished` outbox record is written in the same transaction; a repeated call publishes no second version (SCN-FeedbackService-004, ADR-0021).",
        "AC3: Given a dataset of another tenant or an unknown id, or a caller without the scope, when `FeedbackService/SnapshotDataset` is called, then it is answered 404 or 403 and nothing is written; given ArtifactService fails on all three attempts of the worker, then no version is written and nothing is published (SCN-FeedbackService-004, ADR-0015).",
        "AC4: Given a caller with `factory.evaluation.read`, when `FeedbackService/ListDatasets` is called, then the response is 200 with the datasets of the caller tenant, their versions, task counts and classification; without the scope it is 403; when the dispatcher publishes `FeedbackService/DatasetPublished` on `evaluation.datasets.v1.dataset-published`, then it is sent under the canonical envelope with `datasetId`, `tenantId`, `name`, `version` and `taskCount`, and an outage is retried so it is neither lost nor duplicated (SCN-FeedbackService-003, SCN-FeedbackService-009, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-553",
        "AIFACTORY-TASK-4384",
        "AIFACTORY-TASK-4385"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13203,
      "kind": "behavior",
      "traces": {
        "services": [
          "FeedbackService",
          "ArtifactService",
          "RunControlService",
          "PipelineExecutionService"
        ],
        "aggregates": [
          "FeedbackService/Dataset"
        ],
        "apis": [
          "FeedbackService/ListDatasets",
          "FeedbackService/SnapshotDataset"
        ],
        "events": [
          "FeedbackService/DatasetPublished",
          "RunControlService/RunCompleted",
          "ArtifactService/ArtifactValidated",
          "PipelineExecutionService/ChangeProposalMerged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "NFR-16",
          "XL-08"
        ],
        "scenarios": [
          "SCN-FeedbackService-003",
          "SCN-FeedbackService-004",
          "SCN-FeedbackService-009"
        ]
      },
      "relates": {
        "screens": [
          "datasets"
        ]
      },
      "dependsOn": [
        "feature:artifact-service",
        "feature:run-control-service",
        "feature:pipeline-execution-service-complete"
      ],
      "source": [
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1099]",
      "number": 1099
    },
    {
      "id": "AIFACTORY-TASK-553",
      "type": "task",
      "parent": "AIFACTORY-US-1099",
      "title": "Datasets and snapshots",
      "sequence": "13.05.03.01",
      "description": "Datasets and snapshots. Expected output: HarvestTask and HarvestValidation turn RunCompleted, ArtifactValidated and ChangeProposalMerged into tenant-scoped dataset task candidates held in the candidate table, idempotently; ListDatasets returns the datasets of the tenant; SnapshotDataset answers 202 and triggers DatasetSnapshotter, which stores the snapshot through ArtifactService and writes a new Datasets row with a new DatasetId and the version plus one, its DatasetTasks copied from the candidates and its DatasetPublished outbox record in one transaction, never updating an earlier row, keyed by datasetId and version, with the exponential retry policy and nothing written when it is exhausted.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "HarvestTask and HarvestValidation turn RunCompleted, ArtifactValidated and ChangeProposalMerged into tenant-scoped dataset task candidates held in the candidate table, idempotently; ListDatasets returns the datasets of the tenant; SnapshotDataset answers 202 and triggers DatasetSnapshotter, which stores the snapshot through ArtifactService and writes a new Datasets row with a new DatasetId and the version plus one, its DatasetTasks copied from the candidates and its DatasetPublished outbox record in one transaction, never updating an earlier row, keyed by datasetId and version, with the exponential retry policy and nothing written when it is exhausted."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-553]",
      "number": 553
    },
    {
      "id": "AIFACTORY-TASK-4384",
      "type": "task",
      "parent": "AIFACTORY-US-1099",
      "title": "Harvest and snapshot fixtures",
      "sequence": "13.05.03.02",
      "description": "Harvest and snapshot fixtures. Expected output: The acceptance suite holds RunCompleted, ArtifactValidated and ChangeProposalMerged fixtures of two tenants from the contracts package, datasets with curated additions in both tenants, a fake ArtifactService that can fail a given number of times, and a transport switch for the outbox dispatcher.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "The acceptance suite holds RunCompleted, ArtifactValidated and ChangeProposalMerged fixtures of two tenants from the contracts package, datasets with curated additions in both tenants, a fake ArtifactService that can fail a given number of times, and a transport switch for the outbox dispatcher."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13203,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4384]",
      "number": 4384
    },
    {
      "id": "AIFACTORY-TASK-4385",
      "type": "task",
      "parent": "AIFACTORY-US-1099",
      "title": "Verify harvest, listing and snapshot through the acceptance suite",
      "sequence": "13.05.03.03",
      "description": "Verify harvest, listing and snapshot through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-003|Scenario=SCN-FeedbackService-004|Scenario=SCN-FeedbackService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1099: the harvested candidates and their redelivery, the snapshot published once as a new row with its version while the earlier row stays unchanged, the 404 for another tenant, the 403, the exhausted retry without a version, the listing and the publication and payload of DatasetPublished through an outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-003|Scenario=SCN-FeedbackService-004|Scenario=SCN-FeedbackService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1099: the harvested candidates and their redelivery, the snapshot published once as a new row with its version while the earlier row stays unchanged, the 404 for another tenant, the 403, the exhausted retry without a version, the listing and the publication and payload of DatasetPublished through an outage."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4385]",
      "number": 4385
    },
    {
      "id": "AIFACTORY-US-1100",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-069",
      "title": "Resolve a dataset version to its snapshot artifact for an evaluation suite over the internal gRPC method",
      "sequence": "13.05.04",
      "description": "As an asset maintainer, I want the evaluation service to read the exact snapshot my suite pins, so that every evaluation runs on the data the suite names and on nothing else. QualityScoreService starts an evaluation only after it has resolved the dataset version its suite pins to the snapshot artifact, through the internal gRPC method `Learning.GetDatasetSnapshot` of FeedbackService. The caller presents a workload identity that holds the service scope that names FeedbackService (D114), and forwards the tenant of the evaluation as metadata. The model declares `artifact-v1` as the request, and `artifact-v1` requires `artifactId`, `kind`, `contentHash`, `contentRef`, `classification`, `validation` and `createdAt` and has no field for a dataset or a version, so a caller cannot build a valid request that names the dataset version before it has resolved the snapshot; this is an open point reported with this feature. Until the owner decides, the request carries the per-version `datasetId` of AIFACTORY-US-1099 in the gRPC metadata `dataset-id` and its version in `dataset-version`, the service checks that both name the same `Datasets` row and does not read the body. The service reads that row under the forwarded tenant and replies with `artifact-v1` carrying the `snapshotRef` of the immutable snapshot. The method is of class read: it writes nothing, publishes nothing and answers the same for the same request. A version that does not exist, a dataset of another tenant and a version without a snapshot are answered with the status NOT_FOUND, the same answer in each case, so the reply never confirms that a dataset of another tenant exists (ADR-0015 amendment D113); a caller without a workload identity is refused with UNAUTHENTICATED, a workload without the service scope with PERMISSION_DENIED, and a request that fails validation with INVALID_ARGUMENT. QualityScoreService treats this dependency as required and fail-fast, so a NOT_FOUND or an outage of FeedbackService fails the start of an evaluation or, during a run, fails the run with the reason snapshot missing, in the PBIs of that service. Kind: behavior. Traces: services: FeedbackService, QualityScoreService; aggregates: FeedbackService/Dataset; apis: FeedbackService/Learning.GetDatasetSnapshot; descriptors: artifact-v1; adrs: ADR-0015, ADR-0021; scenarios: SCN-FeedbackService-007. Depends on: AIFACTORY-US-1099. Sources: model/services/observability/FeedbackService.yaml, docs/planes/trust-operations/observability/services/feedback-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a workload identity with the service scope, the tenant metadata of the evaluation and the `dataset-id` and `dataset-version` metadata naming a published dataset version of that tenant, when `FeedbackService/Learning.GetDatasetSnapshot` is called, then the reply carries `artifact-v1` with the snapshot reference of that version, nothing is written and a repeated call answers the same (SCN-FeedbackService-007).",
        "AC2: Given an unknown version, a dataset of another tenant or a version without a snapshot, when `FeedbackService/Learning.GetDatasetSnapshot` is called, then each is answered NOT_FOUND alike; given no workload identity, a workload without the service scope or an invalid request, then the answer is UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT, and no state changes (SCN-FeedbackService-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4386",
        "AIFACTORY-TASK-4387",
        "AIFACTORY-TASK-4388"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13204,
      "kind": "behavior",
      "traces": {
        "services": [
          "FeedbackService",
          "QualityScoreService"
        ],
        "aggregates": [
          "FeedbackService/Dataset"
        ],
        "apis": [
          "FeedbackService/Learning.GetDatasetSnapshot"
        ],
        "descriptors": [
          "artifact-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "scenarios": [
          "SCN-FeedbackService-007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1099"
      ],
      "source": [
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1100]",
      "number": 1100
    },
    {
      "id": "AIFACTORY-TASK-4386",
      "type": "task",
      "parent": "AIFACTORY-US-1100",
      "title": "Learning.GetDatasetSnapshot under the forwarded tenant",
      "sequence": "13.05.04.01",
      "description": "Learning.GetDatasetSnapshot under the forwarded tenant. Expected output: The gRPC method reads the Datasets row named by the dataset-id and dataset-version metadata under the tenant a workload with the service scope forwards, refuses metadata that is missing or names two different rows with INVALID_ARGUMENT, and replies with artifact-v1 carrying its snapshotRef; unknown versions, other tenants and versions without a snapshot answer NOT_FOUND alike; UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT refuse the call before any read.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "The gRPC method reads the Datasets row named by the dataset-id and dataset-version metadata under the tenant a workload with the service scope forwards, refuses metadata that is missing or names two different rows with INVALID_ARGUMENT, and replies with artifact-v1 carrying its snapshotRef; unknown versions, other tenants and versions without a snapshot answer NOT_FOUND alike; UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT refuse the call before any read."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4386]",
      "number": 4386
    },
    {
      "id": "AIFACTORY-TASK-4387",
      "type": "task",
      "parent": "AIFACTORY-US-1100",
      "title": "Contract of the dataset snapshot method for QualityScoreService",
      "sequence": "13.05.04.02",
      "description": "Contract of the dataset snapshot method for QualityScoreService. Expected output: The proto of the service exposes Learning.GetDatasetSnapshot with artifact-v1 as request and reply as model/descriptors.yaml records it, published with the contracts so that QualityScoreService calls it through a generated client; the contract documents that artifact-v1 has no field for a dataset or a version, that the dataset-id and dataset-version metadata carry them until the owner decides the request descriptor, and that the body is not read.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "The proto of the service exposes Learning.GetDatasetSnapshot with artifact-v1 as request and reply as model/descriptors.yaml records it, published with the contracts so that QualityScoreService calls it through a generated client; the contract documents that artifact-v1 has no field for a dataset or a version, that the dataset-id and dataset-version metadata carry them until the owner decides the request descriptor, and that the body is not read."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13204,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-4387]",
      "number": 4387
    },
    {
      "id": "AIFACTORY-TASK-4388",
      "type": "task",
      "parent": "AIFACTORY-US-1100",
      "title": "Verify the dataset snapshot method through the acceptance suite",
      "sequence": "13.05.04.03",
      "description": "Verify the dataset snapshot method through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-FeedbackService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1100: the resolved snapshot and its repeat, NOT_FOUND alike for the three cases, and the three refusals without a state change.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-FeedbackService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 and AC2 of AIFACTORY-US-1100: the resolved snapshot and its repeat, NOT_FOUND alike for the three cases, and the three refusals without a state change."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4388]",
      "number": 4388
    },
    {
      "id": "AIFACTORY-US-1101",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-069",
      "title": "Raise learning proposals with evidence from feedback, drift and failed evaluations, and list them for maintainers",
      "sequence": "13.05.05",
      "description": "As an asset maintainer, I want improvement proposals for my assets drafted from the evidence the Factory collected, with the effect they are expected to have, so that I review a concrete change with its reasons instead of searching through feedback and drift reports myself. Evidence arrives from three sources the service handles now. `EvaluationCompleted` of QualityScoreService (handler `RaiseFromEvaluation`) adds failed gates and regressions; `DriftDetected` of QualityScoreService (handler `RaiseFromDrift`) adds drift of a release; recorded feedback adds what people said. The thin QualityScoreService of I1 publishes no event, and the complete delivery that publishes both events, feature quality-score-service-complete, itself depends on this feature, so `RaiseFromEvaluation` and `RaiseFromDrift` are built against the contracts package and proven with fixtures of both events (AIFACTORY-TASK-4389); their first real events arrive when quality-score-service-complete is deployed in the same increment. The dependency on feature quality-score-service-thin names the service that owns both events, not a publisher of them. A fourth source, `SkillCandidateProposed` of MemoryPromotionService (handler `RaiseSkillProposal`), is built against the contracts package and receives its first events when that service arrives in I5. The ProposalGenerator worker runs on its modelled schedule, clusters the new evidence per target asset, and raises a proposal only for a cluster with at least `Observability:Learning:MinEvidenceItems` items (default 3), because a proposal without evidence is not raised. It drafts the proposal text and diff through ModelRouterService with the model profile `Observability:Learning:ProposalProfile` (default structured), stores the draft through ArtifactService as `summaryRef`, and writes the `LearningProposal` in state Proposed with its kind (PromptImprovement, SkillImprovement, ContextStrategy, ThresholdChange, DatasetAddition or ProfileChange), target asset and version, the evidence references and the expected effect, together with the `LearningProposalRaised` outbox record with `proposalId`, `tenantId`, `kind`, `targetAssetId` and `targetVersion`, in one transaction. A Proposed proposal for the same target and kind is moved to Superseded (trigger NewerProposal) in the same transaction. The idempotency key of the worker is `targetAssetId` plus the evidence hash, so the same evidence never raises a second proposal; its retry policy is fixed with two attempts. When the drafting model is unavailable the evidence cluster waits for the next run and no proposal is raised without a draft. A proposal never changes an asset. StudioBff, StudioNotificationService and AuditService consume the event in their own PBIs. A caller whose scope carries `factory.evaluation.read` lists proposals through `ListLearningProposals` by state, kind and target with their evidence and expected effect, under the tenant row filter; without the scope the answer is 403. Which project the drafting usage is metered on is an open point reported with this feature, because a proposal belongs to a tenant and names no project while a model call outside a run names its project. The gauge `connectsoft.factory.learning.proposals` moves with each state change. Kind: behavior. Traces: services: FeedbackService, QualityScoreService, ModelRouterService, ArtifactService; aggregates: FeedbackService/LearningProposal; apis: FeedbackService/ListLearningProposals; events: FeedbackService/LearningProposalRaised, QualityScoreService/EvaluationCompleted, QualityScoreService/DriftDetected; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FR-11, FUX-09, NFR-11; scenarios: SCN-FeedbackService-005, SCN-FeedbackService-010. Relates: screens: learning-proposals. Depends on: AIFACTORY-US-1098, feature:contracts-package, feature:quality-score-service-thin, feature:model-router-service, feature:artifact-service. Sources: model/services/observability/FeedbackService.yaml, model/services/observability/QualityScoreService.yaml, docs/planes/trust-operations/observability/services/feedback-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given at least three evidence items for one asset from `QualityScoreService/EvaluationCompleted`, `QualityScoreService/DriftDetected` and recorded feedback, when ProposalGenerator runs, then one `FeedbackService/LearningProposal` in Proposed holds the kind, target, evidence references, expected effect and the draft stored through ArtifactService, and the `FeedbackService/LearningProposalRaised` outbox record is written in the same transaction; an earlier Proposed proposal for the same target and kind is Superseded in that transaction (SCN-FeedbackService-010, ADR-0021).",
        "AC2: Given fewer than three evidence items, or the same evidence a second time, when ProposalGenerator runs, then no proposal is raised; given the drafting model unavailable, then the cluster waits, no proposal is raised without a draft and the next run raises it once the model answers (SCN-FeedbackService-010, model/services/observability/FeedbackService.yaml).",
        "AC3: Given the record was written, when the dispatcher publishes `FeedbackService/LearningProposalRaised` on `evaluation.learning.v1.learning-proposal-raised`, then it is sent under the canonical envelope with `proposalId`, `tenantId`, `kind`, `targetAssetId` and `targetVersion`, and an outage is retried so it is neither lost nor duplicated under its event id (SCN-FeedbackService-010, ADR-0012).",
        "AC4: Given proposals in several states and two tenants, when `FeedbackService/ListLearningProposals` is called with `factory.evaluation.read` and a state, kind or target filter, then the response is 200 with the matching proposals of the caller tenant and their evidence and expected effect; without the scope it is 403 and nothing is written (SCN-FeedbackService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-554",
        "AIFACTORY-TASK-4389",
        "AIFACTORY-TASK-4390"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13205,
      "kind": "behavior",
      "traces": {
        "services": [
          "FeedbackService",
          "QualityScoreService",
          "ModelRouterService",
          "ArtifactService"
        ],
        "aggregates": [
          "FeedbackService/LearningProposal"
        ],
        "apis": [
          "FeedbackService/ListLearningProposals"
        ],
        "events": [
          "FeedbackService/LearningProposalRaised",
          "QualityScoreService/EvaluationCompleted",
          "QualityScoreService/DriftDetected"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-11",
          "FUX-09",
          "NFR-11"
        ],
        "scenarios": [
          "SCN-FeedbackService-005",
          "SCN-FeedbackService-010"
        ]
      },
      "relates": {
        "screens": [
          "learning-proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1098",
        "feature:contracts-package",
        "feature:quality-score-service-thin",
        "feature:model-router-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/observability/FeedbackService.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "docs/planes/trust-operations/observability/services/feedback-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1101]",
      "number": 1101
    },
    {
      "id": "AIFACTORY-TASK-554",
      "type": "task",
      "parent": "AIFACTORY-US-1101",
      "title": "Learning proposals raised from evidence",
      "sequence": "13.05.05.01",
      "description": "Learning proposals raised from evidence. Expected output: RaiseFromEvaluation and RaiseFromDrift collect evidence per asset idempotently; ProposalGenerator clusters it, raises a proposal only from MinEvidenceItems items, drafts it through ModelRouterService with ProposalProfile, stores the draft through ArtifactService and writes the Proposed proposal with its LearningProposalRaised outbox record and the Superseded predecessor in one transaction, keyed by targetAssetId and evidence hash; the cluster waits when drafting fails; RaiseSkillProposal is registered against the contracts package; ListLearningProposals filters by state, kind and target.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "RaiseFromEvaluation and RaiseFromDrift collect evidence per asset idempotently; ProposalGenerator clusters it, raises a proposal only from MinEvidenceItems items, drafts it through ModelRouterService with ProposalProfile, stores the draft through ArtifactService and writes the Proposed proposal with its LearningProposalRaised outbox record and the Superseded predecessor in one transaction, keyed by targetAssetId and evidence hash; the cluster waits when drafting fails; RaiseSkillProposal is registered against the contracts package; ListLearningProposals filters by state, kind and target."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-554]",
      "number": 554
    },
    {
      "id": "AIFACTORY-TASK-4389",
      "type": "task",
      "parent": "AIFACTORY-US-1101",
      "title": "Evidence and drafting fixtures for the proposal generator",
      "sequence": "13.05.05.02",
      "description": "Evidence and drafting fixtures for the proposal generator. Expected output: The acceptance suite holds EvaluationCompleted and DriftDetected fixtures from the contracts package, recorded feedback, evidence clusters of two, three and more items for one asset, a fake drafting model that can be made unavailable, a fake ArtifactService and a clock and trigger the test controls.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "The acceptance suite holds EvaluationCompleted and DriftDetected fixtures from the contracts package, recorded feedback, evidence clusters of two, three and more items for one asset, a fake drafting model that can be made unavailable, a fake ArtifactService and a clock and trigger the test controls."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13205,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4389]",
      "number": 4389
    },
    {
      "id": "AIFACTORY-TASK-4390",
      "type": "task",
      "parent": "AIFACTORY-US-1101",
      "title": "Verify raising and listing proposals through the acceptance suite",
      "sequence": "13.05.05.03",
      "description": "Verify raising and listing proposals through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-005|Scenario=SCN-FeedbackService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1101: the raised proposal with its draft and superseded predecessor, no proposal below the evidence minimum or for repeated evidence, the waiting cluster while the model is down, the publication and payload of LearningProposalRaised through an outage, and the listing with its 403.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-005|Scenario=SCN-FeedbackService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1101: the raised proposal with its draft and superseded predecessor, no proposal below the evidence minimum or for repeated evidence, the waiting cluster while the model is down, the publication and payload of LearningProposalRaised through an outage, and the listing with its 403."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4390]",
      "number": 4390
    },
    {
      "id": "AIFACTORY-US-1102",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-069",
      "title": "An asset maintainer accepts a learning proposal, which opens a Draft release, or rejects it with a reason",
      "sequence": "13.05.06",
      "description": "As an asset maintainer, I want to accept a proposal into a Draft release of my asset or reject it with my reason, so that every change a proposal suggests goes through evaluation and publication like any other change, and a rejection is remembered. An Asset maintainer whose scope carries `factory.assets.write` decides a proposal in review through `DecideLearningProposal`, naming accept, or reject with a reason. Accepting moves the `LearningProposal` from InReview to Accepted (trigger ReleaseCandidateOpened): the change becomes a Draft release candidate of the target asset in BC-04, which then goes through evaluation and publication like any change, so a proposal never changes an asset itself. Rejecting moves it from InReview to Rejected (trigger Rejected) with the reason and `reviewedBy`. In both cases the `LearningProposalDecided` outbox record with `proposalId`, `tenantId` and `state`, and for an accepted proposal `targetAssetId`, `targetVersion` and `summaryRef` without `resultingReleaseId`, is written in the transaction of the decision, and the answer is 200. AgentRegistryService, StudioBff and AuditService consume the event in their own PBIs. The operation is idempotent by its natural key: the same decision repeated by the same caller on a proposal already in that state answers 200 with the recorded state and changes nothing, so a caller that retries after a lost answer, as the gateway tells callers to do, learns that its decision was applied. A different decision on an Accepted or Rejected proposal, and any decision on a proposal that is Proposed or Superseded, is answered 409 and the proposal keeps its state. A proposal of another tenant and an unknown id are answered 404 alike (ADR-0015 amendment D113); a caller without the scope is refused with 403. FeedbackService opens no release itself and makes no outbound call to AgentRegistryService: AgentRegistryService, the owner of releases, opens the Draft release when it consumes `LearningProposalDecided` with the state Accepted and announces its release id with the proposal id through `LearningReleaseOpened`. The handler `RecordResultingRelease` of FeedbackService records that release id as `resultingReleaseId` of the proposal, idempotent on the proposal id, so a redelivered announcement for a proposal that already keeps that release id changes nothing (D131). The model also lists the transition from Proposed to InReview with the trigger MaintainerPicksUp, and no operation of the model raises it; which operation raises it is an open point reported with this feature, and this PBI delivers the transition in the domain model and the decision on an InReview proposal. Kind: behavior. Traces: services: FeedbackService, AgentRegistryService; aggregates: FeedbackService/LearningProposal; apis: FeedbackService/DecideLearningProposal; events: FeedbackService/LearningProposalDecided, AgentRegistryService/LearningReleaseOpened; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FR-11, FUX-09; scenarios: SCN-FeedbackService-006, SCN-FeedbackService-011. Relates: screens: learning-proposals. Depends on: AIFACTORY-US-1101, feature:agent-registry-service-complete. Sources: model/services/observability/FeedbackService.yaml, model/services/control-plane/AgentRegistryService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a proposal in InReview of the caller tenant and a caller with `factory.assets.write`, when `FeedbackService/DecideLearningProposal` accepts it, then the `FeedbackService/LearningProposal` is Accepted with `reviewedBy`, the `FeedbackService/LearningProposalDecided` outbox record with the state Accepted and the target asset and without `resultingReleaseId` is written in the transaction of the decision, and FeedbackService opens no release itself; the response is 200 (SCN-FeedbackService-006, ADR-0021).",
        "AC2: Given a proposal in InReview, when `FeedbackService/DecideLearningProposal` rejects it with a reason, then it is Rejected with the reason and `reviewedBy` and `FeedbackService/LearningProposalDecided` is written with the state Rejected; given the same decision repeated by the same caller on a proposal already in that state, then the answer is 200 with the recorded state, no second event is written and nothing changes; given a different decision on an Accepted or Rejected proposal, or a proposal that is Proposed or Superseded, then the answer is 409 and nothing changes (SCN-FeedbackService-006, SCN-FeedbackService-011).",
        "AC3: Given a proposal of another tenant or an unknown id, or a caller without the scope, when `FeedbackService/DecideLearningProposal` is called, then it is answered 404 or 403 and nothing is written (SCN-FeedbackService-006, ADR-0015).",
        "AC4: Given the record was written, when the dispatcher publishes `FeedbackService/LearningProposalDecided` on `evaluation.learning.v1.learning-proposal-decided`, then it is sent under the canonical envelope with `proposalId`, `tenantId`, `state` and, for an accepted proposal, `targetAssetId`, `targetVersion` and `summaryRef` without `resultingReleaseId`, and an outage is retried so it is neither lost nor duplicated (SCN-FeedbackService-011, ADR-0012).",
        "AC5: Given an accepted proposal, when `AgentRegistryService/LearningReleaseOpened` naming it is handled by `RecordResultingRelease`, then the `FeedbackService/LearningProposal` keeps the announced release id as `resultingReleaseId`; a redelivered announcement for a proposal that already keeps that release id changes nothing (D131, model/services/observability/FeedbackService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4391",
        "AIFACTORY-TASK-4392"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13206,
      "kind": "behavior",
      "traces": {
        "services": [
          "FeedbackService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "FeedbackService/LearningProposal"
        ],
        "apis": [
          "FeedbackService/DecideLearningProposal"
        ],
        "events": [
          "FeedbackService/LearningProposalDecided",
          "AgentRegistryService/LearningReleaseOpened"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-11",
          "FUX-09"
        ],
        "scenarios": [
          "SCN-FeedbackService-006",
          "SCN-FeedbackService-011"
        ]
      },
      "relates": {
        "screens": [
          "learning-proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1101",
        "feature:agent-registry-service-complete"
      ],
      "source": [
        "model/services/observability/FeedbackService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1102]",
      "number": 1102
    },
    {
      "id": "AIFACTORY-TASK-4391",
      "type": "task",
      "parent": "AIFACTORY-US-1102",
      "title": "DecideLearningProposal with the guarded transitions and the RecordResultingRelease handler",
      "sequence": "13.05.06.01",
      "description": "DecideLearningProposal with the guarded transitions and the RecordResultingRelease handler. Expected output: DecideLearningProposal accepts or rejects an InReview proposal of the caller tenant, records reviewedBy and the reason, writes LearningProposalDecided in the transaction of the decision with the target asset and without resultingReleaseId, answers 200 with the recorded state and writes nothing for the same decision repeated by the same caller, answers 409 for a different decision on an Accepted or Rejected proposal and for a Proposed or Superseded proposal, 404 for another tenant or an unknown id and 403 without the scope; the handler RecordResultingRelease of LearningReleaseOpened records the announced release id as resultingReleaseId, idempotent on the proposal id, and the service makes no outbound call to AgentRegistryService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "DecideLearningProposal accepts or rejects an InReview proposal of the caller tenant, records reviewedBy and the reason, writes LearningProposalDecided in the transaction of the decision with the target asset and without resultingReleaseId, answers 200 with the recorded state and writes nothing for the same decision repeated by the same caller, answers 409 for a different decision on an Accepted or Rejected proposal and for a Proposed or Superseded proposal, 404 for another tenant or an unknown id and 403 without the scope; the handler RecordResultingRelease of LearningReleaseOpened records the announced release id as resultingReleaseId, idempotent on the proposal id, and the service makes no outbound call to AgentRegistryService."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4391]",
      "number": 4391
    },
    {
      "id": "AIFACTORY-TASK-4392",
      "type": "task",
      "parent": "AIFACTORY-US-1102",
      "title": "Verify the decision of a proposal through the acceptance suite",
      "sequence": "13.05.06.02",
      "description": "Verify the decision of a proposal through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-006|Scenario=SCN-FeedbackService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1102: acceptance and rejection with their events, the 200 without a second event for the repeated same decision, the 409 for a different decision on a decided proposal and for a Proposed or Superseded proposal, the 404 and 403, the publication and payload of LearningProposalDecided through an outage, and the resulting release recorded once from LearningReleaseOpened across a redelivery.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-FeedbackService-006|Scenario=SCN-FeedbackService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1102: acceptance and rejection with their events, the 200 without a second event for the repeated same decision, the 409 for a different decision on a decided proposal and for a Proposed or Superseded proposal, the 404 and 403, the publication and payload of LearningProposalDecided through an outage, and the resulting release recorded once from LearningReleaseOpened across a redelivery."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13206,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4392]",
      "number": 4392
    },
    {
      "id": "AIFACTORY-US-1103",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-069",
      "title": "Retention rules, deletion orders and legal holds are applied to feedback, datasets and proposals",
      "sequence": "13.05.07",
      "description": "As a workspace admin, I want the retention, deletion and hold orders of my tenant applied to feedback, dataset tasks and proposals, so that what people said and what was harvested from runs is kept as long as the rules say and no longer, except under a legal hold. FeedbackService owns `HumanFeedback`, `Datasets`, `DatasetTasks` and `LearningProposals` in `feedback-sql`, and references texts, snapshots and drafts kept by ArtifactService. Three consumed events of RetentionResidencyService govern the lifecycle of its rows. `RetentionRuleChanged` (handler `ApplyRetentionRule`) applies the effective retention period of the rule to the rows of its store class. `DeletionOrderIssued` (handler `ExecuteDeletionOrder`) deletes the ordered scope from the stores the service owns and acknowledges its task of the order through `AcknowledgeOrderTask` of RetentionResidencyService under the scope `factory.data.acknowledge`, once per order id, with a receipt that names the order, the tenant, the deleted rows and what a legal hold kept. A published dataset snapshot is immutable, so a deletion order that reaches tasks of a published version removes the rows of the service and leaves the artifact to the order of ArtifactService. `LegalHoldChanged` (handler `ApplyLegalHold`) suspends deletion and retention expiry for the held scope and resumes them when the hold is lifted. Each handler is idempotent on the event id and touches only rows of the tenant of the event; an event without a tenant is dead-lettered and changes nothing; a failed acknowledgement is retried by the inbox and the deletion is not repeated. Kind: behavior. Traces: services: FeedbackService, RetentionResidencyService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0015, ADR-0019; requirements: NFR-03. Relates: screens: retention-residency. Depends on: feature:retention-residency-service. Sources: model/services/observability/FeedbackService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given `RetentionResidencyService/RetentionRuleChanged` for the store class of the service, when `ApplyRetentionRule` handles it, then rows older than the effective period are removed by the retention sweep and younger rows are kept; a redelivered event changes nothing (ADR-0019, model/services/observability/FeedbackService.yaml).",
        "AC2: Given `RetentionResidencyService/DeletionOrderIssued` for a scope of one tenant while `RetentionResidencyService/LegalHoldChanged` holds a part of it, when the handlers run, then the ordered rows are deleted except the held ones, no row of another tenant is touched, and the task is acknowledged once through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt; a failed acknowledgement is retried without a second deletion (ADR-0015, ADR-0019).",
        "AC3: Given a hold lifted by `RetentionResidencyService/LegalHoldChanged`, when the next sweep runs, then expiry resumes for the scope it held; given an event without a tenant, then it is dead-lettered and nothing changes (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4393",
        "AIFACTORY-TASK-4394"
      ],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13207,
      "kind": "behavior",
      "traces": {
        "services": [
          "FeedbackService",
          "RetentionResidencyService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03"
        ]
      },
      "relates": {
        "screens": [
          "retention-residency"
        ]
      },
      "dependsOn": [
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/observability/FeedbackService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1103]",
      "number": 1103
    },
    {
      "id": "AIFACTORY-TASK-4393",
      "type": "task",
      "parent": "AIFACTORY-US-1103",
      "title": "Handlers ApplyRetentionRule, ExecuteDeletionOrder and ApplyLegalHold over feedback-sql",
      "sequence": "13.05.07.01",
      "description": "Handlers ApplyRetentionRule, ExecuteDeletionOrder and ApplyLegalHold over feedback-sql. Expected output: The three handlers apply the effective retention to the rows of the store class, delete the ordered scope except held rows and acknowledge the order task once through AcknowledgeOrderTask with its receipt, suspend and resume expiry for a held scope, are idempotent on the event id, touch only rows of the tenant of the event and dead-letter an event without a tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "The three handlers apply the effective retention to the rows of the store class, delete the ordered scope except held rows and acknowledge the order task once through AcknowledgeOrderTask with its receipt, suspend and resume expiry for a held scope, are idempotent on the event id, touch only rows of the tenant of the event and dead-letter an event without a tenant."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13207,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4393]",
      "number": 4393
    },
    {
      "id": "AIFACTORY-TASK-4394",
      "type": "task",
      "parent": "AIFACTORY-US-1103",
      "title": "Verify retention, deletion and hold through the acceptance suite",
      "sequence": "13.05.07.02",
      "description": "Verify retention, deletion and hold through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RetentionOrders\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1103 with a fake RetentionResidencyService/AcknowledgeOrderTask endpoint: the sweep under a rule, the deletion under a hold with its receipt, the retried acknowledgement, the lifted hold and the event without a tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.FeedbackService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RetentionOrders\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1103 with a fake RetentionResidencyService/AcknowledgeOrderTask endpoint: the sweep under a rule, the deletion under a hold with its receipt, the retried acknowledgement, the lifted hold and the event without a tenant."
      ],
      "sourceArtifacts": [
        "model/services/observability/FeedbackService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.FeedbackService"
      ],
      "children": [],
      "buildOrder": 132,
      "phase": "factory",
      "stackRank": 13207,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4394]",
      "number": 4394
    },
    {
      "id": "AIFACTORY-FEAT-070",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-013",
      "title": "QualityScoreService: complete delivery",
      "sequence": "13.06",
      "description": "QualityScoreService is the service of bounded context BC-22 (Evaluation & Learning). Evaluation as a core capability: suites per target (models, agents, skills, tools, workflows, context and memory strategies, policies) with the quality-gate metrics, evaluation runs over datasets of historical tasks, verdicts with baseline comparison, waivers, drift monitoring and the evidence records publication reads (BC-22, D32, original design §47–49). This feature completes the service after its thin delivery in I1: every aggregate, operation, event and worker of the model. Repository ConnectSoft.AI.SoftwareFactory.QualityScoreService. Delivers: QualityScoreService (complete). Depends on: AIFACTORY-FEAT-065. Increment I4: Trust and accountability. Build order 133 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-041",
        "AIFACTORY-US-1090",
        "AIFACTORY-US-1091",
        "AIFACTORY-US-1092",
        "AIFACTORY-US-1093",
        "AIFACTORY-US-1094",
        "AIFACTORY-US-1095",
        "AIFACTORY-US-1096",
        "AIFACTORY-US-1097",
        "AIFACTORY-US-1109"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13300,
      "titlePrefix": "[AIFACTORY-FEAT-070]",
      "number": 70
    },
    {
      "id": "AIFACTORY-US-041",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "A release is published only with evaluation evidence",
      "sequence": "13.06.01",
      "description": "As an asset maintainer, I want every release of an asset kind that has an active suite (D117) evaluated by that suite before it can be published, so that nothing runs in a project that was not measured, unless a named person waived it. This is the integration PBI of the complete delivery of QualityScoreService (BC-22), which follows the thin delivery of I1 and adds every aggregate, operation, event and worker of model/services/observability/QualityScoreService.yaml. Evaluation suites are the runtime read model of the suites in force, listed through `ListEvaluationSuites` and announced by `EvaluationSuiteActivated` (AIFACTORY-US-1090). An Asset maintainer or a Platform admin starts an evaluation through `StartEvaluation`, an internal caller through `Evaluation.RunSuite`, and the evaluation is announced by `EvaluationStarted` (AIFACTORY-US-1091). The SuiteRunner worker scores the tasks of the evaluation as sandbox-class Factory runs under the evaluation project, computes the verdict against the thresholds of the suite and the baseline rule of D32, stores the immutable evidence record and publishes `EvaluationCompleted`, and `GetEvaluation` shows the result (AIFACTORY-US-1092); an evaluation that cannot complete ends Failed with `EvaluationFailed` (AIFACTORY-US-1093). Every release candidate that AgentRegistryService submits is evaluated by the suite of its kind, and AgentRegistryService records the verdict and evidence of `EvaluationCompleted` through its handler `RecordEvaluationEvidence` and checks that record at the Published gate without a synchronous call (D141), so a release of an asset kind that has an active suite (D117) is not published without a passing or waived verdict (AIFACTORY-US-1094); a release of a kind without a suite is not gated by evaluation, as `Publication:Gates:RequireEvaluation` of AgentRegistryService states. A Platform admin evaluates a model deployment against its capability suite, whose tasks invoke the deployment directly through ModelRouterService (AIFACTORY-US-1109). From the policy revision that activates the gate, the Draft allowance of the ADR-0021 amendment (D83) is withdrawn. A Reviewer who is not the author may waive a failed verdict with a reason through `WaiveEvaluation`, under an approval of class publication bound to the evaluation (AIFACTORY-US-1095). The DriftMonitor compares production outcomes per release, stored since the thin delivery of I1, with the evaluated scores and publishes `DriftDetected` (AIFACTORY-US-1096). The retention, deletion and legal hold orders of RetentionResidencyService are applied to the records of the service (AIFACTORY-US-1097). Every query runs under the tenant row filter of the service, and a resource of another tenant is answered 404, the same answer as for one that does not exist (ADR-0015 amendment D113). The thin scope and its records are kept: the complete delivery reads the records the thin delivery stored and retires nothing a caller relied on. Kind: behavior. Traces: services: QualityScoreService, AgentRegistryService, FeedbackService, PolicyEngineService; aggregates: QualityScoreService/EvaluationSuite, QualityScoreService/EvaluationRun; apis: QualityScoreService/StartEvaluation, QualityScoreService/GetEvaluation, QualityScoreService/WaiveEvaluation, QualityScoreService/ListReleaseEvaluations, QualityScoreService/Evaluation.GetVerdict, QualityScoreService/Evaluation.RunSuite, AgentRegistryService/PublishRelease; events: QualityScoreService/EvaluationCompleted, QualityScoreService/EvaluationFailed, QualityScoreService/DriftDetected; adrs: ADR-0014, ADR-0015, ADR-0021; requirements: FR-02, FR-04, FR-11, FUX-02, FUX-10, NFR-11, NFR-13, XL-08, XL-15. Relates: screens: evaluation-runs, release-evidence. Depends on: AIFACTORY-US-1090, AIFACTORY-US-1091, AIFACTORY-US-1092, AIFACTORY-US-1093, AIFACTORY-US-1094, AIFACTORY-US-1095, AIFACTORY-US-1096, AIFACTORY-US-1097, AIFACTORY-US-1109, feature:quality-score-service-thin, feature:agent-registry-service-complete, feature:feedback-service, feature:policy-engine-service. Sources: model/services/observability/QualityScoreService.yaml, docs/architecture/adr/0021-quality-gates.md, docs/architecture/quality-gates.md, docs/planes/trust-operations/evaluation.md.",
      "acceptanceCriteria": [
        "AC1: Given a submitted release of an agent, skill, workflow or policy with an active suite of its kind, when its evaluation runs, then `QualityScoreService/EvaluationCompleted` carries the verdict and the reference to the immutable evidence record, as AIFACTORY-US-1092 and AIFACTORY-US-1094 prove (ADR-0021).",
        "AC2: Given a release of an asset kind that has an active suite (D117) without a passing or waived verdict, when publication is requested through `AgentRegistryService/PublishRelease`, then `AgentRegistryService/PublishRelease` refuses it on the evidence recorded from `QualityScoreService/EvaluationCompleted` by `RecordEvaluationEvidence`, makes no synchronous call to QualityScoreService and names the missing evidence (D141); from the policy revision that activates the gate, the Draft allowance of the ADR-0021 amendment no longer applies (ADR-0021).",
        "AC3: Given a waiver with its reason and an approval of class publication bound to the evaluation, when it is recorded through `QualityScoreService/WaiveEvaluation`, then the verdict is Waived, the release may be published and the waiver is part of its evidence, as AIFACTORY-US-1095 proves (ADR-0021).",
        "AC4: Given the outcomes of a published release fall below its evaluated scores by more than the drift tolerance, when the drift monitor runs, then `QualityScoreService/DriftDetected` is published, as AIFACTORY-US-1096 proves (model/services/observability/QualityScoreService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/quality-gates.md",
        "docs/planes/trust-operations/evaluation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-493",
        "AIFACTORY-TASK-494",
        "AIFACTORY-TASK-495",
        "AIFACTORY-TASK-496",
        "AIFACTORY-TASK-497",
        "AIFACTORY-TASK-498",
        "AIFACTORY-TASK-499",
        "AIFACTORY-TASK-772"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "AgentRegistryService",
          "FeedbackService",
          "PolicyEngineService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationSuite",
          "QualityScoreService/EvaluationRun"
        ],
        "apis": [
          "QualityScoreService/StartEvaluation",
          "QualityScoreService/GetEvaluation",
          "QualityScoreService/WaiveEvaluation",
          "QualityScoreService/ListReleaseEvaluations",
          "QualityScoreService/Evaluation.GetVerdict",
          "QualityScoreService/Evaluation.RunSuite",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "QualityScoreService/EvaluationCompleted",
          "QualityScoreService/EvaluationFailed",
          "QualityScoreService/DriftDetected"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "FR-04",
          "FR-11",
          "FUX-02",
          "FUX-10",
          "NFR-11",
          "NFR-13",
          "XL-08",
          "XL-15"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs",
          "release-evidence"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1090",
        "AIFACTORY-US-1091",
        "AIFACTORY-US-1092",
        "AIFACTORY-US-1093",
        "AIFACTORY-US-1094",
        "AIFACTORY-US-1095",
        "AIFACTORY-US-1096",
        "AIFACTORY-US-1097",
        "AIFACTORY-US-1109",
        "feature:quality-score-service-thin",
        "feature:agent-registry-service-complete",
        "feature:feedback-service",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/quality-gates.md",
        "docs/planes/trust-operations/evaluation.md"
      ],
      "titlePrefix": "[AIFACTORY-US-041]",
      "number": 41
    },
    {
      "id": "AIFACTORY-TASK-493",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "Domain model: EvaluationSuite, EvaluationRun",
      "sequence": "13.06.01.01",
      "description": "Domain model: EvaluationSuite, EvaluationRun. Expected output: Aggregates with their invariants and the six transitions of EvaluationState as modelled; unit tests cover every invariant and every transition, and a transition the model does not list is refused.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Aggregates with their invariants and the six transitions of EvaluationState as modelled; unit tests cover every invariant and every transition, and a transition the model does not list is refused."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-493]",
      "number": 493
    },
    {
      "id": "AIFACTORY-TASK-494",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "Persistence in quality-score-sql: EvaluationSuites, EvaluationRuns, EvaluationResults",
      "sequence": "13.06.01.02",
      "description": "Persistence in quality-score-sql: EvaluationSuites, EvaluationRuns, EvaluationResults. Expected output: Mappings and migrations for the modelled tables with tenant filters and the index IX_Evaluations_Target, added beside the table of accepted events of the thin delivery without moving its records; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the modelled tables with tenant filters and the index IX_Evaluations_Target, added beside the table of accepted events of the thin delivery without moving its records; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-494]",
      "number": 494
    },
    {
      "id": "AIFACTORY-TASK-495",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "API hosting: 5 REST and 2 gRPC operations (ListEvaluationSuites, StartEvaluation, GetEvaluation, WaiveEvaluation, ListReleaseEvaluations, Evaluation.GetVerdict, Evaluation.RunSuite)",
      "sequence": "13.06.01.03",
      "description": "API hosting: 5 REST and 2 gRPC operations (ListEvaluationSuites, StartEvaluation, GetEvaluation, WaiveEvaluation, ListReleaseEvaluations, Evaluation.GetVerdict, Evaluation.RunSuite). Expected output: The five REST routes and the two gRPC methods are hosted with JWT validation, scope enforcement per route, workload identity checks on the gRPC methods, problem responses for every modelled refusal code and the Idempotency-Key filter of StartEvaluation; the behaviour of each operation is delivered by AIFACTORY-US-1090 to AIFACTORY-US-1095.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The five REST routes and the two gRPC methods are hosted with JWT validation, scope enforcement per route, workload identity checks on the gRPC methods, problem responses for every modelled refusal code and the Idempotency-Key filter of StartEvaluation; the behaviour of each operation is delivered by AIFACTORY-US-1090 to AIFACTORY-US-1095."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-495]",
      "number": 495
    },
    {
      "id": "AIFACTORY-TASK-496",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "Messaging: publishes 5 events, handles 16",
      "sequence": "13.06.01.04",
      "description": "Messaging: publishes 5 events, handles 16. Expected output: Events are published through the outbox of the quality-score profile under the run envelope (EvaluationSuiteActivated, EvaluationStarted, EvaluationCompleted, EvaluationFailed, DriftDetected); the inbox registers the sixteen consumed events, the ten of the thin delivery among them, idempotently on the event id; what each new handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Events are published through the outbox of the quality-score profile under the run envelope (EvaluationSuiteActivated, EvaluationStarted, EvaluationCompleted, EvaluationFailed, DriftDetected); the inbox registers the sixteen consumed events, the ten of the thin delivery among them, idempotently on the event id; what each new handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-496]",
      "number": 496
    },
    {
      "id": "AIFACTORY-TASK-497",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "Workers: SuiteRunner, DriftMonitor",
      "sequence": "13.06.01.05",
      "description": "Workers: SuiteRunner, DriftMonitor. Expected output: Each worker runs with its modelled trigger, retry policy, idempotency key and concurrency partitioned by tenant; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1091, AIFACTORY-US-1092 and AIFACTORY-US-1096.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Each worker runs with its modelled trigger, retry policy, idempotency key and concurrency partitioned by tenant; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1091, AIFACTORY-US-1092 and AIFACTORY-US-1096."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-497]",
      "number": 497
    },
    {
      "id": "AIFACTORY-TASK-498",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "Security, tenancy and telemetry of QualityScoreService",
      "sequence": "13.06.01.06",
      "description": "Security, tenancy and telemetry of QualityScoreService. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered and a resource of another tenant is answered 404 (ADR-0015 amendment D113), secrets come from secret references, and traces, metrics and health checks follow the observability conventions with the six modelled metrics.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered and a resource of another tenant is answered 404 (ADR-0015 amendment D113), secrets come from secret references, and traces, metrics and health checks follow the observability conventions with the six modelled metrics."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-498]",
      "number": 498
    },
    {
      "id": "AIFACTORY-TASK-499",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "Replace the thin scope of QualityScoreService by the complete delivery",
      "sequence": "13.06.01.07",
      "description": "Replace the thin scope of QualityScoreService by the complete delivery. Expected output: The descriptor test of the thin surface is replaced by the descriptor test of the complete surface, the records of accepted events stored since I1 stay where they are and are read by the drift monitor, and the contract stub of FeedbackService is deleted because the service calls the real FeedbackService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The descriptor test of the thin surface is replaced by the descriptor test of the complete surface, the records of accepted events stored since I1 stay where they are and are read by the drift monitor, and the contract stub of FeedbackService is deleted because the service calls the real FeedbackService."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-499]",
      "number": 499
    },
    {
      "id": "AIFACTORY-TASK-772",
      "type": "task",
      "parent": "AIFACTORY-US-041",
      "title": "Verify release-needs-evaluation-evidence by running the declared command",
      "sequence": "13.06.01.08",
      "description": "Verify release-needs-evaluation-evidence by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a zero-match filter counts as a failure; it passes and proves AC1 to AC4 of AIFACTORY-US-041 end to end: a submitted release evaluated with its evidence, publication refused without a verdict, a waived verdict that allows publication, and drift published for a release whose outcomes fell.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` in the pipeline of the repository; a zero-match filter counts as a failure; it passes and proves AC1 to AC4 of AIFACTORY-US-041 end to end: a submitted release evaluated with its evidence, publication refused without a verdict, a waived verdict that allows publication, and drift published for a release whose outcomes fell."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-772]",
      "number": 772
    },
    {
      "id": "AIFACTORY-US-1090",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Evaluation suites are activated as pinned versions, announced and listed with their thresholds, datasets and baseline rules",
      "sequence": "13.06.02",
      "description": "As a platform admin, I want the suites in force per target listed with the thresholds I set per profile, their pinned dataset and their baseline rule, so that an asset maintainer sees what a release must prove before it is evaluated, and no author sets the bar for their own asset. An `EvaluationSuite` is the runtime read model of a Published evaluation-suite asset: its target kind (Model, Agent, Skill, Tool, Workflow, ContextStrategy, MemoryStrategy or Policy), the dataset it pins by version, the metrics with their thresholds per model profile, the baseline rule (no regression on task success, no rise in tool-error rate) and the cost and duration budgets of one run. Thresholds are set per profile by a Platform admin through the suite asset and never by the author of the evaluated asset (D32); until a suite overrides them, the seeds of `Observability:Evaluation:DefaultThresholds` apply. A suite pins its dataset version, so a changed dataset is a new suite version. When a suite version becomes active the service writes its row in `EvaluationSuites` with `Active` set, deactivates the earlier version of the same suite, and writes the `EvaluationSuiteActivated` outbox record with `suiteId`, `version`, `tenantId` and `target` in the same transaction; StudioBff and AuditService consume it in their own PBIs. The model gives no input for this activation: `AssetKind` of AgentRegistryService has no evaluation-suite kind, QualityScoreService consumes no `AssetReleasePublished`, and no operation creates a suite. This PBI therefore delivers the activation transaction behind one activation port and proves it from a test fixture; which input drives the port is the open point reported with this feature. `DatasetPublished` of FeedbackService (handler `RefreshSuiteDataset`) records that a dataset version is available, so a new suite version may pin it; it never changes the dataset of an active version. A caller whose scope carries `factory.evaluation.read` lists the active suites through `ListEvaluationSuites`, filtered by target, under the tenant row filter; a caller without the scope is refused with 403 and nothing is written. Kind: behavior. Traces: services: QualityScoreService, FeedbackService; aggregates: QualityScoreService/EvaluationSuite; apis: QualityScoreService/ListEvaluationSuites; events: QualityScoreService/EvaluationSuiteActivated, FeedbackService/DatasetPublished; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FUX-10, NFR-11; scenarios: SCN-QualityScoreService-001, SCN-QualityScoreService-008. Relates: screens: evaluation-runs. Depends on: feature:quality-score-service-thin, feature:feedback-service. Sources: model/services/observability/QualityScoreService.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given a suite version fed to the activation port, when it is activated, then its `QualityScoreService/EvaluationSuite` row is active with target, pinned dataset, thresholds per profile, baseline rule and budgets, the earlier version of the same suite is no longer active, and the `QualityScoreService/EvaluationSuiteActivated` outbox record is written in the same transaction (SCN-QualityScoreService-008, ADR-0021).",
        "AC2: Given the record was written, when the dispatcher of the `quality-score` profile publishes `QualityScoreService/EvaluationSuiteActivated` on `evaluation.suites.v1.evaluation-suite-activated`, then it is sent under the canonical envelope with `suiteId`, `version`, `tenantId` and `target`, and a transport outage is retried with backoff so it is neither lost nor duplicated under its event id (SCN-QualityScoreService-008, ADR-0012).",
        "AC3: Given a caller with `factory.evaluation.read`, when `QualityScoreService/ListEvaluationSuites` is called with a target filter, then the response is 200 with the active suites of that target in the caller tenant, each with thresholds per profile, pinned dataset, baseline rule and budgets; a caller without the scope is refused with 403 and nothing is written (SCN-QualityScoreService-001, ADR-0015).",
        "AC4: Given `FeedbackService/DatasetPublished` for a dataset an active suite pins at an older version, when `RefreshSuiteDataset` handles it, then the new version is recorded as available and the active suite keeps its pinned version; given a suite without its own thresholds, then the seeds of `Observability:Evaluation:DefaultThresholds` in model/services/observability/QualityScoreService.yaml apply."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-537",
        "AIFACTORY-TASK-4365",
        "AIFACTORY-TASK-4366"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13302,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "FeedbackService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationSuite"
        ],
        "apis": [
          "QualityScoreService/ListEvaluationSuites"
        ],
        "events": [
          "QualityScoreService/EvaluationSuiteActivated",
          "FeedbackService/DatasetPublished"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FUX-10",
          "NFR-11"
        ],
        "scenarios": [
          "SCN-QualityScoreService-001",
          "SCN-QualityScoreService-008"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs"
        ]
      },
      "dependsOn": [
        "feature:quality-score-service-thin",
        "feature:feedback-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1090]",
      "number": 1090
    },
    {
      "id": "AIFACTORY-TASK-537",
      "type": "task",
      "parent": "AIFACTORY-US-1090",
      "title": "Suites per target with the gate metrics behind the activation port",
      "sequence": "13.06.02.01",
      "description": "Suites per target with the gate metrics behind the activation port. Expected output: The activation port writes an EvaluationSuites row per suite version with target, pinned dataset, thresholds per profile, baseline rule and budgets, deactivates the earlier version and writes EvaluationSuiteActivated to the outbox in the same transaction; DefaultThresholds seed a suite without its own thresholds; RefreshSuiteDataset records an available dataset version without changing an active suite; ListEvaluationSuites returns the active suites by target under the tenant row filter.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The activation port writes an EvaluationSuites row per suite version with target, pinned dataset, thresholds per profile, baseline rule and budgets, deactivates the earlier version and writes EvaluationSuiteActivated to the outbox in the same transaction; DefaultThresholds seed a suite without its own thresholds; RefreshSuiteDataset records an available dataset version without changing an active suite; ListEvaluationSuites returns the active suites by target under the tenant row filter."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-537]",
      "number": 537
    },
    {
      "id": "AIFACTORY-TASK-4365",
      "type": "task",
      "parent": "AIFACTORY-US-1090",
      "title": "Suite fixtures for the activation port and the dataset refresh",
      "sequence": "13.06.02.02",
      "description": "Suite fixtures for the activation port and the dataset refresh. Expected output: The acceptance suite holds suite versions for an agent, a skill, a workflow and a policy target, two versions of one suite, a suite without thresholds, a DatasetPublished fixture from the contracts package and a transport switch for the outbox dispatcher.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The acceptance suite holds suite versions for an agent, a skill, a workflow and a policy target, two versions of one suite, a suite without thresholds, a DatasetPublished fixture from the contracts package and a transport switch for the outbox dispatcher."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13302,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4365]",
      "number": 4365
    },
    {
      "id": "AIFACTORY-TASK-4366",
      "type": "task",
      "parent": "AIFACTORY-US-1090",
      "title": "Verify suite activation and listing through the acceptance suite",
      "sequence": "13.06.02.03",
      "description": "Verify suite activation and listing through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-001|Scenario=SCN-QualityScoreService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1090: activation with its outbox record, the publication and payload of EvaluationSuiteActivated through an outage, the listing by target with its 403, the dataset refresh and the seeded thresholds.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-001|Scenario=SCN-QualityScoreService-008)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1090: activation with its outbox record, the publication and payload of EvaluationSuiteActivated through an outage, the listing by target with its 403, the dataset refresh and the seeded thresholds."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4366]",
      "number": 4366
    },
    {
      "id": "AIFACTORY-US-1091",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Start an evaluation of a target release against a baseline with an active suite, from a person or an internal caller",
      "sequence": "13.06.03",
      "description": "As an asset maintainer, I want to evaluate a release of my asset, and optionally a baseline release, with an active suite, so that I know before submission whether the candidate meets the thresholds and does not regress against the release in force. An Asset maintainer or a Platform admin whose scope carries `factory.evaluation.run` starts an evaluation through `StartEvaluation` with an `Idempotency-Key`, naming an active suite, a target release and optionally a baseline release; an internal caller with a workload identity starts one through the gRPC method `Evaluation.RunSuite` with `release-manifest-v1` and receives `ack-v1`, for a publication gate, a model deployment or a regression. The tenant and the project come from the trusted scope, never from the body (ADR-0015). The service resolves the target and the baseline releases through AgentRegistryService and the pinned dataset version of the suite to its snapshot artifact through `Learning.GetDatasetSnapshot` of FeedbackService; both dependencies are required and fail fast, so when either is unreachable the call fails, nothing is written and the caller repeats it under the same key. The service then writes the `EvaluationRun` in state Queued with `suiteId`, `suiteVersion`, `targetReleaseId`, `baselineReleaseId` and `datasetSnapshotRef`, together with the `EvaluationStarted` outbox record, the result event of the command, in one transaction, and answers 202 with the evaluation location. A repeated call under the same key and body returns the same evaluation and changes nothing; the same key with a different body, a suite that is not active and a release that AgentRegistryService does not resolve for the tenant are refused with 409 and a problem body that names the cause; a caller without the scope is refused with 403; none of these writes a row or publishes. Over gRPC the service reads the forwarded tenant only when the workload token holds the service scope that names QualityScoreService (ADR-0015 amendment D114): a caller without a workload identity is refused with UNAUTHENTICATED, a workload token without that scope with PERMISSION_DENIED before any read or write, and an invalid request with INVALID_ARGUMENT, with no state change. A `RunSuite` request is deduplicated on the `releaseId` of the manifest, the suite, which is the `evaluation.suiteId` of the manifest or else the active suite of the asset kind, and the kind of the evaluation: a retried request while an evaluation with that key is Queued, Running or Scoring queues no second evaluation and answers `ack-v1` again. The kind of an evaluation, one of the values capability-suite, release-gate, regression and drift that `EvaluationCompleted` carries, is taken from the path that starts it and kept on the run: `RunReleaseGate` starts a release-gate evaluation, a start for a suite whose target is Model starts a capability-suite evaluation, and every other start through `StartEvaluation` or `RunSuite` starts a regression evaluation; no start path of the model gives drift (D131). `EvaluationRun` and the table `EvaluationRuns` have no field for the kind, a gap of the model reported with this feature as a correction; the migration of this feature adds the column that keeps it. The SuiteRunner worker picks up a Queued evaluation, submits the tasks of the dataset snapshot as sandbox-class Factory runs under the project `Observability:Evaluation:EvaluationProjectId`, and moves the run from Queued to Running (trigger Started); its idempotency key is `evaluationId` plus `taskId`, so a duplicate trigger submits no task twice. SuiteRunner submits each task through `SubmitRun` of RunControlService with a service token that holds `factory.runs.submit` and names the evaluation project, and each run records QualityScoreService as its submitting service (D131). The model calls of the tasks carry the attempt token of their lease as the proof that they belong to a run (ADR-0015 amendment D125) and their receipts are attributed to the evaluation. Kind: behavior. Traces: services: QualityScoreService, AgentRegistryService, FeedbackService, RunControlService; aggregates: QualityScoreService/EvaluationRun; apis: QualityScoreService/StartEvaluation, QualityScoreService/Evaluation.RunSuite, FeedbackService/Learning.GetDatasetSnapshot, RunControlService/SubmitRun; events: QualityScoreService/EvaluationStarted; descriptors: release-manifest-v1, ack-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0021; requirements: FR-04, XL-08; scenarios: SCN-QualityScoreService-002, SCN-QualityScoreService-007, SCN-QualityScoreService-009. Relates: screens: evaluation-runs. Depends on: AIFACTORY-US-1090, feature:agent-registry-service-complete, feature:feedback-service, feature:run-control-service. Sources: model/services/observability/QualityScoreService.yaml, model/services/observability/FeedbackService.yaml, docs/planes/trust-operations/observability/services/quality-score-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.evaluation.run`, an active suite and a target release that resolves, when `QualityScoreService/StartEvaluation` is called with an `Idempotency-Key`, then the response is 202, the `QualityScoreService/EvaluationRun` is Queued with suite, suite version, target, baseline and dataset snapshot reference, and the `QualityScoreService/EvaluationStarted` outbox record is written in the same transaction; the same key and body return the same evaluation and change nothing (SCN-QualityScoreService-002, ADR-0014).",
        "AC2: Given the same key with a different body, a suite that is not active, a release that does not resolve for the tenant, or a caller without the scope, when `QualityScoreService/StartEvaluation` is called, then it is refused with 409 naming the cause or with 403, no row is written and nothing is published; given AgentRegistryService or `FeedbackService/Learning.GetDatasetSnapshot` unreachable, then the call fails fast, nothing is written and the repeat under the same key is accepted once both answer (SCN-QualityScoreService-002, ADR-0015).",
        "AC3: Given an internal caller whose workload token holds the service scope naming QualityScoreService and `release-manifest-v1`, when `QualityScoreService/Evaluation.RunSuite` is called, then the reply carries `ack-v1`, one evaluation is Queued for that release with its kind kept on the run, and a retried request with the same release, suite and kind while that evaluation is Queued, Running or Scoring queues no second evaluation; a caller without a workload identity is refused with UNAUTHENTICATED, a workload token without the service scope naming QualityScoreService with PERMISSION_DENIED before any read or write, and an invalid request with INVALID_ARGUMENT, with no state change (SCN-QualityScoreService-007, ADR-0015).",
        "AC4: Given the record was written, when the dispatcher publishes `QualityScoreService/EvaluationStarted` on `evaluation.runs.v1.evaluation-started`, then it is sent under the canonical envelope with `evaluationId`, `tenantId`, `suiteId`, `targetReleaseId` and `baselineReleaseId` and an outage is retried so it is neither lost nor duplicated; when SuiteRunner picks the evaluation up, its tasks are submitted once each through `RunControlService/SubmitRun` with a service token that holds `factory.runs.submit` and names the evaluation project, each run records QualityScoreService as its submitting service, and the run moves from Queued to Running (SCN-QualityScoreService-009, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4367",
        "AIFACTORY-TASK-4368",
        "AIFACTORY-TASK-4369"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13303,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "AgentRegistryService",
          "FeedbackService",
          "RunControlService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationRun"
        ],
        "apis": [
          "QualityScoreService/StartEvaluation",
          "QualityScoreService/Evaluation.RunSuite",
          "FeedbackService/Learning.GetDatasetSnapshot",
          "RunControlService/SubmitRun"
        ],
        "events": [
          "QualityScoreService/EvaluationStarted"
        ],
        "descriptors": [
          "release-manifest-v1",
          "ack-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-04",
          "XL-08"
        ],
        "scenarios": [
          "SCN-QualityScoreService-002",
          "SCN-QualityScoreService-007",
          "SCN-QualityScoreService-009"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1090",
        "feature:agent-registry-service-complete",
        "feature:feedback-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/observability/FeedbackService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1091]",
      "number": 1091
    },
    {
      "id": "AIFACTORY-TASK-4367",
      "type": "task",
      "parent": "AIFACTORY-US-1091",
      "title": "StartEvaluation and Evaluation.RunSuite with idempotency, scope and dependency checks",
      "sequence": "13.06.03.01",
      "description": "StartEvaluation and Evaluation.RunSuite with idempotency, scope and dependency checks. Expected output: Both operations take tenant and project from the trusted scope, resolve the releases through AgentRegistryService and the dataset snapshot through Learning.GetDatasetSnapshot, fail fast without a write when either is unreachable, write the EvaluationRun in Queued with its kind and its EvaluationStarted outbox record in one transaction and answer 202 or ack-v1; RunSuite deduplicates on release, suite and kind while the evaluation is Queued, Running or Scoring; the idempotent repeat, the 409 for a reused key with a different body, an inactive suite and an unresolved release, the 403, and the gRPC refusals UNAUTHENTICATED, PERMISSION_DENIED for a workload token without the service scope naming QualityScoreService before any read or write, and INVALID_ARGUMENT are covered by acceptance tests; the migration adds the column of the kind to EvaluationRuns.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Both operations take tenant and project from the trusted scope, resolve the releases through AgentRegistryService and the dataset snapshot through Learning.GetDatasetSnapshot, fail fast without a write when either is unreachable, write the EvaluationRun in Queued with its kind and its EvaluationStarted outbox record in one transaction and answer 202 or ack-v1; RunSuite deduplicates on release, suite and kind while the evaluation is Queued, Running or Scoring; the idempotent repeat, the 409 for a reused key with a different body, an inactive suite and an unresolved release, the 403, and the gRPC refusals UNAUTHENTICATED, PERMISSION_DENIED for a workload token without the service scope naming QualityScoreService before any read or write, and INVALID_ARGUMENT are covered by acceptance tests; the migration adds the column of the kind to EvaluationRuns."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4367]",
      "number": 4367
    },
    {
      "id": "AIFACTORY-TASK-4368",
      "type": "task",
      "parent": "AIFACTORY-US-1091",
      "title": "SuiteRunner submission of the tasks of an evaluation under the evaluation project",
      "sequence": "13.06.03.02",
      "description": "SuiteRunner submission of the tasks of an evaluation under the evaluation project. Expected output: SuiteRunner picks up Queued evaluations per tenant partition, submits each task of the dataset snapshot once as a sandbox-class Factory run under Observability:Evaluation:EvaluationProjectId through SubmitRun of RunControlService with a service token that holds factory.runs.submit and names the evaluation project, so each run records QualityScoreService as its submitting service, keyed by evaluationId and taskId, and moves the run from Queued to Running; RunControlService is a fake in the acceptance suite.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "SuiteRunner picks up Queued evaluations per tenant partition, submits each task of the dataset snapshot once as a sandbox-class Factory run under Observability:Evaluation:EvaluationProjectId through SubmitRun of RunControlService with a service token that holds factory.runs.submit and names the evaluation project, so each run records QualityScoreService as its submitting service, keyed by evaluationId and taskId, and moves the run from Queued to Running; RunControlService is a fake in the acceptance suite."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4368]",
      "number": 4368
    },
    {
      "id": "AIFACTORY-TASK-4369",
      "type": "task",
      "parent": "AIFACTORY-US-1091",
      "title": "Verify the start of an evaluation through the acceptance suite",
      "sequence": "13.06.03.03",
      "description": "Verify the start of an evaluation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-002|Scenario=SCN-QualityScoreService-007|Scenario=SCN-QualityScoreService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1091 with fakes of AgentRegistryService, FeedbackService and RunControlService: the accepted start and its repeat, every refusal, the fail-fast dependencies, the gRPC start with its UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT refusals and the retry deduplicated on release, suite and kind, the kind kept on the run, the publication of EvaluationStarted and the tasks submitted once through SubmitRun with the service token that names the evaluation project.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-002|Scenario=SCN-QualityScoreService-007|Scenario=SCN-QualityScoreService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1091 with fakes of AgentRegistryService, FeedbackService and RunControlService: the accepted start and its repeat, every refusal, the fail-fast dependencies, the gRPC start with its UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT refusals and the retry deduplicated on release, suite and kind, the kind kept on the run, the publication of EvaluationStarted and the tasks submitted once through SubmitRun with the service token that names the evaluation project."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4369]",
      "number": 4369
    },
    {
      "id": "AIFACTORY-US-1092",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Score the tasks of an evaluation, compute the verdict against thresholds and baseline, and record immutable evidence",
      "sequence": "13.06.04",
      "description": "As an asset maintainer, I want the verdict of an evaluation computed from the tasks it ran, compared with the thresholds of my profile and with the release in force, so that I can read per metric why a release passed or failed, and publication can rely on evidence nobody can alter. The tasks of an evaluation run as Factory runs. When one ends, `RunCompleted` of RunControlService (handler `ScoreEvaluationTask`) scores it: the per-metric values of the task for the target, and for the baseline where one is named, are written as an `EvaluationResults` row keyed by `evaluationId` and `taskId` with the `runId` that executed it and whether it passed, once per task, idempotent on the event id. The signals the thin delivery already stores, model and tool receipts, context and retrieval statistics and validator outcomes of the attempts of those runs, feed the metrics of the suite. When every task of the snapshot has a result, SuiteRunner moves the run from Running to Scoring (trigger TasksCompleted), computes the verdict and moves it from Scoring to Completed (trigger VerdictComputed). The verdict is Passed only when every threshold of the suite for the profile is met and the baseline rule holds, that is task success does not fall and the tool-error rate does not rise against the baseline release (D32); otherwise it is Failed. The model also lists the verdict `Inconclusive` and gives no rule that produces it, so this delivery never produces it and the open point is reported with this feature. The service stores the evidence record through ArtifactService: it is immutable and references the dataset snapshot, the target and baseline releases and every receipt of the evaluation; its reference is kept in `evidenceRef`, with the cost and the duration of the run. The `EvaluationCompleted` outbox record with `evaluationId`, `tenantId`, `suiteId`, `targetReleaseId`, `verdict`, `evidenceRef` and `kind`, the kind kept on the run when it started (AIFACTORY-US-1091), is written in the transaction that completes the run. AgentRegistryService, ModelRouterService, FeedbackService, StudioBff and AuditService consume it in their own PBIs. ArtifactService is a required dependency that fails fast: when the evidence cannot be stored, the run stays in Scoring and SuiteRunner retries with its exponential policy of three attempts; when all three fail, the run stays in Scoring with no verdict and no event, the failure is counted and logged with the evaluation id, and the next trigger of SuiteRunner retries it. `EvaluationState` has no transition from Scoring to Failed, so a run whose evidence can never be stored has no terminal state; this is an open point reported with this feature. A caller whose scope carries `factory.evaluation.read` reads an evaluation through `GetEvaluation`: its state, the per-metric results for target and baseline, the verdict, the cost, the duration and the evidence reference. An evaluation of another tenant is answered 404, the same answer as for an id that does not exist (ADR-0015 amendment D113); a missing scope is 403; nothing is written by the read. The metrics `connectsoft.factory.evaluation.runs`, `connectsoft.factory.evaluation.duration` and `connectsoft.factory.evaluation.cost_usd` move with each completed run. Kind: behavior. Traces: services: QualityScoreService, RunControlService, ArtifactService; aggregates: QualityScoreService/EvaluationRun; apis: QualityScoreService/GetEvaluation; events: QualityScoreService/EvaluationCompleted, RunControlService/RunCompleted; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FUX-10, NFR-11; scenarios: SCN-QualityScoreService-003, SCN-QualityScoreService-010. Relates: screens: evaluation-runs, release-evidence. Depends on: AIFACTORY-US-1091, feature:run-control-service, feature:artifact-service. Sources: model/services/observability/QualityScoreService.yaml, docs/architecture/quality-gates.md, docs/planes/trust-operations/evaluation.md.",
      "acceptanceCriteria": [
        "AC1: Given an evaluation in Running whose task runs end, when `RunControlService/RunCompleted` arrives for each, then one `EvaluationResults` row per task holds the metrics for target and baseline and whether it passed, a redelivered event writes nothing, and the `QualityScoreService/EvaluationRun` moves to Scoring when the last task has a result (SCN-QualityScoreService-010, model/services/observability/QualityScoreService.yaml).",
        "AC2: Given results that meet every threshold of the profile and a baseline rule that holds, when the verdict is computed, then the verdict is Passed; given one metric below its threshold, or a fall of task success or a rise of the tool-error rate against the baseline, then it is Failed; in both cases the evidence record is stored once through ArtifactService and referenced in `evidenceRef`, the run is Completed and the `QualityScoreService/EvaluationCompleted` outbox record is written in the same transaction (SCN-QualityScoreService-010, ADR-0021).",
        "AC3: Given the record was written, when the dispatcher publishes `QualityScoreService/EvaluationCompleted` on `evaluation.runs.v1.evaluation-completed`, then it is sent under the canonical envelope with `evaluationId`, `tenantId`, `suiteId`, `targetReleaseId`, `verdict`, `evidenceRef` and `kind`, and an outage is retried so it is neither lost nor duplicated; given ArtifactService unreachable, then the run stays in Scoring and nothing is published until the evidence is stored; given ArtifactService fails on all three attempts of SuiteRunner, then the run stays in Scoring with no verdict and no event, the failure is counted and logged, and the next trigger of SuiteRunner retries it (SCN-QualityScoreService-010, ADR-0012).",
        "AC4: Given a caller with `factory.evaluation.read` and an evaluation of the caller tenant, when `QualityScoreService/GetEvaluation` is called, then the response is 200 with state, per-metric results for target and baseline, verdict, cost, duration and evidence reference; an evaluation of another tenant and an unknown id are both answered 404, a missing scope 403, and nothing is written (SCN-QualityScoreService-003, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/quality-gates.md",
        "docs/planes/trust-operations/evaluation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4370",
        "AIFACTORY-TASK-4371",
        "AIFACTORY-TASK-4372"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13304,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "RunControlService",
          "ArtifactService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationRun"
        ],
        "apis": [
          "QualityScoreService/GetEvaluation"
        ],
        "events": [
          "QualityScoreService/EvaluationCompleted",
          "RunControlService/RunCompleted"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FUX-10",
          "NFR-11"
        ],
        "scenarios": [
          "SCN-QualityScoreService-003",
          "SCN-QualityScoreService-010"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs",
          "release-evidence"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1091",
        "feature:run-control-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/architecture/quality-gates.md",
        "docs/planes/trust-operations/evaluation.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1092]",
      "number": 1092
    },
    {
      "id": "AIFACTORY-TASK-4370",
      "type": "task",
      "parent": "AIFACTORY-US-1092",
      "title": "ScoreEvaluationTask and the verdict of SuiteRunner against thresholds and the baseline rule",
      "sequence": "13.06.04.01",
      "description": "ScoreEvaluationTask and the verdict of SuiteRunner against thresholds and the baseline rule. Expected output: ScoreEvaluationTask writes one EvaluationResults row per task of an evaluation, idempotent on the event id; SuiteRunner moves the run Running to Scoring when every task has a result, computes Passed or Failed from the thresholds per profile and the baseline rule of D32, stores the immutable evidence record through ArtifactService with the snapshot, both releases and every receipt, and completes the run with its EvaluationCompleted outbox record, carrying the kind kept on the run, in one transaction; the run stays in Scoring while the store fails, and after the third failed attempt it stays in Scoring with no verdict and no event, the failure is counted and logged with the evaluation id, and the next SuiteRunner trigger retries it; Inconclusive is never produced.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "ScoreEvaluationTask writes one EvaluationResults row per task of an evaluation, idempotent on the event id; SuiteRunner moves the run Running to Scoring when every task has a result, computes Passed or Failed from the thresholds per profile and the baseline rule of D32, stores the immutable evidence record through ArtifactService with the snapshot, both releases and every receipt, and completes the run with its EvaluationCompleted outbox record, carrying the kind kept on the run, in one transaction; the run stays in Scoring while the store fails, and after the third failed attempt it stays in Scoring with no verdict and no event, the failure is counted and logged with the evaluation id, and the next SuiteRunner trigger retries it; Inconclusive is never produced."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4370]",
      "number": 4370
    },
    {
      "id": "AIFACTORY-TASK-4371",
      "type": "task",
      "parent": "AIFACTORY-US-1092",
      "title": "GetEvaluation read model with results, verdict, cost, duration and evidence",
      "sequence": "13.06.04.02",
      "description": "GetEvaluation read model with results, verdict, cost, duration and evidence. Expected output: GetEvaluation returns state, per-metric results for target and baseline, verdict, cost, duration and evidence reference under the tenant row filter; an evaluation of another tenant and an unknown id are both 404, a missing scope 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "GetEvaluation returns state, per-metric results for target and baseline, verdict, cost, duration and evidence reference under the tenant row filter; an evaluation of another tenant and an unknown id are both 404, a missing scope 403."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4371]",
      "number": 4371
    },
    {
      "id": "AIFACTORY-TASK-4372",
      "type": "task",
      "parent": "AIFACTORY-US-1092",
      "title": "Verify scoring, verdict, evidence and the read model through the acceptance suite",
      "sequence": "13.06.04.03",
      "description": "Verify scoring, verdict, evidence and the read model through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-003|Scenario=SCN-QualityScoreService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1092 with a fake ArtifactService: results per task and their redelivery, Passed, Failed on a threshold and Failed on the baseline rule, the evidence stored once, the publication and payload of EvaluationCompleted, the run held in Scoring while the store fails, the run left in Scoring without a verdict or event after three failed attempts and retried at the next trigger, and the read with its 404 and 403.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-003|Scenario=SCN-QualityScoreService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1092 with a fake ArtifactService: results per task and their redelivery, Passed, Failed on a threshold and Failed on the baseline rule, the evidence stored once, the publication and payload of EvaluationCompleted, the run held in Scoring while the store fails, the run left in Scoring without a verdict or event after three failed attempts and retried at the next trigger, and the read with its 404 and 403."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4372]",
      "number": 4372
    },
    {
      "id": "AIFACTORY-US-1093",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "An evaluation that exceeds its budget, misses its dataset snapshot or loses its infrastructure ends Failed with a reason",
      "sequence": "13.06.05",
      "description": "As an asset maintainer, I want an evaluation that cannot complete to end Failed with the reason named, so that my candidate is not published on a missing verdict and I know whether to re-snapshot the dataset or retry. Three failure modes of model/services/observability/QualityScoreService.yaml end an evaluation without a verdict. Evaluation budget exceeded: SuiteRunner tracks the cost and the duration of a Running evaluation against the budgets of its suite, and when either is above the budget it stops submitting tasks and moves the run from Running to Failed with the reason budget exceeded; a release candidate under evaluation stays InReview. Dataset snapshot missing: when the snapshot reference of the run no longer resolves through FeedbackService while it runs, the run ends Failed with the reason snapshot missing, and the maintainer re-snapshots the dataset and starts a new evaluation. Infrastructure failure: when SuiteRunner exhausts its retry policy (exponential, three attempts) on a task submission or on the dependencies of the run, the run moves from Running to Failed with the reason of the last failure. In each case the `EvaluationFailed` outbox record with `evaluationId`, `tenantId` and `reason` is written in the transaction that fails the run, `completedAt` is set, no verdict and no evidence record are written, and StudioBff consumes the event in its own PBI. A Failed run is terminal: a late `RunCompleted` of one of its tasks writes no result and moves nothing. The model lists two further transitions, Queued to Cancelled and Running to Cancelled with the trigger Cancel, and no operation, event or worker of the model raises that trigger; how an evaluation is cancelled is an open point reported with this feature, and this PBI delivers the two transitions in the domain model only, refusing any other path to Cancelled. Kind: behavior. Traces: services: QualityScoreService; aggregates: QualityScoreService/EvaluationRun; events: QualityScoreService/EvaluationFailed, RunControlService/RunCompleted; adrs: ADR-0012, ADR-0021; requirements: NFR-12; scenarios: SCN-QualityScoreService-011. Depends on: AIFACTORY-US-1091, AIFACTORY-US-1092, feature:run-control-service. Sources: model/services/observability/QualityScoreService.yaml, docs/planes/trust-operations/observability/services/quality-score-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a Running evaluation whose cost or duration rises above the budget of its suite, when SuiteRunner checks it, then no further task is submitted, the `QualityScoreService/EvaluationRun` is Failed with the reason budget exceeded and no verdict, and the `QualityScoreService/EvaluationFailed` outbox record is written in the same transaction (SCN-QualityScoreService-011, model/services/observability/QualityScoreService.yaml).",
        "AC2: Given a Running evaluation whose dataset snapshot no longer resolves, or whose task submission fails after the third attempt of the retry policy, when SuiteRunner handles it, then the run is Failed with the reason snapshot missing or the reason of the last failure, and the `QualityScoreService/EvaluationFailed` record is written with it; a later `RunControlService/RunCompleted` of one of its tasks writes no result (SCN-QualityScoreService-011).",
        "AC3: Given the record was written, when the dispatcher publishes `QualityScoreService/EvaluationFailed` on `evaluation.runs.v1.evaluation-failed`, then it is sent under the canonical envelope with `evaluationId`, `tenantId` and `reason`, and an outage is retried so it is neither lost nor duplicated under its event id (SCN-QualityScoreService-011, ADR-0012).",
        "AC4: Given the domain model, when a transition to Cancelled is requested from Queued or Running, then it is applied, and from any other state it is refused; no operation of the service raises it in this delivery (model/services/observability/QualityScoreService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4373",
        "AIFACTORY-TASK-4374"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13305,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationRun"
        ],
        "events": [
          "QualityScoreService/EvaluationFailed",
          "RunControlService/RunCompleted"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0021"
        ],
        "requirements": [
          "NFR-12"
        ],
        "scenarios": [
          "SCN-QualityScoreService-011"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1091",
        "AIFACTORY-US-1092",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/planes/trust-operations/observability/services/quality-score-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1093]",
      "number": 1093
    },
    {
      "id": "AIFACTORY-TASK-4373",
      "type": "task",
      "parent": "AIFACTORY-US-1093",
      "title": "Budget, snapshot and retry-exhaustion failures of SuiteRunner",
      "sequence": "13.06.05.01",
      "description": "Budget, snapshot and retry-exhaustion failures of SuiteRunner. Expected output: SuiteRunner fails a Running evaluation when its cost or duration exceeds the suite budget, when its snapshot no longer resolves or when its retry policy is exhausted, each time with the reason, completedAt set, no verdict and the EvaluationFailed outbox record in the same transaction; a result for a task of a Failed run is ignored; the Cancel transitions exist in the domain model only.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "SuiteRunner fails a Running evaluation when its cost or duration exceeds the suite budget, when its snapshot no longer resolves or when its retry policy is exhausted, each time with the reason, completedAt set, no verdict and the EvaluationFailed outbox record in the same transaction; a result for a task of a Failed run is ignored; the Cancel transitions exist in the domain model only."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13305,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4373]",
      "number": 4373
    },
    {
      "id": "AIFACTORY-TASK-4374",
      "type": "task",
      "parent": "AIFACTORY-US-1093",
      "title": "Verify the failure branches of an evaluation through the acceptance suite",
      "sequence": "13.06.05.02",
      "description": "Verify the failure branches of an evaluation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-QualityScoreService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1093: the budget breach, the missing snapshot, the exhausted retry policy, the late task result ignored, the publication and payload of EvaluationFailed through an outage, and the guarded Cancel transitions.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-QualityScoreService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1093: the budget breach, the missing snapshot, the exhausted retry policy, the late task result ignored, the publication and payload of EvaluationFailed through an outage, and the guarded Cancel transitions."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4374]",
      "number": 4374
    },
    {
      "id": "AIFACTORY-US-1094",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Every submitted release is evaluated by the suite of its kind and its verdict is recorded for the Published gate",
      "sequence": "13.06.06",
      "description": "As a reviewer, I want the verdict and evidence of a candidate release in front of me and enforced at publication, so that no release of an asset kind that has an active suite (D117) is published without a passing or waived evaluation, and the Draft allowance ends when the gate exists. AgentRegistryService publishes `AssetReleaseSubmitted` when a release candidate enters InReview; the handler `RunReleaseGate` of QualityScoreService evaluates every candidate with the active suite of its kind, with the current Published release of the same asset as the baseline where one exists, as an evaluation of kind release-gate started by the same path as AIFACTORY-US-1091, once per release and suite, idempotent on the event id. A candidate whose kind has no active suite is not evaluated, as SubmitRelease of AgentRegistryService states. `EvaluationCompleted` reaches AgentRegistryService, whose handler `RecordEvaluationEvidence` attaches the verdict and evidence to the release. At the Published gate AgentRegistryService checks the evidence it recorded itself and makes no synchronous call to QualityScoreService (D141); for a release of an asset kind that has an active suite (D117), `AgentRegistryService/PublishRelease` refuses it when the latest recorded verdict is neither Passed nor Waived and names the missing evidence, which feature agent-registry-service-complete proves on its side. The internal gRPC method `Evaluation.GetVerdict` stays a read for other callers: a workload caller sends `release-manifest-v1` and receives the latest verdict and evidence reference for the release and suite in `release-manifest-v1` (D141). A release with no evaluation in the tenant of the caller, and a release of another tenant, are answered NOT_FOUND, never confirming that a foreign release exists (ADR-0015 amendment D113); the service reads the forwarded tenant only when the workload token holds the service scope that names QualityScoreService (ADR-0015 amendment D114), so a caller without a workload identity is refused with UNAUTHENTICATED and a workload token without that scope with PERMISSION_DENIED before any read; the read writes nothing. The request and reply descriptor of `Evaluation.GetVerdict` and `Evaluation.RunSuite`, `release-manifest-v1`, requires `publishedAt`, `publishedBy` and `state`, which a candidate in InReview at the Published gate does not have, and its evaluation verdict enum (passed, failed, waived) has no `Inconclusive`; this is an open point reported with this feature, and until the owner decides the service reads only `releaseId`, `assetKind` and `evaluation.suiteId` of the request and refuses a request without `releaseId` with INVALID_ARGUMENT. A person whose scope carries `factory.evaluation.read` lists the evaluations of a release with their verdicts through `ListReleaseEvaluations`, the evidence Asset Publication reads and the release evidence view shows; a release with no evaluation in the caller tenant and a release of another tenant are answered 404, a missing scope 403. With the gate in place the platform policy rule of D83 is withdrawn: the policy revision that activates the gate removes the Draft allowance of the ADR-0021 amendment, and from that revision a release is published only with its evaluation evidence or a recorded waiver. Kind: behavior. Traces: services: QualityScoreService, AgentRegistryService, PolicyEngineService; apis: QualityScoreService/Evaluation.GetVerdict, QualityScoreService/ListReleaseEvaluations, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleaseSubmitted, QualityScoreService/EvaluationCompleted; descriptors: release-manifest-v1; adrs: ADR-0015, ADR-0021; requirements: FR-02, FUX-02, XL-08; scenarios: SCN-QualityScoreService-005, SCN-QualityScoreService-006. Relates: screens: release-evidence, release-detail. Depends on: AIFACTORY-US-1091, AIFACTORY-US-1092, feature:agent-registry-service-complete, feature:policy-engine-service. Sources: model/services/observability/QualityScoreService.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given `AgentRegistryService/AssetReleaseSubmitted` for a candidate whose kind has an active suite, when `RunReleaseGate` handles it, then one evaluation of kind release-gate is Queued for the candidate with the current Published release as baseline, and a redelivered event starts none; given a kind without an active suite, then no evaluation starts (model/services/observability/QualityScoreService.yaml, ADR-0021).",
        "AC2: Given a completed evaluation of a release, when a workload caller calls `QualityScoreService/Evaluation.GetVerdict` with its workload identity, then the reply carries `release-manifest-v1` with the latest verdict and evidence reference for that release and suite; a release without evaluation in the tenant and a release of another tenant are answered NOT_FOUND, a caller without identity UNAUTHENTICATED, a workload token without the service scope naming QualityScoreService PERMISSION_DENIED before any read, a request without `releaseId` INVALID_ARGUMENT, and nothing is written (SCN-QualityScoreService-006, ADR-0015).",
        "AC3: Given a release of an asset kind that has an active suite (D117) whose latest verdict is Failed, when `AgentRegistryService/PublishRelease` is called, then `AgentRegistryService/PublishRelease` refuses it on the evidence recorded from `QualityScoreService/EvaluationCompleted` by `RecordEvaluationEvidence`, makes no synchronous call to QualityScoreService and names the missing evidence (D141); given the policy revision that activates the gate, then the rule of D83 is removed and a Draft release no longer runs under the allowance of the ADR-0021 amendment (ADR-0021).",
        "AC4: Given a caller with `factory.evaluation.read`, when `QualityScoreService/ListReleaseEvaluations` is called for a release of the caller tenant, then the response is 200 with its evaluations and verdicts; a release with no evaluation in the tenant and a release of another tenant are both answered 404, a missing scope 403, and nothing is written (SCN-QualityScoreService-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-538",
        "AIFACTORY-TASK-512",
        "AIFACTORY-TASK-4375",
        "AIFACTORY-TASK-4376"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13306,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "AgentRegistryService",
          "PolicyEngineService"
        ],
        "apis": [
          "QualityScoreService/Evaluation.GetVerdict",
          "QualityScoreService/ListReleaseEvaluations",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleaseSubmitted",
          "QualityScoreService/EvaluationCompleted"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "FUX-02",
          "XL-08"
        ],
        "scenarios": [
          "SCN-QualityScoreService-005",
          "SCN-QualityScoreService-006"
        ]
      },
      "relates": {
        "screens": [
          "release-evidence",
          "release-detail"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1091",
        "AIFACTORY-US-1092",
        "feature:agent-registry-service-complete",
        "feature:policy-engine-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1094]",
      "number": 1094
    },
    {
      "id": "AIFACTORY-TASK-538",
      "type": "task",
      "parent": "AIFACTORY-US-1094",
      "title": "Verify the release gate between submission and publication against QualityScoreService",
      "sequence": "13.06.06.01",
      "description": "Verify the release gate between submission and publication against QualityScoreService. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReleaseGateAgainstQualityScore\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.AgentRegistryService against a deployed QualityScoreService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1094 on the side of publication: a release of an asset kind with an active suite whose latest verdict is Failed is refused by AgentRegistryService/PublishRelease on the evidence that RecordEvaluationEvidence recorded from QualityScoreService/EvaluationCompleted, with no synchronous call to QualityScoreService, and the refusal names the missing evidence (D141), a release without any recorded verdict is refused the same way, and a Waived verdict lets the release pass with the waiver in its evidence; the removal of the rule of D83 in the second sentence of AC3 is proven by the tests of AIFACTORY-TASK-512 in ConnectSoft.AI.SoftwareFactory.PolicyEngineService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=ReleaseGateAgainstQualityScore\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.AgentRegistryService against a deployed QualityScoreService; a zero-match filter counts as a failure; the tests prove AC3 of AIFACTORY-US-1094 on the side of publication: a release of an asset kind with an active suite whose latest verdict is Failed is refused by AgentRegistryService/PublishRelease on the evidence that RecordEvaluationEvidence recorded from QualityScoreService/EvaluationCompleted, with no synchronous call to QualityScoreService, and the refusal names the missing evidence (D141), a release without any recorded verdict is refused the same way, and a Waived verdict lets the release pass with the waiver in its evidence; the removal of the rule of D83 in the second sentence of AC3 is proven by the tests of AIFACTORY-TASK-512 in ConnectSoft.AI.SoftwareFactory.PolicyEngineService."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13306,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-538]",
      "number": 538
    },
    {
      "id": "AIFACTORY-TASK-512",
      "type": "task",
      "parent": "AIFACTORY-US-1094",
      "title": "Withdraw the waiver rule for Draft releases",
      "sequence": "13.06.06.02",
      "description": "Withdraw the waiver rule for Draft releases. Expected output: The platform policy rule of decision D83 is removed in the policy revision that activates the evaluation gate (ADR-0021); from that revision a release is published only with its evaluation evidence or a recorded waiver.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The platform policy rule of decision D83 is removed in the policy revision that activates the evaluation gate (ADR-0021); from that revision a release is published only with its evaluation evidence or a recorded waiver."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-512]",
      "number": 512
    },
    {
      "id": "AIFACTORY-TASK-4375",
      "type": "task",
      "parent": "AIFACTORY-US-1094",
      "title": "RunReleaseGate, Evaluation.GetVerdict and ListReleaseEvaluations",
      "sequence": "13.06.06.03",
      "description": "RunReleaseGate, Evaluation.GetVerdict and ListReleaseEvaluations. Expected output: RunReleaseGate queues one release-gate evaluation per submitted candidate and suite with the current Published release as baseline, idempotent on the event id, and none for a kind without an active suite; GetVerdict reads releaseId, assetKind and evaluation.suiteId of the request and returns the latest verdict and evidence reference in release-manifest-v1 to a workload whose token holds the service scope naming QualityScoreService, NOT_FOUND for no evaluation or another tenant, UNAUTHENTICATED without a workload identity, PERMISSION_DENIED for a workload token without that scope before any read, INVALID_ARGUMENT without releaseId; ListReleaseEvaluations returns the evaluations of a release under the tenant row filter, 404 for none or another tenant, 403 without the scope.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "RunReleaseGate queues one release-gate evaluation per submitted candidate and suite with the current Published release as baseline, idempotent on the event id, and none for a kind without an active suite; GetVerdict reads releaseId, assetKind and evaluation.suiteId of the request and returns the latest verdict and evidence reference in release-manifest-v1 to a workload whose token holds the service scope naming QualityScoreService, NOT_FOUND for no evaluation or another tenant, UNAUTHENTICATED without a workload identity, PERMISSION_DENIED for a workload token without that scope before any read, INVALID_ARGUMENT without releaseId; ListReleaseEvaluations returns the evaluations of a release under the tenant row filter, 404 for none or another tenant, 403 without the scope."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4375]",
      "number": 4375
    },
    {
      "id": "AIFACTORY-TASK-4376",
      "type": "task",
      "parent": "AIFACTORY-US-1094",
      "title": "Verify the release gate and the verdict reads through the acceptance suite",
      "sequence": "13.06.06.04",
      "description": "Verify the release gate and the verdict reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-005|Scenario=SCN-QualityScoreService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1, AC2 and AC4 of AIFACTORY-US-1094: the gate evaluation queued once per candidate, none without a suite, the verdict read with its NOT_FOUND, UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT, and the release listing with its 404 and 403; AC3 is proven by AIFACTORY-TASK-538 and AIFACTORY-TASK-512.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-QualityScoreService-005|Scenario=SCN-QualityScoreService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1, AC2 and AC4 of AIFACTORY-US-1094: the gate evaluation queued once per candidate, none without a suite, the verdict read with its NOT_FOUND, UNAUTHENTICATED, PERMISSION_DENIED and INVALID_ARGUMENT, and the release listing with its 404 and 403; AC3 is proven by AIFACTORY-TASK-538 and AIFACTORY-TASK-512."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13306,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4376]",
      "number": 4376
    },
    {
      "id": "AIFACTORY-US-1095",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Waive a failed evaluation with a reason under an approval of class publication bound to the evaluation",
      "sequence": "13.06.07",
      "description": "As a reviewer, I want to waive a failed verdict only with a reason and an approval bound to that evaluation, so that a release may be published without passing its suite only when a named person accepted that, and the evidence says so. A caller whose scope carries `factory.evaluation.waive` asks to waive a completed evaluation through `WaiveEvaluation`, with a reason. A waiver is an approval-gated action of class publication: a Reviewer who is not the author of the evaluated release approves it, and the approval is bound to the evaluation id (ADR-0021, D32). The operation follows one flow. The first call with a reason on a Completed evaluation whose verdict is Failed asks RunControlService, its outbound dependency for waiver approvals, for one approval request bound to the evaluation id and carrying the reason, and answers 412 with a problem response that names the pending approval; the request is idempotent on the evaluation id while it is pending, so a repeated call answers 412 again and raises no second approval request, and the verdict is unchanged. The waiver is recorded by whichever comes first: the handler `ApplyWaiver` of `ApprovalDecided` of RunControlService when the decision reports the bound approval Approved, or a later call of `WaiveEvaluation` that finds the bound approval Approved in RunControlService. Either sets the verdict to Waived with `waiverApprovalId`, extends the evidence record through ArtifactService with the reason, the approver and the approval, and writes the `EvaluationCompleted` outbox record with the verdict Waived in the same transaction, the result event of the command, so AgentRegistryService attaches the waiver to the release; the other path then finds the evaluation Waived by that approval and changes nothing. A call on an evaluation already Waived by that approval answers 200 with the recorded state and changes nothing. A rejected, expired, stale or cancelled approval leaves the verdict Failed, and a later call raises a new approval request and answers 412. The other answers follow the model: 404 for an evaluation of another tenant or an unknown id (ADR-0015 amendment D113); 403 for a missing scope; 409 only for an evaluation that is not Completed or whose verdict is Passed. The approval is requested through `RequestApproval` of RunControlService with the subject kind evaluation-run and the evaluation id, under the service identity of QualityScoreService with the scope `factory.approvals.request` (D131, D135). The service calls no `Policy.Decide`: the eligibility of the approver is decided by Run Control and the approval policy, and policy-decision-v1 already has the kinds `approval-eligibility` and `publication`. The counter `connectsoft.factory.evaluation.waivers` moves with each recorded waiver. Kind: behavior. Traces: services: QualityScoreService, RunControlService; aggregates: QualityScoreService/EvaluationRun; apis: QualityScoreService/WaiveEvaluation, RunControlService/RunControl.RequestApproval; events: RunControlService/ApprovalDecided, QualityScoreService/EvaluationCompleted; descriptors: approval-request-v1; adrs: ADR-0015, ADR-0021; requirements: FUX-10, XL-08; scenarios: SCN-QualityScoreService-004. Relates: screens: evaluation-runs, approvals-list. Depends on: AIFACTORY-US-1092, feature:run-control-service. Sources: model/services/observability/QualityScoreService.yaml, docs/reference/schemas/approval.schema.json, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given a Completed evaluation with the verdict Failed and an approval of class publication bound to it that `RunControlService/ApprovalDecided` reports Approved, when `ApplyWaiver` handles the decision, then the `QualityScoreService/EvaluationRun` has the verdict Waived with `waiverApprovalId`, the evidence names the reason, the approver and the approval, and the `QualityScoreService/EvaluationCompleted` outbox record with the verdict Waived is written in the same transaction (SCN-QualityScoreService-004, ADR-0021).",
        "AC2: Given a caller with `factory.evaluation.waive` and a Completed evaluation with the verdict Failed, when `QualityScoreService/WaiveEvaluation` is called with a reason, then one approval request with the subject evaluation-run and the evaluation id is raised through `RunControlService/RunControl.RequestApproval` under the service identity of QualityScoreService with `factory.approvals.request` and the answer is 412, and a repeated call while it is pending answers 412 and raises no second approval request; when a later call finds the bound approval Approved, then it records the waiver as AC1 states and answers 200, and a call on an evaluation already Waived by that approval answers 200 with the recorded state and changes nothing; it answers 409 for an evaluation not Completed or whose verdict is Passed, 404 for an evaluation of another tenant or an unknown id and 403 without the scope, each with a problem response and no state change (SCN-QualityScoreService-004, ADR-0015).",
        "AC3: Given an approval for the waiver that `RunControlService/ApprovalDecided` reports Rejected, Expired, Stale or Cancelled, when `ApplyWaiver` handles it, then the verdict stays Failed, nothing is published, a redelivered decision changes nothing and a later call of `QualityScoreService/WaiveEvaluation` raises a new approval request and answers 412; given the waiver already recorded by a call, when the Approved decision arrives, then `ApplyWaiver` changes nothing; given a recorded waiver, then `connectsoft.factory.evaluation.waivers` is incremented once (SCN-QualityScoreService-004, model/services/observability/QualityScoreService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4377",
        "AIFACTORY-TASK-4378"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13307,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "RunControlService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationRun"
        ],
        "apis": [
          "QualityScoreService/WaiveEvaluation",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "RunControlService/ApprovalDecided",
          "QualityScoreService/EvaluationCompleted"
        ],
        "descriptors": [
          "approval-request-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FUX-10",
          "XL-08"
        ],
        "scenarios": [
          "SCN-QualityScoreService-004"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs",
          "approvals-list"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1092",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/reference/schemas/approval.schema.json",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1095]",
      "number": 1095
    },
    {
      "id": "AIFACTORY-TASK-4377",
      "type": "task",
      "parent": "AIFACTORY-US-1095",
      "title": "WaiveEvaluation, the approval request through RunControl.RequestApproval and the ApplyWaiver handler",
      "sequence": "13.06.07.01",
      "description": "WaiveEvaluation, the approval request through RunControl.RequestApproval and the ApplyWaiver handler. Expected output: WaiveEvaluation checks scope, tenant and the state of the evaluation, raises one approval request of class publication with the subject evaluation-run and the evaluation id through RunControl.RequestApproval of RunControlService, under the service identity of QualityScoreService with the scope factory.approvals.request, idempotent on the evaluation id while it is pending, and answers 412 while it is pending; a later call that finds the bound approval Approved, or ApplyWaiver on an Approved ApprovalDecided, whichever comes first, records the verdict Waived with waiverApprovalId and the reason, extends the evidence through ArtifactService and writes EvaluationCompleted with the verdict Waived in one transaction, and the other path changes nothing; a call on an evaluation Waived by that approval answers 200 with the recorded state; 409 only for an evaluation not Completed or Passed; rejected, expired, stale and cancelled decisions and redeliveries leave the verdict, and a later call raises a new request; RunControlService is a fake in the acceptance suite.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "WaiveEvaluation checks scope, tenant and the state of the evaluation, raises one approval request of class publication with the subject evaluation-run and the evaluation id through RunControl.RequestApproval of RunControlService, under the service identity of QualityScoreService with the scope factory.approvals.request, idempotent on the evaluation id while it is pending, and answers 412 while it is pending; a later call that finds the bound approval Approved, or ApplyWaiver on an Approved ApprovalDecided, whichever comes first, records the verdict Waived with waiverApprovalId and the reason, extends the evidence through ArtifactService and writes EvaluationCompleted with the verdict Waived in one transaction, and the other path changes nothing; a call on an evaluation Waived by that approval answers 200 with the recorded state; 409 only for an evaluation not Completed or Passed; rejected, expired, stale and cancelled decisions and redeliveries leave the verdict, and a later call raises a new request; RunControlService is a fake in the acceptance suite."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13307,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4377]",
      "number": 4377
    },
    {
      "id": "AIFACTORY-TASK-4378",
      "type": "task",
      "parent": "AIFACTORY-US-1095",
      "title": "Verify the waiver through the acceptance suite",
      "sequence": "13.06.07.02",
      "description": "Verify the waiver through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-QualityScoreService-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1095: the approved waiver with its evidence and its EvaluationCompleted recorded once by the handler or by a later call, the 412 with one approval request across repeated calls, the 200 on an evaluation already Waived, the 409, 404 and 403, the decisions that leave the verdict and the new request after them, the redelivery and the waiver counter.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-QualityScoreService-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1095: the approved waiver with its evidence and its EvaluationCompleted recorded once by the handler or by a later call, the 412 with one approval request across repeated calls, the 200 on an evaluation already Waived, the 409, 404 and 403, the decisions that leave the verdict and the new request after them, the redelivery and the waiver counter."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13307,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4378]",
      "number": 4378
    },
    {
      "id": "AIFACTORY-US-1096",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Detect when production outcomes of a release drift below its evaluated scores and publish the drift",
      "sequence": "13.06.08",
      "description": "As an asset maintainer, I want to learn when a published release performs worse in production than its evaluation promised, so that I re-evaluate or improve it before the drop spreads, with the metric and both values in hand. The DriftMonitor worker runs on its modelled schedule and compares, per release with an evaluation and with production outcomes in the window, the outcome statistics with the evaluated scores. The outcomes are the records the service has stored since the thin delivery of I1: attempt starts with their release, attempt outcomes recorded by Run Control (handler `CollectOutcome` of `AttemptOutcomeRecorded`) and the reliability signals of model and tool calls. When an observed value of a metric falls below the evaluated value of the last Passed or Waived evaluation of the release by more than `Observability:Evaluation:DriftTolerance` (default 0.05), the worker writes the `DriftDetected` outbox record with `tenantId`, `targetReleaseId`, `metric`, `evaluated` and `observed`; the event belongs to the aggregate `EvaluationRun` and moves no state of it. StudioBff, AlertRuleService and FeedbackService consume it in their own PBIs. The idempotency key of the worker is `targetReleaseId` plus the window, so a repeated trigger for the same window publishes nothing twice; its retry policy is fixed with two attempts, and when both fail the window is checked again at the next trigger and nothing is published for it in between. A release without an evaluation, or without outcomes in the window, is skipped. The work is partitioned by tenant and reads only the records of that tenant. The counter `connectsoft.factory.evaluation.drift` moves with each detection. Kind: behavior. Traces: services: QualityScoreService, RunControlService; aggregates: QualityScoreService/EvaluationRun; events: QualityScoreService/DriftDetected, RunControlService/AttemptOutcomeRecorded; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: NFR-11, XL-08; scenarios: SCN-QualityScoreService-012. Depends on: AIFACTORY-US-1092, feature:quality-score-service-thin, feature:run-control-service. Sources: model/services/observability/QualityScoreService.yaml, docs/planes/trust-operations/evaluation.md.",
      "acceptanceCriteria": [
        "AC1: Given a release with a Passed or Waived evaluation and stored outcomes in the window whose observed value of a metric falls below the evaluated value by more than `Observability:Evaluation:DriftTolerance`, when DriftMonitor runs, then the `QualityScoreService/DriftDetected` outbox record is written with tenant, release, metric, evaluated and observed values, and `connectsoft.factory.evaluation.drift` is incremented (SCN-QualityScoreService-012, model/services/observability/QualityScoreService.yaml).",
        "AC2: Given the same release and window, when DriftMonitor is triggered again, then nothing is published a second time; given a drop within the tolerance, a release without an evaluation or a release without outcomes in the window, then nothing is published; given two tenants, then the worker of one tenant reads only its records (SCN-QualityScoreService-012, ADR-0015).",
        "AC3: Given the record was written, when the dispatcher publishes `QualityScoreService/DriftDetected` on `evaluation.runs.v1.drift-detected`, then it is sent under the canonical envelope with `tenantId`, `targetReleaseId`, `metric`, `evaluated` and `observed`, and an outage is retried so it is neither lost nor duplicated; given both attempts of the worker fail, then nothing is published for that window until the next trigger (SCN-QualityScoreService-012, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/planes/trust-operations/evaluation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-539",
        "AIFACTORY-TASK-4379",
        "AIFACTORY-TASK-4380"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13308,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "RunControlService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationRun"
        ],
        "events": [
          "QualityScoreService/DriftDetected",
          "RunControlService/AttemptOutcomeRecorded"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "NFR-11",
          "XL-08"
        ],
        "scenarios": [
          "SCN-QualityScoreService-012"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1092",
        "feature:quality-score-service-thin",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "docs/planes/trust-operations/evaluation.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1096]",
      "number": 1096
    },
    {
      "id": "AIFACTORY-TASK-539",
      "type": "task",
      "parent": "AIFACTORY-US-1096",
      "title": "Drift monitor over production outcomes",
      "sequence": "13.06.08.01",
      "description": "Drift monitor over production outcomes. Expected output: DriftMonitor compares, per tenant partition and release, the stored outcomes of the window with the evaluated values of the last Passed or Waived evaluation, writes DriftDetected to the outbox above Observability:Evaluation:DriftTolerance, is idempotent on targetReleaseId and window, skips releases without evaluation or outcomes, and increments connectsoft.factory.evaluation.drift.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "DriftMonitor compares, per tenant partition and release, the stored outcomes of the window with the evaluated values of the last Passed or Waived evaluation, writes DriftDetected to the outbox above Observability:Evaluation:DriftTolerance, is idempotent on targetReleaseId and window, skips releases without evaluation or outcomes, and increments connectsoft.factory.evaluation.drift."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13308,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-539]",
      "number": 539
    },
    {
      "id": "AIFACTORY-TASK-4379",
      "type": "task",
      "parent": "AIFACTORY-US-1096",
      "title": "Outcome fixtures over a window for releases with and without drift",
      "sequence": "13.06.08.02",
      "description": "Outcome fixtures over a window for releases with and without drift. Expected output: The acceptance suite holds stored outcome records of two tenants for a release that drifted beyond the tolerance, one within it, one without an evaluation and one without outcomes in the window, and a clock and trigger the test controls.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The acceptance suite holds stored outcome records of two tenants for a release that drifted beyond the tolerance, one within it, one without an evaluation and one without outcomes in the window, and a clock and trigger the test controls."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13308,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4379]",
      "number": 4379
    },
    {
      "id": "AIFACTORY-TASK-4380",
      "type": "task",
      "parent": "AIFACTORY-US-1096",
      "title": "Verify drift detection through the acceptance suite",
      "sequence": "13.06.08.03",
      "description": "Verify drift detection through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-QualityScoreService-012\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1096: the detection with its payload and counter, no repeat for the same window, the skipped releases, the tenant partition, the publication through an outage and the exhausted retry.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-QualityScoreService-012\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1096: the detection with its payload and counter, no repeat for the same window, the skipped releases, the tenant partition, the publication through an outage and the exhausted retry."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13308,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4380]",
      "number": 4380
    },
    {
      "id": "AIFACTORY-US-1097",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Retention rules, deletion orders and legal holds are applied to the evaluation records and accepted events of the service",
      "sequence": "13.06.09",
      "description": "As a workspace admin, I want the retention, deletion and hold orders of my tenant applied to evaluation records and stored outcomes, so that evaluation data is kept as long as the rules say and no longer, except where a legal hold keeps it. QualityScoreService owns its records in `quality-score-sql`: suites, evaluation runs, results and the accepted events stored since the thin delivery. Three consumed events of RetentionResidencyService govern their lifecycle. `RetentionRuleChanged` (handler `ApplyRetentionRule`) applies the effective retention period of the rule to the records of its store class; the model sets seven years for evidence references and two years for results on `EvaluationRuns`, and the evidence record itself stays with ArtifactService. `DeletionOrderIssued` (handler `ExecuteDeletionOrder`) deletes the ordered scope from the stores the service owns and acknowledges its task of the order through `AcknowledgeOrderTask` of RetentionResidencyService, under the scope `factory.data.acknowledge`, once per order id, with a receipt that names the order, the tenant, what was deleted and what a legal hold kept. `LegalHoldChanged` (handler `ApplyLegalHold`) suspends deletion and retention expiry for the held scope, and resumes them when the hold is lifted. Each handler is idempotent on the event id and touches only rows of the tenant of the event; an event without a tenant is refused to the dead-letter path of the inbox and changes nothing. A failed acknowledgement is retried by the inbox and the deletion is not repeated. The thin delivery of I1 applies no retention period, so this PBI is the first to apply the rules of ADR-0019 to the records of the service, those stored since I1 included. Kind: behavior. Traces: services: QualityScoreService, RetentionResidencyService; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/DeletionOrderIssued, RetentionResidencyService/LegalHoldChanged; adrs: ADR-0015, ADR-0019; requirements: NFR-03. Relates: screens: retention-residency. Depends on: feature:retention-residency-service. Sources: model/services/observability/QualityScoreService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given `RetentionResidencyService/RetentionRuleChanged` for the store class of the service, when `ApplyRetentionRule` handles it, then the records of that class older than the effective period are removed by the retention sweep and the records under it are kept; a redelivered event changes nothing (ADR-0019, model/services/observability/QualityScoreService.yaml).",
        "AC2: Given `RetentionResidencyService/DeletionOrderIssued` for a scope of one tenant while `RetentionResidencyService/LegalHoldChanged` holds a part of it, when the handlers run, then the ordered records are deleted except the held ones, no row of another tenant is touched, and the task is acknowledged once through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt naming the order, the tenant, the deleted records and what the hold kept; a failed acknowledgement is retried without a second deletion (ADR-0015, ADR-0019).",
        "AC3: Given a hold is lifted by `RetentionResidencyService/LegalHoldChanged`, when the next retention sweep runs, then expiry resumes for the scope it held; given an event without a tenant, then it is dead-lettered and nothing changes (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4381",
        "AIFACTORY-TASK-4382"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13309,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "RetentionResidencyService"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/DeletionOrderIssued",
          "RetentionResidencyService/LegalHoldChanged"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "NFR-03"
        ]
      },
      "relates": {
        "screens": [
          "retention-residency"
        ]
      },
      "dependsOn": [
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1097]",
      "number": 1097
    },
    {
      "id": "AIFACTORY-TASK-4381",
      "type": "task",
      "parent": "AIFACTORY-US-1097",
      "title": "Handlers ApplyRetentionRule, ExecuteDeletionOrder and ApplyLegalHold over quality-score-sql",
      "sequence": "13.06.09.01",
      "description": "Handlers ApplyRetentionRule, ExecuteDeletionOrder and ApplyLegalHold over quality-score-sql. Expected output: The three handlers apply the effective retention to the records of the store class, delete the ordered scope except held records and acknowledge the order task once through AcknowledgeOrderTask with its receipt, suspend and resume expiry for a held scope, are idempotent on the event id, touch only rows of the tenant of the event and dead-letter an event without a tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The three handlers apply the effective retention to the records of the store class, delete the ordered scope except held records and acknowledge the order task once through AcknowledgeOrderTask with its receipt, suspend and resume expiry for a held scope, are idempotent on the event id, touch only rows of the tenant of the event and dead-letter an event without a tenant."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13309,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4381]",
      "number": 4381
    },
    {
      "id": "AIFACTORY-TASK-4382",
      "type": "task",
      "parent": "AIFACTORY-US-1097",
      "title": "Verify retention, deletion and hold through the acceptance suite",
      "sequence": "13.06.09.02",
      "description": "Verify retention, deletion and hold through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RetentionOrders\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1097 with a fake RetentionResidencyService/AcknowledgeOrderTask endpoint: the sweep under a rule, the deletion under a hold with its receipt, the retried acknowledgement, the lifted hold and the event without a tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RetentionOrders\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1097 with a fake RetentionResidencyService/AcknowledgeOrderTask endpoint: the sweep under a rule, the deletion under a hold with its receipt, the retried acknowledgement, the lifted hold and the event without a tenant."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13309,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4382]",
      "number": 4382
    },
    {
      "id": "AIFACTORY-US-1109",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-070",
      "title": "Evaluate a model deployment against its capability suite by invoking the deployment directly, and degrade while the router is unavailable",
      "sequence": "13.06.10",
      "description": "As a platform admin, I want a model deployment evaluated against its capability suite before I approve it, with a score per capability, so that a profile routes only to deployments whose tool calling, structured output and other capabilities were measured. A Platform admin asks ModelRouterService to evaluate a deployment through `EvaluateDeployment`, and ModelRouterService starts the evaluation through the internal gRPC method `Evaluation.RunSuite` with its workload identity, as AIFACTORY-US-1091 describes for every internal start. The suite of a deployment is an active suite whose target is Model, so the evaluation is of kind capability-suite and keeps that kind on the run. Unlike the tasks of the other kinds, which run as sandbox-class Factory runs under the evaluation project, the tasks of a capability suite invoke the deployment under evaluation directly through ModelRouterService, the outbound dependency the model lists as required with the failure mode degrade: SuiteRunner calls `ModelGateway.Invoke` of ModelRouterService once per task of the dataset snapshot, keyed by `evaluationId` plus `taskId` as for every task, and scores each answer against the capability metrics of the suite, with the seeds of `Observability:Evaluation:DefaultThresholds` where the suite sets no threshold (D32). A capability call belongs to no run, so it presents no attempt token: the attempt token of a lease is the proof only for a call that belongs to a run (ADR-0015 amendment D125). Its receipt names no run and no attempt and names the evaluation project `Observability:Evaluation:EvaluationProjectId` as its project. Which token a direct suite call presents to the model gateway is an open point reported with this feature; the call is made behind a model port whose credential the owner chooses, and the port is a fake in the acceptance suite. When every task has a result, the verdict, the evidence record and the `EvaluationCompleted` outbox record with the kind capability-suite follow AIFACTORY-US-1092, and ModelRouterService imports the evidence through its handler `ImportCapabilityEvidence` in its own PBIs. A call that the deployment answers with a failed or denied outcome is a scored result of the task, not an infrastructure failure. Degrade: while ModelRouterService is unavailable, a Queued capability-suite evaluation is not started and stays Queued, SuiteRunner tries it again at its next trigger, and evaluations of the other kinds, the reads and the release gate keep serving; a Running capability-suite evaluation whose calls still fail after the third attempt of the retry policy ends Failed with the reason of the last failure, as AIFACTORY-US-1093 states. No score is ever computed for a call that did not return. Kind: behavior. Traces: services: QualityScoreService, ModelRouterService; aggregates: QualityScoreService/EvaluationRun; apis: QualityScoreService/Evaluation.RunSuite, QualityScoreService/GetEvaluation, ModelRouterService/EvaluateDeployment, ModelRouterService/ModelGateway.Invoke; events: QualityScoreService/EvaluationCompleted, QualityScoreService/EvaluationFailed; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FR-04, NFR-11. Depends on: AIFACTORY-US-1091, AIFACTORY-US-1092, AIFACTORY-US-1093, feature:model-router-service. Sources: model/services/observability/QualityScoreService.yaml, model/services/model-compute/ModelRouterService.yaml, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given an evaluation started through `QualityScoreService/Evaluation.RunSuite` for an active suite whose target is Model, when SuiteRunner runs it, then the run keeps the kind capability-suite and each task invokes the deployment once through `ModelRouterService/ModelGateway.Invoke`, outside a run and without an attempt token, keyed by evaluation and task, and a duplicate trigger invokes nothing twice (model/services/observability/QualityScoreService.yaml, ADR-0015).",
        "AC2: Given every task of a capability suite scored, including tasks the deployment answered with a failed or denied outcome, when the verdict is computed, then the evidence record is stored once and the `QualityScoreService/EvaluationCompleted` outbox record carries the verdict, the evidence reference and the kind capability-suite in the transaction that completes the run (ADR-0021, model/services/observability/QualityScoreService.yaml).",
        "AC3: Given ModelRouterService unavailable, when SuiteRunner picks up a Queued capability-suite evaluation, then it stays Queued with no task invoked and no event, and an evaluation of another kind and `QualityScoreService/GetEvaluation` keep serving; given a Running capability-suite evaluation whose calls fail after the third attempt, then it is Failed with the reason and the `QualityScoreService/EvaluationFailed` record, and no score exists for a call that did not return (ADR-0012, model/services/observability/QualityScoreService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4407",
        "AIFACTORY-TASK-4408",
        "AIFACTORY-TASK-4409"
      ],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13310,
      "kind": "behavior",
      "traces": {
        "services": [
          "QualityScoreService",
          "ModelRouterService"
        ],
        "aggregates": [
          "QualityScoreService/EvaluationRun"
        ],
        "apis": [
          "QualityScoreService/Evaluation.RunSuite",
          "QualityScoreService/GetEvaluation",
          "ModelRouterService/EvaluateDeployment",
          "ModelRouterService/ModelGateway.Invoke"
        ],
        "events": [
          "QualityScoreService/EvaluationCompleted",
          "QualityScoreService/EvaluationFailed"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-04",
          "NFR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1091",
        "AIFACTORY-US-1092",
        "AIFACTORY-US-1093",
        "feature:model-router-service"
      ],
      "source": [
        "model/services/observability/QualityScoreService.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1109]",
      "number": 1109
    },
    {
      "id": "AIFACTORY-TASK-4407",
      "type": "task",
      "parent": "AIFACTORY-US-1109",
      "title": "Capability-suite tasks of SuiteRunner through the model port with the degrade branch",
      "sequence": "13.06.10.01",
      "description": "Capability-suite tasks of SuiteRunner through the model port with the degrade branch. Expected output: For an evaluation of kind capability-suite, SuiteRunner invokes the deployment once per task through a model port bound to ModelGateway.Invoke of ModelRouterService, outside a run and without an attempt token, keyed by evaluationId and taskId, scores each answer, failed and denied outcomes included, against the capability metrics of the suite, leaves a Queued evaluation Queued while ModelRouterService is unavailable and tries it at the next trigger, and fails a Running evaluation after the third failed attempt; the credential of the port is configuration until the owner decides it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "For an evaluation of kind capability-suite, SuiteRunner invokes the deployment once per task through a model port bound to ModelGateway.Invoke of ModelRouterService, outside a run and without an attempt token, keyed by evaluationId and taskId, scores each answer, failed and denied outcomes included, against the capability metrics of the suite, leaves a Queued evaluation Queued while ModelRouterService is unavailable and tries it at the next trigger, and fails a Running evaluation after the third failed attempt; the credential of the port is configuration until the owner decides it."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13310,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4407]",
      "number": 4407
    },
    {
      "id": "AIFACTORY-TASK-4408",
      "type": "task",
      "parent": "AIFACTORY-US-1109",
      "title": "Capability suite fixtures and a fake model gateway",
      "sequence": "13.06.10.02",
      "description": "Capability suite fixtures and a fake model gateway. Expected output: The acceptance suite holds an active suite with the target Model and its dataset snapshot, a fake of the model port that answers completed, failed and denied outcomes, can be made unavailable and records whether an attempt token was presented, and a trigger the test controls.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "The acceptance suite holds an active suite with the target Model and its dataset snapshot, a fake of the model port that answers completed, failed and denied outcomes, can be made unavailable and records whether an attempt token was presented, and a trigger the test controls."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13310,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4408]",
      "number": 4408
    },
    {
      "id": "AIFACTORY-TASK-4409",
      "type": "task",
      "parent": "AIFACTORY-US-1109",
      "title": "Verify the capability-suite evaluation through the acceptance suite",
      "sequence": "13.06.10.03",
      "description": "Verify the capability-suite evaluation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=CapabilitySuite\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1109 for QualityScoreService/Evaluation.RunSuite and ModelRouterService/ModelGateway.Invoke: one call per task without an attempt token, the kind capability-suite on QualityScoreService/EvaluationCompleted, the Queued evaluation kept while the router is unavailable with other evaluations serving, and the Failed run after the third attempt.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=CapabilitySuite\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1109 for QualityScoreService/Evaluation.RunSuite and ModelRouterService/ModelGateway.Invoke: one call per task without an attempt token, the kind capability-suite on QualityScoreService/EvaluationCompleted, the Queued evaluation kept while the router is unavailable with other evaluations serving, and the Failed run after the third attempt."
      ],
      "sourceArtifacts": [
        "model/services/observability/QualityScoreService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 133,
      "phase": "factory",
      "stackRank": 13310,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4409]",
      "number": 4409
    },
    {
      "id": "AIFACTORY-FEAT-071",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-013",
      "title": "SloService: complete delivery",
      "sequence": "13.07",
      "description": "SloService is the service of bounded context BC-21 (Operations). SLO definitions per tenant, workflow, agent and platform (success rate, latency, cost per task, availability, human intervention), their measurements and error budgets, and the service health rollup from every host's probes; breaches feed alert rules and the fleet (BC-21, D30). Its own repository is ConnectSoft.AI.SoftwareFactory.SloService. Delivers: SloService (complete). Increment I4: Trust and accountability. Build order 134 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-044",
        "AIFACTORY-US-1129",
        "AIFACTORY-US-1130",
        "AIFACTORY-US-1131",
        "AIFACTORY-US-1132"
      ],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13400,
      "titlePrefix": "[AIFACTORY-FEAT-071]",
      "number": 71
    },
    {
      "id": "AIFACTORY-US-044",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-071",
      "title": "A breached objective raises one alert that I can acknowledge",
      "sequence": "13.07.01",
      "description": "As an operator, I want objectives for the Factory and an alert when one is breached, so that I learn of a problem from the Factory and not from a user. This is the integration PBI of the feature and the end-to-end proof that a breach reaches an operator. SloService is the service of bounded context BC-21 (Operations) that turns the NFR baseline of ADR-0018 (D30) and the operations metrics into objectives with targets, windows, burn thresholds and error budgets, for the platform, a tenant, a project, a workflow, an agent or a generated product, and keeps the health rollup of every host. It owns `SloDefinition` with its `SloMeasurement` rows and `ServiceHealth` in `slo-sql`. Callers reach its three REST operations through the route GW-03 of the gateway ObservabilityHost, which forwards the user token (D117), under `factory.operations.read` and `factory.operations.admin`; every query runs under the tenant row filter (ADR-0015). The behaviour is delivered by the behaviour PBIs of this feature: objectives are set and listed (AIFACTORY-US-1129), evaluated into breaches and recoveries (AIFACTORY-US-1130), the health of every host is rolled up (AIFACTORY-US-1131) and the retention and deletion orders are applied (AIFACTORY-US-1132). This PBI proves the chain with feature `alert-rule-service`: an objective defined through `SetSlo` publishes `SloDefined` and its measurement starts, as `ListSlos` shows; the Workspace admin sets an active tenant rule of source kind Slo through `SetAlertRule`, since Slo is not among the platform rules that are always on; a breach publishes `SloBreached`, which AlertRuleService turns into exactly one alert under that rule however often the breach is observed; the operator acknowledges the alert through `AcknowledgeAlert` and it stays acknowledged; and the recovery publishes `SloRecovered`, which resolves the alert. Of the nine consumed events of the model, `IncidentResolved` of FleetIncidentService and `ProductOnboarded` and `ProductObjectiveDefined` of FleetInventoryService come from producers of I7; this feature registers no handler for them, and which feature registers them is reported to the owner. Telemetry follows the conventions of feature `component-observability-factory-conventions`, taken by the version pin of its packages and never forked. Repository: ConnectSoft.AI.SoftwareFactory.SloService, created by the repository checklist of feature `repository-and-pipeline-conventions` from the base template with the Factory profile. Kind: behavior. Traces: services: SloService, AlertRuleService, ObservabilityHost; aggregates: SloService/SloDefinition, AlertRuleService/AlertRule, AlertRuleService/AlertInstance; apis: SloService/ListSlos, SloService/SetSlo, AlertRuleService/ListAlerts, AlertRuleService/AcknowledgeAlert, AlertRuleService/SetAlertRule; events: SloService/SloDefined, SloService/SloBreached, SloService/SloRecovered, AlertRuleService/AlertFired, AlertRuleService/AlertResolved; adrs: ADR-0015, ADR-0018, ADR-0028; requirements: FR-10, FUX-04, XL-11, XL-16. Relates: screens: status-objectives, alerts; nfrs: NFR-06, NFR-07, NFR-17, NFR-18. Depends on: AIFACTORY-US-1129, AIFACTORY-US-1130, AIFACTORY-US-1131, AIFACTORY-US-1132, feature:alert-rule-service, feature:observability-host, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/observability/SloService.yaml, model/services/observability/AlertRuleService.yaml, model/scenarios/SloService.yaml, docs/planes/trust-operations/observability/services/slo-service/index.md#purpose-and-responsibilities, docs/architecture/adr/0018-nfr-baseline.md.",
      "acceptanceCriteria": [
        "AC1: Given an objective for the availability of a project, when it is defined through `SloService/SetSlo`, then `SloService/SloDefined` is published and the `SloService/SloDefinition` is measured from the next evaluation on, as `SloService/ListSlos` shows with its first measurement (model/services/observability/SloService.yaml).",
        "AC2: Given an active tenant rule of source kind Slo set through `AlertRuleService/SetAlertRule` and the measurement breaches the objective, when the evaluator runs, then `SloService/SloBreached` is published and AlertRuleService fires one `AlertRuleService/AlertInstance` with `AlertRuleService/AlertFired`, however often the breach is observed in later evaluations (ADR-0018).",
        "AC3: Given the fired alert, when the operator acknowledges it through `AlertRuleService/AcknowledgeAlert`, then it stays Acknowledged in `AlertRuleService/ListAlerts` until it resolves, and a further breach of the same objective fires no second alert (FR-10).",
        "AC4: Given the measurement recovers, when the evaluator runs, then `SloService/SloRecovered` is published and the alert is resolved with `AlertRuleService/AlertResolved` (FUX-04).",
        "AC5: Given the repository ConnectSoft.AI.SoftwareFactory.SloService, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SloService --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 tests pass, a container image is published, each of the seven scenarios of SloService has a passing test that names its id, and the telemetry conformance test passes with the four metrics of model/services/observability/SloService.yaml (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml",
        "model/services/observability/AlertRuleService.yaml",
        "model/scenarios/SloService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-774",
        "AIFACTORY-TASK-500",
        "AIFACTORY-TASK-501",
        "AIFACTORY-TASK-502",
        "AIFACTORY-TASK-503",
        "AIFACTORY-TASK-504",
        "AIFACTORY-TASK-505",
        "AIFACTORY-TASK-506"
      ],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "behavior",
      "traces": {
        "services": [
          "SloService",
          "AlertRuleService",
          "ObservabilityHost"
        ],
        "aggregates": [
          "SloService/SloDefinition",
          "AlertRuleService/AlertRule",
          "AlertRuleService/AlertInstance"
        ],
        "apis": [
          "SloService/ListSlos",
          "SloService/SetSlo",
          "AlertRuleService/ListAlerts",
          "AlertRuleService/AcknowledgeAlert",
          "AlertRuleService/SetAlertRule"
        ],
        "events": [
          "SloService/SloDefined",
          "SloService/SloBreached",
          "SloService/SloRecovered",
          "AlertRuleService/AlertFired",
          "AlertRuleService/AlertResolved"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "FUX-04",
          "XL-11",
          "XL-16"
        ]
      },
      "relates": {
        "screens": [
          "status-objectives",
          "alerts"
        ],
        "nfrs": [
          "NFR-06",
          "NFR-07",
          "NFR-17",
          "NFR-18"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1129",
        "AIFACTORY-US-1130",
        "AIFACTORY-US-1131",
        "AIFACTORY-US-1132",
        "feature:alert-rule-service",
        "feature:observability-host",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/observability/SloService.yaml",
        "model/services/observability/AlertRuleService.yaml",
        "model/scenarios/SloService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "titlePrefix": "[AIFACTORY-US-044]",
      "number": 44
    },
    {
      "id": "AIFACTORY-TASK-774",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "Verify slo-breach-raises-alert by running the declared command",
      "sequence": "13.07.01.01",
      "description": "Verify slo-breach-raises-alert by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-SloService\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.SloService and the end-to-end suite of AC1 to AC4 against SloService and AlertRuleService on one messaging transport; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-044, with a test for each of SCN-SloService-001 to SCN-SloService-007.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-SloService\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.SloService and the end-to-end suite of AC1 to AC4 against SloService and AlertRuleService on one messaging transport; a filter that discovers no test counts as a failure; they pass and prove AC1 to AC5 of AIFACTORY-US-044, with a test for each of SCN-SloService-001 to SCN-SloService-007."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-774]",
      "number": 774
    },
    {
      "id": "AIFACTORY-TASK-500",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.SloService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "13.07.01.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.SloService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SloService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `slo`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SloService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SloService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `slo`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-500]",
      "number": 500
    },
    {
      "id": "AIFACTORY-TASK-501",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "Domain model: SloDefinition, ServiceHealth",
      "sequence": "13.07.01.03",
      "description": "Domain model: SloDefinition, ServiceHealth. Expected output: The aggregates hold the fields and invariants of the model: a platform objective cannot be loosened per tenant, a measurement is computed and never entered, error budget consumption is monotonic within the window, and health is observed and never declared; the transitions of SloState that docs/planes/trust-operations/observability/services/slo-service/index.md draws are unit-tested one by one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates hold the fields and invariants of the model: a platform objective cannot be loosened per tenant, a measurement is computed and never entered, error budget consumption is monotonic within the window, and health is observed and never declared; the transitions of SloState that docs/planes/trust-operations/observability/services/slo-service/index.md draws are unit-tested one by one."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-501]",
      "number": 501
    },
    {
      "id": "AIFACTORY-TASK-502",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "Persistence in slo-sql: SloDefinitions, SloMeasurements, ServiceHealth",
      "sequence": "13.07.01.04",
      "description": "Persistence in slo-sql: SloDefinitions, SloMeasurements, ServiceHealth. Expected output: Mappings and migrations for the three modelled tables with the tenant filter and the unique index of an objective per tenant, subject kind, subject and kind; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the three modelled tables with the tenant filter and the unique index of an objective per tenant, subject kind, subject and kind; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-502]",
      "number": 502
    },
    {
      "id": "AIFACTORY-TASK-503",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "API hosting skeleton: the 3 REST operations with scope enforcement and problem responses",
      "sequence": "13.07.01.05",
      "description": "API hosting skeleton: the 3 REST operations with scope enforcement and problem responses. Expected output: ListSlos, SetSlo and ListServiceHealth are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, problem responses for every modelled refusal code and the OpenAPI document; the behaviour of each operation is delivered by AIFACTORY-US-1129 and AIFACTORY-US-1131, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ListSlos, SetSlo and ListServiceHealth are hosted with JWT validation of the token the gateway forwards, scope enforcement per route, problem responses for every modelled refusal code and the OpenAPI document; the behaviour of each operation is delivered by AIFACTORY-US-1129 and AIFACTORY-US-1131, not here."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-503]",
      "number": 503
    },
    {
      "id": "AIFACTORY-TASK-504",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "Messaging skeleton: outbox and inbox of the slo profile for 4 published and 6 consumed events",
      "sequence": "13.07.01.06",
      "description": "Messaging skeleton: outbox and inbox of the slo profile for 4 published and 6 consumed events. Expected output: The outbox writer enlists in the transaction of each change and the dispatcher publishes SloDefined, SloBreached, SloRecovered and ServiceHealthChanged under the canonical envelope; the inbox registers OperationsDigestProduced, WorkerPoolStateChanged, ObservedStateChanged and the three orders of RetentionResidencyService with idempotency on the event id; IncidentResolved, ProductOnboarded and ProductObjectiveDefined are not registered; what each handler does is delivered by the behaviour PBIs of this feature.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of each change and the dispatcher publishes SloDefined, SloBreached, SloRecovered and ServiceHealthChanged under the canonical envelope; the inbox registers OperationsDigestProduced, WorkerPoolStateChanged, ObservedStateChanged and the three orders of RetentionResidencyService with idempotency on the event id; IncidentResolved, ProductOnboarded and ProductObjectiveDefined are not registered; what each handler does is delivered by the behaviour PBIs of this feature."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-504]",
      "number": 504
    },
    {
      "id": "AIFACTORY-TASK-505",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "Worker hosting skeleton: triggers, partitioning and retry policies of SloEvaluator and HealthCollector",
      "sequence": "13.07.01.07",
      "description": "Worker hosting skeleton: triggers, partitioning and retry policies of SloEvaluator and HealthCollector. Expected output: The two workers are hosted with their modelled schedules (every five minutes, every minute), retry policies, partitioning (by tenant, by host) and idempotency keys (sloId plus the five-minute evaluation slot, read from the modelled sloId plus window, and hostId plus minute), and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1130 and AIFACTORY-US-1131.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two workers are hosted with their modelled schedules (every five minutes, every minute), retry policies, partitioning (by tenant, by host) and idempotency keys (sloId plus the five-minute evaluation slot, read from the modelled sloId plus window, and hostId plus minute), and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-1130 and AIFACTORY-US-1131."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-505]",
      "number": 505
    },
    {
      "id": "AIFACTORY-TASK-506",
      "type": "task",
      "parent": "AIFACTORY-US-044",
      "title": "Security, tenancy and telemetry of SloService",
      "sequence": "13.07.01.08",
      "description": "Security, tenancy and telemetry of SloService. Expected output: The two scopes and four roles of the model are enforced, every query is tenant-filtered, 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 four modelled metrics through its instrument helper, among them the gauge connectsoft.factory.slo.inbox_lag, the age in seconds of the oldest unprocessed inbox message of the service, measured by the inbox of the messaging profile (D140), and references the conformance test package from its architecture tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two scopes and four roles of the model are enforced, every query is tenant-filtered, 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 four modelled metrics through its instrument helper, among them the gauge connectsoft.factory.slo.inbox_lag, the age in seconds of the oldest unprocessed inbox message of the service, measured by the inbox of the messaging profile (D140), and references the conformance test package from its architecture tests."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-506]",
      "number": 506
    },
    {
      "id": "AIFACTORY-US-1129",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-071",
      "title": "Define or tighten an objective for a subject and list the objectives in scope with their state and error budget",
      "sequence": "13.07.02",
      "description": "As an operator, I want to set objectives for my tenant, projects, workflows and agents, never looser than the platform baseline, and see each with its current state and budget, so that the Factory is held to targets I chose and I see at once which objective is at risk. An Operator or a Platform admin whose scope carries `factory.operations.admin` defines or changes an objective of the trusted tenant through `SloService/SetSlo`, a PUT on `/factory/slos/{subjectKind}/{subjectId}/{kind}`, where the subject kind is platform, tenant, project, workflow, agent or product and the kind is one of `ObjectiveKind`. The body carries the target, the window, a rolling 30 days or the calendar month, the fast and slow burn thresholds and the source, a metric name or the projection. The objective is unique per tenant, subject kind, subject and kind, so a PUT never reaches an objective of another tenant. A new objective is written active, a known one is changed, and either writes `SloDefined` with `sloId`, `tenantId`, `subjectKind`, `subjectId`, `kind` and `target` in the same transaction and answers 200; the measurement starts with the next evaluation. Platform objectives are the NFR baseline of `Observability:Slo:PlatformBaseline` (D30) and a tenant objective may only be stricter: a target looser than the baseline of its kind, such as an availability below 0.995 or an interactive latency above 2 seconds at p95, is refused with 409 and a problem response that names the baseline value, and nothing is written. The operation is naturally idempotent: a repeat of the same body changes nothing and publishes nothing. A caller without the scope is refused with 403, and so is a caller with the scope but without the Platform admin role who addresses the subject kind platform, because the platform objectives are the baseline of `Observability:Slo:PlatformBaseline` that belongs to the Platform admin. SloService has no lookup of projects, workflows, agents or products, and `SetSlo` lists only 200, 403 and 409, so it cannot tell an unknown subject from a subject of another tenant. Until the owner decides how the subject is verified and whether it is answered 404, a subject id that names nothing of the trusted tenant is written as an objective of the trusted tenant: every measurement reads only data of the trusted tenant, so such an objective reads and changes nothing of another tenant and gets no measurement while no data of that subject exists in the tenant, and the subject kind tenant accepts only the id of the trusted tenant as its subject, refused with 403 otherwise. A caller whose scope carries `factory.operations.read` lists the objectives of the trusted tenant through `SloService/ListSlos`, each with its target and window and with the state, the value, the remaining error budget and the burn rate of its latest measurement, read under the tenant row filter; nothing is written. StudioBff and AuditService consume `SloDefined` in their own PBIs. Kind: behavior. Traces: services: SloService; aggregates: SloService/SloDefinition; apis: SloService/SetSlo, SloService/ListSlos; events: SloService/SloDefined; adrs: ADR-0012, ADR-0015, ADR-0018; requirements: FR-10, FUX-04; scenarios: SCN-SloService-001, SCN-SloService-002, SCN-SloService-004. Relates: screens: status-objectives; nfrs: NFR-06. Sources: model/services/observability/SloService.yaml, docs/planes/trust-operations/observability/services/slo-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.operations.admin` and an availability target of 0.999 for a project of the trusted tenant, when `SloService/SetSlo` is called, then the response is 200, one active `SloService/SloDefinition` exists for the tenant, subject and kind with the target, window, burn thresholds and source of the body, and the `SloService/SloDefined` outbox record is written in the same transaction; a repeat of the same body changes nothing and writes no record, and a tighter target changes the row and writes a second record (SCN-SloService-002).",
        "AC2: Given an availability target of 0.99, below the platform baseline of 0.995, or an interactive latency target above 2 seconds, when `SloService/SetSlo` is called, then the response is 409 with a problem response that names the baseline value and nothing is written or published; a caller without `factory.operations.admin` is refused with 403 and no state changes (SCN-SloService-002, ADR-0018).",
        "AC3: Given objectives of two tenants with measurements, when `SloService/ListSlos` is called with `factory.operations.read`, then the response is 200 with the objectives of the trusted tenant only, each with target, window and the state, value, remaining error budget and burn rate of its latest measurement, and nothing is written; a caller without the scope is refused with 403 (SCN-SloService-001, ADR-0015).",
        "AC4: Given an objective was defined or changed, when the outbox dispatcher publishes `SloService/SloDefined` on `operations.slos.v1.slo-defined`, then the event is sent under the canonical envelope with `sloId`, `tenantId`, `subjectKind`, `subjectId`, `kind` and `target`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SloService-004, ADR-0012).",
        "AC5: Given an Operator with `factory.operations.admin` but without the Platform admin role, when `SloService/SetSlo` addresses the subject kind platform, or the subject kind tenant with the id of another tenant, then the response is 403 with a problem response and nothing is written or published, while a Platform admin is accepted on the subject kind platform; given a project id that names no project of the trusted tenant, then the objective is written under the trusted tenant only, no row of another tenant is read or changed, and no measurement is written for it while the tenant holds no data of that subject (SCN-SloService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4501",
        "AIFACTORY-TASK-4502"
      ],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13402,
      "kind": "behavior",
      "traces": {
        "services": [
          "SloService"
        ],
        "aggregates": [
          "SloService/SloDefinition"
        ],
        "apis": [
          "SloService/SetSlo",
          "SloService/ListSlos"
        ],
        "events": [
          "SloService/SloDefined"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0018"
        ],
        "requirements": [
          "FR-10",
          "FUX-04"
        ],
        "scenarios": [
          "SCN-SloService-001",
          "SCN-SloService-002",
          "SCN-SloService-004"
        ]
      },
      "relates": {
        "screens": [
          "status-objectives"
        ],
        "nfrs": [
          "NFR-06"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/observability/SloService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1129]",
      "number": 1129
    },
    {
      "id": "AIFACTORY-TASK-4501",
      "type": "task",
      "parent": "AIFACTORY-US-1129",
      "title": "SetSlo with the tightening-only rule and ListSlos with the latest measurement",
      "sequence": "13.07.02.01",
      "description": "SetSlo with the tightening-only rule and ListSlos with the latest measurement. Expected output: SetSlo writes or changes the objective of the trusted tenant addressed by the path with its SloDefined outbox record in one transaction, refuses a target looser than the platform baseline of its kind with 409 and a problem response that names the baseline value, changes and publishes nothing on a repeat, answers 403 without the scope, 403 for the subject kind platform without the Platform admin role and 403 for the subject kind tenant with an id other than the trusted tenant, and writes an objective for an unverified project, workflow, agent or product id under the trusted tenant only; ListSlos returns the objectives of the tenant with the state, value, remaining budget and burn rate of the latest measurement.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "SetSlo writes or changes the objective of the trusted tenant addressed by the path with its SloDefined outbox record in one transaction, refuses a target looser than the platform baseline of its kind with 409 and a problem response that names the baseline value, changes and publishes nothing on a repeat, answers 403 without the scope, 403 for the subject kind platform without the Platform admin role and 403 for the subject kind tenant with an id other than the trusted tenant, and writes an objective for an unverified project, workflow, agent or product id under the trusted tenant only; ListSlos returns the objectives of the tenant with the state, value, remaining budget and burn rate of the latest measurement."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4501]",
      "number": 4501
    },
    {
      "id": "AIFACTORY-TASK-4502",
      "type": "task",
      "parent": "AIFACTORY-US-1129",
      "title": "Verify objectives-set-and-listed through the acceptance suite",
      "sequence": "13.07.02.02",
      "description": "Verify objectives-set-and-listed through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SloService-001|Scenario=SCN-SloService-002|Scenario=SCN-SloService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1129 over a two-tenant fixture, including the 409 below the baseline, the 403 on the subject kind platform for an Operator, the objective for a foreign project id that reads nothing of the other tenant, the repeat that publishes nothing and the payload of SloDefined; consumer handling is proven by the suites of StudioBff and AuditService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SloService-001|Scenario=SCN-SloService-002|Scenario=SCN-SloService-004)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1129 over a two-tenant fixture, including the 409 below the baseline, the 403 on the subject kind platform for an Operator, the objective for a foreign project id that reads nothing of the other tenant, the repeat that publishes nothing and the payload of SloDefined; consumer handling is proven by the suites of StudioBff and AuditService."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4502]",
      "number": 4502
    },
    {
      "id": "AIFACTORY-US-1130",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-071",
      "title": "Evaluate every active objective, keep its error budget and announce a breach, a fast burn and a recovery once",
      "sequence": "13.07.03",
      "description": "As an operator, I want every objective measured on a schedule with its error budget and burn rate, so that a breach or a fast burn is announced once, early enough to act, and its recovery closes it. The `SloEvaluator` worker runs every five minutes, partitioned by tenant with at most two in parallel, and evaluates every active objective: an objective sourced from the projection takes its value from the overview digests of DashboardService, which the handler `EvaluateSlos` follows through `OperationsDigestProduced`, and an objective sourced from a metric queries the telemetry backend (`ext-otel-backend`, sync HTTP, required, degrade). Each evaluation writes one `SloMeasurement` with `measuredAt`, the value, the remaining error budget, the burn rate and the state; a measurement is computed and never entered, and error budget consumption is monotonic within the window. The state follows the transitions of docs/planes/trust-operations/observability/services/slo-service/index.md: Meeting to BurningFast when the burn rate exceeds the fast threshold, BurningFast to Breached when the budget is exhausted, Meeting to Breached when the value misses the target at the end of the window, Breached to Recovered when the value meets the target again, BurningFast back to Meeting when the burn rate is normal, Recovered to Meeting with the next window, and Meeting to Suspended and back when the source is unavailable and returns. Entering BurningFast or Breached writes `SloBreached` with `sloId`, `tenantId`, `subjectKind`, `subjectId`, `kind`, `value` and `state` in the transaction of the measurement; leaving them for Recovered or Meeting writes `SloRecovered` with `sloId`, `tenantId` and `kind`; an evaluation that keeps the state publishes nothing. The worker is idempotent on the modelled key `sloId + window`, and the window of that key is read as the five-minute evaluation slot of the schedule, not the objective window of 30 days: one measurement is written per objective per slot, a duplicate trigger in the same slot writes nothing, and the next slot writes the next measurement; the reading is reported to the owner. When the telemetry backend fails, the objectives sourced from metrics that are in Meeting go Suspended with a note and those sourced from the projection continue, which is the modelled failure mode; an objective sourced from a metric that is in BurningFast or Breached keeps its state, gets no measurement and publishes nothing while the backend fails, because the drawn transitions lead into Suspended from Meeting only, which is reported to the owner. A failed pass is attempted three times in all with the modelled fixed backoff of 60 seconds. The digest carries only `tenantId`, `window` and `computedAt`, and the model gives SloService no read of the overviews of DashboardService, so where the projection-sourced values are read is reported to the owner and this PBI reads them through a projection source port that the acceptance suite binds to a fake. `connectsoft.factory.slo.state` and `connectsoft.factory.slo.error_budget_remaining` follow every measurement. AlertRuleService and StudioBff consume `SloBreached` and `SloRecovered` in their own PBIs, and FleetInventoryService and FleetRolloutService in I7; DashboardService declares the handler `ProjectSloDefinition` for `SloBreached`, which feature `dashboard-service` does not register while the owner decides the projections the model does not hold. Kind: behavior. Traces: services: SloService, DashboardService; aggregates: SloService/SloDefinition; events: SloService/SloBreached, SloService/SloRecovered, DashboardService/OperationsDigestProduced; adrs: ADR-0012, ADR-0018; requirements: FR-10, XL-11; scenarios: SCN-SloService-005, SCN-SloService-006. Relates: screens: status-objectives; nfrs: NFR-06, NFR-07. Depends on: AIFACTORY-US-1129, feature:dashboard-service. Sources: model/services/observability/SloService.yaml, docs/planes/trust-operations/observability/services/slo-service/index.md#sagas-and-long-running-flows, docs/architecture/adr/0018-nfr-baseline.md.",
      "acceptanceCriteria": [
        "AC1: Given an active objective sourced from the projection whose burn rate rises above the fast threshold after `DashboardService/OperationsDigestProduced`, when the `SloEvaluator` runs, then a `SloMeasurement` in state BurningFast is written for the `SloService/SloDefinition` with value, remaining budget and burn rate, and the `SloService/SloBreached` outbox record with `state` BurningFast is written in the same transaction; a run in the next five-minute slot that keeps the state writes its own measurement and publishes nothing, and a duplicate trigger in the same slot writes no second measurement and publishes nothing (SCN-SloService-005).",
        "AC2: Given that objective exhausts its budget and later meets its target again, when the `SloEvaluator` runs, then it moves to Breached with a second `SloService/SloBreached` whose `state` is Breached, then to Recovered with `SloService/SloRecovered`, and to Meeting with the next window; the remaining budget never grows within a window (SCN-SloService-006, ADR-0018).",
        "AC3: Given the fake telemetry backend fails, when the `SloEvaluator` runs, then every objective sourced from a metric that is in Meeting goes Suspended with a note and no breach or recovery is published for it, an objective sourced from a metric that is in BurningFast keeps its state without a measurement, the objectives sourced from the projection are evaluated as before, and once the backend answers the suspended objectives return to Meeting (model/services/observability/SloService.yaml).",
        "AC4: Given a breach or a recovery, when the outbox dispatcher publishes `SloService/SloBreached` on `operations.slos.v1.slo-breached` or `SloService/SloRecovered` on `operations.slos.v1.slo-recovered`, then each is sent under the canonical envelope with its payload, `sloId`, `tenantId`, `subjectKind`, `subjectId`, `kind`, `value` and `state` for the breach and `sloId`, `tenantId` and `kind` for the recovery, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SloService-005, SCN-SloService-006, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#sagas-and-long-running-flows",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-546",
        "AIFACTORY-TASK-4503",
        "AIFACTORY-TASK-4504",
        "AIFACTORY-TASK-4505"
      ],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13403,
      "kind": "behavior",
      "traces": {
        "services": [
          "SloService",
          "DashboardService"
        ],
        "aggregates": [
          "SloService/SloDefinition"
        ],
        "events": [
          "SloService/SloBreached",
          "SloService/SloRecovered",
          "DashboardService/OperationsDigestProduced"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0018"
        ],
        "requirements": [
          "FR-10",
          "XL-11"
        ],
        "scenarios": [
          "SCN-SloService-005",
          "SCN-SloService-006"
        ]
      },
      "relates": {
        "screens": [
          "status-objectives"
        ],
        "nfrs": [
          "NFR-06",
          "NFR-07"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1129",
        "feature:dashboard-service"
      ],
      "source": [
        "model/services/observability/SloService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#sagas-and-long-running-flows",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1130]",
      "number": 1130
    },
    {
      "id": "AIFACTORY-TASK-546",
      "type": "task",
      "parent": "AIFACTORY-US-1130",
      "title": "Objectives, measurement and error budget",
      "sequence": "13.07.03.01",
      "description": "Objectives, measurement and error budget. Expected output: The SloEvaluator evaluates every active objective every five minutes per tenant from a projection source port and from a typed client of the telemetry backend, writes one SloMeasurement per evaluation with value, remaining budget, burn rate and state, applies the drawn SloState transitions, writes SloBreached on entering BurningFast or Breached and SloRecovered on leaving them in the transaction of the measurement, suspends metric-sourced objectives in Meeting while the backend fails and leaves those in BurningFast or Breached unmeasured, is idempotent on sloId plus the five-minute evaluation slot so that a duplicate trigger in the slot writes nothing, attempts a failed pass three times in all and sets the two objective gauges.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "The SloEvaluator evaluates every active objective every five minutes per tenant from a projection source port and from a typed client of the telemetry backend, writes one SloMeasurement per evaluation with value, remaining budget, burn rate and state, applies the drawn SloState transitions, writes SloBreached on entering BurningFast or Breached and SloRecovered on leaving them in the transaction of the measurement, suspends metric-sourced objectives in Meeting while the backend fails and leaves those in BurningFast or Breached unmeasured, is idempotent on sloId plus the five-minute evaluation slot so that a duplicate trigger in the slot writes nothing, attempts a failed pass three times in all and sets the two objective gauges."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-546]",
      "number": 546
    },
    {
      "id": "AIFACTORY-TASK-4503",
      "type": "task",
      "parent": "AIFACTORY-US-1130",
      "title": "EvaluateSlos inbox handler on the overview digest",
      "sequence": "13.07.03.02",
      "description": "EvaluateSlos inbox handler on the overview digest. Expected output: The handler of OperationsDigestProduced marks the projection-sourced objectives of the tenant and window of the digest for the next evaluation, idempotent on the event id, so that a digest leads to one evaluation of each affected objective.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "The handler of OperationsDigestProduced marks the projection-sourced objectives of the tenant and window of the digest for the next evaluation, idempotent on the event id, so that a digest leads to one evaluation of each affected objective."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4503]",
      "number": 4503
    },
    {
      "id": "AIFACTORY-TASK-4504",
      "type": "task",
      "parent": "AIFACTORY-US-1130",
      "title": "Fake projection source and fake telemetry backend for the evaluation suite",
      "sequence": "13.07.03.03",
      "description": "Fake projection source and fake telemetry backend for the evaluation suite. Expected output: A fake projection source answers configured values per tenant, subject and window, a fake telemetry backend answers configured series and can fail, and the fixture drives an objective through Meeting, BurningFast, Breached, Recovered, Meeting and Suspended.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "A fake projection source answers configured values per tenant, subject and window, a fake telemetry backend answers configured series and can fail, and the fixture drives an objective through Meeting, BurningFast, Breached, Recovered, Meeting and Suspended."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13403,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4504]",
      "number": 4504
    },
    {
      "id": "AIFACTORY-TASK-4505",
      "type": "task",
      "parent": "AIFACTORY-US-1130",
      "title": "Verify objectives-evaluated-into-breaches-and-recoveries through the acceptance suite",
      "sequence": "13.07.03.04",
      "description": "Verify objectives-evaluated-into-breaches-and-recoveries through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SloService-005|Scenario=SCN-SloService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1130 against the fakes of AIFACTORY-TASK-4504, including the evaluation that keeps its state and publishes nothing, the duplicate trigger in the same slot that writes nothing, the monotonic budget, the BurningFast objective left unmeasured during the outage, the suspension and the payloads of SloBreached and SloRecovered; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SloService-005|Scenario=SCN-SloService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1130 against the fakes of AIFACTORY-TASK-4504, including the evaluation that keeps its state and publishes nothing, the duplicate trigger in the same slot that writes nothing, the monotonic budget, the BurningFast objective left unmeasured during the outage, the suspension and the payloads of SloBreached and SloRecovered; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4505]",
      "number": 4505
    },
    {
      "id": "AIFACTORY-US-1131",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-071",
      "title": "Roll up the health of every host from its probes, list it for the status page and announce every change",
      "sequence": "13.07.04",
      "description": "As an operator, I want the health of every host from its own probes, with its dependencies and ready replicas, so that the status page shows what is really up, and a host that stops reporting is never shown as healthy. The `HealthCollector` worker runs every minute, partitioned by host with at most eight in parallel, and collects the liveness, readiness and dependency probes of every host from the HealthChecks aggregator and the hosts themselves through the engine package of feature `component-healthchecks-aggregator-engine-library`, taken at the version its B-F06 page records and never forked. It rolls them up into the `ServiceHealth` of the host: Healthy when every probe passes, Degraded when the host is live but not ready or a dependency is degraded, Unhealthy when liveness fails, and Unknown when no probe of the host is fresher than `Observability:Slo:HealthStalenessSeconds`, 180 seconds by default, because health is observed and never declared. It keeps the state per dependency, `replicasReady` and `observedAt`, and when the state changes it writes `ServiceHealthChanged` with `hostId`, `tenantId`, `fromState` and `toState` in the same transaction; an unchanged rollup publishes nothing, and the worker is idempotent on the host and the minute and attempts a failed collection twice in all with the modelled fixed backoff of 15 seconds. Shared hosts are kept under the platform tenant. The handler `UpdateServiceHealth`, idempotent on the event id, keeps one `ServiceHealth` row per pool and per environment under the tenant of the event, because the model names no host for them: a pool is the host `pool:{poolId}` and an environment the host `environment:{environmentId}`. For a pool it maps `toState` of `WorkerPoolStateChanged` of ExecutionCapacityService: Ready to Healthy, Provisioning, Scaling and Draining to Degraded, and Unavailable to Unhealthy, with `currentSize` as `replicasReady`. For an environment it maps `ObservedStateChanged` of RuntimeEnvironmentService: `stale` true to Unknown; otherwise Healthy when every workload in `changes` has as many ready replicas as desired, Degraded when one has fewer but more than none, and Unhealthy when one has none of a desired number above zero. The `observedAt` of the row is the `occurredAt` of the event. A change of the mapped state writes `ServiceHealthChanged` with `hostId`, `tenantId`, `fromState` and `toState` in the same transaction, and an unchanged state publishes nothing. This keeps the invariant that health is observed and never declared, since the pool state and the observed state are themselves observations of their services, not declarations; the mapping is not in the model and is reported to the owner. A caller whose scope carries `factory.operations.read` lists the rollup through `SloService/ListServiceHealth` for the status page of the Studio: the hosts of the trusted tenant and the shared hosts, each with state, dependencies, ready replicas and `observedAt`; a caller without the scope is refused with 403 and nothing is written. `connectsoft.factory.health.hosts` counts the hosts by state. StudioBff and AlertRuleService consume `ServiceHealthChanged` in their own PBIs; DashboardService declares the handler `ProjectServiceHealth`, which feature `dashboard-service` does not register while the owner decides the projections the model does not hold. Kind: behavior. Traces: services: SloService, ExecutionCapacityService, RuntimeEnvironmentService; aggregates: SloService/ServiceHealth; apis: SloService/ListServiceHealth; events: SloService/ServiceHealthChanged, ExecutionCapacityService/WorkerPoolStateChanged, RuntimeEnvironmentService/ObservedStateChanged; adrs: ADR-0012, ADR-0015, ADR-0018; requirements: FUX-04, XL-16; scenarios: SCN-SloService-003, SCN-SloService-007. Relates: screens: status-objectives; nfrs: NFR-17. Depends on: feature:component-healthchecks-aggregator-engine-library, feature:execution-capacity-service-complete, feature:runtime-environment-service. Sources: model/services/observability/SloService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, docs/planes/trust-operations/observability/services/slo-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a host whose probes all pass and then whose readiness fails while it stays live, when the `HealthCollector` runs, then the `SloService/ServiceHealth` of the host moves from Healthy to Degraded with its dependencies, ready replicas and `observedAt`, and the `SloService/ServiceHealthChanged` outbox record with `fromState` Healthy and `toState` Degraded is written in the same transaction; a run with an unchanged rollup publishes nothing (SCN-SloService-007).",
        "AC2: Given a host whose last probe is older than 180 seconds, when the `HealthCollector` runs, then its state is Unknown and never Healthy, and a change into Unknown publishes `SloService/ServiceHealthChanged`; given a host whose liveness fails, then its state is Unhealthy (model/services/observability/SloService.yaml).",
        "AC3: Given `ExecutionCapacityService/WorkerPoolStateChanged` of pool p1 from Ready to Draining, when `UpdateServiceHealth` handles it, then the `SloService/ServiceHealth` of host `pool:p1` under the tenant of the event moves from Healthy to Degraded with `currentSize` as `replicasReady` and `SloService/ServiceHealthChanged` with `fromState` Healthy and `toState` Degraded is written, and a change to Unavailable moves it to Unhealthy; given `RuntimeEnvironmentService/ObservedStateChanged` of environment e1 with `stale` true, then host `environment:e1` is Unknown, and with a workload of no ready replica out of two desired it is Unhealthy; a redelivered event id and an unchanged mapped state change and publish nothing (model/services/runtime-cloud/ExecutionCapacityService.yaml).",
        "AC4: Given hosts of two tenants and shared hosts of the platform tenant, when `SloService/ListServiceHealth` is called with `factory.operations.read`, then the response is 200 with the hosts of the trusted tenant and the shared hosts, each with state, dependencies, ready replicas and `observedAt`, and nothing is written; a caller without the scope is refused with 403 (SCN-SloService-003, ADR-0015).",
        "AC5: Given a rollup changed, when the outbox dispatcher publishes `SloService/ServiceHealthChanged` on `operations.health.v1.service-health-changed`, then the event is sent under the canonical envelope with `hostId`, `tenantId`, `fromState` and `toState`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-SloService-007, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-548",
        "AIFACTORY-TASK-4506",
        "AIFACTORY-TASK-4507"
      ],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13404,
      "kind": "behavior",
      "traces": {
        "services": [
          "SloService",
          "ExecutionCapacityService",
          "RuntimeEnvironmentService"
        ],
        "aggregates": [
          "SloService/ServiceHealth"
        ],
        "apis": [
          "SloService/ListServiceHealth"
        ],
        "events": [
          "SloService/ServiceHealthChanged",
          "ExecutionCapacityService/WorkerPoolStateChanged",
          "RuntimeEnvironmentService/ObservedStateChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0018"
        ],
        "requirements": [
          "FUX-04",
          "XL-16"
        ],
        "scenarios": [
          "SCN-SloService-003",
          "SCN-SloService-007"
        ]
      },
      "relates": {
        "screens": [
          "status-objectives"
        ],
        "nfrs": [
          "NFR-17"
        ]
      },
      "dependsOn": [
        "feature:component-healthchecks-aggregator-engine-library",
        "feature:execution-capacity-service-complete",
        "feature:runtime-environment-service"
      ],
      "source": [
        "model/services/observability/SloService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "docs/planes/trust-operations/observability/services/slo-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1131]",
      "number": 1131
    },
    {
      "id": "AIFACTORY-TASK-548",
      "type": "task",
      "parent": "AIFACTORY-US-1131",
      "title": "Service health from the probes of every host",
      "sequence": "13.07.04.01",
      "description": "Service health from the probes of every host. Expected output: The HealthCollector polls the targets of every host through the pinned HealthChecks aggregator engine package every minute, rolls liveness, readiness and dependency probes up into Healthy, Degraded, Unhealthy or Unknown with the staleness of Observability:Slo:HealthStalenessSeconds, keeps dependencies, ready replicas and observedAt, writes ServiceHealthChanged on a change in the same transaction, is idempotent on hostId plus minute and moves connectsoft.factory.health.hosts.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "The HealthCollector polls the targets of every host through the pinned HealthChecks aggregator engine package every minute, rolls liveness, readiness and dependency probes up into Healthy, Degraded, Unhealthy or Unknown with the staleness of Observability:Slo:HealthStalenessSeconds, keeps dependencies, ready replicas and observedAt, writes ServiceHealthChanged on a change in the same transaction, is idempotent on hostId plus minute and moves connectsoft.factory.health.hosts."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-548]",
      "number": 548
    },
    {
      "id": "AIFACTORY-TASK-4506",
      "type": "task",
      "parent": "AIFACTORY-US-1131",
      "title": "UpdateServiceHealth handlers and ListServiceHealth",
      "sequence": "13.07.04.02",
      "description": "UpdateServiceHealth handlers and ListServiceHealth. Expected output: The handler of WorkerPoolStateChanged and ObservedStateChanged writes the ServiceHealth of host pool:{poolId} or environment:{environmentId} under the tenant of the event, maps Ready to Healthy, Provisioning, Scaling and Draining to Degraded and Unavailable to Unhealthy for a pool, and stale to Unknown and the ready against desired replicas of the changed workloads to Healthy, Degraded or Unhealthy for an environment, writes ServiceHealthChanged with fromState and toState on a change of the mapped state in the same transaction and nothing otherwise, and is idempotent on the event id; ListServiceHealth returns the hosts of the trusted tenant and the shared hosts of the platform tenant with state, dependencies, ready replicas and observedAt, and answers 403 without the scope.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "The handler of WorkerPoolStateChanged and ObservedStateChanged writes the ServiceHealth of host pool:{poolId} or environment:{environmentId} under the tenant of the event, maps Ready to Healthy, Provisioning, Scaling and Draining to Degraded and Unavailable to Unhealthy for a pool, and stale to Unknown and the ready against desired replicas of the changed workloads to Healthy, Degraded or Unhealthy for an environment, writes ServiceHealthChanged with fromState and toState on a change of the mapped state in the same transaction and nothing otherwise, and is idempotent on the event id; ListServiceHealth returns the hosts of the trusted tenant and the shared hosts of the platform tenant with state, dependencies, ready replicas and observedAt, and answers 403 without the scope."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4506]",
      "number": 4506
    },
    {
      "id": "AIFACTORY-TASK-4507",
      "type": "task",
      "parent": "AIFACTORY-US-1131",
      "title": "Verify service-health-rolled-up-per-host through the acceptance suite",
      "sequence": "13.07.04.03",
      "description": "Verify service-health-rolled-up-per-host through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SloService-003|Scenario=SCN-SloService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1131 with probe targets served by test hosts that can fail readiness, liveness and stop answering, including the stale host shown Unknown, the unchanged rollup that publishes nothing, the pool and environment states mapped onto the hosts pool:{poolId} and environment:{environmentId} with the redelivered event that changes nothing, and the payload of ServiceHealthChanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-SloService-003|Scenario=SCN-SloService-007)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1131 with probe targets served by test hosts that can fail readiness, liveness and stop answering, including the stale host shown Unknown, the unchanged rollup that publishes nothing, the pool and environment states mapped onto the hosts pool:{poolId} and environment:{environmentId} with the redelivered event that changes nothing, and the payload of ServiceHealthChanged."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4507]",
      "number": 4507
    },
    {
      "id": "AIFACTORY-US-1132",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-071",
      "title": "Apply retention rules, legal holds and deletion orders to the objectives, measurements and health of a tenant",
      "sequence": "13.07.05",
      "description": "As a workspace admin, I want the objectives and measurements of my tenant kept no longer than my retention rule and deleted on order, so that the operations data of a deleted project or tenant does not stay behind in the objective store. Three inbox handlers apply the orders of RetentionResidencyService to `slo-sql`, each idempotent on the event id. `ApplyRetentionRule` handles `RetentionRuleChanged` and applies the effective retention period of the rule to the records of its store class; the model keeps measurements 13 months, a tenant rule may only shorten that, and the retention job of the service deletes the measurements older than the effective period. `ApplyLegalHold` handles `LegalHoldChanged` and suspends deletion and expiry for the held scope while the hold is active. `ExecuteDeletionOrder` handles `DeletionOrderIssued`: an order of tenant scope deletes every row of the tenant in `SloDefinitions`, `SloMeasurements` and `ServiceHealth`; an order of project scope deletes the objectives whose subject kind is project and whose subject is that project, with their measurements; a run purge finds no rows, because the store holds no run, and its receipt says so; a held scope is not deleted and the receipt names the hold. Platform objectives and shared hosts under the platform tenant are never deleted by a tenant order. The handler acknowledges its task through `RetentionResidencyService/AcknowledgeOrderTask` with the workload token of the service, which holds `factory.data.acknowledge`, and a receipt that names the order, the service, the tables and the row counts; a redelivered order deletes nothing more and acknowledges with the same receipt, and an answer 403 or 404 or a failure before the acknowledgement leaves the task unacknowledged, is logged with the order id and is retried by the inbox. Kind: behavior. Traces: services: SloService, RetentionResidencyService; aggregates: SloService/SloDefinition, SloService/ServiceHealth; apis: RetentionResidencyService/AcknowledgeOrderTask; events: RetentionResidencyService/RetentionRuleChanged, RetentionResidencyService/LegalHoldChanged, RetentionResidencyService/DeletionOrderIssued; adrs: ADR-0019; requirements: XL-14. Depends on: AIFACTORY-US-1129, feature:retention-residency-service. Sources: model/services/observability/SloService.yaml, model/services/data-event/RetentionResidencyService.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given `RetentionResidencyService/DeletionOrderIssued` of project scope, when `ExecuteDeletionOrder` handles it, then the `SloService/SloDefinition` rows whose subject is that project are deleted with their measurements, objectives of other subjects and of other tenants are untouched, and the task is acknowledged through `RetentionResidencyService/AcknowledgeOrderTask` with a receipt that names the tables and the row counts (ADR-0019, XL-14).",
        "AC2: Given an order of tenant scope and a run purge, when they are handled, then every row of the tenant in the three tables is deleted while the platform objectives and the shared hosts stay, and the run purge deletes nothing and says so in its receipt; a redelivered order deletes nothing more, and an acknowledgement answered 403 or 404 leaves the task unacknowledged for the inbox to retry (model/services/data-event/RetentionResidencyService.yaml).",
        "AC3: Given `RetentionResidencyService/LegalHoldChanged` that holds a tenant and `RetentionResidencyService/RetentionRuleChanged` that shortens the retention of the store class of `slo-sql`, when the retention job runs, then no measurement of the held tenant is deleted, and after the hold is lifted the measurements older than the effective period are deleted (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4508",
        "AIFACTORY-TASK-4509"
      ],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13405,
      "kind": "behavior",
      "traces": {
        "services": [
          "SloService",
          "RetentionResidencyService"
        ],
        "aggregates": [
          "SloService/SloDefinition",
          "SloService/ServiceHealth"
        ],
        "apis": [
          "RetentionResidencyService/AcknowledgeOrderTask"
        ],
        "events": [
          "RetentionResidencyService/RetentionRuleChanged",
          "RetentionResidencyService/LegalHoldChanged",
          "RetentionResidencyService/DeletionOrderIssued"
        ],
        "adrs": [
          "ADR-0019"
        ],
        "requirements": [
          "XL-14"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1129",
        "feature:retention-residency-service"
      ],
      "source": [
        "model/services/observability/SloService.yaml",
        "model/services/data-event/RetentionResidencyService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1132]",
      "number": 1132
    },
    {
      "id": "AIFACTORY-TASK-4508",
      "type": "task",
      "parent": "AIFACTORY-US-1132",
      "title": "ApplyRetentionRule, ApplyLegalHold and ExecuteDeletionOrder over the three objective tables",
      "sequence": "13.07.05.01",
      "description": "ApplyRetentionRule, ApplyLegalHold and ExecuteDeletionOrder over the three objective tables. Expected output: The three handlers apply the effective retention period through a retention job of the service, suspend and resume expiry and deletion for a held scope, delete the rows of a tenant order and the project objectives with their measurements of a project order without touching platform objectives or shared hosts, answer a run purge with a receipt that names no rows, acknowledge through a typed client of AcknowledgeOrderTask with the workload token that holds factory.data.acknowledge, and are idempotent on the order id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "The three handlers apply the effective retention period through a retention job of the service, suspend and resume expiry and deletion for a held scope, delete the rows of a tenant order and the project objectives with their measurements of a project order without touching platform objectives or shared hosts, answer a run purge with a receipt that names no rows, acknowledge through a typed client of AcknowledgeOrderTask with the workload token that holds factory.data.acknowledge, and are idempotent on the order id."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4508]",
      "number": 4508
    },
    {
      "id": "AIFACTORY-TASK-4509",
      "type": "task",
      "parent": "AIFACTORY-US-1132",
      "title": "Verify objectives-follow-retention-and-deletion-orders through the acceptance suite",
      "sequence": "13.07.05.02",
      "description": "Verify objectives-follow-retention-and-deletion-orders through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1132 over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and can answer 403 and 404, including the redelivered order and the hold that blocks expiry.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.SloService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=InboxHandlers\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1132 over a two-tenant fixture with a fake of AcknowledgeOrderTask that records the receipt and can answer 403 and 404, including the redelivered order and the hold that blocks expiry."
      ],
      "sourceArtifacts": [
        "model/services/observability/SloService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:observability",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.SloService"
      ],
      "children": [],
      "buildOrder": 134,
      "phase": "factory",
      "stackRank": 13405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4509]",
      "number": 4509
    },
    {
      "id": "AIFACTORY-EPIC-014",
      "type": "epic",
      "parent": null,
      "title": "Factory Studio (PF-14)",
      "sequence": "14",
      "description": "Everything that builds the Factory Studio platform (PF-14): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Studio BFF and composition, modules, realtime, clients (web, CLI, VS Code). Done when: Every service of the platform has its complete delivery accepted (StudioBff, StudioNotificationService, StudioRealtimeGateway), the platform gateway routes them under a trusted scope, and the outcome verification of I3 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (StudioBff, StudioNotificationService, StudioRealtimeGateway), the platform gateway routes them under a trusted scope, and the outcome verification of I3 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-072",
        "AIFACTORY-FEAT-073",
        "AIFACTORY-FEAT-074",
        "AIFACTORY-FEAT-075",
        "AIFACTORY-FEAT-076",
        "AIFACTORY-FEAT-077",
        "AIFACTORY-FEAT-078",
        "AIFACTORY-FEAT-079",
        "AIFACTORY-FEAT-080",
        "AIFACTORY-FEAT-081"
      ],
      "stackRank": 11199,
      "titlePrefix": "[AIFACTORY-EPIC-014]",
      "number": 14
    },
    {
      "id": "AIFACTORY-FEAT-072",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "StudioBff: complete delivery",
      "sequence": "14.01",
      "description": "StudioBff is the backend-for-frontend of bounded context BC-29 (Experience Composition). The backend-for-frontend of the Factory Studio (GW-02): composes read models from every platform into screen-shaped responses under the caller's execution scope, forwards commands to the owning platform with idempotency keys and approval bindings, keeps session projections, saved views and preferences, and fronts StudioNotificationService; it owns no factory truth (BC-29). Its own repository is ConnectSoft.AI.SoftwareFactory.StudioBff. Delivers: StudioBff (complete). Stubbed in this increment: FleetOperationsHost (static, completed in I7); DataEventFoundations (static, completed in I4). Increment I3: Studio. Build order 112 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-032",
        "AIFACTORY-US-1361",
        "AIFACTORY-US-1362",
        "AIFACTORY-US-1363",
        "AIFACTORY-US-1364",
        "AIFACTORY-US-037"
      ],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11200,
      "titlePrefix": "[AIFACTORY-FEAT-072]",
      "number": 72
    },
    {
      "id": "AIFACTORY-US-032",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-072",
      "title": "A Studio session carries my scope and my permissions",
      "sequence": "14.01.01",
      "description": "As a requester, I want to sign in to the Studio and receive a session that holds my scope, my roles and my effective permissions, so that every screen shows only what my roles allow in that scope, through one backend that owns no factory truth. This is the integration PBI of the feature. StudioBff is the backend-for-frontend of the Factory Studio in bounded context BC-29 (Experience Composition): the Studio front end calls only StudioBff on the route GW-02 and StudioRealtimeGateway, and every call carries the user token with the scope `factory.studio.use`. StudioBff calls the public gateways of the platforms delivered in I1 to I3 (ControlPlaneApi, TemplateCatalogHost, KnowledgeHost, GovernanceHost, IntegrationHost, ModelGatewayHost, ToolExecutorHost, RuntimeCloudHost, DeliveryHost and ObservabilityHost) with that user token, exchanged at the identity platform for a token of each gateway because a user token has one audience (ADR-0015, D114); these are REST calls made through the typed client package of each gateway, pinned from the ConnectSoft feed and given the exchanged token of its own gateway only, never through a gRPC route of a gateway and never through a client written by hand (D140, AIFACTORY-US-1363); the three routes of StudioNotificationService, which StudioBff fronts, receive the user token unchanged and accept the audience of StudioBff (D117). StudioBff owns no factory truth and keeps only its two aggregates in `studio-sql`: `StudioSession` and `SavedView`. FleetOperationsHost (I7) and DataEventFoundations (I4) are static stubs in I3, so their sources show the freshness Unknown. This PBI delivers the start of a session: `StudioBff/GetStudioSession` returns the session projection of the signed-in user, and when the user has no active session it starts one. The tenant is the claim `tid` of the validated token. The project of a new session is the one of the latest session row of the user in that tenant (index `IX_Sessions_User`); with no earlier session it is the first project that `ProjectService/ListProjects` returns through ControlPlaneApi for the user token; a user with no project receives a session that holds the tenant only, no project role and the tenant-scope roles of the token claims, and the screens that need a project show their empty state. The roles of the project are resolved with `ProjectService/Projects.ResolveScope`, which StudioBff calls with its own workload token holding the service scope that names ProjectService, the user as `callerId` with `callerKind` user, and the active platform policy revision in `policyContext.policyRevision`; the model names no source of that revision for a caller that is not a run, so this PBI assumes the revision that `PolicyEngineService/Policy.GetActiveRevision` returns through GovernanceHost and reports the point as an open question. The roles and the effective permissions snapshot are stored with the preferences of the user, and the `StudioSession` row and its `StudioSessionStarted` outbox record are written in one transaction. Feature flags come from the Config Platform, which arrives with feature `component-config-platform` in I5; until then they come from the options of the service and the session is returned without the platform (optional, degrade). A request without a valid token is refused with 401; while the identity platform is unreachable new sign-ins fail fast with 503 and a problem response naming the identity platform (D137), and sessions already started continue until their tokens expire. The other behaviours are delivered by AIFACTORY-US-1361 (scope switch), AIFACTORY-US-1362 (preferences and idle expiry), AIFACTORY-US-1363 (screen composition and health), AIFACTORY-US-1364 (command forwarding) and AIFACTORY-US-037 (saved views and search). Of the 169 consumed events of the model the inbox registers the handlers of the 111 whose producers are first delivered in I1 to I3, among them `AttemptCheckpointed` of AgentRuntimeService, whose handler `RefreshExecutionAttemptView` refreshes the execution attempt view with the checkpoint sequence (D137), each idempotent on the event id and each invalidating the cached compositions of the scope of its subject so that the next `GetScreenModel` recomposes; an event that a thin delivery does not publish yet simply never arrives, and the 58 handlers whose producers arrive in I4 to I8 are not registered in I3. The repository is created by the repository checklist of feature `repository-and-pipeline-conventions` and scaffolded from the API gateway template with the role BackendForFrontend and the one named exemption file of the template (feature `component-api-gateway-template`), which lists each admitted type with a reason: the aggregates `StudioSession` and `SavedView`, their mappings and migrations, the published events `StudioSessionStarted` and `SavedViewChanged` with the outbox registration, and the view-refresh inbox handlers. Kind: behavior. Traces: services: StudioBff, ControlPlaneApi, ProjectService; aggregates: StudioBff/StudioSession; apis: StudioBff/GetStudioSession, ProjectService/Projects.ResolveScope, ProjectService/ListProjects; events: StudioBff/StudioSessionStarted, StudioBff/SavedViewChanged, AgentRuntimeService/AttemptCheckpointed; descriptors: execution-scope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0016, ADR-0028; requirements: FR-01, FUX-01, FUX-12; scenarios: SCN-StudioBff-001, SCN-StudioBff-010. Relates: screens: my-work; nfrs: NFR-01, NFR-10. Depends on: AIFACTORY-US-1361, AIFACTORY-US-1362, AIFACTORY-US-1363, AIFACTORY-US-1364, AIFACTORY-US-037, feature:control-plane-api, feature:project-service, feature:agent-runtime-service, feature:template-catalog-host, feature:governance-host, feature:typed-gateway-clients, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/factory-studio/StudioBff.yaml, model/scenarios/StudioBff.yaml, docs/planes/experience/studio/services/studio-bff/index.md#purpose-and-responsibilities, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a signed-in user whose token carries `factory.studio.use` and who has no active session, when `StudioBff/GetStudioSession` is called, then the response is 200 with the tenant of the claim `tid`, the project of the latest session row of the user or else the first project of `ProjectService/ListProjects`, the roles that `ProjectService/Projects.ResolveScope` returned for a request with the workload token of StudioBff, the user as `callerId` and `callerKind` user, the effective permissions snapshot, the locale, the theme, the reduced-motion preference, the work area and the feature flags; the `StudioBff/StudioSession` row and its `StudioBff/StudioSessionStarted` outbox record are written in one transaction, and a later call on the active session refreshes `lastSeenAt` and starts no second session (SCN-StudioBff-001, D114).",
        "AC2: Given a request without a token or with a token that does not validate, or the identity platform unreachable for a new sign-in, when `StudioBff/GetStudioSession` is called, then the response is 401 with a problem response, or 503 with a problem response naming the identity platform (D137), no session is started and nothing is published, while a session already started continues until its token expires; given a user with no project, the session holds the tenant only and no project role (SCN-StudioBff-001).",
        "AC3: Given a session was started, when the outbox dispatcher publishes `StudioBff/StudioSessionStarted` on `studio.sessions.v1.studio-session-started`, then the event is sent under the canonical envelope with `sessionId`, `tenantId`, `userId` and `locale`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-StudioBff-010, ADR-0012, ADR-0014).",
        "AC4: Given the repository ConnectSoft.AI.SoftwareFactory.StudioBff scaffolded from the API gateway template with the role BackendForFrontend, when its pipeline runs with the work of this feature, then the solution builds, the architecture test of the template passes with the one exemption file that lists, each with a reason, `StudioBff/StudioSession`, `StudioBff/SavedView`, their mappings and migrations, the published events `StudioBff/StudioSessionStarted` and `StudioBff/SavedViewChanged` with the outbox registration, and the view-refresh inbox handlers, the tests pass, the template version is recorded, a container image is published and each of the eleven scenarios of model/scenarios/StudioBff.yaml has a passing test that names its id (ADR-0028).",
        "AC5: Given the inbox and the configuration of the service, when they are compared with the model descriptor model/services/factory-studio/StudioBff.yaml, then the handlers of the 111 consumed events of producers first delivered in I1 to I3, `AgentRuntimeService/AttemptCheckpointed` among them (D137), are registered with idempotency on the event id and no other handler is, every query runs under the tenant row filter, the secrets `studio-sql` and `studio-signing` come from key-vault references, and the four metrics of the descriptor are emitted with their modelled dimensions (ADR-0015, ADR-0016, NFR-10)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/scenarios/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-513",
        "AIFACTORY-TASK-413",
        "AIFACTORY-TASK-414",
        "AIFACTORY-TASK-415",
        "AIFACTORY-TASK-416",
        "AIFACTORY-TASK-417",
        "AIFACTORY-TASK-419",
        "AIFACTORY-TASK-741",
        "AIFACTORY-TASK-5507",
        "AIFACTORY-TASK-5508"
      ],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ControlPlaneApi",
          "ProjectService"
        ],
        "aggregates": [
          "StudioBff/StudioSession"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "ProjectService/Projects.ResolveScope",
          "ProjectService/ListProjects"
        ],
        "events": [
          "StudioBff/StudioSessionStarted",
          "StudioBff/SavedViewChanged",
          "AgentRuntimeService/AttemptCheckpointed"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0016",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "FUX-01",
          "FUX-12"
        ],
        "scenarios": [
          "SCN-StudioBff-001",
          "SCN-StudioBff-010"
        ]
      },
      "relates": {
        "screens": [
          "my-work"
        ],
        "nfrs": [
          "NFR-01",
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1361",
        "AIFACTORY-US-1362",
        "AIFACTORY-US-1363",
        "AIFACTORY-US-1364",
        "AIFACTORY-US-037",
        "feature:control-plane-api",
        "feature:project-service",
        "feature:agent-runtime-service",
        "feature:template-catalog-host",
        "feature:governance-host",
        "feature:typed-gateway-clients",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/scenarios/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#purpose-and-responsibilities",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-032]",
      "number": 32
    },
    {
      "id": "AIFACTORY-TASK-513",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Session start with scope resolution and the StudioSessionStarted outbox record",
      "sequence": "14.01.01.01",
      "description": "Session start with scope resolution and the StudioSessionStarted outbox record. Expected output: GetStudioSession returns the session projection of the user; without an active session it takes the tenant from the claim tid, the project of the latest session row of the user or else the first project of ListProjects called with the user token, resolves the roles through a typed client of Projects.ResolveScope called with the workload token of StudioBff and its service scope, the user as callerId with callerKind user and the active platform policy revision, stores the roles and the effective permissions snapshot with the preferences of the latest session or the defaults, and writes the StudioSession row and its StudioSessionStarted outbox record in one transaction; a user with no project receives a tenant-only session; feature flags come from the options of the service while the Config Platform is absent; a missing or invalid token is 401, and an unreachable identity platform for a new sign-in is 503 with a problem response naming it (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "GetStudioSession returns the session projection of the user; without an active session it takes the tenant from the claim tid, the project of the latest session row of the user or else the first project of ListProjects called with the user token, resolves the roles through a typed client of Projects.ResolveScope called with the workload token of StudioBff and its service scope, the user as callerId with callerKind user and the active platform policy revision, stores the roles and the effective permissions snapshot with the preferences of the latest session or the defaults, and writes the StudioSession row and its StudioSessionStarted outbox record in one transaction; a user with no project receives a tenant-only session; feature flags come from the options of the service while the Config Platform is absent; a missing or invalid token is 401, and an unreachable identity platform for a new sign-in is 503 with a problem response naming it (D137)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-513]",
      "number": 513
    },
    {
      "id": "AIFACTORY-TASK-413",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.StudioBff and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the role BackendForFrontend",
      "sequence": "14.01.01.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.StudioBff and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the role BackendForFrontend. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.StudioBff` with the Factory profile and the gateway role BackendForFrontend from the pinned template package is committed unchanged with the one exemption file of the template, which lists with a reason each of StudioSession, SavedView, their mappings and migrations, the published events StudioSessionStarted and SavedViewChanged with the outbox registration, and the view-refresh inbox handlers; the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.StudioBff | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.StudioBff` with the Factory profile and the gateway role BackendForFrontend from the pinned template package is committed unchanged with the one exemption file of the template, which lists with a reason each of StudioSession, SavedView, their mappings and migrations, the published events StudioSessionStarted and SavedViewChanged with the outbox registration, and the view-refresh inbox handlers; the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-413]",
      "number": 413
    },
    {
      "id": "AIFACTORY-TASK-414",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Domain model: StudioSession, SavedView",
      "sequence": "14.01.01.03",
      "description": "Domain model: StudioSession, SavedView. Expected output: The aggregates hold the fields and the invariants of the model: a switcher changes the scope a session reads under and never grants a permission, a composed response is never widened by the BFF, and a shared view carries a filter definition and no data; unit tests cover every invariant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates hold the fields and the invariants of the model: a switcher changes the scope a session reads under and never grants a permission, a composed response is never widened by the BFF, and a shared view carries a filter definition and no data; unit tests cover every invariant."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-414]",
      "number": 414
    },
    {
      "id": "AIFACTORY-TASK-415",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Persistence in studio-sql: StudioSessions, SavedViews",
      "sequence": "14.01.01.04",
      "description": "Persistence in studio-sql: StudioSessions, SavedViews. Expected output: Mappings and migrations for the two modelled tables with the tenant filter and the indexes IX_Sessions_User and IX_Views_Screen; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the two modelled tables with the tenant filter and the indexes IX_Sessions_User and IX_Views_Screen; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-415]",
      "number": 415
    },
    {
      "id": "AIFACTORY-TASK-416",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "API hosting skeleton: 9 REST operations with scope enforcement, problem responses and the OpenAPI document",
      "sequence": "14.01.01.05",
      "description": "API hosting skeleton: 9 REST operations with scope enforcement, problem responses and the OpenAPI document. Expected output: The nine REST routes are hosted on GW-02, and StudioHealth on GW-01, with JWT validation, scope enforcement per route (factory.studio.use, factory.health.read), the Idempotency-Key filter of ForwardCommand, problem responses for every modelled refusal code and the OpenAPI document; the three routes of StudioNotificationService that StudioBff fronts are forwarded with the user token unchanged; the behaviour of each operation is delivered by AIFACTORY-US-032, AIFACTORY-US-1361 to AIFACTORY-US-1364 and AIFACTORY-US-037, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The nine REST routes are hosted on GW-02, and StudioHealth on GW-01, with JWT validation, scope enforcement per route (factory.studio.use, factory.health.read), the Idempotency-Key filter of ForwardCommand, problem responses for every modelled refusal code and the OpenAPI document; the three routes of StudioNotificationService that StudioBff fronts are forwarded with the user token unchanged; the behaviour of each operation is delivered by AIFACTORY-US-032, AIFACTORY-US-1361 to AIFACTORY-US-1364 and AIFACTORY-US-037, not here."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-416]",
      "number": 416
    },
    {
      "id": "AIFACTORY-TASK-417",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Messaging skeleton: outbox of 2 published events and inbox of 111 of the 169 consumed events",
      "sequence": "14.01.01.06",
      "description": "Messaging skeleton: outbox of 2 published events and inbox of 111 of the 169 consumed events. Expected output: The outbox writer enlists in the session and view transactions and the dispatcher publishes StudioSessionStarted and SavedViewChanged under the canonical envelope; the inbox registers, with idempotency on the event id, the handlers of the 111 consumed events whose producers are first delivered in I1 to I3, AttemptCheckpointed of AgentRuntimeService with its handler RefreshExecutionAttemptView among them (D137), each invalidating the cached compositions of the scope of its subject, and no handler of a producer first delivered in I4 to I8.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the session and view transactions and the dispatcher publishes StudioSessionStarted and SavedViewChanged under the canonical envelope; the inbox registers, with idempotency on the event id, the handlers of the 111 consumed events whose producers are first delivered in I1 to I3, AttemptCheckpointed of AgentRuntimeService with its handler RefreshExecutionAttemptView among them (D137), each invalidating the cached compositions of the scope of its subject, and no handler of a producer first delivered in I4 to I8."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-417]",
      "number": 417
    },
    {
      "id": "AIFACTORY-TASK-419",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Security, tenancy and telemetry of StudioBff",
      "sequence": "14.01.01.07",
      "description": "Security, tenancy and telemetry of StudioBff. Expected output: Scopes and roles of the model are enforced, every query is tenant-filtered, the user token is exchanged at the identity platform for a token of each gateway audience, the workload token of StudioBff carries the service scope that names ProjectService, the secrets studio-sql and studio-signing come from key-vault references, and the metrics screen_latency, commands_forwarded, sessions_active and source_degraded, traces and health checks follow the observability conventions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is tenant-filtered, the user token is exchanged at the identity platform for a token of each gateway audience, the workload token of StudioBff carries the service scope that names ProjectService, the secrets studio-sql and studio-signing come from key-vault references, and the metrics screen_latency, commands_forwarded, sessions_active and source_degraded, traces and health checks follow the observability conventions."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-419]",
      "number": 419
    },
    {
      "id": "AIFACTORY-TASK-741",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Verify studio-session-and-scope by running the scenario acceptance suite",
      "sequence": "14.01.01.08",
      "description": "Verify studio-session-and-scope by running the scenario acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-StudioBff\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.StudioBff; a filter that discovers no test counts as a failure; it passes and proves AC1 to AC3 of AIFACTORY-US-032 through SCN-StudioBff-001 and SCN-StudioBff-010, and the scenario part of AC4, a passing test for each of the eleven scenarios of model/scenarios/StudioBff.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-StudioBff\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.StudioBff; a filter that discovers no test counts as a failure; it passes and proves AC1 to AC3 of AIFACTORY-US-032 through SCN-StudioBff-001 and SCN-StudioBff-010, and the scenario part of AC4, a passing test for each of the eleven scenarios of model/scenarios/StudioBff.yaml."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-741]",
      "number": 741
    },
    {
      "id": "AIFACTORY-TASK-5507",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Verify the build, the template version and the published image of StudioBff through the pipeline run",
      "sequence": "14.01.01.09",
      "description": "Verify the build, the template version and the published image of StudioBff through the pipeline run. Expected output: A pipeline run of ConnectSoft.AI.SoftwareFactory.StudioBff on its main branch passes `dotnet build -c Release` and `dotnet test -c Release --no-build`, including the architecture test of the template against the one exemption file, and its run record names the recorded template version and the digest of the published container image; that record is the evidence of the build and publication part of AC4 of AIFACTORY-US-032.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "A pipeline run of ConnectSoft.AI.SoftwareFactory.StudioBff on its main branch passes `dotnet build -c Release` and `dotnet test -c Release --no-build`, including the architecture test of the template against the one exemption file, and its run record names the recorded template version and the digest of the published container image; that record is the evidence of the build and publication part of AC4 of AIFACTORY-US-032."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5507]",
      "number": 5507
    },
    {
      "id": "AIFACTORY-TASK-5508",
      "type": "task",
      "parent": "AIFACTORY-US-032",
      "title": "Verify the inbox registrations, the secrets and the metrics of StudioBff",
      "sequence": "14.01.01.10",
      "description": "Verify the inbox registrations, the secrets and the metrics of StudioBff. Expected output: Run `dotnet test -c Release --filter \"Category=Registration|Category=Telemetry\"`; a zero-match filter counts as a failure; the tests compare the inbox registrations with the 111 consumed events of producers first delivered in I1 to I3 in model/services/factory-studio/StudioBff.yaml, AttemptCheckpointed included, check the tenant row filter, the key-vault references of studio-sql and studio-signing and the four metrics with their dimensions, and prove AC5 of AIFACTORY-US-032.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Registration|Category=Telemetry\"`; a zero-match filter counts as a failure; the tests compare the inbox registrations with the 111 consumed events of producers first delivered in I1 to I3 in model/services/factory-studio/StudioBff.yaml, AttemptCheckpointed included, check the tenant row filter, the key-vault references of studio-sql and studio-signing and the four metrics with their dimensions, and prove AC5 of AIFACTORY-US-032."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5508]",
      "number": 5508
    },
    {
      "id": "AIFACTORY-US-1361",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-072",
      "title": "Switch the tenant, project or environment of a Studio session without gaining a right",
      "sequence": "14.01.02",
      "description": "As a requester, I want to switch the tenant, project or environment my Studio session reads under, so that I work in another scope I hold a role in, and a switcher never grants me what my roles do not. A signed-in user whose token carries `factory.studio.use` switches the scope of the active Studio session through `StudioBff/SetStudioScope` on GW-02, naming the tenant, the project and the environment to read under. The trusted tenant comes only from the claim `tid` of a validated token, never from the body (ADR-0015): a switch to another tenant obtains from the identity platform, through the token exchange StudioBff already uses for downstream calls, a token of the user for the named tenant, which the identity platform issues only when it grants the user that tenant; the `tenantId` of the session becomes the claim of that token, and the later requests of the session run under it. A tenant named in the body is never trusted on its own. The roles of the user in the project are resolved through `ProjectService/Projects.ResolveScope`, which StudioBff calls with its own workload token holding the service scope that names ProjectService, the tenant of the trusted token, the user as `callerId` with `callerKind` user and the active platform policy revision (D114); the new scope and the permissions snapshot resolved for it are then written to the `StudioSession`. A switcher changes only the scope the session reads under; it never grants a permission the identity platform and the Control plane did not grant (invariant of `StudioSession`). The command `SetStudioScope` has no result event, so nothing is published, and repeating the same scope changes nothing (natural idempotency). A caller without the scope, a tenant the identity platform does not grant the user and a project of the trusted tenant in which the user holds no role are refused with 403; a project or an environment outside the tenant of the trusted token, whether absent or of another tenant, is answered 404, which never confirms that it exists (D113). When ControlPlaneApi or the identity platform cannot be reached, the switch is answered 503 with a problem response naming the dependency that did not answer (D137) and the session keeps its previous scope. Every screen composed afterwards reads under the new scope. Kind: behavior. Traces: services: StudioBff, ControlPlaneApi, ProjectService; aggregates: StudioBff/StudioSession; apis: StudioBff/SetStudioScope, ProjectService/Projects.ResolveScope; descriptors: execution-scope-v1; adrs: ADR-0015; requirements: FR-01, FUX-01; scenarios: SCN-StudioBff-002. Relates: screens: my-work; nfrs: NFR-01. Depends on: feature:control-plane-api, feature:project-service. Sources: model/services/factory-studio/StudioBff.yaml, model/services/control-plane/ProjectService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given an active session and a project of the trusted tenant in which the user holds a role, when `StudioBff/SetStudioScope` is called with that project and one of its environments, then `ProjectService/Projects.ResolveScope` is called with the workload token of StudioBff, the user as `callerId` and `callerKind` user, the response is 200 with the session under the new scope and the permissions snapshot it returned, the `StudioBff/StudioSession` row is updated, nothing is published, and a repeat with the same scope changes nothing (SCN-StudioBff-002, D114).",
        "AC2: Given a switch to another tenant, when `StudioBff/SetStudioScope` is called, then StudioBff obtains from the identity platform a token of the user for that tenant and the session takes its `tenantId` from the claim `tid` of that token; a tenant the identity platform does not grant the user, a caller without `factory.studio.use` or a project of the trusted tenant in which the user holds no role is refused with 403, the session keeps its previous scope and no permission is granted (SCN-StudioBff-002, ADR-0015, FUX-01).",
        "AC3: Given a project or an environment outside the tenant of the trusted token, whether it does not exist or exists only in another tenant, when `StudioBff/SetStudioScope` is called with it, then the response is 404 in both cases, the same problem response, and the session keeps its previous scope (SCN-StudioBff-002, D113).",
        "AC4: Given ControlPlaneApi or the identity platform cannot be reached, when `StudioBff/SetStudioScope` is called, then the switch is answered 503 with a problem response naming the dependency that did not answer, and the session keeps its previous scope and permissions snapshot (SCN-StudioBff-002, D137, model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5481",
        "AIFACTORY-TASK-5482"
      ],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11202,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ControlPlaneApi",
          "ProjectService"
        ],
        "aggregates": [
          "StudioBff/StudioSession"
        ],
        "apis": [
          "StudioBff/SetStudioScope",
          "ProjectService/Projects.ResolveScope"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "FUX-01"
        ],
        "scenarios": [
          "SCN-StudioBff-002"
        ]
      },
      "relates": {
        "screens": [
          "my-work"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "feature:control-plane-api",
        "feature:project-service"
      ],
      "source": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1361]",
      "number": 1361
    },
    {
      "id": "AIFACTORY-TASK-5481",
      "type": "task",
      "parent": "AIFACTORY-US-1361",
      "title": "SetStudioScope under the tenant of a token issued for it and the roles of Projects.ResolveScope",
      "sequence": "14.01.02.01",
      "description": "SetStudioScope under the tenant of a token issued for it and the roles of Projects.ResolveScope. Expected output: SetStudioScope obtains from the identity platform a token of the user for a newly named tenant and takes the tenant of the session from its claim tid, resolves the roles in the project through Projects.ResolveScope called with the workload token of StudioBff, the user as callerId with callerKind user and the active platform policy revision, writes the new scope and permissions snapshot to the StudioSession and publishes nothing; 403 for a missing scope, an ungranted tenant or a project without a role, 404 alike for a project or environment that is absent or outside the tenant of the trusted token, and an unreachable dependency is answered 503 with a problem response naming it and leaves the previous scope in place (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "SetStudioScope obtains from the identity platform a token of the user for a newly named tenant and takes the tenant of the session from its claim tid, resolves the roles in the project through Projects.ResolveScope called with the workload token of StudioBff, the user as callerId with callerKind user and the active platform policy revision, writes the new scope and permissions snapshot to the StudioSession and publishes nothing; 403 for a missing scope, an ungranted tenant or a project without a role, 404 alike for a project or environment that is absent or outside the tenant of the trusted token, and an unreachable dependency is answered 503 with a problem response naming it and leaves the previous scope in place (D137)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5481]",
      "number": 5481
    },
    {
      "id": "AIFACTORY-TASK-5482",
      "type": "task",
      "parent": "AIFACTORY-US-1361",
      "title": "Verify the scope switch through the acceptance suite",
      "sequence": "14.01.02.02",
      "description": "Verify the scope switch through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioBff-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1361 with a fake identity platform that issues or refuses a token for a tenant and a fake Projects.ResolveScope endpoint that records the workload token and the caller fields and can answer roles, no role, not found and unavailable.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioBff-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1361 with a fake identity platform that issues or refuses a token for a tenant and a fake Projects.ResolveScope endpoint that records the workload token and the caller fields and can answer roles, no role, not found and unavailable."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5482]",
      "number": 5482
    },
    {
      "id": "AIFACTORY-US-1362",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-072",
      "title": "Keep my locale, theme and motion preferences, and end an idle session",
      "sequence": "14.01.03",
      "description": "As a requester, I want my locale, theme, reduced-motion and default work area kept, and an idle session ended for me, so that the Studio opens the way I left it and an abandoned session stops counting as active. A signed-in user whose token carries `factory.studio.use` sets the preferences of the active session through `StudioBff/SetStudioPreferences` on GW-02, from the notification preferences screen of the Studio among others: a locale of `Studio:Bff:SupportedLocales` (en, he or ru; Hebrew renders right to left), a theme (light, dark or system), the reduced-motion preference and a default work area of `WorkArea`. The preferences are written to the `StudioSession` of the user in `studio-sql`; the command publishes no event and repeating the same preferences changes nothing. As a design choice of this PBI, a new session of the user takes its preferences from the latest session row of the user (index `IX_Sessions_User`), so the next session starts with them. When `studio-sql` is unavailable the call fails fast with 503 and a problem response naming `studio-sql` (D137), and the preferences stay as they were. The worker `SessionSweeper` runs every fifteen minutes, partitioned by tenant with at most two in parallel and idempotent on `sessionId`: it expires each session whose `lastSeenAt` is older than `Studio:Bff:SessionIdleMinutes` (120 by default), clears the `subscriptions` field of the session and lowers `connectsoft.factory.studio.sessions_active`; the retry policy is none, and a session the sweeper missed is expired on its next run. The model names no notice from StudioBff to StudioRealtimeGateway, so the sweeper does not close the live subscriptions of the gateway: the gateway closes them only at the next confirmation of the session, which StudioBff refuses for an expired session (AIFACTORY-US-1371), and how long an expired session can keep receiving pushes until then is reported as an open question. A later request of an expired session starts a new one through `StudioBff/GetStudioSession`. Kind: behavior. Traces: services: StudioBff; aggregates: StudioBff/StudioSession; apis: StudioBff/SetStudioPreferences, StudioBff/GetStudioSession; requirements: FUX-12; scenarios: SCN-StudioBff-003. Relates: screens: my-work, notification-preferences. Sources: model/services/factory-studio/StudioBff.yaml, docs/planes/experience/studio/services/studio-bff/index.md#workers-and-jobs, docs/planes/experience/studio/localization-accessibility.md.",
      "acceptanceCriteria": [
        "AC1: Given an active session, when `StudioBff/SetStudioPreferences` is called with the locale he, the theme dark, reduced motion on and the work area Assets, then the response is 200 with the session carrying them, the `StudioBff/StudioSession` row holds them, nothing is published, and a repeat with the same values changes nothing (SCN-StudioBff-003, FUX-12).",
        "AC2: Given preferences were saved and the session ended, when the user starts a new session through `StudioBff/GetStudioSession`, then the new session starts with the saved locale, theme, reduced-motion preference and work area (SCN-StudioBff-003).",
        "AC3: Given `studio-sql` is unavailable, when `StudioBff/SetStudioPreferences` is called, then the call fails fast with 503 and a problem response naming `studio-sql`, and the preferences stay as they were (SCN-StudioBff-003, D137).",
        "AC4: Given a session whose `lastSeenAt` is older than `Studio:Bff:SessionIdleMinutes`, when `SessionSweeper` runs, then the `StudioBff/StudioSession` is expired, its `subscriptions` field is cleared and `connectsoft.factory.studio.sessions_active` falls, a second run for the same `sessionId` has no second effect, and a later confirmation of that session for StudioRealtimeGateway is refused (model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#workers-and-jobs",
        "docs/planes/experience/studio/localization-accessibility.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-514",
        "AIFACTORY-TASK-515",
        "AIFACTORY-TASK-418",
        "AIFACTORY-TASK-5483"
      ],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11203,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "aggregates": [
          "StudioBff/StudioSession"
        ],
        "apis": [
          "StudioBff/SetStudioPreferences",
          "StudioBff/GetStudioSession"
        ],
        "requirements": [
          "FUX-12"
        ],
        "scenarios": [
          "SCN-StudioBff-003"
        ]
      },
      "relates": {
        "screens": [
          "my-work",
          "notification-preferences"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/factory-studio/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#workers-and-jobs",
        "docs/planes/experience/studio/localization-accessibility.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1362]",
      "number": 1362
    },
    {
      "id": "AIFACTORY-TASK-514",
      "type": "task",
      "parent": "AIFACTORY-US-1362",
      "title": "Preferences for locale, theme, reduced motion and work area",
      "sequence": "14.01.03.01",
      "description": "Preferences for locale, theme, reduced motion and work area. Expected output: SetStudioPreferences validates the locale against Studio:Bff:SupportedLocales, the theme and the WorkArea value, writes them to the StudioSession and publishes nothing; a new session takes the preferences of the latest session row of the user; an unavailable studio-sql fails the call fast with 503 and a problem response naming it (D137).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "SetStudioPreferences validates the locale against Studio:Bff:SupportedLocales, the theme and the WorkArea value, writes them to the StudioSession and publishes nothing; a new session takes the preferences of the latest session row of the user; an unavailable studio-sql fails the call fast with 503 and a problem response naming it (D137)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-514]",
      "number": 514
    },
    {
      "id": "AIFACTORY-TASK-515",
      "type": "task",
      "parent": "AIFACTORY-US-1362",
      "title": "Session expiry after the idle limit",
      "sequence": "14.01.03.02",
      "description": "Session expiry after the idle limit. Expected output: The sweeper expires every session whose lastSeenAt is older than Studio:Bff:SessionIdleMinutes, clears the subscriptions field of the session and lowers connectsoft.factory.studio.sessions_active; the confirmation of an expired session for StudioRealtimeGateway is refused, so the gateway closes its live subscriptions at their next confirmation.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "The sweeper expires every session whose lastSeenAt is older than Studio:Bff:SessionIdleMinutes, clears the subscriptions field of the session and lowers connectsoft.factory.studio.sessions_active; the confirmation of an expired session for StudioRealtimeGateway is refused, so the gateway closes its live subscriptions at their next confirmation."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-515]",
      "number": 515
    },
    {
      "id": "AIFACTORY-TASK-418",
      "type": "task",
      "parent": "AIFACTORY-US-1362",
      "title": "Worker hosting: SessionSweeper with its schedule, partitioning and idempotency key",
      "sequence": "14.01.03.03",
      "description": "Worker hosting: SessionSweeper with its schedule, partitioning and idempotency key. Expected output: SessionSweeper is hosted with the schedule every fifteen minutes, the retry policy none, at most two in parallel partitioned by TenantId and the idempotency key sessionId; a duplicate trigger has no second effect.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "SessionSweeper is hosted with the schedule every fifteen minutes, the retry policy none, at most two in parallel partitioned by TenantId and the idempotency key sessionId; a duplicate trigger has no second effect."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-418]",
      "number": 418
    },
    {
      "id": "AIFACTORY-TASK-5483",
      "type": "task",
      "parent": "AIFACTORY-US-1362",
      "title": "Verify preferences and idle expiry through the acceptance suite",
      "sequence": "14.01.03.04",
      "description": "Verify preferences and idle expiry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioBff-003|Category=SessionSweeper)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1362, including the preferences carried into a new session, the cleared subscriptions field, the second sweep without effect and the refused confirmation of an expired session.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioBff-003|Category=SessionSweeper)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1362, including the preferences carried into a new session, the cleared subscriptions field, the second sweep without effect and the refused confirmation of an expired session."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5483]",
      "number": 5483
    },
    {
      "id": "AIFACTORY-US-1363",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-072",
      "title": "Compose a screen from the read models of the platforms with the freshness of each source",
      "sequence": "14.01.04",
      "description": "As an operator, I want each Studio screen built from the read models of the owning platforms with the freshness of every source, so that I see the truth of each platform under my scope, and a source that is down is shown, never hidden. A signed-in user whose token carries `factory.studio.use` opens a screen; the Studio calls `StudioBff/GetScreenModel` with a `screenId` of model/ux/screens.yaml. StudioBff checks that the `roles` list of the screen names a role of the permissions snapshot of the session, calls the read models the screen names through the public gateway of each owning platform delivered in I1 to I3 (ControlPlaneApi, TemplateCatalogHost, KnowledgeHost, GovernanceHost, IntegrationHost, ModelGatewayHost, ToolExecutorHost, RuntimeCloudHost, DeliveryHost and ObservabilityHost) with the user token exchanged for that gateway and under the session's scope, and composes the screen-shaped response with the freshness of each source (Fresh, Stale, Degraded or Unknown, model/ux/states.yaml) and the actions the role may take. Each of these is a REST call, as the outbound dependencies of model/services/factory-studio/StudioBff.yaml state for every gateway, TemplateCatalogHost included (D140), made through the typed client package of that gateway, which StudioBff pins from the ConnectSoft feed and writes no client of its own for: the control plane client of the user-token layout and the clients of the template catalog, knowledge, governance and integration gateways of feature `typed-gateway-clients`, and the clients of DeliveryHost, RuntimeCloudHost and ObservabilityHost that the features `delivery-host`, `runtime-cloud-host` and `observability-host` publish (AIFACTORY-TASK-6601, AIFACTORY-TASK-6602, AIFACTORY-TASK-6603). Each package receives the token exchanged for its own gateway and no other. Feature `typed-gateway-clients` publishes the clients of ModelGatewayHost and ToolExecutorHost in the workload layout only, which cannot carry the exchanged token of a person, so this PBI needs both packages in the user-token layout from that feature and is not done before they are on the feed; that addition is reported to the owner. Every result set is the one the owning platform filtered; the BFF never widens it (invariant of `StudioSession`). A composition is cached for `Studio:Bff:ScreenCacheSeconds` keyed by scope, and the inbox handlers of AIFACTORY-US-032 invalidate it. When one source platform is down, the composition renders the other sources and marks the missing one Degraded with its last freshness (`connectsoft.factory.studio.source_degraded`); a source not delivered in I3, the static stubs of FleetOperationsHost and DataEventFoundations among them, shows Unknown. A caller without the scope, or a screen whose `roles` list names no role of the session, is refused with 403; a `screenId` that is not a screen of the model is answered 404, and a subject the screen addresses that is absent or of another tenant is the 404 of the owning platform, returned unchanged (D113). Nothing is written. The internal probe `StudioBff/StudioHealth` on GW-01 under `factory.health.read` reports liveness and readiness with the health of each dependency. It answers 503 only while `studio-sql` is unreachable or while no cached signing key validates tokens; while the identity platform is unreachable and a cached signing key still validates tokens, it answers 200 and reports the identity platform as degraded, so existing sessions continue until their tokens expire (ADR-0015 amendment D117), and a degraded source gateway keeps it 200 as well. Kind: behavior. Traces: services: StudioBff, ControlPlaneApi, RunControlService; apis: StudioBff/GetScreenModel, StudioBff/StudioHealth, RunControlService/GetRun; adrs: ADR-0015; requirements: FUX-04, FUX-12; scenarios: SCN-StudioBff-004, SCN-StudioBff-009. Relates: screens: run-detail, my-work, template-catalog; nfrs: NFR-01. Depends on: feature:control-plane-api, feature:run-control-service, feature:template-catalog-host, feature:knowledge-host, feature:governance-host, feature:integration-host, feature:model-gateway-host, feature:tool-executor-host, feature:runtime-cloud-host, feature:delivery-host, feature:observability-host, feature:typed-gateway-clients. Sources: model/services/factory-studio/StudioBff.yaml, model/ux/screens.yaml, model/ux/states.yaml, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml, docs/planes/experience/studio/services/studio-bff/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a session whose role is named by the `roles` list of the screen `run-detail` in model/ux/screens.yaml, when `StudioBff/GetScreenModel` is called for it, then the response is 200 with the composition read through `RunControlService/GetRun` behind ControlPlaneApi under the session's scope, the freshness of each source and the actions the role may take, a second call within `Studio:Bff:ScreenCacheSeconds` is served from the cache keyed by scope, and nothing is written (SCN-StudioBff-004, FUX-04).",
        "AC2: Given a caller without `factory.studio.use`, a screen whose `roles` list names no role of the session, an unknown `screenId`, or a `runId` of another tenant, when `StudioBff/GetScreenModel` is called, then the response is 403 for the first two and 404 for the last two, the 404 for the foreign run being the answer of the owning platform returned unchanged, each with a problem response and no state change (SCN-StudioBff-004, ADR-0015).",
        "AC3: Given one source platform of a screen is down and another source is served by a static stub in I3, when `StudioBff/GetScreenModel` is called, then the other sources render, the missing source is marked Degraded with its last freshness and counted in `connectsoft.factory.studio.source_degraded`, and the stubbed source shows Unknown (SCN-StudioBff-004, FUX-04).",
        "AC4: Given a caller with `factory.health.read`, when `StudioBff/StudioHealth` is called, then the response is 200 with liveness, readiness and the health of each dependency while the service is ready; with a source gateway down, or with the identity platform unreachable while a cached signing key still validates tokens, it stays 200 and lists that dependency as degraded; while `studio-sql` is unreachable or no cached signing key validates tokens, the response is 503 with a problem response that names the failing dependency (SCN-StudioBff-009, ADR-0015).",
        "AC5: Given the solution of StudioBff, when its build and its architecture test run, then every call to a public REST route of a gateway goes through a typed client package restored from the ConnectSoft feed at a pinned version, the packages of ControlPlaneApi, TemplateCatalogHost, KnowledgeHost, GovernanceHost, IntegrationHost, ModelGatewayHost, ToolExecutorHost, DeliveryHost, RuntimeCloudHost and ObservabilityHost among them, each package receives only the token exchanged for its own gateway, and no other HTTP client of a gateway is declared in the repository than the two static stubs of FleetOperationsHost and DataEventFoundations (model/services/factory-studio/StudioBff.yaml, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-6605",
        "AIFACTORY-TASK-5484",
        "AIFACTORY-TASK-5485",
        "AIFACTORY-TASK-5486",
        "AIFACTORY-TASK-5487"
      ],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11204,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ControlPlaneApi",
          "RunControlService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/StudioHealth",
          "RunControlService/GetRun"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04",
          "FUX-12"
        ],
        "scenarios": [
          "SCN-StudioBff-004",
          "SCN-StudioBff-009"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "my-work",
          "template-catalog"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "feature:control-plane-api",
        "feature:run-control-service",
        "feature:template-catalog-host",
        "feature:knowledge-host",
        "feature:governance-host",
        "feature:integration-host",
        "feature:model-gateway-host",
        "feature:tool-executor-host",
        "feature:runtime-cloud-host",
        "feature:delivery-host",
        "feature:observability-host",
        "feature:typed-gateway-clients"
      ],
      "source": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1363]",
      "number": 1363
    },
    {
      "id": "AIFACTORY-TASK-6605",
      "type": "task",
      "parent": "AIFACTORY-US-1363",
      "title": "Typed client packages of the gateways pinned from the ConnectSoft feed in place of hand-written gateway clients",
      "sequence": "14.01.04.01",
      "description": "Typed client packages of the gateways pinned from the ConnectSoft feed in place of hand-written gateway clients. Expected output: StudioBff restores from the ConnectSoft feed, at versions pinned in the repository and recorded on the Runbook pages of the client repository, the control plane client of the user-token layout, the clients of TemplateCatalogHost, KnowledgeHost, GovernanceHost and IntegrationHost of feature typed-gateway-clients, the clients of DeliveryHost, RuntimeCloudHost and ObservabilityHost of AIFACTORY-TASK-6601, AIFACTORY-TASK-6602 and AIFACTORY-TASK-6603, and the clients of ModelGatewayHost and ToolExecutorHost in the user-token layout once feature typed-gateway-clients publishes it; each client is registered with the base address of its gateway and given only the user token exchanged at the identity platform for that gateway; GetScreenModel, ForwardCommand and StudioSearch call the public REST routes through these clients alone; an architecture test fails on any other HTTP client of a gateway than the two static stubs of AIFACTORY-TASK-5485.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build --filter \"Category=Architecture\".",
      "acceptanceCriteria": [
        "StudioBff restores from the ConnectSoft feed, at versions pinned in the repository and recorded on the Runbook pages of the client repository, the control plane client of the user-token layout, the clients of TemplateCatalogHost, KnowledgeHost, GovernanceHost and IntegrationHost of feature typed-gateway-clients, the clients of DeliveryHost, RuntimeCloudHost and ObservabilityHost of AIFACTORY-TASK-6601, AIFACTORY-TASK-6602 and AIFACTORY-TASK-6603, and the clients of ModelGatewayHost and ToolExecutorHost in the user-token layout once feature typed-gateway-clients publishes it; each client is registered with the base address of its gateway and given only the user token exchanged at the identity platform for that gateway; GetScreenModel, ForwardCommand and StudioSearch call the public REST routes through these clients alone; an architecture test fails on any other HTTP client of a gateway than the two static stubs of AIFACTORY-TASK-5485."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6605]",
      "number": 6605
    },
    {
      "id": "AIFACTORY-TASK-5484",
      "type": "task",
      "parent": "AIFACTORY-US-1363",
      "title": "GetScreenModel composition from the read models a screen names, with freshness and role checks",
      "sequence": "14.01.04.02",
      "description": "GetScreenModel composition from the read models a screen names, with freshness and role checks. Expected output: GetScreenModel checks the roles list of the screen against the permissions snapshot, calls each read model the screen names in model/ux/screens.yaml through the pinned client package of the gateway of its platform (AIFACTORY-TASK-6605), TemplateCatalogHost included, with the exchanged user token, returns the composition with the freshness of each source and the permitted actions, caches it for Studio:Bff:ScreenCacheSeconds by scope, marks a down source Degraded with its last freshness and returns the 404 of the owning platform unchanged; 403 and 404 refusals are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "GetScreenModel checks the roles list of the screen against the permissions snapshot, calls each read model the screen names in model/ux/screens.yaml through the pinned client package of the gateway of its platform (AIFACTORY-TASK-6605), TemplateCatalogHost included, with the exchanged user token, returns the composition with the freshness of each source and the permitted actions, caches it for Studio:Bff:ScreenCacheSeconds by scope, marks a down source Degraded with its last freshness and returns the 404 of the owning platform unchanged; 403 and 404 refusals are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5484]",
      "number": 5484
    },
    {
      "id": "AIFACTORY-TASK-5485",
      "type": "task",
      "parent": "AIFACTORY-US-1363",
      "title": "Static stubs of FleetOperationsHost and DataEventFoundations",
      "sequence": "14.01.04.03",
      "description": "Static stubs of FleetOperationsHost and DataEventFoundations. Expected output: The clients of FleetOperationsHost and DataEventFoundations ship in the service as static stubs that answer no data and the freshness Unknown, so a screen whose source arrives in I4 or I7 renders that source as Unknown; each stub names the increment that replaces it, and the stub of DataEventFoundations names the client package of AIFACTORY-TASK-6604 of feature data-event-foundations (I4) as its replacement.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "The clients of FleetOperationsHost and DataEventFoundations ship in the service as static stubs that answer no data and the freshness Unknown, so a screen whose source arrives in I4 or I7 renders that source as Unknown; each stub names the increment that replaces it, and the stub of DataEventFoundations names the client package of AIFACTORY-TASK-6604 of feature data-event-foundations (I4) as its replacement."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5485]",
      "number": 5485
    },
    {
      "id": "AIFACTORY-TASK-5486",
      "type": "task",
      "parent": "AIFACTORY-US-1363",
      "title": "StudioHealth with the health of each dependency",
      "sequence": "14.01.04.04",
      "description": "StudioHealth with the health of each dependency. Expected output: StudioHealth reports liveness and readiness with the identity platform, the cached signing keys, studio-sql, the messaging transport and each source gateway; it answers 503 naming the dependency only while studio-sql is unreachable or no cached signing key validates tokens, and stays 200 with the identity platform listed degraded while a cached key still validates and with a degraded source gateway listed as such.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "StudioHealth reports liveness and readiness with the identity platform, the cached signing keys, studio-sql, the messaging transport and each source gateway; it answers 503 naming the dependency only while studio-sql is unreachable or no cached signing key validates tokens, and stays 200 with the identity platform listed degraded while a cached key still validates and with a degraded source gateway listed as such."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5486]",
      "number": 5486
    },
    {
      "id": "AIFACTORY-TASK-5487",
      "type": "task",
      "parent": "AIFACTORY-US-1363",
      "title": "Verify screen composition and health through the acceptance suite",
      "sequence": "14.01.04.05",
      "description": "Verify screen composition and health through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioBff-004|Scenario=SCN-StudioBff-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1363 with fake gateways that can answer data, 404 and unavailable and a fake identity platform that can be unreachable with and without a cached signing key; AC5 is proven by the build and the architecture test of AIFACTORY-TASK-6605 in the same pipeline.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioBff-004|Scenario=SCN-StudioBff-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1363 with fake gateways that can answer data, 404 and unavailable and a fake identity platform that can be unreachable with and without a cached signing key; AC5 is proven by the build and the architecture test of AIFACTORY-TASK-6605 in the same pipeline."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5487]",
      "number": 5487
    },
    {
      "id": "AIFACTORY-US-1364",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-072",
      "title": "Forward a Studio command to the owning platform with my token, my scope and the idempotency key",
      "sequence": "14.01.05",
      "description": "As a requester, I want the commands I take in the Studio forwarded to the platform that owns them, with my own token and scope, so that the gates of the owning service decide, a repeated click does nothing twice and the Studio never acts beyond my rights. A signed-in user whose token carries `factory.studio.use` takes a command on a screen; the Studio calls `StudioBff/ForwardCommand` with a `commandId` that a screen of model/ux/screens.yaml names, a body valid for that command and an `Idempotency-Key`. StudioBff forwards the command to the owning platform through its public gateway, as a REST call through the pinned client package of that gateway (AIFACTORY-TASK-6605), the control plane client of feature `typed-gateway-clients` for ControlPlaneApi and the client of AIFACTORY-TASK-6601 for DeliveryHost, with the user token exchanged for that gateway, the session's scope and the `Idempotency-Key` unchanged, and for a gated class the approval binding the screen showed, the approval id and the request version. In I3 that covers submitting, cancelling and deciding on a run through ControlPlaneApi (`RunControlService/SubmitRun`, `RunControlService/CancelRun`, `RunControlService/DecideApproval`), answering a decision a waiting attempt asks for, missing input or an escalation choice, through the public route `RunControlService/AnswerDecision` behind ControlPlaneApi from the workflow run graph screen, with the user token that holds `factory.runs.operate` (D137), and requesting a promotion through DeliveryHost (`EnvironmentPromotionService/RequestPromotion`) from the promotions screen. Run Control passes the answer to the attempt; the Studio never calls `Runtime.AnswerDecision` of AgentRuntimeService itself, and an approval is never answered through `AnswerDecision`. The operations of StudioBff itself (`SetStudioScope`, `SetStudioPreferences`, `SaveView`) and the routes of StudioNotificationService it fronts (`SetNotificationPreferences` among them) are not commands of the catalog and are never forwarded through it. The class and the gates of the owning service apply, never the BFF's: the BFF stores no command and decides no gate. The response is 202, the envelope of the BFF around the answer of the owning service, which it carries unchanged, the 200 of `DecideApproval` included, and a repeat under the same key returns the answer the owning service gives for the repeat, the same result, and changes nothing. The refusals of the owning service are returned unchanged with their codes, as D137 rules for every Studio route: the 409 of RunControlService for a reused key with another input, for a request version that is stale or was changed by a concurrent decision and for a request already decided, its 410 for a request past its expiry and its 400 for an invalid decision, the 409 of `AnswerDecision` for a decision already answered or an approval, its 404 for a decision the open attempt did not ask for and its 503 when AgentRuntimeService does not answer, the 412 of `EnvironmentPromotionService/RequestPromotion` for a withdrawn release, and the 404 of either for a subject of another tenant (D113). A caller without the scope is refused with 403; a `commandId` that no screen names, or a body that fails the schema of the command, is refused with 422. A command to a platform that is down, or whose route has no live service in I3 such as acknowledging an alert, is refused with 503 and a problem response naming the dependency (D137), and is never queued or retried by the BFF. `connectsoft.factory.studio.commands_forwarded` counts each command by outcome. Kind: behavior. Traces: services: StudioBff, ControlPlaneApi, DeliveryHost, RunControlService, EnvironmentPromotionService; apis: StudioBff/ForwardCommand, RunControlService/SubmitRun, RunControlService/CancelRun, RunControlService/DecideApproval, RunControlService/AnswerDecision, EnvironmentPromotionService/RequestPromotion; descriptors: run-submission-v1, approval-decision-v1; adrs: ADR-0014, ADR-0015; requirements: FR-01, FUX-04, XL-05; scenarios: SCN-StudioBff-005. Relates: screens: run-submit, run-detail, approval-card, promotions, workflow-run-graph. Depends on: AIFACTORY-US-1363, feature:control-plane-api, feature:run-control-service, feature:delivery-host, feature:environment-promotion-service, feature:typed-gateway-clients. Sources: model/services/factory-studio/StudioBff.yaml, model/ux/screens.yaml, docs/planes/experience/studio/services/studio-bff/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a session in a project where the user is a requester and a valid `run-submission-v1` body, when `StudioBff/ForwardCommand` is called for `SubmitRun` with an `Idempotency-Key`, then `RunControlService/SubmitRun` receives the exchanged user token, the session's scope and the key unchanged, the response is 202 carrying the answer of RunControlService, and a repeat under the same key returns the same run and changes nothing (SCN-StudioBff-005, FUX-04).",
        "AC2: Given an approval card that showed a request version, when `StudioBff/ForwardCommand` is called for `DecideApproval` with `approval-decision-v1`, then the approval binding with that version is forwarded to `RunControlService/DecideApproval`, its 200 is carried in the 202 of the BFF, a version that is stale or was changed by a concurrent decision is answered with the 409 of RunControlService returned unchanged, and a request past its expiry with its 410 returned unchanged, the decision being the one of the owning service and never of the BFF (SCN-StudioBff-005, XL-05).",
        "AC3: Given a caller without `factory.studio.use`, a `commandId` named by no screen of model/ux/screens.yaml, or a body that fails the schema of the command, when `StudioBff/ForwardCommand` is called, then the response is 403 or 422 with a problem response, nothing is forwarded and no state changes (SCN-StudioBff-005).",
        "AC4: Given `EnvironmentPromotionService/RequestPromotion` answers 412 for a withdrawn release, RunControlService answers 409 for a reused key with another input or 404 for a run of another tenant, or the platform is down, when `StudioBff/ForwardCommand` is called, then the 412, the 409 and the 404 are returned unchanged, the command to the platform that is down is refused with 503 and a problem response naming that platform and is neither queued nor retried, and `connectsoft.factory.studio.commands_forwarded` counts each outcome (SCN-StudioBff-005, ADR-0015, D137).",
        "AC5: Given a waiting attempt of a run that asks for a decision and a user holding `factory.runs.operate`, when `StudioBff/ForwardCommand` is called for `AnswerDecision` from the workflow run graph screen, then `RunControlService/AnswerDecision` receives the exchanged user token and the answer, its 200 is carried in the 202 of the BFF, and its 404 for a decision the attempt did not ask for, its 409 for an answered decision or an approval and its 503 when AgentRuntimeService does not answer are returned unchanged (SCN-StudioBff-005, D137)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5488",
        "AIFACTORY-TASK-5489",
        "AIFACTORY-TASK-5490"
      ],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11205,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ControlPlaneApi",
          "DeliveryHost",
          "RunControlService",
          "EnvironmentPromotionService"
        ],
        "apis": [
          "StudioBff/ForwardCommand",
          "RunControlService/SubmitRun",
          "RunControlService/CancelRun",
          "RunControlService/DecideApproval",
          "RunControlService/AnswerDecision",
          "EnvironmentPromotionService/RequestPromotion"
        ],
        "descriptors": [
          "run-submission-v1",
          "approval-decision-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01",
          "FUX-04",
          "XL-05"
        ],
        "scenarios": [
          "SCN-StudioBff-005"
        ]
      },
      "relates": {
        "screens": [
          "run-submit",
          "run-detail",
          "approval-card",
          "promotions",
          "workflow-run-graph"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1363",
        "feature:control-plane-api",
        "feature:run-control-service",
        "feature:delivery-host",
        "feature:environment-promotion-service",
        "feature:typed-gateway-clients"
      ],
      "source": [
        "model/services/factory-studio/StudioBff.yaml",
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1364]",
      "number": 1364
    },
    {
      "id": "AIFACTORY-TASK-5488",
      "type": "task",
      "parent": "AIFACTORY-US-1364",
      "title": "Command catalog of the Studio from the commands the screens name",
      "sequence": "14.01.05.01",
      "description": "Command catalog of the Studio from the commands the screens name. Expected output: The command catalog of the service lists each command a screen of model/ux/screens.yaml names and another platform owns, with its owning gateway, its route, its body schema, whether it carries an approval binding, and its side-effect class; the operations of StudioBff itself (SetStudioScope, SetStudioPreferences, SaveView) and the fronted routes of StudioNotificationService (SetNotificationPreferences) are left out; a commandId outside the catalog is refused with 422.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "The command catalog of the service lists each command a screen of model/ux/screens.yaml names and another platform owns, with its owning gateway, its route, its body schema, whether it carries an approval binding, and its side-effect class; the operations of StudioBff itself (SetStudioScope, SetStudioPreferences, SaveView) and the fronted routes of StudioNotificationService (SetNotificationPreferences) are left out; a commandId outside the catalog is refused with 422."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11205,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5488]",
      "number": 5488
    },
    {
      "id": "AIFACTORY-TASK-5489",
      "type": "task",
      "parent": "AIFACTORY-US-1364",
      "title": "ForwardCommand with the exchanged user token, the session scope, the key and the approval binding",
      "sequence": "14.01.05.02",
      "description": "ForwardCommand with the exchanged user token, the session scope, the key and the approval binding. Expected output: ForwardCommand forwards the command through the pinned client package of the gateway of the owning platform (AIFACTORY-TASK-6605) with the exchanged user token, the session scope, the Idempotency-Key unchanged and the approval binding for a gated class, returns 202 carrying the answer of the owning service, returns its 400, 404, 409, 410, 412 and 503 unchanged (409 and 410 of DecideApproval for a stale or expired request, 404, 409 and 503 of AnswerDecision, 412 of RequestPromotion for a withdrawn release) under D137, forwards AnswerDecision to the public route of RunControlService behind ControlPlaneApi and never to Runtime.AnswerDecision, refuses with 403 and 422 before forwarding, refuses a command to a platform that is down with 503 and a problem response naming it without queueing or retrying it, and counts commands_forwarded by outcome.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "ForwardCommand forwards the command through the pinned client package of the gateway of the owning platform (AIFACTORY-TASK-6605) with the exchanged user token, the session scope, the Idempotency-Key unchanged and the approval binding for a gated class, returns 202 carrying the answer of the owning service, returns its 400, 404, 409, 410, 412 and 503 unchanged (409 and 410 of DecideApproval for a stale or expired request, 404, 409 and 503 of AnswerDecision, 412 of RequestPromotion for a withdrawn release) under D137, forwards AnswerDecision to the public route of RunControlService behind ControlPlaneApi and never to Runtime.AnswerDecision, refuses with 403 and 422 before forwarding, refuses a command to a platform that is down with 503 and a problem response naming it without queueing or retrying it, and counts commands_forwarded by outcome."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5489]",
      "number": 5489
    },
    {
      "id": "AIFACTORY-TASK-5490",
      "type": "task",
      "parent": "AIFACTORY-US-1364",
      "title": "Verify command forwarding through the acceptance suite",
      "sequence": "14.01.05.03",
      "description": "Verify command forwarding through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioBff-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1364 with fake ControlPlaneApi and DeliveryHost routes that record the forwarded token, scope, key and binding, whose SubmitRun answers 202, 404 and 409, whose DecideApproval answers 200, 409 and 410, whose AnswerDecision answers 200, 404, 409 and 503, whose RequestPromotion answers 202 and 412, and which can be unavailable.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioBff-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1364 with fake ControlPlaneApi and DeliveryHost routes that record the forwarded token, scope, key and binding, whose SubmitRun answers 202, 404 and 409, whose DecideApproval answers 200, 409 and 410, whose AnswerDecision answers 200, 404, 409 and 503, whose RequestPromotion answers 202 and 412, and which can be unavailable."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5490]",
      "number": 5490
    },
    {
      "id": "AIFACTORY-US-037",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-072",
      "title": "I keep my views of a list and find things within my scope",
      "sequence": "14.01.06",
      "description": "As an operator, I want to save the filter and layout of a list, share it with my tenant and search across the Studio, so that I return to the same view and find a run, an asset or an approval quickly, and only within my scope. A signed-in user whose token carries `factory.studio.use` saves the filter and layout of a list screen (runs, approvals, assets, alerts, fleet) through `StudioBff/SaveView` on GW-02 with the `screenId`, a name, the definition and `sharedWith` (private, project or tenant). A new `viewId` creates the `SavedView` with the caller as owner and answers 201; a view the caller owns is updated and answers 200; in both cases the `SavedViewChanged` outbox record is written in the same transaction, and saving the same definition again changes nothing and publishes nothing. A view owned by another user is refused with 403 and a view of another tenant is answered 404 (D113). `StudioBff/ListSavedViews` returns, for a screen, the caller's own views and the views shared with the tenant of the session; private views of other users and views of other tenants never appear. The `SavedView` of the model has no project field and its index `IX_Views_Screen` covers no project, so the project a view is shared with can be neither recorded nor queried: as an explicit assumption of this PBI, a view saved with `sharedWith` project is stored and treated as private to its owner until the model gains a project field, which is reported as an open question. A shared view carries a filter definition and no data, so the results of a view stay scoped per viewer (invariant of `SavedView`). `StudioBff/StudioSearch` is the command palette: it queries the list read models of runs, assets, projects, environments and alerts through the public gateways of their platforms, by REST through the pinned client packages of ControlPlaneApi and ObservabilityHost (AIFACTORY-TASK-6605), with the exchanged user token under the session's scope, adds the screens whose `roles` list names a role of the session, and merges the results; a source that is down or not delivered in I3, such as alerts, is named as not searched. When `studio-sql` is unavailable the view operations fail fast, and when the identity platform cannot exchange the token the search fails fast; both answer 503 with a problem response naming the dependency that did not answer (D137). `SavedViewChanged` reaches StudioRealtimeGateway, which refreshes the views shared with the tenant in the sessions of that tenant. Kind: behavior. Traces: services: StudioBff; aggregates: StudioBff/SavedView; apis: StudioBff/ListSavedViews, StudioBff/SaveView, StudioBff/StudioSearch; events: StudioBff/SavedViewChanged; adrs: ADR-0012, ADR-0015; requirements: FUX-04; scenarios: SCN-StudioBff-006, SCN-StudioBff-007, SCN-StudioBff-008, SCN-StudioBff-011. Relates: screens: approvals-list; nfrs: NFR-01. Depends on: AIFACTORY-US-1363, feature:control-plane-api, feature:observability-host, feature:typed-gateway-clients. Sources: model/services/factory-studio/StudioBff.yaml, docs/planes/experience/studio/services/studio-bff/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a list screen, when the user calls `StudioBff/SaveView` with a new `viewId`, then the response is 201 and `StudioBff/ListSavedViews` lists the view for that screen with the same definition; an update of the user's own view answers 200; each write and its `StudioBff/SavedViewChanged` outbox record share one transaction (SCN-StudioBff-007, SCN-StudioBff-006).",
        "AC2: Given a view shared with the tenant, a view saved with `sharedWith` project, views private to other users and a view of another tenant, when another user of the tenant calls `StudioBff/ListSavedViews`, then only the tenant-shared view is offered, the project-shared view being treated as private to its owner; given a view owned by another user or a `viewId` of another tenant, when `StudioBff/SaveView` is called, then the response is 403 or 404 with no change and nothing published (SCN-StudioBff-006, SCN-StudioBff-007, D113).",
        "AC3: Given a search term, when the user calls `StudioBff/StudioSearch`, then only items inside the scope of the session are returned with their kind and reference, screens are offered only when their `roles` list names a role of the session, and a source that is down or not delivered in I3 is named as not searched; given the identity platform cannot exchange the token, then the call fails fast with 503 and a problem response naming the identity platform, with no state change (SCN-StudioBff-008, D137).",
        "AC4: Given a saved view was created or changed, when the outbox dispatcher publishes `StudioBff/SavedViewChanged` on `studio.views.v1.saved-view-changed`, then the event is sent under the canonical envelope with `viewId`, `tenantId`, `screenId` and `sharedWith`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-StudioBff-011, ADR-0012).",
        "AC5: Given `studio-sql` is unavailable, when `StudioBff/ListSavedViews` or `StudioBff/SaveView` is called, then the call fails fast with 503 and a problem response naming `studio-sql`, no view changes and nothing is published (SCN-StudioBff-006, SCN-StudioBff-007, D137)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-528",
        "AIFACTORY-TASK-529",
        "AIFACTORY-TASK-742"
      ],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11206,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "aggregates": [
          "StudioBff/SavedView"
        ],
        "apis": [
          "StudioBff/ListSavedViews",
          "StudioBff/SaveView",
          "StudioBff/StudioSearch"
        ],
        "events": [
          "StudioBff/SavedViewChanged"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04"
        ],
        "scenarios": [
          "SCN-StudioBff-006",
          "SCN-StudioBff-007",
          "SCN-StudioBff-008",
          "SCN-StudioBff-011"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1363",
        "feature:control-plane-api",
        "feature:observability-host",
        "feature:typed-gateway-clients"
      ],
      "source": [
        "model/services/factory-studio/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-bff/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-037]",
      "number": 37
    },
    {
      "id": "AIFACTORY-TASK-528",
      "type": "task",
      "parent": "AIFACTORY-US-037",
      "title": "Saved views with sharing scope and the SavedViewChanged outbox record",
      "sequence": "14.01.06.01",
      "description": "Saved views with sharing scope and the SavedViewChanged outbox record. Expected output: SaveView creates (201) or updates (200) a SavedView of the caller with screen, name, definition and sharedWith and writes SavedViewChanged in the same transaction; a repeat of the same definition writes and publishes nothing; 403 for a view of another user and 404 for a view of another tenant; ListSavedViews returns own views and views shared with the tenant of the session, and treats a view saved with sharedWith project as private to its owner while the model has no project field.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "SaveView creates (201) or updates (200) a SavedView of the caller with screen, name, definition and sharedWith and writes SavedViewChanged in the same transaction; a repeat of the same definition writes and publishes nothing; 403 for a view of another user and 404 for a view of another tenant; ListSavedViews returns own views and views shared with the tenant of the session, and treats a view saved with sharedWith project as private to its owner while the model has no project field."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-528]",
      "number": 528
    },
    {
      "id": "AIFACTORY-TASK-529",
      "type": "task",
      "parent": "AIFACTORY-US-037",
      "title": "Search across the composed read models",
      "sequence": "14.01.06.02",
      "description": "Search across the composed read models. Expected output: StudioSearch queries the list read models of runs, assets, projects, environments and alerts through the pinned client packages of their gateways (AIFACTORY-TASK-6605) with the exchanged user token under the scope of the session, adds the screens the roles of the session may open, merges the results and names each source that was not searched.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "StudioSearch queries the list read models of runs, assets, projects, environments and alerts through the pinned client packages of their gateways (AIFACTORY-TASK-6605) with the exchanged user token under the scope of the session, adds the screens the roles of the session may open, merges the results and names each source that was not searched."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-529]",
      "number": 529
    },
    {
      "id": "AIFACTORY-TASK-742",
      "type": "task",
      "parent": "AIFACTORY-US-037",
      "title": "Verify studio-saved-views-and-search by running the declared command",
      "sequence": "14.01.06.03",
      "description": "Verify studio-saved-views-and-search by running the declared command. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioBff-006|Scenario=SCN-StudioBff-007|Scenario=SCN-StudioBff-008|Scenario=SCN-StudioBff-011)\"`; a zero-match filter counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-037, including the project-shared view treated as private and the publication and payload of SavedViewChanged; consumer handling is proven by the suite of StudioRealtimeGateway.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioBff-006|Scenario=SCN-StudioBff-007|Scenario=SCN-StudioBff-008|Scenario=SCN-StudioBff-011)\"`; a zero-match filter counts as a failure; it passes and proves AC1 to AC5 of AIFACTORY-US-037, including the project-shared view treated as private and the publication and payload of SavedViewChanged; consumer handling is proven by the suite of StudioRealtimeGateway."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 112,
      "phase": "factory",
      "stackRank": 11206,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-742]",
      "number": 742
    },
    {
      "id": "AIFACTORY-FEAT-073",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "StudioNotificationService: complete delivery",
      "sequence": "14.02",
      "description": "StudioNotificationService is the service of bounded context BC-29 (Experience Composition). Per-user notifications in the Studio — approvals waiting, alerts, releases ready, promotions and rollouts, incidents, proposals, exports — derived from platform events under each user's scope and role, with read state, grouping, digests and per-user channel preferences (in-app always; email and chat through connectors); the in-app channel is the one every other platform can rely on (BC-29). Its own repository is ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Delivers: StudioNotificationService (complete). Increment I3: Studio. Build order 113 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-035",
        "AIFACTORY-US-1365",
        "AIFACTORY-US-1366",
        "AIFACTORY-US-1367",
        "AIFACTORY-US-1368"
      ],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11300,
      "titlePrefix": "[AIFACTORY-FEAT-073]",
      "number": 73
    },
    {
      "id": "AIFACTORY-US-035",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-073",
      "title": "I am notified of what needs me, and only within my scope",
      "sequence": "14.02.01",
      "description": "As an operator, I want notifications for approvals, releases, promotions and reconciliations that concern my role and scope, so that I act on what needs me and am never shown what I may not see. This is the integration PBI of the feature. StudioNotificationService is the service of bounded context BC-29 (Experience Composition) that keeps per-user notifications in the Studio: it derives them from platform events under the scope and the role of each user, keeps read and dismissed state, groups them into digests and holds per-user channel preferences; the in-app channel is always on and is the one every other platform can rely on, while email and chat go through connectors. It owns two aggregates in `studio-notification-sql`: `Notification`, one notice for one user with its kind, subject reference, scope, importance, read and dismissed state and the deliveries made per channel, and `NotificationPreference`. StudioBff fronts the service on GW-02 and forwards the user token unchanged (D117), so the Studio reaches its three REST operations under `factory.studio.use`, and every query runs under the tenant row filter: a notification of another user or of another tenant is answered 404, the same answer as for one that does not exist (D113). A notification is created only for a user whose scope and role allow seeing the subject, confirmed through `ProjectService/Projects.ResolveScope` and never from the event alone, and it carries a summary with a reference, never the content. The behaviour is delivered by AIFACTORY-US-1365 (fan-out from platform events and `NotificationCreated`), AIFACTORY-US-1366 (list and read state), AIFACTORY-US-1367 (preferences, quiet hours and digests) and AIFACTORY-US-1368 (the internal `Notifications.Notify`). The inbox follows the rule of StudioBff: a handler is registered when its producer is first delivered in I1 to I3, and an event a thin delivery does not publish yet simply never arrives. Of the 17 consumed events of the model, the producers of 8 are first delivered in I1 to I3; the inbox registers 4 of them (`ApprovalRequested`, `ReleaseReady`, `PromotionCompleted` and `ReconciliationProposed`), and leaves out `AttemptDecisionRequested`, `FindingRaised`, `ToolEffectUncertain` and `DeliveryFailed`, because `NotificationKind` has no value for them and an event acknowledged without a notification would be lost once a kind exists; which kind each should create is reported as an open question. The handlers of the 9 others (`AlertFired`, `ApprovalRouted`, `LearningProposalRaised` and `ExportCompleted` from I4, `SkillCandidateProposed` from I5, `RolloutPlanned`, `RolloutHalted`, `IncidentOpened` and `InvoiceIssued` from I7) are not registered in I3. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService, created by the repository checklist of feature `repository-and-pipeline-conventions` and scaffolded from the base template with the Factory profile. Kind: behavior. Traces: services: StudioNotificationService, StudioBff, RunControlService; aggregates: StudioNotificationService/Notification, StudioNotificationService/NotificationPreference; apis: StudioNotificationService/ListNotifications, StudioNotificationService/MarkNotificationRead, StudioNotificationService/SetNotificationPreferences, StudioNotificationService/Notifications.Notify; events: StudioNotificationService/NotificationCreated, RunControlService/ApprovalRequested, ReleaseService/ReleaseReady, EnvironmentPromotionService/PromotionCompleted, RuntimeEnvironmentService/ReconciliationProposed; adrs: ADR-0014, ADR-0015, ADR-0028; requirements: FUX-04. Relates: screens: my-work, notification-preferences; nfrs: NFR-01, NFR-10. Depends on: AIFACTORY-US-1365, AIFACTORY-US-1366, AIFACTORY-US-1367, AIFACTORY-US-1368, feature:studio-bff, feature:run-control-service, feature:release-service, feature:environment-promotion-service, feature:runtime-environment-service, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/factory-studio/StudioNotificationService.yaml, model/scenarios/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.StudioNotificationService, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioNotificationService` with the Factory profile, when its pipeline runs with the work of this feature, then no second scaffold was run, the solution builds, the tests pass, the template version is recorded, a container image is published and each of the five scenarios of model/scenarios/StudioNotificationService.yaml has a passing test that names its id (ADR-0028).",
        "AC2: Given the inbox of the service, when its registrations are listed, then the four handlers of `RunControlService/ApprovalRequested`, `ReleaseService/ReleaseReady`, `EnvironmentPromotionService/PromotionCompleted` and `RuntimeEnvironmentService/ReconciliationProposed` are registered with idempotency on the event id, and no handler is registered for the four events of I1 to I3 producers that `NotificationKind` cannot name nor for any event whose producer arrives in I4 to I7 (model/services/factory-studio/StudioNotificationService.yaml).",
        "AC3: Given a deployed I3 instance with StudioBff, RunControlService and this service, and a run submitted through StudioBff that reaches an approval of the role Reviewer, when RunControlService publishes `RunControlService/ApprovalRequested`, then the reviewer of the project lists one ApprovalWaiting notification through the route of `StudioNotificationService/ListNotifications` that StudioBff fronts, marks it read through `StudioNotificationService/MarkNotificationRead` on that route, and a second device of the reviewer lists it read, while the requester of the run and a user of another tenant list nothing for it (FUX-04, ADR-0015).",
        "AC4: Given the service starts, when liveness and readiness are probed, then readiness reports `studio-notification-sql` and the messaging transport, and the metrics `connectsoft.factory.studio.notifications` by tenant, kind and channel and `connectsoft.factory.studio.notification_latency` by kind are emitted as modelled in model/services/factory-studio/StudioNotificationService.yaml (NFR-10)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "model/scenarios/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-420",
        "AIFACTORY-TASK-421",
        "AIFACTORY-TASK-422",
        "AIFACTORY-TASK-423",
        "AIFACTORY-TASK-424",
        "AIFACTORY-TASK-425",
        "AIFACTORY-TASK-426",
        "AIFACTORY-TASK-745",
        "AIFACTORY-TASK-5509",
        "AIFACTORY-TASK-5510",
        "AIFACTORY-TASK-5511"
      ],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioNotificationService",
          "StudioBff",
          "RunControlService"
        ],
        "aggregates": [
          "StudioNotificationService/Notification",
          "StudioNotificationService/NotificationPreference"
        ],
        "apis": [
          "StudioNotificationService/ListNotifications",
          "StudioNotificationService/MarkNotificationRead",
          "StudioNotificationService/SetNotificationPreferences",
          "StudioNotificationService/Notifications.Notify"
        ],
        "events": [
          "StudioNotificationService/NotificationCreated",
          "RunControlService/ApprovalRequested",
          "ReleaseService/ReleaseReady",
          "EnvironmentPromotionService/PromotionCompleted",
          "RuntimeEnvironmentService/ReconciliationProposed"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-04"
        ]
      },
      "relates": {
        "screens": [
          "my-work",
          "notification-preferences"
        ],
        "nfrs": [
          "NFR-01",
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1365",
        "AIFACTORY-US-1366",
        "AIFACTORY-US-1367",
        "AIFACTORY-US-1368",
        "feature:studio-bff",
        "feature:run-control-service",
        "feature:release-service",
        "feature:environment-promotion-service",
        "feature:runtime-environment-service",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "model/scenarios/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-035]",
      "number": 35
    },
    {
      "id": "AIFACTORY-TASK-420",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.StudioNotificationService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "14.02.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.StudioNotificationService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioNotificationService` with the Factory profile from the pinned template package is committed unchanged, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioNotificationService | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioNotificationService` with the Factory profile from the pinned template package is committed unchanged, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-420]",
      "number": 420
    },
    {
      "id": "AIFACTORY-TASK-421",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Domain model: Notification, NotificationPreference",
      "sequence": "14.02.01.02",
      "description": "Domain model: Notification, NotificationPreference. Expected output: The aggregates hold the fields and the invariants of the model: a notification exists only for a recipient confirmed by the permission check, it carries a summary with a reference and never content, and action-required and critical notifications ignore quiet hours for the in-app channel while an info notification does not; unit tests cover every invariant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregates hold the fields and the invariants of the model: a notification exists only for a recipient confirmed by the permission check, it carries a summary with a reference and never content, and action-required and critical notifications ignore quiet hours for the in-app channel while an info notification does not; unit tests cover every invariant."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-421]",
      "number": 421
    },
    {
      "id": "AIFACTORY-TASK-422",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Persistence in studio-notification-sql: Notifications, NotificationPreferences",
      "sequence": "14.02.01.03",
      "description": "Persistence in studio-notification-sql: Notifications, NotificationPreferences. Expected output: Mappings and migrations for the two modelled tables with the tenant filter, the index IX_Notifications_User_Unread and the key of NotificationPreferences on UserId and TenantId, and the removal of notifications older than Studio:Notifications:RetentionDays; mapping tests run against an isolated test database, never a shared one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the two modelled tables with the tenant filter, the index IX_Notifications_User_Unread and the key of NotificationPreferences on UserId and TenantId, and the removal of notifications older than Studio:Notifications:RetentionDays; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-422]",
      "number": 422
    },
    {
      "id": "AIFACTORY-TASK-423",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "API hosting skeleton: 3 REST and 1 gRPC operations with scope enforcement, problem responses and contract documents",
      "sequence": "14.02.01.04",
      "description": "API hosting skeleton: 3 REST and 1 gRPC operations with scope enforcement, problem responses and contract documents. Expected output: ListNotifications, MarkNotificationRead and SetNotificationPreferences are hosted with JWT validation of the user token StudioBff forwards with its own audience and the scope factory.studio.use, and Notifications.Notify with the workload token check of the service scope of StudioNotificationService, with problem responses for every modelled refusal and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-1366 to AIFACTORY-US-1368, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "ListNotifications, MarkNotificationRead and SetNotificationPreferences are hosted with JWT validation of the user token StudioBff forwards with its own audience and the scope factory.studio.use, and Notifications.Notify with the workload token check of the service scope of StudioNotificationService, with problem responses for every modelled refusal and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-1366 to AIFACTORY-US-1368, not here."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-423]",
      "number": 423
    },
    {
      "id": "AIFACTORY-TASK-424",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Messaging skeleton: outbox of NotificationCreated and inbox of 4 of the 17 consumed events",
      "sequence": "14.02.01.05",
      "description": "Messaging skeleton: outbox of NotificationCreated and inbox of 4 of the 17 consumed events. Expected output: The outbox writer enlists in the transaction of each notification and the dispatcher publishes NotificationCreated under the canonical envelope; the inbox registers, with idempotency on the event id, the handlers of ApprovalRequested, ReleaseReady, PromotionCompleted and ReconciliationProposed, and none for AttemptDecisionRequested, FindingRaised, ToolEffectUncertain and DeliveryFailed, which NotificationKind cannot name, nor for the nine events whose producers arrive in I4 to I7.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of each notification and the dispatcher publishes NotificationCreated under the canonical envelope; the inbox registers, with idempotency on the event id, the handlers of ApprovalRequested, ReleaseReady, PromotionCompleted and ReconciliationProposed, and none for AttemptDecisionRequested, FindingRaised, ToolEffectUncertain and DeliveryFailed, which NotificationKind cannot name, nor for the nine events whose producers arrive in I4 to I7."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-424]",
      "number": 424
    },
    {
      "id": "AIFACTORY-TASK-425",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Worker hosting: FanOut and Digester with their triggers, partitioning and retry policies",
      "sequence": "14.02.01.06",
      "description": "Worker hosting: FanOut and Digester with their triggers, partitioning and retry policies. Expected output: The modelled trigger of FanOut names only AlertFired of AlertRuleService, which arrives in I4; as an assumption of I3, reported as an open question, FanOut is started by each of the four registered inbox handlers, with the retry policy exponential (5 attempts, 30 s backoff), at most eight in parallel partitioned by TenantId and the idempotency key eventId plus userId; Digester runs every hour with the policy fixed (2 attempts, 300 s), at most four in parallel and the key userId plus window; a duplicate trigger has no second effect.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The modelled trigger of FanOut names only AlertFired of AlertRuleService, which arrives in I4; as an assumption of I3, reported as an open question, FanOut is started by each of the four registered inbox handlers, with the retry policy exponential (5 attempts, 30 s backoff), at most eight in parallel partitioned by TenantId and the idempotency key eventId plus userId; Digester runs every hour with the policy fixed (2 attempts, 300 s), at most four in parallel and the key userId plus window; a duplicate trigger has no second effect."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-425]",
      "number": 425
    },
    {
      "id": "AIFACTORY-TASK-426",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Security, tenancy and telemetry of StudioNotificationService",
      "sequence": "14.02.01.07",
      "description": "Security, tenancy and telemetry of StudioNotificationService. Expected output: Scopes and roles of the model are enforced, every query is filtered by tenant and user, the workload token of the service carries the service scope that names ProjectService for the recipient confirmation, the service holds no secret beyond its references, and the metrics notifications and notification_latency, traces and health checks follow the observability conventions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every query is filtered by tenant and user, the workload token of the service carries the service scope that names ProjectService for the recipient confirmation, the service holds no secret beyond its references, and the metrics notifications and notification_latency, traces and health checks follow the observability conventions."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-426]",
      "number": 426
    },
    {
      "id": "AIFACTORY-TASK-745",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Verify studio-notifications by running the scenario acceptance suite",
      "sequence": "14.02.01.08",
      "description": "Verify studio-notifications by running the scenario acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-StudioNotificationService\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.StudioNotificationService; a filter that discovers no test counts as a failure; it passes and proves the scenario part of AC1 of AIFACTORY-US-035, a passing test for each of SCN-StudioNotificationService-001 to SCN-StudioNotificationService-005.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-StudioNotificationService\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.StudioNotificationService; a filter that discovers no test counts as a failure; it passes and proves the scenario part of AC1 of AIFACTORY-US-035, a passing test for each of SCN-StudioNotificationService-001 to SCN-StudioNotificationService-005."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-745]",
      "number": 745
    },
    {
      "id": "AIFACTORY-TASK-5509",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Verify the build, the single scaffold, the template version and the published image of StudioNotificationService",
      "sequence": "14.02.01.09",
      "description": "Verify the build, the single scaffold, the template version and the published image of StudioNotificationService. Expected output: A pipeline run of ConnectSoft.AI.SoftwareFactory.StudioNotificationService on its main branch passes `dotnet build -c Release` and `dotnet test -c Release --no-build`, its run record names the recorded template version and the digest of the published container image, and the repository history holds one scaffold commit; that record is the evidence of the build, scaffold and publication part of AC1 of AIFACTORY-US-035.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "A pipeline run of ConnectSoft.AI.SoftwareFactory.StudioNotificationService on its main branch passes `dotnet build -c Release` and `dotnet test -c Release --no-build`, its run record names the recorded template version and the digest of the published container image, and the repository history holds one scaffold commit; that record is the evidence of the build, scaffold and publication part of AC1 of AIFACTORY-US-035."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5509]",
      "number": 5509
    },
    {
      "id": "AIFACTORY-TASK-5510",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Verify the inbox registrations, readiness and metrics of StudioNotificationService",
      "sequence": "14.02.01.10",
      "description": "Verify the inbox registrations, readiness and metrics of StudioNotificationService. Expected output: Run `dotnet test -c Release --filter \"Category=Registration|Category=Telemetry\"`; a zero-match filter counts as a failure; the tests compare the inbox registrations with the four handlers of AC2 of AIFACTORY-US-035 against model/services/factory-studio/StudioNotificationService.yaml and check readiness and the two metrics with their dimensions, proving AC2 and AC4.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Registration|Category=Telemetry\"`; a zero-match filter counts as a failure; the tests compare the inbox registrations with the four handlers of AC2 of AIFACTORY-US-035 against model/services/factory-studio/StudioNotificationService.yaml and check readiness and the two metrics with their dimensions, proving AC2 and AC4."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5510]",
      "number": 5510
    },
    {
      "id": "AIFACTORY-TASK-5511",
      "type": "task",
      "parent": "AIFACTORY-US-035",
      "title": "Verify the end-to-end path from an approval request to a notification read through StudioBff",
      "sequence": "14.02.01.11",
      "description": "Verify the end-to-end path from an approval request to a notification read through StudioBff. Expected output: Run `dotnet test -c Release --filter \"Category=EndToEnd\"` against a deployed I3 instance with StudioBff, RunControlService behind ControlPlaneApi and this service; a zero-match filter counts as a failure; the test submits a run through StudioBff that reaches an approval, waits for RunControlService/ApprovalRequested, lists and marks the notification read through the routes StudioBff fronts from two devices of the reviewer and checks that the requester and a user of another tenant list nothing, proving AC3 of AIFACTORY-US-035.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=EndToEnd\"` against a deployed I3 instance with StudioBff, RunControlService behind ControlPlaneApi and this service; a zero-match filter counts as a failure; the test submits a run through StudioBff that reaches an approval, waits for RunControlService/ApprovalRequested, lists and marks the notification read through the routes StudioBff fronts from two devices of the reviewer and checks that the requester and a user of another tenant list nothing, proving AC3 of AIFACTORY-US-035."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5511]",
      "number": 5511
    },
    {
      "id": "AIFACTORY-US-1365",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-073",
      "title": "Turn a platform event into notifications for the users whose role and scope allow it",
      "sequence": "14.02.02",
      "description": "As a reviewer, I want a notification when an approval waits for my role in my project, and none for what I may not see, so that I act on what needs me without anyone outside my scope learning of it. The inbox of StudioNotificationService consumes four platform events published in I1 to I3, each idempotent on its event id, and the worker `FanOut` turns each into notifications. The modelled trigger of `FanOut` names only `AlertFired` of AlertRuleService, which arrives in I4; as an assumption of I3, reported as an open question, the four registered handlers start `FanOut`. `ApprovalRequested` of RunControlService (handler NotifyProject) creates ApprovalWaiting, of importance action-required: for a request of kind approval the recipients are the members holding the role of its `approverRule` in the project of the envelope, less the requester of the run, who may not approve the run they requested (ADR-0015 separation of duties); for a request of kind operator-decision the recipients are the Operators of the project and the requester of the run, the two who may take that decision (D119). `ReleaseReady` of ReleaseService and `PromotionCompleted` of EnvironmentPromotionService (NotifyProject) create ReleaseReady and PromotionCompleted, of importance info, for the members of the project; `ReconciliationProposed` of RuntimeEnvironmentService (NotifyOperators) creates ReconciliationProposed, of importance action-required, for the Operators of the project. The tenant and the project come from the canonical envelope (ADR-0014). No modelled operation lists the members of a project by role for a workload caller: as an assumption reported as an open question, the candidates are read from the memberships that `ProjectService/GetProject` returns and the requester of a run from `RunControlService/GetRun`, both through ControlPlaneApi with the workload token of the service. Every candidate is then confirmed through `ProjectService/Projects.ResolveScope`, called with the workload token of StudioNotificationService holding the service scope that names ProjectService (D114), the tenant and project of the envelope, the candidate as `callerId` with `callerKind` user and the active platform policy revision, whose source for a caller that is not a run the model does not name (open question); a notification is created only for a user whose scope and role allow seeing the subject, never from the event alone. Each `Notification` holds the kind, the subject reference, the project, the importance and a summary, never the content, and is written with its `NotificationCreated` outbox record in one transaction, idempotent on the event id and the user id, so a redelivered event adds none; an info notification that falls in the quiet hours of its user follows AIFACTORY-US-1367. The subject of an approval request is named as a kind and an id (D135), and in I3 `ApprovalRequested` names a run. When recipient resolution is unavailable, `FanOut` retries under its exponential policy and the event stays unhandled in the inbox; no notification is created without a permission check. Kind: behavior. Traces: services: StudioNotificationService, ControlPlaneApi, ProjectService, RunControlService; aggregates: StudioNotificationService/Notification; apis: ProjectService/Projects.ResolveScope, ProjectService/GetProject, RunControlService/GetRun; events: StudioNotificationService/NotificationCreated, RunControlService/ApprovalRequested, ReleaseService/ReleaseReady, EnvironmentPromotionService/PromotionCompleted, RuntimeEnvironmentService/ReconciliationProposed; descriptors: execution-scope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: FUX-04, XL-05; scenarios: SCN-StudioNotificationService-005. Relates: screens: approvals-list; nfrs: NFR-01. Depends on: feature:control-plane-api, feature:project-service, feature:run-control-service, feature:release-service, feature:environment-promotion-service, feature:runtime-environment-service. Sources: model/services/factory-studio/StudioNotificationService.yaml, model/services/control-plane/ProjectService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given `RunControlService/ApprovalRequested` of kind approval for a run of a project whose approver rule names the role Reviewer, two reviewers, one of whom requested the run, and members of another project, when `FanOut` handles it, then the reviewer who did not request the run, confirmed through `ProjectService/Projects.ResolveScope` called with the workload token of the service and `callerKind` user, receives one `StudioNotificationService/Notification` of kind ApprovalWaiting and importance action-required naming the approval request and its subject as a kind and an id (D135), the requesting reviewer and the members of the other project receive none, and the notification is written with its `StudioNotificationService/NotificationCreated` outbox record in one transaction (ADR-0015, D114).",
        "AC2: Given `RunControlService/ApprovalRequested` of kind operator-decision, when `FanOut` handles it, then the Operators of the project and the requester of the run, read through `RunControlService/GetRun`, each receive one ApprovalWaiting notification of importance action-required after the permission check, and no other member receives one (D119).",
        "AC3: Given `ReleaseService/ReleaseReady` or `EnvironmentPromotionService/PromotionCompleted` consumed for a project, or `RuntimeEnvironmentService/ReconciliationProposed`, when `FanOut` handles it, then notifications of the kind of the same name are created, of importance info for the members of the project and of importance action-required for its Operators respectively, only after the permission check, and the same event delivered twice creates no second notification for any user (SCN-StudioNotificationService-005).",
        "AC4: Given recipient resolution through ControlPlaneApi is unavailable, when `FanOut` handles a consumed event, then it retries under its exponential policy, no notification is created without a permission check, and after resolution returns the event creates its notifications once (model/services/factory-studio/StudioNotificationService.yaml).",
        "AC5: Given a notification was created, when the outbox dispatcher publishes `StudioNotificationService/NotificationCreated` on `studio.notifications.v1.notification-created`, then the event is sent under the canonical envelope with `notificationId`, `tenantId`, `userId`, `kind` and `importance`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-StudioNotificationService-005, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-522",
        "AIFACTORY-TASK-5491",
        "AIFACTORY-TASK-5492"
      ],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11302,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioNotificationService",
          "ControlPlaneApi",
          "ProjectService",
          "RunControlService"
        ],
        "aggregates": [
          "StudioNotificationService/Notification"
        ],
        "apis": [
          "ProjectService/Projects.ResolveScope",
          "ProjectService/GetProject",
          "RunControlService/GetRun"
        ],
        "events": [
          "StudioNotificationService/NotificationCreated",
          "RunControlService/ApprovalRequested",
          "ReleaseService/ReleaseReady",
          "EnvironmentPromotionService/PromotionCompleted",
          "RuntimeEnvironmentService/ReconciliationProposed"
        ],
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04",
          "XL-05"
        ],
        "scenarios": [
          "SCN-StudioNotificationService-005"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "feature:control-plane-api",
        "feature:project-service",
        "feature:run-control-service",
        "feature:release-service",
        "feature:environment-promotion-service",
        "feature:runtime-environment-service"
      ],
      "source": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1365]",
      "number": 1365
    },
    {
      "id": "AIFACTORY-TASK-522",
      "type": "task",
      "parent": "AIFACTORY-US-1365",
      "title": "Fan-out from consumed events by role and scope",
      "sequence": "14.02.02.01",
      "description": "Fan-out from consumed events by role and scope. Expected output: Each of the four registered events becomes notifications for the users its handler names (NotifyProject, NotifyOperators) with the tenant and project of the envelope, the requester of the run excluded from an approval and included in an operator decision, the importance of each kind set (ApprovalWaiting and ReconciliationProposed action-required, ReleaseReady and PromotionCompleted info); every notification and its NotificationCreated outbox record share one transaction, keyed by event id and user id, so a repeated event adds none.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Each of the four registered events becomes notifications for the users its handler names (NotifyProject, NotifyOperators) with the tenant and project of the envelope, the requester of the run excluded from an approval and included in an operator decision, the importance of each kind set (ApprovalWaiting and ReconciliationProposed action-required, ReleaseReady and PromotionCompleted info); every notification and its NotificationCreated outbox record share one transaction, keyed by event id and user id, so a repeated event adds none."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-522]",
      "number": 522
    },
    {
      "id": "AIFACTORY-TASK-5491",
      "type": "task",
      "parent": "AIFACTORY-US-1365",
      "title": "Candidate lookup and recipient confirmation through Projects.ResolveScope with the workload token",
      "sequence": "14.02.02.02",
      "description": "Candidate lookup and recipient confirmation through Projects.ResolveScope with the workload token. Expected output: Typed clients behind ControlPlaneApi read the candidate members of the project from GetProject and the requester of a run from GetRun, and confirm every candidate through Projects.ResolveScope called with the workload token of the service and its service scope, the tenant and project of the envelope, the candidate as callerId with callerKind user and the active platform policy revision, before a notification is written; an approval subject is named as a kind and an id; an unavailable resolution fails the attempt so FanOut retries.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Typed clients behind ControlPlaneApi read the candidate members of the project from GetProject and the requester of a run from GetRun, and confirm every candidate through Projects.ResolveScope called with the workload token of the service and its service scope, the tenant and project of the envelope, the candidate as callerId with callerKind user and the active platform policy revision, before a notification is written; an approval subject is named as a kind and an id; an unavailable resolution fails the attempt so FanOut retries."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5491]",
      "number": 5491
    },
    {
      "id": "AIFACTORY-TASK-5492",
      "type": "task",
      "parent": "AIFACTORY-US-1365",
      "title": "Verify the fan-out through the acceptance suite",
      "sequence": "14.02.02.03",
      "description": "Verify the fan-out through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioNotificationService-005|Category=FanOut)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1365 with fake GetProject, GetRun and Projects.ResolveScope endpoints that record the workload token and the caller fields and can confirm, deny and be unavailable, including the publication and payload of NotificationCreated; consumer handling is proven by the suite of StudioRealtimeGateway.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioNotificationService-005|Category=FanOut)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1365 with fake GetProject, GetRun and Projects.ResolveScope endpoints that record the workload token and the caller fields and can confirm, deny and be unavailable, including the publication and payload of NotificationCreated; consumer handling is proven by the suite of StudioRealtimeGateway."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5492]",
      "number": 5492
    },
    {
      "id": "AIFACTORY-US-1366",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-073",
      "title": "List my notifications with unread counts and mark one read or dismissed",
      "sequence": "14.02.03",
      "description": "As an operator, I want my notifications with unread counts by importance, and to mark one read or dismissed, so that I see what is new and what is urgent, on every device I use. A signed-in user reaches StudioNotificationService through StudioBff, which fronts it on GW-02 and forwards the user token carrying `factory.studio.use` unchanged (D117). `StudioNotificationService/ListNotifications` returns the notifications of the caller, newest first, each with its kind, subject reference, importance, summary and read and dismissed state, together with the unread counts by importance (info, action-required, critical); notifications of other users and of other tenants never appear (ADR-0015), an info notification held by quiet hours appears once it is released (AIFACTORY-US-1367), and notifications older than `Studio:Notifications:RetentionDays` are gone. `StudioNotificationService/MarkNotificationRead` marks one notification of the caller read or dismissed by setting `readAt` or `dismissedAt`; the state is kept by the service, so it holds on every device of the user, a repeat changes nothing and keeps the first time, and no event is published. A notification that does not exist, that belongs to another user or that belongs to another tenant is answered 404 in each case, the same problem response that never confirms it exists (D113). When `studio-notification-sql` is unavailable both calls fail fast and nothing changes. The notification centre of the Studio lists the notifications, shows the counts and marks them read; the subject of a notification is opened through StudioBff under the permissions of the user, never from the notification. Kind: behavior. Traces: services: StudioNotificationService, StudioBff; aggregates: StudioNotificationService/Notification; apis: StudioNotificationService/ListNotifications, StudioNotificationService/MarkNotificationRead; adrs: ADR-0015; requirements: FUX-04; scenarios: SCN-StudioNotificationService-001, SCN-StudioNotificationService-002. Relates: screens: my-work; nfrs: NFR-01. Depends on: feature:studio-bff. Sources: model/services/factory-studio/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given notifications of the caller, of another user of the tenant and of another tenant, when `StudioNotificationService/ListNotifications` is called, then the response is 200 with only the caller's notifications, newest first, and the unread counts by importance, and nothing is written (SCN-StudioNotificationService-001, ADR-0015).",
        "AC2: Given an unread notification of the caller, when `StudioNotificationService/MarkNotificationRead` is called with read, then the response is 200, `readAt` is set, a list from another device of the same user shows it read, and a repeat changes nothing; dismissed sets `dismissedAt` the same way (SCN-StudioNotificationService-002).",
        "AC3: Given a `notificationId` that does not exist, one of another user and one of another tenant, when `StudioNotificationService/MarkNotificationRead` is called with each, then each is answered 404 with the same problem response and no state changes (SCN-StudioNotificationService-002, D113).",
        "AC4: Given `studio-notification-sql` is unavailable, when `StudioNotificationService/ListNotifications` is called, then the call fails fast with a problem response and no state changes (SCN-StudioNotificationService-001)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5493",
        "AIFACTORY-TASK-524",
        "AIFACTORY-TASK-5494"
      ],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11303,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioNotificationService",
          "StudioBff"
        ],
        "aggregates": [
          "StudioNotificationService/Notification"
        ],
        "apis": [
          "StudioNotificationService/ListNotifications",
          "StudioNotificationService/MarkNotificationRead"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04"
        ],
        "scenarios": [
          "SCN-StudioNotificationService-001",
          "SCN-StudioNotificationService-002"
        ]
      },
      "relates": {
        "screens": [
          "my-work"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "feature:studio-bff"
      ],
      "source": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1366]",
      "number": 1366
    },
    {
      "id": "AIFACTORY-TASK-5493",
      "type": "task",
      "parent": "AIFACTORY-US-1366",
      "title": "ListNotifications and MarkNotificationRead under the tenant and user filter",
      "sequence": "14.02.03.01",
      "description": "ListNotifications and MarkNotificationRead under the tenant and user filter. Expected output: ListNotifications returns the caller's released notifications newest first with unread counts by importance; MarkNotificationRead sets readAt or dismissedAt once and answers 404 alike for an absent notification, one of another user and one of another tenant; an unavailable store fails both calls fast.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "ListNotifications returns the caller's released notifications newest first with unread counts by importance; MarkNotificationRead sets readAt or dismissedAt once and answers 404 alike for an absent notification, one of another user and one of another tenant; an unavailable store fails both calls fast."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5493]",
      "number": 5493
    },
    {
      "id": "AIFACTORY-TASK-524",
      "type": "task",
      "parent": "AIFACTORY-US-1366",
      "title": "Notification centre in the Studio",
      "sequence": "14.02.03.02",
      "description": "Notification centre in the Studio. Expected output: The Studio lists the notifications of the user with the unread counts by importance, marks them read or dismissed through StudioBff and opens the subject of a notification under the permissions of the user.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "The Studio lists the notifications of the user with the unread counts by importance, marks them read or dismissed through StudioBff and opens the subject of a notification under the permissions of the user."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11303,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-524]",
      "number": 524
    },
    {
      "id": "AIFACTORY-TASK-5494",
      "type": "task",
      "parent": "AIFACTORY-US-1366",
      "title": "Verify the list and the read state through the acceptance suite",
      "sequence": "14.02.03.03",
      "description": "Verify the list and the read state through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioNotificationService-001|Scenario=SCN-StudioNotificationService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1366.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioNotificationService-001|Scenario=SCN-StudioNotificationService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1366."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5494]",
      "number": 5494
    },
    {
      "id": "AIFACTORY-US-1367",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-073",
      "title": "Choose my channels, quiet hours and digest, and receive grouped notices once",
      "sequence": "14.02.04",
      "description": "As an operator, I want to choose the channels per kind of notification, my quiet hours and a digest, so that I am reached the way I chose, and urgent work still reaches me in the Studio. A signed-in user reaches the service through StudioBff with the user token carrying `factory.studio.use` and sets the `NotificationPreference` of the user in the trusted tenant through `StudioNotificationService/SetNotificationPreferences`: the channels per `NotificationKind` (InApp is always on; Email and Chat are optional), the quiet hours and the digest (none, hourly or daily). Repeating the same preferences changes nothing and no event is published; when `studio-notification-sql` is unavailable the call fails fast and the preferences stay as they were. Later notifications follow the preference. During quiet hours an action-required or critical notification is delivered in-app at once, because those ignore quiet hours for the in-app channel (invariant of `NotificationPreference`), while the in-app delivery of an info notification is held until quiet hours end. The model names no worker that releases a held delivery, nor whether `NotificationCreated` follows the creation or the release; as an assumption reported as an open question, the info notification is written with its in-app delivery recorded as held, left out of `ListNotifications` and the unread counts, and released by the first `Digester` run after the quiet hours end, which records the in-app delivery and writes the `NotificationCreated` outbox record in the transaction of the release, idempotent on the notification id. The worker `Digester` runs every hour and, for each user with an hourly or daily digest whose window has ended, groups the unread notifications of the window once, idempotent on the user id and the window, and records the digest delivery in `deliveries` of each grouped notification. Email and chat go through ConnectorRegistryService, an optional dependency in degrade mode whose outbound delivery `Connectors.Deliver` arrives with its complete delivery in I5; in I3 every delivery through those channels, the email of a notification and a digest alike, is recorded as not made, with the reason that the channel is unavailable, and the in-app notification stands. The preferences screen of the Studio edits them. Kind: behavior. Traces: services: StudioNotificationService, ConnectorRegistryService; aggregates: StudioNotificationService/NotificationPreference, StudioNotificationService/Notification; apis: StudioNotificationService/SetNotificationPreferences; events: StudioNotificationService/NotificationCreated; requirements: FUX-04; scenarios: SCN-StudioNotificationService-003. Relates: screens: notification-preferences. Depends on: feature:studio-bff. Sources: model/services/factory-studio/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.studio.use`, when `StudioNotificationService/SetNotificationPreferences` is called with Email for ApprovalWaiting and ReleaseReady, quiet hours and an hourly digest, then the response is 200, the `StudioNotificationService/NotificationPreference` holds them with InApp on for every kind, and a repeat changes nothing (SCN-StudioNotificationService-003).",
        "AC2: Given quiet hours in force and Email chosen for both kinds, when an action-required notification and an info notification are created for the user, then the action-required notification is delivered in-app at once with its `StudioNotificationService/NotificationCreated`, the in-app delivery of the info notification is held until quiet hours end and is then released by `Digester` with its `NotificationCreated`, and in I3 the email delivery of both is recorded as not made with the reason that the channel is unavailable (SCN-StudioNotificationService-003).",
        "AC3: Given a user with an hourly digest and unread notifications in the window, when `Digester` runs after the window ended and runs again for the same window, then the notifications are grouped once and the digest delivery is recorded once in their `deliveries`, as not made with the reason that the channel is unavailable while `Connectors.Deliver` is not delivered (model/services/factory-studio/StudioNotificationService.yaml).",
        "AC4: Given `studio-notification-sql` is unavailable, when `StudioNotificationService/SetNotificationPreferences` is called, then the call fails fast with a problem response and the preferences stay as they were (SCN-StudioNotificationService-003)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5495",
        "AIFACTORY-TASK-523",
        "AIFACTORY-TASK-5496"
      ],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11304,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioNotificationService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "StudioNotificationService/NotificationPreference",
          "StudioNotificationService/Notification"
        ],
        "apis": [
          "StudioNotificationService/SetNotificationPreferences"
        ],
        "events": [
          "StudioNotificationService/NotificationCreated"
        ],
        "requirements": [
          "FUX-04"
        ],
        "scenarios": [
          "SCN-StudioNotificationService-003"
        ]
      },
      "relates": {
        "screens": [
          "notification-preferences"
        ]
      },
      "dependsOn": [
        "feature:studio-bff"
      ],
      "source": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-1367]",
      "number": 1367
    },
    {
      "id": "AIFACTORY-TASK-5495",
      "type": "task",
      "parent": "AIFACTORY-US-1367",
      "title": "SetNotificationPreferences with InApp always on and the quiet-hours rule",
      "sequence": "14.02.04.01",
      "description": "SetNotificationPreferences with InApp always on and the quiet-hours rule. Expected output: SetNotificationPreferences writes channels per kind, quiet hours and digest for the user in the trusted tenant with InApp kept on for every kind; deliveries consult the preference, an action-required or critical notification is delivered in-app at once during quiet hours, and the in-app delivery of an info notification is recorded as held; an unavailable store fails the call fast.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "SetNotificationPreferences writes channels per kind, quiet hours and digest for the user in the trusted tenant with InApp kept on for every kind; deliveries consult the preference, an action-required or critical notification is delivered in-app at once during quiet hours, and the in-app delivery of an info notification is recorded as held; an unavailable store fails the call fast."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5495]",
      "number": 5495
    },
    {
      "id": "AIFACTORY-TASK-523",
      "type": "task",
      "parent": "AIFACTORY-US-1367",
      "title": "Release of held deliveries, grouping and digest",
      "sequence": "14.02.04.02",
      "description": "Release of held deliveries, grouping and digest. Expected output: The Digester releases each held in-app delivery once quiet hours ended, with the NotificationCreated outbox record in the transaction of the release and idempotent on the notification id, groups the unread notifications of each ended hourly or daily window once per user and window, records the digest delivery in the deliveries of each grouped notification, and records every email or chat delivery as not made with the reason that the channel is unavailable while Connectors.Deliver of ConnectorRegistryService is not delivered.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "The Digester releases each held in-app delivery once quiet hours ended, with the NotificationCreated outbox record in the transaction of the release and idempotent on the notification id, groups the unread notifications of each ended hourly or daily window once per user and window, records the digest delivery in the deliveries of each grouped notification, and records every email or chat delivery as not made with the reason that the channel is unavailable while Connectors.Deliver of ConnectorRegistryService is not delivered."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-523]",
      "number": 523
    },
    {
      "id": "AIFACTORY-TASK-5496",
      "type": "task",
      "parent": "AIFACTORY-US-1367",
      "title": "Verify preferences, quiet hours and digests through the acceptance suite",
      "sequence": "14.02.04.03",
      "description": "Verify preferences, quiet hours and digests through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioNotificationService-003|Category=Digester)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1367, including the held and released info notification and the second Digester run without effect.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-StudioNotificationService-003|Category=Digester)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1367, including the held and released info notification and the second Digester run without effect."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5496]",
      "number": 5496
    },
    {
      "id": "AIFACTORY-US-1368",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-073",
      "title": "Create a guaranteed in-app notice for the recipients of a subject on the call of a platform",
      "sequence": "14.02.05",
      "description": "A platform that needs a guaranteed in-app notice calls the internal gRPC method `StudioNotificationService/Notifications.Notify` with its workload token and a `run-event-v1` that names the subject, its tenant and project and the event id; AlertRuleService is the modelled caller and arrives in I4, so in I3 the method is delivered and proven with a test caller. The method declares no scope of its own, so it takes the service scope of StudioNotificationService (D135), and the service reads the tenant and project the workload forwards only because the token holds that scope (D114). The candidate recipients are the members of the project of the request who hold the role the subject implies, the Operators of the project for an alert, read from the memberships of `ProjectService/GetProject` under the assumption of AIFACTORY-US-1365; each is confirmed through `ProjectService/Projects.ResolveScope`, called with the workload token of StudioNotificationService and its service scope, the tenant and project of the request, the candidate as `callerId` with `callerKind` user and the active platform policy revision. The service writes one `Notification` per confirmed recipient with its `NotificationCreated` outbox record in one transaction, idempotent on the event id and the user id; the reply carries `ack-v1`, and a repeated call for the same event creates no second notification and returns the same acknowledgement, so the shared-write side effect happens once. A caller without a workload token is refused with UNAUTHENTICATED, a workload token without the service scope of StudioNotificationService with PERMISSION_DENIED (D114, D135) and a request that fails validation with INVALID_ARGUMENT; a project the resolution does not find in the tenant of the request is answered NOT_FOUND, alike for a project of another tenant (D113). When recipient resolution is unavailable the call fails fast and nothing is written, because no notification is created without a permission check. Kind: behavior. Traces: services: StudioNotificationService, ControlPlaneApi, ProjectService; aggregates: StudioNotificationService/Notification; apis: StudioNotificationService/Notifications.Notify, ProjectService/Projects.ResolveScope, ProjectService/GetProject; events: StudioNotificationService/NotificationCreated; descriptors: run-event-v1, ack-v1, execution-scope-v1; adrs: ADR-0015; requirements: XL-06; scenarios: SCN-StudioNotificationService-004. Depends on: feature:control-plane-api, feature:project-service. Sources: model/services/factory-studio/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller whose workload token holds the service scope of StudioNotificationService and a valid `run-event-v1` for a subject with two eligible recipients, when `StudioNotificationService/Notifications.Notify` is called, then each candidate is confirmed through `ProjectService/Projects.ResolveScope` with the workload token of the service and `callerKind` user, two `StudioNotificationService/Notification` rows are written, each with its `StudioNotificationService/NotificationCreated` outbox record in one transaction, and the reply carries `ack-v1` (SCN-StudioNotificationService-004, D114).",
        "AC2: Given the same call repeated for the same event id, when `StudioNotificationService/Notifications.Notify` is called again, then no second notification is created for either recipient and the same acknowledgement is returned (SCN-StudioNotificationService-004, XL-06).",
        "AC3: Given a caller without a workload token, a workload token without the service scope of StudioNotificationService, an invalid request or a project of another tenant, when `StudioNotificationService/Notifications.Notify` is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, the last alike for an unknown project, and nothing is written (SCN-StudioNotificationService-004, D113, D135).",
        "AC4: Given recipient resolution through `ProjectService/Projects.ResolveScope` is unavailable, when `StudioNotificationService/Notifications.Notify` is called, then the call fails fast with the matching gRPC status and no notification is created (SCN-StudioNotificationService-004)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5497",
        "AIFACTORY-TASK-5498"
      ],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11305,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioNotificationService",
          "ControlPlaneApi",
          "ProjectService"
        ],
        "aggregates": [
          "StudioNotificationService/Notification"
        ],
        "apis": [
          "StudioNotificationService/Notifications.Notify",
          "ProjectService/Projects.ResolveScope",
          "ProjectService/GetProject"
        ],
        "events": [
          "StudioNotificationService/NotificationCreated"
        ],
        "descriptors": [
          "run-event-v1",
          "ack-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "XL-06"
        ],
        "scenarios": [
          "SCN-StudioNotificationService-004"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:control-plane-api",
        "feature:project-service"
      ],
      "source": [
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/planes/experience/studio/services/studio-notification-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-1368]",
      "number": 1368
    },
    {
      "id": "AIFACTORY-TASK-5497",
      "type": "task",
      "parent": "AIFACTORY-US-1368",
      "title": "Notifications.Notify with the service scope check, recipient confirmation and the idempotent write",
      "sequence": "14.02.05.01",
      "description": "Notifications.Notify with the service scope check, recipient confirmation and the idempotent write. Expected output: Notifications.Notify checks that the workload token holds the service scope of StudioNotificationService, validates the run-event-v1 request, reads the candidates from GetProject, confirms each through Projects.ResolveScope with the workload token of the service and callerKind user, and writes one notification per recipient with its NotificationCreated outbox record, idempotent on event id and user id, replying ack-v1; UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND refusals and the fail-fast resolution write nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Notifications.Notify checks that the workload token holds the service scope of StudioNotificationService, validates the run-event-v1 request, reads the candidates from GetProject, confirms each through Projects.ResolveScope with the workload token of the service and callerKind user, and writes one notification per recipient with its NotificationCreated outbox record, idempotent on event id and user id, replying ack-v1; UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND refusals and the fail-fast resolution write nothing."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11305,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5497]",
      "number": 5497
    },
    {
      "id": "AIFACTORY-TASK-5498",
      "type": "task",
      "parent": "AIFACTORY-US-1368",
      "title": "Verify Notifications.Notify through the acceptance suite",
      "sequence": "14.02.05.02",
      "description": "Verify Notifications.Notify through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioNotificationService-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1368 with test callers whose workload token holds or lacks the service scope and fake GetProject and Projects.ResolveScope endpoints.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioNotificationService-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1368 with test callers whose workload token holds or lacks the service scope and fake GetProject and Projects.ResolveScope endpoints."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioNotificationService"
      ],
      "children": [],
      "buildOrder": 113,
      "phase": "factory",
      "stackRank": 11305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5498]",
      "number": 5498
    },
    {
      "id": "AIFACTORY-FEAT-074",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "StudioRealtimeGateway: complete delivery",
      "sequence": "14.03",
      "description": "StudioRealtimeGateway is the edge service of bounded context BC-29 (Experience Composition). The SignalR hub that pushes projection updates, notifications and run events to Studio sessions — subscriptions per session bounded by its scope, backed by the platforms' gRPC streams (operations projections, run events) and StudioNotificationService; an edge service that deploys alone (ADR-0028, BC-29). Its own repository is ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway. Delivers: StudioRealtimeGateway (complete). Stubbed in this increment: DashboardService (contract-stub, completed in I4). Increment I3: Studio. Build order 114 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-036",
        "AIFACTORY-US-1369",
        "AIFACTORY-US-1370",
        "AIFACTORY-US-1371",
        "AIFACTORY-US-1372"
      ],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11400,
      "titlePrefix": "[AIFACTORY-FEAT-074]",
      "number": 74
    },
    {
      "id": "AIFACTORY-US-036",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-074",
      "title": "Live updates reach only the sessions allowed to see them",
      "sequence": "14.03.01",
      "description": "As a requester, I want live updates of the runs, notifications and shared views I am looking at, so that the screen stays current, and nobody receives updates outside their scope. This is the integration PBI of the feature. StudioRealtimeGateway is the edge service of bounded context BC-29 (Experience Composition) that deploys alone (ADR-0028): a SignalR hub that pushes run events, notifications and shared-view changes to Studio sessions, with one `RealtimeSubscription` per session and stream, bounded by the scope of the session and held in the shared cache with the Redis backplane of `Studio:Realtime:Backplane`, so a client that loses its replica reconnects to another. It owns no table and publishes no event. A subscription is created only after StudioBff confirmed that the session may read the subject, and its filter never widens the scope of the session. The server contract `Realtime.Subscribe` takes an `execution-scope-v1`, whose schema admits no stream kind, filter, session id or last sequence; as an assumption to be confirmed, those travel on the SignalR negotiation outside the modelled request, and StudioBff declares no operation for the confirmation of a session; both points are reported as open questions. In I3 the stream bridge takes its run source from the platform run stream `RunControlService/RunControl.WatchRun`, because DashboardService, whose `Operations.Subscribe` and `RunProjectionUpdated` the model names as the source of run lists, arrives in I4 (D130, D131); its client is built against a contract stub of that stream, and the streams whose source is not delivered in I3 are answered as unavailable. Of the five consumed events the inbox registers `NotificationCreated` of StudioNotificationService and `SavedViewChanged` of StudioBff; `RunProjectionUpdated` of DashboardService and `AlertFired` and `AlertResolved` of AlertRuleService arrive in I4 and are not registered in I3. The behaviour is delivered by AIFACTORY-US-1369 (subscription within the scope of the session and the run timeline), AIFACTORY-US-1370 (push of notifications and tenant-shared views), AIFACTORY-US-1371 (resume, backpressure and recovery) and AIFACTORY-US-1372 (health); this PBI proves the end-to-end paths that cross StudioBff, RunControlService and StudioNotificationService. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway, created by the repository checklist of feature `repository-and-pipeline-conventions` and scaffolded from the base template with the Factory profile. Kind: behavior. Traces: services: StudioRealtimeGateway, StudioBff, StudioNotificationService, RunControlService; aggregates: StudioRealtimeGateway/RealtimeSubscription; apis: StudioRealtimeGateway/Realtime.Subscribe, StudioRealtimeGateway/RealtimeHealth, RunControlService/RunControl.WatchRun, RunControlService/SubmitRun, StudioBff/ForwardCommand; events: StudioNotificationService/NotificationCreated, StudioBff/SavedViewChanged, RunControlService/ApprovalRequested; adrs: ADR-0014, ADR-0015, ADR-0028; requirements: FR-10, FUX-04. Relates: screens: run-detail, my-work; nfrs: NFR-01, NFR-10. Depends on: AIFACTORY-US-1369, AIFACTORY-US-1370, AIFACTORY-US-1371, AIFACTORY-US-1372, feature:run-control-service, feature:control-plane-api, feature:studio-bff, feature:studio-notification-service, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions. Sources: model/services/factory-studio/StudioRealtimeGateway.yaml, model/scenarios/StudioRealtimeGateway.yaml, docs/planes/experience/studio/services/studio-realtime-gateway/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway, whose first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway` with the Factory profile, when its pipeline runs with the work of this feature, then no second scaffold was run, the solution builds, the tests pass, the template version is recorded, a container image is published and both scenarios of model/scenarios/StudioRealtimeGateway.yaml have a passing test that names its id (ADR-0028).",
        "AC2: Given a deployed I3 instance with StudioBff, RunControlService behind ControlPlaneApi and this gateway, and a second session of the project that has the run-detail screen open with a RunTimeline subscription, when a run is submitted through `StudioBff/ForwardCommand` to `RunControlService/SubmitRun` and the second session subscribes to it, then each state change of the run appears live in the run-detail timeline of the second session through `RunControlService/RunControl.WatchRun`, without a reload, and a session of another tenant receives nothing (FUX-04, ADR-0015).",
        "AC3: Given the inbox of the service, when its registrations are listed, then `StudioNotificationService/NotificationCreated` and `StudioBff/SavedViewChanged` are registered with idempotency on the event id, no handler of an event whose producer arrives in I4 is registered, and the service publishes no event and owns no table (model/services/factory-studio/StudioRealtimeGateway.yaml).",
        "AC4: Given the service starts with two replicas and the Redis backplane, when it runs, then the secret `studio-signing` comes from a key-vault reference, every subscription is filtered by the tenant of its session, and the metrics `connectsoft.factory.studio.realtime_connections`, `connectsoft.factory.studio.realtime_push_latency` and `connectsoft.factory.studio.realtime_refreshes` are emitted as modelled (NFR-10, model/services/factory-studio/StudioRealtimeGateway.yaml).",
        "AC5: Given the same deployed instance with StudioNotificationService and a reviewer with an open session holding a Notifications subscription, when `RunControlService/ApprovalRequested` names the role of the reviewer in the project, then the reviewer's open session receives the push of `StudioNotificationService/NotificationCreated` without a reload, and the notification it names is listed and marked read through the routes StudioBff fronts (FUX-04, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "model/scenarios/StudioRealtimeGateway.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-427",
        "AIFACTORY-TASK-428",
        "AIFACTORY-TASK-429",
        "AIFACTORY-TASK-430",
        "AIFACTORY-TASK-431",
        "AIFACTORY-TASK-432",
        "AIFACTORY-TASK-748",
        "AIFACTORY-TASK-5512",
        "AIFACTORY-TASK-5513",
        "AIFACTORY-TASK-5514"
      ],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioRealtimeGateway",
          "StudioBff",
          "StudioNotificationService",
          "RunControlService"
        ],
        "aggregates": [
          "StudioRealtimeGateway/RealtimeSubscription"
        ],
        "apis": [
          "StudioRealtimeGateway/Realtime.Subscribe",
          "StudioRealtimeGateway/RealtimeHealth",
          "RunControlService/RunControl.WatchRun",
          "RunControlService/SubmitRun",
          "StudioBff/ForwardCommand"
        ],
        "events": [
          "StudioNotificationService/NotificationCreated",
          "StudioBff/SavedViewChanged",
          "RunControlService/ApprovalRequested"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-10",
          "FUX-04"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "my-work"
        ],
        "nfrs": [
          "NFR-01",
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1369",
        "AIFACTORY-US-1370",
        "AIFACTORY-US-1371",
        "AIFACTORY-US-1372",
        "feature:run-control-service",
        "feature:control-plane-api",
        "feature:studio-bff",
        "feature:studio-notification-service",
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "model/scenarios/StudioRealtimeGateway.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-036]",
      "number": 36
    },
    {
      "id": "AIFACTORY-TASK-427",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "14.03.01.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway` with the Factory profile from the pinned template package is committed unchanged, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway` with the Factory profile from the pinned template package is committed unchanged, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-427]",
      "number": 427
    },
    {
      "id": "AIFACTORY-TASK-428",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Domain model: RealtimeSubscription",
      "sequence": "14.03.01.02",
      "description": "Domain model: RealtimeSubscription. Expected output: The aggregate holds the fields and the invariants of the model: a subscription exists only after StudioBff confirmed the session may read the subject and its filter cannot widen the scope of the session, and a reconnect resumes from the last sequence while a gap beyond the buffer requests a full refresh; unit tests cover every invariant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The aggregate holds the fields and the invariants of the model: a subscription exists only after StudioBff confirmed the session may read the subject and its filter cannot widen the scope of the session, and a reconnect resumes from the last sequence while a gap beyond the buffer requests a full refresh; unit tests cover every invariant."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-428]",
      "number": 428
    },
    {
      "id": "AIFACTORY-TASK-429",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "API hosting skeleton: the SignalR hub, Realtime.Subscribe and RealtimeHealth",
      "sequence": "14.03.01.03",
      "description": "API hosting skeleton: the SignalR hub, Realtime.Subscribe and RealtimeHealth. Expected output: The SignalR hub accepts connections with JWT validation and the scope factory.studio.use and reads the stream kind, the filter, the session id and the last sequence from the SignalR negotiation, outside the modelled request, as an assumption to be confirmed; the server contract Realtime.Subscribe is hosted with execution-scope-v1 requests and run-event-envelope-v1 stream items and its proto document, and RealtimeHealth is hosted on GW-01 under factory.health.read; the behaviour of each operation is delivered by AIFACTORY-US-1369 and AIFACTORY-US-1372, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The SignalR hub accepts connections with JWT validation and the scope factory.studio.use and reads the stream kind, the filter, the session id and the last sequence from the SignalR negotiation, outside the modelled request, as an assumption to be confirmed; the server contract Realtime.Subscribe is hosted with execution-scope-v1 requests and run-event-envelope-v1 stream items and its proto document, and RealtimeHealth is hosted on GW-01 under factory.health.read; the behaviour of each operation is delivered by AIFACTORY-US-1369 and AIFACTORY-US-1372, not here."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-429]",
      "number": 429
    },
    {
      "id": "AIFACTORY-TASK-430",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Messaging skeleton: inbox of 2 of the 5 consumed events and no outbox",
      "sequence": "14.03.01.04",
      "description": "Messaging skeleton: inbox of 2 of the 5 consumed events and no outbox. Expected output: The inbox registers NotificationCreated of StudioNotificationService and SavedViewChanged of StudioBff with idempotency on the event id; RunProjectionUpdated, AlertFired and AlertResolved, whose producers arrive in I4, are not registered; the service has no outbox because it publishes no event.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The inbox registers NotificationCreated of StudioNotificationService and SavedViewChanged of StudioBff with idempotency on the event id; RunProjectionUpdated, AlertFired and AlertResolved, whose producers arrive in I4, are not registered; the service has no outbox because it publishes no event."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-430]",
      "number": 430
    },
    {
      "id": "AIFACTORY-TASK-431",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Worker hosting: StreamBridge with its retry policy, partitioning and idempotency key",
      "sequence": "14.03.01.05",
      "description": "Worker hosting: StreamBridge with its retry policy, partitioning and idempotency key. Expected output: StreamBridge is hosted with the retry policy exponential (10 attempts, 5 s backoff), at most sixteen in parallel partitioned by TenantId and the idempotency key subscriptionId plus sequence, so a duplicate upstream message is pushed once; its run source in I3 is RunControl.WatchRun and its client of Operations.Subscribe is a contract stub until I4.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StreamBridge is hosted with the retry policy exponential (10 attempts, 5 s backoff), at most sixteen in parallel partitioned by TenantId and the idempotency key subscriptionId plus sequence, so a duplicate upstream message is pushed once; its run source in I3 is RunControl.WatchRun and its client of Operations.Subscribe is a contract stub until I4."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-431]",
      "number": 431
    },
    {
      "id": "AIFACTORY-TASK-432",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Security, tenancy and telemetry of StudioRealtimeGateway",
      "sequence": "14.03.01.06",
      "description": "Security, tenancy and telemetry of StudioRealtimeGateway. Expected output: Scopes and roles of the model are enforced, every subscription is filtered by the tenant of its session, the secret studio-signing comes from a key-vault reference, the backplane is configured from Studio:Realtime:Backplane, and the three realtime metrics, traces and health checks follow the observability conventions.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Scopes and roles of the model are enforced, every subscription is filtered by the tenant of its session, the secret studio-signing comes from a key-vault reference, the backplane is configured from Studio:Realtime:Backplane, and the three realtime metrics, traces and health checks follow the observability conventions."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-432]",
      "number": 432
    },
    {
      "id": "AIFACTORY-TASK-748",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Verify studio-realtime-subscriptions by running the scenario acceptance suite",
      "sequence": "14.03.01.07",
      "description": "Verify studio-realtime-subscriptions by running the scenario acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-StudioRealtimeGateway\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway; a filter that discovers no test counts as a failure; it passes and proves the scenario part of AC1 of AIFACTORY-US-036, a passing test for SCN-StudioRealtimeGateway-001 and SCN-StudioRealtimeGateway-002.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario~SCN-StudioRealtimeGateway\"` in the pipeline of ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway; a filter that discovers no test counts as a failure; it passes and proves the scenario part of AC1 of AIFACTORY-US-036, a passing test for SCN-StudioRealtimeGateway-001 and SCN-StudioRealtimeGateway-002."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-748]",
      "number": 748
    },
    {
      "id": "AIFACTORY-TASK-5512",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Verify the build, the single scaffold, the template version and the published image of StudioRealtimeGateway",
      "sequence": "14.03.01.08",
      "description": "Verify the build, the single scaffold, the template version and the published image of StudioRealtimeGateway. Expected output: A pipeline run of ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway on its main branch passes `dotnet build -c Release` and `dotnet test -c Release --no-build`, its run record names the recorded template version and the digest of the published container image, and the repository history holds one scaffold commit; that record is the evidence of the build, scaffold and publication part of AC1 of AIFACTORY-US-036.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "A pipeline run of ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway on its main branch passes `dotnet build -c Release` and `dotnet test -c Release --no-build`, its run record names the recorded template version and the digest of the published container image, and the repository history holds one scaffold commit; that record is the evidence of the build, scaffold and publication part of AC1 of AIFACTORY-US-036."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5512]",
      "number": 5512
    },
    {
      "id": "AIFACTORY-TASK-5513",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Verify the inbox registrations, the secret, the tenant filter and the metrics of StudioRealtimeGateway",
      "sequence": "14.03.01.09",
      "description": "Verify the inbox registrations, the secret, the tenant filter and the metrics of StudioRealtimeGateway. Expected output: Run `dotnet test -c Release --filter \"Category=Registration|Category=Telemetry\"`; a zero-match filter counts as a failure; the tests compare the inbox registrations with model/services/factory-studio/StudioRealtimeGateway.yaml, check that no outbox and no table exist, the key-vault reference of studio-signing, the tenant filter of subscriptions on two replicas with the backplane and the three metrics, proving AC3 and AC4 of AIFACTORY-US-036.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Registration|Category=Telemetry\"`; a zero-match filter counts as a failure; the tests compare the inbox registrations with model/services/factory-studio/StudioRealtimeGateway.yaml, check that no outbox and no table exist, the key-vault reference of studio-signing, the tenant filter of subscriptions on two replicas with the backplane and the three metrics, proving AC3 and AC4 of AIFACTORY-US-036."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5513]",
      "number": 5513
    },
    {
      "id": "AIFACTORY-TASK-5514",
      "type": "task",
      "parent": "AIFACTORY-US-036",
      "title": "Verify the end-to-end run timeline and the approval notification push on a deployed instance",
      "sequence": "14.03.01.10",
      "description": "Verify the end-to-end run timeline and the approval notification push on a deployed instance. Expected output: Run `dotnet test -c Release --filter \"Category=EndToEnd\"` against a deployed I3 instance with StudioBff, RunControlService behind ControlPlaneApi, StudioNotificationService and this gateway; a zero-match filter counts as a failure; the tests submit a run through StudioBff ForwardCommand and watch it live in the run-detail timeline of a second session, and push the NotificationCreated of an approval to the open session of the reviewer, which lists and marks it read through StudioBff, proving AC2 and AC5 of AIFACTORY-US-036.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=EndToEnd\"` against a deployed I3 instance with StudioBff, RunControlService behind ControlPlaneApi, StudioNotificationService and this gateway; a zero-match filter counts as a failure; the tests submit a run through StudioBff ForwardCommand and watch it live in the run-detail timeline of a second session, and push the NotificationCreated of an approval to the open session of the reviewer, which lists and marks it read through StudioBff, proving AC2 and AC5 of AIFACTORY-US-036."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5514]",
      "number": 5514
    },
    {
      "id": "AIFACTORY-US-1369",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-074",
      "title": "Subscribe a session to a stream inside its scope and follow a run timeline live",
      "sequence": "14.03.02",
      "description": "As a requester, I want to subscribe the screen I look at to the stream of my run, so that each state change of the run reaches me without a reload, and a stream I may not read is refused. A Studio client connects to the SignalR hub of StudioRealtimeGateway with the user token carrying `factory.studio.use` and the id of its active Studio session, and for each stream the hub negotiates the subscription through the server contract `StudioRealtimeGateway/Realtime.Subscribe`. The modelled request of that method is an `execution-scope-v1`, which names the tenant and the project of the session and whose schema admits no other field; the `StreamKind`, the filter (run id, project, environment or product), the session id and the last sequence therefore travel on the SignalR negotiation outside the modelled request, an assumption to be confirmed and reported as an open question. The gateway asks StudioBff whether the session may read the subject and records a `RealtimeSubscription` with its filter, its upstream and `lastSequence` only after StudioBff confirmed it; the filter can never widen the scope of the session. StudioBff declares no gRPC method for that confirmation, so the call has no modelled StudioBff operation, it is proven against a fake, and the gap is recorded as an open question. In I3 the stream kinds RunTimeline, Notifications and SavedViews are served: a RunTimeline subscription makes the stream bridge open `RunControlService/RunControl.WatchRun` with a `run-ref-v1` for the run of the filter and the gateway's workload identity, and every `run-event-v1` it receives is pushed as a `run-event-envelope-v1` with the next sequence until the client unsubscribes, the run is terminal or the session ends. The kinds RunList and Approvals need the operations streams of DashboardService across a scope (I4), Alerts needs AlertRuleService (I4) and Rollout and Incident need the fleet services (I7); a subscription to any of them is answered UNAVAILABLE with the name of the missing source, and the screen shows that state. While StudioBff cannot be reached a new subscription is refused with UNAVAILABLE, because the confirmation is fail-fast, and the subscriptions already open keep receiving pushes. A missing or invalid token is refused with UNAUTHENTICATED; a token without `factory.studio.use`, a session StudioBff does not confirm or a filter that would widen the scope with PERMISSION_DENIED; an invalid negotiation with INVALID_ARGUMENT; and a run that does not exist or belongs to another tenant with NOT_FOUND, given alike for both (D113). A refused subscription records nothing. The side-effect class of the method is read. Kind: behavior. Traces: services: StudioRealtimeGateway, StudioBff, RunControlService; aggregates: StudioRealtimeGateway/RealtimeSubscription; apis: StudioRealtimeGateway/Realtime.Subscribe, RunControlService/RunControl.WatchRun; descriptors: execution-scope-v1, run-ref-v1, run-event-v1, run-event-envelope-v1; adrs: ADR-0015; requirements: FUX-04; scenarios: SCN-StudioRealtimeGateway-002. Relates: screens: run-detail; nfrs: NFR-01. Depends on: feature:run-control-service, feature:studio-bff. Sources: model/services/factory-studio/StudioRealtimeGateway.yaml, model/services/control-plane/RunControlService.yaml, docs/reference/schemas/execution-scope.schema.json, docs/planes/experience/studio/services/studio-realtime-gateway/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a session confirmed by StudioBff for a run in its project, when the hub negotiates a RunTimeline subscription through `StudioRealtimeGateway/Realtime.Subscribe` with the `execution-scope-v1` of the session and, on the SignalR negotiation, the stream kind, the run id and the session id, then a `StudioRealtimeGateway/RealtimeSubscription` is recorded with the filter and `lastSequence`, `RunControlService/RunControl.WatchRun` is opened for that run, and each `run-event-v1` is pushed as `run-event-envelope-v1` with an increasing sequence until the run is terminal or the client unsubscribes (SCN-StudioRealtimeGateway-002, FUX-04).",
        "AC2: Given a missing token, a token without `factory.studio.use`, a session StudioBff does not confirm, a filter wider than the scope of the session or a negotiation that fails validation, when `StudioRealtimeGateway/Realtime.Subscribe` is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED or INVALID_ARGUMENT and no subscription is recorded; while StudioBff cannot be reached a new subscription is refused with UNAVAILABLE and open subscriptions keep receiving pushes (SCN-StudioRealtimeGateway-002).",
        "AC3: Given a run that does not exist and a run of another tenant, when a RunTimeline subscription names each, then both are refused with NOT_FOUND, the status `RunControlService/RunControl.WatchRun` gives for both, and the answer never confirms that the foreign run exists (SCN-StudioRealtimeGateway-002, D113).",
        "AC4: Given the kinds RunList, Approvals, Alerts, Rollout and Incident, whose sources are not delivered in I3, when a session subscribes to one of them through `StudioRealtimeGateway/Realtime.Subscribe`, then the subscription is answered UNAVAILABLE with the name of the missing source, nothing is recorded, and the screen shows the stream as unavailable (SCN-StudioRealtimeGateway-002, FUX-04)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-525",
        "AIFACTORY-TASK-526",
        "AIFACTORY-TASK-5499",
        "AIFACTORY-TASK-5500"
      ],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11402,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioRealtimeGateway",
          "StudioBff",
          "RunControlService"
        ],
        "aggregates": [
          "StudioRealtimeGateway/RealtimeSubscription"
        ],
        "apis": [
          "StudioRealtimeGateway/Realtime.Subscribe",
          "RunControlService/RunControl.WatchRun"
        ],
        "descriptors": [
          "execution-scope-v1",
          "run-ref-v1",
          "run-event-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04"
        ],
        "scenarios": [
          "SCN-StudioRealtimeGateway-002"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "feature:run-control-service",
        "feature:studio-bff"
      ],
      "source": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-1369]",
      "number": 1369
    },
    {
      "id": "AIFACTORY-TASK-525",
      "type": "task",
      "parent": "AIFACTORY-US-1369",
      "title": "Hub with subscriptions bounded by the session scope",
      "sequence": "14.03.02.01",
      "description": "Hub with subscriptions bounded by the session scope. Expected output: A subscription is negotiated through Realtime.Subscribe with the execution-scope-v1 of the session and the stream kind, filter, session id and last sequence of the SignalR negotiation, recorded only after StudioBff confirmed the session for the subject, and refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND or UNAVAILABLE without a record; the filter cannot widen the scope of the session; an unreachable StudioBff refuses new subscriptions only.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "A subscription is negotiated through Realtime.Subscribe with the execution-scope-v1 of the session and the stream kind, filter, session id and last sequence of the SignalR negotiation, recorded only after StudioBff confirmed the session for the subject, and refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND or UNAVAILABLE without a record; the filter cannot widen the scope of the session; an unreachable StudioBff refuses new subscriptions only."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-525]",
      "number": 525
    },
    {
      "id": "AIFACTORY-TASK-526",
      "type": "task",
      "parent": "AIFACTORY-US-1369",
      "title": "Stream bridge from RunControl.WatchRun to the RunTimeline subscriptions",
      "sequence": "14.03.02.02",
      "description": "Stream bridge from RunControl.WatchRun to the RunTimeline subscriptions. Expected output: The bridge opens RunControl.WatchRun with run-ref-v1 for each run with an open RunTimeline subscription, pushes every run-event-v1 as run-event-envelope-v1 with the next sequence to the subscribed connections, ends at the terminal state of the run, passes NOT_FOUND through and answers the kinds whose source is not delivered in I3 with UNAVAILABLE naming the source.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "The bridge opens RunControl.WatchRun with run-ref-v1 for each run with an open RunTimeline subscription, pushes every run-event-v1 as run-event-envelope-v1 with the next sequence to the subscribed connections, ends at the terminal state of the run, passes NOT_FOUND through and answers the kinds whose source is not delivered in I3 with UNAVAILABLE naming the source."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-526]",
      "number": 526
    },
    {
      "id": "AIFACTORY-TASK-5499",
      "type": "task",
      "parent": "AIFACTORY-US-1369",
      "title": "Fakes of the session confirmation of StudioBff and of RunControl.WatchRun",
      "sequence": "14.03.02.03",
      "description": "Fakes of the session confirmation of StudioBff and of RunControl.WatchRun. Expected output: The acceptance suite holds a fake session confirmation, standing for the StudioBff operation the model does not declare, that answers confirmed, refused and unavailable, and a fake RunControl.WatchRun endpoint that streams run-event-v1 items, ends at a terminal state, drops on demand and answers NOT_FOUND for an unknown and a foreign run.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake session confirmation, standing for the StudioBff operation the model does not declare, that answers confirmed, refused and unavailable, and a fake RunControl.WatchRun endpoint that streams run-event-v1 items, ends at a terminal state, drops on demand and answers NOT_FOUND for an unknown and a foreign run."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11402,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5499]",
      "number": 5499
    },
    {
      "id": "AIFACTORY-TASK-5500",
      "type": "task",
      "parent": "AIFACTORY-US-1369",
      "title": "Verify subscriptions and the run timeline through the acceptance suite",
      "sequence": "14.03.02.04",
      "description": "Verify subscriptions and the run timeline through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioRealtimeGateway-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1369 against the fakes of AIFACTORY-TASK-5499.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioRealtimeGateway-002\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1369 against the fakes of AIFACTORY-TASK-5499."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5500]",
      "number": 5500
    },
    {
      "id": "AIFACTORY-US-1370",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-074",
      "title": "Push a new notification and a changed tenant-shared view to the sessions allowed to see them",
      "sequence": "14.03.03",
      "description": "As a reviewer, I want a new notification and a changed shared view to appear in my open Studio without a reload, so that I see an approval waiting for me as soon as it exists. The inbox of StudioRealtimeGateway consumes two events, each idempotent on its event id. On `StudioNotificationService/NotificationCreated` the handler PushNotification pushes the notice to the connections of the sessions of the named user in the named tenant that hold a Notifications subscription, with its `notificationId`, `kind` and `importance`; the content of the notification is read by the client from StudioNotificationService through StudioBff, never from the push. On `StudioBff/SavedViewChanged` the handler PushViews can filter only by what the event carries: its payload holds `viewId`, `tenantId`, `screenId` and `sharedWith`, and neither the payload nor the envelope names the owner or the project of the view. The handler therefore pushes the change of a view shared with the tenant to the connections of that tenant with a SavedViews subscription for the `screenId`, and pushes no change of a private view or of a view saved with `sharedWith` project, which StudioBff treats as private (AIFACTORY-US-037); those reach their owner when the screen is opened. That SavedViewChanged needs the owner and the project of the view before such pushes can be filtered is reported as an open question. A push never reaches a session of another user for a notification and never a session of another tenant (ADR-0015). A redelivered event is pushed once, because the push is keyed by the subscription and the sequence. A session without an open connection receives nothing from the push; it reads the current state when it opens the screen. The gateway writes nothing and publishes nothing. Kind: behavior. Traces: services: StudioRealtimeGateway, StudioNotificationService, StudioBff; aggregates: StudioRealtimeGateway/RealtimeSubscription; events: StudioNotificationService/NotificationCreated, StudioBff/SavedViewChanged; adrs: ADR-0015; requirements: FUX-04. Relates: screens: my-work, approvals-list; nfrs: NFR-01. Depends on: feature:studio-notification-service, feature:studio-bff. Sources: model/services/factory-studio/StudioRealtimeGateway.yaml, model/services/factory-studio/StudioBff.yaml, docs/planes/experience/studio/services/studio-realtime-gateway/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given two open sessions of the user named by `StudioNotificationService/NotificationCreated` with a Notifications subscription, and a session of another user, when the event is consumed, then both sessions of the user receive the push with `notificationId`, `kind` and `importance`, and the other user receives nothing (ADR-0015).",
        "AC2: Given `StudioBff/SavedViewChanged` for a view shared with the tenant and another for a private view, when they are consumed, then the sessions of that tenant with a SavedViews subscription for that `screenId` receive the change of the tenant-shared view, no session receives the change of the private view, and sessions of other tenants receive nothing (model/services/factory-studio/StudioRealtimeGateway.yaml).",
        "AC3: Given the same event delivered twice, when it is consumed again, then no session receives a second push for it (StudioNotificationService/NotificationCreated, StudioBff/SavedViewChanged)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5501",
        "AIFACTORY-TASK-5502"
      ],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11403,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioRealtimeGateway",
          "StudioNotificationService",
          "StudioBff"
        ],
        "aggregates": [
          "StudioRealtimeGateway/RealtimeSubscription"
        ],
        "events": [
          "StudioNotificationService/NotificationCreated",
          "StudioBff/SavedViewChanged"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04"
        ]
      },
      "relates": {
        "screens": [
          "my-work",
          "approvals-list"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "feature:studio-notification-service",
        "feature:studio-bff"
      ],
      "source": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-1370]",
      "number": 1370
    },
    {
      "id": "AIFACTORY-TASK-5501",
      "type": "task",
      "parent": "AIFACTORY-US-1370",
      "title": "PushNotification and PushViews inbox handlers",
      "sequence": "14.03.03.01",
      "description": "PushNotification and PushViews inbox handlers. Expected output: PushNotification pushes NotificationCreated to the connections of the named user with a Notifications subscription in the named tenant; PushViews pushes SavedViewChanged of a tenant-shared view to the connections of that tenant with a SavedViews subscription for the screen and pushes nothing for a private or project-shared view, whose owner and project the event does not carry; both are idempotent on the event id and push nothing to another user or tenant.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "PushNotification pushes NotificationCreated to the connections of the named user with a Notifications subscription in the named tenant; PushViews pushes SavedViewChanged of a tenant-shared view to the connections of that tenant with a SavedViews subscription for the screen and pushes nothing for a private or project-shared view, whose owner and project the event does not carry; both are idempotent on the event id and push nothing to another user or tenant."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5501]",
      "number": 5501
    },
    {
      "id": "AIFACTORY-TASK-5502",
      "type": "task",
      "parent": "AIFACTORY-US-1370",
      "title": "Verify the pushes of notifications and shared views",
      "sequence": "14.03.03.02",
      "description": "Verify the pushes of notifications and shared views. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Category=Push\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1370 with published NotificationCreated and SavedViewChanged events, tenant-shared and private views and sessions in and out of scope.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Category=Push\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-1370 with published NotificationCreated and SavedViewChanged events, tenant-shared and private views and sessions in and out of scope."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5502]",
      "number": 5502
    },
    {
      "id": "AIFACTORY-US-1371",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-074",
      "title": "Resume a dropped stream from the last sequence, refresh after an overflow and close ended sessions",
      "sequence": "14.03.04",
      "description": "As a requester, I want a dropped connection or upstream stream to resume without a gap, so that the run I follow shows every state, and the screen refreshes rather than skipping silently. Each `RealtimeSubscription` keeps the last sequence delivered and a buffer of `Studio:Realtime:BufferPerConnection` messages (500 by default). When a client reconnects, on the same replica or on another through the backplane, it resubscribes through `StudioRealtimeGateway/Realtime.Subscribe` and names its last sequence on the SignalR negotiation, outside the modelled `execution-scope-v1` request (the assumption of AIFACTORY-US-1369), and resumes from there; when the gap is larger than the buffer, the gateway asks the client for a full refresh of the screen, which reads the current state through `StudioBff/GetScreenModel`, and counts it in `connectsoft.factory.studio.realtime_refreshes`; a gap is never skipped silently (invariant of `RealtimeSubscription`). A connection whose buffer fills is marked under backpressure and receives a full-refresh request rather than a partial stream. When the upstream `RunControlService/RunControl.WatchRun` drops, the stream bridge reconnects with exponential backoff under its retry policy (10 attempts, 5 s) and resumes from the last sequence it pushed, idempotent on the subscription and the sequence so nothing is pushed twice; when the retries are exhausted, every affected connection receives a full-refresh request and the upstream is reported unhealthy by `StudioRealtimeGateway/RealtimeHealth`. A subscription is closed when its client unsubscribes or disconnects. The model names no notice from StudioBff to the gateway when `SessionSweeper` expires a session, so the gateway is never told: a subscription of an expired session stays open and keeps receiving pushes until its next confirmation, on a reconnect or a resubscription, which StudioBff refuses for the expired session, and the subscription is then closed. This PBI sets no bound on how long an expired session can keep receiving pushes; that bound is left explicitly to the open question. Kind: behavior. Traces: services: StudioRealtimeGateway, StudioBff, RunControlService; aggregates: StudioRealtimeGateway/RealtimeSubscription; apis: StudioRealtimeGateway/Realtime.Subscribe, StudioRealtimeGateway/RealtimeHealth, StudioBff/GetScreenModel, RunControlService/RunControl.WatchRun; requirements: FR-10, FUX-04, XL-06. Relates: screens: run-detail. Depends on: feature:run-control-service, feature:studio-bff. Sources: model/services/factory-studio/StudioRealtimeGateway.yaml, docs/planes/experience/studio/services/studio-realtime-gateway/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given a session that received sequence 40 of a run timeline and reconnected through another replica, when it resubscribes through `StudioRealtimeGateway/Realtime.Subscribe` naming its last sequence on the negotiation and the gap is within the buffer, then it receives 41 onwards with no gap and no duplicate (model/services/factory-studio/StudioRealtimeGateway.yaml, FUX-04).",
        "AC2: Given a gap larger than `Studio:Realtime:BufferPerConnection` or a connection whose buffer filled, when the gateway detects it, then the client receives a full-refresh request, reads the current state through `StudioBff/GetScreenModel`, and `connectsoft.factory.studio.realtime_refreshes` counts it (model/services/factory-studio/StudioRealtimeGateway.yaml).",
        "AC3: Given `RunControlService/RunControl.WatchRun` drops, when the stream bridge reconnects within its retry policy, then the subscription resumes from the last sequence pushed and no item is pushed twice; when the retries are exhausted, every affected connection receives a full-refresh request and the upstream is reported unhealthy (StudioRealtimeGateway/RealtimeHealth, XL-06).",
        "AC4: Given a client that unsubscribes or disconnects, when the gateway handles it, then the subscription is closed and no further push reaches it; given a session expired by StudioBff whose client reconnects or resubscribes, when StudioBff refuses its confirmation, then its subscriptions are closed, while before that confirmation no bound is set (StudioRealtimeGateway/Realtime.Subscribe, FR-10)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-527",
        "AIFACTORY-TASK-5503",
        "AIFACTORY-TASK-5504"
      ],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11404,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioRealtimeGateway",
          "StudioBff",
          "RunControlService"
        ],
        "aggregates": [
          "StudioRealtimeGateway/RealtimeSubscription"
        ],
        "apis": [
          "StudioRealtimeGateway/Realtime.Subscribe",
          "StudioRealtimeGateway/RealtimeHealth",
          "StudioBff/GetScreenModel",
          "RunControlService/RunControl.WatchRun"
        ],
        "requirements": [
          "FR-10",
          "FUX-04",
          "XL-06"
        ]
      },
      "relates": {
        "screens": [
          "run-detail"
        ]
      },
      "dependsOn": [
        "feature:run-control-service",
        "feature:studio-bff"
      ],
      "source": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-1371]",
      "number": 1371
    },
    {
      "id": "AIFACTORY-TASK-527",
      "type": "task",
      "parent": "AIFACTORY-US-1371",
      "title": "Release of subscriptions on session end",
      "sequence": "14.03.04.01",
      "description": "Release of subscriptions on session end. Expected output: Subscriptions are closed when the client unsubscribes or disconnects and when StudioBff refuses the confirmation of the session of a reconnecting or resubscribing client, so an expired session receives no further push after its next confirmation.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Subscriptions are closed when the client unsubscribes or disconnects and when StudioBff refuses the confirmation of the session of a reconnecting or resubscribing client, so an expired session receives no further push after its next confirmation."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-527]",
      "number": 527
    },
    {
      "id": "AIFACTORY-TASK-5503",
      "type": "task",
      "parent": "AIFACTORY-US-1371",
      "title": "Resume from the last sequence, buffer overflow refresh and upstream reconnect",
      "sequence": "14.03.04.02",
      "description": "Resume from the last sequence, buffer overflow refresh and upstream reconnect. Expected output: A resubscription that names its last sequence on the negotiation resumes within the buffer of Studio:Realtime:BufferPerConnection, a larger gap or a full buffer sends a full-refresh request counted in realtime_refreshes, and a dropped RunControl.WatchRun is reconnected with exponential backoff and resumed from the last sequence; exhausted retries send full-refresh requests and mark the upstream unhealthy.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "A resubscription that names its last sequence on the negotiation resumes within the buffer of Studio:Realtime:BufferPerConnection, a larger gap or a full buffer sends a full-refresh request counted in realtime_refreshes, and a dropped RunControl.WatchRun is reconnected with exponential backoff and resumed from the last sequence; exhausted retries send full-refresh requests and mark the upstream unhealthy."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5503]",
      "number": 5503
    },
    {
      "id": "AIFACTORY-TASK-5504",
      "type": "task",
      "parent": "AIFACTORY-US-1371",
      "title": "Verify resume, refresh and recovery through the acceptance suite",
      "sequence": "14.03.04.03",
      "description": "Verify resume, refresh and recovery through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Category=Recovery\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1371 with two replicas on the backplane, the fake RunControl.WatchRun of AIFACTORY-TASK-5499 dropping on demand and the fake confirmation refusing an expired session.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Category=Recovery\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1371 with two replicas on the backplane, the fake RunControl.WatchRun of AIFACTORY-TASK-5499 dropping on demand and the fake confirmation refusing an expired session."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5504]",
      "number": 5504
    },
    {
      "id": "AIFACTORY-US-1372",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-074",
      "title": "Report the liveness, readiness, connections and upstream health of the realtime gateway",
      "sequence": "14.03.05",
      "description": "As an operator, I want the realtime gateway to report its readiness, its open connections and the health of each upstream stream, so that I see at once whether live updates can flow and which source is missing. An operator or the platform probe calls `StudioRealtimeGateway/RealtimeHealth` on the internal route GW-01 with a token that carries `factory.health.read`. The answer gives liveness, readiness, the number of open connections (`connectsoft.factory.studio.realtime_connections`) and the health of each upstream: StudioBff, which the confirmation of every new subscription requires (fail-fast); the backplane of `Studio:Realtime:Backplane`; the run streams of RunControlService, an optional dependency in degrade mode; and the operations streams of DashboardService, reported as not delivered until I4. The response is 200 while the gateway is ready. An upstream in degrade mode that drops is listed degraded and the response stays 200, because live updates of the other streams continue. While StudioBff is unreachable it is listed degraded and the response stays 200: new subscriptions are refused, but the subscriptions already open do not need StudioBff to keep pushing, and a 503 would take every replica out of rotation and drop them. Only while the backplane is unreachable is the gateway not ready, because subscriptions can no longer be shared across replicas, and it answers 503 with a problem response that names the backplane. A request without a token is refused with 401 and a token without `factory.health.read` with 403. Nothing is written by the probe. Kind: behavior. Traces: services: StudioRealtimeGateway; apis: StudioRealtimeGateway/RealtimeHealth; adrs: ADR-0015; requirements: FUX-04; scenarios: SCN-StudioRealtimeGateway-001. Relates: nfrs: NFR-10. Sources: model/services/factory-studio/StudioRealtimeGateway.yaml, docs/planes/experience/studio/services/studio-realtime-gateway/index.md#metrics-and-observability.",
      "acceptanceCriteria": [
        "AC1: Given a ready gateway with open connections, when `StudioRealtimeGateway/RealtimeHealth` is called with `factory.health.read`, then the response is 200 with liveness, readiness, the connection count and the health of StudioBff, the backplane, the run streams of RunControlService and the operations streams shown as not delivered until I4 (SCN-StudioRealtimeGateway-001).",
        "AC2: Given the run stream of RunControlService has dropped, or StudioBff is unreachable, when `StudioRealtimeGateway/RealtimeHealth` is called, then that upstream is listed degraded, the response stays 200, open subscriptions keep receiving pushes and, for StudioBff, new subscriptions are refused (SCN-StudioRealtimeGateway-001).",
        "AC3: Given the backplane is unreachable, when `StudioRealtimeGateway/RealtimeHealth` is called, then the response is 503 with a problem response that names the backplane and no state changes (SCN-StudioRealtimeGateway-001).",
        "AC4: Given a request without a token, or with a token that lacks `factory.health.read`, when `StudioRealtimeGateway/RealtimeHealth` is called, then the response is 401 or 403 respectively with a problem response, and no health detail is returned (SCN-StudioRealtimeGateway-001, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#metrics-and-observability"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5505",
        "AIFACTORY-TASK-5506"
      ],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11405,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioRealtimeGateway"
        ],
        "apis": [
          "StudioRealtimeGateway/RealtimeHealth"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04"
        ],
        "scenarios": [
          "SCN-StudioRealtimeGateway-001"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "docs/planes/experience/studio/services/studio-realtime-gateway/index.md#metrics-and-observability"
      ],
      "titlePrefix": "[AIFACTORY-US-1372]",
      "number": 1372
    },
    {
      "id": "AIFACTORY-TASK-5505",
      "type": "task",
      "parent": "AIFACTORY-US-1372",
      "title": "RealtimeHealth with connections and upstream health",
      "sequence": "14.03.05.01",
      "description": "RealtimeHealth with connections and upstream health. Expected output: RealtimeHealth reports liveness, readiness, the open connection count and the health of StudioBff, the backplane, the RunControlService run streams and the DashboardService operations streams marked not delivered until I4; it stays 200 with StudioBff or an optional upstream listed degraded, answers 503 naming the backplane only while the backplane is unreachable, and refuses a request without a token with 401 and one without factory.health.read with 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "RealtimeHealth reports liveness, readiness, the open connection count and the health of StudioBff, the backplane, the RunControlService run streams and the DashboardService operations streams marked not delivered until I4; it stays 200 with StudioBff or an optional upstream listed degraded, answers 503 naming the backplane only while the backplane is unreachable, and refuses a request without a token with 401 and one without factory.health.read with 403."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5505]",
      "number": 5505
    },
    {
      "id": "AIFACTORY-TASK-5506",
      "type": "task",
      "parent": "AIFACTORY-US-1372",
      "title": "Verify the health probe through the acceptance suite",
      "sequence": "14.03.05.02",
      "description": "Verify the health probe through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioRealtimeGateway-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1372.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-StudioRealtimeGateway-001\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1372."
      ],
      "sourceArtifacts": [
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioRealtimeGateway"
      ],
      "children": [],
      "buildOrder": 114,
      "phase": "factory",
      "stackRank": 11405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5506]",
      "number": 5506
    },
    {
      "id": "AIFACTORY-FEAT-075",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "Studio work area: Assets",
      "sequence": "14.04",
      "description": "The 11 screens of the Studio work area Assets on the Blazor shell and microfrontends, bound to the read models and commands the model names for them, with their state families, roles, locales and accessibility contracts. Screens come from model/ux/screens.yaml and the prototype alignment. Increment I3: Studio. Build order 115 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1391",
        "AIFACTORY-US-1392",
        "AIFACTORY-US-129",
        "AIFACTORY-US-1393"
      ],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11500,
      "titlePrefix": "[AIFACTORY-FEAT-075]",
      "number": 75
    },
    {
      "id": "AIFACTORY-US-1391",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-075",
      "title": "Assets: I inspect tool descriptors and dry-run a tool, and see the MCP server registry in its thin scope, through StudioBff",
      "sequence": "14.04.01",
      "description": "As an asset maintainer, I want to read every tool descriptor with its classes, schema and limits and to dry-run a tool without executing it, so that I know what a tool may do and which approval it needs before an agent is bound to it. An asset maintainer, a platform admin or an observer opens the screen `tool-descriptor` at `/assets/tools/{toolId}` in the Assets microfrontend. The page asks StudioBff for `GetScreenModel` of that screen, and StudioBff composes it under the scope of the session from `ListTools` and `GetTool` of ToolAdapterService, reached through ToolExecutorHost, with the freshness of the source: the active descriptors visible to the caller with side-effect and risk class, kind, server and health, and for one descriptor its schema, authorization, secret dependencies, limits and audit requirements. `DryRunTool` uses the read scope `factory.tools.read`, so the dry run is offered to every role of the screen whose session holds that scope, an observer included, because it executes nothing: the page sends it through `ForwardCommand` with an idempotency key, ToolAdapterService validates the arguments and answers the pipeline outcome (class, policy, approval needed, sandbox kind), and the page shows that outcome; nothing changes. A session without that scope sees the dry run disabled with the reason. A tool of another tenant is answered 404 by `GetTool` and `DryRunTool` like a tool that does not exist, a dry run sent without the scope is answered 403 by `DryRunTool`, and the page shows either in words; `ListTools` lists only the descriptors visible to the caller. When ToolExecutorHost does not answer, the composition marks the source degraded with its last freshness and a dry run is refused with 503, never queued by StudioBff. StudioBff consumes `ToolDescriptorActivated` and `ToolDescriptorRetired`, refreshes the tool descriptor view and signals the open page, which updates without a reload. The screen `mcp-servers` reads `ListMcpServers` of McpServerRegistryService. In I3 that registry is static and holds no MCP server, every tool of the chain being native, so the screen says that no server is registered; `GetMcpCapabilities` and the commands `RegisterMcpServer`, `DiscoverMcpCapabilities`, `ActivateMcpServer` and `RetireMcpServer` arrive with the complete delivery of the registry in I5, so the screen offers none of them and lists the capability source as not delivered. Kind: behavior. Traces: services: StudioBff, ToolAdapterService, McpServerRegistryService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, ToolAdapterService/ListTools, ToolAdapterService/GetTool, ToolAdapterService/DryRunTool, McpServerRegistryService/ListMcpServers; events: ToolAdapterService/ToolDescriptorActivated, ToolAdapterService/ToolDescriptorRetired; adrs: ADR-0015, ADR-0022, ADR-0028; requirements: FUX-02, FUX-05. Relates: screens: tool-descriptor, mcp-servers. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:tool-adapter-service, feature:tool-executor-host, feature:mcp-server-registry-service-thin. Sources: model/ux/screens.yaml, model/services/factory-studio/StudioBff.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/tools-mcp/McpServerRegistryService.yaml, docs/planes/experience/studio/screens/assets.md.",
      "acceptanceCriteria": [
        "AC1: Given an asset maintainer with the screen `tool-descriptor` open, when StudioBff/GetScreenModel composes it, then the list and the descriptor come from ToolAdapterService/ListTools and ToolAdapterService/GetTool under the scope of the session with the freshness of the source, and the browser calls no address other than StudioBff (model/ux/screens.yaml, FUX-02).",
        "AC2: Given a role of the screen whose session holds `factory.tools.read`, an observer included, when they dry-run a tool, then StudioBff/ForwardCommand forwards ToolAdapterService/DryRunTool with an idempotency key, the page shows class, policy, approval needed and sandbox kind, nothing is executed, and a session without that scope sees the control disabled with the reason (FUX-05, ADR-0028 decision 3 keeps ToolAdapterService the only executor).",
        "AC3: Given a tool of another tenant, when ToolAdapterService/GetTool or ToolAdapterService/DryRunTool is requested, then the answer is 404 like a tool that does not exist; given a dry run sent without the scope, then ToolAdapterService/DryRunTool answers 403; the page explains either in words, and when ToolExecutorHost does not answer the source is shown degraded with its last freshness and the dry run is refused with 503 without being queued (ADR-0015, model/services/factory-studio/StudioBff.yaml).",
        "AC4: Given the descriptor open and ToolAdapterService/ToolDescriptorActivated or ToolAdapterService/ToolDescriptorRetired consumed by StudioBff, when the view is refreshed, then the page shows the new state without a reload; and given the screen `mcp-servers`, when it opens in I3, then McpServerRegistryService/ListMcpServers answers an empty registry, the page says that no MCP server is registered and no registration, discovery, activation or retirement is offered (FUX-02)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "docs/planes/experience/studio/screens/assets.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5621",
        "AIFACTORY-TASK-5622",
        "AIFACTORY-TASK-5623",
        "AIFACTORY-TASK-5695"
      ],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11501,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ToolAdapterService",
          "McpServerRegistryService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "ToolAdapterService/ListTools",
          "ToolAdapterService/GetTool",
          "ToolAdapterService/DryRunTool",
          "McpServerRegistryService/ListMcpServers"
        ],
        "events": [
          "ToolAdapterService/ToolDescriptorActivated",
          "ToolAdapterService/ToolDescriptorRetired"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-02",
          "FUX-05"
        ]
      },
      "relates": {
        "screens": [
          "tool-descriptor",
          "mcp-servers"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:tool-adapter-service",
        "feature:tool-executor-host",
        "feature:mcp-server-registry-service-thin"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "docs/planes/experience/studio/screens/assets.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1391]",
      "number": 1391
    },
    {
      "id": "AIFACTORY-TASK-5621",
      "type": "task",
      "parent": "AIFACTORY-US-1391",
      "title": "Tool descriptor and MCP server screens in the Assets microfrontend",
      "sequence": "14.04.01.01",
      "description": "Tool descriptor and MCP server screens in the Assets microfrontend. Expected output: The Assets microfrontend renders `tool-descriptor` and `mcp-servers` from the screen model of StudioBff with the asset-readiness and deployment-availability families of model/ux/states.yaml, a dry-run panel with the returned class, policy, approval and sandbox kind, the disabled control with its reason for a session without `factory.tools.read`, the empty registry message, and the not-delivered marker of the capability source.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Assets microfrontend renders `tool-descriptor` and `mcp-servers` from the screen model of StudioBff with the asset-readiness and deployment-availability families of model/ux/states.yaml, a dry-run panel with the returned class, policy, approval and sandbox kind, the disabled control with its reason for a session without `factory.tools.read`, the empty registry message, and the not-delivered marker of the capability source."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11501,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5621]",
      "number": 5621
    },
    {
      "id": "AIFACTORY-TASK-5622",
      "type": "task",
      "parent": "AIFACTORY-US-1391",
      "title": "Screen models of the tool descriptor and MCP server screens in StudioBff",
      "sequence": "14.04.01.02",
      "description": "Screen models of the tool descriptor and MCP server screens in StudioBff. Expected output: StudioBff composes `tool-descriptor` from `ListTools` and `GetTool` and `mcp-servers` from `ListMcpServers` through ToolExecutorHost with the freshness of each source, forwards `DryRunTool` with an idempotency key and the scope of the session, returns its 403 and 404 unchanged, refuses it with 503 while ToolExecutorHost does not answer, and refreshes the tool descriptor view on `ToolDescriptorActivated` and `ToolDescriptorRetired`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `tool-descriptor` from `ListTools` and `GetTool` and `mcp-servers` from `ListMcpServers` through ToolExecutorHost with the freshness of each source, forwards `DryRunTool` with an idempotency key and the scope of the session, returns its 403 and 404 unchanged, refuses it with 503 while ToolExecutorHost does not answer, and refreshes the tool descriptor view on `ToolDescriptorActivated` and `ToolDescriptorRetired`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11501,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5622]",
      "number": 5622
    },
    {
      "id": "AIFACTORY-TASK-5623",
      "type": "task",
      "parent": "AIFACTORY-US-1391",
      "title": "Verify the tool descriptor and MCP server screens against a stubbed StudioBff",
      "sequence": "14.04.01.03",
      "description": "Verify the tool descriptor and MCP server screens against a stubbed StudioBff. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` on the Studio with a StudioBff stub that serves descriptors, a dry-run outcome for an observer, a 404 of `GetTool` and `DryRunTool` for a tool of another tenant, a 403 of a dry run without the scope, a degraded source and an empty MCP registry; the tests prove AC1 to AC4 of AIFACTORY-US-1391 (ToolAdapterService/DryRunTool, McpServerRegistryService/ListMcpServers).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` on the Studio with a StudioBff stub that serves descriptors, a dry-run outcome for an observer, a 404 of `GetTool` and `DryRunTool` for a tool of another tenant, a 403 of a dry run without the scope, a degraded source and an empty MCP registry; the tests prove AC1 to AC4 of AIFACTORY-US-1391 (ToolAdapterService/DryRunTool, McpServerRegistryService/ListMcpServers)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5623]",
      "number": 5623
    },
    {
      "id": "AIFACTORY-TASK-5695",
      "type": "task",
      "parent": "AIFACTORY-US-1391",
      "title": "Verify the StudioBff side of the tool descriptor and MCP server screens",
      "sequence": "14.04.01.04",
      "description": "Verify the StudioBff side of the tool descriptor and MCP server screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-assets-tool-descriptor-and-mcp-servers\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition from `ListTools`, `GetTool` and `ListMcpServers` through ToolExecutorHost with freshness), AC2 (`DryRunTool` forwarded once with its idempotency key and the scope of the session), AC3 (403 and 404 returned unchanged, 503 while ToolExecutorHost does not answer, nothing queued) and AC4 (refresh on `ToolDescriptorActivated` and `ToolDescriptorRetired`) of AIFACTORY-US-1391 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-assets-tool-descriptor-and-mcp-servers\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition from `ListTools`, `GetTool` and `ListMcpServers` through ToolExecutorHost with freshness), AC2 (`DryRunTool` forwarded once with its idempotency key and the scope of the session), AC3 (403 and 404 returned unchanged, 503 while ToolExecutorHost does not answer, nothing queued) and AC4 (refresh on `ToolDescriptorActivated` and `ToolDescriptorRetired`) of AIFACTORY-US-1391 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5695]",
      "number": 5695
    },
    {
      "id": "AIFACTORY-US-1392",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-075",
      "title": "Assets: I read model profiles and deployments, workflow definition versions and the template catalog, and act on them only with the role and class the owning service requires",
      "sequence": "14.04.02",
      "description": "As a platform admin, I want to see the model profiles with their deployments and route plans, the loaded workflow definition versions and the template catalog with its compatibility evidence, and to act on them from the Studio, so that I govern the assets the chain depends on with the evidence beside each decision. Three screens of the Assets area read services that are delivered before I3. The screen `model-profiles` reads `ListModelProfiles`, `GetModelProfile`, `ListModelDeployments` and `PreviewRoutePlan` of ModelRouterService through ModelGatewayHost: the active profiles with capabilities, privacy class, limits and fallback chains, their deployments, and a dry run of the router for a scope and profile with the candidates, the filters and the reasons for exclusion. A platform admin may register a Candidate deployment with `RegisterDeployment` (credentials are brokered, never posted), run the capability suite with `EvaluateDeployment`, a sandbox action whose evidence ModelRouterService records, and move an Evaluated deployment to Approved with `ApproveDeployment`, a publication-class action; ADR-0021 decision 1 makes profiles assets approved by a platform admin. The screen `workflow-definitions` reads `ListWorkflowDefinitionVersions` of WorkflowEngineService with their graph hashes, and an asset maintainer or a platform admin validates a DSL document with `ValidateWorkflowDefinition`, a sandbox action that answers the findings on acyclicity, action classes, failure policies, schema references and bounded loops and stores nothing. The screen `template-catalog` reads `ListTemplates`, `GetTemplateVersion`, `ListLibraries` and `QueryCompatibility` of TemplateRegistryService, and an administrator of the platform tenant may run `DiscoverTemplates` and `PublishTemplateVersion`; a caller of another tenant is answered 403. Every command goes through `ForwardCommand` with an idempotency key and the scope of the session; for a publication-class command it carries the approval binding the owning service requires, and the gate is the owning service, never StudioBff. A 400, 409, 412 or 422 answer is shown in words with the current state, and a 503 of a fail-fast dependency is shown with the statement that nothing changed. StudioBff consumes `DeploymentStateChanged`, `CapabilityEvidenceRecorded` and `TemplateVersionDiscovered` and refreshes the open views. Kind: behavior. Traces: services: StudioBff, ModelRouterService, WorkflowEngineService, TemplateRegistryService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, ModelRouterService/ListModelProfiles, ModelRouterService/GetModelProfile, ModelRouterService/ListModelDeployments, ModelRouterService/PreviewRoutePlan, ModelRouterService/RegisterDeployment, ModelRouterService/EvaluateDeployment, ModelRouterService/ApproveDeployment, WorkflowEngineService/ListWorkflowDefinitionVersions, WorkflowEngineService/ValidateWorkflowDefinition, TemplateRegistryService/ListTemplates, TemplateRegistryService/GetTemplateVersion, TemplateRegistryService/ListLibraries, TemplateRegistryService/QueryCompatibility, TemplateRegistryService/DiscoverTemplates, TemplateRegistryService/PublishTemplateVersion; events: ModelRouterService/DeploymentStateChanged, ModelRouterService/CapabilityEvidenceRecorded, TemplateRegistryService/TemplateVersionDiscovered; adrs: ADR-0021, ADR-0028; requirements: FUX-02, FUX-10, FUX-11. Relates: screens: model-profiles, workflow-definitions, template-catalog. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:model-router-service, feature:model-gateway-host, feature:workflow-engine-service, feature:agent-runtime-worker, feature:template-registry-service, feature:template-catalog-host. Sources: model/ux/screens.yaml, model/services/factory-studio/StudioBff.yaml, model/services/model-compute/ModelRouterService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/services/template-library/TemplateRegistryService.yaml, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given a platform admin on `model-profiles`, when the screen model is composed, then profiles, deployments and the route-plan preview come from ModelRouterService/ListModelProfiles, ModelRouterService/GetModelProfile, ModelRouterService/ListModelDeployments and ModelRouterService/PreviewRoutePlan through StudioBff/GetScreenModel, and a refresh follows ModelRouterService/DeploymentStateChanged and ModelRouterService/CapabilityEvidenceRecorded without a reload (FUX-02, FUX-10).",
        "AC2: Given a platform admin, when they register, evaluate or approve a deployment, then StudioBff/ForwardCommand forwards ModelRouterService/RegisterDeployment, ModelRouterService/EvaluateDeployment or ModelRouterService/ApproveDeployment with an idempotency key and, for the publication-class approval, the approval binding; an answer 409 or 412 is shown with the current state of the deployment and a role other than platform admin sees the controls disabled with the reason (ADR-0021 decision 1).",
        "AC3: Given an asset maintainer on `workflow-definitions`, when they validate a document, then WorkflowEngineService/ValidateWorkflowDefinition answers its findings or 400 and the page lists them by rule beside the versions of WorkflowEngineService/ListWorkflowDefinitionVersions, and nothing is stored (model/ux/screens.yaml).",
        "AC4: Given the screen `template-catalog`, when it opens, then templates, versions, libraries and compatibility come from TemplateRegistryService/ListTemplates, TemplateRegistryService/GetTemplateVersion, TemplateRegistryService/ListLibraries and TemplateRegistryService/QueryCompatibility, and TemplateRegistryService/DiscoverTemplates and TemplateRegistryService/PublishTemplateVersion are offered only to an administrator of the platform tenant, a 403 or a 503 being shown with the statement that nothing changed (TemplateRegistryService/TemplateVersionDiscovered refreshes the view; FUX-11)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5624",
        "AIFACTORY-TASK-5625",
        "AIFACTORY-TASK-5626",
        "AIFACTORY-TASK-5696"
      ],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11502,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ModelRouterService",
          "WorkflowEngineService",
          "TemplateRegistryService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "ModelRouterService/ListModelProfiles",
          "ModelRouterService/GetModelProfile",
          "ModelRouterService/ListModelDeployments",
          "ModelRouterService/PreviewRoutePlan",
          "ModelRouterService/RegisterDeployment",
          "ModelRouterService/EvaluateDeployment",
          "ModelRouterService/ApproveDeployment",
          "WorkflowEngineService/ListWorkflowDefinitionVersions",
          "WorkflowEngineService/ValidateWorkflowDefinition",
          "TemplateRegistryService/ListTemplates",
          "TemplateRegistryService/GetTemplateVersion",
          "TemplateRegistryService/ListLibraries",
          "TemplateRegistryService/QueryCompatibility",
          "TemplateRegistryService/DiscoverTemplates",
          "TemplateRegistryService/PublishTemplateVersion"
        ],
        "events": [
          "ModelRouterService/DeploymentStateChanged",
          "ModelRouterService/CapabilityEvidenceRecorded",
          "TemplateRegistryService/TemplateVersionDiscovered"
        ],
        "adrs": [
          "ADR-0021",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-02",
          "FUX-10",
          "FUX-11"
        ]
      },
      "relates": {
        "screens": [
          "model-profiles",
          "workflow-definitions",
          "template-catalog"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:model-router-service",
        "feature:model-gateway-host",
        "feature:workflow-engine-service",
        "feature:agent-runtime-worker",
        "feature:template-registry-service",
        "feature:template-catalog-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1392]",
      "number": 1392
    },
    {
      "id": "AIFACTORY-TASK-5624",
      "type": "task",
      "parent": "AIFACTORY-US-1392",
      "title": "Model profile, workflow definition and template catalog screens in the Assets microfrontend",
      "sequence": "14.04.02.01",
      "description": "Model profile, workflow definition and template catalog screens in the Assets microfrontend. Expected output: The Assets microfrontend renders `model-profiles`, `workflow-definitions` and `template-catalog` from the screen model with the asset-readiness and deployment-availability families, a route-plan preview panel, validation findings listed by rule, compatibility evidence per version, and every command disabled with its reason for a role or tenant the owning service does not admit.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Assets microfrontend renders `model-profiles`, `workflow-definitions` and `template-catalog` from the screen model with the asset-readiness and deployment-availability families, a route-plan preview panel, validation findings listed by rule, compatibility evidence per version, and every command disabled with its reason for a role or tenant the owning service does not admit."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11502,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5624]",
      "number": 5624
    },
    {
      "id": "AIFACTORY-TASK-5625",
      "type": "task",
      "parent": "AIFACTORY-US-1392",
      "title": "Screen models and command routes of the model, workflow and template screens in StudioBff",
      "sequence": "14.04.02.02",
      "description": "Screen models and command routes of the model, workflow and template screens in StudioBff. Expected output: StudioBff composes the three screens through ModelGatewayHost, AgentRuntimeWorker and TemplateCatalogHost with the freshness of each source, forwards the eight commands with an idempotency key and, for `ApproveDeployment` and `PublishTemplateVersion`, the approval binding, returns the answer of the owning service unchanged, and refreshes the views on `DeploymentStateChanged`, `CapabilityEvidenceRecorded` and `TemplateVersionDiscovered`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes the three screens through ModelGatewayHost, AgentRuntimeWorker and TemplateCatalogHost with the freshness of each source, forwards the eight commands with an idempotency key and, for `ApproveDeployment` and `PublishTemplateVersion`, the approval binding, returns the answer of the owning service unchanged, and refreshes the views on `DeploymentStateChanged`, `CapabilityEvidenceRecorded` and `TemplateVersionDiscovered`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11502,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5625]",
      "number": 5625
    },
    {
      "id": "AIFACTORY-TASK-5626",
      "type": "task",
      "parent": "AIFACTORY-US-1392",
      "title": "Verify the model, workflow and template screens by role",
      "sequence": "14.04.02.03",
      "description": "Verify the model, workflow and template screens by role. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub that serves each screen for a platform admin, an asset maintainer, an observer and a caller of another tenant, and answers 409, 412 and 503 on the commands; the tests prove AC1 to AC4 of AIFACTORY-US-1392 (ModelRouterService/ApproveDeployment, TemplateRegistryService/PublishTemplateVersion).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub that serves each screen for a platform admin, an asset maintainer, an observer and a caller of another tenant, and answers 409, 412 and 503 on the commands; the tests prove AC1 to AC4 of AIFACTORY-US-1392 (ModelRouterService/ApproveDeployment, TemplateRegistryService/PublishTemplateVersion)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5626]",
      "number": 5626
    },
    {
      "id": "AIFACTORY-TASK-5696",
      "type": "task",
      "parent": "AIFACTORY-US-1392",
      "title": "Verify the StudioBff side of the model, workflow and template screens",
      "sequence": "14.04.02.04",
      "description": "Verify the StudioBff side of the model, workflow and template screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-assets-model-profiles-workflows-and-templates\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through ModelGatewayHost and refresh on `DeploymentStateChanged` and `CapabilityEvidenceRecorded`), AC2 (the deployment commands forwarded once with an idempotency key and the approval binding of `ApproveDeployment`), AC3 (`ValidateWorkflowDefinition` forwarded through AgentRuntimeWorker with its answer unchanged) and AC4 (composition through TemplateCatalogHost, the approval binding of `PublishTemplateVersion`, a 403 and a 503 returned unchanged and refresh on `TemplateVersionDiscovered`) of AIFACTORY-US-1392 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-assets-model-profiles-workflows-and-templates\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through ModelGatewayHost and refresh on `DeploymentStateChanged` and `CapabilityEvidenceRecorded`), AC2 (the deployment commands forwarded once with an idempotency key and the approval binding of `ApproveDeployment`), AC3 (`ValidateWorkflowDefinition` forwarded through AgentRuntimeWorker with its answer unchanged) and AC4 (composition through TemplateCatalogHost, the approval binding of `PublishTemplateVersion`, a 403 and a 503 returned unchanged and refresh on `TemplateVersionDiscovered`) of AIFACTORY-US-1392 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5696]",
      "number": 5696
    },
    {
      "id": "AIFACTORY-US-129",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-075",
      "title": "The Assets work area of the Studio is bound to the model",
      "sequence": "14.04.03",
      "description": "As an asset maintainer, I want the Assets work area of the Studio (11 screens) bound to the read models, commands, state families and roles the model names for it, so that I can inspect and govern agents, tools, profiles, workflows and templates from one place, with every control reflecting what I may do and how fresh what I see is. This is the integration PBI of the Assets area. The Assets microfrontend is generated from the microfrontend library template, composed into the Studio shell through its registry and holds the eleven screens of model/ux/screens.yaml with their routes, read models, commands, state families and roles; it calls StudioBff only, through the generated client of the shell. A screen is offered to the roles its list names; for any other role it is absent from the navigation and `GetScreenModel` refuses it with 403. Six screens read services that are not delivered in I3 at the depth they need. `asset-catalog` and `release-detail` read `ListReleases`, `GetRelease` and `ListReleaseEvaluations`: the thin AgentRegistryService only loads the seeded Draft releases by alias with no publication gate, as the amendment of ADR-0021 on Draft releases records, and the thin QualityScoreService only stores evaluation events, so both screens and their lifecycle commands complete with the complete deliveries of the two services in I4. `agent-card` reads AgentCardService and the three marketplace screens read MarketplaceCatalogService and LicenseService, all delivered in I8. In I3 each of these screens is registered, offered to its roles, and shows its sources as unknown in the freshness family, named, never hidden and never filled from a fake; none of its commands is offered. The other five screens are delivered by AIFACTORY-US-1391 and AIFACTORY-US-1392. Every screen subscribes through `Realtime.Subscribe` of StudioRealtimeGateway; when the channel drops the page marks its data stale, and when it returns the page reloads the screen model and shows the current state without a reload of the browser. Every screen renders in English, Russian and Hebrew right to left and is built to the accessibility contract of docs/planes/experience/studio/localization-accessibility.md; the area evidence that follows this PBI checks it on the finished area. Kind: behavior. Traces: services: StudioBff, StudioRealtimeGateway, ToolAdapterService, McpServerRegistryService, ModelRouterService, WorkflowEngineService, TemplateRegistryService; apis: StudioBff/GetStudioSession, StudioBff/GetScreenModel, StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe; adrs: ADR-0007, ADR-0015, ADR-0021; requirements: FUX-02, FUX-12. Relates: screens: asset-catalog, release-detail, agent-card, marketplace-browse, marketplace-installations, publisher-console. Depends on: AIFACTORY-US-1391, AIFACTORY-US-1392, feature:studio-bff, feature:studio-realtime-gateway, feature:component-blazor-shell. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, docs/planes/experience/studio/screens/assets.md, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given the shell with the Assets microfrontend, when each of the 11 screens of model/ux/screens.yaml opens for a role its list names, then it renders from StudioBff/GetScreenModel only, and for a role its list does not name the screen is not offered and StudioBff/GetScreenModel answers 403 (ADR-0007, ADR-0015).",
        "AC2: Given `asset-catalog`, `release-detail`, `agent-card`, `marketplace-browse`, `marketplace-installations` and `publisher-console`, when they open in I3, then each shows its sources as unknown in the freshness family of model/ux/states.yaml with the source named, shows no invented value and offers none of its commands, as the amendment of ADR-0021 on Draft releases leaves publication to the fourth increment (FUX-12).",
        "AC3: Given an open screen and its subscription through StudioRealtimeGateway/Realtime.Subscribe, when the channel drops, then the page marks the data stale and never presents it as current, and when the channel returns the page reloads StudioBff/GetScreenModel and shows the current state without a browser reload (FUX-02).",
        "AC4: Given the commands of the five delivered screens, when a role issues one, then it is forwarded once through StudioBff/ForwardCommand with an idempotency key and the scope of the session, a role without the right sees the control disabled with the reason, and the screens render in en, ru and he right to left under docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/assets.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-433",
        "AIFACTORY-TASK-434",
        "AIFACTORY-TASK-435",
        "AIFACTORY-TASK-740"
      ],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11503,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "ToolAdapterService",
          "McpServerRegistryService",
          "ModelRouterService",
          "WorkflowEngineService",
          "TemplateRegistryService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "adrs": [
          "ADR-0007",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FUX-02",
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "asset-catalog",
          "release-detail",
          "agent-card",
          "marketplace-browse",
          "marketplace-installations",
          "publisher-console"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1391",
        "AIFACTORY-US-1392",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/assets.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-129]",
      "number": 129
    },
    {
      "id": "AIFACTORY-TASK-433",
      "type": "task",
      "parent": "AIFACTORY-US-129",
      "title": "Screens of the work area Assets: Asset catalog, Asset release, Agent card, Tool descriptor, MCP servers, Model profiles and deployments, Workflow definitions, Template catalog and 3 more",
      "sequence": "14.04.03.01",
      "description": "Screens of the work area Assets: Asset catalog, Asset release, Agent card, Tool descriptor, MCP servers, Model profiles and deployments, Workflow definitions, Template catalog and 3 more. Expected output: The Assets microfrontend is composed into the shell through the registry with one navigation group and the eleven routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the six screens of later sources render their sources as unknown with the source named and no command.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Assets microfrontend is composed into the shell through the registry with one navigation group and the eleven routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the six screens of later sources render their sources as unknown with the source named and no command."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11503,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-433]",
      "number": 433
    },
    {
      "id": "AIFACTORY-TASK-434",
      "type": "task",
      "parent": "AIFACTORY-US-129",
      "title": "Commands of the work area Assets",
      "sequence": "14.04.03.02",
      "description": "Commands of the work area Assets. Expected output: The commands of the five delivered screens are forwarded through StudioBff with an idempotency key and the scope of the session, a publication-class command carries its approval binding, and the commands of the six screens of later sources (release lifecycle, listings, pricing, installations) are not offered in I3.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The commands of the five delivered screens are forwarded through StudioBff with an idempotency key and the scope of the session, a publication-class command carries its approval binding, and the commands of the six screens of later sources (release lifecycle, listings, pricing, installations) are not offered in I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-434]",
      "number": 434
    },
    {
      "id": "AIFACTORY-TASK-435",
      "type": "task",
      "parent": "AIFACTORY-US-129",
      "title": "States, roles, locales and accessibility of the work area Assets",
      "sequence": "14.04.03.03",
      "description": "States, roles, locales and accessibility of the work area Assets. Expected output: Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-435]",
      "number": 435
    },
    {
      "id": "AIFACTORY-TASK-740",
      "type": "task",
      "parent": "AIFACTORY-US-129",
      "title": "Verify studio-assets-work-area by running the declared command",
      "sequence": "14.04.03.04",
      "description": "Verify studio-assets-work-area by running the declared command. Expected output: Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-129 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-129 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-740]",
      "number": 740
    },
    {
      "id": "AIFACTORY-US-1393",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-075",
      "title": "Assets area evidence: every screen passes the accessibility and phone-width checks and an end-to-end walk of the area through StudioBff is recorded",
      "sequence": "14.04.04",
      "description": "As an observer, I want proof that every screen of the Assets area is usable by keyboard, in every locale and at phone width, and that a walk of the area reads only StudioBff, so that the area is accepted on a recorded check and not on a screenshot. This PBI is the proof of the Assets area and comes after its integration PBI AIFACTORY-US-129, which registers the eleven screens. Two checks run against the Studio on the acceptance estate. The accessibility and phone-width check opens each of the eleven screens of the area for a role its list in model/ux/screens.yaml names and asserts the rules of docs/planes/experience/studio/localization-accessibility.md: WCAG 2.2 AA by the automated checks, every action reachable by keyboard with a visible focus ring and focus returned to the triggering control after a dialog, status badges with text and never colour alone, server refusals explained in words, reduced motion honoured, in English, Russian and Hebrew rendered right to left, in light and dark, at 1440 by 900 and at 390 by 844, where the page has no horizontal scroll. The end-to-end walk signs in as an asset maintainer, opens the catalog, a tool descriptor and its dry run, the MCP server registry, a model profile with its route-plan preview, a workflow definition with a validation and a template version with its compatibility, and then signs in as an observer and as a requester to see the same screens with the commands their roles allow or not offered. Each screen whose source is delivered after I3 shows that source as unknown in the freshness family and is listed by name. The record holds per screen and role the expected and observed result and the network log, which shows no address other than StudioBff and StudioRealtimeGateway. A failing screen is recorded with its failing rule and the area stays open. Kind: evidence. Traces: services: StudioBff; apis: StudioBff/GetScreenModel; adrs: ADR-0007; requirements: FUX-12. Relates: screens: asset-catalog, release-detail, agent-card, tool-descriptor, mcp-servers, model-profiles, workflow-definitions, template-catalog, marketplace-browse, marketplace-installations, publisher-console; nfrs: NFR-15. Depends on: AIFACTORY-US-1391, AIFACTORY-US-1392, AIFACTORY-US-129, feature:studio-bff, feature:component-blazor-shell. Sources: model/ux/screens.yaml, docs/planes/experience/studio/localization-accessibility.md, docs/planes/experience/studio/screens/assets.md.",
      "acceptanceCriteria": [
        "AC1: Given each screen of the Assets area in model/ux/screens.yaml, when the accessibility check runs in the three locales, both schemes and the two viewports of docs/planes/experience/studio/localization-accessibility.md, then every screen passes the automated WCAG 2.2 AA checks and keyboard operation, renders Hebrew right to left, and has no horizontal scroll at 390 by 844 (NFR-15, FUX-12).",
        "AC2: Given the end-to-end walk as an asset maintainer, an observer and a requester, when it runs on the acceptance estate, then every screen renders from StudioBff/GetScreenModel, the commands offered match the roles of model/ux/screens.yaml, and a screen of a later source shows that source as unknown and is listed by name (ADR-0007).",
        "AC3: Given the network log and the record of the walk, when they are read, then the browser called no address other than StudioBff and StudioRealtimeGateway and the record holds one line per screen and role with the expected and observed result (FUX-12)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/assets.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5627",
        "AIFACTORY-TASK-5628",
        "AIFACTORY-TASK-5629"
      ],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11504,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetScreenModel"
        ],
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "asset-catalog",
          "release-detail",
          "agent-card",
          "tool-descriptor",
          "mcp-servers",
          "model-profiles",
          "workflow-definitions",
          "template-catalog",
          "marketplace-browse",
          "marketplace-installations",
          "publisher-console"
        ],
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1391",
        "AIFACTORY-US-1392",
        "AIFACTORY-US-129",
        "feature:studio-bff",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/assets.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1393]",
      "number": 1393
    },
    {
      "id": "AIFACTORY-TASK-5627",
      "type": "task",
      "parent": "AIFACTORY-US-1393",
      "title": "End-to-end walk of the Assets area with three roles",
      "sequence": "14.04.04.01",
      "description": "End-to-end walk of the Assets area with three roles. Expected output: A browser-driven walk in the Studio repository that signs in as an asset maintainer, an observer and a requester, opens the eleven screens of the Assets area, performs the dry run, the route-plan preview, the workflow validation and the compatibility query, and records per screen and role the rendered state, the offered commands and the addresses the browser called.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven walk in the Studio repository that signs in as an asset maintainer, an observer and a requester, opens the eleven screens of the Assets area, performs the dry run, the route-plan preview, the workflow validation and the compatibility query, and records per screen and role the rendered state, the offered commands and the addresses the browser called."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5627]",
      "number": 5627
    },
    {
      "id": "AIFACTORY-TASK-5628",
      "type": "task",
      "parent": "AIFACTORY-US-1393",
      "title": "Accessibility and phone-width check of the Assets screens",
      "sequence": "14.04.04.02",
      "description": "Accessibility and phone-width check of the Assets screens. Expected output: Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the eleven screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1393 against docs/planes/experience/studio/localization-accessibility.md.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility | npx playwright test --project=phone-390x844.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the eleven screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1393 against docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5628]",
      "number": 5628
    },
    {
      "id": "AIFACTORY-TASK-5629",
      "type": "task",
      "parent": "AIFACTORY-US-1393",
      "title": "Verify the walk record of the Assets area",
      "sequence": "14.04.04.03",
      "description": "Verify the walk record of the Assets area. Expected output: Run the walk of AIFACTORY-TASK-5627 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1393 (StudioBff/GetScreenModel), every screen of a later source is listed by name, and the record is kept with the evidence of increment I3.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the walk of AIFACTORY-TASK-5627 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1393 (StudioBff/GetScreenModel), every screen of a later source is listed by name, and the record is kept with the evidence of increment I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 115,
      "phase": "factory",
      "stackRank": 11504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5629]",
      "number": 5629
    },
    {
      "id": "AIFACTORY-FEAT-076",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "Studio work area: Governance & administration",
      "sequence": "14.05",
      "description": "The 14 screens of the Studio work area Governance & administration on the Blazor shell and microfrontends, bound to the read models and commands the model names for them, with their state families, roles, locales and accessibility contracts. Screens come from model/ux/screens.yaml and the prototype alignment. Increment I3: Studio. Build order 116 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1394",
        "AIFACTORY-US-1395",
        "AIFACTORY-US-1396",
        "AIFACTORY-US-1397",
        "AIFACTORY-US-130",
        "AIFACTORY-US-1398"
      ],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11600,
      "titlePrefix": "[AIFACTORY-FEAT-076]",
      "number": 76
    },
    {
      "id": "AIFACTORY-US-1394",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-076",
      "title": "Governance: I read the policy bundles in force and the decisions of a run, and validate a project override that may only tighten the tenant bundle",
      "sequence": "14.05.01",
      "description": "As a workspace admin, I want to see which policy bundle governs my project, why a run was allowed or denied, and whether a stricter project override is valid before I propose it, so that I tighten the policy of a project with evidence and never loosen the platform ceiling by mistake. A platform admin, a workspace admin or an observer opens the screen `policies` at `/governance/policies`. StudioBff composes it under the scope of the session from `ListPolicyBundles` and `GetPolicyBundle` of PolicyEngineService, reached through GovernanceHost, and from `ListRunDecisions` for a run the user picks, which lists the decisions recorded for that run with their effects, matched rules and reasons. In I3 the bundle in force for a tenant is the one the policy engine seeded itself at the first decision asked for that tenant, and until the publication gate of the fourth increment the seeded bundles are the only ones in force, as the amendment of ADR-0015 on the policy bundle of a new tenant records; the screen states that the bundle is seeded and shows no publication control. A role of the screen whose session holds `factory.policies.write`, the scope of `ValidateProjectPolicy`, validates a project override: the page sends it through `ForwardCommand` with an idempotency key, PolicyEngineService checks every rule against the tenant bundle and answers the findings, a rule that loosens the bundle being a finding, or 400 for a malformed override; the action is sandbox class and stores nothing. `SimulatePolicy`, the what-if evaluation of a candidate bundle against the recorded decisions of a period, is also sandbox class and takes the same scope, so it is offered to the same sessions. A session without `factory.policies.write` sees both controls disabled with the reason. A run of another tenant is answered 404 by `ListRunDecisions` like a run that does not exist and a missing scope inside the tenant 403, and the page says which. When GovernanceHost does not answer, the source is shown degraded with its last freshness and the commands are refused with 503, never queued. StudioBff consumes `PolicyRevisionActivated` and refreshes the policy bundle view of the open page. Kind: behavior. Traces: services: StudioBff, PolicyEngineService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, PolicyEngineService/ListPolicyBundles, PolicyEngineService/GetPolicyBundle, PolicyEngineService/ListRunDecisions, PolicyEngineService/ValidateProjectPolicy, PolicyEngineService/SimulatePolicy; events: PolicyEngineService/PolicyRevisionActivated; adrs: ADR-0015; requirements: FUX-01, FUX-05. Relates: screens: policies. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:policy-engine-service, feature:governance-host. Sources: model/ux/screens.yaml, model/services/factory-studio/StudioBff.yaml, model/services/governance/PolicyEngineService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a workspace admin on `policies`, when StudioBff/GetScreenModel composes it, then the bundles and the bundle in force come from PolicyEngineService/ListPolicyBundles and PolicyEngineService/GetPolicyBundle, the page states that the bundle is the seeded one of the tenant as the amendment of ADR-0015 on new tenants records, and no publication control is shown in I3.",
        "AC2: Given a run of the scope, when the user opens its decisions, then PolicyEngineService/ListRunDecisions lists effects, matched rules and reasons, and a run of another tenant is answered 404 and a missing scope 403, each explained in words (ADR-0015, FUX-05).",
        "AC3: Given a session that holds `factory.policies.write`, when StudioBff/ForwardCommand forwards PolicyEngineService/ValidateProjectPolicy with an idempotency key, then every rule that loosens the tenant bundle is shown as a finding, a malformed override is answered 400 and nothing is stored; PolicyEngineService/SimulatePolicy is offered to the same sessions, because it takes the same scope, and a session without that scope sees both controls disabled with the reason (FUX-01).",
        "AC4: Given GovernanceHost does not answer, when the screen is open, then the source is shown degraded with its last freshness and a command is refused with 503 and not queued, and when PolicyEngineService/PolicyRevisionActivated is consumed by StudioBff the open page refreshes without a reload (model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5630",
        "AIFACTORY-TASK-5631",
        "AIFACTORY-TASK-5632",
        "AIFACTORY-TASK-5697"
      ],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11601,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "PolicyEngineService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "PolicyEngineService/ListPolicyBundles",
          "PolicyEngineService/GetPolicyBundle",
          "PolicyEngineService/ListRunDecisions",
          "PolicyEngineService/ValidateProjectPolicy",
          "PolicyEngineService/SimulatePolicy"
        ],
        "events": [
          "PolicyEngineService/PolicyRevisionActivated"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01",
          "FUX-05"
        ]
      },
      "relates": {
        "screens": [
          "policies"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:policy-engine-service",
        "feature:governance-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1394]",
      "number": 1394
    },
    {
      "id": "AIFACTORY-TASK-5630",
      "type": "task",
      "parent": "AIFACTORY-US-1394",
      "title": "Policies screen in the Governance microfrontend",
      "sequence": "14.05.01.01",
      "description": "Policies screen in the Governance microfrontend. Expected output: The Governance microfrontend renders `policies` with the bundle in force marked as seeded, the decisions of a chosen run with effects, rules and reasons, a validation panel that lists every loosening rule as a finding, the simulation for a session that holds `factory.policies.write`, and both controls disabled with their reason for a session without it.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Governance microfrontend renders `policies` with the bundle in force marked as seeded, the decisions of a chosen run with effects, rules and reasons, a validation panel that lists every loosening rule as a finding, the simulation for a session that holds `factory.policies.write`, and both controls disabled with their reason for a session without it."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11601,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5630]",
      "number": 5630
    },
    {
      "id": "AIFACTORY-TASK-5631",
      "type": "task",
      "parent": "AIFACTORY-US-1394",
      "title": "Screen model and command routes of the policies screen in StudioBff",
      "sequence": "14.05.01.02",
      "description": "Screen model and command routes of the policies screen in StudioBff. Expected output: StudioBff composes `policies` through GovernanceHost from `ListPolicyBundles`, `GetPolicyBundle` and `ListRunDecisions` with the freshness of the source, forwards `ValidateProjectPolicy` and `SimulatePolicy` with an idempotency key and the scope of the session, refuses them with 503 while GovernanceHost does not answer, and refreshes the view on `PolicyRevisionActivated`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `policies` through GovernanceHost from `ListPolicyBundles`, `GetPolicyBundle` and `ListRunDecisions` with the freshness of the source, forwards `ValidateProjectPolicy` and `SimulatePolicy` with an idempotency key and the scope of the session, refuses them with 503 while GovernanceHost does not answer, and refreshes the view on `PolicyRevisionActivated`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11601,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5631]",
      "number": 5631
    },
    {
      "id": "AIFACTORY-TASK-5632",
      "type": "task",
      "parent": "AIFACTORY-US-1394",
      "title": "Verify the policies screen against a stubbed StudioBff",
      "sequence": "14.05.01.03",
      "description": "Verify the policies screen against a stubbed StudioBff. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a seeded bundle, the decisions of a run, a loosening override, a session without `factory.policies.write`, a 404 of another tenant and an unreachable GovernanceHost; the tests prove AC1 to AC4 of AIFACTORY-US-1394 (PolicyEngineService/ValidateProjectPolicy).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a seeded bundle, the decisions of a run, a loosening override, a session without `factory.policies.write`, a 404 of another tenant and an unreachable GovernanceHost; the tests prove AC1 to AC4 of AIFACTORY-US-1394 (PolicyEngineService/ValidateProjectPolicy)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5632]",
      "number": 5632
    },
    {
      "id": "AIFACTORY-TASK-5697",
      "type": "task",
      "parent": "AIFACTORY-US-1394",
      "title": "Verify the StudioBff side of the policies screen",
      "sequence": "14.05.01.04",
      "description": "Verify the StudioBff side of the policies screen. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-policies\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through GovernanceHost with freshness), AC2 (the 404 and 403 of `ListRunDecisions` returned unchanged), AC3 (`ValidateProjectPolicy` and `SimulatePolicy` forwarded once with an idempotency key and the scope of the session) and AC4 (503 while GovernanceHost does not answer, nothing queued, refresh on `PolicyRevisionActivated`) of AIFACTORY-US-1394 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-policies\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through GovernanceHost with freshness), AC2 (the 404 and 403 of `ListRunDecisions` returned unchanged), AC3 (`ValidateProjectPolicy` and `SimulatePolicy` forwarded once with an idempotency key and the scope of the session) and AC4 (503 while GovernanceHost does not answer, nothing queued, refresh on `PolicyRevisionActivated`) of AIFACTORY-US-1394 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5697]",
      "number": 5697
    },
    {
      "id": "AIFACTORY-US-1395",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-076",
      "title": "Governance: I search and export the audit evidence, resolve findings and set classifications, and keep secret references without ever seeing a secret value",
      "sequence": "14.05.02",
      "description": "As a platform admin, I want to search the evidence, act on findings and classifications and manage the references to secrets from the Studio, so that I govern data classes, evidence and credentials of the tenant without leaving the Studio and without a secret value on any screen. Three screens of the Governance area read services delivered in the first increment through GovernanceHost. The screen `audit` reads `SearchAudit` of AuditService: the evidence by scope, kind, actor, run and time with its chain position. A platform admin or a workspace admin may export the evidence of a project with `ExportAudit`, an external-class action answered 202 that produces the export in open formats with chain proofs; the evidence is redacted and never purged, as ADR-0019 decision 3 keeps it. The screen `findings` reads `ListFindings` and `ListClassifications`; a platform admin resolves or accepts the risk of a finding with a reason through `ResolveFinding`, a shared-write action that needs no approval binding, and sets the data class, retention, redaction rules and residency of a resource type through `SetClassification`, a production-class action because retention and routing change, which carries the approval binding of its class and which the owning service answers 409 on a conflict. The screen `secrets-references` reads `ListSecretReferences` of SecretBrokerService, which the model documents for Platform admin under `factory.secrets.admin`, and `ListRunIssuances`, both metadata only. The controls of the screen are offered to a session that holds `factory.secrets.admin`: it registers a reference to a vault secret with owner, purposes, time to live and rotation policy through `RegisterSecretReference`, records a rotation with `RotateSecret`, which revokes the live issuances of the old version, and revokes a reference with `RevokeSecretReference`, all three production class. A workspace admin without that scope sees the controls disabled with the reason and the reference list refused with its reason, while the issuances of a run stay readable. No screen shows or posts a secret value: the value is written to the vault by its owner, never through the Studio. Every command goes through `ForwardCommand` with an idempotency key and the scope of the session and, for a production-class command, the approval binding the owning service requires; the gate is the owning service, never StudioBff. An observer or an operator without the scope sees the controls disabled with the reason, a resource of another tenant is answered 404 and a missing scope 403. StudioBff consumes `FindingRaised`, `FindingResolved`, `ClassificationChanged` and `SecretReferenceRegistered` and refreshes the open views. Kind: behavior. Traces: services: StudioBff, AuditService, SecretBrokerService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, AuditService/SearchAudit, AuditService/ExportAudit, AuditService/ListFindings, AuditService/ListClassifications, AuditService/ResolveFinding, AuditService/SetClassification, SecretBrokerService/ListSecretReferences, SecretBrokerService/ListRunIssuances, SecretBrokerService/RegisterSecretReference, SecretBrokerService/RotateSecret, SecretBrokerService/RevokeSecretReference; events: AuditService/FindingRaised, AuditService/FindingResolved, AuditService/ClassificationChanged, SecretBrokerService/SecretReferenceRegistered; adrs: ADR-0015, ADR-0019; requirements: FUX-01, FUX-06. Relates: screens: audit, findings, secrets-references; nfrs: NFR-03. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:audit-service-complete, feature:secret-broker-service, feature:governance-host. Sources: model/ux/screens.yaml, model/services/governance/AuditService.yaml, model/services/governance/SecretBrokerService.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a platform admin on `audit`, when StudioBff/GetScreenModel composes it, then the evidence comes from AuditService/SearchAudit with its chain position, and AuditService/ExportAudit forwarded through StudioBff/ForwardCommand answers 202 and the page shows the export as requested, the evidence staying redacted as ADR-0019 decision 3 requires (FUX-06).",
        "AC2: Given a platform admin on `findings`, when they resolve a finding or set a classification, then AuditService/ResolveFinding is forwarded with an idempotency key and a reason, AuditService/SetClassification additionally carries the approval binding of its production class, a 409 of SetClassification is shown with the current classification, and the view refreshes on AuditService/FindingResolved and AuditService/ClassificationChanged (AuditService/ListFindings, AuditService/ListClassifications, FUX-01).",
        "AC3: Given the screen `secrets-references`, when it renders, then SecretBrokerService/ListSecretReferences and SecretBrokerService/ListRunIssuances show metadata only, no page shows or accepts a secret value, SecretBrokerService/RegisterSecretReference, SecretBrokerService/RotateSecret and SecretBrokerService/RevokeSecretReference are offered to a session that holds `factory.secrets.admin` and forwarded with the approval binding of the production class, a workspace admin without that scope sees them disabled with the reason, and the view refreshes on SecretBrokerService/SecretReferenceRegistered (NFR-03).",
        "AC4: Given an observer, a resource of another tenant or a missing scope, when a screen or a command is requested, then the controls are disabled with the reason for the observer, the answer is 404 for the other tenant and 403 for the missing scope, and AuditService/FindingRaised refreshes the findings of an open page without a reload (ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5633",
        "AIFACTORY-TASK-5634",
        "AIFACTORY-TASK-5635",
        "AIFACTORY-TASK-5698"
      ],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11602,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "AuditService",
          "SecretBrokerService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "AuditService/SearchAudit",
          "AuditService/ExportAudit",
          "AuditService/ListFindings",
          "AuditService/ListClassifications",
          "AuditService/ResolveFinding",
          "AuditService/SetClassification",
          "SecretBrokerService/ListSecretReferences",
          "SecretBrokerService/ListRunIssuances",
          "SecretBrokerService/RegisterSecretReference",
          "SecretBrokerService/RotateSecret",
          "SecretBrokerService/RevokeSecretReference"
        ],
        "events": [
          "AuditService/FindingRaised",
          "AuditService/FindingResolved",
          "AuditService/ClassificationChanged",
          "SecretBrokerService/SecretReferenceRegistered"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FUX-01",
          "FUX-06"
        ]
      },
      "relates": {
        "screens": [
          "audit",
          "findings",
          "secrets-references"
        ],
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:audit-service-complete",
        "feature:secret-broker-service",
        "feature:governance-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1395]",
      "number": 1395
    },
    {
      "id": "AIFACTORY-TASK-5633",
      "type": "task",
      "parent": "AIFACTORY-US-1395",
      "title": "Audit, findings and secret reference screens in the Governance microfrontend",
      "sequence": "14.05.02.01",
      "description": "Audit, findings and secret reference screens in the Governance microfrontend. Expected output: The Governance microfrontend renders `audit`, `findings` and `secrets-references` with the freshness family, the chain position of each evidence entry, the reason field of a finding resolution, the class of each command beside its control, metadata-only secret references with no field for a secret value, the secret controls disabled with their reason for a session without `factory.secrets.admin`, and other disabled controls with their reason.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Governance microfrontend renders `audit`, `findings` and `secrets-references` with the freshness family, the chain position of each evidence entry, the reason field of a finding resolution, the class of each command beside its control, metadata-only secret references with no field for a secret value, the secret controls disabled with their reason for a session without `factory.secrets.admin`, and other disabled controls with their reason."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11602,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5633]",
      "number": 5633
    },
    {
      "id": "AIFACTORY-TASK-5634",
      "type": "task",
      "parent": "AIFACTORY-US-1395",
      "title": "Screen models and command routes of the audit, findings and secret screens in StudioBff",
      "sequence": "14.05.02.02",
      "description": "Screen models and command routes of the audit, findings and secret screens in StudioBff. Expected output: StudioBff composes the three screens through GovernanceHost with the freshness of each source, forwards the seven commands with an idempotency key and the scope of the session, adds the approval binding of the production class to `SetClassification` and the three secret reference commands and none to `ResolveFinding`, returns the answer of the owning service unchanged, and refreshes the views on `FindingRaised`, `FindingResolved`, `ClassificationChanged` and `SecretReferenceRegistered`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes the three screens through GovernanceHost with the freshness of each source, forwards the seven commands with an idempotency key and the scope of the session, adds the approval binding of the production class to `SetClassification` and the three secret reference commands and none to `ResolveFinding`, returns the answer of the owning service unchanged, and refreshes the views on `FindingRaised`, `FindingResolved`, `ClassificationChanged` and `SecretReferenceRegistered`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11602,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5634]",
      "number": 5634
    },
    {
      "id": "AIFACTORY-TASK-5635",
      "type": "task",
      "parent": "AIFACTORY-US-1395",
      "title": "Verify the audit, findings and secret screens by role",
      "sequence": "14.05.02.03",
      "description": "Verify the audit, findings and secret screens by role. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving each screen to a platform admin, a workspace admin without `factory.secrets.admin`, an observer and a caller of another tenant, a 409 on a classification and a log capture that fails when a secret value appears; the tests prove AC1 to AC4 of AIFACTORY-US-1395 (AuditService/SetClassification, SecretBrokerService/RotateSecret).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving each screen to a platform admin, a workspace admin without `factory.secrets.admin`, an observer and a caller of another tenant, a 409 on a classification and a log capture that fails when a secret value appears; the tests prove AC1 to AC4 of AIFACTORY-US-1395 (AuditService/SetClassification, SecretBrokerService/RotateSecret)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5635]",
      "number": 5635
    },
    {
      "id": "AIFACTORY-TASK-5698",
      "type": "task",
      "parent": "AIFACTORY-US-1395",
      "title": "Verify the StudioBff side of the audit, findings and secret screens",
      "sequence": "14.05.02.04",
      "description": "Verify the StudioBff side of the audit, findings and secret screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-audit-findings-and-secret-references\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through GovernanceHost and the 202 of `ExportAudit` returned unchanged), AC2 (`ResolveFinding` forwarded with a reason and no approval binding, `SetClassification` with the approval binding of its class, refresh on `FindingResolved` and `ClassificationChanged`), AC3 (no secret value in any composed model or log, the secret commands forwarded with their approval binding, refresh on `SecretReferenceRegistered`) and AC4 (404 and 403 returned unchanged, refresh on `FindingRaised`) of AIFACTORY-US-1395 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-audit-findings-and-secret-references\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through GovernanceHost and the 202 of `ExportAudit` returned unchanged), AC2 (`ResolveFinding` forwarded with a reason and no approval binding, `SetClassification` with the approval binding of its class, refresh on `FindingResolved` and `ClassificationChanged`), AC3 (no secret value in any composed model or log, the secret commands forwarded with their approval binding, refresh on `SecretReferenceRegistered`) and AC4 (404 and 403 returned unchanged, refresh on `FindingRaised`) of AIFACTORY-US-1395 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5698]",
      "number": 5698
    },
    {
      "id": "AIFACTORY-US-1396",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-076",
      "title": "Governance: I register, verify and grant the Azure DevOps connection of a project and see its connector, within the thin scope of the integration services",
      "sequence": "14.05.03",
      "description": "As a workspace admin, I want to register the one Azure DevOps connection of my project with its credential reference, verify it and grant its use, so that the project gets its source scope only when the connection is verified, and nothing is shown that the integration services do not yet deliver. In I3 the integration services are delivered thin: IntegrationService holds one Azure DevOps connection per project with its credential reference, and ConnectorRegistryService holds the Azure DevOps connector for template feeds and for opening the change proposal. The screen `connections` reads `ListConnections` of IntegrationService through IntegrationHost: the connections of the scope with provider, state, health, rotation due and grant counts. A workspace admin or a platform admin registers the connection with `RegisterConnection`, naming provider, endpoint policy, credential kind and a Key Vault reference; the value is written to Key Vault by its owner or the Secret Broker flow and never posted through the Studio. `VerifyConnection` checks the credential through the Secret Broker and a provider health call and is answered with the result; `SetGrant` grants or narrows the use of the connection by a subject. A second connection for the same project is answered 409. When verification fails the project stays without source scope, as the flow `onboard-project` of model/ux/flows.yaml states, and the page says so. The screen `connectors` reads `ListConnectors` of ConnectorRegistryService, and a platform admin runs the conformance suite with `CertifyConnector`, a sandbox action answered 202 whose evidence is stored as an artifact. `RotateCredential` and `RevokeConnection` of IntegrationService and `ListDeliveries`, `CreateSubscription` and `ReplayDelivery` of ConnectorRegistryService arrive with the complete deliveries of the two services in I5: the screens offer none of them and show the deliveries source as unknown in the freshness family, named. Every command goes through `ForwardCommand` with an idempotency key and the scope of the session; an observer sees the controls disabled with the reason, a connection of another tenant is answered 404 and a missing scope 403. StudioBff consumes `ConnectionRegistered`, `ConnectionStateChanged`, `ConnectionGrantChanged` and `ConnectorActivated` and refreshes the open views. Kind: behavior. Traces: services: StudioBff, IntegrationService, ConnectorRegistryService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, IntegrationService/ListConnections, IntegrationService/RegisterConnection, IntegrationService/VerifyConnection, IntegrationService/SetGrant, ConnectorRegistryService/ListConnectors, ConnectorRegistryService/CertifyConnector; events: IntegrationService/ConnectionRegistered, IntegrationService/ConnectionStateChanged, IntegrationService/ConnectionGrantChanged, ConnectorRegistryService/ConnectorActivated; adrs: ADR-0015; requirements: FUX-01. Relates: screens: connections, connectors. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:integration-service-thin, feature:connector-registry-service-thin, feature:integration-host. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/backlog/features/integration.yaml, model/services/integration/IntegrationService.yaml, model/services/integration/ConnectorRegistryService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a workspace admin on `connections`, when they register the connection of the project, then StudioBff/ForwardCommand forwards IntegrationService/RegisterConnection with an idempotency key and a Key Vault reference, no field accepts a credential value, a second connection of the project is answered 409, and the list from IntegrationService/ListConnections shows the new connection after IntegrationService/ConnectionRegistered (FUX-01).",
        "AC2: Given a registered connection, when IntegrationService/VerifyConnection fails, then the page shows the failure and that the project stays without source scope as the flow `onboard-project` of model/ux/flows.yaml states, and IntegrationService/SetGrant narrows or grants use with the view refreshed on IntegrationService/ConnectionGrantChanged and IntegrationService/ConnectionStateChanged.",
        "AC3: Given a platform admin on `connectors`, when they certify the connector, then ConnectorRegistryService/CertifyConnector answers 202 and the certification state of ConnectorRegistryService/ListConnectors follows ConnectorRegistryService/ConnectorActivated, while deliveries, subscriptions, replay, rotation and revocation are not offered in I3 and the deliveries source is shown unknown (model/backlog/features/integration.yaml).",
        "AC4: Given an observer, a connection of another tenant or a missing scope, when a screen or a command is requested, then the controls are disabled with the reason, the answer is 404 for the other tenant and 403 for the missing scope, and StudioBff/GetScreenModel shows IntegrationHost degraded with its last freshness when it does not answer (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/backlog/features/integration.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5636",
        "AIFACTORY-TASK-5637",
        "AIFACTORY-TASK-5638",
        "AIFACTORY-TASK-5699"
      ],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11603,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "IntegrationService",
          "ConnectorRegistryService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "IntegrationService/ListConnections",
          "IntegrationService/RegisterConnection",
          "IntegrationService/VerifyConnection",
          "IntegrationService/SetGrant",
          "ConnectorRegistryService/ListConnectors",
          "ConnectorRegistryService/CertifyConnector"
        ],
        "events": [
          "IntegrationService/ConnectionRegistered",
          "IntegrationService/ConnectionStateChanged",
          "IntegrationService/ConnectionGrantChanged",
          "ConnectorRegistryService/ConnectorActivated"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {
        "screens": [
          "connections",
          "connectors"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:integration-service-thin",
        "feature:connector-registry-service-thin",
        "feature:integration-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/backlog/features/integration.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1396]",
      "number": 1396
    },
    {
      "id": "AIFACTORY-TASK-5636",
      "type": "task",
      "parent": "AIFACTORY-US-1396",
      "title": "Connection and connector screens in the Governance microfrontend",
      "sequence": "14.05.03.01",
      "description": "Connection and connector screens in the Governance microfrontend. Expected output: The Governance microfrontend renders `connections` and `connectors` with the deployment-availability and freshness families, a registration form that takes a Key Vault reference and no credential value, the verification result with the source-scope consequence, the grant editor, the certification state, and the deliveries source shown unknown with its name.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Governance microfrontend renders `connections` and `connectors` with the deployment-availability and freshness families, a registration form that takes a Key Vault reference and no credential value, the verification result with the source-scope consequence, the grant editor, the certification state, and the deliveries source shown unknown with its name."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11603,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5636]",
      "number": 5636
    },
    {
      "id": "AIFACTORY-TASK-5637",
      "type": "task",
      "parent": "AIFACTORY-US-1396",
      "title": "Screen models and command routes of the connection and connector screens in StudioBff",
      "sequence": "14.05.03.02",
      "description": "Screen models and command routes of the connection and connector screens in StudioBff. Expected output: StudioBff composes the two screens through IntegrationHost with the freshness of each source, forwards `RegisterConnection`, `VerifyConnection`, `SetGrant` and `CertifyConnector` with an idempotency key and the scope of the session, offers no route for the commands of the complete deliveries, and refreshes the views on the four consumed events.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes the two screens through IntegrationHost with the freshness of each source, forwards `RegisterConnection`, `VerifyConnection`, `SetGrant` and `CertifyConnector` with an idempotency key and the scope of the session, offers no route for the commands of the complete deliveries, and refreshes the views on the four consumed events."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11603,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5637]",
      "number": 5637
    },
    {
      "id": "AIFACTORY-TASK-5638",
      "type": "task",
      "parent": "AIFACTORY-US-1396",
      "title": "Verify the connection and connector screens in their thin scope",
      "sequence": "14.05.03.03",
      "description": "Verify the connection and connector screens in their thin scope. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub that serves a registered connection, a failed verification, a 409 on a second connection, a certification and a 404 of another tenant; the tests prove AC1 to AC4 of AIFACTORY-US-1396 (IntegrationService/VerifyConnection, ConnectorRegistryService/CertifyConnector).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub that serves a registered connection, a failed verification, a 409 on a second connection, a certification and a 404 of another tenant; the tests prove AC1 to AC4 of AIFACTORY-US-1396 (IntegrationService/VerifyConnection, ConnectorRegistryService/CertifyConnector)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5638]",
      "number": 5638
    },
    {
      "id": "AIFACTORY-TASK-5699",
      "type": "task",
      "parent": "AIFACTORY-US-1396",
      "title": "Verify the StudioBff side of the connection and connector screens",
      "sequence": "14.05.03.04",
      "description": "Verify the StudioBff side of the connection and connector screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-connections-and-connectors-thin\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (`RegisterConnection` forwarded once with its idempotency key and a Key Vault reference, the 409 returned unchanged, refresh on `ConnectionRegistered`), AC2 (`VerifyConnection` and `SetGrant` forwarded, refresh on `ConnectionGrantChanged` and `ConnectionStateChanged`), AC3 (the 202 of `CertifyConnector`, refresh on `ConnectorActivated`, no route for the commands of the complete deliveries) and AC4 (404 and 403 returned unchanged, IntegrationHost degraded with its last freshness and commands answered 503) of AIFACTORY-US-1396 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-connections-and-connectors-thin\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (`RegisterConnection` forwarded once with its idempotency key and a Key Vault reference, the 409 returned unchanged, refresh on `ConnectionRegistered`), AC2 (`VerifyConnection` and `SetGrant` forwarded, refresh on `ConnectionGrantChanged` and `ConnectionStateChanged`), AC3 (the 202 of `CertifyConnector`, refresh on `ConnectorActivated`, no route for the commands of the complete deliveries) and AC4 (404 and 403 returned unchanged, IntegrationHost degraded with its last freshness and commands answered 503) of AIFACTORY-US-1396 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5699]",
      "number": 5699
    },
    {
      "id": "AIFACTORY-US-1397",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-076",
      "title": "Governance: I manage project membership and delegations through ProjectService and set my notification and Studio preferences",
      "sequence": "14.05.04",
      "description": "As a workspace admin, I want to grant roles, delegate for a bounded period and revoke a delegation from the Studio, and every user to set how they are notified and how the Studio looks, so that people get exactly the role the Identity service records, and nobody misses an approval for lack of a notification. The screen `users-roles` reads `ListProjects` and `GetProject` of ProjectService through ControlPlaneApi: the projects of the caller with memberships, delegations, source scope and environments. A workspace admin of the project or a platform admin grants or changes a project role with `SetMembership`, delegates the same or a lesser role for a bounded period with a reason through `Delegate`, and revokes a delegation at once through `RevokeDelegation`. The Identity service is the system of record of role assignments and delegations: ProjectService writes to it with its own workload token and names the acting member, and the Identity service decides from its own records whether that member may act, as the amendments of ADR-0015 for D114 and D115 record; the Studio states no role of its own. The role order of D114 applies: Observer is below every role, Requester, Reviewer, Asset maintainer and Operator are not comparable and each is below Workspace admin. Each refusal has its own answer. `Delegate` answers 400 for an invalid body, a delegation without an expiry among them, 409 for a role greater than the one the grantor holds, 404 for a project of another tenant, 403 for a token without `factory.projects.delegate` and 503 while the Identity service does not answer. `SetMembership` answers 400 for an invalid body, 403 for a token without `factory.projects.admin`, 404 for a project it does not find and 503 while the Identity service does not answer. `RevokeDelegation` answers 403 for a token without `factory.projects.delegate`, 404 for a delegation it does not find and 503 while the Identity service does not answer. In every refusal nothing changed and the page says so in words. The screen `notification-preferences` at `/settings/notifications` is open to all seven roles: it reads `ListNotifications` of StudioNotificationService, which StudioBff fronts, sets the channels per kind, the quiet hours and the digest through `SetNotificationPreferences`, and sets the locale (en, he, ru), theme, reduced motion and default work area through `SetStudioPreferences` of StudioBff; the next session starts with them. StudioBff consumes `MembershipChanged` and `DelegationChanged` and refreshes the project view. Kind: behavior. Traces: services: StudioBff, ProjectService, StudioNotificationService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, StudioBff/SetStudioPreferences, ProjectService/ListProjects, ProjectService/GetProject, ProjectService/SetMembership, ProjectService/Delegate, ProjectService/RevokeDelegation, StudioNotificationService/ListNotifications, StudioNotificationService/SetNotificationPreferences; events: ProjectService/MembershipChanged, ProjectService/DelegationChanged; adrs: ADR-0015; requirements: FUX-01. Relates: screens: users-roles, notification-preferences. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:project-service, feature:control-plane-api, feature:studio-notification-service. Sources: model/ux/screens.yaml, model/services/control-plane/ProjectService.yaml, model/services/factory-studio/StudioNotificationService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a workspace admin on `users-roles`, when they grant a role, delegate or revoke, then StudioBff/ForwardCommand forwards ProjectService/SetMembership, ProjectService/Delegate or ProjectService/RevokeDelegation with an idempotency key, and the page shows the role the project holds after ProjectService/MembershipChanged or ProjectService/DelegationChanged refreshes the view of ProjectService/GetProject (ADR-0015, FUX-01).",
        "AC2: Given a refused membership or delegation command, when it is sent, then ProjectService/Delegate answers 400 for an invalid body or a delegation without expiry, 409 for a role greater than the one the grantor holds, 404 for a project of another tenant, 403 for a token without `factory.projects.delegate` and 503 while the Identity service does not answer; ProjectService/SetMembership answers 400, 403, 404 or 503 for an invalid body, a token without `factory.projects.admin`, a project not found or an unavailable Identity service; ProjectService/RevokeDelegation answers 403, 404 or 503 for a token without `factory.projects.delegate`, a delegation not found or an unavailable Identity service; in each case nothing changes and the page explains the refusal in words (ADR-0015 amendments for D114 and D115).",
        "AC3: Given any of the seven roles on `notification-preferences`, when the user saves channels, quiet hours and digest and their locale, theme and reduced motion, then StudioNotificationService/SetNotificationPreferences and StudioBff/SetStudioPreferences record them, StudioNotificationService/ListNotifications shows the notifications with unread counts, and the next session starts with the saved preferences (docs/planes/experience/studio/localization-accessibility.md).",
        "AC4: Given an observer or a role other than workspace admin and platform admin on `users-roles`, when the screen renders, then StudioBff/GetScreenModel refuses it with 403 because the list of model/ux/screens.yaml does not name the role, and ProjectService/ListProjects shows only the projects of the caller."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5639",
        "AIFACTORY-TASK-5640",
        "AIFACTORY-TASK-5641",
        "AIFACTORY-TASK-5700"
      ],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11604,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ProjectService",
          "StudioNotificationService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "StudioBff/SetStudioPreferences",
          "ProjectService/ListProjects",
          "ProjectService/GetProject",
          "ProjectService/SetMembership",
          "ProjectService/Delegate",
          "ProjectService/RevokeDelegation",
          "StudioNotificationService/ListNotifications",
          "StudioNotificationService/SetNotificationPreferences"
        ],
        "events": [
          "ProjectService/MembershipChanged",
          "ProjectService/DelegationChanged"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {
        "screens": [
          "users-roles",
          "notification-preferences"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:project-service",
        "feature:control-plane-api",
        "feature:studio-notification-service"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/factory-studio/StudioNotificationService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1397]",
      "number": 1397
    },
    {
      "id": "AIFACTORY-TASK-5639",
      "type": "task",
      "parent": "AIFACTORY-US-1397",
      "title": "Users and roles and notification preference screens",
      "sequence": "14.05.04.01",
      "description": "Users and roles and notification preference screens. Expected output: The Governance microfrontend renders `users-roles` with memberships, delegations with grantor, expiry and reason, a delegation form that requires an expiry and offers only the same or a lesser role, and each refusal answer in words with the statement that nothing changed; the settings route renders `notification-preferences` with channels per kind, quiet hours, digest, locale, theme and reduced motion.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Governance microfrontend renders `users-roles` with memberships, delegations with grantor, expiry and reason, a delegation form that requires an expiry and offers only the same or a lesser role, and each refusal answer in words with the statement that nothing changed; the settings route renders `notification-preferences` with channels per kind, quiet hours, digest, locale, theme and reduced motion."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11604,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5639]",
      "number": 5639
    },
    {
      "id": "AIFACTORY-TASK-5640",
      "type": "task",
      "parent": "AIFACTORY-US-1397",
      "title": "Screen models and command routes of the users and preferences screens in StudioBff",
      "sequence": "14.05.04.02",
      "description": "Screen models and command routes of the users and preferences screens in StudioBff. Expected output: StudioBff composes `users-roles` through ControlPlaneApi and `notification-preferences` from StudioNotificationService with the freshness of each source, forwards `SetMembership`, `Delegate` and `RevokeDelegation` with an idempotency key and returns their answers unchanged, routes `SetNotificationPreferences` to StudioNotificationService and stores `SetStudioPreferences` on the session, and refreshes the project view on `MembershipChanged` and `DelegationChanged`. The Workspace area reuses these three membership routes.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `users-roles` through ControlPlaneApi and `notification-preferences` from StudioNotificationService with the freshness of each source, forwards `SetMembership`, `Delegate` and `RevokeDelegation` with an idempotency key and returns their answers unchanged, routes `SetNotificationPreferences` to StudioNotificationService and stores `SetStudioPreferences` on the session, and refreshes the project view on `MembershipChanged` and `DelegationChanged`. The Workspace area reuses these three membership routes."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11604,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5640]",
      "number": 5640
    },
    {
      "id": "AIFACTORY-TASK-5641",
      "type": "task",
      "parent": "AIFACTORY-US-1397",
      "title": "Verify the users, roles and preferences screens",
      "sequence": "14.05.04.03",
      "description": "Verify the users, roles and preferences screens. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub that answers a granted role; for `Delegate` a delegation without expiry answered 400, a greater role answered 409, a token without `factory.projects.delegate` answered 403, a project of another tenant answered 404 and an Identity outage answered 503; for `SetMembership` an invalid body answered 400, a token without `factory.projects.admin` answered 403, a project not found answered 404 and an Identity outage answered 503; for `RevokeDelegation` a 403, a 404 and a 503; and saved preferences applied to the next session; the tests prove AC1 to AC4 of AIFACTORY-US-1397 (ProjectService/Delegate, StudioBff/SetStudioPreferences).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub that answers a granted role; for `Delegate` a delegation without expiry answered 400, a greater role answered 409, a token without `factory.projects.delegate` answered 403, a project of another tenant answered 404 and an Identity outage answered 503; for `SetMembership` an invalid body answered 400, a token without `factory.projects.admin` answered 403, a project not found answered 404 and an Identity outage answered 503; for `RevokeDelegation` a 403, a 404 and a 503; and saved preferences applied to the next session; the tests prove AC1 to AC4 of AIFACTORY-US-1397 (ProjectService/Delegate, StudioBff/SetStudioPreferences)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5641]",
      "number": 5641
    },
    {
      "id": "AIFACTORY-TASK-5700",
      "type": "task",
      "parent": "AIFACTORY-US-1397",
      "title": "Verify the StudioBff side of the users, roles and preferences screens",
      "sequence": "14.05.04.04",
      "description": "Verify the StudioBff side of the users, roles and preferences screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-users-roles-and-notification-preferences\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (the three membership commands forwarded once with an idempotency key, refresh on `MembershipChanged` and `DelegationChanged`), AC2 (every 400, 403, 404, 409 and 503 of `Delegate`, `SetMembership` and `RevokeDelegation` returned unchanged with nothing queued), AC3 (`SetNotificationPreferences` routed to StudioNotificationService and `SetStudioPreferences` stored for the next session) and AC4 (403 of `GetScreenModel` for a role the screen does not name) of AIFACTORY-US-1397 (StudioBff/ForwardCommand, StudioBff/SetStudioPreferences).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-governance-users-roles-and-notification-preferences\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (the three membership commands forwarded once with an idempotency key, refresh on `MembershipChanged` and `DelegationChanged`), AC2 (every 400, 403, 404, 409 and 503 of `Delegate`, `SetMembership` and `RevokeDelegation` returned unchanged with nothing queued), AC3 (`SetNotificationPreferences` routed to StudioNotificationService and `SetStudioPreferences` stored for the next session) and AC4 (403 of `GetScreenModel` for a role the screen does not name) of AIFACTORY-US-1397 (StudioBff/ForwardCommand, StudioBff/SetStudioPreferences)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5700]",
      "number": 5700
    },
    {
      "id": "AIFACTORY-US-130",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-076",
      "title": "The Governance & administration work area of the Studio is bound to the model",
      "sequence": "14.05.05",
      "description": "As a workspace admin, I want the Governance & administration work area of the Studio (14 screens) bound to the read models, commands, state families and roles the model names for it, so that I can onboard projects and people under the tenant's policy from one place, with every control reflecting what I may do and how fresh what I see is. This is the integration PBI of the Governance and administration area. The Governance microfrontend is generated from the microfrontend library template, composed into the Studio shell through its registry and holds the fourteen screens of model/ux/screens.yaml with their routes, read models, commands, state families and roles; it calls StudioBff only. A screen is offered to the roles its list names; for any other role it is absent from the navigation and `GetScreenModel` refuses it with 403. Eight screens are delivered by AIFACTORY-US-1394 to AIFACTORY-US-1397. Six read services delivered after I3: `approval-policy` reads ApprovalPolicyService, `topic-registry` EnvelopeRegistryService, `stores` StoreProfileService, and `retention-residency` and `governance-orders` RetentionResidencyService, all delivered in I4; `editions-billing` reads FactoryCommercialService, delivered in I7. In I3 each of these is registered, offered to its roles and shows its sources as unknown in the freshness family, named, never hidden and never filled from a fake; none of its commands is offered, so the refusal of a retention longer than the platform ceiling and the edition changes wait for those increments. Every screen subscribes through `Realtime.Subscribe` of StudioRealtimeGateway; when the channel drops the page marks its data stale and when it returns the page reloads the screen model. A command needing the approval binding of its class carries it to the owning service, whose gate decides; StudioBff and the Studio hold no approval of their own. Every screen renders in English, Russian and Hebrew right to left and is built to the accessibility contract of docs/planes/experience/studio/localization-accessibility.md; the area evidence that follows this PBI checks it on the finished area. Kind: behavior. Traces: services: StudioBff, StudioRealtimeGateway, PolicyEngineService, AuditService, SecretBrokerService, IntegrationService, ConnectorRegistryService, ProjectService; apis: StudioBff/GetStudioSession, StudioBff/GetScreenModel, StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe; adrs: ADR-0007, ADR-0015; requirements: FUX-01, FUX-12. Relates: screens: approval-policy, topic-registry, stores, retention-residency, governance-orders, editions-billing. Depends on: AIFACTORY-US-1394, AIFACTORY-US-1395, AIFACTORY-US-1396, AIFACTORY-US-1397, feature:studio-bff, feature:studio-realtime-gateway, feature:component-blazor-shell. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, docs/planes/experience/studio/screens/governance-administration.md.",
      "acceptanceCriteria": [
        "AC1: Given the shell with the Governance microfrontend, when each of the 14 screens of model/ux/screens.yaml opens for a role its list names, then it renders from StudioBff/GetScreenModel only, and for a role its list does not name the screen is not offered and StudioBff/GetScreenModel answers 403 (ADR-0007, ADR-0015).",
        "AC2: Given `approval-policy`, `topic-registry`, `stores`, `retention-residency`, `governance-orders` and `editions-billing`, when they open in I3, then each shows its sources as unknown in the freshness family of model/ux/states.yaml with the source named, shows no invented value and offers none of its commands (FUX-12).",
        "AC3: Given an open screen and its subscription through StudioRealtimeGateway/Realtime.Subscribe, when the channel drops, then the page marks the data stale and never presents it as current, and when the channel returns the page reloads StudioBff/GetScreenModel and shows the current state without a browser reload (FUX-01).",
        "AC4: Given a command of a delivered screen, when a role issues it, then it is forwarded once through StudioBff/ForwardCommand with an idempotency key, the scope of the session and the approval binding its class requires, a role without the right sees the control disabled with the reason, and the screens render in en, ru and he right to left under docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/governance-administration.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-436",
        "AIFACTORY-TASK-437",
        "AIFACTORY-TASK-438",
        "AIFACTORY-TASK-743"
      ],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11605,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "PolicyEngineService",
          "AuditService",
          "SecretBrokerService",
          "IntegrationService",
          "ConnectorRegistryService",
          "ProjectService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "adrs": [
          "ADR-0007",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01",
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "approval-policy",
          "topic-registry",
          "stores",
          "retention-residency",
          "governance-orders",
          "editions-billing"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1394",
        "AIFACTORY-US-1395",
        "AIFACTORY-US-1396",
        "AIFACTORY-US-1397",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/governance-administration.md"
      ],
      "titlePrefix": "[AIFACTORY-US-130]",
      "number": 130
    },
    {
      "id": "AIFACTORY-TASK-436",
      "type": "task",
      "parent": "AIFACTORY-US-130",
      "title": "Screens of the work area Governance & administration: Policies, Approval policy, Audit search, Findings and classifications, Secret references, Connections, Connectors and deliveries, Topic regist ...",
      "sequence": "14.05.05.01",
      "description": "Screens of the work area Governance & administration: Policies, Approval policy, Audit search, Findings and classifications, Secret references, Connections, Connectors and deliveries, Topic regist .... Expected output: The Governance microfrontend is composed into the shell through the registry with one navigation group and the fourteen routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the six screens of later sources render their sources as unknown with the source named and no command.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Governance microfrontend is composed into the shell through the registry with one navigation group and the fourteen routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the six screens of later sources render their sources as unknown with the source named and no command."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11605,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-436]",
      "number": 436
    },
    {
      "id": "AIFACTORY-TASK-437",
      "type": "task",
      "parent": "AIFACTORY-US-130",
      "title": "Commands of the work area Governance & administration",
      "sequence": "14.05.05.02",
      "description": "Commands of the work area Governance & administration. Expected output: The commands of the eight delivered screens are forwarded through StudioBff with an idempotency key, the scope of the session and the approval binding their class requires, and the commands of the six screens of later sources (approval rules, retention, residency, governance orders, subscriptions) are not offered in I3.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The commands of the eight delivered screens are forwarded through StudioBff with an idempotency key, the scope of the session and the approval binding their class requires, and the commands of the six screens of later sources (approval rules, retention, residency, governance orders, subscriptions) are not offered in I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-437]",
      "number": 437
    },
    {
      "id": "AIFACTORY-TASK-438",
      "type": "task",
      "parent": "AIFACTORY-US-130",
      "title": "States, roles, locales and accessibility of the work area Governance & administration",
      "sequence": "14.05.05.03",
      "description": "States, roles, locales and accessibility of the work area Governance & administration. Expected output: Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11605,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-438]",
      "number": 438
    },
    {
      "id": "AIFACTORY-TASK-743",
      "type": "task",
      "parent": "AIFACTORY-US-130",
      "title": "Verify studio-governance-administration-work-area by running the declared command",
      "sequence": "14.05.05.04",
      "description": "Verify studio-governance-administration-work-area by running the declared command. Expected output: Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-130 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-130 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-743]",
      "number": 743
    },
    {
      "id": "AIFACTORY-US-1398",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-076",
      "title": "Governance and administration area evidence: every screen passes the accessibility and phone-width checks and an end-to-end walk of the area through StudioBff is recorded",
      "sequence": "14.05.06",
      "description": "As an observer, I want proof that every screen of the Governance and administration area is usable by keyboard, in every locale and at phone width, and that a walk of the area reads only StudioBff, so that the area is accepted on a recorded check. This PBI is the proof of the Governance and administration area and comes after its integration PBI AIFACTORY-US-130, which registers the fourteen screens. The accessibility and phone-width check opens each of the fourteen screens of the area for a role its list in model/ux/screens.yaml names and asserts the rules of docs/planes/experience/studio/localization-accessibility.md: WCAG 2.2 AA by the automated checks, keyboard operation with a visible focus ring and focus returned to the triggering control after a dialog, validation messages tied to their fields and refusals explained in words, reduced motion honoured, in English, Russian and Hebrew rendered right to left, light and dark, at 1440 by 900 and at 390 by 844 with no horizontal scroll. The end-to-end walk follows the part of the flow `onboard-project` of model/ux/flows.yaml that I3 delivers, as a workspace admin: the policy bundle in force and the validation of a stricter override, the registration and verification of the Azure DevOps connection, a role granted and a bounded delegation, and the notification preferences; then, as a platform admin, an audit search, a finding resolved with a reason and a secret reference registered; and as an observer, the same screens without commands. The screens whose sources arrive in I4 or I7 show their sources as unknown and are listed by name. The record holds per screen and role the expected and observed result and the network log, which shows no address other than StudioBff and StudioRealtimeGateway; no secret value appears in the record or the log. Kind: evidence. Traces: services: StudioBff; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand; adrs: ADR-0007; requirements: FUX-12. Relates: screens: policies, approval-policy, audit, findings, secrets-references, connections, connectors, topic-registry, stores, retention-residency, governance-orders, users-roles, editions-billing, notification-preferences; nfrs: NFR-15, NFR-03. Depends on: AIFACTORY-US-1394, AIFACTORY-US-1395, AIFACTORY-US-1396, AIFACTORY-US-1397, AIFACTORY-US-130, feature:studio-bff, feature:component-blazor-shell. Sources: model/ux/screens.yaml, model/ux/flows.yaml, docs/planes/experience/studio/localization-accessibility.md, docs/planes/experience/studio/screens/governance-administration.md.",
      "acceptanceCriteria": [
        "AC1: Given each of the 14 screens of the area in model/ux/screens.yaml, when the accessibility check runs in the three locales, both schemes and the two viewports of docs/planes/experience/studio/localization-accessibility.md, then every screen passes the automated WCAG 2.2 AA checks and keyboard operation, renders Hebrew right to left and has no horizontal scroll at 390 by 844 (NFR-15, FUX-12).",
        "AC2: Given the walk as a workspace admin, a platform admin and an observer, when it runs on the acceptance estate, then every screen renders from StudioBff/GetScreenModel, every command it issues goes through StudioBff/ForwardCommand, the offered commands match the roles of model/ux/screens.yaml, and every screen of a later source is listed by name (ADR-0007).",
        "AC3: Given the record and the network log of the walk, when they are read, then the browser called no address other than StudioBff and StudioRealtimeGateway and no secret value appears in either (NFR-03, FUX-12)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/governance-administration.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5642",
        "AIFACTORY-TASK-5643",
        "AIFACTORY-TASK-5644"
      ],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11606,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand"
        ],
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "policies",
          "approval-policy",
          "audit",
          "findings",
          "secrets-references",
          "connections",
          "connectors",
          "topic-registry",
          "stores",
          "retention-residency",
          "governance-orders",
          "users-roles",
          "editions-billing",
          "notification-preferences"
        ],
        "nfrs": [
          "NFR-15",
          "NFR-03"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1394",
        "AIFACTORY-US-1395",
        "AIFACTORY-US-1396",
        "AIFACTORY-US-1397",
        "AIFACTORY-US-130",
        "feature:studio-bff",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/governance-administration.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1398]",
      "number": 1398
    },
    {
      "id": "AIFACTORY-TASK-5642",
      "type": "task",
      "parent": "AIFACTORY-US-1398",
      "title": "End-to-end walk of the Governance and administration area",
      "sequence": "14.05.06.01",
      "description": "End-to-end walk of the Governance and administration area. Expected output: A browser-driven walk in the Studio repository that signs in as a workspace admin, a platform admin and an observer, follows the delivered part of the flow `onboard-project` and the audit, findings and secret screens, and records per screen and role the rendered state, the offered commands, the answers and the addresses the browser called, with a check that fails when a secret value appears.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven walk in the Studio repository that signs in as a workspace admin, a platform admin and an observer, follows the delivered part of the flow `onboard-project` and the audit, findings and secret screens, and records per screen and role the rendered state, the offered commands, the answers and the addresses the browser called, with a check that fails when a secret value appears."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11606,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5642]",
      "number": 5642
    },
    {
      "id": "AIFACTORY-TASK-5643",
      "type": "task",
      "parent": "AIFACTORY-US-1398",
      "title": "Accessibility and phone-width check of the Governance screens",
      "sequence": "14.05.06.02",
      "description": "Accessibility and phone-width check of the Governance screens. Expected output: Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the fourteen screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1398 against docs/planes/experience/studio/localization-accessibility.md.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility | npx playwright test --project=phone-390x844.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the fourteen screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1398 against docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11606,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5643]",
      "number": 5643
    },
    {
      "id": "AIFACTORY-TASK-5644",
      "type": "task",
      "parent": "AIFACTORY-US-1398",
      "title": "Verify the walk record of the Governance area",
      "sequence": "14.05.06.03",
      "description": "Verify the walk record of the Governance area. Expected output: Run the walk of AIFACTORY-TASK-5642 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1398 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the walk of AIFACTORY-TASK-5642 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1398 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 116,
      "phase": "factory",
      "stackRank": 11606,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5644]",
      "number": 5644
    },
    {
      "id": "AIFACTORY-FEAT-077",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "Studio work area: Intelligence",
      "sequence": "14.06",
      "description": "The 6 screens of the Studio work area Intelligence on the Blazor shell and microfrontends, bound to the read models and commands the model names for them, with their state families, roles, locales and accessibility contracts. Screens come from model/ux/screens.yaml and the prototype alignment. Increment I3: Studio. Build order 117 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1399",
        "AIFACTORY-US-131",
        "AIFACTORY-US-1400"
      ],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11700,
      "titlePrefix": "[AIFACTORY-FEAT-077]",
      "number": 77
    },
    {
      "id": "AIFACTORY-US-1399",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-077",
      "title": "Intelligence: I read the artifacts of a run with their lineage, versions and previews within my classification ceiling, and export the artifacts of a project",
      "sequence": "14.06.01",
      "description": "As a requester, I want to open every artifact my run produced with its validation state, lineage, version chain and a preview, so that I judge the output of a run from its sources, and never see content above my classification ceiling. A requester, a reviewer, an operator or an observer opens the screen `artifacts` at `/intelligence/artifacts`. StudioBff composes it under the scope of the session from ArtifactService, reached through KnowledgeHost: `ListRunArtifacts` for a run, with the validation state of each artifact, where a run of which the service holds nothing is answered with an empty list and the page says that the run recorded no artifact; `GetArtifact` for the metadata, the lineage, the position in the version chain and a scoped download reference; `ListArtifactVersions` for the version chain; and `PreviewArtifact` for a rendered diff, document or report, which is a projection and never a second copy. Generated content is shown in its own language and direction and marked as content, as docs/planes/experience/studio/localization-accessibility.md requires. An artifact whose classification is above the ceiling of the viewer is refused by ArtifactService with 403 and the page shows the denial with its explanation and no content, which is the adverse branch of the flow `submit-assessment` of model/ux/flows.yaml; classification follows ADR-0019 decision 2. An artifact of another tenant is answered 404 like one that does not exist. A user whose session permission snapshot holds the scope of the command may export the artifacts, lineage and metadata of a project in open formats with `ExportArtifacts`, an external-class action forwarded through `ForwardCommand` with an idempotency key and answered 202; the page shows the export as requested, and ADR-0019 decision 5 makes the tenant the owner of what it exports. Any other role sees the export disabled with the reason. When KnowledgeHost does not answer, the source is shown degraded with its last freshness and the export is refused with 503, never queued. StudioBff consumes `ArtifactStored`, `ArtifactValidated` and `ArtifactSuperseded` and refreshes the artifact view of an open page, so a superseded version is marked without a reload. Kind: behavior. Traces: services: StudioBff, ArtifactService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, ArtifactService/ListRunArtifacts, ArtifactService/GetArtifact, ArtifactService/PreviewArtifact, ArtifactService/ListArtifactVersions, ArtifactService/ExportArtifacts; events: ArtifactService/ArtifactStored, ArtifactService/ArtifactValidated, ArtifactService/ArtifactSuperseded; adrs: ADR-0015, ADR-0019; requirements: FUX-06. Relates: screens: artifacts. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:artifact-service, feature:knowledge-host. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/services/knowledge/ArtifactService.yaml, docs/architecture/adr/0019-data-governance.md, docs/planes/experience/studio/localization-accessibility.md.",
      "acceptanceCriteria": [
        "AC1: Given a requester on `artifacts` for their run, when StudioBff/GetScreenModel composes it, then the list, the metadata, the lineage, the version chain and the preview come from ArtifactService/ListRunArtifacts, ArtifactService/GetArtifact, ArtifactService/ListArtifactVersions and ArtifactService/PreviewArtifact, and a run with no artifact shows an empty list with that statement, never an error (FUX-06).",
        "AC2: Given an artifact whose classification is above the ceiling of the viewer, when it is opened, then ArtifactService/GetArtifact or ArtifactService/PreviewArtifact answers 403 and the page shows the denial with its explanation and no content, as the flow `submit-assessment` of model/ux/flows.yaml requires; an artifact of another tenant is answered 404 (ADR-0019 decision 2, ADR-0015).",
        "AC3: Given a user whose session holds the export scope, when they export the artifacts of a project, then StudioBff/ForwardCommand forwards ArtifactService/ExportArtifacts with an idempotency key, the answer 202 is shown, and any other role sees the control disabled with the reason (ADR-0019 decision 5).",
        "AC4: Given an open artifact, when ArtifactService/ArtifactSuperseded, ArtifactService/ArtifactValidated or ArtifactService/ArtifactStored is consumed by StudioBff, then the page shows the new state without a reload, and when KnowledgeHost does not answer the source is shown degraded with its last freshness and the export is refused with 503 (model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/experience/studio/localization-accessibility.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5645",
        "AIFACTORY-TASK-5646",
        "AIFACTORY-TASK-5647",
        "AIFACTORY-TASK-5701"
      ],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11701,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ArtifactService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "ArtifactService/ListRunArtifacts",
          "ArtifactService/GetArtifact",
          "ArtifactService/PreviewArtifact",
          "ArtifactService/ListArtifactVersions",
          "ArtifactService/ExportArtifacts"
        ],
        "events": [
          "ArtifactService/ArtifactStored",
          "ArtifactService/ArtifactValidated",
          "ArtifactService/ArtifactSuperseded"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FUX-06"
        ]
      },
      "relates": {
        "screens": [
          "artifacts"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:artifact-service",
        "feature:knowledge-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/planes/experience/studio/localization-accessibility.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1399]",
      "number": 1399
    },
    {
      "id": "AIFACTORY-TASK-5645",
      "type": "task",
      "parent": "AIFACTORY-US-1399",
      "title": "Artifacts and lineage screen in the Intelligence microfrontend",
      "sequence": "14.06.01.01",
      "description": "Artifacts and lineage screen in the Intelligence microfrontend. Expected output: The Intelligence microfrontend renders `artifacts` with the freshness family, the validation state per artifact, the lineage and the version chain, a preview panel that marks generated content in its own language and direction, the denial with its explanation for an artifact above the ceiling, and the export control with its reason when it is disabled.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Intelligence microfrontend renders `artifacts` with the freshness family, the validation state per artifact, the lineage and the version chain, a preview panel that marks generated content in its own language and direction, the denial with its explanation for an artifact above the ceiling, and the export control with its reason when it is disabled."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11701,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5645]",
      "number": 5645
    },
    {
      "id": "AIFACTORY-TASK-5646",
      "type": "task",
      "parent": "AIFACTORY-US-1399",
      "title": "Screen model and export route of the artifacts screen in StudioBff",
      "sequence": "14.06.01.02",
      "description": "Screen model and export route of the artifacts screen in StudioBff. Expected output: StudioBff composes `artifacts` through KnowledgeHost from `ListRunArtifacts`, `GetArtifact`, `ListArtifactVersions` and `PreviewArtifact` with the freshness of the source, returns a 403 of a classification ceiling unchanged, forwards `ExportArtifacts` with an idempotency key and the scope of the session, and refreshes the artifact view on `ArtifactStored`, `ArtifactValidated` and `ArtifactSuperseded`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `artifacts` through KnowledgeHost from `ListRunArtifacts`, `GetArtifact`, `ListArtifactVersions` and `PreviewArtifact` with the freshness of the source, returns a 403 of a classification ceiling unchanged, forwards `ExportArtifacts` with an idempotency key and the scope of the session, and refreshes the artifact view on `ArtifactStored`, `ArtifactValidated` and `ArtifactSuperseded`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11701,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5646]",
      "number": 5646
    },
    {
      "id": "AIFACTORY-TASK-5647",
      "type": "task",
      "parent": "AIFACTORY-US-1399",
      "title": "Verify the artifacts screen with a ceiling denial and a superseded version",
      "sequence": "14.06.01.03",
      "description": "Verify the artifacts screen with a ceiling denial and a superseded version. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving artifacts of a run, an empty run, a 403 above the ceiling, a 404 of another tenant, a superseded version and an unreachable KnowledgeHost; the tests prove AC1 to AC4 of AIFACTORY-US-1399 (ArtifactService/PreviewArtifact, ArtifactService/ExportArtifacts).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving artifacts of a run, an empty run, a 403 above the ceiling, a 404 of another tenant, a superseded version and an unreachable KnowledgeHost; the tests prove AC1 to AC4 of AIFACTORY-US-1399 (ArtifactService/PreviewArtifact, ArtifactService/ExportArtifacts)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5647]",
      "number": 5647
    },
    {
      "id": "AIFACTORY-TASK-5701",
      "type": "task",
      "parent": "AIFACTORY-US-1399",
      "title": "Verify the StudioBff side of the artifacts screen",
      "sequence": "14.06.01.04",
      "description": "Verify the StudioBff side of the artifacts screen. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-intelligence-artifacts-and-lineage\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through KnowledgeHost from the four artifact reads with freshness, an empty list for a run with no artifact), AC2 (the 403 of a classification ceiling and the 404 of another tenant returned unchanged with no content), AC3 (`ExportArtifacts` forwarded once with its idempotency key and its 202 returned) and AC4 (refresh on `ArtifactStored`, `ArtifactValidated` and `ArtifactSuperseded`, 503 while KnowledgeHost does not answer, nothing queued) of AIFACTORY-US-1399 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-intelligence-artifacts-and-lineage\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through KnowledgeHost from the four artifact reads with freshness, an empty list for a run with no artifact), AC2 (the 403 of a classification ceiling and the 404 of another tenant returned unchanged with no content), AC3 (`ExportArtifacts` forwarded once with its idempotency key and its 202 returned) and AC4 (refresh on `ArtifactStored`, `ArtifactValidated` and `ArtifactSuperseded`, 503 while KnowledgeHost does not answer, nothing queued) of AIFACTORY-US-1399 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5701]",
      "number": 5701
    },
    {
      "id": "AIFACTORY-US-131",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-077",
      "title": "The Intelligence work area of the Studio is bound to the model",
      "sequence": "14.06.02",
      "description": "As a requester, I want the Intelligence work area of the Studio (6 screens) bound to the read models, commands, state families and roles the model names for it, so that I can read the artifacts of my runs today and see plainly which knowledge views arrive later, with every control reflecting what I may do and how fresh what I see is. This is the integration PBI of the Intelligence area. The Intelligence microfrontend is generated from the microfrontend library template, composed into the Studio shell through its registry and holds the six screens of model/ux/screens.yaml with their routes, read models, commands, state families and roles; it calls StudioBff only. A screen is offered to the roles its list names; for any other role it is absent from the navigation and `GetScreenModel` refuses it with 403. In I3 only `artifacts` reads a service at the depth it needs, delivered by AIFACTORY-US-1399. The knowledge services are thin: KnowledgeIngestionService performs no ingestion, VectorMemoryService answers retrieval with an empty, well-formed result because no index exists, RepositoryIntelligenceService works only inside the sandbox of a run with no repository index, and ContextBuilderService passes the pinned artifacts of a step through without budget, ranking or provenance; none of them serves the public reads `ListSources`, `GetSnapshot`, `Search`, `QueryGraph`, `ListRepositoryIndexSets`, `ListContextSnapshots` or `GetContextSnapshot` before its complete delivery in I5, and MemoryPromotionService is delivered in I5. So `knowledge-sources`, `knowledge-search`, `memory`, `repository-intelligence` and `context-snapshot` are registered, offered to their roles and show their sources as unknown in the freshness family, named, never hidden, never filled from a fake and never presented as an empty index; none of their commands is offered. Every screen subscribes through `Realtime.Subscribe` of StudioRealtimeGateway; when the channel drops the page marks its data stale and when it returns the page reloads the screen model. Every screen renders in English, Russian and Hebrew right to left and is built to the accessibility contract of docs/planes/experience/studio/localization-accessibility.md; the area evidence that follows this PBI checks it on the finished area. Kind: behavior. Traces: services: StudioBff, StudioRealtimeGateway, ArtifactService; apis: StudioBff/GetStudioSession, StudioBff/GetScreenModel, StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe; adrs: ADR-0007, ADR-0015; requirements: FUX-06, FUX-09. Relates: screens: knowledge-sources, knowledge-search, memory, repository-intelligence, context-snapshot. Depends on: AIFACTORY-US-1399, feature:studio-bff, feature:studio-realtime-gateway, feature:component-blazor-shell. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, model/backlog/features/knowledge.yaml, docs/planes/experience/studio/screens/intelligence.md.",
      "acceptanceCriteria": [
        "AC1: Given the shell with the Intelligence microfrontend, when each of the 6 screens of model/ux/screens.yaml opens for a role its list names, then it renders from StudioBff/GetScreenModel only, and for a role its list does not name the screen is not offered and StudioBff/GetScreenModel answers 403 (ADR-0007, ADR-0015).",
        "AC2: Given `knowledge-sources`, `knowledge-search`, `memory`, `repository-intelligence` and `context-snapshot`, when they open in I3, then each shows its sources as unknown in the freshness family of model/ux/states.yaml with the source named, shows neither an invented value nor an empty index, and offers none of its commands, as model/backlog/features/knowledge.yaml states the thin scopes (FUX-09).",
        "AC3: Given an open screen and its subscription through StudioRealtimeGateway/Realtime.Subscribe, when the channel drops, then the page marks the data stale and never presents it as current, and when the channel returns the page reloads StudioBff/GetScreenModel and shows the current state without a browser reload (FUX-06).",
        "AC4: Given the export of `artifacts`, when a role issues it, then it is forwarded once through StudioBff/ForwardCommand with an idempotency key and the scope of the session, a role without the right sees the control disabled with the reason, and the screens render in en, ru and he right to left under docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/experience/studio/screens/intelligence.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-439",
        "AIFACTORY-TASK-440",
        "AIFACTORY-TASK-441",
        "AIFACTORY-TASK-744"
      ],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11702,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "ArtifactService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "adrs": [
          "ADR-0007",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-06",
          "FUX-09"
        ]
      },
      "relates": {
        "screens": [
          "knowledge-sources",
          "knowledge-search",
          "memory",
          "repository-intelligence",
          "context-snapshot"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1399",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "model/backlog/features/knowledge.yaml",
        "docs/planes/experience/studio/screens/intelligence.md"
      ],
      "titlePrefix": "[AIFACTORY-US-131]",
      "number": 131
    },
    {
      "id": "AIFACTORY-TASK-439",
      "type": "task",
      "parent": "AIFACTORY-US-131",
      "title": "Screens of the work area Intelligence: Knowledge sources, Knowledge search and graph, Memory and promotion, Repository intelligence, Context snapshot, Artifacts and lineage",
      "sequence": "14.06.02.01",
      "description": "Screens of the work area Intelligence: Knowledge sources, Knowledge search and graph, Memory and promotion, Repository intelligence, Context snapshot, Artifacts and lineage. Expected output: The Intelligence microfrontend is composed into the shell through the registry with one navigation group and the six routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the five screens of later sources render their sources as unknown with the source named and no command.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Intelligence microfrontend is composed into the shell through the registry with one navigation group and the six routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the five screens of later sources render their sources as unknown with the source named and no command."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11702,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-439]",
      "number": 439
    },
    {
      "id": "AIFACTORY-TASK-440",
      "type": "task",
      "parent": "AIFACTORY-US-131",
      "title": "Commands of the work area Intelligence",
      "sequence": "14.06.02.02",
      "description": "Commands of the work area Intelligence. Expected output: The export of `artifacts` is forwarded through StudioBff with an idempotency key and the scope of the session, and the commands of the five screens of later sources (source registration, sync, deletion, collections, memory promotion, archive, consent, index rebuild) are not offered in I3.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The export of `artifacts` is forwarded through StudioBff with an idempotency key and the scope of the session, and the commands of the five screens of later sources (source registration, sync, deletion, collections, memory promotion, archive, consent, index rebuild) are not offered in I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-440]",
      "number": 440
    },
    {
      "id": "AIFACTORY-TASK-441",
      "type": "task",
      "parent": "AIFACTORY-US-131",
      "title": "States, roles, locales and accessibility of the work area Intelligence",
      "sequence": "14.06.02.03",
      "description": "States, roles, locales and accessibility of the work area Intelligence. Expected output: Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-441]",
      "number": 441
    },
    {
      "id": "AIFACTORY-TASK-744",
      "type": "task",
      "parent": "AIFACTORY-US-131",
      "title": "Verify studio-intelligence-work-area by running the declared command",
      "sequence": "14.06.02.04",
      "description": "Verify studio-intelligence-work-area by running the declared command. Expected output: Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-131 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-131 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-744]",
      "number": 744
    },
    {
      "id": "AIFACTORY-US-1400",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-077",
      "title": "Intelligence area evidence: every screen passes the accessibility and phone-width checks and an end-to-end walk of the area through StudioBff is recorded",
      "sequence": "14.06.03",
      "description": "As an observer, I want proof that every screen of the Intelligence area is usable by keyboard, in every locale and at phone width, and that the screens of later sources say so, so that the area is accepted on a recorded check and nobody reads an empty knowledge screen as an empty index. This PBI is the proof of the Intelligence area and comes after its integration PBI AIFACTORY-US-131, which registers the six screens. The accessibility and phone-width check opens each of the six screens of the area for a role its list in model/ux/screens.yaml names and asserts the rules of docs/planes/experience/studio/localization-accessibility.md: WCAG 2.2 AA by the automated checks, keyboard operation, generated content marked and shown in its own direction inside right-to-left pages, refusals explained in words, reduced motion honoured, in English, Russian and Hebrew, light and dark, at 1440 by 900 and at 390 by 844 with no horizontal scroll. The end-to-end walk signs in as a requester and opens the artifacts of the fixture run of the first outcome with their lineage, versions and previews, then opens an artifact above the ceiling of a second user to see the denial; it signs in as an observer to see the same screens without the export; and it opens the five knowledge, memory, repository and context screens to assert that each shows its sources as unknown, named, because their services are delivered thin or not at all in I3, and never presents an empty list as an empty index. The record holds per screen and role the expected and observed result and the network log, which shows no address other than StudioBff and StudioRealtimeGateway. Kind: evidence. Traces: services: StudioBff; apis: StudioBff/GetScreenModel; adrs: ADR-0007; requirements: FUX-09, FUX-12. Relates: screens: knowledge-sources, knowledge-search, memory, repository-intelligence, context-snapshot, artifacts; nfrs: NFR-15. Depends on: AIFACTORY-US-1399, AIFACTORY-US-131, feature:studio-bff, feature:component-blazor-shell. Sources: model/ux/screens.yaml, docs/planes/experience/studio/localization-accessibility.md, docs/planes/experience/studio/screens/intelligence.md.",
      "acceptanceCriteria": [
        "AC1: Given each of the 6 screens of the area in model/ux/screens.yaml, when the accessibility check runs in the three locales, both schemes and the two viewports of docs/planes/experience/studio/localization-accessibility.md, then every screen passes the automated WCAG 2.2 AA checks and keyboard operation and has no horizontal scroll at 390 by 844 (NFR-15, FUX-12).",
        "AC2: Given the walk as a requester, a second user under a lower ceiling and an observer, when it runs on the acceptance estate, then the artifacts of the fixture run render from StudioBff/GetScreenModel, the denial above the ceiling is shown with its explanation, and the five screens of later sources show their sources as unknown and named (ADR-0007, FUX-09).",
        "AC3: Given the record and the network log of the walk, when they are read, then the browser called no address other than StudioBff and StudioRealtimeGateway and the record holds one line per screen and role with the expected and observed result (FUX-12)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/intelligence.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5648",
        "AIFACTORY-TASK-5649",
        "AIFACTORY-TASK-5650"
      ],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11703,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetScreenModel"
        ],
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-09",
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "knowledge-sources",
          "knowledge-search",
          "memory",
          "repository-intelligence",
          "context-snapshot",
          "artifacts"
        ],
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1399",
        "AIFACTORY-US-131",
        "feature:studio-bff",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/intelligence.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1400]",
      "number": 1400
    },
    {
      "id": "AIFACTORY-TASK-5648",
      "type": "task",
      "parent": "AIFACTORY-US-1400",
      "title": "End-to-end walk of the Intelligence area",
      "sequence": "14.06.03.01",
      "description": "End-to-end walk of the Intelligence area. Expected output: A browser-driven walk in the Studio repository that signs in as a requester, a user under a lower classification ceiling and an observer, opens the artifacts of the fixture run and the five screens of later sources, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven walk in the Studio repository that signs in as a requester, a user under a lower classification ceiling and an observer, opens the artifacts of the fixture run and the five screens of later sources, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5648]",
      "number": 5648
    },
    {
      "id": "AIFACTORY-TASK-5649",
      "type": "task",
      "parent": "AIFACTORY-US-1400",
      "title": "Accessibility and phone-width check of the Intelligence screens",
      "sequence": "14.06.03.02",
      "description": "Accessibility and phone-width check of the Intelligence screens. Expected output: Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the six screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1400 against docs/planes/experience/studio/localization-accessibility.md.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility | npx playwright test --project=phone-390x844.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the six screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1400 against docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5649]",
      "number": 5649
    },
    {
      "id": "AIFACTORY-TASK-5650",
      "type": "task",
      "parent": "AIFACTORY-US-1400",
      "title": "Verify the walk record of the Intelligence area",
      "sequence": "14.06.03.03",
      "description": "Verify the walk record of the Intelligence area. Expected output: Run the walk of AIFACTORY-TASK-5648 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1400 (StudioBff/GetScreenModel) and are kept with the evidence of increment I3.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the walk of AIFACTORY-TASK-5648 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1400 (StudioBff/GetScreenModel) and are kept with the evidence of increment I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 117,
      "phase": "factory",
      "stackRank": 11703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5650]",
      "number": 5650
    },
    {
      "id": "AIFACTORY-FEAT-078",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "Studio work area: Operations & usage",
      "sequence": "14.07",
      "description": "The 13 screens of the Studio work area Operations & usage on the Blazor shell and microfrontends, bound to the read models and commands the model names for them, with their state families, roles, locales and accessibility contracts. Screens come from model/ux/screens.yaml and the prototype alignment. Increment I3: Studio. Build order 118 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1401",
        "AIFACTORY-US-1402",
        "AIFACTORY-US-1403",
        "AIFACTORY-US-132",
        "AIFACTORY-US-1404"
      ],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11800,
      "titlePrefix": "[AIFACTORY-FEAT-078]",
      "number": 78
    },
    {
      "id": "AIFACTORY-US-1401",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-078",
      "title": "Operations: I read the timeline of a run from its workflow graph and its attempt timelines while the run projection of the dashboard is not yet delivered",
      "sequence": "14.07.01",
      "description": "As an operator, I want to read, for one run, the state of every step, the phases, checkpoints, calls and decisions of each attempt and its outcome, so that I understand where a run stands or why it failed without opening a log, and I am told which part of the timeline is not yet available. A requester, a reviewer, an operator or an observer opens the screen `run-timeline` at `/operations/runs/{runId}`. StudioBff composes it under the scope of the session from `GetWorkflowRunGraph` of WorkflowEngineService, the graph of the run with the state of every step run, its timers and its compensation entries, and from `GetAttemptTimeline` of AgentRuntimeService for each attempt the user expands: phases, checkpoints, calls by hash and receipt reference and never by content, decisions and the outcome. Both services are reached through AgentRuntimeWorker, the internal gateway of the Agent Mesh platform. The third read model of the screen, `GetRunTimeline`, is the run projection of DashboardService, which is delivered in I4; in I3 the page shows that source as unknown in the freshness family, named, and builds the timeline from the graph and the attempts only, never from a fake projection. The screen has no command. StudioBff consumes `StepRunStateChanged` of WorkflowEngineService and `AttemptPhaseChanged` of AgentRuntimeService, refreshes the workflow run and attempt views and signals the open page, which updates the state of the step and the phase of the attempt without a reload. A run of another tenant is answered 404 like a run that does not exist, a missing scope 403, and the page says which. When AgentRuntimeWorker does not answer, the composition shows the Agent Mesh source degraded with its last freshness and keeps the parts it already holds marked stale. A failed attempt shows its failure class and its last receipt reference, which is the adverse branch of the flow `recover-run` of model/ux/flows.yaml that I3 can show. Kind: behavior. Traces: services: StudioBff, WorkflowEngineService, AgentRuntimeService; apis: StudioBff/GetScreenModel, WorkflowEngineService/GetWorkflowRunGraph, AgentRuntimeService/GetAttemptTimeline; events: WorkflowEngineService/StepRunStateChanged, AgentRuntimeService/AttemptPhaseChanged; adrs: ADR-0015, ADR-0024; requirements: FUX-04, FUX-07. Relates: screens: run-timeline. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:workflow-engine-service, feature:agent-runtime-service, feature:agent-runtime-worker. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an operator on `run-timeline`, when StudioBff/GetScreenModel composes it, then the steps come from WorkflowEngineService/GetWorkflowRunGraph and each expanded attempt from AgentRuntimeService/GetAttemptTimeline, calls are shown by hash and receipt reference and never by content, and the run projection source is shown unknown and named (FUX-04).",
        "AC2: Given an open timeline, when WorkflowEngineService/StepRunStateChanged or AgentRuntimeService/AttemptPhaseChanged is consumed by StudioBff, then the page shows the new step state or phase without a reload, and a failed attempt shows its failure class and its last receipt reference as the flow `recover-run` of model/ux/flows.yaml describes (FUX-07).",
        "AC3: Given a run of another tenant, a missing scope or an unreachable AgentRuntimeWorker, when the timeline is requested, then the answer is 404 or 403 explained in words, or the Agent Mesh source is shown degraded with its last freshness and the parts already held are marked stale (ADR-0015, model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5651",
        "AIFACTORY-TASK-5652",
        "AIFACTORY-TASK-5653",
        "AIFACTORY-TASK-5702"
      ],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11801,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "WorkflowEngineService",
          "AgentRuntimeService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "WorkflowEngineService/GetWorkflowRunGraph",
          "AgentRuntimeService/GetAttemptTimeline"
        ],
        "events": [
          "WorkflowEngineService/StepRunStateChanged",
          "AgentRuntimeService/AttemptPhaseChanged"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "FUX-04",
          "FUX-07"
        ]
      },
      "relates": {
        "screens": [
          "run-timeline"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:workflow-engine-service",
        "feature:agent-runtime-service",
        "feature:agent-runtime-worker"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1401]",
      "number": 1401
    },
    {
      "id": "AIFACTORY-TASK-5651",
      "type": "task",
      "parent": "AIFACTORY-US-1401",
      "title": "Run timeline screen in the Operations microfrontend",
      "sequence": "14.07.01.01",
      "description": "Run timeline screen in the Operations microfrontend. Expected output: The Operations microfrontend renders `run-timeline` with the run and freshness families, the steps of the graph with their states, timers and compensation entries, expandable attempts with phases, checkpoints, calls by hash and receipt reference, decisions and outcome, and the run projection source marked unknown with its name.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Operations microfrontend renders `run-timeline` with the run and freshness families, the steps of the graph with their states, timers and compensation entries, expandable attempts with phases, checkpoints, calls by hash and receipt reference, decisions and outcome, and the run projection source marked unknown with its name."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11801,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5651]",
      "number": 5651
    },
    {
      "id": "AIFACTORY-TASK-5652",
      "type": "task",
      "parent": "AIFACTORY-US-1401",
      "title": "Screen model of the run timeline in StudioBff",
      "sequence": "14.07.01.02",
      "description": "Screen model of the run timeline in StudioBff. Expected output: StudioBff composes `run-timeline` through AgentRuntimeWorker from `GetWorkflowRunGraph` and `GetAttemptTimeline` with the freshness of each source, marks the run projection source unknown in I3, and refreshes the workflow run and attempt views on `StepRunStateChanged` and `AttemptPhaseChanged`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `run-timeline` through AgentRuntimeWorker from `GetWorkflowRunGraph` and `GetAttemptTimeline` with the freshness of each source, marks the run projection source unknown in I3, and refreshes the workflow run and attempt views on `StepRunStateChanged` and `AttemptPhaseChanged`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11801,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5652]",
      "number": 5652
    },
    {
      "id": "AIFACTORY-TASK-5653",
      "type": "task",
      "parent": "AIFACTORY-US-1401",
      "title": "Verify the run timeline with live changes and a failed attempt",
      "sequence": "14.07.01.03",
      "description": "Verify the run timeline with live changes and a failed attempt. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a graph, two attempts, a failed attempt with its failure class, a pushed step change, a 404 of another tenant and an unreachable gateway; the tests prove AC1 to AC3 of AIFACTORY-US-1401 (WorkflowEngineService/GetWorkflowRunGraph, AgentRuntimeService/GetAttemptTimeline).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a graph, two attempts, a failed attempt with its failure class, a pushed step change, a 404 of another tenant and an unreachable gateway; the tests prove AC1 to AC3 of AIFACTORY-US-1401 (WorkflowEngineService/GetWorkflowRunGraph, AgentRuntimeService/GetAttemptTimeline)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5653]",
      "number": 5653
    },
    {
      "id": "AIFACTORY-TASK-5702",
      "type": "task",
      "parent": "AIFACTORY-US-1401",
      "title": "Verify the StudioBff side of the run timeline",
      "sequence": "14.07.01.04",
      "description": "Verify the StudioBff side of the run timeline. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-operations-run-timeline-from-attempts-and-graph\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through AgentRuntimeWorker from `GetWorkflowRunGraph` and `GetAttemptTimeline`, calls by hash only, the run projection source marked unknown), AC2 (refresh on `StepRunStateChanged` and `AttemptPhaseChanged`) and AC3 (404 and 403 returned unchanged, the Agent Mesh source degraded with its last freshness while AgentRuntimeWorker does not answer) of AIFACTORY-US-1401 (StudioBff/GetScreenModel).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-operations-run-timeline-from-attempts-and-graph\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through AgentRuntimeWorker from `GetWorkflowRunGraph` and `GetAttemptTimeline`, calls by hash only, the run projection source marked unknown), AC2 (refresh on `StepRunStateChanged` and `AttemptPhaseChanged`) and AC3 (404 and 403 returned unchanged, the Agent Mesh source degraded with its last freshness while AgentRuntimeWorker does not answer) of AIFACTORY-US-1401 (StudioBff/GetScreenModel)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5702]",
      "number": 5702
    },
    {
      "id": "AIFACTORY-US-1402",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-078",
      "title": "Operations: I read project and run usage by status with uncertain amounts kept apart, and set a project budget whose threshold may only lower the platform one",
      "sequence": "14.07.02",
      "description": "As a workspace admin, I want to see what the project and each run consumed, by meter and by status, and to set the project budget, so that I steer spending on attributed numbers and never mistake an uncertain amount for a settled one. A workspace admin, an operator or an observer opens the screen `usage-cost` at `/operations/usage`. StudioBff composes it under the scope of the session from CostUsageService, reached through ControlPlaneApi: `GetProjectUsage` for a period, with usage by meter and by status (estimated, reserved, observed, reconciled, uncertain), and `GetRunUsage` for the usage records and the reservation of one run. The usage family of model/ux/states.yaml governs the display: every amount shows its status and its currency code, and an uncertain amount is shown apart and never folded into a total, which is the adverse branch of the flow `submit-assessment` of model/ux/flows.yaml. A workspace admin sets the project budget and its threshold with `SetProjectBudget`, sent through `ForwardCommand` with an idempotency key; `SetProjectBudget` of model/services/control-plane/CostUsageService.yaml takes a threshold not above the platform one, so a higher threshold is answered 409 and the page says that a project may only lower it; the flow `govern-knowledge-and-usage` words the same refusal against the threshold of the tenant. A project of another tenant is answered 404. An operator and an observer see the control disabled with the reason. The two commercial read models of the screen, `GetSubscription` and `ListInvoices` of FactoryCommercialService, are delivered in I7; in I3 the page shows that source as unknown in the freshness family, named, and shows no subscription or invoice value. StudioBff consumes `BudgetUpdated` and `ReservationSettled` and refreshes the budget and reservation views, so a settled reservation moves from reserved to observed on the open page without a reload. When ControlPlaneApi does not answer, the source is shown degraded with its last freshness and the budget change is refused with 503, never queued. Kind: behavior. Traces: services: StudioBff, CostUsageService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, CostUsageService/GetProjectUsage, CostUsageService/GetRunUsage, CostUsageService/SetProjectBudget; events: CostUsageService/BudgetUpdated, CostUsageService/ReservationSettled; adrs: ADR-0015; requirements: FUX-08. Relates: screens: usage-cost; nfrs: NFR-12. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:cost-usage-service-complete, feature:control-plane-api. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/flows.yaml, model/services/control-plane/CostUsageService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a workspace admin on `usage-cost`, when StudioBff/GetScreenModel composes it, then usage comes from CostUsageService/GetProjectUsage and CostUsageService/GetRunUsage by meter and status with the currency code, and an uncertain amount is shown apart and never added to a total (FUX-08, NFR-12).",
        "AC2: Given a workspace admin, when they set a budget, then StudioBff/ForwardCommand forwards CostUsageService/SetProjectBudget with an idempotency key, a threshold above the platform one is answered 409 and explained as a project that may only lower it, as CostUsageService/SetProjectBudget in model/services/control-plane/CostUsageService.yaml states, a project of another tenant is answered 404, and an operator or observer sees the control disabled with the reason (ADR-0015).",
        "AC3: Given the commercial source of the screen, when it opens in I3, then the subscription and invoice part is shown unknown and named with no invented value, and when CostUsageService/ReservationSettled or CostUsageService/BudgetUpdated is consumed by StudioBff the open page refreshes without a reload (model/ux/states.yaml)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5654",
        "AIFACTORY-TASK-5655",
        "AIFACTORY-TASK-5656",
        "AIFACTORY-TASK-5703"
      ],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11802,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "CostUsageService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "CostUsageService/GetProjectUsage",
          "CostUsageService/GetRunUsage",
          "CostUsageService/SetProjectBudget"
        ],
        "events": [
          "CostUsageService/BudgetUpdated",
          "CostUsageService/ReservationSettled"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-08"
        ]
      },
      "relates": {
        "screens": [
          "usage-cost"
        ],
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:cost-usage-service-complete",
        "feature:control-plane-api"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/CostUsageService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1402]",
      "number": 1402
    },
    {
      "id": "AIFACTORY-TASK-5654",
      "type": "task",
      "parent": "AIFACTORY-US-1402",
      "title": "Usage and cost screen in the Operations microfrontend",
      "sequence": "14.07.02.01",
      "description": "Usage and cost screen in the Operations microfrontend. Expected output: The Operations microfrontend renders `usage-cost` with the usage family, amounts by meter and status with their currency code, uncertain amounts in their own row never added to a total, a budget form with the platform threshold shown beside it, the refusal in words, and the commercial source marked unknown with its name.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Operations microfrontend renders `usage-cost` with the usage family, amounts by meter and status with their currency code, uncertain amounts in their own row never added to a total, a budget form with the platform threshold shown beside it, the refusal in words, and the commercial source marked unknown with its name."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11802,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5654]",
      "number": 5654
    },
    {
      "id": "AIFACTORY-TASK-5655",
      "type": "task",
      "parent": "AIFACTORY-US-1402",
      "title": "Screen model and budget route of the usage screen in StudioBff",
      "sequence": "14.07.02.02",
      "description": "Screen model and budget route of the usage screen in StudioBff. Expected output: StudioBff composes `usage-cost` through ControlPlaneApi from `GetProjectUsage` and `GetRunUsage` with the freshness of the source, marks the commercial source unknown in I3, forwards `SetProjectBudget` with an idempotency key and the scope of the session, refuses it with 503 while ControlPlaneApi does not answer, and refreshes the views on `BudgetUpdated` and `ReservationSettled`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `usage-cost` through ControlPlaneApi from `GetProjectUsage` and `GetRunUsage` with the freshness of the source, marks the commercial source unknown in I3, forwards `SetProjectBudget` with an idempotency key and the scope of the session, refuses it with 503 while ControlPlaneApi does not answer, and refreshes the views on `BudgetUpdated` and `ReservationSettled`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11802,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5655]",
      "number": 5655
    },
    {
      "id": "AIFACTORY-TASK-5656",
      "type": "task",
      "parent": "AIFACTORY-US-1402",
      "title": "Verify the usage screen with uncertain amounts and a refused threshold",
      "sequence": "14.07.02.03",
      "description": "Verify the usage screen with uncertain amounts and a refused threshold. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving usage in all five statuses, a 409 on a threshold above the platform one, a 404 of another tenant and a settled reservation pushed live; the tests prove AC1 to AC3 of AIFACTORY-US-1402 (CostUsageService/SetProjectBudget).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving usage in all five statuses, a 409 on a threshold above the platform one, a 404 of another tenant and a settled reservation pushed live; the tests prove AC1 to AC3 of AIFACTORY-US-1402 (CostUsageService/SetProjectBudget)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5656]",
      "number": 5656
    },
    {
      "id": "AIFACTORY-TASK-5703",
      "type": "task",
      "parent": "AIFACTORY-US-1402",
      "title": "Verify the StudioBff side of the usage screen",
      "sequence": "14.07.02.04",
      "description": "Verify the StudioBff side of the usage screen. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-operations-usage-and-cost\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through ControlPlaneApi from `GetProjectUsage` and `GetRunUsage` with every status and the uncertain amounts apart), AC2 (`SetProjectBudget` forwarded once with its idempotency key, its 409 and 404 returned unchanged, 503 while ControlPlaneApi does not answer and nothing queued) and AC3 (the commercial source marked unknown, refresh on `ReservationSettled` and `BudgetUpdated`) of AIFACTORY-US-1402 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-operations-usage-and-cost\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through ControlPlaneApi from `GetProjectUsage` and `GetRunUsage` with every status and the uncertain amounts apart), AC2 (`SetProjectBudget` forwarded once with its idempotency key, its 409 and 404 returned unchanged, 503 while ControlPlaneApi does not answer and nothing queued) and AC3 (the commercial source marked unknown, refresh on `ReservationSettled` and `BudgetUpdated`) of AIFACTORY-US-1402 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5703]",
      "number": 5703
    },
    {
      "id": "AIFACTORY-US-1403",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-078",
      "title": "Operations: I see worker pools, effective quotas and capacity leases, and change a pool or tighten a quota with the role and class ExecutionCapacityService requires",
      "sequence": "14.07.03",
      "description": "As an operator, I want to see the worker pools, the quotas in force and who holds which lease, and to have a pool or a quota changed by the role allowed to do it, so that runs that wait for capacity are explained by a named limit and capacity changes follow their class. An operator, a workspace admin, a platform admin or an observer opens the screen `capacity` at `/operations/capacity`. StudioBff composes it under the scope of the session from ExecutionCapacityService, reached through RuntimeCloudHost: `ListWorkerPools` with kind, boundary, region, size and utilisation, `GetQuotas` with the effective quotas of the tenant and its projects and the edition source of each, and `ListCapacityLeases` with the active and recent leases by holder, pool and state. A platform admin creates or changes the bounds and autoscaling of a pool with `SetWorkerPool`, a production-class action that is applied through provisioning, so the page sends it through `ForwardCommand` with an idempotency key and the approval binding its class requires and shows the pool as changing until the state is observed; a workspace admin tightens a project or tenant quota with `SetQuota` and a platform admin sets the edition defaults with it. A value the service rejects is answered 422 and explained per field. An operator and an observer see the commands disabled with the reason. The read model `ListComputePools` and the command `DrainComputePool` belong to ComputePoolService, delivered in I8; in I3 the page shows that source as unknown in the freshness family, named, and offers no drain. StudioBff consumes `WorkerPoolStateChanged`, `QuotaChanged` and `QuotaExceeded` and refreshes the pool and quota views; a quota that is exceeded is shown with its limit named, which is the adverse branch of the flow `manage-editions-and-billing` of model/ux/flows.yaml that runs wait with the limit named. When RuntimeCloudHost does not answer, the source is shown degraded with its last freshness and the commands are refused with 503, never queued. Kind: behavior. Traces: services: StudioBff, ExecutionCapacityService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, ExecutionCapacityService/ListWorkerPools, ExecutionCapacityService/GetQuotas, ExecutionCapacityService/ListCapacityLeases, ExecutionCapacityService/SetWorkerPool, ExecutionCapacityService/SetQuota; events: ExecutionCapacityService/WorkerPoolStateChanged, ExecutionCapacityService/QuotaChanged, ExecutionCapacityService/QuotaExceeded; requirements: FUX-08. Relates: screens: capacity; nfrs: NFR-08. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:execution-capacity-service-complete, feature:runtime-cloud-host. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an operator on `capacity`, when StudioBff/GetScreenModel composes it, then pools, quotas and leases come from ExecutionCapacityService/ListWorkerPools, ExecutionCapacityService/GetQuotas and ExecutionCapacityService/ListCapacityLeases with the edition source of each quota, and the compute pool source is shown unknown and named with no drain offered (FUX-08).",
        "AC2: Given a platform admin who changes a pool or a workspace admin who tightens a quota, when StudioBff/ForwardCommand forwards ExecutionCapacityService/SetWorkerPool with the approval binding of its production class or ExecutionCapacityService/SetQuota, then a 422 is explained per field, the pool shows as changing until ExecutionCapacityService/WorkerPoolStateChanged is consumed, and an operator or observer sees the commands disabled with the reason (NFR-08).",
        "AC3: Given a quota reached, when ExecutionCapacityService/QuotaExceeded or ExecutionCapacityService/QuotaChanged is consumed by StudioBff, then the open page shows the limit named without a reload, as the flow `manage-editions-and-billing` of model/ux/flows.yaml describes, and when RuntimeCloudHost does not answer the source is degraded and commands answer 503 (model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5657",
        "AIFACTORY-TASK-5658",
        "AIFACTORY-TASK-5659",
        "AIFACTORY-TASK-5704"
      ],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11803,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ExecutionCapacityService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "ExecutionCapacityService/ListWorkerPools",
          "ExecutionCapacityService/GetQuotas",
          "ExecutionCapacityService/ListCapacityLeases",
          "ExecutionCapacityService/SetWorkerPool",
          "ExecutionCapacityService/SetQuota"
        ],
        "events": [
          "ExecutionCapacityService/WorkerPoolStateChanged",
          "ExecutionCapacityService/QuotaChanged",
          "ExecutionCapacityService/QuotaExceeded"
        ],
        "requirements": [
          "FUX-08"
        ]
      },
      "relates": {
        "screens": [
          "capacity"
        ],
        "nfrs": [
          "NFR-08"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:execution-capacity-service-complete",
        "feature:runtime-cloud-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1403]",
      "number": 1403
    },
    {
      "id": "AIFACTORY-TASK-5657",
      "type": "task",
      "parent": "AIFACTORY-US-1403",
      "title": "Capacity and quotas screen in the Operations microfrontend",
      "sequence": "14.07.03.01",
      "description": "Capacity and quotas screen in the Operations microfrontend. Expected output: The Operations microfrontend renders `capacity` with the freshness family, pools with utilisation, quotas with their edition source, leases by holder and state, the pool editor for a platform admin with the class of the action beside it, the quota editor that only tightens for a workspace admin, field errors of a 422, and the compute pool source marked unknown.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Operations microfrontend renders `capacity` with the freshness family, pools with utilisation, quotas with their edition source, leases by holder and state, the pool editor for a platform admin with the class of the action beside it, the quota editor that only tightens for a workspace admin, field errors of a 422, and the compute pool source marked unknown."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11803,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5657]",
      "number": 5657
    },
    {
      "id": "AIFACTORY-TASK-5658",
      "type": "task",
      "parent": "AIFACTORY-US-1403",
      "title": "Screen model and command routes of the capacity screen in StudioBff",
      "sequence": "14.07.03.02",
      "description": "Screen model and command routes of the capacity screen in StudioBff. Expected output: StudioBff composes `capacity` through RuntimeCloudHost from `ListWorkerPools`, `GetQuotas` and `ListCapacityLeases` with the freshness of the source, marks the compute pool source unknown in I3, forwards `SetWorkerPool` with its approval binding and `SetQuota` with an idempotency key, and refreshes the views on `WorkerPoolStateChanged`, `QuotaChanged` and `QuotaExceeded`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `capacity` through RuntimeCloudHost from `ListWorkerPools`, `GetQuotas` and `ListCapacityLeases` with the freshness of the source, marks the compute pool source unknown in I3, forwards `SetWorkerPool` with its approval binding and `SetQuota` with an idempotency key, and refreshes the views on `WorkerPoolStateChanged`, `QuotaChanged` and `QuotaExceeded`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11803,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5658]",
      "number": 5658
    },
    {
      "id": "AIFACTORY-TASK-5659",
      "type": "task",
      "parent": "AIFACTORY-US-1403",
      "title": "Verify the capacity screen by role with a quota exceeded",
      "sequence": "14.07.03.03",
      "description": "Verify the capacity screen by role with a quota exceeded. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving pools, quotas and leases to each of the four roles, a 422 on a pool change, a pushed `QuotaExceeded` and an unreachable RuntimeCloudHost; the tests prove AC1 to AC3 of AIFACTORY-US-1403 (ExecutionCapacityService/SetWorkerPool, ExecutionCapacityService/SetQuota).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving pools, quotas and leases to each of the four roles, a 422 on a pool change, a pushed `QuotaExceeded` and an unreachable RuntimeCloudHost; the tests prove AC1 to AC3 of AIFACTORY-US-1403 (ExecutionCapacityService/SetWorkerPool, ExecutionCapacityService/SetQuota)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5659]",
      "number": 5659
    },
    {
      "id": "AIFACTORY-TASK-5704",
      "type": "task",
      "parent": "AIFACTORY-US-1403",
      "title": "Verify the StudioBff side of the capacity screen",
      "sequence": "14.07.03.04",
      "description": "Verify the StudioBff side of the capacity screen. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-operations-capacity-and-quotas\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through RuntimeCloudHost from the pool, quota and lease reads, the compute pool source marked unknown), AC2 (`SetWorkerPool` forwarded with the approval binding of its production class and `SetQuota` with its idempotency key, a 422 returned unchanged, refresh on `WorkerPoolStateChanged`) and AC3 (refresh on `QuotaExceeded` and `QuotaChanged`, 503 while RuntimeCloudHost does not answer and nothing queued) of AIFACTORY-US-1403 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-operations-capacity-and-quotas\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through RuntimeCloudHost from the pool, quota and lease reads, the compute pool source marked unknown), AC2 (`SetWorkerPool` forwarded with the approval binding of its production class and `SetQuota` with its idempotency key, a 422 returned unchanged, refresh on `WorkerPoolStateChanged`) and AC3 (refresh on `QuotaExceeded` and `QuotaChanged`, 503 while RuntimeCloudHost does not answer and nothing queued) of AIFACTORY-US-1403 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5704]",
      "number": 5704
    },
    {
      "id": "AIFACTORY-US-132",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-078",
      "title": "The Operations & usage work area of the Studio is bound to the model",
      "sequence": "14.07.04",
      "description": "As an operator, I want the Operations & usage work area of the Studio (13 screens) bound to the read models, commands, state families and roles the model names for it, so that I can follow runs, usage and capacity from one place and see plainly which operations views arrive later, with every control reflecting what I may do and how fresh what I see is. This is the integration PBI of the Operations and usage area. The Operations microfrontend is generated from the microfrontend library template, composed into the Studio shell through its registry and holds the thirteen screens of model/ux/screens.yaml with their routes, read models, commands, state families and roles; it calls StudioBff only. A screen is offered to the roles its list names; for any other role it is absent from the navigation and `GetScreenModel` refuses it with 403. Three screens are delivered in I3 by AIFACTORY-US-1401 to AIFACTORY-US-1403. Four read the observability services of I4: `run-list` and `overview` read DashboardService, which in I4 serves only the run projections and the project and tenant overviews (D131), `status-objectives` reads SloService and `alerts` reads AlertRuleService. Six read the fleet services of I7: `fleet-board`, `product`, `rollouts`, `incidents`, `on-call` and `offboardings`. In I3 each of these ten screens is registered, offered to its roles and shows its sources as unknown in the freshness family, named, never hidden and never filled from a fake; none of its commands is offered, so the rebuild of a run projection, the acknowledgement of an alert and the fleet commands wait for those increments. Every screen subscribes through `Realtime.Subscribe` of StudioRealtimeGateway; when the channel drops the page marks its data stale and when it returns the page reloads the screen model. A command needing the approval binding of its class carries it to the owning service, whose gate decides. Every screen renders in English, Russian and Hebrew right to left and is built to the accessibility contract of docs/planes/experience/studio/localization-accessibility.md; the area evidence that follows this PBI checks it on the finished area. Kind: behavior. Traces: services: StudioBff, StudioRealtimeGateway, WorkflowEngineService, AgentRuntimeService, CostUsageService, ExecutionCapacityService; apis: StudioBff/GetStudioSession, StudioBff/GetScreenModel, StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe; adrs: ADR-0007, ADR-0015; requirements: FUX-04, FUX-08. Relates: screens: run-list, overview, status-objectives, alerts, fleet-board, product, rollouts, incidents, on-call, offboardings. Depends on: AIFACTORY-US-1401, AIFACTORY-US-1402, AIFACTORY-US-1403, feature:studio-bff, feature:studio-realtime-gateway, feature:component-blazor-shell. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, docs/planes/experience/studio/screens/operations-usage.md.",
      "acceptanceCriteria": [
        "AC1: Given the shell with the Operations microfrontend, when each of the 13 screens of model/ux/screens.yaml opens for a role its list names, then it renders from StudioBff/GetScreenModel only, and for a role its list does not name the screen is not offered and StudioBff/GetScreenModel answers 403 (ADR-0007, ADR-0015).",
        "AC2: Given `run-list`, `overview`, `status-objectives`, `alerts`, `fleet-board`, `product`, `rollouts`, `incidents`, `on-call` and `offboardings`, when they open in I3, then each shows its sources as unknown in the freshness family of model/ux/states.yaml with the source named, shows no invented value and offers none of its commands (FUX-04).",
        "AC3: Given an open screen and its subscription through StudioRealtimeGateway/Realtime.Subscribe, when the channel drops, then the page marks the data stale and never presents it as current, and when the channel returns the page reloads StudioBff/GetScreenModel and shows the current state without a browser reload (FUX-08).",
        "AC4: Given a command of a delivered screen, when a role issues it, then it is forwarded once through StudioBff/ForwardCommand with an idempotency key, the scope of the session and the approval binding its class requires, a role without the right sees the control disabled with the reason, and the screens render in en, ru and he right to left under docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/operations-usage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-442",
        "AIFACTORY-TASK-443",
        "AIFACTORY-TASK-444",
        "AIFACTORY-TASK-746"
      ],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11804,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "WorkflowEngineService",
          "AgentRuntimeService",
          "CostUsageService",
          "ExecutionCapacityService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "adrs": [
          "ADR-0007",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04",
          "FUX-08"
        ]
      },
      "relates": {
        "screens": [
          "run-list",
          "overview",
          "status-objectives",
          "alerts",
          "fleet-board",
          "product",
          "rollouts",
          "incidents",
          "on-call",
          "offboardings"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1401",
        "AIFACTORY-US-1402",
        "AIFACTORY-US-1403",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/operations-usage.md"
      ],
      "titlePrefix": "[AIFACTORY-US-132]",
      "number": 132
    },
    {
      "id": "AIFACTORY-TASK-442",
      "type": "task",
      "parent": "AIFACTORY-US-132",
      "title": "Screens of the work area Operations & usage: Runs, Run timeline, Operations overview, Status and objectives, Alerts, Usage and cost, Capacity and quotas, Fleet board and 5 more",
      "sequence": "14.07.04.01",
      "description": "Screens of the work area Operations & usage: Runs, Run timeline, Operations overview, Status and objectives, Alerts, Usage and cost, Capacity and quotas, Fleet board and 5 more. Expected output: The Operations microfrontend is composed into the shell through the registry with one navigation group and the thirteen routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the ten screens of later sources render their sources as unknown with the source named and no command.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Operations microfrontend is composed into the shell through the registry with one navigation group and the thirteen routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the ten screens of later sources render their sources as unknown with the source named and no command."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11804,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-442]",
      "number": 442
    },
    {
      "id": "AIFACTORY-TASK-443",
      "type": "task",
      "parent": "AIFACTORY-US-132",
      "title": "Commands of the work area Operations & usage",
      "sequence": "14.07.04.02",
      "description": "Commands of the work area Operations & usage. Expected output: The commands of the three delivered screens are forwarded through StudioBff with an idempotency key, the scope of the session and the approval binding their class requires, and the commands of the ten screens of later sources (projection rebuild, objectives, alerts, fleet, rollouts, incidents, on-call, off-boarding, compute pools) are not offered in I3.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The commands of the three delivered screens are forwarded through StudioBff with an idempotency key, the scope of the session and the approval binding their class requires, and the commands of the ten screens of later sources (projection rebuild, objectives, alerts, fleet, rollouts, incidents, on-call, off-boarding, compute pools) are not offered in I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-443]",
      "number": 443
    },
    {
      "id": "AIFACTORY-TASK-444",
      "type": "task",
      "parent": "AIFACTORY-US-132",
      "title": "States, roles, locales and accessibility of the work area Operations & usage",
      "sequence": "14.07.04.03",
      "description": "States, roles, locales and accessibility of the work area Operations & usage. Expected output: Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-444]",
      "number": 444
    },
    {
      "id": "AIFACTORY-TASK-746",
      "type": "task",
      "parent": "AIFACTORY-US-132",
      "title": "Verify studio-operations-usage-work-area by running the declared command",
      "sequence": "14.07.04.04",
      "description": "Verify studio-operations-usage-work-area by running the declared command. Expected output: Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-132 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-132 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-746]",
      "number": 746
    },
    {
      "id": "AIFACTORY-US-1404",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-078",
      "title": "Operations and usage area evidence: every screen passes the accessibility and phone-width checks and an end-to-end walk of the area through StudioBff is recorded",
      "sequence": "14.07.05",
      "description": "As an observer, I want proof that every screen of the Operations and usage area is usable by keyboard, in every locale and at phone width, and that the screens of the fourth and later increments say they are not yet delivered, so that the area is accepted on a recorded check and no operations figure is read from a fake. This PBI is the proof of the Operations and usage area and comes after its integration PBI AIFACTORY-US-132, which registers the thirteen screens. The accessibility and phone-width check opens each of the thirteen screens of the area for a role its list in model/ux/screens.yaml names and asserts the rules of docs/planes/experience/studio/localization-accessibility.md: WCAG 2.2 AA by the automated checks, keyboard operation, live updates announced politely and not animated under reduced motion, amounts with their currency code, refusals explained in words, in English, Russian and Hebrew right to left, light and dark, at 1440 by 900 and at 390 by 844 with no horizontal scroll. The end-to-end walk signs in as an operator and opens the timeline of the fixture run of the first outcome with its graph and attempts, then the capacity screen with its pools, quotas and leases; as a workspace admin it reads the usage of the project with its uncertain amounts apart and has a threshold above the platform one refused; and as an observer it sees the same screens without commands. The screens whose sources are delivered in I4 (runs, overview, status and objectives, alerts) or in I7 (fleet board, operated product, rollouts, incidents, on-call, off-boardings) show their sources as unknown and are listed by name. The record holds per screen and role the expected and observed result and the network log, which shows no address other than StudioBff and StudioRealtimeGateway. Kind: evidence. Traces: services: StudioBff; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand; adrs: ADR-0007; requirements: FUX-04, FUX-12. Relates: screens: run-list, run-timeline, overview, status-objectives, alerts, usage-cost, capacity, fleet-board, product, rollouts, incidents, on-call, offboardings; nfrs: NFR-15. Depends on: AIFACTORY-US-1401, AIFACTORY-US-1402, AIFACTORY-US-1403, AIFACTORY-US-132, feature:studio-bff, feature:component-blazor-shell. Sources: model/ux/screens.yaml, docs/planes/experience/studio/localization-accessibility.md, docs/planes/experience/studio/screens/operations-usage.md.",
      "acceptanceCriteria": [
        "AC1: Given each of the 13 screens of the area in model/ux/screens.yaml, when the accessibility check runs in the three locales, both schemes and the two viewports of docs/planes/experience/studio/localization-accessibility.md, then every screen passes the automated WCAG 2.2 AA checks and keyboard operation and has no horizontal scroll at 390 by 844 (NFR-15, FUX-12).",
        "AC2: Given the walk as an operator, a workspace admin and an observer, when it runs on the acceptance estate, then the timeline, usage and capacity screens render from StudioBff/GetScreenModel, the refused threshold goes through StudioBff/ForwardCommand and is explained, and the ten screens of later sources are listed by name with their sources unknown (ADR-0007, FUX-04).",
        "AC3: Given the record and the network log of the walk, when they are read, then the browser called no address other than StudioBff and StudioRealtimeGateway and no screen showed a value its source does not deliver in I3 (FUX-12)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/operations-usage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5660",
        "AIFACTORY-TASK-5661",
        "AIFACTORY-TASK-5662"
      ],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11805,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand"
        ],
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-04",
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "run-list",
          "run-timeline",
          "overview",
          "status-objectives",
          "alerts",
          "usage-cost",
          "capacity",
          "fleet-board",
          "product",
          "rollouts",
          "incidents",
          "on-call",
          "offboardings"
        ],
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1401",
        "AIFACTORY-US-1402",
        "AIFACTORY-US-1403",
        "AIFACTORY-US-132",
        "feature:studio-bff",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/operations-usage.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1404]",
      "number": 1404
    },
    {
      "id": "AIFACTORY-TASK-5660",
      "type": "task",
      "parent": "AIFACTORY-US-1404",
      "title": "End-to-end walk of the Operations and usage area",
      "sequence": "14.07.05.01",
      "description": "End-to-end walk of the Operations and usage area. Expected output: A browser-driven walk in the Studio repository that signs in as an operator, a workspace admin and an observer, opens the timeline of the fixture run, the usage and capacity screens and the ten screens of later sources, attempts the refused threshold, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven walk in the Studio repository that signs in as an operator, a workspace admin and an observer, opens the timeline of the fixture run, the usage and capacity screens and the ten screens of later sources, attempts the refused threshold, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11805,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5660]",
      "number": 5660
    },
    {
      "id": "AIFACTORY-TASK-5661",
      "type": "task",
      "parent": "AIFACTORY-US-1404",
      "title": "Accessibility and phone-width check of the Operations screens",
      "sequence": "14.07.05.02",
      "description": "Accessibility and phone-width check of the Operations screens. Expected output: Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the thirteen screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1404 against docs/planes/experience/studio/localization-accessibility.md.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility | npx playwright test --project=phone-390x844.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the thirteen screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1404 against docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5661]",
      "number": 5661
    },
    {
      "id": "AIFACTORY-TASK-5662",
      "type": "task",
      "parent": "AIFACTORY-US-1404",
      "title": "Verify the walk record of the Operations area",
      "sequence": "14.07.05.03",
      "description": "Verify the walk record of the Operations area. Expected output: Run the walk of AIFACTORY-TASK-5660 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1404 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the walk of AIFACTORY-TASK-5660 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1404 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 118,
      "phase": "factory",
      "stackRank": 11805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5662]",
      "number": 5662
    },
    {
      "id": "AIFACTORY-FEAT-079",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "Studio work area: Quality & releases",
      "sequence": "14.08",
      "description": "The 6 screens of the Studio work area Quality & releases on the Blazor shell and microfrontends, bound to the read models and commands the model names for them, with their state families, roles, locales and accessibility contracts. Screens come from model/ux/screens.yaml and the prototype alignment. Increment I3: Studio. Build order 119 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1405",
        "AIFACTORY-US-133",
        "AIFACTORY-US-1406"
      ],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11900,
      "titlePrefix": "[AIFACTORY-FEAT-079]",
      "number": 79
    },
    {
      "id": "AIFACTORY-US-1405",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-079",
      "title": "Quality and releases: I read product releases with their components, publication evidence and provenance, create one from a succeeded pipeline run and withdraw one with a reason",
      "sequence": "14.08.01",
      "description": "As an operator, I want to see every release of a generated product with its components, digests, publication evidence and provenance, and to create or withdraw a release from the Studio, so that only a release whose every component is published can be promoted, and a bad release is stopped before it reaches an environment. An operator, a workspace admin or an observer opens the screen `product-releases` at `/quality/releases`. StudioBff composes it under the scope of the session from ReleaseService, reached through DeliveryHost: `ListProductReleases` by product, version and state, and `GetProductRelease` for one release with its components and digests, the target feed or registry and the publication state of each component, the SBOM and attestation references, the pipeline run and change proposals that produced it and the asset releases that generated it. The delivery family of model/ux/states.yaml governs the display: a release is Assembling, Candidate, Released, Superseded or Withdrawn, and a Candidate names the components that still lack publication evidence. An operator or a workspace admin creates a release with `CreateProductRelease` from a pipeline run that succeeded, sent through `ForwardCommand` with an idempotency key; a run that did not succeed or a version already used is answered 409 or 422 as ReleaseService answers, and the page says which, and no release is shown as created until `ReleaseCreated` is consumed. They withdraw a release with `WithdrawProductRelease` and a reason; the page says that withdrawal blocks promotion and revokes nothing already deployed, and a release already withdrawn is answered 409. An observer sees the commands disabled with the reason. StudioBff consumes `ReleaseCreated`, `ReleaseReady` and `ReleaseWithdrawn` and refreshes the release view, so a Candidate turns Released on the open page without a reload. A release of another tenant is answered 404 like one that does not exist. When DeliveryHost does not answer, the source is shown degraded with its last freshness and the commands are refused with 503, never queued. Kind: behavior. Traces: services: StudioBff, ReleaseService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, ReleaseService/ListProductReleases, ReleaseService/GetProductRelease, ReleaseService/CreateProductRelease, ReleaseService/WithdrawProductRelease; events: ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady, ReleaseService/ReleaseWithdrawn; adrs: ADR-0015; requirements: FUX-02, FUX-11. Relates: screens: product-releases. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:release-service, feature:delivery-host. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/services/devops-gitops/ReleaseService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an operator on `product-releases`, when StudioBff/GetScreenModel composes it, then releases come from ReleaseService/ListProductReleases and ReleaseService/GetProductRelease with components, digests, publication state, SBOM and attestation references and provenance, and a Candidate names each component still without publication evidence (FUX-02, model/ux/states.yaml).",
        "AC2: Given an operator or a workspace admin, when they create a release, then StudioBff/ForwardCommand forwards ReleaseService/CreateProductRelease with an idempotency key, a 409 or 422 is explained in words, and the release appears only once ReleaseService/ReleaseCreated is consumed; an observer sees the command disabled with the reason (FUX-11).",
        "AC3: Given a release, when an operator withdraws it with a reason through ReleaseService/WithdrawProductRelease, then the page states that promotion is blocked and nothing deployed is revoked, a repeated withdrawal is answered 409, and ReleaseService/ReleaseWithdrawn or ReleaseService/ReleaseReady refresh the open page without a reload (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5663",
        "AIFACTORY-TASK-5664",
        "AIFACTORY-TASK-5665",
        "AIFACTORY-TASK-5705"
      ],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11901,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ReleaseService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "ReleaseService/ListProductReleases",
          "ReleaseService/GetProductRelease",
          "ReleaseService/CreateProductRelease",
          "ReleaseService/WithdrawProductRelease"
        ],
        "events": [
          "ReleaseService/ReleaseCreated",
          "ReleaseService/ReleaseReady",
          "ReleaseService/ReleaseWithdrawn"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-02",
          "FUX-11"
        ]
      },
      "relates": {
        "screens": [
          "product-releases"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:release-service",
        "feature:delivery-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/devops-gitops/ReleaseService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1405]",
      "number": 1405
    },
    {
      "id": "AIFACTORY-TASK-5663",
      "type": "task",
      "parent": "AIFACTORY-US-1405",
      "title": "Product releases screen in the Quality microfrontend",
      "sequence": "14.08.01.01",
      "description": "Product releases screen in the Quality microfrontend. Expected output: The Quality microfrontend renders `product-releases` with the delivery and freshness families, the list by product, version and state, the release detail with components, digests, publication state, SBOM and attestation references and provenance, the create form from a succeeded pipeline run, and the withdraw dialog that asks for a reason and states its effect.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Quality microfrontend renders `product-releases` with the delivery and freshness families, the list by product, version and state, the release detail with components, digests, publication state, SBOM and attestation references and provenance, the create form from a succeeded pipeline run, and the withdraw dialog that asks for a reason and states its effect."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11901,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5663]",
      "number": 5663
    },
    {
      "id": "AIFACTORY-TASK-5664",
      "type": "task",
      "parent": "AIFACTORY-US-1405",
      "title": "Screen model and command routes of the product releases screen in StudioBff",
      "sequence": "14.08.01.02",
      "description": "Screen model and command routes of the product releases screen in StudioBff. Expected output: StudioBff composes `product-releases` through DeliveryHost from `ListProductReleases` and `GetProductRelease` with the freshness of the source, forwards `CreateProductRelease` and `WithdrawProductRelease` with an idempotency key and the scope of the session, refuses them with 503 while DeliveryHost does not answer, and refreshes the release view on `ReleaseCreated`, `ReleaseReady` and `ReleaseWithdrawn`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `product-releases` through DeliveryHost from `ListProductReleases` and `GetProductRelease` with the freshness of the source, forwards `CreateProductRelease` and `WithdrawProductRelease` with an idempotency key and the scope of the session, refuses them with 503 while DeliveryHost does not answer, and refreshes the release view on `ReleaseCreated`, `ReleaseReady` and `ReleaseWithdrawn`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11901,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5664]",
      "number": 5664
    },
    {
      "id": "AIFACTORY-TASK-5665",
      "type": "task",
      "parent": "AIFACTORY-US-1405",
      "title": "Verify the product releases screen with refusals and live readiness",
      "sequence": "14.08.01.03",
      "description": "Verify the product releases screen with refusals and live readiness. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a Candidate and a Released release, a creation from a pipeline run that did not succeed answered 422, a creation with a version already used answered 409, a 409 on a repeated withdrawal, a pushed `ReleaseReady` and an observer session; the tests prove AC1 to AC3 of AIFACTORY-US-1405 (ReleaseService/CreateProductRelease, ReleaseService/WithdrawProductRelease).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a Candidate and a Released release, a creation from a pipeline run that did not succeed answered 422, a creation with a version already used answered 409, a 409 on a repeated withdrawal, a pushed `ReleaseReady` and an observer session; the tests prove AC1 to AC3 of AIFACTORY-US-1405 (ReleaseService/CreateProductRelease, ReleaseService/WithdrawProductRelease)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5665]",
      "number": 5665
    },
    {
      "id": "AIFACTORY-TASK-5705",
      "type": "task",
      "parent": "AIFACTORY-US-1405",
      "title": "Verify the StudioBff side of the product releases screen",
      "sequence": "14.08.01.04",
      "description": "Verify the StudioBff side of the product releases screen. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-quality-product-releases\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through DeliveryHost from `ListProductReleases` and `GetProductRelease` with freshness), AC2 (`CreateProductRelease` forwarded once with its idempotency key, its 409 and 422 returned unchanged, refresh on `ReleaseCreated`) and AC3 (`WithdrawProductRelease` forwarded with its reason, its 409 returned unchanged, refresh on `ReleaseWithdrawn` and `ReleaseReady`, 503 while DeliveryHost does not answer and nothing queued) of AIFACTORY-US-1405 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-quality-product-releases\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through DeliveryHost from `ListProductReleases` and `GetProductRelease` with freshness), AC2 (`CreateProductRelease` forwarded once with its idempotency key, its 409 and 422 returned unchanged, refresh on `ReleaseCreated`) and AC3 (`WithdrawProductRelease` forwarded with its reason, its 409 returned unchanged, refresh on `ReleaseWithdrawn` and `ReleaseReady`, 503 while DeliveryHost does not answer and nothing queued) of AIFACTORY-US-1405 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5705]",
      "number": 5705
    },
    {
      "id": "AIFACTORY-US-133",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-079",
      "title": "The Quality & releases work area of the Studio is bound to the model",
      "sequence": "14.08.02",
      "description": "As an asset maintainer, I want the Quality & releases work area of the Studio (6 screens) bound to the read models, commands, state families and roles the model names for it, so that I can follow product releases from one place now and see plainly that evaluations, evidence, feedback and learning arrive with their services, with every control reflecting what I may do and how fresh what I see is. This is the integration PBI of the Quality and releases area. The Quality microfrontend is generated from the microfrontend library template, composed into the Studio shell through its registry and holds the six screens of model/ux/screens.yaml with their routes, read models, commands, state families and roles; it calls StudioBff only. A screen is offered to the roles its list names; for any other role it is absent from the navigation and `GetScreenModel` refuses it with 403. One screen, `product-releases`, is delivered in I3 by AIFACTORY-US-1405. Five read services of I4: `evaluation-runs` and `release-evidence` read the complete QualityScoreService, whose thin delivery only stores quality events and serves no evaluation, and `feedback`, `datasets` and `learning-proposals` read FeedbackService. In I3 each of these five screens is registered, offered to its roles and shows its sources as unknown in the freshness family, named, never hidden and never filled from a fake; none of its commands (`StartEvaluation`, `WaiveEvaluation`, `RecordFeedback`, `SnapshotDataset`, `DecideLearningProposal`) is offered, so taking an asset from Draft to Published with evaluation evidence waits for I4. Every screen subscribes through `Realtime.Subscribe` of StudioRealtimeGateway; when the channel drops the page marks its data stale and when it returns the page reloads the screen model. A command carries the idempotency key and the scope of the session to the owning service, whose rules decide. Every screen renders in English, Russian and Hebrew right to left and is built to the accessibility contract of docs/planes/experience/studio/localization-accessibility.md; the area evidence that follows this PBI checks it on the finished area. Kind: behavior. Traces: services: StudioBff, StudioRealtimeGateway, ReleaseService; apis: StudioBff/GetStudioSession, StudioBff/GetScreenModel, StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe; adrs: ADR-0007, ADR-0015, ADR-0026; requirements: FUX-04, FUX-11. Relates: screens: evaluation-runs, release-evidence, feedback, datasets, learning-proposals. Depends on: AIFACTORY-US-1405, feature:studio-bff, feature:studio-realtime-gateway, feature:component-blazor-shell. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, docs/planes/experience/studio/screens/quality-releases.md.",
      "acceptanceCriteria": [
        "AC1: Given the shell with the Quality microfrontend, when each of the 6 screens of model/ux/screens.yaml opens for a role its list names, then it renders from StudioBff/GetScreenModel only, and for a role its list does not name the screen is not offered and StudioBff/GetScreenModel answers 403 (ADR-0007, ADR-0015).",
        "AC2: Given `evaluation-runs`, `release-evidence`, `feedback`, `datasets` and `learning-proposals`, when they open in I3, then each shows its sources as unknown in the freshness family of model/ux/states.yaml with the source named, shows no verdict, score or record, and offers none of its commands (FUX-04).",
        "AC3: Given an open screen and its subscription through StudioRealtimeGateway/Realtime.Subscribe, when the channel drops, then the page marks the data stale and never presents it as current, and when the channel returns the page reloads StudioBff/GetScreenModel and shows the current state without a browser reload (FUX-11).",
        "AC4: Given a command of the delivered screen, when a role issues it, then it is forwarded once through StudioBff/ForwardCommand with an idempotency key and the scope of the session, a role without the right sees the control disabled with the reason, and the screens render in en, ru and he right to left under docs/planes/experience/studio/localization-accessibility.md (ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/quality-releases.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-445",
        "AIFACTORY-TASK-446",
        "AIFACTORY-TASK-447",
        "AIFACTORY-TASK-747"
      ],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11902,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "ReleaseService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "adrs": [
          "ADR-0007",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FUX-04",
          "FUX-11"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs",
          "release-evidence",
          "feedback",
          "datasets",
          "learning-proposals"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1405",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/quality-releases.md"
      ],
      "titlePrefix": "[AIFACTORY-US-133]",
      "number": 133
    },
    {
      "id": "AIFACTORY-TASK-445",
      "type": "task",
      "parent": "AIFACTORY-US-133",
      "title": "Screens of the work area Quality & releases: Evaluation runs, Release evidence, Feedback, Evaluation datasets, Learning proposals, Product releases",
      "sequence": "14.08.02.01",
      "description": "Screens of the work area Quality & releases: Evaluation runs, Release evidence, Feedback, Evaluation datasets, Learning proposals, Product releases. Expected output: The Quality microfrontend is composed into the shell through the registry with one navigation group and the six routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the five screens of I4 sources render their sources as unknown with the source named and no command.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Quality microfrontend is composed into the shell through the registry with one navigation group and the six routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the five screens of I4 sources render their sources as unknown with the source named and no command."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11902,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-445]",
      "number": 445
    },
    {
      "id": "AIFACTORY-TASK-446",
      "type": "task",
      "parent": "AIFACTORY-US-133",
      "title": "Commands of the work area Quality & releases",
      "sequence": "14.08.02.02",
      "description": "Commands of the work area Quality & releases. Expected output: The commands of the delivered screen (`CreateProductRelease`, `WithdrawProductRelease`) are forwarded through StudioBff with an idempotency key and the scope of the session, and the five commands of the I4 screens (`StartEvaluation`, `WaiveEvaluation`, `RecordFeedback`, `SnapshotDataset`, `DecideLearningProposal`) are not offered in I3.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The commands of the delivered screen (`CreateProductRelease`, `WithdrawProductRelease`) are forwarded through StudioBff with an idempotency key and the scope of the session, and the five commands of the I4 screens (`StartEvaluation`, `WaiveEvaluation`, `RecordFeedback`, `SnapshotDataset`, `DecideLearningProposal`) are not offered in I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-446]",
      "number": 446
    },
    {
      "id": "AIFACTORY-TASK-447",
      "type": "task",
      "parent": "AIFACTORY-US-133",
      "title": "States, roles, locales and accessibility of the work area Quality & releases",
      "sequence": "14.08.02.03",
      "description": "States, roles, locales and accessibility of the work area Quality & releases. Expected output: Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-447]",
      "number": 447
    },
    {
      "id": "AIFACTORY-TASK-747",
      "type": "task",
      "parent": "AIFACTORY-US-133",
      "title": "Verify studio-quality-releases-work-area by running the declared command",
      "sequence": "14.08.02.04",
      "description": "Verify studio-quality-releases-work-area by running the declared command. Expected output: Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-133 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release`, `dotnet test -c Release --no-build` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-133 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-747]",
      "number": 747
    },
    {
      "id": "AIFACTORY-US-1406",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-079",
      "title": "Quality and releases area evidence: every screen passes the accessibility and phone-width checks and an end-to-end walk of the area through StudioBff is recorded",
      "sequence": "14.08.03",
      "description": "As an observer, I want proof that every screen of the Quality and releases area is usable by keyboard, in every locale and at phone width, and that the evaluation and feedback screens say they are not yet delivered, so that the area is accepted on a recorded check and no quality score or evaluation verdict is read from a fake. This PBI is the proof of the Quality and releases area and comes after its integration PBI AIFACTORY-US-133, which registers the six screens. The accessibility and phone-width check opens each of the six screens of the area for a role its list in model/ux/screens.yaml names and asserts the rules of docs/planes/experience/studio/localization-accessibility.md: WCAG 2.2 AA by the automated checks, keyboard operation, live updates announced politely and not animated under reduced motion, digests and versions readable by a screen reader, refusals explained in words, in English, Russian and Hebrew right to left, light and dark, at 1440 by 900 and at 390 by 844 with no horizontal scroll. The end-to-end walk signs in as an operator, opens the product releases of the fixture product of the first outcome, creates a release from its succeeded pipeline run, watches the Candidate become Released when the publication evidence arrives, and withdraws a second release with a reason; as an observer it sees the same screen without commands. The screens whose sources are delivered in I4 (evaluation runs, release evidence, feedback, evaluation datasets, learning proposals) show their sources as unknown and are listed by name. The record holds per screen and role the expected and observed result and the network log, which shows no address other than StudioBff and StudioRealtimeGateway. Kind: evidence. Traces: services: StudioBff; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand; adrs: ADR-0007; requirements: FUX-04, FUX-12. Relates: screens: evaluation-runs, release-evidence, feedback, datasets, learning-proposals, product-releases; nfrs: NFR-15. Depends on: AIFACTORY-US-1405, AIFACTORY-US-133, feature:studio-bff, feature:component-blazor-shell. Sources: model/ux/screens.yaml, docs/planes/experience/studio/localization-accessibility.md, docs/planes/experience/studio/screens/quality-releases.md.",
      "acceptanceCriteria": [
        "AC1: Given each of the 6 screens of the area in model/ux/screens.yaml, when the accessibility check runs in the three locales, both schemes and the two viewports of docs/planes/experience/studio/localization-accessibility.md, then every screen passes the automated WCAG 2.2 AA checks and keyboard operation and has no horizontal scroll at 390 by 844 (NFR-15, FUX-12).",
        "AC2: Given the walk as an operator and an observer, when it runs on the acceptance estate, then the product releases screen renders from StudioBff/GetScreenModel, the create and withdraw commands go through StudioBff/ForwardCommand, and the five screens of later sources are listed by name with their sources unknown (ADR-0007, FUX-04).",
        "AC3: Given the record and the network log of the walk, when they are read, then the browser called no address other than StudioBff and StudioRealtimeGateway and no screen showed an evaluation verdict, a quality score or a feedback record in I3 (FUX-12)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/quality-releases.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5666",
        "AIFACTORY-TASK-5667",
        "AIFACTORY-TASK-5668"
      ],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11903,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand"
        ],
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-04",
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "evaluation-runs",
          "release-evidence",
          "feedback",
          "datasets",
          "learning-proposals",
          "product-releases"
        ],
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1405",
        "AIFACTORY-US-133",
        "feature:studio-bff",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/quality-releases.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1406]",
      "number": 1406
    },
    {
      "id": "AIFACTORY-TASK-5666",
      "type": "task",
      "parent": "AIFACTORY-US-1406",
      "title": "End-to-end walk of the Quality and releases area",
      "sequence": "14.08.03.01",
      "description": "End-to-end walk of the Quality and releases area. Expected output: A browser-driven walk in the Studio repository that signs in as an operator and an observer, creates and withdraws releases of the fixture product, opens the five screens of later sources, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven walk in the Studio repository that signs in as an operator and an observer, creates and withdraws releases of the fixture product, opens the five screens of later sources, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11903,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5666]",
      "number": 5666
    },
    {
      "id": "AIFACTORY-TASK-5667",
      "type": "task",
      "parent": "AIFACTORY-US-1406",
      "title": "Accessibility and phone-width check of the Quality screens",
      "sequence": "14.08.03.02",
      "description": "Accessibility and phone-width check of the Quality screens. Expected output: Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the six screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1406 against docs/planes/experience/studio/localization-accessibility.md.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility | npx playwright test --project=phone-390x844.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the six screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1406 against docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5667]",
      "number": 5667
    },
    {
      "id": "AIFACTORY-TASK-5668",
      "type": "task",
      "parent": "AIFACTORY-US-1406",
      "title": "Verify the walk record of the Quality area",
      "sequence": "14.08.03.03",
      "description": "Verify the walk record of the Quality area. Expected output: Run the walk of AIFACTORY-TASK-5666 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1406 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the walk of AIFACTORY-TASK-5666 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1406 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 119,
      "phase": "factory",
      "stackRank": 11903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5668]",
      "number": 5668
    },
    {
      "id": "AIFACTORY-FEAT-080",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "Studio work area: Software Factory",
      "sequence": "14.09",
      "description": "The 11 screens of the Studio work area Software Factory on the Blazor shell and microfrontends, bound to the read models and commands the model names for them, with their state families, roles, locales and accessibility contracts. Screens come from model/ux/screens.yaml and the prototype alignment. Increment I3: Studio. Build order 120 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1407",
        "AIFACTORY-US-1408",
        "AIFACTORY-US-1409",
        "AIFACTORY-US-1410",
        "AIFACTORY-US-038",
        "AIFACTORY-US-1411"
      ],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12000,
      "titlePrefix": "[AIFACTORY-FEAT-080]",
      "number": 80
    },
    {
      "id": "AIFACTORY-US-1407",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-080",
      "title": "Software Factory: I author, validate and submit blueprint versions, draft, validate and approve generation recipes, and read the provenance of generated outputs",
      "sequence": "14.09.01",
      "description": "As an asset maintainer, I want to take a blueprint from a Draft version to a submitted one and a recipe from a draft to an approved one, and to see which generated files came from which recipe, so that generation runs from validated, approved inputs and every generated file can be traced back to them. An asset maintainer, a requester, a reviewer or an observer opens the screens `blueprints`, `dsl-studio`, `recipes` and `generated-outputs`. StudioBff composes them under the scope of the session and the project in scope from BlueprintService and GenerationRecipeService, reached through TemplateCatalogHost: `ListBlueprints` and `GetBlueprintVersion` with the document, the validation report and the derived context map and domain model; `ListRecipes` and `GetRecipe` with the module plan, pinned versions, switches and parameters; `QueryCompatibility` of TemplateRegistryService for the compatibility evidence of a recipe; and `ListGeneratedOutputs` with generated and preserved files by commit. A blueprint and a recipe list need the project, so the screen model always names it; a project the token does not grant is answered 403. The asset-readiness family of model/ux/states.yaml governs the display. Through `ForwardCommand` with an idempotency key a user stores a new Draft version with `CreateBlueprintVersion`, validates it with `ValidateBlueprint` and submits a Validated version with `SubmitBlueprint`, a publication-class command that carries the approval binding of its class; a recipe is drafted with `DraftRecipe`, validated with `ValidateRecipe` and approved with `ApproveRecipe` by a requester or an asset maintainer, and a reviewer when policy requires one. The page explains each refusal: 409 for a reused key or a version that is no longer a draft, 412 for a blueprint version a recipe may not bind, 422 per finding of the report, and 503 when a required dependency does not answer, in which case nothing changed. Until the publication gate of I4 a Submitted blueprint version may be bound by a recipe and a compatibility cell that is unknown passes with a warning; the page shows that allowance on the recipe. The `dsl-studio` screen also reads the topics of EnvelopeRegistryService, delivered in I4; in I3 that source is shown unknown, named, and the editor offers no topic list. StudioBff consumes `BlueprintValidated`, `BlueprintSubmitted`, `RecipeValidated`, `RecipeApproved` and `GeneratedOutputRecorded` and refreshes the open page without a reload. Kind: behavior. Traces: services: StudioBff, BlueprintService, GenerationRecipeService, TemplateRegistryService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, BlueprintService/ListBlueprints, BlueprintService/GetBlueprintVersion, BlueprintService/CreateBlueprintVersion, BlueprintService/ValidateBlueprint, BlueprintService/SubmitBlueprint, GenerationRecipeService/ListRecipes, GenerationRecipeService/GetRecipe, GenerationRecipeService/DraftRecipe, GenerationRecipeService/ValidateRecipe, GenerationRecipeService/ApproveRecipe, GenerationRecipeService/ListGeneratedOutputs, TemplateRegistryService/QueryCompatibility; events: BlueprintService/BlueprintValidated, BlueprintService/BlueprintSubmitted, GenerationRecipeService/RecipeValidated, GenerationRecipeService/RecipeApproved, GenerationRecipeService/GeneratedOutputRecorded; requirements: FUX-02, FUX-04, FUX-11. Relates: screens: blueprints, dsl-studio, recipes, generated-outputs. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:blueprint-service, feature:generation-recipe-service, feature:template-registry-service, feature:template-catalog-host. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an asset maintainer on `blueprints`, `recipes` or `generated-outputs`, when StudioBff/GetScreenModel composes them for the project in scope, then they render from BlueprintService/ListBlueprints, BlueprintService/GetBlueprintVersion, GenerationRecipeService/ListRecipes, GenerationRecipeService/GetRecipe, TemplateRegistryService/QueryCompatibility and GenerationRecipeService/ListGeneratedOutputs, and a project the token does not grant is answered 403 (FUX-11).",
        "AC2: Given a Draft blueprint version, when the user validates and submits it, then StudioBff/ForwardCommand forwards BlueprintService/ValidateBlueprint and BlueprintService/SubmitBlueprint with the approval binding of the publication class, findings of a 422 are shown per rule, and the version shows Validated or Submitted only once BlueprintService/BlueprintValidated or BlueprintService/BlueprintSubmitted is consumed (FUX-02).",
        "AC3: Given a recipe, when a user drafts, validates and approves it through GenerationRecipeService/DraftRecipe, GenerationRecipeService/ValidateRecipe and GenerationRecipeService/ApproveRecipe, then a 412, 409 or 503 is explained in words with nothing changed, the allowance used before the publication gate is shown on the recipe, and GenerationRecipeService/RecipeApproved refreshes the open page (model/services/template-library/GenerationRecipeService.yaml).",
        "AC4: Given `dsl-studio` in I3, when it opens, then the blueprint document renders from BlueprintService/GetBlueprintVersion with validation through BlueprintService/ValidateBlueprint, and the topic source is shown unknown and named with no invented topic (FUX-04)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5669",
        "AIFACTORY-TASK-5670",
        "AIFACTORY-TASK-5671",
        "AIFACTORY-TASK-5706"
      ],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12001,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "BlueprintService",
          "GenerationRecipeService",
          "TemplateRegistryService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "BlueprintService/ListBlueprints",
          "BlueprintService/GetBlueprintVersion",
          "BlueprintService/CreateBlueprintVersion",
          "BlueprintService/ValidateBlueprint",
          "BlueprintService/SubmitBlueprint",
          "GenerationRecipeService/ListRecipes",
          "GenerationRecipeService/GetRecipe",
          "GenerationRecipeService/DraftRecipe",
          "GenerationRecipeService/ValidateRecipe",
          "GenerationRecipeService/ApproveRecipe",
          "GenerationRecipeService/ListGeneratedOutputs",
          "TemplateRegistryService/QueryCompatibility"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "BlueprintService/BlueprintSubmitted",
          "GenerationRecipeService/RecipeValidated",
          "GenerationRecipeService/RecipeApproved",
          "GenerationRecipeService/GeneratedOutputRecorded"
        ],
        "requirements": [
          "FUX-02",
          "FUX-04",
          "FUX-11"
        ]
      },
      "relates": {
        "screens": [
          "blueprints",
          "dsl-studio",
          "recipes",
          "generated-outputs"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:blueprint-service",
        "feature:generation-recipe-service",
        "feature:template-registry-service",
        "feature:template-catalog-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1407]",
      "number": 1407
    },
    {
      "id": "AIFACTORY-TASK-5669",
      "type": "task",
      "parent": "AIFACTORY-US-1407",
      "title": "Blueprint, descriptor, recipe and generated output screens in the Software Factory microfrontend",
      "sequence": "14.09.01.01",
      "description": "Blueprint, descriptor, recipe and generated output screens in the Software Factory microfrontend. Expected output: The Software Factory microfrontend renders `blueprints`, `dsl-studio`, `recipes` and `generated-outputs` with the asset-readiness and delivery families, the blueprint editor with its validation report per rule, the recipe module plan with compatibility evidence and the pre-gate allowance, the provenance of generated files by commit, and the topic source of the descriptor editor marked unknown.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Software Factory microfrontend renders `blueprints`, `dsl-studio`, `recipes` and `generated-outputs` with the asset-readiness and delivery families, the blueprint editor with its validation report per rule, the recipe module plan with compatibility evidence and the pre-gate allowance, the provenance of generated files by commit, and the topic source of the descriptor editor marked unknown."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12001,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5669]",
      "number": 5669
    },
    {
      "id": "AIFACTORY-TASK-5670",
      "type": "task",
      "parent": "AIFACTORY-US-1407",
      "title": "Screen models and command routes of the blueprint and recipe screens in StudioBff",
      "sequence": "14.09.01.02",
      "description": "Screen models and command routes of the blueprint and recipe screens in StudioBff. Expected output: StudioBff composes the four screens through TemplateCatalogHost, by REST through the pinned template catalog gateway client of feature typed-gateway-clients (AIFACTORY-TASK-6605), with the project in scope and the freshness of each source, marks the topic source unknown in I3, forwards the blueprint and recipe commands with an idempotency key and the approval binding `SubmitBlueprint` requires, and refreshes the views on `BlueprintValidated`, `BlueprintSubmitted`, `RecipeValidated`, `RecipeApproved` and `GeneratedOutputRecorded`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes the four screens through TemplateCatalogHost, by REST through the pinned template catalog gateway client of feature typed-gateway-clients (AIFACTORY-TASK-6605), with the project in scope and the freshness of each source, marks the topic source unknown in I3, forwards the blueprint and recipe commands with an idempotency key and the approval binding `SubmitBlueprint` requires, and refreshes the views on `BlueprintValidated`, `BlueprintSubmitted`, `RecipeValidated`, `RecipeApproved` and `GeneratedOutputRecorded`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12001,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5670]",
      "number": 5670
    },
    {
      "id": "AIFACTORY-TASK-5671",
      "type": "task",
      "parent": "AIFACTORY-US-1407",
      "title": "Verify the blueprint and recipe screens with every refusal",
      "sequence": "14.09.01.03",
      "description": "Verify the blueprint and recipe screens with every refusal. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a blueprint from Draft to Submitted, a recipe from draft to approved, a 422 report, a 412 binding, a 409 reused key, a 503 dependency and a project not granted; the tests prove AC1 to AC4 of AIFACTORY-US-1407 (BlueprintService/SubmitBlueprint, GenerationRecipeService/ApproveRecipe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a blueprint from Draft to Submitted, a recipe from draft to approved, a 422 report, a 412 binding, a 409 reused key, a 503 dependency and a project not granted; the tests prove AC1 to AC4 of AIFACTORY-US-1407 (BlueprintService/SubmitBlueprint, GenerationRecipeService/ApproveRecipe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5671]",
      "number": 5671
    },
    {
      "id": "AIFACTORY-TASK-5706",
      "type": "task",
      "parent": "AIFACTORY-US-1407",
      "title": "Verify the StudioBff side of the blueprint and recipe screens",
      "sequence": "14.09.01.04",
      "description": "Verify the StudioBff side of the blueprint and recipe screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-blueprints-recipes-and-outputs\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through TemplateCatalogHost for the project in scope and the 403 of a project not granted returned unchanged), AC2 (`ValidateBlueprint` and `SubmitBlueprint` forwarded once with an idempotency key and the approval binding of the publication class, a 422 returned per rule, refresh on `BlueprintValidated` and `BlueprintSubmitted`), AC3 (the recipe commands forwarded, a 412, 409 or 503 returned unchanged with nothing queued, refresh on `RecipeApproved`) and AC4 (the topic source marked unknown in I3) of AIFACTORY-US-1407 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-blueprints-recipes-and-outputs\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through TemplateCatalogHost for the project in scope and the 403 of a project not granted returned unchanged), AC2 (`ValidateBlueprint` and `SubmitBlueprint` forwarded once with an idempotency key and the approval binding of the publication class, a 422 returned per rule, refresh on `BlueprintValidated` and `BlueprintSubmitted`), AC3 (the recipe commands forwarded, a 412, 409 or 503 returned unchanged with nothing queued, refresh on `RecipeApproved`) and AC4 (the topic source marked unknown in I3) of AIFACTORY-US-1407 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5706]",
      "number": 5706
    },
    {
      "id": "AIFACTORY-US-1408",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-080",
      "title": "Software Factory: I follow change proposals and pipeline runs, reconcile a missed run, and request or roll back a promotion whose one production approval is the gate of EnvironmentPromotionService",
      "sequence": "14.09.02",
      "description": "As an operator, I want to follow a change from its proposal through its pipeline run to its promotion into an environment, and to request or roll back a promotion from the Studio, so that I know which release runs where and a production promotion is approved once, at its own gate, by a person. A requester, a reviewer, an operator, a workspace admin or an observer opens the screens `proposals`, `pipeline-runs` and `promotions`. StudioBff composes them under the scope of the session from PipelineExecutionService and EnvironmentPromotionService, reached through DeliveryHost: `ListChangeProposals` and `GetChangeProposal` with commits, reviews, pipeline runs and provenance; `ListPipelineRuns` and `GetPipelineRun` with stages and typed results; `ListPromotions`, `GetPromotion` with gates, approval, desired state, verification and rollback evidence, and `GetCurrentRelease` of each environment. The delivery and approval families of model/ux/states.yaml govern the display, and a promotion moves from Requested through GatesEvaluating to AwaitingApproval, Approved or Rejected, then Deploying, Verifying and Completed, or Failed or RolledBack. An operator reconciles a pipeline run whose delivery was missed with `ReconcilePipelineRun`. An operator requests a promotion of a ready release with `RequestPromotion` through `ForwardCommand` with an idempotency key; the Studio attaches no approval of its own (D133). For a production environment the one approval a person gives is the gate of EnvironmentPromotionService, bound to the release and the environment and requested from RunControlService during gate evaluation with the subject kind Promotion and the promotion id as subject (D135); StudioBff matches the `ApprovalRequested` it consumes to the open promotion by `subjectKind` and `subjectId`, not by a run, and the promotion page shows AwaitingApproval and says that the decision is taken on the approval card of the Workspace area. A 409, 412 or 422 of the owning service reaches the Studio unchanged (D137) and is explained in words, and a withdrawn release cannot be promoted. A promotion whose gate failed or whose approval was rejected or expired is Rejected; `GetPromotion` shows it with the reason, and the page says that a new `RequestPromotion`, which binds a new approval, is needed. A promotion of another tenant is answered 404 by `GetPromotion` like one that does not exist. An operator rolls back a promotion with `RollbackPromotion`; a promotion that cannot be rolled back is answered 409. A reviewer, a workspace admin and an observer see the commands they may not issue disabled with the reason. StudioBff consumes the proposal, pipeline and promotion events and `ApprovalRequested` of RunControlService and refreshes the open page without a reload. When DeliveryHost does not answer, the source is shown degraded with its last freshness and the commands are refused with 503, never queued. Kind: behavior. Traces: services: StudioBff, PipelineExecutionService, EnvironmentPromotionService, RunControlService, DeliveryHost; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, PipelineExecutionService/ListChangeProposals, PipelineExecutionService/GetChangeProposal, PipelineExecutionService/ListPipelineRuns, PipelineExecutionService/GetPipelineRun, PipelineExecutionService/ReconcilePipelineRun, EnvironmentPromotionService/ListPromotions, EnvironmentPromotionService/GetPromotion, EnvironmentPromotionService/GetCurrentRelease, EnvironmentPromotionService/RequestPromotion, EnvironmentPromotionService/RollbackPromotion; events: PipelineExecutionService/PipelineRunCompleted, EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/PromotionCompleted, EnvironmentPromotionService/PromotionFailed, EnvironmentPromotionService/RollbackCompleted, RunControlService/ApprovalRequested; adrs: ADR-0015, ADR-0024; requirements: FUX-05, FUX-11. Relates: screens: proposals, pipeline-runs, promotions. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:pipeline-execution-service-complete, feature:environment-promotion-service, feature:delivery-host, feature:run-control-service. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/services/devops-gitops/EnvironmentPromotionService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an operator on `proposals`, `pipeline-runs` or `promotions`, when StudioBff/GetScreenModel composes them, then they render from PipelineExecutionService/ListChangeProposals, PipelineExecutionService/GetChangeProposal, PipelineExecutionService/ListPipelineRuns, PipelineExecutionService/GetPipelineRun, EnvironmentPromotionService/ListPromotions, EnvironmentPromotionService/GetPromotion and EnvironmentPromotionService/GetCurrentRelease, and a promotion shows its state and gates (FUX-11).",
        "AC2: Given an operator who requests a production promotion, when StudioBff/ForwardCommand forwards EnvironmentPromotionService/RequestPromotion, then it carries an idempotency key and no Studio approval, the page shows AwaitingApproval once RunControlService/ApprovalRequested with the subject kind Promotion and the id of that promotion is consumed and names the approval card as the one place to decide, and a 409, 412 or 422 returned unchanged is explained in words (FUX-05, ADR-0024, D135, D137).",
        "AC3: Given a completed promotion or a missed pipeline delivery, when an operator issues EnvironmentPromotionService/RollbackPromotion or PipelineExecutionService/ReconcilePipelineRun, then the page shows the result only once EnvironmentPromotionService/RollbackCompleted or PipelineExecutionService/PipelineRunCompleted is consumed, and other roles see these commands disabled with the reason (ADR-0015).",
        "AC4: Given an open promotion, when EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/PromotionCompleted or EnvironmentPromotionService/PromotionFailed is consumed by StudioBff, then the page shows the new state without a reload; a promotion whose gate failed or whose approval was rejected or expired shows Rejected with the reason and that a new EnvironmentPromotionService/RequestPromotion is needed (EnvironmentPromotionService/GetPromotion); a promotion of another tenant is answered 404; and when DeliveryHost does not answer the source is degraded and the commands answer 503 (model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5672",
        "AIFACTORY-TASK-5673",
        "AIFACTORY-TASK-5674",
        "AIFACTORY-TASK-5707"
      ],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12002,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "PipelineExecutionService",
          "EnvironmentPromotionService",
          "RunControlService",
          "DeliveryHost"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "PipelineExecutionService/ListChangeProposals",
          "PipelineExecutionService/GetChangeProposal",
          "PipelineExecutionService/ListPipelineRuns",
          "PipelineExecutionService/GetPipelineRun",
          "PipelineExecutionService/ReconcilePipelineRun",
          "EnvironmentPromotionService/ListPromotions",
          "EnvironmentPromotionService/GetPromotion",
          "EnvironmentPromotionService/GetCurrentRelease",
          "EnvironmentPromotionService/RequestPromotion",
          "EnvironmentPromotionService/RollbackPromotion"
        ],
        "events": [
          "PipelineExecutionService/PipelineRunCompleted",
          "EnvironmentPromotionService/PromotionApproved",
          "EnvironmentPromotionService/PromotionCompleted",
          "EnvironmentPromotionService/PromotionFailed",
          "EnvironmentPromotionService/RollbackCompleted",
          "RunControlService/ApprovalRequested"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0024"
        ],
        "requirements": [
          "FUX-05",
          "FUX-11"
        ]
      },
      "relates": {
        "screens": [
          "proposals",
          "pipeline-runs",
          "promotions"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:pipeline-execution-service-complete",
        "feature:environment-promotion-service",
        "feature:delivery-host",
        "feature:run-control-service"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1408]",
      "number": 1408
    },
    {
      "id": "AIFACTORY-TASK-5672",
      "type": "task",
      "parent": "AIFACTORY-US-1408",
      "title": "Proposal, pipeline run and promotion screens in the Software Factory microfrontend",
      "sequence": "14.09.02.01",
      "description": "Proposal, pipeline run and promotion screens in the Software Factory microfrontend. Expected output: The Software Factory microfrontend renders `proposals`, `pipeline-runs` and `promotions` with the delivery, approval and freshness families, the promotion state path with its gates and evidence, the current release per environment, the request and rollback dialogs, and an AwaitingApproval state that names the approval card of the Workspace area and offers no approval control of its own.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Software Factory microfrontend renders `proposals`, `pipeline-runs` and `promotions` with the delivery, approval and freshness families, the promotion state path with its gates and evidence, the current release per environment, the request and rollback dialogs, and an AwaitingApproval state that names the approval card of the Workspace area and offers no approval control of its own."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12002,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5672]",
      "number": 5672
    },
    {
      "id": "AIFACTORY-TASK-5673",
      "type": "task",
      "parent": "AIFACTORY-US-1408",
      "title": "Screen models and command routes of the delivery screens in StudioBff",
      "sequence": "14.09.02.02",
      "description": "Screen models and command routes of the delivery screens in StudioBff. Expected output: StudioBff composes the three screens through DeliveryHost, by REST through the pinned client package of that gateway (AIFACTORY-TASK-6601, AIFACTORY-TASK-6605), with the freshness of the source, forwards `RequestPromotion` with an idempotency key and no Studio approval, `RollbackPromotion` and `ReconcilePipelineRun`, refuses them with 503 while DeliveryHost does not answer, and refreshes the views on the proposal, pipeline and promotion events and on `ApprovalRequested`, matched to a promotion by its subject kind Promotion and subject id (D135).. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes the three screens through DeliveryHost, by REST through the pinned client package of that gateway (AIFACTORY-TASK-6601, AIFACTORY-TASK-6605), with the freshness of the source, forwards `RequestPromotion` with an idempotency key and no Studio approval, `RollbackPromotion` and `ReconcilePipelineRun`, refuses them with 503 while DeliveryHost does not answer, and refreshes the views on the proposal, pipeline and promotion events and on `ApprovalRequested`, matched to a promotion by its subject kind Promotion and subject id (D135)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12002,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5673]",
      "number": 5673
    },
    {
      "id": "AIFACTORY-TASK-5674",
      "type": "task",
      "parent": "AIFACTORY-US-1408",
      "title": "Verify the promotion path with its single production approval",
      "sequence": "14.09.02.03",
      "description": "Verify the promotion path with its single production approval. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub driving a production promotion from Requested through AwaitingApproval to Completed, a 412 gate refusal, a promotion Rejected after its gate failed and another after its approval expired, a promotion of another tenant answered 404, a rollback, a reconciled pipeline run and a reviewer session; the tests prove AC1 to AC4 of AIFACTORY-US-1408 (EnvironmentPromotionService/RequestPromotion, RunControlService/ApprovalRequested).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub driving a production promotion from Requested through AwaitingApproval to Completed, a 412 gate refusal, a promotion Rejected after its gate failed and another after its approval expired, a promotion of another tenant answered 404, a rollback, a reconciled pipeline run and a reviewer session; the tests prove AC1 to AC4 of AIFACTORY-US-1408 (EnvironmentPromotionService/RequestPromotion, RunControlService/ApprovalRequested)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5674]",
      "number": 5674
    },
    {
      "id": "AIFACTORY-TASK-5707",
      "type": "task",
      "parent": "AIFACTORY-US-1408",
      "title": "Verify the StudioBff side of the delivery screens",
      "sequence": "14.09.02.04",
      "description": "Verify the StudioBff side of the delivery screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-proposals-pipelines-and-promotions\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through DeliveryHost from the proposal, pipeline run and promotion reads), AC2 (`RequestPromotion` forwarded once with an idempotency key and no Studio approval, its 409, 412 and 422 returned unchanged, refresh on `ApprovalRequested`), AC3 (`RollbackPromotion` and `ReconcilePipelineRun` forwarded, refresh on `RollbackCompleted` and `PipelineRunCompleted`) and AC4 (refresh on `PromotionApproved`, `PromotionCompleted` and `PromotionFailed`, a Rejected promotion composed with its reason, the 404 of another tenant returned unchanged, 503 while DeliveryHost does not answer and nothing queued) of AIFACTORY-US-1408 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-proposals-pipelines-and-promotions\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through DeliveryHost from the proposal, pipeline run and promotion reads), AC2 (`RequestPromotion` forwarded once with an idempotency key and no Studio approval, its 409, 412 and 422 returned unchanged, refresh on `ApprovalRequested`), AC3 (`RollbackPromotion` and `ReconcilePipelineRun` forwarded, refresh on `RollbackCompleted` and `PipelineRunCompleted`) and AC4 (refresh on `PromotionApproved`, `PromotionCompleted` and `PromotionFailed`, a Rejected promotion composed with its reason, the 404 of another tenant returned unchanged, 503 while DeliveryHost does not answer and nothing queued) of AIFACTORY-US-1408 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5707]",
      "number": 5707
    },
    {
      "id": "AIFACTORY-US-1409",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-080",
      "title": "Software Factory: I plan and cancel provisioning runs and read the observed inventory, drift and reconciliation proposals of an environment",
      "sequence": "14.09.03",
      "description": "As an operator, I want to see the desired-state specifications and provisioning runs, plan or cancel a run, and compare the observed inventory of an environment with its desired state, so that infrastructure changes are planned before they apply and drift is decided by a person instead of corrected silently. An operator, a platform admin, a workspace admin or an observer opens the screens `provisioning` and `inventory`. StudioBff composes them under the scope of the session from IaCProvisioningService and RuntimeEnvironmentService, reached through RuntimeCloudHost: `ListSpecifications` with versions per environment, `ListProvisioningRuns` and `GetProvisioningRun` with the plan, the approval, the apply receipt and the logs; `GetRuntimeInventory` with observed workloads, versions, replicas, endpoints and bindings by reference and their staleness, `ListDrift` with open and resolved findings and `ListReconciliationProposals` with plan summaries. The delivery, approval and freshness families of model/ux/states.yaml govern the display, and inventory older than its freshness limit shows its age. An operator or a platform admin plans a run with `PlanProvisioning` through `ForwardCommand` with an idempotency key; a production apply waits for the approval its class requires, which the owning service requests with the subject kind ProvisioningRun and the provisioning run id as subject (D135), and the page shows the run waiting until the decision arrives. A planned run is cancelled with `CancelProvisioning` before it applies; a run already applying is answered 409. An operator triggers an observation with `ObserveEnvironment` and decides a reconciliation proposal with `DecideReconciliation`, accepting it, which plans a provisioning run, or rejecting it with a reason; production acceptance carries the approval binding of its class. A 409 or 422 is explained in words, a proposal already decided is answered 409 by `DecideReconciliation`, a provisioning run or an environment of another tenant is answered 404 by `GetProvisioningRun`, `GetRuntimeInventory` or `ListDrift`, and a role without the right sees the control disabled with the reason. StudioBff consumes `ProvisioningPlanned`, `ProvisioningApplied`, `ProvisioningFailed`, `ObservedStateChanged`, `RuntimeDriftDetected`, `ReconciliationProposed` and `ReconciliationDecided` and refreshes the open page without a reload. When RuntimeCloudHost does not answer, the source is shown degraded with its last freshness and the commands are refused with 503, never queued. Kind: behavior. Traces: services: StudioBff, IaCProvisioningService, RuntimeEnvironmentService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, IaCProvisioningService/ListSpecifications, IaCProvisioningService/ListProvisioningRuns, IaCProvisioningService/GetProvisioningRun, IaCProvisioningService/PlanProvisioning, IaCProvisioningService/CancelProvisioning, RuntimeEnvironmentService/GetRuntimeInventory, RuntimeEnvironmentService/ListDrift, RuntimeEnvironmentService/ListReconciliationProposals, RuntimeEnvironmentService/ObserveEnvironment, RuntimeEnvironmentService/DecideReconciliation; events: IaCProvisioningService/ProvisioningPlanned, IaCProvisioningService/ProvisioningApplied, IaCProvisioningService/ProvisioningFailed, RuntimeEnvironmentService/ObservedStateChanged, RuntimeEnvironmentService/RuntimeDriftDetected, RuntimeEnvironmentService/ReconciliationProposed, RuntimeEnvironmentService/ReconciliationDecided; requirements: FUX-04, FUX-05, FUX-07. Relates: screens: provisioning, inventory. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:ia-cprovisioning-service, feature:runtime-environment-service, feature:runtime-cloud-host. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an operator on `provisioning` or `inventory`, when StudioBff/GetScreenModel composes them, then they render from IaCProvisioningService/ListSpecifications, IaCProvisioningService/ListProvisioningRuns, IaCProvisioningService/GetProvisioningRun, RuntimeEnvironmentService/GetRuntimeInventory, RuntimeEnvironmentService/ListDrift and RuntimeEnvironmentService/ListReconciliationProposals, and stale inventory shows its age (FUX-04).",
        "AC2: Given an operator who plans or cancels a run, when StudioBff/ForwardCommand forwards IaCProvisioningService/PlanProvisioning or IaCProvisioningService/CancelProvisioning, then a production apply is shown waiting for its approval until IaCProvisioningService/ProvisioningApplied or IaCProvisioningService/ProvisioningFailed is consumed, and a 409 or 422 is explained in words (FUX-05).",
        "AC3: Given a drift finding, when an operator observes the environment or decides a proposal through RuntimeEnvironmentService/ObserveEnvironment or RuntimeEnvironmentService/DecideReconciliation, then a rejection carries a reason, production acceptance carries the approval binding of its class, and RuntimeEnvironmentService/RuntimeDriftDetected or RuntimeEnvironmentService/ReconciliationDecided refresh the open page (FUX-07).",
        "AC4: Given a run or environment of another tenant, an applying run, a decided proposal or an unreachable RuntimeCloudHost, when the screen or a command is requested, then the answer is 404, IaCProvisioningService/CancelProvisioning or RuntimeEnvironmentService/DecideReconciliation answers 409 explained in words, or the source is shown degraded with its last freshness and the command refused with 503 and not queued (model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5675",
        "AIFACTORY-TASK-5676",
        "AIFACTORY-TASK-5677",
        "AIFACTORY-TASK-5708"
      ],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12003,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "IaCProvisioningService",
          "RuntimeEnvironmentService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "IaCProvisioningService/ListSpecifications",
          "IaCProvisioningService/ListProvisioningRuns",
          "IaCProvisioningService/GetProvisioningRun",
          "IaCProvisioningService/PlanProvisioning",
          "IaCProvisioningService/CancelProvisioning",
          "RuntimeEnvironmentService/GetRuntimeInventory",
          "RuntimeEnvironmentService/ListDrift",
          "RuntimeEnvironmentService/ListReconciliationProposals",
          "RuntimeEnvironmentService/ObserveEnvironment",
          "RuntimeEnvironmentService/DecideReconciliation"
        ],
        "events": [
          "IaCProvisioningService/ProvisioningPlanned",
          "IaCProvisioningService/ProvisioningApplied",
          "IaCProvisioningService/ProvisioningFailed",
          "RuntimeEnvironmentService/ObservedStateChanged",
          "RuntimeEnvironmentService/RuntimeDriftDetected",
          "RuntimeEnvironmentService/ReconciliationProposed",
          "RuntimeEnvironmentService/ReconciliationDecided"
        ],
        "requirements": [
          "FUX-04",
          "FUX-05",
          "FUX-07"
        ]
      },
      "relates": {
        "screens": [
          "provisioning",
          "inventory"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:ia-cprovisioning-service",
        "feature:runtime-environment-service",
        "feature:runtime-cloud-host"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1409]",
      "number": 1409
    },
    {
      "id": "AIFACTORY-TASK-5675",
      "type": "task",
      "parent": "AIFACTORY-US-1409",
      "title": "Provisioning and inventory screens in the Software Factory microfrontend",
      "sequence": "14.09.03.01",
      "description": "Provisioning and inventory screens in the Software Factory microfrontend. Expected output: The Software Factory microfrontend renders `provisioning` and `inventory` with the delivery, approval and freshness families, specifications and runs with plan and apply receipts, the run waiting for its approval, observed inventory with its age, drift findings and reconciliation proposals with accept and reject-with-reason controls.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Software Factory microfrontend renders `provisioning` and `inventory` with the delivery, approval and freshness families, specifications and runs with plan and apply receipts, the run waiting for its approval, observed inventory with its age, drift findings and reconciliation proposals with accept and reject-with-reason controls."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12003,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5675]",
      "number": 5675
    },
    {
      "id": "AIFACTORY-TASK-5676",
      "type": "task",
      "parent": "AIFACTORY-US-1409",
      "title": "Screen models and command routes of the provisioning and inventory screens in StudioBff",
      "sequence": "14.09.03.02",
      "description": "Screen models and command routes of the provisioning and inventory screens in StudioBff. Expected output: StudioBff composes the two screens through RuntimeCloudHost, by REST through the pinned client package of that gateway (AIFACTORY-TASK-6602, AIFACTORY-TASK-6605), with the freshness of each source, forwards `PlanProvisioning` with an idempotency key, `CancelProvisioning`, `ObserveEnvironment` and `DecideReconciliation` with the approval binding of its production class, refuses them with 503 while RuntimeCloudHost does not answer, and refreshes the views on the provisioning and runtime events.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes the two screens through RuntimeCloudHost, by REST through the pinned client package of that gateway (AIFACTORY-TASK-6602, AIFACTORY-TASK-6605), with the freshness of each source, forwards `PlanProvisioning` with an idempotency key, `CancelProvisioning`, `ObserveEnvironment` and `DecideReconciliation` with the approval binding of its production class, refuses them with 503 while RuntimeCloudHost does not answer, and refreshes the views on the provisioning and runtime events."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12003,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5676]",
      "number": 5676
    },
    {
      "id": "AIFACTORY-TASK-5677",
      "type": "task",
      "parent": "AIFACTORY-US-1409",
      "title": "Verify provisioning and drift decisions by role",
      "sequence": "14.09.03.03",
      "description": "Verify provisioning and drift decisions by role. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a planned production run waiting for approval, a 409 cancel of an applying run, a pushed drift finding, an accepted and a rejected proposal, a 409 on a proposal already decided, a provisioning run and an environment of another tenant answered 404, an unreachable RuntimeCloudHost with commands answered 503 and an observer session; the tests prove AC1 to AC4 of AIFACTORY-US-1409 (IaCProvisioningService/PlanProvisioning, RuntimeEnvironmentService/DecideReconciliation).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a planned production run waiting for approval, a 409 cancel of an applying run, a pushed drift finding, an accepted and a rejected proposal, a 409 on a proposal already decided, a provisioning run and an environment of another tenant answered 404, an unreachable RuntimeCloudHost with commands answered 503 and an observer session; the tests prove AC1 to AC4 of AIFACTORY-US-1409 (IaCProvisioningService/PlanProvisioning, RuntimeEnvironmentService/DecideReconciliation)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5677]",
      "number": 5677
    },
    {
      "id": "AIFACTORY-TASK-5708",
      "type": "task",
      "parent": "AIFACTORY-US-1409",
      "title": "Verify the StudioBff side of the provisioning and inventory screens",
      "sequence": "14.09.03.04",
      "description": "Verify the StudioBff side of the provisioning and inventory screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-provisioning-and-inventory\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through RuntimeCloudHost with the freshness and age of each source), AC2 (`PlanProvisioning` and `CancelProvisioning` forwarded once with an idempotency key, refresh on `ProvisioningApplied` and `ProvisioningFailed`), AC3 (`ObserveEnvironment` and `DecideReconciliation` forwarded, production acceptance with the approval binding of its class, refresh on `RuntimeDriftDetected` and `ReconciliationDecided`) and AC4 (the 404 and 409 answers returned unchanged, 503 while RuntimeCloudHost does not answer and nothing queued) of AIFACTORY-US-1409 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-provisioning-and-inventory\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through RuntimeCloudHost with the freshness and age of each source), AC2 (`PlanProvisioning` and `CancelProvisioning` forwarded once with an idempotency key, refresh on `ProvisioningApplied` and `ProvisioningFailed`), AC3 (`ObserveEnvironment` and `DecideReconciliation` forwarded, production acceptance with the approval binding of its class, refresh on `RuntimeDriftDetected` and `ReconciliationDecided`) and AC4 (the 404 and 409 answers returned unchanged, 503 while RuntimeCloudHost does not answer and nothing queued) of AIFACTORY-US-1409 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5708]",
      "number": 5708
    },
    {
      "id": "AIFACTORY-US-1410",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-080",
      "title": "Software Factory: I read the workflow graph of a run with its checkpoints, answer the decision an attempt waits for through Run Control, and ask Run Control to stop the run",
      "sequence": "14.09.04",
      "description": "As an operator, I want to see the graph of a run with the state of every step, the checkpoints of an attempt and a decision an attempt waits for, and to stop the run, so that I see where a run is blocked and can stop it from its graph while Run Control stays the one place that records what the run is. A requester, an operator or an observer opens the screen `workflow-run-graph` at `/factory/runs/{runId}/graph`. StudioBff composes it under the scope of the session through AgentRuntimeWorker, the internal gateway of the Agent Mesh platform: `GetWorkflowRunGraph` of WorkflowEngineService with the state of every step run, timers and compensation entries, `GetAttemptTimeline` of AgentRuntimeService for the attempt the user selects, and `ListCheckpoints` with sequence, phase and adapter version, which an operator reads before a resume decision. The run and freshness families of model/ux/states.yaml govern the display. When an attempt waits for a human input or an escalation choice, `AttemptDecisionRequested` marks it and the graph shows the waiting decision with its kind and options. The answer control is enabled for a user whose token holds `factory.runs.operate`: the page sends the answer through `ForwardCommand` to the public route `AnswerDecision` of RunControlService behind ControlPlaneApi, which passes it to the waiting attempt through `Runtime.AnswerDecision` of AgentRuntimeService (D137); the Studio never calls the internal `Runtime.AnswerDecision` itself, and a role without that scope sees the control disabled with the reason. The codes of `AnswerDecision` reach the page unchanged (D137) and are explained in words: 404 for a decision the open attempt did not ask for, 409 for a decision already answered, and 503, with nothing recorded, when AgentRuntimeService does not answer. An approval is never answered here, because `AnswerDecision` refuses an approval with 409 and approvals arrive through the approval card of the Workspace area. To stop a run the page calls `CancelRun` of RunControlService through ControlPlaneApi, because Run Control holds the truth of a run and asks the lease holder to interrupt (ADR-0024 decision 5); the page says that the cancellation is requested, marks each attempt interrupted when `AttemptCancellationObserved` is consumed, and shows the run cancelled only once `RunCancelled` of RunControlService is consumed. A `CancelRun` answered 409, as for a run that is already terminal, is explained in words with nothing changed. The page never calls `Runtime.Interrupt` itself. The adverse branches of the flow `recover-run` of model/ux/flows.yaml are shown in words: a lease still held by another holder and a checkpoint that is missing. A run of another tenant is answered 404 like one that does not exist. StudioBff consumes `StepRunStateChanged`, `AttemptPhaseChanged`, `AttemptCheckpointed` (D137), `AttemptDecisionRequested`, `AttemptCancellationObserved` and `RunCancelled`, refreshes the open page without a reload and reads the checkpoints of the selected attempt again from `ListCheckpoints`, so a new checkpoint appears with its sequence when it is recorded. When AgentRuntimeWorker does not answer, the source is shown degraded with its last freshness and the parts already held are marked stale. Kind: behavior. Traces: services: StudioBff, WorkflowEngineService, AgentRuntimeService, RunControlService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, WorkflowEngineService/GetWorkflowRunGraph, AgentRuntimeService/GetAttemptTimeline, AgentRuntimeService/ListCheckpoints, RunControlService/CancelRun, RunControlService/AnswerDecision; events: WorkflowEngineService/StepRunStateChanged, AgentRuntimeService/AttemptPhaseChanged, AgentRuntimeService/AttemptCheckpointed, AgentRuntimeService/AttemptDecisionRequested, AgentRuntimeService/AttemptCancellationObserved, RunControlService/RunCancelled; adrs: ADR-0015, ADR-0024, ADR-0028; requirements: FUX-04, FUX-07. Relates: screens: workflow-run-graph. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:workflow-engine-service, feature:agent-runtime-service, feature:agent-runtime-worker, feature:run-control-service, feature:control-plane-api. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an operator on `workflow-run-graph`, when StudioBff/GetScreenModel composes it, then it renders from WorkflowEngineService/GetWorkflowRunGraph, AgentRuntimeService/GetAttemptTimeline and AgentRuntimeService/ListCheckpoints, and the adverse branches of the flow `recover-run` of model/ux/flows.yaml (lease held, checkpoint missing) are explained in words (FUX-07).",
        "AC2: Given an attempt marked by AgentRuntimeService/AttemptDecisionRequested, when the graph renders and a user holding `factory.runs.operate` answers, then the waiting decision is shown with its kind and options, the answer goes through StudioBff/ForwardCommand to RunControlService/AnswerDecision and never to the runtime directly, its 404, 409 and 503 are explained in words with nothing changed, a role without the scope sees the control disabled with the reason, and no approval is answered from this screen (ADR-0028, D137).",
        "AC3: Given a running run, when an operator stops it, then the request goes through StudioBff/ForwardCommand to RunControlService/CancelRun and never to the runtime directly, the page says the cancellation is requested, marks each attempt interrupted when AgentRuntimeService/AttemptCancellationObserved is consumed, and shows the run cancelled only once RunControlService/RunCancelled is consumed, and a 409 of RunControlService/CancelRun for a run that is already terminal is explained in words with nothing changed (ADR-0024 decision 5).",
        "AC4: Given an open graph, when WorkflowEngineService/StepRunStateChanged, AgentRuntimeService/AttemptPhaseChanged or AgentRuntimeService/AttemptCheckpointed is consumed by StudioBff, then the page updates without a reload and the checkpoints of the selected attempt are read again from AgentRuntimeService/ListCheckpoints, and a run of another tenant is answered 404 like an unknown one (FUX-04, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5678",
        "AIFACTORY-TASK-5679",
        "AIFACTORY-TASK-5680",
        "AIFACTORY-TASK-5709"
      ],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12004,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "WorkflowEngineService",
          "AgentRuntimeService",
          "RunControlService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "WorkflowEngineService/GetWorkflowRunGraph",
          "AgentRuntimeService/GetAttemptTimeline",
          "AgentRuntimeService/ListCheckpoints",
          "RunControlService/CancelRun",
          "RunControlService/AnswerDecision"
        ],
        "events": [
          "WorkflowEngineService/StepRunStateChanged",
          "AgentRuntimeService/AttemptPhaseChanged",
          "AgentRuntimeService/AttemptCheckpointed",
          "AgentRuntimeService/AttemptDecisionRequested",
          "AgentRuntimeService/AttemptCancellationObserved",
          "RunControlService/RunCancelled"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-04",
          "FUX-07"
        ]
      },
      "relates": {
        "screens": [
          "workflow-run-graph"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:workflow-engine-service",
        "feature:agent-runtime-service",
        "feature:agent-runtime-worker",
        "feature:run-control-service",
        "feature:control-plane-api"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1410]",
      "number": 1410
    },
    {
      "id": "AIFACTORY-TASK-5678",
      "type": "task",
      "parent": "AIFACTORY-US-1410",
      "title": "Workflow run graph screen in the Software Factory microfrontend",
      "sequence": "14.09.04.01",
      "description": "Workflow run graph screen in the Software Factory microfrontend. Expected output: The Software Factory microfrontend renders `workflow-run-graph` with the run and freshness families, the graph of step runs with timers and compensation entries, the selected attempt with its checkpoints, the waiting decision with its kind and options and an answer control enabled for a user holding `factory.runs.operate` and disabled with the reason for other roles, the 404, 409 and 503 of `AnswerDecision` explained in words, attempts marked interrupted, and a stop control that says the cancellation is requested until the run is cancelled.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Software Factory microfrontend renders `workflow-run-graph` with the run and freshness families, the graph of step runs with timers and compensation entries, the selected attempt with its checkpoints, the waiting decision with its kind and options and an answer control enabled for a user holding `factory.runs.operate` and disabled with the reason for other roles, the 404, 409 and 503 of `AnswerDecision` explained in words, attempts marked interrupted, and a stop control that says the cancellation is requested until the run is cancelled."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12004,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5678]",
      "number": 5678
    },
    {
      "id": "AIFACTORY-TASK-5679",
      "type": "task",
      "parent": "AIFACTORY-US-1410",
      "title": "Screen model and command routes of the workflow run graph in StudioBff",
      "sequence": "14.09.04.02",
      "description": "Screen model and command routes of the workflow run graph in StudioBff. Expected output: StudioBff composes `workflow-run-graph` through AgentRuntimeWorker with the freshness of the source, forwards an answer to the public route `AnswerDecision` of RunControlService through ControlPlaneApi and never to `Runtime.AnswerDecision`, forwards a stop to `CancelRun` of RunControlService through ControlPlaneApi, never to `Runtime.Interrupt`, returns their codes unchanged (D137), and refreshes the view on `StepRunStateChanged`, `AttemptPhaseChanged`, `AttemptCheckpointed`, `AttemptDecisionRequested`, `AttemptCancellationObserved` and `RunCancelled`, reading the checkpoints of the selected attempt again from `ListCheckpoints`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `workflow-run-graph` through AgentRuntimeWorker with the freshness of the source, forwards an answer to the public route `AnswerDecision` of RunControlService through ControlPlaneApi and never to `Runtime.AnswerDecision`, forwards a stop to `CancelRun` of RunControlService through ControlPlaneApi, never to `Runtime.Interrupt`, returns their codes unchanged (D137), and refreshes the view on `StepRunStateChanged`, `AttemptPhaseChanged`, `AttemptCheckpointed`, `AttemptDecisionRequested`, `AttemptCancellationObserved` and `RunCancelled`, reading the checkpoints of the selected attempt again from `ListCheckpoints`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12004,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5679]",
      "number": 5679
    },
    {
      "id": "AIFACTORY-TASK-5680",
      "type": "task",
      "parent": "AIFACTORY-US-1410",
      "title": "Verify the run graph with a waiting decision and an observed stop",
      "sequence": "14.09.04.03",
      "description": "Verify the run graph with a waiting decision and an observed stop. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a graph, an attempt waiting for a decision answered by an operator and refused with 409 when already answered, its answer control disabled for an observer, a held lease, a missing checkpoint, attempts marked interrupted before the run is shown cancelled on `RunCancelled`, a 409 cancel of a terminal run, a pushed phase change and a run of another tenant; the tests prove AC1 to AC4 of AIFACTORY-US-1410 (RunControlService/AnswerDecision, RunControlService/CancelRun, RunControlService/RunCancelled).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a graph, an attempt waiting for a decision answered by an operator and refused with 409 when already answered, its answer control disabled for an observer, a held lease, a missing checkpoint, attempts marked interrupted before the run is shown cancelled on `RunCancelled`, a 409 cancel of a terminal run, a pushed phase change and a run of another tenant; the tests prove AC1 to AC4 of AIFACTORY-US-1410 (RunControlService/AnswerDecision, RunControlService/CancelRun, RunControlService/RunCancelled)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5680]",
      "number": 5680
    },
    {
      "id": "AIFACTORY-TASK-5709",
      "type": "task",
      "parent": "AIFACTORY-US-1410",
      "title": "Verify the StudioBff side of the workflow run graph",
      "sequence": "14.09.04.04",
      "description": "Verify the StudioBff side of the workflow run graph. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-workflow-run-graph\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through AgentRuntimeWorker from `GetWorkflowRunGraph`, `GetAttemptTimeline` and `ListCheckpoints`), AC2 (the waiting decision composed from `AttemptDecisionRequested`, the answer forwarded once to `RunControlService/AnswerDecision` through ControlPlaneApi and never to `Runtime.AnswerDecision`, its 404, 409 and 503 returned unchanged), AC3 (`CancelRun` forwarded once through ControlPlaneApi, never to the runtime, its 409 returned unchanged, refresh on `AttemptCancellationObserved` and `RunCancelled`) and AC4 (refresh on `StepRunStateChanged`, `AttemptPhaseChanged` and `AttemptCheckpointed` with the checkpoints read again, the 404 of another tenant returned unchanged) of AIFACTORY-US-1410 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-factory-workflow-run-graph\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition through AgentRuntimeWorker from `GetWorkflowRunGraph`, `GetAttemptTimeline` and `ListCheckpoints`), AC2 (the waiting decision composed from `AttemptDecisionRequested`, the answer forwarded once to `RunControlService/AnswerDecision` through ControlPlaneApi and never to `Runtime.AnswerDecision`, its 404, 409 and 503 returned unchanged), AC3 (`CancelRun` forwarded once through ControlPlaneApi, never to the runtime, its 409 returned unchanged, refresh on `AttemptCancellationObserved` and `RunCancelled`) and AC4 (refresh on `StepRunStateChanged`, `AttemptPhaseChanged` and `AttemptCheckpointed` with the checkpoints read again, the 404 of another tenant returned unchanged) of AIFACTORY-US-1410 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5709]",
      "number": 5709
    },
    {
      "id": "AIFACTORY-US-038",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-080",
      "title": "Every work area renders from the platform read models, and the Software Factory work area is bound to the model",
      "sequence": "14.09.05",
      "description": "As an observer, I want every work area of the Studio, and the Software Factory work area in full, to show what the platforms hold, through the backend-for-frontend, so that what I read in the Studio is the state of the Factory and nothing else, and what is not yet delivered says so. This is the integration PBI of the Software Factory area and the rule every work area follows. StudioBff composes one screen-shaped response per screen from the gateways of the platforms that own its read models, and every microfrontend of the seven work areas renders from that response only; no browser calls a platform service. A screen is offered to the roles its list in model/ux/screens.yaml names; for any other role it is absent from the navigation and `GetScreenModel` refuses it with 403. A screen whose platform is not delivered in the increment shows each such source as unknown in the freshness family, named, never hidden and never filled from a fake, and a read model older than its freshness limit shows its age. The Software Factory microfrontend is generated from the microfrontend library template, composed into the shell through its registry and holds eleven screens: ten are delivered in I3 by AIFACTORY-US-1407 to AIFACTORY-US-1410, and `generated-products` reads GeneratedProductHost of I6 and the fleet inventory of I7, so in I3 it is registered, offered to its roles, shows its sources as unknown and offers no `AcknowledgeOperationsHandover`. Every screen subscribes through `Realtime.Subscribe` of StudioRealtimeGateway; when the channel drops the page marks its data stale and when it returns the page reloads the screen model. A command is forwarded once with an idempotency key, the scope of the session and the approval binding its class requires, and the owning service, never StudioBff, decides; a production promotion carries no Studio approval, because its one approval is the gate of EnvironmentPromotionService (D133). On `workflow-run-graph` the commands `Runtime.Interrupt` and `Runtime.AnswerDecision` that model/ux/screens.yaml lists are replaced by `CancelRun` of RunControlService (ADR-0024) and by the public route `AnswerDecision` of RunControlService (D137). Every screen renders in English, Russian and Hebrew right to left and is built to the accessibility contract of docs/planes/experience/studio/localization-accessibility.md; the area evidence that follows this PBI checks it on the finished area. Kind: behavior. Traces: services: StudioBff, StudioRealtimeGateway, BlueprintService, GenerationRecipeService, PipelineExecutionService, EnvironmentPromotionService, IaCProvisioningService, RuntimeEnvironmentService, WorkflowEngineService; apis: StudioBff/GetStudioSession, StudioBff/GetScreenModel, StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe; adrs: ADR-0007, ADR-0015, ADR-0028; requirements: FUX-04, FUX-07. Relates: screens: generated-products. Depends on: AIFACTORY-US-1407, AIFACTORY-US-1408, AIFACTORY-US-1409, AIFACTORY-US-1410, feature:studio-bff, feature:studio-realtime-gateway, feature:component-blazor-shell. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, docs/planes/experience/studio/screens/software-factory.md.",
      "acceptanceCriteria": [
        "AC1: Given each of the seven work areas, when a user with a role in it opens a screen, then the screen renders from StudioBff/GetScreenModel only, composed from the read models model/ux/screens.yaml names for it, and for a role its list does not name the screen is not offered and StudioBff/GetScreenModel answers 403 (ADR-0007, ADR-0015).",
        "AC2: Given a platform that is not delivered yet, such as the sources of `generated-products`, when one of its screens opens, then the screen shows each such source as unknown in the freshness family of model/ux/states.yaml with the source named, shows no invented value and offers none of its commands (FUX-04).",
        "AC3: Given an open screen and its subscription through StudioRealtimeGateway/Realtime.Subscribe, when a read model is older than its freshness limit or the channel drops, then its age is shown and the data is never presented as current, and when the channel returns the page reloads StudioBff/GetScreenModel without a browser reload (FUX-07).",
        "AC4: Given a command of a Software Factory screen, when a role issues it, then StudioBff/ForwardCommand forwards it once with an idempotency key and the approval binding its class requires through the single-entry gateway of its platform, a role without the right sees it disabled with the reason, and a production promotion carries no Studio approval (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/software-factory.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-530",
        "AIFACTORY-TASK-448",
        "AIFACTORY-TASK-449",
        "AIFACTORY-TASK-450",
        "AIFACTORY-TASK-531",
        "AIFACTORY-TASK-532",
        "AIFACTORY-TASK-749"
      ],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "BlueprintService",
          "GenerationRecipeService",
          "PipelineExecutionService",
          "EnvironmentPromotionService",
          "IaCProvisioningService",
          "RuntimeEnvironmentService",
          "WorkflowEngineService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "adrs": [
          "ADR-0007",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-04",
          "FUX-07"
        ]
      },
      "relates": {
        "screens": [
          "generated-products"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1407",
        "AIFACTORY-US-1408",
        "AIFACTORY-US-1409",
        "AIFACTORY-US-1410",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/software-factory.md"
      ],
      "titlePrefix": "[AIFACTORY-US-038]",
      "number": 38
    },
    {
      "id": "AIFACTORY-TASK-530",
      "type": "task",
      "parent": "AIFACTORY-US-038",
      "title": "Screen models composed per screen",
      "sequence": "14.09.05.01",
      "description": "Screen models composed per screen. Expected output: StudioBff composes one screen-shaped response per screen of the seven work areas from the gateways of the platforms that own its read models, with the freshness of each source, a source not delivered in the increment marked unknown and named, and 403 for a role the screen does not name.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes one screen-shaped response per screen of the seven work areas from the gateways of the platforms that own its read models, with the freshness of each source, a source not delivered in the increment marked unknown and named, and 403 for a role the screen does not name."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-530]",
      "number": 530
    },
    {
      "id": "AIFACTORY-TASK-448",
      "type": "task",
      "parent": "AIFACTORY-US-038",
      "title": "Screens of the work area Software Factory: Blueprints, DSL studio, Recipes, Generated outputs, Proposals, Pipeline runs, Promotions and 4 more",
      "sequence": "14.09.05.02",
      "description": "Screens of the work area Software Factory: Blueprints, DSL studio, Recipes, Generated outputs, Proposals, Pipeline runs, Promotions and 4 more. Expected output: The Software Factory microfrontend is composed into the shell through the registry with one navigation group and the eleven routes of model/ux/screens.yaml; each screen renders from StudioBff only, and `generated-products` renders its sources as unknown with the source named and no command.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Software Factory microfrontend is composed into the shell through the registry with one navigation group and the eleven routes of model/ux/screens.yaml; each screen renders from StudioBff only, and `generated-products` renders its sources as unknown with the source named and no command."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-448]",
      "number": 448
    },
    {
      "id": "AIFACTORY-TASK-449",
      "type": "task",
      "parent": "AIFACTORY-US-038",
      "title": "Commands of the work area Software Factory",
      "sequence": "14.09.05.03",
      "description": "Commands of the work area Software Factory. Expected output: The commands of the ten delivered screens are forwarded through StudioBff with an idempotency key, the scope of the session and the approval binding their class requires, `RequestPromotion` carries no Studio approval, the stop of `workflow-run-graph` goes to `CancelRun` of RunControlService instead of `Runtime.Interrupt`, the answer to a waiting attempt goes to the public route `AnswerDecision` of RunControlService instead of `Runtime.AnswerDecision` (D137), and `AcknowledgeOperationsHandover` of `generated-products` is not offered in I3.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The commands of the ten delivered screens are forwarded through StudioBff with an idempotency key, the scope of the session and the approval binding their class requires, `RequestPromotion` carries no Studio approval, the stop of `workflow-run-graph` goes to `CancelRun` of RunControlService instead of `Runtime.Interrupt`, the answer to a waiting attempt goes to the public route `AnswerDecision` of RunControlService instead of `Runtime.AnswerDecision` (D137), and `AcknowledgeOperationsHandover` of `generated-products` is not offered in I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-449]",
      "number": 449
    },
    {
      "id": "AIFACTORY-TASK-450",
      "type": "task",
      "parent": "AIFACTORY-US-038",
      "title": "States, roles, locales and accessibility of the work area Software Factory",
      "sequence": "14.09.05.04",
      "description": "States, roles, locales and accessibility of the work area Software Factory. Expected output: Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-450]",
      "number": 450
    },
    {
      "id": "AIFACTORY-TASK-531",
      "type": "task",
      "parent": "AIFACTORY-US-038",
      "title": "Unavailable and stale states",
      "sequence": "14.09.05.05",
      "description": "Unavailable and stale states. Expected output: A screen whose platform is not delivered or whose model is stale shows that state from the state families of the model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A screen whose platform is not delivered or whose model is stale shows that state from the state families of the model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-531]",
      "number": 531
    },
    {
      "id": "AIFACTORY-TASK-532",
      "type": "task",
      "parent": "AIFACTORY-US-038",
      "title": "Render check of all screens by role",
      "sequence": "14.09.05.06",
      "description": "Render check of all screens by role. Expected output: An automated pass opens every screen of the seven work areas with every role and records what rendered.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "An automated pass opens every screen of the seven work areas with every role and records what rendered."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-532]",
      "number": 532
    },
    {
      "id": "AIFACTORY-TASK-749",
      "type": "task",
      "parent": "AIFACTORY-US-038",
      "title": "Verify studio-work-areas-render by running the declared command",
      "sequence": "14.09.05.07",
      "description": "Verify studio-work-areas-render by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-038 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-038 (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-749]",
      "number": 749
    },
    {
      "id": "AIFACTORY-US-1411",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-080",
      "title": "Software Factory area evidence: every screen passes the accessibility and phone-width checks and an end-to-end walk of the area through StudioBff is recorded",
      "sequence": "14.09.06",
      "description": "As an observer, I want proof that every screen of the Software Factory area is usable by keyboard, in every locale and at phone width, and that a walk from blueprint to promotion works through the Studio, so that the area is accepted on a recorded check and the generated products screen says it is not yet delivered. This PBI is the proof of the Software Factory area and comes after its integration PBI AIFACTORY-US-038, which registers the eleven screens. The accessibility and phone-width check opens each of the eleven screens of the area for every role its list in model/ux/screens.yaml names, and for one role it does not name, and asserts the rules of docs/planes/experience/studio/localization-accessibility.md: WCAG 2.2 AA by the automated checks, keyboard operation including the graph and the blueprint editor, live updates announced politely and not animated under reduced motion, refusals explained in words, in English, Russian and Hebrew right to left, light and dark, at 1440 by 900 and at 390 by 844 with no horizontal scroll. The end-to-end walk follows the fixture project of the first outcome: as an asset maintainer it validates and submits a blueprint version and approves a recipe, reads the generated outputs, the change proposal and the pipeline run; as an operator it requests a promotion into the acceptance environment, follows it to Completed and rolls back a second one, plans a provisioning run, decides a drift proposal, stops a run from its graph and answers the decision a waiting attempt asks for through `AnswerDecision` of RunControlService (D137); as an observer it sees the same screens without commands. The screen `generated-products` reads GeneratedProductHost, delivered in I6, and the fleet inventory of I7; it shows its sources as unknown and is listed by name, and `dsl-studio` shows its topic source unknown. The record holds per screen and role the expected and observed result and the network log, which shows no address other than StudioBff and StudioRealtimeGateway. Kind: evidence. Traces: services: StudioBff; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand; adrs: ADR-0007; requirements: FUX-04, FUX-12. Relates: screens: blueprints, dsl-studio, recipes, generated-outputs, proposals, pipeline-runs, promotions, provisioning, inventory, generated-products, workflow-run-graph; nfrs: NFR-15. Depends on: AIFACTORY-US-1407, AIFACTORY-US-1408, AIFACTORY-US-1409, AIFACTORY-US-1410, AIFACTORY-US-038, feature:studio-bff, feature:component-blazor-shell. Sources: model/ux/screens.yaml, docs/planes/experience/studio/localization-accessibility.md, docs/planes/experience/studio/screens/software-factory.md.",
      "acceptanceCriteria": [
        "AC1: Given each of the 11 screens of the area in model/ux/screens.yaml, when the accessibility check runs in the three locales, both schemes and the two viewports of docs/planes/experience/studio/localization-accessibility.md, then every screen passes the automated WCAG 2.2 AA checks and keyboard operation and has no horizontal scroll at 390 by 844 (NFR-15, FUX-12).",
        "AC2: Given the walk as an asset maintainer, an operator and an observer, when it runs on the acceptance estate, then every delivered screen renders from StudioBff/GetScreenModel, every command goes through StudioBff/ForwardCommand, a role a screen does not name gets 403, and `generated-products` is listed by name with its sources unknown (ADR-0007, FUX-04).",
        "AC3: Given the record and the network log of the walk, when they are read, then the browser called no address other than StudioBff and StudioRealtimeGateway and no screen showed a value its source does not deliver in I3 (FUX-12)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/software-factory.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5691",
        "AIFACTORY-TASK-5692",
        "AIFACTORY-TASK-5693"
      ],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12006,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand"
        ],
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-04",
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "blueprints",
          "dsl-studio",
          "recipes",
          "generated-outputs",
          "proposals",
          "pipeline-runs",
          "promotions",
          "provisioning",
          "inventory",
          "generated-products",
          "workflow-run-graph"
        ],
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1407",
        "AIFACTORY-US-1408",
        "AIFACTORY-US-1409",
        "AIFACTORY-US-1410",
        "AIFACTORY-US-038",
        "feature:studio-bff",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/software-factory.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1411]",
      "number": 1411
    },
    {
      "id": "AIFACTORY-TASK-5691",
      "type": "task",
      "parent": "AIFACTORY-US-1411",
      "title": "End-to-end walk of the Software Factory area by role",
      "sequence": "14.09.06.01",
      "description": "End-to-end walk of the Software Factory area by role. Expected output: A browser-driven walk in the Studio repository that opens every screen of the Software Factory area with every role its list names and one it does not, walks the fixture project from blueprint to promotion, rollback, provisioning, drift and a stopped run, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven walk in the Studio repository that opens every screen of the Software Factory area with every role its list names and one it does not, walks the fixture project from blueprint to promotion, rollback, provisioning, drift and a stopped run, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12006,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5691]",
      "number": 5691
    },
    {
      "id": "AIFACTORY-TASK-5692",
      "type": "task",
      "parent": "AIFACTORY-US-1411",
      "title": "Accessibility and phone-width check of the Software Factory screens",
      "sequence": "14.09.06.02",
      "description": "Accessibility and phone-width check of the Software Factory screens. Expected output: Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the eleven screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1411 against docs/planes/experience/studio/localization-accessibility.md.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility | npx playwright test --project=phone-390x844.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the eleven screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1411 against docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5692]",
      "number": 5692
    },
    {
      "id": "AIFACTORY-TASK-5693",
      "type": "task",
      "parent": "AIFACTORY-US-1411",
      "title": "Verify unavailable and stale states and the walk record of the Software Factory area",
      "sequence": "14.09.06.03",
      "description": "Verify unavailable and stale states and the walk record of the Software Factory area. Expected output: Run the walk of AIFACTORY-TASK-5691 on the acceptance estate; its record shows `generated-products` and the topic source of `dsl-studio` unknown and stale data marked with its age, and with the network log proves AC2 and AC3 of AIFACTORY-US-1411 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the walk of AIFACTORY-TASK-5691 on the acceptance estate; its record shows `generated-products` and the topic source of `dsl-studio` unknown and stale data marked with its age, and with the network log proves AC2 and AC3 of AIFACTORY-US-1411 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 120,
      "phase": "factory",
      "stackRank": 12006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5693]",
      "number": 5693
    },
    {
      "id": "AIFACTORY-FEAT-081",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-014",
      "title": "Studio work area: Workspace",
      "sequence": "14.10",
      "description": "The 8 screens of the Studio work area Workspace on the Blazor shell and microfrontends, bound to the read models and commands the model names for them, with their state families, roles, locales and accessibility contracts. Screens come from model/ux/screens.yaml and the prototype alignment. Increment I3: Studio. Build order 121 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1412",
        "AIFACTORY-US-1413",
        "AIFACTORY-US-1414",
        "AIFACTORY-US-034",
        "AIFACTORY-US-033",
        "AIFACTORY-US-1415"
      ],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12100,
      "titlePrefix": "[AIFACTORY-FEAT-081]",
      "number": 81
    },
    {
      "id": "AIFACTORY-US-1412",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-081",
      "title": "Workspace: I land on my work with my runs, approvals and notifications in my scope, switch the scope, and read the overview of a project",
      "sequence": "14.10.01",
      "description": "As a requester, I want one landing page with the runs and approvals that concern me and my notifications, a scope I can switch, and an overview of a project, so that I see what waits on me and how a project stands without searching for it. Any user with a Studio role opens the screen `my-work` at `/work`. StudioBff composes it from `GetStudioSession` with the user, the roles in each scope and the current tenant and project, from `ListNotifications` of StudioNotificationService with unread counts by importance, and from `ListRuns` and `ListApprovals` of RunControlService, reached through ControlPlaneApi, filtered to the trusted scope of the session. The user switches the current tenant or project with `SetStudioScope` of StudioBff; a scope the user holds no role in is answered 403, and every screen model after the switch is composed for the new scope. A requester, a reviewer, an operator, a workspace admin or an observer opens `project-overview` at `/projects/{projectId}`, composed from `GetProject` of ProjectService with memberships, delegations and source scope, `ListEnvironments` of EnvironmentService, `GetProjectUsage` of CostUsageService and `ListRuns` for the project. The run, approval, usage and freshness families of model/ux/states.yaml govern the display; uncertain usage is shown apart and never folded into a total. A project of another tenant is answered 404 like one that does not exist, and a project in the tenant the user holds no scope in is answered 403 (ADR-0015). StudioBff consumes `RunStateChanged` and `ApprovalRequested` of RunControlService and refreshes the lists, and the realtime gateway pushes `NotificationCreated`, so a new approval or notification appears on the open page without a reload. When ControlPlaneApi does not answer, the run and project sources are shown degraded with their last freshness while the notifications stay current. Kind: behavior. Traces: services: StudioBff, StudioNotificationService, RunControlService, ProjectService, EnvironmentService, CostUsageService; apis: StudioBff/GetStudioSession, StudioBff/SetStudioScope, StudioBff/GetScreenModel, StudioNotificationService/ListNotifications, RunControlService/ListRuns, RunControlService/ListApprovals, ProjectService/GetProject, EnvironmentService/ListEnvironments, CostUsageService/GetProjectUsage; events: RunControlService/RunStateChanged, RunControlService/ApprovalRequested, StudioNotificationService/NotificationCreated; adrs: ADR-0015; requirements: FUX-01, FUX-04, FUX-08. Relates: screens: my-work, project-overview. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:studio-notification-service, feature:run-control-service, feature:project-service, feature:environment-service, feature:cost-usage-service-complete, feature:control-plane-api. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/services/factory-studio/StudioBff.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a user on `my-work`, when StudioBff/GetScreenModel composes it, then it shows the session from StudioBff/GetStudioSession, notifications from StudioNotificationService/ListNotifications and runs and approvals from RunControlService/ListRuns and RunControlService/ListApprovals in the trusted scope, with the freshness of each source (FUX-01).",
        "AC2: Given a user with roles in two projects, when they switch the scope through StudioBff/SetStudioScope, then every screen model is composed for the new scope, a scope without a role is answered 403, and RunControlService/ApprovalRequested or StudioNotificationService/NotificationCreated show on the open page without a reload (FUX-04).",
        "AC3: Given `project-overview`, when it opens, then it renders from ProjectService/GetProject, EnvironmentService/ListEnvironments, CostUsageService/GetProjectUsage and RunControlService/ListRuns with uncertain usage apart, and a project of another tenant is answered 404 like an unknown one (ADR-0015, FUX-08)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5681",
        "AIFACTORY-TASK-5682",
        "AIFACTORY-TASK-5683",
        "AIFACTORY-TASK-5710"
      ],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12101,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioNotificationService",
          "RunControlService",
          "ProjectService",
          "EnvironmentService",
          "CostUsageService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/SetStudioScope",
          "StudioBff/GetScreenModel",
          "StudioNotificationService/ListNotifications",
          "RunControlService/ListRuns",
          "RunControlService/ListApprovals",
          "ProjectService/GetProject",
          "EnvironmentService/ListEnvironments",
          "CostUsageService/GetProjectUsage"
        ],
        "events": [
          "RunControlService/RunStateChanged",
          "RunControlService/ApprovalRequested",
          "StudioNotificationService/NotificationCreated"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01",
          "FUX-04",
          "FUX-08"
        ]
      },
      "relates": {
        "screens": [
          "my-work",
          "project-overview"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:studio-notification-service",
        "feature:run-control-service",
        "feature:project-service",
        "feature:environment-service",
        "feature:cost-usage-service-complete",
        "feature:control-plane-api"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1412]",
      "number": 1412
    },
    {
      "id": "AIFACTORY-TASK-5681",
      "type": "task",
      "parent": "AIFACTORY-US-1412",
      "title": "My work and project overview screens in the Workspace microfrontend",
      "sequence": "14.10.01.01",
      "description": "My work and project overview screens in the Workspace microfrontend. Expected output: The Workspace microfrontend renders `my-work` with the scope switcher, the runs and approvals of the scope and the notifications with unread counts, and `project-overview` with memberships, delegations, source scope, environments, usage by status with uncertain amounts apart and the runs of the project, each with its freshness.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Workspace microfrontend renders `my-work` with the scope switcher, the runs and approvals of the scope and the notifications with unread counts, and `project-overview` with memberships, delegations, source scope, environments, usage by status with uncertain amounts apart and the runs of the project, each with its freshness."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12101,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5681]",
      "number": 5681
    },
    {
      "id": "AIFACTORY-TASK-5682",
      "type": "task",
      "parent": "AIFACTORY-US-1412",
      "title": "Screen models and scope route of the landing screens in StudioBff",
      "sequence": "14.10.01.02",
      "description": "Screen models and scope route of the landing screens in StudioBff. Expected output: StudioBff composes `my-work` and `project-overview` from the session, StudioNotificationService and ControlPlaneApi with the freshness of each source, applies `SetStudioScope` to every later composition, answers 404 for a project of another tenant and 403 for a scope without a role, and refreshes the lists on `RunStateChanged` and `ApprovalRequested`.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `my-work` and `project-overview` from the session, StudioNotificationService and ControlPlaneApi with the freshness of each source, applies `SetStudioScope` to every later composition, answers 404 for a project of another tenant and 403 for a scope without a role, and refreshes the lists on `RunStateChanged` and `ApprovalRequested`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12101,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5682]",
      "number": 5682
    },
    {
      "id": "AIFACTORY-TASK-5683",
      "type": "task",
      "parent": "AIFACTORY-US-1412",
      "title": "Verify the landing screens across a scope switch",
      "sequence": "14.10.01.03",
      "description": "Verify the landing screens across a scope switch. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a user with roles in two projects, a pushed approval and notification, a project of another tenant and an unreachable control plane; the tests prove AC1 to AC3 of AIFACTORY-US-1412 (StudioBff/SetStudioScope, RunControlService/ListApprovals).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a user with roles in two projects, a pushed approval and notification, a project of another tenant and an unreachable control plane; the tests prove AC1 to AC3 of AIFACTORY-US-1412 (StudioBff/SetStudioScope, RunControlService/ListApprovals)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5683]",
      "number": 5683
    },
    {
      "id": "AIFACTORY-TASK-5710",
      "type": "task",
      "parent": "AIFACTORY-US-1412",
      "title": "Verify the StudioBff side of the landing screens",
      "sequence": "14.10.01.04",
      "description": "Verify the StudioBff side of the landing screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-workspace-my-work-and-project-overview\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition of `my-work` from the session, StudioNotificationService and ControlPlaneApi in the trusted scope with the freshness of each source), AC2 (`SetStudioScope` applied to every later composition, 403 for a scope without a role, refresh on `ApprovalRequested` and `RunStateChanged`) and AC3 (composition of `project-overview`, the 404 of another tenant, the run and project sources degraded while ControlPlaneApi does not answer) of AIFACTORY-US-1412 (StudioBff/GetScreenModel, StudioBff/SetStudioScope).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-workspace-my-work-and-project-overview\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (composition of `my-work` from the session, StudioNotificationService and ControlPlaneApi in the trusted scope with the freshness of each source), AC2 (`SetStudioScope` applied to every later composition, 403 for a scope without a role, refresh on `ApprovalRequested` and `RunStateChanged`) and AC3 (composition of `project-overview`, the 404 of another tenant, the run and project sources degraded while ControlPlaneApi does not answer) of AIFACTORY-US-1412 (StudioBff/GetScreenModel, StudioBff/SetStudioScope)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5710]",
      "number": 5710
    },
    {
      "id": "AIFACTORY-US-1413",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-081",
      "title": "Workspace: I submit a run by alias with its limits and follow it in the run detail with its steps, receipts, artifacts and usage, and cancel it",
      "sequence": "14.10.02",
      "description": "As a requester, I want to submit a vision as a run with its scope and limits and follow it step by step with what it called, produced and consumed, so that I see progress, what waits on me and what the run cost without reloading the page. A requester opens the screen `run-submit` at `/work/runs/new`. StudioBff composes it from `GetProjectUsage` of CostUsageService, so the requester sees the budget left before submitting, and from `ListModelProfiles` of ModelRouterService for the profiles a run may use. The list of asset releases, `ListReleases` of AgentRegistryService, is delivered in I4; in I3 that source is shown unknown, named, and the run is submitted by alias. The requester submits the vision with its scope and limits through `ForwardCommand`, which forwards `SubmitRun` of RunControlService once with an idempotency key; the page shows the run only once `RunAccepted` is consumed. Every 409 is explained in words: a key reused with another body, which is the adverse branch of the flow `submit-assessment` of model/ux/flows.yaml, a suspended or closed project, an alias that points at a deprecated or revoked release, a retired target environment, and a production target whose pinned release is not Published; a body that carries a parent field is answered 400. When CostUsageService denies the budget reservation of the run, StudioBff consumes `BudgetReservationDenied`, and `run-detail` names the limiting budget or quota without a reload and does not present the run as progressing, which is the adverse branch of the same flow for an exhausted budget. A requester, a reviewer, an operator or an observer opens `run-detail` at `/work/runs/{runId}`, composed from `GetRun` with steps, attempts, the current lease and pending approvals, `ListRunReceipts` of ModelRouterService and `ListRunToolReceipts` of ToolAdapterService by hash and never by content, `ListRunArtifacts` of ArtifactService with their validation state and `GetRunUsage` with usage by status, uncertain amounts apart. The run timeline of DashboardService is delivered in I4 and shown unknown. A failed step shows its failure class and recorded outcome. A run of another tenant is answered 404 by `GetRun` like one that does not exist. The requester or an operator cancels a run with `CancelRun`; the page says that cancellation is requested and shows the run cancelled only once `RunCancelled` is consumed. StudioBff follows the run through `RunControl.WatchRun` and refreshes the run view on `RunStateChanged`, `RunCompleted`, `RunFailed` and `RunCancelled`, and the page updates without a reload; after the realtime channel returns the screen reloads its model, and a model older than its freshness limit is marked stale with its age and never shown as current. Kind: behavior. Traces: services: StudioBff, RunControlService, ModelRouterService, ToolAdapterService, ArtifactService, CostUsageService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, RunControlService/SubmitRun, RunControlService/GetRun, RunControlService/CancelRun, RunControlService/RunControl.WatchRun, ModelRouterService/ListModelProfiles, ModelRouterService/ListRunReceipts, ToolAdapterService/ListRunToolReceipts, ArtifactService/ListRunArtifacts, CostUsageService/GetProjectUsage, CostUsageService/GetRunUsage; events: RunControlService/RunAccepted, RunControlService/RunStateChanged, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled, CostUsageService/BudgetReservationDenied; adrs: ADR-0014, ADR-0024; requirements: FUX-03, FUX-04, FUX-06, FUX-07, FUX-08. Relates: screens: run-submit, run-detail. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:run-control-service, feature:control-plane-api, feature:model-router-service, feature:model-gateway-host, feature:tool-adapter-service, feature:tool-executor-host, feature:artifact-service, feature:knowledge-host, feature:cost-usage-service-complete. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a requester on `run-submit`, when they submit, then StudioBff/ForwardCommand forwards RunControlService/SubmitRun once with an idempotency key, the run appears only once RunControlService/RunAccepted is consumed, every 409 is explained in words (a key reused with another body as the flow `submit-assessment` of model/ux/flows.yaml states, a suspended or closed project, an alias of a deprecated or revoked release, a retired target environment and a production target whose pinned release is not Published), a body that carries a parent field is answered 400, and the release list is shown unknown with submission by alias (ADR-0014, FUX-03).",
        "AC2: Given `run-detail`, when StudioBff/GetScreenModel composes it, then it renders from RunControlService/GetRun, ModelRouterService/ListRunReceipts, ToolAdapterService/ListRunToolReceipts, ArtifactService/ListRunArtifacts and CostUsageService/GetRunUsage, receipts by hash only, uncertain usage apart, a failed step shows its failure class and outcome, and a run of another tenant is answered 404 by RunControlService/GetRun like an unknown one (FUX-06, FUX-08).",
        "AC3: Given a running run followed through RunControlService/RunControl.WatchRun, when RunControlService/RunStateChanged, RunControlService/RunCompleted or RunControlService/RunFailed is consumed, then the page shows the new state without a reload, and after a dropped channel returns the page reloads StudioBff/GetScreenModel and marks nothing stale as current (FUX-04, FUX-07).",
        "AC4: Given a running run, when the requester or an operator cancels it through RunControlService/CancelRun, then the page says the cancellation is requested and shows the run cancelled only once RunControlService/RunCancelled is consumed (ADR-0024).",
        "AC5: Given a run whose budget reservation is denied, when CostUsageService/BudgetReservationDenied is consumed by StudioBff, then `run-detail` names the limiting budget or quota without a reload and does not present the run as progressing, as the flow `submit-assessment` of model/ux/flows.yaml states for an exhausted budget (FUX-08)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-516",
        "AIFACTORY-TASK-517",
        "AIFACTORY-TASK-518",
        "AIFACTORY-TASK-5694",
        "AIFACTORY-TASK-5684",
        "AIFACTORY-TASK-5711"
      ],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12102,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "RunControlService",
          "ModelRouterService",
          "ToolAdapterService",
          "ArtifactService",
          "CostUsageService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "RunControlService/SubmitRun",
          "RunControlService/GetRun",
          "RunControlService/CancelRun",
          "RunControlService/RunControl.WatchRun",
          "ModelRouterService/ListModelProfiles",
          "ModelRouterService/ListRunReceipts",
          "ToolAdapterService/ListRunToolReceipts",
          "ArtifactService/ListRunArtifacts",
          "CostUsageService/GetProjectUsage",
          "CostUsageService/GetRunUsage"
        ],
        "events": [
          "RunControlService/RunAccepted",
          "RunControlService/RunStateChanged",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled",
          "CostUsageService/BudgetReservationDenied"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FUX-03",
          "FUX-04",
          "FUX-06",
          "FUX-07",
          "FUX-08"
        ]
      },
      "relates": {
        "screens": [
          "run-submit",
          "run-detail"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:run-control-service",
        "feature:control-plane-api",
        "feature:model-router-service",
        "feature:model-gateway-host",
        "feature:tool-adapter-service",
        "feature:tool-executor-host",
        "feature:artifact-service",
        "feature:knowledge-host",
        "feature:cost-usage-service-complete"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1413]",
      "number": 1413
    },
    {
      "id": "AIFACTORY-TASK-516",
      "type": "task",
      "parent": "AIFACTORY-US-1413",
      "title": "Run submission screen",
      "sequence": "14.10.02.01",
      "description": "Run submission screen. Expected output: The Workspace microfrontend renders `run-submit`, which collects the vision, the scope, the alias and the limits, shows the budget left and the model profiles, marks the release list unknown, forwards one command with an idempotency key and shows the run once it is accepted, with each 409 explained in words.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Workspace microfrontend renders `run-submit`, which collects the vision, the scope, the alias and the limits, shows the budget left and the model profiles, marks the release list unknown, forwards one command with an idempotency key and shows the run once it is accepted, with each 409 explained in words."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12102,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-516]",
      "number": 516
    },
    {
      "id": "AIFACTORY-TASK-517",
      "type": "task",
      "parent": "AIFACTORY-US-1413",
      "title": "Run detail with live step states",
      "sequence": "14.10.02.02",
      "description": "Run detail with live step states. Expected output: The Workspace microfrontend renders `run-detail` with steps, attempts, the lease and pending approvals, model and tool receipts by hash, artifacts with their validation state, usage by status, the run timeline source marked unknown, the failure class of a failed step, and a cancel control that waits for the observed state.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Workspace microfrontend renders `run-detail` with steps, attempts, the lease and pending approvals, model and tool receipts by hash, artifacts with their validation state, usage by status, the run timeline source marked unknown, the failure class of a failed step, and a cancel control that waits for the observed state."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12102,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-517]",
      "number": 517
    },
    {
      "id": "AIFACTORY-TASK-518",
      "type": "task",
      "parent": "AIFACTORY-US-1413",
      "title": "Reconnect and freshness",
      "sequence": "14.10.02.03",
      "description": "Reconnect and freshness. Expected output: The screen reloads its model after a reconnect and marks a model older than its freshness limit as stale with its age.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The screen reloads its model after a reconnect and marks a model older than its freshness limit as stale with its age."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-518]",
      "number": 518
    },
    {
      "id": "AIFACTORY-TASK-5694",
      "type": "task",
      "parent": "AIFACTORY-US-1413",
      "title": "Run following and run view refresh in StudioBff",
      "sequence": "14.10.02.04",
      "description": "Run following and run view refresh in StudioBff. Expected output: StudioBff follows the run through `RunControl.WatchRun` and refreshes the run view on `RunStateChanged`, `RunCompleted`, `RunFailed` and `RunCancelled`, and the reservation view on `BudgetReservationDenied`.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff follows the run through `RunControl.WatchRun` and refreshes the run view on `RunStateChanged`, `RunCompleted`, `RunFailed` and `RunCancelled`, and the reservation view on `BudgetReservationDenied`."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-5694]",
      "number": 5694
    },
    {
      "id": "AIFACTORY-TASK-5684",
      "type": "task",
      "parent": "AIFACTORY-US-1413",
      "title": "Verify submission and the live run detail",
      "sequence": "14.10.02.05",
      "description": "Verify submission and the live run detail. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving an accepted run, each 409 of submission including a retired target environment, a 400 for a body with a parent field, a run of another tenant answered 404 by `GetRun`, a denied budget reservation pushed live, steps changing live, a failed step, a dropped and returned channel and an observed cancellation; the tests prove AC1 to AC5 of AIFACTORY-US-1413 (RunControlService/SubmitRun, RunControlService/CancelRun).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving an accepted run, each 409 of submission including a retired target environment, a 400 for a body with a parent field, a run of another tenant answered 404 by `GetRun`, a denied budget reservation pushed live, steps changing live, a failed step, a dropped and returned channel and an observed cancellation; the tests prove AC1 to AC5 of AIFACTORY-US-1413 (RunControlService/SubmitRun, RunControlService/CancelRun)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5684]",
      "number": 5684
    },
    {
      "id": "AIFACTORY-TASK-5711",
      "type": "task",
      "parent": "AIFACTORY-US-1413",
      "title": "Verify the StudioBff side of submission and the run detail",
      "sequence": "14.10.02.06",
      "description": "Verify the StudioBff side of submission and the run detail. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-workspace-run-submit-and-detail\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (`SubmitRun` forwarded once with its idempotency key, its 409 and 400 returned unchanged, refresh on `RunAccepted`, the release list source marked unknown), AC2 (composition of `run-detail` from the five sources with receipts by hash only and the 404 of `GetRun` returned unchanged), AC3 (`RunControl.WatchRun` followed and refresh on `RunStateChanged`, `RunCompleted` and `RunFailed`), AC4 (`CancelRun` forwarded once, refresh on `RunCancelled`) and AC5 (refresh of the reservation view on `BudgetReservationDenied`) of AIFACTORY-US-1413 (StudioBff/ForwardCommand, RunControlService/RunControl.WatchRun).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-workspace-run-submit-and-detail\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (`SubmitRun` forwarded once with its idempotency key, its 409 and 400 returned unchanged, refresh on `RunAccepted`, the release list source marked unknown), AC2 (composition of `run-detail` from the five sources with receipts by hash only and the 404 of `GetRun` returned unchanged), AC3 (`RunControl.WatchRun` followed and refresh on `RunStateChanged`, `RunCompleted` and `RunFailed`), AC4 (`CancelRun` forwarded once, refresh on `RunCancelled`) and AC5 (refresh of the reservation view on `BudgetReservationDenied`) of AIFACTORY-US-1413 (StudioBff/ForwardCommand, RunControlService/RunControl.WatchRun)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5711]",
      "number": 5711
    },
    {
      "id": "AIFACTORY-US-1414",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-081",
      "title": "Workspace: I administer a project's members, delegations, source scope and budget, and create, freeze and unfreeze its environments",
      "sequence": "14.10.03",
      "description": "As a workspace admin, I want to grant roles, delegate for a bounded period, set the source scope and budget of a project, and manage its environments, so that a project is onboarded and governed from the Studio with every refusal explained. A workspace admin opens the screen `project-settings` at `/projects/{projectId}/settings`, composed from `GetProject` of ProjectService through ControlPlaneApi. Through `ForwardCommand` with an idempotency key they grant or change a role with `SetMembership`, delegate the same or a lesser role for a bounded period with a reason with `Delegate`, revoke a delegation with `RevokeDelegation`, replace the repositories, collections and tools a run may touch with `SetSourceScope`, and set the budget with `SetProjectBudget` of CostUsageService. The adverse branches of the flow `onboard-project` of model/ux/flows.yaml are explained in words: a delegation without an expiry is refused, a source scope outside the connected repositories is refused, and a threshold above the platform one is answered 409. Identity is the system of record of roles, so a role change answers 503 while Identity is unavailable and the page says that nothing changed (D114). An operator, a workspace admin or an observer opens `environment-board` at `/projects/{projectId}/environments`, composed from `ListEnvironments` of EnvironmentService and `GetCurrentRelease` of EnvironmentPromotionService for each environment. A workspace admin creates an environment with a policy class with `CreateEnvironment`, and freezes or unfreezes one with `FreezeEnvironment` and `UnfreezeEnvironment`, production-class commands that carry the approval binding of their class; the page says that a production environment needs its baseline provisioned under an approval. A project of another tenant is answered 404. The delivery and freshness families of model/ux/states.yaml govern the display. StudioBff consumes `MembershipChanged`, `DelegationChanged`, `EnvironmentCreated` and `EnvironmentStateChanged` and refreshes the open page without a reload. Kind: behavior. Traces: services: StudioBff, ProjectService, CostUsageService, EnvironmentService, EnvironmentPromotionService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, ProjectService/GetProject, ProjectService/SetMembership, ProjectService/Delegate, ProjectService/RevokeDelegation, ProjectService/SetSourceScope, CostUsageService/SetProjectBudget, EnvironmentService/ListEnvironments, EnvironmentService/CreateEnvironment, EnvironmentService/FreezeEnvironment, EnvironmentService/UnfreezeEnvironment, EnvironmentPromotionService/GetCurrentRelease; events: ProjectService/MembershipChanged, ProjectService/DelegationChanged, EnvironmentService/EnvironmentCreated, EnvironmentService/EnvironmentStateChanged; adrs: ADR-0015; requirements: FUX-01, FUX-02, FUX-05. Relates: screens: project-settings, environment-board. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:project-service, feature:environment-service, feature:cost-usage-service-complete, feature:control-plane-api, feature:environment-promotion-service, feature:delivery-host, feature:studio-governance-administration, feature:studio-operations-usage, feature:studio-software-factory. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/services/control-plane/ProjectService.yaml, model/services/control-plane/EnvironmentService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a workspace admin on `project-settings`, when they grant a role, delegate, revoke or set the source scope, then StudioBff/ForwardCommand forwards ProjectService/SetMembership, ProjectService/Delegate, ProjectService/RevokeDelegation or ProjectService/SetSourceScope, and the page shows the change only once ProjectService/MembershipChanged or ProjectService/DelegationChanged is consumed (FUX-01).",
        "AC2: Given the adverse branches of the flow `onboard-project` of model/ux/flows.yaml, when a delegation has no expiry, a source scope is outside the connected repositories, a threshold sent through CostUsageService/SetProjectBudget is above the platform one or Identity is unavailable, then each refusal is explained in words and nothing changes (ADR-0015).",
        "AC3: Given `environment-board`, when StudioBff/GetScreenModel composes it, then it renders from EnvironmentService/ListEnvironments and EnvironmentPromotionService/GetCurrentRelease, and EnvironmentService/CreateEnvironment, EnvironmentService/FreezeEnvironment and EnvironmentService/UnfreezeEnvironment are offered to a workspace admin with the approval binding of their class and disabled with the reason for other roles (FUX-02, FUX-05)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-5685",
        "AIFACTORY-TASK-5686",
        "AIFACTORY-TASK-5687",
        "AIFACTORY-TASK-5712"
      ],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12103,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "ProjectService",
          "CostUsageService",
          "EnvironmentService",
          "EnvironmentPromotionService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "ProjectService/GetProject",
          "ProjectService/SetMembership",
          "ProjectService/Delegate",
          "ProjectService/RevokeDelegation",
          "ProjectService/SetSourceScope",
          "CostUsageService/SetProjectBudget",
          "EnvironmentService/ListEnvironments",
          "EnvironmentService/CreateEnvironment",
          "EnvironmentService/FreezeEnvironment",
          "EnvironmentService/UnfreezeEnvironment",
          "EnvironmentPromotionService/GetCurrentRelease"
        ],
        "events": [
          "ProjectService/MembershipChanged",
          "ProjectService/DelegationChanged",
          "EnvironmentService/EnvironmentCreated",
          "EnvironmentService/EnvironmentStateChanged"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01",
          "FUX-02",
          "FUX-05"
        ]
      },
      "relates": {
        "screens": [
          "project-settings",
          "environment-board"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:project-service",
        "feature:environment-service",
        "feature:cost-usage-service-complete",
        "feature:control-plane-api",
        "feature:environment-promotion-service",
        "feature:delivery-host",
        "feature:studio-governance-administration",
        "feature:studio-operations-usage",
        "feature:studio-software-factory"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/EnvironmentService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1414]",
      "number": 1414
    },
    {
      "id": "AIFACTORY-TASK-5685",
      "type": "task",
      "parent": "AIFACTORY-US-1414",
      "title": "Project settings and environment board screens in the Workspace microfrontend",
      "sequence": "14.10.03.01",
      "description": "Project settings and environment board screens in the Workspace microfrontend. Expected output: The Workspace microfrontend renders `project-settings` with members, delegations with their expiry and reason, source scope and budget forms, and `environment-board` with environments by class and state and the current release of each, the create, freeze and unfreeze controls with the class of the action, and each refusal of the flow `onboard-project` explained in words.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Workspace microfrontend renders `project-settings` with members, delegations with their expiry and reason, source scope and budget forms, and `environment-board` with environments by class and state and the current release of each, the create, freeze and unfreeze controls with the class of the action, and each refusal of the flow `onboard-project` explained in words."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12103,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-5685]",
      "number": 5685
    },
    {
      "id": "AIFACTORY-TASK-5686",
      "type": "task",
      "parent": "AIFACTORY-US-1414",
      "title": "Screen models and command routes of the project administration screens in StudioBff",
      "sequence": "14.10.03.02",
      "description": "Screen models and command routes of the project administration screens in StudioBff. Expected output: StudioBff composes `project-settings` and `environment-board` through ControlPlaneApi and DeliveryHost with the freshness of each source, forwards `SetSourceScope` and the environment commands `CreateEnvironment`, `FreezeEnvironment` and `UnfreezeEnvironment` with an idempotency key and the approval binding of their class, and refreshes the views on `EnvironmentCreated` and `EnvironmentStateChanged`. It adds no second route for what earlier tasks deliver: it reuses the routes of `SetMembership`, `Delegate` and `RevokeDelegation` and the refresh on `MembershipChanged` and `DelegationChanged` of AIFACTORY-TASK-5640, the route of `SetProjectBudget` of AIFACTORY-TASK-5655 and the composition of `GetCurrentRelease` of AIFACTORY-TASK-5673.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "StudioBff composes `project-settings` and `environment-board` through ControlPlaneApi and DeliveryHost with the freshness of each source, forwards `SetSourceScope` and the environment commands `CreateEnvironment`, `FreezeEnvironment` and `UnfreezeEnvironment` with an idempotency key and the approval binding of their class, and refreshes the views on `EnvironmentCreated` and `EnvironmentStateChanged`. It adds no second route for what earlier tasks deliver: it reuses the routes of `SetMembership`, `Delegate` and `RevokeDelegation` and the refresh on `MembershipChanged` and `DelegationChanged` of AIFACTORY-TASK-5640, the route of `SetProjectBudget` of AIFACTORY-TASK-5655 and the composition of `GetCurrentRelease` of AIFACTORY-TASK-5673."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12103,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-5686]",
      "number": 5686
    },
    {
      "id": "AIFACTORY-TASK-5687",
      "type": "task",
      "parent": "AIFACTORY-US-1414",
      "title": "Verify project onboarding refusals and environment commands",
      "sequence": "14.10.03.03",
      "description": "Verify project onboarding refusals and environment commands. Expected output: Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a delegation without expiry, a source scope outside the connected repositories, a threshold above the platform one, an Identity outage, a frozen production environment and an observer session; the tests prove AC1 to AC3 of AIFACTORY-US-1414 (ProjectService/Delegate, EnvironmentService/FreezeEnvironment).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` and `npx playwright test --project=chromium` with a StudioBff stub serving a delegation without expiry, a source scope outside the connected repositories, a threshold above the platform one, an Identity outage, a frozen production environment and an observer session; the tests prove AC1 to AC3 of AIFACTORY-US-1414 (ProjectService/Delegate, EnvironmentService/FreezeEnvironment)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5687]",
      "number": 5687
    },
    {
      "id": "AIFACTORY-TASK-5712",
      "type": "task",
      "parent": "AIFACTORY-US-1414",
      "title": "Verify the StudioBff side of the project administration screens",
      "sequence": "14.10.03.04",
      "description": "Verify the StudioBff side of the project administration screens. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-workspace-project-settings-and-environments\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (the membership, delegation and source scope commands forwarded once with an idempotency key, refresh on `MembershipChanged` and `DelegationChanged`), AC2 (the refusals of `Delegate`, `SetSourceScope` and `SetProjectBudget` and the 503 of an unavailable Identity service returned unchanged with nothing queued) and AC3 (composition of `environment-board` through ControlPlaneApi and DeliveryHost, the environment commands forwarded with the approval binding of their class, refresh on `EnvironmentCreated` and `EnvironmentStateChanged`) of AIFACTORY-US-1414 (StudioBff/GetScreenModel, StudioBff/ForwardCommand).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-workspace-project-settings-and-environments\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (the membership, delegation and source scope commands forwarded once with an idempotency key, refresh on `MembershipChanged` and `DelegationChanged`), AC2 (the refusals of `Delegate`, `SetSourceScope` and `SetProjectBudget` and the 503 of an unavailable Identity service returned unchanged with nothing queued) and AC3 (composition of `environment-board` through ControlPlaneApi and DeliveryHost, the environment commands forwarded with the approval binding of their class, refresh on `EnvironmentCreated` and `EnvironmentStateChanged`) of AIFACTORY-US-1414 (StudioBff/GetScreenModel, StudioBff/ForwardCommand)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5712]",
      "number": 5712
    },
    {
      "id": "AIFACTORY-US-034",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-081",
      "title": "I decide approvals on the exact proposal I was shown",
      "sequence": "14.10.04",
      "description": "As a reviewer, I want an inbox of the approvals that wait for me, each with the exact proposal version and its evidence, so that I never approve something other than what I reviewed. A reviewer, an operator or a platform admin opens the screen `approvals-list` at `/work/approvals`, composed from `ListApprovals` of RunControlService through ControlPlaneApi, with the pending and decided requests visible to the roles of the caller. A reviewer opens `approval-card` at `/work/approvals/{approvalId}` with the exact proposal version and its hash, the run from `GetRun` and the evidence from `ListRunArtifacts` of ArtifactService. The approval family of model/ux/states.yaml governs the display: Pending, Approved, Rejected, Expired and Superseded. The reviewer approves, rejects or requests changes through `ForwardCommand`, which forwards `DecideApproval` with the proposal hash and the request version, and the card shows the decision only once `ApprovalDecided` is consumed. Each answer of `DecideApproval` is shown in words. A request whose version changed after the card was opened is answered 409 and the card offers the current version, which is the flow `review-exact-proposal` of model/ux/flows.yaml. A request that expired while it was read is answered 410; the card shows Expired and says that a new request is needed, the adverse branch of the same flow. A request for changes on a spend approval is answered 409 and explained. A 503 means that nothing was recorded, and the card offers to send the decision again. The requester of the run, and the author of the proposal, see the card without the decision controls and with the reason, and a decision they send anyway is answered 403. The production approval of a promotion appears here too: it is the one approval a person gives for a production promotion, the gate of EnvironmentPromotionService bound to the release and the environment, and the Studio adds no approval of its own (D133). When an approval is requested, StudioBff consumes `ApprovalRequested`, the eligible reviewers receive a notification that the realtime gateway pushes as `NotificationCreated`, and the request appears in their open inbox without a reload. Kind: behavior. Traces: services: StudioBff, RunControlService, ArtifactService, StudioNotificationService; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand, RunControlService/ListApprovals, RunControlService/GetRun, RunControlService/DecideApproval, ArtifactService/ListRunArtifacts, StudioNotificationService/ListNotifications; events: RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, StudioNotificationService/NotificationCreated; adrs: ADR-0014, ADR-0015; requirements: FUX-05, FUX-06. Relates: screens: approvals-list, approval-card. Depends on: feature:studio-bff, feature:component-blazor-shell, feature:run-control-service, feature:control-plane-api, feature:artifact-service, feature:knowledge-host, feature:studio-notification-service. Sources: model/ux/screens.yaml, model/ux/flows.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an approval request, when RunControlService/ApprovalRequested is consumed, then it appears in `approvals-list` of the eligible reviewers from RunControlService/ListApprovals without a reload and each of them receives StudioNotificationService/NotificationCreated listed by StudioNotificationService/ListNotifications (FUX-05).",
        "AC2: Given an approval card, when the reviewer opens it, then the exact proposal version and its hash are shown with the run from RunControlService/GetRun and the evidence from ArtifactService/ListRunArtifacts, and a production promotion approval shows the release and the environment it is bound to (FUX-06).",
        "AC3: Given a decision sent through StudioBff/ForwardCommand to RunControlService/DecideApproval, when the request version changed after the card was opened, then the answer is 409 and the card offers the current version as the flow `review-exact-proposal` of model/ux/flows.yaml describes; when the request expired, the answer is 410 and the card shows Expired and says a new request is needed; when changes are requested on a spend approval, the answer is 409 explained in words; and when the answer is 503 the card says nothing was recorded and the decision can be sent again (ADR-0014).",
        "AC4: Given the requester of the run, when they open the approval, then they see no decision control and the reason, and a decision they send anyway is answered 403; the card shows a decision only once RunControlService/ApprovalDecided is consumed (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-519",
        "AIFACTORY-TASK-520",
        "AIFACTORY-TASK-521",
        "AIFACTORY-TASK-751",
        "AIFACTORY-TASK-5713"
      ],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12104,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "RunControlService",
          "ArtifactService",
          "StudioNotificationService"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "RunControlService/ListApprovals",
          "RunControlService/GetRun",
          "RunControlService/DecideApproval",
          "ArtifactService/ListRunArtifacts",
          "StudioNotificationService/ListNotifications"
        ],
        "events": [
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "StudioNotificationService/NotificationCreated"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FUX-05",
          "FUX-06"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list",
          "approval-card"
        ]
      },
      "dependsOn": [
        "feature:studio-bff",
        "feature:component-blazor-shell",
        "feature:run-control-service",
        "feature:control-plane-api",
        "feature:artifact-service",
        "feature:knowledge-host",
        "feature:studio-notification-service"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/flows.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-034]",
      "number": 34
    },
    {
      "id": "AIFACTORY-TASK-519",
      "type": "task",
      "parent": "AIFACTORY-US-034",
      "title": "Approval list and approval card",
      "sequence": "14.10.04.01",
      "description": "Approval list and approval card. Expected output: The Workspace microfrontend renders `approvals-list` with the approvals that wait for the user and `approval-card` with the proposal version, its hash, the run and its evidence, the release and environment of a production promotion approval, and the approval family of model/ux/states.yaml.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Workspace microfrontend renders `approvals-list` with the approvals that wait for the user and `approval-card` with the proposal version, its hash, the run and its evidence, the release and environment of a production promotion approval, and the approval family of model/ux/states.yaml."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12104,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-519]",
      "number": 519
    },
    {
      "id": "AIFACTORY-TASK-520",
      "type": "task",
      "parent": "AIFACTORY-US-034",
      "title": "Decision bound to the proposal version",
      "sequence": "14.10.04.02",
      "description": "Decision bound to the proposal version. Expected output: The decision command carries the proposal hash and the request version through StudioBff; a changed version answered 409 is explained and the current version offered, an expired request answered 410 shows Expired with a new request needed, a request for changes on a spend approval answered 409 is explained, and a 503 says nothing was recorded and offers to send again.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The decision command carries the proposal hash and the request version through StudioBff; a changed version answered 409 is explained and the current version offered, an expired request answered 410 shows Expired with a new request needed, a request for changes on a spend approval answered 409 is explained, and a 503 says nothing was recorded and offers to send again."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-520]",
      "number": 520
    },
    {
      "id": "AIFACTORY-TASK-521",
      "type": "task",
      "parent": "AIFACTORY-US-034",
      "title": "Separation of duties on the card",
      "sequence": "14.10.04.03",
      "description": "Separation of duties on the card. Expected output: The requester and the author see the card without the decision controls and with the reason, and a decision they send anyway is shown refused with 403.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The requester and the author see the card without the decision controls and with the reason, and a decision they send anyway is shown refused with 403."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-521]",
      "number": 521
    },
    {
      "id": "AIFACTORY-TASK-751",
      "type": "task",
      "parent": "AIFACTORY-US-034",
      "title": "Verify studio-approval-inbox by running the declared command",
      "sequence": "14.10.04.04",
      "description": "Verify studio-approval-inbox by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` and `npx playwright test --project=chromium` with a StudioBff stub serving a pushed approval request, a decision recorded on `ApprovalDecided`, a changed version answered 409, an expired request answered 410, a request for changes on a spend approval answered 409, a 503 with nothing recorded and a requester decision answered 403; they pass and prove AC1 to AC4 of AIFACTORY-US-034 (RunControlService/DecideApproval, RunControlService/ApprovalDecided).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` and `npx playwright test --project=chromium` with a StudioBff stub serving a pushed approval request, a decision recorded on `ApprovalDecided`, a changed version answered 409, an expired request answered 410, a request for changes on a spend approval answered 409, a 503 with nothing recorded and a requester decision answered 403; they pass and prove AC1 to AC4 of AIFACTORY-US-034 (RunControlService/DecideApproval, RunControlService/ApprovalDecided)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-751]",
      "number": 751
    },
    {
      "id": "AIFACTORY-TASK-5713",
      "type": "task",
      "parent": "AIFACTORY-US-034",
      "title": "Verify the StudioBff side of the approval inbox",
      "sequence": "14.10.04.05",
      "description": "Verify the StudioBff side of the approval inbox. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-approval-inbox\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (refresh of the approval request view on `ApprovalRequested` for the eligible reviewers), AC2 (composition of `approval-card` from `GetRun` and `ListRunArtifacts` with the proposal version and hash), AC3 (`DecideApproval` forwarded once with the proposal hash and the request version, its 409, 410 and 503 returned unchanged with nothing queued) and AC4 (its 403 returned unchanged, refresh on `ApprovalDecided`) of AIFACTORY-US-034 (StudioBff/ForwardCommand, RunControlService/DecideApproval).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.StudioBff.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=studio-approval-inbox\"` in StudioBff against stubbed platform gateways, where a filter that matches no test fails the run; the tests prove on the StudioBff side AC1 (refresh of the approval request view on `ApprovalRequested` for the eligible reviewers), AC2 (composition of `approval-card` from `GetRun` and `ListRunArtifacts` with the proposal version and hash), AC3 (`DecideApproval` forwarded once with the proposal hash and the request version, its 409, 410 and 503 returned unchanged with nothing queued) and AC4 (its 403 returned unchanged, refresh on `ApprovalDecided`) of AIFACTORY-US-034 (StudioBff/ForwardCommand, RunControlService/DecideApproval)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.StudioBff"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5713]",
      "number": 5713
    },
    {
      "id": "AIFACTORY-US-033",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-081",
      "title": "The Workspace work area of the Studio is bound to the model, and I submit a vision and follow the run as it happens",
      "sequence": "14.10.05",
      "description": "As a requester, I want the Workspace work area of the Studio (8 screens) bound to the read models, commands, state families and roles the model names for it, so that I submit a vision and follow the run step by step, seeing progress and what waits on me without reloading the page, with every control reflecting what I may do and how fresh what I see is. This is the integration PBI of the Workspace area. The Workspace microfrontend is generated from the microfrontend library template, composed into the Studio shell through its registry as the landing area and holds the eight screens of model/ux/screens.yaml with their routes, read models, commands, state families and roles; it calls StudioBff only. A screen is offered to the roles its list names; for any other role it is absent from the navigation and `GetScreenModel` refuses it with 403. All eight screens are delivered in I3, by AIFACTORY-US-1412 to AIFACTORY-US-1414 and AIFACTORY-US-034; two read models are not: `ListReleases` of AgentRegistryService on `run-submit` and the run timeline of DashboardService on `run-detail`, both delivered in I4, so each is shown as unknown in the freshness family, named, never hidden and never filled from a fake, and the run is submitted by alias. The thread of the area is the first outcome: a requester submits a vision, follows the run as it happens, a reviewer decides its approval on the exact proposal, and the requester reads the result. Every screen subscribes through `Realtime.Subscribe` of StudioRealtimeGateway; when the channel drops the page marks its data stale and when it returns the page reloads the screen model. A command is forwarded once with an idempotency key, the scope of the session and the approval binding its class requires, and the owning service decides. Every screen renders in English, Russian and Hebrew right to left and is built to the accessibility contract of docs/planes/experience/studio/localization-accessibility.md; the area evidence that follows this PBI checks it on the finished area. Kind: behavior. Traces: services: StudioBff, StudioRealtimeGateway, RunControlService; apis: StudioBff/GetStudioSession, StudioBff/GetScreenModel, StudioBff/ForwardCommand, RunControlService/SubmitRun, StudioRealtimeGateway/Realtime.Subscribe; events: RunControlService/RunStateChanged; adrs: ADR-0007, ADR-0014, ADR-0015, ADR-0028; requirements: FUX-03, FUX-04. Depends on: AIFACTORY-US-1412, AIFACTORY-US-1413, AIFACTORY-US-1414, AIFACTORY-US-034, feature:studio-bff, feature:studio-realtime-gateway, feature:component-blazor-shell, feature:run-control-service. Sources: model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, docs/planes/experience/studio/screens/workspace.md.",
      "acceptanceCriteria": [
        "AC1: Given the shell with the Workspace microfrontend, when each of the 8 screens of model/ux/screens.yaml opens for a role its list names, then it renders from StudioBff/GetScreenModel only, and for a role its list does not name the screen is not offered and StudioBff/GetScreenModel answers 403 (ADR-0007, ADR-0015).",
        "AC2: Given the first outcome, when a requester submits a vision through StudioBff/ForwardCommand and RunControlService/SubmitRun, then the accepted run is shown with its identifier and the run detail shows each step state on RunControlService/RunStateChanged without a reload, and a failed step shows its failure class and recorded outcome (ADR-0014, FUX-03).",
        "AC3: Given an open screen and its subscription through StudioRealtimeGateway/Realtime.Subscribe, when the channel drops and returns, then the page marks the data stale while it is down and reloads StudioBff/GetScreenModel when it returns, never showing a stale state as current (FUX-04).",
        "AC4: Given `run-submit` and `run-detail` in I3, when they open, then the release list and the run timeline are shown unknown with the source named and no invented value, and the screens render in en, ru and he right to left under docs/planes/experience/studio/localization-accessibility.md (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/workspace.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-451",
        "AIFACTORY-TASK-452",
        "AIFACTORY-TASK-453",
        "AIFACTORY-TASK-750"
      ],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12105,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "RunControlService"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand",
          "RunControlService/SubmitRun",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "events": [
          "RunControlService/RunStateChanged"
        ],
        "adrs": [
          "ADR-0007",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-03",
          "FUX-04"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1412",
        "AIFACTORY-US-1413",
        "AIFACTORY-US-1414",
        "AIFACTORY-US-034",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:component-blazor-shell",
        "feature:run-control-service"
      ],
      "source": [
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "docs/planes/experience/studio/screens/workspace.md"
      ],
      "titlePrefix": "[AIFACTORY-US-033]",
      "number": 33
    },
    {
      "id": "AIFACTORY-TASK-451",
      "type": "task",
      "parent": "AIFACTORY-US-033",
      "title": "Screens of the work area Workspace: My work, Submit a run, Run detail, Approvals waiting, Approval card, Project overview, Project settings, Environment board",
      "sequence": "14.10.05.01",
      "description": "Screens of the work area Workspace: My work, Submit a run, Run detail, Approvals waiting, Approval card, Project overview, Project settings, Environment board. Expected output: The Workspace microfrontend is composed into the shell through the registry as the landing area with one navigation group and the eight routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the release list and the run timeline render their sources as unknown with the source named.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Workspace microfrontend is composed into the shell through the registry as the landing area with one navigation group and the eight routes of model/ux/screens.yaml; each screen renders from StudioBff only, and the release list and the run timeline render their sources as unknown with the source named."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12105,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-451]",
      "number": 451
    },
    {
      "id": "AIFACTORY-TASK-452",
      "type": "task",
      "parent": "AIFACTORY-US-033",
      "title": "Commands of the work area Workspace",
      "sequence": "14.10.05.02",
      "description": "Commands of the work area Workspace. Expected output: Of the twelve commands of the eight screens, `SetStudioScope` goes to StudioBff/SetStudioScope, the own route of StudioBff, and the other eleven (SubmitRun, CancelRun, DecideApproval, SetMembership, Delegate, RevokeDelegation, SetSourceScope, SetProjectBudget, CreateEnvironment, FreezeEnvironment, UnfreezeEnvironment) go through StudioBff/ForwardCommand with an idempotency key and the approval binding their class requires; a decision shows the exact proposal version it binds to.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Of the twelve commands of the eight screens, `SetStudioScope` goes to StudioBff/SetStudioScope, the own route of StudioBff, and the other eleven (SubmitRun, CancelRun, DecideApproval, SetMembership, Delegate, RevokeDelegation, SetSourceScope, SetProjectBudget, CreateEnvironment, FreezeEnvironment, UnfreezeEnvironment) go through StudioBff/ForwardCommand with an idempotency key and the approval binding their class requires; a decision shows the exact proposal version it binds to."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-452]",
      "number": 452
    },
    {
      "id": "AIFACTORY-TASK-453",
      "type": "task",
      "parent": "AIFACTORY-US-033",
      "title": "States, roles, locales and accessibility of the work area Workspace",
      "sequence": "14.10.05.03",
      "description": "States, roles, locales and accessibility of the work area Workspace. Expected output: Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "Each screen shows the state families the model names for it, hides or disables what the role may not do with the reason, marks stale data on a dropped channel and reloads on its return, renders in every supported locale including right-to-left, and passes the accessibility checks of the UX model."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-453]",
      "number": 453
    },
    {
      "id": "AIFACTORY-TASK-750",
      "type": "task",
      "parent": "AIFACTORY-US-033",
      "title": "Verify studio-submit-and-follow-run by running the declared command",
      "sequence": "14.10.05.04",
      "description": "Verify studio-submit-and-follow-run by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-033 (StudioBff/GetScreenModel, RunControlService/SubmitRun, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` and `npx playwright test --project=chromium`; they pass and prove AC1 to AC4 of AIFACTORY-US-033 (StudioBff/GetScreenModel, RunControlService/SubmitRun, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-750]",
      "number": 750
    },
    {
      "id": "AIFACTORY-US-1415",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-081",
      "title": "Workspace area evidence: every screen passes the accessibility and phone-width checks and an end-to-end walk of the area through StudioBff is recorded",
      "sequence": "14.10.06",
      "description": "As an observer, I want proof that every screen of the Workspace area is usable by keyboard, in every locale and at phone width, and that a run can be submitted, approved and followed through the Studio, so that the area is accepted on a recorded check and the release list and run timeline say they are not yet delivered. This PBI is the proof of the Workspace area and comes after its integration PBI AIFACTORY-US-033, which registers the eight screens. The accessibility and phone-width check opens each of the eight screens of the area for a role its list in model/ux/screens.yaml names and asserts the rules of docs/planes/experience/studio/localization-accessibility.md: WCAG 2.2 AA by the automated checks, keyboard operation including the approval decision, live updates announced politely and not animated under reduced motion, amounts with their currency code, refusals explained in words, in English, Russian and Hebrew right to left, light and dark, at 1440 by 900 and at 390 by 844 with no horizontal scroll. The end-to-end walk follows the first outcome: as a workspace admin it onboards the fixture project, grants roles, delegates with an expiry and creates the acceptance environment; as a requester it submits the assessment run by alias and follows it in the run detail; as a reviewer it decides the approval on the exact proposal and sees a stale decision refused; as the requester it opens the same card without decision controls; and as an observer it reads my work and the project overview. The release list of `run-submit` and the run timeline of `run-detail`, delivered in I4, show their sources as unknown and are listed by name. The record holds per screen and role the expected and observed result and the network log, which shows no address other than StudioBff and StudioRealtimeGateway. Kind: evidence. Traces: services: StudioBff; apis: StudioBff/GetScreenModel, StudioBff/ForwardCommand; adrs: ADR-0007; requirements: FUX-04, FUX-12. Relates: screens: my-work, run-submit, run-detail, approvals-list, approval-card, project-overview, project-settings, environment-board; nfrs: NFR-15. Depends on: AIFACTORY-US-1412, AIFACTORY-US-1413, AIFACTORY-US-1414, AIFACTORY-US-034, AIFACTORY-US-033, feature:studio-bff, feature:component-blazor-shell. Sources: model/ux/screens.yaml, docs/planes/experience/studio/localization-accessibility.md, docs/planes/experience/studio/screens/workspace.md.",
      "acceptanceCriteria": [
        "AC1: Given each of the 8 screens of the area in model/ux/screens.yaml, when the accessibility check runs in the three locales, both schemes and the two viewports of docs/planes/experience/studio/localization-accessibility.md, then every screen passes the automated WCAG 2.2 AA checks and keyboard operation and has no horizontal scroll at 390 by 844 (NFR-15, FUX-12).",
        "AC2: Given the walk as a workspace admin, a requester, a reviewer and an observer, when it runs on the acceptance estate, then every screen renders from StudioBff/GetScreenModel, every command goes through StudioBff/ForwardCommand, the stale decision and the requester decision are refused, and the two later sources are listed by name as unknown (ADR-0007, FUX-04).",
        "AC3: Given the record and the network log of the walk, when they are read, then the browser called no address other than StudioBff and StudioRealtimeGateway and no screen showed a value its source does not deliver in I3 (FUX-12)."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/workspace.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5688",
        "AIFACTORY-TASK-5689",
        "AIFACTORY-TASK-5690"
      ],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12106,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/ForwardCommand"
        ],
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-04",
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "my-work",
          "run-submit",
          "run-detail",
          "approvals-list",
          "approval-card",
          "project-overview",
          "project-settings",
          "environment-board"
        ],
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1412",
        "AIFACTORY-US-1413",
        "AIFACTORY-US-1414",
        "AIFACTORY-US-034",
        "AIFACTORY-US-033",
        "feature:studio-bff",
        "feature:component-blazor-shell"
      ],
      "source": [
        "model/ux/screens.yaml",
        "docs/planes/experience/studio/localization-accessibility.md",
        "docs/planes/experience/studio/screens/workspace.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1415]",
      "number": 1415
    },
    {
      "id": "AIFACTORY-TASK-5688",
      "type": "task",
      "parent": "AIFACTORY-US-1415",
      "title": "End-to-end walk of the Workspace area",
      "sequence": "14.10.06.01",
      "description": "End-to-end walk of the Workspace area. Expected output: A browser-driven walk in the Studio repository that signs in as a workspace admin, a requester, a reviewer and an observer, onboards the fixture project, submits and follows the assessment run, decides its approval and attempts the refused decisions, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven walk in the Studio repository that signs in as a workspace admin, a requester, a reviewer and an observer, onboards the fixture project, submits and follows the assessment run, decides its approval and attempts the refused decisions, and records per screen and role the rendered state, the source markers, the offered commands and the addresses the browser called."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12106,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5688]",
      "number": 5688
    },
    {
      "id": "AIFACTORY-TASK-5689",
      "type": "task",
      "parent": "AIFACTORY-US-1415",
      "title": "Accessibility and phone-width check of the Workspace screens",
      "sequence": "14.10.06.02",
      "description": "Accessibility and phone-width check of the Workspace screens. Expected output: Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the eight screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1415 against docs/planes/experience/studio/localization-accessibility.md.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility | npx playwright test --project=phone-390x844.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility`, `npx playwright test --project=chromium` at 1440 by 900 and `npx playwright test --project=phone-390x844`, the Playwright project of the Studio at 390 by 844, on the eight screens in en, ru and he, light and dark; the results prove AC1 of AIFACTORY-US-1415 against docs/planes/experience/studio/localization-accessibility.md."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5689]",
      "number": 5689
    },
    {
      "id": "AIFACTORY-TASK-5690",
      "type": "task",
      "parent": "AIFACTORY-US-1415",
      "title": "Verify the walk record of the Workspace area",
      "sequence": "14.10.06.03",
      "description": "Verify the walk record of the Workspace area. Expected output: Run the walk of AIFACTORY-TASK-5688 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1415 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the walk of AIFACTORY-TASK-5688 on the acceptance estate; its record and network log prove AC2 and AC3 of AIFACTORY-US-1415 (StudioBff/GetScreenModel, StudioBff/ForwardCommand) and are kept with the evidence of increment I3."
      ],
      "sourceArtifacts": [
        "model/ux/screens.yaml",
        "model/ux/prototype-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:factory-studio",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 121,
      "phase": "factory",
      "stackRank": 12106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5690]",
      "number": 5690
    },
    {
      "id": "AIFACTORY-EPIC-015",
      "type": "epic",
      "parent": null,
      "title": "Template & Library (PF-15)",
      "sequence": "15",
      "description": "Everything that builds the Template & Library platform (PF-15): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). Template and library catalog, compatibility, blueprints, generation recipe; SaaS descriptors import into blueprints (ADR-0025). Done when: Every service of the platform has its complete delivery accepted (BlueprintService, GenerationRecipeService, TemplateCatalogHost, TemplateRegistryService), the platform gateway routes them under a trusted scope, and the outcome verification of I3 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (BlueprintService, GenerationRecipeService, TemplateCatalogHost, TemplateRegistryService), the platform gateway routes them under a trusted scope, and the outcome verification of I3 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-082",
        "AIFACTORY-FEAT-083",
        "AIFACTORY-FEAT-084",
        "AIFACTORY-FEAT-085"
      ],
      "stackRank": 7999,
      "titlePrefix": "[AIFACTORY-EPIC-015]",
      "number": 15
    },
    {
      "id": "AIFACTORY-FEAT-082",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-015",
      "title": "BlueprintService: complete delivery",
      "sequence": "15.01",
      "description": "BlueprintService is the service of bounded context BC-02 (Blueprint). Blueprint versions as typed descriptor documents validated against their JSON Schemas and rule sets, with derived context maps and domain models, validation reports with rule ids, and submission of a validated blueprint to Asset Publication (BC-02; parser, validator, context-map and domain-model rows merged). Its own repository is ConnectSoft.AI.SoftwareFactory.BlueprintService. Delivers: BlueprintService (complete). Increment I1: Generate a microservice. Build order 80 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-008",
        "AIFACTORY-US-671",
        "AIFACTORY-US-672",
        "AIFACTORY-US-673",
        "AIFACTORY-US-674",
        "AIFACTORY-US-675",
        "AIFACTORY-US-676",
        "AIFACTORY-US-677",
        "AIFACTORY-US-678"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8000,
      "titlePrefix": "[AIFACTORY-FEAT-082]",
      "number": 82
    },
    {
      "id": "AIFACTORY-US-008",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "A blueprint draft is submitted and validated with a receipt",
      "sequence": "15.01.01",
      "description": "As a requester, I want every blueprint the Factory drafts to be stored as a version and validated against its schema and rules, so that later steps only ever build on a blueprint that passed validation. This is the integration PBI of the feature: it proves that the behaviour PBIs of BlueprintService compose into the chain the first outcome needs, on one deployed instance of the service. A run of `vision-to-blueprint` drafts a Vision Blueprint. Its step `submit-version` calls the tool `blueprint-submit-version`, which ToolAdapterService executes after the policy decision of the project: allow runs the call, allow-with-approval waits for an approval that RunControlService opens and decides, and a Draft version is autonomous by default (D64). The call reaches `Blueprints.SubmitDraftVersion` with a workload token and the scope of the run. The service stores the document in ArtifactService by reference and hash and keeps a Draft `BlueprintVersion` for the project, once per document hash (AIFACTORY-US-674). The step `validate` calls `blueprint-validate`, which reaches `Blueprints.Validate`: the service validates the version against the JSON Schema and the rule set of its kind, stores the report as an artifact, returns a `blueprint-validation-receipt-v1` and writes `BlueprintValidated` with `passed` true or false in the transaction of the verdict; it moves the version from Draft to Validated itself and only for the exact document hash that passed (AIFACTORY-US-676). For a Module Blueprint the rule MOD-002 is evaluated against the manifest of the pinned template version, which the service reads from TemplateRegistryService (D123). A failed receipt leaves the version Draft; the workflow returns the findings to the drafting step at most twice, and the redrafted document replaces the Draft document of the same blueprint id and version. For a Service or Module Blueprint that passed, the context map and the domain models are derived in the same transaction and announced by `ContextMapDerived` and `DomainModelDerived` (AIFACTORY-US-677). The step `store-artifacts` of the workflow that follows records lineage in ArtifactService and calls no operation of this service, so it is traced by the PBIs of the workflow and not here. A person reads the versions of the project and one version with its references (AIFACTORY-US-675), and an Asset maintainer submits a Validated version to Asset Publication (AIFACTORY-US-678). The service is scaffolded from the base template with the Factory profile (AIFACTORY-US-671), hosts its routes, its messaging profile and its worker (AIFACTORY-US-672) and enforces tenancy and the telemetry conventions (AIFACTORY-US-673). It never decides an approval, never retries a write on its own and never marks a version Published by itself. One limit of this increment is stated here and not hidden. The publication path of AgentRegistryService arrives in I2 with feature `agent-registry-service-publication` (D140), but its handler `OpenReleaseCandidate`, which opens the candidate of a blueprint from `BlueprintSubmitted`, arrives with feature `agent-registry-service-complete` in I4, so on a deployed instance a Submitted version stays Submitted and no `BlueprintPublished` is published before I4; the two handlers of the release events are built and proven on event fixtures. Until that gate the Draft allowance applies (D123): a generation recipe may bind the Submitted version, which GenerationRecipeService hears through `BlueprintSubmitted`. A person reaches the REST operations through the gateway TemplateCatalogHost, which feature `template-catalog-host` delivers in this increment; that feature depends on this one, so this feature states the route in words and does not depend on it. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Kind: behavior. Traces: services: BlueprintService, ArtifactService, ToolAdapterService; aggregates: BlueprintService/BlueprintVersion, BlueprintService/ContextMap, BlueprintService/DomainModel; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, BlueprintService/GetBlueprintVersion; events: BlueprintService/BlueprintValidated, BlueprintService/ContextMapDerived, BlueprintService/DomainModelDerived; steps: vision-to-blueprint/submit-version, vision-to-blueprint/validate; tools: blueprint-submit-version, blueprint-validate; descriptors: blueprint-vision-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; adrs: ADR-0021, ADR-0026. Depends on: AIFACTORY-US-671, AIFACTORY-US-672, AIFACTORY-US-673, AIFACTORY-US-674, AIFACTORY-US-675, AIFACTORY-US-676, AIFACTORY-US-677, AIFACTORY-US-678, feature:artifact-service, feature:tool-adapter-service, feature:template-registry-service, feature:local-development-environment. Sources: model/services/template-library/BlueprintService.yaml, model/workflows/vision-to-blueprint.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, docs/architecture/adr/0026-requirements-to-ux-handoff.md, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a Vision Blueprint document, a document of the kind `blueprint-vision-v1`, produced in a run and the allow decision of the project policy, when the tool `blueprint-submit-version` reaches `BlueprintService/Blueprints.SubmitDraftVersion` in the step `vision-to-blueprint/submit-version`, then a Draft `BlueprintService/BlueprintVersion` exists for the project of the run with `documentRef` and `documentHash`, the reply is `blueprint-version-ref-v1`, and submitting the same document again returns the same version and creates none (ADR-0026).",
        "AC2: Given that version, when the tool `blueprint-validate` reaches `BlueprintService/Blueprints.Validate` in the step `vision-to-blueprint/validate`, then the reply is a `blueprint-validation-receipt-v1` that records the document hash, the rule set version and the findings with their rule ids, the report is stored as an artifact, and `BlueprintService/BlueprintValidated` is written in the same transaction with `passed` true or false and the document hash (ADR-0026).",
        "AC3: Given a receipt with `passed` false, when the workflow returns the findings to the drafting step, at most twice by the condition `check-valid` of model/workflows/vision-to-blueprint.yaml, and the redrafted document is submitted for the same blueprint id and version, then the version is still Draft and holds the new `documentHash`, a second call of `BlueprintService/Blueprints.Validate` returns a new receipt for that hash, and the service itself retries nothing.",
        "AC4: Given a Service Blueprint version whose validation passed, when the transaction of the verdict commits, then the version is Validated, one `BlueprintService/ContextMap` and one `BlueprintService/DomainModel` per bounded context exist with their artifact references, `BlueprintService/ContextMapDerived` and `BlueprintService/DomainModelDerived` are in the outbox of that transaction, and `BlueprintService/GetBlueprintVersion` shows the report, the context map and the domain model references.",
        "AC5: Given a Validated version and an Asset maintainer, when the version is submitted to Asset Publication, then it is Submitted and stays Submitted on a deployed instance of this increment, because no service publishes the release event of a blueprint before the handler `OpenReleaseCandidate` of AgentRegistryService opens its candidate in I4, although the publication path of AgentRegistryService arrives in I2 (D140), and the version becomes Published only through the handler of that event, as the state diagram of docs/solution-packs/software-factory/templates/services/blueprint-service/index.md shows."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2701",
        "AIFACTORY-TASK-786"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8001,
      "kind": "behavior",
      "traces": {
        "services": [
          "BlueprintService",
          "ArtifactService",
          "ToolAdapterService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion",
          "BlueprintService/ContextMap",
          "BlueprintService/DomainModel"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "BlueprintService/GetBlueprintVersion"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "BlueprintService/ContextMapDerived",
          "BlueprintService/DomainModelDerived"
        ],
        "steps": [
          "vision-to-blueprint/submit-version",
          "vision-to-blueprint/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "descriptors": [
          "blueprint-vision-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0021",
          "ADR-0026"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-671",
        "AIFACTORY-US-672",
        "AIFACTORY-US-673",
        "AIFACTORY-US-674",
        "AIFACTORY-US-675",
        "AIFACTORY-US-676",
        "AIFACTORY-US-677",
        "AIFACTORY-US-678",
        "feature:artifact-service",
        "feature:tool-adapter-service",
        "feature:template-registry-service",
        "feature:local-development-environment"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/workflows/vision-to-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-008]",
      "number": 8
    },
    {
      "id": "AIFACTORY-TASK-2701",
      "type": "task",
      "parent": "AIFACTORY-US-008",
      "title": "Deployment values of BlueprintService: replica range, secret reference, dependency addresses and the schema registry path",
      "sequence": "15.01.01.01",
      "description": "Deployment values of BlueprintService: replica range, secret reference, dependency addresses and the schema registry path. Expected output: The deployment manifest of the service carries the replica range 2 to 4 of the model, the key vault reference of the transport credential messaging-transport, the addresses of ArtifactService and of TemplateRegistryService, the messaging service name blueprint and the value of Templates:Blueprints:SchemaRegistryPath with the registered blueprint schemas mounted read-only; the acceptance environment of feature local-development-environment starts the service with these values and its readiness answers ready.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The deployment manifest of the service carries the replica range 2 to 4 of the model, the key vault reference of the transport credential messaging-transport, the addresses of ArtifactService and of TemplateRegistryService, the messaging service name blueprint and the value of Templates:Blueprints:SchemaRegistryPath with the registered blueprint schemas mounted read-only; the acceptance environment of feature local-development-environment starts the service with these values and its readiness answers ready."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8001,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2701]",
      "number": 2701
    },
    {
      "id": "AIFACTORY-TASK-786",
      "type": "task",
      "parent": "AIFACTORY-US-008",
      "title": "Verify blueprint-validated by running the chain test of the acceptance suite",
      "sequence": "15.01.01.02",
      "description": "Verify blueprint-validated by running the chain test of the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Chain=blueprint-validated\"`; a zero-match filter counts as a failure; one test drives a Vision document and a Service Blueprint document through submission, a failed and a passed validation, the derivation, the reads and the submission to Asset Publication against fakes of ArtifactService and of the transport, and proves AC1 to AC5 of AIFACTORY-US-008.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Chain=blueprint-validated\"`; a zero-match filter counts as a failure; one test drives a Vision document and a Service Blueprint document through submission, a failed and a passed validation, the derivation, the reads and the submission to Asset Publication against fakes of ArtifactService and of the transport, and proves AC1 to AC5 of AIFACTORY-US-008."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-786]",
      "number": 786
    },
    {
      "id": "AIFACTORY-US-671",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "BlueprintService repository: scaffolded from the base template with the Factory profile, with its three aggregates and the store blueprint-sql",
      "sequence": "15.01.02",
      "description": "The repository ConnectSoft.AI.SoftwareFactory.BlueprintService is created and scaffolded in I0 by AIFACTORY-TASK-118 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold, made with the scaffold command of ADR-0028 and its amendment on the Factory profile switch (D114): `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.BlueprintService --UseFactoryProfile true`, from the template package at the version the gate of feature `component-base-template-factory-profile` published (AIFACTORY-US-230), after the findings of feature `component-base-template-findings` are closed (AIFACTORY-US-235). The generated output is committed unchanged and the repository records the version of the template package it was generated from. What the profile generates, that is the Orleans messaging profile with an outbox and an inbox of the service, the propagation of the trusted tenant and project scope, the role policies, the REST and gRPC hosts from a service descriptor, health and telemetry, is the work of the template feature; it is consumed by that version pin and is neither rewritten nor forked here. The run event envelope and the descriptors `blueprint-common-v1`, `blueprint-version-ref-v1` and `blueprint-validation-receipt-v1` come from the contracts package by a version pin. On that scaffold this PBI adds the domain and the store. The `BlueprintVersion` is one version of one blueprint document of one of the 22 kinds of `BlueprintKind` for a project, identified by blueprint id and version: schema version, the reference and the hash of the document, state, the reference of the validation report with its `ValidationFinding` entities (rule id, severity, path, message), the references of the derived context map and domain model, the release id and the author, a user or a run. It has exactly five transitions: Draft to Validated (`ValidationPassed`), Validated to Draft (`DocumentChanged`), Validated to Submitted (`SubmitForPublication`), Submitted to Published (`AssetReleasePublished`) and Published to Deprecated (`AssetReleaseDeprecated`). It is Validated only for the document hash that passed the schema and every rule of its kind, and no command of the service moves it to Published. The `ContextMap` holds the bounded contexts, their relationships and the published-language events derived from one blueprint version; it is derived and never edited. The `DomainModel` holds the aggregates and events of one bounded context; every aggregate has a root entity, an identity and at least one invariant, and every event names its aggregate. The store `blueprint-sql` is owned by this service alone (ADR-0028 decision 5). This PBI migrates its four tables, `BlueprintVersions`, `ValidationFindings`, `ContextMaps` and `DomainModels`, with the columns and indexes of the model and the tenant row filter of the Factory profile in every mapping. The keys lead with the tenant, as the model lists them (D123): the primary keys of `BlueprintVersions` and `ValidationFindings` and the unique indexes `UX_ContextMaps_Blueprint` and `UX_DomainModels_Blueprint_Context` start with `TenantId`, because the blueprint id comes from the metadata of a document that a tenant writes. A blueprint id and version are therefore unique inside a tenant and never across tenants: a document of one tenant never collides with a version of another tenant that the row filter hides, and no refusal confirms that a foreign version exists (ADR-0015 amendment D113). The document, the report and the derived models as documents live in ArtifactService; the tables keep references and hashes. No deletion job and no deletion-order handler is built or registered here, because those arrive with RetentionResidencyService in I4. Kind: enabling. Traces: services: BlueprintService; aggregates: BlueprintService/BlueprintVersion, BlueprintService/ContextMap, BlueprintService/DomainModel; descriptors: blueprint-common-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; adrs: ADR-0015, ADR-0028; requirements: FUX-01. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package. Sources: model/services/template-library/BlueprintService.yaml, model/template-parameters/connectsoft-base.yaml, model/stores.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#domain-model, docs/solution-packs/software-factory/templates/services/blueprint-service/ddl.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-118 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.BlueprintService --UseFactoryProfile true` from the base template package at the version the gate of feature `component-base-template-factory-profile` published, when its pipeline runs, then the committed output equals the generated output, the solution builds in Release, the generated tests pass, a container image is published and the repository records the template version (ADR-0028, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given the `BlueprintService/BlueprintVersion`, `BlueprintService/ContextMap` and `BlueprintService/DomainModel` aggregates, when their unit tests run, then the version accepts exactly the five transitions of model/services/template-library/BlueprintService.yaml and refuses every other one, a move to Published or Deprecated by a command of the service among them; `ValidationPassed` is accepted only for the document hash the version holds; `DocumentChanged` returns a Validated version to Draft and clears the report and the derived references; a context map cannot be edited after it was derived; and a domain model whose aggregate lacks a root entity, an identity or an invariant, or whose event names no aggregate, is refused.",
        "AC3: Given `blueprint-sql` created by the migrations of the repository on an isolated test database, when the mapping tests run, then the four tables exist with their keys, the index `IX_Blueprints_Project_Kind` and the unique indexes `UX_ContextMaps_Blueprint` and `UX_DomainModels_Blueprint_Context`, a second context map for one blueprint version and a second domain model for one version and context of one tenant each violate their unique index, one blueprint id and version can be stored for two tenants because the tenant leads the two keys and the two unique indexes, as model/services/template-library/BlueprintService.yaml lists them, a query made for one tenant never returns a row of another, and `BlueprintVersions` holds the reference and the hash of a document and has no column for its content (ADR-0015, model/stores.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#domain-model",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/ddl.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-119",
        "AIFACTORY-TASK-120",
        "AIFACTORY-TASK-2702"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8002,
      "kind": "enabling",
      "traces": {
        "services": [
          "BlueprintService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion",
          "BlueprintService/ContextMap",
          "BlueprintService/DomainModel"
        ],
        "descriptors": [
          "blueprint-common-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#domain-model",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/ddl.md"
      ],
      "titlePrefix": "[AIFACTORY-US-671]",
      "number": 671
    },
    {
      "id": "AIFACTORY-TASK-119",
      "type": "task",
      "parent": "AIFACTORY-US-671",
      "title": "Domain model: BlueprintVersion with ValidationFinding, ContextMap, DomainModel",
      "sequence": "15.01.02.01",
      "description": "Domain model: BlueprintVersion with ValidationFinding, ContextMap, DomainModel. Expected output: The three aggregates and the ValidationFinding entity enforce the invariants of the model as it words them; the BlueprintVersion accepts only ValidationPassed out of Draft, DocumentChanged and SubmitForPublication out of Validated, AssetReleasePublished out of Submitted and AssetReleaseDeprecated out of Published, and accepts ValidationPassed only for the document hash it holds; the ContextMap is immutable after derivation; unit tests cover every invariant, each of the five transitions and the refusal of every other one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three aggregates and the ValidationFinding entity enforce the invariants of the model as it words them; the BlueprintVersion accepts only ValidationPassed out of Draft, DocumentChanged and SubmitForPublication out of Validated, AssetReleasePublished out of Submitted and AssetReleaseDeprecated out of Published, and accepts ValidationPassed only for the document hash it holds; the ContextMap is immutable after derivation; unit tests cover every invariant, each of the five transitions and the refusal of every other one."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-119]",
      "number": 119
    },
    {
      "id": "AIFACTORY-TASK-120",
      "type": "task",
      "parent": "AIFACTORY-US-671",
      "title": "Persistence in blueprint-sql: BlueprintVersions, ValidationFindings, ContextMaps, DomainModels",
      "sequence": "15.01.02.02",
      "description": "Persistence in blueprint-sql: BlueprintVersions, ValidationFindings, ContextMaps, DomainModels. Expected output: Mappings and migrations for the four tables with the columns the model lists, the index IX_Blueprints_Project_Kind, the unique indexes UX_ContextMaps_Blueprint and UX_DomainModels_Blueprint_Context and the tenant filter in every mapping; the tenant is the leading column of the keys of BlueprintVersions and ValidationFindings and of the two unique indexes, as the model lists them; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the four tables with the columns the model lists, the index IX_Blueprints_Project_Kind, the unique indexes UX_ContextMaps_Blueprint and UX_DomainModels_Blueprint_Context and the tenant filter in every mapping; the tenant is the leading column of the keys of BlueprintVersions and ValidationFindings and of the two unique indexes, as the model lists them; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8002,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-120]",
      "number": 120
    },
    {
      "id": "AIFACTORY-TASK-2702",
      "type": "task",
      "parent": "AIFACTORY-US-671",
      "title": "Verify the scaffold, the aggregates and the store of BlueprintService",
      "sequence": "15.01.02.03",
      "description": "Verify the scaffold, the aggregates and the store of BlueprintService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the three aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-671 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the three aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-671 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2702]",
      "number": 2702
    },
    {
      "id": "AIFACTORY-US-672",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "BlueprintService host: five REST routes and three gRPC methods behind scope policies, the blueprint messaging profile with three subscriptions and the hosted Validator",
      "sequence": "15.01.03",
      "description": "This PBI makes the scaffold a host on which the behaviour PBIs of the feature land. From the service descriptor the host exposes the five REST operations of the model for its platform gateway and the internal gRPC service `Blueprints` with the methods `SubmitDraftVersion`, `Validate` and `GetDerivedModel`, with their contract documents, an OpenAPI document and a proto. A user token reaches the service forwarded by TemplateCatalogHost: the service validates it again through the resource-server library the profile wires and accepts the audience of its own gateway and no other (ADR-0015 amendments on the one audience of a user token and on the forwarded user token). That gateway is delivered in this increment by feature `template-catalog-host` and is the one route of a person to these operations (ADR-0028 decision 2, D123); the acceptance suite of this repository calls the host of the service with a token of that audience and the forwarded scope, and the route through the gateway is proven by the gateway feature. Each route requires its scope: `factory.blueprints.read` for `ListBlueprints` and `GetBlueprintVersion`, `factory.blueprints.write` for `CreateBlueprintVersion` and `ValidateBlueprint`, `factory.blueprints.publish` for `SubmitBlueprint`. A gRPC caller needs a workload identity whose token holds a service scope; a workload token carries no tenant claim, and the service reads the tenant and project a workload forwards only under that scope. The model gives each gRPC method its scope (D123): the host requires `factory.blueprints.write` for `SubmitDraftVersion` and `Validate` and `factory.blueprints.read` for `GetDerivedModel`. The project of a project-scoped call is named by the caller (D123): `ListBlueprints` takes the required query parameter `projectId` and `CreateBlueprintVersion` the required body member `projectId`; the gateway checks it against the roles of the token, and the service compares it with the project of the trusted scope it receives. One mapping answers every refusal: no token or a token of another audience 401, a call without the required `projectId` 400, a missing scope and a project the token does not grant 403, an unknown resource and a resource of another tenant 404, an idempotency key reused with another body and a state that does not allow the command 409, an invalid body 422, a required dependency that fails fast and does not answer 503, each with a problem response; over gRPC Unauthenticated, PermissionDenied, NOT_FOUND, InvalidArgument, FailedPrecondition and Unavailable. The filter of the `Idempotency-Key` header guards `CreateBlueprintVersion`: the same key with the same input returns the stored result, and the same key with another input is a conflict by ADR-0014 decision 3, which the filter answers with 409. Messaging runs on the Orleans messaging profile with the service name of `OrleansMessaging:ServiceName`, default blueprint, whose inbox and outbox belong to this service alone (ADR-0028). The outbox writer enlists in the transaction of the command, and the dispatcher publishes the five modelled events on their topics under the run event envelope of the pinned contracts package. The inbox registers the three consumed events of the model, the published and the deprecated asset release of AgentRegistryService and `ArtifactValidated` of ArtifactService, idempotently on the event id. The `Validator` is hosted with its modelled trigger, its retry of three attempts 30 s apart, its idempotency key of blueprint id, version and document hash and at most four parallel executions partitioned by project. What each route, handler and worker does is delivered by the behaviour PBIs. The three options of the model are bound and validated at start, and readiness names what is missing. Kind: enabling. Traces: services: BlueprintService; descriptors: run-event-envelope-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-671, feature:component-base-template-factory-profile, feature:contracts-package. Sources: model/services/template-library/BlueprintService.yaml, model/descriptors.yaml, docs/reference/schemas/blueprint-version-ref.schema.json, docs/reference/schemas/blueprint-validation-receipt.schema.json, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given the host built from the service descriptor, when the contract tests of the repository run, then the OpenAPI document lists the five REST operations of model/services/template-library/BlueprintService.yaml with their paths, scopes and response codes, the required query parameter `projectId` of `ListBlueprints` and the required body member `projectId` of `CreateBlueprintVersion` among them, the proto lists the service `Blueprints` with `SubmitDraftVersion`, `Validate` and `GetDerivedModel`, each with the scope the model gives it, and the reply messages map onto docs/reference/schemas/blueprint-version-ref.schema.json and docs/reference/schemas/blueprint-validation-receipt.schema.json.",
        "AC2: Given each REST route and each gRPC method, when it is called without a token, with a user token whose audience is not the gateway of the service, with a user token that lacks the scope of the route, without a workload identity, or with a workload token that lacks the service scope of the method, then the answer is 401, 401, 403, Unauthenticated or PermissionDenied respectively, with a problem response on REST, and no handler runs; and a call of `ListBlueprints` or `CreateBlueprintVersion` without `projectId` is answered 400 with a problem response (ADR-0015, model/services/template-library/BlueprintService.yaml).",
        "AC3: Given the messaging profile blueprint, when a command commits, rolls back, or commits while the transport is down, then the committed event is published once on its topic under `run-event-envelope-v1`, the rolled back one never, and the one written during the outage after the outbox retried with backoff, neither lost nor duplicated under its event id; and a consumed event delivered twice under one event id reaches its handler once (ADR-0012, ADR-0014).",
        "AC4: Given the hosted `Validator`, when its trigger is delivered twice for one blueprint id, version and document hash, then one execution has an effect, the worker runs at most four executions in parallel partitioned by project and makes at most three attempts 30 s apart; and the service is ready only after `blueprint-sql` is migrated, the messaging profile has started and the path of `Templates:Blueprints:SchemaRegistryPath` is readable, and it names what is missing while it is unready (model/services/template-library/BlueprintService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/blueprint-version-ref.schema.json",
        "docs/reference/schemas/blueprint-validation-receipt.schema.json",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-121",
        "AIFACTORY-TASK-122",
        "AIFACTORY-TASK-123",
        "AIFACTORY-TASK-2703"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8003,
      "kind": "enabling",
      "traces": {
        "services": [
          "BlueprintService"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-671",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/blueprint-version-ref.schema.json",
        "docs/reference/schemas/blueprint-validation-receipt.schema.json",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-672]",
      "number": 672
    },
    {
      "id": "AIFACTORY-TASK-121",
      "type": "task",
      "parent": "AIFACTORY-US-672",
      "title": "API hosting skeleton: REST and gRPC hosts, scope policies, problem responses and contract documents for the 5 REST operations and 3 gRPC methods",
      "sequence": "15.01.03.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope policies, problem responses and contract documents for the 5 REST operations and 3 gRPC methods. Expected output: The five REST routes and the three gRPC methods are hosted with token validation that accepts the audience of TemplateCatalogHost, scope enforcement per route, the workload identity and service scope check per gRPC method, problem responses for every modelled refusal code, the Idempotency-Key filter of CreateBlueprintVersion, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-674 to AIFACTORY-US-678, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The five REST routes and the three gRPC methods are hosted with token validation that accepts the audience of TemplateCatalogHost, scope enforcement per route, the workload identity and service scope check per gRPC method, problem responses for every modelled refusal code, the Idempotency-Key filter of CreateBlueprintVersion, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-674 to AIFACTORY-US-678, not here."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-121]",
      "number": 121
    },
    {
      "id": "AIFACTORY-TASK-122",
      "type": "task",
      "parent": "AIFACTORY-US-672",
      "title": "Messaging skeleton: outbox and inbox wiring of the blueprint profile for 5 published and 3 consumed events",
      "sequence": "15.01.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the blueprint profile for 5 published and 3 consumed events. Expected output: The outbox writer enlists in the transaction of the command and the dispatcher of the blueprint messaging profile publishes BlueprintValidated, BlueprintSubmitted, BlueprintPublished, ContextMapDerived and DomainModelDerived on their topics under the run event envelope of the pinned contracts package; the inbox registers AssetReleasePublished, AssetReleaseDeprecated and ArtifactValidated with idempotency on the event id; what each handler does is delivered by AIFACTORY-US-676 and AIFACTORY-US-678.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of the command and the dispatcher of the blueprint messaging profile publishes BlueprintValidated, BlueprintSubmitted, BlueprintPublished, ContextMapDerived and DomainModelDerived on their topics under the run event envelope of the pinned contracts package; the inbox registers AssetReleasePublished, AssetReleaseDeprecated and ArtifactValidated with idempotency on the event id; what each handler does is delivered by AIFACTORY-US-676 and AIFACTORY-US-678."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-122]",
      "number": 122
    },
    {
      "id": "AIFACTORY-TASK-123",
      "type": "task",
      "parent": "AIFACTORY-US-672",
      "title": "Worker hosting skeleton: trigger, partitioning and retry policy of the Validator",
      "sequence": "15.01.03.03",
      "description": "Worker hosting skeleton: trigger, partitioning and retry policy of the Validator. Expected output: The Validator is hosted with its event trigger, the fixed retry of three attempts with 30 s backoff, the idempotency key of blueprint id, version and document hash and at most four parallel executions partitioned by project; a duplicate trigger has no second effect; what the worker validates and derives is delivered by AIFACTORY-US-676 and AIFACTORY-US-677.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Validator is hosted with its event trigger, the fixed retry of three attempts with 30 s backoff, the idempotency key of blueprint id, version and document hash and at most four parallel executions partitioned by project; a duplicate trigger has no second effect; what the worker validates and derives is delivered by AIFACTORY-US-676 and AIFACTORY-US-677."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-123]",
      "number": 123
    },
    {
      "id": "AIFACTORY-TASK-2703",
      "type": "task",
      "parent": "AIFACTORY-US-672",
      "title": "Verify the hosted surface of BlueprintService",
      "sequence": "15.01.03.04",
      "description": "Verify the hosted surface of BlueprintService. Expected output: Run the contract, authorization, messaging and readiness tests of the repository pipeline; they prove AC1 to AC4 of AIFACTORY-US-672: the OpenAPI document and the proto match model/services/template-library/BlueprintService.yaml, every route and method refuses a caller without token, audience, scope or workload identity, an event is published once per committed command and never for a rolled back one, and a duplicate trigger of the Validator has one effect.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run the contract, authorization, messaging and readiness tests of the repository pipeline; they prove AC1 to AC4 of AIFACTORY-US-672: the OpenAPI document and the proto match model/services/template-library/BlueprintService.yaml, every route and method refuses a caller without token, audience, scope or workload identity, an event is published once per committed command and never for a rolled back one, and a duplicate trigger of the Validator has one effect."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2703]",
      "number": 2703
    },
    {
      "id": "AIFACTORY-US-673",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "BlueprintService filters every query by tenant, answers a foreign version as not found, starts only with its transport secret reference and keeps blueprint content out of telemetry",
      "sequence": "15.01.04",
      "description": "Tenancy is enforced in the service and not only at the gateway. Every query of the four tables of `blueprint-sql` runs under the tenant row filter of the Factory profile. The tenant and project of a user call come from the trusted scope of the forwarded token; the tenant and project of a workload call are the ones the workload forwards and are read only when its token holds the service scope of the method (ADR-0015 amendment D114). A version, a context map or a domain model of another tenant is invisible under the filter: every operation that addresses it answers 404, or the gRPC status NOT_FOUND, the same answer as for an id that does not exist, and never confirms that it exists (ADR-0015 amendment D113); a missing scope inside the tenant of the caller stays 403 or PERMISSION_DENIED. The project of a project-scoped call is named by the caller, in the query parameter `projectId` of `ListBlueprints` and in the body member `projectId` of `CreateBlueprintVersion` (D123): a call without it is answered 400, the gateway checks it against the roles of the token and answers 403 for a project the token does not grant, and the service compares it with the project of the trusted scope it receives and answers 403 when the two differ, so a version is never written or listed for another project than the one the gateway admitted. A document whose metadata names another project than that scope is refused. The blueprint id of a version comes from the metadata of its document, so two tenants can choose the same id. The keys of the store lead with the tenant (AIFACTORY-US-671), so a blueprint id and version that another tenant already holds are free for the caller: the document is stored as a Draft version of the tenant of the caller with the ordinary answer, and the version of the other tenant is neither changed nor revealed by any answer. The only secret of the service is the transport credential `messaging-transport`, read from its key vault reference with the rotation the model states; the service does not start without the reference and never logs the value. The data class of the service is confidential, so blueprint content stays out of telemetry: no log record, activity, metric or event carries a document, a finding message or the content of a derived model; events and logs carry ids, references, hashes, kinds, states and rule ids (ADR-0019). Telemetry follows the Factory conventions of feature `component-observability-factory-conventions`, consumed by a version pin: tenant and project are on metrics by default, and run, step and attempt are on activities and log records only. The three metrics of the model are recorded with their modelled dimensions: `connectsoft.factory.blueprints.versions` by tenant, kind and state on every state change, `connectsoft.factory.blueprints.validation_failures` by kind and rule id, and `connectsoft.factory.blueprints.inbox_lag` as the age of the oldest unprocessed inbox message. Health checks cover the store, the messaging profile and the schema registry path. A runbook records the two failure modes of the model: a schema of a kind that is missing or stale, which fails validation with the schema id until the descriptor registry is corrected, and the loss of the store, detected by readiness and recovered by a restore within the recovery point of 15 minutes that model/stores.yaml states. Kind: enabling. Traces: services: BlueprintService; aggregates: BlueprintService/BlueprintVersion; adrs: ADR-0015, ADR-0019; requirements: FUX-01. Depends on: AIFACTORY-US-672, feature:component-observability-factory-conventions, feature:local-development-environment. Sources: model/services/template-library/BlueprintService.yaml, model/stores.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0019-data-governance.md, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the fixture of two tenants with one blueprint version each, when a caller of the first tenant addresses the version of the second through every REST route and every gRPC method that takes a version, then each answer is 404 or the gRPC status NOT_FOUND, the same answer as for an id that does not exist, no list contains a row of the other tenant, and a caller of the right tenant without the scope is answered 403 or PERMISSION_DENIED (ADR-0015).",
        "AC2: Given a call of `ListBlueprints` or `CreateBlueprintVersion` without `projectId`, a call whose `projectId` differs from the project of the trusted scope, or a write through either store operation whose document names another project than the project of the trusted scope, when it arrives, then the first is answered 400, the second 403 and the third 422 or InvalidArgument, each REST refusal with a problem response, and nothing is stored or listed for a project the gateway did not admit (ADR-0015, model/services/template-library/BlueprintService.yaml).",
        "AC3: Given deployment values without the key vault reference of the secret `messaging-transport` that model/services/template-library/BlueprintService.yaml names, when the service starts, then the start fails and names the missing reference; with the reference the service starts, and no log record, activity or metric carries the value.",
        "AC4: Given stores, validations and reads of the fixture, when telemetry is collected, then `connectsoft.factory.blueprints.versions`, `connectsoft.factory.blueprints.validation_failures` and `connectsoft.factory.blueprints.inbox_lag` are recorded with the dimensions of model/services/template-library/BlueprintService.yaml, run, step and attempt appear on activities and log records only, and no log record, activity, metric or event holds document content, a finding message or the content of a derived model (ADR-0019).",
        "AC5: Given the fixture in which the second tenant holds a `BlueprintService/BlueprintVersion` with a blueprint id and version that the first tenant does not hold, when a caller of the first tenant stores a document with that same blueprint id and version through either store operation and then reads, validates and submits it, then the document is stored as a Draft version of the first tenant with the ordinary answer of the operation, every later answer concerns the version of the first tenant alone, the version of the second tenant keeps its document, state and findings, and no answer, problem response, log record or event of the first tenant reveals that the second version exists (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-124",
        "AIFACTORY-TASK-2704",
        "AIFACTORY-TASK-2705",
        "AIFACTORY-TASK-2706"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8004,
      "kind": "enabling",
      "traces": {
        "services": [
          "BlueprintService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-672",
        "feature:component-observability-factory-conventions",
        "feature:local-development-environment"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-673]",
      "number": 673
    },
    {
      "id": "AIFACTORY-TASK-124",
      "type": "task",
      "parent": "AIFACTORY-US-673",
      "title": "Security, tenancy and telemetry of BlueprintService",
      "sequence": "15.01.04.01",
      "description": "Security, tenancy and telemetry of BlueprintService. Expected output: The tenant row filter is on every query of the four tables, the tenant and project of a user call come from the trusted scope, the projectId a caller names in ListBlueprints or CreateBlueprintVersion is compared with that project and answered 403 when it differs, the tenant and project of a workload call are read only under the service scope, a resource of another tenant is answered 404 or NOT_FOUND and a missing scope 403 or PERMISSION_DENIED, the transport credential comes from its key vault reference, the three metrics carry the dimensions of the model, activities and log records carry run, step and attempt, and no telemetry holds blueprint content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The tenant row filter is on every query of the four tables, the tenant and project of a user call come from the trusted scope, the projectId a caller names in ListBlueprints or CreateBlueprintVersion is compared with that project and answered 403 when it differs, the tenant and project of a workload call are read only under the service scope, a resource of another tenant is answered 404 or NOT_FOUND and a missing scope 403 or PERMISSION_DENIED, the transport credential comes from its key vault reference, the three metrics carry the dimensions of the model, activities and log records carry run, step and attempt, and no telemetry holds blueprint content."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-124]",
      "number": 124
    },
    {
      "id": "AIFACTORY-TASK-2704",
      "type": "task",
      "parent": "AIFACTORY-US-673",
      "title": "Acceptance fixture of two tenants with their projects, members and workload identities",
      "sequence": "15.01.04.02",
      "description": "Acceptance fixture of two tenants with their projects, members and workload identities. Expected output: A fixture of the acceptance suite seeds two tenants, each with a project, a member per scope of the model and a workload identity with the service scopes, and one blueprint version per tenant, so that every scenario of the feature can be run once inside a tenant and once across tenants; it also holds a document for the first tenant whose blueprint id and version equal those of the version of the second tenant, for the collision case of AC5 of AIFACTORY-US-673; the fixture uses an isolated test database and the test authority of the local environment.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "A fixture of the acceptance suite seeds two tenants, each with a project, a member per scope of the model and a workload identity with the service scopes, and one blueprint version per tenant, so that every scenario of the feature can be run once inside a tenant and once across tenants; it also holds a document for the first tenant whose blueprint id and version equal those of the version of the second tenant, for the collision case of AC5 of AIFACTORY-US-673; the fixture uses an isolated test database and the test authority of the local environment."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8004,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2704]",
      "number": 2704
    },
    {
      "id": "AIFACTORY-TASK-2705",
      "type": "task",
      "parent": "AIFACTORY-US-673",
      "title": "Runbook of the two failure modes of BlueprintService",
      "sequence": "15.01.04.03",
      "description": "Runbook of the two failure modes of BlueprintService. Expected output: The repository documentation holds a runbook for the schema of a kind that is missing or stale (detection by the finding that names the schema id, correction of the descriptor registry, validation run again) and for the loss of the store (detection by readiness, restore within the recovery point of model/stores.yaml, documents and reports still held by ArtifactService).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The repository documentation holds a runbook for the schema of a kind that is missing or stale (detection by the finding that names the schema id, correction of the descriptor registry, validation run again) and for the loss of the store (detection by readiness, restore within the recovery point of model/stores.yaml, documents and reports still held by ArtifactService)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8004,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2705]",
      "number": 2705
    },
    {
      "id": "AIFACTORY-TASK-2706",
      "type": "task",
      "parent": "AIFACTORY-US-673",
      "title": "Verify tenancy, the failing start without the secret reference and the telemetry content guard",
      "sequence": "15.01.04.04",
      "description": "Verify tenancy, the failing start without the secret reference and the telemetry content guard. Expected output: Run the two-tenant tests, the start test and the telemetry guard of the repository pipeline; they prove AC1 to AC5 of AIFACTORY-US-673: a foreign version is answered 404 or NOT_FOUND on every operation, a call without projectId is answered 400 and a projectId other than the project of the trusted scope 403, a document of another project is refused, a document whose blueprint id and version another tenant already holds is stored for the tenant of the caller without touching or revealing the foreign version, the service does not start without the reference of messaging-transport, and a scan of the collected logs, activities, metrics and events finds the content of no fixture document (ADR-0015, ADR-0019).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run the two-tenant tests, the start test and the telemetry guard of the repository pipeline; they prove AC1 to AC5 of AIFACTORY-US-673: a foreign version is answered 404 or NOT_FOUND on every operation, a call without projectId is answered 400 and a projectId other than the project of the trusted scope 403, a document of another project is refused, a document whose blueprint id and version another tenant already holds is stored for the tenant of the caller without touching or revealing the foreign version, the service does not start without the reference of messaging-transport, and a scan of the collected logs, activities, metrics and events finds the content of no fixture document (ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2706]",
      "number": 2706
    },
    {
      "id": "AIFACTORY-US-674",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "Store a blueprint document as a Draft version, by a person through CreateBlueprintVersion and by a run through Blueprints.SubmitDraftVersion, once per document hash",
      "sequence": "15.01.05",
      "description": "As a requester, I want a blueprint document that I or a run of my project wrote to be kept as a Draft version of its kind, so that the project has one addressable version of every blueprint that validation and generation can refer to. A blueprint enters the service as a document of one of the 22 kinds and becomes a Draft `BlueprintVersion`. Two callers store one. A person, Requester or Asset maintainer, calls `CreateBlueprintVersion` with a user token that carries `factory.blueprints.write`, forwarded by the gateway, the required body member `projectId` and an `Idempotency-Key`. A call without `projectId` is answered 400; the gateway answers 403 for a project the roles of the token do not grant, and the service compares the member with the project of the trusted scope and answers 403 when the two differ (D123). A run calls `Blueprints.SubmitDraftVersion` through ToolAdapterService, which executes the tool `blueprint-submit-version` for a step with a workload token that holds the service scope and with the scope of the run. The tool is a shared write under the policy of the project (D64): whether the call needs an approval is decided by the policy decision that ToolAdapterService obtains before it calls; allow runs the call, allow-with-approval waits for an approval that RunControlService opens and decides, and by default a Draft version is autonomous. BlueprintService evaluates no policy, opens and decides no approval and never repeats a write on its own. Both operations do the same thing. The service checks the common metadata of the document against `blueprint-common-v1`: blueprint id, kind, version, schema version, project, title, status and author. The kind must be a value of `BlueprintKind` and the project must be the project of the trusted scope. It stores the document through `Artifacts.Store` of ArtifactService, which is idempotent on tenant and hash, and writes the version in state Draft with `documentRef`, `documentHash` and `authoredBy`: the user of the token, or the run, flagged with its run and attempt. The REST answer is 201 with the version reference; the gRPC reply is `blueprint-version-ref-v1`. The model names no result event for the command, so no integration event of the service is published; `connectsoft.factory.blueprints.versions` counts the new Draft. The command still leaves evidence, because every command of the first outcome belongs in the audit trail: the Factory sink of the audit library, consumed by a version pin from feature `component-audit-factory-evidence`, writes one `audit-evidence-v1` record to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope, with the actor, that is the user or the run and its attempt, the blueprint id, the version, the kind and the document hash. The record is written when a version is created and also when a document replaces the document of an existing version; a rolled back command leaves none, and an idempotent repeat, which changes nothing, writes no second one. A repeated REST call with the same key returns the same result, and the same document for the same blueprint id and version returns the existing version under any key, because submission is naturally idempotent on the document hash. A document that fails the metadata check is refused with 422; over gRPC an invalid body is InvalidArgument. The same key with another document is a conflict by ADR-0014 decision 3 and is answered 409 (D123). When a document with another hash arrives for a blueprint id and version that already exist in the tenant, which is the redraft after a failed validation, a Draft version takes the new document, a Validated version takes it and returns to Draft through `DocumentChanged` with its report and derived references cleared, and a Submitted, Published or Deprecated version keeps its document, because a submitted document no longer changes. That last refusal is a state conflict; it is answered 409 on REST and FailedPrecondition over gRPC (D123). The model names the transition `DocumentChanged` and not the operation that raises it; that the two store operations raise it is a reading reported to the owner. A blueprint id and version that only another tenant holds are no conflict: the keys lead with the tenant, the document becomes a Draft version of the tenant of the caller and the foreign version is never revealed (AIFACTORY-US-671, AIFACTORY-US-673). The summary of `CreateBlueprintVersion` in the model also names agents, through the write-file and propose-change-set tools under their run. Since ADR-0026 and D64 a run stores a document only through `blueprint-submit-version` and `Blueprints.SubmitDraftVersion`; the two older tools belong to ToolAdapterService and have no modelled route to this service, so that agent path is not built here and is reported as a stale summary. ArtifactService is a required dependency that fails fast: when it does not answer, the call ends with 503 and a problem response, or with the gRPC status Unavailable, and nothing is written (D123). When the reply to a tool call is lost, the outcome of the step is Uncertain and goes to the Operator decision of RunControlService; a repeat with the same document returns the same version, so the effect can be observed. Kind: behavior. Traces: services: BlueprintService, ArtifactService, ToolAdapterService, RunControlService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/CreateBlueprintVersion, BlueprintService/Blueprints.SubmitDraftVersion, ArtifactService/Artifacts.Store; steps: vision-to-blueprint/submit-version; tools: blueprint-submit-version; descriptors: blueprint-common-v1, blueprint-version-ref-v1, artifact-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-03, FUX-01; scenarios: SCN-BlueprintService-003, SCN-BlueprintService-006. Depends on: AIFACTORY-US-672, AIFACTORY-US-673, feature:artifact-service, feature:tool-adapter-service, feature:component-audit-factory-evidence. Sources: model/services/template-library/BlueprintService.yaml, model/services/knowledge/ArtifactService.yaml, model/tools/blueprint-submit-version.yaml, model/blueprints.yaml, docs/reference/schemas/blueprint-common.schema.json, docs/reference/schemas/blueprint-version-ref.schema.json, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0026-requirements-to-ux-handoff.md.",
      "acceptanceCriteria": [
        "AC1: Given a caller whose forwarded user token carries `factory.blueprints.write` for the project of the trusted scope and a document whose metadata is valid against `blueprint-common-v1`, names one of the 22 kinds and names that project, when `BlueprintService/CreateBlueprintVersion` is called with the body member `projectId` of that project and an `Idempotency-Key`, then the document is stored through `ArtifactService/Artifacts.Store`, a `BlueprintService/BlueprintVersion` is written in state Draft with `documentRef`, `documentHash` and the caller as `authoredBy`, the response is 201 with the version reference, no integration event of the service is published, because the model names none for this command, and one `audit-evidence-v1` record with the caller as actor, the blueprint id, the version, the kind and the document hash is in the outbox, written in the transaction of the command on the topic audit.evidence.v1.evidence-submitted under `run-event-envelope-v1`; a command that is rolled back leaves no record (SCN-BlueprintService-003).",
        "AC2: Given the same request repeated with the same `Idempotency-Key`, the same document posted under another key, the same key with another document, a body without `projectId`, a `projectId` that differs from the project of the trusted scope, a document with invalid metadata, an unknown kind or the project of another scope, or a caller without `factory.blueprints.write`, when it arrives at `BlueprintService/CreateBlueprintVersion`, then the first two return the existing version, create none and write no second evidence record, the reused key with another document, a conflict by ADR-0014 decision 3, is answered 409, the missing `projectId` 400, the differing `projectId` 403, the invalid document 422 and the missing scope 403, each refusal with a problem response, no state change and no evidence record (SCN-BlueprintService-003, ADR-0015).",
        "AC3: Given ToolAdapterService executing the tool `blueprint-submit-version` for a step of a run, after the policy decision of the project allowed the call or its approval was decided in RunControlService, when it calls `BlueprintService/Blueprints.SubmitDraftVersion` with a workload token that holds `factory.blueprints.write` and the scope of the run, then the document is stored once, the version is Draft with the run as `authoredBy` and its run and attempt recorded, the reply is `blueprint-version-ref-v1` with blueprint id, version, kind, document hash, state, tenant and project, one `audit-evidence-v1` record with the run and its attempt as actor, the blueprint id, the version, the kind and the document hash is written to the outbox in the same transaction, and a second call with the same document hash returns the same version, creates none and writes no second record (SCN-BlueprintService-006, ADR-0026).",
        "AC4: Given a call of `BlueprintService/Blueprints.SubmitDraftVersion` without a workload identity, without the service scope, or with a body that is no document of a blueprint kind or names another project than the forwarded scope, when it arrives, then it is refused with Unauthenticated, PermissionDenied or InvalidArgument respectively and nothing is stored; and given ArtifactService does not answer either store operation, then the REST call ends with 503 and a problem response and the gRPC call with Unavailable, nothing is written, no evidence record exists and the service retries nothing (SCN-BlueprintService-003, SCN-BlueprintService-006).",
        "AC5: Given a document with another hash for a blueprint id and version that already exist in the tenant of the caller, when it is stored through either operation, then a Draft version takes the new `documentRef` and `documentHash`, a Validated version does the same and returns to Draft through `DocumentChanged` with its report and derived references cleared, each replacement writes one `audit-evidence-v1` record with the new document hash in its transaction, and a Submitted, Published or Deprecated version keeps its document: that state conflict is answered 409 on REST and FailedPrecondition over gRPC (the transition is listed in model/services/template-library/BlueprintService.yaml and names no operation, so the operation that raises it is a reading reported to the owner)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/blueprints.yaml",
        "docs/reference/schemas/blueprint-common.schema.json",
        "docs/reference/schemas/blueprint-version-ref.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-203",
        "AIFACTORY-TASK-2707",
        "AIFACTORY-TASK-2708",
        "AIFACTORY-TASK-2709"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8005,
      "kind": "behavior",
      "traces": {
        "services": [
          "BlueprintService",
          "ArtifactService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/CreateBlueprintVersion",
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "ArtifactService/Artifacts.Store"
        ],
        "steps": [
          "vision-to-blueprint/submit-version"
        ],
        "tools": [
          "blueprint-submit-version"
        ],
        "descriptors": [
          "blueprint-common-v1",
          "blueprint-version-ref-v1",
          "artifact-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-03",
          "FUX-01"
        ],
        "scenarios": [
          "SCN-BlueprintService-003",
          "SCN-BlueprintService-006"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-672",
        "AIFACTORY-US-673",
        "feature:artifact-service",
        "feature:tool-adapter-service",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/blueprints.yaml",
        "docs/reference/schemas/blueprint-common.schema.json",
        "docs/reference/schemas/blueprint-version-ref.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md"
      ],
      "titlePrefix": "[AIFACTORY-US-674]",
      "number": 674
    },
    {
      "id": "AIFACTORY-TASK-203",
      "type": "task",
      "parent": "AIFACTORY-US-674",
      "title": "Versions, document hash and idempotent submission",
      "sequence": "15.01.05.01",
      "description": "Versions, document hash and idempotent submission. Expected output: CreateBlueprintVersion and Blueprints.SubmitDraftVersion check the common metadata, the kind and the project of the trusted scope, store the document through Artifacts.Store and write the Draft BlueprintVersion with documentRef, documentHash and authoredBy; the same document for the same blueprint id and version returns the existing version, a document with another hash replaces the document of a Draft or Validated version and returns a Validated version to Draft through DocumentChanged, and a Submitted, Published or Deprecated version is refused; every created version and every replaced document writes one audit-evidence-v1 record with the actor (user, or run and attempt), blueprint id, version, kind and document hash through the Factory sink of the pinned audit library to the outbox in the transaction of the command, on the topic audit.evidence.v1.evidence-submitted, and a repeat or a rolled back command writes none; CreateBlueprintVersion answers a body without projectId with 400 and a projectId that differs from the project of the trusted scope with 403; the reused key with another document and the state conflict are answered 409; the 400, 403, 409, 422 and 503 answers and the gRPC statuses Unauthenticated, PermissionDenied, InvalidArgument, FailedPrecondition and Unavailable are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "CreateBlueprintVersion and Blueprints.SubmitDraftVersion check the common metadata, the kind and the project of the trusted scope, store the document through Artifacts.Store and write the Draft BlueprintVersion with documentRef, documentHash and authoredBy; the same document for the same blueprint id and version returns the existing version, a document with another hash replaces the document of a Draft or Validated version and returns a Validated version to Draft through DocumentChanged, and a Submitted, Published or Deprecated version is refused; every created version and every replaced document writes one audit-evidence-v1 record with the actor (user, or run and attempt), blueprint id, version, kind and document hash through the Factory sink of the pinned audit library to the outbox in the transaction of the command, on the topic audit.evidence.v1.evidence-submitted, and a repeat or a rolled back command writes none; CreateBlueprintVersion answers a body without projectId with 400 and a projectId that differs from the project of the trusted scope with 403; the reused key with another document and the state conflict are answered 409; the 400, 403, 409, 422 and 503 answers and the gRPC statuses Unauthenticated, PermissionDenied, InvalidArgument, FailedPrecondition and Unavailable are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-203]",
      "number": 203
    },
    {
      "id": "AIFACTORY-TASK-2707",
      "type": "task",
      "parent": "AIFACTORY-US-674",
      "title": "Contract of the stored document, the version reference and the two store operations",
      "sequence": "15.01.05.02",
      "description": "Contract of the stored document, the version reference and the two store operations. Expected output: The OpenAPI document of CreateBlueprintVersion and the proto of Blueprints.SubmitDraftVersion take a document of any blueprint kind of model/blueprints.yaml and refuse any other body, the body of CreateBlueprintVersion requires the member projectId beside the document, and their answers map onto docs/reference/schemas/blueprint-version-ref.schema.json with blueprint id, version, kind, document hash, state, tenant and project.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The OpenAPI document of CreateBlueprintVersion and the proto of Blueprints.SubmitDraftVersion take a document of any blueprint kind of model/blueprints.yaml and refuse any other body, the body of CreateBlueprintVersion requires the member projectId beside the document, and their answers map onto docs/reference/schemas/blueprint-version-ref.schema.json with blueprint id, version, kind, document hash, state, tenant and project."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8005,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2707]",
      "number": 2707
    },
    {
      "id": "AIFACTORY-TASK-2708",
      "type": "task",
      "parent": "AIFACTORY-US-674",
      "title": "Acceptance double of ArtifactService for store, fetch and outage",
      "sequence": "15.01.05.03",
      "description": "Acceptance double of ArtifactService for store, fetch and outage. Expected output: A test double answers Artifacts.Store idempotently on tenant and hash and Artifacts.Fetch by reference, records every call and can be switched to not answering, so the scenarios of AIFACTORY-US-674, AIFACTORY-US-676 and AIFACTORY-US-677 run without ArtifactService and prove the fail-fast branch of SCN-BlueprintService-003.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "A test double answers Artifacts.Store idempotently on tenant and hash and Artifacts.Fetch by reference, records every call and can be switched to not answering, so the scenarios of AIFACTORY-US-674, AIFACTORY-US-676 and AIFACTORY-US-677 run without ArtifactService and prove the fail-fast branch of SCN-BlueprintService-003."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8005,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2708]",
      "number": 2708
    },
    {
      "id": "AIFACTORY-TASK-2709",
      "type": "task",
      "parent": "AIFACTORY-US-674",
      "title": "Verify store-a-blueprint-draft-version through the acceptance suite",
      "sequence": "15.01.05.04",
      "description": "Verify store-a-blueprint-draft-version through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-003|Scenario=SCN-BlueprintService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-674: the two store operations, the idempotent repeats by key and by document hash, the refusals, among them 400 without projectId, 403 for a projectId other than the project of the trusted scope and 409 for the reused key and for the state conflict, the replaced document with the DocumentChanged transition and the outage of ArtifactService answered 503 or Unavailable; they read the outbox and find one audit-evidence-v1 record per created version and per replaced document with its actor, blueprint id, version, kind and document hash, and none after a repeat, a refusal or a rolled back command; and on the two-tenant fixture of AIFACTORY-TASK-2704 a document whose blueprint id and version the other tenant holds becomes a Draft version of the tenant of the caller while the foreign version stays unchanged and unrevealed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-003|Scenario=SCN-BlueprintService-006)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-674: the two store operations, the idempotent repeats by key and by document hash, the refusals, among them 400 without projectId, 403 for a projectId other than the project of the trusted scope and 409 for the reused key and for the state conflict, the replaced document with the DocumentChanged transition and the outage of ArtifactService answered 503 or Unavailable; they read the outbox and find one audit-evidence-v1 record per created version and per replaced document with its actor, blueprint id, version, kind and document hash, and none after a repeat, a refusal or a rolled back command; and on the two-tenant fixture of AIFACTORY-TASK-2704 a document whose blueprint id and version the other tenant holds becomes a Draft version of the tenant of the caller while the foreign version stays unchanged and unrevealed."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2709]",
      "number": 2709
    },
    {
      "id": "AIFACTORY-US-675",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "Read the blueprints of a project by kind and state, and one version with its document, report and derived model references",
      "sequence": "15.01.06",
      "description": "As a requester, I want to list the blueprints of my project and read one version with its state, its validation report and its derived models, so that I know which version of a blueprint the Factory holds and whether later steps may build on it. A caller whose forwarded user token carries `factory.blueprints.read` reads the blueprints of a project. `ListBlueprints` takes the required query parameter `projectId` (D123) and returns the blueprints of that project, filtered by kind and by state, each with its versions, their kind, state, schema version, document hash and author. A call without the parameter is answered 400; the gateway checks the named project against the roles of the token and answers 403 for a project the token does not grant, and the service compares the parameter with the project of the trusted scope it receives and answers 403 when the two differ. `GetBlueprintVersion` returns one version addressed by blueprint id and version: state, kind, schema version, the reference and hash of the document, the reference of the validation report with its findings by rule id, severity, path and message, the references of the derived context map and domain model, the release id once the version is Published, the author and, for a version authored by a run, its run and attempt. A Draft version authored by a run is project scope like any other Draft: it is visible to the readers of the project and flagged by its authoring run (D64). The reads return references and hashes; the content of a document, a report or a derived model is fetched from ArtifactService by its reference under the scope of the reader and is never copied into an answer of this service. Both reads run under the tenant row filter. A caller without the scope is refused with 403. A blueprint id or version that does not exist and a version of another tenant are both answered 404 by `GetBlueprintVersion`, which never confirms that a foreign version exists (ADR-0015 amendment D113); `ListBlueprints` has no not-found answer and never contains a row of another tenant or of a project outside the trusted scope. Nothing is written and nothing is published by a read. The views of the Studio that show blueprints are built by StudioBff in its own increment on these two operations; a person reaches both reads through the gateway TemplateCatalogHost, which is delivered in this increment (D123). Kind: behavior. Traces: services: BlueprintService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/ListBlueprints, BlueprintService/GetBlueprintVersion; adrs: ADR-0015, ADR-0026; requirements: FUX-01; scenarios: SCN-BlueprintService-001, SCN-BlueprintService-002. Depends on: AIFACTORY-US-672, AIFACTORY-US-673, AIFACTORY-US-674. Sources: model/services/template-library/BlueprintService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.blueprints.read` and versions of several kinds and states in the project of the trusted scope, some authored by a person and some by a run, when `BlueprintService/ListBlueprints` is called with the `projectId` of that project and a kind or a state filter, then the response is 200 with the blueprints of that project that match, each with its versions, kind, state and author, a Draft version authored by a run among them and flagged with its run, and nothing of another project or tenant (SCN-BlueprintService-001, ADR-0026).",
        "AC2: Given a `BlueprintService/BlueprintVersion` of the tenant and project of the caller, when `BlueprintService/GetBlueprintVersion` is called, then the response is 200 with the state, the kind, the schema version, the reference and hash of the document, the validation report reference with its findings, the context map and domain model references, the release id once Published and the author, and the content of the document is not part of the answer (SCN-BlueprintService-002).",
        "AC3: Given a caller without `factory.blueprints.read`, a call of `BlueprintService/ListBlueprints` without `projectId` or with a `projectId` that differs from the project of the trusted scope, a blueprint id or version that does not exist, or a version of another tenant, when either read is called, then the response is 403 for the missing scope, 400 for the missing `projectId`, 403 for the differing one and, on `BlueprintService/GetBlueprintVersion`, 404 for the unknown and for the foreign version alike, each with a problem response, and nothing is written by any read (SCN-BlueprintService-001, SCN-BlueprintService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2710",
        "AIFACTORY-TASK-2711"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8006,
      "kind": "behavior",
      "traces": {
        "services": [
          "BlueprintService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/ListBlueprints",
          "BlueprintService/GetBlueprintVersion"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FUX-01"
        ],
        "scenarios": [
          "SCN-BlueprintService-001",
          "SCN-BlueprintService-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-672",
        "AIFACTORY-US-673",
        "AIFACTORY-US-674"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-675]",
      "number": 675
    },
    {
      "id": "AIFACTORY-TASK-2710",
      "type": "task",
      "parent": "AIFACTORY-US-675",
      "title": "ListBlueprints and GetBlueprintVersion over the versions of the trusted project under the tenant filter",
      "sequence": "15.01.06.01",
      "description": "ListBlueprints and GetBlueprintVersion over the versions of the trusted project under the tenant filter. Expected output: ListBlueprints requires the query parameter projectId, answers 400 without it and 403 when it differs from the project of the trusted scope, and returns the blueprints of that project filtered by kind and state with their versions, and GetBlueprintVersion returns one version with the document reference and hash, the report reference with its findings, the derived references, the release id and the author with the run and attempt of a run-authored version; both apply the tenant row filter, a version of another tenant is answered 404 like an unknown one and a missing scope 403 (ADR-0015).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "ListBlueprints requires the query parameter projectId, answers 400 without it and 403 when it differs from the project of the trusted scope, and returns the blueprints of that project filtered by kind and state with their versions, and GetBlueprintVersion returns one version with the document reference and hash, the report reference with its findings, the derived references, the release id and the author with the run and attempt of a run-authored version; both apply the tenant row filter, a version of another tenant is answered 404 like an unknown one and a missing scope 403 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8006,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2710]",
      "number": 2710
    },
    {
      "id": "AIFACTORY-TASK-2711",
      "type": "task",
      "parent": "AIFACTORY-US-675",
      "title": "Verify read-blueprints-and-versions through the acceptance suite",
      "sequence": "15.01.06.02",
      "description": "Verify read-blueprints-and-versions through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-001|Scenario=SCN-BlueprintService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-675 on the two-tenant fixture, the 400 for a list without projectId, the 403 for a projectId other than the project of the trusted scope, the 404 for a foreign version and the absence of document content in the answers among them.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-001|Scenario=SCN-BlueprintService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-675 on the two-tenant fixture, the 400 for a list without projectId, the 403 for a projectId other than the project of the trusted scope, the 404 for a foreign version and the absence of document content in the answers among them."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2711]",
      "number": 2711
    },
    {
      "id": "AIFACTORY-US-676",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "Validate a blueprint version against the schema and the rule set of its kind, return a receipt and announce the verdict",
      "sequence": "15.01.07",
      "description": "As a requester, I want every blueprint version to be validated against the schema and the rules of its kind with a receipt that names each finding, so that a version is Validated only for the exact document that passed and a failed one tells its author what to fix. Validation is an operation with a receipt (ADR-0026 decision 5). A person with `factory.blueprints.write` calls `ValidateBlueprint` for a version of the tenant and project of the caller; a run calls `Blueprints.Validate` through ToolAdapterService, which executes the sandbox-class tool `blueprint-validate` with a `blueprint-version-ref-v1`, a workload token that holds the service scope and the scope of the run. Both run the same routine, the `Validator`. It reads the document through `Artifacts.Fetch` of ArtifactService and checks that its hash is the `documentHash` of the version. It validates the common metadata, then the JSON Schema of the kind at the schema version the document names, resolved under `Templates:Blueprints:SchemaRegistryPath`, then every rule of the rule set of the kind in model/blueprints.yaml. Each violation is a `ValidationFinding` with rule id, severity error, warning or info, path and message; warnings fail the validation only when `Templates:Blueprints:FailOnWarnings` is true. A schema version the registry cannot resolve fails the validation with a finding that names the schema id, the failure mode the model states. One rule needs another service. MOD-002, template switches used are declared by the pinned template version, needs the manifest of that template version, which TemplateRegistryService holds. BlueprintService depends on that service as a required dependency that fails fast (D123): for a Module Blueprint the validator reads the manifest of the pinned template version through `Catalog.ResolveManifest` with the workload identity of the service and evaluates the rule itself, with one finding of rule id MOD-002 and severity error for every switch the document uses and the manifest does not declare. Until the evaluation gate of AgentRegistryService is delivered in I4 the registry serves the manifest of a version the catalog has discovered that is not yet Published, so the rule is evaluated on a deployed instance of this increment. A pinned template version that the registry answers as not found fails the rule with a finding that names the template id and version, a reading of this PBI reported to the owner. While the registry does not answer, `ValidateBlueprint` answers 503 for a Module Blueprint and the version stays as it was; a version of any other kind is validated without a call to the registry. The invariant of the model therefore holds for every kind: a blueprint is Validated only when its document passes every rule of the rule set of its kind. Every other rule is evaluated from the document, from the versions and derived models this service holds and from artifacts of ArtifactService; where the wording of a rule names another platform, as AGM-003 does for registered MCP servers and DB-003 for the store catalog, the validator checks what the document declares and calls no other service, a reading that is reported as well. UX-006 is marked by model/blueprints.yaml itself as a workflow gate and not a rule of BlueprintService, so the validator does not evaluate it and writes no finding for it. The report is stored as an artifact through `Artifacts.Store`, the findings are kept with the version, and the receipt `blueprint-validation-receipt-v1` carries receipt id, blueprint id, version, kind, document hash, schema version, rule set version, verdict, finding counts, report reference, the derived references, the idempotency key of blueprint id, version and document hash, and the receipt hash. The schema of the receipt requires `ruleSetVersion` and model/blueprints.yaml gives a rule set no version: in this delivery the value is the version of the rule classes the service ships, one value for all kinds that changes with every release of the service that changes a rule, and the missing version of the model is reported to the owner. The Validate call itself writes only the receipt, which is why its class is sandbox. The service moves the state: in the transaction of the verdict a passed version goes from Draft to Validated through `ValidationPassed`, for exactly the document hash that was validated, and a failed version stays Draft; `BlueprintValidated` with `passed` true or false, the report reference and the document hash is written to the outbox in that transaction and published under the run event envelope. That event is also the audit evidence of the validation, since AuditService consumes it; no separate evidence record is written. The derivation that follows a passed Service or Module Blueprint is delivered by AIFACTORY-US-677. Validation is naturally idempotent on blueprint id, version and document hash: a repeated call returns the same receipt and publishes nothing again. The inbox handler `AttachValidation` receives `ArtifactValidated` of ArtifactService; when the artifact is the document of a Draft version it hands that version to the `Validator` under the same key, and any other artifact is acknowledged without an effect. The handler hands the version over whatever `passed` of the event says: the artifact verdict concerns the artifact, the version has no field that could hold it, and only the receipt of this service moves a version, so a failed artifact verdict is not attached and does not fail the version by itself. The model names the handler `AttachValidation` and nothing it attaches to; this reading is reported to the owner. A caller without the scope is refused with 403 or PermissionDenied and a caller without a workload identity with Unauthenticated; an unknown version and a version of another tenant are answered 404 or NOT_FOUND alike; a version that is Submitted, Published or Deprecated is refused with 409 or FailedPrecondition, because its document no longer changes and a validation for it is a state conflict (D123). ArtifactService fails fast, and so does TemplateRegistryService for a Module Blueprint: the call ends with 503 and a problem response, or with Unavailable, no receipt is written and nothing changes; the event-triggered execution is tried three times 30 s apart and then left to the failed work of the inbox. The service never retries the call of a caller; whether a failed tool call is repeated is decided by RunControlService under the retry rule of a sandbox step. Kind: behavior. Traces: services: BlueprintService, ArtifactService, ToolAdapterService, TemplateRegistryService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/ValidateBlueprint, BlueprintService/Blueprints.Validate, ArtifactService/Artifacts.Fetch, ArtifactService/Artifacts.Store, TemplateRegistryService/Catalog.ResolveManifest; events: BlueprintService/BlueprintValidated, ArtifactService/ArtifactValidated; steps: vision-to-blueprint/validate; tools: blueprint-validate; descriptors: blueprint-validation-receipt-v1, blueprint-version-ref-v1, blueprint-common-v1; adrs: ADR-0012, ADR-0015, ADR-0026; requirements: FR-03; scenarios: SCN-BlueprintService-004, SCN-BlueprintService-007, SCN-BlueprintService-009. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-674, feature:artifact-service, feature:tool-adapter-service, feature:template-registry-service. Sources: model/services/template-library/BlueprintService.yaml, model/services/template-library/TemplateRegistryService.yaml, model/blueprints.yaml, model/tools/blueprint-validate.yaml, docs/reference/schemas/blueprint-validation-receipt.schema.json, docs/architecture/adr/0026-requirements-to-ux-handoff.md, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.blueprints.write` and a Draft `BlueprintService/BlueprintVersion` of the tenant and project of the caller whose document satisfies the schema and every rule of its kind, when `BlueprintService/ValidateBlueprint` is called, then the document is read through `ArtifactService/Artifacts.Fetch`, the report is stored through `ArtifactService/Artifacts.Store`, the version moves from Draft to Validated through `ValidationPassed` for exactly that document hash, `validationReportRef` is set, `BlueprintService/BlueprintValidated` with `passed` true is written in the same transaction, and the response is 200 with the receipt; and given a Module Blueprint, then the validator reads the manifest of its pinned template version through `TemplateRegistryService/Catalog.ResolveManifest` and evaluates the rule MOD-002 of model/blueprints.yaml against it: the version becomes Validated when every switch the document uses is declared by that manifest and its schema and every other rule hold, and a switch the manifest does not declare is a finding with rule id MOD-002 and severity error that fails the validation (SCN-BlueprintService-004).",
        "AC2: Given a document that violates the common metadata, the JSON Schema of its kind or a rule of its rule set, a warning while `Templates:Blueprints:FailOnWarnings` is true, or a kind whose schema version the registry cannot resolve, when the version is validated, then the receipt has `passed` false with one finding per violation carrying rule id, severity, path and message, the unresolved schema is named by its schema id, the findings are kept in `ValidationFindings`, the version stays Draft, `BlueprintService/BlueprintValidated` with `passed` false is written in the same transaction and `connectsoft.factory.blueprints.validation_failures` is incremented by kind and rule id (SCN-BlueprintService-004, model/blueprints.yaml).",
        "AC3: Given ToolAdapterService executing the tool `blueprint-validate` with a `blueprint-version-ref-v1`, a workload token that holds `factory.blueprints.write` and the scope of the run, when it calls `BlueprintService/Blueprints.Validate`, then the reply is `blueprint-validation-receipt-v1` with receipt id, document hash, schema version, rule set version, which is the version of the rule classes the service ships, verdict, finding counts, report reference, derived references, `idempotencyKey` of blueprint id, version and document hash, and receipt hash, as docs/reference/schemas/blueprint-validation-receipt.schema.json requires, the call itself writes only the receipt while the service moves the state as in AC1 and AC2, and a repeated call for the same version and document hash returns the same receipt and publishes nothing again (SCN-BlueprintService-007, ADR-0026).",
        "AC4: Given the verdict was committed, when the outbox dispatcher of the profile blueprint publishes `BlueprintService/BlueprintValidated` on `blueprints.versions.v1.blueprint-validated`, then the event is sent under the run event envelope with `blueprintId`, `version`, `tenantId`, `projectId`, `kind`, `passed`, `validationReportRef` and `documentHash` and without document content, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-BlueprintService-009, ADR-0012).",
        "AC5: Given a caller without the scope, a caller without a workload identity, a version that does not exist or belongs to another tenant, a version that is Submitted, Published or Deprecated, or a required dependency not answering, that is ArtifactService for every kind and TemplateRegistryService for a Module Blueprint, when a validation is requested, then the answer is 403 or PermissionDenied, Unauthenticated, 404 or NOT_FOUND, 409 or FailedPrecondition, and 503 with a problem response or Unavailable respectively, with no receipt, no state change and no event; and given `ArtifactService/ArtifactValidated` names the document artifact of a Draft version, with `passed` true or false, then the `Validator` validates that version once per blueprint id, version and document hash, with at most three attempts 30 s apart, and the verdict of the version is the receipt of this service alone (SCN-BlueprintService-004, SCN-BlueprintService-007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/blueprints.yaml",
        "model/tools/blueprint-validate.yaml",
        "docs/reference/schemas/blueprint-validation-receipt.schema.json",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-204",
        "AIFACTORY-TASK-2712",
        "AIFACTORY-TASK-2713",
        "AIFACTORY-TASK-3431",
        "AIFACTORY-TASK-2714"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8007,
      "kind": "behavior",
      "traces": {
        "services": [
          "BlueprintService",
          "ArtifactService",
          "ToolAdapterService",
          "TemplateRegistryService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/ValidateBlueprint",
          "BlueprintService/Blueprints.Validate",
          "ArtifactService/Artifacts.Fetch",
          "ArtifactService/Artifacts.Store",
          "TemplateRegistryService/Catalog.ResolveManifest"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "ArtifactService/ArtifactValidated"
        ],
        "steps": [
          "vision-to-blueprint/validate"
        ],
        "tools": [
          "blueprint-validate"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1",
          "blueprint-version-ref-v1",
          "blueprint-common-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-03"
        ],
        "scenarios": [
          "SCN-BlueprintService-004",
          "SCN-BlueprintService-007",
          "SCN-BlueprintService-009"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-674",
        "feature:artifact-service",
        "feature:tool-adapter-service",
        "feature:template-registry-service"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/blueprints.yaml",
        "model/tools/blueprint-validate.yaml",
        "docs/reference/schemas/blueprint-validation-receipt.schema.json",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-676]",
      "number": 676
    },
    {
      "id": "AIFACTORY-TASK-204",
      "type": "task",
      "parent": "AIFACTORY-US-676",
      "title": "Validation against the kind schema and rule set with a receipt",
      "sequence": "15.01.07.01",
      "description": "Validation against the kind schema and rule set with a receipt. Expected output: The Validator reads the document through Artifacts.Fetch, validates the common metadata, the JSON Schema of the kind resolved under Templates:Blueprints:SchemaRegistryPath and the rules of the 22 kinds of model/blueprints.yaml as rule classes with their rule ids, honours Templates:Blueprints:FailOnWarnings, stores the report through Artifacts.Store, keeps the findings, returns the receipt and, in one transaction, applies ValidationPassed for the validated document hash or leaves the version Draft and writes BlueprintValidated; ValidateBlueprint, Blueprints.Validate and the AttachValidation handler all run it under the key of blueprint id, version and document hash, the handler whatever passed of ArtifactValidated says; for a Module Blueprint it reads the manifest of the pinned template version through Catalog.ResolveManifest of TemplateRegistryService with the workload identity of the service and evaluates the rule MOD-002 against it, with one error finding per switch the manifest does not declare and one for a template version the registry answers as not found, and for no other kind does it call the registry; UX-006, a workflow gate by model/blueprints.yaml, is not evaluated and writes no finding; the receipt carries the idempotency key and, as ruleSetVersion, the version of the rule classes the service ships, because the model gives a rule set no version; a version that is Submitted, Published or Deprecated is answered 409 or FailedPrecondition; an outage of ArtifactService, and for a Module Blueprint of TemplateRegistryService, is answered 503 or Unavailable and leaves the version as it was.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The Validator reads the document through Artifacts.Fetch, validates the common metadata, the JSON Schema of the kind resolved under Templates:Blueprints:SchemaRegistryPath and the rules of the 22 kinds of model/blueprints.yaml as rule classes with their rule ids, honours Templates:Blueprints:FailOnWarnings, stores the report through Artifacts.Store, keeps the findings, returns the receipt and, in one transaction, applies ValidationPassed for the validated document hash or leaves the version Draft and writes BlueprintValidated; ValidateBlueprint, Blueprints.Validate and the AttachValidation handler all run it under the key of blueprint id, version and document hash, the handler whatever passed of ArtifactValidated says; for a Module Blueprint it reads the manifest of the pinned template version through Catalog.ResolveManifest of TemplateRegistryService with the workload identity of the service and evaluates the rule MOD-002 against it, with one error finding per switch the manifest does not declare and one for a template version the registry answers as not found, and for no other kind does it call the registry; UX-006, a workflow gate by model/blueprints.yaml, is not evaluated and writes no finding; the receipt carries the idempotency key and, as ruleSetVersion, the version of the rule classes the service ships, because the model gives a rule set no version; a version that is Submitted, Published or Deprecated is answered 409 or FailedPrecondition; an outage of ArtifactService, and for a Module Blueprint of TemplateRegistryService, is answered 503 or Unavailable and leaves the version as it was."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8007,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-204]",
      "number": 204
    },
    {
      "id": "AIFACTORY-TASK-2712",
      "type": "task",
      "parent": "AIFACTORY-US-676",
      "title": "Contract of the validation receipt and of the two validation operations",
      "sequence": "15.01.07.02",
      "description": "Contract of the validation receipt and of the two validation operations. Expected output: The OpenAPI document of ValidateBlueprint and the proto of Blueprints.Validate take a version reference and answer with a message that maps onto docs/reference/schemas/blueprint-validation-receipt.schema.json field by field, the finding counts and the derived references among them, and the payload of BlueprintValidated matches model/services/template-library/BlueprintService.yaml.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The OpenAPI document of ValidateBlueprint and the proto of Blueprints.Validate take a version reference and answer with a message that maps onto docs/reference/schemas/blueprint-validation-receipt.schema.json field by field, the finding counts and the derived references among them, and the payload of BlueprintValidated matches model/services/template-library/BlueprintService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8007,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2712]",
      "number": 2712
    },
    {
      "id": "AIFACTORY-TASK-2713",
      "type": "task",
      "parent": "AIFACTORY-US-676",
      "title": "Schema registry fixture with a passing and a failing document for every blueprint kind",
      "sequence": "15.01.07.03",
      "description": "Schema registry fixture with a passing and a failing document for every blueprint kind. Expected output: The acceptance suite holds the registered schemas of the 22 kinds under a fixture registry path and, for every kind of model/blueprints.yaml, one document that passes and one document per rule that breaks exactly that rule, plus a document whose schema version the registry does not hold, so that every evaluated rule id is proven to produce its finding; the failing document of MOD-002 uses a switch that the fixture manifest of its pinned template version does not declare, and the passing Module document uses only switches that manifest declares; exactly one rule id has no failing document: UX-006, which model/blueprints.yaml marks as a workflow gate and for which no finding is expected.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The acceptance suite holds the registered schemas of the 22 kinds under a fixture registry path and, for every kind of model/blueprints.yaml, one document that passes and one document per rule that breaks exactly that rule, plus a document whose schema version the registry does not hold, so that every evaluated rule id is proven to produce its finding; the failing document of MOD-002 uses a switch that the fixture manifest of its pinned template version does not declare, and the passing Module document uses only switches that manifest declares; exactly one rule id has no failing document: UX-006, which model/blueprints.yaml marks as a workflow gate and for which no finding is expected."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8007,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2713]",
      "number": 2713
    },
    {
      "id": "AIFACTORY-TASK-3431",
      "type": "task",
      "parent": "AIFACTORY-US-676",
      "title": "Acceptance double of TemplateRegistryService for the manifest read of the rule MOD-002 and its outage",
      "sequence": "15.01.07.04",
      "description": "Acceptance double of TemplateRegistryService for the manifest read of the rule MOD-002 and its outage. Expected output: A test double answers Catalog.ResolveManifest by template id and version with fixture manifests that declare their switches, answers a template version it does not hold as not found, records every call and can be switched to not answering, so that the suite of AIFACTORY-US-676 evaluates MOD-002 without TemplateRegistryService, proves the 503 and the Unavailable answer of the validation of a Module Blueprint while the registry does not answer, and proves that a version of any other kind is validated without a call to the double.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "A test double answers Catalog.ResolveManifest by template id and version with fixture manifests that declare their switches, answers a template version it does not hold as not found, records every call and can be switched to not answering, so that the suite of AIFACTORY-US-676 evaluates MOD-002 without TemplateRegistryService, proves the 503 and the Unavailable answer of the validation of a Module Blueprint while the registry does not answer, and proves that a version of any other kind is validated without a call to the double."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8007,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3431]",
      "number": 3431
    },
    {
      "id": "AIFACTORY-TASK-2714",
      "type": "task",
      "parent": "AIFACTORY-US-676",
      "title": "Verify validate-a-blueprint-version-with-a-receipt through the acceptance suite",
      "sequence": "15.01.07.05",
      "description": "Verify validate-a-blueprint-version-with-a-receipt through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-004|Scenario=SCN-BlueprintService-007|Scenario=SCN-BlueprintService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-676: the passed and the failed verdict with the state each leaves, every evaluated rule id of the fixture, the rule MOD-002 evaluated against the manifest that the double of AIFACTORY-TASK-3431 answers, with a Module document that becomes Validated and one whose undeclared switch fails the validation, the receipt fields with the idempotency key and the rule set version, the idempotent repeat, the refusals, among them 409 or FailedPrecondition for a Submitted, Published or Deprecated version, the artifact verdict with passed false that still leads to a validation, the outage of ArtifactService, and of TemplateRegistryService for a Module Blueprint, answered 503 or Unavailable with the version left as it was, and the publication and payload of BlueprintValidated; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-004|Scenario=SCN-BlueprintService-007|Scenario=SCN-BlueprintService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-676: the passed and the failed verdict with the state each leaves, every evaluated rule id of the fixture, the rule MOD-002 evaluated against the manifest that the double of AIFACTORY-TASK-3431 answers, with a Module document that becomes Validated and one whose undeclared switch fails the validation, the receipt fields with the idempotency key and the rule set version, the idempotent repeat, the refusals, among them 409 or FailedPrecondition for a Submitted, Published or Deprecated version, the artifact verdict with passed false that still leads to a validation, the outage of ArtifactService, and of TemplateRegistryService for a Module Blueprint, answered 503 or Unavailable with the version left as it was, and the publication and payload of BlueprintValidated; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8007,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2714]",
      "number": 2714
    },
    {
      "id": "AIFACTORY-US-677",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "Derive the context map and the domain models of a passed Service or Module Blueprint, announce them and serve them to recipes and agents",
      "sequence": "15.01.08",
      "description": "A passed Service or Module Blueprint yields the typed inputs of generation. In the transaction in which the `Validator` records `ValidationPassed`, it derives one `ContextMap` for the blueprint version, with the bounded contexts, their relationships (upstream, downstream, shared kernel, anti-corruption layer) and the published-language events, and one `DomainModel` per bounded context, with aggregates, entities, value objects, invariants and events. Each derived model is stored as a document in ArtifactService through `Artifacts.Store`; the version keeps `contextMapRef` and `domainModelRef`, the rows of `ContextMaps` and `DomainModels` keep the derived structure the model lists, and the receipt names both references. The aggregate and the receipt hold one `domainModelRef`, while a Service Blueprint can name several bounded contexts: in this delivery the reference names one index artifact that lists, per context id, the reference and the content hash of the domain model document of that context, with one entry for a blueprint of one context; the single field of the model is reported to the owner. `ContextMapDerived`, with the number of contexts, and one `DomainModelDerived` per context, with the number of aggregates, are written to the outbox in that same transaction and published under the run event envelope without model content. WorkflowEngineService, GenerationRecipeService and StudioBff consume them in their own PBIs. A version of any other kind derives nothing, and a failed validation derives nothing. A domain model that would break its invariant, an aggregate without a root entity, an identity or an invariant, or an event that names no aggregate, fails the validation with a finding of the matching rule instead of being stored. Derived models are never edited: a changed document returns the version to Draft and clears both references, and the next passed validation replaces the derived rows of that version, which the unique indexes over tenant, blueprint id and version, and over tenant, blueprint id, version and context, keep single. The summary of the `ContextMap` aggregate also names a Vision Blueprint as a source while the worker derives for the Service and Module kinds only; this PBI follows the worker and reports the difference. The optional dependency EnvelopeRegistryService, which would check the published-language events against the topic registry, is delivered in I4: until then the event names are checked by the naming rule of the kind alone and no call is made, which is the degraded mode the model allows. The result is read through `Blueprints.GetDerivedModel`, the read by which a recipe resolves the domain model pin of a module (ADR-0027). The caller of this increment is GenerationRecipeService; AgentRuntimeWorker is the second modelled caller and arrives with its own feature, and no tool is modelled for this method, so ToolAdapterService does not call it. A caller with a workload identity whose token holds `factory.blueprints.read`, with the forwarded tenant and project, addresses a blueprint version and receives `artifact-v1` with the references and content hashes of its context map and domain models. The read writes nothing. A version of the tenant without derived models is answered FailedPrecondition; an unknown version and a version of another tenant are answered NOT_FOUND alike. Kind: behavior. Traces: services: BlueprintService, ArtifactService; aggregates: BlueprintService/BlueprintVersion, BlueprintService/ContextMap, BlueprintService/DomainModel; apis: BlueprintService/Blueprints.GetDerivedModel, ArtifactService/Artifacts.Store; events: BlueprintService/ContextMapDerived, BlueprintService/DomainModelDerived; descriptors: artifact-v1, blueprint-service-v1, blueprint-module-v1; adrs: ADR-0012, ADR-0015, ADR-0027; scenarios: SCN-BlueprintService-008, SCN-BlueprintService-012, SCN-BlueprintService-013. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-676, feature:artifact-service. Sources: model/services/template-library/BlueprintService.yaml, model/blueprints.yaml, docs/reference/schemas/blueprint-service.schema.json, docs/reference/schemas/blueprint-module.schema.json, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given a Service Blueprint version, a document of `blueprint-service-v1`, or a Module Blueprint version, a document of `blueprint-module-v1`, whose validation passes, when the transaction of the verdict commits, then one `BlueprintService/ContextMap` exists for the blueprint version with its contexts, relationships and published-language events, one `BlueprintService/DomainModel` exists per bounded context with its aggregates and events, each is stored as a document through `ArtifactService/Artifacts.Store`, `contextMapRef` of the `BlueprintService/BlueprintVersion` names the context map document and its one `domainModelRef` names an index artifact that lists the reference and content hash of the domain model document of every context, the single reference of the model being reported to the owner, and `BlueprintService/ContextMapDerived` and one `BlueprintService/DomainModelDerived` per context are written in that same transaction (SCN-BlueprintService-012, SCN-BlueprintService-013).",
        "AC2: Given a version of any other kind that passes, a version that fails, or a derived domain model whose aggregate lacks a root entity, an identity or an invariant or whose event names no aggregate, when validation ends, then nothing is derived and no derivation event is written, the last case failing the validation with a finding that carries the rule id; and given a changed document, then the version returns to Draft with both references cleared and the next passed validation replaces the derived rows of that version, as the invariants of model/services/template-library/BlueprintService.yaml require.",
        "AC3: Given the derivation was committed, when the outbox dispatcher publishes `BlueprintService/ContextMapDerived` on `blueprints.models.v1.context-map-derived` and `BlueprintService/DomainModelDerived` on `blueprints.models.v1.domain-model-derived`, then the first carries `contextMapId`, `tenantId`, `projectId`, `blueprintId`, `blueprintVersion` and the number of `contexts`, the second `domainModelId`, `tenantId`, `projectId`, `blueprintId`, `contextId` and the number of `aggregates`, both under the run event envelope and without model content, and a transport outage is retried with backoff so neither is lost or duplicated under its event id (SCN-BlueprintService-012, SCN-BlueprintService-013, ADR-0012).",
        "AC4: Given GenerationRecipeService as the caller of this increment, with a workload identity whose token holds `factory.blueprints.read` and the forwarded tenant and project, when `BlueprintService/Blueprints.GetDerivedModel` is called for a blueprint version, the read by which a recipe resolves a domain model pin (ADR-0027), then the reply is `artifact-v1` with the references and content hashes of the context map and of the domain models of that version and nothing is written; a version of the tenant without derived models is answered FailedPrecondition, an unknown version and a version of another tenant NOT_FOUND alike, a missing identity Unauthenticated, a missing scope PermissionDenied and an invalid request InvalidArgument (SCN-BlueprintService-008, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/blueprints.yaml",
        "docs/reference/schemas/blueprint-service.schema.json",
        "docs/reference/schemas/blueprint-module.schema.json",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-205",
        "AIFACTORY-TASK-2715",
        "AIFACTORY-TASK-2716"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8008,
      "kind": "behavior",
      "traces": {
        "services": [
          "BlueprintService",
          "ArtifactService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion",
          "BlueprintService/ContextMap",
          "BlueprintService/DomainModel"
        ],
        "apis": [
          "BlueprintService/Blueprints.GetDerivedModel",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "BlueprintService/ContextMapDerived",
          "BlueprintService/DomainModelDerived"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-service-v1",
          "blueprint-module-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0027"
        ],
        "scenarios": [
          "SCN-BlueprintService-008",
          "SCN-BlueprintService-012",
          "SCN-BlueprintService-013"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-676",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/blueprints.yaml",
        "docs/reference/schemas/blueprint-service.schema.json",
        "docs/reference/schemas/blueprint-module.schema.json",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-677]",
      "number": 677
    },
    {
      "id": "AIFACTORY-TASK-205",
      "type": "task",
      "parent": "AIFACTORY-US-677",
      "title": "Derivation of the context map and the domain model",
      "sequence": "15.01.08.01",
      "description": "Derivation of the context map and the domain model. Expected output: In the transaction of ValidationPassed the Validator derives one ContextMap per blueprint version and one DomainModel per bounded context from a Service or Module Blueprint, stores each as a document through Artifacts.Store, stores one index artifact that lists the domain model document of every context by reference and content hash, sets contextMapRef and sets domainModelRef to that index, replaces the derived rows of a version that is validated again and writes ContextMapDerived and one DomainModelDerived per context to the outbox; another kind and a failed validation derive nothing, and a model that breaks the domain model invariant fails the validation with its rule finding.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "In the transaction of ValidationPassed the Validator derives one ContextMap per blueprint version and one DomainModel per bounded context from a Service or Module Blueprint, stores each as a document through Artifacts.Store, stores one index artifact that lists the domain model document of every context by reference and content hash, sets contextMapRef and sets domainModelRef to that index, replaces the derived rows of a version that is validated again and writes ContextMapDerived and one DomainModelDerived per context to the outbox; another kind and a failed validation derive nothing, and a model that breaks the domain model invariant fails the validation with its rule finding."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8008,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-205]",
      "number": 205
    },
    {
      "id": "AIFACTORY-TASK-2715",
      "type": "task",
      "parent": "AIFACTORY-US-677",
      "title": "Blueprints.GetDerivedModel over the derived references of a version",
      "sequence": "15.01.08.02",
      "description": "Blueprints.GetDerivedModel over the derived references of a version. Expected output: Blueprints.GetDerivedModel returns artifact-v1 with the references and content hashes of the context map and of the domain models of the addressed version under the tenant filter and the service scope factory.blueprints.read; a version without derived models is FailedPrecondition, an unknown version and a version of another tenant NotFound, the gRPC status NOT_FOUND (ADR-0015), and the read writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Blueprints.GetDerivedModel returns artifact-v1 with the references and content hashes of the context map and of the domain models of the addressed version under the tenant filter and the service scope factory.blueprints.read; a version without derived models is FailedPrecondition, an unknown version and a version of another tenant NotFound, the gRPC status NOT_FOUND (ADR-0015), and the read writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8008,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2715]",
      "number": 2715
    },
    {
      "id": "AIFACTORY-TASK-2716",
      "type": "task",
      "parent": "AIFACTORY-US-677",
      "title": "Verify derive-context-map-and-domain-model through the acceptance suite",
      "sequence": "15.01.08.03",
      "description": "Verify derive-context-map-and-domain-model through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-008|Scenario=SCN-BlueprintService-012|Scenario=SCN-BlueprintService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-677 on the Service and Module fixture documents: the derived rows and references, the kinds that derive nothing, the replacement after a changed document, the read with its refusals and the publication and payload of both derivation events; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-008|Scenario=SCN-BlueprintService-012|Scenario=SCN-BlueprintService-013)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-677 on the Service and Module fixture documents: the derived rows and references, the kinds that derive nothing, the replacement after a changed document, the read with its refusals and the publication and payload of both derivation events; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8008,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2716]",
      "number": 2716
    },
    {
      "id": "AIFACTORY-US-678",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-082",
      "title": "Submit a Validated blueprint version to Asset Publication and follow the release it becomes to Published and Deprecated",
      "sequence": "15.01.09",
      "description": "As an asset maintainer, I want to submit a validated blueprint version to Asset Publication and see when it is Published or Deprecated, so that recipes build on the submitted version until the evaluation gate of I4 exists and only on Published versions from then on. An Asset maintainer whose forwarded user token carries `factory.blueprints.publish` submits a Validated version to Asset Publication through `SubmitBlueprint`. The version moves from Validated to Submitted through `SubmitForPublication` and `BlueprintSubmitted` is written to the outbox in the same transaction; the answer is 202, because publication is decided elsewhere. `BlueprintSubmitted` is also the audit evidence of the submission, and `BlueprintPublished` that of the publication, since AuditService consumes both; no separate evidence record is written. A Service or Module version must hold its derived context map and domain model references, as its invariant requires. A repeated call for a version already Submitted returns 202 and writes nothing. A caller without the scope is refused with 403; an unknown version and a version of another tenant are answered 404 alike; a version that is Draft, Published or Deprecated, and a Service or Module version without derived references, are refused with 409. Publication goes through Asset Publication and its evaluation gate (ADR-0021); this service never marks a version Published on its own, decides no approval and repeats no write. The model lists AgentRegistryService as a required outbound dependency for submitting release candidates and names no operation of that service for it, while AgentRegistryService names the handler `OpenReleaseCandidate` for `BlueprintSubmitted`; this PBI therefore makes no synchronous call and the event is the submission, which is reported to the owner. The inbox handler `MarkPublished` handles the published asset release event of AgentRegistryService: when its asset id and version name a Submitted version of the tenant of the envelope, the version moves to Published through `AssetReleasePublished`, `releaseId` is set and `BlueprintPublished` is written in the same transaction. The enum `AssetKind` of AgentRegistryService has no value for a blueprint, so the handler matches by asset id and version and ignores every release that matches no Submitted version; which asset kind a blueprint release carries is reported to the owner. The handler `MarkDeprecated` handles the deprecated asset release event: the Published version whose `releaseId` it names moves to Deprecated through `AssetReleaseDeprecated`. The model names no event of this service for a deprecation, so the state is read through the reads of the service. Both handlers are idempotent on the event id. In this increment AgentRegistryService is delivered thin and publishes neither event; its publication path arrives in I2 with feature `agent-registry-service-publication` (D140), and its handler `OpenReleaseCandidate`, which opens the candidate of a blueprint from `BlueprintSubmitted`, with feature `agent-registry-service-complete` in I4. On a deployed instance a Submitted version therefore stays Submitted and `BlueprintPublished` is not published before I4. Until that gate the Draft allowance applies (D123): GenerationRecipeService consumes `BlueprintSubmitted` and keeps the Submitted version as one a recipe may bind, so the chain to an approved recipe does not wait for the gate, and from I4 a recipe binds only a Published version. The two handlers are built here and proven on event fixtures that carry the payloads of model/services/control-plane/AgentRegistryService.yaml under the run event envelope; neither release event is traced by this PBI, because no feature of this increment publishes it. Kind: behavior. Traces: services: BlueprintService, AgentRegistryService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/SubmitBlueprint; events: BlueprintService/BlueprintSubmitted, BlueprintService/BlueprintPublished; adrs: ADR-0012, ADR-0015, ADR-0021; requirements: FR-02, NFR-11; scenarios: SCN-BlueprintService-005, SCN-BlueprintService-010, SCN-BlueprintService-011. Depends on: AIFACTORY-US-676, AIFACTORY-US-677. Sources: model/services/template-library/BlueprintService.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/architecture/adr/0021-quality-gates.md, docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.blueprints.publish` and a Validated `BlueprintService/BlueprintVersion` of the tenant and project of the caller, of a Service or Module kind with its derived references or of any other kind, when `BlueprintService/SubmitBlueprint` is called, then the version moves to Submitted through `SubmitForPublication`, `BlueprintService/BlueprintSubmitted` is written in the same transaction, the response is 202, and a repeated call for the version already Submitted returns 202 and writes nothing (SCN-BlueprintService-005).",
        "AC2: Given a caller without `factory.blueprints.publish`, a version that does not exist or belongs to another tenant, a version that is Draft, Published or Deprecated, or a Validated Service or Module version without its derived context map and domain model, when `BlueprintService/SubmitBlueprint` is called, then the response is 403, 404, 409 and 409 respectively with a problem response, the state does not change and nothing is published (SCN-BlueprintService-005, ADR-0015).",
        "AC3: Given the submission was committed, when the outbox dispatcher publishes `BlueprintService/BlueprintSubmitted` on `blueprints.versions.v1.blueprint-submitted`, then the event is sent under the run event envelope with `blueprintId`, `version`, `tenantId` and `projectId`, a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id, and the service calls no operation of Asset Publication itself (SCN-BlueprintService-010, ADR-0012).",
        "AC4: Given a Submitted version and the event fixture of a published asset release that names its blueprint id and version in its tenant, when the inbox handler `MarkPublished` runs, then the version moves to Published through `AssetReleasePublished`, `releaseId` is set and `BlueprintService/BlueprintPublished` is written in the same transaction and published on `blueprints.versions.v1.blueprint-published` with `blueprintId`, `version`, `tenantId`, `projectId` and `releaseId`; a second delivery of the same event id, a release that matches no Submitted version and a release of another tenant change nothing (SCN-BlueprintService-011, ADR-0021).",
        "AC5: Given a Published version and the event fixture of a deprecated asset release that names its `releaseId`, when the inbox handler `MarkDeprecated` runs, then the version moves to Deprecated through `AssetReleaseDeprecated`, idempotently on the event id, the state is readable through the reads of the service, and no command of the service ever moves a version to Published or Deprecated (model/services/template-library/BlueprintService.yaml, NFR-11)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2717",
        "AIFACTORY-TASK-2718",
        "AIFACTORY-TASK-2719",
        "AIFACTORY-TASK-2720"
      ],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8009,
      "kind": "behavior",
      "traces": {
        "services": [
          "BlueprintService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/SubmitBlueprint"
        ],
        "events": [
          "BlueprintService/BlueprintSubmitted",
          "BlueprintService/BlueprintPublished"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "NFR-11"
        ],
        "scenarios": [
          "SCN-BlueprintService-005",
          "SCN-BlueprintService-010",
          "SCN-BlueprintService-011"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-676",
        "AIFACTORY-US-677"
      ],
      "source": [
        "model/services/template-library/BlueprintService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/solution-packs/software-factory/templates/services/blueprint-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-678]",
      "number": 678
    },
    {
      "id": "AIFACTORY-TASK-2717",
      "type": "task",
      "parent": "AIFACTORY-US-678",
      "title": "SubmitBlueprint with the Validated to Submitted transition and the BlueprintSubmitted outbox record",
      "sequence": "15.01.09.01",
      "description": "SubmitBlueprint with the Validated to Submitted transition and the BlueprintSubmitted outbox record. Expected output: SubmitBlueprint applies SubmitForPublication to a Validated version of the trusted tenant and project, requires the derived references of a Service or Module version, writes BlueprintSubmitted in the same transaction and answers 202; a repeat for a Submitted version returns 202 and writes nothing; 403, 404 and 409 are covered by acceptance tests and the service calls no operation of AgentRegistryService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "SubmitBlueprint applies SubmitForPublication to a Validated version of the trusted tenant and project, requires the derived references of a Service or Module version, writes BlueprintSubmitted in the same transaction and answers 202; a repeat for a Submitted version returns 202 and writes nothing; 403, 404 and 409 are covered by acceptance tests and the service calls no operation of AgentRegistryService."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8009,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2717]",
      "number": 2717
    },
    {
      "id": "AIFACTORY-TASK-2718",
      "type": "task",
      "parent": "AIFACTORY-US-678",
      "title": "MarkPublished and MarkDeprecated inbox handlers",
      "sequence": "15.01.09.02",
      "description": "MarkPublished and MarkDeprecated inbox handlers. Expected output: MarkPublished moves the Submitted version that a published asset release names by asset id and version, inside the tenant of the envelope, to Published with its releaseId and writes BlueprintPublished in the same transaction; MarkDeprecated moves the Published version that a deprecated asset release names by releaseId to Deprecated; both are idempotent on the event id and ignore a release that matches no version.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "MarkPublished moves the Submitted version that a published asset release names by asset id and version, inside the tenant of the envelope, to Published with its releaseId and writes BlueprintPublished in the same transaction; MarkDeprecated moves the Published version that a deprecated asset release names by releaseId to Deprecated; both are idempotent on the event id and ignore a release that matches no version."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8009,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2718]",
      "number": 2718
    },
    {
      "id": "AIFACTORY-TASK-2719",
      "type": "task",
      "parent": "AIFACTORY-US-678",
      "title": "Event fixtures of a published and a deprecated asset release",
      "sequence": "15.01.09.03",
      "description": "Event fixtures of a published and a deprecated asset release. Expected output: The acceptance suite builds the published and the deprecated asset release events from the payloads of model/services/control-plane/AgentRegistryService.yaml under the run event envelope of the pinned contracts package and delivers them to the inbox, once, twice under one event id, for an unknown asset and for another tenant, because no service of this increment publishes them.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The acceptance suite builds the published and the deprecated asset release events from the payloads of model/services/control-plane/AgentRegistryService.yaml under the run event envelope of the pinned contracts package and delivers them to the inbox, once, twice under one event id, for an unknown asset and for another tenant, because no service of this increment publishes them."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8009,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2719]",
      "number": 2719
    },
    {
      "id": "AIFACTORY-TASK-2720",
      "type": "task",
      "parent": "AIFACTORY-US-678",
      "title": "Verify submit-and-publish-a-blueprint-version through the acceptance suite",
      "sequence": "15.01.09.04",
      "description": "Verify submit-and-publish-a-blueprint-version through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-005|Scenario=SCN-BlueprintService-010|Scenario=SCN-BlueprintService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-678: the submission with its refusals and its repeat, the publication and payload of BlueprintSubmitted, and on the event fixtures the Published and Deprecated transitions with the publication and payload of BlueprintPublished; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-BlueprintService-005|Scenario=SCN-BlueprintService-010|Scenario=SCN-BlueprintService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-678: the submission with its refusals and its repeat, the publication and payload of BlueprintSubmitted, and on the event fixtures the Published and Deprecated transitions with the publication and payload of BlueprintPublished; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/BlueprintService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 80,
      "phase": "factory",
      "stackRank": 8009,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2720]",
      "number": 2720
    },
    {
      "id": "AIFACTORY-FEAT-083",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-015",
      "title": "GenerationRecipeService: complete delivery",
      "sequence": "15.02",
      "description": "GenerationRecipeService is the service of bounded context BC-15 (Generation Recipe). A generation recipe binds a Published blueprint version to Published template and library versions with a module plan and parameters, validated against manifests, switches and the compatibility matrix, and records the provenance of every generated output down to the commit; the scaffold commitment stays Q-22 (BC-15; template validation and pipeline generation rows merged). Its own repository is ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Delivers: GenerationRecipeService (complete). Increment I1: Generate a microservice. Build order 81 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-013",
        "AIFACTORY-US-679",
        "AIFACTORY-US-680",
        "AIFACTORY-US-681",
        "AIFACTORY-US-682",
        "AIFACTORY-US-683",
        "AIFACTORY-US-684",
        "AIFACTORY-US-685",
        "AIFACTORY-US-686",
        "AIFACTORY-US-687",
        "AIFACTORY-US-688"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8100,
      "titlePrefix": "[AIFACTORY-FEAT-083]",
      "number": 83
    },
    {
      "id": "AIFACTORY-US-013",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Approve a recipe that pins every design input",
      "sequence": "15.02.01",
      "description": "As an asset maintainer, I want to review and approve a generation recipe whose modules pin exact blueprint and design versions, so that generation runs on inputs I have seen and nothing newer replaces them silently. This is the integration PBI of the feature: it proves that the behaviour PBIs of GenerationRecipeService compose into the one chain a person and a generation run need, on one deployed instance of the service. The service hears which inputs may be pinned: blueprint versions that are Submitted or Published, validated design inputs, template versions of the platform catalog that are discovered or Published, library versions and compatibility evidence (AIFACTORY-US-682). Until the evaluation gate of AgentRegistryService is delivered in I4 the Draft allowance applies (D123): a recipe may bind a Submitted blueprint version and a template version the platform catalog has discovered that is not yet Published, and it records in `draftAllowanceUsed` that the allowance was used; from I4 a recipe binds only Published versions. When BlueprintService announces a context map, the `PlanProposer` proposes a module plan, and a Requester or an Asset maintainer drafts a recipe from a blueprint version a recipe may bind with that plan, adjusted where needed (AIFACTORY-US-683). The recipe is read with its module plan, its pins and its evidence (AIFACTORY-US-684) and validated: every module names a template version a recipe may bind whose switches accept its parameters, every library is Published and compatible with every template that consumes it, and every design input a module kind needs is pinned by id, version and hash and resolves to a validated version (AIFACTORY-US-685, ADR-0027). The Asset maintainer approves the Validated recipe; from then on it is immutable, `RecipeApproved` is published, and a change is a new version that supersedes it (AIFACTORY-US-686). The readiness correlation of WorkflowEngineService submits the `generate-product` run on that event; the run reads the approved recipe through `Recipes.GetApprovedRecipe` and its provenance is recorded through `Recipes.RecordOutput` (AIFACTORY-US-687), and the end of the run completes the generation or, when the run fails or is cancelled, returns the recipe to Approved (AIFACTORY-US-688). The service is scaffolded from the base template with the Factory profile (AIFACTORY-US-679), hosts its routes, its messaging profile and its two workers (AIFACTORY-US-680) and enforces tenancy and the telemetry conventions (AIFACTORY-US-681). It never writes code, decides no approval of RunControlService and repeats no write on its own: the approval of a recipe is its own command under the scope `factory.recipes.approve`, and the approval of the generated change set is a separate approval in RunControlService, which the requester of the run never decides. A person reaches the REST operations through the gateway TemplateCatalogHost, which feature `template-catalog-host` delivers in this increment (D123): the command-line client shows a recipe and approves it by recipe id and version through that gateway with its typed client, which feature `typed-gateway-clients` publishes, by the commands `recipe show` and `recipe approve` of AIFACTORY-US-1507 of feature `command-line-client-commands`. The gateway feature and the command feature depend on this feature, so this feature states the route in words and depends on neither. A blueprint or template version becomes Published only through the publication path of AgentRegistryService, which arrives in I2 with feature `agent-registry-service-publication` (D140); until the evaluation gate of I4 the chain runs on a deployed instance under the Draft allowance, on a Submitted blueprint version that BlueprintService announces and on discovered template versions that TemplateRegistryService announces, and a library whose compatibility cell is still Unknown passes validation with a warning under the same allowance (D125). The provenance of the generated outputs is recorded in this increment: the tool `record-generated-output`, bound to the skill of the step `record-outputs` of `generate-product`, is executed by ToolAdapterService, which calls `Recipes.RecordOutput` with its workload identity, so the recipe reaches Generated and `GenerationCompleted` is published in I1 (D133). Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Kind: behavior. Traces: services: GenerationRecipeService, TemplateRegistryService, BlueprintService, ArtifactService; aggregates: GenerationRecipeService/GenerationRecipe; apis: GenerationRecipeService/DraftRecipe, GenerationRecipeService/ValidateRecipe, GenerationRecipeService/ApproveRecipe, GenerationRecipeService/GetRecipe, GenerationRecipeService/Recipes.RecordOutput, TemplateRegistryService/Catalog.ResolveManifest; events: GenerationRecipeService/RecipeValidated, GenerationRecipeService/RecipeApproved, GenerationRecipeService/GenerationCompleted; tools: record-generated-output; adrs: ADR-0027; requirements: FR-06. Depends on: AIFACTORY-US-679, AIFACTORY-US-680, AIFACTORY-US-681, AIFACTORY-US-682, AIFACTORY-US-683, AIFACTORY-US-684, AIFACTORY-US-685, AIFACTORY-US-686, AIFACTORY-US-687, AIFACTORY-US-688, feature:template-registry-service, feature:blueprint-service, feature:artifact-service, feature:run-control-service, feature:typed-gateway-clients, feature:local-development-environment. Sources: model/services/template-library/GenerationRecipeService.yaml, model/workflows/generate-product.yaml, model/tools/record-generated-output.yaml, docs/architecture/adr/0027-generation-input-contract.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given a blueprint version a recipe may bind, Submitted under the Draft allowance until I4 or Published, whose context map names two bounded contexts, when the `PlanProposer` has run and `GenerationRecipeService/DraftRecipe` is called, then the Draft `GenerationRecipeService/GenerationRecipe` has one module entry per context with a template version a recipe may bind, discovered or Published, its switches and its parameters, `draftAllowanceUsed` is true exactly when a Submitted blueprint version or a discovered template version is bound, and `GenerationRecipeService/GetRecipe` shows the plan with every pin (ADR-0027, model/services/template-library/GenerationRecipeService.yaml).",
        "AC2: Given that recipe with every module entry pinning the design inputs of its kind, when `GenerationRecipeService/ValidateRecipe` is called, then every pinned design input resolves to a validated version by id, version and hash, every library is compatible with every template that consumes it with evidence, the manifests are read through `TemplateRegistryService/Catalog.ResolveManifest`, the recipe is Validated and `GenerationRecipeService/RecipeValidated` is written with `passed` true in the same transaction (ADR-0027).",
        "AC3: Given a recipe with a pin that does not resolve, when it is validated and `GenerationRecipeService/ApproveRecipe` is then called, then the validation result names the unresolved pin, the recipe stays Draft, the approval is refused with 409 and nothing is published (ADR-0027).",
        "AC4: Given a Validated recipe, when the Asset maintainer approves it through `GenerationRecipeService/ApproveRecipe`, reached through the gateway TemplateCatalogHost directly or by the client command recipe approve of model/backlog/pbis/engineering-readiness/command-line-client-commands.yaml with the typed client of that gateway, then the recipe is Approved and immutable, `approvedBy` names the approver and `GenerationRecipeService/RecipeApproved` is written in the same transaction with `recipeId`, `version` and `approvedBy`; a change after that is a new version (FR-06).",
        "AC5: Given the approved recipe and a generation run, when the run reads the recipe, one output is recorded per module through `GenerationRecipeService/Recipes.RecordOutput` by ToolAdapterService for the tool record-generated-output and the run completes, then the read returned the recipe with every pin resolved, the outputs are listed with their provenance, the recipe is Generated and `GenerationRecipeService/GenerationCompleted` is written, the flow that docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md draws (D133)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/workflows/generate-product.yaml",
        "model/tools/record-generated-output.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2721",
        "AIFACTORY-TASK-787"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8101,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService",
          "TemplateRegistryService",
          "BlueprintService",
          "ArtifactService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe"
        ],
        "apis": [
          "GenerationRecipeService/DraftRecipe",
          "GenerationRecipeService/ValidateRecipe",
          "GenerationRecipeService/ApproveRecipe",
          "GenerationRecipeService/GetRecipe",
          "GenerationRecipeService/Recipes.RecordOutput",
          "TemplateRegistryService/Catalog.ResolveManifest"
        ],
        "events": [
          "GenerationRecipeService/RecipeValidated",
          "GenerationRecipeService/RecipeApproved",
          "GenerationRecipeService/GenerationCompleted"
        ],
        "tools": [
          "record-generated-output"
        ],
        "adrs": [
          "ADR-0027"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-679",
        "AIFACTORY-US-680",
        "AIFACTORY-US-681",
        "AIFACTORY-US-682",
        "AIFACTORY-US-683",
        "AIFACTORY-US-684",
        "AIFACTORY-US-685",
        "AIFACTORY-US-686",
        "AIFACTORY-US-687",
        "AIFACTORY-US-688",
        "feature:template-registry-service",
        "feature:blueprint-service",
        "feature:artifact-service",
        "feature:run-control-service",
        "feature:typed-gateway-clients",
        "feature:local-development-environment"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/workflows/generate-product.yaml",
        "model/tools/record-generated-output.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-013]",
      "number": 13
    },
    {
      "id": "AIFACTORY-TASK-2721",
      "type": "task",
      "parent": "AIFACTORY-US-013",
      "title": "Deployment values of GenerationRecipeService: replica range, secret reference and dependency addresses",
      "sequence": "15.02.01.01",
      "description": "Deployment values of GenerationRecipeService: replica range, secret reference and dependency addresses. Expected output: The deployment manifest of the service carries the replica range 2 to 4 of the model, the key vault reference of the transport credential messaging-transport, the addresses of BlueprintService, TemplateRegistryService and ArtifactService, the messaging service name generation-recipe and the values of the two options of Templates:Recipes; the acceptance environment of feature local-development-environment starts the service with these values and its readiness answers ready.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The deployment manifest of the service carries the replica range 2 to 4 of the model, the key vault reference of the transport credential messaging-transport, the addresses of BlueprintService, TemplateRegistryService and ArtifactService, the messaging service name generation-recipe and the values of the two options of Templates:Recipes; the acceptance environment of feature local-development-environment starts the service with these values and its readiness answers ready."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8101,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2721]",
      "number": 2721
    },
    {
      "id": "AIFACTORY-TASK-787",
      "type": "task",
      "parent": "AIFACTORY-US-013",
      "title": "Verify approve-a-recipe by running the chain test of the acceptance suite",
      "sequence": "15.02.01.02",
      "description": "Verify approve-a-recipe by running the chain test of the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Chain=approve-a-recipe\"`; a zero-match filter counts as a failure; one test announces the inputs as the services of this increment publish them, a Submitted blueprint version by BlueprintSubmitted, its derived models, a discovered template version by TemplateVersionDiscovered, a library version, its compatibility and the validated design inputs, then proposes, drafts, validates with a broken and with a resolved pin, approves, reads the approved recipe, records one output per module and completes the run, against fakes of BlueprintService, TemplateRegistryService, ArtifactService and the transport, and finds draftAllowanceUsed true on the recipe; a second pass announces the same blueprint and template versions as Published by event fixtures and finds draftAllowanceUsed false; together the passes prove AC1 to AC5 of AIFACTORY-US-013.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Chain=approve-a-recipe\"`; a zero-match filter counts as a failure; one test announces the inputs as the services of this increment publish them, a Submitted blueprint version by BlueprintSubmitted, its derived models, a discovered template version by TemplateVersionDiscovered, a library version, its compatibility and the validated design inputs, then proposes, drafts, validates with a broken and with a resolved pin, approves, reads the approved recipe, records one output per module and completes the run, against fakes of BlueprintService, TemplateRegistryService, ArtifactService and the transport, and finds draftAllowanceUsed true on the recipe; a second pass announces the same blueprint and template versions as Published by event fixtures and finds draftAllowanceUsed false; together the passes prove AC1 to AC5 of AIFACTORY-US-013."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-787]",
      "number": 787
    },
    {
      "id": "AIFACTORY-US-679",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "GenerationRecipeService repository: scaffolded from the base template with the Factory profile, with its two aggregates and the store generation-recipe-sql",
      "sequence": "15.02.02",
      "description": "The repository ConnectSoft.AI.SoftwareFactory.GenerationRecipeService is created and scaffolded in I0 by AIFACTORY-TASK-125 of feature repository-and-pipeline-conventions (D140), by the steps of its repository checklist, and this feature starts from that scaffold, made with the scaffold command of ADR-0028 and its amendment on the Factory profile switch (D114): `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.GenerationRecipeService --UseFactoryProfile true`, from the template package at the version the gate of feature `component-base-template-factory-profile` published (AIFACTORY-US-230), after the findings of feature `component-base-template-findings` are closed (AIFACTORY-US-235). The generated output is committed unchanged and the repository records the version of the template package it was generated from. What the profile generates, that is the Orleans messaging profile with an outbox and an inbox of the service, the propagation of the trusted tenant and project scope, the role policies, the REST and gRPC hosts from a service descriptor, health and telemetry, is the work of the template feature; it is consumed by that version pin and is neither rewritten nor forked here. The run event envelope and the shared descriptors come from the contracts package by a version pin. On that scaffold this PBI adds the domain and the store. The `GenerationRecipe` is the complete instruction set for generating a product or a module, identified by recipe id and an integer version: the blueprint version it is built on, the module plan of `ModulePlanEntry` entities (name, one of the twelve values of `ModuleKind`, context, template id and version, switches, parameters, path and the pinned design inputs), the library versions pinned for all modules, the repository layout, the compatibility evidence it was validated against, its state, its approver, the member `draftAllowanceUsed` and the reference and hash of its recipe document, `documentRef` and `documentHash` (D123). It has exactly nine transitions: Draft to Validated (`PlanValidated`), Validated to Draft (`Changed`), Validated to Approved (`Approved`), Approved to Executing (`RunSubmitted`), Executing to Generated (`RunCompleted`), Executing to Approved (`RunFailed`), Executing to Approved (`RunCancelled`), and Approved or Generated to Superseded (`NewVersion`). Its invariants are those of the model: every module references a template version whose switches accept its parameters; the blueprint version and every template version a recipe binds are Published, and until the evaluation gate of AgentRegistryService is delivered in I4 the Draft allowance lets a recipe also bind a Submitted blueprint version and a template version the catalog has discovered that is not yet Published, with `draftAllowanceUsed` recording that the allowance was used; a recipe binds catalog rows of the platform tenant; every library is Published and Compatible with every template that consumes it, with evidence; every module entry pins the design inputs its kind needs by id, version and hash; a recipe is immutable once Approved; and the service never writes code. The `GeneratedOutput` is the provenance of one generated module at one commit: recipe version, run and attempt, agent release, template version and manifest hash, the generated files with their hashes, the preserved paths, the change proposal and the commit. Generated files are listed with hashes so that a later scaffold can tell generated from hand-edited content, and a preserved path is never listed as generated. The store `generation-recipe-sql` is owned by this service alone (ADR-0028 decision 5). The model lists nine tables on that store (D123). This PBI migrates the three tables of the two aggregates, `GenerationRecipes`, `ModulePlanEntries` and `GeneratedOutputs`, with the keys, columns and indexes of the model, the columns `DraftAllowanceUsed`, `DocumentRef` and `DocumentHash` of `GenerationRecipes` among them, and the tenant row filter in every mapping; the five projection tables are migrated by AIFACTORY-US-682 with the handlers that fill them, and the table `PlanProposals` by AIFACTORY-US-683 with the worker that fills it. The retention of `GeneratedOutputs`, the lifetime of the product plus seven years, is recorded with the table; no deletion job and no deletion-order handler is built or registered here, because those arrive with RetentionResidencyService in I4. Kind: enabling. Traces: services: GenerationRecipeService; aggregates: GenerationRecipeService/GenerationRecipe, GenerationRecipeService/GeneratedOutput; adrs: ADR-0015, ADR-0027, ADR-0028; requirements: FUX-01. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package. Sources: model/services/template-library/GenerationRecipeService.yaml, model/template-parameters/connectsoft-base.yaml, model/stores.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#domain-model, docs/solution-packs/software-factory/templates/services/generation-recipe-service/ddl.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-125 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.GenerationRecipeService --UseFactoryProfile true` from the base template package at the version the gate of feature `component-base-template-factory-profile` published, when its pipeline runs, then the committed output equals the generated output, the solution builds in Release, the generated tests pass, a container image is published and the repository records the template version (ADR-0028, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given the `GenerationRecipeService/GenerationRecipe` and `GenerationRecipeService/GeneratedOutput` aggregates, when their unit tests run, then the recipe accepts exactly the nine transitions of model/services/template-library/GenerationRecipeService.yaml, the return from Executing to Approved through `RunCancelled` among them, and refuses every other one, an approval of a Draft and a transition out of Superseded among them; an Approved recipe refuses every change of its modules, libraries, layout and evidence; a module entry without a template version or without the design input pins of its kind keeps the recipe from `PlanValidated`; and a generated output that lists one path as both generated and preserved is refused (ADR-0027).",
        "AC3: Given `generation-recipe-sql` created by the migrations of the repository on an isolated test database, when the mapping tests run, then the tables `GenerationRecipes`, `ModulePlanEntries` and `GeneratedOutputs` exist with their keys and the indexes `IX_Recipes_Project_State`, `IX_Outputs_Project_Module` and `IX_Outputs_Run`, `GenerationRecipes` holds the columns `DraftAllowanceUsed`, not nullable with the default 0, `DocumentRef` and `DocumentHash`, a query made for one tenant never returns a recipe, a module entry or an output of another, and the retention of `GeneratedOutputs` is recorded with the table (ADR-0015, model/stores.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#domain-model",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/ddl.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-126",
        "AIFACTORY-TASK-127",
        "AIFACTORY-TASK-2722"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8102,
      "kind": "enabling",
      "traces": {
        "services": [
          "GenerationRecipeService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe",
          "GenerationRecipeService/GeneratedOutput"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0027",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#domain-model",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/ddl.md"
      ],
      "titlePrefix": "[AIFACTORY-US-679]",
      "number": 679
    },
    {
      "id": "AIFACTORY-TASK-126",
      "type": "task",
      "parent": "AIFACTORY-US-679",
      "title": "Domain model: GenerationRecipe with ModulePlanEntry, GeneratedOutput",
      "sequence": "15.02.02.01",
      "description": "Domain model: GenerationRecipe with ModulePlanEntry, GeneratedOutput. Expected output: The two aggregates and the ModulePlanEntry entity enforce the invariants of the model as it words them; the GenerationRecipe accepts only PlanValidated out of Draft, Changed and Approved out of Validated, RunSubmitted and NewVersion out of Approved, RunCompleted, RunFailed and RunCancelled out of Executing and NewVersion out of Generated, and refuses every change once Approved; the recipe carries draftAllowanceUsed, documentRef and documentHash; the GeneratedOutput refuses a path listed as both generated and preserved; unit tests cover every invariant, each of the nine transitions and the refusal of every other one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two aggregates and the ModulePlanEntry entity enforce the invariants of the model as it words them; the GenerationRecipe accepts only PlanValidated out of Draft, Changed and Approved out of Validated, RunSubmitted and NewVersion out of Approved, RunCompleted, RunFailed and RunCancelled out of Executing and NewVersion out of Generated, and refuses every change once Approved; the recipe carries draftAllowanceUsed, documentRef and documentHash; the GeneratedOutput refuses a path listed as both generated and preserved; unit tests cover every invariant, each of the nine transitions and the refusal of every other one."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-126]",
      "number": 126
    },
    {
      "id": "AIFACTORY-TASK-127",
      "type": "task",
      "parent": "AIFACTORY-US-679",
      "title": "Persistence in generation-recipe-sql: GenerationRecipes, ModulePlanEntries, GeneratedOutputs",
      "sequence": "15.02.02.02",
      "description": "Persistence in generation-recipe-sql: GenerationRecipes, ModulePlanEntries, GeneratedOutputs. Expected output: Mappings and migrations for the three tables with the columns the model lists, the columns DraftAllowanceUsed, DocumentRef and DocumentHash of GenerationRecipes among them, the indexes IX_Recipes_Project_State, IX_Outputs_Project_Module and IX_Outputs_Run and the tenant filter in every mapping; the six other tables of the store are migrated by AIFACTORY-TASK-2727 and AIFACTORY-TASK-2746; the retention of GeneratedOutputs is recorded as table metadata; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the three tables with the columns the model lists, the columns DraftAllowanceUsed, DocumentRef and DocumentHash of GenerationRecipes among them, the indexes IX_Recipes_Project_State, IX_Outputs_Project_Module and IX_Outputs_Run and the tenant filter in every mapping; the six other tables of the store are migrated by AIFACTORY-TASK-2727 and AIFACTORY-TASK-2746; the retention of GeneratedOutputs is recorded as table metadata; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8102,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-127]",
      "number": 127
    },
    {
      "id": "AIFACTORY-TASK-2722",
      "type": "task",
      "parent": "AIFACTORY-US-679",
      "title": "Verify the scaffold, the aggregates and the store of GenerationRecipeService",
      "sequence": "15.02.02.03",
      "description": "Verify the scaffold, the aggregates and the store of GenerationRecipeService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the two aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-679 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the two aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-679 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2722]",
      "number": 2722
    },
    {
      "id": "AIFACTORY-US-680",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "GenerationRecipeService host: six REST routes and two gRPC methods behind scope policies, the generation-recipe messaging profile with fifteen subscriptions and the two hosted workers",
      "sequence": "15.02.03",
      "description": "This PBI makes the scaffold a host on which the behaviour PBIs of the feature land. From the service descriptor the host exposes the six REST operations of the model for its platform gateway and the internal gRPC service `Recipes` with the methods `GetApprovedRecipe` and `RecordOutput`, with their contract documents, an OpenAPI document and a proto. A user token reaches the service forwarded by TemplateCatalogHost: the service validates it again through the resource-server library the profile wires and accepts the audience of its own gateway and no other (ADR-0015 amendments on the one audience of a user token and on the forwarded user token). That gateway is delivered in this increment by feature `template-catalog-host` and is the one route of a person to these operations (ADR-0028 decision 2, D123); the acceptance suite of this repository calls the host of the service with a token of that audience and the forwarded scope, and the route through the gateway is proven by the gateway feature. Each route requires its scope: `factory.recipes.read` for `ListRecipes`, `GetRecipe` and `ListGeneratedOutputs`, `factory.recipes.write` for `DraftRecipe` and `ValidateRecipe`, `factory.recipes.approve` for `ApproveRecipe`. A gRPC caller needs a workload identity whose token holds a service scope; a workload token carries no tenant claim, and the service reads the tenant and project a workload forwards only under that scope. The model gives each gRPC method its scope (D123): the host requires `factory.recipes.read` for `GetApprovedRecipe` and `factory.recipes.write` for `RecordOutput`. The project of a project-scoped call is named by the caller (D123): `ListRecipes` takes the required query parameter `projectId` and `DraftRecipe` the required body member `projectId`; the gateway checks it against the roles of the token, and the service compares it with the project of the trusted scope it receives. One mapping answers every refusal: no token or a token of another audience 401, a call without the required `projectId` 400, a missing scope or role and a project the token does not grant 403, an unknown resource and a resource of another tenant 404, an idempotency key reused with another body and a state that does not allow the command 409, a blueprint version a recipe may not bind 412, an invalid body 422, a required dependency that fails fast and does not answer 503, each with a problem response; over gRPC Unauthenticated, PermissionDenied, NOT_FOUND, InvalidArgument, FailedPrecondition and Unavailable. The filter of the `Idempotency-Key` header guards `DraftRecipe`: the same key with the same input returns the stored result, and the same key with another input is a conflict by ADR-0014 decision 3, which the filter answers with 409. Messaging runs on the Orleans messaging profile with the service name of `OrleansMessaging:ServiceName`, default generation-recipe, whose inbox and outbox belong to this service alone (ADR-0028). The outbox writer enlists in the transaction of the command, and the dispatcher publishes the four modelled events on their topics under the run event envelope of the pinned contracts package. The inbox registers the fifteen consumed rows of the model, idempotently on the event id: from BlueprintService the submitted and the published blueprint, the validated blueprint with its two handlers, the derived context map and the derived domain model; from ArtifactService the stored artifact; from TemplateRegistryService the discovered and the published template version, the discovered library version and the checked compatibility; from RunControlService the completed, the failed and the cancelled run; from PipelineExecutionService the merged change proposal. The `PlanProposer` is hosted with its event trigger, two attempts 60 s apart, the key of blueprint id and blueprint version and at most two parallel executions; the `RecipeValidator` is hosted to be run by `ValidateRecipe`, with two attempts 30 s apart, the key of recipe id, version and content hash and at most four parallel executions; both are partitioned by project. What each route, handler and worker does is delivered by the behaviour PBIs. The three options of the model are bound and validated at start, and readiness names what is missing. Kind: enabling. Traces: services: GenerationRecipeService; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-679, feature:component-base-template-factory-profile, feature:contracts-package. Sources: model/services/template-library/GenerationRecipeService.yaml, model/descriptors.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given the host built from the service descriptor, when the contract tests of the repository run, then the OpenAPI document lists the six REST operations of model/services/template-library/GenerationRecipeService.yaml with their paths, scopes and response codes, the required query parameter `projectId` of `ListRecipes` and the required body member `projectId` of `DraftRecipe` among them, and the proto lists the service `Recipes` with `GetApprovedRecipe` and `RecordOutput`, each with the scope the model gives it.",
        "AC2: Given each REST route and each gRPC method, when it is called without a token, with a user token whose audience is not the gateway of the service, with a user token that lacks the scope of the route, without a workload identity, or with a workload token that lacks the service scope of the method, then the answer is 401, 401, 403, Unauthenticated or PermissionDenied respectively, with a problem response on REST, and no handler runs; and a call of `ListRecipes` or `DraftRecipe` without `projectId` is answered 400 with a problem response (ADR-0015, model/services/template-library/GenerationRecipeService.yaml).",
        "AC3: Given the messaging profile generation-recipe, when a command commits, rolls back, or commits while the transport is down, then the committed event is published once on its topic under `run-event-envelope-v1`, the rolled back one never, and the one written during the outage after the outbox retried with backoff, neither lost nor duplicated under its event id; and each of the fifteen consumed rows delivered twice under one event id reaches its handler once (ADR-0012, ADR-0014).",
        "AC4: Given the hosted `PlanProposer` and `RecipeValidator`, when the trigger of the first is delivered twice for one blueprint id and blueprint version, or the second is run twice for one recipe id, version and content hash, then one execution has an effect; the first runs at most two executions in parallel and makes at most two attempts 60 s apart, the second at most four in parallel with at most two attempts 30 s apart, both partitioned by project; and the service is ready only after `generation-recipe-sql` is migrated and the messaging profile has started, and it names what is missing while it is unready (model/services/template-library/GenerationRecipeService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/descriptors.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-128",
        "AIFACTORY-TASK-129",
        "AIFACTORY-TASK-130",
        "AIFACTORY-TASK-2723"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8103,
      "kind": "enabling",
      "traces": {
        "services": [
          "GenerationRecipeService"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-679",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/descriptors.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-680]",
      "number": 680
    },
    {
      "id": "AIFACTORY-TASK-128",
      "type": "task",
      "parent": "AIFACTORY-US-680",
      "title": "API hosting skeleton: REST and gRPC hosts, scope policies, problem responses and contract documents for the 6 REST operations and 2 gRPC methods",
      "sequence": "15.02.03.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope policies, problem responses and contract documents for the 6 REST operations and 2 gRPC methods. Expected output: The six REST routes and the two gRPC methods are hosted with token validation that accepts the audience of TemplateCatalogHost, scope enforcement per route, the workload identity and service scope check per gRPC method, problem responses for every modelled refusal code, the Idempotency-Key filter of DraftRecipe, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-683 to AIFACTORY-US-687, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The six REST routes and the two gRPC methods are hosted with token validation that accepts the audience of TemplateCatalogHost, scope enforcement per route, the workload identity and service scope check per gRPC method, problem responses for every modelled refusal code, the Idempotency-Key filter of DraftRecipe, and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-683 to AIFACTORY-US-687, not here."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-128]",
      "number": 128
    },
    {
      "id": "AIFACTORY-TASK-129",
      "type": "task",
      "parent": "AIFACTORY-US-680",
      "title": "Messaging skeleton: outbox and inbox wiring of the generation-recipe profile for 4 published events and 15 consumed rows",
      "sequence": "15.02.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the generation-recipe profile for 4 published events and 15 consumed rows. Expected output: The outbox writer enlists in the transaction of the command and the dispatcher of the generation-recipe messaging profile publishes RecipeValidated, RecipeApproved, GenerationCompleted and GeneratedOutputRecorded on their topics under the run event envelope of the pinned contracts package; the inbox registers the fifteen consumed rows of the model with idempotency on the event id, BlueprintValidated with its two handlers, BlueprintSubmitted, TemplateVersionDiscovered and RunCancelled among them; what each handler does is delivered by AIFACTORY-US-682, AIFACTORY-US-683, AIFACTORY-US-687 and AIFACTORY-US-688.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the transaction of the command and the dispatcher of the generation-recipe messaging profile publishes RecipeValidated, RecipeApproved, GenerationCompleted and GeneratedOutputRecorded on their topics under the run event envelope of the pinned contracts package; the inbox registers the fifteen consumed rows of the model with idempotency on the event id, BlueprintValidated with its two handlers, BlueprintSubmitted, TemplateVersionDiscovered and RunCancelled among them; what each handler does is delivered by AIFACTORY-US-682, AIFACTORY-US-683, AIFACTORY-US-687 and AIFACTORY-US-688."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-129]",
      "number": 129
    },
    {
      "id": "AIFACTORY-TASK-130",
      "type": "task",
      "parent": "AIFACTORY-US-680",
      "title": "Worker hosting skeleton: triggers, partitioning and retry policies of PlanProposer and RecipeValidator",
      "sequence": "15.02.03.03",
      "description": "Worker hosting skeleton: triggers, partitioning and retry policies of PlanProposer and RecipeValidator. Expected output: The PlanProposer is hosted with its event trigger, two attempts with 60 s backoff, the key of blueprint id and blueprint version and at most two parallel executions; the RecipeValidator is hosted to be run by ValidateRecipe with two attempts with 30 s backoff, the key of recipe id, version and content hash and at most four parallel executions; both are partitioned by project and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-683 and AIFACTORY-US-685.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The PlanProposer is hosted with its event trigger, two attempts with 60 s backoff, the key of blueprint id and blueprint version and at most two parallel executions; the RecipeValidator is hosted to be run by ValidateRecipe with two attempts with 30 s backoff, the key of recipe id, version and content hash and at most four parallel executions; both are partitioned by project and a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-683 and AIFACTORY-US-685."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-130]",
      "number": 130
    },
    {
      "id": "AIFACTORY-TASK-2723",
      "type": "task",
      "parent": "AIFACTORY-US-680",
      "title": "Verify the hosted surface of GenerationRecipeService",
      "sequence": "15.02.03.04",
      "description": "Verify the hosted surface of GenerationRecipeService. Expected output: Run the contract, authorization, messaging and readiness tests of the repository pipeline; they prove AC1 to AC4 of AIFACTORY-US-680: the OpenAPI document and the proto match model/services/template-library/GenerationRecipeService.yaml, every route and method refuses a caller without token, audience, scope or workload identity, an event is published once per committed command and never for a rolled back one, and a duplicate trigger of either worker has one effect.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run the contract, authorization, messaging and readiness tests of the repository pipeline; they prove AC1 to AC4 of AIFACTORY-US-680: the OpenAPI document and the proto match model/services/template-library/GenerationRecipeService.yaml, every route and method refuses a caller without token, audience, scope or workload identity, an event is published once per committed command and never for a rolled back one, and a duplicate trigger of either worker has one effect."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2723]",
      "number": 2723
    },
    {
      "id": "AIFACTORY-US-681",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "GenerationRecipeService filters every query by tenant, answers a foreign recipe as not found, starts only with its transport secret reference and keeps generated content out of telemetry",
      "sequence": "15.02.04",
      "description": "Tenancy is enforced in the service and not only at the gateway. Every query of every table of `generation-recipe-sql` runs under the tenant row filter of the Factory profile: the nine tables of the model, that is the three tables of the recipes and outputs, the five projection tables that AIFACTORY-US-682 fills and the table `PlanProposals` that AIFACTORY-US-683 fills. Through I4 the catalog rows belong to the platform tenant only (D123): the envelope of every catalog event names the platform tenant, the three catalog projections, template versions, library versions and compatibility cells, keep each row under the tenant of the envelope of its event, and their filter admits the rows of the platform tenant for reading by every tenant, as the catalog of TemplateRegistryService does. A recipe binds catalog rows of the platform tenant and no other, so a row kept under any other tenant is invisible to the other tenants and bound by no recipe; templates owned by a tenant are a later feature. The tenant and project of a user call come from the trusted scope of the forwarded token; those of a workload call are the ones the workload forwards and are read only when its token holds the service scope of the method (ADR-0015 amendment D114). A recipe or a generated output of another tenant is invisible under the filter: every operation that addresses it answers 404, or the gRPC status NOT_FOUND, the same answer as for an id that does not exist (ADR-0015 amendment D113); a missing scope or role inside the tenant of the caller stays 403 or PERMISSION_DENIED. The project of a project-scoped call is named by the caller, in the query parameter `projectId` of `ListRecipes` and in the body member `projectId` of `DraftRecipe` (D123): a call without it is answered 400, the gateway checks it against the roles of the token and answers 403 for a project the token does not grant, and the service compares it with the project of the trusted scope it receives and answers 403 when the two differ, so a recipe is never written or listed for another project than the one the gateway admitted. The service holds no project registry and the model lists no dependency on ProjectService, so the one operation that takes a project in its path, `ListGeneratedOutputs`, compares the path `projectId` with the project of the trusted scope of the forwarded token: an equal id is answered 200, with an empty list when nothing is recorded, and every other id is answered 404, because the service cannot tell a project of another tenant from a project of the same tenant outside the scope of the caller. Whether a project of the same tenant should be answered 403 instead, which the amendment D113 would suggest for a missing right inside the tenant, is reported to the owner. The only secret of the service is the transport credential `messaging-transport`, read from its key vault reference with the rotation the model states; the service does not start without the reference and never logs the value. The data class of the service is confidential, so generated content stays out of telemetry: no log record, activity, metric or event carries a recipe document, the parameters of a module, a file of a generated output or a list of paths; events and logs carry ids, versions, hashes, states, counts and reasons (ADR-0019). Telemetry follows the Factory conventions of feature `component-observability-factory-conventions`, consumed by a version pin: tenant and project are on metrics by default, and run, step and attempt are on activities and log records only. The four metrics of the model are recorded with their modelled dimensions: `connectsoft.factory.recipes` by tenant and state on every state change, `connectsoft.factory.recipes.generated_modules` by tenant, module kind and template id, `connectsoft.factory.recipes.validation_failures` by reason, and `connectsoft.factory.recipes.inbox_lag` as the age of the oldest unprocessed inbox message. Health checks cover the store and the messaging profile. A runbook records the two failure modes of the model: a template version that is deprecated after a recipe that pins it was approved, in which case the recipe stays valid for its pinned version, a newer version is offered and a run that executes the recipe is not interrupted, and the loss of the store, detected by readiness and recovered by a restore within the recovery point of 15 minutes that model/stores.yaml states. Kind: enabling. Traces: services: GenerationRecipeService; aggregates: GenerationRecipeService/GenerationRecipe, GenerationRecipeService/GeneratedOutput; adrs: ADR-0015, ADR-0019; requirements: FUX-01. Depends on: AIFACTORY-US-680, feature:component-observability-factory-conventions, feature:local-development-environment. Sources: model/services/template-library/GenerationRecipeService.yaml, model/stores.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0019-data-governance.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the fixture of two tenants with one recipe and one generated output each, when a caller of the first tenant addresses the recipe of the second through every REST route and every gRPC method that takes a recipe, or calls `ListGeneratedOutputs` with the project id of the second, then each answer is 404 or the gRPC status NOT_FOUND, the same answer as for an id that does not exist: the recipe because the row filter hides it, the project because the path `projectId` is compared with the project of the trusted scope and every other id is answered 404; no list contains a row of the other tenant, a catalog row announced under the second tenant is invisible to the first while a row of the platform tenant is visible to both, and a caller of the right tenant without the scope is answered 403 or PERMISSION_DENIED (ADR-0015).",
        "AC2: Given a draft or a list without `projectId`, a draft or a list whose `projectId` differs from the project of the trusted scope, a draft whose body names a blueprint version of another project or tenant, a draft whose body names a recipe id that the project of the trusted scope does not hold, or a workload call whose token lacks the service scope under which a forwarded tenant and project are read, when it arrives, then it is refused with 400, 403, 412, 422 or PermissionDenied respectively and nothing is written; the 412 is the same answer as for a blueprint version that is unknown or that a recipe may not bind and never says which (ADR-0015, model/services/template-library/GenerationRecipeService.yaml).",
        "AC3: Given deployment values without the key vault reference of the secret `messaging-transport` that model/services/template-library/GenerationRecipeService.yaml names, when the service starts, then the start fails and names the missing reference; with the reference the service starts, and no log record, activity or metric carries the value.",
        "AC4: Given drafts, validations, approvals and recorded outputs of the fixture, when telemetry is collected, then `connectsoft.factory.recipes`, `connectsoft.factory.recipes.generated_modules`, `connectsoft.factory.recipes.validation_failures` and `connectsoft.factory.recipes.inbox_lag` are recorded with the dimensions of model/services/template-library/GenerationRecipeService.yaml, run, step and attempt appear on activities and log records only, and no log record, activity, metric or event holds a recipe document, module parameters, a generated file or a list of paths (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-131",
        "AIFACTORY-TASK-2724",
        "AIFACTORY-TASK-2725",
        "AIFACTORY-TASK-2726"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8104,
      "kind": "enabling",
      "traces": {
        "services": [
          "GenerationRecipeService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe",
          "GenerationRecipeService/GeneratedOutput"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-680",
        "feature:component-observability-factory-conventions",
        "feature:local-development-environment"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-681]",
      "number": 681
    },
    {
      "id": "AIFACTORY-TASK-131",
      "type": "task",
      "parent": "AIFACTORY-US-681",
      "title": "Security, tenancy and telemetry of GenerationRecipeService",
      "sequence": "15.02.04.01",
      "description": "Security, tenancy and telemetry of GenerationRecipeService. Expected output: The tenant row filter is on every query of every table of generation-recipe-sql, the five projection tables and PlanProposals among them, and admits the platform tenant for reading on the three catalog projections; an architecture test fails on a mapping without the filter; the tenant and project of a user call come from the trusted scope, the projectId a caller names in ListRecipes or DraftRecipe is compared with that project and answered 403 when it differs, the tenant and project of a workload call are read only under the service scope, a resource of another tenant is answered 404 or NOT_FOUND and a missing scope or role 403 or PERMISSION_DENIED, ListGeneratedOutputs answers 404 for every path projectId that is not the project of the trusted scope, the transport credential comes from its key vault reference, the four metrics carry the dimensions of the model, activities and log records carry run, step and attempt, and no telemetry holds generated content.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The tenant row filter is on every query of every table of generation-recipe-sql, the five projection tables and PlanProposals among them, and admits the platform tenant for reading on the three catalog projections; an architecture test fails on a mapping without the filter; the tenant and project of a user call come from the trusted scope, the projectId a caller names in ListRecipes or DraftRecipe is compared with that project and answered 403 when it differs, the tenant and project of a workload call are read only under the service scope, a resource of another tenant is answered 404 or NOT_FOUND and a missing scope or role 403 or PERMISSION_DENIED, ListGeneratedOutputs answers 404 for every path projectId that is not the project of the trusted scope, the transport credential comes from its key vault reference, the four metrics carry the dimensions of the model, activities and log records carry run, step and attempt, and no telemetry holds generated content."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-131]",
      "number": 131
    },
    {
      "id": "AIFACTORY-TASK-2724",
      "type": "task",
      "parent": "AIFACTORY-US-681",
      "title": "Acceptance fixture of two tenants with their projects, members and workload identities",
      "sequence": "15.02.04.02",
      "description": "Acceptance fixture of two tenants with their projects, members and workload identities. Expected output: A fixture of the acceptance suite seeds two tenants, each with a project, a member per scope of the model, a member with the Reviewer role and a workload identity with the service scopes, one recipe and one generated output per tenant, and catalog rows of the three catalog projections under the platform tenant and under each of the two tenants, so that every scenario of the feature can be run once inside a tenant and once across tenants; the fixture uses an isolated test database and the test authority of the local environment.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "A fixture of the acceptance suite seeds two tenants, each with a project, a member per scope of the model, a member with the Reviewer role and a workload identity with the service scopes, one recipe and one generated output per tenant, and catalog rows of the three catalog projections under the platform tenant and under each of the two tenants, so that every scenario of the feature can be run once inside a tenant and once across tenants; the fixture uses an isolated test database and the test authority of the local environment."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8104,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2724]",
      "number": 2724
    },
    {
      "id": "AIFACTORY-TASK-2725",
      "type": "task",
      "parent": "AIFACTORY-US-681",
      "title": "Runbook of the two failure modes of GenerationRecipeService",
      "sequence": "15.02.04.03",
      "description": "Runbook of the two failure modes of GenerationRecipeService. Expected output: The repository documentation holds a runbook for a template version deprecated after approval (the recipe stays valid for its pinned version, the newer version is shown as available, the executing run is not interrupted) and for the loss of the store (detection by readiness, restore within the recovery point of model/stores.yaml, recipe documents still held by ArtifactService).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The repository documentation holds a runbook for a template version deprecated after approval (the recipe stays valid for its pinned version, the newer version is shown as available, the executing run is not interrupted) and for the loss of the store (detection by readiness, restore within the recovery point of model/stores.yaml, recipe documents still held by ArtifactService)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8104,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2725]",
      "number": 2725
    },
    {
      "id": "AIFACTORY-TASK-2726",
      "type": "task",
      "parent": "AIFACTORY-US-681",
      "title": "Verify tenancy, the failing start without the secret reference and the telemetry content guard",
      "sequence": "15.02.04.04",
      "description": "Verify tenancy, the failing start without the secret reference and the telemetry content guard. Expected output: Run the two-tenant tests, the start test and the telemetry guard of the repository pipeline; they prove AC1 to AC4 of AIFACTORY-US-681: a foreign recipe or output is answered 404 or NOT_FOUND on every operation, a path projectId other than the project of the trusted scope is answered 404, a catalog row of another tenant is invisible while one of the platform tenant is visible, a call without projectId is answered 400 and a projectId other than the project of the trusted scope 403, a blueprint version of another project is answered 412 and a recipe id of another project 422, the service does not start without the reference of messaging-transport, and a scan of the collected logs, activities, metrics and events finds the content of no fixture recipe or generated file (ADR-0015, ADR-0019).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run the two-tenant tests, the start test and the telemetry guard of the repository pipeline; they prove AC1 to AC4 of AIFACTORY-US-681: a foreign recipe or output is answered 404 or NOT_FOUND on every operation, a path projectId other than the project of the trusted scope is answered 404, a catalog row of another tenant is invisible while one of the platform tenant is visible, a call without projectId is answered 400 and a projectId other than the project of the trusted scope 403, a blueprint version of another project is answered 412 and a recipe id of another project 422, the service does not start without the reference of messaging-transport, and a scan of the collected logs, activities, metrics and events finds the content of no fixture recipe or generated file (ADR-0015, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2726]",
      "number": 2726
    },
    {
      "id": "AIFACTORY-US-682",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Keep the blueprint versions, design inputs, template versions, library versions and compatibility evidence a recipe may bind, and return a Validated recipe to Draft when a pinned blueprint changes",
      "sequence": "15.02.05",
      "description": "A recipe may bind only what the service has heard is available, and it hears it through its inbox, because the model gives it no read of the state of a blueprint or of the catalog besides the manifest and the derived models. Eight handlers keep that knowledge in the five projection tables of the model, each idempotent on the event id (D123). `TrackBindableBlueprints` records in `BindableBlueprintVersions` the blueprint version that `BlueprintSubmitted` of BlueprintService announces, with the state Submitted, and `OfferRecipe` records the version that `BlueprintPublished` announces, with the state Published, as one a recipe can be drafted from; the row keeps the last state announced, and a Submitted announcement that arrives after the Published one does not lower it. `TrackDesignInputs` records in `ValidatedDesignInputs` the two kinds of design input a module entry may pin (ADR-0027): a Module, Database, Frontend or UX Blueprint version that `BlueprintValidated` announces with `passed` true, by blueprint id, version and document hash, and an artifact that `ArtifactStored` of ArtifactService announces with the descriptor `application-design-v1`, by artifact id, version in its chain and content hash. `TrackTemplates` records in `TemplateVersionProjections` each template version that `TemplateVersionDiscovered` of TemplateRegistryService announces, with the state Discovered, and `OfferUpgrade` records each version that `TemplateVersionPublished` announces, with the state Published, as one a module may reference; a Discovered announcement that arrives after the Published one does not lower the state. `TrackLibraries` records in `LibraryVersionProjections` each library version with its catalog state from `LibraryVersionDiscovered`, and `RefreshEvidence` records in `CompatibilityCellProjections` each compatibility cell with its result and its entry id from `CompatibilityChecked`. Until the evaluation gate of AgentRegistryService is delivered in I4 the Draft allowance applies (D123): a recipe may bind a blueprint version in the state Submitted and a template version in the state Discovered beside Published ones, and the recipe records in `draftAllowanceUsed` that the allowance was used. One read port of the projection applies that rule for `DraftRecipe`, the `PlanProposer`, `GetRecipe` and the `RecipeValidator`. Arriving in I4 a recipe binds only rows in the state Published, which is a change of that one rule and of no handler. The offer of an upgrade is a read: a recipe that pins an earlier version of that template shows the newer Published version as available through the reads of the service, and nothing is drafted automatically. The purpose of `OfferUpgrade` in the model is that a newer template version offers a recipe version; that the offer is a read and the handler drafts nothing is a reading of this PBI, and this reading is reported to the owner. A recipe that is already Approved stays valid for the version it pins, also when that version is deprecated later, and a run that executes it is not interrupted, as the failure mode of the model states. `InvalidateDrafts` handles `BlueprintValidated` for a blueprint that a recipe is built on or pins: when the event announces another document hash than the recipe pins for that blueprint version, or `passed` false for it, a recipe in state Validated returns to Draft through `Changed` and must be validated again; a Draft stays Draft; an Approved, Executing, Generated or Superseded recipe is never touched, because an approved recipe is immutable. The purpose of `InvalidateDrafts` in the model is that a changed blueprint invalidates Draft recipes built on it, while the state table gives a Draft no transition and gives `Changed` to a Validated recipe alone; that the handler returns Validated recipes to Draft and leaves a Draft untouched is a reading of this PBI, and this reading is reported to the owner. Every row of the projection is kept under a tenant. Blueprint versions and design inputs are kept under the tenant and project of their event. Through I4 the catalog rows belong to the platform tenant only (D123): the payloads of the four catalog events name no tenant, `run-event-envelope-v1` requires the tenant id (ADR-0014 decision 1), and the envelope of every catalog event names the platform tenant. The three catalog projections, template versions, library versions and compatibility cells, keep each row under the tenant of the envelope of its event; every tenant reads the rows of the platform tenant, and a recipe binds catalog rows of the platform tenant and no other. Templates owned by a tenant are a later feature. The five tables are those the model lists on `generation-recipe-sql`, and this PBI migrates them. The projection holds ids, versions, hashes, states and results and no document content. Two facts reach the projection through no modelled event, and both are reported to the owner: no event announces that a library version became Published after it was discovered, since `LibraryVersionDiscovered` carries the catalog state at discovery and is the only library event, and no event announces that a template version was deprecated, since `TemplateVersionDiscovered` and `TemplateVersionPublished` are the only template events this service consumes, although the failure mode of the model names a deprecation heard through the catalog. The projection therefore holds the state last announced for a library version and keeps a template version as Published once it was announced; what the validator does with both is stated in AIFACTORY-US-685. BlueprintService publishes `BlueprintPublished` and TemplateRegistryService publishes `TemplateVersionPublished` only after AgentRegistryService publishes `AssetReleasePublished` for the version, which its publication path does from I2 (feature `agent-registry-service-publication`, D140). On a deployed instance of this increment the projections are therefore filled by the events those services publish today, `BlueprintSubmitted` after a submission and `TemplateVersionDiscovered` after a discovery, with rows in the states Submitted and Discovered, and drafting and validation work on them under the allowance. The two handlers of the Published events are complete here and proven on event fixtures under the run event envelope. Kind: behavior. Traces: services: GenerationRecipeService, BlueprintService, TemplateRegistryService, ArtifactService; aggregates: GenerationRecipeService/GenerationRecipe; events: BlueprintService/BlueprintSubmitted, BlueprintService/BlueprintPublished, BlueprintService/BlueprintValidated, ArtifactService/ArtifactStored, TemplateRegistryService/TemplateVersionDiscovered, TemplateRegistryService/TemplateVersionPublished, TemplateRegistryService/LibraryVersionDiscovered, TemplateRegistryService/CompatibilityChecked; descriptors: application-design-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0027. Depends on: AIFACTORY-US-680, feature:blueprint-service, feature:template-registry-service, feature:artifact-service. Sources: model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/TemplateRegistryService.yaml, model/services/knowledge/ArtifactService.yaml, docs/architecture/adr/0027-generation-input-contract.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given `BlueprintService/BlueprintSubmitted` and later `BlueprintService/BlueprintPublished` for a blueprint version, and `TemplateRegistryService/TemplateVersionDiscovered` and later `TemplateRegistryService/TemplateVersionPublished` for a template version, each under `run-event-envelope-v1`, when `TrackBindableBlueprints`, `OfferRecipe`, `TrackTemplates` and `OfferUpgrade` handle them, then `BindableBlueprintVersions` holds the blueprint version for its tenant and project with the state Submitted and then Published, `TemplateVersionProjections` holds the template version under the tenant of its envelope, the platform tenant, with the state Discovered and then Published, a second delivery of the same event id adds nothing, a Submitted or Discovered announcement that arrives after the Published one does not lower the state, and no recipe is drafted or changed by any of the four handlers, the offer of an upgrade being a read by the reading of `OfferUpgrade` that this PBI reports to the owner (ADR-0015, model/services/template-library/GenerationRecipeService.yaml).",
        "AC2: Given `BlueprintService/BlueprintValidated` with `passed` true for a Module, Database, Frontend or UX Blueprint version and `ArtifactService/ArtifactStored` with the descriptor `application-design-v1`, when `TrackDesignInputs` handles them, then each is recorded as a design input that may be pinned, by id, version and hash, and an event with `passed` false, of another kind or with another descriptor records none (ADR-0027).",
        "AC3: Given `TemplateRegistryService/LibraryVersionDiscovered` and `TemplateRegistryService/CompatibilityChecked`, when `TrackLibraries` and `RefreshEvidence` handle them, then `LibraryVersionProjections` holds the library version with its catalog state and `CompatibilityCellProjections` the compatibility cell with its result and entry id, each under the tenant of the envelope of its event, the platform tenant, a later event for the same library version or cell replaces the earlier value, and the projection holds no document content (ADR-0015, model/services/template-library/TemplateRegistryService.yaml).",
        "AC4: Given a `GenerationRecipeService/GenerationRecipe` in state Validated that pins a blueprint version by document hash, when `BlueprintService/BlueprintValidated` announces another hash or `passed` false for that blueprint version and `InvalidateDrafts` handles it, then the recipe returns to Draft through `Changed`; a Draft recipe stays Draft, and an Approved, Executing, Generated or Superseded recipe is not changed; that the handler acts on Validated recipes, while its purpose in the model names Draft recipes, is the reading this PBI reports to the owner (model/services/template-library/GenerationRecipeService.yaml).",
        "AC5: Given the rows of AC1 and AC3 before the evaluation gate of I4, when DraftRecipe, the PlanProposer, GetRecipe and the RecipeValidator read the projection through its one read port, then a blueprint version in the state Submitted and a template version in the state Discovered are offered as ones a recipe may bind, beside Published ones, as the Draft allowance of model/services/template-library/GenerationRecipeService.yaml states; a catalog row of the platform tenant is offered to every tenant, and a template version, a library version or a compatibility cell kept under another tenant than the platform tenant is offered to no caller and bound by no recipe (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2727",
        "AIFACTORY-TASK-2728",
        "AIFACTORY-TASK-2729",
        "AIFACTORY-TASK-2730"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8105,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService",
          "BlueprintService",
          "TemplateRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe"
        ],
        "events": [
          "BlueprintService/BlueprintSubmitted",
          "BlueprintService/BlueprintPublished",
          "BlueprintService/BlueprintValidated",
          "ArtifactService/ArtifactStored",
          "TemplateRegistryService/TemplateVersionDiscovered",
          "TemplateRegistryService/TemplateVersionPublished",
          "TemplateRegistryService/LibraryVersionDiscovered",
          "TemplateRegistryService/CompatibilityChecked"
        ],
        "descriptors": [
          "application-design-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0027"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-680",
        "feature:blueprint-service",
        "feature:template-registry-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-682]",
      "number": 682
    },
    {
      "id": "AIFACTORY-TASK-2727",
      "type": "task",
      "parent": "AIFACTORY-US-682",
      "title": "Projection tables of the pinnable inputs in generation-recipe-sql",
      "sequence": "15.02.05.01",
      "description": "Projection tables of the pinnable inputs in generation-recipe-sql. Expected output: Migrations and mappings create the five projection tables of model/services/template-library/GenerationRecipeService.yaml with the keys, columns and indexes it lists: BindableBlueprintVersions with the state Submitted or Published, ValidatedDesignInputs, TemplateVersionProjections with the state Discovered or Published, LibraryVersionProjections with the catalog state last announced, and CompatibilityCellProjections with the result and the entry id. Each holds ids, versions, hashes, states and results only, leads its key with the tenant and has the tenant row filter in its mapping: blueprint versions and design inputs under the tenant and project of their event, the three catalog tables under the tenant of the envelope of their event, the platform tenant through I4, with a filter that admits the platform tenant for reading. Mapping tests run against an isolated test database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Migrations and mappings create the five projection tables of model/services/template-library/GenerationRecipeService.yaml with the keys, columns and indexes it lists: BindableBlueprintVersions with the state Submitted or Published, ValidatedDesignInputs, TemplateVersionProjections with the state Discovered or Published, LibraryVersionProjections with the catalog state last announced, and CompatibilityCellProjections with the result and the entry id. Each holds ids, versions, hashes, states and results only, leads its key with the tenant and has the tenant row filter in its mapping: blueprint versions and design inputs under the tenant and project of their event, the three catalog tables under the tenant of the envelope of their event, the platform tenant through I4, with a filter that admits the platform tenant for reading. Mapping tests run against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8105,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-2727]",
      "number": 2727
    },
    {
      "id": "AIFACTORY-TASK-2728",
      "type": "task",
      "parent": "AIFACTORY-US-682",
      "title": "Inbox handlers TrackBindableBlueprints, OfferRecipe, TrackDesignInputs, TrackTemplates, OfferUpgrade, TrackLibraries, RefreshEvidence and InvalidateDrafts",
      "sequence": "15.02.05.02",
      "description": "Inbox handlers TrackBindableBlueprints, OfferRecipe, TrackDesignInputs, TrackTemplates, OfferUpgrade, TrackLibraries, RefreshEvidence and InvalidateDrafts. Expected output: The eight handlers keep the projection from BlueprintSubmitted, BlueprintPublished, BlueprintValidated, ArtifactStored, TemplateVersionDiscovered, TemplateVersionPublished, LibraryVersionDiscovered and CompatibilityChecked, idempotently on the event id, and write every row under the tenant of the envelope of its event, the catalog rows included; a blueprint version keeps the state Submitted or Published and a template version the state Discovered or Published, and a later Submitted or Discovered announcement never lowers a Published row; one read port of the projection serves the later PBIs, returns the blueprint versions and design inputs of the tenant and project of the caller and, for the three catalog tables, the rows of the platform tenant, and applies the Draft allowance in one place: until I4 it offers Submitted blueprint versions and Discovered template versions beside Published ones as rows a recipe may bind; InvalidateDrafts returns a Validated recipe to Draft through Changed when BlueprintValidated announces another document hash or a failed verdict for a blueprint version the recipe pins, and never touches a recipe that is Approved or later.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The eight handlers keep the projection from BlueprintSubmitted, BlueprintPublished, BlueprintValidated, ArtifactStored, TemplateVersionDiscovered, TemplateVersionPublished, LibraryVersionDiscovered and CompatibilityChecked, idempotently on the event id, and write every row under the tenant of the envelope of its event, the catalog rows included; a blueprint version keeps the state Submitted or Published and a template version the state Discovered or Published, and a later Submitted or Discovered announcement never lowers a Published row; one read port of the projection serves the later PBIs, returns the blueprint versions and design inputs of the tenant and project of the caller and, for the three catalog tables, the rows of the platform tenant, and applies the Draft allowance in one place: until I4 it offers Submitted blueprint versions and Discovered template versions beside Published ones as rows a recipe may bind; InvalidateDrafts returns a Validated recipe to Draft through Changed when BlueprintValidated announces another document hash or a failed verdict for a blueprint version the recipe pins, and never touches a recipe that is Approved or later."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8105,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2728]",
      "number": 2728
    },
    {
      "id": "AIFACTORY-TASK-2729",
      "type": "task",
      "parent": "AIFACTORY-US-682",
      "title": "Event fixtures of the catalog, blueprint and artifact events the projection is built from",
      "sequence": "15.02.05.03",
      "description": "Event fixtures of the catalog, blueprint and artifact events the projection is built from. Expected output: The acceptance suite builds the eight consumed events from the payloads of model/services/template-library/BlueprintService.yaml, model/services/template-library/TemplateRegistryService.yaml and model/services/knowledge/ArtifactService.yaml under the run event envelope of the pinned contracts package and delivers them once and twice under one event id and in both orders of the Submitted and Published, and of the Discovered and Published, announcement; BlueprintSubmitted, TemplateVersionDiscovered, LibraryVersionDiscovered and CompatibilityChecked are built as BlueprintService and TemplateRegistryService publish them in this increment, with the platform tenant in the envelope of the catalog events, and BlueprintPublished and TemplateVersionPublished are fixtures of events that no service publishes before the publication path of AgentRegistryService arrives in I2 (D140); a two-tenant catalog case delivers one template version, one library version and one compatibility cell under the platform tenant and one of each under the envelope of the second tenant, so that the visibility of catalog rows can be proven for a recipe of the first tenant.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The acceptance suite builds the eight consumed events from the payloads of model/services/template-library/BlueprintService.yaml, model/services/template-library/TemplateRegistryService.yaml and model/services/knowledge/ArtifactService.yaml under the run event envelope of the pinned contracts package and delivers them once and twice under one event id and in both orders of the Submitted and Published, and of the Discovered and Published, announcement; BlueprintSubmitted, TemplateVersionDiscovered, LibraryVersionDiscovered and CompatibilityChecked are built as BlueprintService and TemplateRegistryService publish them in this increment, with the platform tenant in the envelope of the catalog events, and BlueprintPublished and TemplateVersionPublished are fixtures of events that no service publishes before the publication path of AgentRegistryService arrives in I2 (D140); a two-tenant catalog case delivers one template version, one library version and one compatibility cell under the platform tenant and one of each under the envelope of the second tenant, so that the visibility of catalog rows can be proven for a recipe of the first tenant."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8105,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2729]",
      "number": 2729
    },
    {
      "id": "AIFACTORY-TASK-2730",
      "type": "task",
      "parent": "AIFACTORY-US-682",
      "title": "Verify track-pinnable-generation-inputs through the acceptance suite",
      "sequence": "15.02.05.04",
      "description": "Verify track-pinnable-generation-inputs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=track-pinnable-generation-inputs\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-682 on the events of AIFACTORY-TASK-2729: every handler records its input once per event id, an event that does not qualify records nothing, a blueprint version goes from Submitted to Published and a template version from Discovered to Published and neither state is lowered by a late announcement, and a Validated recipe returns to Draft on a changed blueprint while an Approved one does not; the read port of the projection, the one port through which DraftRecipe, the PlanProposer, GetRecipe and the RecipeValidator see what a recipe may bind, offers a Submitted blueprint version and a Discovered template version under the Draft allowance, and on the two-tenant catalog case it returns to the first tenant the rows of the platform tenant and none of the rows delivered under the second tenant; the suites of AIFACTORY-US-683 to AIFACTORY-US-685 repeat the case through each of those callers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=track-pinnable-generation-inputs\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-682 on the events of AIFACTORY-TASK-2729: every handler records its input once per event id, an event that does not qualify records nothing, a blueprint version goes from Submitted to Published and a template version from Discovered to Published and neither state is lowered by a late announcement, and a Validated recipe returns to Draft on a changed blueprint while an Approved one does not; the read port of the projection, the one port through which DraftRecipe, the PlanProposer, GetRecipe and the RecipeValidator see what a recipe may bind, offers a Submitted blueprint version and a Discovered template version under the Draft allowance, and on the two-tenant catalog case it returns to the first tenant the rows of the platform tenant and none of the rows delivered under the second tenant; the suites of AIFACTORY-US-683 to AIFACTORY-US-685 repeat the case through each of those callers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2730]",
      "number": 2730
    },
    {
      "id": "AIFACTORY-US-683",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Propose a module plan from the derived context map and domain model, and draft a recipe from a blueprint version a recipe may bind",
      "sequence": "15.02.06",
      "description": "As a requester, I want a module plan proposed from the derived models of my blueprint and a Draft recipe I can adjust, so that I start from one module per bounded context with a template version and do not assemble the plan by hand. When BlueprintService announces `ContextMapDerived`, the inbox handler `ProposeModulePlan` triggers the `PlanProposer`, once per blueprint id and blueprint version. The worker reads the context map and the domain models of that version through `Blueprints.GetDerivedModel` of BlueprintService with its workload token and proposes a module plan: one microservice per bounded context, a gateway, a shell and microfrontends per UI blueprint and a library per shared kernel, each entry with a module kind, the context it serves, a template version a recipe may bind from `TemplateVersionProjections` (AIFACTORY-US-682), the default switches, the path and the pins of the design inputs its kind needs where a validated version is known. `DomainModelDerived` adds the parameters of the module of its context to the proposal. The template versions the worker may use are those of the platform tenant, which every tenant reads: Published versions and, until the evaluation gate of AgentRegistryService is delivered in I4, versions the catalog has discovered that are not yet Published (D123). For a context for whose module kind no such template version is known, the worker invents no template: the proposal keeps the entry with its kind, context, parameters and path and without a template, marked as unresolved, and a draft taken from such a proposal is refused until the caller sends a plan whose entries name a template. On a deployed instance of this increment TemplateRegistryService announces the versions it discovers, so the proposal names them under the Draft allowance and does not wait for the gate. The proposal is not a recipe. It is kept per blueprint version in the table `PlanProposals` of the model (D123), with tenant, blueprint id, blueprint version, project and the entries, so that `DraftRecipe` on any replica of the service takes it; this PBI migrates the table in `generation-recipe-sql` under the tenant row filter. The model has the proposer name modules through the model profile of `Templates:Recipes:ProposerProfile` and lists ModelRouterService as an optional dependency that degrades. A model invocation of ModelRouterService needs the route plan of a run, and a proposal runs outside a run, so in this delivery the worker derives every name from the context ids by a fixed rule and calls no model, which is the degraded mode; the option is bound and validated, and how a call outside a run is routed is reported to the owner. BlueprintService is a required dependency that fails fast: when it does not answer, the execution fails, is tried once more after 60 s and is then left to the failed work of the inbox, and no partial proposal is kept. A Requester or an Asset maintainer whose forwarded user token carries `factory.recipes.write` drafts a recipe through `DraftRecipe` with an `Idempotency-Key`. The scope summary of the model also names agents under a run, but no tool is modelled for this operation, so only a user token calls it in this delivery. The body names the project in the required member `projectId`, the blueprint id and version, and may carry the module plan, the library versions and the repository layout as the caller adjusted them; without a plan in the body the proposal is taken. A call without `projectId` is answered 400; the gateway checks the named project against the roles of the token and answers 403 for a project the token does not grant, and the service compares the member with the project of the trusted scope it receives and answers 403 when the two differ (D123). The service knows a blueprint only through its projection, so one rule answers the precondition: a blueprint id and version that `BindableBlueprintVersions` does not hold for the trusted tenant and project is answered 412, whether it is unknown, belongs to another project or tenant or was not yet submitted, and the answer never says which (ADR-0015 amendment D113). Until the evaluation gate of I4 a version in the state Submitted is bound under the Draft allowance beside a Published one; from I4 the 412 answers every version that is not Published (D123). The recipe records in `draftAllowanceUsed` whether the allowance was used: the member is true when the bound blueprint version is Submitted or a module entry names a template version in the state Discovered, and false when every bound version is Published. The service writes the `GenerationRecipe` in state Draft with its module entries, and a body that names an existing recipe id of the project drafts the next version of that recipe. The model gives no operation that edits a Draft or Validated recipe, although the summary of the endpoint says that people or agents adjust the plan and the state table returns a Validated recipe to Draft on `Changed`. In this delivery an adjustment is therefore a new POST that drafts the next version, and `Changed` is raised by no REST operation, only by the handler `InvalidateDrafts` of AIFACTORY-US-682; both are readings reported to the owner. The answer is 201 with the recipe id and version. The model names no result event for the command, so no integration event of the service is published; `connectsoft.factory.recipes` counts the Draft. The command still leaves evidence, because every command of the first outcome belongs in the audit trail: the Factory sink of the audit library, consumed by a version pin from feature `component-audit-factory-evidence`, writes one `audit-evidence-v1` record with the actor, the recipe id and the version to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` under the run event envelope; a rolled back command leaves none and an idempotent repeat writes no second one. A repeated call with the same key and the same body returns the same recipe. The same key with another body is a conflict by ADR-0014 decision 3 and is answered 409 (D123). 422 is kept for the body: a module entry with an unknown module kind or without a template, an entry that a proposal left without a template, a recipe id that the project of the trusted scope does not hold, and a call without a plan in the body when no proposal exists for the blueprint version, because the `PlanProposer` failed twice or `ContextMapDerived` has not arrived, which is refused with 422 that names the missing plan. Nothing is written in any of these cases. A missing scope is 403. The project of the recipe is the project the caller names in `projectId`, which is the project of the trusted scope. The service decides no approval and repeats no write on its own. Kind: behavior. Traces: services: GenerationRecipeService, BlueprintService; aggregates: GenerationRecipeService/GenerationRecipe; apis: GenerationRecipeService/DraftRecipe, BlueprintService/Blueprints.GetDerivedModel; events: BlueprintService/ContextMapDerived, BlueprintService/DomainModelDerived; descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0027; requirements: FR-03; scenarios: SCN-GenerationRecipeService-003. Depends on: AIFACTORY-US-681, AIFACTORY-US-682, feature:blueprint-service, feature:component-audit-factory-evidence. Sources: model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/BlueprintService.yaml, model/model-profiles.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given `BlueprintService/ContextMapDerived` and `BlueprintService/DomainModelDerived` for a blueprint version with two bounded contexts, when the `PlanProposer` runs, then it reads the derived models through `BlueprintService/Blueprints.GetDerivedModel` and keeps one proposal for that blueprint version in the table `PlanProposals`, under the tenant and project of the event, with one microservice entry per context, each with a template version of the platform tenant that a recipe may bind, Published or, under the Draft allowance until I4, Discovered, its switches, parameters and path; a context for whose module kind no such template version is known yields an entry without a template, marked as unresolved, and never an invented one, and a draft taken from that proposal is refused as AC3 states; a second trigger for the same blueprint id and blueprint version has no second effect, and no model is called (model/services/template-library/GenerationRecipeService.yaml).",
        "AC2: Given a caller with `factory.recipes.write` and a blueprint version of the project of the trusted scope that `BindableBlueprintVersions` holds as Submitted or as Published, when `GenerationRecipeService/DraftRecipe` is called with the `projectId` of that project and an `Idempotency-Key`, then a `GenerationRecipeService/GenerationRecipe` is written in state Draft with the module entries of the proposal or of the body, `draftAllowanceUsed` is true when the blueprint version is Submitted or a module entry names a Discovered template version and false when every bound version is Published, the response is 201 with recipe id and version, no integration event of the service is published, and one `audit-evidence-v1` record with the actor, the recipe id and the version is in the outbox, written in the transaction of the command on the topic audit.evidence.v1.evidence-submitted under `run-event-envelope-v1`; a command that is rolled back leaves no record (SCN-GenerationRecipeService-003).",
        "AC3: Given the same call repeated with the same key, the same key with another body, a body without `projectId`, a `projectId` that differs from the project of the trusted scope, a blueprint id and version that `BindableBlueprintVersions` does not hold for the trusted tenant and project, a module entry with an unknown kind or without a template, a proposal whose entry was left without a template, no plan in the body while no proposal exists for the blueprint version, or a caller without `factory.recipes.write`, when it arrives at `GenerationRecipeService/DraftRecipe`, then the repeat returns the same recipe, creates none and writes no second evidence record; the reused key, a conflict by ADR-0014 decision 3, is answered 409; the missing `projectId` is answered 400 and the differing one 403; the blueprint version is answered 412 whether it is unknown, belongs to another project or tenant or was not yet submitted, and the answer never says which; the entries are refused with 422 that names the module, and the missing plan with 422 that names it; the missing scope is answered 403; each refusal carries a problem response and writes no recipe and no evidence record (SCN-GenerationRecipeService-003, ADR-0015).",
        "AC4: Given a body that names an existing recipe id of the project, when `GenerationRecipeService/DraftRecipe` is called, then the next version of that recipe is written in state Draft and the earlier versions are unchanged, which is how a plan is adjusted in this delivery, because the model gives no operation that edits a Draft or Validated recipe, a reading reported to the owner; a recipe id that the project of the trusted scope does not hold is refused with 422; and given BlueprintService does not answer the `PlanProposer`, then the execution is tried twice 60 s apart, keeps no partial proposal and leaves `GenerationRecipeService/DraftRecipe` working with a plan in the body (SCN-GenerationRecipeService-003)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/model-profiles.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-215",
        "AIFACTORY-TASK-2746",
        "AIFACTORY-TASK-2731",
        "AIFACTORY-TASK-2732",
        "AIFACTORY-TASK-2733"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8106,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService",
          "BlueprintService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe"
        ],
        "apis": [
          "GenerationRecipeService/DraftRecipe",
          "BlueprintService/Blueprints.GetDerivedModel"
        ],
        "events": [
          "BlueprintService/ContextMapDerived",
          "BlueprintService/DomainModelDerived"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0027"
        ],
        "requirements": [
          "FR-03"
        ],
        "scenarios": [
          "SCN-GenerationRecipeService-003"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-681",
        "AIFACTORY-US-682",
        "feature:blueprint-service",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/model-profiles.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-683]",
      "number": 683
    },
    {
      "id": "AIFACTORY-TASK-215",
      "type": "task",
      "parent": "AIFACTORY-US-683",
      "title": "Module plan proposal and pinned design inputs",
      "sequence": "15.02.06.01",
      "description": "Module plan proposal and pinned design inputs. Expected output: The ProposeModulePlan handler triggers the PlanProposer once per blueprint id and blueprint version; the worker reads the derived models through Blueprints.GetDerivedModel and writes one row of the table PlanProposals of AIFACTORY-TASK-2746 per blueprint version, whose module entries carry kind, context, a template version of the platform tenant that a recipe may bind, Published or until I4 Discovered, switches, parameters, path and the pins of their design inputs by id, version and hash where a validated version is known; an entry for whose module kind no such template version is known is kept without a template and marked unresolved, never with an invented one; names come from the context ids by a fixed rule and no model is called; a failed read is tried twice 60 s apart and keeps no partial proposal.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The ProposeModulePlan handler triggers the PlanProposer once per blueprint id and blueprint version; the worker reads the derived models through Blueprints.GetDerivedModel and writes one row of the table PlanProposals of AIFACTORY-TASK-2746 per blueprint version, whose module entries carry kind, context, a template version of the platform tenant that a recipe may bind, Published or until I4 Discovered, switches, parameters, path and the pins of their design inputs by id, version and hash where a validated version is known; an entry for whose module kind no such template version is known is kept without a template and marked unresolved, never with an invented one; names come from the context ids by a fixed rule and no model is called; a failed read is tried twice 60 s apart and keeps no partial proposal."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-215]",
      "number": 215
    },
    {
      "id": "AIFACTORY-TASK-2746",
      "type": "task",
      "parent": "AIFACTORY-US-683",
      "title": "Table PlanProposals of the module plan in generation-recipe-sql",
      "sequence": "15.02.06.02",
      "description": "Table PlanProposals of the module plan in generation-recipe-sql. Expected output: A migration and a mapping create the table PlanProposals of model/services/template-library/GenerationRecipeService.yaml in generation-recipe-sql: the key of tenant, blueprint id and blueprint version, the project, the proposed entries and the time of the proposal, with the tenant row filter in the mapping, so that DraftRecipe on any replica reads the proposal the PlanProposer wrote; mapping tests run against an isolated test database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "A migration and a mapping create the table PlanProposals of model/services/template-library/GenerationRecipeService.yaml in generation-recipe-sql: the key of tenant, blueprint id and blueprint version, the project, the proposed entries and the time of the proposal, with the tenant row filter in the mapping, so that DraftRecipe on any replica reads the proposal the PlanProposer wrote; mapping tests run against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8106,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-2746]",
      "number": 2746
    },
    {
      "id": "AIFACTORY-TASK-2731",
      "type": "task",
      "parent": "AIFACTORY-US-683",
      "title": "DraftRecipe with idempotency, the bindable blueprint precondition, the Draft allowance and versioned drafts",
      "sequence": "15.02.06.03",
      "description": "DraftRecipe with idempotency, the bindable blueprint precondition, the Draft allowance and versioned drafts. Expected output: DraftRecipe requires the body member projectId, answers 400 without it and 403 when it differs from the project of the trusted scope, requires the blueprint id and version to be held by BindableBlueprintVersions for the trusted tenant and project, as Submitted under the Draft allowance until I4 or as Published, and answers 412 otherwise, the same answer for an unknown, a foreign and a not yet submitted blueprint version, writes the Draft GenerationRecipe with the module entries of the proposal or of the body, sets draftAllowanceUsed when the blueprint version is Submitted or a module entry names a Discovered template version, writes the next version when the body names an existing recipe of the project, and answers 201; in the transaction of the command it writes one audit-evidence-v1 record with the actor, the recipe id and the version through the Factory sink of the pinned audit library to the outbox, on the topic audit.evidence.v1.evidence-submitted; it refuses with 422 an unknown module kind, an entry without a template, a recipe id the project does not hold and a missing plan when no proposal exists, and with 409 the reused key with another body; the idempotent repeat and the 400, 403, 409, 412 and 422 refusals are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "DraftRecipe requires the body member projectId, answers 400 without it and 403 when it differs from the project of the trusted scope, requires the blueprint id and version to be held by BindableBlueprintVersions for the trusted tenant and project, as Submitted under the Draft allowance until I4 or as Published, and answers 412 otherwise, the same answer for an unknown, a foreign and a not yet submitted blueprint version, writes the Draft GenerationRecipe with the module entries of the proposal or of the body, sets draftAllowanceUsed when the blueprint version is Submitted or a module entry names a Discovered template version, writes the next version when the body names an existing recipe of the project, and answers 201; in the transaction of the command it writes one audit-evidence-v1 record with the actor, the recipe id and the version through the Factory sink of the pinned audit library to the outbox, on the topic audit.evidence.v1.evidence-submitted; it refuses with 422 an unknown module kind, an entry without a template, a recipe id the project does not hold and a missing plan when no proposal exists, and with 409 the reused key with another body; the idempotent repeat and the 400, 403, 409, 412 and 422 refusals are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8106,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2731]",
      "number": 2731
    },
    {
      "id": "AIFACTORY-TASK-2732",
      "type": "task",
      "parent": "AIFACTORY-US-683",
      "title": "Contract of the draft body and of the recipe view",
      "sequence": "15.02.06.04",
      "description": "Contract of the draft body and of the recipe view. Expected output: The OpenAPI document of the service defines the body of DraftRecipe (the required projectId, blueprint id and version, optional recipe id, module entries with kind, context, template id and version, switches, parameters, path and design input pins, library versions, repository layout) and the recipe view that GetRecipe returns, with the fields of the GenerationRecipe aggregate and the ModulePlanEntry entity of model/services/template-library/GenerationRecipeService.yaml.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The OpenAPI document of the service defines the body of DraftRecipe (the required projectId, blueprint id and version, optional recipe id, module entries with kind, context, template id and version, switches, parameters, path and design input pins, library versions, repository layout) and the recipe view that GetRecipe returns, with the fields of the GenerationRecipe aggregate and the ModulePlanEntry entity of model/services/template-library/GenerationRecipeService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8106,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2732]",
      "number": 2732
    },
    {
      "id": "AIFACTORY-TASK-2733",
      "type": "task",
      "parent": "AIFACTORY-US-683",
      "title": "Verify propose-a-module-plan-and-draft-a-recipe through the acceptance suite",
      "sequence": "15.02.06.05",
      "description": "Verify propose-a-module-plan-and-draft-a-recipe through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-GenerationRecipeService-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-683 with a fake of Blueprints.GetDerivedModel: the proposal per blueprint version read from PlanProposals by a second instance of the service, the proposal and the draft on a Submitted blueprint version and a Discovered template version with draftAllowanceUsed true, the same on Published versions with draftAllowanceUsed false, the entry left without a template when no template version a recipe may bind is known, the draft from the proposal and from an adjusted body, the next version of an existing recipe, the idempotent repeat, the 400 without projectId and the 403 for a projectId other than the project of the trusted scope, the 412 that is the same for an unknown, a foreign and a not yet submitted blueprint version, the 422 for the missing plan and for the entry without a template, the 409 for the reused key, and the 403 for the missing scope; they read the outbox and find one audit-evidence-v1 record with the actor, the recipe id and the version per drafted recipe and none after a repeat, a refusal or a rolled back command; and on the two-tenant catalog case of AIFACTORY-TASK-2729 the proposal and the draft of the first tenant use no template version delivered under the second tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-GenerationRecipeService-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-683 with a fake of Blueprints.GetDerivedModel: the proposal per blueprint version read from PlanProposals by a second instance of the service, the proposal and the draft on a Submitted blueprint version and a Discovered template version with draftAllowanceUsed true, the same on Published versions with draftAllowanceUsed false, the entry left without a template when no template version a recipe may bind is known, the draft from the proposal and from an adjusted body, the next version of an existing recipe, the idempotent repeat, the 400 without projectId and the 403 for a projectId other than the project of the trusted scope, the 412 that is the same for an unknown, a foreign and a not yet submitted blueprint version, the 422 for the missing plan and for the entry without a template, the 409 for the reused key, and the 403 for the missing scope; they read the outbox and find one audit-evidence-v1 record with the actor, the recipe id and the version per drafted recipe and none after a repeat, a refusal or a rolled back command; and on the two-tenant catalog case of AIFACTORY-TASK-2729 the proposal and the draft of the first tenant use no template version delivered under the second tenant."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2733]",
      "number": 2733
    },
    {
      "id": "AIFACTORY-US-684",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Read the recipes of a project with their versions and states, and one recipe with its module plan, pins, layout and compatibility evidence",
      "sequence": "15.02.07",
      "description": "As an asset maintainer, I want to read a recipe with every module, every pinned version and the evidence it was validated against, so that I approve exactly what I have seen. A caller whose forwarded user token carries `factory.recipes.read` reads the recipes of a project. `ListRecipes` takes the required query parameter `projectId` (D123) and returns the recipes of that project with their versions and states. A call without the parameter is answered 400; the gateway checks the named project against the roles of the token and answers 403 for a project the token does not grant, and the service compares the parameter with the project of the trusted scope it receives and answers 403 when the two differ. `GetRecipe` returns one version addressed by recipe id and version: the blueprint version it is built on, the module plan with the kind, context, template id and version, switches, parameters and path of each module, the design inputs each module pins by id, version and hash, the library versions, the repository layout, the compatibility evidence the recipe was validated against, the state, the approver and `draftAllowanceUsed`, so that the approver sees whether the recipe binds a Submitted blueprint version or a discovered template version under the Draft allowance. For a module that pins a template version for which a newer Published version is known among the catalog rows of the platform tenant, the answer names that newer version as available, which is how an upgrade is offered (AIFACTORY-US-682); a version kept under another tenant than the platform tenant is never named. Both reads run under the tenant row filter. A caller without the scope is refused with 403; a recipe id or version that does not exist and a recipe of another tenant are both answered 404 by `GetRecipe`, which never confirms that a foreign recipe exists (ADR-0015 amendment D113); `ListRecipes` has no not-found answer and never contains a row of another tenant or of a project outside the trusted scope. Nothing is written and nothing is published by a read. The views of the Studio are built by StudioBff in its own increment on these operations, and the command-line client prints a recipe from `GetRecipe` (AIFACTORY-US-013); a person reaches the reads through the gateway TemplateCatalogHost, which is delivered in this increment, and the client through the typed client of that gateway (D123). Kind: behavior. Traces: services: GenerationRecipeService; aggregates: GenerationRecipeService/GenerationRecipe; apis: GenerationRecipeService/ListRecipes, GenerationRecipeService/GetRecipe; adrs: ADR-0015, ADR-0027; requirements: FUX-01; scenarios: SCN-GenerationRecipeService-001, SCN-GenerationRecipeService-002. Depends on: AIFACTORY-US-681, AIFACTORY-US-683. Sources: model/services/template-library/GenerationRecipeService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.recipes.read` and recipes of several states in the project of the trusted scope, when `GenerationRecipeService/ListRecipes` is called with the `projectId` of that project, then the response is 200 with the recipes of that project, each with its versions and their states, and nothing of another project or tenant (SCN-GenerationRecipeService-001).",
        "AC2: Given a `GenerationRecipeService/GenerationRecipe` of the tenant and project of the caller, when `GenerationRecipeService/GetRecipe` is called, then the response is 200 with the blueprint version, the module plan with kind, context, template id and version, switches, parameters and path of each module, the design inputs each module pins by id, version and hash, the library versions, the repository layout, the compatibility evidence, the state, the approver and `draftAllowanceUsed`, and a module that pins a template version for which a newer Published version is known in the catalog rows of the platform tenant names that version as available (SCN-GenerationRecipeService-002, ADR-0027).",
        "AC3: Given a caller without `factory.recipes.read`, a call of `GenerationRecipeService/ListRecipes` without `projectId` or with a `projectId` that differs from the project of the trusted scope, a recipe id or version that does not exist, or a recipe of another tenant, when either read is called, then the response is 403 for the missing scope, 400 for the missing `projectId`, 403 for the differing one and, on `GenerationRecipeService/GetRecipe`, 404 for the unknown and for the foreign recipe alike, each with a problem response, and nothing is written by any read (SCN-GenerationRecipeService-001, SCN-GenerationRecipeService-002, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2734",
        "AIFACTORY-TASK-2735"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8107,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe"
        ],
        "apis": [
          "GenerationRecipeService/ListRecipes",
          "GenerationRecipeService/GetRecipe"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0027"
        ],
        "requirements": [
          "FUX-01"
        ],
        "scenarios": [
          "SCN-GenerationRecipeService-001",
          "SCN-GenerationRecipeService-002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-681",
        "AIFACTORY-US-683"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-684]",
      "number": 684
    },
    {
      "id": "AIFACTORY-TASK-2734",
      "type": "task",
      "parent": "AIFACTORY-US-684",
      "title": "ListRecipes and GetRecipe over the recipes of the trusted project under the tenant filter",
      "sequence": "15.02.07.01",
      "description": "ListRecipes and GetRecipe over the recipes of the trusted project under the tenant filter. Expected output: ListRecipes requires the query parameter projectId, answers 400 without it and 403 when it differs from the project of the trusted scope, and returns the recipes of that project with versions and states, and GetRecipe returns one version with its module plan, pins, libraries, layout, compatibility evidence, state, approver and draftAllowanceUsed and names a newer Published template version as available where the projection knows one; both apply the tenant row filter, a recipe of another tenant is answered 404 like an unknown one and a missing scope 403 (ADR-0015).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "ListRecipes requires the query parameter projectId, answers 400 without it and 403 when it differs from the project of the trusted scope, and returns the recipes of that project with versions and states, and GetRecipe returns one version with its module plan, pins, libraries, layout, compatibility evidence, state, approver and draftAllowanceUsed and names a newer Published template version as available where the projection knows one; both apply the tenant row filter, a recipe of another tenant is answered 404 like an unknown one and a missing scope 403 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8107,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2734]",
      "number": 2734
    },
    {
      "id": "AIFACTORY-TASK-2735",
      "type": "task",
      "parent": "AIFACTORY-US-684",
      "title": "Verify read-recipes through the acceptance suite",
      "sequence": "15.02.07.02",
      "description": "Verify read-recipes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-001|Scenario=SCN-GenerationRecipeService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-684 on the two-tenant fixture, the 400 for a list without projectId, the 403 for a projectId other than the project of the trusted scope, the 404 for a foreign recipe, draftAllowanceUsed in the recipe view and the newer template version shown as available among them.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-001|Scenario=SCN-GenerationRecipeService-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC3 of AIFACTORY-US-684 on the two-tenant fixture, the 400 for a list without projectId, the 403 for a projectId other than the project of the trusted scope, the 404 for a foreign recipe, draftAllowanceUsed in the recipe view and the newer template version shown as available among them."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8107,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2735]",
      "number": 2735
    },
    {
      "id": "AIFACTORY-US-685",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Validate a recipe against template manifests, switches, the compatibility matrix and its pinned design inputs, and announce the verdict",
      "sequence": "15.02.08",
      "description": "As an asset maintainer, I want a recipe to be Validated only when every template, library and pinned design input holds, so that a generation run never starts on a plan that cannot be scaffolded or on a design nobody validated. A Requester or an Asset maintainer whose forwarded user token carries `factory.recipes.write` validates a recipe version of the tenant and project of the caller through `ValidateRecipe`. The scope summary of the model also names agents under a run, but no tool is modelled for this operation, so only a user token calls it in this delivery. The call runs the `RecipeValidator` for that version and answers 200 with the result when it ends. Every catalog row the validator reads is a row of the platform tenant (AIFACTORY-US-682, D123). The validator first checks the blueprint version the recipe is built on against `BindableBlueprintVersions`: a Published version passes, and until the evaluation gate of AgentRegistryService is delivered in I4 a Submitted version passes under the Draft allowance; a version the projection does not hold fails with a reason of its own. It then checks every module entry: the template version must be one a recipe may bind in `TemplateVersionProjections`, Published or until I4 Discovered under the same allowance, its pinned manifest is read through `Catalog.ResolveManifest` of TemplateRegistryService, which until I4 serves the manifest of a version the catalog has discovered that is not yet Published, the switches the module sets must be declared by that manifest and must accept the parameters of the module, and the path must not collide with another module. From I4 only Published versions pass both checks. In the transaction of the result the recipe keeps in `draftAllowanceUsed` whether the allowance was used: true when the blueprint version is Submitted, a module names a template version that is not yet Published or, until I4, a library passed with a cell that is Unknown, false when every bound version is Published and every library cell is Compatible or CompatibleWithWarnings. No modelled event tells this service that a template version was deprecated, so the projection keeps a version as Published once it was announced. The reply of `Catalog.ResolveManifest`, as feature `template-registry-service` delivers it, names the state of the version: when it names the state Deprecated or Retired, and from I4 every state other than Published, the template rule fails with a reason of its own. That the reply carries the state is an open point of that feature, and the missing event is reported to the owner. The validator checks every pinned library against the invariant that a library is Published and Compatible with every template that consumes it, with evidence. The state of a library version is the one last announced by `LibraryVersionDiscovered`, because no modelled event announces that a library version became Published later; a library whose last announced state is not Published, and a library the projection does not hold, each fail with a reason of their own, and the gap is reported to the owner. The compatibility of a library with a template is the result of the cell of the projection, one of the four values of `Compatibility`: Compatible passes and the entry id of the cell becomes compatibility evidence of the recipe; Incompatible fails; a missing cell fails as missing evidence; each failure has a reason of its own. Unknown is decided by the Draft allowance, which decision D125 extends to libraries: until I4 a cell that is Unknown passes with a finding of severity warning that names the library and the template, and the recipe keeps in `draftAllowanceUsed` that the allowance was used; from I4 a library must be Compatible, and a cell that is Unknown fails with a reason of its own. CompatibleWithWarnings passes in this delivery: the entry id is kept as evidence together with its result, and the result of the validation lists the library as a warning that the approver reads with the recipe. The invariant names Compatible alone, so this outcome is a reading reported to the owner. It checks every design input (ADR-0027, D67): a backend module pins a Module Blueprint and an application design; a module with persistence also pins a Database Blueprint and the domain model; a shell or microfrontend pins a Frontend Blueprint and a UX Blueprint; each pin names id, version and hash and must resolve to a validated version in the projection of AIFACTORY-US-682 with that hash. A domain model pin is resolved through `Blueprints.GetDerivedModel` of BlueprintService. The result lists one failure per broken rule with its reason and names the module and the pin or library; `connectsoft.factory.recipes.validation_failures` counts each by reason. In the transaction of the result a recipe that holds every rule moves from Draft to Validated through `PlanValidated` and keeps its evidence, and a recipe that breaks one stays Draft; `RecipeValidated` with `passed` true or false and the number of modules is written to the outbox in that transaction and published under the run event envelope. That event is also the audit evidence of the validation: it is the event AuditService consumes, and no separate evidence record is written. Validation is idempotent on recipe id, version and the hash of the recipe content: a repeated call for an unchanged recipe returns the same result and publishes nothing again. A caller without the scope is refused with 403; an unknown recipe and a recipe of another tenant are answered 404 alike; a recipe that is Approved, Executing, Generated or Superseded is refused with 422, because it is immutable. TemplateRegistryService and BlueprintService are required dependencies that fail fast: when one does not answer, the validator makes its second attempt after 30 s and the call then ends with 503 and a problem response, the recipe stays Draft and nothing is published (D123). The service repeats no write of a caller. On a deployed instance of this increment no blueprint or template version is Published before the gate of I4: a validation there passes on a Submitted blueprint version and on discovered template versions under the Draft allowance, the recipe records that the allowance was used, and the chain reaches an approved recipe without the gate. Kind: behavior. Traces: services: GenerationRecipeService, TemplateRegistryService, BlueprintService; aggregates: GenerationRecipeService/GenerationRecipe; apis: GenerationRecipeService/ValidateRecipe, TemplateRegistryService/Catalog.ResolveManifest, BlueprintService/Blueprints.GetDerivedModel; events: GenerationRecipeService/RecipeValidated; adrs: ADR-0012, ADR-0015, ADR-0027; requirements: NFR-13; scenarios: SCN-GenerationRecipeService-004, SCN-GenerationRecipeService-009. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-682, AIFACTORY-US-683, feature:template-registry-service, feature:blueprint-service. Sources: model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/TemplateRegistryService.yaml, docs/architecture/adr/0027-generation-input-contract.md, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.recipes.write` and a Draft `GenerationRecipeService/GenerationRecipe` of the tenant and project of the caller whose blueprint version is Published or, under the Draft allowance until I4, Submitted, and in which every module names a template version that is Published or, under the same allowance, Discovered, whose manifest, read through `TemplateRegistryService/Catalog.ResolveManifest`, declares its switches and accepts its parameters, every library is Published by the state last announced for it and has, with every template that consumes it, a compatibility cell whose result is Compatible or CompatibleWithWarnings, and every design input its kind needs is pinned by id, version and hash and resolves to a validated version, when `GenerationRecipeService/ValidateRecipe` is called, then the recipe moves from Draft to Validated through `PlanValidated`, `draftAllowanceUsed` is true exactly when a Submitted blueprint version or a template version that is not yet Published is bound or a library cell is Unknown, which passes until I4 with a finding of severity warning (D125), the entry id of every such cell is kept as compatibility evidence with its result, a cell with CompatibleWithWarnings is listed in the result as a warning and does not fail the validation, an outcome this PBI delivers as a reading reported to the owner, `GenerationRecipeService/RecipeValidated` with `passed` true is written in the same transaction, and the response is 200 with the result (SCN-GenerationRecipeService-004, ADR-0027).",
        "AC2: Given a recipe with a blueprint version that `BindableBlueprintVersions` does not hold, a template version that `TemplateVersionProjections` does not hold or whose manifest reply names the state Deprecated or Retired, a switch the manifest does not declare, a library whose last announced state is not Published or that the projection does not hold, a library whose cell with a template that consumes it is Incompatible or is missing, from I4 also one whose cell is Unknown, a catalog row that only another tenant than the platform tenant holds, a missing pin for a design input the module kind needs, or a pin whose id, version or hash resolves to no validated version, when it is validated, then the result lists one failure per broken rule with a reason of its own, Incompatible, Unknown and missing evidence being three different reasons, with the module and the pin or library, the recipe stays Draft, `GenerationRecipeService/RecipeValidated` with `passed` false is written in the same transaction and `connectsoft.factory.recipes.validation_failures` is incremented by reason (SCN-GenerationRecipeService-004, ADR-0027).",
        "AC3: Given the verdict was committed, when the outbox dispatcher of the profile generation-recipe publishes `GenerationRecipeService/RecipeValidated` on `generation.recipes.v1.recipe-validated`, then the event is sent under the run event envelope with `recipeId`, `version`, `tenantId`, `projectId`, `passed` and the number of `modules` and without recipe content, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-GenerationRecipeService-009, ADR-0012).",
        "AC4: Given a caller without `factory.recipes.write`, a recipe that does not exist or belongs to another tenant, a recipe that is Approved, Executing, Generated or Superseded, or TemplateRegistryService or BlueprintService not answering, when `GenerationRecipeService/ValidateRecipe` is called, then the response is 403, 404, 422, and after the second attempt of the `RecipeValidator` 30 s later 503 with a problem response respectively, the recipe keeps its state and nothing is published; a repeated call for an unchanged recipe returns the same result and publishes nothing again; and a domain model pin is resolved through `BlueprintService/Blueprints.GetDerivedModel` (SCN-GenerationRecipeService-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-216",
        "AIFACTORY-TASK-2736",
        "AIFACTORY-TASK-2737"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8108,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService",
          "TemplateRegistryService",
          "BlueprintService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe"
        ],
        "apis": [
          "GenerationRecipeService/ValidateRecipe",
          "TemplateRegistryService/Catalog.ResolveManifest",
          "BlueprintService/Blueprints.GetDerivedModel"
        ],
        "events": [
          "GenerationRecipeService/RecipeValidated"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0027"
        ],
        "requirements": [
          "NFR-13"
        ],
        "scenarios": [
          "SCN-GenerationRecipeService-004",
          "SCN-GenerationRecipeService-009"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-682",
        "AIFACTORY-US-683",
        "feature:template-registry-service",
        "feature:blueprint-service"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-685]",
      "number": 685
    },
    {
      "id": "AIFACTORY-TASK-216",
      "type": "task",
      "parent": "AIFACTORY-US-685",
      "title": "Validation and approval rules",
      "sequence": "15.02.08.01",
      "description": "Validation and approval rules. Expected output: The RecipeValidator checks the blueprint version of the recipe against BindableBlueprintVersions, where Published passes and until I4 Submitted passes under the Draft allowance; it checks every module against the manifest read through Catalog.ResolveManifest and its switches and fails the template rule when TemplateVersionProjections does not hold the version as Published or, until I4, as Discovered, or when the reply names the state Deprecated or Retired; in the transaction of the result it sets draftAllowanceUsed to true when a Submitted blueprint version or a template version that is not yet Published is bound or, until I4, a library passed with an Unknown cell, and to false otherwise; it checks every library against the state last announced by LibraryVersionDiscovered and against the compatibility cells of the projection, where Compatible passes with the entry id as evidence, CompatibleWithWarnings passes with the entry id and a warning in the result, Unknown passes until I4 with a finding of severity warning under the Draft allowance and fails from I4 (D125), and Incompatible and a missing cell each fail with a reason of their own; it reads only catalog rows of the platform tenant; it checks every design input pin of the module kind against a validated version by id, version and hash; in one transaction it applies PlanValidated with the compatibility evidence or leaves the recipe Draft and writes RecipeValidated; ValidateRecipe runs it under the key of recipe id, version and content hash, refuses a recipe that is Approved or later with 422 and answers 503 when TemplateRegistryService or BlueprintService does not answer the second attempt; the rule that approval makes a recipe immutable is delivered by AIFACTORY-TASK-2738.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The RecipeValidator checks the blueprint version of the recipe against BindableBlueprintVersions, where Published passes and until I4 Submitted passes under the Draft allowance; it checks every module against the manifest read through Catalog.ResolveManifest and its switches and fails the template rule when TemplateVersionProjections does not hold the version as Published or, until I4, as Discovered, or when the reply names the state Deprecated or Retired; in the transaction of the result it sets draftAllowanceUsed to true when a Submitted blueprint version or a template version that is not yet Published is bound or, until I4, a library passed with an Unknown cell, and to false otherwise; it checks every library against the state last announced by LibraryVersionDiscovered and against the compatibility cells of the projection, where Compatible passes with the entry id as evidence, CompatibleWithWarnings passes with the entry id and a warning in the result, Unknown passes until I4 with a finding of severity warning under the Draft allowance and fails from I4 (D125), and Incompatible and a missing cell each fail with a reason of their own; it reads only catalog rows of the platform tenant; it checks every design input pin of the module kind against a validated version by id, version and hash; in one transaction it applies PlanValidated with the compatibility evidence or leaves the recipe Draft and writes RecipeValidated; ValidateRecipe runs it under the key of recipe id, version and content hash, refuses a recipe that is Approved or later with 422 and answers 503 when TemplateRegistryService or BlueprintService does not answer the second attempt; the rule that approval makes a recipe immutable is delivered by AIFACTORY-TASK-2738."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8108,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-216]",
      "number": 216
    },
    {
      "id": "AIFACTORY-TASK-2736",
      "type": "task",
      "parent": "AIFACTORY-US-685",
      "title": "Acceptance doubles of the template catalog and of the derived model read, with one recipe per broken rule",
      "sequence": "15.02.08.02",
      "description": "Acceptance doubles of the template catalog and of the derived model read, with one recipe per broken rule. Expected output: A test double answers Catalog.ResolveManifest with fixture manifests and their switches, a second answers Blueprints.GetDerivedModel, and both can be switched to not answering; the suite holds one recipe that holds every rule on a Submitted blueprint version and a Discovered template version, the same recipe on Published versions, one recipe whose library cell is CompatibleWithWarnings and that passes with a warning, and one recipe per broken rule of AC2 of AIFACTORY-US-685, so that every failure reason is proven to be reported: a blueprint version the projection does not hold, a template version the projection does not hold, a manifest reply that names the state Deprecated, an undeclared switch, a library whose last announced state is not Published, a library the projection does not hold, an Incompatible cell, an Unknown cell, which passes with a warning and sets draftAllowanceUsed before I4 and fails from I4, a missing cell, a catalog row held only by the second tenant of the two-tenant catalog case of AIFACTORY-TASK-2729, a missing pin and a pin that resolves to no validated version.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "A test double answers Catalog.ResolveManifest with fixture manifests and their switches, a second answers Blueprints.GetDerivedModel, and both can be switched to not answering; the suite holds one recipe that holds every rule on a Submitted blueprint version and a Discovered template version, the same recipe on Published versions, one recipe whose library cell is CompatibleWithWarnings and that passes with a warning, and one recipe per broken rule of AC2 of AIFACTORY-US-685, so that every failure reason is proven to be reported: a blueprint version the projection does not hold, a template version the projection does not hold, a manifest reply that names the state Deprecated, an undeclared switch, a library whose last announced state is not Published, a library the projection does not hold, an Incompatible cell, an Unknown cell, which passes with a warning and sets draftAllowanceUsed before I4 and fails from I4, a missing cell, a catalog row held only by the second tenant of the two-tenant catalog case of AIFACTORY-TASK-2729, a missing pin and a pin that resolves to no validated version."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8108,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2736]",
      "number": 2736
    },
    {
      "id": "AIFACTORY-TASK-2737",
      "type": "task",
      "parent": "AIFACTORY-US-685",
      "title": "Verify validate-a-recipe through the acceptance suite",
      "sequence": "15.02.08.03",
      "description": "Verify validate-a-recipe through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-004|Scenario=SCN-GenerationRecipeService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-685: the passed and the failed verdict with the state each leaves, the passed verdict under the Draft allowance with draftAllowanceUsed true and on Published versions with draftAllowanceUsed false, the outcome of each of the four values of Compatibility and of a missing cell, every failure reason of the fixture, the catalog row of another tenant that the validator does not see, the idempotent repeat, the refusals, the outage of a required dependency answered 503 and the publication and payload of RecipeValidated; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-004|Scenario=SCN-GenerationRecipeService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-685: the passed and the failed verdict with the state each leaves, the passed verdict under the Draft allowance with draftAllowanceUsed true and on Published versions with draftAllowanceUsed false, the outcome of each of the four values of Compatibility and of a missing cell, every failure reason of the fixture, the catalog row of another tenant that the validator does not see, the idempotent repeat, the refusals, the outage of a required dependency answered 503 and the publication and payload of RecipeValidated; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8108,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2737]",
      "number": 2737
    },
    {
      "id": "AIFACTORY-US-686",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Approve a Validated recipe, make it immutable, supersede its earlier versions and announce it as the single gate of generation",
      "sequence": "15.02.09",
      "description": "As an asset maintainer, I want my approval to bind one validated recipe version and to make that version immutable, so that the generation run executes exactly the version I approved and a change needs a new approval. A caller whose forwarded user token carries `factory.recipes.approve` approves a Validated recipe version of the tenant and project of the caller through `ApproveRecipe`. The model grants the scope to the Requester or the Asset maintainer; when `Templates:Recipes:RequireReviewerApproval` is true the caller must hold the Reviewer role, otherwise the call is refused with 403. The model says that policy may enforce the reviewer per project and lists no dependency on a policy service, so this delivery reads the option alone and reports the gap. This approval is the command of this service and is not an approval of RunControlService: it has no request, no expiry and no run. In one transaction the recipe moves from Validated to Approved through `Approved`, `approvedBy` is set, the recipe document, that is the module plan with every pin, the libraries, the layout and the evidence, is stored in ArtifactService through `Artifacts.Store` and its reference and content hash are kept with the recipe, every earlier version of the same recipe that is Approved or Generated moves to Superseded through `NewVersion`, and `RecipeApproved` with `recipeId`, `version` and `approvedBy` is written to the outbox. From that moment the recipe is immutable: no operation changes it, and a change is a new version that needs its own approval. The Approved recipe is the single gate of the generation run (ADR-0027, D67): the readiness correlation of WorkflowEngineService submits `generate-product` on the event, and RunControlService marks a pending approval that was bound to an earlier version of the recipe stale, each in its own PBI. The answer is 200. A repeated call for a version already Approved returns 200 and writes nothing. A caller without the scope or without the required role is refused with 403; an unknown recipe and a recipe of another tenant are answered 404 alike; a recipe that is Draft, Executing, Generated or Superseded is refused with 409, and so is a Validated recipe whose pins no longer resolve at approval, with the unresolved pin named. ArtifactService fails fast: when it does not answer, the call ends with 503 and a problem response and the recipe stays Validated (D123). A recipe whose `draftAllowanceUsed` is true is approved like any other until I4, and the approver reads the member with the recipe. `RecipeApproved` is also the audit evidence of the approval: it names the approver and is the event AuditService consumes, so no separate evidence record is written. The service repeats no write on its own. The recipe keeps the reference and the hash of its document in `documentRef` and `documentHash` of the model (D123). The model names no operation as the one that stores the document and no rule for when `NewVersion` is raised or for what supersedes a version that is Executing; this PBI stores the document at approval, raises `NewVersion` at the approval of a later version and leaves an Executing version to the end of its run, and reports the three readings to the owner. Kind: behavior. Traces: services: GenerationRecipeService, ArtifactService, WorkflowEngineService, RunControlService; aggregates: GenerationRecipeService/GenerationRecipe; apis: GenerationRecipeService/ApproveRecipe, ArtifactService/Artifacts.Store; events: GenerationRecipeService/RecipeApproved; adrs: ADR-0012, ADR-0015, ADR-0027; requirements: FR-06; scenarios: SCN-GenerationRecipeService-005, SCN-GenerationRecipeService-010. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-685, feature:artifact-service. Sources: model/services/template-library/GenerationRecipeService.yaml, model/services/knowledge/ArtifactService.yaml, model/workflows/generate-product.yaml, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.recipes.approve` and a Validated `GenerationRecipeService/GenerationRecipe` of the tenant and project of the caller, when `GenerationRecipeService/ApproveRecipe` is called, then in one transaction the recipe moves to Approved through `Approved`, `approvedBy` names the caller, the recipe document is stored through `ArtifactService/Artifacts.Store` and its reference and content hash are kept in `documentRef` and `documentHash`, and `GenerationRecipeService/RecipeApproved` is written; the response is 200, and a repeated call for the version already Approved returns 200 and writes nothing (SCN-GenerationRecipeService-005, FR-06).",
        "AC2: Given a caller without `factory.recipes.approve`, a caller without the Reviewer role while `Templates:Recipes:RequireReviewerApproval` is true, a recipe that does not exist or belongs to another tenant, a recipe that is Draft, Executing, Generated or Superseded, or a Validated recipe with a pin that no longer resolves, when `GenerationRecipeService/ApproveRecipe` is called, then the response is 403, 403, 404, 409 and 409 respectively with a problem response, the last one naming the unresolved pin, the state does not change and nothing is published; and given ArtifactService does not answer, then the call ends with 503 and a problem response and the recipe stays Validated (SCN-GenerationRecipeService-005, ADR-0015).",
        "AC3: Given an Approved recipe, when any operation tries to change its modules, libraries, layout or evidence, then nothing changes, because a change is a new version; and given a later version of the same recipe is approved, then every earlier version that is Approved or Generated moves to Superseded through `NewVersion` in the transaction of that approval, while a version that is Executing is left to the end of its run (model/services/template-library/GenerationRecipeService.yaml, ADR-0027).",
        "AC4: Given the approval was committed, when the outbox dispatcher publishes `GenerationRecipeService/RecipeApproved` on `generation.recipes.v1.recipe-approved`, then the event is sent under the run event envelope with `recipeId`, `version`, `tenantId`, `projectId` and `approvedBy`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-GenerationRecipeService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2738",
        "AIFACTORY-TASK-2739"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8109,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService",
          "ArtifactService",
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe"
        ],
        "apis": [
          "GenerationRecipeService/ApproveRecipe",
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "GenerationRecipeService/RecipeApproved"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0027"
        ],
        "requirements": [
          "FR-06"
        ],
        "scenarios": [
          "SCN-GenerationRecipeService-005",
          "SCN-GenerationRecipeService-010"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-685",
        "feature:artifact-service"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-686]",
      "number": 686
    },
    {
      "id": "AIFACTORY-TASK-2738",
      "type": "task",
      "parent": "AIFACTORY-US-686",
      "title": "ApproveRecipe with the role check, the stored recipe document, the superseded versions and the RecipeApproved outbox record",
      "sequence": "15.02.09.01",
      "description": "ApproveRecipe with the role check, the stored recipe document, the superseded versions and the RecipeApproved outbox record. Expected output: ApproveRecipe checks the scope and, when Templates:Recipes:RequireReviewerApproval is true, the Reviewer role, checks that every pin still resolves, and in one transaction applies Approved, sets approvedBy, stores the recipe document through Artifacts.Store and keeps its reference and content hash in documentRef and documentHash of the recipe, the columns DocumentRef and DocumentHash that AIFACTORY-TASK-127 migrates, applies NewVersion to the earlier Approved or Generated versions of the recipe and writes RecipeApproved; an Approved recipe refuses every change; an outage of ArtifactService is answered 503 and leaves the recipe Validated; the repeat and the 403, 404 and 409 refusals are covered by acceptance tests.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "ApproveRecipe checks the scope and, when Templates:Recipes:RequireReviewerApproval is true, the Reviewer role, checks that every pin still resolves, and in one transaction applies Approved, sets approvedBy, stores the recipe document through Artifacts.Store and keeps its reference and content hash in documentRef and documentHash of the recipe, the columns DocumentRef and DocumentHash that AIFACTORY-TASK-127 migrates, applies NewVersion to the earlier Approved or Generated versions of the recipe and writes RecipeApproved; an Approved recipe refuses every change; an outage of ArtifactService is answered 503 and leaves the recipe Validated; the repeat and the 403, 404 and 409 refusals are covered by acceptance tests."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8109,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2738]",
      "number": 2738
    },
    {
      "id": "AIFACTORY-TASK-2739",
      "type": "task",
      "parent": "AIFACTORY-US-686",
      "title": "Verify approve-a-validated-recipe through the acceptance suite",
      "sequence": "15.02.09.02",
      "description": "Verify approve-a-validated-recipe through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-005|Scenario=SCN-GenerationRecipeService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-686: the approval with its stored document, the role rule under the option, the refusals, the immutability, the superseded earlier versions, the outage of ArtifactService answered 503 and the publication and payload of RecipeApproved; consumer handling is proven by the suites of WorkflowEngineService and RunControlService.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-005|Scenario=SCN-GenerationRecipeService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-686: the approval with its stored document, the role rule under the option, the refusals, the immutability, the superseded earlier versions, the outage of ArtifactService answered 503 and the publication and payload of RecipeApproved; consumer handling is proven by the suites of WorkflowEngineService and RunControlService."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8109,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2739]",
      "number": 2739
    },
    {
      "id": "AIFACTORY-US-687",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Serve the approved recipe with every pin resolved to a generation run, record the provenance of each generated module and list it by project",
      "sequence": "15.02.10",
      "description": "A generation run executes the approved recipe and leaves its provenance here. In the first step of `generate-product`, ToolAdapterService executes the read-class tool `get-approved-recipe` and calls `Recipes.GetApprovedRecipe` with a workload token that holds `factory.recipes.read` and the scope of the run. The reply is `artifact-v1`: the reference and the content hash of the recipe document of the approved version, which holds the module plan, the counts by module kind and, per module, every pinned design input resolved to its reference: Module Blueprint, application design, domain model, Database, Frontend and UX Blueprint. The run reads its inputs through these pins and never waits for a blueprint on its own (ADR-0027, D67). The read writes nothing; a recipe that is not Approved or Executing is answered FailedPrecondition, an unknown recipe and a recipe of another tenant NOT_FOUND alike. A generation attempt records the provenance of one generated module through `Recipes.RecordOutput` (decision D133): in the step `record-outputs` of `generate-product`, a step of the class shared-write, ToolAdapterService executes the tool `record-generated-output`, bound to the skill `microservice-generator-record-outputs`, and calls the method with its own workload identity, whose token holds `factory.recipes.write`. The call carries recipe id and version, module name, run and attempt, agent release, template id and version, manifest hash, the generated files with their hashes and the preserved paths. The service writes one `GeneratedOutput` and `GeneratedOutputRecorded` in one transaction and answers `ack-v1`; `connectsoft.factory.recipes.generated_modules` counts it by module kind and template. The call is idempotent on the run, the recipe and the hash of the change set, as the catalogue entry of the tool declares: a repeated call with the same three returns the same acknowledgement and records nothing. Because this caller exists in I1, the first recorded output of a run moves the recipe to Executing and the end of the run moves it to Generated with `GenerationCompleted` in this increment, as AIFACTORY-US-688 delivers. A module that is not in the plan of the recipe, a template version other than the one the module pins, and a path listed as both generated and preserved are refused with InvalidArgument; a recipe that is neither Approved nor Executing is refused with FailedPrecondition. A call without a workload identity is refused with Unauthenticated, a token without `factory.recipes.write` with PermissionDenied, and a recipe that does not exist or belongs to another tenant with NOT_FOUND; every refusal writes no output and no event. `GeneratedOutputRecorded` is also the audit evidence of a recorded output, since AuditService consumes it. The service never writes code and repeats no write on its own; a lost reply leaves the step Uncertain for the Operator decision in RunControlService. A caller with `factory.recipes.read` lists the provenance of the generated modules of a project through `ListGeneratedOutputs`, by commit, with the generated and the preserved files. The service holds no project registry and the model lists no dependency on ProjectService, so the rule it can evaluate is this: the path `projectId` is compared with the project of the trusted scope of the forwarded token; an equal id is answered 200, with an empty list when nothing is recorded for the project, and every other id is answered 404, because the service cannot tell a project of another tenant from a project of the same tenant outside the scope of the caller. Whether a project of the same tenant should be answered 403 instead, as a missing right inside the tenant under the amendment D113 of ADR-0015, is reported to the owner. The handler `LinkCommit` sets the proposal id and the commit on the outputs of the run that a merged change proposal of PipelineExecutionService names, idempotently on the event id; that event is first published in I2, so the handler is proven on a fixture and the event is not traced here. Two gaps of the model are reported and not decided. The request schema of `RecordOutput`, `change-set-v1`, has no field for recipe, module, template, manifest hash or preserved paths, so the proto of this PBI carries them beside the change set. The request schema of `GetApprovedRecipe`, `execution-scope-v1`, names no recipe, while the tool takes `artifact-v1`, so the proto takes the recipe id and version with the scope. Kind: behavior. Traces: services: GenerationRecipeService, ToolAdapterService, PipelineExecutionService; aggregates: GenerationRecipeService/GenerationRecipe, GenerationRecipeService/GeneratedOutput; apis: GenerationRecipeService/Recipes.GetApprovedRecipe, GenerationRecipeService/Recipes.RecordOutput, GenerationRecipeService/ListGeneratedOutputs; events: GenerationRecipeService/GeneratedOutputRecorded; steps: generate-product/resolve-recipe, generate-product/record-outputs; tools: get-approved-recipe, record-generated-output; descriptors: artifact-v1, ack-v1, change-set-v1, execution-scope-v1; adrs: ADR-0012, ADR-0015, ADR-0027; requirements: FR-07, XL-10; scenarios: SCN-GenerationRecipeService-006, SCN-GenerationRecipeService-007, SCN-GenerationRecipeService-008, SCN-GenerationRecipeService-012. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-686, feature:tool-adapter-service. Sources: model/services/template-library/GenerationRecipeService.yaml, model/tools/get-approved-recipe.yaml, model/tools/record-generated-output.yaml, model/workflows/generate-product.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, docs/reference/schemas/change-set.schema.json, docs/reference/schemas/execution-scope.schema.json, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given ToolAdapterService executing the tool `get-approved-recipe` in the step `generate-product/resolve-recipe` with a workload token that holds `factory.recipes.read` and the scope of the run, when it calls `GenerationRecipeService/Recipes.GetApprovedRecipe` for an Approved or Executing recipe version of that scope, then the reply is `artifact-v1` with the reference and content hash of the recipe document, which holds the module plan with its counts by module kind and every pinned design input of every module resolved to its reference, and nothing is written (SCN-GenerationRecipeService-007, ADR-0027).",
        "AC2: Given a call of `GenerationRecipeService/Recipes.GetApprovedRecipe` or of `GenerationRecipeService/Recipes.RecordOutput` without a workload identity, without the service scope of the method, `factory.recipes.read` for the read and `factory.recipes.write` for the write, or for a recipe that does not exist or belongs to another tenant, when it arrives, then it is refused with Unauthenticated, PermissionDenied and NOT_FOUND respectively, no output is written, no event is written and no state changes; and given an invalid request or a recipe that is Draft, Validated, Generated or Superseded at `GenerationRecipeService/Recipes.GetApprovedRecipe`, then the answer is InvalidArgument or FailedPrecondition (SCN-GenerationRecipeService-007, SCN-GenerationRecipeService-008, ADR-0015).",
        "AC3: Given ToolAdapterService executing the tool `record-generated-output` in the step `generate-product/record-outputs` with its workload identity, whose token holds `factory.recipes.write`, and an Approved or Executing recipe, when `GenerationRecipeService/Recipes.RecordOutput` is called with recipe id and version, module name, run, attempt, agent release, template id and version, manifest hash, the generated files with their hashes and the preserved paths, then one `GenerationRecipeService/GeneratedOutput` and `GenerationRecipeService/GeneratedOutputRecorded` are written in one transaction and the reply is `ack-v1`; a repeated call for the same run, recipe and change set hash returns the same acknowledgement and records nothing; a module outside the plan, a template version other than the pinned one or a path listed as both generated and preserved is refused with InvalidArgument, and a recipe in any other state with FailedPrecondition (SCN-GenerationRecipeService-008).",
        "AC4: Given the output was committed, when the outbox dispatcher publishes `GenerationRecipeService/GeneratedOutputRecorded` on `generation.outputs.v1.generated-output-recorded`, then the event is sent under the run event envelope with `outputId`, `tenantId`, `projectId`, `moduleName`, `templateId`, `templateVersion`, `runId` and, once known, `proposalId`, without file content, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-GenerationRecipeService-012, ADR-0012).",
        "AC5: Given a caller with `factory.recipes.read` whose trusted scope names a project, when `GenerationRecipeService/ListGeneratedOutputs` is called with that project id in the path, then the response is 200 with the provenance of its generated modules by commit, each with recipe version, run, attempt, agent release, template version, manifest hash, generated files with hashes and preserved paths, and with an empty list when nothing is recorded for the project; a missing scope is 403; a path `projectId` that is not the project of the trusted scope is answered 404, the one code this PBI names for every other id, because the service holds no project registry, while the choice of 403 for a project of the same tenant is reported to the owner; and after the fixture event of a merged change proposal for the run, handled by `LinkCommit`, the outputs of that run show the proposal id and the commit (SCN-GenerationRecipeService-006, ADR-0015, XL-10)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/tools/get-approved-recipe.yaml",
        "model/tools/record-generated-output.yaml",
        "model/workflows/generate-product.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/reference/schemas/change-set.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2740",
        "AIFACTORY-TASK-2741",
        "AIFACTORY-TASK-2742",
        "AIFACTORY-TASK-2743"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8110,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService",
          "ToolAdapterService",
          "PipelineExecutionService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe",
          "GenerationRecipeService/GeneratedOutput"
        ],
        "apis": [
          "GenerationRecipeService/Recipes.GetApprovedRecipe",
          "GenerationRecipeService/Recipes.RecordOutput",
          "GenerationRecipeService/ListGeneratedOutputs"
        ],
        "events": [
          "GenerationRecipeService/GeneratedOutputRecorded"
        ],
        "steps": [
          "generate-product/resolve-recipe",
          "generate-product/record-outputs"
        ],
        "tools": [
          "get-approved-recipe",
          "record-generated-output"
        ],
        "descriptors": [
          "artifact-v1",
          "ack-v1",
          "change-set-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0027"
        ],
        "requirements": [
          "FR-07",
          "XL-10"
        ],
        "scenarios": [
          "SCN-GenerationRecipeService-006",
          "SCN-GenerationRecipeService-007",
          "SCN-GenerationRecipeService-008",
          "SCN-GenerationRecipeService-012"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-686",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/tools/get-approved-recipe.yaml",
        "model/tools/record-generated-output.yaml",
        "model/workflows/generate-product.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "docs/reference/schemas/change-set.schema.json",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-687]",
      "number": 687
    },
    {
      "id": "AIFACTORY-TASK-2740",
      "type": "task",
      "parent": "AIFACTORY-US-687",
      "title": "Proto of the Recipes service with the recipe reference and the provenance fields",
      "sequence": "15.02.10.01",
      "description": "Proto of the Recipes service with the recipe reference and the provenance fields. Expected output: The proto of the service defines Recipes.GetApprovedRecipe, which takes the forwarded scope with a recipe id and version and answers with a message that maps onto docs/reference/schemas/artifact.schema.json, and Recipes.RecordOutput, which takes the change set of docs/reference/schemas/change-set.schema.json together with recipe id and version, module name, run, attempt, agent release, template id and version, manifest hash and the preserved paths and answers with the acknowledgement; the fields the modelled request schemas lack are listed in the repository documentation.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The proto of the service defines Recipes.GetApprovedRecipe, which takes the forwarded scope with a recipe id and version and answers with a message that maps onto docs/reference/schemas/artifact.schema.json, and Recipes.RecordOutput, which takes the change set of docs/reference/schemas/change-set.schema.json together with recipe id and version, module name, run, attempt, agent release, template id and version, manifest hash and the preserved paths and answers with the acknowledgement; the fields the modelled request schemas lack are listed in the repository documentation."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8110,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2740]",
      "number": 2740
    },
    {
      "id": "AIFACTORY-TASK-2741",
      "type": "task",
      "parent": "AIFACTORY-US-687",
      "title": "Recipes.GetApprovedRecipe over the stored recipe document",
      "sequence": "15.02.10.02",
      "description": "Recipes.GetApprovedRecipe over the stored recipe document. Expected output: Recipes.GetApprovedRecipe returns artifact-v1 with the reference and content hash of the recipe document of an Approved or Executing version under the tenant filter and the service scope factory.recipes.read; a recipe in another state is FailedPrecondition, an unknown recipe and a recipe of another tenant NotFound, the gRPC status NOT_FOUND (ADR-0015), and the read writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Recipes.GetApprovedRecipe returns artifact-v1 with the reference and content hash of the recipe document of an Approved or Executing version under the tenant filter and the service scope factory.recipes.read; a recipe in another state is FailedPrecondition, an unknown recipe and a recipe of another tenant NotFound, the gRPC status NOT_FOUND (ADR-0015), and the read writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8110,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2741]",
      "number": 2741
    },
    {
      "id": "AIFACTORY-TASK-2742",
      "type": "task",
      "parent": "AIFACTORY-US-687",
      "title": "Recipes.RecordOutput, ListGeneratedOutputs and the LinkCommit inbox handler",
      "sequence": "15.02.10.03",
      "description": "Recipes.RecordOutput, ListGeneratedOutputs and the LinkCommit inbox handler. Expected output: Recipes.RecordOutput admits ToolAdapterService, the executor of the tool record-generated-output, as its caller under its workload identity with factory.recipes.write (D133), writes one GeneratedOutput and GeneratedOutputRecorded in one transaction for a module of the plan of an Approved or Executing recipe, idempotently on run, recipe and change set hash, and refuses a module outside the plan, another template version than the pinned one and a path listed as both generated and preserved with InvalidArgument, a recipe in any other state with FailedPrecondition, a caller without a workload identity with Unauthenticated, a token without factory.recipes.write with PermissionDenied and a recipe that does not exist or belongs to another tenant with NOT_FOUND, each with no output and no event written; ListGeneratedOutputs compares the path projectId with the project of the trusted scope, returns for an equal id the provenance of the generated modules by commit, an empty list when nothing is recorded, and answers 404 for every other id; LinkCommit sets proposal id and commit on the outputs of the run a merged change proposal names, idempotently on the event id.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Recipes.RecordOutput admits ToolAdapterService, the executor of the tool record-generated-output, as its caller under its workload identity with factory.recipes.write (D133), writes one GeneratedOutput and GeneratedOutputRecorded in one transaction for a module of the plan of an Approved or Executing recipe, idempotently on run, recipe and change set hash, and refuses a module outside the plan, another template version than the pinned one and a path listed as both generated and preserved with InvalidArgument, a recipe in any other state with FailedPrecondition, a caller without a workload identity with Unauthenticated, a token without factory.recipes.write with PermissionDenied and a recipe that does not exist or belongs to another tenant with NOT_FOUND, each with no output and no event written; ListGeneratedOutputs compares the path projectId with the project of the trusted scope, returns for an equal id the provenance of the generated modules by commit, an empty list when nothing is recorded, and answers 404 for every other id; LinkCommit sets proposal id and commit on the outputs of the run a merged change proposal names, idempotently on the event id."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8110,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2742]",
      "number": 2742
    },
    {
      "id": "AIFACTORY-TASK-2743",
      "type": "task",
      "parent": "AIFACTORY-US-687",
      "title": "Verify serve-the-approved-recipe-and-record-generated-outputs through the acceptance suite",
      "sequence": "15.02.10.04",
      "description": "Verify serve-the-approved-recipe-and-record-generated-outputs through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-006|Scenario=SCN-GenerationRecipeService-007|Scenario=SCN-GenerationRecipeService-008|Scenario=SCN-GenerationRecipeService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-687: the read of the approved recipe with its refusals, the recorded output under the workload token of a ToolAdapterService fixture for the tool record-generated-output with its repeat on the same run, recipe and change set hash and its refusals, among them Unauthenticated without a workload identity, PermissionDenied without factory.recipes.write and NOT_FOUND for an unknown recipe and for a recipe of another tenant, each leaving no output and no event, the list by project with the empty list of a project without outputs and the 404 for every path projectId other than the project of the trusted scope, the commit linked from a fixture event of a merged change proposal and the publication and payload of GeneratedOutputRecorded; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-GenerationRecipeService-006|Scenario=SCN-GenerationRecipeService-007|Scenario=SCN-GenerationRecipeService-008|Scenario=SCN-GenerationRecipeService-012)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-687: the read of the approved recipe with its refusals, the recorded output under the workload token of a ToolAdapterService fixture for the tool record-generated-output with its repeat on the same run, recipe and change set hash and its refusals, among them Unauthenticated without a workload identity, PermissionDenied without factory.recipes.write and NOT_FOUND for an unknown recipe and for a recipe of another tenant, each leaving no output and no event, the list by project with the empty list of a project without outputs and the 404 for every path projectId other than the project of the trusted scope, the commit linked from a fixture event of a merged change proposal and the publication and payload of GeneratedOutputRecorded; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8110,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2743]",
      "number": 2743
    },
    {
      "id": "AIFACTORY-US-688",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-083",
      "title": "Move a recipe to Executing on the first recorded output of its run, to Generated when the run completes and back to Approved when it fails or is cancelled",
      "sequence": "15.02.11",
      "description": "The end of the generation run settles the recipe. The trigger `RunSubmitted` of the transition from Approved to Executing is the first `Recipes.RecordOutput` of a run for the recipe (D123): the accepted run is not consumed and carries no recipe, and `Recipes.RecordOutput` is the one call that names both a run and a recipe. The first recorded output of a run for an Approved recipe applies `RunSubmitted` in the transaction of that output, and the recipe is Executing from then on. The service makes no call to RunControlService, although the model lists it as a required dependency for generation runs: the run is submitted by the readiness correlation of WorkflowEngineService and its end is heard through the inbox. When RunControlService announces `RunCompleted`, the handler `CompleteGeneration` finds the recipe that is Executing for that run by the run id of its generated outputs, moves it to Generated through `RunCompleted` and writes `GenerationCompleted` in the same transaction, with recipe id, version, tenant, project, run id, the number of modules whose provenance is recorded and the proposal ids known for those outputs, an empty list when none is known yet. In practice the list is empty at completion: the only modelled input that gives this service a proposal id is the handler `LinkCommit`, which hears a merged change proposal, and a merge follows the end of the run. No modelled input names a proposal before the run completes, so `proposalIds` of the event cannot be filled as its name promises; this is reported to the owner. `GenerationCompleted` is also the audit evidence of the completion, since AuditService consumes it. When RunControlService announces `RunFailed`, the handler `RevertToApproved` moves the recipe that is Executing for that run back to Approved through `RunFailed`; the recorded outputs of the failed run stay as provenance, nothing is published, and the recipe can be executed by a new run. When RunControlService announces `RunCancelled`, the same handler `RevertToApproved` returns the recipe that is Executing for that run to Approved through `RunCancelled`, as it does for a failed run (D123): the recorded outputs of the cancelled run stay as provenance, nothing is published, and the recipe can be executed by a new run. A run that ends before it recorded an output never moved the recipe, which is therefore still Approved, the result the model states for a failed and for a cancelled run. Both handlers are idempotent on the event id and act only inside the tenant of the envelope; an event for a run that no recipe of the tenant is Executing for is acknowledged without an effect, because most runs are not generation runs. The outbox publishes `GenerationCompleted` under the run event envelope; WorkflowEngineService, AuditService, StudioBff, DashboardService, FleetRolloutService and RepositoryIntelligenceService consume it in their own PBIs and increments. The service decides no approval and repeats no write on its own. Kind: behavior. Traces: services: GenerationRecipeService, RunControlService, WorkflowEngineService; aggregates: GenerationRecipeService/GenerationRecipe, GenerationRecipeService/GeneratedOutput; events: GenerationRecipeService/GenerationCompleted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/RunCancelled; adrs: ADR-0012, ADR-0014, ADR-0027; requirements: FR-03; scenarios: SCN-GenerationRecipeService-011. Relates: nfrs: NFR-05. Depends on: AIFACTORY-US-687, feature:run-control-service. Sources: model/services/template-library/GenerationRecipeService.yaml, model/services/control-plane/RunControlService.yaml, docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#sagas-and-long-running-flows.",
      "acceptanceCriteria": [
        "AC1: Given an Approved `GenerationRecipeService/GenerationRecipe` and the first recorded `GenerationRecipeService/GeneratedOutput` of a run for it, when the output is committed, then the recipe is Executing through `RunSubmitted` in the same transaction, because the first `Recipes.RecordOutput` of a run for the recipe is that trigger, and a later output of the same run changes no state (model/services/template-library/GenerationRecipeService.yaml).",
        "AC2: Given a recipe that is Executing for a run and `RunControlService/RunCompleted` for that run, when `CompleteGeneration` handles it, then the recipe moves to Generated and `GenerationRecipeService/GenerationCompleted` is written in the same transaction with `recipeId`, `version`, `tenantId`, `projectId`, `runId`, the number of `modules` recorded and the known `proposalIds`, an empty list when no merged change proposal was heard before the completion, which is the usual case; a second delivery of the same event id and an event for a run no recipe is Executing for change nothing (SCN-GenerationRecipeService-011).",
        "AC3: Given a recipe that is Executing for a run and `RunControlService/RunFailed` or `RunControlService/RunCancelled` for that run, when `RevertToApproved` handles it, then the recipe returns to Approved through `RunFailed` or through `RunCancelled` respectively, the outputs of the run stay recorded, nothing is published, a second delivery of the same event id changes nothing, and a recipe whose run failed or was cancelled before its first output is still Approved (model/services/template-library/GenerationRecipeService.yaml).",
        "AC4: Given the completion was committed, when the outbox dispatcher publishes `GenerationRecipeService/GenerationCompleted` on `generation.recipes.v1.generation-completed`, then the event is sent under the run event envelope with the payload of AC2, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-GenerationRecipeService-011, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#sagas-and-long-running-flows"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2744",
        "AIFACTORY-TASK-2745"
      ],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8111,
      "kind": "behavior",
      "traces": {
        "services": [
          "GenerationRecipeService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe",
          "GenerationRecipeService/GeneratedOutput"
        ],
        "events": [
          "GenerationRecipeService/GenerationCompleted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/RunCancelled"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-03"
        ],
        "scenarios": [
          "SCN-GenerationRecipeService-011"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-05"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-687",
        "feature:run-control-service"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/solution-packs/software-factory/templates/services/generation-recipe-service/index.md#sagas-and-long-running-flows"
      ],
      "titlePrefix": "[AIFACTORY-US-688]",
      "number": 688
    },
    {
      "id": "AIFACTORY-TASK-2744",
      "type": "task",
      "parent": "AIFACTORY-US-688",
      "title": "RunSubmitted on the first recorded output, and the CompleteGeneration and RevertToApproved inbox handlers",
      "sequence": "15.02.11.01",
      "description": "RunSubmitted on the first recorded output, and the CompleteGeneration and RevertToApproved inbox handlers. Expected output: The first GeneratedOutput of a run for an Approved recipe applies RunSubmitted in its transaction; CompleteGeneration finds the Executing recipe of a completed run by the run id of its outputs, applies RunCompleted and writes GenerationCompleted with the module count and the known proposal ids in the same transaction; RevertToApproved applies RunFailed to the Executing recipe of a failed run and RunCancelled to the Executing recipe of a cancelled run and keeps its outputs in both cases; both handlers are idempotent on the event id and ignore a run that no recipe of the tenant is Executing for.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "The first GeneratedOutput of a run for an Approved recipe applies RunSubmitted in its transaction; CompleteGeneration finds the Executing recipe of a completed run by the run id of its outputs, applies RunCompleted and writes GenerationCompleted with the module count and the known proposal ids in the same transaction; RevertToApproved applies RunFailed to the Executing recipe of a failed run and RunCancelled to the Executing recipe of a cancelled run and keeps its outputs in both cases; both handlers are idempotent on the event id and ignore a run that no recipe of the tenant is Executing for."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8111,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2744]",
      "number": 2744
    },
    {
      "id": "AIFACTORY-TASK-2745",
      "type": "task",
      "parent": "AIFACTORY-US-688",
      "title": "Verify complete-or-revert-a-generation through the acceptance suite",
      "sequence": "15.02.11.02",
      "description": "Verify complete-or-revert-a-generation through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-GenerationRecipeService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-688 with the completed, the failed and the cancelled run delivered as events under the run event envelope: the Executing state on the first output, the Generated state with the publication and payload of GenerationCompleted, the return to Approved with the outputs kept after RunFailed and after RunCancelled, and the duplicate and the unrelated run that change nothing; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-GenerationRecipeService-011\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-688 with the completed, the failed and the cancelled run delivered as events under the run event envelope: the Executing state on the first output, the Generated state with the publication and payload of GenerationCompleted, the return to Approved with the outputs kept after RunFailed and after RunCancelled, and the duplicate and the unrelated run that change nothing; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 81,
      "phase": "factory",
      "stackRank": 8111,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2745]",
      "number": 2745
    },
    {
      "id": "AIFACTORY-FEAT-084",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-015",
      "title": "TemplateRegistryService: complete delivery",
      "sequence": "15.03",
      "description": "TemplateRegistryService is the service of bounded context BC-14 (Template Catalog). One catalog module with pinned manifests: template versions read from the template repositories, library versions read from the feeds, API client catalog, dependency analysis and the compatibility matrix of templates, libraries, runtimes, editions and topologies with evidence (BC-14; eight June-2026 rows merged). Its own repository is ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Delivers: TemplateRegistryService (complete). Increment I1: Generate a microservice. Build order 82 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-072",
        "AIFACTORY-US-701",
        "AIFACTORY-US-702",
        "AIFACTORY-US-703",
        "AIFACTORY-US-704",
        "AIFACTORY-US-705",
        "AIFACTORY-US-706",
        "AIFACTORY-US-707",
        "AIFACTORY-US-708"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8200,
      "titlePrefix": "[AIFACTORY-FEAT-084]",
      "number": 84
    },
    {
      "id": "AIFACTORY-US-072",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "TemplateRegistryService serves its scope end to end: a template repository becomes a pinned manifest, a matrix cell with evidence and a manifest a recipe resolves",
      "sequence": "15.03.01",
      "description": "As an asset maintainer, I want one catalog that reads the templates and libraries of the ConnectSoft estate from their repositories and feeds, pins what it read and says with evidence what works together, so that the Template Catalog context has one owner that recipes and agents query at run time through its contract. This is the integration PBI of the feature: it proves on a deployed instance that the behaviours of TemplateRegistryService work together along one template version, from its repository to a manifest that a generation recipe resolves. TemplateRegistryService is the catalog of bounded context BC-14. It holds the template descriptors and parameter contracts of the ConnectSoft templates as pinned manifests, the library versions of the feeds and the compatibility matrix with evidence, and it is the runtime counterpart of the design-time files model/templates.yaml, model/libraries.yaml and model/template-parameters. A template is consumed by its published package version and never by a path, and the catalog records which version and which commit that is. The chain it proves is this. The `Discoverer` reads the feeds and the template sources, pins each published version of a template package by manifest hash at the commit that package was built from and each library version with its packages, and announces each new version once (AIFACTORY-US-704). The `CompatibilityComputer` fills the cells of the new version, Compatible only with evidence and Unknown without, and a succeeded build of the template repository in the platform tenant becomes evidence for the library cells and for the runtime cells of the frameworks it built, whether the run completes before or after the version is discovered (AIFACTORY-US-705). A caller whose scope carries `factory.catalog.read` lists the template versions, reads one pinned manifest, lists the libraries and queries the matrix (AIFACTORY-US-706). A workload resolves the pinned manifest for a recipe, for the rule MOD-002 that BlueprintService evaluates on a Module Blueprint or for an agent over gRPC (AIFACTORY-US-707). An Asset maintainer of the platform tenant submits a Verified version to Asset Publication, and the catalog mirrors the published and the deprecated release, which it matches by asset kind, asset id and version (AIFACTORY-US-708). The repository, the three aggregates and the store are delivered by AIFACTORY-US-701, the hosted surface by AIFACTORY-US-702 and secrets, tenancy, telemetry and the two failure modes by AIFACTORY-US-703. Through I4 the catalog holds the templates and libraries of the platform tenant only (D123): every tenant reads them, the envelope of every catalog event names the platform tenant, and templates owned by a tenant are a later feature. A resource of another tenant is answered 404, over gRPC NOT_FOUND, and a missing scope or role inside the tenant 403 (ADR-0015 amendment D113). Only an administrator of the platform tenant discovers and publishes: the two commands are admitted only for an Asset maintainer or a Platform admin whose token names the platform tenant, and a caller of another tenant, who can read those rows, is answered 403 by either command. The gateway of this platform, TemplateCatalogHost, is delivered in the same increment (D123): the six REST operations are reached through it with a token whose audience is that gateway, and no service host is reached directly. The delivery states its limits, and each is reported to the owner. The thin AgentRegistryService of this increment has no operation that opens a release candidate and publishes no release event, so the submission is proven against a fake of the release candidate port and the handlers `MarkPublished` and `MarkDeprecated` by fixture publishers; on a deployed instance of this increment no template version becomes Published, because the publication path arrives with feature `agent-registry-service-publication` in I2 (D140). Until the evaluation gate of AgentRegistryService is delivered in I4 the Draft allowance applies (D123): a recipe may bind a version the catalog has discovered that is not yet Published, so `Catalog.ResolveManifest` serves such a version and `TemplateVersionDiscovered`, which GenerationRecipeService projects, is published for it; arriving in I4, only a Published version may be selected. The model names the state Verified and no transition that reaches it, and it names no source for the list of template repositories or for the layer of a template; a template version is a published package version pinned at the commit its package states (D123), and the documentation of the templates names no member of a package that states that commit. It names consumers of a template version and defines none, so `TemplateRegistryService/ListTemplates` returns that field empty. The summary of the service in the model also names an API client catalog and dependency analysis; the model gives neither an aggregate, an operation or an event, so none is built. Build evidence reaches a deployed instance only once a service publishes `PipelineRunCompleted`, which the complete delivery of PipelineExecutionService brings in I2. The chain therefore runs on a deployed instance whose source port is bound to the connector adapter of AIFACTORY-TASK-2868, with ConnectorRegistryService and the Azure DevOps endpoints answered by the recording stub of the acceptance environment, which serves the recorded template sources and the recorded feed, and with a seeded Verified version and evidence by fixture. This PBI proves the one chain; the tenancy answers are proven by AIFACTORY-US-703, AIFACTORY-US-706 and AIFACTORY-US-707, and every scenario of the service is proven by the suite of the PBI that traces it and is not repeated here. Kind: behavior. Traces: services: TemplateRegistryService, AgentRegistryService, PipelineExecutionService, ConnectorRegistryService; aggregates: TemplateRegistryService/TemplateVersion, TemplateRegistryService/LibraryVersion, TemplateRegistryService/CompatibilityEntry; apis: TemplateRegistryService/ListTemplates, TemplateRegistryService/GetTemplateVersion, TemplateRegistryService/QueryCompatibility, TemplateRegistryService/PublishTemplateVersion, TemplateRegistryService/Catalog.ResolveManifest; events: TemplateRegistryService/TemplateVersionDiscovered, TemplateRegistryService/TemplateVersionPublished, TemplateRegistryService/LibraryVersionDiscovered, TemplateRegistryService/CompatibilityChecked, AgentRegistryService/AssetReleasePublished, AgentRegistryService/AssetReleaseDeprecated, PipelineExecutionService/PipelineRunCompleted; adrs: ADR-0014, ADR-0015, ADR-0021, ADR-0028; requirements: FR-06, NFR-13. Relates: screens: template-catalog. Depends on: AIFACTORY-US-701, AIFACTORY-US-702, AIFACTORY-US-703, AIFACTORY-US-704, AIFACTORY-US-705, AIFACTORY-US-706, AIFACTORY-US-707, AIFACTORY-US-708, feature:agent-registry-service-thin, feature:pipeline-execution-service-thin, feature:connector-registry-service-thin. Sources: model/services/template-library/TemplateRegistryService.yaml, model/scenarios/TemplateRegistryService.yaml, model/templates.yaml, model/libraries.yaml, docs/solution-packs/software-factory/templates/workflows.md, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a deployed instance whose source port is bound to the connector adapter of AIFACTORY-TASK-2868, with ConnectorRegistryService and the Azure DevOps endpoints answered by the recording stub of the acceptance environment that serves the recorded template sources and the recorded feed, when a discovery pass runs, then each recorded version of a template package exists once as a `TemplateRegistryService/TemplateVersion` in state Discovered with the version of the package, the commit that package was built from and its manifest hash, and each library version once as a `TemplateRegistryService/LibraryVersion`, `TemplateRegistryService/TemplateVersionDiscovered` and `TemplateRegistryService/LibraryVersionDiscovered` are published once per new version, and `TemplateRegistryService/ListTemplates` returns the versions with layer, state and switches and with the field `consumers` empty, because the model does not define the consumers of a template version (ADR-0014, model/services/template-library/TemplateRegistryService.yaml).",
        "AC2: Given the versions of AC1 and a fixture publisher of `PipelineExecutionService/PipelineRunCompleted` with a succeeded run of the platform tenant for the commit of one of them, when the cells are computed and the event is handled, then `TemplateRegistryService/QueryCompatibility` returns the library cells of that version and the runtime cells of the target frameworks its pinned manifest declares as Compatible with the pipeline run as evidence and every other cell, the runtime cell of a framework the version does not target among them, as Unknown, and `TemplateRegistryService/CompatibilityChecked` was published once per computed or changed `TemplateRegistryService/CompatibilityEntry` (NFR-13, model/services/template-library/TemplateRegistryService.yaml).",
        "AC3: Given a workload token that holds the service scope of TemplateRegistryService, when `TemplateRegistryService/Catalog.ResolveManifest` is called for a version of AC1, which is Discovered and not yet Published and is served under the Draft allowance until I4 (D123), then the reply carries the pinned manifest with the commit and the manifest hash that `TemplateRegistryService/GetTemplateVersion` returns for the same version, so the gRPC reply and the REST read agree along the chain, and nothing is written; the answers for a version of another tenant, 404 and NOT_FOUND, and for a missing scope or role, 403 and PERMISSION_DENIED, are proven over the tenant matrix by AIFACTORY-US-703, AIFACTORY-US-706 and AIFACTORY-US-707 and are not repeated here (ADR-0015).",
        "AC4: Given a seeded Verified version, the fake of the release candidate port and fixture publishers of `AgentRegistryService/AssetReleasePublished` and `AgentRegistryService/AssetReleaseDeprecated`, when `TemplateRegistryService/PublishTemplateVersion` is called by an Asset maintainer of the platform tenant and the two events are delivered in turn, the published one naming the asset kind TemplateBundle, the template id and the version in the tenant of the version and carrying a release manifest hash that differs from the manifest hash of the catalog, then one candidate is submitted, the version moves to Published with its release id, `TemplateRegistryService/TemplateVersionPublished` is published once, and the version then moves to Deprecated; the chain test of the acceptance suite runs AC1 to AC4 in one sequence and demands no further scenario of model/scenarios/TemplateRegistryService.yaml (ADR-0021)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/scenarios/TemplateRegistryService.yaml",
        "model/templates.yaml",
        "model/libraries.yaml",
        "docs/solution-packs/software-factory/templates/workflows.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2831",
        "AIFACTORY-TASK-789"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8201,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "AgentRegistryService",
          "PipelineExecutionService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "TemplateRegistryService/TemplateVersion",
          "TemplateRegistryService/LibraryVersion",
          "TemplateRegistryService/CompatibilityEntry"
        ],
        "apis": [
          "TemplateRegistryService/ListTemplates",
          "TemplateRegistryService/GetTemplateVersion",
          "TemplateRegistryService/QueryCompatibility",
          "TemplateRegistryService/PublishTemplateVersion",
          "TemplateRegistryService/Catalog.ResolveManifest"
        ],
        "events": [
          "TemplateRegistryService/TemplateVersionDiscovered",
          "TemplateRegistryService/TemplateVersionPublished",
          "TemplateRegistryService/LibraryVersionDiscovered",
          "TemplateRegistryService/CompatibilityChecked",
          "AgentRegistryService/AssetReleasePublished",
          "AgentRegistryService/AssetReleaseDeprecated",
          "PipelineExecutionService/PipelineRunCompleted"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ],
        "requirements": [
          "FR-06",
          "NFR-13"
        ]
      },
      "relates": {
        "screens": [
          "template-catalog"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-701",
        "AIFACTORY-US-702",
        "AIFACTORY-US-703",
        "AIFACTORY-US-704",
        "AIFACTORY-US-705",
        "AIFACTORY-US-706",
        "AIFACTORY-US-707",
        "AIFACTORY-US-708",
        "feature:agent-registry-service-thin",
        "feature:pipeline-execution-service-thin",
        "feature:connector-registry-service-thin"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/scenarios/TemplateRegistryService.yaml",
        "model/templates.yaml",
        "model/libraries.yaml",
        "docs/solution-packs/software-factory/templates/workflows.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-072]",
      "number": 72
    },
    {
      "id": "AIFACTORY-TASK-2831",
      "type": "task",
      "parent": "AIFACTORY-US-072",
      "title": "Deployment values of TemplateRegistryService: replica range, secret references, dependency addresses and the catalog options",
      "sequence": "15.03.01.01",
      "description": "Deployment values of TemplateRegistryService: replica range, secret references, dependency addresses and the catalog options. Expected output: The deployment manifest of the service states the replica range 2 to 4 of model/services/template-library/TemplateRegistryService.yaml, the liveness and readiness probes, the messaging service name template-registry, one base address per dependency (ConnectorRegistryService, AgentRegistryService, RepositoryIntelligenceService) from configuration, the two secret references messaging-transport and package-feed by name and never by value, the binding of the source port to the connector adapter of AIFACTORY-TASK-2868, and the options Templates:Catalog:DiscoverIntervalHours, Templates:Catalog:Runtimes and Templates:Feeds:PackageFeeds with their modelled defaults; the same image runs in the saas-default, hybrid and on-prem topologies.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The deployment manifest of the service states the replica range 2 to 4 of model/services/template-library/TemplateRegistryService.yaml, the liveness and readiness probes, the messaging service name template-registry, one base address per dependency (ConnectorRegistryService, AgentRegistryService, RepositoryIntelligenceService) from configuration, the two secret references messaging-transport and package-feed by name and never by value, the binding of the source port to the connector adapter of AIFACTORY-TASK-2868, and the options Templates:Catalog:DiscoverIntervalHours, Templates:Catalog:Runtimes and Templates:Feeds:PackageFeeds with their modelled defaults; the same image runs in the saas-default, hybrid and on-prem topologies."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8201,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2831]",
      "number": 2831
    },
    {
      "id": "AIFACTORY-TASK-789",
      "type": "task",
      "parent": "AIFACTORY-US-072",
      "title": "Verify template-registry-service-serves-its-scope by running the declared command",
      "sequence": "15.03.01.02",
      "description": "Verify template-registry-service-serves-its-scope by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=CatalogChain\"` against the deployed instance whose source port is bound to the connector adapter, with the recording stub of the connector and of the Azure DevOps endpoints serving the recorded template sources and the recorded feed, the fake of the release candidate port and the fixture publishers of the release events and of PipelineRunCompleted; a filter that matches no test counts as a failure; the chain of discovery, cells, evidence by fixture, reads, manifest resolution equal to the REST read, submission of a seeded Verified version, publication by a release event whose manifest hash differs from the catalog hash and deprecation by fixture passes in one sequence, which proves AC1 to AC4 of AIFACTORY-US-072.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=CatalogChain\"` against the deployed instance whose source port is bound to the connector adapter, with the recording stub of the connector and of the Azure DevOps endpoints serving the recorded template sources and the recorded feed, the fake of the release candidate port and the fixture publishers of the release events and of PipelineRunCompleted; a filter that matches no test counts as a failure; the chain of discovery, cells, evidence by fixture, reads, manifest resolution equal to the REST read, submission of a seeded Verified version, publication by a release event whose manifest hash differs from the catalog hash and deprecation by fixture passes in one sequence, which proves AC1 to AC4 of AIFACTORY-US-072."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-789]",
      "number": 789
    },
    {
      "id": "AIFACTORY-US-701",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "TemplateRegistryService repository: scaffolded from the base template with the Factory profile, with its three aggregates and the store template-registry-sql",
      "sequence": "15.03.02",
      "description": "The repository ConnectSoft.AI.SoftwareFactory.TemplateRegistryService is created and scaffolded in I0 by AIFACTORY-TASK-132 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold, with the scaffold command of ADR-0028 and its amendment on the Factory profile switch (D114): `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.TemplateRegistryService --UseFactoryProfile true`, from the template package at the version the gate of feature `component-base-template-factory-profile` published (AIFACTORY-US-230), after the findings of feature `component-base-template-findings` are closed (AIFACTORY-US-235). The generated output is committed unchanged and the repository records the version of the template package it was generated from. What the profile generates, that is the Orleans messaging profile with an outbox and an inbox of the service, the propagation of the trusted tenant and project scope, the role policies, the REST and gRPC hosts from a service descriptor, health and telemetry, is the work of the template feature; it is consumed by that version pin and is neither rewritten nor forked here. The run event envelope comes from the contracts package by a version pin. On that scaffold this PBI adds the domain and the store. A `TemplateVersion` is the pinned manifest of one template version: the template id, which is the short name of `.template.config` and the templates catalog id, the version, which is the version of the published template package, the tenant, the layer (L1Foundation, L2Platform or L3Product), the repository and the commit it was read from, the manifest with the projects and their roles, the switches with their allowed values, the generated and preserved paths, the pipelines and the docs, the manifest hash, the state, the release id once an asset release exists, and the time of discovery. The summary of the aggregate also names consumers, while its fields and the table `TemplateVersions` hold none; no member and no column is added for them here, and the gap is reported to the owner (AIFACTORY-US-706 states what the read returns). Its invariants are those of the model: a manifest is read from the template repository at a commit and pinned by hash and is never edited in the catalog, a template version is a published package version of the template, pinned at the commit its package states, a generation recipe selects a Published version and, until the evaluation gate of AgentRegistryService is delivered in I4, may also select a version the catalog has discovered that is not yet Published, arriving in I4 only a Published version may be selected, and a Deprecated version may be upgraded from and never generated with (D123). The model lists the five values of `CatalogState`, Discovered, Verified, Published, Deprecated and Retired, and no transition table. The aggregate therefore accepts exactly the transitions the rest of the model implies and refuses every other one: a version is created Discovered, moves from Discovered to Verified, from Verified to Published when its asset release is published, and from Published to Deprecated when that release is deprecated. The model names no trigger for the transition to Verified and no path to Retired; the first exists as a domain operation that no handler of this delivery calls, the second as a value no operation reaches, and both are reported to the owner. A `LibraryVersion` is one version of one library of the libraries catalog: library id, version, tenant, layer, capability area, the packages with their versions on the feed, the options sections, the templates that consume it, the state and the time of discovery; a library version without a published package is Discovered and not Published. A `CompatibilityEntry` is one cell of the matrix: subject kind (template or library), subject id and version, the kind it is checked with (library, runtime, edition, topology or template), the id and optional version of that, the result (Compatible, CompatibleWithWarnings, Incompatible or Unknown), the evidence reference and the time of the check; a cell is Compatible only with evidence and Unknown without. The store `template-registry-sql` is owned by this service alone (ADR-0028 decision 5). The model lists four tables for it; the fourth, `PendingBuildEvidence`, is migrated by AIFACTORY-US-705 with the handler that writes it (D123). This PBI migrates the other three, `TemplateVersions` keyed by template id and version, `LibraryVersions` keyed by library id and version and `CompatibilityEntries` keyed by entry id, with the columns of the model, the index over state and layer of template versions, the index over area and state of library versions and the unique index over the six columns that identify a cell. Every mapping carries the tenant row filter of the Factory profile. Through I4 the catalog holds the templates and libraries of the platform tenant only (D123): every row is written with the platform tenant, and the read filter admits the rows of the platform tenant beside those of the tenant of the caller. The filter admits the platform tenant for reading only: a command changes rows of the tenant of its caller, so a row of the platform tenant is changed by a caller of the platform tenant, by a worker or by an inbox handler and never by a caller of another tenant (AIFACTORY-US-702). Templates owned by a tenant are a later feature. No deletion job and no deletion-order handler is built here: the model lists no retention event for this service, and those handlers arrive with RetentionResidencyService in I4. Kind: enabling. Traces: services: TemplateRegistryService; aggregates: TemplateRegistryService/TemplateVersion, TemplateRegistryService/LibraryVersion, TemplateRegistryService/CompatibilityEntry; adrs: ADR-0015, ADR-0028; requirements: NFR-13. Depends on: feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:contracts-package. Sources: model/services/template-library/TemplateRegistryService.yaml, model/template-parameters/connectsoft-base.yaml, model/stores.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#domain-model.",
      "acceptanceCriteria": [
        "AC1: Given the repository created and scaffolded in I0 by AIFACTORY-TASK-132 of feature repository-and-pipeline-conventions with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.TemplateRegistryService --UseFactoryProfile true` from the base template package at the version the gate of feature `component-base-template-factory-profile` published, when its pipeline runs, then the committed output equals the generated output, the solution builds in Release, the generated tests pass with complete reports, a container image is published and the repository records the template version (ADR-0028, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given the `TemplateRegistryService/TemplateVersion`, `TemplateRegistryService/LibraryVersion` and `TemplateRegistryService/CompatibilityEntry` aggregates, when their unit tests run, then a template version is created Discovered and accepts exactly the transitions Discovered to Verified, Verified to Published and Published to Deprecated and refuses every other one, a transition out of Deprecated or into Retired among them; a change of the manifest of a pinned version is refused; a library version without a published package cannot be Published; and a cell cannot be Compatible without an evidence reference and is Unknown without one (model/services/template-library/TemplateRegistryService.yaml).",
        "AC3: Given `template-registry-sql` created by the migrations of the repository on an isolated test database, when the mapping tests run, then the three tables exist with their keys and indexes, a second row for one template id and version, for one library id and version or for one cell of the six identifying columns violates its key or its unique index, a query made for one tenant returns the rows of that tenant and of the platform tenant and never a row of another tenant, and a version of another tenant is not found when addressed (ADR-0015, model/stores.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#domain-model"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-133",
        "AIFACTORY-TASK-134",
        "AIFACTORY-TASK-2832"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8202,
      "kind": "enabling",
      "traces": {
        "services": [
          "TemplateRegistryService"
        ],
        "aggregates": [
          "TemplateRegistryService/TemplateVersion",
          "TemplateRegistryService/LibraryVersion",
          "TemplateRegistryService/CompatibilityEntry"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-13"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:contracts-package"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#domain-model"
      ],
      "titlePrefix": "[AIFACTORY-US-701]",
      "number": 701
    },
    {
      "id": "AIFACTORY-TASK-133",
      "type": "task",
      "parent": "AIFACTORY-US-701",
      "title": "Domain model: TemplateVersion, LibraryVersion, CompatibilityEntry",
      "sequence": "15.03.02.01",
      "description": "Domain model: TemplateVersion, LibraryVersion, CompatibilityEntry. Expected output: The three aggregates enforce the invariants of the model as it words them; the TemplateVersion is created Discovered and accepts only the transitions Discovered to Verified, Verified to Published and Published to Deprecated, keeps its manifest and manifest hash unchanged after creation and takes its release id with the transition to Published; the LibraryVersion is Published only with a published package; the CompatibilityEntry is Compatible only with an evidence reference; unit tests cover every invariant, each of the three transitions and the refusal of every other one.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three aggregates enforce the invariants of the model as it words them; the TemplateVersion is created Discovered and accepts only the transitions Discovered to Verified, Verified to Published and Published to Deprecated, keeps its manifest and manifest hash unchanged after creation and takes its release id with the transition to Published; the LibraryVersion is Published only with a published package; the CompatibilityEntry is Compatible only with an evidence reference; unit tests cover every invariant, each of the three transitions and the refusal of every other one."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-133]",
      "number": 133
    },
    {
      "id": "AIFACTORY-TASK-134",
      "type": "task",
      "parent": "AIFACTORY-US-701",
      "title": "Persistence in template-registry-sql: TemplateVersions, LibraryVersions, CompatibilityEntries",
      "sequence": "15.03.02.02",
      "description": "Persistence in template-registry-sql: TemplateVersions, LibraryVersions, CompatibilityEntries. Expected output: Mappings and migrations for the three tables with the columns the model lists, the keys over template id and version and over library id and version, the index IX_Templates_State, the index IX_Libraries_Area, the unique index UX_Compat_Cell and the tenant filter in every mapping, the filter admitting the platform tenant for reading and never for a command of a caller of another tenant; mapping tests run against an isolated test database, never a shared one.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Mappings and migrations for the three tables with the columns the model lists, the keys over template id and version and over library id and version, the index IX_Templates_State, the index IX_Libraries_Area, the unique index UX_Compat_Cell and the tenant filter in every mapping, the filter admitting the platform tenant for reading and never for a command of a caller of another tenant; mapping tests run against an isolated test database, never a shared one."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8202,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-134]",
      "number": 134
    },
    {
      "id": "AIFACTORY-TASK-2832",
      "type": "task",
      "parent": "AIFACTORY-US-701",
      "title": "Verify the scaffold, the aggregates and the store of TemplateRegistryService",
      "sequence": "15.03.02.03",
      "description": "Verify the scaffold, the aggregates and the store of TemplateRegistryService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the three aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-701 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the repository pipeline; the generated tests, the unit tests of the three aggregates and the mapping tests on an isolated database pass, and a diff of the committed tree against a fresh generation at the recorded template version shows only the files this PBI added, which proves AC1 to AC3 of AIFACTORY-US-701 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2832]",
      "number": 2832
    },
    {
      "id": "AIFACTORY-US-702",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "TemplateRegistryService host: six REST routes, one gRPC method, an inbox for four consumed events and the self-subscription that triggers the CompatibilityComputer, and two hosted workers",
      "sequence": "15.03.03",
      "description": "This PBI turns the scaffold of AIFACTORY-US-701 into a host on which the behaviour PBIs of the feature land. From the service descriptor the host exposes the six REST operations of the model for its platform gateway and the internal gRPC service `Catalog` with the method `ResolveManifest`, with their contract documents, an OpenAPI document and a proto. A user token reaches the service forwarded by TemplateCatalogHost: the service validates it again through the resource-server library the profile wires and accepts the audience of its own gateway (ADR-0015 amendment D117). That gateway is delivered in the same increment (D123), and the audience the service accepts is the audience of that gateway from the first deployment on. Each route requires its scope: `factory.catalog.read` for `ListTemplates`, `GetTemplateVersion`, `ListLibraries` and `QueryCompatibility`, and `factory.catalog.admin` for `DiscoverTemplates` and `PublishTemplateVersion`. The role policies narrow the admin scope as the model words it: the two commands admit an Asset maintainer and a Platform admin, and a Requester or an Observer issues neither; the four reads admit the four roles of the model, Requester, Asset maintainer, Platform admin and Observer. The policy of the two commands also names the tenant of the caller, as the model states it (D123). Through I4 the catalog holds the rows of the platform tenant only, to which every template version the `Discoverer` writes belongs, and only an administrator of that tenant discovers and publishes. `DiscoverTemplates` and `PublishTemplateVersion` are therefore admitted only for an Asset maintainer or a Platform admin whose token names the platform tenant; an Asset maintainer or a Platform admin of another tenant, who can read those rows, is answered 403 by either command, no pass starts and no candidate is submitted. The tenant of a user call comes from the token. The gRPC method requires a workload identity whose token holds the service scope that names TemplateRegistryService; the model names as its callers GenerationRecipeService, BlueprintService, whose Validator evaluates the rule MOD-002 of a Module Blueprint against the manifest (D123), and AgentRuntimeWorker. A workload token carries no tenant claim, and the service reads the tenant and project a workload forwards only because the token holds that service scope (ADR-0015 amendment D114). A resource of another tenant is invisible under the tenant row filter and is answered 404, over gRPC NOT_FOUND, while a missing scope or role inside the tenant of the caller is answered 403, over gRPC PERMISSION_DENIED (D113); the filter is wired here and the answers are proven by the behaviour PBIs. Every modelled refusal code has a problem response. All six REST operations declare the idempotency `natural`, so the host carries no `Idempotency-Key` filter: a repeated command is made harmless by the natural key of what it writes. The messaging profile of the service is named `template-registry`, the value of `OrleansMessaging:ServiceName`, and its inbox and outbox belong to this service alone (ADR-0028). The outbox writer enlists in the unit of work of a command, of an inbox handler and of a worker step, and the dispatcher publishes the four events of the model in the run event envelope of the contracts package with their routes declared in the `OrleansMessaging` section. The inbox holds five registrations with deduplication on the event id: the four consumed events of the model, `AssetReleasePublished` and `AssetReleaseDeprecated` of AgentRegistryService, `PipelineRunCompleted` of PipelineExecutionService and `ChunksPublished` of KnowledgeIngestionService, and the self-subscription to `TemplateVersionDiscovered` of the service itself, which is the trigger of the `CompatibilityComputer`. What the first three handlers do is delivered by AIFACTORY-US-705 and AIFACTORY-US-708. The fourth is delivered here. The model gives `RefreshDocs` the purpose that template documentation ingested by the Knowledge platform refreshes the docs links of the catalog. The payload of `ChunksPublished` names a snapshot, a source, a tenant, a chunk count and an embedding profile version and no template, repository or commit; a manifest is never edited in the catalog, and no table of the model has a column for a docs link. The handler is therefore built with the least effect the model words: idempotent on the event id, it logs the snapshot and the source, changes no row and publishes nothing; what it refreshes and where that is kept is reported to the owner. The thin KnowledgeIngestionService of this increment ingests nothing and publishes no `ChunksPublished`, so the handler is proven with a fixture publisher. The service registers no handler for a retention or deletion-order event: the model lists none for it, and those handlers are built in I4 with RetentionResidencyService. The two workers of the model are hosted with their triggers and limits: the `Discoverer` on the schedule `0 */6 * * *`, which is the default 6 of `Templates:Catalog:DiscoverIntervalHours`, two attempts 600 seconds apart, four in parallel partitioned by repository, keyed by repository and commit; the `CompatibilityComputer` on `TemplateVersionDiscovered`, two attempts 120 seconds apart, four in parallel partitioned by subject id, keyed by cell and evidence. A duplicate trigger has no second effect. The four options of the model are bound and validated at start: `Templates:Catalog:DiscoverIntervalHours`, `Templates:Catalog:Runtimes`, `Templates:Feeds:PackageFeeds` and `OrleansMessaging:ServiceName`; a value that does not parse stops the start with the option named, and a reloaded value of one of the first three, which are reloadable, applies from the next pass or the next computation and never to one in flight. Readiness reports the store and the messaging profile. What each operation, handler and worker does is delivered by AIFACTORY-US-704 to AIFACTORY-US-708, not here. Kind: enabling. Traces: services: TemplateRegistryService, KnowledgeIngestionService; aggregates: TemplateRegistryService/TemplateVersion; events: KnowledgeIngestionService/ChunksPublished; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028; requirements: NFR-13. Depends on: AIFACTORY-US-701, feature:component-base-template-factory-profile, feature:contracts-package, feature:knowledge-ingestion-service-thin. Sources: model/services/template-library/TemplateRegistryService.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/gateways.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given the hosted service, when each of the six REST operations of model/services/template-library/TemplateRegistryService.yaml is called without a token and with a token that lacks the scope of the route, then the answers are 401 and 403 with a problem response; when one of the two commands is called by an Observer or a Requester who holds `factory.catalog.admin`, or by an Asset maintainer or a Platform admin whose token names another tenant than the platform tenant, then the answer is 403; a gRPC call without a workload identity or without the service scope is refused with UNAUTHENTICATED or PERMISSION_DENIED; a user token whose audience is not the gateway of the service is refused with 401; no state changes (ADR-0015).",
        "AC2: Given a handler that changes a `TemplateRegistryService/TemplateVersion` and publishes one of the four declared events, when its unit of work commits, then one outbox record in `run-event-envelope-v1` with event id, tenant id, correlation id and payload is committed in the same transaction; when the unit of work rolls back, neither the change nor the record exists; a publish of an event the `OrleansMessaging` section does not declare throws (ADR-0012, ADR-0014).",
        "AC3: Given the same event id delivered twice to the inbox of the `template-registry` messaging profile, or the same trigger of a hosted worker fired twice under one idempotency key, when it is dispatched, then the handler or the worker runs once and the second delivery has no effect; a handler that keeps failing is retried with backoff and never applied twice; given a fixture publisher of `KnowledgeIngestionService/ChunksPublished`, when the event is delivered, the same event id twice, then the `RefreshDocs` handler runs once, logs the snapshot and the source, changes no `TemplateRegistryService/TemplateVersion` and publishes nothing; an event the delivery does not subscribe to, a retention or deletion-order event among them, reaches no handler (ADR-0012).",
        "AC4: Given the service starts, when liveness and readiness are probed, then readiness answers ready only after `template-registry-sql` is migrated and the messaging profile has started, and it names what is missing while it is unready; the four options of model/services/template-library/TemplateRegistryService.yaml are bound with their modelled defaults; a value that does not parse stops the start with the option named; a reloaded `Templates:Catalog:DiscoverIntervalHours`, `Templates:Catalog:Runtimes` or `Templates:Feeds:PackageFeeds` applies from the next pass or computation; and traces and logs carry the tenant of the call (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-135",
        "AIFACTORY-TASK-136",
        "AIFACTORY-TASK-137",
        "AIFACTORY-TASK-2833"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8203,
      "kind": "enabling",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "KnowledgeIngestionService"
        ],
        "aggregates": [
          "TemplateRegistryService/TemplateVersion"
        ],
        "events": [
          "KnowledgeIngestionService/ChunksPublished"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-13"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-701",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package",
        "feature:knowledge-ingestion-service-thin"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-702]",
      "number": 702
    },
    {
      "id": "AIFACTORY-TASK-135",
      "type": "task",
      "parent": "AIFACTORY-US-702",
      "title": "API hosting skeleton: REST and gRPC hosts, scope and role policies, problem responses and contract documents for the 6 REST and 1 gRPC operations",
      "sequence": "15.03.03.01",
      "description": "API hosting skeleton: REST and gRPC hosts, scope and role policies, problem responses and contract documents for the 6 REST and 1 gRPC operations. Expected output: The six REST routes and the gRPC method Catalog.ResolveManifest are hosted with JWT validation that accepts the audience of the gateway of the service, the scope of each route, the role policy that admits an Asset maintainer and a Platform admin of the platform tenant to DiscoverTemplates and PublishTemplateVersion and answers 403 to a caller of another tenant, the workload identity and service scope check on the gRPC method, problem responses for every modelled refusal code, and the OpenAPI and proto documents; no Idempotency-Key filter is hosted, because every operation declares the idempotency natural; the behaviour of each operation is delivered by AIFACTORY-US-704 to AIFACTORY-US-708, not here.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The six REST routes and the gRPC method Catalog.ResolveManifest are hosted with JWT validation that accepts the audience of the gateway of the service, the scope of each route, the role policy that admits an Asset maintainer and a Platform admin of the platform tenant to DiscoverTemplates and PublishTemplateVersion and answers 403 to a caller of another tenant, the workload identity and service scope check on the gRPC method, problem responses for every modelled refusal code, and the OpenAPI and proto documents; no Idempotency-Key filter is hosted, because every operation declares the idempotency natural; the behaviour of each operation is delivered by AIFACTORY-US-704 to AIFACTORY-US-708, not here."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-135]",
      "number": 135
    },
    {
      "id": "AIFACTORY-TASK-136",
      "type": "task",
      "parent": "AIFACTORY-US-702",
      "title": "Messaging skeleton: outbox and inbox wiring of the template-registry profile for 4 published events, 4 consumed events and the self-subscription that triggers the CompatibilityComputer",
      "sequence": "15.03.03.02",
      "description": "Messaging skeleton: outbox and inbox wiring of the template-registry profile for 4 published events, 4 consumed events and the self-subscription that triggers the CompatibilityComputer. Expected output: The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the template-registry messaging profile publishes TemplateVersionDiscovered, TemplateVersionPublished, LibraryVersionDiscovered and CompatibilityChecked in the run event envelope of the pinned contracts package; the inbox registers the four consumed events AssetReleasePublished, AssetReleaseDeprecated, PipelineRunCompleted and ChunksPublished and, as its fifth registration, the self-subscription to TemplateVersionDiscovered that triggers the CompatibilityComputer, each with deduplication on the event id; the RefreshDocs handler of ChunksPublished logs the snapshot and the source, changes no row and publishes nothing; no handler of a retention or deletion-order event is registered; what the other three handlers do is delivered by AIFACTORY-US-705 and AIFACTORY-US-708.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The outbox writer enlists in the unit of work of a command, a handler and a worker step, and the dispatcher of the template-registry messaging profile publishes TemplateVersionDiscovered, TemplateVersionPublished, LibraryVersionDiscovered and CompatibilityChecked in the run event envelope of the pinned contracts package; the inbox registers the four consumed events AssetReleasePublished, AssetReleaseDeprecated, PipelineRunCompleted and ChunksPublished and, as its fifth registration, the self-subscription to TemplateVersionDiscovered that triggers the CompatibilityComputer, each with deduplication on the event id; the RefreshDocs handler of ChunksPublished logs the snapshot and the source, changes no row and publishes nothing; no handler of a retention or deletion-order event is registered; what the other three handlers do is delivered by AIFACTORY-US-705 and AIFACTORY-US-708."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-136]",
      "number": 136
    },
    {
      "id": "AIFACTORY-TASK-137",
      "type": "task",
      "parent": "AIFACTORY-US-702",
      "title": "Worker hosting skeleton: schedule, partitioning and retry policies of Discoverer and CompatibilityComputer",
      "sequence": "15.03.03.03",
      "description": "Worker hosting skeleton: schedule, partitioning and retry policies of Discoverer and CompatibilityComputer. Expected output: The two workers are hosted with their modelled triggers, retry policies, partitioning and idempotency keys: the Discoverer on the schedule that Templates:Catalog:DiscoverIntervalHours gives, two attempts 600 seconds apart, four in parallel by repository, keyed by repository and commit; the CompatibilityComputer on TemplateVersionDiscovered, two attempts 120 seconds apart, four in parallel by subject id, keyed by cell and evidence; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-704 and AIFACTORY-US-705.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two workers are hosted with their modelled triggers, retry policies, partitioning and idempotency keys: the Discoverer on the schedule that Templates:Catalog:DiscoverIntervalHours gives, two attempts 600 seconds apart, four in parallel by repository, keyed by repository and commit; the CompatibilityComputer on TemplateVersionDiscovered, two attempts 120 seconds apart, four in parallel by subject id, keyed by cell and evidence; a duplicate trigger has no second effect; what each worker does is delivered by AIFACTORY-US-704 and AIFACTORY-US-705."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-137]",
      "number": 137
    },
    {
      "id": "AIFACTORY-TASK-2833",
      "type": "task",
      "parent": "AIFACTORY-US-702",
      "title": "Verify the hosted surface, the messaging profile and the worker hosts of TemplateRegistryService",
      "sequence": "15.03.03.04",
      "description": "Verify the hosted surface, the messaging profile and the worker hosts of TemplateRegistryService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-702: the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every route, the outbox record committed and rolled back with its change, the deduplicated inbox with the RefreshDocs handler under a fixture publisher of ChunksPublished, the duplicate worker trigger, readiness and the four bound options of model/services/template-library/TemplateRegistryService.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=HostingSurface\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-702: the 401, 403, UNAUTHENTICATED and PERMISSION_DENIED answers of every route, the outbox record committed and rolled back with its change, the deduplicated inbox with the RefreshDocs handler under a fixture publisher of ChunksPublished, the duplicate worker trigger, readiness and the four bound options of model/services/template-library/TemplateRegistryService.yaml."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2833]",
      "number": 2833
    },
    {
      "id": "AIFACTORY-US-703",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "TemplateRegistryService keeps its secrets as references, filters every row by tenant, reports its three series and recovers from an unreachable feed and a lost store",
      "sequence": "15.03.04",
      "description": "As an operator, I want to see how many versions the catalog holds, how many cells lack evidence and how far its inbox lags, and to know what the service does when a feed or its store is gone, so that I can tell a stale catalog from a broken one and recover it without guessing. This PBI delivers the rules that every behaviour of the service runs under. Secrets: the model gives the service two, `messaging-transport` and `package-feed`, both in the key vault with a rotation of 90 days. Each is bound as a secret reference by name; no value is in configuration, in the image, in a log record or in telemetry, and a rotated value is picked up by reading the reference again and needs no new image. The service holds no credential of a template repository: it reaches repositories through the connectors of the Integration platform. Tenancy: the isolation of the model is the row filter. Every query runs under the tenant of the trusted scope, the rows of the platform tenant are readable by every tenant, and a row of any other tenant is invisible, so it never appears in a list and is answered 404, over gRPC NOT_FOUND, when addressed, the same answer as for an identifier that does not exist (ADR-0015 amendment D113). The filter admits the platform tenant for reading only: a command changes rows of the tenant of its caller, so the two commands of the service, which change rows of the platform tenant, answer 403 to a caller of another tenant (AIFACTORY-US-702). The data class of the catalog is internal. Telemetry: the service emits the three series of the model with their dimensions. `connectsoft.factory.templates.versions` is an up-down counter by kind, layer and state that moves with every version recorded and every state change, so the sum over the states is the number of versions of the catalog. `connectsoft.factory.templates.compatibility_unknown` is an up-down counter by subject kind that holds the number of cells without evidence. `connectsoft.factory.templates.inbox_lag` is a gauge in seconds by service that holds the age of the oldest unprocessed inbox message. Each is recorded through the helper of the pinned observability library (feature `component-observability-factory-conventions`), which puts the tenant, and the project where a call has one, on the instrument by default (ADR-0019); traces and logs carry the scope of the call, and no log record, activity or metric holds a token or a secret. Health: liveness needs no dependency; readiness reports `template-registry-sql` and the messaging profile; the health detail names the four outbound dependencies of the model with their state. ConnectorRegistryService and the Azure DevOps system are required and degrade, RepositoryIntelligenceService is optional and degrades, so their outage shows in the detail and leaves the service ready; AgentRegistryService is required and fail-fast, so a publication that needs it fails fast while the reads keep serving. The two failure modes of the model are built and written down. Feed unreachable: discovery errors are the detection signal; the last pinned manifests stay, new versions are not discovered until the feed is back, the cells stay as they were, and the reads serve the stale catalog; the next pass after the feed returns catches up, because a pass is idempotent on repository and commit. Service store lost: readiness is the detection signal; the store is restored from its backup, whose recovery point objective is 15 minutes, and a discovery pass then reads the manifests again from the template repositories and derives the compatibility again, which loses nothing because every row of the catalog is derived from a repository, a feed or an event. The objectives of the model, 360 minutes to recover from a feed outage and 240 minutes from a lost store, are measured once the system is deployed and no value is claimed here. Kind: enabling. Traces: services: TemplateRegistryService; adrs: ADR-0015, ADR-0019, ADR-0028; requirements: NFR-13, NFR-18. Depends on: AIFACTORY-US-701, AIFACTORY-US-702, feature:component-observability-factory-conventions. Sources: model/services/template-library/TemplateRegistryService.yaml, model/stores.yaml, docs/architecture/adr/0019-data-governance.md, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#security, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#metrics-and-observability, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the deployment manifest and the configuration of the service, when they are scanned together with the image and the captured logs of the acceptance suite, then `messaging-transport` and `package-feed` appear as secret references by name only and no secret value, token or feed credential is found; given a rotated value behind a reference, when the service reads the reference again, then it uses the new value without a new image (model/services/template-library/TemplateRegistryService.yaml).",
        "AC2: Given rows of the platform tenant and of two other tenants in the three tables, when every read path of the service is exercised for a caller of one tenant, then only the rows of that tenant and of the platform tenant are returned, a row of the other tenant is answered 404 or NOT_FOUND when addressed, and an architecture test fails on a query that bypasses the tenant filter (ADR-0015).",
        "AC3: Given a discovery pass, a computed cell and a delayed inbox message, when the metrics are read, then `connectsoft.factory.templates.versions` holds the versions by kind, layer and state, `connectsoft.factory.templates.compatibility_unknown` the cells without evidence by subject kind and `connectsoft.factory.templates.inbox_lag` the age of the oldest unprocessed message, each with the tenant the helper adds, and no log record, activity or metric holds a token or a secret (ADR-0019, model/services/template-library/TemplateRegistryService.yaml).",
        "AC4: Given a feed that does not answer, when a discovery pass runs, then the error is logged and shown as degraded in the health detail, readiness stays ready, the pinned manifests and the cells stay as they were and the reads keep answering; given the store is lost and restored, when a discovery pass runs again, then the manifests are read again from the template sources and the cells derived again, and no version and no cell exists twice (NFR-18, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#security",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#metrics-and-observability",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-138",
        "AIFACTORY-TASK-2834",
        "AIFACTORY-TASK-2835"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8204,
      "kind": "enabling",
      "traces": {
        "services": [
          "TemplateRegistryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-13",
          "NFR-18"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-701",
        "AIFACTORY-US-702",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/stores.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#security",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#metrics-and-observability",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-703]",
      "number": 703
    },
    {
      "id": "AIFACTORY-TASK-138",
      "type": "task",
      "parent": "AIFACTORY-US-703",
      "title": "Security, tenancy and telemetry of TemplateRegistryService",
      "sequence": "15.03.04.01",
      "description": "Security, tenancy and telemetry of TemplateRegistryService. Expected output: The two secrets of the model are bound as secret references by name and read again on rotation; every query runs under the tenant filter, which admits the platform tenant for reading; the three series connectsoft.factory.templates.versions, connectsoft.factory.templates.compatibility_unknown and connectsoft.factory.templates.inbox_lag are recorded with their modelled dimensions through the helper of the pinned observability library; the health detail names ConnectorRegistryService, AgentRegistryService, RepositoryIntelligenceService and the Azure DevOps system with their state, and only the store and the messaging profile decide readiness.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two secrets of the model are bound as secret references by name and read again on rotation; every query runs under the tenant filter, which admits the platform tenant for reading; the three series connectsoft.factory.templates.versions, connectsoft.factory.templates.compatibility_unknown and connectsoft.factory.templates.inbox_lag are recorded with their modelled dimensions through the helper of the pinned observability library; the health detail names ConnectorRegistryService, AgentRegistryService, RepositoryIntelligenceService and the Azure DevOps system with their state, and only the store and the messaging profile decide readiness."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-138]",
      "number": 138
    },
    {
      "id": "AIFACTORY-TASK-2834",
      "type": "task",
      "parent": "AIFACTORY-US-703",
      "title": "Runbook of the two failure modes of TemplateRegistryService",
      "sequence": "15.03.04.02",
      "description": "Runbook of the two failure modes of TemplateRegistryService. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/template-library/TemplateRegistryService.yaml, feed unreachable and service store lost, each with its detection signal, what the service keeps serving, the recovery step and the modelled objective; the entry of the lost store states the restore from backup, the discovery pass that reads the manifests again and the derivation of the cells, and that a pass is idempotent on repository and commit (NFR-18).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/template-library/TemplateRegistryService.yaml, feed unreachable and service store lost, each with its detection signal, what the service keeps serving, the recovery step and the modelled objective; the entry of the lost store states the restore from backup, the discovery pass that reads the manifests again and the derivation of the cells, and that a pass is idempotent on repository and commit (NFR-18)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8204,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2834]",
      "number": 2834
    },
    {
      "id": "AIFACTORY-TASK-2835",
      "type": "task",
      "parent": "AIFACTORY-US-703",
      "title": "Verify secrets, tenancy, telemetry and the two failure modes of TemplateRegistryService",
      "sequence": "15.03.04.03",
      "description": "Verify secrets, tenancy, telemetry and the two failure modes of TemplateRegistryService. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=SecretsTenancyTelemetry\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-703: the scan for secret values, the three-tenant read matrix with its architecture test, the three series with their dimensions, a feed that stops answering and a store that is emptied and filled again by a discovery pass over the recorded sources.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --filter \"Category=Acceptance&Feature=SecretsTenancyTelemetry\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-703: the scan for secret values, the three-tenant read matrix with its architecture test, the three series with their dimensions, a feed that stops answering and a store that is emptied and filled again by a discovery pass over the recorded sources."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2835]",
      "number": 2835
    },
    {
      "id": "AIFACTORY-US-704",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "Discover published template package versions and library versions on schedule or on demand, pin each manifest by hash at the commit of its package and announce each new version once",
      "sequence": "15.03.05",
      "description": "As an asset maintainer, I want the catalog to read the template repositories and the feeds again on its schedule and whenever I ask, so that a new template or library version is in the catalog with what was really committed and published, and nobody types a manifest in. The `Discoverer` is the only writer of new versions of the catalog. It runs on its schedule, at minute 0 of every sixth hour by default, and whenever a caller starts it through `TemplateRegistryService/DiscoverTemplates`. In one pass it reads every feed of `Templates:Feeds:PackageFeeds` and every template source through one source port. A template is consumed by its published package version and never by a path, so a `TemplateVersion` is one published version of the template package. For each version of the package of a template source that a feed lists and the catalog has not pinned, the pass takes the commit that package was built from, reads `.template.config`, the project files, the pipelines and the docs of the repository at that commit, builds the manifest of the model, that is the short name, the projects and their roles with the target frameworks their project files declare, the switches with their allowed values, the generated and preserved paths, the pipelines and the docs, computes the manifest hash and writes a `TemplateVersion` with the template id, the version of the package, the layer, the repository, the commit, the manifest, the manifest hash and the state Discovered. A commit of a template repository for which no package version is published on a feed creates no version, the head commit among them, so the catalog never pins what nobody can install, and a recipe that pins a version validates against the manifest of the commit its package was built from. The template id is the short name, which is the templates catalog id of model/templates.yaml. A template version is a published package version of the template, pinned at the commit its package states (D123). The version of a template package is given when the package is packed and `.template.config` holds none (Docs/Build Process.md of ConnectSoft.BaseTemplate), so the version comes from the feed. That documentation names no member of the package that states the commit it was built from, which is reported to the owner. The source port therefore returns the commit of a package version from the repository metadata of the package where the package carries it; a package version that states no commit is not pinned, creates no version and is logged with its package id and version. The layer of a template has no source in the model or in the documentation of the templates, which is reported to the owner as well: neither `.template.config` nor the package states it, and model/templates.yaml records it at design time only. The layer therefore comes from the entry of the template source, which names the template id, the repository, the package id and the layer. The switches of a manifest are the parameters the template declares in its own `.template.config`. The design-time snapshot of the same parameter contracts is model/template-parameters, and the catalog restates none of them: a fixture test compares the switches the Discoverer extracts from a recorded template source with the snapshot file of that template and fails on a parameter the snapshot has and the manifest lacks. A manifest is never edited in the catalog. A changed template becomes visible when a new version of its package is published: a package version that is already pinned and is found again with another commit or another manifest hash writes nothing and is logged with both commits and both hashes. The summary of the aggregate names the consumers of a template version, while its fields and the table `TemplateVersions` hold none and the model does not say what a consumer of a template version is, a template that extends it or a repository that was generated from it; the pass derives and stores none, and the gap is reported to the owner. For a library the pass reads the packages and their versions from the feed and the layer, the capability area, the options sections and the registration API from the repository, and writes a `LibraryVersion` with the library id, which is the libraries catalog id of model/libraries.yaml, and the templates that consume it, derived from the package references of the project files the pass has read. Its state follows the invariant of the model: a library version without a published package on the feed is Discovered and not Published, and one whose packages are published is recorded Published. Each new version is written together with its outbox record in one transaction: `TemplateVersionDiscovered` with `templateId`, `version`, `layer` and `commit`, and `LibraryVersionDiscovered` with `libraryId`, `version`, `area` and `state`. The envelope of each event names the platform tenant (D123). `TemplateVersionDiscovered` is published for every discovered version, whatever becomes of it later: until the evaluation gate of AgentRegistryService is delivered in I4 a recipe may bind a discovered version that is not yet Published, and GenerationRecipeService hears the version through this event as one a recipe may bind. The pass is idempotent on repository and commit: a package version whose commit is already pinned writes nothing and publishes nothing. Up to four repositories are read in parallel, partitioned by repository; a repository or a feed that cannot be read is tried a second time after 600 seconds and then left for the next pass, while the other repositories proceed. When a feed is unreachable the last pinned manifests stay, no new version is discovered until it is back and the cells stay as they were. A caller whose scope carries `factory.catalog.admin`, who is Asset maintainer or Platform admin and whose token names the platform tenant starts a pass now through `TemplateRegistryService/DiscoverTemplates`. The operation is of the shared-write class, has no modelled request body and answers 202: the pass runs after the answer. The command leaves evidence: the Factory sink of the audit library, consumed by a version pin from feature `component-audit-factory-evidence`, writes an `audit-evidence-v1` record that names the actor and the action to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` in the run event envelope. Its idempotency is natural: a repeated call starts a pass that finds every published package version pinned and changes nothing. A pass that is lost with a replica is made up by the next scheduled pass. A call without a token is answered 401. A caller without the scope, a Requester or an Observer is answered 403, and so is an Asset maintainer or a Platform admin whose token names another tenant than the platform tenant, because through I4 only an administrator of the platform tenant discovers (D123); no pass starts and no evidence is written. The source port has two bindings. The acceptance suite binds it to recorded sources. A deployed instance binds it to the connector adapter this PBI builds: the adapter resolves the repositories capability of the Azure DevOps connector for the platform tenant through `Connectors.ResolveCapability` of ConnectorRegistryService. Because a connection is registered and granted to a project of a tenant through IntegrationHost from I1 (D129) and the request `execution-scope-v1` of that call requires a `projectId`, the adapter forwards the template-feed project of the platform tenant, which it takes from configuration, and a deployed instance without that setting discovers nothing and logs that; which project of the platform tenant holds the grant of the template feeds is an owner input, an entry of the I1 precondition register of AIFACTORY-US-1339 that the owner supplies before the I1 run (D140). The adapter then reads the files of a repository at a commit from the Azure DevOps system through the connection that call returns, and lists the versions of a package on a feed of `Templates:Feeds:PackageFeeds` in Azure Artifacts with the secret reference `package-feed`. It stores no credential, and a read that fails, an unresolved connector among them, surfaces as the discovery error of the failure mode Feed unreachable. The adapter is contract-tested against a stub of the connector and of the Azure DevOps endpoints. The delivery states its limits, each reported to the owner. The model names the feeds in an option and names no option and no operation that lists the template repositories: the source port returns the template sources it is configured with, and a deployed instance whose port has no template source discovers no template, logs that and invents no list. The model names no operation of ConnectorRegistryService that returns repository content and gives the reply of `Connectors.ResolveCapability` the descriptor `tool-invocation-v1`, so the adapter calls the Azure DevOps system itself, and how the resolved connection authorizes that read is reported. The thin ConnectorRegistryService of this increment names the Azure DevOps connector for template feeds in its scope and does not list `Connectors.ResolveCapability` among the operations it answers, so the adapter is proven against the stub until that method is hosted. The model also names the GitHub connector and lists no GitHub system among the dependencies of the service; the adapter binds Azure DevOps, and a template source on GitHub is not read. RepositoryIntelligenceService is an optional dependency for the dependency graphs of template repositories: this delivery derives the consumers of a library from the package references it reads itself and waits for no graph. The consumers of the two events, StudioBff, AuditService and GenerationRecipeService, handle them in their own PBIs. Kind: behavior. Traces: services: TemplateRegistryService, ConnectorRegistryService; aggregates: TemplateRegistryService/TemplateVersion, TemplateRegistryService/LibraryVersion; apis: TemplateRegistryService/DiscoverTemplates; events: TemplateRegistryService/TemplateVersionDiscovered, TemplateRegistryService/LibraryVersionDiscovered; descriptors: run-event-envelope-v1, audit-evidence-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: NFR-13; scenarios: SCN-TemplateRegistryService-005, SCN-TemplateRegistryService-008, SCN-TemplateRegistryService-010. Relates: screens: template-catalog. Depends on: AIFACTORY-US-701, AIFACTORY-US-702, feature:connector-registry-service-thin, feature:component-audit-factory-evidence. Sources: model/services/template-library/TemplateRegistryService.yaml, model/templates.yaml, model/libraries.yaml, model/template-parameters/connectsoft-base.yaml, model/services/integration/ConnectorRegistryService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/solution-packs/software-factory/templates/parameters.md, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a recorded template source whose package has a version on the recorded feed that is not yet pinned and that states the commit it was built from, when the scheduled trigger fires or a caller of the platform tenant with `factory.catalog.admin` who is Asset maintainer or Platform admin calls `TemplateRegistryService/DiscoverTemplates`, then the command answers 202 and writes one `audit-evidence-v1` record with the actor to the outbox in its transaction, and the pass writes one `TemplateRegistryService/TemplateVersion` in state Discovered with the template id, the version of the package, the layer of the source entry, the repository, the commit of the package, the manifest read at that commit and the manifest hash, together with the `TemplateRegistryService/TemplateVersionDiscovered` outbox record in one transaction, whose envelope names the platform tenant; a head commit without a published package version and a package version that states no commit create no version (SCN-TemplateRegistryService-005, SCN-TemplateRegistryService-008, ADR-0014).",
        "AC2: Given a recorded feed with a library whose packages are published and one whose packages are not, when the pass runs, then one `TemplateRegistryService/LibraryVersion` exists per library version with its packages, layer, area and consuming templates, the first in state Published and the second in state Discovered, each written with its `TemplateRegistryService/LibraryVersionDiscovered` outbox record, whose payload carries `libraryId`, `version`, `area` and `state`, in one transaction (SCN-TemplateRegistryService-010).",
        "AC3: Given a pass that has pinned every published package version, when the trigger fires again or `TemplateRegistryService/DiscoverTemplates` is called again, then no row is written and no event is published; given a package version that is already pinned and is found again with another commit or another manifest hash, when the pass reads it, then the pinned `TemplateRegistryService/TemplateVersion` is unchanged, nothing is published and both commits and both hashes are logged; given a recorded template source and the snapshot file of that template under model/template-parameters, when the fixture test runs, then every parameter of the snapshot is a switch of the extracted manifest (SCN-TemplateRegistryService-005).",
        "AC4: Given a call to `TemplateRegistryService/DiscoverTemplates` without a token, with a token that lacks `factory.catalog.admin`, by a Requester or an Observer, or by an Asset maintainer or a Platform admin whose token names another tenant than the platform tenant, when it arrives, then the answer is 401 for the first and 403 for the others with a problem response, no pass starts, no evidence record is written and no state changes (SCN-TemplateRegistryService-005, ADR-0015).",
        "AC5: Given a feed or a template source that does not answer, when the pass runs, then that source is tried a second time after 600 seconds and then left for the next pass, the versions already pinned stay as they were, the other sources are read, and no event is published for the failed source; given the connector adapter of the source port with a stub of ConnectorRegistryService and of the Azure DevOps endpoints, when its contract tests run, then it resolves the connector through `Connectors.ResolveCapability`, reads a repository at a commit and lists the versions of a package on a feed with the secret reference `package-feed`, and a failed read or an unresolved connector surfaces as the same discovery error; given the transport is unavailable when the dispatcher publishes `TemplateRegistryService/TemplateVersionDiscovered` on `template-catalog.templates.v1.template-version-discovered` or `TemplateRegistryService/LibraryVersionDiscovered` on `template-catalog.libraries.v1.library-version-discovered`, then the committed rows stand and the outbox retries with backoff, so the event is neither lost nor duplicated under its event id (SCN-TemplateRegistryService-008, SCN-TemplateRegistryService-010, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/templates.yaml",
        "model/libraries.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/solution-packs/software-factory/templates/parameters.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2836",
        "AIFACTORY-TASK-2868",
        "AIFACTORY-TASK-2837",
        "AIFACTORY-TASK-2838",
        "AIFACTORY-TASK-2839"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8205,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "ConnectorRegistryService"
        ],
        "aggregates": [
          "TemplateRegistryService/TemplateVersion",
          "TemplateRegistryService/LibraryVersion"
        ],
        "apis": [
          "TemplateRegistryService/DiscoverTemplates"
        ],
        "events": [
          "TemplateRegistryService/TemplateVersionDiscovered",
          "TemplateRegistryService/LibraryVersionDiscovered"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "NFR-13"
        ],
        "scenarios": [
          "SCN-TemplateRegistryService-005",
          "SCN-TemplateRegistryService-008",
          "SCN-TemplateRegistryService-010"
        ]
      },
      "relates": {
        "screens": [
          "template-catalog"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-701",
        "AIFACTORY-US-702",
        "feature:connector-registry-service-thin",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/templates.yaml",
        "model/libraries.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/solution-packs/software-factory/templates/parameters.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-704]",
      "number": 704
    },
    {
      "id": "AIFACTORY-TASK-2836",
      "type": "task",
      "parent": "AIFACTORY-US-704",
      "title": "Source port of the Discoverer with recorded template sources and a recorded feed for the acceptance suite",
      "sequence": "15.03.05.01",
      "description": "Source port of the Discoverer with recorded template sources and a recorded feed for the acceptance suite. Expected output: One source port returns the template sources, each with template id, repository, package id and layer, and the package feeds, lists the published versions of a package with the commit each states, and reads a repository at a commit; the acceptance suite binds it to recorded sources, that is the `.template.config`, project files, pipelines and docs of two templates at two commits each, a recorded feed with one package version per recorded commit, a head commit without a package version, a package version that states no commit, and a published and an unpublished library version, and can make one source stop answering; a port without a configured template source returns none and the pass logs that.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "One source port returns the template sources, each with template id, repository, package id and layer, and the package feeds, lists the published versions of a package with the commit each states, and reads a repository at a commit; the acceptance suite binds it to recorded sources, that is the `.template.config`, project files, pipelines and docs of two templates at two commits each, a recorded feed with one package version per recorded commit, a head commit without a package version, a package version that states no commit, and a published and an unpublished library version, and can make one source stop answering; a port without a configured template source returns none and the pass logs that."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8205,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2836]",
      "number": 2836
    },
    {
      "id": "AIFACTORY-TASK-2868",
      "type": "task",
      "parent": "AIFACTORY-US-704",
      "title": "Connector adapter of the source port for a deployed instance, with its contract tests against a stub of the connector",
      "sequence": "15.03.05.02",
      "description": "Connector adapter of the source port for a deployed instance, with its contract tests against a stub of the connector. Expected output: The adapter of the source port resolves the repositories capability of the Azure DevOps connector for the platform tenant through Connectors.ResolveCapability of ConnectorRegistryService with the template-feed project of the platform tenant from configuration as the projectId of execution-scope-v1 (D129), discovers nothing and logs that when the setting is absent, reads the files of a repository at a commit from the Azure DevOps system through the resolved connection, lists the versions of a package on a feed of Templates:Feeds:PackageFeeds with the secret reference package-feed and returns the commit a package version states in its repository metadata; it stores no credential; its contract tests run against a stub of the connector and of the Azure DevOps endpoints and prove a resolved read, a package version without a commit, and that a failed read or an unresolved connector surfaces as the discovery error of the failure mode Feed unreachable of model/services/template-library/TemplateRegistryService.yaml; the deployment manifest of AIFACTORY-TASK-2831 binds this adapter, and the acceptance suite binds the recorded sources of AIFACTORY-TASK-2836.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The adapter of the source port resolves the repositories capability of the Azure DevOps connector for the platform tenant through Connectors.ResolveCapability of ConnectorRegistryService with the template-feed project of the platform tenant from configuration as the projectId of execution-scope-v1 (D129), discovers nothing and logs that when the setting is absent, reads the files of a repository at a commit from the Azure DevOps system through the resolved connection, lists the versions of a package on a feed of Templates:Feeds:PackageFeeds with the secret reference package-feed and returns the commit a package version states in its repository metadata; it stores no credential; its contract tests run against a stub of the connector and of the Azure DevOps endpoints and prove a resolved read, a package version without a commit, and that a failed read or an unresolved connector surfaces as the discovery error of the failure mode Feed unreachable of model/services/template-library/TemplateRegistryService.yaml; the deployment manifest of AIFACTORY-TASK-2831 binds this adapter, and the acceptance suite binds the recorded sources of AIFACTORY-TASK-2836."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2868]",
      "number": 2868
    },
    {
      "id": "AIFACTORY-TASK-2837",
      "type": "task",
      "parent": "AIFACTORY-US-704",
      "title": "Discoverer pass that pins template manifests by hash and records library versions with their events",
      "sequence": "15.03.05.03",
      "description": "Discoverer pass that pins template manifests by hash and records library versions with their events. Expected output: The pass lists the published package versions of each template source, takes the commit of each version that is not pinned, builds the manifest from the files of the repository at that commit, with the target frameworks of the project files, computes the manifest hash and writes the TemplateVersion in state Discovered with the version of the package and the layer of the source entry, with TemplateVersionDiscovered in one transaction; it creates no version for a commit without a published package version or for a package version that states no commit, and derives no consumers of a template version; it writes a LibraryVersion with its packages, area, layer and consumers, Published only when its packages are on the feed, with LibraryVersionDiscovered in one transaction; it is idempotent on repository and commit, writes nothing for a package version that is pinned and found again with another commit or hash and logs both, tries a failed source a second time after 600 seconds and leaves it for the next pass.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The pass lists the published package versions of each template source, takes the commit of each version that is not pinned, builds the manifest from the files of the repository at that commit, with the target frameworks of the project files, computes the manifest hash and writes the TemplateVersion in state Discovered with the version of the package and the layer of the source entry, with TemplateVersionDiscovered in one transaction; it creates no version for a commit without a published package version or for a package version that states no commit, and derives no consumers of a template version; it writes a LibraryVersion with its packages, area, layer and consumers, Published only when its packages are on the feed, with LibraryVersionDiscovered in one transaction; it is idempotent on repository and commit, writes nothing for a package version that is pinned and found again with another commit or hash and logs both, tries a failed source a second time after 600 seconds and leaves it for the next pass."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2837]",
      "number": 2837
    },
    {
      "id": "AIFACTORY-TASK-2838",
      "type": "task",
      "parent": "AIFACTORY-US-704",
      "title": "DiscoverTemplates command with its role policy, its audit evidence and the pass it starts",
      "sequence": "15.03.05.04",
      "description": "DiscoverTemplates command with its role policy, its audit evidence and the pass it starts. Expected output: DiscoverTemplates admits a caller of the platform tenant with factory.catalog.admin who is Asset maintainer or Platform admin, writes one audit-evidence-v1 record with the actor through the Factory sink of the pinned audit library to the outbox in its transaction, on the topic audit.evidence.v1.evidence-submitted, answers 202 and starts one pass of the Discoverer out of schedule; a missing token is answered 401, and a missing scope, a Requester, an Observer and a caller of another tenant than the platform tenant 403, each with a problem response and without a pass.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "DiscoverTemplates admits a caller of the platform tenant with factory.catalog.admin who is Asset maintainer or Platform admin, writes one audit-evidence-v1 record with the actor through the Factory sink of the pinned audit library to the outbox in its transaction, on the topic audit.evidence.v1.evidence-submitted, answers 202 and starts one pass of the Discoverer out of schedule; a missing token is answered 401, and a missing scope, a Requester, an Observer and a caller of another tenant than the platform tenant 403, each with a problem response and without a pass."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2838]",
      "number": 2838
    },
    {
      "id": "AIFACTORY-TASK-2839",
      "type": "task",
      "parent": "AIFACTORY-US-704",
      "title": "Verify discovery through the acceptance suite",
      "sequence": "15.03.05.05",
      "description": "Verify discovery through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-005|Scenario=SCN-TemplateRegistryService-008|Scenario=SCN-TemplateRegistryService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-704 over the recorded sources: one pinned version per published package version with its commit, its events and payloads, no version for a head commit without a package or for a package without a commit, the evidence record of the command, the idempotent second pass, the package version found again with another commit or hash, the comparison with the snapshot under model/template-parameters, the refusals, a caller of another tenant among them, a source that stops answering and the contract tests of the connector adapter against the stub; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-005|Scenario=SCN-TemplateRegistryService-008|Scenario=SCN-TemplateRegistryService-010)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-704 over the recorded sources: one pinned version per published package version with its commit, its events and payloads, no version for a head commit without a package or for a package without a commit, the evidence record of the command, the idempotent second pass, the package version found again with another commit or hash, the comparison with the snapshot under model/template-parameters, the refusals, a caller of another tenant among them, a source that stops answering and the contract tests of the connector adapter against the stub; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2839]",
      "number": 2839
    },
    {
      "id": "AIFACTORY-US-705",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "Compute the compatibility matrix cell by cell, Compatible only for what a build of the platform tenant proves and Unknown otherwise, and answer queries over it",
      "sequence": "15.03.06",
      "description": "As an asset maintainer, I want the catalog to say for each template or library version what it was proven to work with, and to say Unknown where nothing was proven, so that a recipe is validated against evidence and never against an assumption. The compatibility matrix answers whether a template or library version works with a library version, a runtime, a Factory edition or a topology, and it answers only on evidence. One `CompatibilityEntry` is one cell: the subject kind, template or library, the subject id and version, the kind it is checked with, the id and optional version of that, the result and the evidence reference. The `CompatibilityComputer` runs on `TemplateVersionDiscovered`. For the new version it computes the cells from the pinned manifest and its package references: one cell for each library version the template references and one for each runtime of `Templates:Catalog:Runtimes`, by default net9.0 and net10.0. The invariant of the model decides the result: a cell is Compatible only with evidence, a build or a conformance run, and without evidence it is Unknown. Each cell that is new or whose result or evidence changed is written with its `CompatibilityChecked` outbox record in one transaction; the payload carries `entryId`, `subjectKind`, `subjectId`, `subjectVersion`, `withKind`, `withId` and `result`, and the envelope names the platform tenant (D123). The computer is keyed by cell and evidence: a computation that finds the same cell with the same evidence writes nothing and publishes nothing, and the unique index over the six identifying columns keeps one row per cell. Up to four subjects are computed in parallel, partitioned by subject id, and a failed computation is tried a second time after 120 seconds. Evidence arrives through the inbox handler `RecordBuildEvidence` of `PipelineRunCompleted`, because a build of a template repository is compatibility evidence. The event carries `pipelineRunId`, `tenantId`, `projectId`, `commit`, `state` and `results`. Only a succeeded run of the tenant that owns the template version, which is the platform tenant, is evidence: a run of another tenant on the same commit, the build of a fork of a template repository for example, changes no cell and is acknowledged without effect, and so is a run that did not succeed. What a build proves is limited. It proves the library cells of the version, because the run restored and compiled the package references of that commit, and the runtime cells whose runtime is one of the target frameworks the project files of the pinned manifest declare, because those are the frameworks the run built. Every other cell stays Unknown: with the default runtimes and a template whose projects target net10.0, the net10.0 cell becomes Compatible and the net9.0 cell stays Unknown. The model names no rule that maps a pipeline run to runtime cells and leaves the content of `results` open, so the target frameworks of the pinned manifest are the source this delivery uses, and the rule is reported to the owner. The normal order of events is that the run completes before the version exists: the build of a template repository ends shortly after the commit, while the `Discoverer` pins the package of that commit on a later pass. A succeeded run of the platform tenant is therefore never dropped. When the commit of the event is the commit of a pinned version, the handler records the pipeline run as the evidence reference of the cells the build proves and moves them from Unknown to Compatible, each with its `CompatibilityChecked` record in the same transaction; a cell that is already Compatible keeps its evidence reference, so a second succeeded run of the same commit changes nothing. When no version is pinned at that commit yet, the handler writes one row of `PendingBuildEvidence` with the tenant, the pipeline run id, the commit, the typed results of the run and the time of receipt, and changes no cell. The model makes build evidence an input of the `CompatibilityComputer`: when the computer runs on `TemplateVersionDiscovered` for a version of that commit, it reads the pending record, writes the cells the build proves as Compatible with that run as evidence and the others as Unknown, and deletes the pending record in the same transaction. The handler is idempotent on the event id and the pending record is keyed by tenant and pipeline run id, so a redelivered event writes nothing twice. `PendingBuildEvidence` is the table of `template-registry-sql` the model gives this evidence (D123): keyed by tenant and pipeline run id, with the commit, the typed results and the time of receipt and an index over tenant and commit. This PBI migrates it under the tenant row filter of every mapping. A pending record whose commit never becomes a template version, the run of a repository that is no template for example, stays; this delivery builds no deletion for it, and its retention is reported to the owner. The thin PipelineExecutionService of this increment publishes no pipeline run event, so the handler is built and proven with a fixture publisher until its complete delivery in I2. A caller whose scope carries `factory.catalog.read` reads the matrix through `TemplateRegistryService/QueryCompatibility`: the query names a template or library version and may narrow the kind it is checked with, and the response is 200 with the cells of that subject, each with its result, its evidence reference and the time of the check. The read runs under the tenant row filter, returns the cells of the tenant of the caller and of the platform tenant, writes nothing and calls no other service; the operation lists the code 200 only, so a subject without cells returns an empty list. A call without a token is answered 401 and a token without the scope 403. `connectsoft.factory.templates.compatibility_unknown` moves with every cell that becomes or stops being Unknown. The delivery states its limits, each reported to the owner. The model names four results and no rule that turns evidence into Incompatible or CompatibleWithWarnings: this delivery writes Compatible for a library cell, or for a runtime cell of a framework the version targets, whose evidence is a succeeded build of the pinned commit in the platform tenant, and Unknown for a cell without evidence, a run that did not succeed changes no cell, and the aggregate, the read and the event carry all four values. The model names the runtimes in an option and no source for the editions and the topologies a cell is computed for, so the computer enumerates library and runtime cells, while a cell of any kind the aggregate allows is stored, read and announced. Conformance runs as scheduled evidence are a later capability of the service page, and no source of them exists in the model. GenerationRecipeService and StudioBff handle `CompatibilityChecked` in their own PBIs. Kind: behavior. Traces: services: TemplateRegistryService, PipelineExecutionService; aggregates: TemplateRegistryService/CompatibilityEntry, TemplateRegistryService/TemplateVersion; apis: TemplateRegistryService/QueryCompatibility; events: TemplateRegistryService/CompatibilityChecked, TemplateRegistryService/TemplateVersionDiscovered, PipelineExecutionService/PipelineRunCompleted; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015; requirements: NFR-13; scenarios: SCN-TemplateRegistryService-004, SCN-TemplateRegistryService-011. Relates: screens: template-catalog, recipes. Depends on: AIFACTORY-US-701, AIFACTORY-US-702, AIFACTORY-US-704, feature:pipeline-execution-service-thin. Sources: model/services/template-library/TemplateRegistryService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/stores.yaml, docs/solution-packs/software-factory/templates/compatibility-model.md, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs.",
      "acceptanceCriteria": [
        "AC1: Given a `TemplateRegistryService/TemplateVersionDiscovered` for a version whose manifest references two library versions, `Templates:Catalog:Runtimes` at its default and no build evidence for the commit of the version, when the `CompatibilityComputer` runs, then one `TemplateRegistryService/CompatibilityEntry` exists for each of the two libraries and for each of the two runtimes, each with the result Unknown and no evidence reference, and each was written together with its `TemplateRegistryService/CompatibilityChecked` outbox record in one transaction (SCN-TemplateRegistryService-011, ADR-0014).",
        "AC2: Given the cells of AC1 for a version whose pinned manifest declares the target framework net10.0 and a fixture publisher of `PipelineExecutionService/PipelineRunCompleted` with a succeeded run of the platform tenant for the commit of the version, when `RecordBuildEvidence` handles the event, then the two library cells and the net10.0 runtime cell move to Compatible with the pipeline run as evidence reference, the net9.0 runtime cell stays Unknown, and one `TemplateRegistryService/CompatibilityChecked` is recorded per changed cell in the same transaction; the same event id delivered twice changes the cells once; a run that did not succeed, and a succeeded run of another tenant with the same commit, change no cell (SCN-TemplateRegistryService-011).",
        "AC3: Given a succeeded run of the platform tenant for a commit at which no `TemplateRegistryService/TemplateVersion` is pinned yet, when `RecordBuildEvidence` handles the event, then one row of `PendingBuildEvidence` with the tenant, the pipeline run id, the commit and the typed results of the run is written and no cell changes; when the version of that commit is discovered afterwards and the `CompatibilityComputer` runs on `TemplateRegistryService/TemplateVersionDiscovered`, then the library cells and the runtime cells of its target frameworks are written Compatible with that run as evidence reference and every other cell Unknown, each with its `TemplateRegistryService/CompatibilityChecked` record, and the pending record is deleted in the same transaction (SCN-TemplateRegistryService-011, model/services/template-library/TemplateRegistryService.yaml).",
        "AC4: Given a caller with `factory.catalog.read` and cells of the platform tenant and of two other tenants, when `TemplateRegistryService/QueryCompatibility` is called for a template version, then the response is 200 with the cells of that version that belong to the platform tenant or to the tenant of the caller, each with result, evidence reference and time of the check, a subject without cells returns an empty list and nothing is written; a call without a token is answered 401 and a token without the scope 403 (SCN-TemplateRegistryService-004, ADR-0015).",
        "AC5: Given a committed cell, when the dispatcher of the `template-registry` messaging profile publishes `TemplateRegistryService/CompatibilityChecked` on `template-catalog.compatibility.v1.compatibility-checked`, then the event is sent in the run event envelope with `entryId`, `subjectKind`, `subjectId`, `subjectVersion`, `withKind`, `withId` and `result`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; when the computer is triggered again with the same evidence, or the same trigger fires twice, then no row is written and nothing is published, and no `TemplateRegistryService/CompatibilityEntry` is Compatible without an evidence reference; `connectsoft.factory.templates.compatibility_unknown` equals the number of cells without evidence (SCN-TemplateRegistryService-011, ADR-0012, NFR-13)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/stores.yaml",
        "docs/solution-packs/software-factory/templates/compatibility-model.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2840",
        "AIFACTORY-TASK-2867",
        "AIFACTORY-TASK-2841",
        "AIFACTORY-TASK-2842",
        "AIFACTORY-TASK-2843"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8206,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "PipelineExecutionService"
        ],
        "aggregates": [
          "TemplateRegistryService/CompatibilityEntry",
          "TemplateRegistryService/TemplateVersion"
        ],
        "apis": [
          "TemplateRegistryService/QueryCompatibility"
        ],
        "events": [
          "TemplateRegistryService/CompatibilityChecked",
          "TemplateRegistryService/TemplateVersionDiscovered",
          "PipelineExecutionService/PipelineRunCompleted"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "NFR-13"
        ],
        "scenarios": [
          "SCN-TemplateRegistryService-004",
          "SCN-TemplateRegistryService-011"
        ]
      },
      "relates": {
        "screens": [
          "template-catalog",
          "recipes"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-701",
        "AIFACTORY-US-702",
        "AIFACTORY-US-704",
        "feature:pipeline-execution-service-thin"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/stores.yaml",
        "docs/solution-packs/software-factory/templates/compatibility-model.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#workers-and-jobs"
      ],
      "titlePrefix": "[AIFACTORY-US-705]",
      "number": 705
    },
    {
      "id": "AIFACTORY-TASK-2840",
      "type": "task",
      "parent": "AIFACTORY-US-705",
      "title": "CompatibilityComputer that writes library and runtime cells with CompatibilityChecked and applies build evidence that preceded discovery",
      "sequence": "15.03.06.01",
      "description": "CompatibilityComputer that writes library and runtime cells with CompatibilityChecked and applies build evidence that preceded discovery. Expected output: On TemplateVersionDiscovered the computer derives one cell per referenced library version and one per runtime of Templates:Catalog:Runtimes from the pinned manifest and reads the pending build evidence record of the commit of the version; where one exists it writes the cells the build proves, that is the library cells and the runtime cells of the target frameworks of the pinned manifest, as Compatible with that run as evidence reference and deletes the pending record in the same transaction; every other cell is written Unknown; each new or changed CompatibilityEntry is written with its CompatibilityChecked outbox record in one transaction; the computer is keyed by cell and evidence so that a repeated computation writes nothing, and moves connectsoft.factory.templates.compatibility_unknown with every cell that becomes or stops being Unknown.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "On TemplateVersionDiscovered the computer derives one cell per referenced library version and one per runtime of Templates:Catalog:Runtimes from the pinned manifest and reads the pending build evidence record of the commit of the version; where one exists it writes the cells the build proves, that is the library cells and the runtime cells of the target frameworks of the pinned manifest, as Compatible with that run as evidence reference and deletes the pending record in the same transaction; every other cell is written Unknown; each new or changed CompatibilityEntry is written with its CompatibilityChecked outbox record in one transaction; the computer is keyed by cell and evidence so that a repeated computation writes nothing, and moves connectsoft.factory.templates.compatibility_unknown with every cell that becomes or stops being Unknown."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2840]",
      "number": 2840
    },
    {
      "id": "AIFACTORY-TASK-2867",
      "type": "task",
      "parent": "AIFACTORY-US-705",
      "title": "Table PendingBuildEvidence in template-registry-sql for build evidence that precedes discovery",
      "sequence": "15.03.06.02",
      "description": "Table PendingBuildEvidence in template-registry-sql for build evidence that precedes discovery. Expected output: A migration and a mapping add the table PendingBuildEvidence to template-registry-sql as model/services/template-library/TemplateRegistryService.yaml lists it (D123), keyed by tenant and pipeline run id, with commit, typed results and time of receipt, the index IX_PendingBuildEvidence_Commit over tenant and commit and the tenant row filter; mapping tests on an isolated test database prove that a second row for one tenant and pipeline run id violates the key and that a query made for one tenant returns no row of another; the contract notes of the repository record that no deletion of a pending record whose commit never becomes a template version is built.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "A migration and a mapping add the table PendingBuildEvidence to template-registry-sql as model/services/template-library/TemplateRegistryService.yaml lists it (D123), keyed by tenant and pipeline run id, with commit, typed results and time of receipt, the index IX_PendingBuildEvidence_Commit over tenant and commit and the tenant row filter; mapping tests on an isolated test database prove that a second row for one tenant and pipeline run id violates the key and that a query made for one tenant returns no row of another; the contract notes of the repository record that no deletion of a pending record whose commit never becomes a template version is built."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8206,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-2867]",
      "number": 2867
    },
    {
      "id": "AIFACTORY-TASK-2841",
      "type": "task",
      "parent": "AIFACTORY-US-705",
      "title": "RecordBuildEvidence inbox handler of PipelineRunCompleted with its fixture publisher",
      "sequence": "15.03.06.03",
      "description": "RecordBuildEvidence inbox handler of PipelineRunCompleted with its fixture publisher. Expected output: The handler takes a succeeded PipelineRunCompleted of the platform tenant as evidence and acknowledges without effect a run that did not succeed and a run of another tenant; when the commit of the event is the commit of a pinned template version it records the run as the evidence reference of the library cells and of the runtime cells of the target frameworks of the pinned manifest, moves them from Unknown to Compatible with CompatibilityChecked in the same transaction and leaves every other cell Unknown; when no version is pinned at that commit it writes one row of PendingBuildEvidence, keyed by tenant and pipeline run id, with the commit and the typed results of the run, and changes no cell; it is idempotent on the event id; the acceptance suite holds a fixture publisher of the event, because the thin PipelineExecutionService publishes none.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The handler takes a succeeded PipelineRunCompleted of the platform tenant as evidence and acknowledges without effect a run that did not succeed and a run of another tenant; when the commit of the event is the commit of a pinned template version it records the run as the evidence reference of the library cells and of the runtime cells of the target frameworks of the pinned manifest, moves them from Unknown to Compatible with CompatibilityChecked in the same transaction and leaves every other cell Unknown; when no version is pinned at that commit it writes one row of PendingBuildEvidence, keyed by tenant and pipeline run id, with the commit and the typed results of the run, and changes no cell; it is idempotent on the event id; the acceptance suite holds a fixture publisher of the event, because the thin PipelineExecutionService publishes none."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2841]",
      "number": 2841
    },
    {
      "id": "AIFACTORY-TASK-2842",
      "type": "task",
      "parent": "AIFACTORY-US-705",
      "title": "QueryCompatibility read over the cells of a template or library version",
      "sequence": "15.03.06.04",
      "description": "QueryCompatibility read over the cells of a template or library version. Expected output: QueryCompatibility returns, for the subject the query names and the optional kind it narrows to, the cells of the tenant of the caller and of the platform tenant with result, evidence reference and time of the check, an empty list for a subject without cells, 401 without a token and 403 without factory.catalog.read; it writes nothing and calls no other service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "QueryCompatibility returns, for the subject the query names and the optional kind it narrows to, the cells of the tenant of the caller and of the platform tenant with result, evidence reference and time of the check, an empty list for a subject without cells, 401 without a token and 403 without factory.catalog.read; it writes nothing and calls no other service."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8206,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2842]",
      "number": 2842
    },
    {
      "id": "AIFACTORY-TASK-2843",
      "type": "task",
      "parent": "AIFACTORY-US-705",
      "title": "Verify the compatibility matrix through the acceptance suite",
      "sequence": "15.03.06.05",
      "description": "Verify the compatibility matrix through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-004|Scenario=SCN-TemplateRegistryService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-705: the Unknown cells of a discovered version, the move of the library cells and of the net10.0 runtime cell to Compatible under a fixture publisher of PipelineRunCompleted while the net9.0 cell stays Unknown, a run of another tenant with the same commit that changes no cell, the order run completed and then version discovered, which ends with the same cells Compatible and the pending record deleted, the repeated computation without effect, the three-tenant read with its refusals, and the publication and payload of CompatibilityChecked; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-004|Scenario=SCN-TemplateRegistryService-011)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-705: the Unknown cells of a discovered version, the move of the library cells and of the net10.0 runtime cell to Compatible under a fixture publisher of PipelineRunCompleted while the net9.0 cell stays Unknown, a run of another tenant with the same commit that changes no cell, the order run completed and then version discovered, which ends with the same cells Compatible and the pending record deleted, the repeated computation without effect, the three-tenant read with its refusals, and the publication and payload of CompatibilityChecked; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8206,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2843]",
      "number": 2843
    },
    {
      "id": "AIFACTORY-US-706",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "Read the catalog: list template versions, read one pinned manifest with its compatibility and list library versions, inside the tenant",
      "sequence": "15.03.07",
      "description": "As a requester, I want to see which template and library versions exist, in which state, and what exactly one template version generates, so that I choose building material for a recipe from what the catalog pinned and never from a name I remember. A caller whose scope carries `factory.catalog.read` reads the catalog through three operations. A requester who prepares a recipe, an Asset maintainer, a Platform admin and an Observer are the four roles the model admits, and from I3 the template catalog screen of the Studio reads the same operations through StudioBff and the gateway. `TemplateRegistryService/ListTemplates` returns the template versions with their layer, state and switches, paged: it is the generated template catalog of this site at run time. It hides no version for its state: a Discovered version, which a recipe may bind until the evaluation gate of AgentRegistryService is delivered in I4 (D123), is listed with that state. The summary of the operation also names consumers. The model does not say what a consumer of a template version is, gives the aggregate no field and the table `TemplateVersions` no column for it, and the `Discoverer` derives none (AIFACTORY-US-704). Until the owner decides, the response carries the field `consumers` as an empty list for every template version, so the contract of the operation keeps its shape and no value is invented; the gap is reported to the owner. `TemplateRegistryService/GetTemplateVersion` addresses one version by `templateId` and `version` and returns the pinned manifest with its projects and their roles, its switches with their allowed values, its generated and preserved paths, its pipelines and its docs, together with the repository and the commit it was read from, the manifest hash, the state, the release id once the version is Published, and the compatibility cells of the version. `TemplateRegistryService/ListLibraries` returns the library versions by capability area and layer with their packages, their versions on the feed, their state and the templates that consume them, paged. The three reads run under the tenant row filter of the service: a caller reads the rows of its own tenant and those of the platform tenant, which holds the templates and libraries ConnectSoft publishes and is readable by every tenant. Through I4 the catalog holds the rows of the platform tenant only (D123), so on a deployed instance every tenant reads the same catalog, and the filter is proven with seeded rows of other tenants. A row of another tenant never appears in a list, and a version of another tenant that is addressed is answered 404, the same answer as for a `templateId` and `version` that do not exist, so the response never confirms that it exists (ADR-0015 amendment D113). A call without a token or with an expired token is answered 401 and a token without `factory.catalog.read` 403. The reads write nothing, publish nothing and call no other service: they depend on `template-registry-sql` alone. What they return is what the last discovery pass pinned, so while a feed or a connector is unreachable they keep answering from the stale catalog, which is the data impact the model names for that failure mode; when the store itself is unavailable, readiness is unready and a read fails fast with a problem response. A switch is returned as the manifest holds it, with its name and its allowed values as read from the `.template.config` of the template at the pinned commit; the reads add no parameter and no default of their own. The reads belong to the interactive class of the model, whose objective is an acknowledgement within 2 seconds at p95; it is measured once the system is deployed and no value is claimed here. The operations are reached through TemplateCatalogHost, the gateway of the platform, which is delivered in the same increment (D123), with a token whose audience is that gateway. Kind: behavior. Traces: services: TemplateRegistryService; aggregates: TemplateRegistryService/TemplateVersion, TemplateRegistryService/LibraryVersion, TemplateRegistryService/CompatibilityEntry; apis: TemplateRegistryService/ListTemplates, TemplateRegistryService/GetTemplateVersion, TemplateRegistryService/ListLibraries; adrs: ADR-0015; requirements: FUX-03; scenarios: SCN-TemplateRegistryService-001, SCN-TemplateRegistryService-002, SCN-TemplateRegistryService-003. Relates: screens: template-catalog; nfrs: NFR-07. Depends on: AIFACTORY-US-701, AIFACTORY-US-702. Sources: model/services/template-library/TemplateRegistryService.yaml, model/ux/screens.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/solution-packs/software-factory/templates/ui.md, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a caller with `factory.catalog.read` and template versions of the platform tenant and of two other tenants, when `TemplateRegistryService/ListTemplates` is called with a page cursor, then the response is 200 with the versions of the platform tenant and of the tenant of the caller only, each with template id, version, layer, state and switches and with the field `consumers` as an empty list, because the model defines no consumer of a template version, paged, and nothing is written (SCN-TemplateRegistryService-001, ADR-0015).",
        "AC2: Given a pinned `TemplateRegistryService/TemplateVersion` the caller can read, when `TemplateRegistryService/GetTemplateVersion` is called with its `templateId` and `version`, then the response is 200 with the manifest as it was pinned, that is projects and roles, switches with allowed values, generated and preserved paths, pipelines and docs, with repository, commit, manifest hash and state, the release id when the version is Published or Deprecated, and each `TemplateRegistryService/CompatibilityEntry` of the version with its result and evidence reference (SCN-TemplateRegistryService-002).",
        "AC3: Given a `templateId` and `version` that do not exist, or that exist only in another tenant that is not the platform tenant, when `TemplateRegistryService/GetTemplateVersion` is called, then the response is 404 in both cases with the same problem response; a call without a token is answered 401 and a token without `factory.catalog.read` 403; no state changes (SCN-TemplateRegistryService-002, ADR-0015).",
        "AC4: Given a caller with `factory.catalog.read` and library versions of two capability areas, one of them without a published package, when `TemplateRegistryService/ListLibraries` is called with a filter on area, then the response is 200 with each `TemplateRegistryService/LibraryVersion` of that area that the caller can read, with layer, packages, state and consuming templates, the version without a published package in state Discovered, and nothing is written (SCN-TemplateRegistryService-003).",
        "AC5: Given the feed and the connectors do not answer, when the three reads are called, then each answers 200 from the rows the last pass pinned; given `template-registry-sql` is unavailable, when a read is called, then it fails fast with a problem response, readiness is unready and no state changes (SCN-TemplateRegistryService-001, SCN-TemplateRegistryService-003, model/services/template-library/TemplateRegistryService.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/ui.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2844",
        "AIFACTORY-TASK-2845",
        "AIFACTORY-TASK-2846"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8207,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateRegistryService"
        ],
        "aggregates": [
          "TemplateRegistryService/TemplateVersion",
          "TemplateRegistryService/LibraryVersion",
          "TemplateRegistryService/CompatibilityEntry"
        ],
        "apis": [
          "TemplateRegistryService/ListTemplates",
          "TemplateRegistryService/GetTemplateVersion",
          "TemplateRegistryService/ListLibraries"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-03"
        ],
        "scenarios": [
          "SCN-TemplateRegistryService-001",
          "SCN-TemplateRegistryService-002",
          "SCN-TemplateRegistryService-003"
        ]
      },
      "relates": {
        "screens": [
          "template-catalog"
        ],
        "nfrs": [
          "NFR-07"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-701",
        "AIFACTORY-US-702"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/ui.md",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-706]",
      "number": 706
    },
    {
      "id": "AIFACTORY-TASK-2844",
      "type": "task",
      "parent": "AIFACTORY-US-706",
      "title": "ListTemplates, GetTemplateVersion and ListLibraries read models with the tenant row filter and paging",
      "sequence": "15.03.07.01",
      "description": "ListTemplates, GetTemplateVersion and ListLibraries read models with the tenant row filter and paging. Expected output: ListTemplates returns the template versions with layer, state and switches, paged, and the field consumers as an empty list until the owner decides what a consumer of a template version is; GetTemplateVersion returns the pinned manifest with repository, commit, manifest hash, state, release id and the cells of the version; ListLibraries returns the library versions by area and layer with packages, state and consumers, paged; all three apply the tenant row filter, which admits the platform tenant, so a version of another tenant is answered 404, the same answer as for one that does not exist (ADR-0015), a missing scope is 403 and a missing token 401; the reads write nothing and call no other service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "ListTemplates returns the template versions with layer, state and switches, paged, and the field consumers as an empty list until the owner decides what a consumer of a template version is; GetTemplateVersion returns the pinned manifest with repository, commit, manifest hash, state, release id and the cells of the version; ListLibraries returns the library versions by area and layer with packages, state and consumers, paged; all three apply the tenant row filter, which admits the platform tenant, so a version of another tenant is answered 404, the same answer as for one that does not exist (ADR-0015), a missing scope is 403 and a missing token 401; the reads write nothing and call no other service."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8207,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2844]",
      "number": 2844
    },
    {
      "id": "AIFACTORY-TASK-2845",
      "type": "task",
      "parent": "AIFACTORY-US-706",
      "title": "Catalog seed of three tenants for the read tests of the acceptance suite",
      "sequence": "15.03.07.02",
      "description": "Catalog seed of three tenants for the read tests of the acceptance suite. Expected output: The acceptance suite seeds template versions, library versions and cells of the platform tenant and of two other tenants on an isolated test database, among them a Published version with a release id, a library version without a published package and versions of two capability areas, and issues tokens for the matrix of role and tenant, including a token without factory.catalog.read and an expired token.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The acceptance suite seeds template versions, library versions and cells of the platform tenant and of two other tenants on an isolated test database, among them a Published version with a release id, a library version without a published package and versions of two capability areas, and issues tokens for the matrix of role and tenant, including a token without factory.catalog.read and an expired token."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8207,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2845]",
      "number": 2845
    },
    {
      "id": "AIFACTORY-TASK-2846",
      "type": "task",
      "parent": "AIFACTORY-US-706",
      "title": "Verify the catalog reads through the acceptance suite",
      "sequence": "15.03.07.03",
      "description": "Verify the catalog reads through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-001|Scenario=SCN-TemplateRegistryService-002|Scenario=SCN-TemplateRegistryService-003)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-706 over the three-tenant seed: the two lists with their filters and pages, the manifest of one version with its cells, the 404 that is the same for an unknown version and one of another tenant, the 401 and 403 answers, the reads during a feed outage and the failing read while the store is unavailable.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-001|Scenario=SCN-TemplateRegistryService-002|Scenario=SCN-TemplateRegistryService-003)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-706 over the three-tenant seed: the two lists with their filters and pages, the manifest of one version with its cells, the 404 that is the same for an unknown version and one of another tenant, the 401 and 403 answers, the reads during a feed outage and the failing read while the store is unavailable."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8207,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2846]",
      "number": 2846
    },
    {
      "id": "AIFACTORY-US-707",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "Resolve the pinned manifest of a template version for a recipe or an agent over the internal gRPC method",
      "sequence": "15.03.08",
      "description": "A workload asks the catalog for the pinned manifest of one template version through the internal gRPC method `TemplateRegistryService/Catalog.ResolveManifest`. The model names its callers: GenerationRecipeService, which validates the modules of a recipe against manifests and switches and pins what it validated, BlueprintService, whose Validator evaluates the rule MOD-002 of a Module Blueprint against the manifest of the template version the blueprint pins (D123), and AgentRuntimeWorker, through which agents read manifests during a generation run and which arrives in I3. The method is unary and of the read class. The caller presents a workload token that holds the service scope which names TemplateRegistryService; such a token carries no tenant claim, and the service reads the tenant and the project the caller forwards in the call metadata only because the token holds that scope (ADR-0015 amendment D114). The request names a template id and a version. The reply carries the manifest as the `Discoverer` pinned it, that is the projects and their roles, the switches with their allowed values, the generated and preserved paths, the pipelines and the docs, with the repository, the commit, the manifest hash, the state and, once an asset release exists, the release id. The same template id and version always resolve to the same manifest and the same hash, because a version is one published version of the template package, pinned at the commit that package was built from, and a manifest is never edited in the catalog, so a recipe that pinned a version validates against the manifest of the package it generates from. The method writes nothing and publishes nothing. It resolves every version the forwarded tenant can read, its own and those of the platform tenant, and states the state of the version in the reply. It refuses no version for its state: until the evaluation gate of AgentRegistryService is delivered in I4 the Draft allowance lets a recipe bind a version the catalog has discovered that is not yet Published, so the method serves such a version like a Published one (D123). The rule that arrives in I4, that only a Published version may be selected by a generation recipe, and the rule that a Deprecated version may be upgraded from and never generated with are applied by GenerationRecipeService in its validation with the state this reply carries. A call without a workload identity is refused with UNAUTHENTICATED; a workload token without the service scope, and a user token, which holds no service scope, with PERMISSION_DENIED; a request without a template id or a version with INVALID_ARGUMENT; a version that does not exist, or that belongs to another tenant that is not the platform tenant, with NOT_FOUND, the same status in both cases, and a caller that receives it takes the failure class permanent (ADR-0015 amendment D114). When `template-registry-sql` is unavailable the call fails fast with UNAVAILABLE; GenerationRecipeService and BlueprintService each declare this dependency fail-fast and decide what their own call does then; BlueprintService answers 503 on the validation of a Module Blueprint (D123). The contract of the method needs a decision of the owner. The model declares `release-manifest-v1` as the schema of both messages. That descriptor is the manifest of an asset release of AgentRegistryService: it closes its members, has none for the projects, switches and paths of a template manifest, requires the publication fields of a release and knows the states of a release, not those of the catalog. A version that is Discovered or Verified has no release, so the reply of this method cannot be an instance of it. This delivery therefore declares in the proto a request with template id and version and a reply with the fields of the `TemplateVersion`, records the difference to the declared descriptor in the contract notes of the repository, and changes nothing in the contracts package; which descriptor the method carries is reported to the owner. The method is also reachable through the gRPC route of TemplateCatalogHost, which is delivered in the same increment (D123), under the same token rule. Kind: behavior. Traces: services: TemplateRegistryService, GenerationRecipeService, BlueprintService; aggregates: TemplateRegistryService/TemplateVersion; apis: TemplateRegistryService/Catalog.ResolveManifest; descriptors: release-manifest-v1; adrs: ADR-0015; requirements: NFR-13; scenarios: SCN-TemplateRegistryService-007. Relates: screens: recipes. Depends on: AIFACTORY-US-701, AIFACTORY-US-702. Sources: model/services/template-library/TemplateRegistryService.yaml, model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/BlueprintService.yaml, model/descriptors.yaml, docs/reference/schemas/release-manifest.schema.json, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis.",
      "acceptanceCriteria": [
        "AC1: Given a workload token that holds the service scope of TemplateRegistryService and forwarded tenant metadata, when `TemplateRegistryService/Catalog.ResolveManifest` is called with the template id and the version of a pinned `TemplateRegistryService/TemplateVersion`, then the reply carries the manifest with its projects, switches, generated and preserved paths, pipelines and docs, the repository, the commit, the manifest hash and the state, equal to what the store holds; a second call returns the same reply, and nothing is written or published (SCN-TemplateRegistryService-007).",
        "AC2: Given a call without a workload identity, a workload token without the service scope, a user token, or a request without a template id or a version, when `TemplateRegistryService/Catalog.ResolveManifest` is called, then the status is UNAUTHENTICATED for the first, PERMISSION_DENIED for the second and the third and INVALID_ARGUMENT for the fourth, and no state changes (SCN-TemplateRegistryService-007, ADR-0015).",
        "AC3: Given versions of the platform tenant and of two other tenants, when the method is called with the forwarded tenant of one of them, then a version of that tenant and a version of the platform tenant resolve, and a version of the other tenant and a version that does not exist are both answered NOT_FOUND, which never confirms that a foreign version exists (SCN-TemplateRegistryService-007, ADR-0015).",
        "AC4: Given versions in the states Discovered, Verified, Published and Deprecated, when each is resolved, then every one of them resolves, the Discovered and the Verified one under the Draft allowance until I4 (D123), the reply states the state of the version and carries a release id only for the Published and the Deprecated one; given `template-registry-sql` is unavailable, when the method is called, then the status is UNAVAILABLE and no state changes; the proto of the method and the note on `release-manifest-v1` are in the repository as the contract task leaves them (SCN-TemplateRegistryService-007, docs/reference/schemas/release-manifest.schema.json)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2847",
        "AIFACTORY-TASK-2848",
        "AIFACTORY-TASK-2849"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8208,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "GenerationRecipeService",
          "BlueprintService"
        ],
        "aggregates": [
          "TemplateRegistryService/TemplateVersion"
        ],
        "apis": [
          "TemplateRegistryService/Catalog.ResolveManifest"
        ],
        "descriptors": [
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "NFR-13"
        ],
        "scenarios": [
          "SCN-TemplateRegistryService-007"
        ]
      },
      "relates": {
        "screens": [
          "recipes"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-701",
        "AIFACTORY-US-702"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/descriptors.yaml",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#apis"
      ],
      "titlePrefix": "[AIFACTORY-US-707]",
      "number": 707
    },
    {
      "id": "AIFACTORY-TASK-2847",
      "type": "task",
      "parent": "AIFACTORY-US-707",
      "title": "Proto of Catalog.ResolveManifest and the contract note on the declared descriptor",
      "sequence": "15.03.08.01",
      "description": "Proto of Catalog.ResolveManifest and the contract note on the declared descriptor. Expected output: The proto of the service declares Catalog.ResolveManifest as a unary method with a request that names template id and version and a reply that carries the manifest, repository, commit, manifest hash, state and release id of the TemplateVersion; the contract notes of the repository record that model/services/template-library/TemplateRegistryService.yaml declares release-manifest-v1 for both messages, that docs/reference/schemas/release-manifest.schema.json has no member for a template manifest and requires the fields of a published release, and that the descriptor of the method waits for the decision of the owner; the contracts package is not changed.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The proto of the service declares Catalog.ResolveManifest as a unary method with a request that names template id and version and a reply that carries the manifest, repository, commit, manifest hash, state and release id of the TemplateVersion; the contract notes of the repository record that model/services/template-library/TemplateRegistryService.yaml declares release-manifest-v1 for both messages, that docs/reference/schemas/release-manifest.schema.json has no member for a template manifest and requires the fields of a published release, and that the descriptor of the method waits for the decision of the owner; the contracts package is not changed."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8208,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2847]",
      "number": 2847
    },
    {
      "id": "AIFACTORY-TASK-2848",
      "type": "task",
      "parent": "AIFACTORY-US-707",
      "title": "Catalog.ResolveManifest with the workload scope check and the forwarded tenant",
      "sequence": "15.03.08.02",
      "description": "Catalog.ResolveManifest with the workload scope check and the forwarded tenant. Expected output: The method requires a workload identity whose token holds the service scope of TemplateRegistryService, reads the forwarded tenant and project only under that scope, resolves a version of that tenant or of the platform tenant to its pinned manifest with its state, whatever that state is, a Discovered version included (D123), and answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND for an unknown version and for one of another tenant alike (ADR-0015), and UNAVAILABLE when the store does not answer; it writes nothing.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The method requires a workload identity whose token holds the service scope of TemplateRegistryService, reads the forwarded tenant and project only under that scope, resolves a version of that tenant or of the platform tenant to its pinned manifest with its state, whatever that state is, a Discovered version included (D123), and answers UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT, NOT_FOUND for an unknown version and for one of another tenant alike (ADR-0015), and UNAVAILABLE when the store does not answer; it writes nothing."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8208,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2848]",
      "number": 2848
    },
    {
      "id": "AIFACTORY-TASK-2849",
      "type": "task",
      "parent": "AIFACTORY-US-707",
      "title": "Verify the manifest resolution through the acceptance suite",
      "sequence": "15.03.08.03",
      "description": "Verify the manifest resolution through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateRegistryService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-707 over the three-tenant seed of AIFACTORY-TASK-2845: the reply equal to the stored manifest and repeated unchanged, the four refusal statuses, NOT_FOUND for an unknown and for a foreign version, the state and the release id per catalog state, and UNAVAILABLE while the store is stopped.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateRegistryService-007\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-707 over the three-tenant seed of AIFACTORY-TASK-2845: the reply equal to the stored manifest and repeated unchanged, the four refusal statuses, NOT_FOUND for an unknown and for a foreign version, the state and the release id per catalog state, and UNAVAILABLE while the store is stopped."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8208,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2849]",
      "number": 2849
    },
    {
      "id": "AIFACTORY-US-708",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-084",
      "title": "Submit a Verified template version to Asset Publication and mirror its published and its deprecated release in the catalog",
      "sequence": "15.03.09",
      "description": "As an asset maintainer, I want to submit a Verified template version for publication and see the catalog follow what Asset Publication decides, so that a template version becomes Published only through review, and nobody marks a version Published by hand. A template version becomes Published through Asset Publication like any asset (ADR-0021): the state Published of the catalog mirrors the asset release and is never set by a caller. A caller whose scope carries `factory.catalog.admin` and who is Asset maintainer or Platform admin calls `TemplateRegistryService/PublishTemplateVersion` for a `templateId` and a `version`. Through I4 only an administrator of the platform tenant publishes (D123): the command is admitted only for an Asset maintainer or a Platform admin whose token names the platform tenant, to which every version of the catalog belongs. The version must be Verified. The service submits it to AgentRegistryService, the release authority, as a release candidate through one release candidate port: the asset kind of a template release, which the model of AgentRegistryService names TemplateBundle and `release-manifest-v1` names `template-bundle`, the template id as asset id and the version, which together are the identity of the candidate, and as its content the repository and the commit the manifest was read from and the manifest hash of the catalog, with the caller as the submitting subject. The answer is 202, because publication is observed and not assumed. The review, the evaluation where a suite exists and the approval by someone other than the subject that submitted the candidate belong to Asset Publication and are decided there and never here. The operation is of the publication class, and the model gives the command no result event: it changes no state of the version, which stays Verified until the release is published. The command leaves evidence: the Factory sink of the pinned audit library writes an `audit-evidence-v1` record that names the actor, the template id, the version and the manifest hash to the outbox in the transaction of the command, on the topic `audit.evidence.v1.evidence-submitted` in the run event envelope. Its idempotency is natural, and the service states what it guarantees itself. It keeps no record of a submission, because the model gives the command no result event and no state change. A repeated call therefore sends the release candidate port the same identity, that is asset kind, asset id and version, with the same content, answers 202 again and writes its own `audit-evidence-v1` record, because each admitted call is an act of its caller. That one candidate exists per asset kind, asset id and version is the rule of the release authority, whose releases are unique over tenant, asset kind, asset id and version (model/services/control-plane/AgentRegistryService.yaml), and no guarantee of this service. A caller without the scope, a Requester or an Observer is refused with 403. An Asset maintainer or a Platform admin of another tenant who addresses a version of the platform tenant is refused with 403 as well: the caller can read that version, so the answer hides nothing, and may not change it. A version that does not exist, or that belongs to a tenant that is neither the tenant of the caller nor the platform tenant, is answered 404, the same answer in both cases. A version that is not Verified, that is one that is Discovered, Published, Deprecated or Retired, is refused with 409. AgentRegistryService is a required fail-fast dependency: when it does not answer, the call fails fast with 503 and a problem response that names AgentRegistryService, and nothing is written; the operation lists the code 503 for it (D123). The catalog follows the release through two inbox handlers. `MarkPublished` handles `AssetReleasePublished` and matches a published release on the asset kind, the asset id and the version inside the tenant, as the model states it (D123): when the `assetKind` of the event is TemplateBundle and its `assetId` and `version` name a Verified version inside the tenant of the envelope, it moves the version to Published, records the `releaseId` and writes `TemplateVersionPublished` with `templateId`, `version`, `layer` and `releaseId` in the same transaction, in an envelope that names the platform tenant; the handler is idempotent on the event id, and a release of another asset kind, a release in another tenant and a release that names no Verified version are acknowledged without effect. The `manifestHash` of the event is the hash over the release manifest of AgentRegistryService and not the manifest hash of the catalog, which pins the template manifest, so the handler compares neither with the other: a release whose manifest hash differs from the catalog hash, which is every real release, publishes the version. The event carries no source commit, so the handler cannot tell a release that was cut from another commit than the pinned one; such a guard needs the commit in the event or a read of the release and is reported to the owner. `MarkDeprecated` handles `AssetReleaseDeprecated`: the version whose release id the event names, inside the tenant of the envelope, moves from Published to Deprecated, so it may still be upgraded from and is never generated with; the model names no event of the catalog for this transition, so nothing is published and `connectsoft.factory.templates.versions` moves. The delivery states its limits, each reported to the owner. The thin AgentRegistryService of this increment answers resolution and loading of seeded releases only: the one operation of the model that creates a candidate, `SubmitRelease`, is a public REST operation with a key header that arrives with feature `agent-registry-service-publication` in I2 (D140), while the model names the dependency of this service as gRPC. The port is therefore proven against a fake, the two handlers by fixture publishers, and on a deployed instance of this increment no version becomes Published. Until then the Draft allowance applies: a recipe may bind a discovered version that is not yet Published (D123), and arriving in I4 only a Published version may be selected. The model names no trigger that moves a version to Verified, so the acceptance suite seeds a Verified version. The model gives this service no handler for `AssetReleaseRevoked`, so a revoked template release is not mirrored here. GenerationRecipeService, FleetRolloutService, StudioBff and AuditService handle `TemplateVersionPublished` in their own PBIs. Kind: behavior. Traces: services: TemplateRegistryService, AgentRegistryService; aggregates: TemplateRegistryService/TemplateVersion; apis: TemplateRegistryService/PublishTemplateVersion; events: TemplateRegistryService/TemplateVersionPublished, AgentRegistryService/AssetReleasePublished, AgentRegistryService/AssetReleaseDeprecated; descriptors: release-manifest-v1, audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0021; requirements: FR-06; scenarios: SCN-TemplateRegistryService-006, SCN-TemplateRegistryService-009. Relates: screens: template-catalog. Depends on: AIFACTORY-US-701, AIFACTORY-US-702, feature:agent-registry-service-thin, feature:component-audit-factory-evidence. Sources: model/services/template-library/TemplateRegistryService.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/architecture/adr/0021-quality-gates.md, docs/reference/schemas/release-manifest.schema.json, docs/reference/schemas/audit-evidence.schema.json, docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#messages.",
      "acceptanceCriteria": [
        "AC1: Given a Verified `TemplateRegistryService/TemplateVersion` of the platform tenant and a caller of that tenant with `factory.catalog.admin` who is Asset maintainer or Platform admin, when `TemplateRegistryService/PublishTemplateVersion` is called, then the response is 202, one candidate with the asset kind of templates, the template id and the version as its identity, the repository, the commit and the manifest hash of the catalog as its content and the caller as submitting subject reached the release candidate port, the version is still Verified, and one `audit-evidence-v1` record with the actor is in the outbox, written in the transaction of the command (SCN-TemplateRegistryService-006, ADR-0021, FR-06).",
        "AC2: Given a caller without `factory.catalog.admin`, a Requester or an Observer, an Asset maintainer whose token names another tenant than the platform tenant and who addresses a version of the platform tenant, a version that does not exist or belongs to a third tenant, a version that is Discovered, Published, Deprecated or Retired, or an AgentRegistryService that does not answer, when `TemplateRegistryService/PublishTemplateVersion` is called, then the response is 403, 403, 403, 404, 409 or 503 with a problem response that names AgentRegistryService respectively, the 404 being the same for the unknown and the foreign version; no candidate is submitted in the first five cases, no evidence record is written and no state changes (SCN-TemplateRegistryService-006, ADR-0015).",
        "AC3: Given a call that was answered 202, when `TemplateRegistryService/PublishTemplateVersion` is called again for the same version, then the service sends the release candidate port a second submission with the same asset kind, asset id and version as the identity of the candidate and the same content, answers 202, writes a second `audit-evidence-v1` record for the second call and leaves the version Verified; the test asserts the two submissions the port received and not a count kept by the fake, because that one candidate exists per asset kind, asset id and version is the rule of the release authority (SCN-TemplateRegistryService-006, model/services/control-plane/AgentRegistryService.yaml).",
        "AC4: Given a Verified version and a fixture publisher of `AgentRegistryService/AssetReleasePublished` with the asset kind TemplateBundle, the template id as asset id and the version, in the tenant of the version, and with a release manifest hash that differs from the manifest hash of the catalog, when `MarkPublished` handles the event, then the version is Published with the `releaseId` of the event and the `TemplateRegistryService/TemplateVersionPublished` outbox record was written in the same transaction; the same event id delivered twice publishes once; a release of another asset kind, a release in another tenant and a release that names no Verified version change no version (SCN-TemplateRegistryService-009, ADR-0014).",
        "AC5: Given the published version, when the dispatcher publishes `TemplateRegistryService/TemplateVersionPublished` on `template-catalog.templates.v1.template-version-published`, then the event is sent in the run event envelope with `templateId`, `version`, `layer` and `releaseId`, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id; given a fixture publisher of `AgentRegistryService/AssetReleaseDeprecated` that names the release id of the version in its tenant, when `MarkDeprecated` handles it, then the version moves from Published to Deprecated and nothing is published (SCN-TemplateRegistryService-009, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#messages"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2850",
        "AIFACTORY-TASK-2851",
        "AIFACTORY-TASK-2852",
        "AIFACTORY-TASK-2853"
      ],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8209,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "TemplateRegistryService/TemplateVersion"
        ],
        "apis": [
          "TemplateRegistryService/PublishTemplateVersion"
        ],
        "events": [
          "TemplateRegistryService/TemplateVersionPublished",
          "AgentRegistryService/AssetReleasePublished",
          "AgentRegistryService/AssetReleaseDeprecated"
        ],
        "descriptors": [
          "release-manifest-v1",
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-06"
        ],
        "scenarios": [
          "SCN-TemplateRegistryService-006",
          "SCN-TemplateRegistryService-009"
        ]
      },
      "relates": {
        "screens": [
          "template-catalog"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-701",
        "AIFACTORY-US-702",
        "feature:agent-registry-service-thin",
        "feature:component-audit-factory-evidence"
      ],
      "source": [
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/reference/schemas/release-manifest.schema.json",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/solution-packs/software-factory/templates/services/template-registry-service/index.md#messages"
      ],
      "titlePrefix": "[AIFACTORY-US-708]",
      "number": 708
    },
    {
      "id": "AIFACTORY-TASK-2850",
      "type": "task",
      "parent": "AIFACTORY-US-708",
      "title": "Fake of the release candidate port, fixture publishers of the two release events and a seeded Verified version",
      "sequence": "15.03.09.01",
      "description": "Fake of the release candidate port, fixture publishers of the two release events and a seeded Verified version. Expected output: The acceptance suite holds a fake of the release candidate port that records each submission with asset kind, template id, version, repository, commit, catalog manifest hash and submitting subject, answers a repeated asset kind, asset id and version with the candidate that exists, as the release authority does, and can stop answering; fixture publishers of AssetReleasePublished and AssetReleaseDeprecated in the run event envelope of the pinned contracts package, the first with the asset kind TemplateBundle, a tenant and a release manifest hash that differs from the manifest hash of the catalog; tokens of an Asset maintainer of the platform tenant and of another tenant; and a seed that places a template version in state Verified, because no operation of model/services/template-library/TemplateRegistryService.yaml moves a version there.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of the release candidate port that records each submission with asset kind, template id, version, repository, commit, catalog manifest hash and submitting subject, answers a repeated asset kind, asset id and version with the candidate that exists, as the release authority does, and can stop answering; fixture publishers of AssetReleasePublished and AssetReleaseDeprecated in the run event envelope of the pinned contracts package, the first with the asset kind TemplateBundle, a tenant and a release manifest hash that differs from the manifest hash of the catalog; tokens of an Asset maintainer of the platform tenant and of another tenant; and a seed that places a template version in state Verified, because no operation of model/services/template-library/TemplateRegistryService.yaml moves a version there."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8209,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2850]",
      "number": 2850
    },
    {
      "id": "AIFACTORY-TASK-2851",
      "type": "task",
      "parent": "AIFACTORY-US-708",
      "title": "PublishTemplateVersion command with the release candidate port and its audit evidence",
      "sequence": "15.03.09.02",
      "description": "PublishTemplateVersion command with the release candidate port and its audit evidence. Expected output: PublishTemplateVersion admits a caller with factory.catalog.admin who is Asset maintainer or Platform admin of the platform tenant, answers 403 to a caller of another tenant, 404 for an unknown version and for one of a third tenant alike and 409 for a version that is not Verified, submits the candidate through the release candidate port with the caller as submitting subject, asset kind, template id and version as its identity and repository, commit and catalog manifest hash as its content, writes one audit-evidence-v1 record with the actor to the outbox in its transaction, leaves the state of the version unchanged and answers 202; a repeated call sends the same identity again and writes its own evidence record; when the port does not answer, the call fails fast with 503 and a problem response that names AgentRegistryService and nothing is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "PublishTemplateVersion admits a caller with factory.catalog.admin who is Asset maintainer or Platform admin of the platform tenant, answers 403 to a caller of another tenant, 404 for an unknown version and for one of a third tenant alike and 409 for a version that is not Verified, submits the candidate through the release candidate port with the caller as submitting subject, asset kind, template id and version as its identity and repository, commit and catalog manifest hash as its content, writes one audit-evidence-v1 record with the actor to the outbox in its transaction, leaves the state of the version unchanged and answers 202; a repeated call sends the same identity again and writes its own evidence record; when the port does not answer, the call fails fast with 503 and a problem response that names AgentRegistryService and nothing is written."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8209,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2851]",
      "number": 2851
    },
    {
      "id": "AIFACTORY-TASK-2852",
      "type": "task",
      "parent": "AIFACTORY-US-708",
      "title": "MarkPublished and MarkDeprecated inbox handlers that mirror the asset release",
      "sequence": "15.03.09.03",
      "description": "MarkPublished and MarkDeprecated inbox handlers that mirror the asset release. Expected output: MarkPublished moves a Verified version to Published for an AssetReleasePublished whose assetKind is TemplateBundle and whose assetId and version name that version inside the tenant of the envelope, records the releaseId and writes TemplateVersionPublished with templateId, version, layer and releaseId in the same transaction; it does not compare the manifestHash of the event, which is the hash over the release manifest, with the manifest hash of the catalog; MarkDeprecated moves the version whose release id AssetReleaseDeprecated names, inside the tenant of the envelope, from Published to Deprecated and publishes nothing; both are idempotent on the event id, acknowledge an event that matches no version without effect and move connectsoft.factory.templates.versions with the state change; no handler of AssetReleaseRevoked is registered.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "MarkPublished moves a Verified version to Published for an AssetReleasePublished whose assetKind is TemplateBundle and whose assetId and version name that version inside the tenant of the envelope, records the releaseId and writes TemplateVersionPublished with templateId, version, layer and releaseId in the same transaction; it does not compare the manifestHash of the event, which is the hash over the release manifest, with the manifest hash of the catalog; MarkDeprecated moves the version whose release id AssetReleaseDeprecated names, inside the tenant of the envelope, from Published to Deprecated and publishes nothing; both are idempotent on the event id, acknowledge an event that matches no version without effect and move connectsoft.factory.templates.versions with the state change; no handler of AssetReleaseRevoked is registered."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8209,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2852]",
      "number": 2852
    },
    {
      "id": "AIFACTORY-TASK-2853",
      "type": "task",
      "parent": "AIFACTORY-US-708",
      "title": "Verify the submission and the mirrored release through the acceptance suite",
      "sequence": "15.03.09.04",
      "description": "Verify the submission and the mirrored release through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-006|Scenario=SCN-TemplateRegistryService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-708 with the fake of the release candidate port and the fixture publishers: the 202 with its candidate and its evidence record, the 403, 404 and 409 refusals, the 403 of a caller of another tenant for a version of the platform tenant among them, the 503 that names AgentRegistryService, the repeated call with the same identity sent again and a second evidence record, the publication under a release event whose manifest hash differs from the catalog hash, a release of another asset kind or tenant that changes nothing, the payload of TemplateVersionPublished and the move to Deprecated; consumer handling is proven by the suites of the consumers.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateRegistryService-006|Scenario=SCN-TemplateRegistryService-009)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-708 with the fake of the release candidate port and the fixture publishers: the 202 with its candidate and its evidence record, the 403, 404 and 409 refusals, the 403 of a caller of another tenant for a version of the platform tenant among them, the 503 that names AgentRegistryService, the repeated call with the same identity sent again and a second evidence record, the publication under a release event whose manifest hash differs from the catalog hash, a release of another asset kind or tenant that changes nothing, the payload of TemplateVersionPublished and the move to Deprecated; consumer handling is proven by the suites of the consumers."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateRegistryService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 82,
      "phase": "factory",
      "stackRank": 8209,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2853]",
      "number": 2853
    },
    {
      "id": "AIFACTORY-FEAT-085",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-015",
      "title": "TemplateCatalogHost: gateway delivery",
      "sequence": "15.04",
      "description": "TemplateCatalogHost is the platform API gateway of bounded context BC-14 (Template Catalog). The API gateway of the Template & Library platform (ADR-0028): routes public REST and internal gRPC calls to the 3 services it fronts, validates tokens and scopes, and owns no business state. Its own repository is ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost. Delivers: TemplateCatalogHost (complete). Increment I1: Generate a microservice. Build order 83 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-085",
        "AIFACTORY-US-709",
        "AIFACTORY-US-710",
        "AIFACTORY-US-711",
        "AIFACTORY-US-712",
        "AIFACTORY-US-713"
      ],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8300,
      "titlePrefix": "[AIFACTORY-FEAT-085]",
      "number": 85
    },
    {
      "id": "AIFACTORY-US-085",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-085",
      "title": "TemplateCatalogHost routes the calls of its platform under a trusted scope",
      "sequence": "15.04.01",
      "description": "As an asset maintainer, I want one gateway in front of BlueprintService, GenerationRecipeService and TemplateRegistryService that validates tokens and scopes, so that no service of the platform is reachable except through its gateway and every call arrives with a scope the service can trust. This is the integration PBI of the gateway of the Template and Library platform. ADR-0028 re-scopes the former composition host as the API gateway of its platform: TemplateCatalogHost routes public REST and internal gRPC calls to the three services the model lists under `deployment.fronts`, BlueprintService, GenerationRecipeService and TemplateRegistryService, validates tokens and scopes and owns no business state, no relational store and no secret (gateway role GW-03). The repository ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost is created and scaffolded in I0 by AIFACTORY-TASK-509 of feature repository-and-pipeline-conventions (D140), and this feature starts from that scaffold: it is scaffolded once from the pinned API gateway template package with `UseFactoryProfile` and the gateway role Platform (feature `component-api-gateway-template`), which fixes persistence, messaging and the actor model to none. The gateway therefore has no outbox and no inbox, consumes no event (ADR-0028 amendment on gateways and events) and its only store is the shared cache. The scope of a call is established once from the validated token with the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (feature `component-extensions-ai`); the gateway copies neither the accessor nor the token contract. A user token has one audience, this gateway, and the gateway forwards it to the fronted service unchanged and exchanges no token, because the fronted service accepts the audience of its own gateway (ADR-0015 amendment D117). A workload token carries service scopes and no tenant claim and is admitted only on an internal gRPC route whose operation names a service scope the token holds (ADR-0015 amendment D114). The feature is delivered by five further PBIs: the fronts file and the routes generated from it (AIFACTORY-US-709), token, tenant and scope on every read and sandbox route (AIFACTORY-US-710), the pass-through of a shared-write call with its idempotency key (AIFACTORY-US-711), the publication routes whose gate stays behind the gateway (AIFACTORY-US-712), and health, feed metadata, limits and telemetry with the three failure modes of this gateway (AIFACTORY-US-713). A call without a token, with an expired token or with a user token issued for another gateway is answered 401 and a missing scope 403, and no fronted service is called. Five operations of the platform are scoped by a project in their service files: `ListBlueprints` and `CreateBlueprintVersion` of BlueprintService and `ListRecipes`, `DraftRecipe` and `ListGeneratedOutputs` of GenerationRecipeService. `ListGeneratedOutputs` names the project in its path, `ListBlueprints` and `ListRecipes` name it in the required query parameter `projectId`, and `CreateBlueprintVersion` and `DraftRecipe` in the required body member `projectId` (D123). The gateway reads the project there. It answers 400 itself for a call that names none and 403 itself for a project the roles of the token do not grant, that is a token without a role claim for that project and without the tenant-wide Platform admin role, calls no fronted service in either case, and forwards every other call (AIFACTORY-US-710, AIFACTORY-US-711). Every other route addresses a blueprint, a recipe or a template version by its identifier or lists the catalog of the tenant, which has no project, so the gateway forwards under the tenant of the token and the scope of the operation, the fronted service answers 403 for a missing right and 404 for a resource of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. The gateway is delivered in I1, in the increment of the three services it fronts and like the other gateways (D123): on a deployed instance every route has its service behind it, a caller outside the cluster, the command-line client among them, calls the gateway, and no service host is reached directly. The refusals and the failure branches are still proven against fakes generated from the fronts file. StudioBff and AgentRuntimeWorker, the two callers the model names, arrive in I3 and call the gateway in their own PBIs. The gateway invents no response. Kind: enabling. Traces: services: TemplateCatalogHost, BlueprintService, GenerationRecipeService, TemplateRegistryService; apis: TemplateCatalogHost/TemplatesHealth; adrs: ADR-0012, ADR-0015, ADR-0017, ADR-0028; requirements: FUX-01, NFR-13. Depends on: AIFACTORY-US-709, AIFACTORY-US-710, AIFACTORY-US-711, AIFACTORY-US-712, AIFACTORY-US-713, feature:repository-and-pipeline-conventions, feature:component-api-gateway-template, feature:component-extensions-ai, feature:blueprint-service, feature:generation-recipe-service, feature:template-registry-service. Sources: model/services/template-library/TemplateCatalogHost.yaml, model/gateways.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost created and scaffolded in I0 by AIFACTORY-TASK-509 of feature repository-and-pipeline-conventions, whose first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost --UseFactoryProfile true --GatewayRole Platform` 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 tests pass with complete reports and a container image is published (ADR-0028, model/services/template-library/TemplateCatalogHost.yaml).",
        "AC2: Given a valid token for a route of each of the three fronted services, when the call passes the gateway, then the scope is established once from the token through the scope accessor of the pinned abstractions package, the call is forwarded with the token unchanged, the tenant, the project the token grants where the operation is scoped by one, the correlation id and the trace context, the fronted service answers and the response returns unchanged, as AIFACTORY-US-710 to AIFACTORY-US-712 prove per route class (ADR-0015, FUX-01).",
        "AC3: Given the generated gateway, when its architecture test runs, then the test fails on a persistence model, an aggregate, a migration or a message consumer, the gateway binds no relational store, no outbox and no inbox, its configuration holds no secret, and no event of the model lists TemplateCatalogHost as a consumer (ADR-0012, ADR-0028, model/services/template-library/TemplateCatalogHost.yaml).",
        "AC4: Given the gateway deployed with two replicas, when `TemplateCatalogHost/TemplatesHealth` is probed and one replica is stopped, then health reports the identity platform and the three fronted services, a replica stays in rotation while it can validate tokens, the other replica keeps serving and nothing is replayed, because the gateway holds no state (ADR-0017, model/services/template-library/TemplateCatalogHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-2854",
        "AIFACTORY-TASK-788"
      ],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8301,
      "kind": "enabling",
      "traces": {
        "services": [
          "TemplateCatalogHost",
          "BlueprintService",
          "GenerationRecipeService",
          "TemplateRegistryService"
        ],
        "apis": [
          "TemplateCatalogHost/TemplatesHealth"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0017",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-01",
          "NFR-13"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-709",
        "AIFACTORY-US-710",
        "AIFACTORY-US-711",
        "AIFACTORY-US-712",
        "AIFACTORY-US-713",
        "feature:repository-and-pipeline-conventions",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:blueprint-service",
        "feature:generation-recipe-service",
        "feature:template-registry-service"
      ],
      "source": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/gateways.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-085]",
      "number": 85
    },
    {
      "id": "AIFACTORY-TASK-2854",
      "type": "task",
      "parent": "AIFACTORY-US-085",
      "title": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service",
      "sequence": "15.04.01.01",
      "description": "Deployment values of the gateway: replica range, ports, probes and the address of each fronted service. Expected output: The deployment manifest of the gateway states the replica range 2 to 4, the ports https 8160 and grpc 8162, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/template-library/TemplateCatalogHost.yaml records them; it leaves Templates:Host:FrontedServices at its default, the three service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, and holds no secret; the same image runs in the saas-default, hybrid and on-prem topologies (ADR-0017).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "The deployment manifest of the gateway states the replica range 2 to 4, the ports https 8160 and grpc 8162, the liveness and readiness probes on the health operation and one base address per fronted service from configuration, as model/services/template-library/TemplateCatalogHost.yaml records them; it leaves Templates:Host:FrontedServices at its default, the three service identifiers of deployment.fronts, sets ConnectSoftIdentityPlatform:Authority to the authority of the profile, and holds no secret; the same image runs in the saas-default, hybrid and on-prem topologies (ADR-0017)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8301,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2854]",
      "number": 2854
    },
    {
      "id": "AIFACTORY-TASK-788",
      "type": "task",
      "parent": "AIFACTORY-US-085",
      "title": "Verify template-catalog-host-routes-its-platform by running the declared command",
      "sequence": "15.04.01.02",
      "description": "Verify template-catalog-host-routes-its-platform by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-085, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes TemplateCatalogHost/TemplatesHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` in the pipeline of the repository; a run that discovers no test counts as a failure; the runs pass and prove AC1 to AC4 of AIFACTORY-US-085, that is the repository with its scaffold of the Platform role, the scope established once and forwarded, the architecture test of the Platform role and, for AC4, the acceptance test of feature TwoReplicas (`dotnet test -c Release --filter \"Category=Acceptance&Feature=TwoReplicas\"`), which hosts two instances of the gateway behind one test balancer with the fakes of the fronted services, probes TemplateCatalogHost/TemplatesHealth on both, stops one instance and asserts that the other keeps serving and that no call is replayed."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-788]",
      "number": 788
    },
    {
      "id": "AIFACTORY-US-709",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-085",
      "title": "Template catalog fronts file: named clients and REST and gRPC routes of BlueprintService, GenerationRecipeService and TemplateRegistryService, generated at build",
      "sequence": "15.04.02",
      "description": "As a platform admin, I want the route table of the template catalog gateway generated from the list of services it fronts, so that every operation of the platform has exactly one route with its scope and class and no forwarding code is written by hand. The API gateway template is a custom gateway with controllers, use cases and named clients and is no reverse proxy, so a route exists only when it is declared. Under `UseFactoryProfile` the generated solution holds a build-time source generator that reads a fronts file on every build and emits one named HTTP client and one gRPC client per fronted service, the REST and gRPC routes that forward to them and the route table (feature `component-api-gateway-template`). This PBI writes the fronts file of the Template and Library platform. It lists the three services of `deployment.fronts` in model/services/template-library/TemplateCatalogHost.yaml, each with its base addresses from configuration and its operations in the shape of the `apis` section of its service file: name, method and path or gRPC method with its streaming mode, scope, side-effect class and idempotency. For BlueprintService these are the five REST operations `ListBlueprints`, `GetBlueprintVersion`, `CreateBlueprintVersion`, `ValidateBlueprint` and `SubmitBlueprint` and the three internal gRPC methods of `Blueprints`: `SubmitDraftVersion`, `Validate` and `GetDerivedModel`. For GenerationRecipeService these are the six REST operations `ListRecipes`, `GetRecipe`, `DraftRecipe`, `ValidateRecipe`, `ApproveRecipe` and `ListGeneratedOutputs` and the two gRPC methods `Recipes.GetApprovedRecipe` and `Recipes.RecordOutput`. For TemplateRegistryService these are the six REST operations `ListTemplates`, `GetTemplateVersion`, `ListLibraries`, `QueryCompatibility`, `DiscoverTemplates` and `PublishTemplateVersion` and the gRPC method `Catalog.ResolveManifest`. That is seventeen REST routes and six gRPC routes, all unary. The REST operations are the public surface that StudioBff and a typed client call; the gRPC methods are the internal surface that the agent hosts call through AgentRuntimeWorker during a generation run. Each route carries the scope and the side-effect class of its operation, which is what the route class PBIs of this feature enforce; an internal gRPC route names the service scope a workload token must hold. Each REST entry also states how its operation addresses a project: the path parameter `projectId` for `ListGeneratedOutputs`, the required query parameter `projectId` for `ListBlueprints` and `ListRecipes`, the required body member `projectId` for `CreateBlueprintVersion` and `DraftRecipe` (D123), and a resource identifier only for every other operation, which is what AIFACTORY-US-710 and AIFACTORY-US-711 enforce. A test lists the emitted route table against the file and against the three service files of the model, so an operation of the model without a route, a route without an operation, a service named twice or a route named twice fails the build with the entry named. A path that no route matches is answered 404. The gateway adds no operation of its own beyond `TemplatesHealth` and `TemplatesFeeds`, transforms no payload and composes no response from two services. The option `Templates:Host:FrontedServices` is bound at startup and compared with the service names of the fronts file: a value that names no service of the file, or a service of the file that the value omits, fails startup with the name, so the option can neither add nor remove a route; it is not reloadable. The fronts file names its services by their identifiers, BlueprintService, GenerationRecipeService and TemplateRegistryService, as `deployment.fronts` lists them. The default of the option is those three identifiers, as model/services/template-library/TemplateCatalogHost.yaml states it (D123): the default of a fronted-services option equals the service set of `deployment.fronts`, as for the Control Plane gateway (D117) and for the model and tool gateways (D121). The gateway therefore starts with the option at its default, and the deployment manifest does not set it. The gateway clients of feature `typed-gateway-clients` are generated from a contract-first OpenAPI document of the client repository until a gateway publishes its own (decision D117): the pipeline of this repository publishes the OpenAPI document of the seventeen public REST operations as a build output, checked against the fronts file and against the three service files of the model. This feature builds and publishes no client package. The typed client of this gateway is generated and published by feature `typed-gateway-clients` in the same increment, beside the clients of the control plane, model and tool gateways (AIFACTORY-US-381 and AIFACTORY-US-383 of that feature). Kind: enabling. Traces: services: TemplateCatalogHost, BlueprintService, GenerationRecipeService, TemplateRegistryService; adrs: ADR-0015, ADR-0028; requirements: FUX-01. Depends on: feature:component-api-gateway-template, feature:blueprint-service, feature:generation-recipe-service, feature:template-registry-service. Sources: model/services/template-library/TemplateCatalogHost.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/TemplateRegistryService.yaml, model/gateways.yaml, docs/architecture/catalogs/gateways.md, docs/architecture/api-governance.md, docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#context-and-boundaries.",
      "acceptanceCriteria": [
        "AC1: Given the fronts file of the Template and Library platform, when the gateway builds, then one named HTTP client and one gRPC client exist per service of `deployment.fronts` and one route per REST operation and gRPC method of those services, seventeen REST routes and six gRPC routes, each with the scope, side-effect class, idempotency and streaming mode of the operation, and the route table test passes against model/services/template-library/TemplateCatalogHost.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml and model/services/template-library/TemplateRegistryService.yaml (ADR-0028).",
        "AC2: Given an operation removed from the file, a route named twice or a service named twice, when the gateway builds, then the build fails with the entry named; given `Templates:Host:FrontedServices` at its default, the three service identifiers of `deployment.fronts` in model/services/template-library/TemplateCatalogHost.yaml, when the gateway starts, then startup succeeds; given a value of the option that names no service of the fronts file or omits one, when the gateway starts, then startup fails with the differing name; given a path no route matches, when it is called, then the answer is 404 and no fronted service is called (ADR-0028, docs/architecture/catalogs/gateways.md).",
        "AC3: Given a fake of each fronted service, when one REST route and one gRPC route per service are called with a valid token, then each call reaches the fake of its service with the authorization header, which carries the token of the caller unchanged because the gateway exchanges no token, the tenant, the correlation id and the trace context, and the response of the fake returns unchanged (ADR-0015, FUX-01).",
        "AC4: Given the built gateway, when its pipeline publishes the OpenAPI document of the public REST routes, then the document holds exactly the seventeen REST operations of the fronts file with their methods, paths, scopes and response codes and no internal gRPC method, and a contract check fails the build when it differs from the three service files under model/services/template-library (docs/architecture/api-governance.md)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#context-and-boundaries"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-510",
        "AIFACTORY-TASK-2855",
        "AIFACTORY-TASK-2856",
        "AIFACTORY-TASK-2857"
      ],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8302,
      "kind": "enabling",
      "traces": {
        "services": [
          "TemplateCatalogHost",
          "BlueprintService",
          "GenerationRecipeService",
          "TemplateRegistryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-gateway-template",
        "feature:blueprint-service",
        "feature:generation-recipe-service",
        "feature:template-registry-service"
      ],
      "source": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "docs/architecture/api-governance.md",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#context-and-boundaries"
      ],
      "titlePrefix": "[AIFACTORY-US-709]",
      "number": 709
    },
    {
      "id": "AIFACTORY-TASK-510",
      "type": "task",
      "parent": "AIFACTORY-US-709",
      "title": "Fronts file with the REST and gRPC operations of BlueprintService, GenerationRecipeService and TemplateRegistryService",
      "sequence": "15.04.02.01",
      "description": "Fronts file with the REST and gRPC operations of BlueprintService, GenerationRecipeService and TemplateRegistryService. Expected output: The fronts file lists the three services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation how it addresses a project, by the path parameter projectId, by the required query parameter projectId, by the required body member projectId or by a resource identifier only; the build emits the named clients, the seventeen REST routes, the six gRPC routes and the route table; at startup the option Templates:Host:FrontedServices, whose default is the three service identifiers of deployment.fronts, is compared with the service names of the fronts file, the gateway starts with the option at its default, and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The fronts file lists the three services of deployment.fronts with their base addresses from configuration and every REST operation and gRPC method of their service files with name, path or method, streaming mode, scope, side-effect class and idempotency, and for each REST operation how it addresses a project, by the path parameter projectId, by the required query parameter projectId, by the required body member projectId or by a resource identifier only; the build emits the named clients, the seventeen REST routes, the six gRPC routes and the route table; at startup the option Templates:Host:FrontedServices, whose default is the three service identifiers of deployment.fronts, is compared with the service names of the fronts file, the gateway starts with the option at its default, and a difference in either direction fails startup with the name; a call without a valid token or scope is refused at the gateway by the generated policies."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-510]",
      "number": 510
    },
    {
      "id": "AIFACTORY-TASK-2855",
      "type": "task",
      "parent": "AIFACTORY-US-709",
      "title": "Fakes of the three fronted services and the token matrix of the acceptance suite",
      "sequence": "15.04.02.02",
      "description": "Fakes of the three fronted services and the token matrix of the acceptance suite. Expected output: The acceptance suite of the gateway holds one fake per fronted service that records the headers and metadata it received and answers a configured status, a switch that makes a fake stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway holds one fake per fronted service that records the headers and metadata it received and answers a configured status, a switch that makes a fake stop answering, and tokens for the matrix of role, tenant and project, including an expired token, an identity token, a user token of another audience, a token with a role in one project and none in another, a token with the tenant-wide Platform admin role, and a workload token with and without the service scope of a gRPC route."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8302,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2855]",
      "number": 2855
    },
    {
      "id": "AIFACTORY-TASK-2856",
      "type": "task",
      "parent": "AIFACTORY-US-709",
      "title": "OpenAPI document of the public REST routes of the gateway as a published build output",
      "sequence": "15.04.02.03",
      "description": "OpenAPI document of the public REST routes of the gateway as a published build output. Expected output: The pipeline publishes one OpenAPI document with the seventeen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml and model/services/template-library/TemplateRegistryService.yaml and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can be the input from which feature typed-gateway-clients generates the client of this gateway (decision D117); no client package is built here.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "The pipeline publishes one OpenAPI document with the seventeen public REST operations of the fronts file, their methods, paths, scopes, idempotency headers and response codes, and no internal gRPC method; a contract check compares the document with model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml and model/services/template-library/TemplateRegistryService.yaml and fails the build on a missing operation, an operation of another service or a differing method, path, scope or response code, so the document can be the input from which feature typed-gateway-clients generates the client of this gateway (decision D117); no client package is built here."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8302,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2856]",
      "number": 2856
    },
    {
      "id": "AIFACTORY-TASK-2857",
      "type": "task",
      "parent": "AIFACTORY-US-709",
      "title": "Verify the route table against the fronts file and the model",
      "sequence": "15.04.02.04",
      "description": "Verify the route table against the fronts file and the model. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-709: one route per operation of the three service files under model/services/template-library, the failing builds, the start with the option at its default, the failing startup on a value that names no service of the fronts file or omits one, the 404 of an unknown path, one forwarded call per service and protocol and the contract check of the published OpenAPI document.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Feature=RouteTable\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-709: one route per operation of the three service files under model/services/template-library, the failing builds, the start with the option at its default, the failing startup on a value that names no service of the fronts file or omits one, the 404 of an unknown path, one forwarded call per service and protocol and the contract check of the published OpenAPI document."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2857]",
      "number": 2857
    },
    {
      "id": "AIFACTORY-US-710",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-085",
      "title": "A read or sandbox route of the template catalog gateway forwards a call only under a validated token, the tenant of the token, a granted project and the scope of its operation",
      "sequence": "15.04.03",
      "description": "As a requester, I want my read calls to reach the blueprint, recipe and catalog services only with the tenant, project and scope my token grants, so that I see the blueprints, recipes and template versions I am entitled to and nobody reads across a tenant or a project through the gateway. A caller reaches a read operation of the Template and Library platform through the gateway: a requester lists the blueprints and recipes of a project and reads one version of each, reads the provenance of the generated outputs of a project, lists template and library versions, reads one pinned manifest and queries the compatibility matrix, and an Observer reads the same. A user presents an access token of the authorization server whose one audience is this gateway (ADR-0015 amendment D114); a client that also calls the Control Plane gateway requests a second token for it. The gateway validates issuer, signature, lifetime and audience through the pinned resource-server library and requires the scope the operation names: `factory.blueprints.read` for `ListBlueprints` and `GetBlueprintVersion`, `factory.recipes.read` for `ListRecipes`, `GetRecipe` and `ListGeneratedOutputs`, and `factory.catalog.read` for `ListTemplates`, `GetTemplateVersion`, `ListLibraries` and `QueryCompatibility`. It takes the tenant from the `tid` claim and overwrites any tenant header of the caller. Five operations of BlueprintService and GenerationRecipeService are scoped by a project in their service files: `ListBlueprints` returns the blueprints of a project, `ListRecipes` the recipes of a project and `ListGeneratedOutputs` the generated outputs of a project, and the two writes `CreateBlueprintVersion` and `DraftRecipe` store under the project they name (AIFACTORY-US-711). Each names its project where its operation declares it (D123): `ListGeneratedOutputs` in its path as `projectId`, `ListBlueprints` and `ListRecipes` in the required query parameter `projectId`, and the two writes in the required body member `projectId`. The gateway reads the project there and checks it against the roles of the token: it admits the project only when the token holds a role claim for it or the tenant-wide Platform admin role, and for a project the roles of the token do not grant it answers 403 itself. A call to `ListBlueprints` or `ListRecipes` without the parameter is answered 400 by the gateway. In both cases no fronted service is called. A granted call is forwarded with its path and its query unchanged, and the fronted service reads the project from the same place. A project header of the caller names the project of no project-scoped operation: on those five routes the gateway sets the project header of the forwarded scope from the project it admitted. On a route addressed by a resource identifier the header stays optional, a granted one is forwarded and one the token does not grant is refused with 403, so no project header of a caller is forwarded unchecked on any route. Every public REST operation of the three services names a `factory.` scope and none names a service scope, so no REST route admits a workload token; a workload token on such a route is answered 403. The scope is established once with the scope accessor of the pinned abstractions package and forwarded: the authorization header with the user token itself, the tenant in `X-Tenant-Id`, the project the gateway admitted in the project header of the abstractions package, the correlation id and the trace context. The gateway exchanges no token; the fronted service validates the forwarded token again, accepts the audience of its own gateway, which is this one, and applies its own tenant filter and role policies (ADR-0015 amendment D117). The other read routes, `GetBlueprintVersion`, `GetRecipe` and the four reads of the catalog, name a blueprint, a recipe or a template version by identifier or list the catalog of the tenant, which has no project, and a gateway without business state cannot know the tenant or the project of such a resource. It forwards the call under the tenant of the token and the scope of the operation; the fronted service answers 403 for a missing role and 404 for a blueprint, a recipe or a template version of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. The internal gRPC surface has three read methods and one sandbox method. `Blueprints.GetDerivedModel`, `Recipes.GetApprovedRecipe` and `Catalog.ResolveManifest` are read by workloads during a generation run, and `Blueprints.Validate` is the sandbox route of this platform: it validates one blueprint version against the schema and the rule set of its kind and returns a receipt. A workload presents a token that carries service scopes, no audience of a user API and no tenant claim, and each gRPC route names the service scope the token must hold. For a workload token that holds it, the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope (ADR-0015 amendment D114); for a workload token without it, and for a user token, which holds no service scope, the answer is PERMISSION_DENIED and no fronted service is called. The gateway adds no gate of its own to the sandbox class and returns the receipt of the service unchanged. For every one of these routes the response is served by the fronted service, the gateway returns it unchanged with the correlation id and keeps nothing of the call. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and a token without the scope of the operation 403; in these cases no fronted service is called, and the refusal is counted for the route and logged with the correlation id and without the token. When a fronted service does not answer, its routes answer 503 with a retry hint, over gRPC UNAVAILABLE, and the routes of the other two services keep serving. Kind: behavior. Traces: services: TemplateCatalogHost, BlueprintService, GenerationRecipeService, TemplateRegistryService; adrs: ADR-0015, ADR-0028; requirements: FUX-01, FUX-03; scenarios: SCN-TemplateCatalogHost-004. Relates: screens: template-catalog, recipes. Depends on: AIFACTORY-US-709, feature:component-api-gateway-template, feature:component-extensions-ai, feature:blueprint-service, feature:generation-recipe-service, feature:template-registry-service. Sources: model/services/template-library/TemplateCatalogHost.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/TemplateRegistryService.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#purpose-and-responsibilities.",
      "acceptanceCriteria": [
        "AC1: Given a user token whose audience is this gateway, with `factory.catalog.read`, when the read route of `ListTemplates` is called, then the gateway forwards the call with the user token unchanged in the authorization header, without a token exchange, the tenant of the `tid` claim, the correlation id and the trace context, TemplateRegistryService answers, the response returns unchanged with the correlation id and nothing is written by the gateway (SCN-TemplateCatalogHost-004, ADR-0015, FUX-01).",
        "AC2: Given the token matrix of the acceptance suite, when the read routes of the three fronted services are called, then a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, a token without the scope of the operation and a workload token on a REST route are answered 403, and in none of these cases a fronted service is called; each refusal is counted for its route and logged with the correlation id and without the token (SCN-TemplateCatalogHost-004, ADR-0015).",
        "AC3: Given a valid user token and a tenant header of the caller that names another tenant, when a read route is called, then the header is overwritten with the `tid` claim before the call is forwarded; given the routes of `ListBlueprints` and `ListRecipes` with the required query parameter `projectId` and the route of `ListGeneratedOutputs` with a `projectId` in its path, when the token holds a role claim for that project or the tenant-wide Platform admin role, then the call is forwarded with its path and its query unchanged, when the roles of the token do not grant the project, then the gateway answers 403 itself, and when a call to `ListBlueprints` or `ListRecipes` names no `projectId`, then the gateway answers 400 itself, and in neither case a fronted service is called; given a route addressed by a `blueprintId`, a `recipeId` or a `templateId`, when the caller sends a project header the token does not grant, then the answer is 403 and nothing is forwarded, and when the fronted service answers 403 for a missing role or 404 for a resource of another tenant (ADR-0015 amendment D113), then the gateway returns that answer unchanged (SCN-TemplateCatalogHost-004, ADR-0015).",
        "AC4: Given a workload token that holds the service scope the route names, when the gRPC read route of `Catalog.ResolveManifest` and the sandbox route of `Blueprints.Validate` are called with `tenant-id` and project metadata, then the gateway forwards each call with that metadata unchanged, adds no gate of its own to the sandbox class and returns the reply of the service unchanged; given a workload token without the scope, or a user token, which holds no service scope, then the answer is PERMISSION_DENIED and no fronted service is called; a NOT_FOUND of the fronted service for a resource outside the forwarded tenant returns unchanged (SCN-TemplateCatalogHost-004, ADR-0015).",
        "AC5: Given a fronted service that does not answer, when one of its read routes is called, then the gateway answers 503, over gRPC UNAVAILABLE, with a problem response that carries a retry hint and names the service and never its address, invents no response, and the read routes of the other two services keep serving (SCN-TemplateCatalogHost-004, model/services/template-library/TemplateCatalogHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#purpose-and-responsibilities"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2858",
        "AIFACTORY-TASK-2859"
      ],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8303,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateCatalogHost",
          "BlueprintService",
          "GenerationRecipeService",
          "TemplateRegistryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FUX-01",
          "FUX-03"
        ],
        "scenarios": [
          "SCN-TemplateCatalogHost-004"
        ]
      },
      "relates": {
        "screens": [
          "template-catalog",
          "recipes"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-709",
        "feature:component-api-gateway-template",
        "feature:component-extensions-ai",
        "feature:blueprint-service",
        "feature:generation-recipe-service",
        "feature:template-registry-service"
      ],
      "source": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#purpose-and-responsibilities"
      ],
      "titlePrefix": "[AIFACTORY-US-710]",
      "number": 710
    },
    {
      "id": "AIFACTORY-TASK-2858",
      "type": "task",
      "parent": "AIFACTORY-US-710",
      "title": "Issuer, audience, scope and project configuration of the read and sandbox routes",
      "sequence": "15.04.03.01",
      "description": "Issuer, audience, scope and project configuration of the read and sandbox routes. Expected output: The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the routes of the five project-scoped operations are marked with the place that names their project, the path parameter projectId for ListGeneratedOutputs, the required query parameter projectId for ListBlueprints and ListRecipes and the required body member projectId for CreateBlueprintVersion and DraftRecipe (D123); the gateway reads the project there, admits it only for a token with a role claim for it or the tenant-wide Platform admin role, answers 403 itself for a project the roles of the token do not grant and 400 itself for a call that names none, calling no fronted service in either case, and forwards a granted call with its path, its query and its body unchanged; a route addressed by blueprintId, recipeId or templateId is marked as addressed by a resource id only, so the gateway checks token and scope, refuses a project header the token does not grant and leaves the role and the tenant of the resource to the fronted service; no project header of a caller is forwarded unchecked; the tenant header is overwritten with the tid claim; a workload token is refused with 403 on a REST route; a gRPC route names the service scope a workload token must hold and forwards the tenant-id and project metadata unchanged with it (ADR-0015 amendment D114); the user token is forwarded unchanged and no token is exchanged (ADR-0015 amendment D117); refusals are counted per route and logged with the correlation id and without the token.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "The gateway is configured with the authority of ConnectSoftIdentityPlatform:Authority and its own resource as the one audience of a user token; each read route requires the scope of its operation; the routes of the five project-scoped operations are marked with the place that names their project, the path parameter projectId for ListGeneratedOutputs, the required query parameter projectId for ListBlueprints and ListRecipes and the required body member projectId for CreateBlueprintVersion and DraftRecipe (D123); the gateway reads the project there, admits it only for a token with a role claim for it or the tenant-wide Platform admin role, answers 403 itself for a project the roles of the token do not grant and 400 itself for a call that names none, calling no fronted service in either case, and forwards a granted call with its path, its query and its body unchanged; a route addressed by blueprintId, recipeId or templateId is marked as addressed by a resource id only, so the gateway checks token and scope, refuses a project header the token does not grant and leaves the role and the tenant of the resource to the fronted service; no project header of a caller is forwarded unchecked; the tenant header is overwritten with the tid claim; a workload token is refused with 403 on a REST route; a gRPC route names the service scope a workload token must hold and forwards the tenant-id and project metadata unchanged with it (ADR-0015 amendment D114); the user token is forwarded unchanged and no token is exchanged (ADR-0015 amendment D117); refusals are counted per route and logged with the correlation id and without the token."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2858]",
      "number": 2858
    },
    {
      "id": "AIFACTORY-TASK-2859",
      "type": "task",
      "parent": "AIFACTORY-US-710",
      "title": "Verify the read and sandbox routes through the acceptance suite",
      "sequence": "15.04.03.02",
      "description": "Verify the read and sandbox routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateCatalogHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-710 over the token matrix, the token received by the fake equal to the user token of the caller, the routes of ListBlueprints, ListRecipes and ListGeneratedOutputs forwarded unchanged for a granted project and refused with 403 for a project without a role claim, the routes of ListBlueprints and ListRecipes refused with 400 for a call without the query parameter projectId, a tenant-wide Platform admin admitted to a project, a route addressed by a resource id that refuses a project header the token does not grant and whose 403 and 404 come from the fake and return unchanged, the overwritten tenant header, a workload token refused on a REST route, the gRPC routes of Catalog.ResolveManifest and Blueprints.Validate with and without the service scope, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateCatalogHost-004\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-710 over the token matrix, the token received by the fake equal to the user token of the caller, the routes of ListBlueprints, ListRecipes and ListGeneratedOutputs forwarded unchanged for a granted project and refused with 403 for a project without a role claim, the routes of ListBlueprints and ListRecipes refused with 400 for a call without the query parameter projectId, a tenant-wide Platform admin admitted to a project, a route addressed by a resource id that refuses a project header the token does not grant and whose 403 and 404 come from the fake and return unchanged, the overwritten tenant header, a workload token refused on a REST route, the gRPC routes of Catalog.ResolveManifest and Blueprints.Validate with and without the service scope, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2859]",
      "number": 2859
    },
    {
      "id": "AIFACTORY-US-711",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-085",
      "title": "A shared-write route of the template catalog gateway passes the idempotency key through and the gateway keeps nothing between calls",
      "sequence": "15.04.04",
      "description": "As a requester, I want a write I repeat after a failure to be applied once, so that a lost answer or a restarted gateway never stores a second blueprint version, drafts a second recipe or approves a recipe twice. A shared-write operation changes state that others read. On this platform these are six public REST operations and two internal gRPC methods. Of BlueprintService: `CreateBlueprintVersion` and `ValidateBlueprint` under `factory.blueprints.write`, and the gRPC method `Blueprints.SubmitDraftVersion`, by which a run stores a document it produced as a new Draft version. Of GenerationRecipeService: `DraftRecipe` and `ValidateRecipe` under `factory.recipes.write`, `ApproveRecipe` under `factory.recipes.approve`, and the gRPC method `Recipes.RecordOutput`, by which a generation attempt records the provenance of its output. Of TemplateRegistryService: `DiscoverTemplates` under `factory.catalog.admin`, which through I4 the service admits only for an administrator of the platform tenant and answers 403 for a caller of another tenant (D123), an answer the gateway returns unchanged. The caller sends a REST call through the gateway under the token, tenant, project and scope rules of AIFACTORY-US-710. Two of the writes are scoped by a project, `CreateBlueprintVersion` and `DraftRecipe`: the caller names the project in the required body member `projectId` (D123). The gateway reads that one member of the body, admits the project only for a token that holds a role claim for it or the tenant-wide Platform admin role, and answers 400 itself for a body that names no project and 403 itself for a project the roles of the token do not grant, calling no fronted service in either case. It forwards a granted call with its body unchanged, and the fronted service stores under the project the body names. The other writes address a blueprint or a recipe by identifier or, for `DiscoverTemplates`, the catalog of the platform tenant; on them the gateway reads no project, a project header is optional and is refused with 403 when the token does not grant it. Two of the operations declare the idempotency `key-header`, `CreateBlueprintVersion` and `DraftRecipe`: each is called with an `Idempotency-Key`, the gateway forwards the header unchanged and the fronted service applies the request once under its own rule, and what the service answers for the same key with the same body and for the same key with a different body returns to the caller unchanged. The other four declare the idempotency `natural`: the gateway demands no key for them, and the service makes a repeat harmless by the natural key of what it writes, a blueprint version, a recipe version or a commit that is already pinned. An internal gRPC route is called by a workload: the token carries service scopes, no audience of a user API and no tenant claim, and the route names the service scope it must hold. For a workload token that holds the scope, the gateway forwards the `tenant-id` and the project metadata of the caller unchanged, because the fronted service reads a forwarded tenant and project only under that scope (ADR-0015 amendment D114); for a workload token without it, and for a user token, which holds no service scope, the answer is PERMISSION_DENIED and no fronted service is called. `Blueprints.SubmitDraftVersion` is idempotent on the hash of the document inside BlueprintService, so a repeated call returns the version that was stored first, and `Recipes.RecordOutput` is idempotent on run, attempt and module inside GenerationRecipeService, so a repeated call records one output. The gateway is no party to idempotency. It stores neither a key nor a result, keeps no session and no pending call, has no outbox and writes no event, so a gateway replica that crashes during a call loses nothing: the replica restarts, nothing is replayed, and the caller retries with the same key, or with the same document or version, and receives from the service the result of the first application (failure mode of a gateway replica crash in the model). `ApproveRecipe` is of the shared-write class in the model although it is an approval: who may approve a recipe, a Requester, an Asset maintainer or a Reviewer where the policy of the project requires one, is decided by GenerationRecipeService, and the gateway checks the scope `factory.recipes.approve` and nothing else. When the fronted service does not answer, the route answers 503, over gRPC UNAVAILABLE, with the service named and a retry hint, the routes of the other two services keep serving, and the caller retries. A refusal by the gateway reaches no fronted service, so it applies nothing. A missing key, an invalid body, the 403 of the service for a missing role, the 404 for a resource of another tenant and every domain refusal, such as the 409 of `ApproveRecipe`, the 412 of `DraftRecipe` or the 422 of `CreateBlueprintVersion`, are answers of the fronted service and return unchanged with the correlation id. The gateway records request count and latency for the route with the status that was returned. Kind: behavior. Traces: services: TemplateCatalogHost, BlueprintService, GenerationRecipeService, TemplateRegistryService; adrs: ADR-0014, ADR-0015, ADR-0028; requirements: FR-03; scenarios: SCN-TemplateCatalogHost-005. Depends on: AIFACTORY-US-709, AIFACTORY-US-710, feature:component-api-gateway-template, feature:blueprint-service, feature:generation-recipe-service, feature:template-registry-service. Sources: model/services/template-library/TemplateCatalogHost.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a valid user token with `factory.blueprints.write` and a role claim for the project the body member `projectId` names, and the shared-write route of `CreateBlueprintVersion`, when the call arrives with an `Idempotency-Key`, then the gateway forwards the request with the key header and the body unchanged, the fronted service applies it once and the response returns unchanged with the correlation id (SCN-TemplateCatalogHost-005, ADR-0015, FR-03).",
        "AC2: Given the same call repeated with the same key, and then with the same key and a different body, when both pass the gateway, then the first returns the result of the first application and the second returns the answer of the fronted service for a reused key unchanged; given the route of `DraftRecipe` called with a key and a granted project for a blueprint version a recipe may not bind, when the fronted service answers 412, then that answer returns unchanged; the gateway has stored neither a key nor a result (SCN-TemplateCatalogHost-005, ADR-0014, ADR-0028).",
        "AC3: Given the routes of `ValidateBlueprint`, `ValidateRecipe`, `ApproveRecipe` and `DiscoverTemplates`, the four that declare the idempotency `natural`, when each is called with a valid token of its scope and without a key header, then the gateway forwards the call and returns the answer of the fronted service unchanged, the 422 of the two validations and the 409 of `ApproveRecipe` among them; given a workload token that holds the service scope the routes of `Blueprints.SubmitDraftVersion` and `Recipes.RecordOutput` name, when each method is called twice with the same request and with `tenant-id` and project metadata, then the gateway forwards every call with that metadata unchanged and returns each reply unchanged; given a workload token without the scope, or a user token, then the answer is PERMISSION_DENIED and no fronted service is called (SCN-TemplateCatalogHost-005, ADR-0015).",
        "AC4: Given a gateway replica stopped while a shared-write call is in flight, when the caller retries with the same key through another replica, then the fronted service returns the result of the one application, nothing is replayed by the gateway and no second state change exists (SCN-TemplateCatalogHost-005, model/services/template-library/TemplateCatalogHost.yaml).",
        "AC5: Given a call without a token, a token that lacks the scope, a call to `CreateBlueprintVersion` or `DraftRecipe` whose body names no `projectId`, such a call whose `projectId` names a project the roles of the token do not grant, or a fronted service that does not answer, when a shared-write route is called, then the answer is 401, 403, 400, 403 or 503 respectively, over gRPC UNAUTHENTICATED, PERMISSION_DENIED and UNAVAILABLE for the first, the second and the last; a call the gateway refuses reaches no fronted service and applies nothing; the 403 of the fronted service for a missing role, the 403 of `DiscoverTemplates` for a caller of another tenant than the platform tenant among them, and its 404 for a resource of another tenant (ADR-0015 amendment D113) return unchanged; the 503 names the service and carries a retry hint while the routes of the other two services keep serving (SCN-TemplateCatalogHost-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2860",
        "AIFACTORY-TASK-2861"
      ],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8304,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateCatalogHost",
          "BlueprintService",
          "GenerationRecipeService",
          "TemplateRegistryService"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-03"
        ],
        "scenarios": [
          "SCN-TemplateCatalogHost-005"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-709",
        "AIFACTORY-US-710",
        "feature:component-api-gateway-template",
        "feature:blueprint-service",
        "feature:generation-recipe-service",
        "feature:template-registry-service"
      ],
      "source": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-711]",
      "number": 711
    },
    {
      "id": "AIFACTORY-TASK-2860",
      "type": "task",
      "parent": "AIFACTORY-US-711",
      "title": "Forwarded headers and metadata of a write route and a stateless call path",
      "sequence": "15.04.04.01",
      "description": "Forwarded headers and metadata of a write route and a stateless call path. Expected output: A shared-write REST route forwards the Idempotency-Key header where the operation declares key-header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; the routes of CreateBlueprintVersion and DraftRecipe take their project from the required body member projectId (D123), are forwarded with the body unchanged only when the token holds a role claim for that project or the tenant-wide Platform admin role, and are answered by the gateway 403 for a project the roles of the token do not grant and 400 for a body that names none; a route whose operation declares the idempotency natural demands no key; an internal gRPC route names the service scope a workload token must hold, answers PERMISSION_DENIED without it and forwards the tenant-id and project metadata of the caller unchanged with it (ADR-0015 amendment D114); no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "A shared-write REST route forwards the Idempotency-Key header where the operation declares key-header, the body and the established scope unchanged and returns the status and the body of the fronted service unchanged; the routes of CreateBlueprintVersion and DraftRecipe take their project from the required body member projectId (D123), are forwarded with the body unchanged only when the token holds a role claim for that project or the tenant-wide Platform admin role, and are answered by the gateway 403 for a project the roles of the token do not grant and 400 for a body that names none; a route whose operation declares the idempotency natural demands no key; an internal gRPC route names the service scope a workload token must hold, answers PERMISSION_DENIED without it and forwards the tenant-id and project metadata of the caller unchanged with it (ADR-0015 amendment D114); no key, body or result is written to the shared cache or to any store; request count and latency are recorded for the route with the returned status."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2860]",
      "number": 2860
    },
    {
      "id": "AIFACTORY-TASK-2861",
      "type": "task",
      "parent": "AIFACTORY-US-711",
      "title": "Verify the shared-write routes through the acceptance suite",
      "sequence": "15.04.04.02",
      "description": "Verify the shared-write routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateCatalogHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-711 with a fake that applies a key once, the routes of CreateBlueprintVersion and DraftRecipe forwarded with the body unchanged for a granted project, refused with 403 for a project without a role claim and with 400 for a body that names none, the 412 of DraftRecipe returned unchanged, the four routes without a key header (ValidateBlueprint, ValidateRecipe, ApproveRecipe and DiscoverTemplates) with their 422 and 409 answers, the gRPC routes of Blueprints.SubmitDraftVersion and Recipes.RecordOutput under a workload token with and without the service scope and under a user token of the token matrix (PERMISSION_DENIED and no call to the fake), a replica stopped during a call, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, and a fake that stops answering.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateCatalogHost-005\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-711 with a fake that applies a key once, the routes of CreateBlueprintVersion and DraftRecipe forwarded with the body unchanged for a granted project, refused with 403 for a project without a role claim and with 400 for a body that names none, the 412 of DraftRecipe returned unchanged, the four routes without a key header (ValidateBlueprint, ValidateRecipe, ApproveRecipe and DiscoverTemplates) with their 422 and 409 answers, the gRPC routes of Blueprints.SubmitDraftVersion and Recipes.RecordOutput under a workload token with and without the service scope and under a user token of the token matrix (PERMISSION_DENIED and no call to the fake), a replica stopped during a call, a route addressed by a resource id whose 403 and 404 come from the fake and return unchanged, and a fake that stops answering."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2861]",
      "number": 2861
    },
    {
      "id": "AIFACTORY-US-712",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-085",
      "title": "A publication route is forwarded under its scope, and the review and the approval of the release stay in Asset Publication behind the fronted service",
      "sequence": "15.04.05",
      "description": "As an asset maintainer, I want a submission for publication to be decided by the services that own the version and the release, with the gateway only checking who calls and what may be called, so that an approval is never decided twice or by a component that holds no state. Two operations of this platform are of the publication class, the highest side-effect class the model gives this gateway. `SubmitBlueprint` of BlueprintService submits a Validated blueprint version to Asset Publication as a blueprint release candidate, under `factory.blueprints.publish`. `PublishTemplateVersion` of TemplateRegistryService submits a Verified template version to Asset Publication as a template release, under `factory.catalog.admin`; through I4 the service admits it only for an administrator of the platform tenant and answers 403 for a caller of another tenant (D123). Neither publishes anything by itself: each hands a candidate to AgentRegistryService, the release authority of the Control Plane, and answers 202; the review, the evaluation where a suite exists and the approval by someone other than the subject that submitted the candidate are decided there (ADR-0021), and each service marks its version Published only when the release is published. ADR-0028 leaves a platform gateway routing and the validation of tokens and scopes and no business state, and names a gateway that accumulates logic beyond routing and validation as a reason to revisit the decision. The gateway therefore treats these routes as it treats every route: it validates the token, takes the tenant from it, requires the scope the operation names and forwards the call with the established scope and the user token unchanged, so the fronted service knows the caller as the submitting subject. The gate itself is decided where the state is. BlueprintService submits only a Validated version and TemplateRegistryService only a Verified one, and each answers 409 otherwise and 404 for a version the tenant of the caller cannot read; the gateway returns those answers unchanged. The gateway evaluates no approval and holds no approval reference: neither operation declares one in the model, so a request is forwarded without one, and no request is refused for lacking one. It resolves no release, reads no release state and never asks AgentRegistryService anything, which belongs to another platform and is no service this gateway fronts. It writes no audit evidence: the fronted service writes its evidence in the transaction of its command. A call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401, and a token without the scope of the operation 403, a token that holds only `factory.blueprints.write` on the route of `SubmitBlueprint` among them; in these cases no fronted service is called. Both routes name only a resource id, a `blueprintId` or a `templateId` with a version: the fronted service answers 403 for a caller whose role may not submit and 404 for a version of another tenant (ADR-0015 amendment D113), and the gateway returns that answer unchanged. When the fronted service does not answer, the route answers 503 with a retry hint that names the service, and the routes of the other two services keep serving; when AgentRegistryService does not answer the fronted service, the service fails fast, TemplateRegistryService with 503 and a problem response that names AgentRegistryService, and that answer returns unchanged. A register test of the acceptance suite lists the routes of the publication class from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a release or a candidate. Kind: behavior. Traces: services: TemplateCatalogHost, BlueprintService, TemplateRegistryService; adrs: ADR-0015, ADR-0021, ADR-0028; requirements: FR-02, FR-06, NFR-11; scenarios: SCN-TemplateCatalogHost-003. Relates: screens: template-catalog. Depends on: AIFACTORY-US-709, AIFACTORY-US-710, feature:component-api-gateway-template, feature:blueprint-service, feature:template-registry-service. Sources: model/services/template-library/TemplateCatalogHost.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/TemplateRegistryService.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0021-quality-gates.md.",
      "acceptanceCriteria": [
        "AC1: Given a user token with `factory.blueprints.publish`, when the publication route of `SubmitBlueprint` is called against the fake of BlueprintService that answers 202 or 409, then the gateway forwards the call under the established scope with the user token unchanged and returns each answer unchanged with the correlation id; it evaluates no approval, holds no approval reference and writes nothing (SCN-TemplateCatalogHost-003, ADR-0028, model/services/template-library/BlueprintService.yaml).",
        "AC2: Given a user token with `factory.catalog.admin`, when the publication route of `PublishTemplateVersion` is called against the fake of TemplateRegistryService that answers 202, 403 for a caller of another tenant than the platform tenant, 404 or 409, or 503 with a problem response that names AgentRegistryService because the release authority does not answer it, then the gateway returns each answer unchanged; a request that carries no approval reference is forwarded, because neither publication operation declares one, and the gateway called no service other than the one the route fronts (SCN-TemplateCatalogHost-003, ADR-0021, FR-06).",
        "AC3: Given a call without a token or with an expired token, a token that lacks the scope of the operation, a token with `factory.blueprints.write` only on the route of `SubmitBlueprint` among them, when a publication route is called, then the gateway answers 401 or 403 and no fronted service is called; given a route that names only a `blueprintId` or a `templateId` with a version, when the fronted service answers 403 for a missing role or 404 for a version of another tenant (ADR-0015 amendment D113), then the gateway returns that answer unchanged; given a fronted service that does not answer, then the answer is 503 with a retry hint that names the service (SCN-TemplateCatalogHost-003, ADR-0015).",
        "AC4: Given the route table of the built gateway, when the register test runs, then it lists exactly the two routes of the publication class of model/services/template-library/BlueprintService.yaml and model/services/template-library/TemplateRegistryService.yaml, each with its scope, and it fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a release or a candidate (SCN-TemplateCatalogHost-003, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-2862",
        "AIFACTORY-TASK-2863"
      ],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8305,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateCatalogHost",
          "BlueprintService",
          "TemplateRegistryService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ],
        "requirements": [
          "FR-02",
          "FR-06",
          "NFR-11"
        ],
        "scenarios": [
          "SCN-TemplateCatalogHost-003"
        ]
      },
      "relates": {
        "screens": [
          "template-catalog"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-709",
        "AIFACTORY-US-710",
        "feature:component-api-gateway-template",
        "feature:blueprint-service",
        "feature:template-registry-service"
      ],
      "source": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0021-quality-gates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-712]",
      "number": 712
    },
    {
      "id": "AIFACTORY-TASK-2862",
      "type": "task",
      "parent": "AIFACTORY-US-712",
      "title": "Fakes of the two publication routes and the route class register of the gateway",
      "sequence": "15.04.05.01",
      "description": "Fakes of the two publication routes and the route class register of the gateway. Expected output: The acceptance suite holds a fake of SubmitBlueprint that answers 202 and 409 and a fake of PublishTemplateVersion that answers 202, 403, 404, 409 and the 503 of the service with a problem response that names AgentRegistryService, each recording the token and the headers it received; a register test lists every route of class publication from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a release or a candidate, or a client for a service outside deployment.fronts of model/services/template-library/TemplateCatalogHost.yaml.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "The acceptance suite holds a fake of SubmitBlueprint that answers 202 and 409 and a fake of PublishTemplateVersion that answers 202, 403, 404, 409 and the 503 of the service with a problem response that names AgentRegistryService, each recording the token and the headers it received; a register test lists every route of class publication from the route table and fails when such a route has no scope or when the gateway holds a handler, a cache entry or a store for an approval, a release or a candidate, or a client for a service outside deployment.fronts of model/services/template-library/TemplateCatalogHost.yaml."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8305,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2862]",
      "number": 2862
    },
    {
      "id": "AIFACTORY-TASK-2863",
      "type": "task",
      "parent": "AIFACTORY-US-712",
      "title": "Verify the publication routes through the acceptance suite",
      "sequence": "15.04.05.02",
      "description": "Verify the publication routes through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateCatalogHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-712: each publication route forwarded under its scope with the user token unchanged, the answers 202, 403, 404, 409 and the 503 of the service that names AgentRegistryService returned unchanged, a request without an approval reference forwarded, the refusals of the gateway without a call to a fronted service, a fake that stops answering, and the register of publication routes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&Scenario=SCN-TemplateCatalogHost-003\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-712: each publication route forwarded under its scope with the user token unchanged, the answers 202, 403, 404, 409 and the 503 of the service that names AgentRegistryService returned unchanged, a request without an approval reference forwarded, the refusals of the gateway without a call to a fronted service, a fake that stops answering, and the register of publication routes."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2863]",
      "number": 2863
    },
    {
      "id": "AIFACTORY-US-713",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-085",
      "title": "Health, feed metadata, limits and telemetry of the template catalog gateway while the identity platform, a fronted service or a replica fails",
      "sequence": "15.04.06",
      "description": "As an operator, I want to see whether the template catalog gateway, the identity platform and each fronted service answer, and which package feeds and template sources this installation reads, so that I can tell a failing service from a failing gateway and act on the right one. An operator and the probes of the cluster read the state of the gateway through its two own operations. `TemplateCatalogHost/TemplatesHealth` reports liveness and readiness of the gateway with the aggregated health of the three services it fronts and of the identity platform. Liveness needs no token; the detail is served to a caller whose scope carries `factory.health.read`. The identity platform is the one required dependency of the gateway, and the health check is the detection signal the model names for its failure. What the gateway does when it is unreachable is decided (D117, ADR-0015 amendment). While a cached signing key still validates tokens, the gateway stays in rotation: readiness stays ready, tokens that were already issued keep passing, and from the first failed probe `TemplatesHealth` answers 200 with the health degraded and a detail that names the identity platform as unreachable, so the operator sees the failure in health while calls still pass. The gateway leaves rotation only when no valid key remains, because none was cached or the cached keys expired: readiness turns unready, `TemplatesHealth` answers 503 with a problem response that names the identity platform, and calls are refused, so the gateway fails closed. Liveness keeps answering 200 without a token in both phases. A fronted service is an optional dependency: when it does not answer, health reports it as unavailable in the detail and the answer stays 200, its routes answer 503 with a retry hint, and the routes of the other two services keep serving. `TemplateCatalogHost/TemplatesFeeds` returns to a caller whose scope carries `factory.meta.read` the package feeds and the template sources configured for this installation, by name and never with a credential. The gateway reads no feed and holds no state: the feeds are named by the option `Templates:Feeds:PackageFeeds` of TemplateRegistryService, which also reads the template sources through connectors. The model gives TemplateRegistryService no operation that returns that list and names no option for the template sources, so the source of the answer is an open point reported to the owner. Until it is decided, the operation is hosted with its scope, its refusals and its response shape and reads the list through one metadata port of the gateway. The port has no production binding in this delivery. The call path, the token and the scope under which the gateway would read the list wait for the same decision, because the caller holds `factory.meta.read` while the reads of TemplateRegistryService require `factory.catalog.read`, and the gateway calls no operation of TemplateRegistryService for this operation until then. The happy path is therefore proven against a fake metadata source of the acceptance suite only. A deployed instance, whose port has no source, answers 503 with a problem response that says so and invents no list. The operation lists the code 200 only, so the 503 is no modelled code of `TemplateCatalogHost/TemplatesFeeds`; it is reported with the open point. A call that exceeds the rate limit configured for its route is refused with 429 through the pinned rate-limiting library, from the configuration of the gateway. The gateway emits `connectsoft.factory.templates.host.requests` with the dimensions service, route and status and `connectsoft.factory.templates.host.request_duration` with service and route, the latency including the fronted service, each recorded through the helper of the pinned observability library, which puts the tenant, and the project where the route names one, on the instrument by default (ADR-0019); the gateway carries the trace context to the service. The gateway belongs to the interactive class of the model, whose objective is an acknowledgement within 2 seconds at p95; the duration series is what it is measured against once the system is deployed, and no value is claimed here. Logs, activities and metrics never contain a token, a blueprint document, a recipe or any other payload. A replica that crashes is detected by the readiness probe and restarts; because the gateway holds no state, nothing is replayed and callers retry with their idempotency key, as AIFACTORY-US-711 states. The roles of the gateway are Asset maintainer, Operator, Platform admin and Observer. Kind: behavior. Traces: services: TemplateCatalogHost; apis: TemplateCatalogHost/TemplatesHealth, TemplateCatalogHost/TemplatesFeeds; adrs: ADR-0015, ADR-0017, ADR-0019, ADR-0028; requirements: NFR-13, NFR-18; scenarios: SCN-TemplateCatalogHost-001, SCN-TemplateCatalogHost-002. Relates: nfrs: NFR-07. Depends on: AIFACTORY-US-709, feature:component-api-gateway-template, feature:component-observability-factory-conventions, feature:template-registry-service. Sources: model/services/template-library/TemplateCatalogHost.yaml, model/services/template-library/TemplateRegistryService.yaml, docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#metrics-and-observability, docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#failure-and-recovery.",
      "acceptanceCriteria": [
        "AC1: Given the gateway with the identity platform and the three fronted services reachable, when `TemplateCatalogHost/TemplatesHealth` is called, then liveness answers 200 without a token and a caller with `factory.health.read` receives 200 with the state of each of the three fronted services and of the identity platform; a call for the detail without a token is answered 401 and a token without the scope 403 (SCN-TemplateCatalogHost-001, NFR-18).",
        "AC2: Given the identity platform is unreachable and a cached signing key still validates tokens, when calls arrive and `TemplateCatalogHost/TemplatesHealth` is probed, then tokens that were already issued are validated with the cached key, readiness stays ready so the replica stays in rotation, and from the first failed probe health answers 200 with the health degraded and a detail that names the identity platform as unreachable, while liveness keeps answering 200; given no valid key remains, because none was cached or the cached keys expired, when calls arrive, then they are refused, readiness is unready so the replica leaves rotation, `TemplateCatalogHost/TemplatesHealth` answers 503 with a problem response that names the identity platform and no state changes (SCN-TemplateCatalogHost-001, model/services/template-library/TemplateCatalogHost.yaml).",
        "AC3: Given one fronted service does not answer, when `TemplateCatalogHost/TemplatesHealth` and the routes are called, then health answers 200 and reports that service as unavailable in its detail, its routes answer 503 with a retry hint that names the service, over gRPC UNAVAILABLE, the routes of the other two services keep serving and the gateway invents no response (SCN-TemplateCatalogHost-001, ADR-0028).",
        "AC4: Given a caller with `factory.meta.read` and the fake metadata source of the acceptance suite bound to the metadata port, when `TemplateCatalogHost/TemplatesFeeds` is called, then the response is 200 with the package feeds and the template sources as the source reported them, by name and without a credential, which is the only proof of the happy path in this delivery; a call without a token is answered 401 and a token without the scope 403; when no source is bound, as on a deployed instance, or the source does not answer, the answer is 503 with a problem response that names it, a code that model/services/template-library/TemplateCatalogHost.yaml does not list for the operation and that is reported with the open point; the gateway called no operation of TemplateRegistryService, nothing is written and no list is invented (SCN-TemplateCatalogHost-002).",
        "AC5: Given routed calls and a call above the rate limit of its route, when the metrics and logs are read, then `connectsoft.factory.templates.host.requests` counts every call by service, route and status, the call above the limit was refused with 429 and called no fronted service, `connectsoft.factory.templates.host.request_duration` holds the latency by service and route, both series carry the tenant of the call, and the project where the route names one, as the helper of the pinned observability library adds them, and no log record, activity or metric holds a token or a payload (ADR-0019, model/services/template-library/TemplateCatalogHost.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#metrics-and-observability",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#failure-and-recovery"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-511",
        "AIFACTORY-TASK-2864",
        "AIFACTORY-TASK-2865",
        "AIFACTORY-TASK-2866"
      ],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8306,
      "kind": "behavior",
      "traces": {
        "services": [
          "TemplateCatalogHost"
        ],
        "apis": [
          "TemplateCatalogHost/TemplatesHealth",
          "TemplateCatalogHost/TemplatesFeeds"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0017",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "NFR-13",
          "NFR-18"
        ],
        "scenarios": [
          "SCN-TemplateCatalogHost-001",
          "SCN-TemplateCatalogHost-002"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-07"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-709",
        "feature:component-api-gateway-template",
        "feature:component-observability-factory-conventions",
        "feature:template-registry-service"
      ],
      "source": [
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#metrics-and-observability",
        "docs/solution-packs/software-factory/templates/services/template-catalog-host/index.md#failure-and-recovery"
      ],
      "titlePrefix": "[AIFACTORY-US-713]",
      "number": 713
    },
    {
      "id": "AIFACTORY-TASK-511",
      "type": "task",
      "parent": "AIFACTORY-US-713",
      "title": "Health, feed metadata and telemetry of the gateway",
      "sequence": "15.04.06.01",
      "description": "Health, feed metadata and telemetry of the gateway. Expected output: The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the feeds operation serves, under factory.meta.read, the list its metadata port returns and answers 503 when the port has no source or the source does not answer; the port has no production binding and calls no operation of TemplateRegistryService; every routed call records connectsoft.factory.templates.host.requests and connectsoft.factory.templates.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, with the tenant of the call and the project where the route names one (ADR-0019), and carries the trace context to the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The health operation serves liveness without a token and the detail under factory.health.read with the aggregated state of the three fronted services and of the identity platform; while the identity platform is unreachable and a cached signing key still validates tokens, readiness stays ready and the operation answers 200 with the health degraded and the identity platform named in the detail from the first failed probe; when no valid key remains, readiness turns unready and the operation answers 503 with a problem response that names the identity platform (D117); liveness stays at 200 in both phases; the feeds operation serves, under factory.meta.read, the list its metadata port returns and answers 503 when the port has no source or the source does not answer; the port has no production binding and calls no operation of TemplateRegistryService; every routed call records connectsoft.factory.templates.host.requests and connectsoft.factory.templates.host.request_duration with their modelled dimensions and, through the helper of the pinned observability library, with the tenant of the call and the project where the route names one (ADR-0019), and carries the trace context to the service."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-511]",
      "number": 511
    },
    {
      "id": "AIFACTORY-TASK-2864",
      "type": "task",
      "parent": "AIFACTORY-US-713",
      "title": "Rate limits per route from the configuration of the gateway",
      "sequence": "15.04.06.02",
      "description": "Rate limits per route from the configuration of the gateway. Expected output: Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.templates.host.requests; the limit values are configuration of the deployment and none is fixed in code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "Each route takes its rate limit from the configuration of the gateway through the pinned rate-limiting library and answers 429 above it, over gRPC RESOURCE_EXHAUSTED; a refusal by the limit calls no fronted service and is counted under its status in connectsoft.factory.templates.host.requests; the limit values are configuration of the deployment and none is fixed in code."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2864]",
      "number": 2864
    },
    {
      "id": "AIFACTORY-TASK-2865",
      "type": "task",
      "parent": "AIFACTORY-US-713",
      "title": "Runbook of the three failure modes of the gateway",
      "sequence": "15.04.06.03",
      "description": "Runbook of the three failure modes of the gateway. Expected output: The repository documentation holds one runbook entry per failure mode of model/services/template-library/TemplateCatalogHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the replica crash states that nothing is replayed and that callers retry with their idempotency key (NFR-18).. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "The repository documentation holds one runbook entry per failure mode of model/services/template-library/TemplateCatalogHost.yaml (identity platform unreachable, fronted service unavailable, gateway replica crash) with its detection signal, the expected answers of the gateway and the recovery step; the entry of the identity platform states its two phases, degraded and in rotation while a cached signing key validates tokens, and out of rotation and failing closed when no valid key remains (D117); the entry of the replica crash states that nothing is replayed and that callers retry with their idempotency key (NFR-18)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8306,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2865]",
      "number": 2865
    },
    {
      "id": "AIFACTORY-TASK-2866",
      "type": "task",
      "parent": "AIFACTORY-US-713",
      "title": "Verify health, feed metadata, limits and telemetry through the acceptance suite",
      "sequence": "15.04.06.04",
      "description": "Verify health, feed metadata, limits and telemetry through the acceptance suite. Expected output: Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateCatalogHost-001|Scenario=SCN-TemplateCatalogHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-713 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, the feeds operation with the fake metadata source, without a source and without its scope, a call above its limit, the two series connectsoft.factory.templates.host.requests and connectsoft.factory.templates.host.request_duration with service, route and status, the tenant of the call and the project of a project-scoped route, and a scan of the captured logs and activities for token and payload content.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter \"Category=Acceptance&(Scenario=SCN-TemplateCatalogHost-001|Scenario=SCN-TemplateCatalogHost-002)\"`; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-713 with the identity platform stopped while a cached key validates tokens (readiness ready, health 200 and degraded), without a cached key and after the cached key expired (readiness unready, health 503), one fake stopped, the feeds operation with the fake metadata source, without a source and without its scope, a call above its limit, the two series connectsoft.factory.templates.host.requests and connectsoft.factory.templates.host.request_duration with service, route and status, the tenant of the call and the project of a project-scoped route, and a scan of the captured logs and activities for token and payload content."
      ],
      "sourceArtifacts": [
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:template-library",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 83,
      "phase": "factory",
      "stackRank": 8306,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2866]",
      "number": 2866
    },
    {
      "id": "AIFACTORY-EPIC-016",
      "type": "epic",
      "parent": null,
      "title": "Generated SaaS (PF-16)",
      "sequence": "16",
      "description": "Everything that builds the Generated SaaS platform (PF-16): its services, each in its own repository and deployed alone, and the platform's API gateway (ADR-0028). The products the Software Factory generates — their own domains, tenants and commercial foundations. Done when: Every service of the platform has its complete delivery accepted (GeneratedProductHost, GeneratedSaasFoundations), the platform gateway routes them under a trusted scope, and the outcome verification of I6 has passed with every scenario of those services traced by a PBI.",
      "acceptanceCriteria": [
        "Every service of the platform has its complete delivery accepted (GeneratedProductHost, GeneratedSaasFoundations), the platform gateway routes them under a trusted scope, and the outcome verification of I6 has passed with every scenario of those services traced by a PBI."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:generated-saas",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-086",
        "AIFACTORY-FEAT-087"
      ],
      "stackRank": 15799,
      "titlePrefix": "[AIFACTORY-EPIC-016]",
      "number": 16
    },
    {
      "id": "AIFACTORY-FEAT-086",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-016",
      "title": "GeneratedProductHost: complete delivery",
      "sequence": "16.01",
      "description": "GeneratedProductHost is the per-product reference of bounded context BC-30 (Generated Product Domains). The representative shape of every product the Factory generates: domain microservices on the BaseTemplate shape per bounded context behind the product's own gateway (GW-07), a product descriptor and admin surface read by fleet operations, and a managed-operations handover record when ConnectSoft operates it (BC-30; one instance per product, never a Factory service). It is a reference of what a generated product contains and has no Factory repository. Delivers: GeneratedProductHost (complete). Increment I6: Full product generation. Build order 158 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/generated-saas/GeneratedProductHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:generated-saas",
        "type:feature",
        "route:backend-developer",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 158,
      "phase": "factory",
      "stackRank": 15800,
      "titlePrefix": "[AIFACTORY-FEAT-086]",
      "number": 86
    },
    {
      "id": "AIFACTORY-FEAT-087",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-016",
      "title": "GeneratedSaasFoundations: complete delivery",
      "sequence": "16.02",
      "description": "GeneratedSaasFoundations is the per-product reference of bounded context BC-31 (Generated Tenant & Commercial Foundations). The tenant and commercial foundations every generated SaaS product gets from the SaaS templates (Tenants, ProductsCatalog, Entitlements, Billing, Metering): product tenants mapped to opaque customer-tenant ids, editions and entitlements inside the product, subscriptions and usage meters, mirrored to the fleet when ConnectSoft operates the product (BC-31; one instance per product). It is a reference of what a generated product contains and has no Factory repository. Delivers: GeneratedSaasFoundations (complete). Increment I6: Full product generation. Build order 159 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/services/generated-saas/GeneratedSaasFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:generated-saas",
        "type:feature",
        "route:backend-developer",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 159,
      "phase": "factory",
      "stackRank": 15900,
      "titlePrefix": "[AIFACTORY-FEAT-087]",
      "number": 87
    },
    {
      "id": "AIFACTORY-EPIC-017",
      "type": "epic",
      "parent": null,
      "title": "Engineering readiness",
      "sequence": "17",
      "description": "Work that must be done once before or beside the services: repository and pipeline conventions for one repository per service, the trusted scope chain, the contracts package, the durable execution spike, the local development environment, the command-line client and the owner decisions that are still open. Done when: Every I0 feature is accepted: the contracts package, the trusted scope chain, the repository and pipeline conventions with every first-outcome repository created and scaffolded, and the local estate exist, and the readiness demonstration of I0 has passed; and its two I1 features are accepted: typed-gateway-clients, whose published client packages the command-line client calls the gateways with, and command-line-client-commands, whose commands drive the first-outcome demonstration of I1.",
      "acceptanceCriteria": [
        "Every I0 feature is accepted: the contracts package, the trusted scope chain, the repository and pipeline conventions with every first-outcome repository created and scaffolded, and the local estate exist, and the readiness demonstration of I0 has passed; and its two I1 features are accepted: typed-gateway-clients, whose published client packages the command-line client calls the gateways with, and command-line-client-commands, whose commands drive the first-outcome demonstration of I1."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:epic",
        "route:solution-architect",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-088",
        "AIFACTORY-FEAT-089",
        "AIFACTORY-FEAT-090",
        "AIFACTORY-FEAT-091",
        "AIFACTORY-FEAT-092",
        "AIFACTORY-FEAT-093",
        "AIFACTORY-FEAT-094",
        "AIFACTORY-FEAT-187",
        "AIFACTORY-FEAT-178"
      ],
      "stackRank": 99,
      "titlePrefix": "[AIFACTORY-EPIC-017]",
      "number": 17
    },
    {
      "id": "AIFACTORY-FEAT-088",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Repository and pipeline conventions for one repository per service",
      "sequence": "17.01",
      "description": "Thirty repositories are created for the first outcome and sixty-five for the whole system. This feature fixes how a repository is named, created, scaffolded, built and released, so that every later feature can say 'create the repository' and mean the same steps (ADR-0028), and it creates and scaffolds every first-outcome repository in I0 from its template at the pinned version with a green template pipeline, so that the I1 features start from a repository that exists (D140). Depends on: AIFACTORY-FEAT-156, AIFACTORY-FEAT-159, AIFACTORY-FEAT-090. Increment I0: Readiness. Build order 44 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "AIFACTORY-US-002",
        "AIFACTORY-US-1596",
        "AIFACTORY-US-1597",
        "AIFACTORY-US-1598",
        "AIFACTORY-US-1599",
        "AIFACTORY-US-1600",
        "AIFACTORY-US-1601"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4400,
      "titlePrefix": "[AIFACTORY-FEAT-088]",
      "number": 88
    },
    {
      "id": "AIFACTORY-US-360",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: one checklist names a Factory repository, scaffolds it from the template of its kind with the Factory switch of that template and sets its branch policy",
      "sequence": "17.01.01",
      "description": "As an operator, I want one checklist that tells me the name, the template, the scaffold command and the branch policy of a Factory repository, so that every feature that says create the repository means the same steps. ADR-0028 decision 1 builds every modelled Factory service in the repository `ConnectSoft.AI.SoftwareFactory.<ServiceId>` and ships it as its own deployable: sixty-five repositories for the whole system, about thirty for the first outcome. This PBI delivers the one checklist page of this site that an operator follows for each of them. The checklist decides nothing the model already states; it reads it. For a modelled service or gateway the name is the `repository` field of its service file under model/services and the template is the `template` field of the same file. The contracts package, the gateway client packages and the command-line client have no service file: their names are the entries `ConnectSoft.AI.SoftwareFactory.Contracts`, `ConnectSoft.AI.SoftwareFactory.Clients` and `ConnectSoft.AI.SoftwareFactory.Cli` under `library_repositories` and `other_repositories` of model/backlog/backlog.yaml, and their template is the one the row of their kind on the checklist names. The page holds one row per kind with its command, and the Factory switch differs by template. A service is scaffolded with `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.<ServiceId> --UseFactoryProfile true`; the microservice template is not used for a Factory service (ADR-0028 amendment on the base template). A platform gateway is scaffolded with `dotnet new connectsoft-apigateway -n <name> --UseFactoryProfile true --GatewayRole Platform`, and `StudioBff` with `--GatewayRole BackendForFrontend`; the two gateway roles are two declared profiles of that template (decision D115). The agent template has no `UseFactoryProfile`: decision D114 puts that boolean, off by default and named the same, in the base, worker, gateway and library templates only, and the agent template takes its Factory shape from the choice `agent-host-kind` (decision D113, AIFACTORY-US-138), so `AgentRuntimeService` is scaffolded with `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime` and `WorkflowEngineService` with `--agent-host-kind workflow-engine`. A worker is scaffolded from `connectsoft-worker`, the contracts package from `connectsoft-library` and the gateway client packages from `connectsoft-api-library`, each with `--UseFactoryProfile true`. The command-line client is a console application for which the model names no template: its repository is created without a scaffold command and follows the name, pipeline and feed rules of the checklist. Every other parameter takes the Factory binding that model/template-parameters records for the template. The template package is restored from the ConnectSoft feed and its version is written into the repository together with the scaffold command, in the generation manifest where the template writes one. The first commit is the unchanged output of the scaffold, which builds and passes its template tests. The checklist then sets the branch policy of the default branch with its required reviewers and hands over to the pipeline convention of AIFACTORY-US-361. No repository is created before the owner approves its creation, and nothing in this documentation repository creates one. The Factory switch and the Factory shape of each template are delivered by the template features of the epic `component-extensions`; this PBI depends on them and adds no template parameter of its own. A kind whose template does not yet carry its Factory switch, a service whose service file names a SaaS template among them, is listed on the page as blocked with the feature that delivers the switch, and is given no command. Kind: enabling. Traces: adrs: ADR-0028. Depends on: feature:component-base-template-factory-profile, feature:component-api-gateway-template, feature:component-agent-template, feature:component-library-template-factory-profile, feature:component-worker-template-factory-profile. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, model/templates.yaml, model/template-parameters/connectsoft-base.yaml, model/services/control-plane/RunControlService.yaml, model/backlog/backlog.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a modelled service and the checklist page, when an operator prepares its repository, then the name is ConnectSoft.AI.SoftwareFactory.`<ServiceId>` and equals the `repository` field of the service file, and the template is the one the `template` field of that file names: `connectsoft-base` for a service, `connectsoft-apigateway` for a platform gateway, `connectsoft-ai-agent` for the two agent services; for the contracts package, the gateway client packages and the command-line client, which have no service file, the name is their entry under `library_repositories` or `other_repositories` of model/backlog/backlog.yaml and the template is the one the row of the kind names; the page names no template the model does not name (ADR-0028 decision 1 and its amendment on the base template; model/services/control-plane/RunControlService.yaml is the first example).",
        "AC2: Given the scaffold command of the kind on the checklist, `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.<ServiceId> --UseFactoryProfile true` for a service, `dotnet new connectsoft-apigateway -n <name> --UseFactoryProfile true --GatewayRole Platform` for a platform gateway and `dotnet new connectsoft-ai-agent -n <name> --agent-host-kind attempt-runtime` or `--agent-host-kind workflow-engine` for the two agent services, with the template package restored from the ConnectSoft feed, when its output is committed unchanged, then the solution builds in Release and its template tests pass without an edit, the other parameter values are the Factory bindings of the snapshot of the template under model/template-parameters, such as model/template-parameters/connectsoft-base.yaml, and the command with the template package version is recorded in the repository (ADR-0028 amendment on the Factory profile switch).",
        "AC3: Given the checklist, when a repository is about to be created, then the page requires the recorded approval of the owner for that creation before the first step, sets the branch policy of the default branch with its required reviewers after the first commit, and states that nothing in this documentation repository creates a repository (ADR-0028 decision 1; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC4: Given a kind whose template does not yet carry its Factory switch (`UseFactoryProfile`, or `agent-host-kind` for the agent template), when the checklist page lists the scaffold command per kind, then that kind is listed as blocked with the feature of the epic `component-extensions` that delivers the switch and is given no command, so that no repository is scaffolded from a template without its Factory shape (ADR-0028 amendment on the Factory profile switch; model/templates.yaml)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/backlog/backlog.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-139",
        "AIFACTORY-TASK-1510",
        "AIFACTORY-TASK-1511"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4401,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-api-gateway-template",
        "feature:component-agent-template",
        "feature:component-library-template-factory-profile",
        "feature:component-worker-template-factory-profile"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/backlog/backlog.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-360]",
      "number": 360
    },
    {
      "id": "AIFACTORY-TASK-139",
      "type": "task",
      "parent": "AIFACTORY-US-360",
      "title": "Repository creation checklist and naming",
      "sequence": "17.01.01.01",
      "description": "Repository creation checklist and naming. Expected output: A checklist page of this site with the steps in their order: the recorded approval of the owner before any repository is created, the name read from the `repository` field of the service file or, for the contracts package, the gateway client packages and the command-line client, from `library_repositories` and `other_repositories` of model/backlog/backlog.yaml, the template of the kind, the scaffold command of the kind with its Factory switch (`UseFactoryProfile` for the base, worker, gateway and library templates, with `--GatewayRole` for a gateway, and `agent-host-kind` without `UseFactoryProfile` for the agent template), the unchanged first commit that builds and passes its template tests, the branch policy of the default branch with its required reviewers, the pipeline from the shared templates and the ConnectSoft feed as the only package source.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A checklist page of this site with the steps in their order: the recorded approval of the owner before any repository is created, the name read from the `repository` field of the service file or, for the contracts package, the gateway client packages and the command-line client, from `library_repositories` and `other_repositories` of model/backlog/backlog.yaml, the template of the kind, the scaffold command of the kind with its Factory switch (`UseFactoryProfile` for the base, worker, gateway and library templates, with `--GatewayRole` for a gateway, and `agent-host-kind` without `UseFactoryProfile` for the agent template), the unchanged first commit that builds and passes its template tests, the branch policy of the default branch with its required reviewers, the pipeline from the shared templates and the ConnectSoft feed as the only package source."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4401,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-139]",
      "number": 139
    },
    {
      "id": "AIFACTORY-TASK-1510",
      "type": "task",
      "parent": "AIFACTORY-US-360",
      "title": "Scaffold command per repository kind on the checklist page",
      "sequence": "17.01.01.02",
      "description": "Scaffold command per repository kind on the checklist page. Expected output: The checklist page holds one row per repository kind with the template id the model names, the scaffold command, the parameter snapshot under model/template-parameters that holds its Factory bindings and the feature of the epic `component-extensions` that delivers the Factory switch of that template: service, `dotnet new connectsoft-base -n <name> --UseFactoryProfile true`; platform gateway, `dotnet new connectsoft-apigateway -n <name> --UseFactoryProfile true --GatewayRole Platform`, with `--GatewayRole BackendForFrontend` for `StudioBff`; `AgentRuntimeService`, `dotnet new connectsoft-ai-agent -n <name> --agent-host-kind attempt-runtime`, and `WorkflowEngineService`, `dotnet new connectsoft-ai-agent -n <name> --agent-host-kind workflow-engine`, both without `UseFactoryProfile`; worker, `dotnet new connectsoft-worker -n <name> --UseFactoryProfile true`; contracts package, `dotnet new connectsoft-library -n <name> --UseFactoryProfile true`; gateway client package, `dotnet new connectsoft-api-library -n <name> --UseFactoryProfile true` with the generation switch of that template; the command-line client has a row without a template and without a command; a kind whose template does not yet carry its Factory switch is marked blocked and has no command.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The checklist page holds one row per repository kind with the template id the model names, the scaffold command, the parameter snapshot under model/template-parameters that holds its Factory bindings and the feature of the epic `component-extensions` that delivers the Factory switch of that template: service, `dotnet new connectsoft-base -n <name> --UseFactoryProfile true`; platform gateway, `dotnet new connectsoft-apigateway -n <name> --UseFactoryProfile true --GatewayRole Platform`, with `--GatewayRole BackendForFrontend` for `StudioBff`; `AgentRuntimeService`, `dotnet new connectsoft-ai-agent -n <name> --agent-host-kind attempt-runtime`, and `WorkflowEngineService`, `dotnet new connectsoft-ai-agent -n <name> --agent-host-kind workflow-engine`, both without `UseFactoryProfile`; worker, `dotnet new connectsoft-worker -n <name> --UseFactoryProfile true`; contracts package, `dotnet new connectsoft-library -n <name> --UseFactoryProfile true`; gateway client package, `dotnet new connectsoft-api-library -n <name> --UseFactoryProfile true` with the generation switch of that template; the command-line client has a row without a template and without a command; a kind whose template does not yet carry its Factory switch is marked blocked and has no command."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4401,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1510]",
      "number": 1510
    },
    {
      "id": "AIFACTORY-TASK-1511",
      "type": "task",
      "parent": "AIFACTORY-US-360",
      "title": "Verify the checklist page against the model",
      "sequence": "17.01.01.03",
      "description": "Verify the checklist page against the model. Expected output: Run `python -I tools/docs_model check` for the model and the freshness of the generated output and `mkdocs build --strict` for the site with the checklist page; every service file under model/services names a repository and a template, and a read of the page against model/templates.yaml and model/backlog/backlog.yaml finds the name rule, the template and the command of each kind with its Factory switch, the approval step and the branch policy step, which proves AC1 to AC4 of AIFACTORY-US-360 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run `python -I tools/docs_model check` for the model and the freshness of the generated output and `mkdocs build --strict` for the site with the checklist page; every service file under model/services names a repository and a template, and a read of the page against model/templates.yaml and model/backlog/backlog.yaml finds the name rule, the template and the command of each kind with its Factory switch, the approval step and the branch policy step, which proves AC1 to AC4 of AIFACTORY-US-360 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1511]",
      "number": 1511
    },
    {
      "id": "AIFACTORY-US-361",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: the pipeline of a scaffolded repository builds, tests, packs and publishes from the shared pipeline templates to the ConnectSoft feed, with no script of its own",
      "sequence": "17.01.02",
      "description": "As an operator, I want the pipeline of every Factory repository to come from the shared pipeline templates and to use one feed, so that sixty-five pipelines are maintained in one place and no repository carries a build script of its own. ADR-0028 accepts more pipelines as the price of one repository per service and states that the work a host did once is now done per service by the scaffold. This PBI fixes what the pipeline of a Factory repository is. The pipeline file that the template generates calls the shared step templates of ConnectSoft.AzurePipelines for a service: the build and lint steps, the test steps, the publish steps and the container image steps. A Factory repository therefore produces four results from shared steps: the build, the tests with complete reports, the package where the repository publishes one, and the container image of a deployable. It holds no build, test, pack or push script of its own. A gap that the first Factory repository finds in a shared service step is closed in that shared step, with its default unchanged for the consumers that exist today, and never by a script in the repository. The feed is settled by decision D114 and the amendment of ADR-0028 on the Factory profile switch: the Factory feed is the Azure Artifacts feed the ConnectSoft libraries already publish to, named the ConnectSoft feed here. A Factory repository restores from it and publishes to it, and no second feed is created. The shared pipeline of the templates themselves is not this PBI: the gate hook and the opt-in version guard of the shared template installer steps are AIFACTORY-TASK-1426 under AIFACTORY-US-232 of feature `component-base-template-findings`, and the admission of one additional gating case per declared profile is delivered under AIFACTORY-US-230 of feature `component-base-template-factory-profile`. This PBI depends on both features and repeats none of their tasks. Before the first repository is created, the versions of the templates and libraries that the first-outcome repositories use are recorded and each is restored from the feed by a clean project; a version that is not on the feed is recorded as missing and blocks the repositories that need it. The first repository, `ConnectSoft.AI.SoftwareFactory.RunControlService`, is then created by the checklist of AIFACTORY-US-360 and its pipeline proves the convention. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-360, feature:component-base-template-findings, feature:component-base-template-factory-profile. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/capability-dependencies.md, model/templates.yaml, model/libraries.yaml, model/backlog/pbis/component-extensions/component-base-template-findings.yaml, model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a repository scaffolded by the checklist of AIFACTORY-US-360, when its pipeline runs, then the build, the tests with complete reports, the package and the container image come from the shared step templates of ConnectSoft.AzurePipelines, and the pipeline file holds no build, test, pack or push script of its own (ADR-0028 consequences; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC2: Given the pipeline of a Factory repository, when it restores and when it publishes, then the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to, is its only package source and its only publication target, and no second feed exists for the Factory (ADR-0028 amendment on the Factory profile switch).",
        "AC3: Given the recorded list of the template and library versions the first-outcome repositories use, when a clean project with the ConnectSoft feed as its only source restores each of them, then every listed version restores, and a version that is not on the feed is recorded as missing with the repositories it blocks (ADR-0028; model/templates.yaml and model/libraries.yaml name the templates and libraries).",
        "AC4: Given the shared template pipeline tasks that the epic `component-extensions` already holds, when the work of this PBI in ConnectSoft.AzurePipelines is reviewed, then it changes the shared service steps only and adds no second gate hook, version guard or profile gating case beside AIFACTORY-TASK-1426 and the additional case of the base template gate (ADR-0028 amendment on the Factory profile switch; model/backlog/pbis/component-extensions/component-base-template-findings.yaml)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "model/templates.yaml",
        "model/libraries.yaml",
        "model/backlog/pbis/component-extensions/component-base-template-findings.yaml",
        "model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-140",
        "AIFACTORY-TASK-141",
        "AIFACTORY-TASK-190"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4402,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "feature:component-base-template-findings",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "model/templates.yaml",
        "model/libraries.yaml",
        "model/backlog/pbis/component-extensions/component-base-template-findings.yaml",
        "model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-361]",
      "number": 361
    },
    {
      "id": "AIFACTORY-TASK-140",
      "type": "task",
      "parent": "AIFACTORY-US-361",
      "title": "Pipeline templates for a Factory service repository",
      "sequence": "17.01.02.01",
      "description": "Pipeline templates for a Factory service repository. Expected output: A service repository gets build, test, package and container publication from the shared service steps of ConnectSoft.AzurePipelines (the build and lint steps, the test steps, the publish steps and the container image steps) with no per-repository script; a gap the first Factory repository finds is closed in the shared step with its default unchanged for the consumers of today; the shared template pipeline `template-ci/v1` and the installer steps with the gate hook and the version guard of AIFACTORY-TASK-1426 are not changed by this task.. Kind: operations. Repository: ConnectSoft.AzurePipelines. Verification: one pipeline run of a consumer that exists today is unchanged and the run of AIFACTORY-TASK-190 is green.",
      "acceptanceCriteria": [
        "A service repository gets build, test, package and container publication from the shared service steps of ConnectSoft.AzurePipelines (the build and lint steps, the test steps, the publish steps and the container image steps) with no per-repository script; a gap the first Factory repository finds is closed in the shared step with its default unchanged for the consumers of today; the shared template pipeline `template-ci/v1` and the installer steps with the gate hook and the version guard of AIFACTORY-TASK-1426 are not changed by this task."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4402,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-140]",
      "number": 140
    },
    {
      "id": "AIFACTORY-TASK-141",
      "type": "task",
      "parent": "AIFACTORY-US-361",
      "title": "Verify template and package versions on the feed",
      "sequence": "17.01.02.02",
      "description": "Verify template and package versions on the feed. Expected output: A recorded list, on the checklist page, of the template and library versions the first-outcome repositories use, each restored from the ConnectSoft feed by a clean project with that feed as its only source; a version that does not restore is recorded as missing with the repositories it blocks.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A recorded list, on the checklist page, of the template and library versions the first-outcome repositories use, each restored from the ConnectSoft feed by a clean project with that feed as its only source; a version that does not restore is recorded as missing with the repositories it blocks."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4402,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-141]",
      "number": 141
    },
    {
      "id": "AIFACTORY-TASK-190",
      "type": "task",
      "parent": "AIFACTORY-US-361",
      "title": "Prove the checklist on the first repository",
      "sequence": "17.01.02.03",
      "description": "Prove the checklist on the first repository. Expected output: The repository `ConnectSoft.AI.SoftwareFactory.RunControlService` is created by the checklist after the approval of the owner; this is the one creation of the repository, and feature `run-control-service` of increment I1 takes the repository as it stands; its first commit is the unchanged output of the scaffold command with `UseFactoryProfile`, and one run of its pipeline is green: build, tests with complete reports, package and container image from the shared steps, with the ConnectSoft feed as the only source in the restore log, which proves AC1 and AC2 of AIFACTORY-US-361 and AC2 of AIFACTORY-US-360 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.RunControlService.",
      "acceptanceCriteria": [
        "The repository `ConnectSoft.AI.SoftwareFactory.RunControlService` is created by the checklist after the approval of the owner; this is the one creation of the repository, and feature `run-control-service` of increment I1 takes the repository as it stands; its first commit is the unchanged output of the scaffold command with `UseFactoryProfile`, and one run of its pipeline is green: build, tests with complete reports, package and container image from the shared steps, with the ConnectSoft feed as the only source in the restore log, which proves AC1 and AC2 of AIFACTORY-US-361 and AC2 of AIFACTORY-US-360 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.RunControlService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-190]",
      "number": 190
    },
    {
      "id": "AIFACTORY-US-362",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: a conformance check reports every name, template, pipeline and feed deviation of a repository and passes on the first repository",
      "sequence": "17.01.03",
      "description": "As an operator, I want a check that tells me where a repository deviates from the checklist, so that the sameness of the Factory repositories is proven by a run and not by a reading. A checklist that sixty-five repositories follow drifts unless something checks it. This PBI is the proof of the feature: a conformance check, a script of this documentation repository, that takes the working tree of one repository and the model of this site and reports where the repository deviates from the conventions of AIFACTORY-US-360 and AIFACTORY-US-361. It knows four classes of deviation. A name deviation: the repository name is neither the `repository` field of a service file under model/services nor an entry of `library_repositories` or `other_repositories` of model/backlog/backlog.yaml. A template deviation: the scaffold record of the repository names another template than the one its kind requires, or shows a scaffold without the Factory switch of its kind. For a service or gateway the required template is the `template` field of its service file; for an entry of the two lists it is the template the checklist row of the kind names, `connectsoft-library` for the contracts package and `connectsoft-api-library` for the client packages; the command-line client has no template rule. The Factory switch is `UseFactoryProfile` for the base, worker, gateway and library templates, with the gateway role for a gateway, and `agent-host-kind` with the value `attempt-runtime` or `workflow-engine` for the agent template. A pipeline deviation: the pipeline file holds a build, test, pack or push step that is not a shared step template of ConnectSoft.AzurePipelines, or omits a result its kind requires. A feed deviation: the package source configuration or the pipeline names a source or a target other than the ConnectSoft feed. The check reports every deviation of a run with the file and the rule, exits with a failure when it found one, reads only, and creates and changes nothing in the checked repository or in any tracker. A fixture of six planted trees proves it: four trees, one per class, prove that each class is reported, and two trees that follow the checklist, a service repository and a library repository named in `library_repositories`, prove the silent pass. The check is then run on the first repository that the checklist created. Its result is the evidence that later features rely on when they say that a repository was created by the checklist. Kind: evidence. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/capability-dependencies.md, model/templates.yaml, model/backlog/backlog.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a repository tree whose name is neither the `repository` field of a service file nor an entry of `library_repositories` or `other_repositories` of model/backlog/backlog.yaml, and a tree whose scaffold record names a template other than the one its kind requires or shows a scaffold without the Factory switch of its kind, when the conformance check runs, then each deviation is reported with the rule and the file and the run ends with a failure; for an entry of the two lists the template is the one the checklist row of the kind names (`connectsoft-library` for the contracts package, `connectsoft-api-library` for the client packages) and the console client has no template rule (ADR-0028 decision 1 and its amendment on the Factory profile switch; model/services/control-plane/RunControlService.yaml).",
        "AC2: Given a repository tree whose pipeline file holds a build, test, pack or push step of its own, and a tree whose package source configuration names a source other than the ConnectSoft feed, when the conformance check runs, then the pipeline deviation and the feed deviation are each reported with the step or the source named (ADR-0028 consequences and its amendment on the Factory profile switch).",
        "AC3: Given the first repository created by the checklist, and a planted library repository tree named in `library_repositories` of model/backlog/backlog.yaml and scaffolded from `connectsoft-library`, when the conformance check runs on each working tree, then it reports no deviation and ends with success, it has written nothing to the checked repository, and the recorded result names the revision that was checked (ADR-0028; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "model/templates.yaml",
        "model/backlog/backlog.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-189",
        "AIFACTORY-TASK-1512",
        "AIFACTORY-TASK-1513"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4403,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "model/templates.yaml",
        "model/backlog/backlog.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-362]",
      "number": 362
    },
    {
      "id": "AIFACTORY-TASK-189",
      "type": "task",
      "parent": "AIFACTORY-US-362",
      "title": "Checklist and conformance check",
      "sequence": "17.01.03.01",
      "description": "Checklist and conformance check. Expected output: A script of this repository, linked from the checklist page, that takes the path of a repository working tree, reads the service files under model/services and the lists `library_repositories` and `other_repositories` of model/backlog/backlog.yaml, and reports the name, template, pipeline and feed deviations of that repository, each with the rule and the file: the name is the `repository` field of a service file or an entry of one of the two lists; for those entries the template is the one the checklist row of the kind names (`connectsoft-library` for the contracts package, `connectsoft-api-library` for the client packages) and the console client has no template rule; the template rule reports a scaffold without the Factory switch of its kind; it exits with a failure when a deviation exists, reads only and writes nothing to the checked repository.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A script of this repository, linked from the checklist page, that takes the path of a repository working tree, reads the service files under model/services and the lists `library_repositories` and `other_repositories` of model/backlog/backlog.yaml, and reports the name, template, pipeline and feed deviations of that repository, each with the rule and the file: the name is the `repository` field of a service file or an entry of one of the two lists; for those entries the template is the one the checklist row of the kind names (`connectsoft-library` for the contracts package, `connectsoft-api-library` for the client packages) and the console client has no template rule; the template rule reports a scaffold without the Factory switch of its kind; it exits with a failure when a deviation exists, reads only and writes nothing to the checked repository."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-189]",
      "number": 189
    },
    {
      "id": "AIFACTORY-TASK-1512",
      "type": "task",
      "parent": "AIFACTORY-US-362",
      "title": "Planted repository trees for the four classes of deviation and the two passes",
      "sequence": "17.01.03.02",
      "description": "Planted repository trees for the four classes of deviation and the two passes. Expected output: A fixture of six small repository trees beside the script: a wrong name, a wrong template or a scaffold without the Factory switch of its kind, a pipeline file with a step of its own, a package source other than the ConnectSoft feed, one service tree that follows the checklist and one library repository tree named in `library_repositories` and scaffolded from `connectsoft-library`; a test of the script asserts the reported rule for each of the four and the silent pass of the fifth and the sixth.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A fixture of six small repository trees beside the script: a wrong name, a wrong template or a scaffold without the Factory switch of its kind, a pipeline file with a step of its own, a package source other than the ConnectSoft feed, one service tree that follows the checklist and one library repository tree named in `library_repositories` and scaffolded from `connectsoft-library`; a test of the script asserts the reported rule for each of the four and the silent pass of the fifth and the sixth."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4403,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1512]",
      "number": 1512
    },
    {
      "id": "AIFACTORY-TASK-1513",
      "type": "task",
      "parent": "AIFACTORY-US-362",
      "title": "Verify the conformance check on the fixture and on the first repository",
      "sequence": "17.01.03.03",
      "description": "Verify the conformance check on the fixture and on the first repository. Expected output: The test of the script over the six planted trees passes, and one run of the check on the working tree of `ConnectSoft.AI.SoftwareFactory.RunControlService` reports no deviation with the checked revision recorded on the checklist page, which proves AC1 to AC3 of AIFACTORY-US-362 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The test of the script over the six planted trees passes, and one run of the check on the working tree of `ConnectSoft.AI.SoftwareFactory.RunControlService` reports no deviation with the checked revision recorded on the checklist page, which proves AC1 to AC3 of AIFACTORY-US-362 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1513]",
      "number": 1513
    },
    {
      "id": "AIFACTORY-US-002",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "A new service repository is ready in one pass",
      "sequence": "17.01.04",
      "description": "As an operator, I want to create a Factory service repository by following one checklist, so that every one of the sixty-five repositories is built, tested and released the same way. This is the integration PBI of the feature. An operator creates a Factory repository in one pass: the checklist of AIFACTORY-US-360 gives the name, the template of the kind and the scaffold command of the kind with its Factory switch; the pipeline convention of AIFACTORY-US-361 gives build, tests, package and container image from the shared pipeline templates and the ConnectSoft feed as the only feed; the conformance check of AIFACTORY-US-362 reports any deviation. The work lives in those three PBIs and this one proves them together on two repositories of different kinds. The first, `ConnectSoft.AI.SoftwareFactory.RunControlService`, is a service scaffolded from the base template. The second, `ConnectSoft.AI.SoftwareFactory.ControlPlaneApi`, is a platform gateway scaffolded from the API gateway template, which the feature `trusted-scope-chain` then works in. Both are created only after the owner approved their creation, each is created once, here, and the feature of increment I1 that delivers its content takes the repository as it stands, both first commits are the unchanged scaffold output, both pipelines are green and the conformance check reports no deviation for either. The feature is done when a later feature can say that a repository is created by the checklist and mean these steps, for a service and for a gateway alike. Decision D140 then creates every other first-outcome repository in this feature, in increment I0, by the same steps: AIFACTORY-US-1596 to AIFACTORY-US-1601 hold the thirty creation tasks that the I1 features carried before, grouped by plane and with their identifiers kept, so that the I0 demonstration of AIFACTORY-US-1336, every first-outcome repository exists, builds and runs its template tests in its pipeline, can pass in I0, and the I1 features start from the repository created and scaffolded here. The shared template pipeline tasks stay with the features `component-base-template-findings` and `component-base-template-factory-profile` of the epic `component-extensions`, which this feature depends on. The services that the repositories hold are delivered by their own features from increment I1 on. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361, AIFACTORY-US-362, AIFACTORY-US-1596, AIFACTORY-US-1597, AIFACTORY-US-1598, AIFACTORY-US-1599, AIFACTORY-US-1600, AIFACTORY-US-1601. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the checklist, when an operator creates a repository for a modelled service, then its name is ConnectSoft.AI.SoftwareFactory.`<ServiceId>` and the scaffold of its template with the Factory switch of its kind builds unchanged (ADR-0028 decision 1 and its amendment on the Factory profile switch).",
        "AC2: Given the scaffolded repository, when its pipeline runs, then build, tests, package and container image succeed from the shared pipeline templates and the ConnectSoft feed is the only package source (ADR-0028; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC3: Given a repository that deviates from the checklist in its name, its template, its pipeline or its feed, when the conformance check runs, then the deviation is reported, and given the two repositories created by the checklist, a service and a platform gateway, then the check reports none (ADR-0028 decisions 1 and 2).",
        "AC4: Given the thirty first-outcome repositories that AIFACTORY-US-1596 to AIFACTORY-US-1601 create in I0 beside RunControlService, ControlPlaneApi and AgentRuntimeService, when the conformance check runs over each and its pipeline runs on the default branch, then every one is green and reports no deviation, and the list of their run identifiers is the one the readiness proof of AIFACTORY-US-1336 records (ADR-0028 decision 1, D140)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1514",
        "AIFACTORY-TASK-717"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4404,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "AIFACTORY-US-1596",
        "AIFACTORY-US-1597",
        "AIFACTORY-US-1598",
        "AIFACTORY-US-1599",
        "AIFACTORY-US-1600",
        "AIFACTORY-US-1601"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-002]",
      "number": 2
    },
    {
      "id": "AIFACTORY-TASK-1514",
      "type": "task",
      "parent": "AIFACTORY-US-002",
      "title": "Prove the checklist on a repository of a second kind",
      "sequence": "17.01.04.01",
      "description": "Prove the checklist on a repository of a second kind. Expected output: The repository `ConnectSoft.AI.SoftwareFactory.ControlPlaneApi` is created by the same checklist after the approval of the owner, with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ControlPlaneApi --UseFactoryProfile true --GatewayRole Platform`; this is the one creation of the repository, and feature `control-plane-api` of increment I1 takes the repository as it stands; its first commit is the unchanged scaffold output, its pipeline is green from the shared steps and the conformance check reports no deviation, which proves AC1 to AC3 of AIFACTORY-US-002 for a platform gateway (ADR-0028 decision 2).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The repository `ConnectSoft.AI.SoftwareFactory.ControlPlaneApi` is created by the same checklist after the approval of the owner, with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ControlPlaneApi --UseFactoryProfile true --GatewayRole Platform`; this is the one creation of the repository, and feature `control-plane-api` of increment I1 takes the repository as it stands; its first commit is the unchanged scaffold output, its pipeline is green from the shared steps and the conformance check reports no deviation, which proves AC1 to AC3 of AIFACTORY-US-002 for a platform gateway (ADR-0028 decision 2)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1514]",
      "number": 1514
    },
    {
      "id": "AIFACTORY-TASK-717",
      "type": "task",
      "parent": "AIFACTORY-US-002",
      "title": "Verify repository-in-one-pass by running the declared command",
      "sequence": "17.01.04.02",
      "description": "Verify repository-in-one-pass by running the declared command. Expected output: Run `python -I tools/docs_model validate`; it passes with the checklist page, the recorded versions, the recorded conformance results of the two repositories and the green runs and conformance results of the thirty repositories of AIFACTORY-US-1596 to AIFACTORY-US-1601 in place, and proves AC1 to AC4 of AIFACTORY-US-002.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run `python -I tools/docs_model validate`; it passes with the checklist page, the recorded versions, the recorded conformance results of the two repositories and the green runs and conformance results of the thirty repositories of AIFACTORY-US-1596 to AIFACTORY-US-1601 in place, and proves AC1 to AC4 of AIFACTORY-US-002."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-717]",
      "number": 717
    },
    {
      "id": "AIFACTORY-US-1596",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: the first-outcome repositories of the control plane and the workflow engine are created and scaffolded in I0 by the checklist, each with a green template pipeline",
      "sequence": "17.01.05",
      "description": "As an operator, I want the repositories of AgentRegistryService, EnvironmentService, ProjectService, CostUsageService and WorkflowEngineService created and scaffolded before increment I1 starts, so that the readiness demonstration of I0 finds every first-outcome repository built and tested in its own pipeline, and the I1 features start from a scaffold that is known to build. Decision D140 moves the creation of every first-outcome repository into increment I0, so that the first demonstration of I0, which AIFACTORY-US-1336 proves (each first-outcome repository exists, builds and runs its template tests in its pipeline), can pass in I0. This PBI holds the five repositories of the control plane and the agent mesh beside RunControlService, ControlPlaneApi and AgentRuntimeService, which were already created in I0. The tasks keep the identifiers they had in their I1 features: AIFACTORY-TASK-001 creates ConnectSoft.AI.SoftwareFactory.AgentRegistryService, AIFACTORY-TASK-010 ConnectSoft.AI.SoftwareFactory.EnvironmentService, AIFACTORY-TASK-016 ConnectSoft.AI.SoftwareFactory.ProjectService and AIFACTORY-TASK-238 ConnectSoft.AI.SoftwareFactory.CostUsageService, each with `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the base template package at the version the gate of AIFACTORY-US-230 published; AIFACTORY-TASK-037 creates ConnectSoft.AI.SoftwareFactory.WorkflowEngineService with `dotnet new connectsoft-ai-agent -n <name> --agent-host-kind workflow-engine` from the pinned agent template package, without `UseFactoryProfile`. Every repository is created by the steps of the checklist of AIFACTORY-US-360, only after the recorded approval of the owner for its creation, which stays an open row of the register of AIFACTORY-US-379 until the owner gives it. Its first commit is the unchanged scaffold output with the messaging service name of its service file, the repository records the template version and the scaffold command, the branch policy is set, and the pipeline of AIFACTORY-US-361 builds it, runs the template tests and publishes the container image from the shared steps with the ConnectSoft feed as the only source. No Factory code is written here: the I1 features `agent-registry-service-thin`, `environment-service`, `project-service`, `cost-usage-service-complete` and `workflow-engine-service` take each repository as it stands and start from its scaffold. A repository whose scaffold does not build, whose template tests fail or that the conformance check of AIFACTORY-US-362 reports as deviating is recorded by name and blocks the readiness proof; it is never waived. Kind: enabling. Traces: services: AgentRegistryService, EnvironmentService, ProjectService, CostUsageService, WorkflowEngineService; adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361, AIFACTORY-US-362, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-agent-template-release, feature:contracts-package. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/control-plane/AgentRegistryService.yaml, model/services/control-plane/EnvironmentService.yaml, model/services/control-plane/ProjectService.yaml, model/services/control-plane/CostUsageService.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, handoffs/2026-10-09-independent-review/decision-log.md.",
      "acceptanceCriteria": [
        "AC1: Given the recorded approval of the owner for each creation and the checklist of AIFACTORY-US-360, when AIFACTORY-TASK-001, AIFACTORY-TASK-010, AIFACTORY-TASK-016 and AIFACTORY-TASK-238 run, then the repositories ConnectSoft.AI.SoftwareFactory.AgentRegistryService, ConnectSoft.AI.SoftwareFactory.EnvironmentService, ConnectSoft.AI.SoftwareFactory.ProjectService and ConnectSoft.AI.SoftwareFactory.CostUsageService exist, each first commit is the unchanged output of `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the template package the gate of AIFACTORY-US-230 published, and each records that version and the messaging service name of its service file under model/services/control-plane (ADR-0028 decision 1, D140).",
        "AC2: Given the pinned agent template package, when AIFACTORY-TASK-037 runs, then ConnectSoft.AI.SoftwareFactory.WorkflowEngineService exists, its first commit is the unchanged output of `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.WorkflowEngineService --agent-host-kind workflow-engine` with no `UseFactoryProfile`, and it records the template version, the messaging service name `workflow-engine` and the silo kind of the workflow engine (ADR-0028 amendment on the Factory profile switch, model/services/agent-mesh/WorkflowEngineService.yaml).",
        "AC3: Given each of the five repositories, when its pipeline runs on the default branch, then it restores from the ConnectSoft feed alone, builds in Release, passes the template tests with complete reports and publishes the container image from the shared steps of AIFACTORY-US-361, and the conformance check of AIFACTORY-US-362 reports no deviation, so that the five rows of the repository list of AIFACTORY-US-1336 carry a green run (ADR-0028, D140)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-001",
        "AIFACTORY-TASK-010",
        "AIFACTORY-TASK-016",
        "AIFACTORY-TASK-238",
        "AIFACTORY-TASK-037",
        "AIFACTORY-TASK-6471"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4405,
      "kind": "enabling",
      "traces": {
        "services": [
          "AgentRegistryService",
          "EnvironmentService",
          "ProjectService",
          "CostUsageService",
          "WorkflowEngineService"
        ],
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-agent-template-release",
        "feature:contracts-package"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/EnvironmentService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1596]",
      "number": 1596
    },
    {
      "id": "AIFACTORY-TASK-001",
      "type": "task",
      "parent": "AIFACTORY-US-1596",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.AgentRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.05.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.AgentRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AgentRegistryService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `agent-registry`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRegistryService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AgentRegistryService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AgentRegistryService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `agent-registry`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRegistryService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-001]",
      "number": 1
    },
    {
      "id": "AIFACTORY-TASK-010",
      "type": "task",
      "parent": "AIFACTORY-US-1596",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.EnvironmentService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.05.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.EnvironmentService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `environment`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.EnvironmentService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.EnvironmentService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `environment`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.EnvironmentService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-010]",
      "number": 10
    },
    {
      "id": "AIFACTORY-TASK-016",
      "type": "task",
      "parent": "AIFACTORY-US-1596",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ProjectService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.05.03",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ProjectService and scaffold it from the base template with the Factory profile. Expected output: The repository exists; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ProjectService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ProjectService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ProjectService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ProjectService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ProjectService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-016]",
      "number": 16
    },
    {
      "id": "AIFACTORY-TASK-238",
      "type": "task",
      "parent": "AIFACTORY-US-1596",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.CostUsageService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.05.04",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.CostUsageService and scaffold it from the base template with the Factory profile. Expected output: The repository exists; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.CostUsageService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.CostUsageService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.CostUsageService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-238]",
      "number": 238
    },
    {
      "id": "AIFACTORY-TASK-037",
      "type": "task",
      "parent": "AIFACTORY-US-1596",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService and scaffold it from the pinned agent host template as the workflow-engine host kind",
      "sequence": "17.01.05.05",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.WorkflowEngineService and scaffold it from the pinned agent host template as the workflow-engine host kind. Expected output: The repository exists as the checklist of feature repository-and-pipeline-conventions creates it, the output of `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.WorkflowEngineService --agent-host-kind workflow-engine` from the pinned template package is committed with the messaging service name `workflow-engine` and the silo kind of the workflow engine, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.WorkflowEngineService --agent-host-kind workflow-engine | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists as the checklist of feature repository-and-pipeline-conventions creates it, the output of `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.WorkflowEngineService --agent-host-kind workflow-engine` from the pinned template package is committed with the messaging service name `workflow-engine` and the silo kind of the workflow engine, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-037]",
      "number": 37
    },
    {
      "id": "AIFACTORY-TASK-6471",
      "type": "task",
      "parent": "AIFACTORY-US-1596",
      "title": "Verify the five control plane and agent mesh repositories and their green pipeline runs",
      "sequence": "17.01.05.06",
      "description": "Verify the five control plane and agent mesh repositories and their green pipeline runs. Expected output: The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.AgentRegistryService, ConnectSoft.AI.SoftwareFactory.EnvironmentService, ConnectSoft.AI.SoftwareFactory.ProjectService, ConnectSoft.AI.SoftwareFactory.CostUsageService and ConnectSoft.AI.SoftwareFactory.WorkflowEngineService, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests, and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-001, AIFACTORY-TASK-010, AIFACTORY-TASK-016, AIFACTORY-TASK-238 and AIFACTORY-TASK-037 proves AC1 to AC3 of AIFACTORY-US-1596, and `python -I tools/docs_model check` passes with the list in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.AgentRegistryService, ConnectSoft.AI.SoftwareFactory.EnvironmentService, ConnectSoft.AI.SoftwareFactory.ProjectService, ConnectSoft.AI.SoftwareFactory.CostUsageService and ConnectSoft.AI.SoftwareFactory.WorkflowEngineService, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests, and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-001, AIFACTORY-TASK-010, AIFACTORY-TASK-016, AIFACTORY-TASK-238 and AIFACTORY-TASK-037 proves AC1 to AC3 of AIFACTORY-US-1596, and `python -I tools/docs_model check` passes with the list in place."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6471]",
      "number": 6471
    },
    {
      "id": "AIFACTORY-US-1597",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: the first-outcome repositories of the governance plane are created and scaffolded in I0 by the checklist, each with a green template pipeline",
      "sequence": "17.01.06",
      "description": "As an operator, I want the repositories of PolicyEngineService, SecretBrokerService, AuditService and GovernanceHost created and scaffolded before increment I1 starts, so that the readiness demonstration of I0 finds the governance repositories built and tested in their own pipelines, and the I1 governance features start from a scaffold that is known to build. Decision D140 moves the creation of every first-outcome repository into increment I0, so that the first demonstration of I0, which AIFACTORY-US-1336 proves, can pass in I0. This PBI holds the four repositories of the governance plane. The tasks keep the identifiers they had in their I1 features: AIFACTORY-TASK-101 creates ConnectSoft.AI.SoftwareFactory.PolicyEngineService, AIFACTORY-TASK-108 ConnectSoft.AI.SoftwareFactory.SecretBrokerService and AIFACTORY-TASK-231 ConnectSoft.AI.SoftwareFactory.AuditService, each with `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned base template package; AIFACTORY-TASK-454 creates the platform gateway ConnectSoft.AI.SoftwareFactory.GovernanceHost with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.GovernanceHost --UseFactoryProfile true --GatewayRole Platform`, whose template tests include the architecture test of the Platform role. Every repository is created by the steps of the checklist of AIFACTORY-US-360 only after the recorded approval of the owner for its creation, which stays an open row of the register of AIFACTORY-US-379 until the owner gives it. Its first commit is the unchanged scaffold output with the messaging service name of its service file where the service has one, the repository records the template version and the scaffold command, the branch policy is set, and the pipeline of AIFACTORY-US-361 builds it, runs the template tests and publishes the container image from the shared steps with the ConnectSoft feed as the only source. No Factory code is written here: the I1 features `policy-engine-service`, `secret-broker-service`, `audit-service-complete` and `governance-host` take each repository as it stands. A repository whose scaffold does not build, whose template tests fail or that the conformance check of AIFACTORY-US-362 reports as deviating is recorded by name and blocks the readiness proof; it is never waived. Kind: enabling. Traces: services: PolicyEngineService, SecretBrokerService, AuditService, GovernanceHost; adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361, AIFACTORY-US-362, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-api-gateway-template, feature:contracts-package. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/governance/PolicyEngineService.yaml, model/services/governance/SecretBrokerService.yaml, model/services/governance/AuditService.yaml, model/services/governance/GovernanceHost.yaml, handoffs/2026-10-09-independent-review/decision-log.md.",
      "acceptanceCriteria": [
        "AC1: Given the recorded approval of the owner for each creation and the checklist of AIFACTORY-US-360, when AIFACTORY-TASK-101, AIFACTORY-TASK-108 and AIFACTORY-TASK-231 run, then ConnectSoft.AI.SoftwareFactory.PolicyEngineService, ConnectSoft.AI.SoftwareFactory.SecretBrokerService and ConnectSoft.AI.SoftwareFactory.AuditService exist, each first commit is the unchanged output of `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned template package, and each records the template version and the messaging service name of its service file under model/services/governance (ADR-0028 decision 1, D140).",
        "AC2: Given the pinned API gateway template package, when AIFACTORY-TASK-454 runs, then ConnectSoft.AI.SoftwareFactory.GovernanceHost exists, its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.GovernanceHost --UseFactoryProfile true --GatewayRole Platform`, it records the template version, and the template tests pass with the architecture test of the Platform role (ADR-0028 decision 2, model/services/governance/GovernanceHost.yaml).",
        "AC3: Given each of the four repositories, when its pipeline runs on the default branch, then it restores from the ConnectSoft feed alone, builds in Release, passes the template tests with complete reports and publishes the container image from the shared steps of AIFACTORY-US-361, and the conformance check of AIFACTORY-US-362 reports no deviation, so that the four rows of the repository list of AIFACTORY-US-1336 carry a green run (ADR-0028, D140)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/GovernanceHost.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-101",
        "AIFACTORY-TASK-108",
        "AIFACTORY-TASK-231",
        "AIFACTORY-TASK-454",
        "AIFACTORY-TASK-6472"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4406,
      "kind": "enabling",
      "traces": {
        "services": [
          "PolicyEngineService",
          "SecretBrokerService",
          "AuditService",
          "GovernanceHost"
        ],
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-api-gateway-template",
        "feature:contracts-package"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/governance/SecretBrokerService.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/governance/GovernanceHost.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1597]",
      "number": 1597
    },
    {
      "id": "AIFACTORY-TASK-101",
      "type": "task",
      "parent": "AIFACTORY-US-1597",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.PolicyEngineService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.06.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.PolicyEngineService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PolicyEngineService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `policy-engine`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PolicyEngineService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PolicyEngineService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PolicyEngineService --UseFactoryProfile true` from the pinned template package is committed unchanged with the messaging service name `policy-engine`, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PolicyEngineService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-101]",
      "number": 101
    },
    {
      "id": "AIFACTORY-TASK-108",
      "type": "task",
      "parent": "AIFACTORY-US-1597",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.SecretBrokerService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.06.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.SecretBrokerService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SecretBrokerService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name secret-broker; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.SecretBrokerService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SecretBrokerService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.SecretBrokerService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name secret-broker; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.SecretBrokerService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-108]",
      "number": 108
    },
    {
      "id": "AIFACTORY-TASK-231",
      "type": "task",
      "parent": "AIFACTORY-US-1597",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.AuditService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.06.03",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.AuditService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AuditService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name audit; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuditService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AuditService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.AuditService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name audit; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuditService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-231]",
      "number": 231
    },
    {
      "id": "AIFACTORY-TASK-454",
      "type": "task",
      "parent": "AIFACTORY-US-1597",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.GovernanceHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "17.01.06.04",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.GovernanceHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.GovernanceHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-455 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GovernanceHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.GovernanceHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.GovernanceHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-455 is written."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GovernanceHost"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4406,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-454]",
      "number": 454
    },
    {
      "id": "AIFACTORY-TASK-6472",
      "type": "task",
      "parent": "AIFACTORY-US-1597",
      "title": "Verify the four governance repositories and their green pipeline runs",
      "sequence": "17.01.06.05",
      "description": "Verify the four governance repositories and their green pipeline runs. Expected output: The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.PolicyEngineService, ConnectSoft.AI.SoftwareFactory.SecretBrokerService, ConnectSoft.AI.SoftwareFactory.AuditService and ConnectSoft.AI.SoftwareFactory.GovernanceHost, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for GovernanceHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-101, AIFACTORY-TASK-108, AIFACTORY-TASK-231 and AIFACTORY-TASK-454 proves AC1 to AC3 of AIFACTORY-US-1597, and `python -I tools/docs_model check` passes with the list in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.PolicyEngineService, ConnectSoft.AI.SoftwareFactory.SecretBrokerService, ConnectSoft.AI.SoftwareFactory.AuditService and ConnectSoft.AI.SoftwareFactory.GovernanceHost, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for GovernanceHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-101, AIFACTORY-TASK-108, AIFACTORY-TASK-231 and AIFACTORY-TASK-454 proves AC1 to AC3 of AIFACTORY-US-1597, and `python -I tools/docs_model check` passes with the list in place."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4406,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6472]",
      "number": 6472
    },
    {
      "id": "AIFACTORY-US-1598",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: the first-outcome repositories of integration, delivery and runtime capacity are created and scaffolded in I0 by the checklist, each with a green template pipeline",
      "sequence": "17.01.07",
      "description": "As an operator, I want the repositories of ConnectorRegistryService, IntegrationService, IntegrationHost, PipelineExecutionService and ExecutionCapacityService created and scaffolded before increment I1 starts, so that the readiness demonstration of I0 finds these repositories built and tested in their own pipelines, and their I1 features start from a scaffold that is known to build. Decision D140 moves the creation of every first-outcome repository into increment I0, so that the first demonstration of I0, which AIFACTORY-US-1336 proves, can pass in I0. This PBI holds the five repositories of the integration plane, of the delivery plane and of the runtime capacity that the first outcome needs. The tasks keep the identifiers they had in their I1 features: AIFACTORY-TASK-086 creates ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService, AIFACTORY-TASK-089 ConnectSoft.AI.SoftwareFactory.IntegrationService, AIFACTORY-TASK-092 ConnectSoft.AI.SoftwareFactory.PipelineExecutionService and AIFACTORY-TASK-095 ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService, each with `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned base template package; AIFACTORY-TASK-463 creates the platform gateway ConnectSoft.AI.SoftwareFactory.IntegrationHost with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.IntegrationHost --UseFactoryProfile true --GatewayRole Platform`, whose template tests include the architecture test of the Platform role. Every repository is created by the steps of the checklist of AIFACTORY-US-360 only after the recorded approval of the owner for its creation, which stays an open row of the register of AIFACTORY-US-379 until the owner gives it. Its first commit is the unchanged scaffold output with the messaging service name of its service file where the service has one, the repository records the template version and the scaffold command, the branch policy is set, and the pipeline of AIFACTORY-US-361 builds it, runs the template tests and publishes the container image from the shared steps with the ConnectSoft feed as the only source. No Factory code is written here: the I1 features `connector-registry-service-thin`, `integration-service-thin`, `integration-host`, `pipeline-execution-service-thin` and `execution-capacity-service-thin` take each repository as it stands. A repository whose scaffold does not build, whose template tests fail or that the conformance check of AIFACTORY-US-362 reports as deviating is recorded by name and blocks the readiness proof; it is never waived. Kind: enabling. Traces: services: ConnectorRegistryService, IntegrationService, IntegrationHost, PipelineExecutionService, ExecutionCapacityService; adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361, AIFACTORY-US-362, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-api-gateway-template. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/integration/ConnectorRegistryService.yaml, model/services/integration/IntegrationService.yaml, model/services/integration/IntegrationHost.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, handoffs/2026-10-09-independent-review/decision-log.md.",
      "acceptanceCriteria": [
        "AC1: Given the recorded approval of the owner for each creation and the checklist of AIFACTORY-US-360, when AIFACTORY-TASK-086, AIFACTORY-TASK-089, AIFACTORY-TASK-092 and AIFACTORY-TASK-095 run, then ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService, ConnectSoft.AI.SoftwareFactory.IntegrationService, ConnectSoft.AI.SoftwareFactory.PipelineExecutionService and ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService exist, each first commit is the unchanged output of `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned template package, and each records the template version and the messaging service name of its service file (ADR-0028 decision 1, model/services/integration/ConnectorRegistryService.yaml, D140).",
        "AC2: Given the pinned API gateway template package, when AIFACTORY-TASK-463 runs, then ConnectSoft.AI.SoftwareFactory.IntegrationHost exists, its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.IntegrationHost --UseFactoryProfile true --GatewayRole Platform`, it records the template version, and the template tests pass with the architecture test of the Platform role (ADR-0028 decision 2, model/services/integration/IntegrationHost.yaml).",
        "AC3: Given each of the five repositories, when its pipeline runs on the default branch, then it restores from the ConnectSoft feed alone, builds in Release, passes the template tests with complete reports and publishes the container image from the shared steps of AIFACTORY-US-361, and the conformance check of AIFACTORY-US-362 reports no deviation, so that the five rows of the repository list of AIFACTORY-US-1336 carry a green run (ADR-0028, D140)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/IntegrationHost.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-086",
        "AIFACTORY-TASK-089",
        "AIFACTORY-TASK-463",
        "AIFACTORY-TASK-092",
        "AIFACTORY-TASK-095",
        "AIFACTORY-TASK-6473"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4407,
      "kind": "enabling",
      "traces": {
        "services": [
          "ConnectorRegistryService",
          "IntegrationService",
          "IntegrationHost",
          "PipelineExecutionService",
          "ExecutionCapacityService"
        ],
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/integration/IntegrationHost.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1598]",
      "number": 1598
    },
    {
      "id": "AIFACTORY-TASK-086",
      "type": "task",
      "parent": "AIFACTORY-US-1598",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.07.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `connector-registry`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `connector-registry`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-086]",
      "number": 86
    },
    {
      "id": "AIFACTORY-TASK-089",
      "type": "task",
      "parent": "AIFACTORY-US-1598",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.IntegrationService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.07.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.IntegrationService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IntegrationService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `integration`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IntegrationService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.IntegrationService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `integration`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-089]",
      "number": 89
    },
    {
      "id": "AIFACTORY-TASK-463",
      "type": "task",
      "parent": "AIFACTORY-US-1598",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.IntegrationHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "17.01.07.03",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.IntegrationHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.IntegrationHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-464 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.IntegrationHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.IntegrationHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.IntegrationHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-464 is written."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.IntegrationHost"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-463]",
      "number": 463
    },
    {
      "id": "AIFACTORY-TASK-092",
      "type": "task",
      "parent": "AIFACTORY-US-1598",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.PipelineExecutionService and scaffold it from the ConnectSoft.BaseTemplate template",
      "sequence": "17.01.07.04",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.PipelineExecutionService and scaffold it from the ConnectSoft.BaseTemplate template. Expected output: The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PipelineExecutionService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `pipeline-execution`; the solution builds and the template tests pass in the repository pipeline.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.PipelineExecutionService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PipelineExecutionService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.PipelineExecutionService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `pipeline-execution`; the solution builds and the template tests pass in the repository pipeline."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.PipelineExecutionService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-092]",
      "number": 92
    },
    {
      "id": "AIFACTORY-TASK-095",
      "type": "task",
      "parent": "AIFACTORY-US-1598",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.07.05",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `execution-capacity`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `execution-capacity`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-095]",
      "number": 95
    },
    {
      "id": "AIFACTORY-TASK-6473",
      "type": "task",
      "parent": "AIFACTORY-US-1598",
      "title": "Verify the five integration, delivery and runtime repositories and their green pipeline runs",
      "sequence": "17.01.07.06",
      "description": "Verify the five integration, delivery and runtime repositories and their green pipeline runs. Expected output: The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService, ConnectSoft.AI.SoftwareFactory.IntegrationService, ConnectSoft.AI.SoftwareFactory.IntegrationHost, ConnectSoft.AI.SoftwareFactory.PipelineExecutionService and ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for IntegrationHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-086, AIFACTORY-TASK-089, AIFACTORY-TASK-463, AIFACTORY-TASK-092 and AIFACTORY-TASK-095 proves AC1 to AC3 of AIFACTORY-US-1598, and `python -I tools/docs_model check` passes with the list in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.ConnectorRegistryService, ConnectSoft.AI.SoftwareFactory.IntegrationService, ConnectSoft.AI.SoftwareFactory.IntegrationHost, ConnectSoft.AI.SoftwareFactory.PipelineExecutionService and ConnectSoft.AI.SoftwareFactory.ExecutionCapacityService, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for IntegrationHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-086, AIFACTORY-TASK-089, AIFACTORY-TASK-463, AIFACTORY-TASK-092 and AIFACTORY-TASK-095 proves AC1 to AC3 of AIFACTORY-US-1598, and `python -I tools/docs_model check` passes with the list in place."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4407,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6473]",
      "number": 6473
    },
    {
      "id": "AIFACTORY-US-1599",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: the first-outcome repositories of the knowledge plane are created and scaffolded in I0 by the checklist, each with a green template pipeline",
      "sequence": "17.01.08",
      "description": "As an operator, I want the repositories of ArtifactService, ContextBuilderService, KnowledgeIngestionService, RepositoryIntelligenceService, VectorMemoryService and KnowledgeHost created and scaffolded before increment I1 starts, so that the readiness demonstration of I0 finds the knowledge repositories built and tested in their own pipelines, and the I1 knowledge features start from a scaffold that is known to build. Decision D140 moves the creation of every first-outcome repository into increment I0, so that the first demonstration of I0, which AIFACTORY-US-1336 proves, can pass in I0. This PBI holds the six repositories of the knowledge plane. The tasks keep the identifiers they had in their I1 features: AIFACTORY-TASK-054 creates ConnectSoft.AI.SoftwareFactory.ArtifactService, AIFACTORY-TASK-061 ConnectSoft.AI.SoftwareFactory.ContextBuilderService, AIFACTORY-TASK-064 ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService, AIFACTORY-TASK-067 ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService and AIFACTORY-TASK-070 ConnectSoft.AI.SoftwareFactory.VectorMemoryService, each with `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned base template package; AIFACTORY-TASK-466 creates the platform gateway ConnectSoft.AI.SoftwareFactory.KnowledgeHost with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.KnowledgeHost --UseFactoryProfile true --GatewayRole Platform`, whose template tests include the architecture test of the Platform role. Every repository is created by the steps of the checklist of AIFACTORY-US-360 only after the recorded approval of the owner for its creation, which stays an open row of the register of AIFACTORY-US-379 until the owner gives it. Its first commit is the unchanged scaffold output with the messaging service name of its service file where the service has one, the repository records the template version and the scaffold command, the branch policy is set, and the pipeline of AIFACTORY-US-361 builds it, runs the template tests and publishes the container image from the shared steps with the ConnectSoft feed as the only source. No Factory code is written here: the I1 features `artifact-service`, `context-builder-service-thin`, `knowledge-ingestion-service-thin`, `repository-intelligence-service-thin`, `vector-memory-service-thin` and `knowledge-host` take each repository as it stands. A repository whose scaffold does not build, whose template tests fail or that the conformance check of AIFACTORY-US-362 reports as deviating is recorded by name and blocks the readiness proof; it is never waived. Kind: enabling. Traces: services: ArtifactService, ContextBuilderService, KnowledgeIngestionService, RepositoryIntelligenceService, VectorMemoryService, KnowledgeHost; adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361, AIFACTORY-US-362, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-api-gateway-template, feature:contracts-package. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/knowledge/ArtifactService.yaml, model/services/knowledge/ContextBuilderService.yaml, model/services/knowledge/KnowledgeIngestionService.yaml, model/services/knowledge/RepositoryIntelligenceService.yaml, model/services/knowledge/VectorMemoryService.yaml, model/services/knowledge/KnowledgeHost.yaml, handoffs/2026-10-09-independent-review/decision-log.md.",
      "acceptanceCriteria": [
        "AC1: Given the recorded approval of the owner for each creation and the checklist of AIFACTORY-US-360, when AIFACTORY-TASK-054, AIFACTORY-TASK-061, AIFACTORY-TASK-064, AIFACTORY-TASK-067 and AIFACTORY-TASK-070 run, then ConnectSoft.AI.SoftwareFactory.ArtifactService, ConnectSoft.AI.SoftwareFactory.ContextBuilderService, ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService, ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService and ConnectSoft.AI.SoftwareFactory.VectorMemoryService exist, each first commit is the unchanged output of `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned template package, and each records the template version and the messaging service name of its service file under model/services/knowledge (ADR-0028 decision 1, D140).",
        "AC2: Given the pinned API gateway template package, when AIFACTORY-TASK-466 runs, then ConnectSoft.AI.SoftwareFactory.KnowledgeHost exists, its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.KnowledgeHost --UseFactoryProfile true --GatewayRole Platform`, it records the template version, and the template tests pass with the architecture test of the Platform role (ADR-0028 decision 2, model/services/knowledge/KnowledgeHost.yaml).",
        "AC3: Given each of the six repositories, when its pipeline runs on the default branch, then it restores from the ConnectSoft feed alone, builds in Release, passes the template tests with complete reports and publishes the container image from the shared steps of AIFACTORY-US-361, and the conformance check of AIFACTORY-US-362 reports no deviation, so that the six rows of the repository list of AIFACTORY-US-1336 carry a green run (ADR-0028, D140)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/KnowledgeHost.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-054",
        "AIFACTORY-TASK-061",
        "AIFACTORY-TASK-064",
        "AIFACTORY-TASK-067",
        "AIFACTORY-TASK-070",
        "AIFACTORY-TASK-466",
        "AIFACTORY-TASK-6474"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "enabling",
      "traces": {
        "services": [
          "ArtifactService",
          "ContextBuilderService",
          "KnowledgeIngestionService",
          "RepositoryIntelligenceService",
          "VectorMemoryService",
          "KnowledgeHost"
        ],
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-api-gateway-template",
        "feature:contracts-package"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/knowledge/ContextBuilderService.yaml",
        "model/services/knowledge/KnowledgeIngestionService.yaml",
        "model/services/knowledge/RepositoryIntelligenceService.yaml",
        "model/services/knowledge/VectorMemoryService.yaml",
        "model/services/knowledge/KnowledgeHost.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1599]",
      "number": 1599
    },
    {
      "id": "AIFACTORY-TASK-054",
      "type": "task",
      "parent": "AIFACTORY-US-1599",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ArtifactService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.08.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ArtifactService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ArtifactService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name artifact; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ArtifactService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ArtifactService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ArtifactService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name artifact; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ArtifactService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-054]",
      "number": 54
    },
    {
      "id": "AIFACTORY-TASK-061",
      "type": "task",
      "parent": "AIFACTORY-US-1599",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ContextBuilderService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.08.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ContextBuilderService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ContextBuilderService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name context-builder; the repository records that template version; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ContextBuilderService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ContextBuilderService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ContextBuilderService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name context-builder; the repository records that template version; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ContextBuilderService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-061]",
      "number": 61
    },
    {
      "id": "AIFACTORY-TASK-064",
      "type": "task",
      "parent": "AIFACTORY-US-1599",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.08.03",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name knowledge-ingestion; the repository records that template version; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name knowledge-ingestion; the repository records that template version; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-064]",
      "number": 64
    },
    {
      "id": "AIFACTORY-TASK-067",
      "type": "task",
      "parent": "AIFACTORY-US-1599",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.08.04",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `repository-intelligence`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `repository-intelligence`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-067]",
      "number": 67
    },
    {
      "id": "AIFACTORY-TASK-070",
      "type": "task",
      "parent": "AIFACTORY-US-1599",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.VectorMemoryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.08.05",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.VectorMemoryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.VectorMemoryService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `vector-memory`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.VectorMemoryService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.VectorMemoryService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.VectorMemoryService --UseFactoryProfile true` from the pinned template package, whose version the repository records, with the messaging service name `vector-memory`; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.VectorMemoryService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-070]",
      "number": 70
    },
    {
      "id": "AIFACTORY-TASK-466",
      "type": "task",
      "parent": "AIFACTORY-US-1599",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.KnowledgeHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "17.01.08.06",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.KnowledgeHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.KnowledgeHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-467 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.KnowledgeHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.KnowledgeHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.KnowledgeHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-467 is written."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.KnowledgeHost"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-466]",
      "number": 466
    },
    {
      "id": "AIFACTORY-TASK-6474",
      "type": "task",
      "parent": "AIFACTORY-US-1599",
      "title": "Verify the six knowledge repositories and their green pipeline runs",
      "sequence": "17.01.08.07",
      "description": "Verify the six knowledge repositories and their green pipeline runs. Expected output: The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.ArtifactService, ConnectSoft.AI.SoftwareFactory.ContextBuilderService, ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService, ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService, ConnectSoft.AI.SoftwareFactory.VectorMemoryService and ConnectSoft.AI.SoftwareFactory.KnowledgeHost, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for KnowledgeHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-054, AIFACTORY-TASK-061, AIFACTORY-TASK-064, AIFACTORY-TASK-067, AIFACTORY-TASK-070 and AIFACTORY-TASK-466 proves AC1 to AC3 of AIFACTORY-US-1599, and `python -I tools/docs_model check` passes with the list in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.ArtifactService, ConnectSoft.AI.SoftwareFactory.ContextBuilderService, ConnectSoft.AI.SoftwareFactory.KnowledgeIngestionService, ConnectSoft.AI.SoftwareFactory.RepositoryIntelligenceService, ConnectSoft.AI.SoftwareFactory.VectorMemoryService and ConnectSoft.AI.SoftwareFactory.KnowledgeHost, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for KnowledgeHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-054, AIFACTORY-TASK-061, AIFACTORY-TASK-064, AIFACTORY-TASK-067, AIFACTORY-TASK-070 and AIFACTORY-TASK-466 proves AC1 to AC3 of AIFACTORY-US-1599, and `python -I tools/docs_model check` passes with the list in place."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4408,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6474]",
      "number": 6474
    },
    {
      "id": "AIFACTORY-US-1600",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: the first-outcome repositories of model compute, tools and quality scoring are created and scaffolded in I0 by the checklist, each with a green template pipeline",
      "sequence": "17.01.09",
      "description": "As an operator, I want the repositories of ModelRouterService, ModelGatewayHost, McpServerRegistryService, ToolAdapterService, ToolExecutorHost and QualityScoreService created and scaffolded before increment I1 starts, so that the readiness demonstration of I0 finds these repositories built and tested in their own pipelines, and their I1 features start from a scaffold that is known to build. Decision D140 moves the creation of every first-outcome repository into increment I0, so that the first demonstration of I0, which AIFACTORY-US-1336 proves, can pass in I0. This PBI holds the six repositories of the model compute plane, of the tools plane and of the quality scoring that the first outcome needs. The tasks keep the identifiers they had in their I1 features: AIFACTORY-TASK-047 creates ConnectSoft.AI.SoftwareFactory.ModelRouterService, AIFACTORY-TASK-073 ConnectSoft.AI.SoftwareFactory.McpServerRegistryService, AIFACTORY-TASK-076 ConnectSoft.AI.SoftwareFactory.ToolAdapterService and AIFACTORY-TASK-115 ConnectSoft.AI.SoftwareFactory.QualityScoreService, each with `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned base template package; AIFACTORY-TASK-044 creates the platform gateway ConnectSoft.AI.SoftwareFactory.ModelGatewayHost and AIFACTORY-TASK-083 the platform gateway ConnectSoft.AI.SoftwareFactory.ToolExecutorHost, each with `dotnet new connectsoft-apigateway -n <name> --UseFactoryProfile true --GatewayRole Platform`, whose template tests include the architecture test of the Platform role. Every repository is created by the steps of the checklist of AIFACTORY-US-360 only after the recorded approval of the owner for its creation, which stays an open row of the register of AIFACTORY-US-379 until the owner gives it. Its first commit is the unchanged scaffold output with the messaging service name of its service file where the service has one, the repository records the template version and the scaffold command, the branch policy is set, and the pipeline of AIFACTORY-US-361 builds it, runs the template tests and publishes the container image from the shared steps with the ConnectSoft feed as the only source. No Factory code is written here: the I1 features `model-router-service`, `model-gateway-host`, `mcp-server-registry-service-thin`, `tool-adapter-service`, `tool-executor-host` and `quality-score-service-thin` take each repository as it stands. A repository whose scaffold does not build, whose template tests fail or that the conformance check of AIFACTORY-US-362 reports as deviating is recorded by name and blocks the readiness proof; it is never waived. Kind: enabling. Traces: services: ModelRouterService, ModelGatewayHost, McpServerRegistryService, ToolAdapterService, ToolExecutorHost, QualityScoreService; adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361, AIFACTORY-US-362, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-api-gateway-template, feature:contracts-package. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/model-compute/ModelRouterService.yaml, model/services/model-compute/ModelGatewayHost.yaml, model/services/tools-mcp/McpServerRegistryService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/tools-mcp/ToolExecutorHost.yaml, model/services/observability/QualityScoreService.yaml, handoffs/2026-10-09-independent-review/decision-log.md.",
      "acceptanceCriteria": [
        "AC1: Given the recorded approval of the owner for each creation and the checklist of AIFACTORY-US-360, when AIFACTORY-TASK-047, AIFACTORY-TASK-073, AIFACTORY-TASK-076 and AIFACTORY-TASK-115 run, then ConnectSoft.AI.SoftwareFactory.ModelRouterService, ConnectSoft.AI.SoftwareFactory.McpServerRegistryService, ConnectSoft.AI.SoftwareFactory.ToolAdapterService and ConnectSoft.AI.SoftwareFactory.QualityScoreService exist, each first commit is the unchanged output of `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the pinned template package, and each records the template version and the messaging service name of its service file (ADR-0028 decision 1, model/services/model-compute/ModelRouterService.yaml, D140).",
        "AC2: Given the pinned API gateway template package, when AIFACTORY-TASK-044 and AIFACTORY-TASK-083 run, then ConnectSoft.AI.SoftwareFactory.ModelGatewayHost and ConnectSoft.AI.SoftwareFactory.ToolExecutorHost exist, each first commit is the unchanged output of `dotnet new connectsoft-apigateway -n <name> --UseFactoryProfile true --GatewayRole Platform`, each records the template version, and the template tests pass with the architecture test of the Platform role (ADR-0028 decision 2, model/services/model-compute/ModelGatewayHost.yaml, model/services/tools-mcp/ToolExecutorHost.yaml).",
        "AC3: Given each of the six repositories, when its pipeline runs on the default branch, then it restores from the ConnectSoft feed alone, builds in Release, passes the template tests with complete reports and publishes the container image from the shared steps of AIFACTORY-US-361, and the conformance check of AIFACTORY-US-362 reports no deviation, so that the six rows of the repository list of AIFACTORY-US-1336 carry a green run (ADR-0028, D140)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-047",
        "AIFACTORY-TASK-044",
        "AIFACTORY-TASK-073",
        "AIFACTORY-TASK-076",
        "AIFACTORY-TASK-083",
        "AIFACTORY-TASK-115",
        "AIFACTORY-TASK-6475"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "enabling",
      "traces": {
        "services": [
          "ModelRouterService",
          "ModelGatewayHost",
          "McpServerRegistryService",
          "ToolAdapterService",
          "ToolExecutorHost",
          "QualityScoreService"
        ],
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-api-gateway-template",
        "feature:contracts-package"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/model-compute/ModelGatewayHost.yaml",
        "model/services/tools-mcp/McpServerRegistryService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/tools-mcp/ToolExecutorHost.yaml",
        "model/services/observability/QualityScoreService.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1600]",
      "number": 1600
    },
    {
      "id": "AIFACTORY-TASK-047",
      "type": "task",
      "parent": "AIFACTORY-US-1600",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ModelRouterService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.09.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ModelRouterService and scaffold it from the base template with the Factory profile. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ModelRouterService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name model-router; the repository records that template version and pins the contracts package and the AI library packages; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelRouterService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ModelRouterService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ModelRouterService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name model-router; the repository records that template version and pins the contracts package and the AI library packages; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelRouterService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-047]",
      "number": 47
    },
    {
      "id": "AIFACTORY-TASK-044",
      "type": "task",
      "parent": "AIFACTORY-US-1600",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ModelGatewayHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "17.01.09.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ModelGatewayHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ModelGatewayHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-045 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ModelGatewayHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ModelGatewayHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ModelGatewayHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-045 is written."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ModelGatewayHost"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-044]",
      "number": 44
    },
    {
      "id": "AIFACTORY-TASK-073",
      "type": "task",
      "parent": "AIFACTORY-US-1600",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.McpServerRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.09.03",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.McpServerRegistryService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.McpServerRegistryService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `mcp-server-registry`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.McpServerRegistryService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.McpServerRegistryService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.McpServerRegistryService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `mcp-server-registry`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.McpServerRegistryService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-073]",
      "number": 73
    },
    {
      "id": "AIFACTORY-TASK-076",
      "type": "task",
      "parent": "AIFACTORY-US-1600",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ToolAdapterService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile",
      "sequence": "17.01.09.04",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ToolAdapterService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ToolAdapterService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `tool-adapter`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ToolAdapterService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.ToolAdapterService --UseFactoryProfile true` from the pinned template package is committed with the messaging service name `tool-adapter`, the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-076]",
      "number": 76
    },
    {
      "id": "AIFACTORY-TASK-083",
      "type": "task",
      "parent": "AIFACTORY-US-1600",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.ToolExecutorHost and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the Factory profile and the Platform role",
      "sequence": "17.01.09.05",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.ToolExecutorHost and scaffold it from the ConnectSoft.ApiGatewayTemplate template with the Factory profile and the Platform role. Expected output: The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ToolExecutorHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package is committed, the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolExecutorHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ToolExecutorHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists by the repository checklist of feature repository-and-pipeline-conventions, the output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.ToolExecutorHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package is committed, the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolExecutorHost"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-083]",
      "number": 83
    },
    {
      "id": "AIFACTORY-TASK-115",
      "type": "task",
      "parent": "AIFACTORY-US-1600",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.QualityScoreService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.09.06",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.QualityScoreService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.QualityScoreService --UseFactoryProfile true` from the pinned template package, whose version the repository records; the solution builds and the template tests pass in the repository pipeline, which publishes the container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.QualityScoreService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.QualityScoreService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.QualityScoreService --UseFactoryProfile true` from the pinned template package, whose version the repository records; the solution builds and the template tests pass in the repository pipeline, which publishes the container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.QualityScoreService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-115]",
      "number": 115
    },
    {
      "id": "AIFACTORY-TASK-6475",
      "type": "task",
      "parent": "AIFACTORY-US-1600",
      "title": "Verify the six model compute, tools and quality repositories and their green pipeline runs",
      "sequence": "17.01.09.07",
      "description": "Verify the six model compute, tools and quality repositories and their green pipeline runs. Expected output: The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.ModelRouterService, ConnectSoft.AI.SoftwareFactory.ModelGatewayHost, ConnectSoft.AI.SoftwareFactory.McpServerRegistryService, ConnectSoft.AI.SoftwareFactory.ToolAdapterService, ConnectSoft.AI.SoftwareFactory.ToolExecutorHost and ConnectSoft.AI.SoftwareFactory.QualityScoreService, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for the two gateways), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-044, AIFACTORY-TASK-047, AIFACTORY-TASK-073, AIFACTORY-TASK-076, AIFACTORY-TASK-083 and AIFACTORY-TASK-115 proves AC1 to AC3 of AIFACTORY-US-1600, and `python -I tools/docs_model check` passes with the list in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.ModelRouterService, ConnectSoft.AI.SoftwareFactory.ModelGatewayHost, ConnectSoft.AI.SoftwareFactory.McpServerRegistryService, ConnectSoft.AI.SoftwareFactory.ToolAdapterService, ConnectSoft.AI.SoftwareFactory.ToolExecutorHost and ConnectSoft.AI.SoftwareFactory.QualityScoreService, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for the two gateways), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-044, AIFACTORY-TASK-047, AIFACTORY-TASK-073, AIFACTORY-TASK-076, AIFACTORY-TASK-083 and AIFACTORY-TASK-115 proves AC1 to AC3 of AIFACTORY-US-1600, and `python -I tools/docs_model check` passes with the list in place."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4409,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6475]",
      "number": 6475
    },
    {
      "id": "AIFACTORY-US-1601",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-088",
      "title": "Repository conventions: the first-outcome repositories of the template library are created and scaffolded in I0 by the checklist, each with a green template pipeline",
      "sequence": "17.01.10",
      "description": "As an operator, I want the repositories of BlueprintService, GenerationRecipeService, TemplateRegistryService and TemplateCatalogHost created and scaffolded before increment I1 starts, so that the readiness demonstration of I0 finds the template library repositories built and tested in their own pipelines, and their I1 features start from a scaffold that is known to build. Decision D140 moves the creation of every first-outcome repository into increment I0, so that the first demonstration of I0, which AIFACTORY-US-1336 proves, can pass in I0. This PBI holds the four repositories of the template library plane. The tasks keep the identifiers they had in their I1 features: AIFACTORY-TASK-118 creates ConnectSoft.AI.SoftwareFactory.BlueprintService, AIFACTORY-TASK-125 ConnectSoft.AI.SoftwareFactory.GenerationRecipeService and AIFACTORY-TASK-132 ConnectSoft.AI.SoftwareFactory.TemplateRegistryService, each with `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the base template package at the version the gate of AIFACTORY-US-230 published; AIFACTORY-TASK-509 creates the platform gateway ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost with `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost --UseFactoryProfile true --GatewayRole Platform`, whose template tests include the architecture test of the Platform role. Every repository is created by the steps of the checklist of AIFACTORY-US-360 only after the recorded approval of the owner for its creation, which stays an open row of the register of AIFACTORY-US-379 until the owner gives it. Its first commit is the unchanged scaffold output with the messaging service name of its service file where the service has one, the repository records the template version and the scaffold command, the branch policy is set, and the pipeline of AIFACTORY-US-361 builds it, runs the template tests and publishes the container image from the shared steps with the ConnectSoft feed as the only source. No Factory code is written here: the I1 features `blueprint-service`, `generation-recipe-service`, `template-registry-service` and `template-catalog-host` take each repository as it stands. A repository whose scaffold does not build, whose template tests fail or that the conformance check of AIFACTORY-US-362 reports as deviating is recorded by name and blocks the readiness proof; it is never waived. Kind: enabling. Traces: services: BlueprintService, GenerationRecipeService, TemplateRegistryService, TemplateCatalogHost; adrs: ADR-0028. Depends on: AIFACTORY-US-360, AIFACTORY-US-361, AIFACTORY-US-362, feature:component-base-template-factory-profile, feature:component-base-template-findings, feature:component-api-gateway-template, feature:contracts-package. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/template-library/BlueprintService.yaml, model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/TemplateRegistryService.yaml, model/services/template-library/TemplateCatalogHost.yaml, handoffs/2026-10-09-independent-review/decision-log.md.",
      "acceptanceCriteria": [
        "AC1: Given the recorded approval of the owner for each creation and the checklist of AIFACTORY-US-360, when AIFACTORY-TASK-118, AIFACTORY-TASK-125 and AIFACTORY-TASK-132 run, then ConnectSoft.AI.SoftwareFactory.BlueprintService, ConnectSoft.AI.SoftwareFactory.GenerationRecipeService and ConnectSoft.AI.SoftwareFactory.TemplateRegistryService exist, each first commit is the unchanged output of `dotnet new connectsoft-base -n <name> --UseFactoryProfile true` from the template package the gate of AIFACTORY-US-230 published, and each records that version and the messaging service name of its service file under model/services/template-library (ADR-0028 decision 1, D140).",
        "AC2: Given the pinned API gateway template package, when AIFACTORY-TASK-509 runs, then ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost exists, its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost --UseFactoryProfile true --GatewayRole Platform`, it records the template version, and the template tests pass with the architecture test of the Platform role (ADR-0028 decision 2, model/services/template-library/TemplateCatalogHost.yaml).",
        "AC3: Given each of the four repositories, when its pipeline runs on the default branch, then it restores from the ConnectSoft feed alone, builds in Release, passes the template tests with complete reports and publishes the container image from the shared steps of AIFACTORY-US-361, and the conformance check of AIFACTORY-US-362 reports no deviation, so that the four rows of the repository list of AIFACTORY-US-1336 carry a green run (ADR-0028, D140)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/template-library/TemplateCatalogHost.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-118",
        "AIFACTORY-TASK-125",
        "AIFACTORY-TASK-132",
        "AIFACTORY-TASK-509",
        "AIFACTORY-TASK-6476"
      ],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4410,
      "kind": "enabling",
      "traces": {
        "services": [
          "BlueprintService",
          "GenerationRecipeService",
          "TemplateRegistryService",
          "TemplateCatalogHost"
        ],
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-360",
        "AIFACTORY-US-361",
        "AIFACTORY-US-362",
        "feature:component-base-template-factory-profile",
        "feature:component-base-template-findings",
        "feature:component-api-gateway-template",
        "feature:contracts-package"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/template-library/TemplateCatalogHost.yaml",
        "handoffs/2026-10-09-independent-review/decision-log.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1601]",
      "number": 1601
    },
    {
      "id": "AIFACTORY-TASK-118",
      "type": "task",
      "parent": "AIFACTORY-US-1601",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.BlueprintService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.10.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.BlueprintService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.BlueprintService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name blueprint; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.BlueprintService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.BlueprintService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name blueprint; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4410,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-118]",
      "number": 118
    },
    {
      "id": "AIFACTORY-TASK-125",
      "type": "task",
      "parent": "AIFACTORY-US-1601",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.GenerationRecipeService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.10.02",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.GenerationRecipeService and scaffold it from the base template with the Factory profile. Expected output: The repository exists, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.GenerationRecipeService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name generation-recipe; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.GenerationRecipeService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.GenerationRecipeService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name generation-recipe; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4410,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-125]",
      "number": 125
    },
    {
      "id": "AIFACTORY-TASK-132",
      "type": "task",
      "parent": "AIFACTORY-US-1601",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.TemplateRegistryService and scaffold it from the base template with the Factory profile",
      "sequence": "17.01.10.03",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.TemplateRegistryService and scaffold it from the base template with the Factory profile. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.TemplateRegistryService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name template-registry; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateRegistryService. Verification: dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.TemplateRegistryService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist; the output of `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.TemplateRegistryService --UseFactoryProfile true`, generated from the template package at the version the gate of AIFACTORY-US-230 published, is committed unchanged with the messaging service name template-registry; the repository records that template version and pins the contracts package; the solution builds and the generated tests pass in the repository pipeline, which publishes a container image."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateRegistryService"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4410,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-132]",
      "number": 132
    },
    {
      "id": "AIFACTORY-TASK-509",
      "type": "task",
      "parent": "AIFACTORY-US-1601",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role",
      "sequence": "17.01.10.04",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost and scaffold it from the API gateway template with the Factory profile and the Platform gateway role. Expected output: The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-510 is written.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost. Verification: dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost --UseFactoryProfile true --GatewayRole Platform | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists after the recorded approval of the owner, created by the steps of the repository checklist of feature repository-and-pipeline-conventions; its first commit is the unchanged output of `dotnet new connectsoft-apigateway -n ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost --UseFactoryProfile true --GatewayRole Platform` from the pinned template package, whose version the repository records; the solution builds and the template tests, the architecture test of the Platform role included, pass in the repository pipeline, which publishes the container image; a deviation is corrected in the repository before the fronts file of AIFACTORY-TASK-510 is written."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4410,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-509]",
      "number": 509
    },
    {
      "id": "AIFACTORY-TASK-6476",
      "type": "task",
      "parent": "AIFACTORY-US-1601",
      "title": "Verify the four template library repositories and their green pipeline runs",
      "sequence": "17.01.10.05",
      "description": "Verify the four template library repositories and their green pipeline runs. Expected output: The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.BlueprintService, ConnectSoft.AI.SoftwareFactory.GenerationRecipeService, ConnectSoft.AI.SoftwareFactory.TemplateRegistryService and ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for TemplateCatalogHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-118, AIFACTORY-TASK-125, AIFACTORY-TASK-132 and AIFACTORY-TASK-509 proves AC1 to AC3 of AIFACTORY-US-1601, and `python -I tools/docs_model check` passes with the list in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The repository list of AIFACTORY-US-1336 holds ConnectSoft.AI.SoftwareFactory.BlueprintService, ConnectSoft.AI.SoftwareFactory.GenerationRecipeService, ConnectSoft.AI.SoftwareFactory.TemplateRegistryService and ConnectSoft.AI.SoftwareFactory.TemplateCatalogHost, each with the recorded approval of its creation, its template and template version, the identifier of one green pipeline run on its default branch that restored from the ConnectSoft feed alone, built in Release and passed the template tests (the architecture test of the Platform role for TemplateCatalogHost), and a conformance check with no deviation; the comparison of these rows with AIFACTORY-TASK-118, AIFACTORY-TASK-125, AIFACTORY-TASK-132 and AIFACTORY-TASK-509 proves AC1 to AC3 of AIFACTORY-US-1601, and `python -I tools/docs_model check` passes with the list in place."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 44,
      "phase": "factory",
      "stackRank": 4410,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6476]",
      "number": 6476
    },
    {
      "id": "AIFACTORY-FEAT-089",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Trusted tenant and project scope from the edge to a service",
      "sequence": "17.02",
      "description": "Every call in the Factory carries a tenant and project scope that was established once, at the edge, from a token of the Identity Platform, and no service trusts a scope a caller merely claims. This is the first capability every other one depends on. Increment I0: Readiness. Build order 45 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-363",
        "AIFACTORY-US-364",
        "AIFACTORY-US-365",
        "AIFACTORY-US-001"
      ],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4500,
      "titlePrefix": "[AIFACTORY-FEAT-089]",
      "number": 89
    },
    {
      "id": "AIFACTORY-US-363",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-089",
      "title": "Trusted scope chain: the control plane gateway establishes tenant and project once from the validated token and forwards them to the service it fronts",
      "sequence": "17.02.01",
      "description": "As a platform administrator, I want the first Factory gateway to establish the tenant and the project of a call from the token and from nothing else, so that the service behind it receives a scope it can trust. ADR-0015 decision 2 has every Factory contract carry the trusted tenant id and project id, derived from the authenticated context and never from prompt text or caller-controlled headers. The parts of that chain have owners. The scope type, the single scope accessor, the middleware and message filter that fill it and the names of the Factory token contract live in `ConnectSoft.Extensions.AI.Factory.Abstractions` and are delivered by AIFACTORY-US-220 of feature `component-extensions-ai` (AIFACTORY-TASK-186, AIFACTORY-TASK-142, AIFACTORY-TASK-1173). The validation rules of a generated platform gateway are AIFACTORY-US-237 of feature `component-api-gateway-template`, the service side is AIFACTORY-US-227 of feature `component-base-template-factory-profile`, and the token with its tenant claim, its role claims per project and its one audience is issued as feature `component-auth-server-template-factory-tokens` delivers it. This feature keeps the gateway side of the chain on the first real gateway, and this PBI configures it. It redefines no scope type, no claim name and no header name: it pins the packages. The repository `ConnectSoft.AI.SoftwareFactory.ControlPlaneApi`, created by the checklist of feature `repository-and-pipeline-conventions`, is configured with the authority of the Identity Platform, with its own audience, because a user token has one audience, the gateway that fronts its scopes, and with a fronts file. None of the seven services the gateway fronts exists in this increment, so a probe service generated by the Factory scaffold command stands behind it and the chain ends in a real accessor. On a call the gateway validates the token, takes the tenant from the `tid` claim, overwrites a tenant header the caller sent, admits the project the route addresses only when the token holds a role claim for that project or the tenant-wide Platform admin role, and forwards the tenant in the tenant headers of the SaaS tenancy libraries and the project in the project header the abstractions package names. The user token itself travels with the call: the amendment of ADR-0015 on the forwarded user token (decision D117) decides that a gateway forwards the user token to the service it fronts, that the service accepts the audience of its own gateway and that no token is exchanged between them. The gateway therefore forwards the token unchanged, requests no token exchange and issues no token of its own for a user call, and the probe service is configured with the authority of the Identity Platform and with the audience of the control plane gateway as the one audience it accepts: it validates the forwarded token itself and rejects a user token issued for the audience of another gateway. The probe service reads the scope from the accessor and returns it. The resolution of roles, source scope and policy override of a project through `Projects.ResolveScope` of ProjectService arrives with that service in increment I1 and is no part of this PBI: here the project right is what the role claims of the token grant. The gateway keeps no business state and no copy of a scope, and every refusal is a problem response that is logged with the correlation id and without token content. Kind: enabling. Traces: descriptors: execution-scope-v1; adrs: ADR-0015, ADR-0028; requirements: FR-01. Depends on: feature:component-extensions-ai, feature:component-api-gateway-template, feature:component-base-template-factory-profile, feature:component-auth-server-template-factory-tokens, feature:repository-and-pipeline-conventions. Sources: docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/capability-dependencies.md, docs/reference/schemas/execution-scope.schema.json, model/services/control-plane/ControlPlaneApi.yaml, model/gateways.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the control plane gateway generated with `UseFactoryProfile` and configured with the authority of the Identity Platform and its own audience, when a call with a valid user token of a member of a project passes it to the probe service, then the scope the probe service reads from the accessor of the pinned abstractions package holds the tenant of the `tid` claim and the project the route addresses, and both equal what the token grants (ADR-0015 decision 2, FR-01, descriptor `execution-scope-v1`).",
        "AC2: Given the same call with a tenant header and a project header that the caller typed with other values, when it passes the gateway, then the tenant header is overwritten with the claim of the token, the typed project is never read into the scope, and the probe service sees only the scope the token grants (ADR-0015 decision 2; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC3: Given the gateway repository, when its architecture test inspects its references and types, then the scope type, the accessor, the claim type names and the project header name come from the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions`, the tenant header names come from the SaaS tenancy libraries, the repository declares none of them, and the gateway owns no store beside the shared cache (ADR-0028 decisions 2 and 7; model/services/control-plane/ControlPlaneApi.yaml).",
        "AC4: Given a call with a valid user token that passed the gateway, when the probe service receives it, then the request carries the user token the caller sent, unchanged, the probe service validates it against the authority and accepts it because the one audience it accepts is the audience of the control plane gateway, the gateway requested no token exchange and issued no token of its own for the call, and a user token issued for the audience of another gateway that is sent to the probe service directly is rejected with 401 (ADR-0015 amendment on the forwarded user token; model/services/control-plane/ControlPlaneApi.yaml names the gateway and what it fronts)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "docs/reference/schemas/execution-scope.schema.json",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-187",
        "AIFACTORY-TASK-1515",
        "AIFACTORY-TASK-1516"
      ],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4501,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-extensions-ai",
        "feature:component-api-gateway-template",
        "feature:component-base-template-factory-profile",
        "feature:component-auth-server-template-factory-tokens",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/capability-dependencies.md",
        "docs/reference/schemas/execution-scope.schema.json",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/gateways.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-363]",
      "number": 363
    },
    {
      "id": "AIFACTORY-TASK-187",
      "type": "task",
      "parent": "AIFACTORY-US-363",
      "title": "Gateway establishes the scope from the token and the project membership",
      "sequence": "17.02.01.01",
      "description": "Gateway establishes the scope from the token and the project membership. Expected output: The control plane gateway, generated from the API gateway template with `UseFactoryProfile`, is configured with the authority of the Identity Platform, its own audience and a fronts file that routes to the probe service; it establishes the scope from the validated token (the tenant from the `tid` claim, the project from the role claims), forwards it in the tenant headers of the SaaS tenancy libraries and in the project header of the pinned Factory abstractions package, forwards the user token unchanged to the service it fronts without a token exchange, and answers every refusal with a problem response; the resolution through ProjectService is not part of this task and arrives in I1.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The control plane gateway, generated from the API gateway template with `UseFactoryProfile`, is configured with the authority of the Identity Platform, its own audience and a fronts file that routes to the probe service; it establishes the scope from the validated token (the tenant from the `tid` claim, the project from the role claims), forwards it in the tenant headers of the SaaS tenancy libraries and in the project header of the pinned Factory abstractions package, forwards the user token unchanged to the service it fronts without a token exchange, and answers every refusal with a problem response; the resolution through ProjectService is not part of this task and arrives in I1."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-187]",
      "number": 187
    },
    {
      "id": "AIFACTORY-TASK-1515",
      "type": "task",
      "parent": "AIFACTORY-US-363",
      "title": "Probe service and test token issuer in the acceptance suite of the gateway",
      "sequence": "17.02.01.02",
      "description": "Probe service and test token issuer in the acceptance suite of the gateway. Expected output: The acceptance suite of the gateway repository hosts a probe service generated by `dotnet new connectsoft-base` with `UseFactoryProfile`, with one read endpoint that returns the scope of the accessor, one resource by identifier in each of two tenants and one command that changes state and publishes an event; tokens are signed by the test issuer of the generated suite with the claim type names of the pinned Factory abstractions package; the probe service is configured with that issuer as its authority and with the audience of the control plane gateway as the one audience it accepts; the probe service uses a throwaway database of the pipeline container of the generated acceptance suite, and no named or shared database is touched.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The acceptance suite of the gateway repository hosts a probe service generated by `dotnet new connectsoft-base` with `UseFactoryProfile`, with one read endpoint that returns the scope of the accessor, one resource by identifier in each of two tenants and one command that changes state and publishes an event; tokens are signed by the test issuer of the generated suite with the claim type names of the pinned Factory abstractions package; the probe service is configured with that issuer as its authority and with the audience of the control plane gateway as the one audience it accepts; the probe service uses a throwaway database of the pipeline container of the generated acceptance suite, and no named or shared database is touched."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4501,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1515]",
      "number": 1515
    },
    {
      "id": "AIFACTORY-TASK-1516",
      "type": "task",
      "parent": "AIFACTORY-US-363",
      "title": "Verify the carried scope and the pinned definitions",
      "sequence": "17.02.01.03",
      "description": "Verify the carried scope and the pinned definitions. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` on the gateway solution; the carried-scope test, the typed-header test, the forwarded-token test with its rejection of a token for another audience and the architecture test over the pinned packages pass and prove AC1 to AC4 of AIFACTORY-US-363 (ADR-0015, FR-01).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` on the gateway solution; the carried-scope test, the typed-header test, the forwarded-token test with its rejection of a token for another audience and the architecture test over the pinned packages pass and prove AC1 to AC4 of AIFACTORY-US-363 (ADR-0015, FR-01)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1516]",
      "number": 1516
    },
    {
      "id": "AIFACTORY-US-364",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-089",
      "title": "Trusted scope chain: the scope established at the edge travels in the run event envelope and the handler of another service reads the same tenant and project",
      "sequence": "17.02.02",
      "description": "As a platform administrator, I want the scope of a call to reach the handler of an event that the call caused, so that work done after the request ended is still attributed to the tenant and project of the caller. A call does not end at the first service. ADR-0014 decision 1 makes the trusted tenant id required and the project id required where applicable in the port-level envelope of every Factory integration event; the schema requires the tenant and leaves the project optional. The amendment of the ADR on envelopes per event family settles which envelope that is: a Factory service writes the run event envelope of the contracts package, the descriptor `run-event-envelope-v1`, and `AgentEventEnvelope` of the Factory messaging library carries agent lifecycle events only. This PBI proves the second half of the chain across two processes, and only what the chain alone can prove. The two probe services are the output of the pinned base template: nothing of the generated outbox, inbox, tenant row filter, message filter or scope middleware is edited, and the probes add only the endpoint that returns the scope, the command that publishes one event and the handler that records the scope it read. The behaviours of that generated code are proven on the generated solution of the template and are not proven a second time here: the outbox record in the transaction of the command and the absence of an event after a rollback are the gate of AIFACTORY-US-226, and the refusal of an envelope without a tenant, the tenant-only scope of a tenant-level event and the refusal by a handler that declares itself project-scoped are AIFACTORY-US-227. What is left for the chain is the value. The probe service behind the gateway handles a command under a token of one tenant and project and publishes an event; the envelope takes `tenantId` and `projectId` from the scope accessor, never from the payload and never from a header. A second probe service consumes the event over the Orleans messaging profile, the message filter of the pinned abstractions package fills the accessor from the envelope, and the handler reads the same tenant and project that the token of the original call granted when it passed the gateway. The trace id of the envelope stays diagnostic and is never read as a scope. This PBI adds no envelope field, no filter and no scope type: the acceptance solution pins the published contracts package and the published abstractions package from the ConnectSoft feed, and an architecture test fails on a local copy of either. Each probe service uses a throwaway database of the pipeline container of the generated acceptance suite; no named or shared database is touched. Kind: enabling. Traces: descriptors: run-event-envelope-v1, execution-scope-v1; adrs: ADR-0014, ADR-0015. Depends on: AIFACTORY-US-363, feature:contracts-package, feature:component-extensions-ai, feature:component-base-template-factory-profile. Sources: docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/reference/event-envelope.md, docs/reference/schemas/run-event-envelope.schema.json, model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the two probe services of the acceptance solution, when their generated files are compared with a fresh generation from the pinned base template package, then the generated outbox, inbox, tenant row filter, message filter and scope middleware are unchanged, the probes add only the scope endpoint, the publishing command and the recording handler, and the chain test asserts only the scope values end to end, because the outbox commit and the scope refusals of the generated service are gated by AIFACTORY-US-226 and AIFACTORY-US-227 of feature `component-base-template-factory-profile` (ADR-0014 decision 4; model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml).",
        "AC2: Given a command that reaches the first probe service through the gateway under a token of one tenant and project and publishes an event under `run-event-envelope-v1`, when the event is delivered to the second probe service and its handler runs, then the accessor returns the tenant and the project of the token of the original call that passed the gateway, read from the envelope and not from the payload, and the trace id of the envelope is not used as a scope (ADR-0014 decision 1, ADR-0015 decision 2).",
        "AC3: Given the acceptance solution of the gateway repository, when its architecture test runs, then the envelope type is the one of the pinned contracts package, the message filter and the accessor are those of the pinned abstractions package, both are restored from the ConnectSoft feed without a project reference, and the solution declares no envelope and no scope type of its own (ADR-0014 amendment on envelopes per event family; descriptor `run-event-envelope-v1`)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1517",
        "AIFACTORY-TASK-1518",
        "AIFACTORY-TASK-1519"
      ],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4502,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-363",
        "feature:contracts-package",
        "feature:component-extensions-ai",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/backlog/pbis/component-extensions/component-base-template-factory-profile.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-364]",
      "number": 364
    },
    {
      "id": "AIFACTORY-TASK-1517",
      "type": "task",
      "parent": "AIFACTORY-US-364",
      "title": "Publishing command and consuming handler of the two probe services",
      "sequence": "17.02.02.01",
      "description": "Publishing command and consuming handler of the two probe services. Expected output: The probe service of AIFACTORY-TASK-1515 publishes one event from its command under the run event envelope of the pinned contracts package through the generated outbox, which is not edited; a second probe service, generated by the same scaffold command, consumes it over the Orleans messaging profile and records the scope its handler read from the accessor; each probe service uses a throwaway database of the pipeline container of the generated acceptance suite, created and dropped by the run, and no named or shared database is touched.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The probe service of AIFACTORY-TASK-1515 publishes one event from its command under the run event envelope of the pinned contracts package through the generated outbox, which is not edited; a second probe service, generated by the same scaffold command, consumes it over the Orleans messaging profile and records the scope its handler read from the accessor; each probe service uses a throwaway database of the pipeline container of the generated acceptance suite, created and dropped by the run, and no named or shared database is touched."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1517]",
      "number": 1517
    },
    {
      "id": "AIFACTORY-TASK-1518",
      "type": "task",
      "parent": "AIFACTORY-US-364",
      "title": "Pins of the contracts package and the abstractions package in the acceptance solution",
      "sequence": "17.02.02.02",
      "description": "Pins of the contracts package and the abstractions package in the acceptance solution. Expected output: The acceptance solution of the gateway repository pins the published versions of the contracts package and of `ConnectSoft.Extensions.AI.Factory.Abstractions` in its central package file, restores them from the ConnectSoft feed without a project reference, and an architecture test fails when the solution declares an envelope type, a scope type or a message filter of its own; a second test generates a service from the pinned base template package and fails when a generated file of a probe service differs from it.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The acceptance solution of the gateway repository pins the published versions of the contracts package and of `ConnectSoft.Extensions.AI.Factory.Abstractions` in its central package file, restores them from the ConnectSoft feed without a project reference, and an architecture test fails when the solution declares an envelope type, a scope type or a message filter of its own; a second test generates a service from the pinned base template package and fails when a generated file of a probe service differs from it."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4502,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1518]",
      "number": 1518
    },
    {
      "id": "AIFACTORY-TASK-1519",
      "type": "task",
      "parent": "AIFACTORY-US-364",
      "title": "Verify the scope in the envelope and in the handler",
      "sequence": "17.02.02.03",
      "description": "Verify the scope in the envelope and in the handler. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` on the gateway solution; the comparison of the probe services with the output of the pinned template, the scope the handler of the second process read and the architecture test pass and prove AC1 to AC3 of AIFACTORY-US-364 (ADR-0014, ADR-0015).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` on the gateway solution; the comparison of the probe services with the output of the pinned template, the scope the handler of the second process read and the architecture test pass and prove AC1 to AC3 of AIFACTORY-US-364 (ADR-0014, ADR-0015)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1519]",
      "number": 1519
    },
    {
      "id": "AIFACTORY-US-365",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-089",
      "title": "Trusted scope chain: the running gateway refuses a missing token or right with 401 or 403 before any service is called, and a resource of another tenant is answered 404 by the service",
      "sequence": "17.02.03",
      "description": "As a platform administrator, I want proof that every call the token does not grant gets the decided answer, from the running gateway or from the tenant filter of the service behind it, so that no service ever acts on a scope a caller merely claims. This PBI is the proof of the feature and of the readiness demonstration that a request without scope is refused. The cases are run through a running control plane gateway with the running probe service behind it, not against a mock of either, and each one asserts two things: the answer, and what the probe service recorded. A call the gateway admits reaches the probe service with the user token of the caller, forwarded unchanged and accepted by the service for the audience of its gateway, with no token exchange between the two (ADR-0015 amendment on the forwarded user token, decision D117), which AIFACTORY-US-363 proves. The answers are the decided ones, and who gives them differs. The gateway refuses before any service is called. A call without a token, with an expired token, with an identity token or with a user token issued for the audience of another gateway is answered 401. A valid token that lacks the scope the operation names, or a route that addresses a project for which the token holds no role claim while the token is not Platform admin, is answered 403: a missing scope or right inside the tenant of the caller. For each of these the probe service records no call. A resource of another tenant has two cases with two owners. Case a: a route that addresses another tenant by its tenant identifier is answered 404 by the gateway and nothing is forwarded, as AIFACTORY-US-237 generates it. Case b: a request for a resource identifier that belongs to another tenant cannot be refused by the gateway, which owns no business state and cannot know the tenant of a resource identifier (ADR-0028 decisions 2 and 7). It is forwarded under the tenant of the caller, the tenant row filter of the probe service, which AIFACTORY-US-227 generates, finds no row, and the probe service answers 404 with the same body as an identifier that does not exist, over gRPC with the status NOT_FOUND, as the amendment of ADR-0015 decides (decisions D113 and D114). The response never confirms that the resource exists, and the probe service records exactly one call, under the tenant of the caller. A tenant header typed by the caller is overwritten and never decides anything. A workload token carries service scopes, no audience of a user API and no tenant claim: it is admitted only on a route whose operation names an `svc.` scope the token holds, and the tenant and project it forwards are read only under that scope. When the authority of the Identity Platform cannot be reached, the gateway fails closed: tokens whose signing keys are cached validate until they expire and every other call is refused, as the failure mode of the gateway in the model states. Every refusal is counted for its route and logged with the correlation id and without token content. The matrix feature and the test issuer are the ones the pinned API gateway template generated; they are kept unchanged, and this PBI adds only the rows the template cannot hold. The run of the matrix in the pipeline of the gateway repository is the evidence. Kind: evidence. Traces: descriptors: execution-scope-v1; adrs: ADR-0015, ADR-0028; requirements: FR-01. Depends on: AIFACTORY-US-363, feature:component-api-gateway-template, feature:component-base-template-factory-profile, feature:component-auth-server-template-factory-tokens. Sources: docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/control-plane/ControlPlaneApi.yaml, model/backlog/increments.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the running gateway and probe service, when a call arrives without a token, with an expired token, with an identity token or with a user token whose audience is another gateway, then the answer is 401 and the probe service records no call (ADR-0015 amendment on the one audience of a user token; ADR-0028 decision 2).",
        "AC2: Given a valid user token, when the token lacks the scope the operation names, or the route addresses a project for which the token holds no role claim and the token is not Platform admin, then the answer is 403, a tenant or project header typed by the caller changes nothing, and the probe service records no call (ADR-0015 decisions 2 and 3, FR-01).",
        "AC3: Given two tenants with one resource each in the probe service, when a caller of the first tenant addresses the second tenant by its tenant identifier in a route, then the gateway answers 404, over gRPC NOT_FOUND, and the probe service records no call; and when the caller requests the identifier of the resource of the second tenant over REST and over gRPC, then the call is forwarded under the tenant of the caller, the tenant row filter of the probe service finds no row, the probe service answers 404 with the same body as for an identifier that does not exist, over gRPC the status NOT_FOUND, the probe service records one call under the tenant of the caller, and the response does not confirm that the resource exists (ADR-0015 amendment on a resource of another tenant; ADR-0028 decisions 2 and 7; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC4: Given a workload token, which carries service scopes, no audience of a user API and no tenant claim, when it calls a route whose operation names an `svc.` scope it holds, then the call is admitted and the forwarded tenant and project are read under that scope; when it calls any other route, or forwards a tenant without holding the scope, then the call is refused and the probe service records no call (ADR-0015 amendment on the workload token; descriptor `execution-scope-v1`).",
        "AC5: Given the authority of the Identity Platform is unreachable, when calls arrive, then a token whose signing key is cached validates until it expires, every other call is refused, the health of the gateway reports the authority, and each refusal of the matrix is counted for its route and logged with the correlation id and without token content (ADR-0028 decision 7; model/services/control-plane/ControlPlaneApi.yaml lists the failure mode)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1520",
        "AIFACTORY-TASK-143",
        "AIFACTORY-TASK-1521"
      ],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4503,
      "kind": "evidence",
      "traces": {
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-363",
        "feature:component-api-gateway-template",
        "feature:component-base-template-factory-profile",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/backlog/increments.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-365]",
      "number": 365
    },
    {
      "id": "AIFACTORY-TASK-1520",
      "type": "task",
      "parent": "AIFACTORY-US-365",
      "title": "Rows added to the generated refusal matrix for the running probe service, the foreign tenant and the unreachable authority",
      "sequence": "17.02.03.01",
      "description": "Rows added to the generated refusal matrix for the running probe service, the foreign tenant and the unreachable authority. Expected output: The matrix feature and the test issuer that the pinned API gateway template generated (third task of AIFACTORY-US-237) are kept unchanged in the acceptance suite of the gateway repository; this task adds only the rows the template cannot hold: the running probe service in place of the fake fronted service with the recorded-call expectation (no recorded call for 401, for 403 and for a route that addresses another tenant by its tenant identifier; one recorded call under the tenant of the caller for 200 and for a resource identifier of another tenant, which the probe service answers 404 or NOT_FOUND), the resource of another tenant over REST and gRPC, and the unreachable authority with a cached and an uncached signing key; a gap found in the generated matrix is reported to feature `component-api-gateway-template` and not patched here.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The matrix feature and the test issuer that the pinned API gateway template generated (third task of AIFACTORY-US-237) are kept unchanged in the acceptance suite of the gateway repository; this task adds only the rows the template cannot hold: the running probe service in place of the fake fronted service with the recorded-call expectation (no recorded call for 401, for 403 and for a route that addresses another tenant by its tenant identifier; one recorded call under the tenant of the caller for 200 and for a resource identifier of another tenant, which the probe service answers 404 or NOT_FOUND), the resource of another tenant over REST and gRPC, and the unreachable authority with a cached and an uncached signing key; a gap found in the generated matrix is reported to feature `component-api-gateway-template` and not patched here."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4503,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1520]",
      "number": 1520
    },
    {
      "id": "AIFACTORY-TASK-143",
      "type": "task",
      "parent": "AIFACTORY-US-365",
      "title": "Refusal tests for missing and forged scope",
      "sequence": "17.02.03.02",
      "description": "Refusal tests for missing and forged scope. Expected output: Acceptance tests through the running gateway prove that a call without a token, a call with a scope or a project the token does not grant and a call with a typed tenant or project header are refused with 401 or 403 and reach no service, which proves AC1 and AC2 of AIFACTORY-US-365 (ADR-0015, FR-01).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Acceptance tests through the running gateway prove that a call without a token, a call with a scope or a project the token does not grant and a call with a typed tenant or project header are refused with 401 or 403 and reach no service, which proves AC1 and AC2 of AIFACTORY-US-365 (ADR-0015, FR-01)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-143]",
      "number": 143
    },
    {
      "id": "AIFACTORY-TASK-1521",
      "type": "task",
      "parent": "AIFACTORY-US-365",
      "title": "Verify the foreign tenant, the workload token and the unreachable authority",
      "sequence": "17.02.03.03",
      "description": "Verify the foreign tenant, the workload token and the unreachable authority. Expected output: Run the generated matrix with the rows of AIFACTORY-TASK-1520 in the pipeline of the gateway repository; the row for a route that addresses another tenant answers 404 from the gateway with no recorded call, the rows for a resource identifier of another tenant over REST and gRPC answer 404 and NOT_FOUND from the probe service with one recorded call under the tenant of the caller, and the rows for the workload token with and without its `svc.` scope and for the unreachable authority answer as stated, with the refusal counter and the log line asserted, which proves AC3 to AC5 of AIFACTORY-US-365 (ADR-0015, ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run the generated matrix with the rows of AIFACTORY-TASK-1520 in the pipeline of the gateway repository; the row for a route that addresses another tenant answers 404 from the gateway with no recorded call, the rows for a resource identifier of another tenant over REST and gRPC answer 404 and NOT_FOUND from the probe service with one recorded call under the tenant of the caller, and the rows for the workload token with and without its `svc.` scope and for the unreachable authority answer as stated, with the refusal counter and the log line asserted, which proves AC3 to AC5 of AIFACTORY-US-365 (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1521]",
      "number": 1521
    },
    {
      "id": "AIFACTORY-US-001",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-089",
      "title": "A call carries a trusted scope from the edge to a service",
      "sequence": "17.02.04",
      "description": "As a platform administrator, I want every call to carry a tenant and project scope that was established once from the token of the caller, so that no service ever acts on a scope a caller merely claims. This is the integration PBI of the feature. A platform administrator sees one call chain carry a trusted scope from the edge to a service and on into an event handler, which is the second demonstration of increment I0. The scope type, the accessor with its middleware and the Factory token contract names are not defined here: they live in `ConnectSoft.Extensions.AI.Factory.Abstractions` and are delivered by AIFACTORY-US-220 of feature `component-extensions-ai`, which this PBI depends on. The feature keeps the gateway side and its refusal tests. AIFACTORY-US-363 configures the control plane gateway so that it establishes tenant and project once from the validated token and forwards them together with the user token itself, which the fronted service accepts for the audience of its gateway, with no token exchange between the two (ADR-0015 amendment on the forwarded user token, decision D117); AIFACTORY-US-364 carries the scope in the run event envelope of the contracts package to the handler of a second service; AIFACTORY-US-365 proves through the running gateway that a call the token does not grant is answered 401 or, inside the tenant of the caller, 403 before any service is called, and that a resource of another tenant is answered 404, NOT_FOUND over gRPC, by the tenant row filter of the service, which is called under the tenant of the caller and finds no row. Those three PBIs sign their tokens with the test issuer of the generated suite. What this PBI adds is the real issuer. The acceptance stage of the repository `ConnectSoft.AI.SoftwareFactory.ControlPlaneApi` starts a local authorization server generated from `connectsoft-authorization-server` at the version the gate of feature `component-auth-server-template-factory-tokens` published, with one registered client, one tenant, one project and one member, and runs one carried call and one refused call with tokens of that server through the gateway, a probe service and its consumer. The matrix of refusals stays with AIFACTORY-US-365 and is not repeated here. The seven services the gateway fronts arrive from increment I1 on and take the chain as it is proven here; the resolution of roles, source scope and policy override through ProjectService arrives with that service and adds to the chain without changing who establishes the scope. Kind: enabling. Traces: descriptors: execution-scope-v1, run-event-envelope-v1; adrs: ADR-0015, ADR-0014; requirements: FR-01. Depends on: AIFACTORY-US-363, AIFACTORY-US-364, AIFACTORY-US-365, feature:component-extensions-ai, feature:component-auth-server-template-factory-tokens. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, model/backlog/increments.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a valid token of the local authorization server with membership in a project, when a request passes the gateway, then the service reads tenant and project from the scope accessor and they equal those of the token, and the service received that user token forwarded by the gateway and accepted it for the audience of its gateway (ADR-0015 decision 2 and its amendment on the forwarded user token, FR-01, descriptor `execution-scope-v1`).",
        "AC2: Given a request without a token or with a project the token does not grant, when it reaches the gateway, then it is refused with 401 or 403 and no service is called, and a request for a resource identifier of another tenant is answered 404, over gRPC NOT_FOUND, by the service, which is called under the tenant of the caller and finds no row (ADR-0015 decision 3 and its amendment on a resource of another tenant).",
        "AC3: Given a service publishes an event, when another service handles it, then the handler sees the same tenant and project in the envelope `run-event-envelope-v1` and reads them from the scope accessor (ADR-0014 decision 1)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1566",
        "AIFACTORY-TASK-188",
        "AIFACTORY-TASK-718"
      ],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4504,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "execution-scope-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0014"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-363",
        "AIFACTORY-US-364",
        "AIFACTORY-US-365",
        "feature:component-extensions-ai",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "model/backlog/increments.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-001]",
      "number": 1
    },
    {
      "id": "AIFACTORY-TASK-1566",
      "type": "task",
      "parent": "AIFACTORY-US-001",
      "title": "Local authorization server of the acceptance stage with one client, tenant, project and member",
      "sequence": "17.02.04.01",
      "description": "Local authorization server of the acceptance stage with one client, tenant, project and member. Expected output: The acceptance stage of the gateway repository generates a local authorization server from `connectsoft-authorization-server` at the version the gate of feature `component-auth-server-template-factory-tokens` published, into a working folder of the pipeline that is not committed, and starts it with one registered client, one tenant, one project and one member whose token carries the tenant claim and a role claim for the project; the generated output is used unchanged, its clients work only in Development (AIFACTORY-US-245), its store is a throwaway database of the pipeline container, and no named or shared database is touched.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "The acceptance stage of the gateway repository generates a local authorization server from `connectsoft-authorization-server` at the version the gate of feature `component-auth-server-template-factory-tokens` published, into a working folder of the pipeline that is not committed, and starts it with one registered client, one tenant, one project and one member whose token carries the tenant claim and a role claim for the project; the generated output is used unchanged, its clients work only in Development (AIFACTORY-US-245), its store is a throwaway database of the pipeline container, and no named or shared database is touched."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1566]",
      "number": 1566
    },
    {
      "id": "AIFACTORY-TASK-188",
      "type": "task",
      "parent": "AIFACTORY-US-001",
      "title": "Acceptance tests for a carried and a refused scope with tokens of the authorization server",
      "sequence": "17.02.04.02",
      "description": "Acceptance tests for a carried and a refused scope with tokens of the authorization server. Expected output: Two acceptance tests of one chain pass in the pipeline of the gateway repository with tokens of the local authorization server of AIFACTORY-TASK-1566: one carried call, whose scope travels from the token through the gateway and the probe service into the handler of its consumer and whose user token the probe service receives forwarded and accepts for the audience of the gateway, and one refused call for a project the token does not grant, which is answered 403 and reaches no service; the matrix of refusals stays with AIFACTORY-US-365 and is not repeated here, which proves AC1 to AC3 of AIFACTORY-US-001 together with the matrix run of AIFACTORY-TASK-1521.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Two acceptance tests of one chain pass in the pipeline of the gateway repository with tokens of the local authorization server of AIFACTORY-TASK-1566: one carried call, whose scope travels from the token through the gateway and the probe service into the handler of its consumer and whose user token the probe service receives forwarded and accepts for the audience of the gateway, and one refused call for a project the token does not grant, which is answered 403 and reaches no service; the matrix of refusals stays with AIFACTORY-US-365 and is not repeated here, which proves AC1 to AC3 of AIFACTORY-US-001 together with the matrix run of AIFACTORY-TASK-1521."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-188]",
      "number": 188
    },
    {
      "id": "AIFACTORY-TASK-718",
      "type": "task",
      "parent": "AIFACTORY-US-001",
      "title": "Verify scope-end-to-end by running the declared command",
      "sequence": "17.02.04.03",
      "description": "Verify scope-end-to-end by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance`; it passes and proves AC1 to AC3 of AIFACTORY-US-001.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ControlPlaneApi.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance`; it passes and proves AC1 to AC3 of AIFACTORY-US-001."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ControlPlaneApi"
      ],
      "children": [],
      "buildOrder": 45,
      "phase": "factory",
      "stackRank": 4504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-718]",
      "number": 718
    },
    {
      "id": "AIFACTORY-FEAT-090",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Contracts package from the published schemas",
      "sequence": "17.03",
      "description": "The run envelope, the topic names, the descriptors and the JSON schemas of this repository are published as one versioned contracts package, so that two services never copy a contract. Increment I0: Readiness. Build order 1 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-366",
        "AIFACTORY-US-367",
        "AIFACTORY-US-368",
        "AIFACTORY-US-369",
        "AIFACTORY-US-095"
      ],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 100,
      "titlePrefix": "[AIFACTORY-FEAT-090]",
      "number": 90
    },
    {
      "id": "AIFACTORY-US-366",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-090",
      "title": "Contracts package: the contract types are generated at build from the published JSON schemas of this repository and stamped with the hash of each schema",
      "sequence": "17.03.01",
      "description": "As a platform admin, I want every contract type of the Factory to be generated from the schema file this repository publishes, so that two services never copy a contract and a schema change cannot pass unnoticed. The feature publishes the run envelope, the topic names, the descriptors and the JSON schemas of this repository as one versioned package, so that two services never copy a contract. This PBI delivers the types. The repository `ConnectSoft.AI.SoftwareFactory.Contracts` is scaffolded from the library template with the Factory scaffold command, `dotnet new connectsoft-library -n ConnectSoft.AI.SoftwareFactory.Contracts --UseFactoryProfile true`; the feature `component-library-template-factory-profile` delivers that profile, the generation manifest and the generated pipeline, and this PBI depends on it. The source of every type is a schema file under docs/reference/schemas that model/descriptors.yaml registers under a descriptor id. How the files reach the Contracts repository is stated and not assumed: an intake folder of that repository holds a copy of each schema file and one JSON document of the events of the service files, an intake file records the revision of this repository they were taken from and the content hash of each schema file and of the event list, and one documented command refreshes the intake from a checkout of this repository, so that a .NET build reads only files of its own repository. The package embeds the schema files of the intake and generates at build one contract type per descriptor whose schema file defines its shape: the run submission, the run event envelope, the approval request and decision, the artifact, the blueprint version reference, the readiness bundle, the execution scope, the attempt outcome, the policy decision, the tool and model invocations with their receipts, the usage record and the blueprint descriptors. No type is written by hand. Seven descriptors are registered on a schema file that does not define their shape and are not generated: `run-accepted-v1` and `run-ref-v1` on the file of the run submission, which has one object, `run-view-v1` and `run-list-v1` on the file of the resolved execution snapshot, `run-event-v1` on the file of the envelope, and `approval-ref-v1` and `approval-list-v1` on the approval file, which defines the request and the decision only. The package lists them as not generated. Whether their definitions are added to the schema files or they stay out of the first package version is an open question for the owner, and this PBI decides neither shape. The approval file is also behind the model: its `state` enumeration lacks ChangesRequested (decision D113) and the request lacks `onExpiry` and `reRequestsLeft` (decision D115) while it admits no additional property, so a generated type would refuse a valid approval. A documentation task in this repository brings the file up to the model before the first version of the package is published, so no published descriptor version changes. A stamp in the package records, per descriptor, the schema file and its content hash. A test fails when a schema file of the intake differs from its stamp while the package version is unchanged, and a stage of the pipeline refreshes the intake from a checkout of this repository and fails when a refreshed hash differs from the stamp under an unchanged package version, which is what notices that this repository moved on. Required and optional follow the schema: `run-submission-v1` has an optional `environmentId` (decision D114), so the generated type carries it as an optional member and a run submitted without it is never gated by an environment. Decision D117 adds three such cases, and the types follow the schema files in each. The usage record of `usage-record-v1` meters model tokens as two meters, `model.input-tokens` and `model.output-tokens`, each with a price of its own, and requires neither `quantity` nor `runId` nor `pricingRevision`, so a record with the status uncertain is built without a quantity and without a run and is priced or reconciled later. The approval request of `approval-request-v1` leaves `stepId`, `leaseId` and `fencingToken` optional, so a run-level spend approval, which gates no step, is built without them. A document that validates against its schema deserialises into its type and serialises back to an equivalent document, and a document that misses a required field is refused with the field named. Versioning follows ADR-0014 decision 6: a new field arrives in a new version, and a change that removes or renames a field or adds a required one under an existing descriptor version fails the compatibility test, because it needs a descriptor version of its own. The package references no service, no transport and no host; a consumer pins it and validates at run time against the very schema file the type was generated from. Kind: enabling. Traces: descriptors: run-submission-v1, run-event-envelope-v1, approval-request-v1, artifact-v1, blueprint-version-ref-v1, readiness-bundle-v1, execution-scope-v1, usage-record-v1; adrs: ADR-0014, ADR-0028. Depends on: feature:component-library-template-factory-profile. Sources: docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, docs/reference/schemas/index.md, docs/reference/schemas/run-submission.schema.json, docs/reference/schemas/approval.schema.json, docs/reference/schemas/usage-record.schema.json, model/descriptors.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the schema files that model/descriptors.yaml registers, when the package builds, then one contract type exists for each descriptor whose schema file defines its shape, the run submission, the run event envelope, the approval request and decision, the artifact, the blueprint version reference and the readiness bundle among them, each generated from its schema file and none written by hand; the stamp of the package records the schema file and its content hash per descriptor; and `run-accepted-v1`, `run-ref-v1`, `run-view-v1`, `run-list-v1`, `run-event-v1`, `approval-ref-v1` and `approval-list-v1`, for which the schema file they are registered on defines no shape, are listed by the package as not generated (ADR-0014; docs/reference/schemas/index.md).",
        "AC2: Given the descriptor `run-submission-v1`, when its type is generated, then `environmentId` is an optional member: a submission without it serialises without the member and validates against docs/reference/schemas/run-submission.schema.json, and a submission with it round-trips unchanged.",
        "AC3: Given one stored sample document per descriptor whose schema file defines its shape, when it is deserialised into its generated type and serialised again, then the result validates against the embedded schema file and equals the sample, and a document that misses a required field is refused with the field named (descriptors `run-submission-v1`, `approval-request-v1`, `artifact-v1`, `blueprint-version-ref-v1` and `readiness-bundle-v1` are among the samples); a usage record of `usage-record-v1` with the status uncertain and without `quantity`, `runId` and `pricingRevision` round-trips, and its `meter` admits `model.input-tokens` and `model.output-tokens` as two meters, as docs/reference/schemas/usage-record.schema.json states them.",
        "AC4: Given a schema file of the intake whose content hash differs from the stamp of the package, when the tests run under an unchanged package version, then the stamp test fails with the descriptor named; given the intake refreshed from a checkout of this repository, when a refreshed hash of a schema file or of the event list differs from the stamp under an unchanged package version, then the pipeline fails; and given a change that removes or renames a field or adds a required one under an existing descriptor version, then the compatibility test fails, because ADR-0014 decision 6 admits new fields only in a new version.",
        "AC5: Given docs/reference/schemas/approval.schema.json after the documentation task, when the approval types are generated, then the `state` of the request admits ChangesRequested and the request carries `onExpiry` and `reRequestsLeft` as model/services/control-plane/RunControlService.yaml states them, a sample approval in the state ChangesRequested round-trips, a run-level spend approval without `stepId`, `leaseId` and `fencingToken` round-trips, and `python -I tools/docs_model check` passes (descriptor `approval-request-v1`)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/reference/schemas/index.md",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/usage-record.schema.json",
        "model/descriptors.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1522",
        "AIFACTORY-TASK-144",
        "AIFACTORY-TASK-1567",
        "AIFACTORY-TASK-1568",
        "AIFACTORY-TASK-1523"
      ],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 101,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-submission-v1",
          "run-event-envelope-v1",
          "approval-request-v1",
          "artifact-v1",
          "blueprint-version-ref-v1",
          "readiness-bundle-v1",
          "execution-scope-v1",
          "usage-record-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-library-template-factory-profile"
      ],
      "source": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/reference/schemas/index.md",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "docs/reference/schemas/usage-record.schema.json",
        "model/descriptors.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-366]",
      "number": 366
    },
    {
      "id": "AIFACTORY-TASK-1522",
      "type": "task",
      "parent": "AIFACTORY-US-366",
      "title": "Scaffold the contracts repository from the library template with the Factory profile",
      "sequence": "17.03.01.01",
      "description": "Scaffold the contracts repository from the library template with the Factory profile. Expected output: The repository `ConnectSoft.AI.SoftwareFactory.Contracts` holds the unchanged output of `dotnet new connectsoft-library -n ConnectSoft.AI.SoftwareFactory.Contracts --UseFactoryProfile true` with the template package restored from the ConnectSoft feed; the solution builds, its template tests pass, the generation manifest records the template version and the parameter values, and the generated pipeline names the ConnectSoft feed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository `ConnectSoft.AI.SoftwareFactory.Contracts` holds the unchanged output of `dotnet new connectsoft-library -n ConnectSoft.AI.SoftwareFactory.Contracts --UseFactoryProfile true` with the template package restored from the ConnectSoft feed; the solution builds, its template tests pass, the generation manifest records the template version and the parameter values, and the generated pipeline names the ConnectSoft feed."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1522]",
      "number": 1522
    },
    {
      "id": "AIFACTORY-TASK-144",
      "type": "task",
      "parent": "AIFACTORY-US-366",
      "title": "Generate contract types from docs/reference/schemas",
      "sequence": "17.03.01.02",
      "description": "Generate contract types from docs/reference/schemas. Expected output: A package with one type per descriptor whose schema file defines its shape, the run submission with its optional `environmentId`, the envelope, the approval request and decision with the optional step of a run-level spend approval, the usage record with its two token meters and its optional quantity and run, the artifact, the blueprint version reference and the readiness bundle among them, generated at build from the schema files of the intake of AIFACTORY-TASK-1567, embedded in the package and stamped per descriptor with the schema file and its content hash; the seven descriptors whose schema file defines no shape for them are listed as not generated.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A package with one type per descriptor whose schema file defines its shape, the run submission with its optional `environmentId`, the envelope, the approval request and decision with the optional step of a run-level spend approval, the usage record with its two token meters and its optional quantity and run, the artifact, the blueprint version reference and the readiness bundle among them, generated at build from the schema files of the intake of AIFACTORY-TASK-1567, embedded in the package and stamped per descriptor with the schema file and its content hash; the seven descriptors whose schema file defines no shape for them are listed as not generated."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-144]",
      "number": 144
    },
    {
      "id": "AIFACTORY-TASK-1567",
      "type": "task",
      "parent": "AIFACTORY-US-366",
      "title": "Intake of the schema files and the event list from this repository with a recorded revision and hashes",
      "sequence": "17.03.01.03",
      "description": "Intake of the schema files and the event list from this repository with a recorded revision and hashes. Expected output: An intake folder of the Contracts repository holds a copy of each schema file under docs/reference/schemas and one JSON document of the integration events of the service files under model/services (service, event name, topic, version, payload fields with type and required flag, and the `enums` of each service); an intake file records the source revision of this repository and the content hash of each schema file and of the event list; one documented command refreshes the intake from a checkout of this repository; a stage of the pipeline runs the refresh and fails when a refreshed hash differs from the stamp under an unchanged package version.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An intake folder of the Contracts repository holds a copy of each schema file under docs/reference/schemas and one JSON document of the integration events of the service files under model/services (service, event name, topic, version, payload fields with type and required flag, and the `enums` of each service); an intake file records the source revision of this repository and the content hash of each schema file and of the event list; one documented command refreshes the intake from a checkout of this repository; a stage of the pipeline runs the refresh and fails when a refreshed hash differs from the stamp under an unchanged package version."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 101,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1567]",
      "number": 1567
    },
    {
      "id": "AIFACTORY-TASK-1568",
      "type": "task",
      "parent": "AIFACTORY-US-366",
      "title": "ChangesRequested, onExpiry and reRequestsLeft in the approval schema file",
      "sequence": "17.03.01.04",
      "description": "ChangesRequested, onExpiry and reRequestsLeft in the approval schema file. Expected output: docs/reference/schemas/approval.schema.json admits ChangesRequested in the `state` enumeration of the approval request and declares `onExpiry` and `reRequestsLeft` on the request, as model/services/control-plane/RunControlService.yaml states them (decisions D113 and D115); the change is made before the first version of the contracts package is published, docs/reference/schemas/index.md names it, and `python -I tools/docs_model check` passes, which proves the schema half of AC5 of AIFACTORY-US-366.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "docs/reference/schemas/approval.schema.json admits ChangesRequested in the `state` enumeration of the approval request and declares `onExpiry` and `reRequestsLeft` on the request, as model/services/control-plane/RunControlService.yaml states them (decisions D113 and D115); the change is made before the first version of the contracts package is published, docs/reference/schemas/index.md names it, and `python -I tools/docs_model check` passes, which proves the schema half of AC5 of AIFACTORY-US-366."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 101,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1568]",
      "number": 1568
    },
    {
      "id": "AIFACTORY-TASK-1523",
      "type": "task",
      "parent": "AIFACTORY-US-366",
      "title": "Verify the generated types, the stamp and the compatibility test",
      "sequence": "17.03.01.05",
      "description": "Verify the generated types, the stamp and the compatibility test. Expected output: Run `dotnet test -c Release --no-build` on the contracts solution; the round trip of one sample per generated descriptor, the list of the seven descriptors that are not generated, the optional `environmentId` of `run-submission-v1`, the approval in the state ChangesRequested with `onExpiry` and `reRequestsLeft`, the run-level spend approval without a step, the uncertain usage record without a quantity and a run with its two token meters, the refusal of a missing required field, the stamp test on a planted changed schema, the intake stage on a planted changed hash and the compatibility test on a planted removed field pass and prove AC1 to AC5 of AIFACTORY-US-366 (ADR-0014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Contracts.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the contracts solution; the round trip of one sample per generated descriptor, the list of the seven descriptors that are not generated, the optional `environmentId` of `run-submission-v1`, the approval in the state ChangesRequested with `onExpiry` and `reRequestsLeft`, the run-level spend approval without a step, the uncertain usage record without a quantity and a run with its two token meters, the refusal of a missing required field, the stamp test on a planted changed schema, the intake stage on a planted changed hash and the compatibility test on a planted removed field pass and prove AC1 to AC5 of AIFACTORY-US-366 (ADR-0014)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1523]",
      "number": 1523
    },
    {
      "id": "AIFACTORY-US-367",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-090",
      "title": "Contracts package: the run event envelope, the topic constants and the event types are generated from the model, with the optional failure class of `AttemptOutcomeReported`",
      "sequence": "17.03.02",
      "description": "As a platform admin, I want the envelope, the topic names and the event types of the Factory to exist once, generated from the model, so that a publisher and a consumer in two repositories cannot disagree on a topic, a field or a version. ADR-0014 decision 1 makes event id, schema version, occurred-at, the trusted tenant id, project id, run id, step id and attempt id where applicable, correlation id, producer identity and event type the required fields of the port-level envelope, with the causation id optional since the amendment of the ADR on the causation id (decision D117), and keeps the trace id as diagnostic correlation that is never an authorization or idempotency key. Its amendment on envelopes per event family (decision D114) settles who writes which envelope: a Factory service writes the run event envelope of this package for its integration events, and `AgentEventEnvelope` of the Factory messaging library carries agent lifecycle events only, with the same scope fields. This PBI delivers that envelope and what travels in it. The envelope type is generated from docs/reference/schemas/run-event-envelope.schema.json and cannot be built without the fields the schema requires, the tenant among them; the project, run, step and attempt are optional members, the classification defaults to internal, and the topic follows the pattern of the schema. The causation id is optional: the first event of a chain has none, the schema leaves `causationId` optional and the amendment of ADR-0014 on the causation id says the same, so the type carries it as an optional member. For every integration event that a service file under model/services declares, a generator writes the event type name, the topic constant, the version and a payload record with the fields the model lists; a field the model marks as not required is an optional member. The generator reads the event list of the intake that AIFACTORY-US-366 delivers and maps each field by its model type: `string` to a string, `guid` to a GUID, `int` and `long` to integers of that width, `bool`, `decimal`, `datetime` to a UTC instant, `hash` to a string that holds the hash text, `json` to a raw JSON element, `list:string` to a read-only list of strings, and `enum:<Name>` to an enum type generated from the `enums` of the service file that declares the event. `AttemptOutcomeReported` of AgentRuntimeService is the case decision D114 names: its payload carries an optional `failureClass`, present on a failed attempt as ADR-0014 decision 2 requires and absent otherwise. No service types a topic or an event type name of its own; it references the constant. A test compares the generated constants and records with the event list of the intake, and the pipeline stage that refreshes the intake from a checkout of this repository fails when an event, a topic, a version or a payload field of the model changed while the package version did not. The event records implement the event contract of the messaging port, `IEvent` of `ConnectSoft.Extensions.MessagingModel`, so that a service publishes them through the port; that contracts package is the one dependency ADR-0012 decision 1 allows event types. The package declares no agent lifecycle event and no `AgentEventEnvelope` and references no adapter, no transport and not the Factory messaging library; the serialised names of the scope fields are the ones the contract test of the messaging library compares its own envelope with. Kind: enabling. Traces: descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014. Depends on: AIFACTORY-US-366. Sources: docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/reference/event-envelope.md, docs/reference/schemas/run-event-envelope.schema.json, model/services/agent-mesh/AgentRuntimeService.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the package, when a service builds an envelope for an integration event, then event id, event type, schema version, occurred-at, producer, tenant id, correlation id and payload must be supplied, an envelope without a tenant cannot be built, project, run, step and attempt are optional members, `causationId` is an optional member, as the schema and the amendment of ADR-0014 on the causation id state, because the first event of a chain has none, the trace id is a diagnostic member only, and the serialised envelope validates against docs/reference/schemas/run-event-envelope.schema.json (ADR-0014 decision 1, descriptor `run-event-envelope-v1`).",
        "AC2: Given the integration events that the service files under model/services declare, when the package is generated, then each event has an event type name, a topic constant equal to the topic of the model, its version and a payload record with the fields of the model, an `enum:` field is an enum type generated from the `enums` of the service file, and the intake stage of the pipeline fails when an event, a topic, a version or a payload field of the model changed without a new package version (ADR-0014 decision 6; model/services/control-plane/RunControlService.yaml is one of the files read).",
        "AC3: Given the payload of `AttemptOutcomeReported` as model/services/agent-mesh/AgentRuntimeService.yaml states it, when its record is generated, then `failureClass` is an optional member: the outcome of a completed attempt serialises without it and the outcome of a failed attempt carries it, as ADR-0014 decision 2 and its amendment on the failure class of a failed attempt require.",
        "AC4: Given the package assembly, when its architecture test runs, then its event records implement the event contract of `ConnectSoft.Extensions.MessagingModel` and that contracts package is the only messaging reference; the assembly references no adapter, no transport and no `ConnectSoft.Extensions.AI.Factory.Messaging`, and declares no agent lifecycle event and no `AgentEventEnvelope`, because that envelope carries agent lifecycle events only and a Factory service writes the envelope of this package (ADR-0014 amendment on envelopes per event family, ADR-0012 decision 1)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-145",
        "AIFACTORY-TASK-1524",
        "AIFACTORY-TASK-1525"
      ],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 102,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-366"
      ],
      "source": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-367]",
      "number": 367
    },
    {
      "id": "AIFACTORY-TASK-145",
      "type": "task",
      "parent": "AIFACTORY-US-367",
      "title": "Topic and envelope constants",
      "sequence": "17.03.02.01",
      "description": "Topic and envelope constants. Expected output: Topic names, event type names and envelope fields as constants generated from the event list of the intake of AIFACTORY-TASK-1567, which is taken from the service files under model/services at the recorded revision of this repository, with a test that compares the constants with that list and the intake stage that fails when an event, a topic, a version or a payload field of the model changes without a package version.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Topic names, event type names and envelope fields as constants generated from the event list of the intake of AIFACTORY-TASK-1567, which is taken from the service files under model/services at the recorded revision of this repository, with a test that compares the constants with that list and the intake stage that fails when an event, a topic, a version or a payload field of the model changes without a package version."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-145]",
      "number": 145
    },
    {
      "id": "AIFACTORY-TASK-1524",
      "type": "task",
      "parent": "AIFACTORY-US-367",
      "title": "Run event envelope type and payload records of the integration events",
      "sequence": "17.03.02.02",
      "description": "Run event envelope type and payload records of the integration events. Expected output: The package holds the run event envelope type generated from docs/reference/schemas/run-event-envelope.schema.json, which cannot be built without the required fields and carries `causationId` as an optional member, and one payload record per integration event of the model with a member per payload field, optional where the model marks the field as not required; the type mapping is `string` to a string, `guid` to a GUID, `int` and `long` to integers of that width, `bool`, `decimal`, `datetime` to a UTC instant, `hash` to a string that holds the hash text, `json` to a raw JSON element and `list:string` to a read-only list of strings, and an `enum:` field is generated as an enum type from the `enums` of the service file; the records implement the event contract of `ConnectSoft.Extensions.MessagingModel`; the record of `AttemptOutcomeReported` carries the optional `failureClass`; the package declares no `AgentEventEnvelope` and no agent lifecycle event.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package holds the run event envelope type generated from docs/reference/schemas/run-event-envelope.schema.json, which cannot be built without the required fields and carries `causationId` as an optional member, and one payload record per integration event of the model with a member per payload field, optional where the model marks the field as not required; the type mapping is `string` to a string, `guid` to a GUID, `int` and `long` to integers of that width, `bool`, `decimal`, `datetime` to a UTC instant, `hash` to a string that holds the hash text, `json` to a raw JSON element and `list:string` to a read-only list of strings, and an `enum:` field is generated as an enum type from the `enums` of the service file; the records implement the event contract of `ConnectSoft.Extensions.MessagingModel`; the record of `AttemptOutcomeReported` carries the optional `failureClass`; the package declares no `AgentEventEnvelope` and no agent lifecycle event."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 102,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1524]",
      "number": 1524
    },
    {
      "id": "AIFACTORY-TASK-1525",
      "type": "task",
      "parent": "AIFACTORY-US-367",
      "title": "Verify the envelope, the generated event types and the model comparison",
      "sequence": "17.03.02.03",
      "description": "Verify the envelope, the generated event types and the model comparison. Expected output: Run `dotnet test -c Release --no-build` on the contracts solution; the envelope validation against `run-event-envelope-v1`, the refusal of an envelope without a tenant, the optional `causationId`, the comparison of every topic and payload with the event list of the intake, the enum types, the optional `failureClass` and the architecture test pass and prove AC1 to AC4 of AIFACTORY-US-367 (ADR-0014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Contracts.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the contracts solution; the envelope validation against `run-event-envelope-v1`, the refusal of an envelope without a tenant, the optional `causationId`, the comparison of every topic and payload with the event list of the intake, the enum types, the optional `failureClass` and the architecture test pass and prove AC1 to AC4 of AIFACTORY-US-367 (ADR-0014)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1525]",
      "number": 1525
    },
    {
      "id": "AIFACTORY-US-368",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-090",
      "title": "Contracts package: the audit evidence event type `AuditEvidenceSubmitted`, the topic constant `audit.evidence.v1.evidence-submitted` and a submission shape without the chain hash",
      "sequence": "17.03.03",
      "description": "As a platform admin, I want the evidence event that every service submits to be declared once in the contracts package, in the shape a service can submit, so that every Factory service records audit evidence the same way and none computes a chain hash it cannot know. Audit evidence travels as an event (decision D115): a service writes it to its outbox in the transaction of its command, and the Audit service has the command `SubmitEvidence` for it on the topic `audit.evidence.v1.evidence-submitted`, appending once per evidence identifier by the same append as `Audit.Record`, which stays for commands that are not events. Every service publishes that event, so it is no event of one producer in the model and the generator of AIFACTORY-US-367 does not find it in a list of events. This PBI declares it once, by hand, in the contracts package: the evidence event type, named `AuditEvidenceSubmitted` (decision D117), the topic constant, and the shape of what a service submits. That shape is the record of the descriptor `audit-evidence-v1` without `chainHash`. The chain hash is computed by the Audit service when it appends the record, because only that service knows the previous record of the tenant; a service never submits it. The schema file does not allow this today: docs/reference/schemas/audit-evidence.schema.json marks `chainHash` as required and admits no additional property, so a submitted record cannot validate against it. Decision D117 settles how: the submission shape is a second definition under the descriptor `audit-evidence-v1`. A documentation task in this repository therefore adds that definition to the schema file, so that it describes two shapes under the same descriptor: the submitted record, in which `chainHash` is not admitted, and the stored record of the Audit service, in which it stays required. The package generates both from the changed file. The payload of the evidence event is the submission shape only; the stored record is what the Audit service keeps and returns. The closed list of actions, the actor kinds and the correlation with run, approval and event identifiers are those of the schema and are not widened here. The Audit library of the feature `component-audit-factory-evidence` pins this package for the record its builder returns and for the event type and the topic its sink publishes on, and declares none of them. Kind: enabling. Traces: descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0014. Depends on: AIFACTORY-US-366, AIFACTORY-US-367. Sources: docs/reference/schemas/audit-evidence.schema.json, docs/reference/schemas/index.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, model/services/governance/AuditService.yaml, model/descriptors.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the package, when a consumer references the evidence event, then its event type name `AuditEvidenceSubmitted` and the topic constant `audit.evidence.v1.evidence-submitted` are constants of the package, and a test asserts that the constant equals the topic that model/services/governance/AuditService.yaml names for the command `SubmitEvidence` (descriptor `audit-evidence-v1`).",
        "AC2: Given the submission shape of the package, when a service builds an evidence record, then the record holds every field of `audit-evidence-v1` except `chainHash`, a record without evidence identifier, tenant, time, actor, action, subject or outcome cannot be built, and a serialised submission that carries a `chainHash` member is refused by the validation against the submitted record of docs/reference/schemas/audit-evidence.schema.json.",
        "AC3: Given docs/reference/schemas/audit-evidence.schema.json after the documentation task, when it is read, then it describes the submitted record, in which `chainHash` is not admitted, beside the stored record, in which `chainHash` stays required, docs/reference/schemas/index.md names both shapes under the descriptor `audit-evidence-v1`, and `python -I tools/docs_model check` passes.",
        "AC4: Given the evidence event of the package, when it is wrapped as the payload of `run-event-envelope-v1`, then the payload type is the submission shape only, the stored record with its required `chainHash` cannot be used as the payload of the event, and the serialised event validates against both schema files (ADR-0014 decision 4 is the reason the evidence travels as an outbox event)."
      ],
      "sourceArtifacts": [
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/reference/schemas/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "model/services/governance/AuditService.yaml",
        "model/descriptors.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1526",
        "AIFACTORY-TASK-1527",
        "AIFACTORY-TASK-1528"
      ],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 103,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-366",
        "AIFACTORY-US-367"
      ],
      "source": [
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/reference/schemas/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "model/services/governance/AuditService.yaml",
        "model/descriptors.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-368]",
      "number": 368
    },
    {
      "id": "AIFACTORY-TASK-1526",
      "type": "task",
      "parent": "AIFACTORY-US-368",
      "title": "Submitted and stored record in the audit evidence schema file",
      "sequence": "17.03.03.01",
      "description": "Submitted and stored record in the audit evidence schema file. Expected output: docs/reference/schemas/audit-evidence.schema.json describes two shapes as two definitions under the descriptor `audit-evidence-v1`: the submitted record, which holds every field except `chainHash` and does not admit it, and the stored record of the Audit service, in which `chainHash` stays required; docs/reference/schemas/index.md names both and states that the Audit service computes the chain hash when it appends the record; `python -I tools/docs_model check` passes with the changed file, which proves AC3 of AIFACTORY-US-368.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "docs/reference/schemas/audit-evidence.schema.json describes two shapes as two definitions under the descriptor `audit-evidence-v1`: the submitted record, which holds every field except `chainHash` and does not admit it, and the stored record of the Audit service, in which `chainHash` stays required; docs/reference/schemas/index.md names both and states that the Audit service computes the chain hash when it appends the record; `python -I tools/docs_model check` passes with the changed file, which proves AC3 of AIFACTORY-US-368."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 103,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1526]",
      "number": 1526
    },
    {
      "id": "AIFACTORY-TASK-1527",
      "type": "task",
      "parent": "AIFACTORY-US-368",
      "title": "Evidence event type, topic constant and submission shape in the contracts package",
      "sequence": "17.03.03.02",
      "description": "Evidence event type, topic constant and submission shape in the contracts package. Expected output: The package declares the evidence event type `AuditEvidenceSubmitted`, the topic constant `audit.evidence.v1.evidence-submitted` and the submission record generated from the submitted shape of the schema file, beside the stored record with its required `chainHash`; the payload type of the evidence event is the submission record, and a test compares the topic constant with model/services/governance/AuditService.yaml.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package declares the evidence event type `AuditEvidenceSubmitted`, the topic constant `audit.evidence.v1.evidence-submitted` and the submission record generated from the submitted shape of the schema file, beside the stored record with its required `chainHash`; the payload type of the evidence event is the submission record, and a test compares the topic constant with model/services/governance/AuditService.yaml."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 103,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1527]",
      "number": 1527
    },
    {
      "id": "AIFACTORY-TASK-1528",
      "type": "task",
      "parent": "AIFACTORY-US-368",
      "title": "Verify the evidence event and the two record shapes",
      "sequence": "17.03.03.03",
      "description": "Verify the evidence event and the two record shapes. Expected output: Run `dotnet test -c Release --no-build` on the contracts solution; the topic comparison, the build of a submission without `chainHash`, the refusal of a submission that carries it, the stored record with its required hash and the envelope with the evidence payload pass and prove AC1, AC2 and AC4 of AIFACTORY-US-368; AC3 is proven by AIFACTORY-TASK-1526 in the documentation repository (descriptor `audit-evidence-v1`).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Contracts.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the contracts solution; the topic comparison, the build of a submission without `chainHash`, the refusal of a submission that carries it, the stored record with its required hash and the envelope with the evidence payload pass and prove AC1, AC2 and AC4 of AIFACTORY-US-368; AC3 is proven by AIFACTORY-TASK-1526 in the documentation repository (descriptor `audit-evidence-v1`)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1528]",
      "number": 1528
    },
    {
      "id": "AIFACTORY-US-369",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-090",
      "title": "Contracts package: the package is built, tested and published to the ConnectSoft feed with a version its consumers pin, and a probe consumer restores it from the feed alone",
      "sequence": "17.03.04",
      "description": "As a platform admin, I want proof that the contracts package is on the ConnectSoft feed with a version a consumer can pin, so that the templates and the services restore one definition of every contract and never a local copy. This PBI is the publication proof of the feature. The base template profile, the Audit library, the observability libraries, the API library template and, later, every Factory service pin the contracts package, so it has to be on the feed before any of them is built. The feed is the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to (decision D114); no second feed is created. The pipeline of the contracts repository is the one the library template generates: it builds, tests, packs the library with its symbols and publishes it with a version that is verified against the feed before the push, and a version that is already on the feed is refused with the reason. That generated pipeline runs unchanged: the repository adds only the probe stage and the intake stage, holds no pack or push script of its own, and reports a gap of the generated pipeline to the template feature. A publication is reached only after the tests of the solution pass, and those tests are the gates of the earlier PBIs: the stamp test over the schema files, the comparison of the generated topics and payloads with the model, the compatibility test and the architecture test. A probe then proves the result from the side of a consumer. A clean project that has the ConnectSoft feed as its only source and no project reference restores the published version and builds; it builds a run submission with and without `environmentId`, a run event envelope, a payload of `AttemptOutcomeReported` with and without `failureClass` and an evidence submission, validates each against the schema file embedded in the package, and reads the topic constant of the evidence event. The published version is recorded on the reference page of the schemas on this site, which is where a consuming template or service reads its pin. The demonstration of increment I0 that two services consume the package is carried by the feature that verifies the increment; the probe and the recorded version are what it builds on. Kind: evidence. Traces: descriptors: run-event-envelope-v1; adrs: ADR-0014, ADR-0028. Depends on: AIFACTORY-US-366, AIFACTORY-US-367, AIFACTORY-US-368, feature:component-library-template-factory-profile. Sources: docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/reference/schemas/index.md, model/backlog/increments.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the contracts repository, when it runs after the work of the feature, then the package is built, tested, packed and pushed to the ConnectSoft feed with a version that was not on the feed, the publication stage runs only after the tests of the solution pass, and the published version is recorded on docs/reference/schemas/index.md (ADR-0028 amendment on the Factory profile switch names the feed).",
        "AC2: Given a clean consumer project with the ConnectSoft feed as its only package source and no project reference, when it restores the published version and builds, then it builds a run submission, an envelope of `run-event-envelope-v1`, a payload of `AttemptOutcomeReported` and an evidence submission, each validates against the schema file embedded in the package, and the topic constant of the evidence event reads `audit.evidence.v1.evidence-submitted` (ADR-0014 decision 1).",
        "AC3: Given a planted schema file that differs from its stamp, or a version that is already on the feed, when the pipeline reaches the publication stage, then the stage is refused with the reason and nothing is pushed; a run with the planted file proves the refusal (ADR-0014 decision 6; docs/reference/schemas/index.md keeps the earlier version)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/index.md",
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1529",
        "AIFACTORY-TASK-1530",
        "AIFACTORY-TASK-1531",
        "AIFACTORY-TASK-1532"
      ],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 104,
      "kind": "evidence",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-366",
        "AIFACTORY-US-367",
        "AIFACTORY-US-368",
        "feature:component-library-template-factory-profile"
      ],
      "source": [
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/index.md",
        "model/backlog/increments.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-369]",
      "number": 369
    },
    {
      "id": "AIFACTORY-TASK-1529",
      "type": "task",
      "parent": "AIFACTORY-US-369",
      "title": "First publishing run of the generated pipeline of the contracts repository",
      "sequence": "17.03.04.01",
      "description": "First publishing run of the generated pipeline of the contracts repository. Expected output: The pipeline that the library template generated for the contracts repository runs unchanged: one green run publishes the package and its symbols to the ConnectSoft feed after the tests of the solution pass, and one run with a repeated version is refused with the reason; the repository adds only the probe stage of AIFACTORY-TASK-1530 and the intake stage of AIFACTORY-TASK-1567; a gap found in the generated pipeline is reported to feature `component-library-template-factory-profile` and not patched in the repository.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: one green publishing run and one refused run with a repeated version of the generated pipeline.",
      "acceptanceCriteria": [
        "The pipeline that the library template generated for the contracts repository runs unchanged: one green run publishes the package and its symbols to the ConnectSoft feed after the tests of the solution pass, and one run with a repeated version is refused with the reason; the repository adds only the probe stage of AIFACTORY-TASK-1530 and the intake stage of AIFACTORY-TASK-1567; a gap found in the generated pipeline is reported to feature `component-library-template-factory-profile` and not patched in the repository."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 104,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1529]",
      "number": 1529
    },
    {
      "id": "AIFACTORY-TASK-1530",
      "type": "task",
      "parent": "AIFACTORY-US-369",
      "title": "Feed probe consumer for the published contracts package",
      "sequence": "17.03.04.02",
      "description": "Feed probe consumer for the published contracts package. Expected output: A probe project with the ConnectSoft feed as its only source and no project reference restores the published version, builds a run submission with and without `environmentId`, an envelope, a payload of `AttemptOutcomeReported` with and without `failureClass` and an evidence submission, validates each against the embedded schema file and reads the topic constant of the evidence event; the probe runs as the last stage of the pipeline.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe project with the ConnectSoft feed as its only source and no project reference restores the published version, builds a run submission with and without `environmentId`, an envelope, a payload of `AttemptOutcomeReported` with and without `failureClass` and an evidence submission, validates each against the embedded schema file and reads the topic constant of the evidence event; the probe runs as the last stage of the pipeline."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 104,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1530]",
      "number": 1530
    },
    {
      "id": "AIFACTORY-TASK-1531",
      "type": "task",
      "parent": "AIFACTORY-US-369",
      "title": "Published version of the contracts package recorded on the schemas reference page",
      "sequence": "17.03.04.03",
      "description": "Published version of the contracts package recorded on the schemas reference page. Expected output: docs/reference/schemas/index.md names the published version of the contracts package, the revision of this repository its schema files and events were taken from and the descriptors it holds, and states that a Factory service writes the run event envelope of this package for its integration events while `AgentEventEnvelope` carries agent lifecycle events only.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "docs/reference/schemas/index.md names the published version of the contracts package, the revision of this repository its schema files and events were taken from and the descriptors it holds, and states that a Factory service writes the run event envelope of this package for its integration events while `AgentEventEnvelope` carries agent lifecycle events only."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 104,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1531]",
      "number": 1531
    },
    {
      "id": "AIFACTORY-TASK-1532",
      "type": "task",
      "parent": "AIFACTORY-US-369",
      "title": "Verify the published package by the probe and by a planted failing run",
      "sequence": "17.03.04.04",
      "description": "Verify the published package by the probe and by a planted failing run. Expected output: One run of the pipeline publishes the package and the probe passes; one run with a planted schema file that differs from its stamp stops before publication and pushes nothing; both runs prove AC1 to AC3 of AIFACTORY-US-369 (ADR-0014, ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Contracts.",
      "acceptanceCriteria": [
        "One run of the pipeline publishes the package and the probe passes; one run with a planted schema file that differs from its stamp stops before publication and pushes nothing; both runs prove AC1 to AC3 of AIFACTORY-US-369 (ADR-0014, ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1532]",
      "number": 1532
    },
    {
      "id": "AIFACTORY-US-095",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-090",
      "title": "Contracts package from the published schemas is delivered and proven by its consumers",
      "sequence": "17.03.05",
      "description": "As a platform admin, I want contracts package from the published schemas, so that every Factory service reads the envelope, topics, descriptors and schemas from one versioned package. This is the integration PBI of the feature. A platform admin takes the schemas and the events of this repository to one published package: the contract types generated from the schema files with a stamp per descriptor (AIFACTORY-US-366), the run event envelope with the topic constants and the event types generated from the model (AIFACTORY-US-367), the audit evidence event `AuditEvidenceSubmitted` with its topic constant and a submission shape without the chain hash (AIFACTORY-US-368), and the publication to the ConnectSoft feed with a probe consumer (AIFACTORY-US-369). The implementation lives in those PBIs; this one proves them together from the side of the consumers. The decisions the package carries are the ones the model and the amendments of ADR-0014 state: a Factory service writes the run event envelope of this package for its integration events, while `AgentEventEnvelope` of the Factory messaging library carries agent lifecycle events only; `run-submission-v1` has an optional `environmentId`; `AttemptOutcomeReported` carries an optional `failureClass`; the Audit service computes the chain hash, so the submitted evidence record has none. Decision D117 adds to them: the causation id of the envelope is optional, the usage record meters model tokens as two meters, input tokens and output tokens, and admits an uncertain record without a quantity and without a run, and an approval request admits a run-level spend approval without a step. The feature is done when the package is on the feed with a recorded version, a consumer that has only the feed builds every contract and validates it against the embedded schema, and a change of a schema file or of an event of the model cannot be published without a new version. Repository of the feature: `ConnectSoft.AI.SoftwareFactory.Contracts`; the schema changes of the audit evidence record and of the approval request and the recorded version are documentation tasks in this repository. Kind: enabling. Traces: descriptors: run-event-envelope-v1, audit-evidence-v1; adrs: ADR-0014, ADR-0028. Depends on: AIFACTORY-US-366, AIFACTORY-US-367, AIFACTORY-US-368, AIFACTORY-US-369. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/reference/schemas/index.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repository ConnectSoft.AI.SoftwareFactory.Contracts, when its pipeline runs, then the package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0028; docs/reference/schemas/index.md records the version).",
        "AC2: Given the work of AIFACTORY-TASK-144 (generate contract types from docs/reference/schemas) is done, then the package holds one type per descriptor of model/descriptors.yaml whose schema file defines its shape, the run submission, envelope, approval, artifact, blueprint reference and readiness bundle among them, generated and version-stamped from the schema files (ADR-0014).",
        "AC3: Given the work of AIFACTORY-TASK-145 (topic and envelope constants) is done, then topic names, event type names and envelope fields exist as constants generated from the model, with a test that fails when the model changes without a package version, and the payload of `AttemptOutcomeReported` carries its optional `failureClass` (ADR-0014 decision 2; model/services/agent-mesh/AgentRuntimeService.yaml).",
        "AC4: Given the published package, when a service submits audit evidence, then it uses the evidence event type `AuditEvidenceSubmitted`, the topic constant `audit.evidence.v1.evidence-submitted` and the submission shape of `audit-evidence-v1` without `chainHash` from the package, and the schema file docs/reference/schemas/audit-evidence.schema.json describes that shape beside the stored record.",
        "AC5: Given a Factory service that publishes an integration event, when it pins the package, then it writes the envelope `run-event-envelope-v1` of the package, and the package offers no `AgentEventEnvelope`, which stays the envelope of agent lifecycle events in the Factory messaging library (ADR-0014 amendment on envelopes per event family)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/reference/schemas/index.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1533",
        "AIFACTORY-TASK-713"
      ],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 105,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1",
          "audit-evidence-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-366",
        "AIFACTORY-US-367",
        "AIFACTORY-US-368",
        "AIFACTORY-US-369"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/reference/schemas/index.md"
      ],
      "titlePrefix": "[AIFACTORY-US-095]",
      "number": 95
    },
    {
      "id": "AIFACTORY-TASK-1533",
      "type": "task",
      "parent": "AIFACTORY-US-095",
      "title": "Build every contract of the published package from a consumer that has only the feed",
      "sequence": "17.03.05.01",
      "description": "Build every contract of the published package from a consumer that has only the feed. Expected output: A consumer test project restores the published package from the ConnectSoft feed and is exhaustive where the feed probe of AIFACTORY-TASK-1530 is a smoke over five documents: for every descriptor the package generates it builds a document, validates it against the embedded schema file and compares its stamp with the pinned intake, and for every event type of the package it builds one envelope and compares the topic constant and the payload members with the event list of the intake, which proves AC2 to AC5 of AIFACTORY-US-095.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Contracts. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A consumer test project restores the published package from the ConnectSoft feed and is exhaustive where the feed probe of AIFACTORY-TASK-1530 is a smoke over five documents: for every descriptor the package generates it builds a document, validates it against the embedded schema file and compares its stamp with the pinned intake, and for every event type of the package it builds one envelope and compares the topic constant and the payload members with the event list of the intake, which proves AC2 to AC5 of AIFACTORY-US-095."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1533]",
      "number": 1533
    },
    {
      "id": "AIFACTORY-TASK-713",
      "type": "task",
      "parent": "AIFACTORY-US-095",
      "title": "Verify contracts-package-delivered by running the declared command",
      "sequence": "17.03.05.02",
      "description": "Verify contracts-package-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build`; they pass and prove AC1 to AC5 of AIFACTORY-US-095.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Contracts.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build`; they pass and prove AC1 to AC5 of AIFACTORY-US-095."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Contracts"
      ],
      "children": [],
      "buildOrder": 1,
      "phase": "templates-and-libraries",
      "stackRank": 105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-713]",
      "number": 713
    },
    {
      "id": "AIFACTORY-FEAT-091",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Durable execution substrate verified against pinned versions",
      "sequence": "17.04",
      "description": "ADR-0024 chose Orleans grains with the Agent Framework for durable execution without checking the framework's durable extension against the versions the estate pins. This feature proves the substrate with one run that survives a process restart. Increment I0: Readiness. Build order 46 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-370",
        "AIFACTORY-US-371",
        "AIFACTORY-US-052"
      ],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4600,
      "titlePrefix": "[AIFACTORY-FEAT-091]",
      "number": 91
    },
    {
      "id": "AIFACTORY-US-370",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-091",
      "title": "Durability spike: a run with one step and one attempt runs as `WorkflowRunGrain` and `AttemptGrain` on the pinned Orleans and Agent Framework versions and persists every transition",
      "sequence": "17.04.01",
      "description": "As a platform admin, I want the smallest host in which a run, its step and its attempt live as grains on the versions the estate pins, so that the durable execution decision can be tested by running code and not by reading documentation. ADR-0024 decision 1 makes Orleans grains the durability substrate, with `AttemptGrain` per attempt and `WorkflowRunGrain` per run, and decision 2 runs the Microsoft Agent Framework in-process under the attempt grain with its checkpoint stored as an opaque blob with an `adapterVersion`. The amendment of the ADR on the primary documentation check (decision D89) records that no code was run: of twenty-six claims five differ from the documentation and five were not found, and several of them can only be answered by a first implementation. This PBI builds the smallest host that can answer them. It is a spike project in the repository `ConnectSoft.AI.SoftwareFactory.AgentRuntimeService`. No other task of this increment creates that repository, so the spike does: after the approval of the owner it is created by the checklist of feature `repository-and-pipeline-conventions` with `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime`, the host kind that AIFACTORY-US-138 of feature `component-agent-template` delivers with the silo-kind configuration of one Orleans cluster and without any grain. This is the one creation of the repository, and the service feature of increment I1 takes it as it stands. The spike lives in a folder of its own outside the product solution and the package, so nothing of it is built into the service or shipped with it. The spike adds two grains. `WorkflowRunGrain` holds a run and its one step; `AttemptGrain` holds the one attempt. Each serialises its transitions, persists a state row per transition in a relational store through the grain persistence of the host, and commits the transition together with its outbox record through the Orleans messaging profile of the messaging port, as ADR-0012 decision 4 requires; AIFACTORY-US-147 of feature `component-agent-template-factory-access` makes that profile the default of a Factory host kind, and this PBI depends on it. Under the attempt grain a scripted agent of the Agent Framework runs with a scripted chat client, so no model provider is called and no key is needed, and it writes its checkpoint as an opaque blob with its `adapterVersion` after each step of its loop. The versions are the ones the estate pins: the Orleans packages and `Microsoft.Agents.AI` at the versions of the recorded pin set of the Factory libraries, which feature `component-extensions-ai` aligns. No preview package is referenced, so the Durable Extension, which ships outside the pins, is not part of the spike. The spike is evidence and not product code: its grains carry identifiers, a state name, a counter and a checkpoint reference only, nothing of it is the implementation that AgentRuntimeService and WorkflowEngineService receive in increment I1, the spike folder with its grains, which carry the names of the product grains, is removed when the service feature of I1 delivers the grains, and since Run Control does not exist yet the spike keeps no run journal and claims nothing about the restore order of ADR-0024 decision 5. Its store is a local database whose name the owner agreed before it was created. Kind: enabling. Traces: adrs: ADR-0012, ADR-0024. Depends on: feature:component-agent-template, feature:component-extensions-ai, feature:component-agent-template-factory-access, feature:repository-and-pipeline-conventions. Sources: docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/durability-spike.md, docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md.",
      "acceptanceCriteria": [
        "AC1: Given the spike host on the pinned versions, when a run with one step and one attempt is started, then `WorkflowRunGrain` and `AttemptGrain` persist a state row for each transition, the package versions in use equal the recorded pin set and no preview package is referenced (ADR-0024 decision 1 and its amendment on the primary documentation check; docs/planes/agent-runtime/durability-spike.md).",
        "AC2: Given the scripted agent under the attempt grain, when its loop advances, then a checkpoint is written after each step as an opaque blob with its `adapterVersion` and is referenced by the state of the attempt, and a loop that runs longer than the default timeout of a grain call proceeds without a grain call that waits for it to end (ADR-0024 decision 2; the spike page lists the agent loop inside a grain among the points that stay unknown).",
        "AC3: Given a transition of the attempt grain, when it commits, then its state row and the outbox record of its event are committed together through the Orleans messaging profile, and a planted failure between the two leaves neither behind (ADR-0024 decision 1, ADR-0012 decision 4)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-146",
        "AIFACTORY-TASK-1534",
        "AIFACTORY-TASK-1535"
      ],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4601,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-agent-template",
        "feature:component-extensions-ai",
        "feature:component-agent-template-factory-access",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "titlePrefix": "[AIFACTORY-US-370]",
      "number": 370
    },
    {
      "id": "AIFACTORY-TASK-146",
      "type": "task",
      "parent": "AIFACTORY-US-370",
      "title": "Spike: a run, a step and an attempt as grains that survive a restart",
      "sequence": "17.04.01.01",
      "description": "Spike: a run, a step and an attempt as grains that survive a restart. Expected output: The repository `ConnectSoft.AI.SoftwareFactory.AgentRuntimeService` is created by the checklist after the approval of the owner with `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime`; this is the one creation of the repository. The spike lives in a folder of its own outside the product solution and the package, and is removed when the service feature of I1 delivers the grains. It holds `WorkflowRunGrain` for the run and its step and `AttemptGrain` for the attempt; each transition persists a state row and commits with its outbox record through the Orleans messaging profile of the host, the scripted agent checkpoints as an opaque blob with its `adapterVersion`, and the recorded result names the package versions used and any deviation from ADR-0024.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository `ConnectSoft.AI.SoftwareFactory.AgentRuntimeService` is created by the checklist after the approval of the owner with `dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime`; this is the one creation of the repository. The spike lives in a folder of its own outside the product solution and the package, and is removed when the service feature of I1 delivers the grains. It holds `WorkflowRunGrain` for the run and its step and `AttemptGrain` for the attempt; each transition persists a state row and commits with its outbox record through the Orleans messaging profile of the host, the scripted agent checkpoints as an opaque blob with its `adapterVersion`, and the recorded result names the package versions used and any deviation from ADR-0024."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-146]",
      "number": 146
    },
    {
      "id": "AIFACTORY-TASK-1534",
      "type": "task",
      "parent": "AIFACTORY-US-370",
      "title": "Scripted agent, scripted chat client and a harness that runs the silo as its own process",
      "sequence": "17.04.01.02",
      "description": "Scripted agent, scripted chat client and a harness that runs the silo as its own process. Expected output: A fixture of the spike: a scripted agent of the Agent Framework with a scripted chat client that calls no provider, a loop of a configurable number of steps and duration, and a harness that starts the silo as a separate process against the agreed local database, kills that process without a graceful stop at a chosen step and starts it again.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "A fixture of the spike: a scripted agent of the Agent Framework with a scripted chat client that calls no provider, a loop of a configurable number of steps and duration, and a harness that starts the silo as a separate process against the agreed local database, kills that process without a graceful stop at a chosen step and starts it again."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4601,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1534]",
      "number": 1534
    },
    {
      "id": "AIFACTORY-TASK-1535",
      "type": "task",
      "parent": "AIFACTORY-US-370",
      "title": "Verify the persisted transitions, the checkpoints and the joint commit",
      "sequence": "17.04.01.03",
      "description": "Verify the persisted transitions, the checkpoints and the joint commit. Expected output: Run `dotnet test -c Release --filter Category=Spike` on the spike project; the state rows per transition, the checkpoint with its `adapterVersion`, the long loop and the planted failure between state row and outbox record pass and prove AC1 to AC3 of AIFACTORY-US-370 (ADR-0024, ADR-0012).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Spike` on the spike project; the state rows per transition, the checkpoint with its `adapterVersion`, the long loop and the planted failure between state row and outbox record pass and prove AC1 to AC3 of AIFACTORY-US-370 (ADR-0024, ADR-0012)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1535]",
      "number": 1535
    },
    {
      "id": "AIFACTORY-US-371",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-091",
      "title": "Durability spike: after a killed silo the grains reactivate with their last state, the attempt resumes from a compatible checkpoint, a reminder fires once and a stale activation cannot write",
      "sequence": "17.04.02",
      "description": "As a platform admin, I want the points the documentation check left open to be answered by probes against a killed and restarted silo, so that the first services are built on a substrate whose recovery was seen and measured. This PBI is the proof of the feature. Each probe runs against the spike host of AIFACTORY-US-370 with the silo in a process of its own that the harness kills without a graceful stop and starts again. The first probe is the restart itself: the process is killed while the scripted agent is in the middle of its loop, and after the restart `WorkflowRunGrain` and `AttemptGrain` reactivate with their last committed state and the attempt resumes from its last checkpoint, so that a step completed before the checkpoint is not executed again. This is recovery and not replay, which ADR-0014 decision 5 does not promise. The time from the start of the new process to the resumed loop is measured and recorded. The second probe plants a checkpoint whose `adapterVersion` the adapter does not accept: ADR-0024 decision 2 allows a resume only from a compatible checkpoint, so the attempt is not resumed, ends with the reason and reports that a new attempt is needed. The third probe concerns reminders. The run grain registers a reminder; a tick that falls due while the silo is down is skipped and is not delivered late, and the next tick fires once after the restart and never twice. The documentation check found that reminders are documented for periods of minutes or longer, so the probe records the shortest period that held and whether a grain timer kept alive by the reminder serves a shorter heartbeat. The fourth probe forces two activations of one attempt grain, which the default grain directory allows for a short time: the write of the stale activation is refused by the consistency check of the state store and one outcome is recorded. The check found that leases and fencing are Factory design and not an Orleans feature; the probe shows what the store gives and what the design has to add. A probe that fails is recorded as failed with what it shows. It is a finding for the owner and is neither hidden nor worked around, and the spike decides nothing about it. Kind: evidence. Traces: adrs: ADR-0014, ADR-0024. Depends on: AIFACTORY-US-370. Sources: docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/durability-spike.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a run whose attempt is in the middle of its loop, when the silo process is killed and started again, then `WorkflowRunGrain` and `AttemptGrain` reactivate with their last committed state, the attempt resumes from its last checkpoint without executing a completed step again, and the time from the start of the process to the resumed loop is measured and recorded (ADR-0024 decisions 1 and 2; ADR-0014 decision 5 promises recovery and not replay).",
        "AC2: Given a stored checkpoint whose `adapterVersion` the adapter does not accept, when the attempt grain reactivates, then the attempt is not resumed, it ends with the reason and reports that a new attempt is needed (ADR-0024 decision 2).",
        "AC3: Given a reminder registered by the run grain, when the silo is down while a tick falls due and is then restarted, then the tick that fell due while the silo was down is not delivered, the next tick fires once after the restart and never twice, and the probe records the shortest period that held and the behaviour of a grain timer kept alive by the reminder (ADR-0024 decision 1; docs/planes/agent-runtime/durability-spike.md records the documented granularity of reminders and that a tick due during an outage is skipped).",
        "AC4: Given two activations of one attempt grain, when both write their state, then the write of the stale activation is refused by the consistency check of the state store, one outcome is recorded, and the result states what the fencing token and the outcome report of the Factory design have to add to that check (ADR-0024 amendment on the primary documentation check)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1536",
        "AIFACTORY-TASK-1537"
      ],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4602,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-370"
      ],
      "source": [
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-371]",
      "number": 371
    },
    {
      "id": "AIFACTORY-TASK-1536",
      "type": "task",
      "parent": "AIFACTORY-US-371",
      "title": "Probes for the restart, the incompatible checkpoint, the reminder and the duplicate activation",
      "sequence": "17.04.02.01",
      "description": "Probes for the restart, the incompatible checkpoint, the reminder and the duplicate activation. Expected output: Four probes in the spike project, each a test of the category Spike that uses the harness of AIFACTORY-TASK-1534: a kill in the middle of the loop with the measured time to the resumed loop, a planted checkpoint with an `adapterVersion` the adapter refuses, a reminder whose tick falls due while the silo is down, and a forced second activation of one attempt grain whose stale write is refused.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Four probes in the spike project, each a test of the category Spike that uses the harness of AIFACTORY-TASK-1534: a kill in the middle of the loop with the measured time to the resumed loop, a planted checkpoint with an `adapterVersion` the adapter refuses, a reminder whose tick falls due while the silo is down, and a forced second activation of one attempt grain whose stale write is refused."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4602,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1536]",
      "number": 1536
    },
    {
      "id": "AIFACTORY-TASK-1537",
      "type": "task",
      "parent": "AIFACTORY-US-371",
      "title": "Verify the four probes against a killed and restarted silo",
      "sequence": "17.04.02.02",
      "description": "Verify the four probes against a killed and restarted silo. Expected output: Run `dotnet test -c Release --filter Category=Spike` on the spike project; the result of each of the four probes, passed or failed, is kept with the package versions, the measured recovery time and the shortest reminder period that held, which proves AC1 to AC4 of AIFACTORY-US-371 (ADR-0024) or names the criterion a failed probe contradicts.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Spike` on the spike project; the result of each of the four probes, passed or failed, is kept with the package versions, the measured recovery time and the shortest reminder period that held, which proves AC1 to AC4 of AIFACTORY-US-371 (ADR-0024) or names the criterion a failed probe contradicts."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1537]",
      "number": 1537
    },
    {
      "id": "AIFACTORY-US-052",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-091",
      "title": "A run, a step and an attempt survive a silo restart",
      "sequence": "17.04.03",
      "description": "As a platform admin, I want proof that a run, a step and an attempt modelled as grains keep their state across a silo restart, so that the durable execution decision (ADR-0024) stands on evidence before the first services are built on it. This is the integration PBI of the feature. ADR-0024 chose Orleans grains with the Agent Framework as the execution adapter for durable execution, and its amendment on the primary documentation check states that the claims were read and never run. A platform admin gets the missing evidence here: AIFACTORY-US-370 builds a spike host in which a run with its step lives in `WorkflowRunGrain` and its attempt in `AttemptGrain`, on the Orleans and Agent Framework versions the estate pins, and AIFACTORY-US-371 kills and restarts the silo under four probes. This PBI turns the results into a record. The durability spike page of this site gains the result of the run: the package versions, the outcome of each probe, the measured recovery time, the shortest reminder period that held and every deviation from ADR-0024. Each of the five differences that the documentation check listed for the owner is marked as answered by a probe, with the probe named, or as still open. The record then confirms ADR-0024 or proposes an amendment of it for the owner to accept. The spike decides nothing: a revisit of the decision, the wording of the allowance for the durable extension inside an attempt and the acceptance of an amendment are decisions of the owner, and they stay open in the record until the owner takes them. The feature is done when the first services of increment I1 can be built on grains with a recorded answer to whether a run survives a restart. The spike project is not the implementation of AgentRuntimeService; that is delivered by its own feature in I1. Kind: enabling. Traces: adrs: ADR-0024, ADR-0014. Depends on: AIFACTORY-US-370, AIFACTORY-US-371. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, docs/architecture/adr/0024-durable-execution-substrate.md, docs/planes/agent-runtime/durability-spike.md.",
      "acceptanceCriteria": [
        "AC1: Given a run with one step and one attempt persisted as grains, when the silo process is killed and restarted, then the grains reactivate with their last state and the attempt resumes from its last checkpoint (ADR-0024 decisions 1 and 2; recovery and not replay, ADR-0014 decision 5).",
        "AC2: Given a reminder registered by the run grain, when the silo restarts, then the tick that fell due during the outage is not delivered and the next tick fires once after restart and never twice (ADR-0024 decision 1; docs/planes/agent-runtime/durability-spike.md).",
        "AC3: Given the outcome of the spike, when it is recorded on docs/planes/agent-runtime/durability-spike.md, then the record names the package versions, the result of each probe, the measured recovery time and the open risks, marks each of the five differences of the documentation check as answered by a named probe or as still open, and confirms ADR-0024 or proposes an amendment that only the owner accepts."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-147",
        "AIFACTORY-TASK-714"
      ],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4603,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0024",
          "ADR-0014"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-370",
        "AIFACTORY-US-371"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/planes/agent-runtime/durability-spike.md"
      ],
      "titlePrefix": "[AIFACTORY-US-052]",
      "number": 52
    },
    {
      "id": "AIFACTORY-TASK-147",
      "type": "task",
      "parent": "AIFACTORY-US-052",
      "title": "Record the outcome as an ADR amendment or confirmation",
      "sequence": "17.04.03.01",
      "description": "Record the outcome as an ADR amendment or confirmation. Expected output: docs/planes/agent-runtime/durability-spike.md gains the result of the spike: package versions, the result of each probe, the measured recovery time, the shortest reminder period that held and every deviation; each of the five differences of the documentation check is marked answered by a named probe or still open; ADR-0024 is confirmed, or an amendment is written as a proposal that the owner accepts or rejects.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "docs/planes/agent-runtime/durability-spike.md gains the result of the spike: package versions, the result of each probe, the measured recovery time, the shortest reminder period that held and every deviation; each of the five differences of the documentation check is marked answered by a named probe or still open; ADR-0024 is confirmed, or an amendment is written as a proposal that the owner accepts or rejects."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4603,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-147]",
      "number": 147
    },
    {
      "id": "AIFACTORY-TASK-714",
      "type": "task",
      "parent": "AIFACTORY-US-052",
      "title": "Verify run-survives-a-restart-spike by running the declared command",
      "sequence": "17.04.03.02",
      "description": "Verify run-survives-a-restart-spike by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Spike` on the spike project; the run completes and its results prove AC1 and AC2 of AIFACTORY-US-052 or name the probe that contradicts them; AC3 is proven by AIFACTORY-TASK-147.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Spike` on the spike project; the run completes and its results prove AC1 and AC2 of AIFACTORY-US-052 or name the probe that contradicts them; AC3 is proven by AIFACTORY-TASK-147."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:solution-architect",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 46,
      "phase": "factory",
      "stackRank": 4603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-714]",
      "number": 714
    },
    {
      "id": "AIFACTORY-FEAT-092",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Local development environment for a Factory service",
      "sequence": "17.05",
      "description": "A developer or a coding agent can run any first-outcome service locally with its store, messaging and identity, from documented steps, without touching a shared database. Increment I0: Readiness. Build order 47 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-372",
        "AIFACTORY-US-373",
        "AIFACTORY-US-374",
        "AIFACTORY-US-527",
        "AIFACTORY-US-134"
      ],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4700,
      "titlePrefix": "[AIFACTORY-FEAT-092]",
      "number": 92
    },
    {
      "id": "AIFACTORY-US-372",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-092",
      "title": "Local environment: a developer or a coding agent starts one Factory service locally with its own store, the Orleans messaging profile, a local authorization server and model access by secret reference",
      "sequence": "17.05.01",
      "description": "As an operator, I want written steps by which one Factory service starts on a developer machine with everything it needs, so that a developer or a coding agent can run and test a service without touching a shared database. One repository per service (ADR-0028) means that a developer or a coding agent works on one service at a time and has to start it alone. This PBI delivers the page of this site with the steps for that, written so that a coding agent can follow them without asking. The steps cover four things a service needs and state for each where its value comes from. The store: ADR-0028 decision 5 gives every service one relational store that it alone binds, and model/stores.yaml names it, so the steps create one local database per service and never point a service at a shared database. The name of every local database is on a list that the owner agreed before any database is created; a step that creates, resets or removes a database names that database and no other. The messaging transport: the Orleans messaging profile of the messaging port, with the outbox and the inbox in the store of the service and its own messaging service name, as ADR-0028 decision 7 and ADR-0012 require, so a local run needs no broker. The identity: the Factory instance of the Identity Platform runs locally and issues the tokens. The page says where it comes from: the Factory owns the two repositories of that instance, `ConnectSoft.AI.SoftwareFactory.Identity`, scaffolded from the Identity template, and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer`, scaffolded from the authorization server template (ADR-0028 amendment on the Factory instance of the Identity Platform, decision D117), and AIFACTORY-US-527 creates them. The steps start both from a checkout of those repositories, each with a local database of its own from the agreed list, and no folder outside a repository stands in for them. The seeded clients work only in the Development environment (AIFACTORY-US-245). The steps register the local clients, the public client of the command-line client among them, and a tenant, a project and a member for local work, and they use no secret that works outside the Development environment. The model access: `ModelRouterService` is the only service that calls a model provider (ADR-0028 decision 3) and reads its key through a secret reference that the developer resolves from a local secret store; no key value is written to a file of the repository or of this site. Every other service reaches a model through the model gateway, holds no key and starts without one. The steps name the ports that the service file declares, the health and readiness addresses of the scaffold and the one command that starts the service. They are written against a repository scaffolded with the Factory profile, which the feature `component-base-template-factory-profile` delivers, and are proven first on `ConnectSoft.AI.SoftwareFactory.RunControlService`. The page creates nothing by itself: it is followed by a person or an agent, and the databases it names exist only after the owner agreed their names. Kind: enabling. Traces: adrs: ADR-0012, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-527, feature:component-base-template-factory-profile, feature:component-auth-server-template-factory-tokens, feature:repository-and-pipeline-conventions. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, model/stores.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a repository scaffolded with the Factory profile and the steps page, when a developer or a coding agent follows the steps on a machine that has only the listed prerequisites, then the service starts on the ports its service file declares and reports ready, a call with a token of the local authorization server is answered and a call without a token is answered 401 (ADR-0015 decision 2; model/services/control-plane/RunControlService.yaml declares the ports of the first service).",
        "AC2: Given the steps, when the service starts, then it binds only the relational store it owns, a local database whose name is on the list the owner agreed before any database was created, no connection string of the page names a shared database, and every step that creates, resets or removes a database names that database (ADR-0028 decision 5; model/stores.yaml names the store of each service).",
        "AC3: Given the steps, when the service publishes and consumes an event locally, then it uses the Orleans messaging profile with its outbox and inbox in its own store and its own messaging service name, and no broker is started (ADR-0012 decisions 2 and 4, ADR-0028 decision 7).",
        "AC4: Given `ModelRouterService`, the only service that calls a model provider (ADR-0028 decision 3), when the page describes its local start, then its key is read through a secret reference resolved from the local secret store of the developer, a start without the reference fails with the name of the missing reference, and no key value appears on the page or in a file of the repository; every other service calls the model gateway and starts without a key, which the recorded run shows for the first repository, and the failing start of `ModelRouterService` is recorded when the feature of increment I1 that delivers that service runs these steps (ADR-0028 decision 7 places secrets with the owning service; docs/architecture/data-governance.md)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "model/stores.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-148",
        "AIFACTORY-TASK-1538",
        "AIFACTORY-TASK-1569"
      ],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4701,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-527",
        "feature:component-base-template-factory-profile",
        "feature:component-auth-server-template-factory-tokens",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "model/stores.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-372]",
      "number": 372
    },
    {
      "id": "AIFACTORY-TASK-148",
      "type": "task",
      "parent": "AIFACTORY-US-372",
      "title": "Documented local setup: store, messaging transport, identity and model access",
      "sequence": "17.05.01.01",
      "description": "Documented local setup: store, messaging transport, identity and model access. Expected output: A page of this site with written, repeatable steps to start one Factory service locally: the prerequisites, one local database per service with the names agreed with the owner before any database is created, the Orleans messaging profile without a broker, the Factory instance of the Identity Platform, started from a checkout of `ConnectSoft.AI.SoftwareFactory.Identity` and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer` (AIFACTORY-US-527), each with a local database of its own, with clients that work only in Development (AIFACTORY-US-245) and with its tenant, project and member, the model key of `ModelRouterService` through a secret reference only and no key for any other service, the ports of the service file, the health and readiness addresses and the start command.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A page of this site with written, repeatable steps to start one Factory service locally: the prerequisites, one local database per service with the names agreed with the owner before any database is created, the Orleans messaging profile without a broker, the Factory instance of the Identity Platform, started from a checkout of `ConnectSoft.AI.SoftwareFactory.Identity` and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer` (AIFACTORY-US-527), each with a local database of its own, with clients that work only in Development (AIFACTORY-US-245) and with its tenant, project and member, the model key of `ModelRouterService` through a secret reference only and no key for any other service, the ports of the service file, the health and readiness addresses and the start command."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4701,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-148]",
      "number": 148
    },
    {
      "id": "AIFACTORY-TASK-1538",
      "type": "task",
      "parent": "AIFACTORY-US-372",
      "title": "Verify the local setup page against the model",
      "sequence": "17.05.01.02",
      "description": "Verify the local setup page against the model. Expected output: Run `python -I tools/docs_model check` for the model and the freshness of the generated output and `mkdocs build --strict` for the site with the page; a read of the page against the model finds that every first-outcome service has a row whose store is the one model/stores.yaml names for it and whose ports equal its service file, and finds no connection string to a shared database and no key value, which proves AC2 and the page half of AC4 of AIFACTORY-US-372 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run `python -I tools/docs_model check` for the model and the freshness of the generated output and `mkdocs build --strict` for the site with the page; a read of the page against the model finds that every first-outcome service has a row whose store is the one model/stores.yaml names for it and whose ports equal its service file, and finds no connection string to a shared database and no key value, which proves AC2 and the page half of AC4 of AIFACTORY-US-372 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1538]",
      "number": 1538
    },
    {
      "id": "AIFACTORY-TASK-1569",
      "type": "task",
      "parent": "AIFACTORY-US-372",
      "title": "Verify the local start, the event without a broker and the start without a model key by the recorded run",
      "sequence": "17.05.01.03",
      "description": "Verify the local start, the event without a broker and the start without a model key by the recorded run. Expected output: The recorded run of AIFACTORY-TASK-1540 on `ConnectSoft.AI.SoftwareFactory.RunControlService` shows the service ready on the ports of its service file, a call with a token of the local authorization server answered and a call without a token answered 401, one event published and consumed through the Orleans messaging profile with no broker process running, and a start with no model key configured; it proves AC1, AC3 and the run-time half of AC4 of AIFACTORY-US-372 for a service that calls no model provider (ADR-0012, ADR-0015).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded run of AIFACTORY-TASK-1540 on `ConnectSoft.AI.SoftwareFactory.RunControlService` shows the service ready on the ports of its service file, a call with a token of the local authorization server answered and a call without a token answered 401, one event published and consumed through the Orleans messaging profile with no broker process running, and a start with no model key configured; it proves AC1, AC3 and the run-time half of AC4 of AIFACTORY-US-372 for a service that calls no model provider (ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1569]",
      "number": 1569
    },
    {
      "id": "AIFACTORY-US-373",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-092",
      "title": "Local environment: one acceptance environment runs the first-outcome services together behind their gateways for the fixture runs of the workflow definitions",
      "sequence": "17.05.02",
      "description": "As an operator, I want one environment in which the first-outcome services run together, so that a fixture run of a workflow definition crosses real services before the first outcome is demonstrated. A service that starts alone proves little about a chain of six workflows. This PBI defines the one environment in which the first-outcome services run together: the acceptance environment. It is the environment that the amendment of ADR-0021 names: until the evaluation gate exists, a Draft workflow or agent release may run only in the acceptance environment and in the projects a platform-scope policy rule names as internal, so the environment and its fixture project have to exist and have a name before the first fixture run. The page of this site that defines it holds an inventory and the procedures. The inventory lists every service and gateway of the first outcome, the ones a feature of increment I1 delivers, with its repository, its database, its ports, its messaging service name and its health address, and names for each row the task of increment I0 that created and scaffolded its repository and the feature of increment I1 that delivers the service (D140). Each service has a database of its own, on the list of names the owner agreed before any database is created, because a service binds only the store it owns (ADR-0028 decision 5). The two agent silo kinds join one Orleans cluster (ADR-0028 decision 4), the gateways front the services of their platform, and the Factory instance of the Identity Platform issues the tokens: the identity service and the authorization server run from their own repositories, `ConnectSoft.AI.SoftwareFactory.Identity` and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer` (ADR-0028 amendment on the Factory instance of the Identity Platform), and each has a row of the inventory with its repository, its database, its ports and its health address. The procedures are the order in which the estate is brought up, the way a fixture run is started with a token of the fixture tenant and project, and a reset that names every database it resets and touches none outside the list. Every first-outcome repository exists in increment I0 (D140): RunControlService and ControlPlaneApi are created by AIFACTORY-TASK-190 and AIFACTORY-TASK-1514 of feature `repository-and-pipeline-conventions`, AgentRuntimeService by AIFACTORY-TASK-146 of feature `durable-execution-spike`, every other first-outcome service and gateway by the tasks of AIFACTORY-US-1596 to AIFACTORY-US-1601 of feature `repository-and-pipeline-conventions`, each scaffolded from its template at the pinned version with a green template pipeline, and the two repositories of the Identity Platform instance by AIFACTORY-US-527; this PBI creates no repository. A bring-up in increment I0 therefore starts the scaffold of every first-outcome service and gateway behind the scaffold of ControlPlaneApi, and from increment I1 each service runs what its feature delivers. A row changes its delivery mark, and nothing else, when its feature delivers the service. The environment is defined by written steps here. The environment stack that the platform template generates arrives with a later increment and is not a dependency of this PBI. Kind: enabling. Traces: adrs: ADR-0015, ADR-0021, ADR-0028. Depends on: AIFACTORY-US-372, feature:repository-and-pipeline-conventions, feature:trusted-scope-chain. Sources: docs/architecture/capability-dependencies.md, docs/architecture/adr/0021-quality-gates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/backlog/increments.yaml, model/stores.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the acceptance environment page, when its inventory is compared with the features of increment I1 in model/backlog/features, then every service and gateway of the first outcome has one row with its repository, its own database from the agreed list, its ports, its messaging service name and its health address, each row names the task of increment I0 that created and scaffolded its repository and the feature of increment I1 that delivers the service (D140), and the identity service and the authorization server of the Factory instance of the Identity Platform have a row each with their own repository and database (ADR-0028 decisions 1 and 5 and its amendment on the Factory instance of the Identity Platform).",
        "AC2: Given the environment brought up by the written order, when a call with a token of the fixture tenant and project passes the control plane gateway to a service, then every first-outcome service and gateway reports ready, which in increment I0 is the scaffold of each, created and scaffolded in increment I0 (D140), behind the scaffold of ControlPlaneApi, and the service reads the tenant and project of the token from its scope (ADR-0015 decision 2, ADR-0028 decision 2).",
        "AC3: Given the waiver for Draft releases, when the page is read, then it names this environment as the acceptance environment and names the fixture tenant and project that the platform-scope policy rule lists as internal, so that the rule of the amendment of ADR-0021 has an environment and a project to name.",
        "AC4: Given the reset procedure of the page, when it is read against the agreed list, then it names every database it resets, resets none outside the list, and states that no database is created, reset or removed before the owner agreed its name (ADR-0028 decision 5; model/stores.yaml)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/backlog/increments.yaml",
        "model/stores.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-149",
        "AIFACTORY-TASK-1539"
      ],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4702,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0021",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-372",
        "feature:repository-and-pipeline-conventions",
        "feature:trusted-scope-chain"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/backlog/increments.yaml",
        "model/stores.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-373]",
      "number": 373
    },
    {
      "id": "AIFACTORY-TASK-149",
      "type": "task",
      "parent": "AIFACTORY-US-373",
      "title": "Acceptance environment for cross-service fixture runs",
      "sequence": "17.05.02.01",
      "description": "Acceptance environment for cross-service fixture runs. Expected output: A page of this site that defines the one environment where the first-outcome services run together for the fixture runs of the workflow definitions: the inventory of the first-outcome services and gateways with repository, database, ports, messaging service name and health address, each row naming the task of increment I0 that created and scaffolded its repository and the feature of increment I1 that delivers the service (D140), a row each for the identity service and the authorization server of the Factory instance of the Identity Platform with their repositories `ConnectSoft.AI.SoftwareFactory.Identity` and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer`, the bring-up order of every first-outcome service and gateway, the fixture tenant and project, the way a fixture run is started and the reset procedure that names every database it resets.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A page of this site that defines the one environment where the first-outcome services run together for the fixture runs of the workflow definitions: the inventory of the first-outcome services and gateways with repository, database, ports, messaging service name and health address, each row naming the task of increment I0 that created and scaffolded its repository and the feature of increment I1 that delivers the service (D140), a row each for the identity service and the authorization server of the Factory instance of the Identity Platform with their repositories `ConnectSoft.AI.SoftwareFactory.Identity` and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer`, the bring-up order of every first-outcome service and gateway, the fixture tenant and project, the way a fixture run is started and the reset procedure that names every database it resets."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4702,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-149]",
      "number": 149
    },
    {
      "id": "AIFACTORY-TASK-1539",
      "type": "task",
      "parent": "AIFACTORY-US-373",
      "title": "Verify the inventory of the acceptance environment against the backlog and the stores",
      "sequence": "17.05.02.02",
      "description": "Verify the inventory of the acceptance environment against the backlog and the stores. Expected output: Run `python -I tools/docs_model check` for the model and the freshness of the generated output and `mkdocs build --strict` for the site with the page; a comparison of the inventory with the deliveries of increment I1 in model/backlog/features and with model/stores.yaml finds one row per first-outcome service and gateway, the task of increment I0 that created its repository and the feature that delivers the service, and one store per service, which proves AC1, AC3 and AC4 of AIFACTORY-US-373 (ADR-0028, ADR-0021).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run `python -I tools/docs_model check` for the model and the freshness of the generated output and `mkdocs build --strict` for the site with the page; a comparison of the inventory with the deliveries of increment I1 in model/backlog/features and with model/stores.yaml finds one row per first-outcome service and gateway, the task of increment I0 that created its repository and the feature that delivers the service, and one store per service, which proves AC1, AC3 and AC4 of AIFACTORY-US-373 (ADR-0028, ADR-0021)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1539]",
      "number": 1539
    },
    {
      "id": "AIFACTORY-US-374",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-092",
      "title": "Local environment: a recorded run on a clean machine starts a service from the steps alone, and a recorded call crosses the acceptance environment with its scope",
      "sequence": "17.05.03",
      "description": "As an operator, I want recorded runs that show the steps work for someone who did not write them, so that the local estate is accepted on facts before services are built on it. Steps that only their author has followed are not proven. This PBI is the proof of the feature and consists of two recorded runs. In the first, a person or a coding agent who did not write the local setup page follows it on a machine that has only the listed prerequisites, for the first repository, `ConnectSoft.AI.SoftwareFactory.RunControlService`. The record holds every step that was run and its result, the time the service took to report ready, the databases the service opened, the answer to a call with a token and to a call without one, one event published and consumed with no broker process running and the start with no model key configured. A step that had to be changed, guessed or repeated is recorded as a finding and leads to a correction of the page before the run is repeated. The record shows that every database the service opened is on the list the owner agreed and that no shared database was touched. In the second run, the acceptance environment is brought up by its written order with the services whose repository exists at the time of the run, which in this increment is the scaffold of RunControlService behind the scaffold of ControlPlaneApi, and one call with a token of the fixture tenant and project passes the control plane gateway to the service. The record holds the readiness of every started service, the rows of the inventory that are marked not yet created, the trace identifier of the call and the tenant and project the service read. Both records are kept on this site beside the pages they prove. They name no person and carry no date; they name the revision of the page and of each repository that was used. A failed run is recorded as failed with the step that failed, and the feature is not accepted on it. Kind: evidence. Traces: adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-372, AIFACTORY-US-373. Sources: docs/architecture/capability-dependencies.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/stores.yaml, model/backlog/increments.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a machine with only the listed prerequisites and a person or coding agent who did not write the page, when the steps are followed for the first repository, then the service reports ready, a call with a token is answered and a call without one is answered 401, and the record names every step with its result and the revision of the page (ADR-0015 decision 2; model/services/control-plane/RunControlService.yaml).",
        "AC2: Given the record of that run, when the databases the service opened are compared with the agreed list, then each is on the list and no shared database was opened, and a step that had to be changed or guessed is recorded as a finding with the correction of the page (ADR-0028 decision 5; model/stores.yaml).",
        "AC3: Given the acceptance environment brought up by its written order, when one call with a token of the fixture tenant and project passes the control plane gateway to a service, then the record holds the readiness of every service whose repository exists at the time of the run, which in increment I0 is the scaffold of RunControlService behind the scaffold of ControlPlaneApi, the rows that are marked not yet created, the trace identifier of the call and the tenant and project the service read, which equal those of the token (ADR-0015 decision 2, ADR-0028 decision 2)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/stores.yaml",
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1540",
        "AIFACTORY-TASK-1541"
      ],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4703,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-372",
        "AIFACTORY-US-373"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/stores.yaml",
        "model/backlog/increments.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-374]",
      "number": 374
    },
    {
      "id": "AIFACTORY-TASK-1540",
      "type": "task",
      "parent": "AIFACTORY-US-374",
      "title": "Recorded run of the local steps on a clean machine",
      "sequence": "17.05.03.01",
      "description": "Recorded run of the local steps on a clean machine. Expected output: A record on this site of one run of the local setup page for `ConnectSoft.AI.SoftwareFactory.RunControlService` by someone who did not write the page: every step with its result, the time to ready, the databases opened, the answers to a call with and without a token, one event published and consumed with no broker process running, the start with no model key configured, each finding with the correction of the page, and the revisions used, which proves AC1 and AC2 of AIFACTORY-US-374 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A record on this site of one run of the local setup page for `ConnectSoft.AI.SoftwareFactory.RunControlService` by someone who did not write the page: every step with its result, the time to ready, the databases opened, the answers to a call with and without a token, one event published and consumed with no broker process running, the start with no model key configured, each finding with the correction of the page, and the revisions used, which proves AC1 and AC2 of AIFACTORY-US-374 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1540]",
      "number": 1540
    },
    {
      "id": "AIFACTORY-TASK-1541",
      "type": "task",
      "parent": "AIFACTORY-US-374",
      "title": "Recorded scoped call across the acceptance environment",
      "sequence": "17.05.03.02",
      "description": "Recorded scoped call across the acceptance environment. Expected output: A record on this site of one bring-up of the acceptance environment by its written order and of one call through the control plane gateway with a token of the fixture tenant and project: the readiness of every service whose repository exists at the time of the run, the rows marked not yet created, the trace identifier and the tenant and project the service read, which proves AC3 of AIFACTORY-US-374 (ADR-0015).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A record on this site of one bring-up of the acceptance environment by its written order and of one call through the control plane gateway with a token of the fixture tenant and project: the readiness of every service whose repository exists at the time of the run, the rows marked not yet created, the trace identifier and the tenant and project the service read, which proves AC3 of AIFACTORY-US-374 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1541]",
      "number": 1541
    },
    {
      "id": "AIFACTORY-US-527",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-092",
      "title": "Local environment: the Factory instance of the Identity Platform has its two repositories, scaffolded from the Identity and authorization server templates with the registration data of the Factory",
      "sequence": "17.05.04",
      "description": "As an operator, I want the identity service and the authorization server of the Factory to live in repositories of their own, so that the local and the acceptance environment start the sole token issuer from a repository with a pipeline and not from a folder nobody owns. ADR-0028 builds every deployable of the Factory in a repository of its own, scaffolded from a published template. Its amendment on the Factory instance of the Identity Platform (decision D117) applies that to identity: the Factory owns `ConnectSoft.AI.SoftwareFactory.Identity`, scaffolded from the Identity template, and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer`, scaffolded from the authorization server template, each with its pipeline and its deployable. Before that decision the local environment generated an authorization server into a folder that was no repository. This PBI replaces that folder by the two repositories, and the local setup page and the acceptance environment page of this feature start the instance from them. Each repository is created once, by the steps of the checklist of feature `repository-and-pipeline-conventions`: after the recorded approval of the owner for that creation, under the name the amendment gives, with the template package restored from the ConnectSoft feed at the version the gate of its template feature published, `component-identity-template-factory-roles` for the Identity template and `component-auth-server-template-factory-tokens` for the authorization server template. The first commit of each is the unchanged output of its scaffold command, `dotnet new connectsoft-identity -n ConnectSoft.AI.SoftwareFactory.Identity` and `dotnet new connectsoft-authorization-server -n ConnectSoft.AI.SoftwareFactory.AuthorizationServer`. What makes the two a Factory instance is data and no code, and it is the second commit. The identity repository gets the role registration file with the seven Factory roles (AIFACTORY-US-240). The authorization server repository gets the scope registration file that maps each Factory scope of the service files to the resource of the gateway that fronts its service (AIFACTORY-US-244), the workload registration file with one client for each Factory service and agent host whose repository exists (AIFACTORY-US-245), and the public client registration file with the command-line client and its two sign-in flows (AIFACTORY-US-526). The feature that creates a later service repository adds its workload entry. No generated file is edited; a gap found while scaffolding is reported to the template feature and not patched. Each repository builds and tests in its generated pipeline from the shared pipeline templates and restores from the ConnectSoft feed only. The seeded development secrets work only in the Development environment, and the deployment checklist of the template names the credentials an operator replaces elsewhere. The identity service is the system of record of memberships, role assignments and delegations, and the authorization server reads them when it issues a token, so the two start together and the authorization server is configured with the address of the identity service of the same instance. Each of the two has a relational store of its own. Its local database is on the list of names the owner agreed before any database is created, and nothing in this PBI creates, resets or removes a database outside that list. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028. Depends on: feature:component-identity-template-factory-roles, feature:component-auth-server-template-factory-tokens, feature:repository-and-pipeline-conventions. Sources: docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, model/backlog/backlog.yaml, model/gateways.yaml, model/templates.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the recorded approval of the owner and the two template packages at the versions their gates published, when the repositories are created by the steps of the checklist, then `ConnectSoft.AI.SoftwareFactory.Identity` holds the unchanged output of `dotnet new connectsoft-identity` and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer` the unchanged output of `dotnet new connectsoft-authorization-server`, both names are entries of model/backlog/backlog.yaml, each solution builds and its tests pass in its generated pipeline, and the ConnectSoft feed is the only package source (ADR-0028 decision 1 and its amendment on the Factory instance of the Identity Platform).",
        "AC2: Given the registration data of the second commit, when the two services are seeded in the Development environment, then the identity service holds the seven Factory roles, and the authorization server holds the Factory scopes mapped to the resource of the gateway that model/gateways.yaml names for their service, one workload client per registered service and the public client of the command-line client with the authorization code flow with PKCE and the device code flow; and no generated file differs from a fresh generation of the pinned template package (ADR-0015 decisions 5 and 6 and its amendment on the client sign-in).",
        "AC3: Given the instance started from the two repositories, when a member of the fixture project signs in, then the authorization server reads the role assignments from the identity service of the same instance and issues a user token with the tenant claim, the role claim of the project and the one audience of the control plane gateway, and the local setup page and the acceptance environment page of this feature start this instance and no server generated into a folder that is no repository (ADR-0015 decision 6; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC4: Given the stores of the two repositories, when the instance is started locally, then each binds a local database of its own whose name is on the list the owner agreed before any database was created, and no step of this PBI creates, resets or removes a database the list does not name (ADR-0028 decision 5)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "model/backlog/backlog.yaml",
        "model/gateways.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-2119",
        "AIFACTORY-TASK-2120",
        "AIFACTORY-TASK-2121",
        "AIFACTORY-TASK-2122",
        "AIFACTORY-TASK-2123"
      ],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4704,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-identity-template-factory-roles",
        "feature:component-auth-server-template-factory-tokens",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "model/backlog/backlog.yaml",
        "model/gateways.yaml",
        "model/templates.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-527]",
      "number": 527
    },
    {
      "id": "AIFACTORY-TASK-2119",
      "type": "task",
      "parent": "AIFACTORY-US-527",
      "title": "Scaffold the identity repository of the Factory from the Identity template",
      "sequence": "17.05.04.01",
      "description": "Scaffold the identity repository of the Factory from the Identity template. Expected output: The repository `ConnectSoft.AI.SoftwareFactory.Identity` is created once, after the recorded approval of the owner and by the steps of the checklist of feature `repository-and-pipeline-conventions`; its first commit is the unchanged output of `dotnet new connectsoft-identity -n ConnectSoft.AI.SoftwareFactory.Identity` with the template package restored from the ConnectSoft feed at the version the gate of feature `component-identity-template-factory-roles` published; the solution builds, its tests pass and one run of its generated pipeline is green.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Identity. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository `ConnectSoft.AI.SoftwareFactory.Identity` is created once, after the recorded approval of the owner and by the steps of the checklist of feature `repository-and-pipeline-conventions`; its first commit is the unchanged output of `dotnet new connectsoft-identity -n ConnectSoft.AI.SoftwareFactory.Identity` with the template package restored from the ConnectSoft feed at the version the gate of feature `component-identity-template-factory-roles` published; the solution builds, its tests pass and one run of its generated pipeline is green."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Identity"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2119]",
      "number": 2119
    },
    {
      "id": "AIFACTORY-TASK-2120",
      "type": "task",
      "parent": "AIFACTORY-US-527",
      "title": "Scaffold the authorization server repository of the Factory from the authorization server template",
      "sequence": "17.05.04.02",
      "description": "Scaffold the authorization server repository of the Factory from the authorization server template. Expected output: The repository `ConnectSoft.AI.SoftwareFactory.AuthorizationServer` is created once, after the recorded approval of the owner and by the steps of the checklist of feature `repository-and-pipeline-conventions`; its first commit is the unchanged output of `dotnet new connectsoft-authorization-server -n ConnectSoft.AI.SoftwareFactory.AuthorizationServer` with the template package restored from the ConnectSoft feed at the version the gate of feature `component-auth-server-template-factory-tokens` published; the solution builds, its tests pass and one run of its generated pipeline is green.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AuthorizationServer. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository `ConnectSoft.AI.SoftwareFactory.AuthorizationServer` is created once, after the recorded approval of the owner and by the steps of the checklist of feature `repository-and-pipeline-conventions`; its first commit is the unchanged output of `dotnet new connectsoft-authorization-server -n ConnectSoft.AI.SoftwareFactory.AuthorizationServer` with the template package restored from the ConnectSoft feed at the version the gate of feature `component-auth-server-template-factory-tokens` published; the solution builds, its tests pass and one run of its generated pipeline is green."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AuthorizationServer"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2120]",
      "number": 2120
    },
    {
      "id": "AIFACTORY-TASK-2121",
      "type": "task",
      "parent": "AIFACTORY-US-527",
      "title": "Role registration file of the Factory in the identity repository",
      "sequence": "17.05.04.03",
      "description": "Role registration file of the Factory in the identity repository. Expected output: The identity repository holds the role registration file with the seven Factory roles, their allowed scope kinds and the roles each covers, as ADR-0015 decision 5 names them, in the schema that AIFACTORY-US-240 delivers; the seed reads it in the Development environment, and no generated file is edited.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Identity. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The identity repository holds the role registration file with the seven Factory roles, their allowed scope kinds and the roles each covers, as ADR-0015 decision 5 names them, in the schema that AIFACTORY-US-240 delivers; the seed reads it in the Development environment, and no generated file is edited."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Identity"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4704,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2121]",
      "number": 2121
    },
    {
      "id": "AIFACTORY-TASK-2122",
      "type": "task",
      "parent": "AIFACTORY-US-527",
      "title": "Scope, workload and public client registration files of the Factory in the authorization server repository",
      "sequence": "17.05.04.04",
      "description": "Scope, workload and public client registration files of the Factory in the authorization server repository. Expected output: The authorization server repository holds the scope registration file with every Factory scope of the service files under model/services mapped to the resource of the gateway that model/gateways.yaml names for its service, the workload registration file with one client for each Factory service and agent host whose repository exists and only its `svc.` scopes, and the public client registration file with the command-line client, its two flows, its loopback redirect address and the scopes of the control plane gateway; the server is configured with the address of the identity service of the same instance, and no generated file is edited.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AuthorizationServer. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The authorization server repository holds the scope registration file with every Factory scope of the service files under model/services mapped to the resource of the gateway that model/gateways.yaml names for its service, the workload registration file with one client for each Factory service and agent host whose repository exists and only its `svc.` scopes, and the public client registration file with the command-line client, its two flows, its loopback redirect address and the scopes of the control plane gateway; the server is configured with the address of the identity service of the same instance, and no generated file is edited."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AuthorizationServer"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4704,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2122]",
      "number": 2122
    },
    {
      "id": "AIFACTORY-TASK-2123",
      "type": "task",
      "parent": "AIFACTORY-US-527",
      "title": "Verify the Factory instance of the Identity Platform by a seeded start and one issued token",
      "sequence": "17.05.04.05",
      "description": "Verify the Factory instance of the Identity Platform by a seeded start and one issued token. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on both solutions and start the two services together in the Development environment, each on a throwaway database of the pipeline container; the comparison of the generated files with a fresh generation, the seeded roles, scopes and clients, and the token of a member of the fixture project with its tenant claim, its role claim and the one audience of the control plane gateway pass and prove AC1 to AC4 of AIFACTORY-US-527 (ADR-0015, ADR-0028); no named or shared database is touched.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AuthorizationServer.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on both solutions and start the two services together in the Development environment, each on a throwaway database of the pipeline container; the comparison of the generated files with a fresh generation, the seeded roles, scopes and clients, and the token of a member of the fixture project with its tenant claim, its role claim and the one audience of the control plane gateway pass and prove AC1 to AC4 of AIFACTORY-US-527 (ADR-0015, ADR-0028); no named or shared database is touched."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AuthorizationServer"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2123]",
      "number": 2123
    },
    {
      "id": "AIFACTORY-US-134",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-092",
      "title": "Local development environment for a Factory service is delivered",
      "sequence": "17.05.05",
      "description": "As an operator, I want a local development environment and an acceptance environment for the Factory services, so that a developer or a coding agent can run any first-outcome service with its store, messaging and identity from documented steps. This is the integration PBI of the feature. A developer or a coding agent can run any first-outcome service locally with its store, its messaging and its identity, from documented steps, without touching a shared database, and the first-outcome services can run together in one acceptance environment. AIFACTORY-US-372 delivers the local setup page: one local database per service with names the owner agreed before any database is created, the Orleans messaging profile without a broker, the Factory instance of the Identity Platform started from its own two repositories and model keys through secret references only. AIFACTORY-US-527 creates those two repositories, `ConnectSoft.AI.SoftwareFactory.Identity` and `ConnectSoft.AI.SoftwareFactory.AuthorizationServer`, from the Identity template and the authorization server template with the registration data of the Factory (ADR-0028 amendment of decision D117). AIFACTORY-US-373 delivers the page of the acceptance environment with its inventory, its bring-up order, its fixture tenant and project and a reset that names every database it resets. AIFACTORY-US-374 proves both by recorded runs of someone who did not write the pages. This PBI closes the feature: the two pages and the two records are linked from the index of the handoff records and from the navigation of the site, which are written by hand, and the site builds with them; the page of increment I0 is generated from the model and is not edited. The feature is done when the local estate that the epic names in its completion exists as pages that were followed successfully. No page here creates a database, a repository or an environment by itself; the steps are run by a person or an agent after the owner agreed the names, and the two repositories of AIFACTORY-US-527 are created only after the recorded approval of the owner. The environment stack generated by the platform template replaces the written bring-up in a later increment and is no part of this feature. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-372, AIFACTORY-US-373, AIFACTORY-US-374, AIFACTORY-US-527. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, handoffs/2026-10-09-independent-review/INDEX.md, model/stores.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the tasks of AIFACTORY-FEAT-092 are done, then the local setup page, the acceptance environment page and the two recorded runs exist in ConnectSoft.AI.SoftwareFactory.Documentation and are linked from the index of the handoff records, handoffs/2026-10-09-independent-review/INDEX.md, and from the navigation of the site; no generated page is edited for a link (ADR-0028 decision 5; the pages name one store per service as model/stores.yaml does).",
        "AC2: Given the repository with those outputs, when `python -I tools/docs_model validate` runs, then it reports no error and no warning, and the pages name one store per service as model/stores.yaml does (ADR-0028 decision 5).",
        "AC3: Given the two recorded runs, when they are read, then the local run opened only databases of the agreed list and the call across the acceptance environment carried the tenant and project of its token to the service (ADR-0015 decision 2, ADR-0028 decision 5)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "handoffs/2026-10-09-independent-review/INDEX.md",
        "model/stores.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1542",
        "AIFACTORY-TASK-715"
      ],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4705,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-372",
        "AIFACTORY-US-373",
        "AIFACTORY-US-374",
        "AIFACTORY-US-527"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "handoffs/2026-10-09-independent-review/INDEX.md",
        "model/stores.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-134]",
      "number": 134
    },
    {
      "id": "AIFACTORY-TASK-1542",
      "type": "task",
      "parent": "AIFACTORY-US-134",
      "title": "Link the environment pages and the recorded runs from the handoff records",
      "sequence": "17.05.05.01",
      "description": "Link the environment pages and the recorded runs from the handoff records. Expected output: The local setup page, the acceptance environment page and the two recorded runs are linked from the index of the handoff records, a page written by hand, and the navigation of the site lists the two pages; no page that tools/docs_model generates is edited, so `python -I tools/docs_model check` reports no changed output, which proves AC1 of AIFACTORY-US-134.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "The local setup page, the acceptance environment page and the two recorded runs are linked from the index of the handoff records, a page written by hand, and the navigation of the site lists the two pages; no page that tools/docs_model generates is edited, so `python -I tools/docs_model check` reports no changed output, which proves AC1 of AIFACTORY-US-134."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4705,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1542]",
      "number": 1542
    },
    {
      "id": "AIFACTORY-TASK-715",
      "type": "task",
      "parent": "AIFACTORY-US-134",
      "title": "Verify local-development-environment against its acceptance criteria",
      "sequence": "17.05.05.02",
      "description": "Verify local-development-environment against its acceptance criteria. Expected output: The outputs of the tasks of AIFACTORY-FEAT-092 exist and `python -I tools/docs_model validate` reports no error, which proves AC1 to AC3 of AIFACTORY-US-134.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The outputs of the tasks of AIFACTORY-FEAT-092 exist and `python -I tools/docs_model validate` reports no error, which proves AC1 to AC3 of AIFACTORY-US-134."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:devops-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 47,
      "phase": "factory",
      "stackRank": 4705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-715]",
      "number": 715
    },
    {
      "id": "AIFACTORY-FEAT-093",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Command-line client for the first outcome",
      "sequence": "17.06",
      "description": "The first outcome is used through the control plane API and a small command-line client: submit a vision, follow a run, approve a recipe and approve a change proposal. Studio follows in a later increment. I0 delivers the repository, the skeleton and the sign-in (authorization code with PKCE by default, device code as a switch); the commands are the I1 feature command-line-client-commands (owner decision D117). Increment I0: Readiness. Build order 48 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-375",
        "AIFACTORY-US-377",
        "AIFACTORY-US-003"
      ],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4800,
      "titlePrefix": "[AIFACTORY-FEAT-093]",
      "number": 93
    },
    {
      "id": "AIFACTORY-US-375",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-093",
      "title": "Command-line client: a person signs in by authorization code with PKCE or by device code, the client holds a short-lived token for the control plane gateway and keeps no long-lived secret on disk",
      "sequence": "17.06.01",
      "description": "As a requester, I want to sign in from the command-line client without a secret ending up in a file, so that I can use the Factory before the Studio exists and my credentials stay where the operating system protects them. ADR-0029 decision 2 has the first outcome used through the API and a command-line client, and the Studio follows in a later increment. Owner decision D117 splits that client over two increments: increment I0 delivers the repository, the skeleton and the sign-in, and the commands of the first outcome are the feature `command-line-client-commands` of increment I1. This PBI delivers the I0 part in the repository `ConnectSoft.AI.SoftwareFactory.Cli`. The client is a console application built by the shared pipeline templates. The model names no template for a console client, so the repository is created without one, under the name, pipeline and feed rules of the checklist of feature `repository-and-pipeline-conventions`. The skeleton is what the commands are written into later: the command host, the configuration, the rule that a refused call ends with a failure code and never silently, and one client port through which a command will reach the control plane gateway. In this increment the port has a hand-written adapter that does one thing, attach the token of the signed-in person to a request to the configured base address of the gateway; the pinned control plane client of feature `typed-gateway-clients` takes its place in increment I1. No command of the first outcome is part of the skeleton. The client is a public client of the authorization server of the Identity Platform: it holds no client secret, and a person signs in interactively. The amendment of ADR-0015 on the client sign-in (decision D117) decides the two flows. By default the client signs in with the authorization code flow with PKCE: it opens the browser of the machine on the authorization request, receives the code on a loopback redirect address of that machine and redeems it with the code verifier. A switch of the sign-in command selects the device code flow for a machine without a browser: the client prints the verification address and the user code and polls the token endpoint at the interval the authorization server gives, until the person has confirmed the code on another device, the code is denied or it expires. Both flows end in the same token and the same custody. The client side of the sign-in is this PBI: the authority, the client identifier, the requested audience and the requested scopes are read from configuration. The registration of the public client with both flows, its scopes and its redirect address is registration data of the authorization server and no output of the client repository; AIFACTORY-US-526 of feature `component-auth-server-template-factory-tokens` delivers it. The token the client asks for is a user token, and a user token has one audience, the gateway that fronts its scopes (ADR-0015 amendment on the audience, decision D114). The client therefore requests one token per gateway audience it calls, each audience with its scopes read from configuration, and never reuses the token of one gateway for another. The commands of the control plane call the control plane gateway, so the client requests a token for that gateway with the scopes those commands need as the service files of the model name them, `factory.projects.read`, `factory.runs.write`, `factory.runs.read`, `factory.approvals.read` and `factory.approvals.decide`; this increment configures that one audience. The recipe act of the first outcome calls the template catalog gateway, which fronts GenerationRecipeService (decision D123), so its commands request a second token for the audience of that gateway with `factory.recipes.read` and `factory.recipes.approve`; that audience is configured with those commands in I1 (AIFACTORY-US-1507 of feature `command-line-client-commands`). Each gateway forwards the user token to the service it fronts and that service accepts the audience of its gateway, so one token serves every command of its gateway and the client never asks for a token per service (ADR-0015 amendment on the forwarded user token). The token carries the tenant and one role claim per project assignment, issued by the authorization server as feature `component-auth-server-template-factory-tokens` delivers them; the client reads them only to show who is signed in and decides nothing from them, because every backend enforces them per request (ADR-0015 decision 6). The access token is short-lived. The token and what is needed to renew it are kept in the credential store of the operating system and in no file, so no long-lived secret is on disk. When the token has expired, the client renews it without a prompt while the authorization server allows it; when it cannot, the call stops, tells the person to sign in again and ends with a failure code. It never fails silently, never retries with an expired token and never prints a token, at any verbosity. A sign-out removes the entries from the credential store. The claim type names the client reads are those of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions`; the client defines none. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028. Depends on: feature:component-auth-server-template-factory-tokens, feature:component-extensions-ai, feature:repository-and-pipeline-conventions. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0029-build-backlog-as-a-model-kind.md, model/services/control-plane/RunControlService.yaml, model/services/control-plane/ProjectService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given valid credentials on a machine with a browser, when I sign in without a switch, then the client signs in as a public client by the authorization code flow with PKCE, sends no client secret, and holds a short-lived user token whose one audience is the control plane gateway and whose requested scopes are `factory.projects.read`, `factory.runs.write`, `factory.runs.read`, `factory.approvals.read` and `factory.approvals.decide`, the token and what renews it are kept in the credential store of the operating system, and no token, renewal credential or client secret is written to a file (ADR-0015 amendments on the client sign-in and on the one audience of a user token; ADR-0028 decision 2 makes the gateway the route to the services; model/services/control-plane/RunControlService.yaml and model/services/control-plane/ProjectService.yaml name the scopes).",
        "AC2: Given a machine without a browser, when I sign in with the device code switch, then the client prints the verification address and the user code, polls the token endpoint at the interval the authorization server gives, and after I confirmed the code on another device holds the same token under the same custody as after the default flow; a code that is denied or that expires ends the sign-in with a failure code and nothing is stored (ADR-0015 amendment on the client sign-in; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC3: Given my token expired, when a call through the client port of the skeleton needs a token, then the client renews the token without a prompt while the authorization server allows it, and otherwise stops, asks me to sign in again and ends with a failure code; it does not fail silently and does not send the expired token a second time (ADR-0015 decision 6).",
        "AC4: Given I am signed in, when I sign out, then the entries are removed from the credential store and the next call asks me to sign in; and at any verbosity no output line and no log line holds a token value (ADR-0015 decision 2; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-150",
        "AIFACTORY-TASK-191",
        "AIFACTORY-TASK-1543"
      ],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4801,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-auth-server-template-factory-tokens",
        "feature:component-extensions-ai",
        "feature:repository-and-pipeline-conventions"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-375]",
      "number": 375
    },
    {
      "id": "AIFACTORY-TASK-150",
      "type": "task",
      "parent": "AIFACTORY-US-375",
      "title": "Scaffold the client and authenticate against the Identity Platform",
      "sequence": "17.06.01.01",
      "description": "Scaffold the client and authenticate against the Identity Platform. Expected output: The repository `ConnectSoft.AI.SoftwareFactory.Cli` is created without a template, because the model names none for a console client, under the name, pipeline and feed rules of the checklist of feature `repository-and-pipeline-conventions` and after the approval of the owner; it holds a console application that builds and tests from the shared pipeline templates and the skeleton of the client: the command host, the configuration, the failure code of a refused call and the one client port to the control plane gateway with a hand-written adapter that attaches the token to a request to the configured base address; it holds no command of the first outcome; it reads the authority, its client identifier, the requested audience of the control plane gateway and the requested scopes (`factory.projects.read`, `factory.runs.write`, `factory.runs.read`, `factory.approvals.read`, `factory.approvals.decide`) from configuration; it signs a person in for that audience and stores no long-lived secret; the registration of the public client in the authorization server is no output of this repository.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository `ConnectSoft.AI.SoftwareFactory.Cli` is created without a template, because the model names none for a console client, under the name, pipeline and feed rules of the checklist of feature `repository-and-pipeline-conventions` and after the approval of the owner; it holds a console application that builds and tests from the shared pipeline templates and the skeleton of the client: the command host, the configuration, the failure code of a refused call and the one client port to the control plane gateway with a hand-written adapter that attaches the token to a request to the configured base address; it holds no command of the first outcome; it reads the authority, its client identifier, the requested audience of the control plane gateway and the requested scopes (`factory.projects.read`, `factory.runs.write`, `factory.runs.read`, `factory.approvals.read`, `factory.approvals.decide`) from configuration; it signs a person in for that audience and stores no long-lived secret; the registration of the public client in the authorization server is no output of this repository."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-150]",
      "number": 150
    },
    {
      "id": "AIFACTORY-TASK-191",
      "type": "task",
      "parent": "AIFACTORY-US-375",
      "title": "Sign-in against the Identity Platform",
      "sequence": "17.06.01.02",
      "description": "Sign-in against the Identity Platform. Expected output: Interactive sign-in as a public client, by the authorization code flow with PKCE by default and by the device code flow behind a switch of the sign-in command, with token renewal, a command that shows who is signed in and a sign-out; the token and what renews it are kept in the credential store of the operating system and in no file; a denied or expired device code stores nothing; an expired token that cannot be renewed stops the call with a request to sign in again and a failure code.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Interactive sign-in as a public client, by the authorization code flow with PKCE by default and by the device code flow behind a switch of the sign-in command, with token renewal, a command that shows who is signed in and a sign-out; the token and what renews it are kept in the credential store of the operating system and in no file; a denied or expired device code stores nothing; an expired token that cannot be renewed stops the call with a request to sign in again and a failure code."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-191]",
      "number": 191
    },
    {
      "id": "AIFACTORY-TASK-1543",
      "type": "task",
      "parent": "AIFACTORY-US-375",
      "title": "Verify the sign-in, the renewal and the custody of the token",
      "sequence": "17.06.01.03",
      "description": "Verify the sign-in, the renewal and the custody of the token. Expected output: Run `dotnet test -c Release --no-build` on the client solution against a local authorization server; the sign-in by authorization code with PKCE, the sign-in by device code with a confirmed, a denied and an expired code, the audience of the control plane gateway, the silent renewal, the expired token that cannot be renewed, the sign-out and the search of output and log for a token value pass and prove AC1 to AC4 of AIFACTORY-US-375 (ADR-0015).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the client solution against a local authorization server; the sign-in by authorization code with PKCE, the sign-in by device code with a confirmed, a denied and an expired code, the audience of the control plane gateway, the silent renewal, the expired token that cannot be renewed, the sign-out and the search of output and log for a token value pass and prove AC1 to AC4 of AIFACTORY-US-375 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1543]",
      "number": 1543
    },
    {
      "id": "AIFACTORY-US-377",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-093",
      "title": "Command-line client: the pipeline of the client repository proves the sign-in by both flows, the renewal, the sign-out and the custody of the token against a local authorization server",
      "sequence": "17.06.02",
      "description": "As a requester, I want proof from a pipeline run that the client signs in by both flows and leaves no secret behind, so that the commands of the first outcome are built on a sign-in that is already proven. This PBI is the proof of the feature. The pipeline of the repository `ConnectSoft.AI.SoftwareFactory.Cli` is built from the shared pipeline templates, as the conventions of feature `repository-and-pipeline-conventions` require, and its acceptance stage runs the built client as a process, the way a person runs it. The stage starts a local authorization server, generated from `connectsoft-authorization-server` at the version the gate of feature `component-auth-server-template-factory-tokens` published into a working folder of the pipeline that is not committed. Its registration data hold the public client of the command-line client with the authorization code flow with PKCE and the device code flow, as AIFACTORY-US-526 of that feature delivers the registration, together with a tenant, a project and a member. The harness plays the part of the person and of the browser. For the default flow it follows the authorization request the client opens, signs the member in and lets the redirect reach the loopback address of the client. For the device code switch it reads the verification address and the user code the client printed and confirms the code as the member; in a second run it denies the code. After each sign-in it runs the command that shows who is signed in, lets the access token expire and proves the renewal without a prompt, then signs out. After the run a scan of every file the client process wrote, and of its output and log, searches for a token, a renewal credential and a secret: it must find none, because the only place a token may rest is the credential store of the operating system. The pipeline publishes the built client as its build artifact with the version of the build. The model does not state how the client is distributed to its users, so this PBI proves the build and the behaviour and claims no package on a feed. No command of the first outcome is run here: the commands and their run against the real control plane gateway are the feature `command-line-client-commands` of increment I1 (owner decision D117). Kind: evidence. Traces: adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-375, feature:repository-and-pipeline-conventions, feature:component-auth-server-template-factory-tokens. Sources: docs/architecture/capability-dependencies.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the client repository, when it runs, then build and tests come from the shared pipeline templates with complete test reports, the acceptance stage runs the built client as a process, and the built client is published as the build artifact of the run (ADR-0028; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC2: Given the acceptance stage with a local authorization server whose registration data hold the public client of the command-line client, when the built client signs in once by the authorization code flow with PKCE and once with the device code switch, then each token it obtained has the control plane gateway as its one audience and the scopes that model/services/control-plane/RunControlService.yaml names for the commands, the command that shows who is signed in prints the tenant and the roles of the member, an expired access token is renewed without a prompt, and a sign-in whose device code was denied ends with a failure code (ADR-0015 amendments on the client sign-in and on the one audience of a user token).",
        "AC3: Given the files, the output and the log that the client process wrote during the acceptance stage, when they are scanned, then no token, no renewal credential and no secret is found, and a planted run that writes a token to a file fails the scan (ADR-0015 decision 2)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1546",
        "AIFACTORY-TASK-1547",
        "AIFACTORY-TASK-1548"
      ],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4802,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-375",
        "feature:repository-and-pipeline-conventions",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-377]",
      "number": 377
    },
    {
      "id": "AIFACTORY-TASK-1546",
      "type": "task",
      "parent": "AIFACTORY-US-377",
      "title": "Pipeline of the client repository from the shared pipeline templates",
      "sequence": "17.06.02.01",
      "description": "Pipeline of the client repository from the shared pipeline templates. Expected output: The pipeline file of the client repository calls the shared build and test steps of ConnectSoft.AzurePipelines, runs the acceptance stage against the built client and publishes the built client as the build artifact; it holds no build or test script of its own and restores from the ConnectSoft feed only.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The pipeline file of the client repository calls the shared build and test steps of ConnectSoft.AzurePipelines, runs the acceptance stage against the built client and publishes the built client as the build artifact; it holds no build or test script of its own and restores from the ConnectSoft feed only."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4802,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1546]",
      "number": 1546
    },
    {
      "id": "AIFACTORY-TASK-1547",
      "type": "task",
      "parent": "AIFACTORY-US-377",
      "title": "Acceptance harness with a local authorization server, both sign-in flows and a secret scan",
      "sequence": "17.06.02.02",
      "description": "Acceptance harness with a local authorization server, both sign-in flows and a secret scan. Expected output: A harness in the client repository that generates a local authorization server from `connectsoft-authorization-server` at the version the gate of feature `component-auth-server-template-factory-tokens` published, into a working folder of the pipeline that is not committed, with the public client of the command-line client in its registration data (AIFACTORY-US-526) and with a tenant, a project and a member; it runs the built client as a process through the sign-in by authorization code with PKCE, where the harness follows the authorization request to the loopback redirect, and through the sign-in with the device code switch, where the harness confirms the user code in one run and denies it in another, then through the command that shows who is signed in, a renewal after expiry and the sign-out, and scans the files, the output and the log of the process for a token, a renewal credential and a secret; a planted token file proves that the scan fails; the store of the local server is a throwaway database of the pipeline container and no named or shared database is touched.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "A harness in the client repository that generates a local authorization server from `connectsoft-authorization-server` at the version the gate of feature `component-auth-server-template-factory-tokens` published, into a working folder of the pipeline that is not committed, with the public client of the command-line client in its registration data (AIFACTORY-US-526) and with a tenant, a project and a member; it runs the built client as a process through the sign-in by authorization code with PKCE, where the harness follows the authorization request to the loopback redirect, and through the sign-in with the device code switch, where the harness confirms the user code in one run and denies it in another, then through the command that shows who is signed in, a renewal after expiry and the sign-out, and scans the files, the output and the log of the process for a token, a renewal credential and a secret; a planted token file proves that the scan fails; the store of the local server is a throwaway database of the pipeline container and no named or shared database is touched."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1547]",
      "number": 1547
    },
    {
      "id": "AIFACTORY-TASK-1548",
      "type": "task",
      "parent": "AIFACTORY-US-377",
      "title": "Verify the client by one green pipeline run and one planted failing scan",
      "sequence": "17.06.02.03",
      "description": "Verify the client by one green pipeline run and one planted failing scan. Expected output: One run of the pipeline is green with the acceptance stage and the published build artifact; one run with the planted token file fails at the scan; both prove AC1 to AC3 of AIFACTORY-US-377 (ADR-0015, ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "One run of the pipeline is green with the acceptance stage and the published build artifact; one run with the planted token file fails at the scan; both prove AC1 to AC3 of AIFACTORY-US-377 (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1548]",
      "number": 1548
    },
    {
      "id": "AIFACTORY-US-003",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-093",
      "title": "Sign in from the command line and hold a token for the control plane gateway",
      "sequence": "17.06.03",
      "description": "As a requester, I want to sign in from the command-line client and see who I am signed in as, so that I can use the Factory before the Studio exists. This is the integration PBI of the feature. Increment I0 delivers the repository of the command-line client, its skeleton and its sign-in; the commands of the first outcome, submit a vision, follow the run, approve a recipe and approve a change proposal, are the feature `command-line-client-commands` of increment I1 (owner decision D117) and are promised by nothing here. A requester signs in from the command-line client and sees who is signed in: the tenant and the role per project that the token carries. AIFACTORY-US-375 delivers the repository, the skeleton and the sign-in as a public client, by the authorization code flow with PKCE by default and by the device code flow behind a switch, with a short-lived user token for the one audience of the control plane gateway and with no long-lived secret on disk. AIFACTORY-US-377 proves it in the pipeline of the client repository against a local authorization server. This PBI proves it in the local environment of feature `local-development-environment`, against the authorization server of the Factory instance of the Identity Platform that the environment runs: one walk by a person through both sign-in flows, the command that shows who is signed in, a renewal and the sign-out. The thin scope of this increment is stated exactly: the client, its skeleton and its sign-in exist and are proven; the commands and the services that answer them arrive in increment I1, where they run against the real gateway through the pinned control plane client. The client decides nothing about access: the roles in the token are enforced by every backend, and a project the token does not grant is refused by the gateway, not hidden by the client. Kind: enabling. Traces: adrs: ADR-0015. Depends on: AIFACTORY-US-375, AIFACTORY-US-377, feature:local-development-environment. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, model/backlog/increments.yaml.",
      "acceptanceCriteria": [
        "AC1: Given valid credentials, when I sign in by the authorization code flow with PKCE or with the device code switch, then the client holds a short-lived token and no long-lived secret on disk (ADR-0015 amendments on the client sign-in and on the one audience of a user token).",
        "AC2: Given I am signed in, when I ask who is signed in, then the client shows the tenant and my role per project as the token carries them and decides nothing from them, because every backend enforces them per request (ADR-0015 decisions 5 and 6).",
        "AC3: Given my token expired, when a call needs a token, then the client renews it while the authorization server allows it and otherwise asks me to sign in again and does not fail silently (ADR-0015 decision 6).",
        "AC4: Given the local environment with the authorization server of the Factory instance of the Identity Platform, when a person walks through the sign-in by authorization code with PKCE, the command that shows who is signed in, the sign-out and the sign-in with the device code switch, then every step prints the state it reached and the walk is recorded; the commands of the first outcome are left to the feature `command-line-client-commands` of increment I1 (ADR-0015; model/backlog/increments.yaml)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1549",
        "AIFACTORY-TASK-712"
      ],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4803,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-375",
        "AIFACTORY-US-377",
        "feature:local-development-environment"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "model/backlog/increments.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-003]",
      "number": 3
    },
    {
      "id": "AIFACTORY-TASK-1549",
      "type": "task",
      "parent": "AIFACTORY-US-003",
      "title": "Recorded walk through both sign-in flows in the local environment",
      "sequence": "17.06.03.01",
      "description": "Recorded walk through both sign-in flows in the local environment. Expected output: A record of one walk by a person in the local environment against the authorization server of the Factory instance of the Identity Platform: the sign-in by authorization code with PKCE, the command that shows who is signed in, the sign-out and the sign-in with the device code switch, each step with the printed state, which proves AC4 of AIFACTORY-US-003 and names the revision of the client that was used.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "A record of one walk by a person in the local environment against the authorization server of the Factory instance of the Identity Platform: the sign-in by authorization code with PKCE, the command that shows who is signed in, the sign-out and the sign-in with the device code switch, each step with the printed state, which proves AC4 of AIFACTORY-US-003 and names the revision of the client that was used."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1549]",
      "number": 1549
    },
    {
      "id": "AIFACTORY-TASK-712",
      "type": "task",
      "parent": "AIFACTORY-US-003",
      "title": "Verify cli-sign-in by running the declared command",
      "sequence": "17.06.03.02",
      "description": "Verify cli-sign-in by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build`; they pass and prove AC1 to AC3 of AIFACTORY-US-003.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build`; they pass and prove AC1 to AC3 of AIFACTORY-US-003."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 48,
      "phase": "factory",
      "stackRank": 4803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-712]",
      "number": 712
    },
    {
      "id": "AIFACTORY-FEAT-094",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Import of the backlog draft by the owner",
      "sequence": "17.07",
      "description": "Every owner decision the first wave depended on is recorded: the derived decisions D70, D71 and D74 and the stub register of the first outcome (D80), the Scrum process (D81), the waiver that lets Draft releases run before the evaluation gate exists (D83) and the import without an area path (D85). One act stays with the owner: importing the draft into Azure DevOps, because no session of the Factory design work has a connection to it. Increment I0: Readiness. Build order 49 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-378",
        "AIFACTORY-US-379",
        "AIFACTORY-US-380",
        "AIFACTORY-US-135"
      ],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4900,
      "titlePrefix": "[AIFACTORY-FEAT-094]",
      "number": 94
    },
    {
      "id": "AIFACTORY-US-378",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-094",
      "title": "Owner decisions: the import files carry the Scrum types and no area path, each packed or per-epic file holds at most 1,000 rows, and a guide tells the owner what to import in which order",
      "sequence": "17.07.01",
      "description": "As a platform admin, I want import files and a guide that match what the owner decided about the tracker, so that the owner can import the draft in one sitting and nothing is created before that. ADR-0029 decision 1 keeps the backlog a model kind of this repository: nothing here creates a work item in a tracker, and importing the draft is a separate, explicit act of the owner. Two decisions of the owner shape the import files. The Azure DevOps project uses the Scrum process (decision D81), so the export names the work item types Epic, Feature, Product Backlog Item and Task. The import carries no area path (decision D85), so the items land in the root area of the project and are moved later if needed. Both are recorded in model/backlog/backlog.yaml, which also states that nothing was created in a tracker. The files are generated from the model under docs/backlog/export, with the hierarchical title columns, the description, the acceptance criteria, the tags and the stack rank of the derived build order. They are of four sorts. The whole draft, `aifactory-backlog-ado.csv`, is the complete reference file: it holds more than 1,000 rows and is not an import file. The packed files `aifactory-backlog-ado-NN.csv` hold whole epics in build order, at most 1,000 rows each with parents first, and are the way to import the whole draft. The per-epic files hold at most 1,000 rows each as well. A per-increment file is generated without that limit and serves an import only while it stays within 1,000 rows. This PBI delivers the page that tells the owner how to use them. The guide states which file set serves which intent, the whole draft through the packed files in their order or one increment alone through its file while that file stays within 1,000 rows, the mapping of the four types, that a parent row precedes its children inside a file and across the packed files, and what to compare after the import: the count of items per type against the counts the generator reports, and the bracketed identifier at the start of every title. It also states what the files leave out by design: no date, estimate, assignee, sprint or capacity, because progress and people live in the tracker and never here (ADR-0029 decision 6). The guide decides nothing that is still open: the project to import into and the file set to use stay with the owner and are recorded as open by AIFACTORY-US-379. The files are never edited by hand; a change of the model regenerates them, and the check of the site fails when one is stale. Kind: enabling. Traces: adrs: ADR-0029. Sources: docs/architecture/adr/0029-build-backlog-as-a-model-kind.md, docs/backlog/index.md, docs/backlog/export/aifactory-backlog-ado.csv, model/backlog/backlog.yaml, handoffs/2026-10-09-independent-review/open-items.md.",
      "acceptanceCriteria": [
        "AC1: Given model/backlog/backlog.yaml with the Scrum process and no area path, when the import files are generated, then every file under docs/backlog/export names the work item types Epic, Feature, Product Backlog Item and Task and holds no area path column, each packed file `aifactory-backlog-ado-NN.csv` and each per-epic file holds at most 1,000 rows with a parent row before its children, inside each file and across the packed files, and the whole draft `aifactory-backlog-ado.csv` is the complete reference file and is not an import file (ADR-0029 decision 8).",
        "AC2: Given the import guide page, when the owner reads it, then it names the packed files in their order as the way to import the whole draft, a per-increment file as the way to import one increment only while that file stays within 1,000 rows, and the whole draft docs/backlog/export/aifactory-backlog-ado.csv as the reference file that is not imported; it names the mapping of the four types and the comparison to make after the import, the count of items per type and the bracketed identifier in every title, and it states that nothing in this repository creates a work item (ADR-0029 decision 1).",
        "AC3: Given the generated files and the guide, when they are searched, then no row and no line carries a date, an estimate, an assignee, a sprint or a capacity, and `python -I tools/docs_model check` fails when a file under docs/backlog/export differs from what the model generates (ADR-0029 decision 6)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "docs/backlog/index.md",
        "docs/backlog/export/aifactory-backlog-ado.csv",
        "model/backlog/backlog.yaml",
        "handoffs/2026-10-09-independent-review/open-items.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1550",
        "AIFACTORY-TASK-1551"
      ],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4901,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "docs/backlog/index.md",
        "docs/backlog/export/aifactory-backlog-ado.csv",
        "model/backlog/backlog.yaml",
        "handoffs/2026-10-09-independent-review/open-items.md"
      ],
      "titlePrefix": "[AIFACTORY-US-378]",
      "number": 378
    },
    {
      "id": "AIFACTORY-TASK-1550",
      "type": "task",
      "parent": "AIFACTORY-US-378",
      "title": "Import guide page for the backlog draft",
      "sequence": "17.07.01.01",
      "description": "Import guide page for the backlog draft. Expected output: A page of this site, linked from the index of the handoff records and from the navigation of the site and from no generated page, that names the generated files under docs/backlog/export and the intent each serves: the packed files in their order for the whole draft, a per-increment file only while it stays within 1,000 rows, the per-epic files, and the whole draft as the reference file that is not imported; it names the mapping of the types Epic, Feature, Product Backlog Item and Task, the comparison of counts and identifiers after the import and the fields the files leave out by design; it names no project, no person and no date.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "A page of this site, linked from the index of the handoff records and from the navigation of the site and from no generated page, that names the generated files under docs/backlog/export and the intent each serves: the packed files in their order for the whole draft, a per-increment file only while it stays within 1,000 rows, the per-epic files, and the whole draft as the reference file that is not imported; it names the mapping of the types Epic, Feature, Product Backlog Item and Task, the comparison of counts and identifiers after the import and the fields the files leave out by design; it names no project, no person and no date."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4901,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1550]",
      "number": 1550
    },
    {
      "id": "AIFACTORY-TASK-1551",
      "type": "task",
      "parent": "AIFACTORY-US-378",
      "title": "Verify the import files against the tracker settings of the model",
      "sequence": "17.07.01.02",
      "description": "Verify the import files against the tracker settings of the model. Expected output: Run `python -I tools/docs_model check`; the files under docs/backlog/export are fresh, each packed file `aifactory-backlog-ado-NN.csv` and each per-epic file holds at most 1,000 rows with parents first, the four type names equal those of model/backlog/backlog.yaml and no file has an area path column; a read of the guide finds the whole draft named as the reference file and not as an import file, which proves AC1 to AC3 of AIFACTORY-US-378 (ADR-0029).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run `python -I tools/docs_model check`; the files under docs/backlog/export are fresh, each packed file `aifactory-backlog-ado-NN.csv` and each per-epic file holds at most 1,000 rows with parents first, the four type names equal those of model/backlog/backlog.yaml and no file has an area path column; a read of the guide finds the whole draft named as the reference file and not as an import file, which proves AC1 to AC3 of AIFACTORY-US-378 (ADR-0029)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1551]",
      "number": 1551
    },
    {
      "id": "AIFACTORY-US-379",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-094",
      "title": "Owner decisions: every decision that still belongs to the owner is recorded as open with what it blocks, and no backlog item decides it",
      "sequence": "17.07.02",
      "description": "As a platform admin, I want one register of the decisions that are still open and whose they are, so that no writer, agent or backlog item quietly decides what the owner has not decided. Some decisions the build depends on are not taken, and the worst outcome is a value that someone invented and that reads as decided. This PBI keeps one register of them in the open items of the handoff records, each row marked open, and sets the rule that goes with it. The register is complete by a rule and not by a selection. It holds every row of handoffs/2026-10-09-independent-review/open-items.md whose closing column names the owner and that is not marked closed, every item that the decisions D113 to D115 record as left open, every open question recorded under handoffs/2026-10-09-independent-review/pbi-reviews, and every input of the owner that a PBI under model/backlog/pbis states (D140). An input of the owner is a value the model leaves to the owner and a PBI says is never invented; its row names the PBI that states it, says that the owner supplies the value and never states the value. The inputs an I1 service refuses to start without, or without which it discovers nothing, are also entries of the I1 precondition register of AIFACTORY-US-1339, which the owner supplies before the I1 run and which are checked before it: `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod` and `Usage:Budgets:PlatformLimitUsd`, the section `Usage:Estimates` and the pricing revisions of the meters of CostUsageService, the Sandbox pool values of ExecutionCapacityService (boundary, egress, region, size and workspace medium), the template-feed project of the platform tenant of TemplateRegistryService and the source of the tenant region of ProjectService. Three rows are the ones the owner named as still theirs. The tracker import settings: the process and the area path are decided (decisions D81 and D85), while the project to import into, the choice between the packed files and one increment file, and a later move of items out of the root area are not. The team: its shape, its capacity and the owners of the work stay deferred by direction of the owner, and the tracker carries people and dates, never this repository (ADR-0029 decision 6). The units of the seven usage dimensions: the unit and the conversion factor of each of the seven meters that docs/reference/schemas/usage-record.schema.json lists, `model.tokens`, `runs.accepted`, `runs.completed`, `tools.invocations`, `sandbox.minutes`, `storage.gb` and `product.capacity`, are an input of the owner; the metering PBIs fix the rule and the shape of the map and name no value. From the open items the register further holds: the adoption of the canonical AI and messaging decision by its owner; the questions Q-04 and Q-08 to Q-16 of the decision log; the five differences between ADR-0024 and its primary documentation; the consumers of a deletion order outside eight platforms; the three points on which hand pages and the model differ; the repository name of the Studio front end; the template parameter bindings, which the owner and the template owners confirm or correct; and the approval of each epic of the PBI campaign. From decision D115 it holds: the treatment of a project, release or environment that was never announced to the gate states of Run Control; the call that sets the validation reference of an artifact; a read operation for the reconciliation result of usage; the consumer of the three aggregator events of the fleet profile and the health address and criticality of an observed workload; whether a skill package may name a tool of another package; and the names a writer chose that the owner may rename. From the review records of the campaign it holds the open questions of each run, those of this epic among them: the name of the evidence event type and one or two descriptors for the audit evidence record. Where the commands of the command-line client belong is no longer open: they are the I1 feature `command-line-client-commands`, which the done_when of the epic engineering-readiness names beside `typed-gateway-clients` (D140). Two approvals of this epic recur, and each has a row that stays open: the creation of each repository, and the list of the database names of the local and acceptance environments. Each row states the question, what is already decided, what it blocks and that the owner decides. The rule: an item that depends on an open row names the row and states no value for it. When the owner decides, the row is closed with the decision identifier, the decision log gains its row and the model file or ADR that carries the decision changes in the same change. Kind: enabling. Traces: adrs: ADR-0029. Sources: handoffs/2026-10-09-independent-review/open-items.md, handoffs/2026-10-09-independent-review/decision-log.md, docs/architecture/adr/0029-build-backlog-as-a-model-kind.md, docs/architecture/adr/0024-durable-execution-substrate.md, docs/reference/schemas/usage-record.schema.json, model/backlog/backlog.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the register of open decisions, when it is read, then it holds one row each for the tracker import settings, the team and the units of the seven usage dimensions, each marked open, with what is already decided (the Scrum process and no area path in model/backlog/backlog.yaml; the seven meters in docs/reference/schemas/usage-record.schema.json), what the row blocks and that the owner decides it (ADR-0029 decisions 1 and 6).",
        "AC2: Given the backlog and the model, when they are searched for a value of an open row, then no file under model/backlog names a team member, a capacity, a date or a sprint, no file states a unit or a conversion factor for a usage dimension as decided, and an item that depends on an open row names that row (ADR-0029 decision 6; model/backlog/backlog.yaml).",
        "AC3: Given the four sources of the register, when it is compared with them, then every row of handoffs/2026-10-09-independent-review/open-items.md whose closing column names the owner and that is not marked closed, every item that the decisions D113 to D115 record as left open in handoffs/2026-10-09-independent-review/decision-log.md, every open question recorded under handoffs/2026-10-09-independent-review/pbi-reviews, and every input of the owner that a PBI under model/backlog/pbis states, the I1 inputs that D140 enters in the precondition register of AIFACTORY-US-1339 among them (`Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod`, `Usage:Budgets:PlatformLimitUsd`, `Usage:Estimates`, the pricing revisions, the Sandbox pool values, the template-feed project of the platform tenant and the source of the tenant region), has its row with the question, what is decided, what it blocks, the PBI that states it where it is an input, and the owner as the one who decides or supplies it, and none is marked closed without a decision identifier and none states the value (ADR-0029 decision 1; docs/architecture/adr/0024-durable-execution-substrate.md records the five differences as revisit triggers for the owner).",
        "AC4: Given the owner decides an open row, when the decision is recorded, then the row is closed with the decision identifier, and the model file or ADR that carries the decision changes in the same change; until then the row stays open and nothing under docs/backlog or model/backlog reads as decided (ADR-0029 decision 1)."
      ],
      "sourceArtifacts": [
        "handoffs/2026-10-09-independent-review/open-items.md",
        "handoffs/2026-10-09-independent-review/decision-log.md",
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/reference/schemas/usage-record.schema.json",
        "model/backlog/backlog.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1552",
        "AIFACTORY-TASK-1553"
      ],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4902,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "handoffs/2026-10-09-independent-review/open-items.md",
        "handoffs/2026-10-09-independent-review/decision-log.md",
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/reference/schemas/usage-record.schema.json",
        "model/backlog/backlog.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-379]",
      "number": 379
    },
    {
      "id": "AIFACTORY-TASK-1552",
      "type": "task",
      "parent": "AIFACTORY-US-379",
      "title": "Register of the decisions that are still open for the owner",
      "sequence": "17.07.02.01",
      "description": "Register of the decisions that are still open for the owner. Expected output: The open items of the handoff records hold one row per open decision, complete by the rule of the four sources: every row of open-items.md whose closing column names the owner and that is not marked closed (the import of the backlog draft with its tracker settings, the team, the adoption of the canonical AI and messaging decision, the questions Q-04 and Q-08 to Q-16, the five differences of ADR-0024, the consumers of a deletion order outside eight platforms, the three points on which hand pages and the model differ, the repository name of the Studio front end, the template parameter bindings and the approval of each epic of the PBI campaign), every item decision D115 leaves open (the never announced gate state, the validation reference of an artifact, the unit and conversion factor of each of the seven meters of docs/reference/schemas/usage-record.schema.json, the read operation for the reconciliation result, the consumer of the aggregator events, the health address and criticality of an observed workload, the tool of another skill package and the names a writer chose), every open question under pbi-reviews (for this epic the name of the evidence event type and one or two descriptors for the audit evidence record), every input of the owner that a PBI states, with the PBI that states it (D140; the I1 inputs of the precondition register of AIFACTORY-US-1339 among them: the budget defaults and the platform limit, `Usage:Estimates`, the pricing revisions, the Sandbox pool values, the template-feed project of the platform tenant and the source of the tenant region) and the two recurring approvals of this epic (the creation of each repository, the list of database names); each row states the question, what is already decided, what it blocks and that the owner decides, and is marked open; no row states a value.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The open items of the handoff records hold one row per open decision, complete by the rule of the four sources: every row of open-items.md whose closing column names the owner and that is not marked closed (the import of the backlog draft with its tracker settings, the team, the adoption of the canonical AI and messaging decision, the questions Q-04 and Q-08 to Q-16, the five differences of ADR-0024, the consumers of a deletion order outside eight platforms, the three points on which hand pages and the model differ, the repository name of the Studio front end, the template parameter bindings and the approval of each epic of the PBI campaign), every item decision D115 leaves open (the never announced gate state, the validation reference of an artifact, the unit and conversion factor of each of the seven meters of docs/reference/schemas/usage-record.schema.json, the read operation for the reconciliation result, the consumer of the aggregator events, the health address and criticality of an observed workload, the tool of another skill package and the names a writer chose), every open question under pbi-reviews (for this epic the name of the evidence event type and one or two descriptors for the audit evidence record), every input of the owner that a PBI states, with the PBI that states it (D140; the I1 inputs of the precondition register of AIFACTORY-US-1339 among them: the budget defaults and the platform limit, `Usage:Estimates`, the pricing revisions, the Sandbox pool values, the template-feed project of the platform tenant and the source of the tenant region) and the two recurring approvals of this epic (the creation of each repository, the list of database names); each row states the question, what is already decided, what it blocks and that the owner decides, and is marked open; no row states a value."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4902,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1552]",
      "number": 1552
    },
    {
      "id": "AIFACTORY-TASK-1553",
      "type": "task",
      "parent": "AIFACTORY-US-379",
      "title": "Verify that no backlog item decides an open row",
      "sequence": "17.07.02.02",
      "description": "Verify that no backlog item decides an open row. Expected output: Run `python -I tools/docs_model validate`; the rule against dates, estimates and assignees passes over model/backlog, a search of model/backlog and docs/backlog for a unit or a conversion factor of a usage dimension, a team member and a capacity finds none stated as decided, and a comparison of the register with open-items.md, with the rows D113 to D115 of the decision log and with the files under handoffs/2026-10-09-independent-review/pbi-reviews finds no open item without a row, and a search of model/backlog/pbis for the words input of the owner and owner input finds every stated input with its row and the I1 inputs of D140 also in the precondition register of AIFACTORY-US-1339, which proves AC1 to AC4 of AIFACTORY-US-379 (ADR-0029).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run `python -I tools/docs_model validate`; the rule against dates, estimates and assignees passes over model/backlog, a search of model/backlog and docs/backlog for a unit or a conversion factor of a usage dimension, a team member and a capacity finds none stated as decided, and a comparison of the register with open-items.md, with the rows D113 to D115 of the decision log and with the files under handoffs/2026-10-09-independent-review/pbi-reviews finds no open item without a row, and a search of model/backlog/pbis for the words input of the owner and owner input finds every stated input with its row and the I1 inputs of D140 also in the precondition register of AIFACTORY-US-1339, which proves AC1 to AC4 of AIFACTORY-US-379 (ADR-0029)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1553]",
      "number": 1553
    },
    {
      "id": "AIFACTORY-US-380",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-094",
      "title": "Owner decisions: every accepted decision of the first wave has its row in the decision log and its effect in the model or in an ADR, and the validator passes",
      "sequence": "17.07.03",
      "description": "As a platform admin, I want proof that each decision the owner took is carried by the model or by an ADR, so that a decision cannot be lost between the log that records it and the files the build reads. This PBI is the proof of the feature: a recorded decision is checkable only when the file the build reads says the same as the log that records it. The decisions of the first wave are these. The derived decisions D70 and D71, the role contract corrections and the readiness members added for required role inputs, were accepted by the owner and are decisions 5 and 6 of ADR-0027. Decision D74, a relational store per service, is decision 5 of ADR-0028 and the rows of model/stores.yaml. Decision D80 accepted them together with the stub register of the first outcome, with AuditService and CostUsageService delivered complete in increment I1, which the features of the backlog state. Decision D81, the Scrum process, and decision D85, the import without an area path, are the tracker settings of model/backlog/backlog.yaml. Decision D83, the waiver that lets a Draft release run before the evaluation gate exists, only in the acceptance environment and in projects a platform-scope policy rule names as internal, is the amendment of ADR-0021. The decisions of the backlog campaign follow the same path: D111, the PBI format, is the amendment of ADR-0029; D112, the freeze of that format after the pilot, is carried by the ratchet file model/backlog/progress.yaml, which names the pilot features; D113, D114 and D115 each hold many decided points, and the last column of the decision log names their carriers, most of them model files, so the trace has one row per decided point of these three and not one row per decision. The ADR amendments are among the carriers: those of ADR-0015 on a resource of another tenant, on the role order, the one audience of a user token and the workload token, and on role writes, that of ADR-0014 on envelopes per event family and the failure class, and that of ADR-0028 on the Factory profile switch and the feed. The other points are carried by model and schema files: the Held state and ChangesRequested by model/services/control-plane/RunControlService.yaml, the optional `environmentId` by docs/reference/schemas/run-submission.schema.json, `onExpiry` and the limit of re-requests by the approval rule of ApprovalPolicyService, `failure_policy` and the retry of write steps by the workflow schema and the validator, `SubmitEvidence` by AuditService, the optional failure class by AgentRuntimeService, and the Metering service of increment I4 by the components and the backlog. The evidence is a trace on one page of this site: per decision the row of the decision log, the ADR section or the model field that carries it, and the check that reads it. A decision or a decided point whose carrier is missing or behind is listed as a gap, and the feature is not accepted while a gap is listed. One gap is known when this PBI is written: the `state` enumeration of docs/reference/schemas/approval.schema.json has no ChangesRequested and the request has no `onExpiry` and `reRequestsLeft`; AIFACTORY-TASK-1568 of feature `contracts-package` closes it. The trace adds no decision and changes no carrier. Kind: evidence. Traces: adrs: ADR-0014, ADR-0015, ADR-0021, ADR-0027, ADR-0028, ADR-0029. Sources: handoffs/2026-10-09-independent-review/decision-log.md, docs/architecture/adr/0021-quality-gates.md, docs/architecture/adr/0027-generation-input-contract.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0029-build-backlog-as-a-model-kind.md, model/backlog/backlog.yaml, model/stores.yaml, model/services/control-plane/RunControlService.yaml, model/services/governance/ApprovalPolicyService.yaml, model/schemas/workflow.schema.json, docs/reference/schemas/approval.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the decisions D70, D71, D74 and D80, when the trace is read, then each names its row in the decision log and its carrier: decisions 5 and 6 of ADR-0027, decision 5 of ADR-0028 with one store per service in model/stores.yaml, and the complete deliveries of AuditService and CostUsageService in increment I1 in model/backlog/features/governance.yaml and model/backlog/features/control-plane.yaml.",
        "AC2: Given the decisions D81, D83 and D85, when the trace is read, then the Scrum process with the types Epic, Feature, Product Backlog Item and Task and the absent area path are the tracker settings of model/backlog/backlog.yaml, and the waiver for Draft releases is the amendment of ADR-0021, which names the acceptance environment and the internal projects and never waives publication.",
        "AC3: Given the decisions D111 to D115, when the trace is read, then D111 names the amendment of ADR-0029 for the PBI format and D112 the pilot features of model/backlog/progress.yaml for its freeze, and the trace holds one row per decided point of D113, D114 and D115 with the carrier the last column of handoffs/2026-10-09-independent-review/decision-log.md names for it, a field of a model file, a schema file or an ADR amendment, and the check that reads it: the Held state and ChangesRequested in model/services/control-plane/RunControlService.yaml, the optional `environmentId` in docs/reference/schemas/run-submission.schema.json, `onExpiry` in model/services/governance/ApprovalPolicyService.yaml, `failure_policy` and the retry of write steps in model/schemas/workflow.schema.json and tools/docs_model/validate.py, `SubmitEvidence` in model/services/governance/AuditService.yaml and the amendments of ADR-0014, ADR-0015 and ADR-0028 among them; a point whose carrier is missing or behind, such as the `state` enumeration of docs/reference/schemas/approval.schema.json without ChangesRequested, is listed as a gap.",
        "AC4: Given the repository with the trace, when `python -I tools/docs_model validate` runs, then it reports no error, every ADR and every model or schema file the trace names exists, and the trace lists every decision or decided point without a carrier as a gap; the feature is accepted only when no gap is listed (ADR-0029 decision 1)."
      ],
      "sourceArtifacts": [
        "handoffs/2026-10-09-independent-review/decision-log.md",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "model/backlog/backlog.yaml",
        "model/stores.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/schemas/workflow.schema.json",
        "docs/reference/schemas/approval.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1554",
        "AIFACTORY-TASK-1555"
      ],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4903,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0021",
          "ADR-0027",
          "ADR-0028",
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "handoffs/2026-10-09-independent-review/decision-log.md",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0029-build-backlog-as-a-model-kind.md",
        "model/backlog/backlog.yaml",
        "model/stores.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/schemas/workflow.schema.json",
        "docs/reference/schemas/approval.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-380]",
      "number": 380
    },
    {
      "id": "AIFACTORY-TASK-1554",
      "type": "task",
      "parent": "AIFACTORY-US-380",
      "title": "Trace of the accepted decisions to the ADR sections and model fields that carry them",
      "sequence": "17.07.03.01",
      "description": "Trace of the accepted decisions to the ADR sections and model fields that carry them. Expected output: A page of this site with one row per accepted decision of the first wave (D70, D71, D74, D80, D81, D83, D85, D111 and D112) and one row per decided point of D113, D114 and D115: the row of the decision log, the carrier that the last column of the decision log names for the point (a field of a file under model/, a schema file or an ADR amendment) and the check that reads it; a point whose carrier is missing or behind, such as the `state` enumeration of docs/reference/schemas/approval.schema.json without ChangesRequested, is listed as a gap; the page adds no decision and is linked from the index of the handoff records and from no generated page.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "A page of this site with one row per accepted decision of the first wave (D70, D71, D74, D80, D81, D83, D85, D111 and D112) and one row per decided point of D113, D114 and D115: the row of the decision log, the carrier that the last column of the decision log names for the point (a field of a file under model/, a schema file or an ADR amendment) and the check that reads it; a point whose carrier is missing or behind, such as the `state` enumeration of docs/reference/schemas/approval.schema.json without ChangesRequested, is listed as a gap; the page adds no decision and is linked from the index of the handoff records and from no generated page."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4903,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1554]",
      "number": 1554
    },
    {
      "id": "AIFACTORY-TASK-1555",
      "type": "task",
      "parent": "AIFACTORY-US-380",
      "title": "Verify every carrier of the trace",
      "sequence": "17.07.03.02",
      "description": "Verify every carrier of the trace. Expected output: Run `python -I tools/docs_model validate`; it reports no error, and a read of each row of the trace against docs/architecture/adr, the model and schema files it names and model/backlog/backlog.yaml finds the carrier it names or the gap it lists, which proves AC1 to AC4 of AIFACTORY-US-380 (ADR-0029).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run `python -I tools/docs_model validate`; it reports no error, and a read of each row of the trace against docs/architecture/adr, the model and schema files it names and model/backlog/backlog.yaml finds the carrier it names or the gap it lists, which proves AC1 to AC4 of AIFACTORY-US-380 (ADR-0029)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1555]",
      "number": 1555
    },
    {
      "id": "AIFACTORY-US-135",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-094",
      "title": "Import of the backlog draft by the owner is delivered",
      "sequence": "17.07.04",
      "description": "As a platform admin, I want every owner decision of the first wave recorded and the backlog draft ready for the import by the owner, so that the build starts from decisions that are written down and from a tracker only the owner filled. This is the integration PBI of the feature. Every owner decision the first wave depended on is recorded: the derived decisions D70, D71 and D74 and the stub register of the first outcome (D80), the Scrum process (D81), the waiver that lets Draft releases run before the evaluation gate exists (D83) and the import without an area path (D85), followed by the decisions of the backlog campaign (D111 to D115). AIFACTORY-US-380 proves that each of them is carried by an ADR or by the model. AIFACTORY-US-379 records what is still open as open: the tracker import settings beyond process and area path, the team, and the units of the seven usage dimensions, beside the further open rows of the handoff records. AIFACTORY-US-378 delivers the import files and the guide. One act stays with the owner: importing the draft into Azure DevOps, because no session of the Factory design work has a connection to it. The owner imports the packed files in their order, or one increment file while it stays within 1,000 rows, into the root area of a project that uses the Scrum process, as Epic, Feature, Product Backlog Item and Task, with no area path column. Nothing is imported before the owner does it, nothing in this repository creates a work item, and the backlog of the model stays marked as not created in a tracker until the owner records the import. The feature is done when the three outputs exist, are linked from the handoff records and pass the validator, and the import itself is recorded by the owner as done or stays open with the owner. Kind: enabling. Traces: adrs: ADR-0027, ADR-0028, ADR-0021, ADR-0029. Depends on: AIFACTORY-US-378, AIFACTORY-US-379, AIFACTORY-US-380. Sources: docs/architecture/capability-dependencies.md, docs/ai-software-factory/current-state.md, handoffs/2026-10-09-independent-review/INDEX.md, model/backlog/backlog.yaml, handoffs/2026-10-09-independent-review/open-items.md.",
      "acceptanceCriteria": [
        "AC1: Given the tasks of AIFACTORY-FEAT-094 are done, then the import guide, the register of open decisions and the trace of the accepted decisions exist in ConnectSoft.AI.SoftwareFactory.Documentation, are linked from the index of the handoff records, handoffs/2026-10-09-independent-review/INDEX.md, and from the navigation of the site, are linked from no generated page, and name the decisions that ADR-0027, ADR-0028 and ADR-0021 carry.",
        "AC2: Given the repository with those outputs, when `python -I tools/docs_model validate` runs, then it reports no error and no warning (ADR-0029 decision 6: no item carries a date, an estimate or an assignee).",
        "AC3: Given the backlog draft, when the owner imports it, then the items land in the root area of a project on the Scrum process as Epic, Feature, Product Backlog Item and Task; before that act model/backlog/backlog.yaml states that nothing was created in a tracker, and no task of this repository creates a work item (ADR-0029 decision 1)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "handoffs/2026-10-09-independent-review/INDEX.md",
        "model/backlog/backlog.yaml",
        "handoffs/2026-10-09-independent-review/open-items.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-155",
        "AIFACTORY-TASK-716"
      ],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4904,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0027",
          "ADR-0028",
          "ADR-0021",
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-378",
        "AIFACTORY-US-379",
        "AIFACTORY-US-380"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md",
        "handoffs/2026-10-09-independent-review/INDEX.md",
        "model/backlog/backlog.yaml",
        "handoffs/2026-10-09-independent-review/open-items.md"
      ],
      "titlePrefix": "[AIFACTORY-US-135]",
      "number": 135
    },
    {
      "id": "AIFACTORY-TASK-155",
      "type": "task",
      "parent": "AIFACTORY-US-135",
      "title": "Import of the backlog draft into Azure DevOps by the owner",
      "sequence": "17.07.04.01",
      "description": "Import of the backlog draft into Azure DevOps by the owner. Expected output: The owner imports the packed files in their order, or one increment file, into the root area of the project, which uses the Scrum process (decisions D81 and D85): Epic, Feature, Product Backlog Item, Task, with no area path column. Nothing is imported before the owner does it, and nothing in this repository creates a work item; the open row of the import in the handoff records is closed by the owner or stays open.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The owner imports the packed files in their order, or one increment file, into the root area of the project, which uses the Scrum process (decisions D81 and D85): Epic, Feature, Product Backlog Item, Task, with no area path column. Nothing is imported before the owner does it, and nothing in this repository creates a work item; the open row of the import in the handoff records is closed by the owner or stays open."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4904,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-155]",
      "number": 155
    },
    {
      "id": "AIFACTORY-TASK-716",
      "type": "task",
      "parent": "AIFACTORY-US-135",
      "title": "Verify owner-decisions against its acceptance criteria",
      "sequence": "17.07.04.02",
      "description": "Verify owner-decisions against its acceptance criteria. Expected output: The outputs of the tasks of AIFACTORY-FEAT-094 exist and `python -I tools/docs_model validate` reports no error, which proves AC1 to AC3 of AIFACTORY-US-135.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The outputs of the tasks of AIFACTORY-FEAT-094 exist and `python -I tools/docs_model validate` reports no error, which proves AC1 to AC3 of AIFACTORY-US-135."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:human-approval",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 49,
      "phase": "factory",
      "stackRank": 4904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-716]",
      "number": 716
    },
    {
      "id": "AIFACTORY-FEAT-187",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Commands of the command-line client against the control plane gateway",
      "sequence": "17.08",
      "description": "The command-line client of the first outcome gets its commands once the services they call exist: submit a vision, follow a run, approve a recipe and approve a change proposal run against the control plane gateway through the pinned typed client, with the user token of the signed-in member. The repository, the skeleton and the sign-in of the client are delivered in I0 by the feature command-line-client (owner decision D117). Depends on: AIFACTORY-FEAT-093, AIFACTORY-FEAT-002, AIFACTORY-FEAT-178. Increment I1: Generate a microservice. Build order 84 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-376",
        "AIFACTORY-US-1507",
        "AIFACTORY-US-528"
      ],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8400,
      "titlePrefix": "[AIFACTORY-FEAT-187]",
      "number": 187
    },
    {
      "id": "AIFACTORY-US-376",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-187",
      "title": "Command-line client: the projects, submit, status, watch, approvals, approve and reject commands call the modelled control plane operations through the pinned client and explain every refusal",
      "sequence": "17.08.01",
      "description": "As a requester, I want commands to see my projects, submit a vision, follow the run and decide its approvals, so that the first outcome can be driven end to end from a terminal. The first outcome is four acts of a person: submit a vision, follow a run, approve a recipe and approve a change proposal. This PBI gives a command to the three acts on the control plane; the recipe act calls the template catalog gateway, because GenerationRecipeService is fronted by TemplateCatalogHost and the client reaches no service host directly (decision D123), and its commands `recipe show` and `recipe approve` are delivered by AIFACTORY-US-1507 of this feature. Owner decision D117 places the commands in increment I1, where the services they call exist: the repository, the skeleton and the sign-in of the client are delivered in increment I0 by the feature `command-line-client`, and the commands are written into that skeleton here. Every command calls one public REST operation of the control plane as the model states it, through the control plane gateway and through nothing else (ADR-0028 decision 2), and holds no business rule of its own. `projects` calls `ListProjects` of ProjectService and prints the key, the name and my role for each project my membership grants. `submit` sends a run submission of the descriptor `run-submission-v1` to `SubmitRun` of RunControlService with an idempotency key that the client generates once for the submission and reuses when it retries, so that the same key with the same input prints the same accepted run and the same key with another input prints a conflict (ADR-0014 decision 3). `status` reads one run with `GetRun`. `watch` has no operation of its own: the model has no public stream, and `RunControl.WatchRun` is an internal gRPC server stream for the BFF and the workers that a public caller cannot use. `watch` therefore polls `GetRun`, GET /factory/runs/{runId} under the scope `factory.runs.read`, at a configurable interval until the run is Completed, Failed or Cancelled, prints each change of the run, of its steps and of its pending approvals, and stops on 404 or 403 with the explanation of the class; whether a public stream is wanted later is open for the owner. `approvals list` reads the approval requests visible to my roles with `ListApprovals`, and `approve` and `reject` send a decision of the descriptor `approval-decision-v1` to `DecideApproval` that quotes the version of the request it decides. A run-level spend approval, which has no step (decision D117), is listed and decided by the same commands. A refused command explains the refusal from the problem response and ends with a failure code of its class. 401 asks me to sign in again. 403 names the scope or the right I lack inside my tenant. 404 says not found, and is the same answer for an identifier that does not exist and for a resource of another tenant, which the client cannot and does not tell apart (ADR-0015 amendment on a resource of another tenant). 409 prints the reason the service gives; on a decision it has the two causes the model states: the quoted version no longer matches, or the request is already decided, Stale or Cancelled. 410 says that the approval request expired and that the run follows the expiry rule of its request; the decision was not recorded. 400 prints the fields that failed validation. 503, the answer of the gateway for a fronted service that is unavailable, prints the retry hint, is not retried blindly and has a failure code of its own. The commands reach the gateway through the one client port of the skeleton. Behind that port stands the control plane client of feature `typed-gateway-clients` in its user-token layout, pinned at its published version from the ConnectSoft feed: it takes the place of the hand-written adapter of the skeleton, and the client repository holds no second HTTP call to the control plane gateway. The pinned client attaches the user token of the signed-in member for the audience of the control plane gateway only to requests to the base address of that gateway. The gateway forwards that token to the service it fronts, and the service accepts the audience of its gateway, so that one token serves every command of this PBI and nothing is exchanged on the way; the recipe commands use a second token, requested for the audience of the template catalog gateway (AIFACTORY-US-1507) (ADR-0015 amendments on the one audience of a user token and on the forwarded user token). The commands are proven against the real gateway and not against a contract stub. The acceptance suite of the client repository runs the built commands against the acceptance environment that feature `local-development-environment` defines, in which `ControlPlaneApi` fronts `ProjectService` and `RunControlService` and the authorization server of the Factory instance of the Identity Platform issues the tokens. The fixture uses the fixture tenant and project of that environment with two members, a requester and a reviewer, because the requester of a run is never eligible to decide its approvals. The workflow chain that raises approvals in a real run is delivered by other features of the increment, so a worker stand-in of the fixture raises the approval requests of the fixture run through the internal operation `RunControl.RequestApproval`, one of them with an expiry that has passed. Request bodies are the types of the pinned contracts package. The responses of `SubmitRun`, `GetRun` and `ListApprovals` name the descriptors `run-accepted-v1`, `run-view-v1` and `approval-list-v1`, for which no schema file defines a shape today; the client prints the run and approval state those responses carry as the pinned control plane client types them from the OpenAPI document of the gateway, and a reading through types of the contracts package waits for the open question recorded with feature `contracts-package`. Kind: enabling. Traces: apis: ProjectService/ListProjects, RunControlService/SubmitRun, RunControlService/GetRun, RunControlService/ListApprovals, RunControlService/DecideApproval; descriptors: run-submission-v1, approval-decision-v1; adrs: ADR-0014, ADR-0015, ADR-0028. Depends on: feature:command-line-client, feature:control-plane-api, feature:typed-gateway-clients, feature:project-service, feature:run-control-service, feature:contracts-package, feature:local-development-environment. Sources: docs/architecture/capability-dependencies.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/reference/schemas/run-submission.schema.json, docs/reference/schemas/approval.schema.json, model/services/control-plane/RunControlService.yaml, model/services/control-plane/ProjectService.yaml, model/services/control-plane/ControlPlaneApi.yaml, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml.",
      "acceptanceCriteria": [
        "AC1: Given I am signed in, when I list projects, then the command calls ProjectService/ListProjects, the list operation that model/services/control-plane/ProjectService.yaml names, through the control plane gateway and prints, for exactly the projects my membership grants, the project key, the name and my role (ADR-0015 decisions 5 and 6).",
        "AC2: Given a run submission, when I submit it, then the command sends a document of `run-submission-v1` to RunControlService/SubmitRun with an idempotency key it generated once; a repeated submit with the same key and the same input prints the same accepted run, and the same key with another input prints the conflict (ADR-0014 decision 3; model/services/control-plane/RunControlService.yaml names the operation and its codes).",
        "AC3: Given a submitted run, when I run status, approvals list, approve or reject, then each command calls its modelled operation (RunControlService/GetRun, RunControlService/ListApprovals, RunControlService/DecideApproval) through the control plane gateway and prints the run or approval state the service returned, a decision of `approval-decision-v1` quotes the version of the request it decides, and a run-level spend approval without a step is listed and decided like any other; and when I run watch, then the client polls `GetRun`, GET /factory/runs/{runId} under the scope `factory.runs.read`, at a configurable interval, prints each change of the run, its steps and its pending approvals, ends when the run is Completed, Failed or Cancelled, stops on 404 or 403 with the explanation of the class, and never calls the internal stream `WatchRun` (ADR-0028 decision 2; model/services/control-plane/RunControlService.yaml).",
        "AC4: Given a command that the gateway or a service refuses, when the answer is 401, 403, 404, 409, 410, 400 or 503, then the client prints the explanation of that class from the problem response and ends with the failure code of the class: a 404 for a resource of another tenant reads exactly as a 404 for an identifier that does not exist; a 409 on a decision says that the quoted version no longer matches or that the request is already decided, Stale or Cancelled; a 410 says that the approval request expired, that the run follows the expiry rule of its request and that the decision was not recorded; a 503 prints the retry hint and is not retried blindly (ADR-0015 amendment on a resource of another tenant; model/services/control-plane/RunControlService.yaml lists the codes of `DecideApproval`, and model/services/control-plane/ControlPlaneApi.yaml the 503 of an unavailable fronted service).",
        "AC5: Given the client repository, when its architecture test runs, then the control plane client of feature `typed-gateway-clients` in the user-token layout is pinned at its published version from the ConnectSoft feed and is the only adapter to the control plane gateway behind the client port, the hand-written adapter of the skeleton is removed, no other type of the repository sends a request to that gateway, the only other adapter is the pinned template catalog gateway client of AIFACTORY-US-1507 for the other gateway, and the user token of the control plane audience is attached only to requests to the base address of the control plane gateway (ADR-0028 decision 2; ADR-0015 amendment on the one audience of a user token; model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml names the package)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-192",
        "AIFACTORY-TASK-151",
        "AIFACTORY-TASK-2111",
        "AIFACTORY-TASK-1544",
        "AIFACTORY-TASK-1545"
      ],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8401,
      "kind": "enabling",
      "traces": {
        "apis": [
          "ProjectService/ListProjects",
          "RunControlService/SubmitRun",
          "RunControlService/GetRun",
          "RunControlService/ListApprovals",
          "RunControlService/DecideApproval"
        ],
        "descriptors": [
          "run-submission-v1",
          "approval-decision-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:command-line-client",
        "feature:control-plane-api",
        "feature:typed-gateway-clients",
        "feature:project-service",
        "feature:run-control-service",
        "feature:contracts-package",
        "feature:local-development-environment"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/schemas/run-submission.schema.json",
        "docs/reference/schemas/approval.schema.json",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-376]",
      "number": 376
    },
    {
      "id": "AIFACTORY-TASK-192",
      "type": "task",
      "parent": "AIFACTORY-US-376",
      "title": "Projects command",
      "sequence": "17.08.01.01",
      "description": "Projects command. Expected output: The command prints project key, name and my role for each project my membership grants, read from the list operation of ProjectService through the control plane gateway and the pinned control plane client; a refusal is explained and ends with the failure code of its class.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The command prints project key, name and my role for each project my membership grants, read from the list operation of ProjectService through the control plane gateway and the pinned control plane client; a refusal is explained and ends with the failure code of its class."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-192]",
      "number": 192
    },
    {
      "id": "AIFACTORY-TASK-151",
      "type": "task",
      "parent": "AIFACTORY-US-376",
      "title": "Commands: submit, status, watch, approvals list, approve, reject",
      "sequence": "17.08.01.02",
      "description": "Commands: submit, status, watch, approvals list, approve, reject. Expected output: Each command calls the modelled public REST operation through the one client port of the skeleton and prints the run or approval state; submit sends `run-submission-v1` with an idempotency key generated once and reused on a retry; watch polls `GetRun` at a configurable interval until the run is Completed, Failed or Cancelled, prints each change of the run, its steps and its pending approvals and stops on 404 or 403; approve and reject send `approval-decision-v1` with the version of the request, for a run-level spend approval without a step as for any other; a refused command explains the refusal by its class (401, 403, 404, 409, 410, 400, 503) and ends with the failure code of that class: 409 on a decision names the two modelled causes, 410 says that the approval request expired and that the run follows the expiry rule of its request and that the decision was not recorded, and 503 prints the retry hint.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Each command calls the modelled public REST operation through the one client port of the skeleton and prints the run or approval state; submit sends `run-submission-v1` with an idempotency key generated once and reused on a retry; watch polls `GetRun` at a configurable interval until the run is Completed, Failed or Cancelled, prints each change of the run, its steps and its pending approvals and stops on 404 or 403; approve and reject send `approval-decision-v1` with the version of the request, for a run-level spend approval without a step as for any other; a refused command explains the refusal by its class (401, 403, 404, 409, 410, 400, 503) and ends with the failure code of that class: 409 on a decision names the two modelled causes, 410 says that the approval request expired and that the run follows the expiry rule of its request and that the decision was not recorded, and 503 prints the retry hint."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-151]",
      "number": 151
    },
    {
      "id": "AIFACTORY-TASK-2111",
      "type": "task",
      "parent": "AIFACTORY-US-376",
      "title": "Pinned control plane client behind the client port in place of the hand-written adapter",
      "sequence": "17.08.01.03",
      "description": "Pinned control plane client behind the client port in place of the hand-written adapter. Expected output: The client repository pins the published control plane client package of feature `typed-gateway-clients` in its user-token layout in the central package file and restores it from the ConnectSoft feed without a project reference; the package is registered behind the one client port of the skeleton with the base address of the control plane gateway and the token of the sign-in; the hand-written adapter of the skeleton is removed; the typed errors of the package are mapped to the failure codes of the refusal classes; an architecture test fails when a type of the repository other than the pinned client sends a request to the control plane gateway, or when a type other than the pinned client of its gateway sends a request to another gateway, which proves AC5 of AIFACTORY-US-376.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The client repository pins the published control plane client package of feature `typed-gateway-clients` in its user-token layout in the central package file and restores it from the ConnectSoft feed without a project reference; the package is registered behind the one client port of the skeleton with the base address of the control plane gateway and the token of the sign-in; the hand-written adapter of the skeleton is removed; the typed errors of the package are mapped to the failure codes of the refusal classes; an architecture test fails when a type of the repository other than the pinned client sends a request to the control plane gateway, or when a type other than the pinned client of its gateway sends a request to another gateway, which proves AC5 of AIFACTORY-US-376."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-2111]",
      "number": 2111
    },
    {
      "id": "AIFACTORY-TASK-1544",
      "type": "task",
      "parent": "AIFACTORY-US-376",
      "title": "Acceptance fixture of the commands on the real control plane gateway",
      "sequence": "17.08.01.04",
      "description": "Acceptance fixture of the commands on the real control plane gateway. Expected output: A fixture of the acceptance suite of the client repository that addresses the acceptance environment of feature `local-development-environment`, in which `ControlPlaneApi` fronts `ProjectService` and `RunControlService` and the authorization server of the Factory issues the tokens, in place of the contract stub the commands were first planned against: it uses the fixture tenant and project of the environment with a requester and a reviewer, submits the fixture run through the gateway, and lets a worker stand-in raise the approval requests of that run through the internal operation `RunControl.RequestApproval`, one with an expiry that has passed for the 410 and one that is decided twice for the 409; it holds an identifier of a second tenant for the 404 and a member without the deciding scope for the 403; the fixture creates, resets and removes no database and touches only the fixture tenant and project the environment page names.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "A fixture of the acceptance suite of the client repository that addresses the acceptance environment of feature `local-development-environment`, in which `ControlPlaneApi` fronts `ProjectService` and `RunControlService` and the authorization server of the Factory issues the tokens, in place of the contract stub the commands were first planned against: it uses the fixture tenant and project of the environment with a requester and a reviewer, submits the fixture run through the gateway, and lets a worker stand-in raise the approval requests of that run through the internal operation `RunControl.RequestApproval`, one with an expiry that has passed for the 410 and one that is decided twice for the 409; it holds an identifier of a second tenant for the 404 and a member without the deciding scope for the 403; the fixture creates, resets and removes no database and touches only the fixture tenant and project the environment page names."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8401,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1544]",
      "number": 1544
    },
    {
      "id": "AIFACTORY-TASK-1545",
      "type": "task",
      "parent": "AIFACTORY-US-376",
      "title": "Verify every control plane command and every class of refusal against the real gateway",
      "sequence": "17.08.01.05",
      "description": "Verify every control plane command and every class of refusal against the real gateway. Expected output: Run `dotnet test -c Release --no-build` on the client solution with the fixture of AIFACTORY-TASK-1544; the projects list, the idempotent submit with its conflict, status, watch by polling to a terminal run and its stop on 404, approvals list, approve and reject, the run-level spend approval without a step, and one refusal per class with its failure code, the expired approval with 410, both causes of 409 on a decision and the stopped fronted service with 503 among them, pass against the real control plane gateway through the pinned control plane client, and the architecture test over the single adapter passes, which proves AC1 to AC5 of AIFACTORY-US-376 (ADR-0014, ADR-0015).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the client solution with the fixture of AIFACTORY-TASK-1544; the projects list, the idempotent submit with its conflict, status, watch by polling to a terminal run and its stop on 404, approvals list, approve and reject, the run-level spend approval without a step, and one refusal per class with its failure code, the expired approval with 410, both causes of 409 on a decision and the stopped fronted service with 503 among them, pass against the real control plane gateway through the pinned control plane client, and the architecture test over the single adapter passes, which proves AC1 to AC5 of AIFACTORY-US-376 (ADR-0014, ADR-0015)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1545]",
      "number": 1545
    },
    {
      "id": "AIFACTORY-US-1507",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-187",
      "title": "Command-line client: recipe show and recipe approve call GenerationRecipeService through the template catalog gateway with the pinned client of that gateway and a token of its audience",
      "sequence": "17.08.02",
      "description": "As an asset maintainer, I want to read a generation recipe with its pins and approve it from a terminal, so that the recipe act of the first outcome is driven from the same client as the other three acts. The third act of the first outcome is the approval of a generation recipe. GenerationRecipeService is fronted by the gateway TemplateCatalogHost, which is delivered in I1 (decision D123), and the command-line client calls the gateway and reaches no service host directly. This PBI writes the two commands of that act into the skeleton of the client. `recipe show` calls `GetRecipe`, GET /factory/recipes/{recipeId}/versions/{version} under the scope `factory.recipes.read`, and prints the module plan with its template versions, switches, parameters and pins, the libraries, the compatibility evidence, the state, the approver and `draftAllowanceUsed`, so that the approver sees whether the recipe binds a version under the Draft allowance. `recipe approve` calls `ApproveRecipe`, POST /factory/recipes/{recipeId}/versions/{version}/approve under the scope `factory.recipes.approve`, by recipe identifier and version, and prints the approved state or the explanation of a refusal. The two commands go through the template catalog gateway client of feature `typed-gateway-clients` in its user-token layout, pinned at its published version from the ConnectSoft feed and registered behind the client port with the base address of the template catalog gateway; the repository holds no hand-written adapter for these operations and no address of the service. A user token has one audience, so the client requests a second token for the audience of the template catalog gateway with the scopes `factory.recipes.read` and `factory.recipes.approve` from the Factory entry of the client at the Authorization Server, and that client attaches it only to requests to the base address of that gateway; the token of the control plane gateway is never sent to it and this token never to the control plane gateway. A refused command explains the refusal from the problem response and ends with the failure code of its class, as the control plane commands do (AIFACTORY-US-376): 401 asks me to sign in again, 403 names the scope or the role I lack, 404 is the same answer for an unknown recipe and a recipe of another tenant, 409 says that the recipe is not Validated or its pins no longer resolve, with the pin named, and 503 prints the retry hint of the gateway or of a dependency that does not answer. The commands are proven in the acceptance suite of the client repository against a stub of the template catalog gateway built from its OpenAPI document; the run of a recipe through a generation is proven by the features of the chain. Kind: enabling. Traces: apis: GenerationRecipeService/GetRecipe, GenerationRecipeService/ApproveRecipe; adrs: ADR-0015, ADR-0027, ADR-0028. Depends on: feature:command-line-client, feature:typed-gateway-clients, feature:generation-recipe-service, feature:template-catalog-host. Sources: model/services/template-library/GenerationRecipeService.yaml, model/services/template-library/TemplateCatalogHost.yaml, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml.",
      "acceptanceCriteria": [
        "AC1: Given I am signed in with a token for the audience of the template catalog gateway, when I run recipe show for a recipe identifier and version, then the command calls `GenerationRecipeService/GetRecipe` through the pinned template catalog gateway client and prints the module plan with its template versions, switches, parameters and pins, the libraries, the compatibility evidence, the state, the approver and `draftAllowanceUsed` (model/services/template-library/GenerationRecipeService.yaml).",
        "AC2: Given a Validated recipe, when I run recipe approve for its identifier and version, then the command calls `GenerationRecipeService/ApproveRecipe` through the same client and prints the approved state and the approver; given a recipe that is not Validated, whose pins no longer resolve, of another tenant or a scope I lack, then the command prints the explanation of 409 with the reason, 404, or 403 and ends with the failure code of the class, and a 503 prints the retry hint (ADR-0027, model/services/template-library/GenerationRecipeService.yaml).",
        "AC3: Given the client repository, when its architecture test and the token test run, then the template catalog gateway client is the only adapter to that gateway, the token of its audience is attached only to requests to the base address of the template catalog gateway, the token of the control plane gateway never reaches it, and no token is written to a file, the output or the log of the client (ADR-0015 amendment on the one audience of a user token, model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml)."
      ],
      "sourceArtifacts": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-217",
        "AIFACTORY-TASK-6133"
      ],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8402,
      "kind": "enabling",
      "traces": {
        "apis": [
          "GenerationRecipeService/GetRecipe",
          "GenerationRecipeService/ApproveRecipe"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:command-line-client",
        "feature:typed-gateway-clients",
        "feature:generation-recipe-service",
        "feature:template-catalog-host"
      ],
      "source": [
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/services/template-library/TemplateCatalogHost.yaml",
        "model/backlog/pbis/engineering-readiness/typed-gateway-clients.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1507]",
      "number": 1507
    },
    {
      "id": "AIFACTORY-TASK-217",
      "type": "task",
      "parent": "AIFACTORY-US-1507",
      "title": "CLI commands recipe show and recipe approve",
      "sequence": "17.08.02.01",
      "description": "CLI commands recipe show and recipe approve. Expected output: The client has the commands recipe show and recipe approve: show prints the module plan with its template versions, switches and pins from GetRecipe, and approve sends ApproveRecipe by recipe identifier and version and prints the approved state or the explanation of a 403, 404, 409 or 503. Both commands go through the gateway TemplateCatalogHost, which is delivered in I1 and fronts GenerationRecipeService (D123): the client pins the typed client of that gateway that feature typed-gateway-clients publishes, in its user-token layout, restores it from the ConnectSoft feed, registers it with the base address of the gateway and attaches a user token requested for the audience of that gateway and no other, because a user token has one audience; the client holds no hand-written adapter for these operations and no address of the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client has the commands recipe show and recipe approve: show prints the module plan with its template versions, switches and pins from GetRecipe, and approve sends ApproveRecipe by recipe identifier and version and prints the approved state or the explanation of a 403, 404, 409 or 503. Both commands go through the gateway TemplateCatalogHost, which is delivered in I1 and fronts GenerationRecipeService (D123): the client pins the typed client of that gateway that feature typed-gateway-clients publishes, in its user-token layout, restores it from the ConnectSoft feed, registers it with the base address of the gateway and attaches a user token requested for the audience of that gateway and no other, because a user token has one audience; the client holds no hand-written adapter for these operations and no address of the service."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-217]",
      "number": 217
    },
    {
      "id": "AIFACTORY-TASK-6133",
      "type": "task",
      "parent": "AIFACTORY-US-1507",
      "title": "Verify the recipe commands against a stub of the template catalog gateway",
      "sequence": "17.08.02.02",
      "description": "Verify the recipe commands against a stub of the template catalog gateway. Expected output: Run `dotnet test -c Release --no-build` on the client solution with a stub of the template catalog gateway built from its OpenAPI document; recipe show and recipe approve with their printed states, one refusal per class with its failure code, the token of the template catalog audience attached only to that gateway and the architecture test over the single adapter of that gateway pass, which proves AC1 to AC3 of AIFACTORY-US-1507 and AC4 of AIFACTORY-US-013.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the client solution with a stub of the template catalog gateway built from its OpenAPI document; recipe show and recipe approve with their printed states, one refusal per class with its failure code, the token of the template catalog audience attached only to that gateway and the architecture test over the single adapter of that gateway pass, which proves AC1 to AC3 of AIFACTORY-US-1507 and AC4 of AIFACTORY-US-013."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6133]",
      "number": 6133
    },
    {
      "id": "AIFACTORY-US-528",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-187",
      "title": "Command-line client commands: the pipeline of the client repository and one recorded walk prove the commands against the real control plane gateway, from the sign-in to a decided approval",
      "sequence": "17.08.03",
      "description": "As a requester, I want proof that the commands of the command-line client drive a run and its approvals through the real control plane gateway, so that the first outcome can be demonstrated from a terminal and not only from a test double. This is the integration PBI and the proof of the feature. Increment I0 proved the sign-in of the command-line client (AIFACTORY-US-377 and AIFACTORY-US-003 of feature `command-line-client`); this PBI proves the commands that AIFACTORY-US-376 writes into the skeleton, against the real services. Two proofs are kept. The first is the pipeline of the repository `ConnectSoft.AI.SoftwareFactory.Cli`: its acceptance stage, which in increment I0 ran the sign-in only, now also runs the built client as a process against the acceptance environment of feature `local-development-environment`, with `ControlPlaneApi` in front of `ProjectService` and `RunControlService` and with the authorization server of the Factory instance of the Identity Platform. It signs in as the requester, lists projects, submits a run twice with one idempotency key, reads its status and watches it; it signs in as the reviewer, lists approvals, approves one and rejects one; and it provokes one refusal of each class, the 410 of an expired approval request and the 503 of a stopped fronted service among them. Every call leaves the client through the pinned control plane client of feature `typed-gateway-clients`, with the user token of the signed-in member, which the gateway forwards to the service it fronts. The scan of the files, the output and the log of the client process for a token, a renewal credential and a secret stays part of the stage and must find none. The second proof is a recorded walk by a person in the same environment, from the sign-in to a decided approval, with the printed state of every step, the revision of the client, the version of the pinned control plane client and the trace identifier of the submission. The record names no person and carries no date. A failed run or a failed walk is recorded as failed with the step that failed, and the feature is not accepted on it. The run of a vision through the six workflows to an approved change proposal is the demonstration of increment I1 and belongs to the feature that verifies that increment; this PBI ends where the commands are proven. Kind: evidence. Traces: apis: ProjectService/ListProjects, RunControlService/SubmitRun, RunControlService/GetRun, RunControlService/ListApprovals, RunControlService/DecideApproval; adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-376, feature:command-line-client, feature:control-plane-api, feature:typed-gateway-clients, feature:project-service, feature:run-control-service, feature:local-development-environment. Sources: docs/architecture/capability-dependencies.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/reference/schemas/approval.schema.json, model/services/control-plane/RunControlService.yaml, model/backlog/increments.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the acceptance environment with `ControlPlaneApi`, `ProjectService`, `RunControlService` and the authorization server of the Factory, when the acceptance stage of the client pipeline runs the built client as a process, then the sign-in, projects, submit twice with one idempotency key, status, watch, approvals list, approve and reject each print the state the real service returned for RunControlService/SubmitRun, RunControlService/GetRun, RunControlService/ListApprovals, RunControlService/DecideApproval and ProjectService/ListProjects, and one refusal of each class ends with the failure code of its class (ADR-0028 decision 2; model/services/control-plane/RunControlService.yaml).",
        "AC2: Given a person in that environment, when they walk from the sign-in as a requester through projects, submit, status and watch and, signed in as a reviewer, through approvals list and approve, then the walk is recorded with the printed state of every step, the revision of the client, the version of the pinned control plane client and the trace identifier of the submission, and the reviewer is another member than the requester, because docs/reference/schemas/approval.schema.json makes the requester of a run never eligible to decide (ADR-0015 decision 6).",
        "AC3: Given the files, the output and the log that the client process wrote during the acceptance stage with the commands, when they are scanned, then no token, no renewal credential and no secret is found, and the stage fails on a planted token file as it did for the sign-in alone (ADR-0015 decision 2)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/approval.schema.json",
        "model/services/control-plane/RunControlService.yaml",
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-2112",
        "AIFACTORY-TASK-2113",
        "AIFACTORY-TASK-2114"
      ],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8403,
      "kind": "evidence",
      "traces": {
        "apis": [
          "ProjectService/ListProjects",
          "RunControlService/SubmitRun",
          "RunControlService/GetRun",
          "RunControlService/ListApprovals",
          "RunControlService/DecideApproval"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-376",
        "feature:command-line-client",
        "feature:control-plane-api",
        "feature:typed-gateway-clients",
        "feature:project-service",
        "feature:run-control-service",
        "feature:local-development-environment"
      ],
      "source": [
        "docs/architecture/capability-dependencies.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/approval.schema.json",
        "model/services/control-plane/RunControlService.yaml",
        "model/backlog/increments.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-528]",
      "number": 528
    },
    {
      "id": "AIFACTORY-TASK-2112",
      "type": "task",
      "parent": "AIFACTORY-US-528",
      "title": "Acceptance stage of the client pipeline runs the commands against the acceptance environment",
      "sequence": "17.08.03.01",
      "description": "Acceptance stage of the client pipeline runs the commands against the acceptance environment. Expected output: The acceptance stage of the pipeline of the client repository, which holds the sign-in harness of AIFACTORY-TASK-1547, also runs the built client as a process against the acceptance environment with the fixture of AIFACTORY-TASK-1544: the sign-in as requester and as reviewer, projects, submit twice with one idempotency key, status, watch, approvals list, approve, reject and one refusal per class; the scan for a token, a renewal credential and a secret covers the files, the output and the log of these runs; the stage holds no build or test script of its own and creates, resets and removes no database.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The acceptance stage of the pipeline of the client repository, which holds the sign-in harness of AIFACTORY-TASK-1547, also runs the built client as a process against the acceptance environment with the fixture of AIFACTORY-TASK-1544: the sign-in as requester and as reviewer, projects, submit twice with one idempotency key, status, watch, approvals list, approve, reject and one refusal per class; the scan for a token, a renewal credential and a secret covers the files, the output and the log of these runs; the stage holds no build or test script of its own and creates, resets and removes no database."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8403,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-2112]",
      "number": 2112
    },
    {
      "id": "AIFACTORY-TASK-2113",
      "type": "task",
      "parent": "AIFACTORY-US-528",
      "title": "Recorded walk from the sign-in to a decided approval against the real gateway",
      "sequence": "17.08.03.02",
      "description": "Recorded walk from the sign-in to a decided approval against the real gateway. Expected output: A record of one walk by a person in the acceptance environment: the sign-in as a requester, projects, submit, status and watch, then the sign-in as a reviewer, approvals list and approve, each step with the printed state, the revision of the client, the version of the pinned control plane client and the trace identifier of the submission, which proves AC2 of AIFACTORY-US-528; the record names no person.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "A record of one walk by a person in the acceptance environment: the sign-in as a requester, projects, submit, status and watch, then the sign-in as a reviewer, approvals list and approve, each step with the printed state, the revision of the client, the version of the pinned control plane client and the trace identifier of the submission, which proves AC2 of AIFACTORY-US-528; the record names no person."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2113]",
      "number": 2113
    },
    {
      "id": "AIFACTORY-TASK-2114",
      "type": "task",
      "parent": "AIFACTORY-US-528",
      "title": "Verify the commands by one green pipeline run and one planted failing scan",
      "sequence": "17.08.03.03",
      "description": "Verify the commands by one green pipeline run and one planted failing scan. Expected output: One run of the pipeline of the client repository is green with the commands of the acceptance stage against the real control plane gateway; one run with a planted token file fails at the scan; both prove AC1 and AC3 of AIFACTORY-US-528 (ADR-0015, ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "One run of the pipeline of the client repository is green with the commands of the acceptance stage against the real control plane gateway; one run with a planted token file fails at the scan; both prove AC1 and AC3 of AIFACTORY-US-528 (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "docs/architecture/capability-dependencies.md",
        "docs/ai-software-factory/current-state.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 84,
      "phase": "factory",
      "stackRank": 8403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2114]",
      "number": 2114
    },
    {
      "id": "AIFACTORY-FEAT-178",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-017",
      "title": "Typed client libraries for the Factory gateways from the API library template",
      "sequence": "17.09",
      "description": "Every Factory service, the command-line client and the agent host call the control-plane, model and tool gateways; the Factory would otherwise hand-write those clients in each repository. The API library template (connectsoft-api-library) scaffolds a typed HTTP client library with the house conventions; once it carries the Factory's scope headers, workload-token acquisition and OpenAPI generation (FEAT-180), three client packages are generated from the gateways' OpenAPI documents, versioned with the contracts package and consumed by the CLI and the agent host switches. Component: API library template (extend). Depends on: AIFACTORY-FEAT-090, AIFACTORY-FEAT-180. Increment I1: Generate a microservice. Build order 25 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-381",
        "AIFACTORY-US-382",
        "AIFACTORY-US-383",
        "AIFACTORY-US-119",
        "AIFACTORY-US-1510"
      ],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2500,
      "titlePrefix": "[AIFACTORY-FEAT-178]",
      "number": 178
    },
    {
      "id": "AIFACTORY-US-381",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-178",
      "title": "Gateway clients: typed libraries for the control plane, model, tool and template catalog gateways, three of them in two layouts, are generated from OpenAPI with the API library template",
      "sequence": "17.09.01",
      "description": "As an asset maintainer, I want the clients of the four Factory gateways to be generated from the contracts of the gateways, so that no repository writes a gateway client by hand and none drifts from the contract. The command-line client and, where an operation admits them, Factory services call the public REST surface of the control plane, model, tool and template catalog gateways. ADR-0028 decision 2 makes each gateway the one route to the services of its platform, decision 3 makes the model gateway and the tool gateway the only routes to `ModelRouterService` and `ToolAdapterService`, and ADR-0022 decision 2 sends every tool call through the governed executor. A client written by hand in each caller would repeat every contract and drift from it. This PBI generates them. The repository `ConnectSoft.AI.SoftwareFactory.Clients` holds seven libraries for the four gateways: two for `ControlPlaneApi`, one in the user-token layout and one in the workload layout (decision D117), two for `ModelGatewayHost` and two for `ToolExecutorHost`, each in the workload layout and in the user-token layout for StudioBff, which calls the model and the tool gateway with a user token of the audience of each (D141), and one for `TemplateCatalogHost`, the gateway of the Template and Library platform, which is delivered in I1 like the other gateways (decision D123). The gateways `KnowledgeHost`, `GovernanceHost` and `IntegrationHost` moved to I1 as well (decisions D125, D127 and D129); their three libraries are generated in the same repository, in the same way and in the user-token layout by AIFACTORY-US-1510, so the repository holds ten libraries for seven gateways. The library of the template catalog gateway is generated in the user-token layout, because the caller that reaches that gateway with a typed client is the command-line client, which calls the gateway and reaches no service host directly. The two libraries of each of the control plane, model and tool gateways are generated from the same OpenAPI document and differ only in the authentication layout of the template (D141). Each is generated with `dotnet new connectsoft-api-library`, with the generation switch, the document path and `UseFactoryProfile` that AIFACTORY-US-301 to AIFACTORY-US-304 of feature `component-api-library-template-factory-clients` deliver. The template is consumed by a pin on the package version that passed its gate; this feature changes nothing in the template, and a gap found while generating is recorded for the template feature and not patched in the generated output. What each package holds is named by the operations of the model. The control plane client, in both layouts, holds the public REST operations of the services the gateway fronts whose delivery increment in model/backlog/features is I1 or earlier: of ProjectService `CreateProject`, `ListProjects`, `GetProject`, `SetMembership`, `Delegate`, `RevokeDelegation`, `SetSourceScope`, `CloseProject`, `SuspendProject` and `ResumeProject`; of RunControlService `SubmitRun`, `GetRun`, `ListRuns`, `CancelRun`, `DecideApproval` and `ListApprovals`; of EnvironmentService `CreateEnvironment`, `ListEnvironments`, `FreezeEnvironment` and `UnfreezeEnvironment`; of CostUsageService `GetProjectUsage`, `GetRunUsage` and `SetProjectBudget`. The model gateway client holds the public REST operations of ModelRouterService: `ListModelProfiles`, `GetModelProfile`, `ListModelDeployments`, `RegisterDeployment`, `EvaluateDeployment`, `ApproveDeployment`, `PreviewRoutePlan` and `ListRunReceipts`. The tool gateway client holds those of ToolAdapterService: `ListTools`, `GetTool`, `DryRunTool`, `ListRunToolReceipts`, `GetToolInvocation` and `ConfirmToolEffect`. The template catalog gateway client holds the seventeen public REST operations of the three services its gateway fronts, all of increment I1: of BlueprintService `ListBlueprints`, `GetBlueprintVersion`, `CreateBlueprintVersion`, `ValidateBlueprint` and `SubmitBlueprint`; of GenerationRecipeService `ListRecipes`, `GetRecipe`, `DraftRecipe`, `ValidateRecipe`, `ApproveRecipe` and `ListGeneratedOutputs`; of TemplateRegistryService `ListTemplates`, `GetTemplateVersion`, `ListLibraries`, `QueryCompatibility`, `DiscoverTemplates` and `PublishTemplateVersion`. The project of a project-scoped operation travels where the operation declares it: in the path of `ListGeneratedOutputs`, in the required query parameter `projectId` of `ListBlueprints` and `ListRecipes` and in the required body member `projectId` of `CreateBlueprintVersion` and `DraftRecipe` (decision D123), so the generated request types carry it and no header names it. The internal gRPC methods of the three services, `Catalog.ResolveManifest` among them, are not in the package. The operations of a service or of a delivery of a later increment, such as `AgentCardService`, `FactoryCommercialService` or the release operations of the complete `AgentRegistryService`, enter with the package version of their increment. The libraries are typed HTTP clients of the public REST surface only. The calls by which an agent host invokes a model or a tool are not in them: `ModelGateway.Invoke`, `Embed` and `Rerank` of ModelRouterService and `ToolExecutor.Invoke` of ToolAdapterService are internal gRPC methods with server streaming, and a REST client generated from an OpenAPI document cannot implement the gateway transport port of the Factory model client (AIFACTORY-US-196). The `UseFactoryModelRouter` and `UseFactoryToolAdapter` switches of the agent host therefore do not pin these packages. Whether the invoke path stays with the transport of the Factory AI libraries, or the API library template gains gRPC client generation from the proto, which would be a gap of feature `component-api-library-template-factory-clients`, is open for the owner. The input of each library is an OpenAPI document. The APIs of the Factory are contract-first (docs/architecture/api-governance.md): the document is the source of truth and is reviewed before the implementation. No gateway publishes an OpenAPI document today, so the four documents are written contract-first in the client repository from an intake of the model and are the source of truth until a gateway publishes its own, which then takes the place of the document of the client repository as the input of its library (decision D117). The template catalog gateway publishes the document of its seventeen public REST operations as a build output of its repository (AIFACTORY-TASK-2856 of feature `template-catalog-host`), and from its first published version on that document is the input of the template catalog gateway client. The intake is built like the intake of the contracts package (AIFACTORY-TASK-1567): an intake file records the revision of this repository and the content hash of the operation list of the service files, and one documented command refreshes it from a checkout of this repository. A contract check compares each document with the intake and fails on an operation the model has and the document lacks, or on a differing method, path, scope or response code. Shared contract types are not generated a second time: a type the contracts package declares comes from the pinned contracts package, and an architecture test fails on a copy. Generated types are not committed; every build regenerates them, and a missing or unparsable document fails the build with the path and the parser message. Kind: enabling. Traces: descriptors: run-submission-v1; adrs: ADR-0022, ADR-0028. Depends on: feature:component-api-library-template-factory-clients, feature:contracts-package. Sources: model/components.yaml, model/templates.yaml, model/gateways.yaml, model/template-parameters/connectsoft-api-library.yaml, docs/architecture/api-governance.md, docs/architecture/ecosystem-composition.md, model/services/model-compute/ModelRouterService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/control-plane/ControlPlaneApi.yaml, model/services/template-library/TemplateCatalogHost.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the four OpenAPI documents and the pinned template package, when the seven libraries are generated and built, then each holds the client interface, the client, the request types and the response types generated from its document and registered by the dependency injection extension of the template: the two control plane clients, one in the user-token layout and one in the workload layout from the same document, for the operations of ProjectService, RunControlService, EnvironmentService and CostUsageService, the two model gateway clients, in the workload layout and in the user-token layout for StudioBff (D141), for `ListModelProfiles` to `ListRunReceipts` of ModelRouterService, the two tool gateway clients, in the same two layouts (D141), for `ListTools` to `ConfirmToolEffect` of ToolAdapterService, and the template catalog gateway client, in the user-token layout, for the seventeen public REST operations of BlueprintService, GenerationRecipeService and TemplateRegistryService, with `projectId` as a required query parameter of `ListBlueprints` and `ListRecipes` and as a required body member of `CreateBlueprintVersion` and `DraftRecipe`; no internal gRPC method is in a package, no generated type is under version control, and the generation manifest of each library records the template version and the parameter values (ADR-0028 decision 2; model/template-parameters/connectsoft-api-library.yaml).",
        "AC2: Given the four documents and the intake of the model, when the contract check runs, then every public REST operation that a service file lists for a service the gateway fronts and whose delivery increment in model/backlog/features is I1 or earlier is in the document of that gateway with the same method, path, scope and response codes, a difference fails the check with the operation named, and the operations of a service of a later increment are absent until the package version of their increment (docs/architecture/api-governance.md; model/gateways.yaml names what each gateway fronts).",
        "AC3: Given a contract type that the contracts package declares, such as the run submission of `run-submission-v1`, when a library is generated, then the type comes from the pinned contracts package, and an architecture test fails when one of the libraries declares a second type for a descriptor of that package (ADR-0028; model/descriptors.yaml).",
        "AC4: Given a document path that does not exist or a document that does not parse, when a library builds, then the build fails with the path and the parser message named and no client of an earlier build is packed (ADR-0028 decision 2; docs/architecture/ecosystem-composition.md names OpenAPI generation as the need of this component)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/gateways.yaml",
        "model/template-parameters/connectsoft-api-library.yaml",
        "docs/architecture/api-governance.md",
        "docs/architecture/ecosystem-composition.md",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-640",
        "AIFACTORY-TASK-1556",
        "AIFACTORY-TASK-1557"
      ],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2501,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-submission-v1"
        ],
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-api-library-template-factory-clients",
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/gateways.yaml",
        "model/template-parameters/connectsoft-api-library.yaml",
        "docs/architecture/api-governance.md",
        "docs/architecture/ecosystem-composition.md",
        "model/services/model-compute/ModelRouterService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/ControlPlaneApi.yaml",
        "model/services/template-library/TemplateCatalogHost.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-381]",
      "number": 381
    },
    {
      "id": "AIFACTORY-TASK-640",
      "type": "task",
      "parent": "AIFACTORY-US-381",
      "title": "Client packages for the control-plane, model, tool and template catalog gateways",
      "sequence": "17.09.01.01",
      "description": "Client packages for the control-plane, model, tool and template catalog gateways. Expected output: Seven client libraries in the repository `ConnectSoft.AI.SoftwareFactory.Clients`, the control plane client, the model gateway client and the tool gateway client each in the user-token layout and in the workload layout, the user-token layout of the model and tool gateway clients for StudioBff (D141), and the template catalog gateway client in the user-token layout, generated with `dotnet new connectsoft-api-library` with the generation switch and `UseFactoryProfile` from the OpenAPI documents of the control plane, model, tool and template catalog gateways, each holding the public REST operations of the services of increment I1 or earlier that its gateway fronts, versioned with the contracts package they pin and published to the feed, so that the command-line client pins the control plane client of the user-token layout in place of its hand-written adapter (AIFACTORY-TASK-2111 of feature `command-line-client-commands`); the invoke path of the agent host is not served by these packages.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Seven client libraries in the repository `ConnectSoft.AI.SoftwareFactory.Clients`, the control plane client, the model gateway client and the tool gateway client each in the user-token layout and in the workload layout, the user-token layout of the model and tool gateway clients for StudioBff (D141), and the template catalog gateway client in the user-token layout, generated with `dotnet new connectsoft-api-library` with the generation switch and `UseFactoryProfile` from the OpenAPI documents of the control plane, model, tool and template catalog gateways, each holding the public REST operations of the services of increment I1 or earlier that its gateway fronts, versioned with the contracts package they pin and published to the feed, so that the command-line client pins the control plane client of the user-token layout in place of its hand-written adapter (AIFACTORY-TASK-2111 of feature `command-line-client-commands`); the invoke path of the agent host is not served by these packages."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-640]",
      "number": 640
    },
    {
      "id": "AIFACTORY-TASK-1556",
      "type": "task",
      "parent": "AIFACTORY-US-381",
      "title": "OpenAPI documents of the four gateways with their hashes and the comparison with the model",
      "sequence": "17.09.01.02",
      "description": "OpenAPI documents of the four gateways with their hashes and the comparison with the model. Expected output: The client repository holds one OpenAPI document per gateway with its content hash, written contract-first from an intake of the model and the source of truth until a gateway publishes its own; the intake is built like the intake of AIFACTORY-TASK-1567 (an intake file with the source revision of this repository and the content hash of the operation list, one documented refresh command, a pipeline stage that fails when the refreshed hash differs); each document describes the public REST operations of the services of increment I1 or earlier that model/gateways.yaml and the gateway file let the gateway front, with the schemas of the descriptors from the pinned contracts package; a contract check fails on a missing operation or on a differing method, path, scope or response code, with the operation named, and lists per package the operations whose scope is an `svc.` scope.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The client repository holds one OpenAPI document per gateway with its content hash, written contract-first from an intake of the model and the source of truth until a gateway publishes its own; the intake is built like the intake of AIFACTORY-TASK-1567 (an intake file with the source revision of this repository and the content hash of the operation list, one documented refresh command, a pipeline stage that fails when the refreshed hash differs); each document describes the public REST operations of the services of increment I1 or earlier that model/gateways.yaml and the gateway file let the gateway front, with the schemas of the descriptors from the pinned contracts package; a contract check fails on a missing operation or on a differing method, path, scope or response code, with the operation named, and lists per package the operations whose scope is an `svc.` scope."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2501,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1556]",
      "number": 1556
    },
    {
      "id": "AIFACTORY-TASK-1557",
      "type": "task",
      "parent": "AIFACTORY-US-381",
      "title": "Verify the generated libraries, the contract check and the single definition of shared types",
      "sequence": "17.09.01.03",
      "description": "Verify the generated libraries, the contract check and the single definition of shared types. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the client solution; the seven libraries build from the four documents, the contract check against the model passes and fails on a planted differing scope, the architecture test finds no copy of a type of the contracts package, and a planted unparsable document fails the build, which proves AC1 to AC4 of AIFACTORY-US-381 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the client solution; the seven libraries build from the four documents, the contract check against the model passes and fails on a planted differing scope, the architecture test finds no copy of a type of the contracts package, and a planted unparsable document fails the build, which proves AC1 to AC4 of AIFACTORY-US-381 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1557]",
      "number": 1557
    },
    {
      "id": "AIFACTORY-US-382",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-178",
      "title": "Gateway clients: each package is registered for its caller, a user token goes only to the gateway that is its one audience, and no public REST operation admits a workload token today",
      "sequence": "17.09.02",
      "description": "As an asset maintainer, I want each gateway client to send the token its caller is allowed to send and the scope the call runs under, so that a token never reaches a gateway it was not issued for and a call never leaves without a scope. The amendments of ADR-0015 (decision D114) settle which token a caller sends. A user token has one audience, the gateway that fronts its scopes, so a client that calls two gateways requests two tokens. A workload token carries service scopes, no audience of a user API and no tenant claim, and a gateway or service reads the tenant and project a workload forwards only when the token holds the service scope that names it. The template delivers the mechanics for both under AIFACTORY-US-302 of feature `component-api-library-template-factory-clients`: one delegating handler that is the single writer of the scope headers and obtains a workload token by client credentials, the refusal of a call without a scope, the distinct typed errors for 404 and 403 with the single refresh on 401, and a JWT bearer choice for a caller that already holds a user token. Those behaviours are proven on the generated library of the template and are not proven a second time here; this PBI writes no handler and patches no generated output. It states the caller of each package and proves only what differs per package. Three points do. First, the callers. The command-line client holds a user token and calls the control plane client; a Factory service calls a gateway as a workload. In the template `AuthenticationType` is one choice per generated library, so one package with both layouts is not what the template generates. Decision D117 settles how the two callers of the control plane are served: the control plane client is generated as two libraries from the same document, one in the JWT bearer layout for a caller that holds a user token and one in the workload layout, which makes four packages with the model and tool gateway clients of the workload layout. The model and tool gateway clients are generated in the JWT bearer layout as well, for StudioBff, which calls the model and the tool gateway with a user token exchanged for the audience of each gateway (D141), which makes six. The template catalog gateway client, added by decision D123, is the seventh; it is generated in the JWT bearer layout only, because the caller that reaches the template catalog gateway with a typed client is the command-line client, which holds a user token. The command-line client is the consumer of the user-token layout of the control plane client; the workload layout is generated, registered and published beside it and has no consumer among the modelled routes today, as the third point states. Second, the user-token layout has no scope accessor behind it, because the command-line client has none. The rule proposed here is that in this layout the client sends no tenant header, the project travels in the route, and a missing scope in the accessor does not refuse the call; the gateway takes the tenant from the token and overwrites a tenant header in any case (ADR-0015 decision 2). The owner may choose another rule, and the criterion follows it; if the scope handler of the Factory profile refuses such a call in the generated library, that is recorded as a gap for the template feature and not patched. The user token is attached only to requests to the base address of the control plane gateway and is never handed to the model or the tool gateway client. The model gateway and the tool gateway are two more audiences of a user token: StudioBff requests one token for each, and the user-token layout of each client attaches it only to requests to the base address of its own gateway (D141). The template catalog gateway is a second audience: a user token has one audience, so the command-line client requests a second token for that gateway, and the template catalog gateway client attaches it only to requests to the base address of the template catalog gateway; neither client is given the token of the other. The project of a call through the template catalog gateway client travels where the operation declares it, in the path, in the required query parameter `projectId` or in the required body member `projectId` (decision D123). Third, the workload layout. Every public REST operation of the model names a `factory.` scope and none names an `svc.` scope, and a gateway admits a workload token only on a route whose operation names an `svc.` scope the token holds (AIFACTORY-US-237). No public REST operation therefore admits a workload token today, which decision D117 records as the state of the model and not as a question. The contract check lists per package the operations whose scope is an `svc.` scope; the list is empty today and grows only with a change of the model. No test of this PBI asserts that a modelled route admits a workload token: the workload layout of the control plane client and the model and tool gateway clients are proven against the stubs, on the token they request and on the headers they write. No token and no header value is written to a log. Kind: enabling. Traces: descriptors: execution-scope-v1; adrs: ADR-0015, ADR-0022, ADR-0028. Depends on: AIFACTORY-US-381, feature:component-api-library-template-factory-clients, feature:component-extensions-ai, feature:component-auth-server-template-factory-tokens. Sources: docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0022-mcp-as-tool-protocol.md, model/components.yaml, model/gateways.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the registrations of the packages, when they are read against the generated output of the pinned template, then every handler, header name and claim name comes from the template and from the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions`, no package declares one of its own, the options are validated at start, and the workload token, the refusal without a scope and the typed errors are referred to AC1, AC2 and AC3 of AIFACTORY-US-302 and are not tested a second time (ADR-0015 amendment on the workload token; descriptor `execution-scope-v1`; model/backlog/pbis/component-extensions/component-api-library-template-factory-clients.yaml).",
        "AC2: Given the control plane client in the user-token layout, the layout of the command-line client, when it is called and the gateway stub redirects to a second host, then the user token is attached only to requests to the base address of the control plane gateway, the second host receives none, and the model and tool gateway clients are never given that token; given the model or the tool gateway client in the user-token layout and the user token issued for its gateway, when StudioBff calls it, then that token is attached only to requests to the base address of that gateway (D141); given the template catalog gateway client and the user token issued for the template catalog gateway, when it is called, then that token is attached only to requests to the base address of that gateway, and the token issued for the control plane gateway is never attached to them (ADR-0015 amendment on the one audience of a user token).",
        "AC3: Given the control plane client in the user-token layout and no scope in the accessor, when it is called, then it sends no tenant header, the project travels in the route, and the call is not refused for the missing scope, because the gateway takes the tenant from the token (ADR-0015 decision 2, descriptor `execution-scope-v1`); this is the proposed rule, and the criterion follows the rule the owner chooses if it differs.",
        "AC4: Given the contract check of the client repository, when it lists per package the operations whose scope in the model is an `svc.` scope, then the list is what the model states, which is empty today because every public REST operation names a `factory.` scope, so no public REST operation admits a workload token today; the control plane client in the workload layout is generated and registered beside the user-token layout from the same document, and no test asserts that a modelled route admits a workload token (ADR-0015 amendment on the workload token; ADR-0022 decision 2; model/gateways.yaml)."
      ],
      "sourceArtifacts": [
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "model/components.yaml",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1558",
        "AIFACTORY-TASK-1559",
        "AIFACTORY-TASK-1560"
      ],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2502,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-381",
        "feature:component-api-library-template-factory-clients",
        "feature:component-extensions-ai",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "model/components.yaml",
        "model/gateways.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-382]",
      "number": 382
    },
    {
      "id": "AIFACTORY-TASK-1558",
      "type": "task",
      "parent": "AIFACTORY-US-382",
      "title": "Token and scope registration of the seven client packages",
      "sequence": "17.09.02.01",
      "description": "Token and scope registration of the seven client packages. Expected output: The registrations of the packages: the control plane client is generated as two libraries from the same document, one in the JWT bearer layout of the template for the command-line client, which holds a user token, and one in the workload layout with the workload token of the Factory profile; the template catalog gateway client is generated in the JWT bearer layout of the template for the same caller, with the template catalog gateway as the one audience of its token; the model and tool gateway clients are generated with the workload token of the Factory profile and the `svc.` scopes of their registration, and a second time in the JWT bearer layout of the template for StudioBff, with their own gateway as the one audience of its token (D141); no library writes a handler, a header name or a claim name of its own, the generated output is not patched, a difference between the generated library and the rule of AC3 is recorded as a gap for feature `component-api-library-template-factory-clients`, and the options are validated at start.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The registrations of the packages: the control plane client is generated as two libraries from the same document, one in the JWT bearer layout of the template for the command-line client, which holds a user token, and one in the workload layout with the workload token of the Factory profile; the template catalog gateway client is generated in the JWT bearer layout of the template for the same caller, with the template catalog gateway as the one audience of its token; the model and tool gateway clients are generated with the workload token of the Factory profile and the `svc.` scopes of their registration, and a second time in the JWT bearer layout of the template for StudioBff, with their own gateway as the one audience of its token (D141); no library writes a handler, a header name or a claim name of its own, the generated output is not patched, a difference between the generated library and the rule of AC3 is recorded as a gap for feature `component-api-library-template-factory-clients`, and the options are validated at start."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1558]",
      "number": 1558
    },
    {
      "id": "AIFACTORY-TASK-1559",
      "type": "task",
      "parent": "AIFACTORY-US-382",
      "title": "Stubs of the four gateways and of the token endpoint",
      "sequence": "17.09.02.02",
      "description": "Stubs of the four gateways and of the token endpoint. Expected output: A fixture of the client solution with a stub server per gateway that answers from its OpenAPI document and can answer 401, 403, 404 and a redirect to a second host, and a stub of the token endpoint of the authorization server that records the requested scopes and parameters of each token request.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "A fixture of the client solution with a stub server per gateway that answers from its OpenAPI document and can answer 401, 403, 404 and a redirect to a second host, and a stub of the token endpoint of the authorization server that records the requested scopes and parameters of each token request."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1559]",
      "number": 1559
    },
    {
      "id": "AIFACTORY-TASK-1560",
      "type": "task",
      "parent": "AIFACTORY-US-382",
      "title": "Verify the token of each caller, the refusal without a scope and the typed errors",
      "sequence": "17.09.02.03",
      "description": "Verify the token of each caller, the refusal without a scope and the typed errors. Expected output: Run `dotnet test -c Release --no-build` on the client solution; the comparison of the registrations with the generated output, the user token of the control plane client with the redirect, the token of the template catalog gateway client and the user tokens of the model and tool gateway clients of the user-token layout each attached to its own gateway only (D141), the user-token call without a scope and without a tenant header, the list of operations with an `svc.` scope and the search of the log for a token value pass and prove AC1 to AC4 of AIFACTORY-US-382 (ADR-0015, ADR-0022).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the client solution; the comparison of the registrations with the generated output, the user token of the control plane client with the redirect, the token of the template catalog gateway client and the user tokens of the model and tool gateway clients of the user-token layout each attached to its own gateway only (D141), the user-token call without a scope and without a tenant header, the list of operations with an `svc.` scope and the search of the log for a token value pass and prove AC1 to AC4 of AIFACTORY-US-382 (ADR-0015, ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1560]",
      "number": 1560
    },
    {
      "id": "AIFACTORY-US-383",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-178",
      "title": "Gateway clients: the seven client packages are published to the ConnectSoft feed with versions tied to the contracts package, and a probe consumer calls a stub of each gateway from the feed alone",
      "sequence": "17.09.03",
      "description": "As an asset maintainer, I want proof that the five client packages are on the ConnectSoft feed with versions a consumer can pin, so that the command-line client restores the control plane client from the feed and can drop its hand-written adapter. This PBI is the publication proof of the feature. The pipeline of the repository `ConnectSoft.AI.SoftwareFactory.Clients` generates the seven libraries, builds them, runs their tests against the stubs, packs them and publishes them to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to. It is the pipeline the template generates and it runs unchanged: the repository adds only the probe stage, the intake stage and, in its test project, the version tie test, and a gap of the generated pipeline is reported to the template feature and not patched. A publication is reached only after the tests pass, and a version that is already on the feed is refused with the reason. The packages are versioned with the contracts package: each package records the version of the contracts package it pins and the hash of the OpenAPI document it was generated from, and a test fails when the pinned contracts version or the document changed while the package version did not. A probe then proves the result from the side of a consumer. A clean console host with the ConnectSoft feed as its only source and no project reference restores the seven published versions, registers each client in the mode without inbound requests that the template offers for such a host, and calls a stub of each gateway; the stubs assert the token and the headers of the layout of the package: the workload token with the tenant header and the project header for the model and tool gateway clients and for the control plane client of the workload layout, the user token without a tenant header for the control plane, model and tool gateway clients of the user-token layout (D141) and for the template catalog gateway client. The published versions are recorded on the Runbook page of the client repository, which is where a consumer reads its pins. The one consumer named today is the command-line client, which pins the control plane client of the user-token layout in place of its hand-written adapter. The template catalog gateway client is published for the same caller: by decision D123 the command-line client calls the template catalog gateway and reaches no service host directly, and the commands that call it, recipe show and recipe approve of AIFACTORY-US-1507 of feature `command-line-client-commands`, are work of `ConnectSoft.AI.SoftwareFactory.Cli` and no part of this feature. The change of the adapter is AIFACTORY-TASK-2111 of AIFACTORY-US-376 in the feature `command-line-client-commands` of increment I1 (decision D117); it is a task in `ConnectSoft.AI.SoftwareFactory.Cli`, and this template and library feature does not hold it. The `UseFactoryModelRouter` and `UseFactoryToolAdapter` switches of the agent host are not consumers of these packages while the question of the invoke path is open. This PBI ends with the packages on the feed, the probe green and the versions recorded. A run with a planted change of a document under an unchanged version proves that such a package is not published. Kind: evidence. Traces: adrs: ADR-0015, ADR-0022, ADR-0028. Depends on: AIFACTORY-US-381, AIFACTORY-US-382, feature:contracts-package. Sources: model/components.yaml, model/templates.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the client repository, when it runs after the work of the feature, then the seven packages are generated, built, tested, packed and pushed to the ConnectSoft feed with versions that were not on the feed, each package records the version of the contracts package it pins and the hash of its OpenAPI document, and the versions are recorded on the Runbook page of the repository (ADR-0028 amendment on the Factory profile switch names the feed; model/components.yaml).",
        "AC2: Given a clean console host with the ConnectSoft feed as its only package source and no project reference, when it restores the seven published versions, registers each client and calls a stub of each gateway, then each call succeeds and the stub asserts the token and the headers of the layout of the package: the workload token with the tenant header and the project header for the model and tool gateway clients and for the control plane client of the workload layout, the user token without a tenant header for the control plane, model and tool gateway clients of the user-token layout (D141) and for the template catalog gateway client (ADR-0015 decision 2, ADR-0022 decision 2).",
        "AC3: Given an OpenAPI document or a pinned contracts package version that changed while the package version did not, or a version that is already on the feed, when the pipeline reaches the publication stage, then the stage is refused with the reason and nothing is pushed; a run with a planted changed document proves the refusal (ADR-0028 decision 2)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1561",
        "AIFACTORY-TASK-1562",
        "AIFACTORY-TASK-1563",
        "AIFACTORY-TASK-1564"
      ],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2503,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-381",
        "AIFACTORY-US-382",
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-383]",
      "number": 383
    },
    {
      "id": "AIFACTORY-TASK-1561",
      "type": "task",
      "parent": "AIFACTORY-US-383",
      "title": "First publishing run of the generated pipeline of the client repository",
      "sequence": "17.09.03.01",
      "description": "First publishing run of the generated pipeline of the client repository. Expected output: The pipeline generated by the template runs unchanged: one green run publishes the seven packages to the ConnectSoft feed after the tests of the solution pass, and one run with a repeated version is refused with the reason; the repository adds only the probe stage of AIFACTORY-TASK-1562, the intake stage and, in its test project, the version tie test that fails when the pinned contracts package version or the hash of an OpenAPI document changed under an unchanged package version; a gap in the generated pipeline is reported to feature `component-api-library-template-factory-clients` and not patched.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: one green publishing run and one refused run with a repeated version of the generated pipeline.",
      "acceptanceCriteria": [
        "The pipeline generated by the template runs unchanged: one green run publishes the seven packages to the ConnectSoft feed after the tests of the solution pass, and one run with a repeated version is refused with the reason; the repository adds only the probe stage of AIFACTORY-TASK-1562, the intake stage and, in its test project, the version tie test that fails when the pinned contracts package version or the hash of an OpenAPI document changed under an unchanged package version; a gap in the generated pipeline is reported to feature `component-api-library-template-factory-clients` and not patched."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2503,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1561]",
      "number": 1561
    },
    {
      "id": "AIFACTORY-TASK-1562",
      "type": "task",
      "parent": "AIFACTORY-US-383",
      "title": "Feed probe consumer for the seven client packages",
      "sequence": "17.09.03.02",
      "description": "Feed probe consumer for the seven client packages. Expected output: A probe console host with the ConnectSoft feed as its only source and no project reference restores the seven published versions, registers each client in the mode without inbound requests, and calls a stub of each gateway; the stubs assert the workload token, the tenant header and the project header for the model and tool gateway clients and for the control plane client of the workload layout, and the user token without a tenant header for the control plane, model and tool gateway clients of the user-token layout (D141) and for the template catalog gateway client; the probe runs as the last stage of the pipeline.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe console host with the ConnectSoft feed as its only source and no project reference restores the seven published versions, registers each client in the mode without inbound requests, and calls a stub of each gateway; the stubs assert the workload token, the tenant header and the project header for the model and tool gateway clients and for the control plane client of the workload layout, and the user token without a tenant header for the control plane, model and tool gateway clients of the user-token layout (D141) and for the template catalog gateway client; the probe runs as the last stage of the pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2503,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1562]",
      "number": 1562
    },
    {
      "id": "AIFACTORY-TASK-1563",
      "type": "task",
      "parent": "AIFACTORY-US-383",
      "title": "Published versions of the client packages recorded on the Runbook page",
      "sequence": "17.09.03.03",
      "description": "Published versions of the client packages recorded on the Runbook page. Expected output: The Runbook page of the client repository names, per package, the published version, the version of the contracts package it pins, the hash of its OpenAPI document and the consumer that pins it: the command-line client for the control plane client of the user-token layout; the template catalog gateway client names the command-line client as its caller (decision D123), whose commands recipe show and recipe approve pin it (AIFACTORY-US-1507 of feature `command-line-client-commands`); the control plane client of the workload layout names no consumer while no public REST operation admits a workload token; the model and tool gateway clients of the workload layout name no consumer while the question of the invoke path of the agent host is open, and those of the user-token layout name StudioBff as their caller (D141); the typed clients of the later gateways, AIFACTORY-TASK-6601 (DeliveryHost), AIFACTORY-TASK-6602 (RuntimeCloudHost), AIFACTORY-TASK-6603 (ObservabilityHost) and AIFACTORY-TASK-6604 (DataEventFoundations), are held by their gateway features and recorded on the same page with the package version of their increment (D140); the documentation site of the repository builds without warnings.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "The Runbook page of the client repository names, per package, the published version, the version of the contracts package it pins, the hash of its OpenAPI document and the consumer that pins it: the command-line client for the control plane client of the user-token layout; the template catalog gateway client names the command-line client as its caller (decision D123), whose commands recipe show and recipe approve pin it (AIFACTORY-US-1507 of feature `command-line-client-commands`); the control plane client of the workload layout names no consumer while no public REST operation admits a workload token; the model and tool gateway clients of the workload layout name no consumer while the question of the invoke path of the agent host is open, and those of the user-token layout name StudioBff as their caller (D141); the typed clients of the later gateways, AIFACTORY-TASK-6601 (DeliveryHost), AIFACTORY-TASK-6602 (RuntimeCloudHost), AIFACTORY-TASK-6603 (ObservabilityHost) and AIFACTORY-TASK-6604 (DataEventFoundations), are held by their gateway features and recorded on the same page with the package version of their increment (D140); the documentation site of the repository builds without warnings."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2503,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1563]",
      "number": 1563
    },
    {
      "id": "AIFACTORY-TASK-1564",
      "type": "task",
      "parent": "AIFACTORY-US-383",
      "title": "Verify the published packages by the probe and by a planted failing run",
      "sequence": "17.09.03.04",
      "description": "Verify the published packages by the probe and by a planted failing run. Expected output: One run of the pipeline publishes the seven packages and the probe passes; one run with a planted changed OpenAPI document under an unchanged version stops before publication and pushes nothing; both runs prove AC1 to AC3 of AIFACTORY-US-383 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "One run of the pipeline publishes the seven packages and the probe passes; one run with a planted changed OpenAPI document under an unchanged version stops before publication and pushes nothing; both runs prove AC1 to AC3 of AIFACTORY-US-383 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1564]",
      "number": 1564
    },
    {
      "id": "AIFACTORY-US-119",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-178",
      "title": "Typed client libraries for the Factory gateways from the API library template is delivered and proven by its consumers",
      "sequence": "17.09.04",
      "description": "As an asset maintainer, I want typed client libraries for the Factory gateways from the API library template, so that it serves typed client libraries for the control-plane, model, tool, template catalog, knowledge, governance and integration gateways; consumed by the command-line client without later rework. This is the integration PBI of the feature. An asset maintainer takes the contracts of the seven Factory gateways of I1 to ten published client packages, the control plane client in a user-token layout and in a workload layout and the client of the template catalog gateway, which decision D123 delivers in I1, among them: the libraries generated from the OpenAPI documents of the gateways with the API library template and checked against the model (AIFACTORY-US-381), the token and scope rules of each caller (AIFACTORY-US-382), the publication to the ConnectSoft feed with a probe consumer (AIFACTORY-US-383), and the clients of the knowledge, governance and integration gateways, which decisions D125, D127 and D129 move to I1 (AIFACTORY-US-1510). The implementation lives in those PBIs; this one proves them together from the side of the consumers. The clients are generated and not written: the template with its OpenAPI generation, its Factory profile and its gate is delivered by AIFACTORY-US-301 to AIFACTORY-US-304 of feature `component-api-library-template-factory-clients` and is consumed by a pin, and the shared contract types come from the pinned contracts package. The rules the packages carry are the decided ones: a user token has one audience, the gateway that fronts its scopes; a workload token carries service scopes, no audience of a user API and no tenant claim; a resource of another tenant is answered 404 and a missing scope inside the tenant 403, and the two surface as distinct errors. The feature is done when the eight packages are on the feed with recorded versions tied to the contracts package and a consumer that has only the feed calls a stub of each gateway through its client, so that the command-line client can pin the control plane client of the user-token layout in place of its hand-written adapter. The task that makes that change in `ConnectSoft.AI.SoftwareFactory.Cli` is AIFACTORY-TASK-2111 of AIFACTORY-US-376 in the feature `command-line-client-commands` of increment I1 (decision D117); it is Factory code and no part of this feature. The agent host switches are no consumer of these packages: the calls that invoke a model or a tool are internal gRPC methods with server streaming, and whether they stay with the transport of the Factory AI libraries or the template gains gRPC client generation is open for the owner. No public REST operation admits a workload token today, so the workload layouts are proven against the stubs and on no modelled route. Repository of the feature: `ConnectSoft.AI.SoftwareFactory.Clients`. Kind: enabling. Traces: adrs: ADR-0015, ADR-0022, ADR-0028. Depends on: AIFACTORY-US-381, AIFACTORY-US-382, AIFACTORY-US-383, AIFACTORY-US-1510, feature:component-api-library-template-factory-clients, feature:contracts-package. Sources: model/components.yaml, model/templates.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repository ConnectSoft.AI.SoftwareFactory.Clients, when its pipeline runs, then the ten packages build, the three of AIFACTORY-US-1510 among them, their tests pass and they publish to the ConnectSoft feed with verified versions that the consuming repositories pin (ADR-0028; model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-640 (client packages for the control-plane, model, tool and template catalog gateways) is done, then seven client packages generated with `dotnet new connectsoft-api-library` from the OpenAPI documents of the gateways, the control plane client in the user-token layout and in the workload layout and the template catalog gateway client among them, are versioned with the contracts package and published to the feed, and the package of the user-token layout is the one the command-line client pins in place of its hand-written adapter by AIFACTORY-TASK-2111 of the feature `command-line-client-commands` of increment I1, which is no part of this feature (ADR-0022 decision 2, ADR-0028 decision 3).",
        "AC3: Given a consumer that restores the published packages from the feed alone, when a workload calls the stub of the model or the tool gateway through its client and a caller with a user token calls the stub of the control plane gateway through the control plane client and the stub of the template catalog gateway through its client with the token issued for that gateway, then the workload sends a token with service scopes and no tenant claim together with the scope headers, each user token reaches only the gateway it was issued for, and a 404 for a resource of another tenant and a 403 for a missing scope are distinct errors (ADR-0015 amendments on the audience, the workload token and a resource of another tenant)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1565",
        "AIFACTORY-TASK-719"
      ],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2504,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-381",
        "AIFACTORY-US-382",
        "AIFACTORY-US-383",
        "AIFACTORY-US-1510",
        "feature:component-api-library-template-factory-clients",
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-119]",
      "number": 119
    },
    {
      "id": "AIFACTORY-TASK-1565",
      "type": "task",
      "parent": "AIFACTORY-US-119",
      "title": "Call each gateway stub from a web host and from a console host that pin the published packages",
      "sequence": "17.09.04.01",
      "description": "Call each gateway stub from a web host and from a console host that pin the published packages. Expected output: A consumer test project restores the eight published packages from the ConnectSoft feed and calls the stub of each gateway from a web host with an inbound request and from a console host without one: the model and tool gateway clients and the control plane client of the workload layout as a workload, the control plane client of the user-token layout, the template catalog gateway client and the knowledge, governance and integration gateway clients as a caller with a user token, each with the token issued for its own gateway; every call carries the token and the headers of its layout, which proves AC3 of AIFACTORY-US-119 and the published half of AC2; the consumer change of the command-line client is not part of this task.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Clients. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A consumer test project restores the eight published packages from the ConnectSoft feed and calls the stub of each gateway from a web host with an inbound request and from a console host without one: the model and tool gateway clients and the control plane client of the workload layout as a workload, the control plane client of the user-token layout, the template catalog gateway client and the knowledge, governance and integration gateway clients as a caller with a user token, each with the token issued for its own gateway; every call carries the token and the headers of its layout, which proves AC3 of AIFACTORY-US-119 and the published half of AC2; the consumer change of the command-line client is not part of this task."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1565]",
      "number": 1565
    },
    {
      "id": "AIFACTORY-TASK-719",
      "type": "task",
      "parent": "AIFACTORY-US-119",
      "title": "Verify typed-gateway-clients-delivered by running the declared command",
      "sequence": "17.09.04.02",
      "description": "Verify typed-gateway-clients-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build`; they pass and prove AC1 to AC3 of AIFACTORY-US-119.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build`; they pass and prove AC1 to AC3 of AIFACTORY-US-119."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-719]",
      "number": 719
    },
    {
      "id": "AIFACTORY-US-1510",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-178",
      "title": "Gateway clients: the knowledge, governance and integration gateways of I1 get typed libraries in the user-token layout, generated, checked, registered and published like the other seven",
      "sequence": "17.09.05",
      "description": "As an asset maintainer, I want typed clients for the knowledge, governance and integration gateways from their contracts, so that the command-line client reads artifacts, audit records and policies and registers connections through those gateways without a hand-written adapter. Decisions D125, D127 and D129 move the gateways `KnowledgeHost`, `GovernanceHost` and `IntegrationHost` from I3 to I1, like the template catalog gateway, so a person reaches the artifact, governance and integration routes of the first outcome through them and through no service host. Their clients are added to the repository `ConnectSoft.AI.SoftwareFactory.Clients` by the rules of AIFACTORY-US-381 to AIFACTORY-US-383, which this PBI applies and does not repeat: generated with `dotnet new connectsoft-api-library` and `UseFactoryProfile` from one OpenAPI document per gateway, written contract-first from the intake of the model until the gateway publishes its own, checked against the model by the contract check, with the shared types from the pinned contracts package. Each of the three is generated in the user-token layout, because the caller that reaches these gateways with a typed client is the command-line client, which holds a user token, and each gateway is one more audience: the client requests one token per gateway and each library attaches its token only to requests to the base address of its own gateway. What each package holds is named by the public REST operations of the services the gateway fronts whose delivery increment is I1 or earlier. The knowledge gateway client holds the five artifact routes of ArtifactService, `GetArtifact`, `PreviewArtifact`, `ListArtifactVersions`, `ListRunArtifacts` and `ExportArtifacts`; the other knowledge routes enter with the complete services of I5. The governance gateway client holds the routes of the three services of I1: of PolicyEngineService `ListPolicyBundles`, `GetPolicyBundle`, `ValidateProjectPolicy`, `SimulatePolicy` and `ListRunDecisions`; of SecretBrokerService `ListSecretReferences`, `RegisterSecretReference`, `RotateSecret`, `RevokeSecretReference` and `ListRunIssuances`; of AuditService `SearchAudit`, `ExportAudit`, `ListClassifications`, `SetClassification`, `ListFindings` and `ResolveFinding`. ApprovalPolicyService arrives in I4, so `ListApprovalRules`, `ValidateProjectApprovalRules` and `GetApprovalRouting` enter with the package version of I4. The integration gateway client holds the routes of the two thin services of I1: of ConnectorRegistryService `ListConnectors`, `CertifyConnector`, `CreateSubscription`, `ListDeliveries` and `ReplayDelivery`; of IntegrationService `RegisterConnection`, `ListConnections`, `VerifyConnection`, `SetGrant`, `RotateCredential` and `RevokeConnection`; a route whose operation the thin service does not host returns the answer of that service, and the client surfaces it as a typed error. The caller named today is the command-line client: the audit commands of AIFACTORY-TASK-309 call the governance gateway with the token of its audience. The commands are work of `ConnectSoft.AI.SoftwareFactory.Cli` and no part of this feature. The gateways of later increments get their typed clients in the user-token layout by the same rules, each in a task held by its own gateway feature and not by this I1 feature (D140): AIFACTORY-TASK-6601 for DeliveryHost (feature `delivery-host`, I2), AIFACTORY-TASK-6602 for RuntimeCloudHost (feature `runtime-cloud-host`, I2), AIFACTORY-TASK-6603 for ObservabilityHost (feature `observability-host`, I3) and AIFACTORY-TASK-6604 for DataEventFoundations (feature `data-event-foundations`, I4). The published versions are recorded on the Runbook page beside the seven others. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-381, AIFACTORY-US-382, AIFACTORY-US-383, feature:component-api-library-template-factory-clients, feature:contracts-package. Sources: model/gateways.yaml, model/services/knowledge/KnowledgeHost.yaml, model/services/governance/GovernanceHost.yaml, model/services/integration/IntegrationHost.yaml, docs/architecture/api-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given the OpenAPI documents of the knowledge, governance and integration gateways and the pinned template package, when the three libraries are generated and built in the user-token layout, then the knowledge gateway client holds the five artifact routes of ArtifactService, the governance gateway client the sixteen routes of PolicyEngineService, SecretBrokerService and AuditService and none of ApprovalPolicyService, and the integration gateway client the eleven routes of ConnectorRegistryService and IntegrationService, and no internal gRPC method and no generated type under version control is in a package (model/services/knowledge/KnowledgeHost.yaml, model/services/governance/GovernanceHost.yaml, model/services/integration/IntegrationHost.yaml).",
        "AC2: Given the three documents and the intake of the model, when the contract check runs, then every public REST operation of a service the gateway fronts whose delivery increment is I1 or earlier is in the document with the same method, path, scope and response codes, and the operations of ApprovalPolicyService of I4 and of the complete knowledge services of I5 are absent until the package version of their increment (model/gateways.yaml, docs/architecture/api-governance.md).",
        "AC3: Given each of the three clients and the user token issued for its gateway, when it is called against the stub of its gateway that redirects to a second host, then that token is attached only to requests to the base address of its gateway, the tokens of the other gateways are never attached, a 404 for a resource of another tenant and a 403 for a missing scope are distinct errors, and no token is written to a log (ADR-0015 amendment on the one audience of a user token).",
        "AC4: Given the pipeline of the client repository, when it publishes, then the three packages are on the ConnectSoft feed with versions tied to the contracts package, the probe consumer restores them from the feed alone and calls the stub of each gateway with the user token of that gateway and without a tenant header, and the Runbook page names their versions and the command-line client as their caller (ADR-0028, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/gateways.yaml",
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/governance/GovernanceHost.yaml",
        "model/services/integration/IntegrationHost.yaml",
        "docs/architecture/api-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-6129",
        "AIFACTORY-TASK-6130",
        "AIFACTORY-TASK-6131",
        "AIFACTORY-TASK-6132"
      ],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2505,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-381",
        "AIFACTORY-US-382",
        "AIFACTORY-US-383",
        "feature:component-api-library-template-factory-clients",
        "feature:contracts-package"
      ],
      "source": [
        "model/gateways.yaml",
        "model/services/knowledge/KnowledgeHost.yaml",
        "model/services/governance/GovernanceHost.yaml",
        "model/services/integration/IntegrationHost.yaml",
        "docs/architecture/api-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1510]",
      "number": 1510
    },
    {
      "id": "AIFACTORY-TASK-6129",
      "type": "task",
      "parent": "AIFACTORY-US-1510",
      "title": "OpenAPI documents of the knowledge, governance and integration gateways with their hashes and the contract check",
      "sequence": "17.09.05.01",
      "description": "OpenAPI documents of the knowledge, governance and integration gateways with their hashes and the contract check. Expected output: The client repository holds one OpenAPI document per gateway for KnowledgeHost, GovernanceHost and IntegrationHost with its content hash, written contract-first from the intake of the model and the source of truth until the gateway publishes its own; each describes the public REST operations of the services of I1 or earlier that the gateway fronts, and the contract check of AIFACTORY-TASK-1556 covers the three documents.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "The client repository holds one OpenAPI document per gateway for KnowledgeHost, GovernanceHost and IntegrationHost with its content hash, written contract-first from the intake of the model and the source of truth until the gateway publishes its own; each describes the public REST operations of the services of I1 or earlier that the gateway fronts, and the contract check of AIFACTORY-TASK-1556 covers the three documents."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2505,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6129]",
      "number": 6129
    },
    {
      "id": "AIFACTORY-TASK-6130",
      "type": "task",
      "parent": "AIFACTORY-US-1510",
      "title": "Client libraries of the knowledge, governance and integration gateways in the user-token layout",
      "sequence": "17.09.05.02",
      "description": "Client libraries of the knowledge, governance and integration gateways in the user-token layout. Expected output: Three client libraries generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` from the three documents in the JWT bearer layout of the template, each registered with the base address of its gateway and the token of that gateway as its one audience, without a handler, header name or claim name of its own, versioned with the contracts package and published through the generated pipeline of the repository.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "Three client libraries generated with `dotnet new connectsoft-api-library`, the generation switch and `UseFactoryProfile` from the three documents in the JWT bearer layout of the template, each registered with the base address of its gateway and the token of that gateway as its one audience, without a handler, header name or claim name of its own, versioned with the contracts package and published through the generated pipeline of the repository."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6130]",
      "number": 6130
    },
    {
      "id": "AIFACTORY-TASK-6131",
      "type": "task",
      "parent": "AIFACTORY-US-1510",
      "title": "Stubs of the three gateways and the probe stage for their packages",
      "sequence": "17.09.05.03",
      "description": "Stubs of the three gateways and the probe stage for their packages. Expected output: The fixture of the client solution gains a stub server for each of the three gateways that answers from its document and can answer 401, 403, 404 and a redirect to a second host, and the probe consumer restores the three published packages from the feed alone and calls each stub with the user token of its gateway.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "The fixture of the client solution gains a stub server for each of the three gateways that answers from its document and can answer 401, 403, 404 and a redirect to a second host, and the probe consumer restores the three published packages from the feed alone and calls each stub with the user token of its gateway."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2505,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6131]",
      "number": 6131
    },
    {
      "id": "AIFACTORY-TASK-6132",
      "type": "task",
      "parent": "AIFACTORY-US-1510",
      "title": "Verify the three gateway clients by the solution tests and the probe",
      "sequence": "17.09.05.04",
      "description": "Verify the three gateway clients by the solution tests and the probe. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the client solution and one publishing run of the pipeline; the three libraries build from their documents, the contract check passes and fails on a planted differing scope, each token reaches only its own gateway, and the probe stage is green, which proves AC1 to AC4 of AIFACTORY-US-1510.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Clients.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the client solution and one publishing run of the pipeline; the three libraries build from their documents, the contract check passes and fails on a planted differing scope, each token reaches only its own gateway, and the probe stage is green, which proves AC1 to AC4 of AIFACTORY-US-1510."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:readiness",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Clients"
      ],
      "children": [],
      "buildOrder": 25,
      "phase": "templates-and-libraries",
      "stackRank": 2505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6132]",
      "number": 6132
    },
    {
      "id": "AIFACTORY-EPIC-018",
      "type": "epic",
      "parent": null,
      "title": "Ecosystem component extensions",
      "sequence": "18",
      "description": "Extensions to components that already exist in the ConnectSoft estate and that the Factory is assembled from: the agent host template, the AI and Factory libraries, the Model Context Protocol library, the SaaS libraries and services, the Blazor shell, and the integration of the Config Platform when it exists. Done when: Every extend or develop component is realized by its features across I0 to I7, each template publishes a package that passes its generated-solution gate and each library publishes to the Factory feed before the Factory code that consumes it is built.",
      "acceptanceCriteria": [
        "Every extend or develop component is realized by its features across I0 to I7, each template publishes a package that passes its generated-solution gate and each library publishes to the Factory feed before the Factory code that consumes it is built."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:epic",
        "route:backend-developer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-096",
        "AIFACTORY-FEAT-097",
        "AIFACTORY-FEAT-098",
        "AIFACTORY-FEAT-099",
        "AIFACTORY-FEAT-100",
        "AIFACTORY-FEAT-153",
        "AIFACTORY-FEAT-154",
        "AIFACTORY-FEAT-155",
        "AIFACTORY-FEAT-156",
        "AIFACTORY-FEAT-157",
        "AIFACTORY-FEAT-158",
        "AIFACTORY-FEAT-159",
        "AIFACTORY-FEAT-161",
        "AIFACTORY-FEAT-162",
        "AIFACTORY-FEAT-163",
        "AIFACTORY-FEAT-171",
        "AIFACTORY-FEAT-172",
        "AIFACTORY-FEAT-175",
        "AIFACTORY-FEAT-183",
        "AIFACTORY-FEAT-160",
        "AIFACTORY-FEAT-176",
        "AIFACTORY-FEAT-177",
        "AIFACTORY-FEAT-180",
        "AIFACTORY-FEAT-181",
        "AIFACTORY-FEAT-184",
        "AIFACTORY-FEAT-173",
        "AIFACTORY-FEAT-174",
        "AIFACTORY-FEAT-185",
        "AIFACTORY-FEAT-167",
        "AIFACTORY-FEAT-168",
        "AIFACTORY-FEAT-169",
        "AIFACTORY-FEAT-101",
        "AIFACTORY-FEAT-164",
        "AIFACTORY-FEAT-102",
        "AIFACTORY-FEAT-103",
        "AIFACTORY-FEAT-166",
        "AIFACTORY-FEAT-170",
        "AIFACTORY-FEAT-179",
        "AIFACTORY-FEAT-182",
        "AIFACTORY-FEAT-186",
        "AIFACTORY-FEAT-104",
        "AIFACTORY-FEAT-105",
        "AIFACTORY-FEAT-106",
        "AIFACTORY-FEAT-165"
      ],
      "stackRank": 199,
      "titlePrefix": "[AIFACTORY-EPIC-018]",
      "number": 18
    },
    {
      "id": "AIFACTORY-FEAT-096",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Agent host template: one execution port and Factory scope",
      "sequence": "18.01",
      "description": "The agent host template carries the Factory scope on every entry point and converges its lifecycle, MCP, REST and development entry points on one execution port, so that every run enters the same way. AgentRuntimeService and WorkflowEngineService are scaffolded from it. Component: AI Agent host template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 2 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-136",
        "AIFACTORY-US-137",
        "AIFACTORY-US-138",
        "AIFACTORY-US-096"
      ],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 200,
      "titlePrefix": "[AIFACTORY-FEAT-096]",
      "number": 96
    },
    {
      "id": "AIFACTORY-US-136",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-096",
      "title": "Agent host template: the Factory scope travels on the trace context of the Factory libraries and every entry point refuses a request without it",
      "sequence": "18.01.01",
      "description": "As an asset maintainer, I want every entry point of a generated agent host to bind the trusted tenant, project, run, step and attempt identity into the scoped trace context of the Factory libraries, so that no attempt executes without the scope that Run Control, the policy engine and the audit trail attribute it to. The trace context a generated agent host carries is `AgentTraceContext` of the library `ConnectSoft.Extensions.AI.Factory.Abstractions`, which today holds trace id, blueprint id, agent origin and workflow step and nothing else. ADR-0014 makes tenant id, project id, run id, step id and attempt id required on every Factory message, keeps the trace id as diagnostic correlation that is never an authorization or idempotency key, and places the additive change on the shared libraries. The library feature `component-extensions-ai` extends the type: the tenant and project scope under AIFACTORY-TASK-161 and the run id, step id, attempt id and schema version in a PBI of that feature, where D113 places them; this PBI consumes the result by pin. The template pins the versions of `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory` that carry the scoped trace context, adds no trace context of its own, and makes every entry point of a generated host (the lifecycle pipeline, the MCP tool, the REST operation and the development entry) bind the five identifiers into the library type from the caller before the pipeline starts. A request that arrives without tenant, project, run or attempt identity is refused before any model or tool call, and the refusal is recorded with its reason and the entry path it came through. The scope flows from the entry point into the lifecycle events, the outbox record and the telemetry of the attempt, so that later features put it on the envelope without a second plumbing pass. Kind: enabling. Traces: adrs: ADR-0014, ADR-0028. Depends on: feature:component-extensions-ai. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/agent-runtime/agent-runtime.md.",
      "acceptanceCriteria": [
        "AC1: Given a generated agent host built against the pinned Factory libraries, when a request enters through any of its entry points with a trusted tenant id, project id, run id, step id and attempt id, then the `AgentTraceContext` of `ConnectSoft.Extensions.AI.Factory.Abstractions` carries the five identifiers and the trace id, as ADR-0014 requires, and every lifecycle event and log entry of the attempt is attributable to them.",
        "AC2: Given a request that reaches an entry point without a tenant, project, run or attempt identity, when the entry point binds the scope, then the request is refused before the pipeline starts, no model or tool call is made, and the refusal is recorded with its reason and the name of the entry path (ADR-0014, docs/planes/agent-runtime/agent-runtime.md).",
        "AC3: Given the template tests, when the unit suite runs, then a test per entry path proves the refusal of a scope-less request and the propagation of a complete scope, and the library `AgentTraceContext` is the only scope carrier the host uses: the template defines no second trace context (ADR-0028 amendment on the Factory templates, D94: AgentRuntimeService and WorkflowEngineService are scaffolded from this host)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-793",
        "AIFACTORY-TASK-794",
        "AIFACTORY-TASK-795",
        "AIFACTORY-TASK-796"
      ],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 201,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "titlePrefix": "[AIFACTORY-US-136]",
      "number": 136
    },
    {
      "id": "AIFACTORY-TASK-793",
      "type": "task",
      "parent": "AIFACTORY-US-136",
      "title": "Pin the Factory libraries that carry the scoped trace context and bind the scope at every entry point",
      "sequence": "18.01.01.01",
      "description": "BEFORE DEVELOPMENT. Pin the Factory libraries that carry the scoped trace context and bind the scope at every entry point. Expected output: The template pins `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory` at the versions whose `AgentTraceContext` carries tenant id, project id, run id, step id and attempt id beside the trace id, blueprint id, agent origin and workflow step; every entry point of a generated host binds the five identifiers into that type; the template defines no trace context of its own.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template pins `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory` at the versions whose `AgentTraceContext` carries tenant id, project id, run id, step id and attempt id beside the trace id, blueprint id, agent origin and workflow step; every entry point of a generated host binds the five identifiers into that type; the template defines no trace context of its own."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-793]",
      "number": 793
    },
    {
      "id": "AIFACTORY-TASK-794",
      "type": "task",
      "parent": "AIFACTORY-US-136",
      "title": "Scope binding and refusal at every entry point",
      "sequence": "18.01.01.02",
      "description": "BEFORE DEVELOPMENT. Scope binding and refusal at every entry point. Expected output: The lifecycle pipeline, the MCP tool, the REST operation and the development entry bind the scope from the caller before execution; a request without tenant, project, run or attempt identity is refused with a recorded reason and entry path.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The lifecycle pipeline, the MCP tool, the REST operation and the development entry bind the scope from the caller before execution; a request without tenant, project, run or attempt identity is refused with a recorded reason and entry path."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-794]",
      "number": 794
    },
    {
      "id": "AIFACTORY-TASK-795",
      "type": "task",
      "parent": "AIFACTORY-US-136",
      "title": "Scope on the telemetry and log enrichment of an attempt",
      "sequence": "18.01.01.03",
      "description": "BEFORE DEVELOPMENT. Scope on the telemetry and log enrichment of an attempt. Expected output: Log entries, traces and metrics of an attempt are enriched with tenant, project, run, step and attempt identity from the library trace context; a test asserts the enrichment on one attempt.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Log entries, traces and metrics of an attempt are enriched with tenant, project, run, step and attempt identity from the library trace context; a test asserts the enrichment on one attempt."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-795]",
      "number": 795
    },
    {
      "id": "AIFACTORY-TASK-796",
      "type": "task",
      "parent": "AIFACTORY-US-136",
      "title": "Verify the scope refusal and propagation per entry path",
      "sequence": "18.01.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the scope refusal and propagation per entry path. Expected output: Run `dotnet test -c Release --no-build`; one test per entry path proves AC1 to AC3 of AIFACTORY-US-136: a scope-less request is refused before any model or tool call and a complete scope reaches the lifecycle events through the library `AgentTraceContext` (ADR-0014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build`; one test per entry path proves AC1 to AC3 of AIFACTORY-US-136: a scope-less request is refused before any model or tool call and a complete scope reaches the lifecycle events through the library `AgentTraceContext` (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-796]",
      "number": 796
    },
    {
      "id": "AIFACTORY-US-137",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-096",
      "title": "Agent host template: the lifecycle, MCP, REST and development entry paths converge on one execution port",
      "sequence": "18.01.02",
      "description": "As an asset maintainer, I want the four entry paths of a generated agent host to call one execution port that runs the lifecycle pipeline, so that no caller reaches the raw agent and every run enters the same way, under the same scope and policy checks. A generated agent host today has four entry paths. The lifecycle pipeline of `FactoryAgentBase` accepts a request, builds the prompt, runs the model, validates the output, retries within a bound and completes or escalates. The MCP tool wrapper, the REST operation and the development entry call the agent directly and skip that pipeline, which is the bypass ADR-0022 closes in its decision 7: exposing an agent as an MCP tool is allowed only through the lifecycle pipeline, never by calling the raw agent. This PBI defines one execution port in the application layer of the template, makes the lifecycle, MCP, REST and development paths call it with the bound scope of the earlier PBI, and removes every direct path to the agent. The port records which entry path an attempt came through. A test proves that no path bypasses scope and policy, and an architecture rule of the template fails the test run, and with it the generated-solution gate, when a new path calls the agent without the port. Kind: enabling. Traces: adrs: ADR-0022, ADR-0028. Depends on: AIFACTORY-US-136. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/planes/agent-runtime/agent-runtime.md.",
      "acceptanceCriteria": [
        "AC1: Given a generated agent host, when a request enters through the lifecycle, the MCP tool, the REST operation or the development entry, then the same execution port runs the pipeline accept, prompt, run, validate, retry, complete or escalate described in docs/planes/agent-runtime/agent-runtime.md, and the attempt records the entry path it came through.",
        "AC2: Given the MCP surface of a generated host, when its agent operation is invoked, then the invocation goes through the execution port and never calls the raw agent, as ADR-0022 decision 7 requires; a unit test calls the MCP tool with a scope-less request and asserts the refusal of the port.",
        "AC3: Given the architecture tests of the template, when a type outside the execution port calls the agent directly, then the architecture test fails the test run of the authoring and generated solutions, which fails the generated-solution gate; the test suite proves that none of the four entry paths bypasses scope and policy (ADR-0028, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-797",
        "AIFACTORY-TASK-798",
        "AIFACTORY-TASK-799",
        "AIFACTORY-TASK-800"
      ],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 202,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-136"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "titlePrefix": "[AIFACTORY-US-137]",
      "number": 137
    },
    {
      "id": "AIFACTORY-TASK-797",
      "type": "task",
      "parent": "AIFACTORY-US-137",
      "title": "Execution port contract in the application layer",
      "sequence": "18.01.02.01",
      "description": "BEFORE DEVELOPMENT. Execution port contract in the application layer. Expected output: An execution port interface in the application model of the template takes a scoped request and returns the agent result; it is the only type that invokes `IFactoryAgent`; the port records the entry path of the attempt.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "An execution port interface in the application model of the template takes a scoped request and returns the agent result; it is the only type that invokes `IFactoryAgent`; the port records the entry path of the attempt."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 202,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-797]",
      "number": 797
    },
    {
      "id": "AIFACTORY-TASK-798",
      "type": "task",
      "parent": "AIFACTORY-US-137",
      "title": "Reroute the MCP tool, the REST operation and the development entry through the port",
      "sequence": "18.01.02.02",
      "description": "BEFORE DEVELOPMENT. Reroute the MCP tool, the REST operation and the development entry through the port. Expected output: The MCP tool wrapper, the REST operation and the development entry call the execution port; the direct calls to the agent are removed; the generated host builds with every entry switch combination.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The MCP tool wrapper, the REST operation and the development entry call the execution port; the direct calls to the agent are removed; the generated host builds with every entry switch combination."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-798]",
      "number": 798
    },
    {
      "id": "AIFACTORY-TASK-799",
      "type": "task",
      "parent": "AIFACTORY-US-137",
      "title": "Architecture rule against a direct agent call",
      "sequence": "18.01.02.03",
      "description": "BEFORE DEVELOPMENT. Architecture rule against a direct agent call. Expected output: An architecture test of the template fails the test run when any type outside the execution port references the agent execution method; the rule is part of the generated solution as well, so the generated-solution gate fails on it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An architecture test of the template fails the test run when any type outside the execution port references the agent execution method; the rule is part of the generated solution as well, so the generated-solution gate fails on it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 202,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-799]",
      "number": 799
    },
    {
      "id": "AIFACTORY-TASK-800",
      "type": "task",
      "parent": "AIFACTORY-US-137",
      "title": "Verify that no entry path bypasses scope and policy",
      "sequence": "18.01.02.04",
      "description": "BEFORE DEVELOPMENT. Verify that no entry path bypasses scope and policy. Expected output: Run `dotnet test -c Release --no-build`; the unit and architecture tests prove AC1 to AC3 of AIFACTORY-US-137: each of the four entry paths reaches the execution port and the raw agent is unreachable (ADR-0022).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build`; the unit and architecture tests prove AC1 to AC3 of AIFACTORY-US-137: each of the four entry paths reaches the execution port and the raw agent is unreachable (ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-800]",
      "number": 800
    },
    {
      "id": "AIFACTORY-US-138",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-096",
      "title": "Agent host template: a host-kind switch scaffolds the attempt-runtime host and the workflow-engine host",
      "sequence": "18.01.03",
      "description": "As an asset maintainer, I want the agent template to scaffold the two Agent Mesh silo kinds from one host-kind switch, so that AgentRuntimeService and WorkflowEngineService start from a host that already carries their shape instead of a sample host that is cut down by hand. ADR-0028 decides in decision 4 that AgentRuntimeService and WorkflowEngineService deploy alone as two silo kinds of one Orleans cluster, and its amendment on the Factory templates (D94) scaffolds both from the agent template. The compose pipeline of the template has an `agent-profile` symbol, but that symbol selects the hosting environment (`local-safe` by default, `cloud-ready`) and is kept for that purpose. The owner decided the symbol (D113): the template gains the choice symbol `agent-host-kind` with the choices `agent`, `attempt-runtime` and `workflow-engine` and the default `agent`, orthogonal to `agent-profile`, which keeps its meaning. This PBI adds it. The two Factory kinds shape only what the template owns at I0: the silo-kind configuration of one Orleans cluster (cluster id and silo kind name in the generated settings), the declaration that the default messaging profile of these kinds is Orleans, as D113 decides (the choice, its default and the removal of the forced MassTransit constant are delivered by AIFACTORY-US-147 of `component-agent-template-factory-access`), and the presence of the execution port and the exemplar for the attempt-runtime kind against their exclusion for the workflow-engine kind, which executes no agent of its own. The attempt grain, the workflow run grain, the definition loader and the outcome report to Run Control are the I1 work of the two services on top of the scaffolded host and are not generated here. A value outside the choices is refused by the template engine with the choices listed. Both generated hosts build, pass the template tests and carry the execution port and the scope binding of the earlier PBIs where the kind includes them; the generated case of each kind joins the template test matrix. Kind: enabling. Traces: adrs: ADR-0024, ADR-0028. Depends on: AIFACTORY-US-136, AIFACTORY-US-137. Sources: model/components.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given the agent template, when `dotnet new connectsoft-ai-agent --agent-host-kind attempt-runtime` runs, then the generated host carries the silo-kind configuration of one Orleans cluster (cluster id and silo kind name), the execution port and the exemplar, and it builds and passes its tests; the attempt grain and the outcome report to Run Control are not generated and remain the I1 work of AgentRuntimeService (ADR-0024 decision 1, ADR-0028 decision 4).",
        "AC2: Given the agent template, when `dotnet new connectsoft-ai-agent --agent-host-kind workflow-engine` runs, then the generated host carries the silo-kind configuration of the same cluster with its own silo kind name and no agent execution path, exemplar or execution port of its own, and it builds and passes its tests; the definition loader and the step readiness emission of ADR-0024 decision 3 remain the I1 work of WorkflowEngineService.",
        "AC3: Given a value of `agent-host-kind` outside `agent`, `attempt-runtime` and `workflow-engine`, when the template is instantiated, then the template engine refuses the value with the choices listed; `agent-profile` keeps its values `local-safe` and `cloud-ready` beside it, and both symbols with their choices appear in model/template-parameters/connectsoft-ai-agent.yaml after the next inventory."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-801",
        "AIFACTORY-TASK-802",
        "AIFACTORY-TASK-803",
        "AIFACTORY-TASK-804"
      ],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 203,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-136",
        "AIFACTORY-US-137"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-138]",
      "number": 138
    },
    {
      "id": "AIFACTORY-TASK-801",
      "type": "task",
      "parent": "AIFACTORY-US-138",
      "title": "Choice symbol agent-host-kind with the choices agent, attempt-runtime and workflow-engine",
      "sequence": "18.01.03.01",
      "description": "BEFORE DEVELOPMENT. Choice symbol agent-host-kind with the choices agent, attempt-runtime and workflow-engine. Expected output: The merge script and the template configuration define the choice symbol `agent-host-kind` with the choices `agent`, `attempt-runtime` and `workflow-engine`, the default `agent` and a description per choice, orthogonal to the existing `agent-profile` symbol; a value outside the choices is refused by the template engine with the choices listed.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet new connectsoft-ai-agent --help lists the three choices of agent-host-kind beside the two of agent-profile.",
      "acceptanceCriteria": [
        "The merge script and the template configuration define the choice symbol `agent-host-kind` with the choices `agent`, `attempt-runtime` and `workflow-engine`, the default `agent` and a description per choice, orthogonal to the existing `agent-profile` symbol; a value outside the choices is refused by the template engine with the choices listed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 203,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-801]",
      "number": 801
    },
    {
      "id": "AIFACTORY-TASK-802",
      "type": "task",
      "parent": "AIFACTORY-US-138",
      "title": "Attempt-runtime host shape behind the host kind",
      "sequence": "18.01.03.02",
      "description": "BEFORE DEVELOPMENT. Attempt-runtime host shape behind the host kind. Expected output: With the attempt-runtime kind the generated host carries the silo-kind configuration of one Orleans cluster (cluster id, silo kind name) in its settings, the execution port wiring and the exemplar; no attempt grain and no Run Control report client are generated; the files of the other kinds are excluded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With the attempt-runtime kind the generated host carries the silo-kind configuration of one Orleans cluster (cluster id, silo kind name) in its settings, the execution port wiring and the exemplar; no attempt grain and no Run Control report client are generated; the files of the other kinds are excluded."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-802]",
      "number": 802
    },
    {
      "id": "AIFACTORY-TASK-803",
      "type": "task",
      "parent": "AIFACTORY-US-138",
      "title": "Workflow-engine host shape behind the host kind",
      "sequence": "18.01.03.03",
      "description": "BEFORE DEVELOPMENT. Workflow-engine host shape behind the host kind. Expected output: With the workflow-engine kind the generated host carries the silo-kind configuration of the same cluster with its own silo kind name and excludes the agent execution path, the exemplar and the execution port; no definition loader and no readiness emission are generated; the host builds with no agent registered.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With the workflow-engine kind the generated host carries the silo-kind configuration of the same cluster with its own silo kind name and excludes the agent execution path, the exemplar and the execution port; no definition loader and no readiness emission are generated; the host builds with no agent registered."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-803]",
      "number": 803
    },
    {
      "id": "AIFACTORY-TASK-804",
      "type": "task",
      "parent": "AIFACTORY-US-138",
      "title": "Verify the two host-kind cases in the template matrix",
      "sequence": "18.01.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the two host-kind cases in the template matrix. Expected output: The template test matrix generates one case per host kind; both cases restore, build and pass their tests, which proves AC1 to AC3 of AIFACTORY-US-138 and the scaffolding of the two silo kinds under the ADR-0028 amendment on the Factory templates (D94) on a generated solution.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The template test matrix generates one case per host kind; both cases restore, build and pass their tests, which proves AC1 to AC3 of AIFACTORY-US-138 and the scaffolding of the two silo kinds under the ADR-0028 amendment on the Factory templates (D94) on a generated solution."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-804]",
      "number": 804
    },
    {
      "id": "AIFACTORY-US-096",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-096",
      "title": "Agent host template: one execution port and Factory scope is delivered and proven on a generated solution",
      "sequence": "18.01.04",
      "description": "As an asset maintainer, I want AI Agent host template to carry one execution port and Factory scope, so that it serves AgentRuntimeService and WorkflowEngineService without later rework. This is the integration PBI of the feature. The asset maintainer packs the agent template with the Factory scope bound into the library trace context, the single execution port and the two Agent Mesh host kinds of the earlier PBIs, installs the package and instantiates it in the template pipeline. The generated solution of every case of the matrix restores, builds and passes its unit, architecture and acceptance tests before the package is allowed to publish with a verified version. A case that fails any stage fails the run and blocks publication; the run records which case and which stage failed. The migrated tasks of this PBI are its proofs on the generated solution; the implementation lives in the behaviour PBIs. The feature is done when the lifecycle, MCP, REST and development paths of a generated host call the same port, a test proves that no path bypasses scope and policy, and the attempt-runtime and workflow-engine hosts scaffold, build and pass the template tests, which is what the ADR-0028 amendment on the Factory templates needs before AgentRuntimeService and WorkflowEngineService are scaffolded. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-136, AIFACTORY-US-137, AIFACTORY-US-138. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.AI.SoftwareFactory.AgentTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution of every matrix 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-158 (converge the entry points of the agent host on one execution port) is done, then the lifecycle, MCP, REST and development paths of a generated host call the same port and a test proves that no path bypasses scope and policy, as docs/architecture/ecosystem-composition.md requires of the component.",
        "AC3: Given the work of AIFACTORY-TASK-159 (template switches for the two Agent Mesh services) is done, then the template scaffolds an attempt-runtime host and a workflow-engine host; both build and pass the template tests, which is the shape the ADR-0028 amendment on the Factory templates (D94) gives the two silo kinds of decision 4."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-158",
        "AIFACTORY-TASK-159",
        "AIFACTORY-TASK-666"
      ],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 204,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-136",
        "AIFACTORY-US-137",
        "AIFACTORY-US-138"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-096]",
      "number": 96
    },
    {
      "id": "AIFACTORY-TASK-158",
      "type": "task",
      "parent": "AIFACTORY-US-096",
      "title": "Converge the entry points of the agent host on one execution port",
      "sequence": "18.01.04.01",
      "description": "BEFORE DEVELOPMENT. Converge the entry points of the agent host on one execution port. Expected output: The generated solution of every matrix case proves the outputs of AIFACTORY-TASK-793 to AIFACTORY-TASK-800 (AC2 of AIFACTORY-US-096): the lifecycle, MCP, REST and development paths call the same port and the unit and architecture tests prove that no path bypasses scope and policy.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on every generated case | dotnet test -c Release --no-build on every generated case.",
      "acceptanceCriteria": [
        "The generated solution of every matrix case proves the outputs of AIFACTORY-TASK-793 to AIFACTORY-TASK-800 (AC2 of AIFACTORY-US-096): the lifecycle, MCP, REST and development paths call the same port and the unit and architecture tests prove that no path bypasses scope and policy."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-158]",
      "number": 158
    },
    {
      "id": "AIFACTORY-TASK-159",
      "type": "task",
      "parent": "AIFACTORY-US-096",
      "title": "Template switches for the two Agent Mesh services",
      "sequence": "18.01.04.02",
      "description": "BEFORE DEVELOPMENT. Template switches for the two Agent Mesh services. Expected output: The generated cases of the attempt-runtime and workflow-engine kinds prove the outputs of AIFACTORY-TASK-801 to AIFACTORY-TASK-804 (AC3 of AIFACTORY-US-096): both hosts scaffold, build and pass the template tests.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on the two host-kind cases | dotnet test -c Release --no-build on the two host-kind cases.",
      "acceptanceCriteria": [
        "The generated cases of the attempt-runtime and workflow-engine kinds prove the outputs of AIFACTORY-TASK-801 to AIFACTORY-TASK-804 (AC3 of AIFACTORY-US-096): both hosts scaffold, build and pass the template tests."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-159]",
      "number": 159
    },
    {
      "id": "AIFACTORY-TASK-666",
      "type": "task",
      "parent": "AIFACTORY-US-096",
      "title": "Verify agent-template-delivered by running the declared command",
      "sequence": "18.01.04.03",
      "description": "BEFORE DEVELOPMENT. Verify agent-template-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case of the matrix; they pass and prove AC1 to AC3 of AIFACTORY-US-096.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case of the matrix; they pass and prove AC1 to AC3 of AIFACTORY-US-096."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 2,
      "phase": "templates-and-libraries",
      "stackRank": 204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-666]",
      "number": 666
    },
    {
      "id": "AIFACTORY-FEAT-097",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "AI and Factory libraries: scope in contracts, Anthropic adapter, durable base",
      "sequence": "18.02",
      "description": "The Factory libraries carry tenant and project scope in their contracts, gain an Anthropic model adapter (decision D16), and expose the run, step and attempt abstractions the durable runtime persists. The libraries are verified to build and test as they are before they are extended. Component: Extensions.AI + AgentsFramework + Factory libraries (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 3 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-191",
        "AIFACTORY-US-192",
        "AIFACTORY-US-193",
        "AIFACTORY-US-194",
        "AIFACTORY-US-195",
        "AIFACTORY-US-196",
        "AIFACTORY-US-220",
        "AIFACTORY-US-197",
        "AIFACTORY-US-097",
        "AIFACTORY-US-758"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 300,
      "titlePrefix": "[AIFACTORY-FEAT-097]",
      "number": 97
    },
    {
      "id": "AIFACTORY-US-191",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "AI and Factory libraries: the libraries build and test as they are, the library types of the recorded agent base work are the single definition and the pin drift is resolved",
      "sequence": "18.02.01",
      "description": "As a platform admin, I want a recorded baseline of the AI and Factory libraries, with every shared type of the recorded agent base work settled in the library that owns it, so that every later change of the libraries starts from packages that are known to build, test and pin one set of versions. The feature extends libraries that already ship: `ConnectSoft.Extensions.AI`, `ConnectSoft.Extensions.AI.AgentsFramework`, `ConnectSoft.Extensions.AI.Factory.Abstractions`, `ConnectSoft.Extensions.AI.Factory`, `ConnectSoft.Extensions.AI.Factory.Messaging` and its MassTransit publisher package `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`, each in a repository of its own with its own solution, pins and pipeline. Before any of them is changed, a maintainer of the libraries records a baseline: every solution restores from the feed, builds in Release and passes its tests, with the package versions each one pins. Two things are settled in the same pass. First, the receiving side of the agent base, envelope and lifecycle work that the page Docs/Generic Agent Implementation Summary.md of the agent template records as applied but not compiled (decision D113). The libraries already hold these types and their tests, which the baseline proves, so the library definitions of `IFactoryAgent`, `FactoryAgentBase`, the request, result and validation contracts, `AgentEventEnvelope` and the five lifecycle events are the single definition. The maintainer compares them with the copies the page records in the template, ports into the library any unit test the page lists that the library lacks, and records per type the package that the package responsibility matrix of the Factory library pages makes its owner. The checklist of that page belongs to the template: compiling the authoring solution, generating the matrix and removing the copies from the template are tasks of the feature `component-agent-template-contract`, which depends on this one, and they are not repeated here. Second, the pin drift that model/components.yaml records for this component is resolved: the libraries pin one version of `Microsoft.Extensions.AI`, of `Microsoft.Agents.AI` and of each sibling ConnectSoft package, and a pipeline check in every repository refuses a solution whose pins differ from the recorded set. A library that does not build or test as it is blocks the PBIs that extend it, and the failure is recorded with the failing project instead of being worked around. Kind: enabling. Traces: adrs: ADR-0014, ADR-0028. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/agent-runtime/agent-runtime.md.",
      "acceptanceCriteria": [
        "AC1: Given the repositories of the AI and Factory libraries as they are, when each solution is restored from the feed, built in Release and tested, then every project builds and every test passes, and the baseline records the package versions each solution pins; a project that fails is recorded by name and blocks the PBIs that extend it (ADR-0028, model/components.yaml).",
        "AC2: Given the page Docs/Generic Agent Implementation Summary.md of the agent template and the library projects of the baseline, when the types the page records are compared with the libraries, then the library definitions of `IFactoryAgent`, `FactoryAgentBase`, the request, result and validation contracts, `AgentEventEnvelope` and the five lifecycle events are the single definition, every unit test the page lists that a library lacked (first-attempt success, retry then success, escalation after exhaustion, event order, null request, trace-origin stamping and trace-id preservation) is ported and passes in the package that owns the type, and the owning package of each type is recorded against the package responsibility matrix; compiling the template and removing its copies is left to the tasks of the feature `component-agent-template-contract` (ADR-0014 names these types as the envelopes that exist in code).",
        "AC3: Given the central package files of the six library repositories, when the pins are compared, then every library pins the same version of `Microsoft.Extensions.AI`, of `Microsoft.Agents.AI` and of each sibling ConnectSoft package, and a pipeline check in each repository fails a solution whose pins differ from the recorded set, which closes the pin drift model/components.yaml records for the component (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-160",
        "AIFACTORY-TASK-951",
        "AIFACTORY-TASK-952",
        "AIFACTORY-TASK-953"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 301,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "titlePrefix": "[AIFACTORY-US-191]",
      "number": 191
    },
    {
      "id": "AIFACTORY-TASK-160",
      "type": "task",
      "parent": "AIFACTORY-US-191",
      "title": "Build and test the Factory libraries as they are",
      "sequence": "18.02.01.01",
      "description": "BEFORE DEVELOPMENT. Build and test the Factory libraries as they are. Expected output: A recorded baseline that proves AC1 of AIFACTORY-US-191: the solutions of the six repositories `ConnectSoft.Extensions.AI`, `ConnectSoft.Extensions.AI.AgentsFramework`, `ConnectSoft.Extensions.AI.Factory.Abstractions`, `ConnectSoft.Extensions.AI.Factory`, `ConnectSoft.Extensions.AI.Factory.Messaging` and `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit` each restore from the feed, build in Release and pass their tests; the baseline is one record in the Runbook page of the Factory library that holds, per repository, the result of the two commands and the package versions the solution pins.. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A recorded baseline that proves AC1 of AIFACTORY-US-191: the solutions of the six repositories `ConnectSoft.Extensions.AI`, `ConnectSoft.Extensions.AI.AgentsFramework`, `ConnectSoft.Extensions.AI.Factory.Abstractions`, `ConnectSoft.Extensions.AI.Factory`, `ConnectSoft.Extensions.AI.Factory.Messaging` and `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit` each restore from the feed, build in Release and pass their tests; the baseline is one record in the Runbook page of the Factory library that holds, per repository, the result of the two commands and the package versions the solution pins."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-160]",
      "number": 160
    },
    {
      "id": "AIFACTORY-TASK-951",
      "type": "task",
      "parent": "AIFACTORY-US-191",
      "title": "Settle each shared type of the recorded agent base, envelope and lifecycle work in its library and port the missing unit tests",
      "sequence": "18.02.01.02",
      "description": "BEFORE DEVELOPMENT. Settle each shared type of the recorded agent base, envelope and lifecycle work in its library and port the missing unit tests. Expected output: The library definitions are the single definition: the agent contracts in the package `ConnectSoft.Extensions.AI.Factory.Abstractions`, the base and its options in `ConnectSoft.Extensions.AI.Factory`, the envelope, the lifecycle events and the mapper in `ConnectSoft.Extensions.AI.Factory.Messaging`. The task compares them with the copies the page Docs/Generic Agent Implementation Summary.md records in the agent template, ports every unit test the page lists that the library lacks (trace-origin stamping and trace-id preservation among them) into the test project of the owning repository, and records per type, in the migration guide of the Factory library pages, that the package of the responsibility matrix owns it. The check per repository: the Abstractions, the Factory and the Messaging solution each build and pass their tests with the ported tests. The compile of the template and the removal of its copies are tasks of the feature `component-agent-template-contract`.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The library definitions are the single definition: the agent contracts in the package `ConnectSoft.Extensions.AI.Factory.Abstractions`, the base and its options in `ConnectSoft.Extensions.AI.Factory`, the envelope, the lifecycle events and the mapper in `ConnectSoft.Extensions.AI.Factory.Messaging`. The task compares them with the copies the page Docs/Generic Agent Implementation Summary.md records in the agent template, ports every unit test the page lists that the library lacks (trace-origin stamping and trace-id preservation among them) into the test project of the owning repository, and records per type, in the migration guide of the Factory library pages, that the package of the responsibility matrix owns it. The check per repository: the Abstractions, the Factory and the Messaging solution each build and pass their tests with the ported tests. The compile of the template and the removal of its copies are tasks of the feature `component-agent-template-contract`."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-951]",
      "number": 951
    },
    {
      "id": "AIFACTORY-TASK-952",
      "type": "task",
      "parent": "AIFACTORY-US-191",
      "title": "One recorded set of pins across the AI and Factory libraries",
      "sequence": "18.02.01.03",
      "description": "BEFORE DEVELOPMENT. One recorded set of pins across the AI and Factory libraries. Expected output: The central package file of each of the six repositories (`ConnectSoft.Extensions.AI`, `ConnectSoft.Extensions.AI.AgentsFramework`, `ConnectSoft.Extensions.AI.Factory.Abstractions`, `ConnectSoft.Extensions.AI.Factory`, `ConnectSoft.Extensions.AI.Factory.Messaging`, `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`) pins one version of `Microsoft.Extensions.AI`, of `Microsoft.Agents.AI` and of each sibling ConnectSoft package. The recorded set is one file kept in the agents framework repository; the pipeline of each of the six repositories has a step that reads that file through a repository resource, compares it with its own central package file and fails the run on a difference. The check per repository is one green run of its pipeline with the comparison step and one failed run on a planted differing pin.. Kind: operations. Repository: ConnectSoft.Extensions.AI.AgentsFramework. Verification: azure-pipelines.yml of each of the six repositories runs the pin comparison and the run is green.",
      "acceptanceCriteria": [
        "The central package file of each of the six repositories (`ConnectSoft.Extensions.AI`, `ConnectSoft.Extensions.AI.AgentsFramework`, `ConnectSoft.Extensions.AI.Factory.Abstractions`, `ConnectSoft.Extensions.AI.Factory`, `ConnectSoft.Extensions.AI.Factory.Messaging`, `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`) pins one version of `Microsoft.Extensions.AI`, of `Microsoft.Agents.AI` and of each sibling ConnectSoft package. The recorded set is one file kept in the agents framework repository; the pipeline of each of the six repositories has a step that reads that file through a repository resource, compares it with its own central package file and fails the run on a difference. The check per repository is one green run of its pipeline with the comparison step and one failed run on a planted differing pin."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.AI.AgentsFramework"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 301,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-952]",
      "number": 952
    },
    {
      "id": "AIFACTORY-TASK-953",
      "type": "task",
      "parent": "AIFACTORY-US-191",
      "title": "Verify the baseline, the compiled agent work and the aligned pins",
      "sequence": "18.02.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the baseline, the compiled agent work and the aligned pins. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of each of the six library repositories after the pins are aligned; every run passes, the ported tests of AIFACTORY-TASK-951 run in the Abstractions, Factory and Messaging repositories, and the results per repository prove AC1 to AC3 of AIFACTORY-US-191 (ADR-0014).. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of each of the six library repositories after the pins are aligned; every run passes, the ported tests of AIFACTORY-TASK-951 run in the Abstractions, Factory and Messaging repositories, and the results per repository prove AC1 to AC3 of AIFACTORY-US-191 (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-953]",
      "number": 953
    },
    {
      "id": "AIFACTORY-US-192",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "Factory libraries: AgentTraceContext and AgentEventEnvelope carry tenant, project, run, step and attempt identity and a schema version",
      "sequence": "18.02.02",
      "description": "As a platform admin, I want the trace context and the event envelope of the Factory libraries to carry the trusted scope, the run, step and attempt identity and a schema version, so that every request and every lifecycle event of an agent is attributable to its tenant, project, run and attempt without a second plumbing pass in the hosts. ADR-0014 records that `AgentTraceContext` of `ConnectSoft.Extensions.AI.Factory.Abstractions` and `AgentEventEnvelope` of `ConnectSoft.Extensions.AI.Factory.Messaging` carry trace id, blueprint id, agent origin and workflow step and no tenant, project, run, step, attempt or schema-version field, and its decision 1 makes those fields required on every Factory integration event while the trace id stays diagnostic correlation that is never an authorization or idempotency key. Decision D113 places the change in this feature. The amendment of ADR-0014 on envelopes per event family (decision D114) settles which envelope carries what: a Factory service writes the run event envelope of the contracts package, the descriptor `run-event-envelope-v1`, for its integration events, and `AgentEventEnvelope` carries agent lifecycle events only, with the same scope fields. This PBI therefore changes the lifecycle envelope and offers it to no service as the envelope of its integration events. The run, step and attempt abstractions the feature names are delivered here as typed identifiers of the Abstractions package: a run id, a step id and an attempt id over a guid, and a tenant id and a project id over a string, the underlying types model/services/control-plane/RunControlService.yaml gives `runId`, `stepId`, `attemptId`, `tenantId` and `projectId`. The trace context gains tenant id, project id, run id, step id, attempt id and a schema version as members a caller must supply, in those types. The envelope gains the same identity together with schema version, correlation id, causation id, producer identity and event type, and keeps trace id, blueprint id and agent origin as diagnostic fields. The scope is taken from the authenticated context of the caller, never from prompt text or a caller-controlled header, as ADR-0015 decision 2 requires. Two kinds of versioning are kept apart. The serialized schema follows the additive rule of ADR-0014 decision 6: the shape the Messaging package writes today, which has no schema-version field, is schema version 1, as decision D114 settles; the new fields arrive in the next schema version; the serialized shape of version 1 is frozen as a reader contract with its own contract test and is not altered; a versioned reader accepts it for a window that is an option of the reader; an unknown version is refused with the reason recorded; and no second incompatible envelope appears under an existing version. The CLR types are not kept side by side: `AgentTraceContext` and `AgentEventEnvelope` change in place, a request without scope no longer compiles, and that source-breaking change is released as a new major version of the Abstractions and Messaging packages. The publisher `MassTransitAgentLifecyclePublisher` lives in a repository of its own and mirrors the envelope to the broker properties there. The grains that persist the same identifiers arrive with the agent runtime in a later increment, so this PBI proves the identifier types against the model and not against a grain. The agent host template consumes the types by a version pin and defines none of its own. Kind: enabling. Traces: descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024. Depends on: AIFACTORY-US-191. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/reference/event-envelope.md, docs/reference/schemas/run-event-envelope.schema.json, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the package `ConnectSoft.Extensions.AI.Factory.Abstractions`, when a caller builds an `AgentTraceContext` for a Factory request, then tenant id, project id, run id, step id where the request belongs to a workflow step, attempt id and the schema version are members the caller must supply beside the trace id, as typed identifiers of the package whose underlying types are those of model/services/control-plane/RunControlService.yaml, and a request contract built without the scope does not compile; the trace id stays diagnostic and is never used as an authorization or idempotency key (ADR-0014 decision 1, ADR-0015 decision 2).",
        "AC2: Given the package `ConnectSoft.Extensions.AI.Factory.Messaging`, when the lifecycle mapper builds an event from a stage and a request, then the `AgentEventEnvelope` of every lifecycle event carries event id, schema version, occurred-at, tenant id, project id, run id, step id and attempt id where applicable, correlation id, causation id, producer identity and event type, with trace id, blueprint id and agent origin kept as diagnostic fields; the envelope carries agent lifecycle events only, and the serialized names of its scope fields equal those of the run event envelope `run-event-envelope-v1` that a Factory service writes for its integration events; a contract test asserts the required fields on every event type and the scope field names against that schema, and docs/reference/event-envelope.md lists the same fields and states which envelope carries which event family (ADR-0014 decision 1 and its amendment on envelopes per event family).",
        "AC3: Given a serialized envelope of schema version 1, the shape the Messaging package wrote before this change, when the versioned reader reads it inside the compatibility window its option sets, then it is accepted and mapped to the current version with the missing identity marked absent, and an envelope of an unknown schema version is refused with the reason recorded; the serialized shape of schema version 1 is kept as a frozen reader contract with its own contract test and is not altered, while the CLR types change in a new major version of the Abstractions and Messaging packages (ADR-0014 decision 6; docs/reference/event-envelope.md records the default of the window).",
        "AC4: Given the MassTransit publisher package of the Factory libraries, when a lifecycle event is published, then the event type, the tenant id, the trace id, the correlation id and the schema version of the envelope are mirrored to the five broker properties `cs-event-type`, `cs-tenant-id`, `cs-trace-id`, `cs-correlation-id` and `cs-schema-version` that ADR-0012 decision 5 keeps as the mapping of the MassTransit profile; and a contract test of the Abstractions package asserts the underlying types of the run, step and attempt identifiers against the payload of `AttemptOutcomeRecorded` in model/services/control-plane/RunControlService.yaml, the record of the durable substrate that ADR-0024 decision 1 keeps on grains."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-161",
        "AIFACTORY-TASK-954",
        "AIFACTORY-TASK-955",
        "AIFACTORY-TASK-1052",
        "AIFACTORY-TASK-956",
        "AIFACTORY-TASK-957"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 302,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-191"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-192]",
      "number": 192
    },
    {
      "id": "AIFACTORY-TASK-161",
      "type": "task",
      "parent": "AIFACTORY-US-192",
      "title": "Tenant and project scope in the Factory contracts",
      "sequence": "18.02.02.01",
      "description": "BEFORE DEVELOPMENT. Tenant and project scope in the Factory contracts. Expected output: `AgentTraceContext` of the package `ConnectSoft.Extensions.AI.Factory.Abstractions` carries tenant id, project id, run id, step id, attempt id and a schema version as members the caller must supply, beside the trace id, blueprint id, agent origin and workflow step; the package defines the typed identifiers they use, a run id, a step id and an attempt id over a guid and a tenant id and a project id over a string, matching `runId`, `stepId`, `attemptId`, `tenantId` and `projectId` of model/services/control-plane/RunControlService.yaml; `AgentRequest` and `AgentResult` expose them; a request contract built without the scope does not compile, and the change is released as a new major version of the package.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory.Abstractions. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`AgentTraceContext` of the package `ConnectSoft.Extensions.AI.Factory.Abstractions` carries tenant id, project id, run id, step id, attempt id and a schema version as members the caller must supply, beside the trace id, blueprint id, agent origin and workflow step; the package defines the typed identifiers they use, a run id, a step id and an attempt id over a guid and a tenant id and a project id over a string, matching `runId`, `stepId`, `attemptId`, `tenantId` and `projectId` of model/services/control-plane/RunControlService.yaml; `AgentRequest` and `AgentResult` expose them; a request contract built without the scope does not compile, and the change is released as a new major version of the package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory.Abstractions"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-161]",
      "number": 161
    },
    {
      "id": "AIFACTORY-TASK-954",
      "type": "task",
      "parent": "AIFACTORY-US-192",
      "title": "Schema version and run identity on the envelope, the lifecycle events and the mapper",
      "sequence": "18.02.02.02",
      "description": "BEFORE DEVELOPMENT. Schema version and run identity on the envelope, the lifecycle events and the mapper. Expected output: `AgentEventEnvelope`, the lifecycle event types and `AgentLifecycleEventMapper` of the package `ConnectSoft.Extensions.AI.Factory.Messaging` carry event id, schema version, occurred-at, tenant id, project id, run id, step id, attempt id, correlation id, causation id, producer identity and event type, in the typed identifiers of AIFACTORY-TASK-161; trace id, blueprint id and agent origin stay as diagnostic fields; the envelope stays the envelope of agent lifecycle events, the serialized names of its scope fields equal those of the run event envelope of the contracts package (`run-event-envelope-v1`), and the pages of the package state that a Factory service writes that run event envelope for its integration events; the change is released as a new major version of the package.. Kind: contract. Repository: ConnectSoft.Extensions.AI.Factory.Messaging. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`AgentEventEnvelope`, the lifecycle event types and `AgentLifecycleEventMapper` of the package `ConnectSoft.Extensions.AI.Factory.Messaging` carry event id, schema version, occurred-at, tenant id, project id, run id, step id, attempt id, correlation id, causation id, producer identity and event type, in the typed identifiers of AIFACTORY-TASK-161; trace id, blueprint id and agent origin stay as diagnostic fields; the envelope stays the envelope of agent lifecycle events, the serialized names of its scope fields equal those of the run event envelope of the contracts package (`run-event-envelope-v1`), and the pages of the package state that a Factory service writes that run event envelope for its integration events; the change is released as a new major version of the package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.AI.Factory.Messaging"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 302,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-954]",
      "number": 954
    },
    {
      "id": "AIFACTORY-TASK-955",
      "type": "task",
      "parent": "AIFACTORY-US-192",
      "title": "Versioned reader for the envelope of schema version 1",
      "sequence": "18.02.02.03",
      "description": "BEFORE DEVELOPMENT. Versioned reader for the envelope of schema version 1. Expected output: A versioned reader in the package `ConnectSoft.Extensions.AI.Factory.Messaging` accepts a serialized envelope of schema version 1 inside the compatibility window and refuses an unknown version with a reason; the window in which version 1 is read is an option of the reader with its default recorded in docs/reference/event-envelope.md; the serialized shape of version 1 is frozen by a contract test over stored samples and is not altered.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory.Messaging. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A versioned reader in the package `ConnectSoft.Extensions.AI.Factory.Messaging` accepts a serialized envelope of schema version 1 inside the compatibility window and refuses an unknown version with a reason; the window in which version 1 is read is an option of the reader with its default recorded in docs/reference/event-envelope.md; the serialized shape of version 1 is frozen by a contract test over stored samples and is not altered."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory.Messaging"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-955]",
      "number": 955
    },
    {
      "id": "AIFACTORY-TASK-1052",
      "type": "task",
      "parent": "AIFACTORY-US-192",
      "title": "Broker property mapping of the MassTransit lifecycle publisher",
      "sequence": "18.02.02.04",
      "description": "BEFORE DEVELOPMENT. Broker property mapping of the MassTransit lifecycle publisher. Expected output: `MassTransitAgentLifecyclePublisher` of the package `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`, in the repository of that name with its own solution, pins and pipeline, mirrors the envelope to the five broker properties of ADR-0012 decision 5: `cs-event-type`, `cs-tenant-id`, `cs-trace-id`, `cs-correlation-id` and `cs-schema-version`; a unit test of that repository asserts the five properties on a published lifecycle event, and the repository pins the new major version of the Messaging package.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`MassTransitAgentLifecyclePublisher` of the package `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`, in the repository of that name with its own solution, pins and pipeline, mirrors the envelope to the five broker properties of ADR-0012 decision 5: `cs-event-type`, `cs-tenant-id`, `cs-trace-id`, `cs-correlation-id` and `cs-schema-version`; a unit test of that repository asserts the five properties on a published lifecycle event, and the repository pins the new major version of the Messaging package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1052]",
      "number": 1052
    },
    {
      "id": "AIFACTORY-TASK-956",
      "type": "task",
      "parent": "AIFACTORY-US-192",
      "title": "Envelope reference page revised to the fields of the library envelope",
      "sequence": "18.02.02.05",
      "description": "BEFORE DEVELOPMENT. Envelope reference page revised to the fields of the library envelope. Expected output: docs/reference/event-envelope.md lists the required fields of ADR-0014 decision 1 as the library envelope carries them, states that `AgentEventEnvelope` carries agent lifecycle events and that a Factory service writes the run event envelope of the contracts package for its integration events, with the same scope fields, names the schema version, the frozen shape of schema version 1 and the default of the compatibility window of the versioned reader, and no longer describes a field the library does not have.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "docs/reference/event-envelope.md lists the required fields of ADR-0014 decision 1 as the library envelope carries them, states that `AgentEventEnvelope` carries agent lifecycle events and that a Factory service writes the run event envelope of the contracts package for its integration events, with the same scope fields, names the schema version, the frozen shape of schema version 1 and the default of the compatibility window of the versioned reader, and no longer describes a field the library does not have."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 302,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-956]",
      "number": 956
    },
    {
      "id": "AIFACTORY-TASK-957",
      "type": "task",
      "parent": "AIFACTORY-US-192",
      "title": "Verify the required fields and the earlier version by contract tests",
      "sequence": "18.02.02.06",
      "description": "BEFORE DEVELOPMENT. Verify the required fields and the earlier version by contract tests. Expected output: Run `dotnet test -c Release --no-build` on the solutions of the Abstractions, the Messaging and the MassTransit publisher repositories; the contract tests assert the required fields on every event type, the read of a stored envelope of schema version 1, the scope field names against docs/reference/schemas/run-event-envelope.schema.json, the five broker properties and the underlying types of the run, step and attempt identifiers against the payload of `AttemptOutcomeRecorded` as model/services/control-plane/RunControlService.yaml states it, which proves AC1 to AC4 of AIFACTORY-US-192 (ADR-0014).. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory.Messaging.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the solutions of the Abstractions, the Messaging and the MassTransit publisher repositories; the contract tests assert the required fields on every event type, the read of a stored envelope of schema version 1, the scope field names against docs/reference/schemas/run-event-envelope.schema.json, the five broker properties and the underlying types of the run, step and attempt identifiers against the payload of `AttemptOutcomeRecorded` as model/services/control-plane/RunControlService.yaml states it, which proves AC1 to AC4 of AIFACTORY-US-192 (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory.Messaging"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-957]",
      "number": 957
    },
    {
      "id": "AIFACTORY-US-193",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "Factory libraries: FactoryAgentBase refuses a request without trace metadata before any model call and retries in attempts with a backoff",
      "sequence": "18.02.03",
      "description": "As a platform admin, I want the Factory agent base to refuse a request that carries no trace id or no Factory scope instead of stamping one, so that no agent executes a model call that cannot be attributed to a tenant, a project, a run and an attempt. The base of the package `ConnectSoft.Extensions.AI.Factory` runs the pipeline docs/planes/agent-runtime/agent-runtime.md describes: accept, prompt, run, validate, retry, complete or escalate. Today it refuses nothing except a null request: `AgentTraceContext` generates a trace id when none is supplied and the base stamps its own agent id as the origin, so a request without identity executes and its events cannot be attributed. Decision D113 makes the refusal work of this feature. Before the Accepted stage is published and before any model call, the base validates the trace metadata of the request: the trace id and the Factory scope of the earlier PBI (tenant, project, run and attempt identity, and the step identity where the request belongs to a workflow step). A request that lacks any of them is refused with a typed refusal that names the missing fields; no Accepted event is published, no model is invoked, the refusal is counted on the meter of the library and logged with the agent id. The base no longer generates a trace id for a caller; it still stamps its own agent id as the origin of the outgoing context. The set of required fields is an option of the library with the trace id and the scope as its default. A host can add the blueprint id to the set, and a request without it is then refused in the same way. The agent origin is never a required field a caller supplies, because the base stamps it, so a missing origin cannot be refused. The default set is settled by decision D114: the trace id and the scope are required, the blueprint id only when a host adds it through the option, and the option test covers that case. In the same change the retry vocabulary follows ADR-0026 decision 6: the options say attempts, the total number of tries, with a backoff between them, and the wait honours cancellation. Kind: enabling. Traces: adrs: ADR-0014, ADR-0026. Depends on: AIFACTORY-US-192. Sources: model/components.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0026-requirements-to-ux-handoff.md, docs/planes/agent-runtime/agent-runtime.md.",
      "acceptanceCriteria": [
        "AC1: Given a request whose trace context lacks the trace id or any of tenant id, project id, run id and attempt id, when `ExecuteAsync` of `FactoryAgentBase` is called, then the request is refused before the Accepted stage is published and before any model call, the refusal names the missing fields, it is counted and logged, and a unit test with a scripted agent proves that the model is never invoked; when the required set of the options includes the blueprint id, a request without it is refused in the same way, proven by a unit test, and the agent origin is never a required field of the caller because the base stamps it (ADR-0014 decision 1 makes the scope required and keeps the trace id diagnostic).",
        "AC2: Given a request with complete trace metadata, when the base accepts it, then the outgoing trace context keeps the supplied trace id and scope unchanged and carries the agent id of the base as its origin; the base generates no trace id on behalf of a caller, and the pipeline runs in the order docs/planes/agent-runtime/agent-runtime.md describes (ADR-0014).",
        "AC3: Given the options of the library, when validation fails on an attempt, then the base waits the configured backoff and tries again until the configured number of attempts is used, a cancellation during the wait ends the wait at once, and after the last attempt the escalation sink receives the issues of that attempt; the options say attempts and backoff as ADR-0026 decision 6 requires and the unit tests cover first-attempt success, retry then success and escalation."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-958",
        "AIFACTORY-TASK-959",
        "AIFACTORY-TASK-960",
        "AIFACTORY-TASK-961"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 303,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-192"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "titlePrefix": "[AIFACTORY-US-193]",
      "number": 193
    },
    {
      "id": "AIFACTORY-TASK-958",
      "type": "task",
      "parent": "AIFACTORY-US-193",
      "title": "Trace metadata validation in FactoryAgentBase before the Accepted stage",
      "sequence": "18.02.03.01",
      "description": "BEFORE DEVELOPMENT. Trace metadata validation in FactoryAgentBase before the Accepted stage. Expected output: `FactoryAgentBase` validates the trace id and the Factory scope of a request before it publishes Accepted; a request that lacks a required field is refused with a typed refusal naming the fields, no model is invoked, the refusal is counted on the meter `connectsoft.ai.factory.agent` and logged; `AgentTraceContext` no longer generates a trace id for a caller.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`FactoryAgentBase` validates the trace id and the Factory scope of a request before it publishes Accepted; a request that lacks a required field is refused with a typed refusal naming the fields, no model is invoked, the refusal is counted on the meter `connectsoft.ai.factory.agent` and logged; `AgentTraceContext` no longer generates a trace id for a caller."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-958]",
      "number": 958
    },
    {
      "id": "AIFACTORY-TASK-959",
      "type": "task",
      "parent": "AIFACTORY-US-193",
      "title": "Attempts and backoff in the options and the retry loop of the base",
      "sequence": "18.02.03.02",
      "description": "BEFORE DEVELOPMENT. Attempts and backoff in the options and the retry loop of the base. Expected output: `AgentFactoryOptions` and its validator expose the number of attempts, the backoff and the list of required trace fields; the retry loop of `FactoryAgentBase` waits the backoff between attempts and ends the wait on cancellation; the earlier maximum setting is read for the compatibility window and mapped to attempts.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`AgentFactoryOptions` and its validator expose the number of attempts, the backoff and the list of required trace fields; the retry loop of `FactoryAgentBase` waits the backoff between attempts and ends the wait on cancellation; the earlier maximum setting is read for the compatibility window and mapped to attempts."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-959]",
      "number": 959
    },
    {
      "id": "AIFACTORY-TASK-960",
      "type": "task",
      "parent": "AIFACTORY-US-193",
      "title": "Scripted agent and recording doubles for the refusal and backoff tests",
      "sequence": "18.02.03.03",
      "description": "BEFORE DEVELOPMENT. Scripted agent and recording doubles for the refusal and backoff tests. Expected output: A scripted agent, a recording lifecycle publisher, a recording escalation sink and a controllable time provider in the unit test project of the library drive the refusal, the retry with backoff and the escalation without a live model.. Kind: fixture. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A scripted agent, a recording lifecycle publisher, a recording escalation sink and a controllable time provider in the unit test project of the library drive the refusal, the retry with backoff and the escalation without a live model."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 303,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-960]",
      "number": 960
    },
    {
      "id": "AIFACTORY-TASK-961",
      "type": "task",
      "parent": "AIFACTORY-US-193",
      "title": "Verify the refusal of a request without trace metadata and the retry with backoff",
      "sequence": "18.02.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the refusal of a request without trace metadata and the retry with backoff. Expected output: Run `dotnet test -c Release --no-build` on the Factory library solution; the refusal, origin and backoff tests pass, together with the option test in which the required set includes the blueprint id and a request without it is refused before any model call, and prove AC1 to AC3 of AIFACTORY-US-193 (ADR-0014, ADR-0026).. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the Factory library solution; the refusal, origin and backoff tests pass, together with the option test in which the required set includes the blueprint id and a request without it is refused before any model call, and prove AC1 to AC3 of AIFACTORY-US-193 (ADR-0014, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-961]",
      "number": 961
    },
    {
      "id": "AIFACTORY-US-194",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "Factory libraries: AgentLifecycleStage gains Cancelled and the base reports a terminal Failed with a failure class before it rethrows",
      "sequence": "18.02.04",
      "description": "As a platform admin, I want every run of a Factory agent to end with exactly one terminal lifecycle stage, Cancelled included, so that a cancellation or an unexpected exception is observable on the envelope instead of ending the attempt without a trace. `AgentLifecycleStage` of the package `ConnectSoft.Extensions.AI.Factory.Abstractions` has Accepted, OutputValidated, Completed, Failed and Escalated. The base catches a cancellation and rethrows it, and catches any other exception, logs it, counts it and rethrows it; in both cases no terminal event is published, which the context of ADR-0014 records. Decision 2 of that ADR adds Cancelled as a terminal state distinct from Failed and requires that an exception path emits a terminal Failed event with a failure class before it rethrows; decision D113 places the work here. The enumeration gains Cancelled as an appended member, so that the stored values of the existing members do not change. When the pipeline observes a cancellation the base publishes the Cancelled stage and then rethrows; when it observes any other exception it publishes Failed with a failure class and then rethrows. The terminal publication does not use the cancelled token of the request, is bounded by a publication timeout, and a failure of the publisher is logged and never replaces the original exception. The messaging package gains the event of the Cancelled stage and the mapper maps it, and the MassTransit publisher, which lives in a repository of its own, publishes it; the failed event carries the failure class in the vocabulary model/services/control-plane/RunControlService.yaml names (transient, permanent, policy-denied, validation, cancellation, uncertain). The library reports an observed termination; the request to cancel and the authoritative outcome stay with Run Control, as ADR-0024 decision 5 keeps them. Kind: enabling. Traces: adrs: ADR-0014, ADR-0024. Depends on: AIFACTORY-US-192, AIFACTORY-US-193. Sources: model/components.yaml, model/services/control-plane/RunControlService.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given an attempt in progress, when its cancellation token is cancelled, then `FactoryAgentBase` publishes the Cancelled stage of `AgentLifecycleStage` as a terminal stage distinct from Failed and then rethrows the cancellation; no Completed or Failed stage follows, and a unit test proves the order (ADR-0014 decision 2).",
        "AC2: Given an unexpected exception in the prompt, the model call or the validation, when the pipeline unwinds, then the base publishes Failed with a failure class before the exception is rethrown, the publication does not use the cancelled token of the request and is bounded by a timeout, and a failure of the publisher is logged without replacing the original exception (ADR-0014 decision 2).",
        "AC3: Given the packages `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory.Messaging`, when the Cancelled stage is mapped, then an event of the cancelled run exists beside the five existing lifecycle events, the failed event carries the failure class in the vocabulary of model/services/control-plane/RunControlService.yaml, exactly one of Completed, Failed and Cancelled ends a run, and a contract test proves that the stored values of the earlier enumeration members are unchanged (ADR-0014 decision 6, ADR-0024 decision 5 keeps the authoritative outcome with Run Control)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-962",
        "AIFACTORY-TASK-963",
        "AIFACTORY-TASK-964",
        "AIFACTORY-TASK-1053",
        "AIFACTORY-TASK-965"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 304,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-192",
        "AIFACTORY-US-193"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-194]",
      "number": 194
    },
    {
      "id": "AIFACTORY-TASK-962",
      "type": "task",
      "parent": "AIFACTORY-US-194",
      "title": "Cancelled stage in AgentLifecycleStage and the failure class on the agent result",
      "sequence": "18.02.04.01",
      "description": "BEFORE DEVELOPMENT. Cancelled stage in AgentLifecycleStage and the failure class on the agent result. Expected output: `AgentLifecycleStage` of the package `ConnectSoft.Extensions.AI.Factory.Abstractions` has Cancelled as an appended member and `AgentResult` exposes a failure class with the values transient, permanent, policy-denied, validation, cancellation and uncertain; the stored values of the earlier members are unchanged.. Kind: contract. Repository: ConnectSoft.Extensions.AI.Factory.Abstractions. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`AgentLifecycleStage` of the package `ConnectSoft.Extensions.AI.Factory.Abstractions` has Cancelled as an appended member and `AgentResult` exposes a failure class with the values transient, permanent, policy-denied, validation, cancellation and uncertain; the stored values of the earlier members are unchanged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.AI.Factory.Abstractions"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 304,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-962]",
      "number": 962
    },
    {
      "id": "AIFACTORY-TASK-963",
      "type": "task",
      "parent": "AIFACTORY-US-194",
      "title": "Terminal Cancelled and Failed publication in FactoryAgentBase before the rethrow",
      "sequence": "18.02.04.02",
      "description": "BEFORE DEVELOPMENT. Terminal Cancelled and Failed publication in FactoryAgentBase before the rethrow. Expected output: `FactoryAgentBase` publishes Cancelled on an observed cancellation and Failed with a failure class on any other exception before it rethrows; the terminal publication runs on a token that is not the cancelled one, within a publication timeout, and a publisher failure is logged and does not mask the original exception.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`FactoryAgentBase` publishes Cancelled on an observed cancellation and Failed with a failure class on any other exception before it rethrows; the terminal publication runs on a token that is not the cancelled one, within a publication timeout, and a publisher failure is logged and does not mask the original exception."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-963]",
      "number": 963
    },
    {
      "id": "AIFACTORY-TASK-964",
      "type": "task",
      "parent": "AIFACTORY-US-194",
      "title": "Cancelled run event, failure class on the failed event and the mapper",
      "sequence": "18.02.04.03",
      "description": "BEFORE DEVELOPMENT. Cancelled run event, failure class on the failed event and the mapper. Expected output: The package `ConnectSoft.Extensions.AI.Factory.Messaging` holds the event of a cancelled run on `AgentEventEnvelope`, the failed event carries the failure class, and `AgentLifecycleEventMapper` maps the Cancelled stage; a unit test of the Messaging repository asserts the mapping of every stage.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory.Messaging. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.AI.Factory.Messaging` holds the event of a cancelled run on `AgentEventEnvelope`, the failed event carries the failure class, and `AgentLifecycleEventMapper` maps the Cancelled stage; a unit test of the Messaging repository asserts the mapping of every stage."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory.Messaging"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-964]",
      "number": 964
    },
    {
      "id": "AIFACTORY-TASK-1053",
      "type": "task",
      "parent": "AIFACTORY-US-194",
      "title": "Cancelled run event and failure class published by the MassTransit lifecycle publisher",
      "sequence": "18.02.04.04",
      "description": "BEFORE DEVELOPMENT. Cancelled run event and failure class published by the MassTransit lifecycle publisher. Expected output: `MassTransitAgentLifecyclePublisher` of the package `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`, in the repository of that name, publishes the event of a cancelled run and the failed event with its failure class under the same broker properties as the other lifecycle events; a unit test of that repository asserts both.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`MassTransitAgentLifecyclePublisher` of the package `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`, in the repository of that name, publishes the event of a cancelled run and the failed event with its failure class under the same broker properties as the other lifecycle events; a unit test of that repository asserts both."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1053]",
      "number": 1053
    },
    {
      "id": "AIFACTORY-TASK-965",
      "type": "task",
      "parent": "AIFACTORY-US-194",
      "title": "Verify one terminal stage per run on cancellation and on an exception",
      "sequence": "18.02.04.05",
      "description": "BEFORE DEVELOPMENT. Verify one terminal stage per run on cancellation and on an exception. Expected output: Run `dotnet test -c Release --no-build` on the solutions of the Abstractions, the Factory, the Messaging and the MassTransit publisher repositories; the tests of the cancelled run, the failed run, the published cancelled event and the enumeration values pass and prove AC1 to AC3 of AIFACTORY-US-194 (ADR-0014).. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the solutions of the Abstractions, the Factory, the Messaging and the MassTransit publisher repositories; the tests of the cancelled run, the failed run, the published cancelled event and the enumeration values pass and prove AC1 to AC3 of AIFACTORY-US-194 (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-965]",
      "number": 965
    },
    {
      "id": "AIFACTORY-US-195",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "Extensions.AI: an Anthropic chat client is registered under the keyed provider pattern with streaming, tool calling and usage",
      "sequence": "18.02.05",
      "description": "As a platform admin, I want an Anthropic adapter behind the chat client abstraction of the AI library, so that the model profiles of the first solution pack that name an Anthropic deployment can be served through the same keyed registration as the other providers. The Features page of `ConnectSoft.Extensions.AI` lists OpenAI, Azure OpenAI, Ollama and Azure AI Inference as chat completion providers, each with its own extension class, its options and a keyed `IChatClient`; docs/planes/model-compute/providers-and-profiles.md records that no Anthropic adapter exists anywhere in the estate and that one is required for the first solution pack (decision D16), registered under the same keyed pattern with tool calling and structured output declared in its capability evidence. This PBI adds the provider: a new value of the provider choice, an extension class, options for the endpoint, the model identifier and the reference to the key, options validation at startup, a keyed chat client and a health check like the other providers have. The adapter supports streaming with cancellation, tool calling and structured output, and reports input and output token usage on the response, which the invocation receipt of the model gateway needs. Its contract tests run against recorded responses, so that the pipeline of the library calls no live provider. A missing key reference or model identifier fails options validation at startup, and the key never appears in a log entry or in telemetry. The adapter is library code for the model router, which ADR-0028 decision 3 makes the only service that calls model providers; an agent host reaches a model through the model gateway and never registers this adapter directly. The provider table of docs/planes/model-compute/providers-and-profiles.md is revised to list the adapter with its keyed name and its capability evidence. Kind: enabling. Traces: adrs: ADR-0021, ADR-0028. Depends on: AIFACTORY-US-191. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/planes/model-compute/providers-and-profiles.md, docs/planes/model-compute/model-gateway.md.",
      "acceptanceCriteria": [
        "AC1: Given a host configured with the Anthropic provider, when the AI library registers its services, then a keyed `IChatClient` for Anthropic is resolved in the same way as the clients of the existing providers, with its options bound and validated and its health check registered, and docs/planes/model-compute/providers-and-profiles.md lists the adapter in its provider table with its keyed name and its capability evidence (ADR-0028 decision 3 keeps the model router the only caller of a provider).",
        "AC2: Given recorded provider responses, when the contract tests of the adapter run, then a streamed completion with cancellation, a completion with a tool call, a completion with structured output and the input and output token usage of each are asserted without a live provider call, and the results are kept as the capability evidence a model profile needs under ADR-0021 decision 1.",
        "AC3: Given a configuration without the key reference or without the model identifier, when the host starts, then options validation fails with the missing setting named, and a test proves that the key appears in no log entry and in no telemetry attribute of a completion (docs/planes/model-compute/model-gateway.md, ADR-0021)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/model-compute/providers-and-profiles.md",
        "docs/planes/model-compute/model-gateway.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-162",
        "AIFACTORY-TASK-966",
        "AIFACTORY-TASK-967",
        "AIFACTORY-TASK-1054",
        "AIFACTORY-TASK-968"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 305,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0021",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-191"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/model-compute/providers-and-profiles.md",
        "docs/planes/model-compute/model-gateway.md"
      ],
      "titlePrefix": "[AIFACTORY-US-195]",
      "number": 195
    },
    {
      "id": "AIFACTORY-TASK-162",
      "type": "task",
      "parent": "AIFACTORY-US-195",
      "title": "Anthropic model adapter",
      "sequence": "18.02.05.01",
      "description": "BEFORE DEVELOPMENT. Anthropic model adapter. Expected output: An adapter behind the model client abstraction of `ConnectSoft.Extensions.AI` with streaming, tool use, structured output and usage reporting, registered as a keyed chat client through its own extension class; contract tests run against recorded responses.. Kind: implementation. Repository: ConnectSoft.Extensions.AI. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An adapter behind the model client abstraction of `ConnectSoft.Extensions.AI` with streaming, tool use, structured output and usage reporting, registered as a keyed chat client through its own extension class; contract tests run against recorded responses."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 305,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-162]",
      "number": 162
    },
    {
      "id": "AIFACTORY-TASK-966",
      "type": "task",
      "parent": "AIFACTORY-US-195",
      "title": "Anthropic options, startup validation and health check",
      "sequence": "18.02.05.02",
      "description": "BEFORE DEVELOPMENT. Anthropic options, startup validation and health check. Expected output: The provider choice of the AI library has the Anthropic value; its options carry the endpoint, the model identifier and the key reference, are validated at startup with the missing setting named, and a health check of the provider is registered like those of the other providers.. Kind: implementation. Repository: ConnectSoft.Extensions.AI. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The provider choice of the AI library has the Anthropic value; its options carry the endpoint, the model identifier and the key reference, are validated at startup with the missing setting named, and a health check of the provider is registered like those of the other providers."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 305,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-966]",
      "number": 966
    },
    {
      "id": "AIFACTORY-TASK-967",
      "type": "task",
      "parent": "AIFACTORY-US-195",
      "title": "Recorded response fixtures for the Anthropic contract tests",
      "sequence": "18.02.05.03",
      "description": "BEFORE DEVELOPMENT. Recorded response fixtures for the Anthropic contract tests. Expected output: Recorded responses for a streamed completion, a tool call, a structured output and a provider error are stored in the test project with every secret removed, and a replay handler serves them to the adapter so that no test calls a live provider.. Kind: fixture. Repository: ConnectSoft.Extensions.AI. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Recorded responses for a streamed completion, a tool call, a structured output and a provider error are stored in the test project with every secret removed, and a replay handler serves them to the adapter so that no test calls a live provider."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 305,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-967]",
      "number": 967
    },
    {
      "id": "AIFACTORY-TASK-1054",
      "type": "task",
      "parent": "AIFACTORY-US-195",
      "title": "Provider table of the documentation site lists the Anthropic adapter",
      "sequence": "18.02.05.04",
      "description": "BEFORE DEVELOPMENT. Provider table of the documentation site lists the Anthropic adapter. Expected output: The provider table of docs/planes/model-compute/providers-and-profiles.md lists the Anthropic adapter of `ConnectSoft.Extensions.AI` with its keyed name and its capability evidence (streaming, tool calling, structured output and usage), and the page no longer states that no Anthropic adapter exists in the estate.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "The provider table of docs/planes/model-compute/providers-and-profiles.md lists the Anthropic adapter of `ConnectSoft.Extensions.AI` with its keyed name and its capability evidence (streaming, tool calling, structured output and usage), and the page no longer states that no Anthropic adapter exists in the estate."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 305,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1054]",
      "number": 1054
    },
    {
      "id": "AIFACTORY-TASK-968",
      "type": "task",
      "parent": "AIFACTORY-US-195",
      "title": "Verify the Anthropic adapter against the recorded responses",
      "sequence": "18.02.05.05",
      "description": "BEFORE DEVELOPMENT. Verify the Anthropic adapter against the recorded responses. Expected output: Run `dotnet test -c Release --no-build` on the AI library solution; the contract tests of streaming, tool calling, structured output, usage and startup validation pass, and the provider table revised by AIFACTORY-TASK-1054 lists the adapter, which proves AC1 to AC3 of AIFACTORY-US-195 (ADR-0021).. Kind: verification. Repository: ConnectSoft.Extensions.AI.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the AI library solution; the contract tests of streaming, tool calling, structured output, usage and startup validation pass, and the provider table revised by AIFACTORY-TASK-1054 lists the adapter, which proves AC1 to AC3 of AIFACTORY-US-195 (ADR-0021)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-968]",
      "number": 968
    },
    {
      "id": "AIFACTORY-US-196",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "Factory libraries: a Factory model client sends scope, profile and correlation to the model gateway and returns the invocation receipt",
      "sequence": "18.02.06",
      "description": "As a platform admin, I want a chat client of the Factory libraries that reaches models only through the model gateway, under the scope of the attempt, and keeps the receipt, so that a generated agent host needs no provider registration and every completion is attributable and accounted. docs/architecture/ecosystem-composition.md names model profile and receipt contracts as part of the extension of this component, and docs/planes/model-compute/model-gateway.md records that the AI library has no profile, policy, reservation or receipt contract today. The agent host template registers the Factory model client of the AI libraries as the chat client of a generated host when its Factory model switch is on, so the client is a deliverable of this feature. This PBI adds the contracts and the client to the Factory packages, where the scoped trace context already lives. The contracts are a reference to a logical model profile, which names a profile such as code agent and never a vendor model, and an invocation receipt with the invocation id, the actual route, the policy receipt, the usage status, the validation status and the references to redacted diagnostics, as the gateway page lists them for the response. The client implements the chat client abstraction over a gateway transport port: it sends the tenant, project, run, step and attempt identity of the trace context, the profile reference and the correlation id with every completion and returns the output together with the receipt. A completion without scope is refused before any network call. A gateway that is unreachable ends the completion with a failure class and never falls back to a direct provider, because ADR-0028 decision 3 keeps the gateway the only route to the model router. The transport port keeps the library free of a dependency on a gateway client package of a later increment. Kind: enabling. Traces: adrs: ADR-0014, ADR-0021, ADR-0028. Depends on: AIFACTORY-US-192, AIFACTORY-US-194. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/planes/model-compute/model-gateway.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the package `ConnectSoft.Extensions.AI.Factory.Abstractions`, when a host references it, then a model profile reference that names a logical profile and an invocation receipt with invocation id, actual route, policy receipt, usage status, validation status and the references to redacted diagnostics are available as contracts, which are the fields docs/planes/model-compute/model-gateway.md lists for the response of the gateway (ADR-0021 decision 1 makes profiles the assets a client references).",
        "AC2: Given a scoped trace context and a profile reference, when the Factory model client runs a completion, streamed or not, then the transport port receives the tenant, project, run, step and attempt identity, the profile reference and the correlation id, and the caller receives the output together with the receipt; a test with a fake transport proves the values (ADR-0028 decision 3, ADR-0014 decision 1).",
        "AC3: Given a completion without scope or a transport that reports the gateway unreachable, when the client is called, then the first is refused before any network call and the second ends with a failure class and no direct provider call; the package references no provider adapter, which an architecture test asserts (ADR-0028 decision 3)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/model-compute/model-gateway.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-969",
        "AIFACTORY-TASK-970",
        "AIFACTORY-TASK-971",
        "AIFACTORY-TASK-972"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 306,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0021",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-192",
        "AIFACTORY-US-194"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/model-compute/model-gateway.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-196]",
      "number": 196
    },
    {
      "id": "AIFACTORY-TASK-969",
      "type": "task",
      "parent": "AIFACTORY-US-196",
      "title": "Model profile reference and invocation receipt contracts",
      "sequence": "18.02.06.01",
      "description": "BEFORE DEVELOPMENT. Model profile reference and invocation receipt contracts. Expected output: The package `ConnectSoft.Extensions.AI.Factory.Abstractions` holds a model profile reference, an invocation receipt (invocation id, actual route, policy receipt, usage status, validation status and the references to redacted diagnostics) and the gateway transport port the client calls; none of them names a vendor model or a provider type.. Kind: contract. Repository: ConnectSoft.Extensions.AI.Factory.Abstractions. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.AI.Factory.Abstractions` holds a model profile reference, an invocation receipt (invocation id, actual route, policy receipt, usage status, validation status and the references to redacted diagnostics) and the gateway transport port the client calls; none of them names a vendor model or a provider type."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.AI.Factory.Abstractions"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 306,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-969]",
      "number": 969
    },
    {
      "id": "AIFACTORY-TASK-970",
      "type": "task",
      "parent": "AIFACTORY-US-196",
      "title": "Factory model client as a chat client over the gateway transport port",
      "sequence": "18.02.06.02",
      "description": "BEFORE DEVELOPMENT. Factory model client as a chat client over the gateway transport port. Expected output: The package `ConnectSoft.Extensions.AI.Factory` holds a chat client that sends scope, profile reference and correlation id through the transport port for plain and streamed completions, returns the receipt with the output, refuses a completion without scope and maps an unreachable gateway to a failure class; a registration extension makes it the chat client of a host.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.AI.Factory` holds a chat client that sends scope, profile reference and correlation id through the transport port for plain and streamed completions, returns the receipt with the output, refuses a completion without scope and maps an unreachable gateway to a failure class; a registration extension makes it the chat client of a host."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 306,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-970]",
      "number": 970
    },
    {
      "id": "AIFACTORY-TASK-971",
      "type": "task",
      "parent": "AIFACTORY-US-196",
      "title": "Fake gateway transport for the tests of the client and of its consumers",
      "sequence": "18.02.06.03",
      "description": "BEFORE DEVELOPMENT. Fake gateway transport for the tests of the client and of its consumers. Expected output: A fake transport in the test support of the Factory library returns a receipt for a completion, streams a completion and simulates an unreachable gateway; it is published with the test support so that a consuming template can run its host tests against it.. Kind: fixture. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A fake transport in the test support of the Factory library returns a receipt for a completion, streams a completion and simulates an unreachable gateway; it is published with the test support so that a consuming template can run its host tests against it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 306,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-971]",
      "number": 971
    },
    {
      "id": "AIFACTORY-TASK-972",
      "type": "task",
      "parent": "AIFACTORY-US-196",
      "title": "Verify the scope, the receipt and the absence of a provider path",
      "sequence": "18.02.06.04",
      "description": "BEFORE DEVELOPMENT. Verify the scope, the receipt and the absence of a provider path. Expected output: Run `dotnet test -c Release --no-build` on the Factory library solution; the fake transport tests and the architecture test pass and prove AC1 to AC3 of AIFACTORY-US-196 (ADR-0028).. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the Factory library solution; the fake transport tests and the architecture test pass and prove AC1 to AC3 of AIFACTORY-US-196 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 306,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-972]",
      "number": 972
    },
    {
      "id": "AIFACTORY-US-220",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "Factory libraries: one scope accessor, its middleware and the Factory token contract names live in the abstractions package",
      "sequence": "18.02.07",
      "description": "As a platform admin, I want the scope accessor, the middleware that fills it and the names of the Factory token contract to exist once in the abstractions package, so that every template pins one definition of the trusted scope and of the role claims before any Factory service is generated. ADR-0015 decision 2 requires every Factory contract to carry the trusted tenant id and project id derived from the authenticated context, never from caller-controlled headers, and decisions 5 and 6 have the authorization server issue the seven Factory roles as claims that every service enforces. The base, gateway, identity and authorization server templates all need the same scope type, the same accessor and the same claim and role names before a Factory service exists, so this work belongs to the library phase and not to a development feature. The package `ConnectSoft.Extensions.AI.Factory.Abstractions` holds one scope object (tenant and project, with run, step and attempt while a run is in flight), one accessor that returns it in REST, gRPC and message handlers and throws when no scope was established, the middleware and the message filter that fill it from the validated token and from the envelope of ADR-0014, and the Factory token contract: the claim type names, the seven role names and one formatter and parser of the scoped role value. The templates pin the package and type none of the names. The gateway side of the chain, the resolution of the project membership and the refusal tests through a running gateway, stays with the feature `trusted-scope-chain`, which consumes this package. Kind: enabling. Traces: descriptors: execution-scope-v1; adrs: ADR-0014, ADR-0015. Depends on: AIFACTORY-US-192. Sources: model/components.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a host that registers the scope middleware of `ConnectSoft.Extensions.AI.Factory.Abstractions`, when a REST call, a gRPC call and a message handler run under a validated token or a received envelope, then the single accessor returns the same tenant and project in all three and throws a typed exception when no scope was established; unit tests of the package prove the three entry points and the missing-scope case (ADR-0015 decision 2).",
        "AC2: Given a request that carries a tenant or project header a caller typed, when the middleware fills the scope, then the values come from the validated token and the header is ignored, and when a message is published the scope travels in the envelope fields and the handler reads it from there; unit tests prove that a forged header never reaches the accessor (ADR-0015 decision 2, ADR-0014 decision 1).",
        "AC3: Given the token contract types of the package, when a scoped role value is formatted and parsed, then the role, the scope kind, the scope identifier and, for a delegated role, the delegation identifier round-trip, a malformed value is refused with a typed error, and the claim type names and the seven role names exist once as constants the templates reference; round-trip and refusal tests pass (ADR-0015 decisions 5 and 6)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-186",
        "AIFACTORY-TASK-142",
        "AIFACTORY-TASK-1173",
        "AIFACTORY-TASK-1059"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 307,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-192"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-220]",
      "number": 220
    },
    {
      "id": "AIFACTORY-TASK-186",
      "type": "task",
      "parent": "AIFACTORY-US-220",
      "title": "Scope accessor and middleware in the Factory abstractions",
      "sequence": "18.02.07.01",
      "description": "BEFORE DEVELOPMENT. Scope accessor and middleware in the Factory abstractions. Expected output: One accessor returns the scope in REST, gRPC and message handlers; it throws when no scope was established.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory.Abstractions.",
      "acceptanceCriteria": [
        "One accessor returns the scope in REST, gRPC and message handlers; it throws when no scope was established."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory.Abstractions"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 307,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-186]",
      "number": 186
    },
    {
      "id": "AIFACTORY-TASK-142",
      "type": "task",
      "parent": "AIFACTORY-US-220",
      "title": "Scope propagation over REST, gRPC and messaging from the validated token",
      "sequence": "18.02.07.02",
      "description": "BEFORE DEVELOPMENT. Scope propagation over REST, gRPC and messaging from the validated token. Expected output: A scope object is created by the middleware from the validated token and travels in headers between Factory services and in the message envelope; services read it from one accessor and a header a caller typed is ignored.. Kind: implementation. Repository: ConnectSoft.Extensions.AI.Factory.Abstractions. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A scope object is created by the middleware from the validated token and travels in headers between Factory services and in the message envelope; services read it from one accessor and a header a caller typed is ignored."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI.Factory.Abstractions"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 307,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-142]",
      "number": 142
    },
    {
      "id": "AIFACTORY-TASK-1173",
      "type": "task",
      "parent": "AIFACTORY-US-220",
      "title": "Factory token contract names and the scoped role value in the Factory abstractions package",
      "sequence": "18.02.07.03",
      "description": "BEFORE DEVELOPMENT. Factory token contract names and the scoped role value in the Factory abstractions package. Expected output: The package `ConnectSoft.Extensions.AI.Factory.Abstractions` holds the Factory token contract: the claim type names of the tenant claim, the role claim and the delegated role claim, the seven role names, and one formatter and parser of the scoped role value (role, scope kind, scope identifier and, for a delegated role, the delegation identifier) with round-trip tests and a refusal of a malformed value; the feature component-extensions-ai publishes the package, and the identity, authorization server, base and gateway templates pin it and type none of the names.. Kind: contract. Repository: ConnectSoft.Extensions.AI.Factory.Abstractions. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.AI.Factory.Abstractions` holds the Factory token contract: the claim type names of the tenant claim, the role claim and the delegated role claim, the seven role names, and one formatter and parser of the scoped role value (role, scope kind, scope identifier and, for a delegated role, the delegation identifier) with round-trip tests and a refusal of a malformed value; the feature component-extensions-ai publishes the package, and the identity, authorization server, base and gateway templates pin it and type none of the names."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.AI.Factory.Abstractions"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 307,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1173]",
      "number": 1173
    },
    {
      "id": "AIFACTORY-TASK-1059",
      "type": "task",
      "parent": "AIFACTORY-US-220",
      "title": "Verify the scope accessor, the forged-header refusal and the token contract round trip",
      "sequence": "18.02.07.04",
      "description": "BEFORE DEVELOPMENT. Verify the scope accessor, the forged-header refusal and the token contract round trip. Expected output: Run `dotnet test -c Release --no-build` on the abstractions solution; the accessor tests for REST, gRPC and message handlers, the missing-scope and forged-header tests and the round-trip and refusal tests of the scoped role value pass and prove AC1 to AC3 of AIFACTORY-US-220 (ADR-0014, ADR-0015).. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory.Abstractions.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the abstractions solution; the accessor tests for REST, gRPC and message handlers, the missing-scope and forged-header tests and the round-trip and refusal tests of the scoped role value pass and prove AC1 to AC3 of AIFACTORY-US-220 (ADR-0014, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory.Abstractions"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 307,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1059]",
      "number": 1059
    },
    {
      "id": "AIFACTORY-US-197",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "AI and Factory libraries: the packages are built, tested and published to the ConnectSoft feed in dependency order with the versions the consumers pin",
      "sequence": "18.02.08",
      "description": "As a platform admin, I want proof that the extended AI and Factory packages are on the ConnectSoft feed with versions a consumer can pin, so that the agent host template and the Factory services restore them from the feed and never from a local source. This PBI is the publication proof of the feature. The epic is done only when each library publishes to the feed before the Factory code that consumes it is built, and decision D114 settles which feed that is: the Factory feed is the Azure Artifacts feed the ConnectSoft libraries already publish to, so this PBI says the ConnectSoft feed and no second feed is created. The agent host template features pin the versions of the Factory packages that carry the scoped trace context, the refusing base, the Cancelled stage and the model client, and the base, gateway, identity and authorization server templates pin the Abstractions package for the scope object, the scope accessor with its middleware and message filter and the Factory token contract of AIFACTORY-US-220. The pipelines of the library repositories build, test, pack and push in dependency order: the Abstractions package first, then the Factory and the Messaging packages, then the MassTransit publisher package, with the AI library before the agents framework library. Each package has its own pipeline in its own repository. A stage publishes only when the tests of its solution pass and a version that is already on the feed is refused. The order is held by pipeline resources: the pipeline of a downstream package is triggered by the pipeline resource of its upstream and restores the upstream version from the feed, so an upstream run that fails publishes no version for the downstream to build on. The Abstractions and Messaging packages, whose CLR types changed in a source-breaking way, publish under a new major version, and every package that references them moves its pin to it. A probe then proves the result from the side of a consumer: a clean project that has the ConnectSoft feed as its only source and no project reference restores the published versions, builds, runs a scripted agent derived from the base through a scoped request to a terminal stage, resolves the scope accessor of the Abstractions package after its middleware ran and round-trips a scoped role value of the Factory token contract. The published versions are recorded in the Runbook pages of the libraries, which is where a consuming template reads its pins. The migration guide of the Factory library pages already forbids mixing a published package reference with a local project reference for the same assembly; the probe is the test of that rule. Kind: evidence. Traces: adrs: ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-192, AIFACTORY-US-193, AIFACTORY-US-194, AIFACTORY-US-195, AIFACTORY-US-196, AIFACTORY-US-220. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/ecosystem-composition.md, docs/architecture/catalogs/libraries.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipelines of the six AI and Factory library repositories, when they run after the work of the feature, then each package is built, tested, packed and pushed to the ConnectSoft feed in dependency order, a stage publishes only after the tests of its solution pass, the Abstractions and Messaging packages, whose contracts changed in a source-breaking way, publish under a new major version that the dependent packages pin, the published Abstractions package holds the scope object, the scope accessor with its middleware and message filter and the Factory token contract of AIFACTORY-US-220 that ADR-0015 decisions 2, 5 and 6 require of every template, and the published versions are recorded in the Runbook pages of the libraries (ADR-0028; model/backlog/epics.yaml states the publication before consumption as the completion of the epic).",
        "AC2: Given a clean consumer project with the ConnectSoft feed as its only package source and no project reference, when it restores the published versions and builds, then a scripted agent derived from `FactoryAgentBase` runs a scoped request to a terminal stage and its events carry the envelope fields of ADR-0014 decision 1, and the probe resolves the scope accessor of the published Abstractions package after its middleware ran and round-trips a scoped role value of the Factory token contract (ADR-0015 decision 2); the same versions are the pins the agent host template features and the base, gateway, identity and authorization server templates read.",
        "AC3: Given a failing test in a library solution or a version that is already on the feed, when the pipeline reaches the publication stage, then the stage is refused with the reason; because each downstream pipeline is triggered by the pipeline resource of its upstream and restores the upstream version from the feed, no downstream package is published on top of the failed one, and a run with a planted failing test proves the refusal (ADR-0028, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-973",
        "AIFACTORY-TASK-974",
        "AIFACTORY-TASK-975",
        "AIFACTORY-TASK-976"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 308,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-192",
        "AIFACTORY-US-193",
        "AIFACTORY-US-194",
        "AIFACTORY-US-195",
        "AIFACTORY-US-196",
        "AIFACTORY-US-220"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "titlePrefix": "[AIFACTORY-US-197]",
      "number": 197
    },
    {
      "id": "AIFACTORY-TASK-973",
      "type": "task",
      "parent": "AIFACTORY-US-197",
      "title": "Publication order and version guard in the library pipelines",
      "sequence": "18.02.08.01",
      "description": "BEFORE DEVELOPMENT. Publication order and version guard in the library pipelines. Expected output: The pipeline of each of the six repositories (`ConnectSoft.Extensions.AI`, `ConnectSoft.Extensions.AI.AgentsFramework`, `ConnectSoft.Extensions.AI.Factory.Abstractions`, `ConnectSoft.Extensions.AI.Factory`, `ConnectSoft.Extensions.AI.Factory.Messaging`, `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`) publishes after the tests of its solution pass and refuses a version already on the feed with the reason. The order is the Abstractions package, then the Factory and the Messaging packages, then the MassTransit publisher package, with the AI library before the agents framework library. The order is held by pipeline resources: each downstream pipeline is triggered by the pipeline resource of its upstream and restores the upstream version from the feed, so a failed upstream run publishes no version for the downstream to build on. The Abstractions and Messaging packages publish under a new major version, and the Abstractions package of that version holds the scope accessor, its middleware and the Factory token contract of AIFACTORY-US-220. The check per repository is its pipeline file with the upstream resource and one green publishing run.. Kind: operations. Repository: ConnectSoft.Extensions.AI.Factory. Verification: azure-pipelines.yml of each of the six repositories names its upstream pipeline resource and publishes after its tests; a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipeline of each of the six repositories (`ConnectSoft.Extensions.AI`, `ConnectSoft.Extensions.AI.AgentsFramework`, `ConnectSoft.Extensions.AI.Factory.Abstractions`, `ConnectSoft.Extensions.AI.Factory`, `ConnectSoft.Extensions.AI.Factory.Messaging`, `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit`) publishes after the tests of its solution pass and refuses a version already on the feed with the reason. The order is the Abstractions package, then the Factory and the Messaging packages, then the MassTransit publisher package, with the AI library before the agents framework library. The order is held by pipeline resources: each downstream pipeline is triggered by the pipeline resource of its upstream and restores the upstream version from the feed, so a failed upstream run publishes no version for the downstream to build on. The Abstractions and Messaging packages publish under a new major version, and the Abstractions package of that version holds the scope accessor, its middleware and the Factory token contract of AIFACTORY-US-220. The check per repository is its pipeline file with the upstream resource and one green publishing run."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 308,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-973]",
      "number": 973
    },
    {
      "id": "AIFACTORY-TASK-974",
      "type": "task",
      "parent": "AIFACTORY-US-197",
      "title": "Feed probe consumer for the published Factory packages",
      "sequence": "18.02.08.02",
      "description": "BEFORE DEVELOPMENT. Feed probe consumer for the published Factory packages. Expected output: A probe project with the ConnectSoft feed as its only source and no project reference restores the published versions, builds, runs a scripted agent through a scoped request to a terminal stage, resolves the scope accessor of the Abstractions package after its middleware ran and round-trips a scoped role value of the Factory token contract; the probe runs as the last stage of the Factory library pipeline.. Kind: fixture. Repository: ConnectSoft.Extensions.AI.Factory. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe project with the ConnectSoft feed as its only source and no project reference restores the published versions, builds, runs a scripted agent through a scoped request to a terminal stage, resolves the scope accessor of the Abstractions package after its middleware ran and round-trips a scoped role value of the Factory token contract; the probe runs as the last stage of the Factory library pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 308,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-974]",
      "number": 974
    },
    {
      "id": "AIFACTORY-TASK-975",
      "type": "task",
      "parent": "AIFACTORY-US-197",
      "title": "Published versions and the changed contracts recorded in the library pages",
      "sequence": "18.02.08.03",
      "description": "BEFORE DEVELOPMENT. Published versions and the changed contracts recorded in the library pages. Expected output: The Runbook page of each of the six library repositories names the version its package published; the Features page and the migration guide of the Factory library pages describe the scoped trace context, the typed identifiers, the scope object and its accessor with the middleware and the message filter, the Factory token contract, the refusal, the Cancelled stage, the failure class and the model client, state the new major version of the Abstractions and Messaging packages with what a consumer changes, and the package responsibility matrix names the package of each new type. The check per repository is a build of its documentation site without warnings.. Kind: documentation. Repository: ConnectSoft.Extensions.AI.Factory. Verification: the documentation pipeline of each of the six libraries builds its site without warnings.",
      "acceptanceCriteria": [
        "The Runbook page of each of the six library repositories names the version its package published; the Features page and the migration guide of the Factory library pages describe the scoped trace context, the typed identifiers, the scope object and its accessor with the middleware and the message filter, the Factory token contract, the refusal, the Cancelled stage, the failure class and the model client, state the new major version of the Abstractions and Messaging packages with what a consumer changes, and the package responsibility matrix names the package of each new type. The check per repository is a build of its documentation site without warnings."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 308,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-975]",
      "number": 975
    },
    {
      "id": "AIFACTORY-TASK-976",
      "type": "task",
      "parent": "AIFACTORY-US-197",
      "title": "Verify the published packages by the probe and by a planted failing run",
      "sequence": "18.02.08.04",
      "description": "BEFORE DEVELOPMENT. Verify the published packages by the probe and by a planted failing run. Expected output: One run of the six pipelines in their order publishes every package and the probe passes, the scope accessor and the token contract of the published Abstractions package included; one run with a planted failing test in an upstream solution stops before publication and triggers no downstream pipeline; both runs prove AC1 to AC3 of AIFACTORY-US-197 (ADR-0028).. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory.",
      "acceptanceCriteria": [
        "One run of the six pipelines in their order publishes every package and the probe passes, the scope accessor and the token contract of the published Abstractions package included; one run with a planted failing test in an upstream solution stops before publication and triggers no downstream pipeline; both runs prove AC1 to AC3 of AIFACTORY-US-197 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 308,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-976]",
      "number": 976
    },
    {
      "id": "AIFACTORY-US-097",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "AI and Factory libraries: scope in contracts, Anthropic adapter, durable base is delivered and proven by its consumers",
      "sequence": "18.02.09",
      "description": "As a platform admin, I want Extensions.AI + AgentsFramework + Factory libraries to carry scope in contracts, Anthropic adapter, durable base, so that it serves model adapters, keyed agents, lifecycle hooks without later rework. This is the integration PBI of the feature. A platform admin takes the AI and Factory libraries from their recorded baseline to published packages: the scope, the run, step and attempt identity and a schema version on the trace context and the envelope, one scope accessor with its middleware and the Factory token contract in the Abstractions package, a base that refuses a request without trace metadata and retries in attempts with a backoff, the Cancelled stage and a terminal Failed before the rethrow, the Anthropic adapter and the Factory model client with its profile and receipt contracts. The implementation lives in the earlier PBIs of this file; this PBI proves them together from the side of the consumers. The published packages are restored from the ConnectSoft feed, a scripted agent runs through every lifecycle outcome under a scoped request, and the result is what the agent host template features pin. The feature is done when no request without scope executes, every lifecycle event is attributable to tenant, project, run and attempt, a cancellation is observable, and the packages are on the feed with recorded versions. Repository of the feature: the AI and Factory library repositories. The services that reach these libraries in a later increment are the agent registry, the agent runtime and the context builder. Kind: enabling. Traces: adrs: ADR-0014, ADR-0028. Depends on: AIFACTORY-US-191, AIFACTORY-US-192, AIFACTORY-US-193, AIFACTORY-US-194, AIFACTORY-US-195, AIFACTORY-US-196, AIFACTORY-US-220, AIFACTORY-US-197. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/planes/model-compute/providers-and-profiles.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repositories of the feature, when their pipelines run, then each package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-160 (build and test the Factory libraries as they are) is done, then a recorded baseline exists: every project of the AI and Factory libraries builds and its tests pass with the package versions of the feed, the library types of the recorded agent base work are the single definition and the pins are aligned (ADR-0028, docs/architecture/ecosystem-composition.md).",
        "AC3: Given the work of AIFACTORY-TASK-161 (tenant and project scope in the Factory contracts) is done, then every request and event contract carries the trusted scope, the run, step and attempt identity and a schema version, and a contract without scope does not compile (ADR-0014 decision 1).",
        "AC4: Given the work of AIFACTORY-TASK-162 (Anthropic model adapter) is done, then an adapter behind the model client abstraction with streaming, tool use and usage reporting exists and its contract tests run against recorded responses (docs/planes/model-compute/providers-and-profiles.md, ADR-0028 decision 3).",
        "AC5: Given the published packages, when a scripted agent runs under a scoped request, then a request without trace metadata is refused before any model call, a cancellation ends with the Cancelled stage and an unexpected exception with a terminal Failed and a failure class before the rethrow, as ADR-0014 decision 2 requires."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/model-compute/providers-and-profiles.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-977",
        "AIFACTORY-TASK-680"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 309,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-191",
        "AIFACTORY-US-192",
        "AIFACTORY-US-193",
        "AIFACTORY-US-194",
        "AIFACTORY-US-195",
        "AIFACTORY-US-196",
        "AIFACTORY-US-220",
        "AIFACTORY-US-197"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/planes/model-compute/providers-and-profiles.md"
      ],
      "titlePrefix": "[AIFACTORY-US-097]",
      "number": 97
    },
    {
      "id": "AIFACTORY-TASK-977",
      "type": "task",
      "parent": "AIFACTORY-US-097",
      "title": "Run every lifecycle outcome of a scripted agent against the published packages",
      "sequence": "18.02.09.01",
      "description": "BEFORE DEVELOPMENT. Run every lifecycle outcome of a scripted agent against the published packages. Expected output: A consumer test project restores the published packages from the ConnectSoft feed and runs a scripted agent through success, retry then success, escalation, refusal without trace metadata, cancellation and an unexpected exception; each run ends with the terminal stage and the envelope fields of ADR-0014, which proves AC3 and AC5 of AIFACTORY-US-097.. Kind: verification. Repository: ConnectSoft.Extensions.AI.Factory. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A consumer test project restores the published packages from the ConnectSoft feed and runs a scripted agent through success, retry then success, escalation, refusal without trace metadata, cancellation and an unexpected exception; each run ends with the terminal stage and the envelope fields of ADR-0014, which proves AC3 and AC5 of AIFACTORY-US-097."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI.Factory"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 309,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-977]",
      "number": 977
    },
    {
      "id": "AIFACTORY-TASK-680",
      "type": "task",
      "parent": "AIFACTORY-US-097",
      "title": "Verify extensions-ai-delivered by running the declared command",
      "sequence": "18.02.09.02",
      "description": "BEFORE DEVELOPMENT. Verify extensions-ai-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on every library solution of the feature; they pass and prove AC1 to AC5 of AIFACTORY-US-097.. Kind: verification. Repository: ConnectSoft.Extensions.AI.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on every library solution of the feature; they pass and prove AC1 to AC5 of AIFACTORY-US-097."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 309,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-680]",
      "number": 680
    },
    {
      "id": "AIFACTORY-US-758",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-097",
      "title": "Extensions.AI: a rerank adapter abstraction is registered under the keyed provider pattern with a conformance suite and no provider implementation",
      "sequence": "18.02.10",
      "description": "As a platform admin, I want a rerank adapter abstraction beside the chat client and the embedding generator of the AI library, so that the model router binds its rerank port to library code by a version pin and a provider adapter for reranking never has to be written in a service repository. The Features page of `ConnectSoft.Extensions.AI` lists chat completion providers and embedding providers, registers a keyed chat client and an embedding generator per provider under the keys `openAI`, `azureOpenAI`, `ollama` and `azureAIInference`, and names no reranking; docs/planes/model-compute/providers-and-profiles.md lists a `reranker` profile among the logical profiles and has no adapter row for it. ModelRouterService serves `ModelGateway.Rerank` in I1 and, because a provider adapter is library code, keeps its rerank adapter as a port of the service until the AI library publishes a rerank adapter. Decision D121 therefore adds this PBI: a keyed rerank adapter abstraction in the AI library. The PBI adds one rerank contract to the library, with one asynchronous operation that takes a query, the candidate texts with the identifiers the caller gave them, an optional number of results and a cancellation token, and returns the candidates ranked by relevance score, each with its identifier and its score, together with the usage the provider reported. Usage is optional on the result: an adapter whose provider reports none leaves it absent and never writes zero, which is what the invocation receipt of the model gateway needs in order to record the usage as Unknown. The contract carries no tenant, no credential and no profile; those belong to the caller. An adapter is registered the way the chat clients and the embedding generators of the library are, as a keyed service under the provider key the library already uses for that provider, through one registration extension of the abstraction, and behind a rerank provider choice whose default is none, so a host that configures no rerank provider registers nothing and starts as before. A configured rerank provider whose adapter is not registered fails options validation at startup with the provider named, and a health check reports whether the adapter of the configured provider is registered and reports healthy with a message when none is configured, as the embedding health check of the library does. A caller resolves the adapter of a provider by its key; a key without a registered adapter resolves nothing, and the caller decides what that means, which for the model router is the refusal of a rerank call whose candidate has no adapter (feature `model-router-service`). The PBI brings the abstraction, its keyed registration and a conformance suite, and no provider implementation. The suite is a set of contract tests every implementation has to pass: the order by score, ties kept in input order, the number of results, an empty candidate list, a cancellation and absent usage. A scripted adapter in the test project of the library proves them without a provider call. Which provider is implemented first is not decided: model/model-profiles.yaml names `azure-ai-inference` and `ollama` for the `reranker` profile, no PBI holds an adapter for either, and that is reported to the owner. The pipeline of the repository publishes the package version that holds the abstraction to the ConnectSoft feed after its tests pass, under the publication rules of AIFACTORY-US-197, and the Runbook page of the library names that version, which is the pin feature `model-router-service` reads. The abstraction is library code for the model router, which ADR-0028 decision 3 makes the only service that calls model providers; an agent host reaches reranking through the model gateway and never registers a rerank adapter itself. The Features page of the library and the provider table of docs/planes/model-compute/providers-and-profiles.md are revised to describe the abstraction and to state that no provider adapter implements it yet. Kind: enabling. Traces: adrs: ADR-0021, ADR-0028. Depends on: AIFACTORY-US-191. Sources: model/components.yaml, model/model-profiles.yaml, docs/architecture/ecosystem-composition.md, docs/planes/model-compute/providers-and-profiles.md, docs/planes/model-compute/model-gateway.md.",
      "acceptanceCriteria": [
        "AC1: Given a host that configures no rerank provider, when the AI library registers its services, then nothing of reranking is registered, the host starts as before and the rerank health check reports healthy with a message that no provider is configured; given a host that registers a rerank adapter under a provider key through the registration extension of the abstraction, then the adapter is resolved by that key in the same way as the keyed chat client and the embedding generator of that provider, a key without an adapter resolves nothing, and a configured rerank provider whose adapter is not registered fails options validation at startup with the provider named (docs/planes/model-compute/providers-and-profiles.md; ADR-0028 decision 3 keeps the model router the only caller of a provider).",
        "AC2: Given the conformance suite and the scripted adapter of the test project, when the tests of the library run, then a result is ordered by score with ties in input order, holds at most the number of results asked for, returns the identifiers the caller gave, is empty for an empty candidate list, a cancellation ends the call, and an adapter whose script reports no usage returns a result without usage and never with zero; no test calls a live provider, and the suite is the capability evidence a later provider adapter has to pass under ADR-0021 decision 1.",
        "AC3: Given the pipeline of the repository ConnectSoft.Extensions.AI, when it runs after this work, then the package version that holds the abstraction is published to the ConnectSoft feed only after the tests of the solution pass, the Runbook page of the library names that version as the pin of its consumers, and the Features page of the library and the provider table of docs/planes/model-compute/providers-and-profiles.md describe the abstraction with its keyed registration and state that no provider adapter implements it yet (ADR-0028, docs/planes/model-compute/model-gateway.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/model-profiles.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/model-compute/providers-and-profiles.md",
        "docs/planes/model-compute/model-gateway.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-3058",
        "AIFACTORY-TASK-3059",
        "AIFACTORY-TASK-3060",
        "AIFACTORY-TASK-3061",
        "AIFACTORY-TASK-3062"
      ],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 310,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0021",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-191"
      ],
      "source": [
        "model/components.yaml",
        "model/model-profiles.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/model-compute/providers-and-profiles.md",
        "docs/planes/model-compute/model-gateway.md"
      ],
      "titlePrefix": "[AIFACTORY-US-758]",
      "number": 758
    },
    {
      "id": "AIFACTORY-TASK-3058",
      "type": "task",
      "parent": "AIFACTORY-US-758",
      "title": "Rerank contract of the AI library with its request, result and usage types",
      "sequence": "18.02.10.01",
      "description": "BEFORE DEVELOPMENT. Rerank contract of the AI library with its request, result and usage types. Expected output: The library holds one rerank contract with one asynchronous operation (a query, candidate texts with caller identifiers, an optional number of results, a cancellation token) and a result of ranked entries with identifier and relevance score and an optional usage that is absent when the provider reports none; the contract carries no tenant, credential or profile, and its public types are documented in the Features page of the library.. Kind: contract. Repository: ConnectSoft.Extensions.AI. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The library holds one rerank contract with one asynchronous operation (a query, candidate texts with caller identifiers, an optional number of results, a cancellation token) and a result of ranked entries with identifier and relevance score and an optional usage that is absent when the provider reports none; the contract carries no tenant, credential or profile, and its public types are documented in the Features page of the library."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 310,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-3058]",
      "number": 3058
    },
    {
      "id": "AIFACTORY-TASK-3059",
      "type": "task",
      "parent": "AIFACTORY-US-758",
      "title": "Keyed registration, provider choice, startup validation and health check of the rerank abstraction",
      "sequence": "18.02.10.02",
      "description": "BEFORE DEVELOPMENT. Keyed registration, provider choice, startup validation and health check of the rerank abstraction. Expected output: One registration extension registers a rerank adapter as a keyed service under the provider key the library uses for the chat client and the embedding generator of that provider; the rerank provider choice has the default none, under which nothing is registered; a configured provider without a registered adapter fails options validation at startup with the provider named; a rerank health check reports whether the adapter of the configured provider is registered and reports healthy with a message when none is configured.. Kind: implementation. Repository: ConnectSoft.Extensions.AI. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One registration extension registers a rerank adapter as a keyed service under the provider key the library uses for the chat client and the embedding generator of that provider; the rerank provider choice has the default none, under which nothing is registered; a configured provider without a registered adapter fails options validation at startup with the provider named; a rerank health check reports whether the adapter of the configured provider is registered and reports healthy with a message when none is configured."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 310,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-3059]",
      "number": 3059
    },
    {
      "id": "AIFACTORY-TASK-3060",
      "type": "task",
      "parent": "AIFACTORY-US-758",
      "title": "Conformance suite of the rerank contract and a scripted adapter for the tests",
      "sequence": "18.02.10.03",
      "description": "BEFORE DEVELOPMENT. Conformance suite of the rerank contract and a scripted adapter for the tests. Expected output: The test project of the library holds the contract tests every rerank adapter has to pass (order by score, ties in input order, the number of results, caller identifiers returned, an empty candidate list, cancellation, absent usage never written as zero) as a base that an adapter test derives from, and a scripted adapter with configurable scores and usage that proves them without a provider call.. Kind: fixture. Repository: ConnectSoft.Extensions.AI. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The test project of the library holds the contract tests every rerank adapter has to pass (order by score, ties in input order, the number of results, caller identifiers returned, an empty candidate list, cancellation, absent usage never written as zero) as a base that an adapter test derives from, and a scripted adapter with configurable scores and usage that proves them without a provider call."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 310,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-3060]",
      "number": 3060
    },
    {
      "id": "AIFACTORY-TASK-3061",
      "type": "task",
      "parent": "AIFACTORY-US-758",
      "title": "Provider table of the documentation site lists the rerank abstraction",
      "sequence": "18.02.10.04",
      "description": "BEFORE DEVELOPMENT. Provider table of the documentation site lists the rerank abstraction. Expected output: The provider table of docs/planes/model-compute/providers-and-profiles.md gains a row for reranking that names the rerank abstraction of `ConnectSoft.Extensions.AI`, its keyed registration under the provider keys and the fact that no provider adapter implements it yet, so that the page no longer leaves the `reranker` profile without an adapter row.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "The provider table of docs/planes/model-compute/providers-and-profiles.md gains a row for reranking that names the rerank abstraction of `ConnectSoft.Extensions.AI`, its keyed registration under the provider keys and the fact that no provider adapter implements it yet, so that the page no longer leaves the `reranker` profile without an adapter row."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 310,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-3061]",
      "number": 3061
    },
    {
      "id": "AIFACTORY-TASK-3062",
      "type": "task",
      "parent": "AIFACTORY-US-758",
      "title": "Verify the rerank abstraction by its conformance suite and its published version",
      "sequence": "18.02.10.05",
      "description": "BEFORE DEVELOPMENT. Verify the rerank abstraction by its conformance suite and its published version. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the AI library solution; the registration, validation and health check tests and the conformance suite against the scripted adapter pass, the pipeline of the repository publishes the package version that holds the abstraction after those tests and its Runbook page names the version, and the provider table revised by AIFACTORY-TASK-3061 lists the abstraction, which proves AC1 to AC3 of AIFACTORY-US-758 (ADR-0028).. Kind: verification. Repository: ConnectSoft.Extensions.AI.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the AI library solution; the registration, validation and health check tests and the conformance suite against the scripted adapter pass, the pipeline of the repository publishes the package version that holds the abstraction after those tests and its Runbook page names the version, and the provider table revised by AIFACTORY-TASK-3061 lists the abstraction, which proves AC1 to AC3 of AIFACTORY-US-758 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AI"
      ],
      "children": [],
      "buildOrder": 3,
      "phase": "templates-and-libraries",
      "stackRank": 310,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-3062]",
      "number": 3062
    },
    {
      "id": "AIFACTORY-FEAT-098",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Model Context Protocol library: authenticated by default",
      "sequence": "18.03",
      "description": "The Model Context Protocol library authenticates every server and client call by default and passes the caller's scope to the governed tool executor, so that no tool path bypasses policy. Component: Extensions.ModelContextProtocol (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 4 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-198",
        "AIFACTORY-US-199",
        "AIFACTORY-US-200",
        "AIFACTORY-US-201",
        "AIFACTORY-US-098"
      ],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 400,
      "titlePrefix": "[AIFACTORY-FEAT-098]",
      "number": 98
    },
    {
      "id": "AIFACTORY-US-198",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-098",
      "title": "Model Context Protocol library: an HTTP server requires authorization by default and anonymous exposure is a declared exception",
      "sequence": "18.03.01",
      "description": "As a platform admin, I want a server built with the Model Context Protocol library to require authorization as soon as it is reachable beyond the local process, so that no host exposes its tools anonymously because a setting was left at its default. The Features page of `ConnectSoft.Extensions.ModelContextProtocol` describes two transports, Stdio and Http, and an authorization options class with OAuth 2.0, protected resource metadata, and authority and audience validation of the token; the source of that class, `McpAuthorizationOptions`, states that `Enabled` is off by default and that the server then accepts unauthenticated requests, and docs/planes/capability-tools/mcp.md records the same default and that the agent host maps its endpoint without authorization. ADR-0022 decision 4 makes authentication on by default for any server reachable beyond the local process and anonymous access a documented exception per server. This PBI changes the default of the library. On the Http transport `Enabled` is true unless the host declares an anonymous exception that carries a reason. The existing rule of the options class stays: `ResourceUri` and `AuthorizationServers` are required when `Enabled` is true, because the pointer to the protected resource metadata cannot be served without them. A host on the Http transport therefore has three outcomes at start. It configures `ResourceUri` and `AuthorizationServers`, leaves `Enabled` unset or sets it, and runs protected. It declares the anonymous exception with its reason and runs open, with the exception logged at start and reported in the health data of the server, so that the server registry can record it. Or it does neither and fails options validation with `ResourceUri` and `AuthorizationServers` named. Switching `Enabled` off without a declared exception fails the start as well. On a protected server a call without a token, with an expired token or with a token for another audience is answered 401 with the pointer to the protected resource metadata, no tool handler runs and the refusal is counted. The Stdio transport, which never leaves the local process, keeps its behaviour. A host that relied on the earlier default fails at start with the setting named instead of running open. Kind: enabling. Traces: adrs: ADR-0022. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/planes/capability-tools/mcp.md.",
      "acceptanceCriteria": [
        "AC1: Given a host that registers a server on the Http transport, configures `ResourceUri` and `AuthorizationServers` of `McpAuthorizationOptions` and leaves `Enabled` unset, when a client calls a tool without a token, then the call is answered 401 with the pointer to the protected resource metadata, no tool handler runs and the refusal is counted, because authorization is on by default as ADR-0022 decision 4 requires.",
        "AC2: Given a host whose Http server has authorization switched off, when the host starts, then options validation fails with the setting named unless an anonymous exception with a reason is declared; an Http host that has neither `ResourceUri` and `AuthorizationServers` nor a declared anonymous exception fails at start with `ResourceUri` and `AuthorizationServers` named, because the existing rule that requires them when authorization is enabled stays; a declared exception is logged at start and reported in the health data of the server, which is the documented exception per server of ADR-0022 decision 4 (docs/planes/capability-tools/mcp.md).",
        "AC3: Given a token issued for another audience or an expired token, when a tool is called over Http, then the call is refused with 401 and no handler runs; a server on the Stdio transport keeps accepting its local client without a token, and tests cover both transports (ADR-0022 decision 4)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-163",
        "AIFACTORY-TASK-978",
        "AIFACTORY-TASK-979",
        "AIFACTORY-TASK-980"
      ],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 401,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "titlePrefix": "[AIFACTORY-US-198]",
      "number": 198
    },
    {
      "id": "AIFACTORY-TASK-163",
      "type": "task",
      "parent": "AIFACTORY-US-198",
      "title": "Authentication and scope on MCP calls by default",
      "sequence": "18.03.01.01",
      "description": "BEFORE DEVELOPMENT. Authentication and scope on MCP calls by default. Expected output: The authorization options of the library are on by default for the Http transport: on a host that configures `ResourceUri` and `AuthorizationServers` and leaves `Enabled` unset, an unauthenticated call, an expired token and a token for another audience are refused with 401 and the pointer to the protected resource metadata, no tool handler runs and the refusal is counted; an authenticated call reaches the handler with the tenant and project scope that AIFACTORY-US-199 binds.. Kind: implementation. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The authorization options of the library are on by default for the Http transport: on a host that configures `ResourceUri` and `AuthorizationServers` and leaves `Enabled` unset, an unauthenticated call, an expired token and a token for another audience are refused with 401 and the pointer to the protected resource metadata, no tool handler runs and the refusal is counted; an authenticated call reaches the handler with the tenant and project scope that AIFACTORY-US-199 binds."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-163]",
      "number": 163
    },
    {
      "id": "AIFACTORY-TASK-978",
      "type": "task",
      "parent": "AIFACTORY-US-198",
      "title": "Start validation of an Http server and the declared anonymous exception",
      "sequence": "18.03.01.02",
      "description": "BEFORE DEVELOPMENT. Start validation of an Http server and the declared anonymous exception. Expected output: The server options validator fails the start of a host whose Http server has authorization off and no anonymous exception, and of an Http host that has neither `ResourceUri` and `AuthorizationServers` nor a declared exception, with the missing settings named; the `RequiredIf` rule of `McpAuthorizationOptions` on the two settings stays; the exception setting carries a reason, is logged at start and is reported in the health data of the server; the Stdio transport is exempt.. Kind: implementation. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The server options validator fails the start of a host whose Http server has authorization off and no anonymous exception, and of an Http host that has neither `ResourceUri` and `AuthorizationServers` nor a declared exception, with the missing settings named; the `RequiredIf` rule of `McpAuthorizationOptions` on the two settings stays; the exception setting carries a reason, is logged at start and is reported in the health data of the server; the Stdio transport is exempt."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-978]",
      "number": 978
    },
    {
      "id": "AIFACTORY-TASK-979",
      "type": "task",
      "parent": "AIFACTORY-US-198",
      "title": "Test host and token fixtures for the authorization default",
      "sequence": "18.03.01.03",
      "description": "BEFORE DEVELOPMENT. Test host and token fixtures for the authorization default. Expected output: A test host on the Http transport, configured with `ResourceUri` and `AuthorizationServers` and with `Enabled` unset, and a local token issuer that produces a valid token, an expired token and a token for another audience; a second host runs on the Stdio transport; both are reused by the scope tests of the next PBI.. Kind: fixture. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A test host on the Http transport, configured with `ResourceUri` and `AuthorizationServers` and with `Enabled` unset, and a local token issuer that produces a valid token, an expired token and a token for another audience; a second host runs on the Stdio transport; both are reused by the scope tests of the next PBI."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 401,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-979]",
      "number": 979
    },
    {
      "id": "AIFACTORY-TASK-980",
      "type": "task",
      "parent": "AIFACTORY-US-198",
      "title": "Verify the authorization default on both transports",
      "sequence": "18.03.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the authorization default on both transports. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the tests of the unauthenticated call, the wrong audience, the start validation with authorization off, the start refusal of an Http host with no authorization setting and the Stdio transport pass and prove AC1 to AC3 of AIFACTORY-US-198 (ADR-0022).. Kind: verification. Repository: ConnectSoft.Extensions.ModelContextProtocol.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the tests of the unauthenticated call, the wrong audience, the start validation with authorization off, the start refusal of an Http host with no authorization setting and the Stdio transport pass and prove AC1 to AC3 of AIFACTORY-US-198 (ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-980]",
      "number": 980
    },
    {
      "id": "AIFACTORY-US-199",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-098",
      "title": "Model Context Protocol library: the scope of the authenticated caller reaches every tool handler and the governance layer",
      "sequence": "18.03.02",
      "description": "As a platform admin, I want the tenant, the project and the agent identity of the authenticated caller to be available to every tool handler and to the governance layer of the library, so that the governed tool executor decides and records every tool call under the scope of its caller and no tool path bypasses policy. ADR-0022 decision 2 sends every tool call, from a Factory agent, an IDE client or a partner agent, through the governed executor with scope, policy decision, side-effect class, idempotency key, receipt and audit, and ADR-0015 decision 2 takes the tenant and the project of a Factory contract from the authenticated context, never from prompt text or a caller-controlled header. The library validates a token today but hands nothing of it to a tool: its governance options carry a default agent id used as a fallback and a switch that requires an authenticated agent identity, which is off by default, as docs/planes/capability-tools/mcp.md records. This PBI binds the scope. After authorization the library exposes a scope accessor to the tool handler and to the governance layer with the tenant id, the project id, the agent or user identity and, where the token carries them, the run, step and attempt identity. A token without a tenant claim is answered 401 and a token with a tenant and without a project 403, both before the handler runs; these are the codes the Factory profile of the base template answers for the same token, so two backends of one estate do not differ. A tenant or project named in a tool argument or in a header is never used as the scope. The library recognises a scope argument by a stated rule: a tool parameter is a scope argument when the tool declares it so, through a scope attribute of the library on the parameter or an entry of its tool descriptor, or when it carries the canonical name `tenantId` or `projectId`; any other parameter, a free-text one included, is not inspected. A scope argument recognised by this rule that contradicts the scope of the token is refused before the handler with a typed tool error whose reason is `scope-mismatch`, as decision D114 settles: the token itself is valid, so the refusal is a result of the tool call that the caller can classify and not a 401 or 403, no handler runs and the refusal is counted. This is the fail-closed rule for conflicting evidence. With authorization on, the governance layer requires the authenticated agent identity by default and the fallback agent id is not applied. The scope is added to the activity of the tool invocation and to the audit record of the governance decision. The library hands the executor the scope and never the raw token of the caller, which the tools page calls unsafe to forward. Kind: enabling. Traces: adrs: ADR-0015, ADR-0022. Depends on: AIFACTORY-US-198. Sources: model/components.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/capability-tools/mcp.md.",
      "acceptanceCriteria": [
        "AC1: Given an authenticated call whose token carries a tenant and a project, when a tool handler runs, then the scope accessor returns the tenant id, the project id and the caller identity of the token, with the run, step and attempt identity where the token carries them, and the governance decision of the call is recorded with the same scope (ADR-0022 decision 2, ADR-0015 decision 2).",
        "AC2: Given a token without a tenant claim, a token with a tenant and without a project, or a call whose scope argument (a parameter the tool declares as scope, or one named `tenantId` or `projectId`) names a tenant or a project other than that of the token, when the tool is called, then the call is refused before the handler runs, with 401 for the missing tenant claim, 403 for the missing project and a typed tool error whose reason is `scope-mismatch` for the contradicting scope argument, and the scope is never taken from an argument or a header; an undeclared free-text parameter is not inspected, and a test with two tenants proves that a handler never observes the scope of another caller (ADR-0015 decision 2; its amendment keeps 403 for a missing scope inside the tenant).",
        "AC3: Given a server with authorization on, when the governance layer evaluates a call, then the authenticated agent identity is required by default and the fallback agent id of the options is not applied; the raw token of the caller is not available to the handler and is not forwarded, as docs/planes/capability-tools/mcp.md requires of tool credentials (ADR-0022 decision 2)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-981",
        "AIFACTORY-TASK-982",
        "AIFACTORY-TASK-983",
        "AIFACTORY-TASK-984"
      ],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 402,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0022"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-198"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "titlePrefix": "[AIFACTORY-US-199]",
      "number": 199
    },
    {
      "id": "AIFACTORY-TASK-981",
      "type": "task",
      "parent": "AIFACTORY-US-199",
      "title": "Scope accessor from the validated token for tool handlers",
      "sequence": "18.03.02.01",
      "description": "BEFORE DEVELOPMENT. Scope accessor from the validated token for tool handlers. Expected output: A request-scoped accessor of the library returns tenant id, project id, caller identity and the optional run, step and attempt identity read from the validated token; the claim names are options with the canonical names as defaults; a token without a tenant claim is answered 401 and a token with a tenant and without a project 403, both before the handler. A tool parameter is a scope argument when the tool declares it so, through a scope attribute of the library on the parameter or an entry of its tool descriptor, or when it carries the canonical name `tenantId` or `projectId`; a scope argument that contradicts the scope of the token is refused before the handler with a typed tool error whose reason is `scope-mismatch`, the refusal is counted, and no other parameter is inspected.. Kind: implementation. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A request-scoped accessor of the library returns tenant id, project id, caller identity and the optional run, step and attempt identity read from the validated token; the claim names are options with the canonical names as defaults; a token without a tenant claim is answered 401 and a token with a tenant and without a project 403, both before the handler. A tool parameter is a scope argument when the tool declares it so, through a scope attribute of the library on the parameter or an entry of its tool descriptor, or when it carries the canonical name `tenantId` or `projectId`; a scope argument that contradicts the scope of the token is refused before the handler with a typed tool error whose reason is `scope-mismatch`, the refusal is counted, and no other parameter is inspected."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-981]",
      "number": 981
    },
    {
      "id": "AIFACTORY-TASK-982",
      "type": "task",
      "parent": "AIFACTORY-US-199",
      "title": "Authenticated agent identity required by the governance layer by default",
      "sequence": "18.03.02.02",
      "description": "BEFORE DEVELOPMENT. Authenticated agent identity required by the governance layer by default. Expected output: With authorization on, the governance options require the authenticated agent identity by default and ignore the fallback agent id; the governance decision, its audit record and the activity of the tool invocation carry the scope of the caller; the raw token is not exposed to handlers.. Kind: implementation. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With authorization on, the governance options require the authenticated agent identity by default and ignore the fallback agent id; the governance decision, its audit record and the activity of the tool invocation carry the scope of the caller; the raw token is not exposed to handlers."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-982]",
      "number": 982
    },
    {
      "id": "AIFACTORY-TASK-983",
      "type": "task",
      "parent": "AIFACTORY-US-199",
      "title": "Sample tool and two-tenant tokens for the scope tests",
      "sequence": "18.03.02.03",
      "description": "BEFORE DEVELOPMENT. Sample tool and two-tenant tokens for the scope tests. Expected output: A sample tool in the test project returns the scope it observes, a second sample tool has a declared scope parameter and a third an undeclared free-text parameter that is not checked; tokens of two tenants and of two projects of one tenant call them through the test host of AIFACTORY-TASK-979, including a token without a tenant claim, a token without a project, a call whose declared scope argument contradicts the token and a call whose free-text parameter names another tenant and is handled.. Kind: fixture. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A sample tool in the test project returns the scope it observes, a second sample tool has a declared scope parameter and a third an undeclared free-text parameter that is not checked; tokens of two tenants and of two projects of one tenant call them through the test host of AIFACTORY-TASK-979, including a token without a tenant claim, a token without a project, a call whose declared scope argument contradicts the token and a call whose free-text parameter names another tenant and is handled."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 402,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-983]",
      "number": 983
    },
    {
      "id": "AIFACTORY-TASK-984",
      "type": "task",
      "parent": "AIFACTORY-US-199",
      "title": "Verify that every handler runs under the scope of its caller",
      "sequence": "18.03.02.04",
      "description": "BEFORE DEVELOPMENT. Verify that every handler runs under the scope of its caller. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the two-tenant tests, the 401 for a missing tenant claim, the 403 for a missing project, the contradicting scope argument refused with the typed tool error `scope-mismatch`, the unchecked free-text parameter and the governance identity test pass and prove AC1 to AC3 of AIFACTORY-US-199 (ADR-0015, ADR-0022).. Kind: verification. Repository: ConnectSoft.Extensions.ModelContextProtocol.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the two-tenant tests, the 401 for a missing tenant claim, the 403 for a missing project, the contradicting scope argument refused with the typed tool error `scope-mismatch`, the unchecked free-text parameter and the governance identity test pass and prove AC1 to AC3 of AIFACTORY-US-199 (ADR-0015, ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-984]",
      "number": 984
    },
    {
      "id": "AIFACTORY-US-200",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-098",
      "title": "Model Context Protocol library: a client call to a server beyond the local process carries a token obtained through a credential port",
      "sequence": "18.03.03",
      "description": "As a platform admin, I want the client side of the library to authenticate every call to a remote server with a token it obtains through a credential port, so that no host holds a raw secret for an MCP server and no caller token is forwarded to one. The feature asks that the library authenticates every server and every client call by default. The pages of `ConnectSoft.Extensions.ModelContextProtocol` describe the hosting of a server only; a host that consumes a remote server builds its client by hand. ADR-0022 decision 6 lets the Factory consume an external server only through a connection with a credential reference from the secret broker, and states that a client never holds a raw secret; docs/planes/capability-tools/mcp.md adds that forwarding the token of a caller to a downstream server is unsafe and that a token must be scoped to the resource it is presented to. This PBI adds a client registration to the library. A client for a server on the Http transport is registered with the address of the server and a credential reference, never with a secret value; before each call the client asks a credential port for a token whose audience is that server and presents it. Registration of a remote server without a credential reference fails at start with the server named, unless the same kind of declared anonymous exception as on the server side is set. The client never reuses the token of the incoming request. A server that answers 401 ends the call with a failure the caller can classify, and the response body is not logged. A client for a Stdio server of the local process needs no credential. The credential port is an abstraction of the library; its implementation over the secret broker belongs to the service that owns connections in a later increment. Kind: enabling. Traces: adrs: ADR-0022. Depends on: AIFACTORY-US-198. Sources: model/components.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/planes/capability-tools/mcp.md.",
      "acceptanceCriteria": [
        "AC1: Given a client registered for a server on the Http transport with a credential reference, when a tool of that server is called, then the client obtains a token for the audience of that server through the credential port and presents it, and the options of the client hold a reference and never a secret value, as ADR-0022 decision 6 requires.",
        "AC2: Given the registration of a remote server without a credential reference and without a declared anonymous exception, when the host starts, then start fails with the server named; a client for a Stdio server of the local process starts without a credential (ADR-0022 decision 4 and decision 6).",
        "AC3: Given a call that arrives at a host with the token of its caller, when the host calls a downstream server through the client, then the token of the caller is never forwarded and the downstream call carries only the token obtained for that server; a downstream 401 ends the call with a classified failure and nothing of the response body is logged (docs/planes/capability-tools/mcp.md, ADR-0022 decision 6)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-985",
        "AIFACTORY-TASK-986",
        "AIFACTORY-TASK-987",
        "AIFACTORY-TASK-988"
      ],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 403,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-198"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "titlePrefix": "[AIFACTORY-US-200]",
      "number": 200
    },
    {
      "id": "AIFACTORY-TASK-985",
      "type": "task",
      "parent": "AIFACTORY-US-200",
      "title": "Credential port and client options with a credential reference",
      "sequence": "18.03.03.01",
      "description": "BEFORE DEVELOPMENT. Credential port and client options with a credential reference. Expected output: The library defines a credential port that returns a token for a named server and audience, and client options that carry the server address, the transport and a credential reference; the options type has no member for a secret value and its validator names a remote server that has no reference.. Kind: contract. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The library defines a credential port that returns a token for a named server and audience, and client options that carry the server address, the transport and a credential reference; the options type has no member for a secret value and its validator names a remote server that has no reference."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 403,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-985]",
      "number": 985
    },
    {
      "id": "AIFACTORY-TASK-986",
      "type": "task",
      "parent": "AIFACTORY-US-200",
      "title": "Client registration that obtains a token per call and never forwards the caller token",
      "sequence": "18.03.03.02",
      "description": "BEFORE DEVELOPMENT. Client registration that obtains a token per call and never forwards the caller token. Expected output: A registration extension of the library builds a client for a registered server; on the Http transport it asks the credential port for a token before each call and presents it, it never reads the token of the incoming request, and a 401 of the server ends the call with a classified failure without logging the response body.. Kind: implementation. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A registration extension of the library builds a client for a registered server; on the Http transport it asks the credential port for a token before each call and presents it, it never reads the token of the incoming request, and a 401 of the server ends the call with a classified failure without logging the response body."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-986]",
      "number": 986
    },
    {
      "id": "AIFACTORY-TASK-987",
      "type": "task",
      "parent": "AIFACTORY-US-200",
      "title": "Fake credential port and a protected test server for the client tests",
      "sequence": "18.03.03.03",
      "description": "BEFORE DEVELOPMENT. Fake credential port and a protected test server for the client tests. Expected output: A fake credential port issues tokens per audience and records each request; the protected test host of AIFACTORY-TASK-979 acts as the remote server and records the token it receives, so that a test can assert which token arrived.. Kind: fixture. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A fake credential port issues tokens per audience and records each request; the protected test host of AIFACTORY-TASK-979 acts as the remote server and records the token it receives, so that a test can assert which token arrived."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 403,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-987]",
      "number": 987
    },
    {
      "id": "AIFACTORY-TASK-988",
      "type": "task",
      "parent": "AIFACTORY-US-200",
      "title": "Verify the authenticated client call and the start refusal",
      "sequence": "18.03.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the authenticated client call and the start refusal. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the tests of the token per call, the start refusal without a credential reference and the absence of a forwarded caller token pass and prove AC1 to AC3 of AIFACTORY-US-200 (ADR-0022).. Kind: verification. Repository: ConnectSoft.Extensions.ModelContextProtocol.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the tests of the token per call, the start refusal without a credential reference and the absence of a forwarded caller token pass and prove AC1 to AC3 of AIFACTORY-US-200 (ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-988]",
      "number": 988
    },
    {
      "id": "AIFACTORY-US-201",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-098",
      "title": "Model Context Protocol library: the package is built, tested and published to the ConnectSoft feed with the version the consumers pin",
      "sequence": "18.03.04",
      "description": "As a platform admin, I want proof that the library with the authorization default is on the ConnectSoft feed with a version a consumer can pin, so that every host that maps an MCP endpoint is protected by restoring that version. This PBI is the publication proof of the feature. The library is consumed by the agent host template, by the worker template for its operations tools and by the AI skills library template, and docs/planes/capability-tools/mcp.md records that the agent host maps its endpoint without authorization on the version it pins today. The pipeline of the library builds, tests, packs and pushes the package to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to, which decision D114 makes the Factory feed; the publication stage runs only when the tests pass and refuses a version that is already on the feed. A probe proves the change from the side of a consumer: a clean host that has the ConnectSoft feed as its only source restores the published version, configures the authorization servers and the resource of an Http server, leaves `Enabled` at its default, and a call without a token is refused; a second probe host that still switches authorization off without a declared exception fails at start; a third probe host that maps an Http server with no authorization setting at all fails at start with `ResourceUri` and `AuthorizationServers` named. The pages of the library state the new defaults and carry a migration note for a host that relied on anonymous access: declare the exception with its reason or configure `ResourceUri` and `AuthorizationServers`. The published version is recorded in the Runbook page, where the consuming templates read their pin. A host on an earlier version is not protected by this feature; moving the pins is work of the features that own those templates. Kind: evidence. Traces: adrs: ADR-0022, ADR-0028. Depends on: AIFACTORY-US-198, AIFACTORY-US-199, AIFACTORY-US-200. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/planes/capability-tools/mcp.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the library repository, when it runs after the work of the feature, then the package is built, tested, packed and pushed to the ConnectSoft feed, the publication stage runs only after the tests pass and refuses a version that is already on the feed, and the published version is recorded in the Runbook page of the library (ADR-0028, model/backlog/epics.yaml).",
        "AC2: Given clean probe hosts with the ConnectSoft feed as their only package source, when the first restores the published version, configures `ResourceUri` and `AuthorizationServers` and leaves `Enabled` at its default, then a call without a token is refused with 401; when the second switches authorization off without a declared exception and the third maps an Http server with no authorization setting at all, then each fails at start with the setting named, which is the default ADR-0022 decision 4 requires.",
        "AC3: Given the pages of the library, when a maintainer of a consuming host reads them, then the Features page states authorization on by default, the scope accessor and the client credential port, and a migration note explains the declared anonymous exception with its reason, which is the documented exception per server of ADR-0022 decision 4."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-989",
        "AIFACTORY-TASK-990",
        "AIFACTORY-TASK-991",
        "AIFACTORY-TASK-992"
      ],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 404,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-198",
        "AIFACTORY-US-199",
        "AIFACTORY-US-200"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "titlePrefix": "[AIFACTORY-US-201]",
      "number": 201
    },
    {
      "id": "AIFACTORY-TASK-989",
      "type": "task",
      "parent": "AIFACTORY-US-201",
      "title": "Publication stage with the version guard in the library pipeline",
      "sequence": "18.03.04.01",
      "description": "BEFORE DEVELOPMENT. Publication stage with the version guard in the library pipeline. Expected output: The pipeline of the library pushes the package to the ConnectSoft feed after the tests pass; a version already on the feed is refused with the reason and the run fails; the published version is written to the Runbook page.. Kind: operations. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: azure-pipelines.yml publishes after the tests; a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipeline of the library pushes the package to the ConnectSoft feed after the tests pass; a version already on the feed is refused with the reason and the run fails; the published version is written to the Runbook page."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 404,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-989]",
      "number": 989
    },
    {
      "id": "AIFACTORY-TASK-990",
      "type": "task",
      "parent": "AIFACTORY-US-201",
      "title": "Feed probe hosts for the published package",
      "sequence": "18.03.04.02",
      "description": "BEFORE DEVELOPMENT. Feed probe hosts for the published package. Expected output: Three probe hosts with the ConnectSoft feed as their only source restore the published version: the first configures the authority and the resource (`AuthorizationServers` and `ResourceUri`), leaves `Enabled` at its default and refuses a call without a token with 401; the second switches authorization off without an exception and fails at start; the third maps an Http server with no authorization setting and fails at start with `ResourceUri` and `AuthorizationServers` named; all three run as the last stage of the pipeline.. Kind: fixture. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "Three probe hosts with the ConnectSoft feed as their only source restore the published version: the first configures the authority and the resource (`AuthorizationServers` and `ResourceUri`), leaves `Enabled` at its default and refuses a call without a token with 401; the second switches authorization off without an exception and fails at start; the third maps an Http server with no authorization setting and fails at start with `ResourceUri` and `AuthorizationServers` named; all three run as the last stage of the pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 404,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-990]",
      "number": 990
    },
    {
      "id": "AIFACTORY-TASK-991",
      "type": "task",
      "parent": "AIFACTORY-US-201",
      "title": "Library pages state the new defaults and the migration note",
      "sequence": "18.03.04.03",
      "description": "BEFORE DEVELOPMENT. Library pages state the new defaults and the migration note. Expected output: The Features, Getting Started and Runbook pages of the library describe authorization on by default, the declared anonymous exception, the scope accessor, the typed tool error `scope-mismatch` for a contradicting scope argument, the required agent identity and the client credential port, with a migration note for a host that relied on anonymous access.. Kind: documentation. Repository: ConnectSoft.Extensions.ModelContextProtocol. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Features, Getting Started and Runbook pages of the library describe authorization on by default, the declared anonymous exception, the scope accessor, the typed tool error `scope-mismatch` for a contradicting scope argument, the required agent identity and the client credential port, with a migration note for a host that relied on anonymous access."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 404,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-991]",
      "number": 991
    },
    {
      "id": "AIFACTORY-TASK-992",
      "type": "task",
      "parent": "AIFACTORY-US-201",
      "title": "Verify the published package by the probe hosts",
      "sequence": "18.03.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the published package by the probe hosts. Expected output: One pipeline run publishes the package and the three probe hosts behave as stated; a rerun with the same version is refused; the runs prove AC1 to AC3 of AIFACTORY-US-201 (ADR-0022, ADR-0028).. Kind: verification. Repository: ConnectSoft.Extensions.ModelContextProtocol.",
      "acceptanceCriteria": [
        "One pipeline run publishes the package and the three probe hosts behave as stated; a rerun with the same version is refused; the runs prove AC1 to AC3 of AIFACTORY-US-201 (ADR-0022, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-992]",
      "number": 992
    },
    {
      "id": "AIFACTORY-US-098",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-098",
      "title": "Model Context Protocol library: authenticated by default is delivered and proven by its consumers",
      "sequence": "18.03.05",
      "description": "As a platform admin, I want Extensions.ModelContextProtocol to carry authenticated by default, so that it serves MCP hosting and governance without later rework. This is the integration PBI of the feature. A platform admin takes the Model Context Protocol library from a server that accepts anonymous calls by default to a published package in which an Http server requires authorization unless an exception is declared, every tool handler and the governance layer run under the tenant, the project and the identity of the authenticated caller, and a client call to a remote server carries a token obtained through a credential port. The implementation lives in the earlier PBIs of this file; this PBI proves them together. An unauthenticated call is refused and no tool runs, an authenticated call reaches the handler with its scope, a token without a tenant claim is answered 401 and a token without a project 403, a scope argument that contradicts the token is refused with the typed tool error `scope-mismatch`, and the package is on the ConnectSoft feed with a recorded version. The feature is done when no tool path of a host built on the published version bypasses authorization and scope, which is what the governed executor of ADR-0022 needs from the library. Repository of the feature: ConnectSoft.Extensions.ModelContextProtocol. The services that reach the library in a later increment are the agent runtime, the server registry and the tool adapter. Kind: enabling. Traces: adrs: ADR-0015, ADR-0022, ADR-0028. Depends on: AIFACTORY-US-198, AIFACTORY-US-199, AIFACTORY-US-200, AIFACTORY-US-201. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/planes/capability-tools/mcp.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repository ConnectSoft.Extensions.ModelContextProtocol, when its pipeline runs, then the package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-163 (authentication and scope on MCP calls by default) is done, then an unauthenticated MCP call is refused and an authenticated one reaches the tool handler with tenant and project scope, as ADR-0022 decision 2 and decision 4 require.",
        "AC3: Given a host built on the published version, when its tools are called with a token of one tenant and then of another, then each handler observes only the scope of its caller, a token without a tenant claim is answered 401 and a token without a project 403, and a client call to a remote server carries a token from the credential port and never the token of the caller (ADR-0015 decision 2, ADR-0022 decision 6).",
        "AC4: Given the documentation site after the delivery, when docs/planes/capability-tools/mcp.md is read, then it describes authorization on by default for the Http transport, the declared anonymous exception, the scope handed to tool handlers and the client credential port, and no longer states the earlier defaults as the current state (ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-993",
        "AIFACTORY-TASK-685"
      ],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 405,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-198",
        "AIFACTORY-US-199",
        "AIFACTORY-US-200",
        "AIFACTORY-US-201"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/planes/capability-tools/mcp.md"
      ],
      "titlePrefix": "[AIFACTORY-US-098]",
      "number": 98
    },
    {
      "id": "AIFACTORY-TASK-993",
      "type": "task",
      "parent": "AIFACTORY-US-098",
      "title": "Tools page of the documentation site revised to the delivered defaults",
      "sequence": "18.03.05.01",
      "description": "BEFORE DEVELOPMENT. Tools page of the documentation site revised to the delivered defaults. Expected output: docs/planes/capability-tools/mcp.md describes the library with authorization on by default for the Http transport, the declared anonymous exception, the scope handed to tool handlers and the client credential port, and no longer states the earlier defaults as the current state.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "docs/planes/capability-tools/mcp.md describes the library with authorization on by default for the Http transport, the declared anonymous exception, the scope handed to tool handlers and the client credential port, and no longer states the earlier defaults as the current state."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 405,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-993]",
      "number": 993
    },
    {
      "id": "AIFACTORY-TASK-685",
      "type": "task",
      "parent": "AIFACTORY-US-098",
      "title": "Verify mcp-delivered by running the declared command",
      "sequence": "18.03.05.02",
      "description": "BEFORE DEVELOPMENT. Verify mcp-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and the probe hosts against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-098, and the revised page of AIFACTORY-TASK-993 proves AC4.. Kind: verification. Repository: ConnectSoft.Extensions.ModelContextProtocol.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and the probe hosts against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-098, and the revised page of AIFACTORY-TASK-993 proves AC4."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.ModelContextProtocol"
      ],
      "children": [],
      "buildOrder": 4,
      "phase": "templates-and-libraries",
      "stackRank": 405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-685]",
      "number": 685
    },
    {
      "id": "AIFACTORY-FEAT-099",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "SaaS libraries: tenancy filters for Orleans grains",
      "sequence": "18.04",
      "description": "The SaaS extension libraries resolve the tenant from the trusted scope inside Orleans grains and apply tenant filters to grain persistence and messaging, as they already do for HTTP requests. Component: Extensions.Saas.* libraries (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 5 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-202",
        "AIFACTORY-US-203",
        "AIFACTORY-US-204",
        "AIFACTORY-US-205",
        "AIFACTORY-US-099"
      ],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 500,
      "titlePrefix": "[AIFACTORY-FEAT-099]",
      "number": 99
    },
    {
      "id": "AIFACTORY-US-202",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-099",
      "title": "SaaS libraries: the tenant travels in the Orleans call context and a call to a tenant-scoped grain without it is refused",
      "sequence": "18.04.01",
      "description": "As a platform admin, I want the tenant of a request to follow every grain call inside the silo and between client and silo, so that a grain never runs on behalf of an unknown tenant and never has to trust a tenant passed as a method argument. The SaaS libraries resolve the tenant of an HTTP request, of a gRPC call and of a MassTransit or NServiceBus message into a scoped `ITenantContext`. For Orleans the package `ConnectSoft.Extensions.Saas.Orleans` ships one helper, `SaasGrainIdentityFormatter.FormatComposite`, which joins a tenant id and an aggregate id into a grain key, and its Integration page warns that Orleans remoting does not set the tenant context inside the silo and that client and silo need their own resolution. The canonical tenancy decision that ADR-0015 inherits names the Orleans call context as a carrier of the tenant id and requires a fail-closed answer on conflicting evidence. This PBI adds the missing carrier. An outgoing grain call filter copies the tenant of the current context into the call context under the tenant key the libraries already use for gRPC and messaging metadata; an incoming grain call filter restores a mutable tenant context for the duration of the call. The default is fail closed, as decision D114 settles: every grain type is tenant-scoped unless it is marked as a host-level grain or its assembly is listed as host-level in the registration, which is how the grains of another library, such as the messaging adapter, are exempted, and no option admits a grain without a tenant in any other way. The default changes what a silo with the filters admits, so the package releases it as a new major version, and an existing consumer adds its exemptions, the marker on its own host-level grains and the assembly entries of the libraries it hosts, when it takes that version; a grain it did not exempt is refused and never admitted by a fallback. A call to a tenant-scoped grain that arrives without a tenant is refused before the grain method runs, with a typed error that names the grain type, and the refusal is counted. When the grain key was built with the composite formatter and its tenant part differs from the tenant of the call, the call is refused as well. The tenant is never read from a method argument. One registration on the silo builder and one on the client builder turn the filters on. The project, run and attempt identity of the Factory scope are not part of the SaaS libraries; the Factory service profile of the base template carries them. The test silo that exercises the filters lives in a testing project of the Orleans repository, published as the package `ConnectSoft.Extensions.Saas.Orleans.Testing`; the existing package `ConnectSoft.Extensions.Saas.Testing`, which holds `FixedTenantContext` and references only the abstractions package, gains nothing that references Orleans. Kind: enabling. Traces: adrs: ADR-0011, ADR-0015, ADR-0024. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0011-multi-tenant-isolation-strategy.md.",
      "acceptanceCriteria": [
        "AC1: Given a silo and a client that register the tenant filters of the package `ConnectSoft.Extensions.Saas.Orleans`, when a request of one tenant calls a grain that calls a second grain, then both grain methods observe the tenant of the request through `ITenantContext`, carried in the Orleans call context under the tenant key of the libraries, which is the carrier the tenancy decision inherited by ADR-0015 names.",
        "AC2: Given a call to a tenant-scoped grain that arrives without a tenant in the call context, when the incoming filter runs, then the call is refused before the grain method executes with a typed error naming the grain type and the refusal is counted; a grain marked as host-level, or one whose assembly the registration lists, accepts the call, every other grain is tenant-scoped and no option admits it without a tenant, and an existing consumer adds these exemptions when it takes the new major version of the package, as the migration note of the Integration page tells it (ADR-0011, ADR-0015 decision 2 takes the tenant from the authenticated context only).",
        "AC3: Given a grain whose key was built with `SaasGrainIdentityFormatter.FormatComposite` for one tenant, when a call that carries another tenant addresses it, then the call is refused as conflicting evidence and the grain state is not read; the tenant is never taken from a method argument, and a unit test covers both refusals (ADR-0015, ADR-0024 decision 1 makes grains the substrate these calls reach)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0011-multi-tenant-isolation-strategy.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-164",
        "AIFACTORY-TASK-994",
        "AIFACTORY-TASK-995",
        "AIFACTORY-TASK-996"
      ],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 501,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0011",
          "ADR-0015",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0011-multi-tenant-isolation-strategy.md"
      ],
      "titlePrefix": "[AIFACTORY-US-202]",
      "number": 202
    },
    {
      "id": "AIFACTORY-TASK-164",
      "type": "task",
      "parent": "AIFACTORY-US-202",
      "title": "Tenant context inside grains and grain storage",
      "sequence": "18.04.01.01",
      "description": "BEFORE DEVELOPMENT. Tenant context inside grains and grain storage. Expected output: The package `ConnectSoft.Extensions.Saas.Orleans` holds an outgoing grain call filter that writes the tenant of the current `ITenantContext` to the call context and an incoming filter that restores a mutable tenant context for the call; one extension on the silo builder and one on the client builder register them; a grain call without tenant context fails before the grain method runs.. Kind: implementation. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.Saas.Orleans` holds an outgoing grain call filter that writes the tenant of the current `ITenantContext` to the call context and an incoming filter that restores a mutable tenant context for the call; one extension on the silo builder and one on the client builder register them; a grain call without tenant context fails before the grain method runs."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-164]",
      "number": 164
    },
    {
      "id": "AIFACTORY-TASK-994",
      "type": "task",
      "parent": "AIFACTORY-US-202",
      "title": "Host-level grain marker and the key consistency check",
      "sequence": "18.04.01.02",
      "description": "BEFORE DEVELOPMENT. Host-level grain marker and the key consistency check. Expected output: The package `ConnectSoft.Extensions.Saas.Orleans` defines the marker of a host-level grain, accepts a list of host-level assemblies in the registration and treats every other grain as tenant-scoped; the incoming filter compares the tenant part of a composite grain key with the tenant of the call and refuses a difference with a typed error; refusals are counted on the meter of the package; the fail-closed default has no switch and is released as a new major version of the package, whose migration note tells an existing consumer to add the marker or the assembly entry for its host-level grains.. Kind: implementation. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.Saas.Orleans` defines the marker of a host-level grain, accepts a list of host-level assemblies in the registration and treats every other grain as tenant-scoped; the incoming filter compares the tenant part of a composite grain key with the tenant of the call and refuses a difference with a typed error; refusals are counted on the meter of the package; the fail-closed default has no switch and is released as a new major version of the package, whose migration note tells an existing consumer to add the marker or the assembly entry for its host-level grains."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-994]",
      "number": 994
    },
    {
      "id": "AIFACTORY-TASK-995",
      "type": "task",
      "parent": "AIFACTORY-US-202",
      "title": "Test silo with two tenants in a testing package of the Orleans repository",
      "sequence": "18.04.01.03",
      "description": "BEFORE DEVELOPMENT. Test silo with two tenants in a testing package of the Orleans repository. Expected output: A testing project in the solution of the Orleans repository, published as the package `ConnectSoft.Extensions.Saas.Orleans.Testing` and built with a project reference to the Orleans package, holds a test silo and client with the tenant filters registered and a helper that runs a block of calls as a given tenant, so that the tests of this feature and of consuming services exercise two tenants against the same grains; `ConnectSoft.Extensions.Saas.Testing`, which holds `FixedTenantContext` and references only the abstractions package, gains nothing that references Orleans.. Kind: fixture. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A testing project in the solution of the Orleans repository, published as the package `ConnectSoft.Extensions.Saas.Orleans.Testing` and built with a project reference to the Orleans package, holds a test silo and client with the tenant filters registered and a helper that runs a block of calls as a given tenant, so that the tests of this feature and of consuming services exercise two tenants against the same grains; `ConnectSoft.Extensions.Saas.Testing`, which holds `FixedTenantContext` and references only the abstractions package, gains nothing that references Orleans."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 501,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-995]",
      "number": 995
    },
    {
      "id": "AIFACTORY-TASK-996",
      "type": "task",
      "parent": "AIFACTORY-US-202",
      "title": "Verify the propagation and the two refusals on the test silo",
      "sequence": "18.04.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the propagation and the two refusals on the test silo. Expected output: Run `dotnet test -c Release --no-build` on the solution of the Orleans repository, whose tests use the test silo by project reference; the tests of the nested grain call, the call without tenant, the grain exempted by the marker, the grain exempted by an assembly entry and the conflicting grain key pass and prove AC1 to AC3 of AIFACTORY-US-202 (ADR-0015).. Kind: verification. Repository: ConnectSoft.Extensions.Saas.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the solution of the Orleans repository, whose tests use the test silo by project reference; the tests of the nested grain call, the call without tenant, the grain exempted by the marker, the grain exempted by an assembly entry and the conflicting grain key pass and prove AC1 to AC3 of AIFACTORY-US-202 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-996]",
      "number": 996
    },
    {
      "id": "AIFACTORY-US-203",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-099",
      "title": "SaaS libraries: grain state and the loads of a unit of work opened in a grain are filtered by the tenant of the call",
      "sequence": "18.04.02",
      "description": "As a platform admin, I want grain storage and the persistence a grain opens to apply the tenant of the call without code in each grain, so that state of one tenant is never visible to an activation that serves another. The Integration page of `ConnectSoft.Extensions.Saas.Orleans` separates two problems: the grain key, which the composite formatter solves, and the database filter, which the package `ConnectSoft.Extensions.Saas.NHibernate` solves for a session when its tenant filter is enabled inside a scoped tenant boundary. It states that grain code which opens a unit of work uses the tenant context independently. The NHibernate package already has the registration `AddConnectSoftSaasNHibernateTenantFilter`, which registers a scoped unit of work that calls `TryEnableSaasTenantFilter`; what a grain call lacks is a tenant context for that unit of work to read. The tenancy decision that ADR-0015 inherits requires that a load from a shared database never bypasses a tenant predicate, and ADR-0024 decision 1 makes grains the place where attempt and workflow run state is persisted. This PBI adds the link on both paths. A grain storage decorator stamps the tenant of the call on the state it writes and checks the stamp on every read: state written for one tenant is not returned to a call of another, the read fails closed with a typed error, and nothing of the foreign state is logged. The grain path extends the existing registration: a unit of work opened inside a grain call takes the filter value from the tenant context the incoming grain call filter restored, without a call in the grain and without a second enabling mechanism, and opening one in a tenant-scoped grain without a tenant fails before a query is sent. Host-level grains write state without a stamp and never read stamped state. The decorator wraps any registered grain storage provider, so the choice of provider stays with the host. Kind: enabling. Traces: adrs: ADR-0011, ADR-0015, ADR-0024. Depends on: AIFACTORY-US-202. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given a tenant-scoped grain with the storage decorator registered, when it writes its state under one tenant and an activation called under another tenant reads the same storage key, then the read fails closed with a typed error and returns nothing of the foreign state, proven by a test with two tenants (ADR-0015, ADR-0024 decision 1).",
        "AC2: Given a grain call with a restored tenant context, when the grain opens a unit of work on a shared database, then the tenant filter of the package `ConnectSoft.Extensions.Saas.NHibernate` is enabled for that session through its existing registration `AddConnectSoftSaasNHibernateTenantFilter`, without code in the grain and without a second enabling mechanism, and a load returns only rows of the tenant of the call, which is the rule that a shared load never bypasses a tenant predicate (ADR-0011, ADR-0015).",
        "AC3: Given a tenant-scoped grain called without a tenant or a host-level grain, when persistence is used, then the first fails before a query is sent and the second writes state without a tenant stamp and cannot read stamped state; the decorator wraps whichever grain storage provider the host registered (ADR-0015 decision 2)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-997",
        "AIFACTORY-TASK-998",
        "AIFACTORY-TASK-999",
        "AIFACTORY-TASK-1000"
      ],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 502,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0011",
          "ADR-0015",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-202"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-203]",
      "number": 203
    },
    {
      "id": "AIFACTORY-TASK-997",
      "type": "task",
      "parent": "AIFACTORY-US-203",
      "title": "Tenant-stamping grain storage decorator",
      "sequence": "18.04.02.01",
      "description": "BEFORE DEVELOPMENT. Tenant-stamping grain storage decorator. Expected output: The package `ConnectSoft.Extensions.Saas.Orleans` holds a grain storage decorator that stamps the tenant of the call on written state, checks the stamp on read and fails closed with a typed error on a difference; a registration extension wraps a named storage provider; host-level grains bypass the stamp.. Kind: implementation. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.Saas.Orleans` holds a grain storage decorator that stamps the tenant of the call on written state, checks the stamp on read and fails closed with a typed error on a difference; a registration extension wraps a named storage provider; host-level grains bypass the stamp."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-997]",
      "number": 997
    },
    {
      "id": "AIFACTORY-TASK-998",
      "type": "task",
      "parent": "AIFACTORY-US-203",
      "title": "Tenant filter enabled for a unit of work opened inside a grain call",
      "sequence": "18.04.02.02",
      "description": "BEFORE DEVELOPMENT. Tenant filter enabled for a unit of work opened inside a grain call. Expected output: The registration `AddConnectSoftSaasNHibernateTenantFilter` of the package `ConnectSoft.Extensions.Saas.NHibernate` is extended for the grain path: the scoped unit of work it registers takes the filter value, through the existing `TryEnableSaasTenantFilter`, from the tenant context the incoming grain call filter restored for the call, and no second enabling mechanism is added; opening a unit of work in a tenant-scoped grain without a tenant fails before a query is sent; the package gains no Orleans reference, because it reads the tenant context of the abstractions package.. Kind: implementation. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The registration `AddConnectSoftSaasNHibernateTenantFilter` of the package `ConnectSoft.Extensions.Saas.NHibernate` is extended for the grain path: the scoped unit of work it registers takes the filter value, through the existing `TryEnableSaasTenantFilter`, from the tenant context the incoming grain call filter restored for the call, and no second enabling mechanism is added; opening a unit of work in a tenant-scoped grain without a tenant fails before a query is sent; the package gains no Orleans reference, because it reads the tenant context of the abstractions package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-998]",
      "number": 998
    },
    {
      "id": "AIFACTORY-TASK-999",
      "type": "task",
      "parent": "AIFACTORY-US-203",
      "title": "Two-tenant persistence fixture on the test silo",
      "sequence": "18.04.02.03",
      "description": "BEFORE DEVELOPMENT. Two-tenant persistence fixture on the test silo. Expected output: A sample grain with stored state and a mapped entity runs on the test silo of AIFACTORY-TASK-995, on two paths. The storage decorator case lives in the test project of the Orleans repository against an in-memory storage provider. The grain plus unit-of-work case lives in the test project of the NHibernate repository, which references the published packages `ConnectSoft.Extensions.Saas.Orleans` and `ConnectSoft.Extensions.Saas.Orleans.Testing` and a test database. On both paths the fixture writes as one tenant and reads as another.. Kind: fixture. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A sample grain with stored state and a mapped entity runs on the test silo of AIFACTORY-TASK-995, on two paths. The storage decorator case lives in the test project of the Orleans repository against an in-memory storage provider. The grain plus unit-of-work case lives in the test project of the NHibernate repository, which references the published packages `ConnectSoft.Extensions.Saas.Orleans` and `ConnectSoft.Extensions.Saas.Orleans.Testing` and a test database. On both paths the fixture writes as one tenant and reads as another."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-999]",
      "number": 999
    },
    {
      "id": "AIFACTORY-TASK-1000",
      "type": "task",
      "parent": "AIFACTORY-US-203",
      "title": "Verify that grain state and loads never cross tenants",
      "sequence": "18.04.02.04",
      "description": "BEFORE DEVELOPMENT. Verify that grain state and loads never cross tenants. Expected output: Run `dotnet test -c Release --no-build` on the solution of the Orleans repository for the storage decorator and on the solution of the NHibernate repository for the unit of work opened in a grain; the two-tenant tests of both pass and prove AC1 to AC3 of AIFACTORY-US-203 (ADR-0015).. Kind: verification. Repository: ConnectSoft.Extensions.Saas.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the solution of the Orleans repository for the storage decorator and on the solution of the NHibernate repository for the unit of work opened in a grain; the two-tenant tests of both pass and prove AC1 to AC3 of AIFACTORY-US-203 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1000]",
      "number": 1000
    },
    {
      "id": "AIFACTORY-US-204",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-099",
      "title": "SaaS libraries: the tenant is carried on messages of the Orleans messaging profile and restored before a handler runs",
      "sequence": "18.04.03",
      "description": "As a platform admin, I want a message published through the Orleans messaging profile to carry the tenant of its publisher and a handler to run under that tenant, so that the default messaging profile of Factory hosts is as tenant-safe as the broker profiles already are. The SaaS libraries carry the tenant on messages of two transports: the MassTransit package has publish, send and consume filters and the NServiceBus package an incoming behaviour, both on the messaging header name of the abstractions package. Nothing exists for the Orleans messaging adapter, although ADR-0012 makes it a transport profile, Factory hosts use it by default, and docs/architecture/ecosystem-composition.md lists messaging propagation as missing for this component. The adapter stores the headers a publisher supplies on its outbox record and hands them to the consumer with the message context, so the tenant can travel there without a change of the adapter. This PBI adds the pair for the Orleans profile as a new package of the family, `ConnectSoft.Extensions.Saas.Messaging.Orleans`, beside `ConnectSoft.Extensions.Saas.Messaging.MassTransit` and `ConnectSoft.Extensions.Saas.Messaging.NServiceBus`, because the family keeps messaging propagation in one package per transport. The new package references `ConnectSoft.Extensions.MessagingModel.Orleans` and the abstractions package; `ConnectSoft.Extensions.Saas.Orleans` keeps referencing only the abstractions package and the Orleans SDK, so a silo that wants only the grain call filters takes no messaging reference. Whether the owner prefers one Orleans package instead is reported as an open question. On publish and send, the tenant of the current context is written to the tenant header of a message; publishing a tenant-scoped message without a tenant fails before the outbox record is written, so nothing is stored. On consume, the tenant header is restored into a mutable tenant context before the handler runs, together with the grain call filters of the earlier PBI. A tenant-scoped message that arrives without the header is not handled; it goes to the poison handling of the profile with the reason recorded. The header name and the marker of a tenant-scoped message are those of the abstractions package, so a message keeps its tenant when a host changes its profile. ADR-0012 decision 2 asks every profile to declare its tenant isolation with evidence from its own tests; the round trip test of this PBI is that evidence for the Orleans profile. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0015. Depends on: AIFACTORY-US-202. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a host on the Orleans messaging profile with the tenant propagation of the package `ConnectSoft.Extensions.Saas.Messaging.Orleans` registered, when a handler of one tenant publishes a message and the inbox dispatches it, then the outbox record carries the tenant header and the consuming handler observes the same tenant through `ITenantContext`, on the header name the MassTransit and NServiceBus packages use (ADR-0012 decision 2, ADR-0015).",
        "AC2: Given a tenant-scoped message, when it is published without a tenant in the current context, then publication fails before an outbox record is written; when such a message arrives without the tenant header, then no handler runs and the message goes to the poison handling of the profile with the reason recorded (ADR-0014 decision 1 makes the tenant a required field of a Factory message).",
        "AC3: Given messages of two tenants on the same queue, when they are dispatched in turn, then each handler runs under the tenant of its own message and the context of one is never visible to the other; the round trip test is recorded as the tenant isolation evidence ADR-0012 decision 2 requires of the profile (docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1001",
        "AIFACTORY-TASK-1002",
        "AIFACTORY-TASK-1003",
        "AIFACTORY-TASK-1004"
      ],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 503,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-202"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-204]",
      "number": 204
    },
    {
      "id": "AIFACTORY-TASK-1001",
      "type": "task",
      "parent": "AIFACTORY-US-204",
      "title": "Tenant header on publish and send through the Orleans messaging profile",
      "sequence": "18.04.03.01",
      "description": "BEFORE DEVELOPMENT. Tenant header on publish and send through the Orleans messaging profile. Expected output: The new package `ConnectSoft.Extensions.Saas.Messaging.Orleans`, which references `ConnectSoft.Extensions.MessagingModel.Orleans` and `ConnectSoft.Extensions.Saas.Abstractions`, decorates publish and send of the messaging port so that the tenant of the current context is written to the tenant header of the message, on the header name and with the marker of a tenant-scoped message of the abstractions package; publishing a tenant-scoped message without a tenant fails before the outbox record is written; `ConnectSoft.Extensions.Saas.Orleans` gains no messaging reference.. Kind: implementation. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The new package `ConnectSoft.Extensions.Saas.Messaging.Orleans`, which references `ConnectSoft.Extensions.MessagingModel.Orleans` and `ConnectSoft.Extensions.Saas.Abstractions`, decorates publish and send of the messaging port so that the tenant of the current context is written to the tenant header of the message, on the header name and with the marker of a tenant-scoped message of the abstractions package; publishing a tenant-scoped message without a tenant fails before the outbox record is written; `ConnectSoft.Extensions.Saas.Orleans` gains no messaging reference."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1001]",
      "number": 1001
    },
    {
      "id": "AIFACTORY-TASK-1002",
      "type": "task",
      "parent": "AIFACTORY-US-204",
      "title": "Tenant restored on consume and a message without tenant refused",
      "sequence": "18.04.03.02",
      "description": "BEFORE DEVELOPMENT. Tenant restored on consume and a message without tenant refused. Expected output: The package `ConnectSoft.Extensions.Saas.Messaging.Orleans` restores a mutable tenant context from the tenant header of the message context before a handler runs; a tenant-scoped message without the header is not handled and is handed to the poison handling of the profile with the reason.. Kind: implementation. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Extensions.Saas.Messaging.Orleans` restores a mutable tenant context from the tenant header of the message context before a handler runs; a tenant-scoped message without the header is not handled and is handed to the poison handling of the profile with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1002]",
      "number": 1002
    },
    {
      "id": "AIFACTORY-TASK-1003",
      "type": "task",
      "parent": "AIFACTORY-US-204",
      "title": "Outbox to inbox round trip fixture for two tenants",
      "sequence": "18.04.03.03",
      "description": "BEFORE DEVELOPMENT. Outbox to inbox round trip fixture for two tenants. Expected output: A fixture in the test project of the package `ConnectSoft.Extensions.Saas.Messaging.Orleans`, on the test silo of the published package `ConnectSoft.Extensions.Saas.Orleans.Testing`, runs the Orleans messaging adapter with an outbox and an inbox, publishes messages of two tenants and a message without tenant, and records the tenant each handler observed.. Kind: fixture. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A fixture in the test project of the package `ConnectSoft.Extensions.Saas.Messaging.Orleans`, on the test silo of the published package `ConnectSoft.Extensions.Saas.Orleans.Testing`, runs the Orleans messaging adapter with an outbox and an inbox, publishes messages of two tenants and a message without tenant, and records the tenant each handler observed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 503,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1003]",
      "number": 1003
    },
    {
      "id": "AIFACTORY-TASK-1004",
      "type": "task",
      "parent": "AIFACTORY-US-204",
      "title": "Verify the tenant round trip on the Orleans messaging profile",
      "sequence": "18.04.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the tenant round trip on the Orleans messaging profile. Expected output: Run `dotnet test -c Release --no-build` on the solution of the package `ConnectSoft.Extensions.Saas.Messaging.Orleans`; the round trip, the refused publication and the unhandled message tests pass and prove AC1 to AC3 of AIFACTORY-US-204 (ADR-0012, ADR-0015).. Kind: verification. Repository: ConnectSoft.Extensions.Saas.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the solution of the package `ConnectSoft.Extensions.Saas.Messaging.Orleans`; the round trip, the refused publication and the unhandled message tests pass and prove AC1 to AC3 of AIFACTORY-US-204 (ADR-0012, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1004]",
      "number": 1004
    },
    {
      "id": "AIFACTORY-US-205",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-099",
      "title": "SaaS libraries: the Orleans, Orleans testing, NHibernate and Orleans messaging packages are published to the ConnectSoft feed in dependency order with the versions the consumers pin",
      "sequence": "18.04.04",
      "description": "As a platform admin, I want proof that the SaaS packages with the grain tenancy filters are on the ConnectSoft feed with versions a consumer can pin, so that a Factory service restores tenant isolation for grains instead of writing it. This PBI is the publication proof of the feature. Four packages are published. `ConnectSoft.Extensions.Saas.Orleans` gains the call filters and the storage decorator and publishes under a new major version, because every grain is tenant-scoped by default (decision D114), and its solution publishes the new testing package `ConnectSoft.Extensions.Saas.Orleans.Testing` with the test silo. `ConnectSoft.Extensions.Saas.NHibernate` takes its filter value from the tenant context of a grain call. The new package `ConnectSoft.Extensions.Saas.Messaging.Orleans` carries the messaging propagation. `ConnectSoft.Extensions.Saas.Abstractions` is consumed as it is on the feed and `ConnectSoft.Extensions.Saas.Testing` is not changed. Each repository has its own pipeline, which builds, tests, packs and pushes to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to, which decision D114 makes the Factory feed; a publication stage runs only when the tests pass and refuses a version that is already on the feed. The order is stated, so that no test needs a package that is not yet built: the abstractions package, then the Orleans package with its testing package from one solution, then the NHibernate package, whose grain test restores the two Orleans packages from the feed, then the Orleans messaging package. A probe proves the result from the side of a consumer: a clean silo host that has the ConnectSoft feed as its only source restores the published versions, registers the filters with one call on the silo builder and the messaging propagation with one call, and a test with two tenants shows that a grain call without tenant is refused, that state of one tenant is not visible to the other and that a message is handled under the tenant of its publisher. The Integration page of the Orleans package is rewritten: its warning that the tenant does not flow into the silo is replaced by the registration and the refusal rules, with a migration note that tells an existing consumer which exemptions to add when it takes the new major version, and the Features page lists the new types. The published versions are recorded in the Runbook pages, where the base template and the Factory services read their pins. Kind: evidence. Traces: adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-202, AIFACTORY-US-203, AIFACTORY-US-204. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/catalogs/libraries.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipelines of the Orleans, the NHibernate and the Orleans messaging repositories, when they run after the work of the feature, then the packages are built, tested, packed and pushed to the ConnectSoft feed in the stated order (the abstractions package as published, the Orleans package under a new major version with its testing package, the NHibernate package, the Orleans messaging package), a publication stage runs only after the tests pass and refuses a version that is already on the feed, and the published versions are recorded in the Runbook pages (ADR-0028, model/backlog/epics.yaml).",
        "AC2: Given a clean probe silo with the ConnectSoft feed as its only package source, when it restores the published versions and registers the tenant filters and the messaging propagation, then a grain call without tenant is refused, a test with two tenants proves that grain state of one tenant is never visible to another, and a message published by one tenant is handled under that tenant, which is the isolation ADR-0015 requires of every backend.",
        "AC3: Given the pages of the Orleans package, when a maintainer of a consuming service reads them, then the Integration page describes the registration, the host-level marker and the refusal rules in place of the earlier warning, its migration note lists the exemptions an existing consumer adds when it takes the new major version, and the Features page lists the new types, which closes the gap docs/architecture/ecosystem-composition.md records for the component (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1005",
        "AIFACTORY-TASK-1006",
        "AIFACTORY-TASK-1007",
        "AIFACTORY-TASK-1008"
      ],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 504,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-202",
        "AIFACTORY-US-203",
        "AIFACTORY-US-204"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "titlePrefix": "[AIFACTORY-US-205]",
      "number": 205
    },
    {
      "id": "AIFACTORY-TASK-1005",
      "type": "task",
      "parent": "AIFACTORY-US-205",
      "title": "Publication order and version guard in the pipelines of the SaaS packages",
      "sequence": "18.04.04.01",
      "description": "BEFORE DEVELOPMENT. Publication order and version guard in the pipelines of the SaaS packages. Expected output: The pipelines of the Orleans, the NHibernate and the Orleans messaging repositories publish to the ConnectSoft feed after the tests of each solution pass, in the order Orleans together with `ConnectSoft.Extensions.Saas.Orleans.Testing` from the same solution, then NHibernate, then `ConnectSoft.Extensions.Saas.Messaging.Orleans`, each restoring its upstream packages from the feed; the Orleans package publishes under a new major version because of the fail-closed default; the new messaging repository gets its pipeline from the definition in the repository; a version already on the feed is refused with the reason; the published versions are written to the Runbook pages.. Kind: operations. Repository: ConnectSoft.Extensions.Saas. Verification: azure-pipelines.yml of each of the three repositories publishes after its tests; a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipelines of the Orleans, the NHibernate and the Orleans messaging repositories publish to the ConnectSoft feed after the tests of each solution pass, in the order Orleans together with `ConnectSoft.Extensions.Saas.Orleans.Testing` from the same solution, then NHibernate, then `ConnectSoft.Extensions.Saas.Messaging.Orleans`, each restoring its upstream packages from the feed; the Orleans package publishes under a new major version because of the fail-closed default; the new messaging repository gets its pipeline from the definition in the repository; a version already on the feed is refused with the reason; the published versions are written to the Runbook pages."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 504,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1005]",
      "number": 1005
    },
    {
      "id": "AIFACTORY-TASK-1006",
      "type": "task",
      "parent": "AIFACTORY-US-205",
      "title": "Integration and Features pages of the Orleans package rewritten",
      "sequence": "18.04.04.02",
      "description": "BEFORE DEVELOPMENT. Integration and Features pages of the Orleans package rewritten. Expected output: The Integration page of the Orleans package describes the silo and client registration, the host-level marker, the storage decorator, the testing package and the refusal rules in place of the warning that the tenant does not flow into the silo, with a migration note on the exemptions an existing consumer adds for the new major version, and its Features page lists the new types; the pages of the package `ConnectSoft.Extensions.Saas.Messaging.Orleans` describe the registration of the messaging propagation and its two refusals.. Kind: documentation. Repository: ConnectSoft.Extensions.Saas. Verification: the documentation pipeline of each package builds its site without warnings.",
      "acceptanceCriteria": [
        "The Integration page of the Orleans package describes the silo and client registration, the host-level marker, the storage decorator, the testing package and the refusal rules in place of the warning that the tenant does not flow into the silo, with a migration note on the exemptions an existing consumer adds for the new major version, and its Features page lists the new types; the pages of the package `ConnectSoft.Extensions.Saas.Messaging.Orleans` describe the registration of the messaging propagation and its two refusals."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 504,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1006]",
      "number": 1006
    },
    {
      "id": "AIFACTORY-TASK-1007",
      "type": "task",
      "parent": "AIFACTORY-US-205",
      "title": "Feed probe silo for the published packages",
      "sequence": "18.04.04.03",
      "description": "BEFORE DEVELOPMENT. Feed probe silo for the published packages. Expected output: A probe silo host with the ConnectSoft feed as its only source restores the published versions, registers the filters and the messaging propagation with one call each and runs the two-tenant test of grain calls, grain state and a published message; the probe runs as the last stage of the pipeline of the Orleans messaging package, the last package in the order.. Kind: fixture. Repository: ConnectSoft.Extensions.Saas. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe silo host with the ConnectSoft feed as its only source restores the published versions, registers the filters and the messaging propagation with one call each and runs the two-tenant test of grain calls, grain state and a published message; the probe runs as the last stage of the pipeline of the Orleans messaging package, the last package in the order."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1007]",
      "number": 1007
    },
    {
      "id": "AIFACTORY-TASK-1008",
      "type": "task",
      "parent": "AIFACTORY-US-205",
      "title": "Verify the published packages by the probe silo",
      "sequence": "18.04.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the published packages by the probe silo. Expected output: One run of the three pipelines in their order publishes the four packages and the probe silo passes its two-tenant test; a rerun with the same version is refused; the runs prove AC1 to AC3 of AIFACTORY-US-205 (ADR-0015, ADR-0028).. Kind: verification. Repository: ConnectSoft.Extensions.Saas.",
      "acceptanceCriteria": [
        "One run of the three pipelines in their order publishes the four packages and the probe silo passes its two-tenant test; a rerun with the same version is refused; the runs prove AC1 to AC3 of AIFACTORY-US-205 (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1008]",
      "number": 1008
    },
    {
      "id": "AIFACTORY-US-099",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-099",
      "title": "SaaS libraries: tenancy filters for Orleans grains is delivered and proven by its consumers",
      "sequence": "18.04.05",
      "description": "As a platform admin, I want Extensions.Saas.* libraries to carry tenancy filters for Orleans grains, so that it serves tenant resolution per ADR-0100 without later rework. This is the integration PBI of the feature. A platform admin takes the SaaS libraries from a grain key helper to published packages in which the tenant of a request follows every grain call, grain state and the loads of a unit of work opened in a grain are filtered by that tenant, and a message of the Orleans messaging profile carries the tenant and is handled under it. The implementation lives in the earlier PBIs of this file; this PBI proves them together on one silo. A request of one tenant calls a grain that stores state, publishes a message and is handled by a second grain; the same flow runs for a second tenant; a call, a read and a message without tenant are each refused. The feature is done when no grain of a host built on the published versions runs for an unknown tenant and no state crosses tenants, as the tenancy decisions inherited by ADR-0015 require for grains in the same way as for HTTP requests. Repository of the feature: the SaaS library repositories. The services that reach these libraries in a later increment are the control plane API, the agent runtime worker and the data and event foundations. Kind: enabling. Traces: adrs: ADR-0012, ADR-0015, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-202, AIFACTORY-US-203, AIFACTORY-US-204, AIFACTORY-US-205. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repositories of the feature, when their pipelines run, then each package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-164 (tenant context inside grains and grain storage) is done, then a grain call without tenant context fails and grain state of one tenant is never visible to another, proven by a test with two tenants (ADR-0015, ADR-0024 decision 1).",
        "AC3: Given a silo built on the published versions, when one flow of grain call, stored state, published message and handling grain runs for two tenants in turn, then every step of each flow observes its own tenant only, and a call, a read and a message without tenant are each refused with the reason recorded (ADR-0012 decision 2, ADR-0015 decision 2)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1009",
        "AIFACTORY-TASK-688"
      ],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 505,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-202",
        "AIFACTORY-US-203",
        "AIFACTORY-US-204",
        "AIFACTORY-US-205"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-099]",
      "number": 99
    },
    {
      "id": "AIFACTORY-TASK-1009",
      "type": "task",
      "parent": "AIFACTORY-US-099",
      "title": "End-to-end flow of two tenants on one silo against the published packages",
      "sequence": "18.04.05.01",
      "description": "BEFORE DEVELOPMENT. End-to-end flow of two tenants on one silo against the published packages. Expected output: A consumer test project restores the published packages from the ConnectSoft feed and runs the flow of grain call, stored state, published message and handling grain for two tenants in turn, then the three refusals without tenant; the run proves AC2 and AC3 of AIFACTORY-US-099 (ADR-0015).. Kind: verification. Repository: ConnectSoft.Extensions.Saas. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A consumer test project restores the published packages from the ConnectSoft feed and runs the flow of grain call, stored state, published message and handling grain for two tenants in turn, then the three refusals without tenant; the run proves AC2 and AC3 of AIFACTORY-US-099 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1009]",
      "number": 1009
    },
    {
      "id": "AIFACTORY-TASK-688",
      "type": "task",
      "parent": "AIFACTORY-US-099",
      "title": "Verify saas-extensions-delivered by running the declared command",
      "sequence": "18.04.05.02",
      "description": "BEFORE DEVELOPMENT. Verify saas-extensions-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solutions of the Orleans, the NHibernate and the Orleans messaging repositories; they pass and prove AC1 to AC3 of AIFACTORY-US-099.. Kind: verification. Repository: ConnectSoft.Extensions.Saas.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solutions of the Orleans, the NHibernate and the Orleans messaging repositories; they pass and prove AC1 to AC3 of AIFACTORY-US-099."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Saas"
      ],
      "children": [],
      "buildOrder": 5,
      "phase": "templates-and-libraries",
      "stackRank": 505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-688]",
      "number": 688
    },
    {
      "id": "AIFACTORY-FEAT-100",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Tenancy integration: tenant resolution for the Factory",
      "sequence": "18.05",
      "description": "The Factory resolves its tenants, editions and feature entitlements from the SaaS Tenants service instead of owning them. The first outcome needs tenant resolution only; editions and entitlements follow with commercialisation. Component: SaaS Tenants service (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-163. Increment I0: Readiness. Build order 16 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-254",
        "AIFACTORY-US-255",
        "AIFACTORY-US-256",
        "AIFACTORY-US-110"
      ],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1600,
      "titlePrefix": "[AIFACTORY-FEAT-100]",
      "number": 100
    },
    {
      "id": "AIFACTORY-US-254",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-100",
      "title": "Tenancy integration: the Tenants service answers a resolution query with the tenant, its residency region and lifecycle state, and answers not found for an unknown tenant",
      "sequence": "18.05.01",
      "description": "As an asset maintainer, I want the Tenants service to answer who a tenant is, where its data resides and whether it is active, so that the Factory resolves the tenant of a token from the service that holds tenants and keeps no tenant table of its own. The Factory resolves its tenants from the SaaS Tenants service instead of holding them (BC-33), and ADR-0015 decision 4 keeps a Factory tenant and a product tenant as distinct identities and stores, so the Factory reads its own instance of the service. The first outcome needs resolution only: for the tenant a token names, the control plane needs to know that the tenant exists, the region its data resides in, which a project inherits and records, and its lifecycle state. The service contract of the template has five operations and all of them write; its REST page lists the read by identifier as a placeholder (Docs/rest-api.md of the template). This PBI adds the resolution query to the service contract, so that REST and the code-first gRPC adapter expose it from one interface as the template prescribes. The answer carries the tenant identifier, the tenant key, the residency region, the lifecycle state and the aggregate version; a suspended or decommissioned tenant is returned with its state to a workload caller that holds the resolution scope and is never hidden from it, so that the caller decides. An identifier that names no tenant is answered 404 over REST and with the not-found fault over gRPC. A workload caller needs the resolution scope and is answered 403 without it; a caller with a user token resolves only the tenant of its own token and gets 404 for any other. The resolution scope is an `svc.` scope of the workload registration file of AIFACTORY-US-245, and a workload token carries no tenant claim. The service this feature builds on is proven with the tenant claim required and no default tenant, where a principal without a tenant claim is answered 401 before the query runs, so the resolution operation is stated as what it is: the one named exemption from the tenant-claim requirement. It is open only to a workload token with the resolution scope, it sets the tenant context from the requested identifier for the single load and never from a default, and every other operation of the service still answers 401 for a principal without a tenant claim. A test plants a second exempt operation and fails, so that the exemption cannot spread. The read always binds the tenant predicate to the requested identifier and never runs without one. The query is added to the descriptor, so the drift test of the template feature stays green. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028; requirements: FR-01. Depends on: feature:component-saas-tenants-template, feature:component-auth-server-template-factory-tokens. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/tenancy.md, model/template-parameters/connectsoft-saas-tenants.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an active tenant with a residency region, when a workload caller with the resolution scope resolves its identifier over REST and over gRPC, then both answers carry the tenant identifier, the tenant key, the residency region, the lifecycle state and the aggregate version (ADR-0015 decisions 1 and 4, FR-01, model/components.yaml).",
        "AC2: Given an identifier that names no tenant, when it is resolved, then the answer is 404 over REST and the not-found fault over gRPC; given a suspended and a decommissioned tenant, when a workload caller that holds the resolution scope resolves each, then the answer carries the tenant with its state and is not a not-found answer (ADR-0015 decision 1, docs/architecture/ecosystem-composition.md).",
        "AC3: Given a workload caller without the resolution scope, when it resolves a tenant, then the answer is 403; given a caller with a user token of one tenant, when it resolves another tenant, then the answer is 404 with the same body as for an unknown identifier, and when it resolves its own tenant, then it gets the answer (ADR-0015 decision 3 and its amendment on a resource of another tenant, D113; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC4: Given the descriptor of the Tenants service, when the query is added to the contract, then the descriptor lists it and the drift test of the template passes, and the read is shown by a test to run with the tenant predicate bound to the requested identifier (ADR-0015 decision 1, ADR-0028).",
        "AC5: Given the production tenancy wiring with the tenant claim required and no default tenant, when a workload token with the `svc.` resolution scope and no tenant claim calls the resolution operation, then the operation is the one named exemption from the tenant-claim requirement: it sets the tenant context from the requested identifier for the single load and never from a default; every other operation of the service answers 401 for a principal without a tenant claim, and a test that plants a second exempt operation fails (ADR-0015 decisions 1 and 3, FR-01, docs/planes/control/tenancy.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/tenancy.md",
        "model/template-parameters/connectsoft-saas-tenants.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1157",
        "AIFACTORY-TASK-165",
        "AIFACTORY-TASK-1158"
      ],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1601,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-saas-tenants-template",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/tenancy.md",
        "model/template-parameters/connectsoft-saas-tenants.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-254]",
      "number": 254
    },
    {
      "id": "AIFACTORY-TASK-1157",
      "type": "task",
      "parent": "AIFACTORY-US-254",
      "title": "Resolution request, answer and fault on the service contract and in the descriptor",
      "sequence": "18.05.01.01",
      "description": "BEFORE DEVELOPMENT. Resolution request, answer and fault on the service contract and in the descriptor. Expected output: The service contract of the template holds the resolution operation with its request message, its answer with tenant identifier, tenant key, residency region, lifecycle state and aggregate version, and the not-found fault; the operation requires the `svc.` resolution scope of the workload registration file and is marked as the one named exemption from the tenant-claim requirement; `ConnectSoft.Saas.Tenants.json` lists the query; the REST and gRPC pages of the template document it and the exemption.. Kind: contract. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: build/regenerate.ps1 -ValidateOnly | dotnet build -c Release.",
      "acceptanceCriteria": [
        "The service contract of the template holds the resolution operation with its request message, its answer with tenant identifier, tenant key, residency region, lifecycle state and aggregate version, and the not-found fault; the operation requires the `svc.` resolution scope of the workload registration file and is marked as the one named exemption from the tenant-claim requirement; `ConnectSoft.Saas.Tenants.json` lists the query; the REST and gRPC pages of the template document it and the exemption."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1601,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1157]",
      "number": 1157
    },
    {
      "id": "AIFACTORY-TASK-165",
      "type": "task",
      "parent": "AIFACTORY-US-254",
      "title": "Tenant resolution from the SaaS Tenants service",
      "sequence": "18.05.01.02",
      "description": "BEFORE DEVELOPMENT. Tenant resolution from the SaaS Tenants service. Expected output: The Tenants service answers the resolution query over REST and gRPC with the tenant, its residency region and its lifecycle state, so that the control plane resolves a tenant and its region for a token; an unknown tenant is refused with a not-found answer; for a workload token with the resolution scope the tenant context of the single load is set from the requested identifier and never from a default, and no other operation is exempt from the tenant-claim requirement.. Kind: implementation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Tenants service answers the resolution query over REST and gRPC with the tenant, its residency region and its lifecycle state, so that the control plane resolves a tenant and its region for a token; an unknown tenant is refused with a not-found answer; for a workload token with the resolution scope the tenant context of the single load is set from the requested identifier and never from a default, and no other operation is exempt from the tenant-claim requirement."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-165]",
      "number": 165
    },
    {
      "id": "AIFACTORY-TASK-1158",
      "type": "task",
      "parent": "AIFACTORY-US-254",
      "title": "Verify the resolution query on the generated Tenants service",
      "sequence": "18.05.01.03",
      "description": "BEFORE DEVELOPMENT. Verify the resolution query on the generated Tenants service. Expected output: Run the acceptance scenarios for an active, a suspended, a decommissioned and an unknown tenant, for a workload caller with and without the scope and for a user token of another tenant, over REST and gRPC, and the exemption cases, a workload token without a tenant claim that is admitted on the resolution operation only, the same token answered 401 on every other operation, and a planted second exempt operation that fails its test; the answers are as stated, which proves AC1 to AC5 of AIFACTORY-US-254 (ADR-0015).. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Run the acceptance scenarios for an active, a suspended, a decommissioned and an unknown tenant, for a workload caller with and without the scope and for a user token of another tenant, over REST and gRPC, and the exemption cases, a workload token without a tenant claim that is admitted on the resolution operation only, the same token answered 401 on every other operation, and a planted second exempt operation that fails its test; the answers are as stated, which proves AC1 to AC5 of AIFACTORY-US-254 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1158]",
      "number": 1158
    },
    {
      "id": "AIFACTORY-US-255",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-100",
      "title": "Tenancy integration: the ServiceModel package of the Tenants service offers a typed resolution client that never answers with a default tenant",
      "sequence": "18.05.02",
      "description": "As an asset maintainer, I want a typed client for the resolution query in the package the Tenants service already publishes its contracts in, so that a Factory gateway resolves a tenant by a version pin and no Factory repository writes its own client or copies a contract. The REST page of the template states that the contracts and the typed client facades of the service live in the package `ConnectSoft.Saas.Tenants.ServiceModel`. A consumer of the resolution query therefore takes the package by a version pin and does not copy a type. This PBI adds the resolution facade to that package for REST and for gRPC. The facade takes the transport the consumer configured, with the workload token of the consumer and the propagation of correlation and trace context, and adds no authentication of its own. It returns one of three typed outcomes: the tenant with its region and state, an unknown tenant, or a failure to reach the service. It never returns a default tenant and never turns a failure into an unknown tenant, because the canonical tenancy rules the Factory inherits fail closed on missing evidence and the isolation recipe of the SaaS family runs without a default tenant. It keeps no cache: a platform gateway has the shared cache as its only store (ADR-0028 decision 7), and how long an answer may be reused is the decision of the consumer. Contract tests in the template run the facade against the generated service over both transports, so that the client and the service cannot drift apart inside one package version. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028; requirements: FR-01. Depends on: AIFACTORY-US-254. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/control/tenancy.md.",
      "acceptanceCriteria": [
        "AC1: Given the resolution facade of the ServiceModel package and a generated Tenants service, when the facade resolves an active tenant over REST and over gRPC, then both return the tenant with its residency region and lifecycle state as a typed outcome (ADR-0015 decision 1, FR-01, model/components.yaml).",
        "AC2: Given an identifier that names no tenant, when the facade resolves it, then the outcome is the typed unknown tenant; given a service that cannot be reached or answers an error, when the facade resolves, then the outcome is the typed failure and never an unknown tenant or a default tenant (ADR-0015 decision 1 on the inherited fail-closed rule, docs/planes/control/tenancy.md).",
        "AC3: Given the facade, when a consumer configures its transport with a workload token and trace context, then the call carries both unchanged, the facade holds no cache and no credential, and the contract tests of the template fail when the facade and the service contract differ (ADR-0028 decision 7, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/tenancy.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1159",
        "AIFACTORY-TASK-1160",
        "AIFACTORY-TASK-1161"
      ],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1602,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-254"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/control/tenancy.md"
      ],
      "titlePrefix": "[AIFACTORY-US-255]",
      "number": 255
    },
    {
      "id": "AIFACTORY-TASK-1159",
      "type": "task",
      "parent": "AIFACTORY-US-255",
      "title": "Typed resolution facade over REST and gRPC in the ServiceModel package",
      "sequence": "18.05.02.01",
      "description": "BEFORE DEVELOPMENT. Typed resolution facade over REST and gRPC in the ServiceModel package. Expected output: The package `ConnectSoft.Saas.Tenants.ServiceModel` holds a resolution facade for REST and for the code-first gRPC client with three typed outcomes (tenant, unknown tenant, failure); it takes the configured transport of the consumer and holds no cache, credential or default tenant.. Kind: implementation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Saas.Tenants.ServiceModel` holds a resolution facade for REST and for the code-first gRPC client with three typed outcomes (tenant, unknown tenant, failure); it takes the configured transport of the consumer and holds no cache, credential or default tenant."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1159]",
      "number": 1159
    },
    {
      "id": "AIFACTORY-TASK-1160",
      "type": "task",
      "parent": "AIFACTORY-US-255",
      "title": "Contract tests of the facade against the generated service",
      "sequence": "18.05.02.02",
      "description": "BEFORE DEVELOPMENT. Contract tests of the facade against the generated service. Expected output: Tests of the template run the facade against the generated Tenants service over both transports for an active, a suspended and an unknown tenant and against a stopped service, and assert the typed outcome of each.. Kind: fixture. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Tests of the template run the facade against the generated Tenants service over both transports for an active, a suspended and an unknown tenant and against a stopped service, and assert the typed outcome of each."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1602,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1160]",
      "number": 1160
    },
    {
      "id": "AIFACTORY-TASK-1161",
      "type": "task",
      "parent": "AIFACTORY-US-255",
      "title": "Verify the typed outcomes of the resolution facade",
      "sequence": "18.05.02.03",
      "description": "BEFORE DEVELOPMENT. Verify the typed outcomes of the resolution facade. Expected output: Run the contract tests of the facade; the four cases return the tenant, the tenant with its state, the unknown tenant and the failure, which proves AC1 to AC3 of AIFACTORY-US-255 (ADR-0015).. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Run the contract tests of the facade; the four cases return the tenant, the tenant with its state, the unknown tenant and the failure, which proves AC1 to AC3 of AIFACTORY-US-255 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1161]",
      "number": 1161
    },
    {
      "id": "AIFACTORY-US-256",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-100",
      "title": "Tenancy integration: the ServiceModel package with the resolution contract is built, tested and published to the ConnectSoft feed with a version the consumers pin",
      "sequence": "18.05.03",
      "description": "As an asset maintainer, I want the resolution contract and its client on the ConnectSoft feed in a package whose version consumers pin, so that the control plane of the next increment resolves tenants from a published package that was proven against a generated Tenants service. The template has a pipeline for its service model package (`azure-pipelines-service-model.yml` of the template) beside its template pipeline. This PBI is the proof of the feature: the package `ConnectSoft.Saas.Tenants.ServiceModel` with the resolution contract and its typed facade is built and tested in that pipeline, the contract tests of the facade run against a Tenants service generated from the packed template, and the package is published to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to, which the amendment of ADR-0028 (D114) names as the feed of the Factory. Publication is reached only when the build, the tests and the contract tests are green and refuses a version that is already on the feed. A probe then proves what a consumer will do: a small project that pins the published version, and holds no project reference into the template, resolves an active tenant with its region from the generated service, receives the unknown-tenant outcome for an identifier that names no tenant, and sees the state of a suspended tenant. The published version is recorded on the documentation of the template, because the model of this repository holds no package versions. The PBI proves that the Factory can resolve tenants from the Tenants service as the ecosystem composition page states (docs/architecture/ecosystem-composition.md) and the release gate of FR-11 for the package. Kind: evidence. Traces: adrs: ADR-0015, ADR-0028; requirements: FR-01, FR-11. Depends on: AIFACTORY-US-254, AIFACTORY-US-255. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the service model pipeline of the Tenants template, when it runs on the work of this feature, then the ServiceModel package builds, its tests and the contract tests of the facade against a generated Tenants service pass, and only then is the package published to the ConnectSoft feed (FR-11, ADR-0028, model/components.yaml).",
        "AC2: Given a version that is already on the feed or a failing contract test, when the pipeline reaches publication, then publication is refused with the reason and the run fails (FR-11, docs/architecture/ecosystem-composition.md).",
        "AC3: Given the published package, when a probe project that pins that version and references nothing else of the template calls a Tenants service generated from the published template, then it resolves an active tenant with its residency region, receives the unknown-tenant outcome for an unknown identifier and reads the state of a suspended tenant (ADR-0015 decision 1, FR-01)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1162",
        "AIFACTORY-TASK-1163",
        "AIFACTORY-TASK-1164",
        "AIFACTORY-TASK-1165"
      ],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1603,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01",
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-254",
        "AIFACTORY-US-255"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-256]",
      "number": 256
    },
    {
      "id": "AIFACTORY-TASK-1162",
      "type": "task",
      "parent": "AIFACTORY-US-256",
      "title": "Service model pipeline runs the contract tests before publication",
      "sequence": "18.05.03.01",
      "description": "BEFORE DEVELOPMENT. Service model pipeline runs the contract tests before publication. Expected output: The service model pipeline of the template builds the package, runs its tests and the contract tests of the facade against a service generated from the packed template, and publishes to the ConnectSoft feed only when all are green; a version that is already on the feed is refused with the reason.. Kind: operations. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: azure-pipelines-service-model.yml publishes after the contract tests; a repeated version is refused.",
      "acceptanceCriteria": [
        "The service model pipeline of the template builds the package, runs its tests and the contract tests of the facade against a service generated from the packed template, and publishes to the ConnectSoft feed only when all are green; a version that is already on the feed is refused with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1603,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1162]",
      "number": 1162
    },
    {
      "id": "AIFACTORY-TASK-1163",
      "type": "task",
      "parent": "AIFACTORY-US-256",
      "title": "Probe project that pins the published package",
      "sequence": "18.05.03.02",
      "description": "BEFORE DEVELOPMENT. Probe project that pins the published package. Expected output: A probe under the build folder of the template restores the published version from the feed with no project reference into the template and runs the three resolution cases against a generated Tenants service; the pipeline runs it after publication.. Kind: fixture. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: the probe restores from the feed and passes.",
      "acceptanceCriteria": [
        "A probe under the build folder of the template restores the published version from the feed with no project reference into the template and runs the three resolution cases against a generated Tenants service; the pipeline runs it after publication."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1603,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1163]",
      "number": 1163
    },
    {
      "id": "AIFACTORY-TASK-1164",
      "type": "task",
      "parent": "AIFACTORY-US-256",
      "title": "Published version recorded on the documentation of the template",
      "sequence": "18.05.03.03",
      "description": "BEFORE DEVELOPMENT. Published version recorded on the documentation of the template. Expected output: The REST and gRPC pages of the template name the resolution query, the facade and the version of the ServiceModel package that first carries them, so that a consumer knows which version to pin.. Kind: documentation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: the pages name the version.",
      "acceptanceCriteria": [
        "The REST and gRPC pages of the template name the resolution query, the facade and the version of the ServiceModel package that first carries them, so that a consumer knows which version to pin."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1603,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1164]",
      "number": 1164
    },
    {
      "id": "AIFACTORY-TASK-1165",
      "type": "task",
      "parent": "AIFACTORY-US-256",
      "title": "Verify the published package with the probe",
      "sequence": "18.05.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the published package with the probe. Expected output: Run the service model pipeline to publication and the probe against the published version; the three cases pass and a repeated version is refused, which proves AC1 to AC3 of AIFACTORY-US-256 (ADR-0015, FR-11).. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Run the service model pipeline to publication and the probe against the published version; the three cases pass and a repeated version is refused, which proves AC1 to AC3 of AIFACTORY-US-256 (ADR-0015, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1165]",
      "number": 1165
    },
    {
      "id": "AIFACTORY-US-110",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-100",
      "title": "Tenancy integration: tenant resolution for the Factory is delivered and proven on a generated solution",
      "sequence": "18.05.04",
      "description": "As an asset maintainer, I want SaaS Tenants service to carry tenant resolution for the Factory, so that it serves factory tenants (BC-33) and product tenants (BC-31) without later rework. This is the integration PBI of the feature. The Factory resolves its tenants, and later its editions and entitlements, from the SaaS Tenants service instead of holding them; the first outcome needs tenant resolution only. The feature builds on the template feature that reconciles the descriptor, completes the lifecycle and proves the isolation of the service. With the resolution query on the service contract, the typed resolution client in the ServiceModel package and the package published to the ConnectSoft feed with a pinned version, the asset maintainer runs the template pipeline and the service model pipeline end to end and proves the result with the probe. A failing contract test or a repeated version blocks publication. The migrated implementation task sits under the PBI that delivers the query, and the verification task of this PBI is the proof on the generated solution. The feature is done when a Tenants service generated from the published template answers the resolution query for an active, a suspended and an unknown tenant, and a consumer that pins the published package reads those answers, so that the control plane of the next increment can resolve a tenant and its region for a token and refuse an unknown tenant. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-254, AIFACTORY-US-255, AIFACTORY-US-256, feature:component-saas-tenants-template. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.Saas.TenantsTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution 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-165 (tenant resolution from the SaaS Tenants service) is done, then the generated Tenants service answers the resolution query with the tenant, its residency region and its lifecycle state, so that the control plane resolves a tenant and its region for a token, and an unknown tenant is refused with a not-found answer (ADR-0015 decision 1, docs/architecture/ecosystem-composition.md).",
        "AC3: Given the published ServiceModel package, when a consumer pins its version, then the typed resolution client returns the tenant, the unknown tenant or the failure and never a default tenant, which the probe of the package proves against a generated service (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-692"
      ],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1604,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-254",
        "AIFACTORY-US-255",
        "AIFACTORY-US-256",
        "feature:component-saas-tenants-template"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-110]",
      "number": 110
    },
    {
      "id": "AIFACTORY-TASK-692",
      "type": "task",
      "parent": "AIFACTORY-US-110",
      "title": "Verify saas-tenants-delivered by running the declared command",
      "sequence": "18.05.04.01",
      "description": "BEFORE DEVELOPMENT. Verify saas-tenants-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the Tenants service generated from the published template, with the resolution scenarios in its acceptance suite; they pass and prove AC1 to AC3 of AIFACTORY-US-110.. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the Tenants service generated from the published template, with the resolution scenarios in its acceptance suite; they pass and prove AC1 to AC3 of AIFACTORY-US-110."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 16,
      "phase": "templates-and-libraries",
      "stackRank": 1604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-692]",
      "number": 692
    },
    {
      "id": "AIFACTORY-FEAT-153",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Agent host template: parameterized agent identity and a neutral exemplar",
      "sequence": "18.06",
      "description": "A generated agent host carries the identity of its agent in its classes, manifest and MCP surface. Today the template rewrites only the namespace prefix: every generated host ships classes named SampleFactoryAgent*, the MCP method InvokeSampleFactoryAgent, demo weather and string tools switched on by default, and an exemplar whose logic is demo analytics with hard-coded figures (Docs/Generic Agent Audit Report.md of the template, gaps 1, 2, 5 and 7). AgentRuntimeService and WorkflowEngineService cannot be scaffolded from a host that is named after the sample. Component: AI Agent host template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 6 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-139",
        "AIFACTORY-US-140",
        "AIFACTORY-US-141",
        "AIFACTORY-US-100"
      ],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 600,
      "titlePrefix": "[AIFACTORY-FEAT-153]",
      "number": 153
    },
    {
      "id": "AIFACTORY-US-139",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-153",
      "title": "Agent host template: the agent class, its tools, the MCP method and the manifest entry take their names from the agent identity",
      "sequence": "18.06.01",
      "description": "As an asset maintainer, I want a generated agent host to name its agent class, tool classes, MCP method, keyed service and manifest entry after the agent I generate, so that AgentRuntimeService and WorkflowEngineService are scaffolded from a host that carries their identity and not the name of the sample. The template rewrites the namespace prefix through `sourceName`, and its compose pipeline already defines the `agent-class-name` symbol with a `replaces` rule and a `fileRename` rule on `SampleFactoryAgent`; model/templates.yaml lists the symbol among the switches of `connectsoft-ai-agent`. The symbol is part of the work that `Docs/Generic Agent Implementation Summary.md` of the template records as applied without a compiler; D113 makes that recorded work the starting point, so the first task of this PBI builds and tests it and keeps what passes. Its default is the constant `SampleFactoryAgent`, which is the real defect: a host generated without the option keeps the classes `SampleFactoryAgent`, `SampleFactoryAgentTools`, `SampleFactoryAgentMcpTool` and `SampleFactoryAgentMcpToolWrapper`, the MCP method `InvokeSampleFactoryAgent`, the keyed-service name and the manifest value `entry_agent_class: SampleFactoryAgent`, which gap 1 of the audit report of the template records. This PBI derives the default of the symbol from the `agent-id` symbol in Pascal case and completes the renames of the types, the files, the MCP method, the keyed-service name and the manifest entry. A text symbol of the template engine has no pattern validation, so a class name that is not a valid identifier is caught by the placeholder scan before the build and otherwise fails the build of the generated host with the identifier named. The placeholder scan of the template fails when a generated host still contains a `SampleFactoryAgent` identifier or an unreplaced agent token, and the symbol stays in the generated template configuration so that the inventory of the documentation repository lists it. Kind: enabling. Traces: adrs: ADR-0028. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the agent template, when `dotnet new connectsoft-ai-agent --agent-id connectsoft-probe` runs without an explicit class name, then the agent class, its tools, the MCP tool and wrapper, the MCP method, the keyed-service name and the manifest `entry_agent_class` are named from the agent id in Pascal case, and the generated host contains no `SampleFactoryAgent` identifier (ADR-0028 amendment on the Factory templates, model/components.yaml).",
        "AC2: Given an explicit `--agent-class-name` that is not a valid C# identifier, when the host is generated, then the placeholder scan of the template reports the name as an invalid identifier before the build and the build of the generated host fails with the identifier named; given a valid name, then the files and types of the agent are renamed to it through `fileRename` and `replaces` (model/template-parameters/connectsoft-ai-agent.yaml lists the symbol with its derived default after the next inventory).",
        "AC3: Given the placeholder scan of the template pipeline, when a generated host still contains a `SampleFactoryAgent` identifier or an `__AGENT_` token, then the scan fails the case; the scan is part of the generated-solution gate that docs/architecture/ecosystem-composition.md names as a need of this component and that Docs/AgentTemplate-Alignment-Verification.md of the template describes."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-853",
        "AIFACTORY-TASK-805",
        "AIFACTORY-TASK-806",
        "AIFACTORY-TASK-807",
        "AIFACTORY-TASK-808"
      ],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 601,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-139]",
      "number": 139
    },
    {
      "id": "AIFACTORY-TASK-853",
      "type": "task",
      "parent": "AIFACTORY-US-139",
      "title": "Compile and test the recorded agent-class-name work as the starting point",
      "sequence": "18.06.01.01",
      "description": "BEFORE DEVELOPMENT. Compile and test the recorded agent-class-name work as the starting point. Expected output: The `agent-class-name` symbol with its `replaces` and `fileRename` rules, which `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler, is composed, packed and generated with and without an explicit class name; the generated hosts build and pass their tests; a rule that passes is kept, a rule that fails is corrected or removed, and the outcome per rule is recorded in that summary (D113, the starting point of AC1 of AIFACTORY-US-139).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The `agent-class-name` symbol with its `replaces` and `fileRename` rules, which `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler, is composed, packed and generated with and without an explicit class name; the generated hosts build and pass their tests; a rule that passes is kept, a rule that fails is corrected or removed, and the outcome per rule is recorded in that summary (D113, the starting point of AC1 of AIFACTORY-US-139)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-853]",
      "number": 853
    },
    {
      "id": "AIFACTORY-TASK-805",
      "type": "task",
      "parent": "AIFACTORY-US-139",
      "title": "Default of agent-class-name derived from agent-id and the renames completed",
      "sequence": "18.06.01.02",
      "description": "BEFORE DEVELOPMENT. Default of agent-class-name derived from agent-id and the renames completed. Expected output: The merge script derives the default of the existing `agent-class-name` symbol from `agent-id` in Pascal case in place of the constant `SampleFactoryAgent`, and its `replaces` and `fileRename` rules cover every sample type and file; an invalid identifier fails the build of the generated host with the identifier named.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet new connectsoft-ai-agent -n ConnectSoft.Probe --agent-id connectsoft-probe -o probe && ! grep -r SampleFactoryAgent probe.",
      "acceptanceCriteria": [
        "The merge script derives the default of the existing `agent-class-name` symbol from `agent-id` in Pascal case in place of the constant `SampleFactoryAgent`, and its `replaces` and `fileRename` rules cover every sample type and file; an invalid identifier fails the build of the generated host with the identifier named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 601,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-805]",
      "number": 805
    },
    {
      "id": "AIFACTORY-TASK-806",
      "type": "task",
      "parent": "AIFACTORY-US-139",
      "title": "MCP method, keyed-service name and manifest entry_agent_class renamed from the symbol",
      "sequence": "18.06.01.03",
      "description": "BEFORE DEVELOPMENT. MCP method, keyed-service name and manifest entry_agent_class renamed from the symbol. Expected output: The MCP method, the keyed-service registration and `factory/agent.manifest.yaml` of a generated host carry the class name of the symbol; the acceptance tests of the MCP surface resolve the renamed method.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The MCP method, the keyed-service registration and `factory/agent.manifest.yaml` of a generated host carry the class name of the symbol; the acceptance tests of the MCP surface resolve the renamed method."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-806]",
      "number": 806
    },
    {
      "id": "AIFACTORY-TASK-807",
      "type": "task",
      "parent": "AIFACTORY-US-139",
      "title": "Placeholder scan of a generated host for sample identifiers, agent tokens and invalid class names",
      "sequence": "18.06.01.04",
      "description": "BEFORE DEVELOPMENT. Placeholder scan of a generated host for sample identifiers, agent tokens and invalid class names. Expected output: The template pipeline scans every generated case for `SampleFactoryAgent`, `__AGENT_`, `__PRIMARY_` and `__SECONDARY_` and for a class name that is not a valid C# identifier, and fails the case on a hit before the build; the scan has a fixture with one planted hit that proves it fails.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: the template pipeline runs the scan on the generated cases and the planted-hit fixture fails.",
      "acceptanceCriteria": [
        "The template pipeline scans every generated case for `SampleFactoryAgent`, `__AGENT_`, `__PRIMARY_` and `__SECONDARY_` and for a class name that is not a valid C# identifier, and fails the case on a hit before the build; the scan has a fixture with one planted hit that proves it fails."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 601,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-807]",
      "number": 807
    },
    {
      "id": "AIFACTORY-TASK-808",
      "type": "task",
      "parent": "AIFACTORY-US-139",
      "title": "Verify the renamed identity on a generated host",
      "sequence": "18.06.01.05",
      "description": "BEFORE DEVELOPMENT. Verify the renamed identity on a generated host. Expected output: Generate a host with `--agent-id connectsoft-probe`, build it and run its tests; no `SampleFactoryAgent` identifier remains and the MCP method and manifest entry carry the derived name, which proves AC1 to AC3 of AIFACTORY-US-139.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Generate a host with `--agent-id connectsoft-probe`, build it and run its tests; no `SampleFactoryAgent` identifier remains and the MCP method and manifest entry carry the derived name, which proves AC1 to AC3 of AIFACTORY-US-139."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-808]",
      "number": 808
    },
    {
      "id": "AIFACTORY-US-140",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-153",
      "title": "Agent host template: the demo MCP tools are generated only behind a switch that is off by default",
      "sequence": "18.06.02",
      "description": "As an asset maintainer, I want a generated agent host to expose only the agent operation on its MCP surface unless I ask for the demo tools, so that a Factory agent host does not ship weather and string demos as governed MCP capabilities. The compose pipeline of the template already defines the `IncludeMcpSamples` switch, but its default is true, so the MCP project of every generated host ships the weather, echo and string demo tools, their prompts, their response types and their acceptance tests as its default MCP surface, which gap 2 of the audit report of the template records. The switch and its exclusion list are part of the uncompiled work the implementation summary of the template records; D113 makes that work the starting point, so the first task of this PBI builds and tests the switch in both positions and keeps what passes. ADR-0022 makes every MCP tool a governed capability with a descriptor, so a demo tool on a Factory host is a capability nobody declared. This PBI flips the default of the switch to false and completes its exclusion list: the weather, echo and string tools, the prompts, the response types and the acceptance tests of the samples. With the switch off, the MCP surface of a generated host exposes the agent operation alone, routed through the execution port of the earlier feature; with the switch on, the demo tools are generated and their tests run. A generated host with the switch off must build with no reference to an excluded type, which the configuration smoke tests of the template matrix cover in both positions of the switch. Kind: enabling. Traces: adrs: ADR-0022, ADR-0028. Depends on: AIFACTORY-US-139. Sources: model/components.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the agent template, when a host is generated without `--IncludeMcpSamples`, then the weather, echo and string demo tools, their prompts, their response types and their acceptance tests are absent, the host builds, and its MCP surface lists the agent operation alone (ADR-0022 decision 1 and 7, model/template-parameters/connectsoft-ai-agent.yaml).",
        "AC2: Given the agent template, when a host is generated with `--IncludeMcpSamples true`, then the demo tools and their acceptance tests are generated and pass; both positions of the switch are cases of the template matrix that docs/architecture/ecosystem-composition.md names as a need of this component and that Docs/AgentTemplate-Alignment-Verification.md of the template describes.",
        "AC3: Given a generated host with the switch off, when the MCP acceptance test enumerates the tools of the server, then exactly one tool is listed and its name is the agent operation of the class identity of AIFACTORY-US-139 (ADR-0028 amendment on the Factory templates)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-854",
        "AIFACTORY-TASK-809",
        "AIFACTORY-TASK-810",
        "AIFACTORY-TASK-811"
      ],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 602,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-139"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-140]",
      "number": 140
    },
    {
      "id": "AIFACTORY-TASK-854",
      "type": "task",
      "parent": "AIFACTORY-US-140",
      "title": "Compile and test the recorded IncludeMcpSamples switch as the starting point",
      "sequence": "18.06.02.01",
      "description": "BEFORE DEVELOPMENT. Compile and test the recorded IncludeMcpSamples switch as the starting point. Expected output: The `IncludeMcpSamples` switch and its exclusion list, which `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler, are generated in both positions; both generated hosts build and pass their tests; an exclusion that leaves a dangling reference is corrected, and the outcome per position is recorded in that summary (D113, the starting point of AC1 and AC2 of AIFACTORY-US-140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The `IncludeMcpSamples` switch and its exclusion list, which `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler, are generated in both positions; both generated hosts build and pass their tests; an exclusion that leaves a dangling reference is corrected, and the outcome per position is recorded in that summary (D113, the starting point of AC1 and AC2 of AIFACTORY-US-140)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-854]",
      "number": 854
    },
    {
      "id": "AIFACTORY-TASK-809",
      "type": "task",
      "parent": "AIFACTORY-US-140",
      "title": "IncludeMcpSamples default flipped to false with a complete exclusion list",
      "sequence": "18.06.02.02",
      "description": "BEFORE DEVELOPMENT. IncludeMcpSamples default flipped to false with a complete exclusion list. Expected output: The merge script and the template configuration set the existing `IncludeMcpSamples` switch to false by default; the exclusion list names the weather, echo and string tools, the prompts, the response types and the acceptance tests of the samples; the MCP registration of a generated host has no reference to an excluded type.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The merge script and the template configuration set the existing `IncludeMcpSamples` switch to false by default; the exclusion list names the weather, echo and string tools, the prompts, the response types and the acceptance tests of the samples; the MCP registration of a generated host has no reference to an excluded type."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-809]",
      "number": 809
    },
    {
      "id": "AIFACTORY-TASK-810",
      "type": "task",
      "parent": "AIFACTORY-US-140",
      "title": "MCP acceptance test that enumerates the surface in both switch positions",
      "sequence": "18.06.02.03",
      "description": "BEFORE DEVELOPMENT. MCP acceptance test that enumerates the surface in both switch positions. Expected output: An acceptance test lists the tools of the MCP server of a generated host; with the switch off it asserts the agent operation alone, with the switch on it asserts the demo tools beside it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An acceptance test lists the tools of the MCP server of a generated host; with the switch off it asserts the agent operation alone, with the switch on it asserts the demo tools beside it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 602,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-810]",
      "number": 810
    },
    {
      "id": "AIFACTORY-TASK-811",
      "type": "task",
      "parent": "AIFACTORY-US-140",
      "title": "Verify the default MCP surface on generated hosts",
      "sequence": "18.06.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the default MCP surface on generated hosts. Expected output: Generate one host with the default switch and one with `--IncludeMcpSamples true`; both build and pass their tests and the enumeration test proves AC1 to AC3 of AIFACTORY-US-140 (ADR-0022).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Generate one host with the default switch and one with `--IncludeMcpSamples true`; both build and pass their tests and the enumeration test proves AC1 to AC3 of AIFACTORY-US-140 (ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-811]",
      "number": 811
    },
    {
      "id": "AIFACTORY-US-141",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-153",
      "title": "Agent host template: a neutral exemplar agent replaces the demo analytics and the generation guide names the real options",
      "sequence": "18.06.03",
      "description": "As an asset maintainer, I want the exemplar agent of a generated host to execute one typed operation on its inputs and the generation guide to name the options the compose pipeline defines, so that a developer who scaffolds AgentRuntimeService or WorkflowEngineService starts from an exemplar and a guide that are true. The sample agent of the template exposes workflow metrics analysis and blueprint recommendation whose tools return hard-coded figures, which gap 5 of the audit report of the template records, and the generation guide documents Pascal-case options while the merge script defines kebab-case ones, which is gap 7. The implementation summary of the template records a first answer to both gaps, a thin exemplar over `FactoryAgentBase` and kebab-case edits of the guide and of the behavioral specification, applied without a compiler; D113 makes that work the starting point, so the first task of this PBI builds and tests it and keeps what passes. This PBI replaces the demo analytics with a neutral exemplar that takes a typed request, executes one typed operation through the execution port and returns a typed result with no hard-coded figure, so that the unit and acceptance tests of the template assert the exemplar and a generated host carries an agent a developer can replace by implementing the prompt and the validation alone. It also rewrites the generation guide to the kebab-case options the compose pipeline defines and model/templates.yaml lists as the switches of `connectsoft-ai-agent` (`agent-id`, `agent-display-name`, `agent-role`, `agent-cluster`, `agent-profile`, `agent-summary`, `agent-class-name`, `primary-workflow`, and `agent-host-kind`, which D113 decides and the earlier feature adds) and adds a test that parses the guide and the merge script and fails when an option name of one is missing from the other. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-139. Sources: model/components.yaml, model/templates.yaml, docs/planes/agent-runtime/agent-runtime.md, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given a generated host, when the exemplar agent executes a typed request through the execution port, then it returns a typed result computed from the inputs of the request, no hard-coded figure remains in the agent or its tools, and the unit and acceptance tests of the template assert the exemplar (docs/planes/agent-runtime/agent-runtime.md, ADR-0028 amendment on the Factory templates).",
        "AC2: Given the generation guide of the template, when the option-name test parses the guide and the merge script, then every option the compose pipeline defines is named in the guide in kebab-case and the test fails when a name of one is missing from the other; the names are the ones model/templates.yaml lists under `switches` of `connectsoft-ai-agent`.",
        "AC3: Given the behavioral specification of the exemplar in the generated host, when the host is generated, then the specification names the typed operation, its inputs and outputs, the lifecycle events of the attempt and the correction and escalation flow, and no demo analytics vocabulary remains (model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/planes/agent-runtime/agent-runtime.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-855",
        "AIFACTORY-TASK-812",
        "AIFACTORY-TASK-813",
        "AIFACTORY-TASK-814",
        "AIFACTORY-TASK-815"
      ],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 603,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-139"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/planes/agent-runtime/agent-runtime.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-141]",
      "number": 141
    },
    {
      "id": "AIFACTORY-TASK-855",
      "type": "task",
      "parent": "AIFACTORY-US-141",
      "title": "Compile and test the recorded thin exemplar, specification and guide edits as the starting point",
      "sequence": "18.06.03.01",
      "description": "BEFORE DEVELOPMENT. Compile and test the recorded thin exemplar, specification and guide edits as the starting point. Expected output: The exemplar that `Docs/Generic Agent Implementation Summary.md` of the template records as demoted to a thin wrapper over `FactoryAgentBase`, its behavioral specification and the kebab-case edits of the generation guide, all written without a compiler, are built and tested on the authoring solution and on a generated default host; what builds and passes is kept as the base of the neutral exemplar and of the guide rewrite, what fails is corrected or removed, and the outcome is recorded in that summary (D113, the starting point of AC1 and AC2 of AIFACTORY-US-141).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The exemplar that `Docs/Generic Agent Implementation Summary.md` of the template records as demoted to a thin wrapper over `FactoryAgentBase`, its behavioral specification and the kebab-case edits of the generation guide, all written without a compiler, are built and tested on the authoring solution and on a generated default host; what builds and passes is kept as the base of the neutral exemplar and of the guide rewrite, what fails is corrected or removed, and the outcome is recorded in that summary (D113, the starting point of AC1 and AC2 of AIFACTORY-US-141)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-855]",
      "number": 855
    },
    {
      "id": "AIFACTORY-TASK-812",
      "type": "task",
      "parent": "AIFACTORY-US-141",
      "title": "Neutral exemplar agent with one typed operation",
      "sequence": "18.06.03.02",
      "description": "BEFORE DEVELOPMENT. Neutral exemplar agent with one typed operation. Expected output: The exemplar agent takes a typed request, executes one typed operation on its inputs through the execution port and returns a typed result; the demo analytics methods and their hard-coded tool data are removed; the unit tests drive the exemplar with a scripted model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The exemplar agent takes a typed request, executes one typed operation on its inputs through the execution port and returns a typed result; the demo analytics methods and their hard-coded tool data are removed; the unit tests drive the exemplar with a scripted model."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-812]",
      "number": 812
    },
    {
      "id": "AIFACTORY-TASK-813",
      "type": "task",
      "parent": "AIFACTORY-US-141",
      "title": "Generation guide and behavioral specification rewritten to the real options and the exemplar",
      "sequence": "18.06.03.03",
      "description": "BEFORE DEVELOPMENT. Generation guide and behavioral specification rewritten to the real options and the exemplar. Expected output: Docs/Template Generation Guide.md names the kebab-case options of the compose pipeline with one example per option; the behavioral specification of the exemplar names its operation, inputs, outputs, events and escalation flow.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Docs/Template Generation Guide.md names the kebab-case options of the compose pipeline with one example per option; the behavioral specification of the exemplar names its operation, inputs, outputs, events and escalation flow."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 603,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-813]",
      "number": 813
    },
    {
      "id": "AIFACTORY-TASK-814",
      "type": "task",
      "parent": "AIFACTORY-US-141",
      "title": "Option-name test over the guide and the merge script",
      "sequence": "18.06.03.04",
      "description": "BEFORE DEVELOPMENT. Option-name test over the guide and the merge script. Expected output: A unit test parses the option names of Docs/Template Generation Guide.md and of build/Merge-AgentTemplateSymbols.ps1 and compares the two against each other; it fails when a name of one is missing from the other.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A unit test parses the option names of Docs/Template Generation Guide.md and of build/Merge-AgentTemplateSymbols.ps1 and compares the two against each other; it fails when a name of one is missing from the other."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 603,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-814]",
      "number": 814
    },
    {
      "id": "AIFACTORY-TASK-815",
      "type": "task",
      "parent": "AIFACTORY-US-141",
      "title": "Verify the exemplar and the guide on a generated host",
      "sequence": "18.06.03.05",
      "description": "BEFORE DEVELOPMENT. Verify the exemplar and the guide on a generated host. Expected output: Generate a host, build it and run its tests; the exemplar tests pass, a grep for the demo analytics names and hard-coded figures returns nothing, and the option-name test passes, which proves AC1 to AC3 of AIFACTORY-US-141.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Generate a host, build it and run its tests; the exemplar tests pass, a grep for the demo analytics names and hard-coded figures returns nothing, and the option-name test passes, which proves AC1 to AC3 of AIFACTORY-US-141."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-815]",
      "number": 815
    },
    {
      "id": "AIFACTORY-US-100",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-153",
      "title": "Agent host template: parameterized agent identity and a neutral exemplar is delivered and proven on a generated solution",
      "sequence": "18.06.04",
      "description": "As an asset maintainer, I want AI Agent host template to carry a parameterized agent identity and a neutral exemplar, so that it serves AgentRuntimeService and WorkflowEngineService without later rework. This is the integration PBI of the feature. The asset maintainer packs the agent template with the derived class identity, the demo tools behind their switch and the neutral exemplar of the earlier PBIs, installs the package and instantiates it in the template pipeline across the identity cases of the matrix: a derived class name, an explicit class name, the demo switch off and on. Every generated case restores, builds, passes its unit, architecture and acceptance tests and passes the placeholder scan before the package is allowed to publish with a verified version; a case that fails any stage fails the run and blocks publication. The migrated tasks of this PBI are its proofs on the generated solution; the implementation lives in the behaviour PBIs. The feature is done when a generated host contains no sample identifier, its default MCP surface exposes the agent operation alone, its exemplar executes one typed operation without hard-coded figures, and the generation guide names the options the compose pipeline defines, as the audit report of the template and ADR-0028 require before AgentRuntimeService and WorkflowEngineService are scaffolded. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-139, AIFACTORY-US-140, AIFACTORY-US-141. Sources: model/components.yaml, model/templates.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.AI.SoftwareFactory.AgentTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution of every identity case builds, passes its tests and passes the placeholder scan before the package publishes with a verified version (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-567 (agent class identity from the agent-id symbol) is done, then the agent class, its tools, MCP tool and wrapper, the MCP method and the manifest entry_agent_class are renamed from the agent-id symbol through fileRename and source replacement, and a generated host contains no SampleFactoryAgent name (docs/architecture/ecosystem-composition.md).",
        "AC3: Given the work of AIFACTORY-TASK-568 (MCP demo tools behind a switch that is off by default) is done, then the weather, echo and string demo tools and their response types are generated only when IncludeMcpSamples is true, and the default MCP surface of a generated host exposes the agent operation alone (model/template-parameters/connectsoft-ai-agent.yaml).",
        "AC4: Given the work of AIFACTORY-TASK-569 (a neutral exemplar agent in place of the demo analytics) is done, then the exemplar executes one typed operation on the inputs of the agent and returns a typed output, no hard-coded figures remain, and the unit and acceptance tests of the template assert the exemplar (docs/planes/agent-runtime/agent-runtime.md).",
        "AC5: Given the work of AIFACTORY-TASK-570 (option names of the generation guide match the merge script) is done, then Docs/Template Generation Guide.md of the template names the kebab-case options the compose pipeline defines (agent-display-name, agent-role, agent-cluster, primary-workflow among them) and a test parses the guide and the script and compares the names (model/templates.yaml lists the same names under switches)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-567",
        "AIFACTORY-TASK-568",
        "AIFACTORY-TASK-569",
        "AIFACTORY-TASK-570",
        "AIFACTORY-TASK-664"
      ],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 604,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-139",
        "AIFACTORY-US-140",
        "AIFACTORY-US-141"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-100]",
      "number": 100
    },
    {
      "id": "AIFACTORY-TASK-567",
      "type": "task",
      "parent": "AIFACTORY-US-100",
      "title": "Agent class identity from the agent-id symbol",
      "sequence": "18.06.04.01",
      "description": "BEFORE DEVELOPMENT. Agent class identity from the agent-id symbol. Expected output: The generated cases with a derived and with an explicit class name prove the outputs of AIFACTORY-TASK-853 and AIFACTORY-TASK-805 to AIFACTORY-TASK-808 (AC2 of AIFACTORY-US-100): the agent class, its tools, MCP tool and wrapper, the MCP method and the manifest entry_agent_class are renamed and no SampleFactoryAgent name remains.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on the identity cases | dotnet test -c Release --no-build on the identity cases | dotnet new connectsoft-ai-agent -n ConnectSoft.Probe --agent-id connectsoft-probe -o probe && ! grep -r SampleFactoryAgent probe.",
      "acceptanceCriteria": [
        "The generated cases with a derived and with an explicit class name prove the outputs of AIFACTORY-TASK-853 and AIFACTORY-TASK-805 to AIFACTORY-TASK-808 (AC2 of AIFACTORY-US-100): the agent class, its tools, MCP tool and wrapper, the MCP method and the manifest entry_agent_class are renamed and no SampleFactoryAgent name remains."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-567]",
      "number": 567
    },
    {
      "id": "AIFACTORY-TASK-568",
      "type": "task",
      "parent": "AIFACTORY-US-100",
      "title": "MCP demo tools behind a switch that is off by default",
      "sequence": "18.06.04.02",
      "description": "BEFORE DEVELOPMENT. MCP demo tools behind a switch that is off by default. Expected output: The generated cases with the switch off and on prove the outputs of AIFACTORY-TASK-854 and AIFACTORY-TASK-809 to AIFACTORY-TASK-811 (AC3 of AIFACTORY-US-100): the demo tools and their response types exist only when IncludeMcpSamples is true and the default MCP surface exposes the agent operation alone.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on the two switch cases | dotnet test -c Release --no-build on the two switch cases.",
      "acceptanceCriteria": [
        "The generated cases with the switch off and on prove the outputs of AIFACTORY-TASK-854 and AIFACTORY-TASK-809 to AIFACTORY-TASK-811 (AC3 of AIFACTORY-US-100): the demo tools and their response types exist only when IncludeMcpSamples is true and the default MCP surface exposes the agent operation alone."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-568]",
      "number": 568
    },
    {
      "id": "AIFACTORY-TASK-569",
      "type": "task",
      "parent": "AIFACTORY-US-100",
      "title": "A neutral exemplar agent in place of the demo analytics",
      "sequence": "18.06.04.03",
      "description": "BEFORE DEVELOPMENT. A neutral exemplar agent in place of the demo analytics. Expected output: The generated default case proves the outputs of AIFACTORY-TASK-855, AIFACTORY-TASK-812 and AIFACTORY-TASK-815 (AC4 of AIFACTORY-US-100): the exemplar executes one typed operation on its inputs and returns a typed output, no hard-coded figures remain, and the unit and acceptance tests assert the exemplar.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on the default case | dotnet test -c Release --no-build on the default case.",
      "acceptanceCriteria": [
        "The generated default case proves the outputs of AIFACTORY-TASK-855, AIFACTORY-TASK-812 and AIFACTORY-TASK-815 (AC4 of AIFACTORY-US-100): the exemplar executes one typed operation on its inputs and returns a typed output, no hard-coded figures remain, and the unit and acceptance tests assert the exemplar."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-569]",
      "number": 569
    },
    {
      "id": "AIFACTORY-TASK-570",
      "type": "task",
      "parent": "AIFACTORY-US-100",
      "title": "Option names of the generation guide match the merge script",
      "sequence": "18.06.04.04",
      "description": "BEFORE DEVELOPMENT. Option names of the generation guide match the merge script. Expected output: The option-name test of AIFACTORY-TASK-814 passes on the authoring solution and proves the outputs of AIFACTORY-TASK-813 and AIFACTORY-TASK-814 (AC5 of AIFACTORY-US-100): Docs/Template Generation Guide.md names the kebab-case options of the compose pipeline.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The option-name test of AIFACTORY-TASK-814 passes on the authoring solution and proves the outputs of AIFACTORY-TASK-813 and AIFACTORY-TASK-814 (AC5 of AIFACTORY-US-100): Docs/Template Generation Guide.md names the kebab-case options of the compose pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-570]",
      "number": 570
    },
    {
      "id": "AIFACTORY-TASK-664",
      "type": "task",
      "parent": "AIFACTORY-US-100",
      "title": "Verify agent-template-identity-delivered by running the declared command",
      "sequence": "18.06.04.05",
      "description": "BEFORE DEVELOPMENT. Verify agent-template-identity-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every identity case of the matrix; they pass and prove AC1 to AC5 of AIFACTORY-US-100.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every identity case of the matrix; they pass and prove AC1 to AC5 of AIFACTORY-US-100."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 6,
      "phase": "templates-and-libraries",
      "stackRank": 604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-664]",
      "number": 664
    },
    {
      "id": "AIFACTORY-FEAT-154",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Agent host template: Factory agent base, handoff envelope and lifecycle stages",
      "sequence": "18.07",
      "description": "The template has no generic agent abstraction and no event-driven handoff contract: the only agent is the concrete demo, the messaging model carries one create command and one created event, and no run, attempt or handoff event travels with the trace, blueprint and origin of the agent (Docs/Generic Agent Audit Report.md of the template, gaps 3 and 4). This feature adds the Factory agent base that every scaffolded agent derives from, the accepted envelope with the Factory scope on every message, and the lifecycle stages the runtime needs, Cancelled included. It builds on the single execution port of the earlier feature. Component: AI Agent host template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-096. Increment I0: Readiness. Build order 7 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-142",
        "AIFACTORY-US-143",
        "AIFACTORY-US-144",
        "AIFACTORY-US-101"
      ],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 700,
      "titlePrefix": "[AIFACTORY-FEAT-154]",
      "number": 154
    },
    {
      "id": "AIFACTORY-US-142",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-154",
      "title": "Agent host template: every scaffolded agent derives from the library FactoryAgentBase that enforces trace metadata and bounded attempts with backoff",
      "sequence": "18.07.01",
      "description": "As an asset maintainer, I want every agent scaffolded from the template to derive from the one Factory agent base of the Factory libraries that owns the lifecycle, so that a concrete agent implements only its prompt and its validation, and no agent executes without trace metadata. The Factory agent base is library code: `IFactoryAgent`, `AgentRequest`, `AgentResult` and `AgentValidationResult` live in `ConnectSoft.Extensions.AI.Factory.Abstractions` and `FactoryAgentBase` with its accept, prompt, run, validate, retry, complete or escalate pipeline lives in `ConnectSoft.Extensions.AI.Factory`, as ADR-0014 and docs/planes/agent-runtime/agent-runtime.md record. The exemplar `SampleFactoryAgent` of the template already derives from that base through the package references, so the template creates no second base; gap 3 of the audit report of the template is stale against the model on this point. What the template owns is the pin of the library version whose base refuses to execute an agent whose request carries no trace metadata (trace id, blueprint id, agent origin and the Factory scope of the earlier feature) instead of stamping it, and whose retry vocabulary says attempts with a backoff as ADR-0026 decision 6 unifies it; the host options for the attempt count and the backoff and their binding from the generated configuration; the registration of the escalation sink of the host; and the tests on the generated host that prove the pipeline, the refusal and the escalation. The refusal of a request without trace metadata is a PBI of the library feature `component-extensions-ai` (D113); the template consumes it by pin and changes no library type. The base, the contract types, the escalation sinks and their unit tests that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are the starting point: the first task of this PBI builds and tests them, keeps what passes and moves every shared type that still sits in the template to the libraries of that feature. Kind: enabling. Traces: adrs: ADR-0014, ADR-0026, ADR-0028. Depends on: feature:component-extensions-ai. Sources: model/components.yaml, docs/planes/agent-runtime/agent-runtime.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0026-requirements-to-ux-handoff.md.",
      "acceptanceCriteria": [
        "AC1: Given a concrete agent of a generated host that derives from the library `FactoryAgentBase` at the pinned version, when its execute operation runs with a scoped request, then the base accepts, builds the prompt, runs the model, validates, retries within the configured attempts with the configured backoff and completes or escalates, in the order docs/planes/agent-runtime/agent-runtime.md describes; the concrete agent implements only the prompt and the validation and the template defines no base of its own.",
        "AC2: Given a request without the trace id or the Factory scope (tenant, project, run and attempt), when the pinned library base is asked to execute on a generated host, then it refuses before any model call and records the refusal with its reason; the blueprint id is refused only when the host adds it to the required set of the library options, and the agent origin is stamped by the base and is never required of a caller; a unit test on the generated host proves the refusal and that the model is never invoked (ADR-0014 keeps the trace id diagnostic and the scope authoritative).",
        "AC3: Given validation fails on every attempt, when the attempts are exhausted, then the base escalates through the escalation sink the host registers with the issues of the last attempt and ends the attempt as failed with a failure class; the host options say attempts and backoff as ADR-0026 decision 6 requires and bind from the generated configuration, and the unit tests cover first-attempt success, retry then success and escalation."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/planes/agent-runtime/agent-runtime.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-856",
        "AIFACTORY-TASK-816",
        "AIFACTORY-TASK-817",
        "AIFACTORY-TASK-818",
        "AIFACTORY-TASK-819"
      ],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 701,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0026",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "docs/planes/agent-runtime/agent-runtime.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md"
      ],
      "titlePrefix": "[AIFACTORY-US-142]",
      "number": 142
    },
    {
      "id": "AIFACTORY-TASK-856",
      "type": "task",
      "parent": "AIFACTORY-US-142",
      "title": "Compile and test the recorded Factory agent base work and hand the shared types to the libraries",
      "sequence": "18.07.01.01",
      "description": "BEFORE DEVELOPMENT. Compile and test the recorded Factory agent base work and hand the shared types to the libraries. Expected output: The `IFactoryAgent`, `FactoryAgentBase`, request, result and validation types, the escalation sinks and the unit tests that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are built and tested on the authoring solution; what passes is kept, what fails is corrected or removed; every shared type is moved to `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory` under the feature `component-extensions-ai` and no copy remains in the template, which keeps its exemplar and its tests against the package reference (D113, the starting point of AC1 of AIFACTORY-US-142).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The `IFactoryAgent`, `FactoryAgentBase`, request, result and validation types, the escalation sinks and the unit tests that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are built and tested on the authoring solution; what passes is kept, what fails is corrected or removed; every shared type is moved to `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory` under the feature `component-extensions-ai` and no copy remains in the template, which keeps its exemplar and its tests against the package reference (D113, the starting point of AC1 of AIFACTORY-US-142)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-856]",
      "number": 856
    },
    {
      "id": "AIFACTORY-TASK-816",
      "type": "task",
      "parent": "AIFACTORY-US-142",
      "title": "Pin the Factory libraries at the version with the trace-metadata refusal and the attempts-and-backoff options",
      "sequence": "18.07.01.02",
      "description": "BEFORE DEVELOPMENT. Pin the Factory libraries at the version with the trace-metadata refusal and the attempts-and-backoff options. Expected output: The template pins `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory` at the version whose `FactoryAgentBase` refuses a request without trace metadata and whose retry options say attempts and backoff (ADR-0026 decision 6); the host exposes the attempt count and the backoff as options bound from the generated configuration; no `IFactoryAgent`, `FactoryAgentBase` or request, result or validation type is defined in the template.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template pins `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory` at the version whose `FactoryAgentBase` refuses a request without trace metadata and whose retry options say attempts and backoff (ADR-0026 decision 6); the host exposes the attempt count and the backoff as options bound from the generated configuration; no `IFactoryAgent`, `FactoryAgentBase` or request, result or validation type is defined in the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-816]",
      "number": 816
    },
    {
      "id": "AIFACTORY-TASK-817",
      "type": "task",
      "parent": "AIFACTORY-US-142",
      "title": "Host-side wiring of the retry options and the escalation sink",
      "sequence": "18.07.01.03",
      "description": "BEFORE DEVELOPMENT. Host-side wiring of the retry options and the escalation sink. Expected output: The generated host binds the attempts and backoff options from its configuration into the library base, registers its escalation sink, and records a refusal of the base with its reason in the host log; an attempt whose attempts are exhausted ends as failed with the failure class the base assigns.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated host binds the attempts and backoff options from its configuration into the library base, registers its escalation sink, and records a refusal of the base with its reason in the host log; an attempt whose attempts are exhausted ends as failed with the failure class the base assigns."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-817]",
      "number": 817
    },
    {
      "id": "AIFACTORY-TASK-818",
      "type": "task",
      "parent": "AIFACTORY-US-142",
      "title": "Exemplar derived from the base and unit tests with a scripted model",
      "sequence": "18.07.01.04",
      "description": "BEFORE DEVELOPMENT. Exemplar derived from the base and unit tests with a scripted model. Expected output: The exemplar derives from the library `FactoryAgentBase` and implements only its prompt and validation; unit tests with a scripted model and recording doubles cover first-attempt success, retry then success, escalation after exhaustion and the trace-metadata refusal.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The exemplar derives from the library `FactoryAgentBase` and implements only its prompt and validation; unit tests with a scripted model and recording doubles cover first-attempt success, retry then success, escalation after exhaustion and the trace-metadata refusal."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 701,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-818]",
      "number": 818
    },
    {
      "id": "AIFACTORY-TASK-819",
      "type": "task",
      "parent": "AIFACTORY-US-142",
      "title": "Verify the Factory agent base on the authoring and generated solutions",
      "sequence": "18.07.01.05",
      "description": "BEFORE DEVELOPMENT. Verify the Factory agent base on the authoring and generated solutions. Expected output: Run `dotnet test -c Release --no-build` on the authoring solution and on a generated host; the base tests pass and prove AC1 to AC3 of AIFACTORY-US-142, including the refusal of an agent without trace metadata (ADR-0014).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the authoring solution and on a generated host; the base tests pass and prove AC1 to AC3 of AIFACTORY-US-142, including the refusal of an agent without trace metadata (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-819]",
      "number": 819
    },
    {
      "id": "AIFACTORY-US-143",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-154",
      "title": "Agent host template: the command, the event and the lifecycle events of the host carry the library envelope, the base-profile outbox writes it and the inbox dead-letters a message without scope",
      "sequence": "18.07.02",
      "description": "As an asset maintainer, I want every message a generated agent host publishes or consumes to carry the envelope of ADR-0014 with the Factory scope, so that every event of an attempt is attributable to its tenant, project, run and attempt and a message without scope never reaches a handler. The envelope is library code: `AgentEventEnvelope` of `ConnectSoft.Extensions.AI.Factory.Messaging` carries event id, occurred-at, agent id, trace id, blueprint id, agent origin and workflow step with no tenant, project, run, step, attempt or schema-version field, which the context of ADR-0014 records. The MessagingModel project of the template holds only the aggregate command and the aggregate event and references that package. The envelope and the lifecycle event types that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are the starting point: the first task of this PBI builds and tests them, keeps what passes and moves the shared types to the messaging library. The tenant and project scope in the contracts is AIFACTORY-TASK-161 of `component-extensions-ai`, the run id, step id, attempt id and schema version on `AgentEventEnvelope` are a PBI of the same feature (D113), and the outbox that writes the ADR-0014 envelope on every published message in the transaction of the state transition is the work of `component-base-template-factory-profile` (AIFACTORY-TASK-580), which the agent template composes on through its base-template submodule. This PBI is narrowed to what the template owns: the aggregate command and event of the template and the agent lifecycle events carry the library envelope at the pinned version (event id, schema version, occurred-at, trusted tenant id, project id, run id, step id and attempt id where applicable, correlation id, causation id, producer identity and event type, with the trace id, blueprint id and agent origin kept as diagnostic fields); the generated host registers the inbox validation of the base profile so that a message without a tenant, project, run or attempt where one is required is dead-lettered with the reason recorded and never handled; and a scope-less message is proven dead-lettered on the generated host. The earlier envelope version is read for the stated window through the additive versioning of the library, as ADR-0014 decision 6 requires. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0028. Depends on: AIFACTORY-US-142, feature:component-extensions-ai, feature:component-base-template-factory-profile. Sources: model/components.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/reference/event-envelope.md.",
      "acceptanceCriteria": [
        "AC1: Given a generated host publishes its aggregate command, its aggregate event or a lifecycle event, when the outbox of the base profile writes the record, then the message carries event id, schema version, occurred-at, tenant id, project id, run id, step id and attempt id where applicable, correlation id, causation id, producer identity and event type as ADR-0014 decision 1 lists them, and the record is written in the same transaction as the state transition (ADR-0012 decision 4); the registrations come from the base-template submodule, the message types from the pinned library.",
        "AC2: Given a message arrives at the inbox of a generated host without a tenant, project, run or attempt where one is required, when the inbox validation the host registers from the base profile runs, then the message is dead-lettered with the reason recorded and no handler runs; a test on the generated host proves the dead-letter and the absence of a handler call (ADR-0014).",
        "AC3: Given a message of the earlier envelope version, when the inbox reads it, then it is accepted for the stated compatibility window and mapped to the new version, as ADR-0014 decision 6 requires; a contract test asserts the required fields of ADR-0014 decision 1 (event id, schema version, occurred-at, tenant id, project id, run id, step id, attempt id, correlation id, causation id, producer identity, event type) on the envelope of every message type of the host, and docs/reference/event-envelope.md is revised to that field list so that it becomes a valid oracle afterwards."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/reference/event-envelope.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-857",
        "AIFACTORY-TASK-820",
        "AIFACTORY-TASK-821",
        "AIFACTORY-TASK-822",
        "AIFACTORY-TASK-852",
        "AIFACTORY-TASK-823"
      ],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 702,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-142",
        "feature:component-extensions-ai",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/reference/event-envelope.md"
      ],
      "titlePrefix": "[AIFACTORY-US-143]",
      "number": 143
    },
    {
      "id": "AIFACTORY-TASK-857",
      "type": "task",
      "parent": "AIFACTORY-US-143",
      "title": "Compile and test the recorded envelope work and hand the shared types to the messaging library",
      "sequence": "18.07.02.01",
      "description": "BEFORE DEVELOPMENT. Compile and test the recorded envelope work and hand the shared types to the messaging library. Expected output: The `AgentEventEnvelope` and the lifecycle event types that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are built and tested with the aggregate command and event of the template; what passes is kept, what fails is corrected or removed; the envelope and every shared message type are moved to `ConnectSoft.Extensions.AI.Factory.Messaging` under the feature `component-extensions-ai` and no envelope type remains in the template (D113, the starting point of AC1 of AIFACTORY-US-143).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The `AgentEventEnvelope` and the lifecycle event types that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are built and tested with the aggregate command and event of the template; what passes is kept, what fails is corrected or removed; the envelope and every shared message type are moved to `ConnectSoft.Extensions.AI.Factory.Messaging` under the feature `component-extensions-ai` and no envelope type remains in the template (D113, the starting point of AC1 of AIFACTORY-US-143)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-857]",
      "number": 857
    },
    {
      "id": "AIFACTORY-TASK-820",
      "type": "task",
      "parent": "AIFACTORY-US-143",
      "title": "Pin the library and submodule versions that carry the envelope and the outbox",
      "sequence": "18.07.02.02",
      "description": "BEFORE DEVELOPMENT. Pin the library and submodule versions that carry the envelope and the outbox. Expected output: The template pins `ConnectSoft.Extensions.AI.Factory.Messaging` at the version whose `AgentEventEnvelope` carries the fields of ADR-0014 decision 1 in a new schema version, and moves the base-template submodule to the commit of AIFACTORY-TASK-580 whose outbox writes that envelope in the transaction of the state transition; the aggregate command and event of the template and the lifecycle events derive from the pinned envelope; no envelope type is defined in the template.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The template pins `ConnectSoft.Extensions.AI.Factory.Messaging` at the version whose `AgentEventEnvelope` carries the fields of ADR-0014 decision 1 in a new schema version, and moves the base-template submodule to the commit of AIFACTORY-TASK-580 whose outbox writes that envelope in the transaction of the state transition; the aggregate command and event of the template and the lifecycle events derive from the pinned envelope; no envelope type is defined in the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-820]",
      "number": 820
    },
    {
      "id": "AIFACTORY-TASK-821",
      "type": "task",
      "parent": "AIFACTORY-US-143",
      "title": "Inbox validation of the base profile registered on the generated host",
      "sequence": "18.07.02.03",
      "description": "BEFORE DEVELOPMENT. Inbox validation of the base profile registered on the generated host. Expected output: The generated host registers the inbox validation of the base profile for every consumed message type so that a message without a required tenant, project, run or attempt is dead-lettered with the reason recorded before any handler runs; the registration is generated for every messaging profile the host can be generated with.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated host registers the inbox validation of the base profile for every consumed message type so that a message without a required tenant, project, run or attempt is dead-lettered with the reason recorded before any handler runs; the registration is generated for every messaging profile the host can be generated with."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-821]",
      "number": 821
    },
    {
      "id": "AIFACTORY-TASK-822",
      "type": "task",
      "parent": "AIFACTORY-US-143",
      "title": "Envelope contract test and the earlier-version compatibility fixture on the generated host",
      "sequence": "18.07.02.04",
      "description": "BEFORE DEVELOPMENT. Envelope contract test and the earlier-version compatibility fixture on the generated host. Expected output: A contract test on the generated host asserts the required fields of ADR-0014 decision 1 on the envelope of every message type of the host; a fixture feeds a message of the earlier version and asserts that it is accepted and mapped; a fixture feeds a scope-less message and asserts the dead-letter and the absence of a handler call.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A contract test on the generated host asserts the required fields of ADR-0014 decision 1 on the envelope of every message type of the host; a fixture feeds a message of the earlier version and asserts that it is accepted and mapped; a fixture feeds a scope-less message and asserts the dead-letter and the absence of a handler call."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 702,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-822]",
      "number": 822
    },
    {
      "id": "AIFACTORY-TASK-852",
      "type": "task",
      "parent": "AIFACTORY-US-143",
      "title": "Event envelope reference revised to the field list of ADR-0014 decision 1",
      "sequence": "18.07.02.05",
      "description": "BEFORE DEVELOPMENT. Event envelope reference revised to the field list of ADR-0014 decision 1. Expected output: docs/reference/event-envelope.md lists the required fields of ADR-0014 decision 1 (event id, schema version, occurred-at, tenant id, project id, run id, step id, attempt id, correlation id, causation id, producer identity, event type) with the trace id as a diagnostic field, drops the admonition that the envelope exists only in documentation, and names `AgentEventEnvelope` of `ConnectSoft.Extensions.AI.Factory.Messaging` as its binding; the strict documentation build passes.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate | mkdocs build --strict.",
      "acceptanceCriteria": [
        "docs/reference/event-envelope.md lists the required fields of ADR-0014 decision 1 (event id, schema version, occurred-at, tenant id, project id, run id, step id, attempt id, correlation id, causation id, producer identity, event type) with the trace id as a diagnostic field, drops the admonition that the envelope exists only in documentation, and names `AgentEventEnvelope` of `ConnectSoft.Extensions.AI.Factory.Messaging` as its binding; the strict documentation build passes."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 702,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-852]",
      "number": 852
    },
    {
      "id": "AIFACTORY-TASK-823",
      "type": "task",
      "parent": "AIFACTORY-US-143",
      "title": "Verify the envelope on the outbox and the inbox of a generated host",
      "sequence": "18.07.02.06",
      "description": "BEFORE DEVELOPMENT. Verify the envelope on the outbox and the inbox of a generated host. Expected output: Run `dotnet test -c Release --no-build` on a generated host; the contract, outbox and inbox tests pass and prove AC1 to AC3 of AIFACTORY-US-143 against ADR-0014 decision 1, and docs/reference/event-envelope.md agrees with the asserted field list.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on a generated host; the contract, outbox and inbox tests pass and prove AC1 to AC3 of AIFACTORY-US-143 against ADR-0014 decision 1, and docs/reference/event-envelope.md agrees with the asserted field list."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-823]",
      "number": 823
    },
    {
      "id": "AIFACTORY-US-144",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-154",
      "title": "Agent host template: the library lifecycle events map onto the attempt events AgentRuntimeService models, with the outcome, the observed cancellation and the sub-agent delegation on the envelope",
      "sequence": "18.07.03",
      "description": "As an asset maintainer, I want a generated agent host to publish the lifecycle of an attempt under the event names AgentRuntimeService models, as one event family with a Cancelled outcome, so that the runtime and Run Control observe every terminal outcome of an attempt, cancellation included, on one timeline. The lifecycle stages and events are library code: `AgentLifecycleStage` of `ConnectSoft.Extensions.AI.Factory.Abstractions` has Accepted, OutputValidated, Completed, Failed and Escalated, and `FactoryAgentBase` publishes `AgentRunAccepted`, `AgentOutputValidated`, `AgentRunCompleted`, `AgentRunFailed` and `AgentRunEscalated` through `IAgentLifecyclePublisher` with an `AgentLifecycleEventMapper`. There is no Cancelled stage; cancellation and unexpected exceptions rethrow without a terminal event, which the context of ADR-0014 records. The Cancelled stage and the terminal Failed with a failure class before rethrow of ADR-0014 decision 2 are PBIs of the library feature `component-extensions-ai` (D113) and are consumed by the template through its pin. The lifecycle stage, the five lifecycle event types, the publisher bridge and the lifecycle acceptance feature that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are the starting point: the first task of this PBI builds and tests them, keeps what passes and moves the shared types to the libraries of that feature. The work of the template is the mapping of the lifecycle events of the library onto the envelope of ADR-0014 as one event family and not a second timeline, under the event names model/services/agent-mesh/AgentRuntimeService.yaml already gives an attempt: `AttemptStarted`, `AttemptPhaseChanged`, `AttemptCheckpointed`, `AttemptDecisionRequested`, `AttemptCancellationObserved`, `AttemptOutcomeReported` and `SubAgentDelegated`. The template introduces no event name of its own (D113). Accepted maps to `AttemptStarted`; Completed maps to `AttemptOutcomeReported` with the outcome value Succeeded; Failed, with or without a preceding Escalated, maps to one `AttemptOutcomeReported` with the outcome value Failed and its failure class; Cancelled maps to `AttemptCancellationObserved`, followed by `AttemptOutcomeReported` with the outcome value Cancelled; and a handoff to a sub-agent is published by the execution port as `SubAgentDelegated` with the child run id, the child agent id and the depth. The typed body an agent hands to the next step, as ADR-0026 types the handoff, is the output of the attempt whose hash the outcome event carries, and is not an event. `AttemptPhaseChanged`, `AttemptCheckpointed` and `AttemptDecisionRequested` belong to the attempt loop that AgentRuntimeService adds on the scaffolded host at I1 and are not published by the lifecycle pipeline of the template. A cancellation request stops the attempt within the cancellation budget of the host options and the port passes the token into the base. The port also calls the trace context method of the single observability registration with the `AgentTraceContext` of the request for the length of the attempt, because `connectsoft.factory.agent_id` is written on activities and log records only while an agent host makes that call (AIFACTORY-US-257 of the feature `component-observability-factory-conventions`); the call lives in the generated host and not in the library base, since a reference from `ConnectSoft.Extensions.AI.Factory` to the observability libraries would close a cycle. The acceptance suite of the template covers each stage on the real host, and the events of the host are its timeline, never the authoritative lifecycle of Run Control, which ADR-0024 keeps as the single writer of run truth. Kind: enabling. Traces: adrs: ADR-0014, ADR-0024, ADR-0026, ADR-0028. Depends on: AIFACTORY-US-142, AIFACTORY-US-143, feature:component-extensions-ai, feature:component-observability-factory-conventions. Sources: model/components.yaml, docs/planes/agent-runtime/agent-runtime.md, docs/planes/agent-runtime/services/agent-runtime-service/index.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0024-durable-execution-substrate.md, model/services/agent-mesh/AgentRuntimeService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an attempt runs through the execution port of a generated host, when the library base publishes Accepted, Completed or Failed, with or without a preceding Escalated, or the port delegates to a sub-agent, then exactly one of `AttemptStarted`, `AttemptOutcomeReported` with the outcome value Succeeded, `AttemptOutcomeReported` with the outcome value Failed and its failure class, or `SubAgentDelegated` with the child run id, the child agent id and the depth is published on the envelope of ADR-0014 under the name model/services/agent-mesh/AgentRuntimeService.yaml gives that event; no event of the unmapped library family and no event name of the template is published beside it, and an attempt reports one outcome; the acceptance suite covers each stage on the real host (docs/planes/agent-runtime/agent-runtime.md).",
        "AC2: Given a cancellation request arrives during an attempt, when the pipeline observes it, then the attempt stops within the cancellation budget of the host options and the Cancelled stage of the pinned library base is mapped to `AttemptCancellationObserved`, followed by `AttemptOutcomeReported` with the outcome value Cancelled as a terminal outcome distinct from Failed, as ADR-0014 decision 2 requires; a test proves the stop time is within the budget and that no outcome Succeeded follows.",
        "AC3: Given an unexpected exception during an attempt, when the pipeline unwinds, then the terminal Failed of the pinned library base is mapped to `AttemptOutcomeReported` with the outcome value Failed and its failure class and published before the exception is rethrown (ADR-0014 decision 2); the events of the host remain its timeline and the authoritative outcome stays with Run Control (ADR-0024 decision 5)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/planes/agent-runtime/agent-runtime.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-858",
        "AIFACTORY-TASK-824",
        "AIFACTORY-TASK-825",
        "AIFACTORY-TASK-1304",
        "AIFACTORY-TASK-826",
        "AIFACTORY-TASK-827"
      ],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 703,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-142",
        "AIFACTORY-US-143",
        "feature:component-extensions-ai",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/components.yaml",
        "docs/planes/agent-runtime/agent-runtime.md",
        "docs/planes/agent-runtime/services/agent-runtime-service/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-144]",
      "number": 144
    },
    {
      "id": "AIFACTORY-TASK-858",
      "type": "task",
      "parent": "AIFACTORY-US-144",
      "title": "Compile and test the recorded lifecycle work and hand the shared types to the libraries",
      "sequence": "18.07.03.01",
      "description": "BEFORE DEVELOPMENT. Compile and test the recorded lifecycle work and hand the shared types to the libraries. Expected output: The `AgentLifecycleStage`, the five lifecycle event types, the lifecycle publisher bridge and the lifecycle acceptance feature that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are built and tested on the authoring solution; what passes is kept, what fails is corrected or removed; the stage and the shared event types are moved to `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory.Messaging` under the feature `component-extensions-ai` and no copy remains in the template (D113, the starting point of AC1 of AIFACTORY-US-144).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The `AgentLifecycleStage`, the five lifecycle event types, the lifecycle publisher bridge and the lifecycle acceptance feature that `Docs/Generic Agent Implementation Summary.md` of the template records as written without a compiler are built and tested on the authoring solution; what passes is kept, what fails is corrected or removed; the stage and the shared event types are moved to `ConnectSoft.Extensions.AI.Factory.Abstractions` and `ConnectSoft.Extensions.AI.Factory.Messaging` under the feature `component-extensions-ai` and no copy remains in the template (D113, the starting point of AC1 of AIFACTORY-US-144)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-858]",
      "number": 858
    },
    {
      "id": "AIFACTORY-TASK-824",
      "type": "task",
      "parent": "AIFACTORY-US-144",
      "title": "Mapping of the library lifecycle events onto the attempt event names AgentRuntimeService models",
      "sequence": "18.07.03.02",
      "description": "BEFORE DEVELOPMENT. Mapping of the library lifecycle events onto the attempt event names AgentRuntimeService models. Expected output: The messaging model of the template defines `AttemptStarted`, `AttemptCancellationObserved`, `AttemptOutcomeReported` with the outcome value and, for a failure, its failure class, and `SubAgentDelegated` with the child run id, the child agent id and the depth on the pinned envelope, under the names model/services/agent-mesh/AgentRuntimeService.yaml gives these events and with no event name of its own, and a mapper from the library lifecycle events (Accepted to started, Completed to the outcome Succeeded, Failed with or without a preceding Escalated to one outcome Failed with its class, Cancelled to the observed cancellation followed by the outcome Cancelled) that replaces the default `AgentLifecycleEventMapper` so that one event family is published; the Cancelled stage itself is consumed from the pinned library.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The messaging model of the template defines `AttemptStarted`, `AttemptCancellationObserved`, `AttemptOutcomeReported` with the outcome value and, for a failure, its failure class, and `SubAgentDelegated` with the child run id, the child agent id and the depth on the pinned envelope, under the names model/services/agent-mesh/AgentRuntimeService.yaml gives these events and with no event name of its own, and a mapper from the library lifecycle events (Accepted to started, Completed to the outcome Succeeded, Failed with or without a preceding Escalated to one outcome Failed with its class, Cancelled to the observed cancellation followed by the outcome Cancelled) that replaces the default `AgentLifecycleEventMapper` so that one event family is published; the Cancelled stage itself is consumed from the pinned library."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 703,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-824]",
      "number": 824
    },
    {
      "id": "AIFACTORY-TASK-825",
      "type": "task",
      "parent": "AIFACTORY-US-144",
      "title": "Lifecycle publisher registration, cancellation budget and sub-agent delegation from the port",
      "sequence": "18.07.03.03",
      "description": "BEFORE DEVELOPMENT. Lifecycle publisher registration, cancellation budget and sub-agent delegation from the port. Expected output: The generated host registers the mapping publisher as its `IAgentLifecyclePublisher`; the execution port passes the cancellation token into the base and enforces the cancellation budget of the host options; the port publishes `SubAgentDelegated` with the child run id, the child agent id and the depth when the agent hands work to a sub-agent; the terminal Failed and Cancelled of the pinned base reach the envelope as `AttemptOutcomeReported` before rethrow.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated host registers the mapping publisher as its `IAgentLifecyclePublisher`; the execution port passes the cancellation token into the base and enforces the cancellation budget of the host options; the port publishes `SubAgentDelegated` with the child run id, the child agent id and the depth when the agent hands work to a sub-agent; the terminal Failed and Cancelled of the pinned base reach the envelope as `AttemptOutcomeReported` before rethrow."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-825]",
      "number": 825
    },
    {
      "id": "AIFACTORY-TASK-1304",
      "type": "task",
      "parent": "AIFACTORY-US-144",
      "title": "Agent attribute on the telemetry of an attempt through the trace context method of the observability registration",
      "sequence": "18.07.03.04",
      "description": "BEFORE DEVELOPMENT. Agent attribute on the telemetry of an attempt through the trace context method of the observability registration. Expected output: The generated agent host pins the observability libraries at the version that carries the single enrichment registration and its trace context method, calls the registration once, and its execution port calls the trace context method with the `AgentTraceContext` of the request for the length of the attempt, so that the activities and log records of the attempt carry `connectsoft.factory.agent_id` with the agent origin beside the scope attributes and a signal outside an attempt carries none (AC5 of AIFACTORY-US-257, ADR-0014 decision 1); the call is made by the generated host and not by the library base, so no `ConnectSoft.Extensions.AI` package references the observability libraries; a test on the generated host reads the attribute from an activity and a log record of an attempt exported to the in-memory exporter and finds it absent outside the attempt.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated agent host pins the observability libraries at the version that carries the single enrichment registration and its trace context method, calls the registration once, and its execution port calls the trace context method with the `AgentTraceContext` of the request for the length of the attempt, so that the activities and log records of the attempt carry `connectsoft.factory.agent_id` with the agent origin beside the scope attributes and a signal outside an attempt carries none (AC5 of AIFACTORY-US-257, ADR-0014 decision 1); the call is made by the generated host and not by the library base, so no `ConnectSoft.Extensions.AI` package references the observability libraries; a test on the generated host reads the attribute from an activity and a log record of an attempt exported to the in-memory exporter and finds it absent outside the attempt."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1304]",
      "number": 1304
    },
    {
      "id": "AIFACTORY-TASK-826",
      "type": "task",
      "parent": "AIFACTORY-US-144",
      "title": "Acceptance scenarios per lifecycle stage on the real host",
      "sequence": "18.07.03.05",
      "description": "BEFORE DEVELOPMENT. Acceptance scenarios per lifecycle stage on the real host. Expected output: The acceptance suite of the template runs one scenario per stage on the real host, started, succeeded, failed, cancelled and delegated to a sub-agent, asserts the event name against model/services/agent-mesh/AgentRuntimeService.yaml, its envelope and its outcome value and, for cancellation, the stop within the budget, and asserts that no unmapped library event and no event under another name is published beside the family.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The acceptance suite of the template runs one scenario per stage on the real host, started, succeeded, failed, cancelled and delegated to a sub-agent, asserts the event name against model/services/agent-mesh/AgentRuntimeService.yaml, its envelope and its outcome value and, for cancellation, the stop within the budget, and asserts that no unmapped library event and no event under another name is published beside the family."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-826]",
      "number": 826
    },
    {
      "id": "AIFACTORY-TASK-827",
      "type": "task",
      "parent": "AIFACTORY-US-144",
      "title": "Verify the lifecycle stages on a generated host",
      "sequence": "18.07.03.06",
      "description": "BEFORE DEVELOPMENT. Verify the lifecycle stages on a generated host. Expected output: Run `dotnet test -c Release --no-build` on a generated host; the acceptance scenarios of the five stages pass and prove AC1 to AC3 of AIFACTORY-US-144, the Cancelled outcome of ADR-0014 included, under the event names of model/services/agent-mesh/AgentRuntimeService.yaml.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on a generated host; the acceptance scenarios of the five stages pass and prove AC1 to AC3 of AIFACTORY-US-144, the Cancelled outcome of ADR-0014 included, under the event names of model/services/agent-mesh/AgentRuntimeService.yaml."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-827]",
      "number": 827
    },
    {
      "id": "AIFACTORY-US-101",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-154",
      "title": "Agent host template: Factory agent base, handoff envelope and lifecycle stages is delivered and proven on a generated solution",
      "sequence": "18.07.04",
      "description": "As an asset maintainer, I want AI Agent host template to carry a Factory agent base, handoff envelope and lifecycle stages, so that it serves AgentRuntimeService and WorkflowEngineService without later rework. This is the integration PBI of the feature. The asset maintainer packs the agent template with the pinned Factory agent base, the library envelope on the base-profile outbox and inbox and the lifecycle mapping with Cancelled of the earlier PBIs, installs the package and instantiates it in the template pipeline. Every generated case restores, builds and passes its unit, architecture and acceptance tests, the lifecycle scenarios included, before the package is allowed to publish with a verified version; a case that fails any stage fails the run and blocks publication. The migrated tasks of this PBI are its proofs on the generated solution; the implementation lives in the behaviour PBIs and in the library and base-template features the feature depends on. The feature is done when every scaffolded agent derives from the library base and an agent without trace metadata is refused before execution, every message of the host carries the ADR-0014 envelope with a scope-less message dead-lettered, and the attempt events are published as one family under the names AgentRuntimeService models, with a Cancelled outcome that stops within the budget, which AgentRuntimeService and WorkflowEngineService need from the host they are scaffolded from (ADR-0024, ADR-0028). Kind: enabling. Traces: adrs: ADR-0014, ADR-0024, ADR-0026, ADR-0028. Depends on: AIFACTORY-US-142, AIFACTORY-US-143, AIFACTORY-US-144. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/planes/agent-runtime/agent-runtime.md, model/services/agent-mesh/AgentRuntimeService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.AI.SoftwareFactory.AgentTemplate 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, the lifecycle acceptance scenarios included, before the package publishes with a verified version (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-571 (IFactoryAgent and FactoryAgentBase) is done, then the library interface and base class with execute, self-validate and retry, escalation and trace-metadata enforcement are pinned, the exemplar derives from the base, and a test proves that an agent without trace metadata is refused before execution (docs/planes/agent-runtime/agent-runtime.md).",
        "AC3: Given the work of AIFACTORY-TASK-572 (the accepted envelope on every message of the host) is done, then the command, the event and the lifecycle events of the messaging model carry the ADR-0014 envelope with tenant, project, run, attempt, trace and the agent origin, the base-profile outbox writes it and the registered inbox validation checks it, and a message without scope is dead-lettered with a reason.",
        "AC4: Given the work of AIFACTORY-TASK-573 (run, attempt and handoff lifecycle events with a Cancelled stage) is done, then `AttemptStarted`, `AttemptCancellationObserved`, `AttemptOutcomeReported` with its outcome value and `SubAgentDelegated` are published from the lifecycle pipeline as one event family under the names model/services/agent-mesh/AgentRuntimeService.yaml gives them, the template defines no event name of its own, the Cancelled stage stops the attempt within the cancellation budget, and the acceptance suite covers each stage (ADR-0014 decision 2, ADR-0024 decision 5)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-571",
        "AIFACTORY-TASK-572",
        "AIFACTORY-TASK-573",
        "AIFACTORY-TASK-662"
      ],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 704,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-142",
        "AIFACTORY-US-143",
        "AIFACTORY-US-144"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "model/services/agent-mesh/AgentRuntimeService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-101]",
      "number": 101
    },
    {
      "id": "AIFACTORY-TASK-571",
      "type": "task",
      "parent": "AIFACTORY-US-101",
      "title": "IFactoryAgent and FactoryAgentBase",
      "sequence": "18.07.04.01",
      "description": "BEFORE DEVELOPMENT. IFactoryAgent and FactoryAgentBase. Expected output: The generated cases prove the outputs of AIFACTORY-TASK-856 and AIFACTORY-TASK-816 to AIFACTORY-TASK-819 (AC2 of AIFACTORY-US-101): the exemplar derives from the pinned library base and a test proves that an agent without trace metadata is refused before execution.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on every generated case | dotnet test -c Release --no-build on every generated case.",
      "acceptanceCriteria": [
        "The generated cases prove the outputs of AIFACTORY-TASK-856 and AIFACTORY-TASK-816 to AIFACTORY-TASK-819 (AC2 of AIFACTORY-US-101): the exemplar derives from the pinned library base and a test proves that an agent without trace metadata is refused before execution."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-571]",
      "number": 571
    },
    {
      "id": "AIFACTORY-TASK-572",
      "type": "task",
      "parent": "AIFACTORY-US-101",
      "title": "The accepted envelope on every message of the host",
      "sequence": "18.07.04.02",
      "description": "BEFORE DEVELOPMENT. The accepted envelope on every message of the host. Expected output: The generated cases prove the outputs of AIFACTORY-TASK-857 and AIFACTORY-TASK-820 to AIFACTORY-TASK-823 (AC3 of AIFACTORY-US-101): every message of the host carries the ADR-0014 envelope, the outbox writes it and a scope-less message is dead-lettered with a reason.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on every generated case | dotnet test -c Release --no-build on every generated case.",
      "acceptanceCriteria": [
        "The generated cases prove the outputs of AIFACTORY-TASK-857 and AIFACTORY-TASK-820 to AIFACTORY-TASK-823 (AC3 of AIFACTORY-US-101): every message of the host carries the ADR-0014 envelope, the outbox writes it and a scope-less message is dead-lettered with a reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-572]",
      "number": 572
    },
    {
      "id": "AIFACTORY-TASK-573",
      "type": "task",
      "parent": "AIFACTORY-US-101",
      "title": "Run, attempt and handoff lifecycle events with a Cancelled stage",
      "sequence": "18.07.04.03",
      "description": "BEFORE DEVELOPMENT. Run, attempt and handoff lifecycle events with a Cancelled stage. Expected output: The generated cases prove the outputs of AIFACTORY-TASK-858 and AIFACTORY-TASK-824 to AIFACTORY-TASK-827 (AC4 of AIFACTORY-US-101): the attempt events are published as one family under the names AgentRuntimeService models, the Cancelled stage stops the attempt within the budget and the acceptance suite covers each stage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on every generated case | dotnet test -c Release --no-build on every generated case.",
      "acceptanceCriteria": [
        "The generated cases prove the outputs of AIFACTORY-TASK-858 and AIFACTORY-TASK-824 to AIFACTORY-TASK-827 (AC4 of AIFACTORY-US-101): the attempt events are published as one family under the names AgentRuntimeService models, the Cancelled stage stops the attempt within the budget and the acceptance suite covers each stage."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-573]",
      "number": 573
    },
    {
      "id": "AIFACTORY-TASK-662",
      "type": "task",
      "parent": "AIFACTORY-US-101",
      "title": "Verify agent-template-contract-delivered by running the declared command",
      "sequence": "18.07.04.04",
      "description": "BEFORE DEVELOPMENT. Verify agent-template-contract-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case of the matrix; they pass and prove AC1 to AC4 of AIFACTORY-US-101.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case of the matrix; they pass and prove AC1 to AC4 of AIFACTORY-US-101."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/planes/agent-runtime/agent-runtime.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/Generic Agent Audit Report.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 7,
      "phase": "templates-and-libraries",
      "stackRank": 704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-662]",
      "number": 662
    },
    {
      "id": "AIFACTORY-FEAT-155",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Agent host template: model access through the Factory and the Orleans messaging profile",
      "sequence": "18.08",
      "description": "The template reaches model providers directly through its provider switches (Azure OpenAI, OpenAI, Ollama, Azure AI inference) and executes tools inside the host, while the Factory allows model calls only through ModelRouterService and tool execution only through ToolAdapterService (ADR-0028, single-entry rules). Its messaging switch offers MassTransit and NServiceBus but not the Orleans outbox and inbox adapter the runtime uses (ADR-0024). This feature adds the switches a Factory agent host is scaffolded with: a model client that routes through the model gateway and returns a receipt, a tool client that calls the tool gateway, and the Orleans messaging profile. The Anthropic adapter itself is library work of the earlier feature. Component: AI Agent host template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-097. Increment I0: Readiness. Build order 8 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-145",
        "AIFACTORY-US-146",
        "AIFACTORY-US-147",
        "AIFACTORY-US-102"
      ],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 800,
      "titlePrefix": "[AIFACTORY-FEAT-155]",
      "number": 155
    },
    {
      "id": "AIFACTORY-US-145",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-155",
      "title": "Agent host template: the UseFactoryModelRouter switch routes every completion through the model gateway with the attempt scope and keeps its receipt",
      "sequence": "18.08.01",
      "description": "As an asset maintainer, I want a generated Factory agent host to reach models only through the model gateway of the Factory, so that ModelRouterService stays the only service that calls a model provider and every completion of an attempt has a receipt. The template reaches model providers directly through the choice `MicrosoftExtensionsAIServiceProvider` (OpenAI, AzureOpenAI, AzureAIInference, Ollama) behind `EnableMicrosoftExtensionsAI`, whose computed `Use...Provider` symbols select the provider registration, while ADR-0028 decision 3 makes `ModelRouterService` the only service that calls model providers and its gateway the only route to it. This PBI adds the `UseFactoryModelRouter` switch to the compose pipeline. With the switch on, the `IChatClient` of the host is the Factory model client of the AI libraries of `component-extensions-ai` that calls the model gateway with the attempt scope of the library trace context bound by AIFACTORY-US-136 of `component-agent-template` (tenant, project, run, step, attempt), the model policy of the step and the correlation id, and keeps the receipt id of every completion on the attempt record. The template engine has no cross-symbol constraint, so no combination is refused at generation; instead, with the switch on, the computed provider symbols are forced false and the provider registration and the provider key settings are excluded, so that a generated host carries no provider registration and no provider key whatever provider choice was passed. The switch is on by default for the `attempt-runtime` value of the `agent-host-kind` symbol of AIFACTORY-US-138. A model gateway that is unreachable ends the completion with a failure class the lifecycle pipeline publishes on the envelope of AIFACTORY-US-143 of `component-agent-template-contract`, never with a fallback to a direct provider. Kind: enabling. Traces: adrs: ADR-0028. Depends on: feature:component-extensions-ai, feature:component-agent-template, feature:component-agent-template-contract. Sources: model/components.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/planes/agent-runtime/agent-runtime.md.",
      "acceptanceCriteria": [
        "AC1: Given a host generated with `UseFactoryModelRouter` on, when the exemplar runs a completion, then the `IChatClient` of the host calls the model gateway with the tenant, project, run, step and attempt identity of the trace context and the model policy of the step, and the receipt id of the completion is kept on the attempt record (ADR-0028 decision 3, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC2: Given `UseFactoryModelRouter` is on, when a host is generated with any value of `MicrosoftExtensionsAIServiceProvider`, then the computed provider symbols are false, no provider registration and no provider key setting is generated, and the host builds; the switch and the forced symbols appear in model/template-parameters/connectsoft-ai-agent.yaml after the next inventory.",
        "AC3: Given the model gateway is unreachable, when a completion is attempted, then the attempt ends with the outcome value Failed and its failure class published on `AttemptOutcomeReported`, the event name AgentRuntimeService models, and no direct provider is called; a test with a fake gateway proves the receipt on success and the failure class on an unreachable gateway (ADR-0028 decision 3 keeps the gateway the only route to the model provider)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-828",
        "AIFACTORY-TASK-829",
        "AIFACTORY-TASK-830",
        "AIFACTORY-TASK-831"
      ],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 801,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-extensions-ai",
        "feature:component-agent-template",
        "feature:component-agent-template-contract"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/planes/agent-runtime/agent-runtime.md"
      ],
      "titlePrefix": "[AIFACTORY-US-145]",
      "number": 145
    },
    {
      "id": "AIFACTORY-TASK-828",
      "type": "task",
      "parent": "AIFACTORY-US-145",
      "title": "UseFactoryModelRouter symbol that forces the provider symbols off",
      "sequence": "18.08.01.01",
      "description": "BEFORE DEVELOPMENT. UseFactoryModelRouter symbol that forces the provider symbols off. Expected output: The merge script and the template configuration define `UseFactoryModelRouter`, on by default for the `attempt-runtime` host kind; with the switch on the computed `UseMicrosoftExtensionsAI...Provider` symbols are forced false and the provider registration files and provider key settings are excluded, whatever value `MicrosoftExtensionsAIServiceProvider` carries.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet new connectsoft-ai-agent --UseFactoryModelRouter true --microsoft-extensions-ai-provider AzureOpenAI -o probe && a scan of probe finds no provider registration and no provider key setting | dotnet build probe -c Release.",
      "acceptanceCriteria": [
        "The merge script and the template configuration define `UseFactoryModelRouter`, on by default for the `attempt-runtime` host kind; with the switch on the computed `UseMicrosoftExtensionsAI...Provider` symbols are forced false and the provider registration files and provider key settings are excluded, whatever value `MicrosoftExtensionsAIServiceProvider` carries."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 801,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-828]",
      "number": 828
    },
    {
      "id": "AIFACTORY-TASK-829",
      "type": "task",
      "parent": "AIFACTORY-US-145",
      "title": "Factory model client registered as the IChatClient with scope, policy and receipt",
      "sequence": "18.08.01.02",
      "description": "BEFORE DEVELOPMENT. Factory model client registered as the IChatClient with scope, policy and receipt. Expected output: With the switch on, the host registers the Factory model client of the AI libraries as its `IChatClient`; the client sends the attempt scope, the model policy and the correlation id with every completion and stores the receipt id on the attempt record; an unreachable gateway ends the completion with a failure class.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With the switch on, the host registers the Factory model client of the AI libraries as its `IChatClient`; the client sends the attempt scope, the model policy and the correlation id with every completion and stores the receipt id on the attempt record; an unreachable gateway ends the completion with a failure class."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-829]",
      "number": 829
    },
    {
      "id": "AIFACTORY-TASK-830",
      "type": "task",
      "parent": "AIFACTORY-US-145",
      "title": "Fake model gateway fixture for the generated-host tests",
      "sequence": "18.08.01.03",
      "description": "BEFORE DEVELOPMENT. Fake model gateway fixture for the generated-host tests. Expected output: A fake model gateway in the test projects of the template returns a receipt for a completion and simulates an unreachable gateway; the acceptance tests of a host with the switch on run against it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A fake model gateway in the test projects of the template returns a receipt for a completion and simulates an unreachable gateway; the acceptance tests of a host with the switch on run against it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 801,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-830]",
      "number": 830
    },
    {
      "id": "AIFACTORY-TASK-831",
      "type": "task",
      "parent": "AIFACTORY-US-145",
      "title": "Verify model access through the gateway on a generated host",
      "sequence": "18.08.01.04",
      "description": "BEFORE DEVELOPMENT. Verify model access through the gateway on a generated host. Expected output: Generate a host with `UseFactoryModelRouter` on and a provider choice passed, build it and run its tests against the fake gateway; the receipt and failure-class tests pass and the scan finds no provider registration or key setting, which proves AC1 to AC3 of AIFACTORY-US-145 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Generate a host with `UseFactoryModelRouter` on and a provider choice passed, build it and run its tests against the fake gateway; the receipt and failure-class tests pass and the scan finds no provider registration or key setting, which proves AC1 to AC3 of AIFACTORY-US-145 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-831]",
      "number": 831
    },
    {
      "id": "AIFACTORY-US-146",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-155",
      "title": "Agent host template: the UseFactoryToolAdapter switch sends tool invocations to the tool gateway with their side-effect class and keeps in-host execution for the default host development entry",
      "sequence": "18.08.02",
      "description": "As an asset maintainer, I want a generated Factory agent host to execute tools only through the tool gateway of the Factory, so that ToolAdapterService stays the only service that executes tools and no write-class tool runs inside an agent host. The template executes tools inside the host, while ADR-0028 decision 3 makes `ToolAdapterService` the only service that executes tools and ADR-0022 decision 2 sends every tool call, from a Factory agent included, through the governed executor with scope, policy decision, side-effect class, idempotency key, receipt and audit. This PBI adds the `UseFactoryToolAdapter` switch to the compose pipeline. With the switch on, the tool invocations of the agent go to the tool gateway with the attempt scope of the library trace context bound by AIFACTORY-US-136 of `component-agent-template`, the tool descriptor id and version and the side-effect class of the step, and the receipt of every invocation is kept on the attempt record. In-host tool execution is a development-only exception to ADR-0022 decision 2: the in-host executor is generated only for the development entry path of the default `agent` host kind, is excluded from the `attempt-runtime` and `workflow-engine` values of the `agent-host-kind` symbol of AIFACTORY-US-138, and is refused for every other path; a write-class tool (shared-write, external, production, publication or spend) is never executed in the host, and an attempt to do so is refused and recorded. The switch is on by default for the `attempt-runtime` host kind. A tool gateway that is unreachable ends the invocation with a failure class the lifecycle pipeline publishes. Kind: enabling. Traces: adrs: ADR-0022, ADR-0028. Depends on: AIFACTORY-US-145, feature:component-agent-template, feature:component-agent-template-contract. Sources: model/components.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/adr/0022-mcp-as-tool-protocol.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a host generated with `UseFactoryToolAdapter` on, when the agent invokes a tool, then the invocation goes to the tool gateway with the attempt scope, the descriptor id and version and the side-effect class of the step, and the receipt is kept on the attempt record, as ADR-0022 decision 2 and ADR-0028 decision 3 require.",
        "AC2: Given a host with the switch on, when a write-class tool (shared-write, external, production, publication or spend) is requested for in-host execution through any path, then the host refuses and records the refusal; a test proves that the tool is not executed in the host (docs/architecture/adr/0022-mcp-as-tool-protocol.md).",
        "AC3: Given the development entry path of a generated host of the default `agent` kind, when a read or sandbox tool is invoked in-host, then it executes locally and is recorded with its side-effect class as a development-only exception to ADR-0022 decision 2; the in-host executor is generated for that path alone, is excluded from the `attempt-runtime` and `workflow-engine` host kinds so that a generated Factory host contains no in-host executor, and the switch appears in model/template-parameters/connectsoft-ai-agent.yaml after the next inventory."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-832",
        "AIFACTORY-TASK-833",
        "AIFACTORY-TASK-834",
        "AIFACTORY-TASK-835"
      ],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 802,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-145",
        "feature:component-agent-template",
        "feature:component-agent-template-contract"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-146]",
      "number": 146
    },
    {
      "id": "AIFACTORY-TASK-832",
      "type": "task",
      "parent": "AIFACTORY-US-146",
      "title": "UseFactoryToolAdapter symbol and the development-only in-host executor of the default host kind",
      "sequence": "18.08.02.01",
      "description": "BEFORE DEVELOPMENT. UseFactoryToolAdapter symbol and the development-only in-host executor of the default host kind. Expected output: The merge script and the template configuration define `UseFactoryToolAdapter`, on by default for the `attempt-runtime` host kind; the in-host tool executor is generated only for the development entry path of the `agent` host kind and is excluded for the `attempt-runtime` and `workflow-engine` kinds; the exception is recorded in the generation guide as development-only against ADR-0022 decision 2.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet new connectsoft-ai-agent --agent-host-kind attempt-runtime -o probe && a scan of probe finds no in-host tool executor.",
      "acceptanceCriteria": [
        "The merge script and the template configuration define `UseFactoryToolAdapter`, on by default for the `attempt-runtime` host kind; the in-host tool executor is generated only for the development entry path of the `agent` host kind and is excluded for the `attempt-runtime` and `workflow-engine` kinds; the exception is recorded in the generation guide as development-only against ADR-0022 decision 2."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 802,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-832]",
      "number": 832
    },
    {
      "id": "AIFACTORY-TASK-833",
      "type": "task",
      "parent": "AIFACTORY-US-146",
      "title": "Factory tool client with scope, descriptor, side-effect class and receipt",
      "sequence": "18.08.02.02",
      "description": "BEFORE DEVELOPMENT. Factory tool client with scope, descriptor, side-effect class and receipt. Expected output: With the switch on, tool invocations of the agent go to the tool gateway with the attempt scope, the descriptor id and version and the side-effect class; the receipt is kept on the attempt record; a write-class tool requested in-host is refused and recorded; an unreachable gateway ends the invocation with a failure class.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With the switch on, tool invocations of the agent go to the tool gateway with the attempt scope, the descriptor id and version and the side-effect class; the receipt is kept on the attempt record; a write-class tool requested in-host is refused and recorded; an unreachable gateway ends the invocation with a failure class."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-833]",
      "number": 833
    },
    {
      "id": "AIFACTORY-TASK-834",
      "type": "task",
      "parent": "AIFACTORY-US-146",
      "title": "Fake tool gateway fixture and the write-class refusal test",
      "sequence": "18.08.02.03",
      "description": "BEFORE DEVELOPMENT. Fake tool gateway fixture and the write-class refusal test. Expected output: A fake tool gateway in the test projects returns a receipt per invocation; a test requests a write-class tool in-host through every entry path and asserts the refusal and that no local execution happened.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A fake tool gateway in the test projects returns a receipt per invocation; a test requests a write-class tool in-host through every entry path and asserts the refusal and that no local execution happened."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-834]",
      "number": 834
    },
    {
      "id": "AIFACTORY-TASK-835",
      "type": "task",
      "parent": "AIFACTORY-US-146",
      "title": "Verify tool access through the gateway on a generated host",
      "sequence": "18.08.02.04",
      "description": "BEFORE DEVELOPMENT. Verify tool access through the gateway on a generated host. Expected output: Generate a host with `UseFactoryToolAdapter` on, build it and run its tests against the fake tool gateway; the receipt, refusal and development-path tests pass and the attempt-runtime probe carries no in-host executor, which proves AC1 to AC3 of AIFACTORY-US-146 (ADR-0022).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Generate a host with `UseFactoryToolAdapter` on, build it and run its tests against the fake tool gateway; the receipt, refusal and development-path tests pass and the attempt-runtime probe carries no in-host executor, which proves AC1 to AC3 of AIFACTORY-US-146 (ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-835]",
      "number": 835
    },
    {
      "id": "AIFACTORY-US-147",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-155",
      "title": "Agent host template: MessagingModelType accepts Orleans from the base template and a Factory host kind defaults to the Orleans outbox and inbox profile",
      "sequence": "18.08.03",
      "description": "As an asset maintainer, I want a generated agent host to carry the Orleans messaging profile with its outbox dispatcher and inbox grains, so that the two Agent Mesh silo kinds run on the durable substrate and the messaging profile the Factory decided on. The compose pipeline of the agent template forces two symbols of the base template: `MessagingModelType` to the constant MassTransit and `UseMassTransit` to the computed value true, so that the messaging choice cannot be changed at generation. ADR-0012 makes the Orleans outbox and inbox adapter the default profile of Factory hosts and ADR-0024 makes Orleans grains the durability substrate of attempts and workflow runs. The Orleans value of `MessagingModelType` with the registration of the Orleans messaging adapter library, the outbox dispatcher and the inbox grains and the ADR-0014 envelope on every outbox record is the work of `component-base-template-factory-profile` (AIFACTORY-TASK-580); the agent template composes on it through its base-template submodule (`inherits: connectsoft-base`), so the choice arrives through the submodule pointer. The owner decided the outcome (D113): the forced MassTransit constant is removed, the Orleans messaging profile is the default of the Factory host kinds and MassTransit stays a selectable transport. This PBI moves the submodule to the commit that carries that choice, stops forcing both symbols so that they derive from the choice again, makes the registration of the MassTransit lifecycle publisher of `ConnectSoft.Extensions.AI.Factory.Messaging.MassTransit` follow the MassTransit choice in place of being unconditional, defaults the choice to Orleans for the `attempt-runtime` and `workflow-engine` values of the `agent-host-kind` symbol of AIFACTORY-US-138, and adds only what is agent-specific: the lifecycle publisher of AIFACTORY-US-144 on the Orleans outbox and the messaging service name of the agent. The MassTransit and NServiceBus profiles stay available as transports and are never used for run or workflow state, and the saga scaffolding of the FlowModel project is excluded from every Factory host kind and from the Orleans profile, as ADR-0024 decision 4 removes broker sagas from the design. The generated configuration smoke tests of the template cover the Orleans profile. Kind: enabling. Traces: adrs: ADR-0012, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-145, feature:component-base-template-factory-profile, feature:component-agent-template, feature:component-agent-template-contract. Sources: model/components.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given the agent template on the base-template submodule that carries the Orleans choice, when a host is generated with `MessagingModelType` Orleans, then the host registers the Orleans messaging adapter library, the outbox dispatcher and the inbox grains with its actor model as the base template feature `component-base-template-factory-profile` generates them, the outbox record carries the envelope and is written with the state transition in one transaction (ADR-0012 decision 4, ADR-0024 decision 1), and the agent template adds the lifecycle publisher on that outbox and the messaging service name of the agent.",
        "AC2: Given the attempt-runtime or the workflow-engine host kind, when a host is generated without an explicit messaging value, then its messaging profile is Orleans; `MessagingModelType` is no longer forced to MassTransit and `UseMassTransit` is no longer computed true in the compose pipeline, the generated host contains no MassTransit registration, a host generated with an explicit MassTransit value still carries the MassTransit transport and its lifecycle publisher, and the choice appears in model/template-parameters/connectsoft-ai-agent.yaml after the next inventory.",
        "AC3: Given the generated configuration smoke tests of the template, when the Orleans case runs, then the host starts with its silo, outbox and inbox configured from the generated settings; the saga scaffolding of the flow model is excluded from every Factory host kind and from the Orleans profile and the generated host carries no saga type, as ADR-0024 decision 4 removes broker sagas from the design (docs/architecture/adr/0024-durable-execution-substrate.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-836",
        "AIFACTORY-TASK-837",
        "AIFACTORY-TASK-838",
        "AIFACTORY-TASK-839"
      ],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 803,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-145",
        "feature:component-base-template-factory-profile",
        "feature:component-agent-template",
        "feature:component-agent-template-contract"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-147]",
      "number": 147
    },
    {
      "id": "AIFACTORY-TASK-836",
      "type": "task",
      "parent": "AIFACTORY-US-147",
      "title": "Both forced messaging symbols released, Orleans default for the Factory host kinds and the saga files excluded",
      "sequence": "18.08.03.01",
      "description": "BEFORE DEVELOPMENT. Both forced messaging symbols released, Orleans default for the Factory host kinds and the saga files excluded. Expected output: `MessagingModelType` is no longer forced to the constant MassTransit and `UseMassTransit` is no longer computed true in build/Merge-AgentTemplateSymbols.ps1; both derive from the choice again; the `attempt-runtime` and `workflow-engine` host kinds default the choice to Orleans; the registration of the MassTransit lifecycle publisher is generated only when the MassTransit transport is chosen, which stays selectable; the FlowModel saga files are excluded behind the choice for every Factory host kind and for the Orleans profile.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet new connectsoft-ai-agent --help lists Orleans under MessagingModelType | dotnet new connectsoft-ai-agent --agent-host-kind attempt-runtime -o probe && a scan of probe finds no MassTransit registration and no saga type.",
      "acceptanceCriteria": [
        "`MessagingModelType` is no longer forced to the constant MassTransit and `UseMassTransit` is no longer computed true in build/Merge-AgentTemplateSymbols.ps1; both derive from the choice again; the `attempt-runtime` and `workflow-engine` host kinds default the choice to Orleans; the registration of the MassTransit lifecycle publisher is generated only when the MassTransit transport is chosen, which stays selectable; the FlowModel saga files are excluded behind the choice for every Factory host kind and for the Orleans profile."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 803,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-836]",
      "number": 836
    },
    {
      "id": "AIFACTORY-TASK-837",
      "type": "task",
      "parent": "AIFACTORY-US-147",
      "title": "Base-template submodule moved to the Orleans choice and the agent-specific additions",
      "sequence": "18.08.03.02",
      "description": "BEFORE DEVELOPMENT. Base-template submodule moved to the Orleans choice and the agent-specific additions. Expected output: The base-template submodule of the agent template is moved to the commit that carries the Orleans choice of AIFACTORY-TASK-580 (adapter registration, outbox dispatcher, inbox grains, envelope on the outbox record); the agent template adds only the lifecycle publisher on the Orleans outbox and the messaging service name of the agent; no registration of the base feature is re-implemented in the template.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The base-template submodule of the agent template is moved to the commit that carries the Orleans choice of AIFACTORY-TASK-580 (adapter registration, outbox dispatcher, inbox grains, envelope on the outbox record); the agent template adds only the lifecycle publisher on the Orleans outbox and the messaging service name of the agent; no registration of the base feature is re-implemented in the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-837]",
      "number": 837
    },
    {
      "id": "AIFACTORY-TASK-838",
      "type": "task",
      "parent": "AIFACTORY-US-147",
      "title": "Configuration smoke test case for the Orleans profile",
      "sequence": "18.08.03.03",
      "description": "BEFORE DEVELOPMENT. Configuration smoke test case for the Orleans profile. Expected output: The generated configuration smoke tests of the template matrix gain an Orleans case that starts the host with its silo, outbox and inbox from the generated settings and asserts the registrations and the absence of a saga type.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: the template pipeline runs the Orleans smoke case and it passes.",
      "acceptanceCriteria": [
        "The generated configuration smoke tests of the template matrix gain an Orleans case that starts the host with its silo, outbox and inbox from the generated settings and asserts the registrations and the absence of a saga type."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 803,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-838]",
      "number": 838
    },
    {
      "id": "AIFACTORY-TASK-839",
      "type": "task",
      "parent": "AIFACTORY-US-147",
      "title": "Verify the Orleans profile on the generated Factory hosts",
      "sequence": "18.08.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the Orleans profile on the generated Factory hosts. Expected output: Generate the attempt-runtime and workflow-engine hosts with the default messaging profile; both carry Orleans, no MassTransit registration and no saga type, build, pass their tests and the smoke case, and a host generated with an explicit MassTransit value builds with the MassTransit transport and its lifecycle publisher, which proves AC1 to AC3 of AIFACTORY-US-147 (ADR-0012, ADR-0024).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Generate the attempt-runtime and workflow-engine hosts with the default messaging profile; both carry Orleans, no MassTransit registration and no saga type, build, pass their tests and the smoke case, and a host generated with an explicit MassTransit value builds with the MassTransit transport and its lifecycle publisher, which proves AC1 to AC3 of AIFACTORY-US-147 (ADR-0012, ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-839]",
      "number": 839
    },
    {
      "id": "AIFACTORY-US-102",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-155",
      "title": "Agent host template: model access through the Factory and the Orleans messaging profile is delivered and proven on a generated solution",
      "sequence": "18.08.04",
      "description": "As an asset maintainer, I want AI Agent host template to carry model access through the Factory and the Orleans messaging profile, so that it serves AgentRuntimeService and WorkflowEngineService without later rework. This is the integration PBI of the feature. The asset maintainer packs the agent template with the Factory model client switch, the Factory tool client switch and the Orleans messaging profile of the earlier PBIs, installs the package and instantiates it in the template pipeline across the access cases of the matrix: both Factory switches on with Orleans for each Factory host kind, the development case of the default host kind with in-host read tools, and the broker transports for comparison. Every generated case restores, builds, passes its tests against the fake gateways and passes the configuration smoke tests before the package is allowed to publish with a verified version; a case that fails any stage fails the run and blocks publication. The migrated tasks of this PBI are its proofs on the generated solution; the implementation lives in the behaviour PBIs and in the library and base-template features the feature depends on. The feature is done when a generated Factory host reaches models only through the model gateway with a receipt per completion, executes tools only through the tool gateway with their side-effect class, carries no provider registration and no in-host executor, refuses a write-class tool in-host, and defaults to the Orleans outbox and inbox, which is what ADR-0028 and ADR-0024 require of the hosts AgentRuntimeService and WorkflowEngineService are scaffolded from. Kind: enabling. Traces: adrs: ADR-0024, ADR-0028. Depends on: AIFACTORY-US-145, AIFACTORY-US-146, AIFACTORY-US-147, feature:component-agent-template, feature:component-agent-template-contract. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.AI.SoftwareFactory.AgentTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution of every access case builds, its tests pass against the fake gateways and the configuration smoke tests pass before the package publishes with a verified version (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-574 (model client switch UseFactoryModelRouter) is done, then with the switch on the IChatClient of the host is the Factory model client that calls the model gateway with the attempt scope and keeps the receipt id of every completion, no provider registration or key setting is generated when it is on, and a generated host with the switch builds and its tests pass (ADR-0028 decision 3, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC3: Given the work of AIFACTORY-TASK-575 (tool client switch UseFactoryToolAdapter) is done, then with the switch on tool invocations of the agent go to the tool gateway with the side-effect class of the step, in-host tool execution is generated only for the development entry path of the default host kind, and a test proves that a write-class tool is not executed in the host (ADR-0028 decision 3).",
        "AC4: Given the work of AIFACTORY-TASK-576 (messaging profile Orleans for the outbox and inbox) is done, then MessagingModelType accepts Orleans through the base-template submodule and the generated host registers the Orleans messaging adapter, the outbox dispatcher and the inbox grains, the default of a Factory host kind is Orleans, and the generated configuration smoke tests cover the profile (ADR-0024 decision 1, docs/architecture/adr/0024-durable-execution-substrate.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-574",
        "AIFACTORY-TASK-575",
        "AIFACTORY-TASK-576",
        "AIFACTORY-TASK-663"
      ],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 804,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-145",
        "AIFACTORY-US-146",
        "AIFACTORY-US-147",
        "feature:component-agent-template",
        "feature:component-agent-template-contract"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-102]",
      "number": 102
    },
    {
      "id": "AIFACTORY-TASK-574",
      "type": "task",
      "parent": "AIFACTORY-US-102",
      "title": "Model client switch UseFactoryModelRouter",
      "sequence": "18.08.04.01",
      "description": "BEFORE DEVELOPMENT. Model client switch UseFactoryModelRouter. Expected output: The generated access cases prove the outputs of AIFACTORY-TASK-828 to AIFACTORY-TASK-831 (AC2 of AIFACTORY-US-102): the IChatClient of a host with the switch on is the Factory model client with a receipt per completion and the probe carries no provider registration or key setting.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on the access cases | dotnet test -c Release --no-build on the access cases.",
      "acceptanceCriteria": [
        "The generated access cases prove the outputs of AIFACTORY-TASK-828 to AIFACTORY-TASK-831 (AC2 of AIFACTORY-US-102): the IChatClient of a host with the switch on is the Factory model client with a receipt per completion and the probe carries no provider registration or key setting."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-574]",
      "number": 574
    },
    {
      "id": "AIFACTORY-TASK-575",
      "type": "task",
      "parent": "AIFACTORY-US-102",
      "title": "Tool client switch UseFactoryToolAdapter",
      "sequence": "18.08.04.02",
      "description": "BEFORE DEVELOPMENT. Tool client switch UseFactoryToolAdapter. Expected output: The generated access cases prove the outputs of AIFACTORY-TASK-832 to AIFACTORY-TASK-835 (AC3 of AIFACTORY-US-102): tool invocations go to the tool gateway with their side-effect class, the in-host executor exists only on the development path of the default host kind, and a write-class tool is not executed in the host.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on the access cases | dotnet test -c Release --no-build on the access cases.",
      "acceptanceCriteria": [
        "The generated access cases prove the outputs of AIFACTORY-TASK-832 to AIFACTORY-TASK-835 (AC3 of AIFACTORY-US-102): tool invocations go to the tool gateway with their side-effect class, the in-host executor exists only on the development path of the default host kind, and a write-class tool is not executed in the host."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-575]",
      "number": 575
    },
    {
      "id": "AIFACTORY-TASK-576",
      "type": "task",
      "parent": "AIFACTORY-US-102",
      "title": "Messaging profile Orleans for the outbox and inbox",
      "sequence": "18.08.04.03",
      "description": "BEFORE DEVELOPMENT. Messaging profile Orleans for the outbox and inbox. Expected output: The generated Factory host kind cases prove the outputs of AIFACTORY-TASK-836 to AIFACTORY-TASK-839 (AC4 of AIFACTORY-US-102): the default messaging profile is Orleans with the adapter, outbox dispatcher and inbox grains registered and the configuration smoke case passes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release on the Factory host kind cases | dotnet test -c Release --no-build on the Factory host kind cases.",
      "acceptanceCriteria": [
        "The generated Factory host kind cases prove the outputs of AIFACTORY-TASK-836 to AIFACTORY-TASK-839 (AC4 of AIFACTORY-US-102): the default messaging profile is Orleans with the adapter, outbox dispatcher and inbox grains registered and the configuration smoke case passes."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-576]",
      "number": 576
    },
    {
      "id": "AIFACTORY-TASK-663",
      "type": "task",
      "parent": "AIFACTORY-US-102",
      "title": "Verify agent-template-factory-access-delivered by running the declared command",
      "sequence": "18.08.04.04",
      "description": "BEFORE DEVELOPMENT. Verify agent-template-factory-access-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every access case of the matrix; they pass and prove AC1 to AC4 of AIFACTORY-US-102.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every access case of the matrix; they pass and prove AC1 to AC4 of AIFACTORY-US-102."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 8,
      "phase": "templates-and-libraries",
      "stackRank": 804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-663]",
      "number": 663
    },
    {
      "id": "AIFACTORY-FEAT-156",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Agent host template: generated-solution gate and a publishable package",
      "sequence": "18.09",
      "description": "The last alignment pass of the template records a blocking generation defect inherited from the base template (a persistence provider substitution that leaves an unterminated JSON string in the generated configuration), stale symbols in the agent metadata, a submodule behind the base template, and a package publication that stays blocked until the generated cases pass their configuration smoke tests (Docs/AgentTemplate-Alignment-Verification.md of the template). The two Agent Mesh services are scaffolded only from a published package whose generated solution builds and passes. Component: AI Agent host template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-158. Increment I0: Readiness. Build order 11 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-148",
        "AIFACTORY-US-149",
        "AIFACTORY-US-150",
        "AIFACTORY-US-105"
      ],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1100,
      "titlePrefix": "[AIFACTORY-FEAT-156]",
      "number": 156
    },
    {
      "id": "AIFACTORY-US-148",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-156",
      "title": "Agent host template: the base-template submodule carries the substitution fix and the agent metadata holds no stale symbol",
      "sequence": "18.09.01",
      "description": "As an asset maintainer, I want the agent template to compose on a base template whose persistence substitution is fixed and on metadata whose symbols are current, so that a generated host no longer carries an unterminated JSON string in its configuration and the authoring solution builds in Release with zero errors. The alignment verification of the template (Docs/AgentTemplate-Alignment-Verification.md of the template) records a blocking generation defect inherited from the base template: the Dapper, PostgreSQL and MySQL persistence substitutions share a replacement marker and drop its closing quote, so the generated provider becomes an unterminated JSON string in the configuration even for the default NHibernate generation, and the same stale symbols sit in the agent-owned metadata. The verification states that the submodule contents are not patched and the configuration regression tests are not removed to bypass the failure. This PBI waits for the base template findings feature to carry the fix, then points the base-template submodule of the agent template at that base template, reconciles the agent metadata (the extend file, the merge script and the nuspec) so that no stale or duplicated symbol remains, and rebuilds the authoring solution in Release. The vulnerability audit of the authoring solution reports zero findings. A submodule pointer that does not carry the fix is refused by a pipeline check that generates the default case and runs its configuration smoke tests, in the shared template pipeline Docs/Shared-Template-CI.md of the template describes. Kind: enabling. Traces: adrs: ADR-0028. Depends on: feature:component-base-template-findings. Sources: model/components.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the base template findings feature has landed the substitution fix, when the base-template submodule of the agent template is moved to that base template, then the default generated case produces a configuration whose persistence provider is a terminated JSON string and its configuration smoke tests pass (feature component-base-template-findings, ADR-0028 amendment on the Factory templates).",
        "AC2: Given the agent-owned metadata (the extend file, the merge script and the nuspec), when the stale persistence symbols are reconciled, then no symbol of the metadata is absent from the composed template configuration and no symbol is defined twice; the inventory of model/template-parameters/connectsoft-ai-agent.yaml lists each symbol once after the next run.",
        "AC3: Given the reconciled authoring solution, when it builds in Release, then the build reports zero errors and the direct and transitive vulnerability audit reports zero findings; a pipeline check in the shared template pipeline (Docs/Shared-Template-CI.md of the template) refuses a submodule pointer whose default generated case fails the configuration smoke tests, which is the generated-solution gate docs/architecture/ecosystem-composition.md names as a need of this component."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-840",
        "AIFACTORY-TASK-841",
        "AIFACTORY-TASK-842",
        "AIFACTORY-TASK-843"
      ],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1101,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-148]",
      "number": 148
    },
    {
      "id": "AIFACTORY-TASK-840",
      "type": "task",
      "parent": "AIFACTORY-US-148",
      "title": "Base-template submodule moved to the base template with the substitution fix",
      "sequence": "18.09.01.01",
      "description": "BEFORE DEVELOPMENT. Base-template submodule moved to the base template with the substitution fix. Expected output: The base-template submodule of the agent template points at the base template commit that carries the persistence substitution fix; the default generated case has a terminated provider string in its configuration.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: the default generated case passes its configuration smoke tests.",
      "acceptanceCriteria": [
        "The base-template submodule of the agent template points at the base template commit that carries the persistence substitution fix; the default generated case has a terminated provider string in its configuration."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1101,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-840]",
      "number": 840
    },
    {
      "id": "AIFACTORY-TASK-841",
      "type": "task",
      "parent": "AIFACTORY-US-148",
      "title": "Agent metadata reconciled with the composed template configuration",
      "sequence": "18.09.01.02",
      "description": "BEFORE DEVELOPMENT. Agent metadata reconciled with the composed template configuration. Expected output: The extend file, the merge script and the nuspec of the agent template define no stale persistence symbol and no duplicate symbol; a test composes the template configuration and asserts that every metadata symbol appears exactly once.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The extend file, the merge script and the nuspec of the agent template define no stale persistence symbol and no duplicate symbol; a test composes the template configuration and asserts that every metadata symbol appears exactly once."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-841]",
      "number": 841
    },
    {
      "id": "AIFACTORY-TASK-842",
      "type": "task",
      "parent": "AIFACTORY-US-148",
      "title": "Submodule check in the template pipeline",
      "sequence": "18.09.01.03",
      "description": "BEFORE DEVELOPMENT. Submodule check in the template pipeline. Expected output: A pipeline step generates the default case from the current submodule and runs its configuration smoke tests; a pointer whose case fails the tests fails the run with the failing case named; the step is documented in Docs/Shared-Template-CI.md of the template.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: azure-pipelines.yml runs the submodule check and the run is green.",
      "acceptanceCriteria": [
        "A pipeline step generates the default case from the current submodule and runs its configuration smoke tests; a pointer whose case fails the tests fails the run with the failing case named; the step is documented in Docs/Shared-Template-CI.md of the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1101,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-842]",
      "number": 842
    },
    {
      "id": "AIFACTORY-TASK-843",
      "type": "task",
      "parent": "AIFACTORY-US-148",
      "title": "Verify the Release build and the audit of the reconciled authoring solution",
      "sequence": "18.09.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the Release build and the audit of the reconciled authoring solution. Expected output: Run `dotnet build -c Release` and the vulnerability audit on the authoring solution; zero errors and zero findings, and the default generated case passes its configuration smoke tests, which proves AC1 to AC3 of AIFACTORY-US-148.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and the vulnerability audit on the authoring solution; zero errors and zero findings, and the default generated case passes its configuration smoke tests, which proves AC1 to AC3 of AIFACTORY-US-148."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-843]",
      "number": 843
    },
    {
      "id": "AIFACTORY-US-149",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-156",
      "title": "Agent host template: the pipeline generates the Domain and Compatibility cases, builds and smoke-tests them, audits them and fails the run on any failing case",
      "sequence": "18.09.02",
      "description": "As an asset maintainer, I want every change of the agent template to be gated by its generated cases, so that a package that would generate a host that does not build, start or audit clean never reaches the feed. The alignment verification of the template ran one nested Domain case and three Compatibility cases by hand and recorded that their audits were not reached after the configuration smoke failure, so the earlier clean audit was no evidence for the final candidate. This PBI turns that manual pass into the generated-solution gate of the template pipeline, which docs/architecture/ecosystem-composition.md names as a need of this component and whose mechanism is the shared template pipeline of Docs/Shared-Template-CI.md of the template. On every change of the template, the pipeline packs and installs the template, generates the Domain case and the Compatibility cases together with the identity, access and host-kind cases of the earlier features, restores and builds each case in Release, runs its configuration smoke tests, its unit and architecture tests and the placeholder scan, and runs the direct and transitive vulnerability audit of each generated solution. A case that fails any stage fails the run with the case and the stage named, and no later stage of that case is reported as evidence. The gate runs before the publication stage, which is reached only when every case is green. The run keeps the logs of every case as its artifacts. This is an evidence PBI (D113): a template feature has no scenario to trace, so the gate names what it proves through `traces.adrs` and its sources: the ADR-0028 amendment on the Factory templates and the generated-solution need that docs/architecture/ecosystem-composition.md records for this component. Kind: evidence. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-148. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the agent template, when the pipeline runs, then it packs and installs the template, generates the Domain case, the Compatibility cases and the cases of the identity, access and host-kind features, and for each case restores, builds in Release, runs the configuration smoke tests, the unit and architecture tests, the placeholder scan and the vulnerability audit (ADR-0028 amendment on the Factory templates; mechanism in Docs/Shared-Template-CI.md and Docs/AgentTemplate-Alignment-Verification.md of the template).",
        "AC2: Given a case fails any stage, when the pipeline evaluates the run, then the run fails with the case and the stage named, no later stage of that case is reported as passed, and the publication stage is not reached; a fixture with a planted failing case proves the refusal (ADR-0028 amendment on the Factory templates: the two agent services are scaffolded only from a package whose generated solution passes).",
        "AC3: Given every case is green, when the pipeline reaches the publication stage, then the stage is enabled with the logs of every case kept as run artifacts, and the gate closes the generated-solution need that docs/architecture/ecosystem-composition.md records for this component."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-844",
        "AIFACTORY-TASK-845",
        "AIFACTORY-TASK-846",
        "AIFACTORY-TASK-847"
      ],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1102,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-148"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-149]",
      "number": 149
    },
    {
      "id": "AIFACTORY-TASK-844",
      "type": "task",
      "parent": "AIFACTORY-US-149",
      "title": "Generated-case matrix definition of the template pipeline",
      "sequence": "18.09.02.01",
      "description": "BEFORE DEVELOPMENT. Generated-case matrix definition of the template pipeline. Expected output: The template pipeline defines the Domain case, the Compatibility cases and the identity, access and host-kind cases with their generation options; each case is a named job that restores, builds, smoke-tests, tests, scans and audits its generated solution; the matrix is documented in Docs/Shared-Template-CI.md of the template.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: azure-pipelines.yml lists every case as a named job.",
      "acceptanceCriteria": [
        "The template pipeline defines the Domain case, the Compatibility cases and the identity, access and host-kind cases with their generation options; each case is a named job that restores, builds, smoke-tests, tests, scans and audits its generated solution; the matrix is documented in Docs/Shared-Template-CI.md of the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1102,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-844]",
      "number": 844
    },
    {
      "id": "AIFACTORY-TASK-845",
      "type": "task",
      "parent": "AIFACTORY-US-149",
      "title": "Fail-fast evaluation and publication stage dependency",
      "sequence": "18.09.02.02",
      "description": "BEFORE DEVELOPMENT. Fail-fast evaluation and publication stage dependency. Expected output: A failing stage of any case fails the run with the case and stage named and stops the later stages of that case; the publication stage depends on every case job and is skipped when one failed; the case logs are kept as run artifacts.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: a run with one failing case stops before publication and names the case.",
      "acceptanceCriteria": [
        "A failing stage of any case fails the run with the case and stage named and stops the later stages of that case; the publication stage depends on every case job and is skipped when one failed; the case logs are kept as run artifacts."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1102,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-845]",
      "number": 845
    },
    {
      "id": "AIFACTORY-TASK-846",
      "type": "task",
      "parent": "AIFACTORY-US-149",
      "title": "Planted failing case fixture for the gate",
      "sequence": "18.09.02.03",
      "description": "BEFORE DEVELOPMENT. Planted failing case fixture for the gate. Expected output: A pipeline fixture generates a case with a planted configuration defect and asserts that the run fails at the smoke stage with the case named and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: the planted-case run fails at the smoke stage.",
      "acceptanceCriteria": [
        "A pipeline fixture generates a case with a planted configuration defect and asserts that the run fails at the smoke stage with the case named and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-846]",
      "number": 846
    },
    {
      "id": "AIFACTORY-TASK-847",
      "type": "task",
      "parent": "AIFACTORY-US-149",
      "title": "Verify the generated-solution gate on a green and on a planted run",
      "sequence": "18.09.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the generated-solution gate on a green and on a planted run. Expected output: One pipeline run with every case green reaches the publication stage and one run with the planted case fails before it; both runs prove AC1 to AC3 of AIFACTORY-US-149 and close the generated-solution gate docs/architecture/ecosystem-composition.md names for this component.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "One pipeline run with every case green reaches the publication stage and one run with the planted case fails before it; both runs prove AC1 to AC3 of AIFACTORY-US-149 and close the generated-solution gate docs/architecture/ecosystem-composition.md names for this component."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-847]",
      "number": 847
    },
    {
      "id": "AIFACTORY-US-150",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-156",
      "title": "Agent host template: the package is published to the feed with a verified version and the two Agent Mesh hosts generate from it unchanged",
      "sequence": "18.09.03",
      "description": "As an asset maintainer, I want the agent template package on the feed with the version the readiness checklist names, so that AgentRuntimeService and WorkflowEngineService are scaffolded from a published package whose generated solution builds and passes. The alignment verification of the template keeps package publication blocked until the generated cases pass their configuration smoke tests, and lists the remaining release checks: full application suites run twice against the available services, the database concurrency verification repeated, the generated audits rerun after the base template checkpoint, and fresh pipeline timings and publication gates confirmed. This PBI publishes the package once the gate of the earlier PBI is green and those checks are recorded in the readiness checklist of the template. The publication stage pushes the package with the version the checklist names and refuses a version that is already on the feed or that the checklist does not name. A probe installs the published package and generates the attempt-runtime and workflow-engine hosts with the names of the two Agent Mesh services; both build in Release unchanged. The documentation repository re-runs its template inventory so that the parameter snapshot lists every switch of this epic; the inventory reads no package version, so the published version is recorded in the readiness checklist of the template and not in the model. This is an evidence PBI (D113): a template feature has no scenario to trace, so the probe names what it proves through `traces.adrs` and its sources: the two silo kinds of ADR-0028 decision 4 generate unchanged from the published `connectsoft-ai-agent` package, and model/template-parameters/connectsoft-ai-agent.yaml lists the switches of the epic. Kind: evidence. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-149. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-ai-agent.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the generated-solution gate is green and the readiness checklist records the remaining release checks, when the publication stage runs, then the package is pushed to the feed with the version the checklist names, and a version already on the feed or not named by the checklist is refused with the reason (ADR-0028 amendment on the Factory templates; the publication stage of Docs/Shared-Template-CI.md of the template).",
        "AC2: Given the published package, when `dotnet new install` of that version is followed by a generation of the attempt-runtime host named for AgentRuntimeService and of the workflow-engine host named for WorkflowEngineService, then both generated solutions build in Release unchanged (ADR-0028 amendment on the Factory templates, D94, which scaffolds the two silo kinds of decision 4 from `connectsoft-ai-agent`; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC3: Given the published package, when the documentation repository runs its template inventory, then every switch of this epic (`agent-host-kind`, `UseFactoryModelRouter`, `UseFactoryToolAdapter`, the Orleans choice of `MessagingModelType`, the derived default of `agent-class-name` and the flipped default of `IncludeMcpSamples`) appears in model/template-parameters/connectsoft-ai-agent.yaml and in the `switches` list of model/templates.yaml, and the row of the agent template in docs/architecture/catalogs/templates.md still renders."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-848",
        "AIFACTORY-TASK-849",
        "AIFACTORY-TASK-850",
        "AIFACTORY-TASK-851"
      ],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1103,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-149"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-ai-agent.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-150]",
      "number": 150
    },
    {
      "id": "AIFACTORY-TASK-848",
      "type": "task",
      "parent": "AIFACTORY-US-150",
      "title": "Readiness checklist completed with the remaining release checks",
      "sequence": "18.09.03.01",
      "description": "BEFORE DEVELOPMENT. Readiness checklist completed with the remaining release checks. Expected output: The readiness checklist of the template records the twice-run application suites, the repeated database concurrency verification, the rerun generated audits and the pipeline timings, and names the version to publish.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: the checklist names the version and every remaining check with its outcome.",
      "acceptanceCriteria": [
        "The readiness checklist of the template records the twice-run application suites, the repeated database concurrency verification, the rerun generated audits and the pipeline timings, and names the version to publish."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1103,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-848]",
      "number": 848
    },
    {
      "id": "AIFACTORY-TASK-849",
      "type": "task",
      "parent": "AIFACTORY-US-150",
      "title": "Publication stage with the version guard",
      "sequence": "18.09.03.02",
      "description": "BEFORE DEVELOPMENT. Publication stage with the version guard. Expected output: The publication stage pushes the package to the feed with the version the checklist names; a version already on the feed or not named by the checklist is refused with the reason and the run fails.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: azure-pipelines.yml publishes the package after the gate; a repeated version is refused.",
      "acceptanceCriteria": [
        "The publication stage pushes the package to the feed with the version the checklist names; a version already on the feed or not named by the checklist is refused with the reason and the run fails."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1103,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-849]",
      "number": 849
    },
    {
      "id": "AIFACTORY-TASK-850",
      "type": "task",
      "parent": "AIFACTORY-US-150",
      "title": "Published template configuration carries every switch of the epic for the inventory",
      "sequence": "18.09.03.03",
      "description": "BEFORE DEVELOPMENT. Published template configuration carries every switch of the epic for the inventory. Expected output: The template configuration of the published package names every switch of this epic with its description and choices, so that `python -I tools/docs_model inventory-templates` of the documentation repository lists them in the `switches` of model/templates.yaml and in model/template-parameters/connectsoft-ai-agent.yaml without a hand edit.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: python -I tools/docs_model inventory-templates in the documentation repository reports every switch of the epic.",
      "acceptanceCriteria": [
        "The template configuration of the published package names every switch of this epic with its description and choices, so that `python -I tools/docs_model inventory-templates` of the documentation repository lists them in the `switches` of model/templates.yaml and in model/template-parameters/connectsoft-ai-agent.yaml without a hand edit."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1103,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-850]",
      "number": 850
    },
    {
      "id": "AIFACTORY-TASK-851",
      "type": "task",
      "parent": "AIFACTORY-US-150",
      "title": "Verify the published package by generating the two Agent Mesh hosts",
      "sequence": "18.09.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the published package by generating the two Agent Mesh hosts. Expected output: Install the published version, generate the attempt-runtime host as ConnectSoft.AI.SoftwareFactory.AgentRuntimeService and the workflow-engine host as ConnectSoft.AI.SoftwareFactory.WorkflowEngineService, and build both in Release unchanged; this proves AC1 to AC3 of AIFACTORY-US-150 (ADR-0028).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Install the published version, generate the attempt-runtime host as ConnectSoft.AI.SoftwareFactory.AgentRuntimeService and the workflow-engine host as ConnectSoft.AI.SoftwareFactory.WorkflowEngineService, and build both in Release unchanged; this proves AC1 to AC3 of AIFACTORY-US-150 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-851]",
      "number": 851
    },
    {
      "id": "AIFACTORY-US-105",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-156",
      "title": "Agent host template: generated-solution gate and a publishable package is delivered and proven on a generated solution",
      "sequence": "18.09.04",
      "description": "As an asset maintainer, I want AI Agent host template to carry a generated-solution gate and a publishable package, so that it serves AgentRuntimeService and WorkflowEngineService without later rework. This is the integration PBI of the feature. With the submodule refreshed and the metadata reconciled, the generated-solution gate in the pipeline and the publication stage of the earlier PBIs, the asset maintainer runs the template pipeline end to end: pack, install, generate every case, restore, build, smoke-test, test, scan, audit, and publish with the verified version. A case that fails any stage fails the run and blocks publication with the case and stage named. The migrated tasks of this PBI are its proofs on the generated solution and on the published package; the implementation lives in the enabling PBI of the submodule and the metadata and in the tasks of the gate and probe evidence PBIs. The feature is done when the authoring solution builds in Release with zero errors, the gate runs on every change of the template and fails the run on any failing case, the package is on the feed with the version the readiness checklist names, and a fresh install of that package generates the two Agent Mesh hosts that build unchanged, which closes the blocked publication of the alignment verification and gives the ADR-0028 amendment on the Factory templates the published template AgentRuntimeService and WorkflowEngineService are scaffolded from. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-148, AIFACTORY-US-149, AIFACTORY-US-150. Sources: model/components.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.AI.SoftwareFactory.AgentTemplate 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-577 (base template submodule refreshed and agent metadata reconciled) is done, then the base-template submodule points at the base template that carries the substitution fix, the stale symbols of the agent metadata are removed, and the authoring solution builds in Release with zero errors (model/template-parameters/connectsoft-ai-agent.yaml lists each symbol once).",
        "AC3: Given the work of AIFACTORY-TASK-578 (generated-solution gate in the template pipeline) is done, then the pipeline generates the Domain and Compatibility cases, restores, builds, runs the configuration smoke tests and the vulnerability audit, fails the run when any case fails, and the gate runs on every change of the template (ADR-0028 amendment on the Factory templates; mechanism in Docs/Shared-Template-CI.md of the template).",
        "AC4: Given the work of AIFACTORY-TASK-579 (package published to the feed with a verified version) is done, then the template package is published with the version the readiness checklist names, and dotnet new install of the published package followed by a generation of the two Agent Mesh hosts builds unchanged (ADR-0028 amendment on the Factory templates, D94; docs/architecture/catalogs/templates.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-577",
        "AIFACTORY-TASK-578",
        "AIFACTORY-TASK-579",
        "AIFACTORY-TASK-665"
      ],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1104,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-148",
        "AIFACTORY-US-149",
        "AIFACTORY-US-150"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-105]",
      "number": 105
    },
    {
      "id": "AIFACTORY-TASK-577",
      "type": "task",
      "parent": "AIFACTORY-US-105",
      "title": "Base template submodule refreshed and agent metadata reconciled",
      "sequence": "18.09.04.01",
      "description": "BEFORE DEVELOPMENT. Base template submodule refreshed and agent metadata reconciled. Expected output: The authoring solution and the default generated case prove the outputs of AIFACTORY-TASK-840 to AIFACTORY-TASK-843 (AC2 of AIFACTORY-US-105): the submodule carries the substitution fix, the metadata holds no stale symbol and the Release build reports zero errors.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet build -c Release | the default generated case passes its configuration smoke tests.",
      "acceptanceCriteria": [
        "The authoring solution and the default generated case prove the outputs of AIFACTORY-TASK-840 to AIFACTORY-TASK-843 (AC2 of AIFACTORY-US-105): the submodule carries the substitution fix, the metadata holds no stale symbol and the Release build reports zero errors."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-577]",
      "number": 577
    },
    {
      "id": "AIFACTORY-TASK-578",
      "type": "task",
      "parent": "AIFACTORY-US-105",
      "title": "Generated-solution gate in the template pipeline",
      "sequence": "18.09.04.02",
      "description": "BEFORE DEVELOPMENT. Generated-solution gate in the template pipeline. Expected output: The green pipeline run proves the outputs of AIFACTORY-TASK-844 to AIFACTORY-TASK-847 (AC3 of AIFACTORY-US-105): the pipeline generates the Domain and Compatibility cases, restores, builds, runs the configuration smoke tests and the vulnerability audit, and fails the run when any case fails; the gate runs on every change of the template.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: azure-pipelines.yml runs the generated cases; the run is green.",
      "acceptanceCriteria": [
        "The green pipeline run proves the outputs of AIFACTORY-TASK-844 to AIFACTORY-TASK-847 (AC3 of AIFACTORY-US-105): the pipeline generates the Domain and Compatibility cases, restores, builds, runs the configuration smoke tests and the vulnerability audit, and fails the run when any case fails; the gate runs on every change of the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-578]",
      "number": 578
    },
    {
      "id": "AIFACTORY-TASK-579",
      "type": "task",
      "parent": "AIFACTORY-US-105",
      "title": "Package published to the feed with a verified version",
      "sequence": "18.09.04.03",
      "description": "BEFORE DEVELOPMENT. Package published to the feed with a verified version. Expected output: The published package proves the outputs of AIFACTORY-TASK-848 to AIFACTORY-TASK-851 (AC4 of AIFACTORY-US-105): the package is on the feed with the version the readiness checklist names and dotnet new install of it followed by a generation of the two Agent Mesh hosts builds unchanged.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet new install ConnectSoft.AI.SoftwareFactory.AgentTemplate::<version> && dotnet new connectsoft-ai-agent -n ConnectSoft.AI.SoftwareFactory.AgentRuntimeService --agent-host-kind attempt-runtime -o probe && dotnet build probe -c Release.",
      "acceptanceCriteria": [
        "The published package proves the outputs of AIFACTORY-TASK-848 to AIFACTORY-TASK-851 (AC4 of AIFACTORY-US-105): the package is on the feed with the version the readiness checklist names and dotnet new install of it followed by a generation of the two Agent Mesh hosts builds unchanged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-579]",
      "number": 579
    },
    {
      "id": "AIFACTORY-TASK-665",
      "type": "task",
      "parent": "AIFACTORY-US-105",
      "title": "Verify agent-template-release-delivered by running the declared command",
      "sequence": "18.09.04.04",
      "description": "BEFORE DEVELOPMENT. Verify agent-template-release-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case of the matrix after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-105.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case of the matrix after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-105."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 11,
      "phase": "templates-and-libraries",
      "stackRank": 1104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-665]",
      "number": 665
    },
    {
      "id": "AIFACTORY-FEAT-157",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Base template: the Factory service profile",
      "sequence": "18.10",
      "description": "Forty-six Factory services are scaffolded from the base template (D94) and deploy alone (ADR-0028), so the work a host did once is done per service by the scaffold. The profile a Factory service is generated with: the Orleans messaging adapter for the outbox and inbox with the accepted envelope, the tenant and project scope read from the token and propagated to every call and message, token validation against the authorization server with the Factory roles as claims, a REST and gRPC surface described by descriptors, health and readiness endpoints, and telemetry that carries run and attempt correlation. A service scaffolded with the profile builds and passes unchanged, which is the acceptance of the readiness checklist. Component: BaseTemplate (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 9 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-226",
        "AIFACTORY-US-227",
        "AIFACTORY-US-228",
        "AIFACTORY-US-229",
        "AIFACTORY-US-230",
        "AIFACTORY-US-103"
      ],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 900,
      "titlePrefix": "[AIFACTORY-FEAT-157]",
      "number": 157
    },
    {
      "id": "AIFACTORY-US-226",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-157",
      "title": "Base template: `MessagingModelType` accepts Orleans and the generated service commits the accepted envelope to the Orleans outbox with its state change",
      "sequence": "18.10.01",
      "description": "As an asset maintainer, I want the base template to offer the Orleans outbox and inbox as a messaging choice that writes the accepted envelope, so that every Factory service scaffolded from it has a durable outbox and inbox of its own without a broker and without copied messaging code. The template configuration of the base template offers three values of `MessagingModelType` today: None, NServiceBus and MassTransit (model/template-parameters/connectsoft-base.yaml). ADR-0012 makes `ConnectSoft.Extensions.MessagingModel` the only messaging contract of application code and the transport a profile, and ADR-0028 decision 7 gives every service that publishes or consumes messages its own messaging service name, its own transport credential and the Orleans messaging profile library, because its inbox and outbox are its own. This PBI adds the value Orleans. The existing library `ConnectSoft.Extensions.MessagingModel.Orleans` is consumed by a version pin and is not changed here. Its getting started page (Docs/GettingStarted.md of the library) names what it needs: a co-hosted Orleans silo, SQL Server with the messaging tables in the `ConnectSoftMessaging` schema of the service database, and the NHibernate unit of work the outbox writer enlists in. The template therefore refuses a generation that selects the value without `ActorModelType` Orleans, without `PersistenceModelType` NHibernate or with an `NHibernateDialectType` other than SqlServer, and the message names both symbols. The adapter also requires declared routing, so the generated service carries an `OrleansMessaging` configuration section with `ServiceName`, the `Outbox` connection, `Subscribers`, `Subscriptions` and `PublishedEvents`: every published event has a subscription or an `UnroutedReason`, startup fails otherwise, an undeclared publish throws, and a publish outside a transaction is refused. The adapter has one wire type, `MessageEnvelope`, and the accepted envelope of the Factory does not replace it. A Factory service writes the run event envelope of the contracts package for its integration events (ADR-0014 amendment of D114), so the envelope type is read from the Factory contracts package by a version pin, is never copied into the template, and its fields are mapped onto the publish options of the adapter: `eventId` is the caller message id, `correlationId` and `causationId` are the options of the same name, `orderingKey` is `OrderingKey`, the aggregate version is `AggregateRevision`, and `schemaVersion` is the version a handler registration declares. The inbox deduplicates by `(DeduplicationScope, MessageId)`; a failing handler is retried with back-off and poisoned per subscriber at `MaxAttempts`, a contract failure at once, and a poisoned delivery is recovered through `IOutboxRecovery`. MassTransit and NServiceBus stay selectable as transports for generated products and their generated output does not change. Kind: enabling. Traces: descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0028. Depends on: feature:contracts-package. Sources: model/components.yaml, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/template-parameters/connectsoft-base.yaml, docs/reference/schemas/run-event-envelope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the template configuration with the value Orleans of `MessagingModelType`, when a service is generated with it together with `ActorModelType` Orleans, `PersistenceModelType` NHibernate and `NHibernateDialectType` SqlServer, then the service registers the outbox dispatcher and the inbox grains of the Orleans messaging adapter library with its own messaging service name and holds no MassTransit or NServiceBus registration; a generation that combines the value with another actor model, another persistence model or another dialect is refused with a message naming both symbols (ADR-0012 decision 2, ADR-0028 decision 7, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given a generated service that changes state and publishes an event in one handler, when the unit of work commits, then one outbox record is committed in the same transaction and carries the accepted envelope with event id, event type, schema version, occurred-at, producer, tenant id, correlation id and payload, and with project id, causation id and ordering key where the event has them; `eventId` is passed as the caller message id, `correlationId` and `causationId` as the options of the same name, `orderingKey` as `OrderingKey` and the aggregate version as `AggregateRevision`, so that two publications of one event id carry one message id; when the unit of work rolls back neither the state change nor the record exists (ADR-0012 decision 4, ADR-0014 decisions 1 and 4, descriptor `run-event-envelope-v1`).",
        "AC3: Given the same message id delivered twice inside one deduplication scope, when the inbox of a generated service dispatches it, then the handler runs once and the second delivery has no effect; a handler that keeps failing is retried with back-off and poisoned at `MaxAttempts`, is visible in the poison metric of the adapter and is recoverable through `IOutboxRecovery`; a message whose `schemaVersion` no handler registration declares is refused as `IncompatibleSchemaVersion` (ADR-0014 decision 3, ADR-0012).",
        "AC4: Given the generated `OrleansMessaging` section with the service name, the outbox connection and the sample event declared in `PublishedEvents` with a route or an `UnroutedReason`, when the generated tests run, then a publish of an event that is not declared throws, a declared event without a route and without a reason fails startup with its key named, and a publish outside the unit of work is refused (ADR-0012 decision 4, ADR-0028 decision 7).",
        "AC5: Given a generation with MassTransit or NServiceBus, when the cases of the template pipeline run, then those cases generate and pass as before, the Compatibility cases hold an Orleans case while the gating case of the value is the Factory preset case of AIFACTORY-US-230, and model/template-parameters/connectsoft-base.yaml lists the value Orleans after the next template inventory, so that MassTransit stays a selectable transport for products (ADR-0012 decision 3)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1071",
        "AIFACTORY-TASK-580",
        "AIFACTORY-TASK-1166",
        "AIFACTORY-TASK-1072",
        "AIFACTORY-TASK-1073"
      ],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 901,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-226]",
      "number": 226
    },
    {
      "id": "AIFACTORY-TASK-1071",
      "type": "task",
      "parent": "AIFACTORY-US-226",
      "title": "Orleans value of MessagingModelType with its computed symbol and the silo, NHibernate and SQL Server constraints",
      "sequence": "18.10.01.01",
      "description": "BEFORE DEVELOPMENT. Orleans value of MessagingModelType with its computed symbol and the silo, NHibernate and SQL Server constraints. Expected output: The template configuration lists the value Orleans of `MessagingModelType` with a computed symbol that source conditions use; a generation that selects it without `ActorModelType` Orleans, without `PersistenceModelType` NHibernate or with an `NHibernateDialectType` other than SqlServer fails with a message naming both symbols; the parameters page of the template documents the value and its three prerequisites.. Kind: contract. Repository: ConnectSoft.BaseTemplate. Verification: dotnet new connectsoft-base --help lists the value Orleans | a generation with the value and the PostgreSQL dialect is refused.",
      "acceptanceCriteria": [
        "The template configuration lists the value Orleans of `MessagingModelType` with a computed symbol that source conditions use; a generation that selects it without `ActorModelType` Orleans, without `PersistenceModelType` NHibernate or with an `NHibernateDialectType` other than SqlServer fails with a message naming both symbols; the parameters page of the template documents the value and its three prerequisites."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 901,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1071]",
      "number": 1071
    },
    {
      "id": "AIFACTORY-TASK-580",
      "type": "task",
      "parent": "AIFACTORY-US-226",
      "title": "Messaging profile Orleans with the accepted envelope",
      "sequence": "18.10.01.02",
      "description": "BEFORE DEVELOPMENT. Messaging profile Orleans with the accepted envelope. Expected output: `MessagingModelType` accepts Orleans; the generated service registers the outbox dispatcher and the inbox grains of `ConnectSoft.Extensions.MessagingModel.Orleans`, writes the outbox record in the NHibernate unit of work of the state change and publishes the ADR-0014 envelope, read from the pinned contracts package, with `eventId` as the caller message id, `correlationId` and `causationId` as the options of the same name, `orderingKey` as `OrderingKey`, the aggregate version as `AggregateRevision` and `schemaVersion` as the version the handler registration declares; the Compatibility cases of the template pipeline have an Orleans case and the Factory preset case of AIFACTORY-US-230 gates the value.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`MessagingModelType` accepts Orleans; the generated service registers the outbox dispatcher and the inbox grains of `ConnectSoft.Extensions.MessagingModel.Orleans`, writes the outbox record in the NHibernate unit of work of the state change and publishes the ADR-0014 envelope, read from the pinned contracts package, with `eventId` as the caller message id, `correlationId` and `causationId` as the options of the same name, `orderingKey` as `OrderingKey`, the aggregate version as `AggregateRevision` and `schemaVersion` as the version the handler registration declares; the Compatibility cases of the template pipeline have an Orleans case and the Factory preset case of AIFACTORY-US-230 gates the value."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-580]",
      "number": 580
    },
    {
      "id": "AIFACTORY-TASK-1166",
      "type": "task",
      "parent": "AIFACTORY-US-226",
      "title": "Generated OrleansMessaging section with declared routing of the sample event",
      "sequence": "18.10.01.03",
      "description": "BEFORE DEVELOPMENT. Generated OrleansMessaging section with declared routing of the sample event. Expected output: The generated configuration of the Orleans case holds the `OrleansMessaging` section with `ServiceName` set to the messaging service name of the service, the `Outbox` connection of the service database, and the sample event declared in `PublishedEvents` with a subscription or an `UnroutedReason`; the options are validated at startup and a generated test fails when the section is absent.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated configuration of the Orleans case holds the `OrleansMessaging` section with `ServiceName` set to the messaging service name of the service, the `Outbox` connection of the service database, and the sample event declared in `PublishedEvents` with a subscription or an `UnroutedReason`; the options are validated at startup and a generated test fails when the section is absent."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1166]",
      "number": 1166
    },
    {
      "id": "AIFACTORY-TASK-1072",
      "type": "task",
      "parent": "AIFACTORY-US-226",
      "title": "Outbox transaction, deduplication, poison and declared routing tests of the generated Orleans case",
      "sequence": "18.10.01.04",
      "description": "BEFORE DEVELOPMENT. Outbox transaction, deduplication, poison and declared routing tests of the generated Orleans case. Expected output: The generated solution of the Orleans case holds tests for commit and rollback of the outbox record with the state change, for one message id of two publications of one event id, for a second delivery of a message id inside the deduplication scope that has no effect, for a failing handler that is retried with back-off, poisoned at `MaxAttempts`, counted in the poison metric and recovered through `IOutboxRecovery`, for an unknown schema version that is refused, for an undeclared publish that throws, for a declared event without route or reason that fails startup, and for a publish outside the unit of work that is refused.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated solution of the Orleans case holds tests for commit and rollback of the outbox record with the state change, for one message id of two publications of one event id, for a second delivery of a message id inside the deduplication scope that has no effect, for a failing handler that is retried with back-off, poisoned at `MaxAttempts`, counted in the poison metric and recovered through `IOutboxRecovery`, for an unknown schema version that is refused, for an undeclared publish that throws, for a declared event without route or reason that fails startup, and for a publish outside the unit of work that is refused."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 901,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1072]",
      "number": 1072
    },
    {
      "id": "AIFACTORY-TASK-1073",
      "type": "task",
      "parent": "AIFACTORY-US-226",
      "title": "Verify the Orleans messaging profile on a generated service",
      "sequence": "18.10.01.05",
      "description": "BEFORE DEVELOPMENT. Verify the Orleans messaging profile on a generated service. Expected output: Generate the Orleans case and the MassTransit case from the packed template, build both in Release and run their tests; the Orleans case passes the outbox, deduplication, poison and declared routing tests, a generation with another dialect is refused, and the MassTransit case is unchanged, which proves AC1 to AC5 of AIFACTORY-US-226 (ADR-0012, ADR-0014).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Generate the Orleans case and the MassTransit case from the packed template, build both in Release and run their tests; the Orleans case passes the outbox, deduplication, poison and declared routing tests, a generation with another dialect is refused, and the MassTransit case is unchanged, which proves AC1 to AC5 of AIFACTORY-US-226 (ADR-0012, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1073]",
      "number": 1073
    },
    {
      "id": "AIFACTORY-US-227",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-157",
      "title": "Base template: a Factory service takes the tenant from the token, admits a project only when the token grants it, carries the scope on every call and message, and answers 404 for a foreign tenant",
      "sequence": "18.10.02",
      "description": "As an asset maintainer, I want a generated Factory service to establish the trusted scope once per request or message and to carry it everywhere, so that no Factory service acts on a tenant or project a caller merely claims and no service reveals that a resource of another tenant exists. ADR-0015 decision 2 requires every Factory contract to carry the trusted tenant id and project id derived from the authenticated context, never from caller-controlled headers, and decision 3 requires every backend to enforce authorization for every read and write. ADR-0028 notes that what a host did once is now done per service by the scaffold. This PBI adds the Factory profile switch to the base template and, under it, the scope chain of a service. The switch is the one the amendment of ADR-0028 (D114) decides: the boolean `UseFactoryProfile`, off by default so that other generations do not change, named the same in every template that has a Factory shape, and passed by the Factory scaffold command, `dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.<ServiceId> --UseFactoryProfile true`. The template defines no scope type of its own. The scope accessor and the middleware that fills it are AIFACTORY-TASK-186 and AIFACTORY-TASK-142 of AIFACTORY-US-220 in feature `component-extensions-ai`; they live in `ConnectSoft.Extensions.AI.Factory.Abstractions`, which that feature publishes, and the template pins that package and registers them. The tenant resolution, the tenant filters and the tenant propagation live in the `ConnectSoft.Extensions.Saas` libraries. `UseFactoryProfile` requires the existing switch `UseIdentityPlatform`, and a generation without it is refused. On an inbound REST or gRPC call the tenant comes from the `tid` claim of the validated token and overwrites any tenant header the caller sent. The token holds no single project claim: it holds one role claim per project assignment. The project of a request is the one the route addresses or the gateway forwarded, and it is admitted into the scope only when the validated token holds a role claim for that project or the tenant-wide Platform admin role; otherwise the answer is 403, and a project value the token does not grant is never read into the scope. A workload token carries service scopes, no audience of a user API and no tenant claim; the tenant and project it forwards are read only when the token holds the `svc.` scope that names the service (ADR-0015 amendment of D114). Outbound HTTP and gRPC calls carry the tenant in `X-Tenant-Id` and `tenant-id` and the project in the header the abstractions package names, published messages take tenant and project from the accessor into the envelope, and a message handler or a grain call sees the scope of the message or of the caller. The persistence filter makes rows of another tenant invisible, so a request for an identifier of another tenant is answered 404, over gRPC the status NOT_FOUND, exactly as an unknown identifier is; a caller without the scope or the project right an endpoint requires inside its own tenant is answered 403; a call without a token or without a trusted source of the tenant is answered 401 before any handler runs. The envelope a Factory service writes for its integration events is the run event envelope of the contracts package (ADR-0014 amendment of D114); it requires the tenant and leaves the project optional. The generic SaaS templates keep their own envelope base, so under the profile an inbound message in that base, such as a tenant event of the Tenants service, is mapped onto the run event envelope before the scope is read: `tenantId`, `schemaVersion`, `correlationId` and `causationId` map by name, `occurredOn` is `occurredAt`, the message id is `eventId`, the topic name is `eventType`, the messaging service name of the publisher is `producer` and the event body is `payload`. A message without the tenant, in either envelope, is therefore not handled and goes to the poison handling of the Orleans messaging profile with the reason, through the tenant propagation of the SaaS libraries (AIFACTORY-US-204). A message without a project, such as a tenant suspension, a tenant-scope role assignment or a retention event, is handled under a tenant-only scope, and only a handler that declares itself project-scoped refuses it. Every refusal is logged with the correlation id and without token content. Kind: enabling. Traces: descriptors: execution-scope-v1; adrs: ADR-0014, ADR-0015, ADR-0028; requirements: FR-01. Depends on: AIFACTORY-US-226, feature:component-extensions-ai, feature:component-saas-extensions. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/reference/schemas/execution-scope.schema.json, docs/reference/schemas/run-event-envelope.schema.json, model/template-parameters/connectsoft-base.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a service generated with `UseFactoryProfile` and a call with a valid user token, when a REST endpoint or a gRPC method handles it, then the tenant of the scope is the `tid` claim and a tenant header sent by the caller with another value is overwritten and never read; the project of the scope is the one the route addresses or the gateway forwarded and is admitted only when the token holds a role claim for that project or the tenant-wide Platform admin role, otherwise the answer is 403 and the project value is never read into the scope (ADR-0015 decision 2, FR-01, descriptor `execution-scope-v1`).",
        "AC2: Given a handler that calls another service over HTTP and over gRPC, calls a grain and publishes an event, when it runs under a scope, then the outbound calls carry the tenant in `X-Tenant-Id` and `tenant-id` and the project in the header the abstractions package names, the grain call carries the same scope, the envelope of the event carries tenant and project, and the consuming handler reads the same scope from its accessor (ADR-0014 decision 1, ADR-0015 decisions 1 and 2).",
        "AC3: Given two tenants with one resource each, when a caller of the first tenant requests the identifier of the resource of the second, then the answer is 404 with the same body as for an identifier that does not exist, and over gRPC the status NOT_FOUND; when the caller lacks the scope or the project right the endpoint requires inside its own tenant, then the answer is 403; when the call has no token, a user token has no `tid` claim or a workload token forwards no tenant, then the answer is 401 and no handler runs; a workload token has its forwarded tenant and project read only when it holds the `svc.` scope that names the service (ADR-0015 amendment on a resource of another tenant, D113; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC4: Given a message whose envelope carries no tenant, when the inbox of a generated service receives it, then it is not handled and goes to the poison handling of the Orleans messaging profile with the reason, through the tenant propagation of the `ConnectSoft.Extensions.Saas` libraries, and the refusal is logged with the correlation id; given a tenant-level event without a project, when it is received, then it is handled under a tenant-only scope, and only a handler that declares itself project-scoped refuses it; given a tenant event in the envelope base of a generic SaaS template, when it is received, then the profile maps it onto the run event envelope with a source for every required field and the handler reads the tenant of the event from the scope accessor (ADR-0014 decision 1 and its amendment on envelopes per event family, ADR-0015 decision 3, docs/reference/schemas/run-event-envelope.schema.json)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1074",
        "AIFACTORY-TASK-581",
        "AIFACTORY-TASK-1465",
        "AIFACTORY-TASK-1075",
        "AIFACTORY-TASK-1076"
      ],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 902,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-226",
        "feature:component-extensions-ai",
        "feature:component-saas-extensions"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/reference/schemas/execution-scope.schema.json",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-227]",
      "number": 227
    },
    {
      "id": "AIFACTORY-TASK-1074",
      "type": "task",
      "parent": "AIFACTORY-US-227",
      "title": "UseFactoryProfile symbol with the pins of the Factory abstractions and the SaaS tenancy libraries",
      "sequence": "18.10.02.01",
      "description": "BEFORE DEVELOPMENT. UseFactoryProfile symbol with the pins of the Factory abstractions and the SaaS tenancy libraries. Expected output: The template configuration holds the boolean `UseFactoryProfile` of the ADR-0028 amendment, off by default so that other generations do not change and named as in the worker, gateway and library templates; a generation with it and without `UseIdentityPlatform` is refused with both symbols named; with it the generated solution pins `ConnectSoft.Extensions.AI.Factory.Abstractions` and the `ConnectSoft.Extensions.Saas` packages in central package management, registers the scope accessor and middleware of AIFACTORY-TASK-186 and AIFACTORY-TASK-142 and holds no copy of a scope type or of a header name; the parameters page of the template documents the symbol and the scaffold command that passes it.. Kind: contract. Repository: ConnectSoft.BaseTemplate. Verification: dotnet new connectsoft-base --help lists UseFactoryProfile | a generation with UseFactoryProfile and without UseIdentityPlatform is refused.",
      "acceptanceCriteria": [
        "The template configuration holds the boolean `UseFactoryProfile` of the ADR-0028 amendment, off by default so that other generations do not change and named as in the worker, gateway and library templates; a generation with it and without `UseIdentityPlatform` is refused with both symbols named; with it the generated solution pins `ConnectSoft.Extensions.AI.Factory.Abstractions` and the `ConnectSoft.Extensions.Saas` packages in central package management, registers the scope accessor and middleware of AIFACTORY-TASK-186 and AIFACTORY-TASK-142 and holds no copy of a scope type or of a header name; the parameters page of the template documents the symbol and the scaffold command that passes it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 902,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1074]",
      "number": 1074
    },
    {
      "id": "AIFACTORY-TASK-581",
      "type": "task",
      "parent": "AIFACTORY-US-227",
      "title": "Factory scope from the token to every call and message",
      "sequence": "18.10.02.02",
      "description": "BEFORE DEVELOPMENT. Factory scope from the token to every call and message. Expected output: The generated service takes the tenant from the `tid` claim of the validated token, admits the project the route addresses or the gateway forwarded only when the token holds a role claim for it or the tenant-wide Platform admin role, exposes both through the scope accessor, forwards them on outbound HTTP and gRPC calls and grain calls and stamps them on messages; an identifier of another tenant is answered 404, a project the token does not grant or a missing scope inside the own tenant 403, a missing token or tenant source 401; a message without the tenant goes to the poison handling of the Orleans messaging profile and a message without a project is handled under a tenant-only scope unless its handler is declared project-scoped.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated service takes the tenant from the `tid` claim of the validated token, admits the project the route addresses or the gateway forwarded only when the token holds a role claim for it or the tenant-wide Platform admin role, exposes both through the scope accessor, forwards them on outbound HTTP and gRPC calls and grain calls and stamps them on messages; an identifier of another tenant is answered 404, a project the token does not grant or a missing scope inside the own tenant 403, a missing token or tenant source 401; a message without the tenant goes to the poison handling of the Orleans messaging profile and a message without a project is handled under a tenant-only scope unless its handler is declared project-scoped."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-581]",
      "number": 581
    },
    {
      "id": "AIFACTORY-TASK-1465",
      "type": "task",
      "parent": "AIFACTORY-US-227",
      "title": "Mapping of the envelope base of the generic SaaS templates onto the run event envelope",
      "sequence": "18.10.02.03",
      "description": "BEFORE DEVELOPMENT. Mapping of the envelope base of the generic SaaS templates onto the run event envelope. Expected output: Under `UseFactoryProfile` the inbox of the generated service maps a message in the envelope base of a generic SaaS template onto the run event envelope of the pinned contracts package before the scope is read, `tenantId`, `schemaVersion`, `correlationId` and `causationId` by name, `occurredOn` as `occurredAt`, the message id as `eventId`, the topic name as `eventType`, the messaging service name of the publisher as `producer` and the event body as `payload`; a message of that base without a tenant goes to the poison handling with the reason; the mapping reads the fields of the base by name and the generated solution references no package of a SaaS template.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` the inbox of the generated service maps a message in the envelope base of a generic SaaS template onto the run event envelope of the pinned contracts package before the scope is read, `tenantId`, `schemaVersion`, `correlationId` and `causationId` by name, `occurredOn` as `occurredAt`, the message id as `eventId`, the topic name as `eventType`, the messaging service name of the publisher as `producer` and the event body as `payload`; a message of that base without a tenant goes to the poison handling with the reason; the mapping reads the fields of the base by name and the generated solution references no package of a SaaS template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1465]",
      "number": 1465
    },
    {
      "id": "AIFACTORY-TASK-1075",
      "type": "task",
      "parent": "AIFACTORY-US-227",
      "title": "Two-tenant and two-project acceptance fixture of the generated Factory service",
      "sequence": "18.10.02.04",
      "description": "BEFORE DEVELOPMENT. Two-tenant and two-project acceptance fixture of the generated Factory service. Expected output: The generated acceptance suite of the Factory preset holds a fixture with two tenants and two projects on one disposable database and scenarios for the carried scope, the overwritten tenant header, a project the token does not grant, the 404, 403 and 401 answers, a workload token with and without its `svc.` scope, a message without the tenant that is poisoned with the reason, a tenant-level event without a project that is handled under a tenant-only scope, the same event refused by a handler declared project-scoped, and a tenant event in the envelope base of a generic SaaS template that is mapped onto the run event envelope; the assertions are not weakened when one fails.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated acceptance suite of the Factory preset holds a fixture with two tenants and two projects on one disposable database and scenarios for the carried scope, the overwritten tenant header, a project the token does not grant, the 404, 403 and 401 answers, a workload token with and without its `svc.` scope, a message without the tenant that is poisoned with the reason, a tenant-level event without a project that is handled under a tenant-only scope, the same event refused by a handler declared project-scoped, and a tenant event in the envelope base of a generic SaaS template that is mapped onto the run event envelope; the assertions are not weakened when one fails."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1075]",
      "number": 1075
    },
    {
      "id": "AIFACTORY-TASK-1076",
      "type": "task",
      "parent": "AIFACTORY-US-227",
      "title": "Verify the scope chain and the refusal codes on a generated Factory service",
      "sequence": "18.10.02.05",
      "description": "BEFORE DEVELOPMENT. Verify the scope chain and the refusal codes on a generated Factory service. Expected output: Generate the Factory preset from the packed template, build it in Release and run its acceptance suite; the scope scenarios, the 404, 403 and 401 scenarios, the tenant-level event scenario and the envelope mapping scenario pass, which proves AC1 to AC4 of AIFACTORY-US-227 (ADR-0015, FR-01).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Generate the Factory preset from the packed template, build it in Release and run its acceptance suite; the scope scenarios, the 404, 403 and 401 scenarios, the tenant-level event scenario and the envelope mapping scenario pass, which proves AC1 to AC4 of AIFACTORY-US-227 (ADR-0015, FR-01)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1076]",
      "number": 1076
    },
    {
      "id": "AIFACTORY-US-228",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-157",
      "title": "Base template: a Factory service validates tokens through the resource-server library and maps the seven Factory roles to endpoint policies",
      "sequence": "18.10.03",
      "description": "As an asset maintainer, I want a generated Factory service to validate the tokens of the authorization server and to enforce the seven Factory roles per request, so that every backend enforces the roles the authorization server issued and menu visibility in the Studio grants nothing. ADR-0015 decisions 5 and 6 define seven roles, assigned per project except Platform admin, issued as claims by the authorization server and enforced by every backend per request, and ADR-0008 fixes the authorization server as the OpenIddict issuer. The identity platform page of the base template (Docs/Identity-Platform-Foundation.md of the template) states that the template is neither an authorization server nor an identity service and that derived templates implement resource-server behaviour. ADR-0028 decision 7 names the resource-server library for that, and ADR-0008 records `ConnectSoft.Extensions.ResourceServer` as existing. The template already has the switch `UseIdentityPlatform` (model/template-parameters/connectsoft-base.yaml); `UseFactoryProfile` requires it, and a generation without it is refused. Under both switches the validation of issuer, signature, lifetime and audience, the refusal of an identity token used as an API credential and the loading of the signing keys are the registration of the pinned `ConnectSoft.Extensions.ResourceServer`, and the template writes none of that. What this PBI adds is the policies: one named policy per role (Requester, Reviewer, Asset maintainer, Operator, Workspace admin, Platform admin, Observer) and scope policies for workloads. The claim type names, the role names and the parser of the scoped role value come from the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (AIFACTORY-TASK-1173 of AIFACTORY-US-220 in feature `component-extensions-ai`), which the authorization server, identity and gateway templates pin as well, so no template types them again and the profile does not wait for the authorization server template. A project role counts only when its claim names the project the scope chain admitted for the request. Workspace admin of a project satisfies the Requester, Reviewer, Asset maintainer and Operator policies of that project and of no other. Platform admin counts for the whole tenant, and an admission through it is marked on the authorization result, so that a service that decides approvals can demand the audited reason decision 5 requires. Observer counts for a project or for the tenant and never satisfies a command policy. Audience validation applies to user tokens: a user token has one audience, the resource of the gateway that fronts its granted scopes (ADR-0015 amendment of D114), which for a service is the gateway that fronts it. A workload token carries service scopes, no audience of a user API and no tenant claim: it is admitted by issuer, signature, lifetime and the `svc.` scope that names the service, and it never satisfies a role policy or a user-audience policy. An invalid or expired token, a user token for another audience and an identity token are answered 401; a valid token without the required role in the project or without the required scope is answered 403; when the signing keys of the authority cannot be loaded the service refuses requests and reports the authority in its readiness. A refusal is logged with policy, tenant, project and correlation id and never with the token. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015, ADR-0028; requirements: FR-01. Depends on: AIFACTORY-US-227, feature:component-extensions-ai. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0008-openiddict-identity.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/template-parameters/connectsoft-base.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a service generated with `UseFactoryProfile` and `UseIdentityPlatform` and configured with the issuer and the audience of the gateway that fronts it, when it receives a user access token of the authorization server, then issuer, signature, lifetime and audience are validated by the registration of the pinned `ConnectSoft.Extensions.ResourceServer`, and an expired token, a user token issued for another audience and an identity token are each answered 401; a generation with `UseFactoryProfile` and without `UseIdentityPlatform` is refused (ADR-0008, ADR-0015 decision 6, ADR-0028 decision 7).",
        "AC2: Given endpoints that require each of the seven roles, when the acceptance matrix calls them with a token holding the role in the project of the request, the same role in another project of the same tenant, Workspace admin of the project, Workspace admin of another project, Platform admin of the tenant and Observer, then the role in the project and Platform admin are admitted, Workspace admin of the project satisfies the Requester, Reviewer, Asset maintainer and Operator policies of that project and of no other project, the role of another project is answered 403, an admission through Platform admin is marked on the authorization result, and Observer is admitted to read endpoints and answered 403 on every command (ADR-0015 decision 5).",
        "AC3: Given a workload token of a service client, which carries no audience of a user API, when it calls an endpoint, then it is admitted by issuer, signature, lifetime and the `svc.` scope that names the service, is answered 403 without that scope, and never satisfies a role policy or a user-audience policy (ADR-0015 decision 6, FR-01).",
        "AC4: Given the signing keys of the authority cannot be loaded and none are cached, when a request arrives, then it is refused, readiness reports the identity authority as unreachable, and the refusal is logged with policy, tenant, project and correlation id without token content (ADR-0028 decision 7 names this failure mode for gateways; docs/architecture/adr/0028-one-repository-and-deployable-per-service.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1077",
        "AIFACTORY-TASK-582",
        "AIFACTORY-TASK-1078",
        "AIFACTORY-TASK-1079"
      ],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 903,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-227",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-228]",
      "number": 228
    },
    {
      "id": "AIFACTORY-TASK-1077",
      "type": "task",
      "parent": "AIFACTORY-US-228",
      "title": "Resource-server pin, role policy names and the issuer and audience options of the Factory profile",
      "sequence": "18.10.03.01",
      "description": "BEFORE DEVELOPMENT. Resource-server pin, role policy names and the issuer and audience options of the Factory profile. Expected output: Under `UseFactoryProfile` with `UseIdentityPlatform` the generated solution pins `ConnectSoft.Extensions.ResourceServer` and registers it with the issuer and audience options, validated at startup; one policy name per Factory role and per `svc.` scope kind exists as a constant that endpoints reference, built on the role names and claim type names of the pinned Factory abstractions package; the security page of the template documents them and the relation of the two switches.. Kind: contract. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` with `UseIdentityPlatform` the generated solution pins `ConnectSoft.Extensions.ResourceServer` and registers it with the issuer and audience options, validated at startup; one policy name per Factory role and per `svc.` scope kind exists as a constant that endpoints reference, built on the role names and claim type names of the pinned Factory abstractions package; the security page of the template documents them and the relation of the two switches."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 903,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1077]",
      "number": 1077
    },
    {
      "id": "AIFACTORY-TASK-582",
      "type": "task",
      "parent": "AIFACTORY-US-228",
      "title": "Token validation with the Factory roles",
      "sequence": "18.10.03.02",
      "description": "BEFORE DEVELOPMENT. Token validation with the Factory roles. Expected output: The identity platform switch validates tokens of the authorization server through the pinned `ConnectSoft.Extensions.ResourceServer` and maps the seven Factory roles to policies with the parser of the pinned Factory abstractions package; a generated service refuses a token without the role its endpoint requires in the project of the request, lets Workspace admin stand for the four project roles of its own project only, marks an admission through Platform admin and admits a workload token by its `svc.` scope alone; the acceptance suite covers the matrix.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The identity platform switch validates tokens of the authorization server through the pinned `ConnectSoft.Extensions.ResourceServer` and maps the seven Factory roles to policies with the parser of the pinned Factory abstractions package; a generated service refuses a token without the role its endpoint requires in the project of the request, lets Workspace admin stand for the four project roles of its own project only, marks an admission through Platform admin and admits a workload token by its `svc.` scope alone; the acceptance suite covers the matrix."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-582]",
      "number": 582
    },
    {
      "id": "AIFACTORY-TASK-1078",
      "type": "task",
      "parent": "AIFACTORY-US-228",
      "title": "Test token issuer and role matrix of the generated acceptance suite",
      "sequence": "18.10.03.03",
      "description": "BEFORE DEVELOPMENT. Test token issuer and role matrix of the generated acceptance suite. Expected output: The generated acceptance suite holds a test issuer that signs tokens with the claim type names and the scoped role value of the pinned Factory abstractions package, never with names typed in the test, and a role matrix feature with one scenario per role, per foreign project, for Workspace admin in its own and in another project, for Platform admin, for Observer, for a workload token with and without its `svc.` scope and for the 401 cases.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated acceptance suite holds a test issuer that signs tokens with the claim type names and the scoped role value of the pinned Factory abstractions package, never with names typed in the test, and a role matrix feature with one scenario per role, per foreign project, for Workspace admin in its own and in another project, for Platform admin, for Observer, for a workload token with and without its `svc.` scope and for the 401 cases."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 903,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1078]",
      "number": 1078
    },
    {
      "id": "AIFACTORY-TASK-1079",
      "type": "task",
      "parent": "AIFACTORY-US-228",
      "title": "Verify token validation and the role matrix on a generated Factory service",
      "sequence": "18.10.03.04",
      "description": "BEFORE DEVELOPMENT. Verify token validation and the role matrix on a generated Factory service. Expected output: Generate the Factory preset, build it in Release and run the role matrix; every admitted and refused case answers as the matrix states, which proves AC1 to AC4 of AIFACTORY-US-228 (ADR-0015, ADR-0008).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Generate the Factory preset, build it in Release and run the role matrix; every admitted and refused case answers as the matrix states, which proves AC1 to AC4 of AIFACTORY-US-228 (ADR-0015, ADR-0008)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1079]",
      "number": 1079
    },
    {
      "id": "AIFACTORY-US-229",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-157",
      "title": "Base template: a Factory service exposes REST and gRPC from a service descriptor, serves health and readiness, and emits scope and run correlation through the single enrichment registration",
      "sequence": "18.10.04",
      "description": "As an asset maintainer, I want a generated Factory service to expose exactly the operations its descriptor names, to report its readiness and to wire its telemetry through the shared registration, so that a platform gateway can route to it, an operator can see whether it is ready, every activity and log record carries the tenant, project, run, step and attempt it belongs to, every metric carries the tenant and project, and no service writes a telemetry convention of its own. ADR-0028 decision 2 routes public REST and internal gRPC calls through the platform gateway to the services, and its consequences list health and readiness and telemetry wiring among the work the base template provides per service. The template offers one service model per generation today: `ServiceModelType` is a single choice with Grpc as default, and `UseRestApi` and `UseGrpc` are computed from it (model/template-parameters/connectsoft-base.yaml). Under `UseFactoryProfile` this PBI generates both the REST and the gRPC service model over one set of use cases and adds a service descriptor file to the generated repository. The file lists each operation as the `apis` section of a service file of the model does (for example model/services/control-plane/ProjectService.yaml): name, method and path or gRPC method, scope, side-effect class, idempotency and response codes. It is a separate file and not a part of the descriptor family the SaaS templates carry (`Microservice.schema.json` with a context descriptor, the import format of ADR-0025): that family describes the entity model a service is generated from, while this file is no generation input and only records the surface the code is checked against. A contract test compares the mapped endpoints with the file in both directions and fails on an endpoint the file does not name or an operation without an endpoint. The service serves a liveness endpoint and a readiness endpoint; readiness is unready until the store is migrated and the silo has started, while the outbox readiness check of the Orleans messaging adapter (`AddConnectSoftOrleansMessagingOutboxHealthCheck`, on backlog age and depth) is unhealthy, and while the identity authority is unreachable. The template registers that check of the adapter and writes no outbox check of its own. Telemetry is wiring only, and it carries the correlation the feature promises. The feature `component-observability-factory-conventions` is in the same increment (D114) and delivers one enrichment registration in the observability libraries (AIFACTORY-TASK-632): it reads the scope accessor and the run event envelope and puts tenant, project, run, step and attempt on every activity and log record, and its instrument helper tags a metric with tenant and project by default; run, step and attempt reach a metric only through the allowlist of the instrument helper (D115, AIFACTORY-US-257). The generated service pins the library version that carries that registration, calls it once and creates its instruments through the instrument helper, so a request handled under a scope emits activities and log records with tenant and project, a message handled under the envelope of a run emits them with run, step and attempt as well, under the attribute names of the library, and a measurement of the service carries the tags `tenant` and `project`. The Factory preset leaves the allowlist at its default and does not put run, step and attempt on every metric; a service that needs one of them on a series names it in its own options. The generated solution defines no enricher and no tag name for tenant, project, run, step or attempt of its own and creates no instrument outside the helper, and an architecture test fails when one appears, so that no service writes a telemetry convention. Kind: enabling. Traces: adrs: ADR-0014, ADR-0028. Depends on: AIFACTORY-US-226, AIFACTORY-US-227, AIFACTORY-US-228, feature:component-observability-factory-conventions. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/templates-docs/base-template.md, model/template-parameters/connectsoft-base.yaml, model/services/control-plane/ProjectService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a service generated with `UseFactoryProfile` and a service descriptor file that lists REST operations and gRPC methods, when the solution builds and its contract test runs, then both the REST and the gRPC host expose exactly the operations of the file with the scope each names, and the test fails when an endpoint is absent from the file or the file names an operation without an endpoint (ADR-0028 decision 2, model/services/control-plane/ProjectService.yaml as the shape of the operations).",
        "AC2: Given a generated Factory service that starts, when its store is not migrated, its silo has not started or the outbox readiness check of the Orleans messaging adapter (`AddConnectSoftOrleansMessagingOutboxHealthCheck`) is unhealthy, then the readiness endpoint answers unready and names the dependency while the liveness endpoint answers alive; when all three are healthy and the identity authority is reachable, then readiness answers ready (ADR-0028 consequences on health and readiness per service).",
        "AC3: Given a service generated with `UseFactoryProfile` that pins the single enrichment registration of the observability libraries, when a request is handled under a scope and a message is handled whose envelope carries run, step and attempt, then the exported activity and log record of each carry tenant and project, and those of the message also run, step and attempt, under the attribute names of the library, while a measurement recorded through the instrument helper carries the tags `tenant` and `project` and no run, step or attempt tag, because the preset leaves the allowlist of the helper at its default; when its architecture tests run, then telemetry is registered by one call of that registration, every instrument of the solution is created through the instrument helper, the generated solution defines no enricher and no tag name for tenant, project, run, step or attempt of its own, a planted enricher fails the test, and no generated code writes a request or message payload to a span or metric attribute (ADR-0014 decision 1 names the identifiers, ADR-0028 consequences on telemetry wiring per service).",
        "AC4: Given the architecture and correlation tests of the generated Factory preset, when they run, then they assert the three: descriptor conformity of both hosts, mapped liveness and readiness endpoints, and the single enrichment registration with tenant, project, run, step and attempt read from an activity and a log record exported to the in-memory exporter of the tests, and a planted endpoint outside the descriptor fails the suite (ADR-0028, ADR-0014 decision 1, docs/templates-docs/base-template.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/templates-docs/base-template.md",
        "model/template-parameters/connectsoft-base.yaml",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-583",
        "AIFACTORY-TASK-1080",
        "AIFACTORY-TASK-1081",
        "AIFACTORY-TASK-1082"
      ],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 904,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-226",
        "AIFACTORY-US-227",
        "AIFACTORY-US-228",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/templates-docs/base-template.md",
        "model/template-parameters/connectsoft-base.yaml",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-229]",
      "number": 229
    },
    {
      "id": "AIFACTORY-TASK-583",
      "type": "task",
      "parent": "AIFACTORY-US-229",
      "title": "Descriptor-described REST and gRPC surface with health and telemetry",
      "sequence": "18.10.04.01",
      "description": "BEFORE DEVELOPMENT. Descriptor-described REST and gRPC surface with health and telemetry. Expected output: A generated service exposes its REST and gRPC endpoints from a service descriptor file whose schema is part of the template, serves health and readiness, and wires its telemetry through the single enrichment registration of the pinned observability libraries, so that its activities and log records carry tenant, project, run, step and attempt and its metrics carry tenant and project; the architecture tests assert the three.. Kind: contract. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A generated service exposes its REST and gRPC endpoints from a service descriptor file whose schema is part of the template, serves health and readiness, and wires its telemetry through the single enrichment registration of the pinned observability libraries, so that its activities and log records carry tenant, project, run, step and attempt and its metrics carry tenant and project; the architecture tests assert the three."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 904,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-583]",
      "number": 583
    },
    {
      "id": "AIFACTORY-TASK-1080",
      "type": "task",
      "parent": "AIFACTORY-US-229",
      "title": "Both service models, the readiness endpoint and the telemetry wiring under the Factory profile",
      "sequence": "18.10.04.02",
      "description": "BEFORE DEVELOPMENT. Both service models, the readiness endpoint and the telemetry wiring under the Factory profile. Expected output: Under `UseFactoryProfile` the template generates the REST and the gRPC service model over one set of use cases, maps a liveness and a readiness endpoint with checks for the store, the silo and the identity authority and with the outbox readiness check the adapter ships (`AddConnectSoftOrleansMessagingOutboxHealthCheck`), pins the observability libraries at the version that carries the single enrichment registration of AIFACTORY-TASK-632, calls it once and creates its instruments through the instrument helper with the allowlist at its default, so that every activity and log record carries tenant, project, run, step and attempt and every measurement carries tenant and project; the generated solution holds no enricher, no tag name for a scope or run identifier, no instrument created outside the helper and no outbox check of its own.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` the template generates the REST and the gRPC service model over one set of use cases, maps a liveness and a readiness endpoint with checks for the store, the silo and the identity authority and with the outbox readiness check the adapter ships (`AddConnectSoftOrleansMessagingOutboxHealthCheck`), pins the observability libraries at the version that carries the single enrichment registration of AIFACTORY-TASK-632, calls it once and creates its instruments through the instrument helper with the allowlist at its default, so that every activity and log record carries tenant, project, run, step and attempt and every measurement carries tenant and project; the generated solution holds no enricher, no tag name for a scope or run identifier, no instrument created outside the helper and no outbox check of its own."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1080]",
      "number": 1080
    },
    {
      "id": "AIFACTORY-TASK-1081",
      "type": "task",
      "parent": "AIFACTORY-US-229",
      "title": "Descriptor conformity, readiness, telemetry wiring and correlation tests of the generated Factory preset",
      "sequence": "18.10.04.03",
      "description": "BEFORE DEVELOPMENT. Descriptor conformity, readiness, telemetry wiring and correlation tests of the generated Factory preset. Expected output: The generated solution holds a contract test that compares mapped endpoints with the descriptor file in both directions, readiness tests with each dependency down, an architecture test that finds exactly one call of the enrichment registration and fails on an enricher or a scope tag name defined in the solution and on an instrument created outside the instrument helper, and a correlation test that exports the activities and log records of a scoped request and of a message of a run to the in-memory exporter and reads tenant, project, run, step and attempt from them, and that reads the tags `tenant` and `project` and no run, step or attempt tag from a measurement of the service; a planted endpoint outside the descriptor fails the contract test and a planted enricher fails the architecture test.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated solution holds a contract test that compares mapped endpoints with the descriptor file in both directions, readiness tests with each dependency down, an architecture test that finds exactly one call of the enrichment registration and fails on an enricher or a scope tag name defined in the solution and on an instrument created outside the instrument helper, and a correlation test that exports the activities and log records of a scoped request and of a message of a run to the in-memory exporter and reads tenant, project, run, step and attempt from them, and that reads the tags `tenant` and `project` and no run, step or attempt tag from a measurement of the service; a planted endpoint outside the descriptor fails the contract test and a planted enricher fails the architecture test."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 904,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1081]",
      "number": 1081
    },
    {
      "id": "AIFACTORY-TASK-1082",
      "type": "task",
      "parent": "AIFACTORY-US-229",
      "title": "Verify the surface, readiness, telemetry wiring and correlation on a generated Factory service",
      "sequence": "18.10.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the surface, readiness, telemetry wiring and correlation on a generated Factory service. Expected output: Generate the Factory preset, build it in Release and run its contract, readiness, architecture and correlation tests; all pass, the exported activities and log records carry tenant, project, run, step and attempt, the measurements carry tenant and project only, and the planted endpoint and the planted enricher are refused, which proves AC1 to AC4 of AIFACTORY-US-229 (ADR-0028, ADR-0014).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Generate the Factory preset, build it in Release and run its contract, readiness, architecture and correlation tests; all pass, the exported activities and log records carry tenant, project, run, step and attempt, the measurements carry tenant and project only, and the planted endpoint and the planted enricher are refused, which proves AC1 to AC4 of AIFACTORY-US-229 (ADR-0028, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1082]",
      "number": 1082
    },
    {
      "id": "AIFACTORY-US-230",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-157",
      "title": "Base template: the Factory preset is the additional gating case of the shared template pipeline and is packed, installed, generated, built and tested before the package publishes",
      "sequence": "18.10.05",
      "description": "As an asset maintainer, I want the Factory preset to be a gated case of the template pipeline, so that no package that would scaffold a Factory service that does not build or pass reaches the feed. The estate has one gate mechanism for templates, the shared template pipeline of ConnectSoft.AzurePipelines (`template-ci/v1`): one packed candidate, scaffold cases, result validation with discovery and completion checks, dependency audit, package protection and publication evidence bound to the candidate hash, all driven by the `build/template-ci.json` manifest of the consumer. The findings feature of the base template moves the template onto it, and the preset matrix of `build/Test-BaseTemplateRegressions.ps1` becomes the cases of that manifest. This PBI adds the Factory preset as a gating case and is the proof of the feature. The Domain profile of the shared tooling declares one case per artifact kind, and the amendment of ADR-0028 (D114) admits one additional gating case per declared profile while the default generations stay gated as today. The Factory preset is that additional case of the declared Factory profile. The admission is a change of the shared tooling, made once by a task of this PBI in ConnectSoft.AzurePipelines, which is a before-development repository, and the gate PBIs of the gateway and Tenants templates build on it. The candidate is installed, a solution is generated by the Factory scaffold command with `UseFactoryProfile` under the name of a Factory service repository, restored and built in Release, and its tests run with the discovery and completion checks, so that a truncated run fails. The manifest names the services the case needs: SQL Server for the outbox and the two-tenant fixture, and a co-hosted silo. The dependency audit of the generated solution runs through the shared tooling. A case that fails any stage fails the run with the case and the stage named, and publication is not reached. Publication requires the complete reports of every case bound to the candidate and pushes a version that is not yet on the ConnectSoft feed. The PBI proves the amendment of ADR-0028 that scaffolds the Factory services from `connectsoft-base` and the release gate of FR-11: a service scaffolded with the profile builds and passes unchanged, which is the acceptance of the readiness checklist of the increment. Kind: evidence. Traces: adrs: ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-226, AIFACTORY-US-227, AIFACTORY-US-228, AIFACTORY-US-229, feature:component-base-template-findings. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/template-parameters/connectsoft-base.yaml, docs/architecture/catalogs/templates.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the base template, when the template pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the default cases run as today, the Factory preset case, the one additional gating case of the declared Factory profile, is generated with `UseFactoryProfile` under the name of a Factory service repository, restored and built in Release, its tests run with the discovery and completion checks against the services the manifest declares for the case, SQL Server for the outbox and the two-tenant fixture and a co-hosted silo, and the dependency audit of the generated solution runs (ADR-0028 amendments on scaffolding Factory services from the base template and on the Factory profile switch, FR-11).",
        "AC2: Given the Factory preset case fails any stage, when the pipeline evaluates the run, then the run fails with the case and the stage named, the logs are kept in the diagnostics artifact and publication is not reached; a planted failing case proves the refusal (FR-11, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC3: Given complete reports of every case bound to the candidate hash, when the publication job runs, then the package is pushed with a version that is not on the feed, a fresh install of that version generates the Factory preset that builds unchanged, and model/template-parameters/connectsoft-base.yaml lists `UseFactoryProfile` and the Orleans value after the next template inventory (ADR-0028, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1464",
        "AIFACTORY-TASK-1083",
        "AIFACTORY-TASK-1084",
        "AIFACTORY-TASK-1085",
        "AIFACTORY-TASK-1086"
      ],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 905,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-226",
        "AIFACTORY-US-227",
        "AIFACTORY-US-228",
        "AIFACTORY-US-229",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-230]",
      "number": 230
    },
    {
      "id": "AIFACTORY-TASK-1464",
      "type": "task",
      "parent": "AIFACTORY-US-230",
      "title": "Admission of one additional gating case per declared profile in the shared template pipeline",
      "sequence": "18.10.05.01",
      "description": "BEFORE DEVELOPMENT. Admission of one additional gating case per declared profile in the shared template pipeline. Expected output: The manifest schema and `Read-TemplateManifest.ps1` of `template-ci/v1` accept a declared profile with one additional gating case beside the one Domain case per artifact kind and refuse a second additional case of the same profile with the case named; the installer jobs run that case on every change and the publication evidence requires its complete report; `Test-InstallerTooling.SelfTest.ps1` covers an admitted and a refused manifest, the readme of `template-ci/v1` states the rule, and a manifest without a declared profile is gated as before.. Kind: implementation. Repository: ConnectSoft.AzurePipelines. Verification: Test-InstallerTooling.SelfTest.ps1 passes with the admitted and the refused manifest.",
      "acceptanceCriteria": [
        "The manifest schema and `Read-TemplateManifest.ps1` of `template-ci/v1` accept a declared profile with one additional gating case beside the one Domain case per artifact kind and refuse a second additional case of the same profile with the case named; the installer jobs run that case on every change and the publication evidence requires its complete report; `Test-InstallerTooling.SelfTest.ps1` covers an admitted and a refused manifest, the readme of `template-ci/v1` states the rule, and a manifest without a declared profile is gated as before."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 905,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1464]",
      "number": 1464
    },
    {
      "id": "AIFACTORY-TASK-1083",
      "type": "task",
      "parent": "AIFACTORY-US-230",
      "title": "Factory preset case as the additional gating case of the template pipeline manifest",
      "sequence": "18.10.05.02",
      "description": "BEFORE DEVELOPMENT. Factory preset case as the additional gating case of the template pipeline manifest. Expected output: `build/template-ci.json` declares the Factory profile and holds, beside the default Domain cases, the Factory preset case as its one additional gating case, generated with `UseFactoryProfile`, the Orleans messaging value and a Factory service name, with its test filter and the required services SQL Server and a silo; `build/local-scaffold-presets.ps1` offers the same preset for local runs; the shared installer jobs run the case on every change.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: azure-pipelines-template.yml runs the Factory preset case and the run is green.",
      "acceptanceCriteria": [
        "`build/template-ci.json` declares the Factory profile and holds, beside the default Domain cases, the Factory preset case as its one additional gating case, generated with `UseFactoryProfile`, the Orleans messaging value and a Factory service name, with its test filter and the required services SQL Server and a silo; `build/local-scaffold-presets.ps1` offers the same preset for local runs; the shared installer jobs run the case on every change."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 905,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1083]",
      "number": 1083
    },
    {
      "id": "AIFACTORY-TASK-1084",
      "type": "task",
      "parent": "AIFACTORY-US-230",
      "title": "Planted failing Factory case for the gate",
      "sequence": "18.10.05.03",
      "description": "BEFORE DEVELOPMENT. Planted failing Factory case for the gate. Expected output: A pipeline fixture generates the Factory preset case with a planted failing test and asserts that the run fails at the test stage with the case named, that the diagnostics artifact holds its logs and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: the planted run fails at the test stage.",
      "acceptanceCriteria": [
        "A pipeline fixture generates the Factory preset case with a planted failing test and asserts that the run fails at the test stage with the case named, that the diagnostics artifact holds its logs and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 905,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1084]",
      "number": 1084
    },
    {
      "id": "AIFACTORY-TASK-1085",
      "type": "task",
      "parent": "AIFACTORY-US-230",
      "title": "Publication on the complete report of the Factory preset case",
      "sequence": "18.10.05.04",
      "description": "BEFORE DEVELOPMENT. Publication on the complete report of the Factory preset case. Expected output: The publication job of the template pipeline requires the complete report of the Factory preset case beside the reports of the other cases, each bound to the candidate hash, the selected profile and the test filter; a missing or failed stage, an incomplete report or a version that is already on the feed refuses publication with the reason.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: azure-pipelines-template.yml publishes only on complete reports; a repeated version is refused.",
      "acceptanceCriteria": [
        "The publication job of the template pipeline requires the complete report of the Factory preset case beside the reports of the other cases, each bound to the candidate hash, the selected profile and the test filter; a missing or failed stage, an incomplete report or a version that is already on the feed refuses publication with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 905,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1085]",
      "number": 1085
    },
    {
      "id": "AIFACTORY-TASK-1086",
      "type": "task",
      "parent": "AIFACTORY-US-230",
      "title": "Verify the gate on a green run and on the planted run",
      "sequence": "18.10.05.05",
      "description": "BEFORE DEVELOPMENT. Verify the gate on a green run and on the planted run. Expected output: One pipeline run with every case green reaches publication and a fresh install of the published version generates the Factory preset that builds unchanged; the planted run fails before publication; both prove AC1 to AC3 of AIFACTORY-US-230 (ADR-0028, FR-11).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "One pipeline run with every case green reaches publication and a fresh install of the published version generates the Factory preset that builds unchanged; the planted run fails before publication; both prove AC1 to AC3 of AIFACTORY-US-230 (ADR-0028, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1086]",
      "number": 1086
    },
    {
      "id": "AIFACTORY-US-103",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-157",
      "title": "Base template: the Factory service profile is delivered and proven on a generated solution",
      "sequence": "18.10.06",
      "description": "As an asset maintainer, I want BaseTemplate to carry the Factory service profile, so that it serves every Factory service that is not a gateway or an agent host, and every generated product module (D94, D95) without later rework. This is the integration PBI of the feature. Forty-six Factory services are scaffolded from the base template and deploy alone, so the profile carries per service what a host did once. With the Orleans messaging choice and the accepted envelope, the scope chain with its 404, 403 and 401 answers, token validation through the resource-server library with the seven Factory roles, the descriptor-described REST and gRPC surface with health, readiness and the telemetry wiring, and the Factory preset case in the shared template pipeline, the asset maintainer runs the pipeline end to end: pack, install, generate the Factory preset, build, test and audit, then publish. A case that fails any stage blocks publication. The migrated implementation tasks sit under the PBIs that deliver them, and the verification task of this PBI is the proof on the published package. The feature is done when a service generated from the published package with the Factory profile builds and passes unchanged, which is what the readiness checklist of the increment accepts, and when the template inventory of this repository lists the new symbols. The activities and log records of a generated service carry tenant, project, run, step and attempt correlation and its metrics carry tenant and project, because the profile pins the single enrichment registration of the feature `component-observability-factory-conventions`, which is in the same increment (D114). Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-226, AIFACTORY-US-227, AIFACTORY-US-228, AIFACTORY-US-229, AIFACTORY-US-230. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/templates-docs/base-template.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.BaseTemplate with the work of this feature, when the template is packed, installed and instantiated with the Factory preset in its pipeline, then the generated solution 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-580 (messaging profile Orleans with the accepted envelope) is done, then `MessagingModelType` accepts Orleans, the generated service registers the outbox dispatcher and the inbox grains of the Orleans messaging adapter library and writes the ADR-0014 envelope on every published message in the transaction of the state change, and the Compatibility cases of the template pipeline have an Orleans case (ADR-0012).",
        "AC3: Given the work of AIFACTORY-TASK-581 (Factory scope from the token to every call and message) is done, then the generated service takes the tenant from the `tid` claim, admits a project only when the token grants it, forwards the scope on outbound calls and stamps it on messages, answers 404 for an identifier of another tenant, 403 for a project or a scope the token does not grant inside the own tenant and 401 without a token, sends a message without the tenant to the poison handling of the Orleans messaging profile, and handles a tenant-level event without a project under a tenant-only scope (ADR-0015, ADR-0014 decision 1).",
        "AC4: Given the work of AIFACTORY-TASK-582 (token validation with the Factory roles) is done, then the generated service validates tokens of the authorization server through the resource-server library, maps the seven Factory roles to policies and refuses a token without the role its endpoint requires in the project of the request, and the acceptance suite covers the matrix (ADR-0015 decision 5).",
        "AC5: Given the work of AIFACTORY-TASK-583 (descriptor-described REST and gRPC surface with health and telemetry) is done, then a generated service exposes its REST and gRPC endpoints from a service descriptor file, serves health and readiness, and wires its telemetry through the single enrichment registration of the pinned observability libraries, so that its activities and log records carry tenant, project, run, step and attempt correlation and its metrics carry tenant and project, with no enricher of its own, and the architecture tests assert the three (ADR-0014, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-672",
        "AIFACTORY-TASK-1087"
      ],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 906,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-226",
        "AIFACTORY-US-227",
        "AIFACTORY-US-228",
        "AIFACTORY-US-229",
        "AIFACTORY-US-230"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-103]",
      "number": 103
    },
    {
      "id": "AIFACTORY-TASK-672",
      "type": "task",
      "parent": "AIFACTORY-US-103",
      "title": "Verify base-template-factory-profile-delivered by running the declared command",
      "sequence": "18.10.06.01",
      "description": "BEFORE DEVELOPMENT. Verify base-template-factory-profile-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution generated from the published package with the Factory preset; they pass and prove AC1 to AC5 of AIFACTORY-US-103.. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution generated from the published package with the Factory preset; they pass and prove AC1 to AC5 of AIFACTORY-US-103."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 906,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-672]",
      "number": 672
    },
    {
      "id": "AIFACTORY-TASK-1087",
      "type": "task",
      "parent": "AIFACTORY-US-103",
      "title": "Template inventory of this repository records the Factory profile symbols",
      "sequence": "18.10.06.02",
      "description": "BEFORE DEVELOPMENT. Template inventory of this repository records the Factory profile symbols. Expected output: After `python -I tools/docs_model inventory-templates`, model/template-parameters/connectsoft-base.yaml lists `UseFactoryProfile` and the value Orleans of `MessagingModelType`; the authored `note` of `MessagingModelType` no longer says that the template offers only NServiceBus and MassTransit and its `factory_default` names the Orleans value, and the authored `note` of `ServiceModelType` says that the Factory profile generates both service models and no longer that the recipe adds the gRPC project; the generated row of docs/architecture/catalogs/templates.md still renders.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model inventory-templates | python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "After `python -I tools/docs_model inventory-templates`, model/template-parameters/connectsoft-base.yaml lists `UseFactoryProfile` and the value Orleans of `MessagingModelType`; the authored `note` of `MessagingModelType` no longer says that the template offers only NServiceBus and MassTransit and its `factory_default` names the Orleans value, and the authored `note` of `ServiceModelType` says that the Factory profile generates both service models and no longer that the recipe adds the gRPC project; the generated row of docs/architecture/catalogs/templates.md still renders."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 9,
      "phase": "templates-and-libraries",
      "stackRank": 906,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1087]",
      "number": 1087
    },
    {
      "id": "AIFACTORY-FEAT-158",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Base template: open consumer findings closed before the first scaffold",
      "sequence": "18.11",
      "description": "The base template keeps a register of findings reported by its consuming templates (Docs/Consumer-Reported-Findings.md). Four are open: a test session timeout that can silently truncate a run, so that every green result is suspect until it is audited; three vulnerable transitive dependencies, one of them High, carried by Hangfire and Pulumi; the QueryModel symbol without an update path for the consuming templates; and no sync path for the Scripts folder into them. The agent host template also records a generation defect inherited from the base template (a persistence provider substitution that drops a closing quote). The Factory scaffolds from the base template only after these are closed. Component: BaseTemplate (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 10 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-231",
        "AIFACTORY-US-232",
        "AIFACTORY-US-233",
        "AIFACTORY-US-234",
        "AIFACTORY-US-235",
        "AIFACTORY-US-104"
      ],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1000,
      "titlePrefix": "[AIFACTORY-FEAT-158]",
      "number": 158
    },
    {
      "id": "AIFACTORY-US-231",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-158",
      "title": "Base template: the persistence provider substitution keeps its closing quote and the generated configuration of every provider parses",
      "sequence": "18.11.01",
      "description": "As an asset maintainer, I want the persistence provider constants of the template to be substituted into a terminated string for every provider, so that no solution generated from the base template or from a template composed on it starts with a configuration that does not parse. The alignment verification page of the agent host template (Docs/AgentTemplate-Alignment-Verification.md of that template) records a blocking generation defect that it inherits from the base template: the Dapper, PostgreSQL and MySQL persistence substitutions share a replacement marker and drop its closing quote, so the generated provider becomes an unterminated JSON string in the configuration even for the default NHibernate generation. The page states the order of the repair: the standalone base template source is fixed and verified first, the consuming template then moves its submodule, and neither the submodule contents are patched nor the configuration regression tests removed to bypass the failure. This PBI is that first step. It gives each provider constant its own replacement so that the generated value is a terminated string for every persistence choice and dialect, adds configuration smoke tests that parse every generated configuration root to the preset matrix of the template, and records the defect as an item of the findings register with its cause and its closure, because the register does not list it yet. A generation whose configuration does not parse fails the matrix with the preset and the file named. The agent host template consumes the fix through the feature component-agent-template-release. Kind: enabling. Traces: adrs: ADR-0028. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/template-parameters/connectsoft-base.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the default generation of the base template with the NHibernate persistence model, when the generated configuration files are read, then each parses as JSON and the persistence provider value is a terminated string (ADR-0028 amendment on scaffolding from the base template; defect recorded in Docs/AgentTemplate-Alignment-Verification.md of the agent host template; docs/architecture/ecosystem-composition.md names the open findings as a need of this component).",
        "AC2: Given every persistence choice of `PersistenceModelType` and every dialect of the preset matrix, including the Dapper, PostgreSQL and MySQL cases, when the matrix generates them, then the configuration smoke tests parse every configuration root of every case and pass, and a case whose configuration does not parse fails the matrix with the preset and the file named (model/template-parameters/connectsoft-base.yaml lists the choices, ADR-0028).",
        "AC3: Given the fixed template, when the findings register is read, then it holds an item for the substitution defect with its cause, the commit that closes it and the smoke tests that guard it, and the agent host template can move its submodule to that commit without patching submodule contents (ADR-0028, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-584",
        "AIFACTORY-TASK-1088",
        "AIFACTORY-TASK-1089",
        "AIFACTORY-TASK-1090"
      ],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1001,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-231]",
      "number": 231
    },
    {
      "id": "AIFACTORY-TASK-584",
      "type": "task",
      "parent": "AIFACTORY-US-231",
      "title": "Persistence provider substitution fixed in the generated configuration",
      "sequence": "18.11.01.01",
      "description": "BEFORE DEVELOPMENT. Persistence provider substitution fixed in the generated configuration. Expected output: The PostgreSQL and MySQL constant substitutions keep their closing quote; the generated configuration of every provider parses; the configuration smoke tests of the generated matrix pass for all providers.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build | generated regression matrix green.",
      "acceptanceCriteria": [
        "The PostgreSQL and MySQL constant substitutions keep their closing quote; the generated configuration of every provider parses; the configuration smoke tests of the generated matrix pass for all providers."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-584]",
      "number": 584
    },
    {
      "id": "AIFACTORY-TASK-1088",
      "type": "task",
      "parent": "AIFACTORY-US-231",
      "title": "Configuration smoke tests for every persistence choice in the preset matrix",
      "sequence": "18.11.01.02",
      "description": "BEFORE DEVELOPMENT. Configuration smoke tests for every persistence choice in the preset matrix. Expected output: The preset matrix of the template, `build/Test-BaseTemplateRegressions.ps1` until the cases of `build/template-ci.json` replace it in AIFACTORY-US-235, runs smoke tests that parse every generated configuration root for each persistence choice and dialect; a planted unterminated provider string fails the matrix with the preset and the file named.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: the planted case fails the matrix.",
      "acceptanceCriteria": [
        "The preset matrix of the template, `build/Test-BaseTemplateRegressions.ps1` until the cases of `build/template-ci.json` replace it in AIFACTORY-US-235, runs smoke tests that parse every generated configuration root for each persistence choice and dialect; a planted unterminated provider string fails the matrix with the preset and the file named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1001,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1088]",
      "number": 1088
    },
    {
      "id": "AIFACTORY-TASK-1089",
      "type": "task",
      "parent": "AIFACTORY-US-231",
      "title": "Register item for the substitution defect",
      "sequence": "18.11.01.03",
      "description": "BEFORE DEVELOPMENT. Register item for the substitution defect. Expected output: Docs/Consumer-Reported-Findings.md of the template holds an item for the persistence substitution defect with cause, closing commit and guarding tests, and its status table marks the item fixed.. Kind: documentation. Repository: ConnectSoft.BaseTemplate. Verification: the status table lists the item as fixed.",
      "acceptanceCriteria": [
        "Docs/Consumer-Reported-Findings.md of the template holds an item for the persistence substitution defect with cause, closing commit and guarding tests, and its status table marks the item fixed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1001,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1089]",
      "number": 1089
    },
    {
      "id": "AIFACTORY-TASK-1090",
      "type": "task",
      "parent": "AIFACTORY-US-231",
      "title": "Verify the generated configuration of every provider",
      "sequence": "18.11.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the generated configuration of every provider. Expected output: Run the preset matrix from the packed template; every case generates, builds in Release and passes its configuration smoke tests, and the planted case fails, which proves AC1 to AC3 of AIFACTORY-US-231 (ADR-0028).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Run the preset matrix from the packed template; every case generates, builds in Release and passes its configuration smoke tests, and the planted case fails, which proves AC1 to AC3 of AIFACTORY-US-231 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1090]",
      "number": 1090
    },
    {
      "id": "AIFACTORY-US-232",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-158",
      "title": "Base template: the test session timeout is audited and the template adopts the shared template pipeline, so that a truncated test run fails instead of passing",
      "sequence": "18.11.02",
      "description": "As an asset maintainer, I want every test run of the template to be compared with the tests that were discovered, by the one implementation the estate has, so that a green result of the base template means that every test ran and no second completeness script exists. Item 7 of the findings register of the template (Docs/Consumer-Reported-Findings.md of the template) reports that a test session which reaches `TestSessionTimeout` is cut off without a failure: tests that never ran are not failures, so the run prints a pass over an incomplete run, in the pipeline as well as locally. The base template sets the ceiling to 900000 milliseconds in `ConnectSoft.BaseTemplate.runsettings` and to 600000 in the Docker variant, both lower than the value that truncated a consuming suite, and the register states that until the audit is done every other green result in the repository is suspect. Item 5 of the findings page of the authorization server template (Docs/Consumer-Reported-Findings.md of that template) records the stronger repair: a runner that compares the discovery list with what executed and fails on a difference, which holds when a suite outgrows any ceiling. The estate already owns that repair once, in the shared template pipeline tooling of ConnectSoft.AzurePipelines: `template-ci/v1/scripts/Invoke-ApplicationTests.ps1` and `Test-TestResults.ps1` reject missing, aborted and incomplete reports, `Test-ApplicationTooling.SelfTest.ps1` holds their fixtures, and the authorization server and identity templates consume them through `build/template-ci.json` and `template-ci/v1/application-steps.yml`. The rollout ledger of that tooling (`template-ci/rollout-status.md`) lists the base template as pending, with the checkpoint to migrate the standalone base template. This PBI does the audit and that migration. It measures the wall-clock runtime of the unit, architecture and acceptance suites and sets both ceilings well above a healthy run. It gives the base template a `build/template-ci.json` manifest that names its solution, test projects, runsettings, required services and scaffold cases, and imports the shared application steps in `azure-pipelines.yml`. The base template gains no completeness script of its own: the shared scripts own execution and gates, tooling is never composed into a package, and a copy in the base template would ship inside every consumer submodule. A rejection case the shared `Test-TestResults.ps1` lacks, a truncated or a mismatched report, is added in the shared tooling with its self-test and not in a template. ConnectSoft.AzurePipelines is a before-development repository (D114), so that change is a task of this PBI in that repository, and the base template proves the four rejections from the consumer side at the tooling commit that carries it. The audit with its measured numbers closes the item in the register. The same repository holds the shared template installer steps, `template/dotnet-template-installer-steps.yaml` and the job `template/dotnet-template-installer-job.yaml` that calls them, by which the templates outside `template-ci/v1` pack, validate one instantiation and push. The template gates of the next increment already rely on a gate between the pack and the push, so this PBI delivers it in the first increment. A gate hook, off by default, runs a command of the consumer against the installed candidate after the pack and before the push and stops the run on a non-zero exit. A version guard, opt-in and off by default, refuses a version that is already on the feed. The `allowPackageConflicts` parameter stays for a consumer that does not switch the guard on, so no existing consumer of the shared job changes. Kind: enabling. Traces: adrs: ADR-0028; requirements: FR-11. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the unit, architecture and acceptance suites of the base template, when the audit measures their wall-clock runtime, then the ceilings of `ConnectSoft.BaseTemplate.runsettings` and of the Docker variant are set above the measured runtime with a recorded margin and the measured numbers are written into item 7 of the findings register (ADR-0028, docs/architecture/ecosystem-composition.md names the open findings as a need of this component).",
        "AC2: Given a test run of any suite through the shared application steps, when `Test-TestResults.ps1` of the shared tooling compares the discovery list with the executed tests of the result files, then a run with fewer executed than discovered tests fails with the missing tests named, and synthetic missing, aborted, truncated and mismatched result files are each rejected while a complete one is accepted (FR-11, ADR-0028).",
        "AC3: Given the pipeline of the base template, when it runs the three suites, then `azure-pipelines.yml` imports `template-ci/v1/application-steps.yml` with `build/template-ci.json`, each suite passes through the shared completeness check before its result counts, a truncated run fails the stage, the base template holds no completeness script of its own, and item 7 is marked fixed in the status table of the register (FR-11, model/components.yaml).",
        "AC4: Given a consumer of the shared installer job `template/dotnet-template-installer-job.yaml`, when it switches the gate hook on and its command exits with a failure, then the run stops before the push; when it switches the version guard on and the version is already on the feed, then the push is refused with the reason; and a consumer that sets neither switch packs, validates one instantiation and pushes as before, with `allowPackageConflicts` as it was (ADR-0028 amendment on scaffolding from the published templates; model/backlog/epics.yaml states the generated-solution gate as the completion of the epic)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-585",
        "AIFACTORY-TASK-1167",
        "AIFACTORY-TASK-1091",
        "AIFACTORY-TASK-1461",
        "AIFACTORY-TASK-1092",
        "AIFACTORY-TASK-1093",
        "AIFACTORY-TASK-1426"
      ],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-232]",
      "number": 232
    },
    {
      "id": "AIFACTORY-TASK-585",
      "type": "task",
      "parent": "AIFACTORY-US-232",
      "title": "Test session timeout audited",
      "sequence": "18.11.02.01",
      "description": "BEFORE DEVELOPMENT. Test session timeout audited. Expected output: The measured runtime of each suite and the margin are recorded in item 7 of the findings register, a run of the three suites through the shared application steps is complete, a synthetic truncated run fails instead of passing, and the finding is closed in the register, which proves AC1 to AC3 of AIFACTORY-US-232.. Kind: verification. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The measured runtime of each suite and the margin are recorded in item 7 of the findings register, a run of the three suites through the shared application steps is complete, a synthetic truncated run fails instead of passing, and the finding is closed in the register, which proves AC1 to AC3 of AIFACTORY-US-232."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-585]",
      "number": 585
    },
    {
      "id": "AIFACTORY-TASK-1167",
      "type": "task",
      "parent": "AIFACTORY-US-232",
      "title": "Test session ceilings of both runsettings files set from the measured runtimes",
      "sequence": "18.11.02.02",
      "description": "BEFORE DEVELOPMENT. Test session ceilings of both runsettings files set from the measured runtimes. Expected output: `TestSessionTimeout` of `ConnectSoft.BaseTemplate.runsettings` and of the Docker variant is set above the measured wall-clock runtime of the slowest suite with the margin the audit records, and a comment beside each value names the measurement it derives from.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`TestSessionTimeout` of `ConnectSoft.BaseTemplate.runsettings` and of the Docker variant is set above the measured wall-clock runtime of the slowest suite with the margin the audit records, and a comment beside each value names the measurement it derives from."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1167]",
      "number": 1167
    },
    {
      "id": "AIFACTORY-TASK-1091",
      "type": "task",
      "parent": "AIFACTORY-US-232",
      "title": "Shared template pipeline manifest of the base template",
      "sequence": "18.11.02.03",
      "description": "BEFORE DEVELOPMENT. Shared template pipeline manifest of the base template. Expected output: `build/template-ci.json` of the base template names its identity, solution, package source configuration, test projects, runsettings, concurrency, coverage threshold, required services and scaffold cases, validates with the manifest action of the shared tooling, and holds no credential; the base template holds no completeness script.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: the manifest validation of the shared tooling passes.",
      "acceptanceCriteria": [
        "`build/template-ci.json` of the base template names its identity, solution, package source configuration, test projects, runsettings, concurrency, coverage threshold, required services and scaffold cases, validates with the manifest action of the shared tooling, and holds no credential; the base template holds no completeness script."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1091]",
      "number": 1091
    },
    {
      "id": "AIFACTORY-TASK-1461",
      "type": "task",
      "parent": "AIFACTORY-US-232",
      "title": "Rejection of a truncated and of a mismatched report in the shared result validation",
      "sequence": "18.11.02.04",
      "description": "BEFORE DEVELOPMENT. Rejection of a truncated and of a mismatched report in the shared result validation. Expected output: `Test-TestResults.ps1` of `template-ci/v1` rejects a truncated result file and a result file whose executed tests differ from the discovery list, each with the missing tests named, beside the missing and the aborted report it rejects today; `Test-ApplicationTooling.SelfTest.ps1` holds a synthetic truncated and a synthetic mismatched report that are rejected and a complete one that is accepted.. Kind: implementation. Repository: ConnectSoft.AzurePipelines. Verification: Test-ApplicationTooling.SelfTest.ps1 rejects the truncated and the mismatched report and accepts the complete one.",
      "acceptanceCriteria": [
        "`Test-TestResults.ps1` of `template-ci/v1` rejects a truncated result file and a result file whose executed tests differ from the discovery list, each with the missing tests named, beside the missing and the aborted report it rejects today; `Test-ApplicationTooling.SelfTest.ps1` holds a synthetic truncated and a synthetic mismatched report that are rejected and a complete one that is accepted."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1461]",
      "number": 1461
    },
    {
      "id": "AIFACTORY-TASK-1092",
      "type": "task",
      "parent": "AIFACTORY-US-232",
      "title": "Consumer proof of the four rejected result files",
      "sequence": "18.11.02.05",
      "description": "BEFORE DEVELOPMENT. Consumer proof of the four rejected result files. Expected output: A self-test of the base template runs the result validation of the shared tooling, at the tooling commit the manifest resolves, on a missing, an aborted, a truncated and a mismatched result file and on a complete one, and asserts four rejections and one acceptance; the tooling commit is one that carries the truncated and the mismatched rejection of AIFACTORY-TASK-1461.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: the self-test rejects the four synthetic files and accepts the complete one.",
      "acceptanceCriteria": [
        "A self-test of the base template runs the result validation of the shared tooling, at the tooling commit the manifest resolves, on a missing, an aborted, a truncated and a mismatched result file and on a complete one, and asserts four rejections and one acceptance; the tooling commit is one that carries the truncated and the mismatched rejection of AIFACTORY-TASK-1461."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1092]",
      "number": 1092
    },
    {
      "id": "AIFACTORY-TASK-1093",
      "type": "task",
      "parent": "AIFACTORY-US-232",
      "title": "Shared application steps imported in the pipeline of the base template",
      "sequence": "18.11.02.06",
      "description": "BEFORE DEVELOPMENT. Shared application steps imported in the pipeline of the base template. Expected output: `azure-pipelines.yml` of the base template declares the shared tooling resource, imports its runtime variables and setup steps and runs the unit, architecture and acceptance suites through `template-ci/v1/application-steps.yml` with `build/template-ci.json`; the stage output names the counts of discovered and executed tests and a difference fails the stage.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: azure-pipelines.yml runs the shared application steps and the run is green.",
      "acceptanceCriteria": [
        "`azure-pipelines.yml` of the base template declares the shared tooling resource, imports its runtime variables and setup steps and runs the unit, architecture and acceptance suites through `template-ci/v1/application-steps.yml` with `build/template-ci.json`; the stage output names the counts of discovered and executed tests and a difference fails the stage."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1093]",
      "number": 1093
    },
    {
      "id": "AIFACTORY-TASK-1426",
      "type": "task",
      "parent": "AIFACTORY-US-232",
      "title": "Gate hook and version guard in the shared template installer steps",
      "sequence": "18.11.02.07",
      "description": "BEFORE DEVELOPMENT. Gate hook and version guard in the shared template installer steps. Expected output: The shared installer steps `template/dotnet-template-installer-steps.yaml` and the job that calls them gain a gate hook, off by default, that runs a command of the consumer against the installed candidate after the pack and before the push and stops the run on a non-zero exit, and a version guard, opt-in and off by default, that refuses a version already on the feed with the reason; the `allowPackageConflicts` parameter stays with its default for a consumer that does not switch the guard on, and a consumer that sets neither switch keeps its single smoke instantiation and its push unchanged; the three consumer runs of the verification prove AC4 of AIFACTORY-US-232.. Kind: operations. Repository: ConnectSoft.AzurePipelines. Verification: a consumer run with the hook on and a failing case does not reach the push | a consumer run with the guard on and a repeated version is refused with the reason | a consumer run with neither switch packs, instantiates once and pushes as before.",
      "acceptanceCriteria": [
        "The shared installer steps `template/dotnet-template-installer-steps.yaml` and the job that calls them gain a gate hook, off by default, that runs a command of the consumer against the installed candidate after the pack and before the push and stops the run on a non-zero exit, and a version guard, opt-in and off by default, that refuses a version already on the feed with the reason; the `allowPackageConflicts` parameter stays with its default for a consumer that does not switch the guard on, and a consumer that sets neither switch keeps its single smoke instantiation and its push unchanged; the three consumer runs of the verification prove AC4 of AIFACTORY-US-232."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1002,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1426]",
      "number": 1426
    },
    {
      "id": "AIFACTORY-US-233",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-158",
      "title": "Base template: the `Hangfire.Core`, `Pulumi` and `System.ServiceModel.Primitives` dependency paths are cleared at the parent, so that no consumer needs a direct reference of its own",
      "sequence": "18.11.03",
      "description": "As an asset maintainer, I want the vulnerable transitive dependencies of the template to be cleared at their source, so that no Factory service and no consuming template inherits a known vulnerability it cannot fix itself. Item 4 of the findings register of the template (Docs/Consumer-Reported-Findings.md of the template) lists the advisories that remain after the earlier bumps: `Newtonsoft.Json` 11.0.1 through `Hangfire.Core`, rated High, `OpenTelemetry.Api` and the OpenTelemetry protocol exporter at 1.9.0 through `Pulumi`, rated Moderate, and the remaining path of `System.Security.Cryptography.Xml` through `System.ServiceModel.Primitives`. The register explains why a consuming template cannot repair them: central transitive pinning breaks restore because the template declares package versions conditionally on symbols that are not evaluated yet, and a direct reference per project would place a package into projects that do not use it. It names Pulumi as the entry to do first, because it also holds the infrastructure project at an OpenTelemetry version below the centrally declared one. The evidence is not uniform, so this PBI first establishes what is open. The register reports the advisories against a solution generated from the authorization server template, while the findings verification page of the base template (Docs/Findings-Verification.md of the template) records for the same commit no known vulnerabilities across its authoring and generated projects, and the shared pipeline page of the authorization server template records that four direct references in its own projects select the already declared central versions without a change of the base template. What stays open in the base template is the parents: `Hangfire.Core`, `Pulumi` and `System.ServiceModel.Primitives` still pull the vulnerable versions into every consumer that carries no direct references of its own, and the infrastructure project still resolves the old OpenTelemetry version. The PBI raises the three parents to versions whose transitive closure is clean. Where a parent has no clean release, the central version of the vulnerable package is activated by a versionless direct reference in the base template project that references the parent, with the reason next to it, so that a consumer needs none. The audit runs through `Invoke-DependencyAudit.ps1` of the shared template pipeline tooling on the authoring solution and on every generated case and fails the run on any finding; the template adds no audit step of its own. Kind: enabling. Traces: adrs: ADR-0028; requirements: FR-11. Relates: nfrs: NFR-02. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/template-parameters/connectsoft-base.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the base template before the change, when the dependency audit runs over a generated case with the HangFire scheduler and the infrastructure project and over a solution composed by a consuming template that carries no direct references of its own, then it either reproduces the advisories of item 4 of the findings register with the parent of each, or the register records with the commit that they are already cleared there (ADR-0028, NFR-02, docs/architecture/ecosystem-composition.md).",
        "AC2: Given the base template after the change, when the audit runs over the authoring solution and over every generated case, then `Hangfire.Core`, `Pulumi` and `System.ServiceModel.Primitives` resolve to versions whose closure holds none of the advisories, or the versionless direct reference that activates the central version sits in the base template project that references the parent with its reason, and no vulnerable package is reported (ADR-0028, NFR-02, model/template-parameters/connectsoft-base.yaml lists `SchedulerModelType`).",
        "AC3: Given a solution composed by a consuming template on the changed base template, when the consumer carries no direct reference of its own for these packages, then its audit is clean, and the infrastructure project resolves the centrally declared OpenTelemetry version (NFR-02, ADR-0028).",
        "AC4: Given the template pipeline, when `Invoke-DependencyAudit.ps1` of the shared tooling finds a vulnerable package of any severity in the authoring solution or in a generated case, then the run fails with the package, the advisory and the case named, and item 4 is marked fixed in the status table of the register only when the audit is green (FR-11, NFR-02)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1168",
        "AIFACTORY-TASK-586",
        "AIFACTORY-TASK-1094",
        "AIFACTORY-TASK-1095",
        "AIFACTORY-TASK-1096"
      ],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1003,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-02"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-base.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-233]",
      "number": 233
    },
    {
      "id": "AIFACTORY-TASK-1168",
      "type": "task",
      "parent": "AIFACTORY-US-233",
      "title": "Baseline audit of what is open before the change",
      "sequence": "18.11.03.01",
      "description": "BEFORE DEVELOPMENT. Baseline audit of what is open before the change. Expected output: The audit output of a generated case with the HangFire scheduler and the infrastructure project and of a consumer composition without direct references of its own is recorded in item 4 of Docs/Consumer-Reported-Findings.md of the template, with the commit and with the parent of each advisory or the statement that it is already cleared, which proves AC1 of AIFACTORY-US-233.. Kind: verification. Repository: ConnectSoft.BaseTemplate. Verification: dotnet list package --vulnerable --include-transitive on both solutions is recorded.",
      "acceptanceCriteria": [
        "The audit output of a generated case with the HangFire scheduler and the infrastructure project and of a consumer composition without direct references of its own is recorded in item 4 of Docs/Consumer-Reported-Findings.md of the template, with the commit and with the parent of each advisory or the statement that it is already cleared, which proves AC1 of AIFACTORY-US-233."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1168]",
      "number": 1168
    },
    {
      "id": "AIFACTORY-TASK-586",
      "type": "task",
      "parent": "AIFACTORY-US-233",
      "title": "Vulnerable transitive dependencies cleared",
      "sequence": "18.11.03.02",
      "description": "BEFORE DEVELOPMENT. Vulnerable transitive dependencies cleared. Expected output: The `Hangfire.Core`, `Pulumi` and `System.ServiceModel.Primitives` paths are raised, or the versionless direct reference sits in the base template project that references the parent, so that the direct and transitive audit of the authoring and generated projects reports no known vulnerability, a consumer needs no direct reference of its own and the infrastructure project resolves the centrally declared OpenTelemetry version.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet list package --vulnerable --include-transitive reports none.",
      "acceptanceCriteria": [
        "The `Hangfire.Core`, `Pulumi` and `System.ServiceModel.Primitives` paths are raised, or the versionless direct reference sits in the base template project that references the parent, so that the direct and transitive audit of the authoring and generated projects reports no known vulnerability, a consumer needs no direct reference of its own and the infrastructure project resolves the centrally declared OpenTelemetry version."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-586]",
      "number": 586
    },
    {
      "id": "AIFACTORY-TASK-1094",
      "type": "task",
      "parent": "AIFACTORY-US-233",
      "title": "Dependency audit of the shared tooling for the authoring solution and every generated case",
      "sequence": "18.11.03.03",
      "description": "BEFORE DEVELOPMENT. Dependency audit of the shared tooling for the authoring solution and every generated case. Expected output: The manifest and the pipelines of the base template run `Invoke-DependencyAudit.ps1` of the shared template pipeline tooling on the authoring solution and on each generated case; a finding or an unavailable audit source fails the run with package, advisory and case named, and the template holds no audit step of its own.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: the audit action of the shared tooling runs in both pipelines and the run is green.",
      "acceptanceCriteria": [
        "The manifest and the pipelines of the base template run `Invoke-DependencyAudit.ps1` of the shared template pipeline tooling on the authoring solution and on each generated case; a finding or an unavailable audit source fails the run with package, advisory and case named, and the template holds no audit step of its own."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1003,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1094]",
      "number": 1094
    },
    {
      "id": "AIFACTORY-TASK-1095",
      "type": "task",
      "parent": "AIFACTORY-US-233",
      "title": "Register item 4 closed with the raised versions",
      "sequence": "18.11.03.04",
      "description": "BEFORE DEVELOPMENT. Register item 4 closed with the raised versions. Expected output: Item 4 of Docs/Consumer-Reported-Findings.md of the template lists the raised parent versions, any versionless direct reference with its project and reason, and the audit output, and the status table marks the item fixed.. Kind: documentation. Repository: ConnectSoft.BaseTemplate. Verification: the status table lists item 4 as fixed.",
      "acceptanceCriteria": [
        "Item 4 of Docs/Consumer-Reported-Findings.md of the template lists the raised parent versions, any versionless direct reference with its project and reason, and the audit output, and the status table marks the item fixed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1003,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1095]",
      "number": 1095
    },
    {
      "id": "AIFACTORY-TASK-1096",
      "type": "task",
      "parent": "AIFACTORY-US-233",
      "title": "Verify the audit of the authoring, generated and consumer-composed solutions",
      "sequence": "18.11.03.05",
      "description": "BEFORE DEVELOPMENT. Verify the audit of the authoring, generated and consumer-composed solutions. Expected output: Run the audit on the authoring solution, on every generated case and on a consumer composition without direct references of its own; zero findings, and a planted vulnerable pin fails the audit, which proves AC2 to AC4 of AIFACTORY-US-233 (NFR-02).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Run the audit on the authoring solution, on every generated case and on a consumer composition without direct references of its own; zero findings, and a planted vulnerable pin fails the audit, which proves AC2 to AC4 of AIFACTORY-US-233 (NFR-02)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1096]",
      "number": 1096
    },
    {
      "id": "AIFACTORY-US-234",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-158",
      "title": "Base template: consuming templates receive QueryModel through a migration step and the Scripts folder through the check of the shared template pipeline, which fails their pipeline on drift",
      "sequence": "18.11.04",
      "description": "As an asset maintainer, I want a defined path by which a change of the base template reaches the templates composed on it, so that a default-on feature or a new script of the base template no longer breaks or silently bypasses its consumers. Items 5 and 6 of the findings register of the template (Docs/Consumer-Reported-Findings.md of the template) are two forms of one gap. QueryModel shipped with `UseQueryModel` on by default and an unconditional `AddQueryModel` call that binds a validated configuration section, so every consuming host without that section failed at startup when its submodule moved, and the three QueryModel package versions were missing from a consumer snapshot. The Scripts folder of the base template holds 35 files while a consumer root holds 14: the observability toolkit and four dashboards never arrive, and no mechanism keeps the two in step. The register proposes the repair for both: a change that makes configuration mandatory states its migration step, and a sync step replaces hand copies, in the shape a consumer already uses for its package snapshot, with a check mode for the pipeline and a write mode to regenerate. That shape exists once in the estate, as the snapshot check of the shared template pipeline tooling (`Sync-PackageSnapshot.ps1` with a `snapshot` entry in `build/template-ci.json`). The Scripts sync and its check therefore belong beside it in the shared tooling of ConnectSoft.AzurePipelines, with one manifest entry per consumer, and not in the base template, where a script would ship inside every consumer submodule. ConnectSoft.AzurePipelines is a before-development repository (D114), so the sync with its check mode and its write mode is a task of this PBI in that repository. This PBI keeps in the base template what belongs there: the `AddQueryModel` call depends on the `UseQueryModel` symbol, a configuration invariant test names a missing section instead of failing at startup, and a consumer migration note lists, per change of the base template, the configuration and package entries a consumer adds and the manifest entry of the Scripts check. A consumer whose Scripts differ from the Scripts folder of its base-template submodule fails its own pipeline in check mode with the drifted files named. The check is wired by the adopters this campaign names, each in its own feature: the authorization server template (AIFACTORY-US-247), the gateway template (AIFACTORY-US-239), the identity template (AIFACTORY-US-243) and the Tenants template (AIFACTORY-US-253). The remaining consumers are listed in the migration note in the order of the rollout ledger of the shared tooling. Kind: enabling. Traces: adrs: ADR-0028; requirements: FR-11. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a host generated with `UseQueryModel` off and no QueryModel configuration section, when it starts, then it starts without a binding failure; given the symbol on and a configuration root without the section, when the configuration invariant test runs, then it fails and names the root and the section before any host starts (item 5 of the findings register, ADR-0028, docs/architecture/ecosystem-composition.md).",
        "AC2: Given a consuming template whose Scripts folder differs from the Scripts folder of its base-template submodule, when the Scripts check of the shared template pipeline tooling runs in check mode through the entry of the consumer in `build/template-ci.json`, then it exits with an error that lists the missing and the changed files, and when it runs in write mode, then the folders are equal and the check passes; the base template holds no copy of the sync script (item 6 of the findings register, ADR-0028, FR-11).",
        "AC3: Given a change of the base template that makes a configuration section or a package entry mandatory, when the consumer migration note is read, then it lists the change with the step a consumer takes, the manifest entry of the Scripts check, the four adopters that wire the check in this campaign and the consumers that still follow, and items 5 and 6 are marked fixed in the status table of the register (ADR-0028, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-587",
        "AIFACTORY-TASK-1462",
        "AIFACTORY-TASK-1097",
        "AIFACTORY-TASK-1098",
        "AIFACTORY-TASK-1099"
      ],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1004,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-234]",
      "number": 234
    },
    {
      "id": "AIFACTORY-TASK-587",
      "type": "task",
      "parent": "AIFACTORY-US-234",
      "title": "QueryModel rollout and Scripts sync path for the consuming templates",
      "sequence": "18.11.04.01",
      "description": "BEFORE DEVELOPMENT. QueryModel rollout and Scripts sync path for the consuming templates. Expected output: The `AddQueryModel` call depends on `UseQueryModel` and a configuration invariant test names a missing QueryModel section; the consuming templates receive the QueryModel symbol through the documented migration step and the Scripts folder through a documented sync step with a guard, the Scripts check of the shared template pipeline tooling, that fails their pipeline when they drift; the two findings are closed in the register.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The `AddQueryModel` call depends on `UseQueryModel` and a configuration invariant test names a missing QueryModel section; the consuming templates receive the QueryModel symbol through the documented migration step and the Scripts folder through a documented sync step with a guard, the Scripts check of the shared template pipeline tooling, that fails their pipeline when they drift; the two findings are closed in the register."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-587]",
      "number": 587
    },
    {
      "id": "AIFACTORY-TASK-1462",
      "type": "task",
      "parent": "AIFACTORY-US-234",
      "title": "Scripts sync with check and write mode in the shared template pipeline tooling",
      "sequence": "18.11.04.02",
      "description": "BEFORE DEVELOPMENT. Scripts sync with check and write mode in the shared template pipeline tooling. Expected output: A Scripts sync script of `template-ci/v1` stands beside `Sync-PackageSnapshot.ps1`: in check mode it compares the Scripts folder of a consumer with the Scripts folder of its base-template submodule and exits with an error that lists the missing and the changed files, and in write mode it writes the folder; the manifest schema holds one Scripts entry per consumer beside the `snapshot` entry, and a self-test covers an aligned folder, a removed file, a changed file and the write mode.. Kind: implementation. Repository: ConnectSoft.AzurePipelines. Verification: the self-test of the Scripts sync passes in check mode and in write mode.",
      "acceptanceCriteria": [
        "A Scripts sync script of `template-ci/v1` stands beside `Sync-PackageSnapshot.ps1`: in check mode it compares the Scripts folder of a consumer with the Scripts folder of its base-template submodule and exits with an error that lists the missing and the changed files, and in write mode it writes the folder; the manifest schema holds one Scripts entry per consumer beside the `snapshot` entry, and a self-test covers an aligned folder, a removed file, a changed file and the write mode."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1462]",
      "number": 1462
    },
    {
      "id": "AIFACTORY-TASK-1097",
      "type": "task",
      "parent": "AIFACTORY-US-234",
      "title": "Drift fixture for the Scripts check and the QueryModel invariant",
      "sequence": "18.11.04.03",
      "description": "BEFORE DEVELOPMENT. Drift fixture for the Scripts check and the QueryModel invariant. Expected output: A self-test removes the QueryModel section from one configuration root and asserts that the invariant test names root and section; a copy of the Scripts folder with one file removed and one changed is run through the Scripts check of the shared tooling in check mode, which names both, and in write mode, which restores them.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: the self-tests pass.",
      "acceptanceCriteria": [
        "A self-test removes the QueryModel section from one configuration root and asserts that the invariant test names root and section; a copy of the Scripts folder with one file removed and one changed is run through the Scripts check of the shared tooling in check mode, which names both, and in write mode, which restores them."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1004,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1097]",
      "number": 1097
    },
    {
      "id": "AIFACTORY-TASK-1098",
      "type": "task",
      "parent": "AIFACTORY-US-234",
      "title": "Consumer migration note and closure of items 5 and 6",
      "sequence": "18.11.04.04",
      "description": "BEFORE DEVELOPMENT. Consumer migration note and closure of items 5 and 6. Expected output: A page of the template documentation lists, per change of the base template that adds mandatory configuration or package entries, the step a consumer takes, the entry of the Scripts check in `build/template-ci.json`, the four adopters of this campaign and the consumers that still follow in the order of the rollout ledger; items 5 and 6 of Docs/Consumer-Reported-Findings.md of the template are marked fixed.. Kind: documentation. Repository: ConnectSoft.BaseTemplate. Verification: the status table lists items 5 and 6 as fixed.",
      "acceptanceCriteria": [
        "A page of the template documentation lists, per change of the base template that adds mandatory configuration or package entries, the step a consumer takes, the entry of the Scripts check in `build/template-ci.json`, the four adopters of this campaign and the consumers that still follow in the order of the rollout ledger; items 5 and 6 of Docs/Consumer-Reported-Findings.md of the template are marked fixed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1004,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1098]",
      "number": 1098
    },
    {
      "id": "AIFACTORY-TASK-1099",
      "type": "task",
      "parent": "AIFACTORY-US-234",
      "title": "Verify the sync step and the invariant on a consumer copy",
      "sequence": "18.11.04.05",
      "description": "BEFORE DEVELOPMENT. Verify the sync step and the invariant on a consumer copy. Expected output: Run the Scripts check of the shared tooling in check mode against a drifted consumer copy and against an aligned one, and run the invariant test with and without the section; the drifted cases fail and the aligned cases pass, which proves AC1 to AC3 of AIFACTORY-US-234 (ADR-0028).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Run the Scripts check of the shared tooling in check mode against a drifted consumer copy and against an aligned one, and run the invariant test with and without the section; the drifted cases fail and the aligned cases pass, which proves AC1 to AC3 of AIFACTORY-US-234 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1099]",
      "number": 1099
    },
    {
      "id": "AIFACTORY-US-235",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-158",
      "title": "Base template: the register holds no open finding and the packed template passes the cases of the shared template pipeline with complete reports before the package publishes",
      "sequence": "18.11.05",
      "description": "As an asset maintainer, I want the closure of the findings to be proven by the template pipeline on generated solutions, so that the Factory scaffolds its first service from a package whose green result is complete, audited and reproducible. The amendment of ADR-0028 that scaffolds the Factory services from the base template puts the extensions the templates need before the first scaffold into the build backlog, and the feature states that the Factory scaffolds from the base template only after the open findings are closed. This PBI is the proof. The gate is the one mechanism the estate has, the shared template pipeline of ConnectSoft.AzurePipelines (`template-ci/v1`): candidate packing, scaffold cases, result validation, dependency audit, package protection and publication evidence bound to the candidate hash. The rollout ledger of that tooling schedules the base template next. The preset matrix of `build/Test-BaseTemplateRegressions.ps1` becomes the Domain and Compatibility cases of the `build/template-ci.json` manifest, the template pipeline imports the shared installer jobs, and publication requires the complete reports of every case bound to the candidate. For each case the candidate is installed and the solution is generated, restored and built in Release; it passes the configuration smoke tests of the substitution fix as a case validator, runs its tests with the discovery and completion checks against the services the manifest declares, SQL Server for the persistence and messaging tests and a co-hosted silo, and passes the dependency audit. A case that fails any stage fails the run with the case and the stage named, and no later stage of that case counts as evidence. Publication pushes a version that is not yet on the ConnectSoft feed. The status table of the findings register then shows items 4, 5, 6 and 7 and the substitution defect as fixed, each with the stage of the gate that guards it, so that a finding cannot reopen without a red run. The agent host template moves its base-template submodule to the published state in its own release feature. Kind: evidence. Traces: adrs: ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-231, AIFACTORY-US-232, AIFACTORY-US-233, AIFACTORY-US-234. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/catalogs/templates.md.",
      "acceptanceCriteria": [
        "AC1: Given the base template with the work of this feature, when the template pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, every case of the selected profile is generated, restored and built in Release, passes the configuration smoke tests, runs its tests with the discovery and completion checks against the services the manifest declares, SQL Server and a co-hosted silo, and passes the dependency audit before publication (ADR-0028 amendment on scaffolding from the base template, FR-11).",
        "AC2: Given a planted unterminated provider string, a planted truncated test run and a planted vulnerable pin, when the pipeline runs with each, then each run fails at the stage that guards the finding with the case named and publication is not reached (FR-11, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC3: Given complete reports of every case bound to the candidate hash, when the findings register is read, then its status table shows items 4, 5, 6 and 7 and the substitution defect as fixed with the guarding stage named, the package is published with a version that was not on the feed, and a fresh install of that version generates the default case whose configuration parses (ADR-0028, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/catalogs/templates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1100",
        "AIFACTORY-TASK-1101",
        "AIFACTORY-TASK-1102"
      ],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1005,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-231",
        "AIFACTORY-US-232",
        "AIFACTORY-US-233",
        "AIFACTORY-US-234"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/catalogs/templates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-235]",
      "number": 235
    },
    {
      "id": "AIFACTORY-TASK-1100",
      "type": "task",
      "parent": "AIFACTORY-US-235",
      "title": "Preset matrix as Domain and Compatibility cases of the manifest with the shared installer jobs",
      "sequence": "18.11.05.01",
      "description": "BEFORE DEVELOPMENT. Preset matrix as Domain and Compatibility cases of the manifest with the shared installer jobs. Expected output: The presets of `build/Test-BaseTemplateRegressions.ps1` are the Domain and Compatibility cases of `build/template-ci.json`, each with its arguments, test filter, required services and the configuration smoke tests as its validator; `azure-pipelines-template.yml` imports `template-ci/v1/installer-jobs.yml` of the shared tooling; publication requires the complete reports of every case bound to the candidate hash and refuses a version that is already on the feed.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: azure-pipelines-template.yml runs the shared installer jobs and the run is green.",
      "acceptanceCriteria": [
        "The presets of `build/Test-BaseTemplateRegressions.ps1` are the Domain and Compatibility cases of `build/template-ci.json`, each with its arguments, test filter, required services and the configuration smoke tests as its validator; `azure-pipelines-template.yml` imports `template-ci/v1/installer-jobs.yml` of the shared tooling; publication requires the complete reports of every case bound to the candidate hash and refuses a version that is already on the feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1005,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1100]",
      "number": 1100
    },
    {
      "id": "AIFACTORY-TASK-1101",
      "type": "task",
      "parent": "AIFACTORY-US-235",
      "title": "Planted regressions of the three guarded findings",
      "sequence": "18.11.05.02",
      "description": "BEFORE DEVELOPMENT. Planted regressions of the three guarded findings. Expected output: Pipeline fixtures plant an unterminated provider string, a truncated run and a vulnerable pin, and assert that each run fails at its guarding stage with the case named and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: each planted run fails at its guarding stage.",
      "acceptanceCriteria": [
        "Pipeline fixtures plant an unterminated provider string, a truncated run and a vulnerable pin, and assert that each run fails at its guarding stage with the case named and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1005,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1101]",
      "number": 1101
    },
    {
      "id": "AIFACTORY-TASK-1102",
      "type": "task",
      "parent": "AIFACTORY-US-235",
      "title": "Verify the closed register on a green run and on the planted runs",
      "sequence": "18.11.05.03",
      "description": "BEFORE DEVELOPMENT. Verify the closed register on a green run and on the planted runs. Expected output: One green pipeline run reaches publication with the status table of the register showing no open finding, and the three planted runs fail before it; together they prove AC1 to AC3 of AIFACTORY-US-235 (ADR-0028, FR-11).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "One green pipeline run reaches publication with the status table of the register showing no open finding, and the three planted runs fail before it; together they prove AC1 to AC3 of AIFACTORY-US-235 (ADR-0028, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1102]",
      "number": 1102
    },
    {
      "id": "AIFACTORY-US-104",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-158",
      "title": "Base template: open consumer findings closed before the first scaffold is delivered and proven on a generated solution",
      "sequence": "18.11.06",
      "description": "As an asset maintainer, I want BaseTemplate to carry open consumer findings closed before the first scaffold, so that it serves every Factory service that is not a gateway or an agent host, and every generated product module (D94, D95) without later rework. This is the integration PBI of the feature. The base template keeps a register of findings reported by its consuming templates, and four of its items are open together with a generation defect the agent host template inherits. With the substitution fixed, the test runs checked for completeness by the shared template pipeline, the vulnerable dependency paths cleared at their parents, the migration step for QueryModel and the Scripts check for the consumers in place, and the cases of the shared template pipeline guarding each of them, the asset maintainer runs the pipeline end to end and publishes the package. A case that fails any stage blocks publication. The migrated tasks sit under the PBIs that deliver them, and the verification task of this PBI is the proof on the published package. The feature is done when the status table of the register shows no open item, the package is on the feed with a verified version, and a solution generated from it builds and passes with a complete test run, so that the first Factory service and the agent host template compose on a base template without known defects. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-231, AIFACTORY-US-232, AIFACTORY-US-233, AIFACTORY-US-234, AIFACTORY-US-235. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.BaseTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution builds and its tests pass through the completeness check before the package publishes with a verified version (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-584 (persistence provider substitution fixed in the generated configuration) is done, then the PostgreSQL and MySQL constant substitutions keep their closing quote, the generated configuration of every provider parses, and the configuration smoke tests of the generated matrix pass for all providers (ADR-0028, docs/architecture/ecosystem-composition.md).",
        "AC3: Given the work of AIFACTORY-TASK-585 (test session timeout audited) is done, then the test session timeout is set so that no suite is truncated, a truncated run fails instead of passing because the suites run through the shared template pipeline, and the finding is closed in the register (ADR-0028).",
        "AC4: Given the work of AIFACTORY-TASK-586 (vulnerable transitive dependencies cleared) is done, then the `Hangfire.Core`, `Pulumi` and `System.ServiceModel.Primitives` paths are cleared at the parent, so that the direct and transitive audit of the authoring and generated projects reports no known vulnerability and a consumer needs no direct reference of its own (ADR-0028).",
        "AC5: Given the work of AIFACTORY-TASK-587 (QueryModel rollout and Scripts sync path for the consuming templates) is done, then the consuming templates receive the QueryModel symbol through a documented migration step and the Scripts folder through a documented sync step with a guard, the Scripts check of the shared template pipeline, that fails their pipeline when they drift; the authorization server, gateway, identity and Tenants templates wire it in their own features, the remaining consumers are listed in the migration note, and the two findings are closed in the register (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-673"
      ],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1006,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-231",
        "AIFACTORY-US-232",
        "AIFACTORY-US-233",
        "AIFACTORY-US-234",
        "AIFACTORY-US-235"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-104]",
      "number": 104
    },
    {
      "id": "AIFACTORY-TASK-673",
      "type": "task",
      "parent": "AIFACTORY-US-104",
      "title": "Verify base-template-findings-delivered by running the declared command",
      "sequence": "18.11.06.01",
      "description": "BEFORE DEVELOPMENT. Verify base-template-findings-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution generated from the published package; they pass with a complete run and prove AC1 to AC5 of AIFACTORY-US-104.. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution generated from the published package; they pass with a complete run and prove AC1 to AC5 of AIFACTORY-US-104."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.BaseTemplate/Docs/Consumer-Reported-Findings.md",
        "ConnectSoft.AI.SoftwareFactory.AgentTemplate/Docs/AgentTemplate-Alignment-Verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 10,
      "phase": "templates-and-libraries",
      "stackRank": 1006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-673]",
      "number": 673
    },
    {
      "id": "AIFACTORY-FEAT-159",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "API gateway template: the platform gateway profile",
      "sequence": "18.12",
      "description": "The fourteen platform gateways and the Studio backend-for-frontend are scaffolded from the API gateway template (ADR-0028, D73): they validate tokens and scopes, route public REST and internal gRPC calls to the services they front, and own no business state. The template is a custom BFF gateway with controllers, use cases and named clients; it has no profile that generates the route table of a platform from the fronts list of the model, no scope validation that refuses a call outside the tenant and project of the token, and no guard against business state. Component: API Gateway template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 12 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-236",
        "AIFACTORY-US-237",
        "AIFACTORY-US-238",
        "AIFACTORY-US-239",
        "AIFACTORY-US-106"
      ],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1200,
      "titlePrefix": "[AIFACTORY-FEAT-159]",
      "number": 159
    },
    {
      "id": "AIFACTORY-US-236",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-159",
      "title": "API gateway template: the `UseFactoryProfile` switch generates named clients and the REST and gRPC routes of a platform from its fronts file",
      "sequence": "18.12.01",
      "description": "As an asset maintainer, I want the gateway template to generate the route table of a platform gateway from the list of services it fronts, so that each of the fourteen platform gateways is scaffolded with its routes and clients and without hand-written forwarding code. ADR-0028 decision 2 re-scopes the fourteen composition hosts as the API gateways of their platforms on the API gateway template: they route public REST and internal gRPC calls to the services they front, and decision 6 puts the list of those services into the model as `deployment.fronts` of the gateway (for example model/services/control-plane/ControlPlaneApi.yaml). The template is a custom gateway with controllers, use cases and named clients and is not a reverse proxy (Docs/TenantPropagation.md of the template), so a route exists today only when a developer writes it. This PBI adds the platform gateway profile and a fronts file to the template. The switch of the profile is the one the amendment of ADR-0028 (D114) decides for every template that has a Factory shape: the boolean `UseFactoryProfile`, off by default so that other generations of the gateway template do not change, and passed by the Factory scaffold command. The file names each fronted service with its base addresses and its operations in the shape of the `apis` section of a service file of the model. A template instantiation cannot read a data file, so the routes are not written when the solution is generated: the generated solution holds a build-time source generator that reads the fronts file on every build, validates it against its schema and emits one named HTTP client and one gRPC client per service, the REST and gRPC routes that forward to them and the route table. A schema violation, a service named twice, a route named twice or an operation without a service fails the build with the entry named, and a test lists the emitted route table against the file. The generated gateway also carries the request count and latency metrics per route that decision 7 leaves with a gateway, a modules endpoint that lists the fronted services, and the health operation every gateway of the model exposes (for example `/factory/health` of the same service file): liveness and readiness with the aggregated health of the fronted services and of the identity authority, answering 503 when a required dependency is down. A forwarded call carries the authorization header, the tenant in `X-Tenant-Id` on REST and in `tenant-id` in gRPC metadata, the project header, the correlation id and the trace context, as the token and header propagation page of the template prescribes. A path that no route matches is answered 404, and a fronted service that does not answer is reported as 503 with a problem response that names the service and never its address. Kind: enabling. Traces: adrs: ADR-0028; requirements: FR-01. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/gateways.yaml, docs/architecture/catalogs/gateways.md, model/template-parameters/connectsoft-apigateway.yaml, model/services/control-plane/ControlPlaneApi.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a fronts file that lists two services with REST operations and gRPC methods, when a gateway is generated with `UseFactoryProfile` and built, then it holds one named HTTP client and one gRPC client per service and one route per operation, a modules endpoint lists the two services, and the health operation answers with the aggregated health of the fronted services and of the identity authority and with 503 when a required dependency is down (ADR-0028 decisions 2 and 6, model/gateways.yaml, model/services/control-plane/ControlPlaneApi.yaml).",
        "AC2: Given a generated platform gateway and a fake fronted service, when a REST call and a gRPC call pass a route, then each is forwarded to the fronted service with the authorization header, the tenant in `X-Tenant-Id` or `tenant-id`, the project header, the correlation id and the trace context, and a request count and a latency measurement are recorded for the route (ADR-0028 decision 7, FR-01).",
        "AC3: Given a fronts file that violates its schema or names a service twice, a route twice or an operation without a service, when the generated solution builds, then the source generator fails the build with the entry named; given a path no route matches, when it is called, then the answer is 404; given a fronted service that does not answer, when its route is called, then the answer is 503 with a problem response naming the service (ADR-0028 decision 7 failure mode of an unavailable fronted service, docs/architecture/catalogs/gateways.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "model/template-parameters/connectsoft-apigateway.yaml",
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1103",
        "AIFACTORY-TASK-588",
        "AIFACTORY-TASK-1104",
        "AIFACTORY-TASK-1105"
      ],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1201,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "model/template-parameters/connectsoft-apigateway.yaml",
        "model/services/control-plane/ControlPlaneApi.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-236]",
      "number": 236
    },
    {
      "id": "AIFACTORY-TASK-1103",
      "type": "task",
      "parent": "AIFACTORY-US-236",
      "title": "UseFactoryProfile symbol of the gateway template and the schema of the fronts file",
      "sequence": "18.12.01.01",
      "description": "BEFORE DEVELOPMENT. UseFactoryProfile symbol of the gateway template and the schema of the fronts file. Expected output: The template configuration holds the boolean `UseFactoryProfile` of the ADR-0028 amendment, off by default and named as in the base, worker and library templates; a JSON schema of the fronts file ships with the template and names service, base addresses and operations with method, path or gRPC method and scope; the template page for the platform profile documents both.. Kind: contract. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet new connectsoft-apigateway --help lists UseFactoryProfile.",
      "acceptanceCriteria": [
        "The template configuration holds the boolean `UseFactoryProfile` of the ADR-0028 amendment, off by default and named as in the base, worker and library templates; a JSON schema of the fronts file ships with the template and names service, base addresses and operations with method, path or gRPC method and scope; the template page for the platform profile documents both."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1201,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1103]",
      "number": 1103
    },
    {
      "id": "AIFACTORY-TASK-588",
      "type": "task",
      "parent": "AIFACTORY-US-236",
      "title": "Platform gateway switch with routes from the fronts list",
      "sequence": "18.12.01.02",
      "description": "BEFORE DEVELOPMENT. Platform gateway switch with routes from the fronts list. Expected output: The `UseFactoryProfile` switch adds to the generated solution a build-time source generator that reads the fronts file listing the services of the platform, validates it against its schema and emits the named clients, the REST and gRPC routes and the route table; a schema violation or a duplicate entry fails the build with the entry named; a test of the generated solution lists the emitted route table against the file; the generated gateway forwards each route with the tenant and project headers, serves the modules endpoint and the health operation with the aggregated health of the fronted services and of the identity authority; the acceptance suite covers one route per protocol.. Kind: implementation. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The `UseFactoryProfile` switch adds to the generated solution a build-time source generator that reads the fronts file listing the services of the platform, validates it against its schema and emits the named clients, the REST and gRPC routes and the route table; a schema violation or a duplicate entry fails the build with the entry named; a test of the generated solution lists the emitted route table against the file; the generated gateway forwards each route with the tenant and project headers, serves the modules endpoint and the health operation with the aggregated health of the fronted services and of the identity authority; the acceptance suite covers one route per protocol."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-588]",
      "number": 588
    },
    {
      "id": "AIFACTORY-TASK-1104",
      "type": "task",
      "parent": "AIFACTORY-US-236",
      "title": "Two fake fronted services for the route tests of the generated gateway",
      "sequence": "18.12.01.03",
      "description": "BEFORE DEVELOPMENT. Two fake fronted services for the route tests of the generated gateway. Expected output: The generated acceptance suite starts two fake fronted services, one REST and one gRPC, that record the headers they receive and can report themselves unhealthy, and holds scenarios for a forwarded call per protocol, an unknown path, a fronted service that is down and the health operation with a healthy and with an unhealthy dependency.. Kind: fixture. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated acceptance suite starts two fake fronted services, one REST and one gRPC, that record the headers they receive and can report themselves unhealthy, and holds scenarios for a forwarded call per protocol, an unknown path, a fronted service that is down and the health operation with a healthy and with an unhealthy dependency."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1201,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1104]",
      "number": 1104
    },
    {
      "id": "AIFACTORY-TASK-1105",
      "type": "task",
      "parent": "AIFACTORY-US-236",
      "title": "Verify the generated routes of a platform gateway",
      "sequence": "18.12.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the generated routes of a platform gateway. Expected output: Generate a gateway with `UseFactoryProfile` and a fronts file of two services, build it in Release and run the route scenarios; forwarding, 404, 503 and the health operation answer as stated, the route table test matches the file and a duplicated entry fails the build, which proves AC1 to AC3 of AIFACTORY-US-236 (ADR-0028).. Kind: verification. Repository: ConnectSoft.ApiGatewayTemplate.",
      "acceptanceCriteria": [
        "Generate a gateway with `UseFactoryProfile` and a fronts file of two services, build it in Release and run the route scenarios; forwarding, 404, 503 and the health operation answer as stated, the route table test matches the file and a duplicated entry fails the build, which proves AC1 to AC3 of AIFACTORY-US-236 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1105]",
      "number": 1105
    },
    {
      "id": "AIFACTORY-US-237",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-159",
      "title": "API gateway template: a platform gateway validates the token and its scope, never forwards a tenant the token does not carry, and refuses a project the token does not grant",
      "sequence": "18.12.02",
      "description": "As an asset maintainer, I want a generated platform gateway to validate every call against the token before it forwards it, so that no call reaches a Factory service with a scope the caller merely claimed. ADR-0028 decision 2 makes the platform gateways validate tokens and scopes, and ADR-0015 decision 2 forbids a scope taken from caller-controlled headers. The identity platform page of the template (Docs/Identity-Platform-Integration.md of the template) lists what a gateway does: validate platform access tokens, reject identity tokens as API credentials, enforce route policies before forwarding, keep an explicit anonymous allowlist, resolve the tenant from the validated token and overwrite or reject tenant headers of the public client. ADR-0028 decision 7 names the resource-server library for that, the gateway files of the model list it, and the template already pins `ConnectSoft.Extensions.ResourceServer` and the SaaS tenancy libraries. The validation of issuer, signature, lifetime and audience and the refusal of an identity token are therefore the registration of the pinned library, and this PBI adds what is specific to a platform gateway under `UseFactoryProfile`: the route scope, tenant and project rules. A user token has one audience, the gateway that fronts its granted scopes (ADR-0015 amendment of D114), so it must be addressed to the resource of this gateway, a token issued for another gateway is refused, and a client that calls two gateways requests two tokens. A workload token carries service scopes, no audience of a user API and no tenant claim; it is admitted only on a route whose operation names an `svc.` scope the token holds, and the tenant and project it forwards are read only under that scope. Each route requires the scope its operation names in the fronts file. The tenant comes from the `tid` claim: a tenant header of the caller is overwritten, and a route that addresses another tenant by identifier is answered 404, over gRPC the status NOT_FOUND, the answer every Factory service gives for a resource outside the tenant of the caller. A route that addresses a project is forwarded only when the token holds a role claim for that project or the tenant-wide Platform admin role; otherwise the answer is 403, as it is for a missing scope. A call without a token, with an expired token or with an identity token is answered 401. When the identity authority cannot be reached and no signing key is cached, the gateway refuses calls and reports the authority in its health. ADR-0015 decision 1 has the Factory inherit the canonical tenant tokens and define none of its own, so the validated tenant travels to the fronted service in `X-Tenant-Id` on REST and in `tenant-id` in gRPC metadata, through the SaaS tenancy libraries the template already uses (Docs/TenantPropagation.md of the template). Only the project header is a Factory name. It is taken from the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package, which holds the scope accessor, the claim type names and the parser of the scoped role value, all delivered by AIFACTORY-US-220 of feature `component-extensions-ai` (AIFACTORY-TASK-186, AIFACTORY-TASK-142, AIFACTORY-TASK-1173); the template copies none of them and waits for no other template. Refusals are counted per route and logged with the correlation id and without the token. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028; requirements: FR-01. Depends on: AIFACTORY-US-236, feature:component-extensions-ai. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, model/gateways.yaml, docs/templates-docs/api-gateway-template.md, docs/reference/schemas/execution-scope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a generated platform gateway configured with the issuer and its own audience, when it receives a call, then the registration of the pinned `ConnectSoft.Extensions.ResourceServer` validates issuer, signature, lifetime and audience; a valid user access token addressed to the resource of this gateway passes; a call without a token, with an expired token, with an identity token or with a user token issued for another gateway is answered 401 and nothing is forwarded; a workload token, which carries no audience of a user API, is admitted only on a route whose operation names an `svc.` scope it holds (ADR-0028 decisions 2 and 7, ADR-0015 decision 6 and its amendment on the one audience of a user token).",
        "AC2: Given a valid token of one tenant, when the caller sends a tenant header with another value, then the header is overwritten with the `tid` claim of the token and forwarded in `X-Tenant-Id` on REST and in `tenant-id` in gRPC metadata through the SaaS tenancy libraries, and when the route addresses another tenant by identifier, then the answer is 404, over gRPC the status NOT_FOUND, and nothing is forwarded (ADR-0015 decisions 1 and 2 and its amendment on a resource of another tenant, D113; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC3: Given a valid token, when the route addresses a project for which the token holds no role claim and the token is not Platform admin, or the token lacks the scope the operation names, then the answer is 403 and nothing is forwarded; when the token grants both, then the call is forwarded with the validated tenant in the canonical tenant header and the project in the project header of the pinned Factory abstractions package (ADR-0015 decisions 3 and 5, FR-01).",
        "AC4: Given the matrix of role, tenant and project of the generated acceptance suite, when it runs, then every combination answers as the three criteria above state, each refusal is counted for its route and logged with the correlation id and without token content, and when the identity authority is unreachable without a cached key the gateway refuses calls and its health reports the authority (ADR-0028 decision 7)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "model/gateways.yaml",
        "docs/templates-docs/api-gateway-template.md",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1106",
        "AIFACTORY-TASK-589",
        "AIFACTORY-TASK-1107",
        "AIFACTORY-TASK-1108"
      ],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1202,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-236",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "model/gateways.yaml",
        "docs/templates-docs/api-gateway-template.md",
        "docs/reference/schemas/execution-scope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-237]",
      "number": 237
    },
    {
      "id": "AIFACTORY-TASK-1106",
      "type": "task",
      "parent": "AIFACTORY-US-237",
      "title": "Issuer, audience and route scope options of the platform profile",
      "sequence": "18.12.02.01",
      "description": "BEFORE DEVELOPMENT. Issuer, audience and route scope options of the platform profile. Expected output: The generated options hold the issuer and the audience of the gateway for the registration of the pinned `ConnectSoft.Extensions.ResourceServer`, validated at startup, and each generated route reads its required scope from the fronts file; the tenant header names are those of the SaaS tenancy libraries the template already pins, the project header name, the claim type names and the parser of the scoped role value are those of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions`, and the template holds no copy of any of them.. Kind: contract. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The generated options hold the issuer and the audience of the gateway for the registration of the pinned `ConnectSoft.Extensions.ResourceServer`, validated at startup, and each generated route reads its required scope from the fronts file; the tenant header names are those of the SaaS tenancy libraries the template already pins, the project header name, the claim type names and the parser of the scoped role value are those of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions`, and the template holds no copy of any of them."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1202,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1106]",
      "number": 1106
    },
    {
      "id": "AIFACTORY-TASK-589",
      "type": "task",
      "parent": "AIFACTORY-US-237",
      "title": "Token and scope validation at the gateway",
      "sequence": "18.12.02.02",
      "description": "BEFORE DEVELOPMENT. Token and scope validation at the gateway. Expected output: The generated gateway validates the token of the authorization server through the pinned resource-server library, overwrites a tenant header of the caller with the `tid` claim, answers 404 for a route that addresses another tenant, refuses a project the token does not grant and a missing scope with 403, admits a workload token only on a route with an `svc.` scope it holds, and forwards the validated tenant in `X-Tenant-Id` or `tenant-id` and the project in the project header to the fronted service; the matrix of role, tenant and project is covered.. Kind: implementation. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated gateway validates the token of the authorization server through the pinned resource-server library, overwrites a tenant header of the caller with the `tid` claim, answers 404 for a route that addresses another tenant, refuses a project the token does not grant and a missing scope with 403, admits a workload token only on a route with an `svc.` scope it holds, and forwards the validated tenant in `X-Tenant-Id` or `tenant-id` and the project in the project header to the fronted service; the matrix of role, tenant and project is covered."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-589]",
      "number": 589
    },
    {
      "id": "AIFACTORY-TASK-1107",
      "type": "task",
      "parent": "AIFACTORY-US-237",
      "title": "Role, tenant and project matrix with a test token issuer",
      "sequence": "18.12.02.03",
      "description": "BEFORE DEVELOPMENT. Role, tenant and project matrix with a test token issuer. Expected output: The generated acceptance suite holds a test issuer that signs tokens with the claim type names and the scoped role value of the pinned Factory abstractions package and a matrix feature over role, tenant, project, scope, audience and workload token with the expected answer of each combination.. Kind: fixture. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated acceptance suite holds a test issuer that signs tokens with the claim type names and the scoped role value of the pinned Factory abstractions package and a matrix feature over role, tenant, project, scope, audience and workload token with the expected answer of each combination."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1202,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1107]",
      "number": 1107
    },
    {
      "id": "AIFACTORY-TASK-1108",
      "type": "task",
      "parent": "AIFACTORY-US-237",
      "title": "Verify token and scope validation on a generated platform gateway",
      "sequence": "18.12.02.04",
      "description": "BEFORE DEVELOPMENT. Verify token and scope validation on a generated platform gateway. Expected output: Generate a platform gateway, build it in Release and run the matrix; every combination answers 200, 401, 403 or 404 as stated and the fake fronted service receives only the validated tenant and project headers, which proves AC1 to AC4 of AIFACTORY-US-237 (ADR-0015, ADR-0028).. Kind: verification. Repository: ConnectSoft.ApiGatewayTemplate.",
      "acceptanceCriteria": [
        "Generate a platform gateway, build it in Release and run the matrix; every combination answers 200, 401, 403 or 404 as stated and the fake fronted service receives only the validated tenant and project headers, which proves AC1 to AC4 of AIFACTORY-US-237 (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1108]",
      "number": 1108
    },
    {
      "id": "AIFACTORY-US-238",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-159",
      "title": "API gateway template: an architecture test keeps a platform gateway free of state and consumers, and holds the backend-for-frontend to one named list of session and view types",
      "sequence": "18.12.03",
      "description": "As an asset maintainer, I want a generated gateway to be kept free of business state by a test that knows the two gateway roles, so that a platform gateway stays a thin route and the Studio backend-for-frontend holds its session state and nothing else. ADR-0028 decision 2 states that a platform gateway owns no business state, decision 7 leaves it the shared cache as its only store with the tenancy, resource-server, rate-limiting and observability libraries, and the amendment on gateways and events states that a platform gateway consumes no events and is never listed as a consumer. A revisit trigger of the decision is a gateway that accumulates logic beyond routing and validation. The same template scaffolds the Studio backend-for-frontend, and the model shows that it is a different case: model/services/factory-studio/StudioBff.yaml has the role `bff`, a primary relational store with the tables `StudioSessions` and `SavedViews`, the NHibernate persistence library and the messaging model library, two aggregates of session state with their commands and events, and a long list of consumed events whose handlers refresh a view. The amendment of ADR-0028 on consumers names the Studio backend-for-frontend as the consumer that refreshes the view of the aggregate. The template can generate a persistence model, an actor model and a messaging model, because it composes on the base template (`PersistenceModelType`, `ActorModelType` and `MessagingModelType` in model/template-parameters/connectsoft-apigateway.yaml). This PBI therefore defines the two cases explicitly. Under `UseFactoryProfile` the choice `GatewayRole` has the values Platform and BackendForFrontend, after the roles `platform-gateway` and `bff` of the model. For the Platform role the template fixes `PersistenceModelType`, `MessagingModelType` and `ActorModelType` to None and migrations to off, and an architecture test of the generated solution fails when an aggregate, a persistence mapping, a migration or a message consumer is present, naming the offending type. For the BackendForFrontend role the template admits NHibernate persistence, the migrations of its session and view tables and the message handlers that refresh a view, all behind one named exemption: a single file that lists each admitted type with a reason. The test still fails there on any aggregate, mapping, migration, published event or handler the list does not name, on a listed handler that writes through a repository of a type outside the list, and on a second exemption or an entry without a reason. The exemption is checked by negative controls, in the way the findings page of the authorization server template describes its own narrow exemptions. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-236. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/gateways.yaml, docs/architecture/catalogs/gateways.md, model/template-parameters/connectsoft-apigateway.yaml, model/services/factory-studio/StudioBff.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a gateway generated with `UseFactoryProfile` and the role Platform, when its architecture tests run, then they pass on the generated solution and fail with the offending type named when an aggregate, a persistence mapping or a migration is planted; a generation of that role with a value other than None for `PersistenceModelType`, `MessagingModelType` or `ActorModelType` is refused with the symbol named (ADR-0028 decisions 2 and 7, model/gateways.yaml).",
        "AC2: Given the same gateway, when a message consumer, an inbox registration or an outbox registration is planted, then the architecture test fails and names it, and the generated solution holds no messaging registration (ADR-0028 amendment on gateways that consume no events, model/template-parameters/connectsoft-apigateway.yaml).",
        "AC3: Given a gateway generated with the role BackendForFrontend and the named exemption that lists its session and view types, when its architecture tests run, then they pass with NHibernate persistence, the migrations of the listed tables and the message handlers that refresh a listed view present; they fail when an aggregate, a mapping, a migration, a published event or a handler outside the list is planted, when a listed handler writes through a repository of a type outside the list, and when a second exemption or an entry without a reason is added (ADR-0028 decision 2 on the Studio backend-for-frontend, model/services/factory-studio/StudioBff.yaml, docs/architecture/catalogs/gateways.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "model/template-parameters/connectsoft-apigateway.yaml",
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1109",
        "AIFACTORY-TASK-590",
        "AIFACTORY-TASK-1110",
        "AIFACTORY-TASK-1111"
      ],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1203,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-236"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "docs/architecture/catalogs/gateways.md",
        "model/template-parameters/connectsoft-apigateway.yaml",
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-238]",
      "number": 238
    },
    {
      "id": "AIFACTORY-TASK-1109",
      "type": "task",
      "parent": "AIFACTORY-US-238",
      "title": "GatewayRole choice with the persistence, messaging and actor choices fixed for the Platform role",
      "sequence": "18.12.03.01",
      "description": "BEFORE DEVELOPMENT. GatewayRole choice with the persistence, messaging and actor choices fixed for the Platform role. Expected output: With `UseFactoryProfile` the template configuration holds the choice `GatewayRole` with the values Platform, the default, and BackendForFrontend; for Platform it fixes `PersistenceModelType`, `MessagingModelType` and `ActorModelType` to None and migrations to off and rejects a generation that asks for another value with a message naming the symbol; for BackendForFrontend it admits NHibernate persistence, migrations and a messaging model and generates the exemption file with its schema; the template page for the platform profile documents the two roles.. Kind: contract. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet new connectsoft-apigateway with the Platform role and a persistence value is refused | dotnet new connectsoft-apigateway with the BackendForFrontend role and NHibernate generates.",
      "acceptanceCriteria": [
        "With `UseFactoryProfile` the template configuration holds the choice `GatewayRole` with the values Platform, the default, and BackendForFrontend; for Platform it fixes `PersistenceModelType`, `MessagingModelType` and `ActorModelType` to None and migrations to off and rejects a generation that asks for another value with a message naming the symbol; for BackendForFrontend it admits NHibernate persistence, migrations and a messaging model and generates the exemption file with its schema; the template page for the platform profile documents the two roles."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1203,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1109]",
      "number": 1109
    },
    {
      "id": "AIFACTORY-TASK-590",
      "type": "task",
      "parent": "AIFACTORY-US-238",
      "title": "No business state in a gateway",
      "sequence": "18.12.03.02",
      "description": "BEFORE DEVELOPMENT. No business state in a gateway. Expected output: An architecture test of the generated gateway fails for the Platform role when a persistence model, an aggregate, a migration or a message consumer is present; the Studio backend-for-frontend keeps its session and view state through an explicit override of the test, one named exemption file that lists each admitted aggregate, mapping, migration, published event and handler with a reason, and the test fails there on any type outside the list, on a listed handler that writes outside the list and on a second exemption.. Kind: implementation. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An architecture test of the generated gateway fails for the Platform role when a persistence model, an aggregate, a migration or a message consumer is present; the Studio backend-for-frontend keeps its session and view state through an explicit override of the test, one named exemption file that lists each admitted aggregate, mapping, migration, published event and handler with a reason, and the test fails there on any type outside the list, on a listed handler that writes outside the list and on a second exemption."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-590]",
      "number": 590
    },
    {
      "id": "AIFACTORY-TASK-1110",
      "type": "task",
      "parent": "AIFACTORY-US-238",
      "title": "Planted violations of both roles and the negative controls of the exemption",
      "sequence": "18.12.03.03",
      "description": "BEFORE DEVELOPMENT. Planted violations of both roles and the negative controls of the exemption. Expected output: Test fixtures plant, for the Platform role, an aggregate, a mapping, a migration, a consumer and an outbox registration one at a time and assert the named failure; for the BackendForFrontend role they plant an aggregate, a migration, a published event and a handler outside the list, a listed handler that writes through a foreign repository, a second exemption and an entry without a reason, and assert that the test fails on each.. Kind: fixture. Repository: ConnectSoft.ApiGatewayTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Test fixtures plant, for the Platform role, an aggregate, a mapping, a migration, a consumer and an outbox registration one at a time and assert the named failure; for the BackendForFrontend role they plant an aggregate, a migration, a published event and a handler outside the list, a listed handler that writes through a foreign repository, a second exemption and an entry without a reason, and assert that the test fails on each."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1203,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1110]",
      "number": 1110
    },
    {
      "id": "AIFACTORY-TASK-1111",
      "type": "task",
      "parent": "AIFACTORY-US-238",
      "title": "Verify the guard on a platform gateway and on the backend-for-frontend case",
      "sequence": "18.12.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the guard on a platform gateway and on the backend-for-frontend case. Expected output: Generate the Platform case and the BackendForFrontend case, run their architecture tests clean and with each planted violation; clean runs pass and planted runs fail with the type named, which proves AC1 to AC3 of AIFACTORY-US-238 (ADR-0028).. Kind: verification. Repository: ConnectSoft.ApiGatewayTemplate.",
      "acceptanceCriteria": [
        "Generate the Platform case and the BackendForFrontend case, run their architecture tests clean and with each planted violation; clean runs pass and planted runs fail with the type named, which proves AC1 to AC3 of AIFACTORY-US-238 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1111]",
      "number": 1111
    },
    {
      "id": "AIFACTORY-US-239",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-159",
      "title": "API gateway template: the platform gateway and backend-for-frontend cases are packed, installed, generated, built and tested by the shared template pipeline before the package publishes",
      "sequence": "18.12.04",
      "description": "As an asset maintainer, I want the platform gateway profile to be a gated case of the template pipeline, so that the fourteen platform gateways and the Studio backend-for-frontend are scaffolded only from a package whose generated gateway builds and passes. The estate gates its templates with the shared template pipeline of ConnectSoft.AzurePipelines (`template-ci/v1`), whose rollout ledger lists the gateway template as pending. The gateway template composes on the base template through its `base-template` submodule and keeps a package snapshot in `build/MaterializedDirectory.Packages.props`. This PBI is the proof of the feature and moves the template onto that mechanism. The submodule pointer moves to the base template state the findings feature publishes, and the package snapshot is refreshed from it. A `build/template-ci.json` manifest keeps the default generation of the template gated as today and declares two Factory cases: a platform gateway generated with `UseFactoryProfile`, the role Platform and a fronts file of two services under the name of a Factory gateway repository, and a backend-for-frontend case generated with `UseFactoryProfile`, the role BackendForFrontend, NHibernate persistence and its named exemption, with SQL Server as its required service. The amendment of ADR-0028 (D114) admits one additional gating case per declared profile, so the manifest declares the two gateway roles as two profiles and each case is the one additional gating case of its profile. The admission in the shared tooling is AIFACTORY-TASK-1464 of the feature `component-base-template-factory-profile`, on which this PBI depends. The template pipeline imports the shared installer jobs: the candidate is packed once and installed, each case is generated, restored and built in Release, its route, token and scope and architecture tests run with the discovery and completion checks, and the dependency audit runs on it. The Scripts check of the shared tooling runs in check mode and keeps the root Scripts folder in step with the Scripts folder of the base-template submodule. A case that fails any stage fails the run with the case and the stage named, and publication is not reached. Publication requires the complete reports of both cases bound to the candidate and pushes a version that is not yet on the ConnectSoft feed. The PBI proves decision 2 of ADR-0028 for the template and the release gate of FR-11, and it ends with the template inventory of this repository listing the new symbols. Kind: evidence. Traces: adrs: ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-236, AIFACTORY-US-237, AIFACTORY-US-238, feature:component-base-template-findings, feature:component-base-template-factory-profile. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/gateways.yaml, model/template-parameters/connectsoft-apigateway.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a change of the gateway template, when the template pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the default case runs as today, the platform gateway case with a fronts file of two services and the backend-for-frontend case, each the one additional gating case of its declared profile, are generated, restored and built in Release, their tests run with the discovery and completion checks, the dependency audit runs on each, and the Scripts check passes in check mode (ADR-0028 decision 2 and its amendment on the Factory profile switch, FR-11).",
        "AC2: Given a case that fails any stage, when the pipeline evaluates the run, then the run fails with the case and the stage named and publication is not reached; a planted failing route test proves the refusal (FR-11, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC3: Given complete reports of both cases bound to the candidate hash, when the publication job runs, then the package is pushed with a version that was not on the feed, a fresh install of that version generates a platform gateway that builds unchanged, and model/template-parameters/connectsoft-apigateway.yaml lists `UseFactoryProfile` and `GatewayRole` after the next template inventory (ADR-0028, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "model/template-parameters/connectsoft-apigateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1169",
        "AIFACTORY-TASK-1112",
        "AIFACTORY-TASK-1170",
        "AIFACTORY-TASK-1113",
        "AIFACTORY-TASK-1114"
      ],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1204,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-236",
        "AIFACTORY-US-237",
        "AIFACTORY-US-238",
        "feature:component-base-template-findings",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "model/template-parameters/connectsoft-apigateway.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-239]",
      "number": 239
    },
    {
      "id": "AIFACTORY-TASK-1169",
      "type": "task",
      "parent": "AIFACTORY-US-239",
      "title": "Base-template submodule pointer moved and the package snapshot refreshed",
      "sequence": "18.12.04.01",
      "description": "BEFORE DEVELOPMENT. Base-template submodule pointer moved and the package snapshot refreshed. Expected output: The `base-template` submodule of the gateway template points at the base template state the feature component-base-template-findings publishes, `build/MaterializedDirectory.Packages.props` is regenerated from it, and the snapshot check of the shared tooling passes; no file inside the submodule is edited.. Kind: operations. Repository: ConnectSoft.ApiGatewayTemplate. Verification: the snapshot check passes and the authoring solution builds in Release.",
      "acceptanceCriteria": [
        "The `base-template` submodule of the gateway template points at the base template state the feature component-base-template-findings publishes, `build/MaterializedDirectory.Packages.props` is regenerated from it, and the snapshot check of the shared tooling passes; no file inside the submodule is edited."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1204,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1169]",
      "number": 1169
    },
    {
      "id": "AIFACTORY-TASK-1112",
      "type": "task",
      "parent": "AIFACTORY-US-239",
      "title": "Template pipeline manifest with the platform gateway and backend-for-frontend cases",
      "sequence": "18.12.04.02",
      "description": "BEFORE DEVELOPMENT. Template pipeline manifest with the platform gateway and backend-for-frontend cases. Expected output: `build/template-ci.json` of the gateway template declares the package, the solutions, the tests, the default case and the two declared profiles with one additional gating case each, the platform gateway case with a fronts file of two services and the backend-for-frontend case with its exemption file and SQL Server as required service, each with its test filter; `azure-pipelines-template.yml` imports `template-ci/v1/installer-jobs.yml` of the shared tooling and holds no stage of its own for generation, tests or audit.. Kind: operations. Repository: ConnectSoft.ApiGatewayTemplate. Verification: azure-pipelines-template.yml runs both cases through the shared installer jobs and the run is green.",
      "acceptanceCriteria": [
        "`build/template-ci.json` of the gateway template declares the package, the solutions, the tests, the default case and the two declared profiles with one additional gating case each, the platform gateway case with a fronts file of two services and the backend-for-frontend case with its exemption file and SQL Server as required service, each with its test filter; `azure-pipelines-template.yml` imports `template-ci/v1/installer-jobs.yml` of the shared tooling and holds no stage of its own for generation, tests or audit."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1204,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1112]",
      "number": 1112
    },
    {
      "id": "AIFACTORY-TASK-1170",
      "type": "task",
      "parent": "AIFACTORY-US-239",
      "title": "Scripts check of the gateway template in check mode",
      "sequence": "18.12.04.03",
      "description": "BEFORE DEVELOPMENT. Scripts check of the gateway template in check mode. Expected output: The manifest of the gateway template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside the package snapshot check and fails with the missing and the changed files named.. Kind: operations. Repository: ConnectSoft.ApiGatewayTemplate. Verification: the pipeline runs the Scripts check and a removed file fails it.",
      "acceptanceCriteria": [
        "The manifest of the gateway template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside the package snapshot check and fails with the missing and the changed files named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1204,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1170]",
      "number": 1170
    },
    {
      "id": "AIFACTORY-TASK-1113",
      "type": "task",
      "parent": "AIFACTORY-US-239",
      "title": "Planted failing route test and publication on complete reports",
      "sequence": "18.12.04.04",
      "description": "BEFORE DEVELOPMENT. Planted failing route test and publication on complete reports. Expected output: A pipeline fixture plants a failing route test in the platform gateway case and asserts that the run fails with the case named; publication requires the complete reports of both cases bound to the candidate hash and refuses a version that is already on the feed.. Kind: fixture. Repository: ConnectSoft.ApiGatewayTemplate. Verification: the planted run stops before publication.",
      "acceptanceCriteria": [
        "A pipeline fixture plants a failing route test in the platform gateway case and asserts that the run fails with the case named; publication requires the complete reports of both cases bound to the candidate hash and refuses a version that is already on the feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1204,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1113]",
      "number": 1113
    },
    {
      "id": "AIFACTORY-TASK-1114",
      "type": "task",
      "parent": "AIFACTORY-US-239",
      "title": "Verify the gate of the gateway template on a green and a planted run",
      "sequence": "18.12.04.05",
      "description": "BEFORE DEVELOPMENT. Verify the gate of the gateway template on a green and a planted run. Expected output: One green run reaches publication and a fresh install of the published version generates a platform gateway that builds unchanged; the planted run fails before publication; both prove AC1 to AC3 of AIFACTORY-US-239 (ADR-0028, FR-11).. Kind: verification. Repository: ConnectSoft.ApiGatewayTemplate.",
      "acceptanceCriteria": [
        "One green run reaches publication and a fresh install of the published version generates a platform gateway that builds unchanged; the planted run fails before publication; both prove AC1 to AC3 of AIFACTORY-US-239 (ADR-0028, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1114]",
      "number": 1114
    },
    {
      "id": "AIFACTORY-US-106",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-159",
      "title": "API gateway template: the platform gateway profile is delivered and proven on a generated solution",
      "sequence": "18.12.05",
      "description": "As an asset maintainer, I want API Gateway to carry the platform gateway profile, so that it serves GW-01 edge ingress, GW-02 Studio BFF, GW-07 product gateways, the 14 platform gateways (ADR-0028) without later rework. This is the integration PBI of the feature. The fourteen platform gateways and the Studio backend-for-frontend are scaffolded from the API gateway template; they validate tokens and scopes and route public REST and internal gRPC calls to the services they front, a platform gateway owns no business state, and the backend-for-frontend holds its session and view state and nothing else. With the routes generated from the fronts file, the token and scope validation with its 401, 403 and 404 answers, the guard for the two gateway roles and the two gated cases in the shared template pipeline, the asset maintainer runs the pipeline end to end: pack, install, generate both cases, build, test and audit, then publish. A case that fails any stage blocks publication. The migrated implementation tasks sit under the PBIs that deliver them, and the verification task of this PBI is the proof on the published package. The feature is done when a gateway generated from the published package with the platform profile builds and passes unchanged and the template inventory of this repository lists the new symbols. Kind: enabling. Traces: adrs: ADR-0015, ADR-0028. Depends on: AIFACTORY-US-236, AIFACTORY-US-237, AIFACTORY-US-238, AIFACTORY-US-239. Sources: model/components.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/gateways.yaml, model/services/factory-studio/StudioBff.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.ApiGatewayTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution 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-588 (platform gateway switch with routes from the fronts list) is done, then the `UseFactoryProfile` switch generates the named clients and the REST and gRPC routes from a fronts file that lists the services of the platform, the generated gateway forwards each route with the tenant and project headers, and the acceptance suite covers one route per protocol (ADR-0028 decision 2, model/gateways.yaml).",
        "AC3: Given the work of AIFACTORY-TASK-589 (token and scope validation at the gateway) is done, then the generated gateway validates the token of the authorization server, answers 404 for a route that addresses another tenant and 403 for a project or a scope the token does not grant, and forwards the validated scope to the fronted service, and the matrix of role, tenant and project is covered (ADR-0015).",
        "AC4: Given the work of AIFACTORY-TASK-590 (no business state in a gateway) is done, then an architecture test of a gateway generated with the Platform role fails when a persistence model, an aggregate, a migration or a message consumer is present, and the Studio backend-for-frontend keeps its session and view state through an explicit override of the test, one named exemption that lists each admitted type, outside which the test still fails (ADR-0028 decision 2, model/services/factory-studio/StudioBff.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-668",
        "AIFACTORY-TASK-1115"
      ],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1205,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-236",
        "AIFACTORY-US-237",
        "AIFACTORY-US-238",
        "AIFACTORY-US-239"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml",
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-106]",
      "number": 106
    },
    {
      "id": "AIFACTORY-TASK-668",
      "type": "task",
      "parent": "AIFACTORY-US-106",
      "title": "Verify api-gateway-template-delivered by running the declared command",
      "sequence": "18.12.05.01",
      "description": "BEFORE DEVELOPMENT. Verify api-gateway-template-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the gateway generated from the published package with the platform profile; they pass and prove AC1 to AC4 of AIFACTORY-US-106.. Kind: verification. Repository: ConnectSoft.ApiGatewayTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the gateway generated from the published package with the platform profile; they pass and prove AC1 to AC4 of AIFACTORY-US-106."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiGatewayTemplate"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-668]",
      "number": 668
    },
    {
      "id": "AIFACTORY-TASK-1115",
      "type": "task",
      "parent": "AIFACTORY-US-106",
      "title": "Template inventory of this repository records the UseFactoryProfile switch and the GatewayRole choice",
      "sequence": "18.12.05.02",
      "description": "BEFORE DEVELOPMENT. Template inventory of this repository records the UseFactoryProfile switch and the GatewayRole choice. Expected output: After `python -I tools/docs_model inventory-templates`, model/template-parameters/connectsoft-apigateway.yaml lists `UseFactoryProfile` and `GatewayRole` with its two values, and the generated row of docs/architecture/catalogs/templates.md still renders.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model inventory-templates | python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "After `python -I tools/docs_model inventory-templates`, model/template-parameters/connectsoft-apigateway.yaml lists `UseFactoryProfile` and `GatewayRole` with its two values, and the generated row of docs/architecture/catalogs/templates.md still renders."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/gateways.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 12,
      "phase": "templates-and-libraries",
      "stackRank": 1205,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1115]",
      "number": 1115
    },
    {
      "id": "AIFACTORY-FEAT-161",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Identity template: the Factory role model with per-project assignments and delegation records",
      "sequence": "18.13",
      "description": "The Identity microservice owns accounts, credentials, MFA, memberships and roles for the Factory (D18, canonical ADR-0101), and the Authorization Server issues the seven Factory roles as claims from what Identity holds (ADR-0015). The Identity template carries today a flat user, role and claim model: a role is not bound to a project, Platform admin is not a tenant-wide role, and there is no record of a delegation with grantor, grantee, scope, expiry and reason. The template's own findings page records that the multi-valued claims contract (ServiceModel 1.1.x) is promoted and consumed, so repeating role claims can travel; what is missing is the model behind them. Component: Identity microservice (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 13 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-240",
        "AIFACTORY-US-241",
        "AIFACTORY-US-242",
        "AIFACTORY-US-243",
        "AIFACTORY-US-107"
      ],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1300,
      "titlePrefix": "[AIFACTORY-FEAT-161]",
      "number": 161
    },
    {
      "id": "AIFACTORY-US-240",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-161",
      "title": "Identity template: a role assignment binds a member, a role of the seeded catalogue and a project or tenant scope, and the claims API returns one role claim per assignment",
      "sequence": "18.13.01",
      "description": "As an asset maintainer, I want the identity service to hold the seven Factory roles as assignments with a scope, so that the authorization server can issue project-scoped role claims from what the identity service holds. ADR-0015 decision 5 defines seven roles and where each is assigned: Requester, Reviewer, Asset maintainer, Operator and Workspace admin per project, Platform admin for the tenant, Observer for a project or the tenant; decision 6 keeps membership itself per tenant in the identity service and has the roles issued as claims by the authorization server. The identity service is the system of record of role assignments and delegations (D18, amendment of ADR-0015 under D114): ProjectService of the Factory writes its membership commands through the API of this PBI and keeps a projection that it updates from the events this PBI raises, as the invariant of model/services/control-plane/ProjectService.yaml states, so no second writable copy of an assignment exists. The identity template carries a flat user, role and claim model in which a role has no scope. Its findings page records that claims now travel as a list of type and value pairs on the read and bulk-write contracts (the ServiceModel 1.1 stream), so a subject can hold several values of one claim type; what is missing is the model behind them. This PBI adds the role assignment: member, role, scope kind (project or tenant) and scope identifier, with who granted it and when. The template also serves generated products with roles of their own, so the role catalogue is data and the template holds no Factory role name in code: role name, allowed scope kinds, the roles a role covers and whether it may manage assignments are read from a role registration file, which the Factory seeds with its seven roles, and the assignment rules are evaluated against that catalogue. The project identifier is opaque to the identity service: it is stored and returned and never resolved. The service refuses a role the catalogue does not hold, a scope kind the catalogue does not allow for the role (in the Factory catalogue Platform admin with a project scope and a project role other than Observer with a tenant scope), an assignment for a subject who is not a member of the tenant, and a second identical assignment. The grant and the removal are written by a workload on behalf of a member (amendment of ADR-0015 on role writes, D115): the caller presents a workload token that holds the service scope of the write and names the acting member in the request, which is how ProjectService calls them with its own workload token; the user token of the member is not forwarded, because a user token has one audience. The identity service never trusts a role stated by the caller. It checks from its own records that the named actor holds a role that may manage assignments in that scope, in the Factory catalogue Workspace admin of the project or Platform admin of the tenant, and records the actor as grantor together with the workload that wrote. A write whose caller lacks the service scope, that names no actor, or whose actor lacks such a role by the records of the identity service is answered 403, and an assignment addressed by an identifier outside the tenant the request is made for is answered 404. A fresh tenant has no holder of such a role, so the first assignment is a bootstrap and the only write without an actor: a workload caller with the `svc.` scope of the internal API assigns the first Platform admin when a tenant is provisioned and is recorded as grantor; the first Workspace admin of a project is then assigned through the ordinary grant with that Platform admin named as actor. The internal claims API that the authorization server calls returns one role claim per assignment. Its claim type name and the value that carries the scope are written with the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package, which holds the claim type names, the role names and the formatter and parser of the scoped role value (AIFACTORY-TASK-1173 of AIFACTORY-US-220 in feature `component-extensions-ai`), so that the authorization server, base and gateway templates pin the same names and none types them again. Each grant and removal raises an integration event, from which ProjectService updates its projection, and is kept for audit with the actor as grantor, the workload that wrote it and the time. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015; requirements: FR-01. Depends on: feature:component-extensions-ai. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0008-openiddict-identity.md, docs/architecture/ecosystem-composition.md, docs/templates-docs/identity-backend-template.md, model/services/control-plane/ProjectService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a member of a tenant and the role catalogue seeded with the seven Factory roles, when a workload caller that holds the service scope of the write assigns the member one of the five project roles for a project and names as actor a member whom the records of the identity service hold as Workspace admin of that project, then the assignment is stored with member, role, project scope, the actor as grantor, the workload that wrote it and time, the project identifier is stored as an opaque value, and the internal claims API returns one role claim per assignment of the member, written with the formatter of the pinned Factory abstractions package (ADR-0015 decisions 5 and 6 and its amendment on role writes, D115, ADR-0008).",
        "AC2: Given the assignment rules evaluated against the role catalogue, when a role the catalogue does not hold is assigned, Platform admin is assigned with a project scope, a project role other than Observer is assigned with a tenant scope, the subject is not a member of the tenant or the same assignment exists, then each request is refused with a validation or conflict answer that names the rule and nothing is stored; Observer is accepted with either scope; and a search of the template code finds no Factory role name outside the seeded registration file (ADR-0015 decision 5).",
        "AC3: Given a workload caller that holds the service scope of the write, when it grants or removes an assignment and names an actor who by the records of the identity service is neither Workspace admin of the project nor Platform admin of the tenant, or names no actor, then the answer is 403 and nothing is stored or removed, whatever role the request states for the actor, and the same write from a caller without the service scope is answered 403; given an assignment identifier of another tenant, when a request made for the first tenant reads or removes it, then the answer is 404 (ADR-0015 decision 3, its amendment on a resource of another tenant, D113, and its amendment on role writes, D115; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC4: Given a grant or a removal, when it commits in the identity service, the system of record of role assignments, then an integration event naming member, role, scope and grantor is published, from which ProjectService updates its projection as model/services/control-plane/ProjectService.yaml states, the audit record of the change names the actor as grantor, the workload that wrote it and the time, and a removed assignment no longer appears in the claims of the member (ADR-0015 decision 6 and its amendment on the system of record, FR-01).",
        "AC5: Given a tenant that was just provisioned and has no role holder, when a workload caller with the `svc.` scope of the internal API assigns the first Platform admin, then the assignment is stored with the workload as grantor, and the same call without that scope or for a tenant that already has a Platform admin through the bootstrap is refused; when a workload caller that holds the service scope of the write then names that Platform admin as actor and assigns the first Workspace admin of a project, then the assignment is stored with the Platform admin as grantor and the workload that wrote it (ADR-0015 decisions 5 and 6, FR-01)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/ecosystem-composition.md",
        "docs/templates-docs/identity-backend-template.md",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1116",
        "AIFACTORY-TASK-594",
        "AIFACTORY-TASK-1117",
        "AIFACTORY-TASK-1172",
        "AIFACTORY-TASK-1118"
      ],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1301,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/ecosystem-composition.md",
        "docs/templates-docs/identity-backend-template.md",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-240]",
      "number": 240
    },
    {
      "id": "AIFACTORY-TASK-1116",
      "type": "task",
      "parent": "AIFACTORY-US-240",
      "title": "Role assignment contract with scope kinds and the schema of the role registration file",
      "sequence": "18.13.01.01",
      "description": "BEFORE DEVELOPMENT. Role assignment contract with scope kinds and the schema of the role registration file. Expected output: The service contract of the template holds the role assignment requests and responses with member, role, scope kind and opaque scope identifier, the acting member on the grant and the removal request, the bootstrap request, which names no actor, and the two assignment events; the schema of the role registration file names per role its allowed scope kinds, the roles it covers and whether it may manage assignments; the Factory catalogue with the seven roles is a seeded file and the template code holds no Factory role name; the role claim value is written with the formatter of the pinned Factory abstractions package.. Kind: contract. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The service contract of the template holds the role assignment requests and responses with member, role, scope kind and opaque scope identifier, the acting member on the grant and the removal request, the bootstrap request, which names no actor, and the two assignment events; the schema of the role registration file names per role its allowed scope kinds, the roles it covers and whether it may manage assignments; the Factory catalogue with the seven roles is a seeded file and the template code holds no Factory role name; the role claim value is written with the formatter of the pinned Factory abstractions package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1301,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1116]",
      "number": 1116
    },
    {
      "id": "AIFACTORY-TASK-594",
      "type": "task",
      "parent": "AIFACTORY-US-240",
      "title": "Per-project role assignments for the seven Factory roles",
      "sequence": "18.13.01.02",
      "description": "BEFORE DEVELOPMENT. Per-project role assignments for the seven Factory roles. Expected output: A role assignment binds a member, a role of the catalogue and a project scope; Platform admin is the only assignment with tenant scope and Observer may hold either, as the seeded catalogue states; membership stays per tenant; the internal claims API returns one repeating role claim per project assignment so the Authorization Server can issue them; the grant and the removal accept a workload caller that holds the service scope of the write and names an actor, check from the records of the identity service that the actor holds a role of the catalogue that may manage assignments in that scope, answer 403 without the scope, without an actor or for an actor that lacks such a role, whatever role the request states, and record the actor as grantor with the workload that wrote.. Kind: implementation. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A role assignment binds a member, a role of the catalogue and a project scope; Platform admin is the only assignment with tenant scope and Observer may hold either, as the seeded catalogue states; membership stays per tenant; the internal claims API returns one repeating role claim per project assignment so the Authorization Server can issue them; the grant and the removal accept a workload caller that holds the service scope of the write and names an actor, check from the records of the identity service that the actor holds a role of the catalogue that may manage assignments in that scope, answer 403 without the scope, without an actor or for an actor that lacks such a role, whatever role the request states, and record the actor as grantor with the workload that wrote."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-594]",
      "number": 594
    },
    {
      "id": "AIFACTORY-TASK-1117",
      "type": "task",
      "parent": "AIFACTORY-US-240",
      "title": "Role assignment table and its migration",
      "sequence": "18.13.01.03",
      "description": "BEFORE DEVELOPMENT. Role assignment table and its migration. Expected output: A migration adds the role assignment table with member, role, scope kind, scope identifier, tenant, grantor, the workload that wrote it and time, a unique index over member, role and scope, and the tenant filter in its mapping; the mapping test of the template covers it.. Kind: migration. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration adds the role assignment table with member, role, scope kind, scope identifier, tenant, grantor, the workload that wrote it and time, a unique index over member, role and scope, and the tenant filter in its mapping; the mapping test of the template covers it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1301,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1117]",
      "number": 1117
    },
    {
      "id": "AIFACTORY-TASK-1172",
      "type": "task",
      "parent": "AIFACTORY-US-240",
      "title": "Bootstrap of the first Platform admin and the first Workspace admin",
      "sequence": "18.13.01.04",
      "description": "BEFORE DEVELOPMENT. Bootstrap of the first Platform admin and the first Workspace admin. Expected output: The internal API holds a bootstrap operation, open only to a workload token with its `svc.` scope, that assigns the first Platform admin of a provisioned tenant once and records the workload as grantor; it is the only write that names no actor, and the first Workspace admin of a project is assigned through the ordinary grant with that Platform admin named as actor; a second bootstrap for the same tenant and a bootstrap without the scope are refused.. Kind: implementation. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The internal API holds a bootstrap operation, open only to a workload token with its `svc.` scope, that assigns the first Platform admin of a provisioned tenant once and records the workload as grantor; it is the only write that names no actor, and the first Workspace admin of a project is assigned through the ordinary grant with that Platform admin named as actor; a second bootstrap for the same tenant and a bootstrap without the scope are refused."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1172]",
      "number": 1172
    },
    {
      "id": "AIFACTORY-TASK-1118",
      "type": "task",
      "parent": "AIFACTORY-US-240",
      "title": "Verify role assignments and their claims on the generated identity service",
      "sequence": "18.13.01.05",
      "description": "BEFORE DEVELOPMENT. Verify role assignments and their claims on the generated identity service. Expected output: Run the acceptance scenarios for the bootstrap, grant, refusal, removal and claims on the generated solution with the seeded Factory catalogue, every grant and removal written by a workload caller that names the actor; the rules of the seven roles hold, the 403 cases (a caller without the service scope, a write without an actor, an actor without the role by the records of the identity service although the request states one) and the 404 case answer as stated, and the audit record names the actor and the workload, which proves AC1 to AC5 of AIFACTORY-US-240 (ADR-0015).. Kind: verification. Repository: ConnectSoft.IdentityTemplate.",
      "acceptanceCriteria": [
        "Run the acceptance scenarios for the bootstrap, grant, refusal, removal and claims on the generated solution with the seeded Factory catalogue, every grant and removal written by a workload caller that names the actor; the rules of the seven roles hold, the 403 cases (a caller without the service scope, a write without an actor, an actor without the role by the records of the identity service although the request states one) and the 404 case answer as stated, and the audit record names the actor and the workload, which proves AC1 to AC5 of AIFACTORY-US-240 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1118]",
      "number": 1118
    },
    {
      "id": "AIFACTORY-US-241",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-161",
      "title": "Identity template: a delegation records grantor, grantee, role, scope, expiry and reason, is revocable, expires on its own and appears in claims only while valid",
      "sequence": "18.13.02",
      "description": "As an asset maintainer, I want the identity service to record a delegation of a role with a bounded validity, so that a role holder can hand a role to another member for a period and every such hand-over is recorded and ends without anyone acting. ADR-0015 decision 6 allows a role holder to delegate the same or a lesser role to another member for a bounded period; every delegation is recorded with grantor, grantee, scope, expiry and reason, is revocable at any time and expires automatically. The identity template has no such record. This PBI adds the delegation beside the role assignment. The amendment of ADR-0015 (D114) decides the order that makes a role lesser, and the role catalogue holds it as data: Observer is below every role; Requester, Reviewer, Asset maintainer and Operator are not comparable with each other and each is below Workspace admin; every role is below Platform admin. The same amendment makes the identity service the system of record of delegations: the delegation commands of ProjectService write through the API of this PBI, and ProjectService keeps a projection that it updates from the grant, revocation and expiry events, as the invariant of model/services/control-plane/ProjectService.yaml states. The grant and the revocation are written by a workload on behalf of a member (amendment of ADR-0015 on role writes, D115): ProjectService calls them with its own workload token, which holds the service scope of the write, and names the acting member in the request; the user token of the member is not forwarded, and the identity service never trusts a role stated by the caller. A holder may delegate the same role or a lesser one in the scope of its own assignment, where a tenant-scope assignment includes the projects of the tenant. The named actor of a grant is the grantor, and the check that the grantor holds the role runs against the records of the identity service for that actor. A delegation names grantor, grantee, the delegated role, the scope of the grantor assignment it derives from, an expiry and a reason. A grant whose caller lacks the service scope, that names no actor, or whose actor by those records holds no role in that scope that is the same as or above the delegated role is answered 403. The service also refuses a delegation to a subject who is not a member of the tenant, one without an expiry or with an expiry beyond the configured maximum, and one without a reason. A revocation names its actor the same way: the grantor, Workspace admin of the project and Platform admin may revoke the delegation at any time, each checked against the records of the identity service, and a revocation without an actor or by any other actor is answered 403. The record of a grant and of a revocation names the actor and the workload that wrote it. Validity is decided when claims are read, so an expired or revoked delegation never appears in the claims of the grantee even before the expiry sweep has run; the sweep marks it expired and raises the event. The claim of a delegated role carries the identifier of the delegation, so that a decision taken under it can be traced to the record, and the claims read returns the expiry of the delegation with it, so that the authorization server can bound the lifetime of a token that carries it. Grant, revocation and expiry each raise an integration event, and when the assignment of the grantor is removed its delegations are revoked with it. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015; requirements: FR-01. Depends on: AIFACTORY-US-240. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0008-openiddict-identity.md, model/services/control-plane/ProjectService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a member who by the records of the identity service holds a role in a project, when a workload caller that holds the service scope of the write names that member as actor and delegates that role or a lesser one to another member of the tenant with an expiry and a reason, then the delegation is stored in the identity service, the system of record of delegations, with the actor as grantor, grantee, role, scope, expiry, reason and the workload that wrote it, an event is raised from which ProjectService updates its projection as model/services/control-plane/ProjectService.yaml states, and the claims of the grantee hold the delegated role claim with the identifier of the delegation and its expiry (ADR-0015 decision 6, ADR-0008).",
        "AC2: Given the role order the amendment of ADR-0015 decides and the role catalogue holds, in which Observer is below every role, Requester, Reviewer, Asset maintainer and Operator are not comparable with each other and each is below Workspace admin, and every role is below Platform admin, when a workload caller writes a delegation that names no actor, or names an actor who by the records of the identity service holds no role in that scope that is the same as or above the delegated role, then the answer is 403, whatever role the request states for the actor; when a delegation names a grantee outside the tenant, no expiry, an expiry beyond the configured maximum or no reason, then the request is refused with the rule named; nothing is stored in any of these cases (ADR-0015 decisions 5 and 6 and its amendments on the role order and on role writes, D115).",
        "AC3: Given a valid delegation, when a workload caller that holds the service scope of the write revokes it and names as actor the grantor, Workspace admin of the project or Platform admin, each by the records of the identity service, or its expiry passes, then the next claims read of the grantee no longer holds the delegated role, the record keeps who ended it, through which workload and when, and an event for the revocation or the expiry is raised once (ADR-0015 decision 6, FR-01).",
        "AC4: Given a grantor whose own assignment is removed, when the removal commits, then every delegation derived from that assignment is revoked with the removal as its reason; a delegation identifier of another tenant is answered 404, and a revocation that names no actor, or an actor who by the records of the identity service is neither the grantor nor Workspace admin of the project nor Platform admin, is answered 403 (ADR-0015 decision 3, its amendment on a resource of another tenant, D113, and its amendment on role writes, D115; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1119",
        "AIFACTORY-TASK-595",
        "AIFACTORY-TASK-1120",
        "AIFACTORY-TASK-1121"
      ],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1302,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-240"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "model/services/control-plane/ProjectService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-241]",
      "number": 241
    },
    {
      "id": "AIFACTORY-TASK-1119",
      "type": "task",
      "parent": "AIFACTORY-US-241",
      "title": "Delegation contract, the lesser-role relation and the three delegation events",
      "sequence": "18.13.02.01",
      "description": "BEFORE DEVELOPMENT. Delegation contract, the lesser-role relation and the three delegation events. Expected output: The service contract of the template holds the delegation grant, revoke and read requests and responses, the acting member on the grant and the revoke request, the maximum expiry option, the relation of same and lesser roles, which is the order of the ADR-0015 amendment, read from the roles each catalogue entry covers, the expiry on the delegated role entry of the claims read, and the events for grant, revocation and expiry with delegation identifier, grantor, grantee, role and scope.. Kind: contract. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The service contract of the template holds the delegation grant, revoke and read requests and responses, the acting member on the grant and the revoke request, the maximum expiry option, the relation of same and lesser roles, which is the order of the ADR-0015 amendment, read from the roles each catalogue entry covers, the expiry on the delegated role entry of the claims read, and the events for grant, revocation and expiry with delegation identifier, grantor, grantee, role and scope."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1302,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1119]",
      "number": 1119
    },
    {
      "id": "AIFACTORY-TASK-595",
      "type": "task",
      "parent": "AIFACTORY-US-241",
      "title": "Delegation records with bounded validity and revocation",
      "sequence": "18.13.02.02",
      "description": "BEFORE DEVELOPMENT. Delegation records with bounded validity and revocation. Expected output: A delegation records grantor, grantee, delegated role (the same or a lesser one by the relation of the catalogue), scope, expiry and reason; it is revocable at any time, expires on its own, raises an event on grant, revoke and expiry, and appears in the grantee's claims only while valid; grant and revocation accept a workload caller that holds the service scope of the write and names an actor, the grantor of a grant and the right to revoke are checked against the records of the identity service for that actor, a write without the scope, without an actor or with an actor that lacks the role is answered 403, and the record names the actor and the workload that wrote it.. Kind: implementation. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A delegation records grantor, grantee, delegated role (the same or a lesser one by the relation of the catalogue), scope, expiry and reason; it is revocable at any time, expires on its own, raises an event on grant, revoke and expiry, and appears in the grantee's claims only while valid; grant and revocation accept a workload caller that holds the service scope of the write and names an actor, the grantor of a grant and the right to revoke are checked against the records of the identity service for that actor, a write without the scope, without an actor or with an actor that lacks the role is answered 403, and the record names the actor and the workload that wrote it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-595]",
      "number": 595
    },
    {
      "id": "AIFACTORY-TASK-1120",
      "type": "task",
      "parent": "AIFACTORY-US-241",
      "title": "Delegation table, its migration and the expiry sweep",
      "sequence": "18.13.02.03",
      "description": "BEFORE DEVELOPMENT. Delegation table, its migration and the expiry sweep. Expected output: A migration adds the delegation table with the workload that wrote the grant and the revocation, its tenant filter and an index over grantee and expiry for active rows; a scheduled sweep marks delegations past their expiry and raises the expiry event once per delegation.. Kind: migration. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration adds the delegation table with the workload that wrote the grant and the revocation, its tenant filter and an index over grantee and expiry for active rows; a scheduled sweep marks delegations past their expiry and raises the expiry event once per delegation."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1302,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1120]",
      "number": 1120
    },
    {
      "id": "AIFACTORY-TASK-1121",
      "type": "task",
      "parent": "AIFACTORY-US-241",
      "title": "Verify delegation validity, revocation and expiry on the generated identity service",
      "sequence": "18.13.02.04",
      "description": "BEFORE DEVELOPMENT. Verify delegation validity, revocation and expiry on the generated identity service. Expected output: Run the acceptance scenarios for grant, revocation, expiry with a controlled clock and removal of the grantor assignment, and the acceptance matrix of delegations over the seven roles: every admitted pair (the same role, Observer from any role, one of the four project roles from Workspace admin, any role from Platform admin) is stored and every refused pair is enumerated and refused, among them each of the twelve pairs between Requester, Reviewer, Asset maintainer and Operator, Workspace admin from any of those four, any other role from Observer and Platform admin from any other role; every grant and revocation is written by a workload caller that names the actor, each refused pair is answered 403 from the records of the identity service although the request states the role, a write without an actor is answered 403, and the record names the actor and the workload; claims hold the delegated role only while valid, which proves AC1 to AC4 of AIFACTORY-US-241 (ADR-0015).. Kind: verification. Repository: ConnectSoft.IdentityTemplate.",
      "acceptanceCriteria": [
        "Run the acceptance scenarios for grant, revocation, expiry with a controlled clock and removal of the grantor assignment, and the acceptance matrix of delegations over the seven roles: every admitted pair (the same role, Observer from any role, one of the four project roles from Workspace admin, any role from Platform admin) is stored and every refused pair is enumerated and refused, among them each of the twelve pairs between Requester, Reviewer, Asset maintainer and Operator, Workspace admin from any of those four, any other role from Observer and Platform admin from any other role; every grant and revocation is written by a workload caller that names the actor, each refused pair is answered 403 from the records of the identity service although the request states the role, a write without an actor is answered 403, and the record names the actor and the workload; claims hold the delegated role only while valid, which proves AC1 to AC4 of AIFACTORY-US-241 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1121]",
      "number": 1121
    },
    {
      "id": "AIFACTORY-US-242",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-161",
      "title": "Identity template: the role and delegation contracts are promoted as a minor ServiceModel version together with the Authorization Server client that reads them",
      "sequence": "18.13.03",
      "description": "As an asset maintainer, I want the role assignment and delegation contracts to reach the authorization server in one coordinated promotion, so that no consumer of the identity contracts breaks on its next restore. The authorization server calls the internal API of the identity service on every login, so its HTTP client is the first consumer of every contract change. The findings page of the template (Docs/Consumer-Reported-Findings.md of the template) records how the last change was sequenced: the multi-valued claims contract was a breaking change with a known downstream casualty, it was promoted as the 1.1 stream by explicit decision and not as a patch, and the consumer change landed in the same window; a patch-level promotion would have broken every consumer on its next restore. The page also shows how that alignment was proven before anything was published: a locally packed prerelease of the package passed the isolated consumer tests. This PBI applies the same sequencing to the role assignment and delegation contracts. They are added to the `ConnectSoft.IdentityTemplate.ServiceModel` package as an additive minor version. Publication is the gate of AIFACTORY-US-243, which depends on this PBI, so the proof here uses a locally packed prerelease candidate of the package: the HTTP client of the authorization server template (`ConnectSoft.Extensions.Http.IdentityMicroservice` in that template) builds against the candidate and maps the role claims with their scope and the valid delegations, and its claims tests pass. The move of its pin to the published version, with no downgrade warning, belongs to AIFACTORY-US-244, where the published version exists. A contract baseline test in the identity template compares the public surface of the package with the last published version and fails the pipeline when a breaking change is published under a patch or a minor version. Isolated consumer tests serialise and read the new contracts in JSON and in the data contract format, as the earlier alignment did, so that the wire shape is proven without a running service. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015; requirements: FR-11. Depends on: AIFACTORY-US-240, AIFACTORY-US-241. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0008-openiddict-identity.md, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the role assignment and delegation contracts, when the ServiceModel package is built, then it carries them as an additive minor version above the 1.1 stream, and isolated consumer tests read and write them in JSON and in the data contract format (ADR-0008, ADR-0015 decision 6; sequencing asked for by Docs/Consumer-Reported-Findings.md of the template; model/components.yaml).",
        "AC2: Given a locally packed prerelease candidate of the ServiceModel package, when the HTTP client of the authorization server template is built against it from a local feed, then it maps one role claim per assignment with its scope and one per valid delegation with its expiry into the identity information it returns, its focused claims tests pass and it builds in Release, before anything is published (ADR-0015 decision 6, ADR-0008).",
        "AC3: Given a change that removes or renames a member of a published contract, when the pipeline of the identity template runs with a patch or a minor version, then the contract baseline test fails and names the member, so that a breaking change is published only as a deliberate version step with its consumer change (FR-11, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-596",
        "AIFACTORY-TASK-1122",
        "AIFACTORY-TASK-1123",
        "AIFACTORY-TASK-1124"
      ],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1303,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-240",
        "AIFACTORY-US-241"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-242]",
      "number": 242
    },
    {
      "id": "AIFACTORY-TASK-596",
      "type": "task",
      "parent": "AIFACTORY-US-242",
      "title": "Role and delegation contracts promoted with the Authorization Server consumer",
      "sequence": "18.13.03.01",
      "description": "BEFORE DEVELOPMENT. Role and delegation contracts promoted with the Authorization Server consumer. Expected output: The ServiceModel package carries the role-assignment and delegation requests and responses as a minor version, and the HTTP client of the Authorization Server template consumes them in the same window, first against a locally packed prerelease candidate, so no patch-level promotion breaks a consumer (the sequencing the findings page asks for).. Kind: implementation. Repository: ConnectSoft.IdentityTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The ServiceModel package carries the role-assignment and delegation requests and responses as a minor version, and the HTTP client of the Authorization Server template consumes them in the same window, first against a locally packed prerelease candidate, so no patch-level promotion breaks a consumer (the sequencing the findings page asks for)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-596]",
      "number": 596
    },
    {
      "id": "AIFACTORY-TASK-1122",
      "type": "task",
      "parent": "AIFACTORY-US-242",
      "title": "Contract baseline test of the ServiceModel package",
      "sequence": "18.13.03.02",
      "description": "BEFORE DEVELOPMENT. Contract baseline test of the ServiceModel package. Expected output: A test compares the public surface of `ConnectSoft.IdentityTemplate.ServiceModel` with the surface of the last published version and fails when a member was removed or renamed under a patch or a minor version; the service-model pipeline of the template runs it before publication.. Kind: contract. Repository: ConnectSoft.IdentityTemplate. Verification: azure-pipelines-service-model.yml runs the baseline test.",
      "acceptanceCriteria": [
        "A test compares the public surface of `ConnectSoft.IdentityTemplate.ServiceModel` with the surface of the last published version and fails when a member was removed or renamed under a patch or a minor version; the service-model pipeline of the template runs it before publication."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1303,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1122]",
      "number": 1122
    },
    {
      "id": "AIFACTORY-TASK-1123",
      "type": "task",
      "parent": "AIFACTORY-US-242",
      "title": "Authorization Server HTTP client reads role assignments and delegations",
      "sequence": "18.13.03.03",
      "description": "BEFORE DEVELOPMENT. Authorization Server HTTP client reads role assignments and delegations. Expected output: The identity client of the authorization server template builds against the locally packed prerelease candidate of the ServiceModel package from a local feed and maps role claims with their scope and valid delegations with their expiry into the identity information it returns; its claims regression tests cover repeated roles across projects and an expired delegation; the pin of the published version follows in AIFACTORY-US-244.. Kind: implementation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The identity client of the authorization server template builds against the locally packed prerelease candidate of the ServiceModel package from a local feed and maps role claims with their scope and valid delegations with their expiry into the identity information it returns; its claims regression tests cover repeated roles across projects and an expired delegation; the pin of the published version follows in AIFACTORY-US-244."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1123]",
      "number": 1123
    },
    {
      "id": "AIFACTORY-TASK-1124",
      "type": "task",
      "parent": "AIFACTORY-US-242",
      "title": "Verify the promoted contracts against their consumer",
      "sequence": "18.13.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the promoted contracts against their consumer. Expected output: Pack a prerelease candidate of the ServiceModel package locally, build the authorization server template against it and run its focused claims tests and the isolated consumer tests of the identity template; all pass and a planted removed member fails the baseline test, which proves AC1 to AC3 of AIFACTORY-US-242 (ADR-0015).. Kind: verification. Repository: ConnectSoft.IdentityTemplate.",
      "acceptanceCriteria": [
        "Pack a prerelease candidate of the ServiceModel package locally, build the authorization server template against it and run its focused claims tests and the isolated consumer tests of the identity template; all pass and a planted removed member fails the baseline test, which proves AC1 to AC3 of AIFACTORY-US-242 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1124]",
      "number": 1124
    },
    {
      "id": "AIFACTORY-US-243",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-161",
      "title": "Identity template: the role model passes the full suites of the authoring pipeline and the Domain cases of the installer pipeline before the template and ServiceModel packages publish",
      "sequence": "18.13.04",
      "description": "As an asset maintainer, I want the role model to be proven by the two pipelines the identity template has, so that the Factory resolves roles from an identity service that was scaffolded from a gated package. The findings page of the template (Docs/Consumer-Reported-Findings.md of the template) records the gate the template has, and it has two parts. The authoring pipeline runs the acceptance scenarios through `build/Invoke-IdentityTests.ps1`, which checks discovery against completion and rejects missing, aborted, truncated and mismatched result files. The installer gate is the shared template pipeline: `build/template-ci.json` declares one Domain case per artifact kind with a test filter and keeps the Compatibility cases for manual selection, every generated configuration passes restore, build, mapper and options checks and a dependency audit, and the package is guarded so that no package source credential is copied into an installer. A database-backed acceptance run per generated case is not what the installer pipeline does and would not fit the bound of a validation job. This PBI makes the role model part of both pipelines as they are and is the proof of the feature. The authoring pipeline runs the full unit, architecture and acceptance suites with the role assignment, delegation and claims scenarios through the completeness runner. The installer pipeline generates the Domain cases of the manifest, whose test filter gains contract-level tests of the role assignment, delegation and claims boundary that run with local test doubles, and audits each generated graph. The Scripts check of the shared tooling runs in check mode and keeps the root Scripts folder in step with the Scripts folder of the base-template submodule. A failing case, an incomplete run or a package that holds a credential fails the run with the case and the stage named, and neither the template package nor the ServiceModel package is published. Publication of both packages requires the complete reports of both pipelines bound to the candidate and pushes versions that are not yet on the ConnectSoft feed. The PBI proves decisions 5 and 6 of ADR-0015 on the identity service and the release gate of FR-11. Kind: evidence. Traces: adrs: ADR-0008, ADR-0015; requirements: FR-11. Depends on: AIFACTORY-US-240, AIFACTORY-US-241, AIFACTORY-US-242, feature:component-base-template-findings. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/ecosystem-composition.md, model/template-parameters/connectsoft-identity.yaml, docs/architecture/catalogs/templates.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the identity template, when its authoring pipeline runs, then the full unit, architecture and acceptance suites run with the role assignment, delegation and claims scenarios through the completeness runner, and a run that executes fewer tests than were discovered fails (ADR-0015 decisions 5 and 6, FR-11).",
        "AC2: Given the same change, when the installer pipeline runs the shared installer jobs, then it generates the Domain cases of `build/template-ci.json`, whose test filter holds contract-level tests of the role assignment, delegation and claims boundary, restores and builds each case in Release, runs the filtered tests with the discovery and completion checks, audits each generated graph, and the Scripts check passes in check mode (FR-11, ADR-0015, docs/architecture/ecosystem-composition.md).",
        "AC3: Given a failing case, an incomplete test run or a staged package that holds a package source credential, when either pipeline evaluates the run, then the run fails with the case and the stage named and neither the template package nor the ServiceModel package is published (FR-11, docs/architecture/ecosystem-composition.md).",
        "AC4: Given complete reports of both pipelines bound to the candidate, when the publication jobs run, then the template package and the ServiceModel package are pushed with versions that were not on the feed, and a fresh install of the template version generates the Domain cases whose role, delegation and claims contract tests pass unchanged (ADR-0008, ADR-0015, model/template-parameters/connectsoft-identity.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/ecosystem-composition.md",
        "model/template-parameters/connectsoft-identity.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1125",
        "AIFACTORY-TASK-1171",
        "AIFACTORY-TASK-1126",
        "AIFACTORY-TASK-1127"
      ],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1304,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-240",
        "AIFACTORY-US-241",
        "AIFACTORY-US-242",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/ecosystem-composition.md",
        "model/template-parameters/connectsoft-identity.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-243]",
      "number": 243
    },
    {
      "id": "AIFACTORY-TASK-1125",
      "type": "task",
      "parent": "AIFACTORY-US-243",
      "title": "Role, delegation and claims contract tests in the test filter of the Domain cases",
      "sequence": "18.13.04.01",
      "description": "BEFORE DEVELOPMENT. Role, delegation and claims contract tests in the test filter of the Domain cases. Expected output: The generated test projects hold contract-level tests of the role assignment, delegation and claims boundary that run with local test doubles, and the test filter of each Domain case in `build/template-ci.json` selects them; the role, delegation and claims acceptance scenarios stay in the authoring pipeline and run through `build/Invoke-IdentityTests.ps1`; a failing or incomplete case fails its pipeline with the case named.. Kind: operations. Repository: ConnectSoft.IdentityTemplate. Verification: the manifest validation of the shared tooling passes and the Domain cases run the new tests.",
      "acceptanceCriteria": [
        "The generated test projects hold contract-level tests of the role assignment, delegation and claims boundary that run with local test doubles, and the test filter of each Domain case in `build/template-ci.json` selects them; the role, delegation and claims acceptance scenarios stay in the authoring pipeline and run through `build/Invoke-IdentityTests.ps1`; a failing or incomplete case fails its pipeline with the case named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1304,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1125]",
      "number": 1125
    },
    {
      "id": "AIFACTORY-TASK-1171",
      "type": "task",
      "parent": "AIFACTORY-US-243",
      "title": "Scripts check of the identity template in check mode",
      "sequence": "18.13.04.02",
      "description": "BEFORE DEVELOPMENT. Scripts check of the identity template in check mode. Expected output: The manifest of the identity template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside the package snapshot check and fails with the missing and the changed files named.. Kind: operations. Repository: ConnectSoft.IdentityTemplate. Verification: the pipeline runs the Scripts check and a removed file fails it.",
      "acceptanceCriteria": [
        "The manifest of the identity template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside the package snapshot check and fails with the missing and the changed files named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1304,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1171]",
      "number": 1171
    },
    {
      "id": "AIFACTORY-TASK-1126",
      "type": "task",
      "parent": "AIFACTORY-US-243",
      "title": "Publication of the template and ServiceModel packages on the reports of both pipelines",
      "sequence": "18.13.04.03",
      "description": "BEFORE DEVELOPMENT. Publication of the template and ServiceModel packages on the reports of both pipelines. Expected output: The publication jobs of the template package and of the ServiceModel package require the complete report of the authoring pipeline and the complete reports of the Domain cases, bound to the candidate, and the package protection check, and refuse a version that is already on the feed with the reason.. Kind: operations. Repository: ConnectSoft.IdentityTemplate. Verification: a repeated version is refused; a failed case skips publication.",
      "acceptanceCriteria": [
        "The publication jobs of the template package and of the ServiceModel package require the complete report of the authoring pipeline and the complete reports of the Domain cases, bound to the candidate, and the package protection check, and refuse a version that is already on the feed with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1304,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1126]",
      "number": 1126
    },
    {
      "id": "AIFACTORY-TASK-1127",
      "type": "task",
      "parent": "AIFACTORY-US-243",
      "title": "Verify the gate of the identity template on a green and a planted run",
      "sequence": "18.13.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the gate of the identity template on a green and a planted run. Expected output: One green run of both pipelines publishes both packages and a fresh install generates the Domain cases whose contract tests pass; a run with a planted failing delegation scenario stops before publication; both prove AC1 to AC4 of AIFACTORY-US-243 (ADR-0015, FR-11).. Kind: verification. Repository: ConnectSoft.IdentityTemplate.",
      "acceptanceCriteria": [
        "One green run of both pipelines publishes both packages and a fresh install generates the Domain cases whose contract tests pass; a run with a planted failing delegation scenario stops before publication; both prove AC1 to AC4 of AIFACTORY-US-243 (ADR-0015, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1127]",
      "number": 1127
    },
    {
      "id": "AIFACTORY-US-107",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-161",
      "title": "Identity template: the Factory role model with per-project assignments and delegation records is delivered and proven on a generated solution",
      "sequence": "18.13.05",
      "description": "As an asset maintainer, I want Identity microservice to carry the Factory role model with per-project assignments and delegation records, so that it serves Accounts, credentials, MFA, memberships, roles (D18) without later rework. This is the integration PBI of the feature. The identity service holds accounts, credentials, memberships and roles for the Factory and is the system of record of role assignments and delegations, of which ProjectService keeps a projection, and the authorization server issues the seven Factory roles as claims from what it holds. With role assignments bound to a project or the tenant and evaluated against a seeded role catalogue, the bootstrap of the first role holders, delegation records with bounded validity and revocation, the contracts promoted as a minor ServiceModel version together with the authorization server client, and the gate of the two pipelines, the asset maintainer runs the pipelines end to end: the full suites in the authoring pipeline, then pack, install, generate the Domain cases, build and test completely, then publish both packages. A failing or incomplete case blocks publication. The migrated implementation tasks sit under the PBIs that deliver them, and the verification task of this PBI is the proof on the published package. The feature is done when an identity service generated from the published package returns project-scoped role claims and valid delegations to the authorization server client. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015. Depends on: AIFACTORY-US-240, AIFACTORY-US-241, AIFACTORY-US-242, AIFACTORY-US-243. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.IdentityTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution builds and its tests pass before the package publishes with a verified version (ADR-0015, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-594 (per-project role assignments for the seven Factory roles) is done, then a role assignment binds a member, a role and a project scope, Platform admin is the only assignment with tenant scope and Observer may hold either, membership stays per tenant, and the internal claims API returns one repeating role claim per project assignment so the authorization server can issue them (ADR-0015 decision 5).",
        "AC3: Given the work of AIFACTORY-TASK-595 (delegation records with bounded validity and revocation) is done, then a delegation records grantor, grantee, delegated role (the same or a lesser one), scope, expiry and reason, is revocable at any time, expires on its own, raises an event on grant, revoke and expiry, and appears in the claims of the grantee only while valid (ADR-0015 decision 6).",
        "AC4: Given the work of AIFACTORY-TASK-596 (role and delegation contracts promoted with the Authorization Server consumer) is done, then the ServiceModel package carries the role-assignment and delegation requests and responses as a minor version, and the HTTP client of the authorization server template consumes them in the same window, so no patch-level promotion breaks a consumer (ADR-0008, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-683"
      ],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1305,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-240",
        "AIFACTORY-US-241",
        "AIFACTORY-US-242",
        "AIFACTORY-US-243"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-107]",
      "number": 107
    },
    {
      "id": "AIFACTORY-TASK-683",
      "type": "task",
      "parent": "AIFACTORY-US-107",
      "title": "Verify identity-template-factory-roles-delivered by running the declared command",
      "sequence": "18.13.05.01",
      "description": "BEFORE DEVELOPMENT. Verify identity-template-factory-roles-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the identity service generated from the published package; they pass and prove AC1 to AC4 of AIFACTORY-US-107.. Kind: verification. Repository: ConnectSoft.IdentityTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the identity service generated from the published package; they pass and prove AC1 to AC4 of AIFACTORY-US-107."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.IdentityTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.IdentityTemplate"
      ],
      "children": [],
      "buildOrder": 13,
      "phase": "templates-and-libraries",
      "stackRank": 1305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-683]",
      "number": 683
    },
    {
      "id": "AIFACTORY-FEAT-162",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Authorization server template: the Factory token contract, workload identity and delegation",
      "sequence": "18.14",
      "description": "The Authorization Server is the sole token issuer of the Factory (canonical ADR-0101, ADR-0008). Its template issues standard OpenID Connect tokens with tenant claims, but not yet what the Factory needs on every call: role claims scoped to a project, audiences for the Factory gateways, registered Factory scopes, client-credential identities for services and agents (workload identity, D44) and the RFC 8693 actor claim that lets an agent act for a person with the delegated scope (ADR-0023). The template's findings page records the delegation gap with two leads, a seeded service client that shares the development secret, a missing Scripts sync guard and the stronger test-completeness check the Identity template already has. Component: Authorization Server (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-161. Increment I0: Readiness. Build order 14 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-244",
        "AIFACTORY-US-245",
        "AIFACTORY-US-246",
        "AIFACTORY-US-1506",
        "AIFACTORY-US-247",
        "AIFACTORY-US-526",
        "AIFACTORY-US-248",
        "AIFACTORY-US-108"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1400,
      "titlePrefix": "[AIFACTORY-FEAT-162]",
      "number": 162
    },
    {
      "id": "AIFACTORY-US-244",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: an access token for a Factory client carries the tenant, project-scoped role claims, valid delegations, registered Factory scopes and the audience of one gateway",
      "sequence": "18.14.01",
      "description": "As an asset maintainer, I want the authorization server to issue the claims, scopes and audiences every Factory call is validated against, so that a gateway and a service can decide a call from the token alone and a token for one gateway is useless at another. The authorization server is the sole token issuer of the Factory (ADR-0008) and ADR-0015 decision 6 has it issue the seven Factory roles as claims that every backend enforces. The template issues standard OpenID Connect tokens with the tenant claim today. What a Factory call needs beyond that is not issued yet, and this PBI adds it. On issuance the server reads the role assignments and the valid delegations of the subject from the identity service through the contracts of the identity template feature, with its HTTP client pinned to the published ServiceModel version, and writes one role claim per assignment with its project or tenant scope and one per valid delegation with the identifier of the delegation. The claim type names, the role names and the formatter of the scoped role value come from the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package (AIFACTORY-TASK-1173 of AIFACTORY-US-220 in feature `component-extensions-ai`), which the identity, base and gateway templates pin as well; the template holds none of them as constants of its own. The audience is not a request parameter. The claims contract page of the template (Docs/Claims-and-Token-Contract.md of the template) states that OpenIddict derives `aud` from the resources attached to the principal and that those resources come from the API resources registered against the granted scopes. Factory scopes are therefore registered from a registration file that lists the scopes the service files of the model name under their operations (for example model/services/control-plane/ProjectService.yaml) and maps each to the resource of the gateway of model/gateways.yaml that fronts its service. The template holds no Factory name in code. The amendment of ADR-0015 (D114) decides the audience: a user token has one audience, the resource of the gateway that fronts its granted scopes, so a client that calls two gateways requests two tokens. A request that combines scopes of two gateways is refused by the authorization server with the standard scope error and no token, as is a request for a scope that is not registered or that the client is not allowed. When the identity service cannot be reached, issuance fails instead of producing a token without roles. The same page warns that access encoded as a claim cannot be revoked before the token expires. The lifetime of an access token that carries a delegated role therefore never exceeds the remaining validity of the delegation, and a revocation takes effect at the next issuance, a refresh included; the page documents that bound. It documents every claim with its type, value shape and source, and issuance stays recorded by the audit path the template already has, with its bounded write. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015; requirements: FR-01. Depends on: feature:component-identity-template-factory-roles, feature:component-extensions-ai. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0008-openiddict-identity.md, model/gateways.yaml, model/services/control-plane/ProjectService.yaml, docs/templates-docs/authorization-server-template.md.",
      "acceptanceCriteria": [
        "AC1: Given a member with role assignments in two projects and one valid delegation, when a Factory client obtains an access token for the member, then the token carries the tenant claim, one role claim per assignment with its scope, one delegated role claim with the identifier of the delegation and the granted Factory scopes, all under the claim type names of the pinned Factory abstractions package, and the HTTP client that read them pins the published ServiceModel version and builds with no downgrade warning (ADR-0015 decisions 5 and 6, ADR-0008).",
        "AC2: Given the registration file that maps each Factory scope to the resource of the gateway that fronts its service, when a user token is issued, then it has one audience, the resource of the gateway that fronts its granted scopes, and a resource server that validates another audience rejects it; a request that combines scopes of two gateways, a request for a scope that is not registered and a request for a scope the client is not allowed are each refused with the standard error and no token is issued (ADR-0008, ADR-0015 amendment on the one audience of a user token, FR-01, model/gateways.yaml).",
        "AC3: Given the identity service cannot be reached during issuance, when a token is requested, then the request fails with a server error and no token without role claims is issued; given an expired delegation, when a token is issued, then it holds no claim for it (ADR-0015 decision 6).",
        "AC4: Given a valid delegation whose remaining validity is shorter than the configured access token lifetime, when a token that carries the delegated role is issued, then the lifetime of the token does not exceed the remaining validity of the delegation; given the delegation is revoked, when the next token is issued or refreshed, then it holds no claim for it; the claims contract page documents the bound (ADR-0015 decision 6, docs/templates-docs/authorization-server-template.md).",
        "AC5: Given the claims contract page of the template, when it is compared with an issued Factory token by the contract test, then every claim of the token is documented with type, value shape and source and the page names no claim the token lacks (ADR-0008, docs/templates-docs/authorization-server-template.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "model/gateways.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1128",
        "AIFACTORY-TASK-597",
        "AIFACTORY-TASK-1129",
        "AIFACTORY-TASK-1130"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1401,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-identity-template-factory-roles",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "model/gateways.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-244]",
      "number": 244
    },
    {
      "id": "AIFACTORY-TASK-1128",
      "type": "task",
      "parent": "AIFACTORY-US-244",
      "title": "Pins of the Factory token contract and of the published ServiceModel, and the scope registration file",
      "sequence": "18.14.01.01",
      "description": "BEFORE DEVELOPMENT. Pins of the Factory token contract and of the published ServiceModel, and the scope registration file. Expected output: The template pins `ConnectSoft.Extensions.AI.Factory.Abstractions` for the claim type names, the role names and the formatter of the scoped role value and holds none of them as constants; its identity client pins the published ServiceModel version with no downgrade warning; the schema of a registration file lists each Factory scope with the one resource of the gateway that fronts its service, and a scope mapped to two gateways fails the seed with the scope named; the seed reads the file, registers the resources against the scopes, and the template names no Factory scope or gateway in code.. Kind: contract. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The template pins `ConnectSoft.Extensions.AI.Factory.Abstractions` for the claim type names, the role names and the formatter of the scoped role value and holds none of them as constants; its identity client pins the published ServiceModel version with no downgrade warning; the schema of a registration file lists each Factory scope with the one resource of the gateway that fronts its service, and a scope mapped to two gateways fails the seed with the scope named; the seed reads the file, registers the resources against the scopes, and the template names no Factory scope or gateway in code."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1401,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1128]",
      "number": 1128
    },
    {
      "id": "AIFACTORY-TASK-597",
      "type": "task",
      "parent": "AIFACTORY-US-244",
      "title": "Factory claims, scopes and audiences in the issued tokens",
      "sequence": "18.14.01.02",
      "description": "BEFORE DEVELOPMENT. Factory claims, scopes and audiences in the issued tokens. Expected output: An access token for a Factory client carries the tenant, the project-scoped role claims and the valid delegations read from Identity, the registered Factory scopes and one audience, the resource of the gateway that fronts those scopes; a request that combines scopes of two gateways is refused and a token for one audience is rejected by another; a token that carries a delegated role does not outlive the delegation and a revocation takes effect at the next issuance; the claims contract page of the template documents every claim.. Kind: implementation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An access token for a Factory client carries the tenant, the project-scoped role claims and the valid delegations read from Identity, the registered Factory scopes and one audience, the resource of the gateway that fronts those scopes; a request that combines scopes of two gateways is refused and a token for one audience is rejected by another; a token that carries a delegated role does not outlive the delegation and a revocation takes effect at the next issuance; the claims contract page of the template documents every claim."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-597]",
      "number": 597
    },
    {
      "id": "AIFACTORY-TASK-1129",
      "type": "task",
      "parent": "AIFACTORY-US-244",
      "title": "Claims contract page checked against an issued token",
      "sequence": "18.14.01.03",
      "description": "BEFORE DEVELOPMENT. Claims contract page checked against an issued token. Expected output: Docs/Claims-and-Token-Contract.md of the template lists every Factory claim with type, value shape and source, states that a user token has one audience, the resource of the gateway that fronts its granted scopes, that a request for scopes of two gateways is refused and that a token with a delegated role is bounded by the remaining validity of the delegation, and a contract test of the acceptance suite fails when an issued Factory token and the page differ.. Kind: documentation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Docs/Claims-and-Token-Contract.md of the template lists every Factory claim with type, value shape and source, states that a user token has one audience, the resource of the gateway that fronts its granted scopes, that a request for scopes of two gateways is refused and that a token with a delegated role is bounded by the remaining validity of the delegation, and a contract test of the acceptance suite fails when an issued Factory token and the page differ."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1401,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1129]",
      "number": 1129
    },
    {
      "id": "AIFACTORY-TASK-1130",
      "type": "task",
      "parent": "AIFACTORY-US-244",
      "title": "Verify the Factory token contract on issued tokens",
      "sequence": "18.14.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the Factory token contract on issued tokens. Expected output: Run the acceptance scenarios for a member with two assignments and a delegation, for a resource server that validates another audience, for a request that combines scopes of two gateways, for an unregistered scope, for a delegation that ends before the token lifetime, for a revoked delegation at the next issuance and for an unreachable identity service; the tokens and refusals are as stated, which proves AC1 to AC5 of AIFACTORY-US-244 (ADR-0015, ADR-0008).. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "Run the acceptance scenarios for a member with two assignments and a delegation, for a resource server that validates another audience, for a request that combines scopes of two gateways, for an unregistered scope, for a delegation that ends before the token lifetime, for a revoked delegation at the next issuance and for an unreachable identity service; the tokens and refusals are as stated, which proves AC1 to AC5 of AIFACTORY-US-244 (ADR-0015, ADR-0008)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1130]",
      "number": 1130
    },
    {
      "id": "AIFACTORY-US-245",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: every Factory service and agent host has its own client-credentials client with only its `svc.` scopes, and no seeded development secret works outside Development",
      "sequence": "18.14.02",
      "description": "As an asset maintainer, I want the authorization server to hold one workload identity per Factory service and per agent host, so that a service authenticates as itself with a credential that no other workload shares. ADR-0023 decision 4 makes workload identity the authentication of callers: they present tokens issued by the authorization server. Item 8 of the findings page of the template (Docs/Consumer-Reported-Findings.md of the template) records the state today: the migration seeds one service client with the same secret hash as the demo client, the secret of the service token is intentionally empty in the settings, and both must be replaced at deploy time, which the page asks to make an explicit deployment checklist item because a service credential is shared across a deployment. This PBI turns the single seeded client into one client-credentials client per Factory service and per agent host. The clients are seeded from a workload registration file that names each client with its service scopes, so the template holds no Factory service name in code. The claims contract page of the template (Docs/Claims-and-Token-Contract.md of the template) sets the rule for such scopes: a scope prefixed `svc.` addresses the internal API of another service and is deliberately registered without API resources, because an audience would make a machine-to-machine token indistinguishable from a user API token, and the seeding logic relies on the prefix to withhold resources. Every Factory service scope of the workload registration file is therefore `svc.` prefixed and registered without a resource, and a workload token carries no audience of a user API. It carries no role claim and no tenant claim either: a workload serves every tenant and takes the tenant of a call from the scope it forwards, and a service reads the tenant and project a workload forwards only when the token holds the `svc.` scope that names that service (ADR-0015 amendment of D114). Each client has its own secret or certificate, no two seeded clients share a secret, and a client is granted only the scopes the file gives it. Outside the Development environment a token request of a client that still holds a seeded development secret is refused as an invalid client, and a startup check names every such client without printing a secret. A request for a scope the client does not hold is refused with the standard error. The deployment checklist of the template names each credential the operator replaces and how the replacement is verified. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015, ADR-0023; requirements: FR-01. Depends on: AIFACTORY-US-244. Sources: model/components.yaml, docs/architecture/adr/0023-a2a-interoperability.md, docs/architecture/adr/0008-openiddict-identity.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/templates-docs/authorization-server-template.md.",
      "acceptanceCriteria": [
        "AC1: Given a workload registration file with two services and one agent host, when the server is seeded, then three client-credentials clients exist, each with its own secret or certificate and only the `svc.` scopes the file gives it, each scope is registered without a resource, no two seeded clients share a secret, and a file entry whose scope lacks the `svc.` prefix fails the seed with the entry named (ADR-0023 decision 4, ADR-0008).",
        "AC2: Given a seeded client, when it requests a token with its own scope, then the token carries the client as subject, `client_id`, its `svc.` scopes, no role claim, no tenant claim and no audience of a user API; when it requests a scope the file does not give it, then the request is refused with the standard error (ADR-0023 decision 4, ADR-0015 decision 6 and its amendment on workload tokens).",
        "AC3: Given an environment other than Development, when a client that still holds a seeded development secret requests a token, then the request is refused as an invalid client, the startup check names the client without its secret, and the same request succeeds in Development (ADR-0008, FR-01).",
        "AC4: Given the deployment checklist of the template, when an operator follows it, then it names each seeded credential, the setting or secret store entry that replaces it and the check that proves the replacement, which closes item 8 of the findings page (ADR-0023, docs/architecture/adr/0023-a2a-interoperability.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1131",
        "AIFACTORY-TASK-598",
        "AIFACTORY-TASK-1132",
        "AIFACTORY-TASK-1133"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1402,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015",
          "ADR-0023"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-244"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-245]",
      "number": 245
    },
    {
      "id": "AIFACTORY-TASK-1131",
      "type": "task",
      "parent": "AIFACTORY-US-245",
      "title": "Workload registration file and its seed",
      "sequence": "18.14.02.01",
      "description": "BEFORE DEVELOPMENT. Workload registration file and its seed. Expected output: The template holds the schema of a workload registration file with client identifier, credential kind and `svc.` scopes, and the migration seeds one client-credentials client per entry with a distinct secret hash and registers each scope without a resource; a file with a duplicate client, a scope without the `svc.` prefix or a scope that is not registered fails the seed with the entry named.. Kind: contract. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template holds the schema of a workload registration file with client identifier, credential kind and `svc.` scopes, and the migration seeds one client-credentials client per entry with a distinct secret hash and registers each scope without a resource; a file with a duplicate client, a scope without the `svc.` prefix or a scope that is not registered fails the seed with the entry named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1402,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1131]",
      "number": 1131
    },
    {
      "id": "AIFACTORY-TASK-598",
      "type": "task",
      "parent": "AIFACTORY-US-245",
      "title": "Workload identity for services and agents",
      "sequence": "18.14.02.02",
      "description": "BEFORE DEVELOPMENT. Workload identity for services and agents. Expected output: A client-credentials client exists per Factory service and per agent host with its own secret or certificate and only its `svc.` service scopes, and its token carries no audience of a user API; the seeded development secret is refused outside the Development environment and no two seeded clients share a secret; the deployment checklist names the credential the operator replaces.. Kind: implementation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A client-credentials client exists per Factory service and per agent host with its own secret or certificate and only its `svc.` service scopes, and its token carries no audience of a user API; the seeded development secret is refused outside the Development environment and no two seeded clients share a secret; the deployment checklist names the credential the operator replaces."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-598]",
      "number": 598
    },
    {
      "id": "AIFACTORY-TASK-1132",
      "type": "task",
      "parent": "AIFACTORY-US-245",
      "title": "Deployment checklist of the credentials an operator replaces",
      "sequence": "18.14.02.03",
      "description": "BEFORE DEVELOPMENT. Deployment checklist of the credentials an operator replaces. Expected output: A deployment checklist page of the template lists every seeded client and the service token secret with the setting or secret store entry that replaces each and the check that proves it; item 8 of Docs/Consumer-Reported-Findings.md of the template is marked resolved.. Kind: documentation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: the checklist names every seeded credential.",
      "acceptanceCriteria": [
        "A deployment checklist page of the template lists every seeded client and the service token secret with the setting or secret store entry that replaces each and the check that proves it; item 8 of Docs/Consumer-Reported-Findings.md of the template is marked resolved."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1402,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1132]",
      "number": 1132
    },
    {
      "id": "AIFACTORY-TASK-1133",
      "type": "task",
      "parent": "AIFACTORY-US-245",
      "title": "Verify workload clients and the refusal of the development secret",
      "sequence": "18.14.02.04",
      "description": "BEFORE DEVELOPMENT. Verify workload clients and the refusal of the development secret. Expected output: Run the acceptance scenarios for a workload token without an audience of a user API, a scope outside the registration and a seeded secret in a non-Development environment; the token and the two refusals are as stated, which proves AC1 to AC4 of AIFACTORY-US-245 (ADR-0023).. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "Run the acceptance scenarios for a workload token without an audience of a user API, a scope outside the registration and a seeded secret in a non-Development environment; the token and the two refusals are as stated, which proves AC1 to AC4 of AIFACTORY-US-245 (ADR-0023)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1133]",
      "number": 1133
    },
    {
      "id": "AIFACTORY-US-246",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: a token exchange with an actor token issues a token whose `act` claim names the actor and whose scope is no wider than the delegated one",
      "sequence": "18.14.03",
      "description": "As an asset maintainer, I want the token exchange of the authorization server to perform the delegation it advertises, so that an agent can act for a person with the scope the person delegated and every backend can see who acted for whom. ADR-0023 decision 4 lets the delegated user scope travel with a task and be narrowed per step, and the feature names the actor claim of RFC 8693 as the means. Item 1 of the findings page of the template (Docs/Consumer-Reported-Findings.md of the template) records that the grant advertises delegation it does not perform: the token-exchange endpoint accepts an actor token and validates it, but the issued access token carries no `act` claim. The acceptance scenario for it holds a real assertion and is quarantined rather than weakened. Two routes were tried and failed silently, and the page leaves two leads: the actor token types option of the server has never been configured, so the actor principal may not be populated at all, and a handler order declared only on the handler type is ignored unless it is set in the registration. It also asks whether the scope, audience and resource calls of the same controller branch have any effect. This PBI implements the exchange. A workload client of an agent host that is permitted to exchange presents the token of the person as subject token and its own token as actor token; the issued token keeps the person as subject, names the actor in `act`, and carries a scope that is contained in the scope of the subject token and in what the actor may request, with the one audience of the gateway that fronts that scope. A wider scope is refused, never silently narrowed to something else; a missing, expired or foreign actor token and a client without the exchange permission are refused with the standard errors. The quarantined scenario runs unchanged. The two leads and the effect of the three calls are confirmed or ruled out in the findings record, each with a negative control. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015, ADR-0023. Depends on: AIFACTORY-US-244, AIFACTORY-US-245. Sources: model/components.yaml, docs/architecture/adr/0023-a2a-interoperability.md, docs/architecture/adr/0008-openiddict-identity.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/templates-docs/authorization-server-template.md.",
      "acceptanceCriteria": [
        "AC1: Given a subject token of a person and an actor token of an agent host client that is permitted to exchange, when the client calls the token-exchange endpoint, then the issued access token keeps the person as subject, carries an `act` claim that names the actor client, a scope contained in the scope of the subject token and the one audience of the gateway that fronts that scope (ADR-0023 decision 4, ADR-0015 decision 6).",
        "AC2: Given the same exchange, when the request asks for a scope the subject token does not hold or the actor may not request, then it is refused with the standard scope error; when the actor token is missing, expired or issued by another authority, or the client lacks the exchange permission, then it is refused with the standard grant or client error and no token is issued (ADR-0023 decision 4, ADR-0008).",
        "AC3: Given the quarantined acceptance scenario for an exchange with an actor token, when its quarantine tag is removed and nothing else in the scenario changes, then it passes in the full acceptance run (ADR-0023; item 1 of Docs/Consumer-Reported-Findings.md of the template; docs/architecture/adr/0023-a2a-interoperability.md).",
        "AC4: Given the two leads of the findings page and the scope, audience and resource calls of the exchange branch, when the work is done, then the findings record states for each whether it was the cause or had no effect, with the negative control that shows it, and item 1 is marked resolved (ADR-0008, docs/templates-docs/authorization-server-template.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-599",
        "AIFACTORY-TASK-1134",
        "AIFACTORY-TASK-1135",
        "AIFACTORY-TASK-1136"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1403,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015",
          "ADR-0023"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-244",
        "AIFACTORY-US-245"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-246]",
      "number": 246
    },
    {
      "id": "AIFACTORY-TASK-599",
      "type": "task",
      "parent": "AIFACTORY-US-246",
      "title": "RFC 8693 token exchange with the act claim",
      "sequence": "18.14.03.01",
      "description": "BEFORE DEVELOPMENT. RFC 8693 token exchange with the act claim. Expected output: A token exchange with an actor token issues a token whose act claim names the actor and whose scope is no wider than the delegated one; the quarantined acceptance scenario of the template runs unchanged and passes; the two leads of the findings page (ActorTokenTypes, handler order set at registration) are confirmed or ruled out in the record.. Kind: implementation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A token exchange with an actor token issues a token whose act claim names the actor and whose scope is no wider than the delegated one; the quarantined acceptance scenario of the template runs unchanged and passes; the two leads of the findings page (ActorTokenTypes, handler order set at registration) are confirmed or ruled out in the record."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-599]",
      "number": 599
    },
    {
      "id": "AIFACTORY-TASK-1134",
      "type": "task",
      "parent": "AIFACTORY-US-246",
      "title": "Token exchange acceptance scenarios for the restored case and the refusals",
      "sequence": "18.14.03.02",
      "description": "BEFORE DEVELOPMENT. Token exchange acceptance scenarios for the restored case and the refusals. Expected output: The token-exchange feature of the acceptance suite runs the formerly quarantined scenario without its quarantine tag and holds scenarios for a wider scope, a missing, an expired and a foreign actor token and a client without the exchange permission, each with a negative control.. Kind: fixture. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The token-exchange feature of the acceptance suite runs the formerly quarantined scenario without its quarantine tag and holds scenarios for a wider scope, a missing, an expired and a foreign actor token and a client without the exchange permission, each with a negative control."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1403,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1134]",
      "number": 1134
    },
    {
      "id": "AIFACTORY-TASK-1135",
      "type": "task",
      "parent": "AIFACTORY-US-246",
      "title": "Findings record of the two leads and the three calls",
      "sequence": "18.14.03.03",
      "description": "BEFORE DEVELOPMENT. Findings record of the two leads and the three calls. Expected output: Item 1 of Docs/Consumer-Reported-Findings.md of the template states for the actor token types option, the handler order and the scope, audience and resource calls whether each was the cause or had no effect, with the test that shows it, and is marked resolved.. Kind: documentation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: item 1 is marked resolved with its evidence.",
      "acceptanceCriteria": [
        "Item 1 of Docs/Consumer-Reported-Findings.md of the template states for the actor token types option, the handler order and the scope, audience and resource calls whether each was the cause or had no effect, with the test that shows it, and is marked resolved."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1403,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1135]",
      "number": 1135
    },
    {
      "id": "AIFACTORY-TASK-1136",
      "type": "task",
      "parent": "AIFACTORY-US-246",
      "title": "Verify the actor claim and the refusals in the full acceptance run",
      "sequence": "18.14.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the actor claim and the refusals in the full acceptance run. Expected output: Run the full acceptance suite through the shared application steps; the restored scenario and the refusal scenarios pass and the report is complete, which proves AC1 to AC4 of AIFACTORY-US-246 (ADR-0023).. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "Run the full acceptance suite through the shared application steps; the restored scenario and the refusal scenarios pass and the report is complete, which proves AC1 to AC4 of AIFACTORY-US-246 (ADR-0023)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1136]",
      "number": 1136
    },
    {
      "id": "AIFACTORY-US-1506",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: a permitted workload client exchanges its token for a short-lived token bound to registered claim values, the token of an attempt of the Factory",
      "sequence": "18.14.04",
      "description": "As an asset maintainer, I want the authorization server to issue a short-lived token bound to a run, a step and an attempt by a token exchange, so that a model call of an attempt is recognised as run-bound by the gateway and the router without any other service minting a token. Decision D125 settles how a run-bound call of the OpenAI-compatible route of the model gateway is recognised: it presents the token of an attempt. RunControlService hands that token out in the required member `attemptToken` of the lease answer `lease-v1` (docs/reference/schemas/attempt-outcome.schema.json), and the token names the run, the step and the attempt in the claims `run_id`, `step_id` and `attempt_id` beside the tenant claim `tid`. The Authorization Server is the sole token issuer of the Factory (ADR-0101), so no service mints the token itself: RunControlService obtains it by a token exchange that it makes with its own workload identity when it grants the lease, and the token lives no longer than the lease. This PBI delivers that exchange in the template. The template already performs the exchange with an actor token for a delegation (AIFACTORY-US-246); the bound exchange is a second kind of the same grant, kept apart from the delegation by its registration. The registration data that make a generated server the authorization server of the Factory gain a fourth file beside the scope, workload and public client registration files of AIFACTORY-US-244, AIFACTORY-US-245 and AIFACTORY-US-526, the bound exchange registration file. An entry names the workload client permitted to exchange, the claim names the issued token carries and whose values the request supplies, the one audience of the issued token and the maximum lifetime. The template names no client, claim or audience of the Factory in code. The Factory seeds one entry: the client of RunControlService, the claims `run_id`, `step_id` and `attempt_id`, the tenant claim `tid`, and the audience of the gateway on which a run-bound call is made, the model gateway. The permitted client presents its own workload token as subject token, the values of the registered claims and the lifetime it asks for, the lifetime of the lease it grants. The issued access token has the client as its subject, carries exactly the registered claims with the values of the request and the one audience of the entry, holds no `svc.` scope and no role claim, and expires at the lower of the requested lifetime and the maximum of the entry. Refusals are the standard errors of the grant and no token is issued: a client without an entry, a missing value of a registered claim, a claim the entry does not name, another audience than the one of the entry, and a lifetime above the maximum. An entry that names a user scope, an `svc.` scope or no claim fails the seed with the entry named. The exchange writes no token value to a log, an activity or a metric, and the claims contract page of the template documents the kind with its registration file. Kind: enabling. Traces: descriptors: lease-v1; adrs: ADR-0008, ADR-0015, ADR-0019, ADR-0023. Depends on: AIFACTORY-US-244, AIFACTORY-US-245, AIFACTORY-US-246. Sources: model/components.yaml, docs/reference/schemas/attempt-outcome.schema.json, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0008-openiddict-identity.md, docs/templates-docs/authorization-server-template.md.",
      "acceptanceCriteria": [
        "AC1: Given a bound exchange registration file with one entry for a workload client, three bound claims, the tenant claim, one audience and a maximum lifetime, when the server is seeded and that client presents its workload token with the values of the claims and a lifetime below the maximum, then the issued access token has the client as its subject, carries exactly the registered claims with the values of the request, the one audience of the entry and no `svc.` scope and no role claim, and expires at the requested lifetime (ADR-0015, docs/reference/schemas/attempt-outcome.schema.json).",
        "AC2: Given the same entry, when a client without an entry asks for the exchange, a registered claim has no value, the request names a claim the entry does not hold, another audience or a lifetime above the maximum, then each request is refused with the standard error of the grant and no token is issued; an entry that names a user scope, an `svc.` scope or no claim fails the seed with the entry named (ADR-0008, ADR-0015).",
        "AC3: Given the exchange with an actor token of AIFACTORY-US-246 and the bound exchange in one generated server, when both are requested, then each issues the token of its own kind, a delegation never carries the bound claims and a bound token never carries an `act` claim, and no token value appears in a log line, an activity or a metric of the server (ADR-0023 decision 4, ADR-0019).",
        "AC4: Given the claims contract page of the template, when the contract test compares it with a seeded server, then the page names the bound exchange registration file, its fields and the claims and the audience of the issued token, and a difference fails the test (ADR-0008, docs/templates-docs/authorization-server-template.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-6134",
        "AIFACTORY-TASK-6135",
        "AIFACTORY-TASK-6136",
        "AIFACTORY-TASK-6137",
        "AIFACTORY-TASK-6138"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1404,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "lease-v1"
        ],
        "adrs": [
          "ADR-0008",
          "ADR-0015",
          "ADR-0019",
          "ADR-0023"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-244",
        "AIFACTORY-US-245",
        "AIFACTORY-US-246"
      ],
      "source": [
        "model/components.yaml",
        "docs/reference/schemas/attempt-outcome.schema.json",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1506]",
      "number": 1506
    },
    {
      "id": "AIFACTORY-TASK-6134",
      "type": "task",
      "parent": "AIFACTORY-US-1506",
      "title": "Bound exchange registration file and its seed",
      "sequence": "18.14.04.01",
      "description": "BEFORE DEVELOPMENT. Bound exchange registration file and its seed. Expected output: The template holds the schema of a bound exchange registration file with the permitted workload client, the bound claim names, the one audience and the maximum lifetime, and the migration seeds one exchange permission per entry; an entry that names a user scope, an `svc.` scope or no claim fails the seed with the entry named; the template names no client, claim or audience of the Factory in code.. Kind: contract. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "The template holds the schema of a bound exchange registration file with the permitted workload client, the bound claim names, the one audience and the maximum lifetime, and the migration seeds one exchange permission per entry; an entry that names a user scope, an `svc.` scope or no claim fails the seed with the entry named; the template names no client, claim or audience of the Factory in code."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1404,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-6134]",
      "number": 6134
    },
    {
      "id": "AIFACTORY-TASK-6135",
      "type": "task",
      "parent": "AIFACTORY-US-1506",
      "title": "Bound token exchange that issues a short-lived token with the registered claim values",
      "sequence": "18.14.04.02",
      "description": "BEFORE DEVELOPMENT. Bound token exchange that issues a short-lived token with the registered claim values. Expected output: The token-exchange endpoint serves the bound kind beside the delegation of AIFACTORY-TASK-599: for a permitted client presenting its workload token it issues an access token with the client as subject, exactly the registered claims with the values of the request, the one audience of the entry and an expiry at the lower of the requested lifetime and the maximum; every other request is refused with the standard error and no token value is logged.. Kind: implementation. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "The token-exchange endpoint serves the bound kind beside the delegation of AIFACTORY-TASK-599: for a permitted client presenting its workload token it issues an access token with the client as subject, exactly the registered claims with the values of the request, the one audience of the entry and an expiry at the lower of the requested lifetime and the maximum; every other request is refused with the standard error and no token value is logged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-6135]",
      "number": 6135
    },
    {
      "id": "AIFACTORY-TASK-6136",
      "type": "task",
      "parent": "AIFACTORY-US-1506",
      "title": "Acceptance scenarios of the bound exchange and its refusals",
      "sequence": "18.14.04.03",
      "description": "BEFORE DEVELOPMENT. Acceptance scenarios of the bound exchange and its refusals. Expected output: The token-exchange feature of the acceptance suite holds scenarios for a bound exchange with a seeded entry, a client without an entry, a missing claim value, a claim outside the entry, another audience, a lifetime above the maximum and a faulty entry in the seed, each with a negative control, and a scenario that holds a delegation and a bound token apart.. Kind: fixture. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "The token-exchange feature of the acceptance suite holds scenarios for a bound exchange with a seeded entry, a client without an entry, a missing claim value, a claim outside the entry, another audience, a lifetime above the maximum and a faulty entry in the seed, each with a negative control, and a scenario that holds a delegation and a bound token apart."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1404,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-6136]",
      "number": 6136
    },
    {
      "id": "AIFACTORY-TASK-6137",
      "type": "task",
      "parent": "AIFACTORY-US-1506",
      "title": "Bound exchange on the claims contract page",
      "sequence": "18.14.04.04",
      "description": "BEFORE DEVELOPMENT. Bound exchange on the claims contract page. Expected output: Docs/Claims-and-Token-Contract.md of the template names the bound exchange registration file, its fields, the claims, the audience and the lifetime rule of the issued token, and the contract test of the acceptance suite fails when a seeded server and the page differ.. Kind: documentation. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "Docs/Claims-and-Token-Contract.md of the template names the bound exchange registration file, its fields, the claims, the audience and the lifetime rule of the issued token, and the contract test of the acceptance suite fails when a seeded server and the page differ."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1404,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-6137]",
      "number": 6137
    },
    {
      "id": "AIFACTORY-TASK-6138",
      "type": "task",
      "parent": "AIFACTORY-US-1506",
      "title": "Verify the bound exchange in the full acceptance run",
      "sequence": "18.14.04.05",
      "description": "BEFORE DEVELOPMENT. Verify the bound exchange in the full acceptance run. Expected output: Run the full acceptance suite through the shared application steps; the bound exchange, its refusals, the faulty seed entry, the separation from the delegation and the contract test pass and the report is complete, which proves AC1 to AC4 of AIFACTORY-US-1506 (ADR-0008, ADR-0015).. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "Run the full acceptance suite through the shared application steps; the bound exchange, its refusals, the faulty seed entry, the separation from the delegation and the contract test pass and the report is complete, which proves AC1 to AC4 of AIFACTORY-US-1506 (ADR-0008, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-6138]",
      "number": 6138
    },
    {
      "id": "AIFACTORY-US-247",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: the hosted run of the shared application steps is complete, the legacy local runner copies are removed, and a Scripts check keeps the Scripts folder current",
      "sequence": "18.14.05",
      "description": "As an asset maintainer, I want the green result of the authorization server template to mean a complete run by the one shared implementation, on current scripts, so that a token contract that passes its suite has passed every scenario of it. Item 5 of the findings page of the template (Docs/Consumer-Reported-Findings.md of the template) describes how the acceptance suite of the template was cut off by the test session timeout while the run printed a pass, and names as the stronger repair a runner that compares the discovery list with what executed. The item is older than the pages that record what the template has done since. `build/Invoke-AuthServerTests.ps1` checks completeness for each assembly and `build/Test-AuthServerTestResults.ps1` validates the result files; `azure-pipelines.yml` imports `template-ci/v1/application-steps.yml` of the shared template pipeline tooling; the installer verification page (Docs/Installer-Verification.md of the template) requires generated test discovery and completion checks for every case; and the shared pipeline page (Docs/Shared-Template-CI.md of the template) records two runs with matching discovery and result totals. What is open is narrower. The rollout ledger of the shared tooling (`template-ci/rollout-status.md` of ConnectSoft.AzurePipelines) records the template as passed on the local Domain gate with the normal, service and hosted gates open, and the shared pipeline page keeps the legacy local helpers temporarily, for review and rollback, until equivalent hosted verification has passed. Item 7 is a real gap: the root Scripts folder holds 14 files against 35 in the base template, without the observability toolkit and the dashboards, and a hand copy would only add a second copy that drifts. This PBI closes what remains. The hosted run of the shared application steps passes with complete unit, architecture and acceptance reports, and a synthetic truncated report is rejected by the shared validator. Once that hosted gate has passed, the legacy local runner copies are removed, so that one implementation remains, in the shared tooling. The base-template submodule pointer moves to the base template state the findings feature publishes, and `build/MaterializedDirectory.Packages.props` is regenerated with the write mode of `build/Sync-MaterializedPackages.ps1`. The Scripts check of item 7 runs in check mode beside that package snapshot check and fails with the missing or changed files named. Items 5 and 7 of the findings page are updated with this evidence. Kind: enabling. Traces: adrs: ADR-0008; requirements: FR-11. Depends on: feature:component-base-template-findings. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0008-openiddict-identity.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the template on a hosted agent, when the unit, architecture and acceptance suites run through the shared application steps, then the three reports are complete with matching discovery and result totals, a synthetic truncated report is rejected by the validator of the shared tooling, and a run that executes fewer tests than were discovered fails the stage with the missing tests named (FR-11; item 5 of Docs/Consumer-Reported-Findings.md of the template; ADR-0008).",
        "AC2: Given the hosted gate has passed, when the template repository is searched, then the legacy local runner copies `build/Invoke-AuthServerTests.ps1` and `build/Test-AuthServerTestResults.ps1` with their self-test are removed, the documentation names the shared entry point for local runs, and one implementation of the completeness check remains, in the shared tooling (FR-11, model/components.yaml).",
        "AC3: Given the root Scripts folder of the template, when the Scripts check runs in check mode in the pipeline beside the package snapshot check and the folder differs from the Scripts folder of the base-template submodule, then the stage fails with the missing and the changed files named, and after the write mode has written the folder the check passes and the observability toolkit and dashboards are present (FR-11, docs/architecture/ecosystem-composition.md).",
        "AC4: Given the base-template submodule pointer moved to the base template state of the findings feature, when `build/Sync-MaterializedPackages.ps1` runs in check mode, then `build/MaterializedDirectory.Packages.props` matches, and items 5 and 7 of the findings page name the hosted run, the removed copies and the Scripts check as their evidence and are marked resolved (ADR-0008, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0008-openiddict-identity.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-600",
        "AIFACTORY-TASK-1137",
        "AIFACTORY-TASK-1174",
        "AIFACTORY-TASK-1138",
        "AIFACTORY-TASK-1139"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1405,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0008-openiddict-identity.md"
      ],
      "titlePrefix": "[AIFACTORY-US-247]",
      "number": 247
    },
    {
      "id": "AIFACTORY-TASK-600",
      "type": "task",
      "parent": "AIFACTORY-US-247",
      "title": "Test-run completeness check and Scripts sync guard",
      "sequence": "18.14.05.01",
      "description": "BEFORE DEVELOPMENT. Test-run completeness check and Scripts sync guard. Expected output: The hosted pipeline run shows the three suites complete through the shared application steps, red on a synthetic truncated report and red on a drifted Scripts folder, so a session timeout can no longer report a green incomplete run and the observability toolkit and dashboards stay in step with the base template without a second copy, which proves AC1 to AC4 of AIFACTORY-US-247.. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: azure-pipelines.yml runs the shared application steps and the Scripts check on a hosted agent; the run is green.",
      "acceptanceCriteria": [
        "The hosted pipeline run shows the three suites complete through the shared application steps, red on a synthetic truncated report and red on a drifted Scripts folder, so a session timeout can no longer report a green incomplete run and the observability toolkit and dashboards stay in step with the base template without a second copy, which proves AC1 to AC4 of AIFACTORY-US-247."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-600]",
      "number": 600
    },
    {
      "id": "AIFACTORY-TASK-1137",
      "type": "task",
      "parent": "AIFACTORY-US-247",
      "title": "Legacy local runner copies removed after the hosted gate",
      "sequence": "18.14.05.02",
      "description": "BEFORE DEVELOPMENT. Legacy local runner copies removed after the hosted gate. Expected output: After the hosted run of the shared application steps has passed, `build/Invoke-AuthServerTests.ps1`, `build/Test-AuthServerTestResults.ps1` and `build/Test-AuthServerTestResults.SelfTest.ps1` are removed, no pipeline or documentation page refers to them, the testing page names the shared entry point for local runs, and the shared pipeline page no longer lists them as kept for rollback.. Kind: implementation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: a search of the repository finds no reference to the removed scripts and the hosted run is green.",
      "acceptanceCriteria": [
        "After the hosted run of the shared application steps has passed, `build/Invoke-AuthServerTests.ps1`, `build/Test-AuthServerTestResults.ps1` and `build/Test-AuthServerTestResults.SelfTest.ps1` are removed, no pipeline or documentation page refers to them, the testing page names the shared entry point for local runs, and the shared pipeline page no longer lists them as kept for rollback."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1137]",
      "number": 1137
    },
    {
      "id": "AIFACTORY-TASK-1174",
      "type": "task",
      "parent": "AIFACTORY-US-247",
      "title": "Base-template submodule pointer moved and the materialized package snapshot regenerated",
      "sequence": "18.14.05.03",
      "description": "BEFORE DEVELOPMENT. Base-template submodule pointer moved and the materialized package snapshot regenerated. Expected output: The `base-template` submodule of the template points at the base template state the feature component-base-template-findings publishes, `build/MaterializedDirectory.Packages.props` is regenerated by `build/Sync-MaterializedPackages.ps1` with `-Write`, and the same script passes in check mode; no file inside the submodule is edited.. Kind: operations. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: build/Sync-MaterializedPackages.ps1 passes in check mode and the authoring solution builds in Release.",
      "acceptanceCriteria": [
        "The `base-template` submodule of the template points at the base template state the feature component-base-template-findings publishes, `build/MaterializedDirectory.Packages.props` is regenerated by `build/Sync-MaterializedPackages.ps1` with `-Write`, and the same script passes in check mode; no file inside the submodule is edited."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1405,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1174]",
      "number": 1174
    },
    {
      "id": "AIFACTORY-TASK-1138",
      "type": "task",
      "parent": "AIFACTORY-US-247",
      "title": "Scripts folder written from the base template and checked in the pipeline",
      "sequence": "18.14.05.04",
      "description": "BEFORE DEVELOPMENT. Scripts folder written from the base template and checked in the pipeline. Expected output: The manifest of the template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside `build/Sync-MaterializedPackages.ps1` and fails on drift with the files named.. Kind: operations. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: azure-pipelines.yml runs the Scripts check and a removed file fails it.",
      "acceptanceCriteria": [
        "The manifest of the template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside `build/Sync-MaterializedPackages.ps1` and fails on drift with the files named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1405,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1138]",
      "number": 1138
    },
    {
      "id": "AIFACTORY-TASK-1139",
      "type": "task",
      "parent": "AIFACTORY-US-247",
      "title": "Items 5 and 7 of the findings page updated with the hosted evidence",
      "sequence": "18.14.05.05",
      "description": "BEFORE DEVELOPMENT. Items 5 and 7 of the findings page updated with the hosted evidence. Expected output: Item 5 of Docs/Consumer-Reported-Findings.md of the template names the hosted run with its discovery and result totals, the rejected synthetic truncated report and the removal of the local runner copies; item 7 names the Scripts check and its first green and first red run; both are marked resolved, and the rollout ledger entry of the template is quoted with its hosted gate passed.. Kind: documentation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: items 5 and 7 are marked resolved with their evidence.",
      "acceptanceCriteria": [
        "Item 5 of Docs/Consumer-Reported-Findings.md of the template names the hosted run with its discovery and result totals, the rejected synthetic truncated report and the removal of the local runner copies; item 7 names the Scripts check and its first green and first red run; both are marked resolved, and the rollout ledger entry of the template is quoted with its hosted gate passed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1405,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1139]",
      "number": 1139
    },
    {
      "id": "AIFACTORY-US-526",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: the registration data seed a public client without a secret that signs in by the authorization code flow with PKCE and by the device code flow",
      "sequence": "18.14.06",
      "description": "As an asset maintainer, I want the authorization server to register a public client with the two sign-in flows from registration data, so that the command-line client of the Factory signs a person in with or without a browser and holds no client secret. The amendment of ADR-0015 on the client sign-in (decision D117) makes the command-line client of the Factory a public client: it signs in with the authorization code flow with PKCE by default and with the device code flow when a switch asks for it, on a machine without a browser. The template implements both flows already. Its flow pages (the Docs/Flows folder of the template) record the authorization code flow with PKCE with its acceptance scenarios and the device authorization flow of RFC 8628 as implemented, and name a command-line tool among the uses of the device flow. What the Factory lacks is the registration of its client. The registration data that make a generated server the authorization server of the Factory are the scope registration file of AIFACTORY-US-244 and the workload registration file of AIFACTORY-US-245, and neither registers a client without a secret that may use these two flows for Factory scopes. This PBI adds a third file to them, the public client registration file. An entry names the client identifier, the flows the client may use out of authorization code with PKCE and device code, whether it may renew its token with a refresh token, its loopback redirect addresses for the authorization code flow and the Factory scopes it may request. The seed registers one public client per entry: without a secret, with a proof key required for the code exchange, and with the permissions of the endpoints and grant types of the named flows and of nothing else. The template holds no client name in code; the Factory seeds one entry, the command-line client, with the scopes of the control plane gateway that the service files of the model name and the scopes `factory.recipes.read` and `factory.recipes.approve` of the template catalog gateway, which fronts GenerationRecipeService (decision D123). The audience follows the rule of AIFACTORY-US-244 unchanged: the token has the one audience of the gateway that fronts its granted scopes, and a request for scopes of two gateways is refused, so the command-line client requests the scopes of each gateway as a separate token, one per audience. The refusals are the standard ones. An authorization request of the public client without a code challenge is refused, as is a code exchange with a wrong verifier. A token request that presents a client secret for the public client, a client credentials request by it and a request for a scope its entry does not hold, an `svc.` scope included, are refused. A device code that the person denied, that expired or that is polled faster than the interval allows is answered with the standard errors of the device flow and no token. An entry that names a secret, a flow outside the two, a redirect address that is not a loopback address or an `svc.` scope fails the seed with the entry named. A token obtained by either flow carries the claims as AIFACTORY-US-244 issues them: the tenant, the role claims per project and the granted scopes. The claims contract page and the deployment checklist of the template name the public client registration and state that a public client holds no credential an operator replaces. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015; requirements: FR-01. Depends on: AIFACTORY-US-244, AIFACTORY-US-245. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0008-openiddict-identity.md, docs/templates-docs/authorization-server-template.md.",
      "acceptanceCriteria": [
        "AC1: Given a public client registration file with one entry that names both flows, a loopback redirect address and scopes of one gateway, when the server is seeded, then one public client exists without a secret, with a proof key required for the code exchange and with the permissions of the authorization code grant, the device code grant and, where the entry allows it, the refresh token grant and of no other grant; an entry that names a secret, another flow, a redirect address that is not a loopback address or an `svc.` scope fails the seed with the entry named (ADR-0015 amendment on the client sign-in, ADR-0008).",
        "AC2: Given the seeded public client and a member with role assignments, when the client completes the authorization code flow with PKCE, then the issued access token carries the tenant claim, the role claims and the granted Factory scopes with the one audience of the gateway that fronts them; an authorization request without a code challenge, a code exchange with a wrong verifier and a token request that presents a client secret are each refused with the standard error and no token is issued (ADR-0015 amendments on the client sign-in and on the one audience of a user token, FR-01).",
        "AC3: Given the same client, when it starts the device code flow and the member confirms the user code at the verification address, then the token request that polls at the given interval is answered with a token of the same claims and the same one audience; a code the member denied, an expired code and a poll faster than the interval allows are answered with the standard errors of the device flow and no token is issued (ADR-0015 amendment on the client sign-in, ADR-0008).",
        "AC4: Given the seeded public client, when it requests a token by client credentials, a scope its entry does not hold or an `svc.` scope, then the request is refused with the standard error; and the claims contract page of the template names the public client registration with its two flows, which the contract test compares with a seeded server (ADR-0008, docs/templates-docs/authorization-server-template.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-2115",
        "AIFACTORY-TASK-2116",
        "AIFACTORY-TASK-2117",
        "AIFACTORY-TASK-2118"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1406,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-244",
        "AIFACTORY-US-245"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-526]",
      "number": 526
    },
    {
      "id": "AIFACTORY-TASK-2115",
      "type": "task",
      "parent": "AIFACTORY-US-526",
      "title": "Public client registration file and its seed",
      "sequence": "18.14.06.01",
      "description": "BEFORE DEVELOPMENT. Public client registration file and its seed. Expected output: The template holds the schema of a public client registration file with client identifier, the flows out of authorization code with PKCE and device code, the refresh token permission, the loopback redirect addresses and the Factory scopes, and the migration seeds one public client per entry without a secret, with a proof key required and with the permissions of the named flows only; an entry with a secret, a flow outside the two, a redirect address that is not a loopback address, an `svc.` scope or a scope that is not registered fails the seed with the entry named; the template names no client in code.. Kind: contract. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template holds the schema of a public client registration file with client identifier, the flows out of authorization code with PKCE and device code, the refresh token permission, the loopback redirect addresses and the Factory scopes, and the migration seeds one public client per entry without a secret, with a proof key required and with the permissions of the named flows only; an entry with a secret, a flow outside the two, a redirect address that is not a loopback address, an `svc.` scope or a scope that is not registered fails the seed with the entry named; the template names no client in code."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1406,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-2115]",
      "number": 2115
    },
    {
      "id": "AIFACTORY-TASK-2116",
      "type": "task",
      "parent": "AIFACTORY-US-526",
      "title": "Acceptance scenarios of the seeded public client for both flows and their refusals",
      "sequence": "18.14.06.02",
      "description": "BEFORE DEVELOPMENT. Acceptance scenarios of the seeded public client for both flows and their refusals. Expected output: The acceptance suite of the template holds scenarios for the seeded public client: the authorization code flow with PKCE to a token with the Factory claims and one audience, the device code flow with a confirmed, a denied and an expired code and a poll faster than the interval, and the refusals of a request without a code challenge, a wrong verifier, a presented client secret, a client credentials request and a scope outside the entry, each with a negative control.. Kind: fixture. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The acceptance suite of the template holds scenarios for the seeded public client: the authorization code flow with PKCE to a token with the Factory claims and one audience, the device code flow with a confirmed, a denied and an expired code and a poll faster than the interval, and the refusals of a request without a code challenge, a wrong verifier, a presented client secret, a client credentials request and a scope outside the entry, each with a negative control."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1406,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-2116]",
      "number": 2116
    },
    {
      "id": "AIFACTORY-TASK-2117",
      "type": "task",
      "parent": "AIFACTORY-US-526",
      "title": "Public client registration on the claims contract page and the deployment checklist",
      "sequence": "18.14.06.03",
      "description": "BEFORE DEVELOPMENT. Public client registration on the claims contract page and the deployment checklist. Expected output: Docs/Claims-and-Token-Contract.md of the template names the public client registration file, the two flows a public client may use and the claims and the one audience of its token, the deployment checklist states that a public client holds no credential an operator replaces, and the contract test of the acceptance suite fails when a seeded public client and the page differ.. Kind: documentation. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Docs/Claims-and-Token-Contract.md of the template names the public client registration file, the two flows a public client may use and the claims and the one audience of its token, the deployment checklist states that a public client holds no credential an operator replaces, and the contract test of the acceptance suite fails when a seeded public client and the page differ."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1406,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-2117]",
      "number": 2117
    },
    {
      "id": "AIFACTORY-TASK-2118",
      "type": "task",
      "parent": "AIFACTORY-US-526",
      "title": "Verify the public client by both flows and by its refusals",
      "sequence": "18.14.06.04",
      "description": "BEFORE DEVELOPMENT. Verify the public client by both flows and by its refusals. Expected output: Run the acceptance scenarios of the seeded public client for the authorization code flow with PKCE, the device code flow with a confirmed, a denied and an expired code, a request without a code challenge, a presented client secret, a client credentials request and a scope outside the entry, and the seed with a faulty entry; the tokens and the refusals are as stated, which proves AC1 to AC4 of AIFACTORY-US-526 (ADR-0015, ADR-0008).. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "Run the acceptance scenarios of the seeded public client for the authorization code flow with PKCE, the device code flow with a confirmed, a denied and an expired code, a request without a code challenge, a presented client secret, a client credentials request and a scope outside the entry, and the seed with a faulty entry; the tokens and the refusals are as stated, which proves AC1 to AC4 of AIFACTORY-US-526 (ADR-0015, ADR-0008)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1406,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-2118]",
      "number": 2118
    },
    {
      "id": "AIFACTORY-US-248",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: the Factory token contract passes the full suites of the authoring pipeline and the Domain cases of the installer pipeline before the package publishes",
      "sequence": "18.14.07",
      "description": "As an asset maintainer, I want the Factory token contract to be proven by the two pipelines the template has, so that the sole token issuer of the Factory is scaffolded from a package whose token scenarios all ran and passed. The installer verification page of the template (Docs/Installer-Verification.md of the template) states how the template gates itself. The template pipeline is the import of the shared installer jobs with the cases of `build/template-ci.json`: the Domain cases run generated unit and contract tests with local test doubles and not live endpoint or database acceptance tests, the authoring pipeline retains responsibility for full application acceptance, and publication already requires complete reports bound to the candidate hash and a credential check of the candidate. This PBI is the proof of the feature in those two pipelines as they are. The authoring pipeline runs the full unit, architecture and acceptance suites with the Factory claims, workload identity, public client sign-in and token exchange scenarios through the shared application steps. The installer pipeline generates the Domain cases, whose test filter in the manifest gains contract-level tests of the Factory claims, the workload registration, the public client registration and the exchange with the actor claim, and audits each case, which is clean only on a base template whose findings are closed. Item 2 of the findings page records that the package once held a developer-local folder and that the pipeline, which packs a fresh clone, would not notice such content on its own. The package protection check of the shared tooling is the place that refuses such a candidate. ConnectSoft.AzurePipelines is a before-development repository (D114), so the extension of `Protect-TemplatePackage.ps1` to developer-local folders is a task of this PBI in that repository; the template proves the refusal with a planted folder and adds no content check of its own. A stage that fails stops the run with the stage named and the package is not published. Publication requires the reports of both pipelines and pushes a version that is not yet on the ConnectSoft feed. The PBI proves ADR-0008 and decision 4 of ADR-0023 on the template and the release gate of FR-11. Kind: evidence. Traces: adrs: ADR-0008, ADR-0015, ADR-0023; requirements: FR-11. Depends on: AIFACTORY-US-244, AIFACTORY-US-245, AIFACTORY-US-246, AIFACTORY-US-247, AIFACTORY-US-526, AIFACTORY-US-1506, feature:component-base-template-findings. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0008-openiddict-identity.md, docs/architecture/adr/0023-a2a-interoperability.md, model/template-parameters/connectsoft-authorization-server.yaml, docs/architecture/catalogs/templates.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the authorization server template, when its authoring pipeline runs, then the full unit, architecture and acceptance suites run with the Factory claims, workload identity, public client sign-in, token exchange and bound exchange scenarios of AIFACTORY-US-1506 through the shared application steps and their reports are complete (ADR-0008, ADR-0023 decision 4, FR-11).",
        "AC2: Given the same change, when the installer pipeline runs the shared installer jobs, then it generates the Domain cases of `build/template-ci.json`, whose test filter holds contract-level tests of the Factory claims, the workload registration, the public client registration and the exchange with the actor claim, restores and builds each case in Release, runs the filtered tests with the discovery and completion checks and audits each case (ADR-0008, ADR-0015, FR-11).",
        "AC3: Given a failing scenario, an incomplete report, an audit finding or a candidate that holds a developer-local folder, when the pipelines evaluate the run, then the run fails with the stage named and the package is not published; a planted failing token exchange scenario and a planted developer-local folder prove the refusals (FR-11, docs/architecture/ecosystem-composition.md).",
        "AC4: Given complete reports of both pipelines bound to the candidate hash, when the publication job runs, then the package is pushed with a version that was not on the feed, and a fresh install of that version generates the Domain cases whose contract tests of the Factory claims, the workload registration, the public client registration and the exchange with the `act` claim pass unchanged (ADR-0008, ADR-0015, ADR-0023, model/template-parameters/connectsoft-authorization-server.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "model/template-parameters/connectsoft-authorization-server.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1140",
        "AIFACTORY-TASK-1463",
        "AIFACTORY-TASK-1141",
        "AIFACTORY-TASK-1142"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1407,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015",
          "ADR-0023"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-244",
        "AIFACTORY-US-245",
        "AIFACTORY-US-246",
        "AIFACTORY-US-247",
        "AIFACTORY-US-526",
        "AIFACTORY-US-1506",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0008-openiddict-identity.md",
        "docs/architecture/adr/0023-a2a-interoperability.md",
        "model/template-parameters/connectsoft-authorization-server.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-248]",
      "number": 248
    },
    {
      "id": "AIFACTORY-TASK-1140",
      "type": "task",
      "parent": "AIFACTORY-US-248",
      "title": "Factory token contract tests in the test filter of the Domain cases",
      "sequence": "18.14.07.01",
      "description": "BEFORE DEVELOPMENT. Factory token contract tests in the test filter of the Domain cases. Expected output: The generated test projects hold contract-level tests of the Factory claims, the workload registration, the public client registration and the token exchange with the actor claim that run with local test doubles, and the test filter of each Domain case in `build/template-ci.json` selects them; the Factory claims, workload identity, public client sign-in and token exchange acceptance scenarios stay in the authoring pipeline and run through the shared application steps; the template pipeline gains no stage of its own.. Kind: operations. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: the manifest validation of the shared tooling passes and the Domain cases run the new tests.",
      "acceptanceCriteria": [
        "The generated test projects hold contract-level tests of the Factory claims, the workload registration, the public client registration and the token exchange with the actor claim that run with local test doubles, and the test filter of each Domain case in `build/template-ci.json` selects them; the Factory claims, workload identity, public client sign-in and token exchange acceptance scenarios stay in the authoring pipeline and run through the shared application steps; the template pipeline gains no stage of its own."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1407,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1140]",
      "number": 1140
    },
    {
      "id": "AIFACTORY-TASK-1463",
      "type": "task",
      "parent": "AIFACTORY-US-248",
      "title": "Package protection check of the shared tooling extended to developer-local folders",
      "sequence": "18.14.07.02",
      "description": "BEFORE DEVELOPMENT. Package protection check of the shared tooling extended to developer-local folders. Expected output: `Protect-TemplatePackage.ps1` of `template-ci/v1` refuses a candidate that holds a developer-local folder, such as an assistant worktree folder or an editor settings folder, with the entry named, beside the package source credentials it refuses today; `Test-TemplatePackageProtection.SelfTest.ps1` covers a candidate with a planted local folder that is refused and a clean candidate that is accepted.. Kind: implementation. Repository: ConnectSoft.AzurePipelines. Verification: Test-TemplatePackageProtection.SelfTest.ps1 refuses the planted local folder and accepts the clean candidate.",
      "acceptanceCriteria": [
        "`Protect-TemplatePackage.ps1` of `template-ci/v1` refuses a candidate that holds a developer-local folder, such as an assistant worktree folder or an editor settings folder, with the entry named, beside the package source credentials it refuses today; `Test-TemplatePackageProtection.SelfTest.ps1` covers a candidate with a planted local folder that is refused and a clean candidate that is accepted."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1407,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1463]",
      "number": 1463
    },
    {
      "id": "AIFACTORY-TASK-1141",
      "type": "task",
      "parent": "AIFACTORY-US-248",
      "title": "Planted developer-local folder refused by the package protection check",
      "sequence": "18.14.07.03",
      "description": "BEFORE DEVELOPMENT. Planted developer-local folder refused by the package protection check. Expected output: A self-test of the template packs a candidate with a planted developer-local folder through the pack action of the shared tooling and asserts that the package protection check refuses it and publication is not reached; the pack action runs at a tooling commit that carries the extension of AIFACTORY-TASK-1463.. Kind: fixture. Repository: ConnectSoft.AuthorizationServerTemplate. Verification: a candidate with a planted local folder is refused.",
      "acceptanceCriteria": [
        "A self-test of the template packs a candidate with a planted developer-local folder through the pack action of the shared tooling and asserts that the package protection check refuses it and publication is not reached; the pack action runs at a tooling commit that carries the extension of AIFACTORY-TASK-1463."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1407,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1141]",
      "number": 1141
    },
    {
      "id": "AIFACTORY-TASK-1142",
      "type": "task",
      "parent": "AIFACTORY-US-248",
      "title": "Verify the gate of the authorization server template on a green and a planted run",
      "sequence": "18.14.07.04",
      "description": "BEFORE DEVELOPMENT. Verify the gate of the authorization server template on a green and a planted run. Expected output: One green run of both pipelines publishes the package and a fresh install generates the Domain cases whose token contract tests pass; a run with a planted failing token exchange scenario stops before publication; both prove AC1 to AC4 of AIFACTORY-US-248 (ADR-0008, ADR-0023, FR-11).. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "One green run of both pipelines publishes the package and a fresh install generates the Domain cases whose token contract tests pass; a run with a planted failing token exchange scenario stops before publication; both prove AC1 to AC4 of AIFACTORY-US-248 (ADR-0008, ADR-0023, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1407,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1142]",
      "number": 1142
    },
    {
      "id": "AIFACTORY-US-108",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-162",
      "title": "Authorization server template: the Factory token contract, workload identity and delegation is delivered and proven on a generated solution",
      "sequence": "18.14.08",
      "description": "As an asset maintainer, I want Authorization Server to carry the Factory token contract, workload identity and delegation, so that it serves sole token issuer (ADR-0101) without later rework. This is the integration PBI of the feature. The authorization server is the sole token issuer of the Factory, and its template issues standard OpenID Connect tokens with tenant claims but not yet what a Factory call needs. With project-scoped role claims, registered scopes and the one audience of the gateway that fronts them in the issued tokens, one workload identity per service and agent host with `svc.` scopes and no audience of a user API, the public client of the command-line client with the authorization code flow with PKCE and the device code flow (AIFACTORY-US-526), the token exchange with its actor claim, the bound exchange that issues the token of an attempt to RunControlService (AIFACTORY-US-1506, decision D125), the complete hosted run with one completeness implementation and the Scripts check, and the gate of the two pipelines, the asset maintainer runs the pipelines end to end: the full suites in the authoring pipeline, then pack, install, generate the Domain cases, build, test and audit, then publish. A failing stage blocks publication. The migrated tasks sit under the PBIs that deliver them, and the verification task of this PBI is the proof on the published package. The feature is done when a server generated from the published package issues a Factory token, a token for the public client by each of its two flows, a workload token, an exchanged token and a bound token as the claims contract page documents them, and the open items of the findings page that the Factory needs are resolved. Kind: enabling. Traces: adrs: ADR-0008, ADR-0015, ADR-0023. Depends on: AIFACTORY-US-244, AIFACTORY-US-245, AIFACTORY-US-246, AIFACTORY-US-247, AIFACTORY-US-248, AIFACTORY-US-526, AIFACTORY-US-1506. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/templates-docs/authorization-server-template.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.AuthorizationServerTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution builds and its tests pass before the package publishes with a verified version (ADR-0008, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-597 (Factory claims, scopes and audiences in the issued tokens) is done, then an access token for a Factory client carries the tenant, the project-scoped role claims and the valid delegations read from the identity service, the registered Factory scopes and one audience, the resource of the gateway that fronts those scopes, a request that combines scopes of two gateways is refused, a token for one audience is rejected by another, and the claims contract page of the template documents every claim (ADR-0015 decision 6).",
        "AC3: Given the work of AIFACTORY-TASK-598 (workload identity for services and agents) is done, then a client-credentials client exists per Factory service and per agent host with its own secret or certificate and only its `svc.` service scopes, the seeded development secret is refused outside the Development environment, no two seeded clients share a secret, and the deployment checklist names the credential the operator replaces (ADR-0023 decision 4).",
        "AC4: Given the work of AIFACTORY-TASK-599 (RFC 8693 token exchange with the act claim) is done, then a token exchange with an actor token issues a token whose `act` claim names the actor and whose scope is no wider than the delegated one, the quarantined acceptance scenario of the template runs unchanged and passes, and the two leads of the findings page are confirmed or ruled out in the record (ADR-0023).",
        "AC5: Given the work of AIFACTORY-TASK-600 (test-run completeness check and Scripts sync guard) is done, then the hosted run compares the discovered tests with the executed ones through the shared application steps and fails on a difference, so a session timeout can no longer report a green incomplete run, the legacy local runner copies are removed, and a Scripts check in the pipeline keeps the observability toolkit and dashboards in step with the base template without a second copy (ADR-0008, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-671"
      ],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1408,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0008",
          "ADR-0015",
          "ADR-0023"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-244",
        "AIFACTORY-US-245",
        "AIFACTORY-US-246",
        "AIFACTORY-US-247",
        "AIFACTORY-US-248",
        "AIFACTORY-US-526",
        "AIFACTORY-US-1506"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/templates-docs/authorization-server-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-108]",
      "number": 108
    },
    {
      "id": "AIFACTORY-TASK-671",
      "type": "task",
      "parent": "AIFACTORY-US-108",
      "title": "Verify auth-server-template-factory-tokens-delivered by running the declared command",
      "sequence": "18.14.08.01",
      "description": "BEFORE DEVELOPMENT. Verify auth-server-template-factory-tokens-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the server generated from the published package; they pass with a complete run and prove AC1 to AC5 of AIFACTORY-US-108.. Kind: verification. Repository: ConnectSoft.AuthorizationServerTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the server generated from the published package; they pass with a complete run and prove AC1 to AC5 of AIFACTORY-US-108."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "ConnectSoft.AuthorizationServerTemplate/Docs/Consumer-Reported-Findings.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AuthorizationServerTemplate"
      ],
      "children": [],
      "buildOrder": 14,
      "phase": "templates-and-libraries",
      "stackRank": 1408,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-671]",
      "number": 671
    },
    {
      "id": "AIFACTORY-FEAT-163",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "SaaS Tenants template: descriptor, lifecycle, envelope and isolation before the Factory resolves tenants",
      "sequence": "18.15",
      "description": "The Factory resolves its tenants from the SaaS Tenants service from the first increment (FEAT-100) and every generated SaaS product gets its product tenants from the same template (GeneratedSaasFoundations). The template's own gap backlog (saas-EPIC-TEN) is not started: the JSON descriptor and the code disagree, the lifecycle saga covers creation only while the Factory needs Suspended and Decommissioned, integration events carry no common envelope, the Orleans write path is undecided and the architecture tests are placeholders. The two-tenant isolation recipe (OP-020 of the Entitlements template) has no fixture yet. What the Factory needs before FEAT-100 is taken from that backlog; the rest stays with the template. Component: SaaS Tenants service (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 15 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-249",
        "AIFACTORY-US-250",
        "AIFACTORY-US-251",
        "AIFACTORY-US-252",
        "AIFACTORY-US-253",
        "AIFACTORY-US-109"
      ],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1500,
      "titlePrefix": "[AIFACTORY-FEAT-163]",
      "number": 163
    },
    {
      "id": "AIFACTORY-US-249",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-163",
      "title": "SaaS Tenants template: the Tenants descriptor and its entity-model schema describe exactly the aggregate, enumerations and events of the code, and the build validates it",
      "sequence": "18.15.01",
      "description": "As an asset maintainer, I want the Tenants descriptor to be a true description of the Tenants service, so that the descriptor import of the Factory and every generated product read what the code really has. ADR-0025 makes the SaaS descriptor family an import format: the blueprint service maps a context descriptor with its entity-model schema into a Service blueprint and a Module blueprint and records the content hash as provenance. An import of a descriptor that disagrees with the code would produce blueprints of a service that does not exist. Feature saas-TEN-F04 of the gap backlog of the template (Docs/backlog/tenants-gap-backlog.md of the template) lists the disagreement of `ConnectSoft.Saas.Tenants.json` with the entity `ITenant`: the descriptor names one guid key where the code has an aggregate identifier and a string partition key, it calls the region `RegionCode` where the code has `ResidencyRegion`, it omits `TenantKey` and `AggregateVersion`, and its lifecycle vocabulary differs from the event topics. The backlog takes the code as the runtime truth. Its feature saas-TEN-F01 asked whether the tenant stays flat or gains child entities and for program acceptance of the choice, and decision record 0002 of the template (Docs/adr/0002-flat-tenant-vs-rich-aggregate.md of the template) held both options. The owner has accepted the flat tenant (D114). This PBI reconciles the descriptor with the flat tenant the code has, which is all the Factory needs, and records the acceptance in that decision record with the mapping of each deferred blueprint concept. The descriptor then documents both identifiers, the property names of the code, every enumeration value and the five published events. The validation mode of `build/regenerate.ps1` runs on every build, and a drift test compares the descriptor with the public surface of `ITenant`, the enumerations and the event types and fails with the member named. The generated projects are not edited by hand to make the test pass. Kind: enabling. Traces: adrs: ADR-0025; requirements: FR-11. Sources: model/components.yaml, model/services/generated-saas/GeneratedSaasFoundations.yaml, docs/architecture/adr/0025-saas-descriptor-import.md, docs/architecture/ecosystem-composition.md, model/template-parameters/connectsoft-saas-tenants.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the reconciled descriptor, when it is compared with the entity of the code, then it documents the aggregate identifier and the string partition key, the property `ResidencyRegion`, `TenantKey` and `AggregateVersion`, every lifecycle value of the enumeration and the five published events, and it validates against its schema and its entity-model schema (ADR-0025 decision 2, saas-TEN-F04 of the gap backlog of the template, model/services/generated-saas/GeneratedSaasFoundations.yaml).",
        "AC2: Given a property, an enumeration value or an event type added to the code without the descriptor, or to the descriptor without the code, when the solution builds and the drift test runs, then the validation mode of the regenerate script or the drift test fails and names the member, and no generated project is edited by hand to pass (ADR-0025 decision 4, FR-11).",
        "AC3: Given decision record 0002 of the template on the flat tenant, which the owner has accepted, when this PBI is done, then the record carries the status accepted for the flat option with the acceptance recorded, lists each blueprint concept that is collapsed into a scalar of the flat tenant with its field, and the descriptor holds no child entity the code lacks, so that the descriptor import of the Factory reads a true descriptor (ADR-0025 decision 2, docs/architecture/adr/0025-saas-descriptor-import.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/architecture/adr/0025-saas-descriptor-import.md",
        "docs/architecture/ecosystem-composition.md",
        "model/template-parameters/connectsoft-saas-tenants.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-601",
        "AIFACTORY-TASK-1143",
        "AIFACTORY-TASK-1144",
        "AIFACTORY-TASK-1145"
      ],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1501,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0025"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/architecture/adr/0025-saas-descriptor-import.md",
        "docs/architecture/ecosystem-composition.md",
        "model/template-parameters/connectsoft-saas-tenants.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-249]",
      "number": 249
    },
    {
      "id": "AIFACTORY-TASK-601",
      "type": "task",
      "parent": "AIFACTORY-US-249",
      "title": "Descriptor reconciled with the code (saas-TEN-F04)",
      "sequence": "18.15.01.01",
      "description": "BEFORE DEVELOPMENT. Descriptor reconciled with the code (saas-TEN-F04). Expected output: The Tenants descriptor JSON and its entity-model schema describe exactly the aggregate, enumerations and events the code has; the generator validates the descriptor on every build and the generated projects are not hand edited, so the Factory's descriptor import (ADR-0025) reads a true descriptor.. Kind: contract. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: build/regenerate.ps1 -ValidateOnly | dotnet build -c Release.",
      "acceptanceCriteria": [
        "The Tenants descriptor JSON and its entity-model schema describe exactly the aggregate, enumerations and events the code has; the generator validates the descriptor on every build and the generated projects are not hand edited, so the Factory's descriptor import (ADR-0025) reads a true descriptor."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1501,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-601]",
      "number": 601
    },
    {
      "id": "AIFACTORY-TASK-1143",
      "type": "task",
      "parent": "AIFACTORY-US-249",
      "title": "Descriptor drift test over the tenant entity, the enumerations and the event types",
      "sequence": "18.15.01.02",
      "description": "BEFORE DEVELOPMENT. Descriptor drift test over the tenant entity, the enumerations and the event types. Expected output: An architecture test reads `ConnectSoft.Saas.Tenants.json` and compares it with the public surface of `ITenant`, the lifecycle enumeration and the event types of the messaging model in both directions; a planted extra property fails it with the member named.. Kind: fixture. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An architecture test reads `ConnectSoft.Saas.Tenants.json` and compares it with the public surface of `ITenant`, the lifecycle enumeration and the event types of the messaging model in both directions; a planted extra property fails it with the member named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1501,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1143]",
      "number": 1143
    },
    {
      "id": "AIFACTORY-TASK-1144",
      "type": "task",
      "parent": "AIFACTORY-US-249",
      "title": "Acceptance of the flat tenant recorded in decision record 0002 with its mapping table",
      "sequence": "18.15.01.03",
      "description": "BEFORE DEVELOPMENT. Acceptance of the flat tenant recorded in decision record 0002 with its mapping table. Expected output: Decision record 0002 of the template on the flat tenant versus the rich aggregate carries the status accepted for the flat option, records the acceptance of the owner and holds a table that maps each deferred blueprint concept to the scalar that stands in for it; the documentation of the template refers to it wherever it names a deferred concept.. Kind: documentation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: the record status is accepted and names the acceptance of the owner.",
      "acceptanceCriteria": [
        "Decision record 0002 of the template on the flat tenant versus the rich aggregate carries the status accepted for the flat option, records the acceptance of the owner and holds a table that maps each deferred blueprint concept to the scalar that stands in for it; the documentation of the template refers to it wherever it names a deferred concept."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1501,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1144]",
      "number": 1144
    },
    {
      "id": "AIFACTORY-TASK-1145",
      "type": "task",
      "parent": "AIFACTORY-US-249",
      "title": "Verify the descriptor against the code and the schema",
      "sequence": "18.15.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the descriptor against the code and the schema. Expected output: Run the validation mode of the regenerate script, build in Release and run the drift test clean and with a planted extra property; the clean run passes and the planted run fails with the member named, which proves AC1 to AC3 of AIFACTORY-US-249 (ADR-0025).. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Run the validation mode of the regenerate script, build in Release and run the drift test clean and with a planted extra property; the clean run passes and the planted run fails with the member named, which proves AC1 to AC3 of AIFACTORY-US-249 (ADR-0025)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1145]",
      "number": 1145
    },
    {
      "id": "AIFACTORY-US-250",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-163",
      "title": "SaaS Tenants template: activate, suspend, restore and decommission are commands with events, and under the Orleans profile every write passes through the lifecycle grain",
      "sequence": "18.15.02",
      "description": "As an asset maintainer, I want the Tenants service to carry a tenant through its whole lifecycle, so that the Factory can suspend, restore and decommission a tenant and every consumer learns of it. The Factory resolves its tenants from the Tenants service and needs the states Suspended and Decommissioned from the first increment; the product tenants of a generated product move through the same lifecycle with a restore from Suspended to Active (model/services/generated-saas/GeneratedSaasFoundations.yaml). Feature saas-TEN-F03 of the gap backlog of the template (Docs/backlog/tenants-gap-backlog.md of the template) records that the lifecycle saga of the template is a stub for creation only: it correlates on the created event, logs and finishes at once, while the service contract already has operations for draft creation, activation, suspension, decommissioning and a change of residency. The backlog asks for a saga with a durable repository per saas-INTEG-F05 and for states beyond create for the activate, suspend, decommission and residency paths, and saas-TEN-F08 is the grain path. This PBI takes from that what the Factory needs and says what it leaves. The commands activate, suspend and decommission check the current state, refuse a transition the state does not allow with a conflict that names both states, and raise an event. Restore is no new operation: `DefaultTenantsProcessor.AllowedTransitions` already admits Suspended to Active, so a restore is the activation of a suspended tenant, announced on `tenants.domain.v1.tenant-activated` with the previous state in the payload, so that a consumer can tell a restore from a first activation. The orchestration differs per messaging profile. Decision record 0003 of the template on the Orleans write path (Docs/adr/0003-orleans-write-path-decision.md of the template) offered two options: route every write through `TenantLifecycleGrain`, or keep the processor as the write path. The owner has accepted the lifecycle grain under the Orleans messaging profile, with the MassTransit saga only where MassTransit is selected (D114). The Factory generates the service with the Orleans messaging profile, and under it the lifecycle state is held and persisted by `TenantLifecycleGrain`, every write of the REST and gRPC adapters passes through it, and an architecture rule enforces it; this PBI records the acceptance in that decision record. Under MassTransit the durable saga repository of saas-INTEG-F05 is not delivered here and stays with the template: the saga remains the creation stub, and the MassTransit case is gated on the commands and their events only. The residency path stays with the template as well. Feature saas-TEN-F05 leaves the vocabulary open: the enumeration says Decommissioned and the topic says deleted. This PBI records the mapping in a decision record of the template, with the Factory reading the deleted event as the terminal decommissioned state and not as a removed row, with the draft state as what the Factory calls pending, and with the five values of `ProductTenantState` of the model (Provisioning, Active, Suspended, Offboarding, Deleted) mapped to the four states of the template. Kind: enabling. Traces: adrs: ADR-0014, ADR-0015. Depends on: AIFACTORY-US-249. Sources: model/components.yaml, model/services/generated-saas/GeneratedSaasFoundations.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given a tenant in each lifecycle state, when activate, suspend or decommission is called, then a transition the state allows changes the state, increases the aggregate version and raises its event, a transition the state does not allow is refused with a conflict that names the current and the requested state and raises nothing, and the activation of a suspended tenant is the restore, announced on `tenants.domain.v1.tenant-activated` with the previous state Suspended in the payload (saas-TEN-F03 of the gap backlog of the template; model/services/generated-saas/GeneratedSaasFoundations.yaml for the transitions; ADR-0015 decision 4 keeps Factory tenants and product tenants distinct users of the same lifecycle).",
        "AC2: Given a Tenants service generated with the Orleans messaging profile, when create, activate, suspend, restore and decommission run in sequence for one tenant, then every write of the REST and gRPC adapters passes through `TenantLifecycleGrain` keyed by the tenant, the grain holds and persists the lifecycle state after each event, an architecture rule fails when an adapter calls the processor directly, and the tests cover create to activate and suspend to restore to decommission (ADR-0014 decision 4 on a transition written with its record; saas-TEN-F08 of the gap backlog of the template).",
        "AC3: Given a Tenants service generated with MassTransit, when the same commands run, then the commands and their events behave as under the Orleans profile, the lifecycle saga remains the creation stub, the documentation of the template names the durable saga repository of saas-INTEG-F05 and the residency path as work that stays with the template, and the gate runs the command and event tests of that case and no orchestration test (saas-TEN-F03 of the gap backlog of the template, ADR-0015 decision 4, docs/architecture/ecosystem-composition.md).",
        "AC4: Given the vocabulary question of saas-TEN-F05, when this PBI is done, then a decision record of the template states that the deleted event announces the terminal decommissioned state and not a removed row, that the draft state is what the Factory calls pending, and which state of the template stands for each of the five values of `ProductTenantState`: Provisioning is Draft, Active is Active, Suspended is Suspended, Deleted is Decommissioned, and Offboarding has no state of the template and is held by the product until it calls decommission; the events page of the template says the same, and decision record 0003 of the template carries the status accepted for the option that routes every write through the grain under the Orleans messaging profile, with the acceptance of the owner recorded (ADR-0015 decision 4, model/services/generated-saas/GeneratedSaasFoundations.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1146",
        "AIFACTORY-TASK-602",
        "AIFACTORY-TASK-1175",
        "AIFACTORY-TASK-1147",
        "AIFACTORY-TASK-1148"
      ],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1502,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-249"
      ],
      "source": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-250]",
      "number": 250
    },
    {
      "id": "AIFACTORY-TASK-1146",
      "type": "task",
      "parent": "AIFACTORY-US-250",
      "title": "Previous state on the activation event and the conflict fault of a refused transition",
      "sequence": "18.15.02.01",
      "description": "BEFORE DEVELOPMENT. Previous state on the activation event and the conflict fault of a refused transition. Expected output: The service contract of the template keeps its five operations and gains no restore operation; the payload of the activation event carries the previous state, so that the activation of a suspended tenant is readable as a restore on `tenants.domain.v1.tenant-activated`, as an additive change under the first version of the topic; the conflict fault for a refused transition names the current and the requested state; the published language of the template records both.. Kind: contract. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The service contract of the template keeps its five operations and gains no restore operation; the payload of the activation event carries the previous state, so that the activation of a suspended tenant is readable as a restore on `tenants.domain.v1.tenant-activated`, as an additive change under the first version of the topic; the conflict fault for a refused transition names the current and the requested state; the published language of the template records both."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1502,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1146]",
      "number": 1146
    },
    {
      "id": "AIFACTORY-TASK-602",
      "type": "task",
      "parent": "AIFACTORY-US-250",
      "title": "Full tenant lifecycle with Suspended and Decommissioned (saas-TEN-F03)",
      "sequence": "18.15.02.02",
      "description": "BEFORE DEVELOPMENT. Full tenant lifecycle with Suspended and Decommissioned (saas-TEN-F03). Expected output: Activate, suspend and decommission are commands of the aggregate with events, and restore is the activation of a suspended tenant; under the Orleans messaging profile the lifecycle grain holds and persists the state for each of them, not creation alone, and every write passes through it; under MassTransit the lifecycle saga stays the creation stub and the durable saga stays with the template; the Factory's Pending and Deleted vocabulary decision of saas-TEN-F05 is recorded in the template's ADR.. Kind: implementation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Activate, suspend and decommission are commands of the aggregate with events, and restore is the activation of a suspended tenant; under the Orleans messaging profile the lifecycle grain holds and persists the state for each of them, not creation alone, and every write passes through it; under MassTransit the lifecycle saga stays the creation stub and the durable saga stays with the template; the Factory's Pending and Deleted vocabulary decision of saas-TEN-F05 is recorded in the template's ADR."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-602]",
      "number": 602
    },
    {
      "id": "AIFACTORY-TASK-1175",
      "type": "task",
      "parent": "AIFACTORY-US-250",
      "title": "Architecture rule and grain tests of the Orleans write path",
      "sequence": "18.15.02.03",
      "description": "BEFORE DEVELOPMENT. Architecture rule and grain tests of the Orleans write path. Expected output: An architecture test of the Orleans case fails when a REST or gRPC adapter references the processor directly instead of `ITenantLifecycleGrain`, with a planted direct call as its negative control; grain tests run create, activate, suspend, restore and decommission for one tenant and read the persisted lifecycle state after each event and after a reactivation of the grain.. Kind: fixture. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An architecture test of the Orleans case fails when a REST or gRPC adapter references the processor directly instead of `ITenantLifecycleGrain`, with a planted direct call as its negative control; grain tests run create, activate, suspend, restore and decommission for one tenant and read the persisted lifecycle state after each event and after a reactivation of the grain."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1175]",
      "number": 1175
    },
    {
      "id": "AIFACTORY-TASK-1147",
      "type": "task",
      "parent": "AIFACTORY-US-250",
      "title": "Vocabulary decision record and the recorded acceptance of the Orleans write path",
      "sequence": "18.15.02.04",
      "description": "BEFORE DEVELOPMENT. Vocabulary decision record and the recorded acceptance of the Orleans write path. Expected output: The decision records of the template state the mapping of deleted to decommissioned, of draft to pending and of the five values of `ProductTenantState` to the four states of the template; decision record 0003 of the template carries the status accepted for the option that routes every write through `TenantLifecycleGrain` under the Orleans messaging profile, with the MassTransit saga only where MassTransit is selected, and records the acceptance of the owner; the documentation names the durable saga of saas-INTEG-F05 and the residency path as work that stays with the template, and the events page uses the same words.. Kind: documentation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: both records are accepted and name the acceptance of the owner.",
      "acceptanceCriteria": [
        "The decision records of the template state the mapping of deleted to decommissioned, of draft to pending and of the five values of `ProductTenantState` to the four states of the template; decision record 0003 of the template carries the status accepted for the option that routes every write through `TenantLifecycleGrain` under the Orleans messaging profile, with the MassTransit saga only where MassTransit is selected, and records the acceptance of the owner; the documentation names the durable saga of saas-INTEG-F05 and the residency path as work that stays with the template, and the events page uses the same words."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1502,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1147]",
      "number": 1147
    },
    {
      "id": "AIFACTORY-TASK-1148",
      "type": "task",
      "parent": "AIFACTORY-US-250",
      "title": "Verify the lifecycle transitions and their orchestration",
      "sequence": "18.15.02.05",
      "description": "BEFORE DEVELOPMENT. Verify the lifecycle transitions and their orchestration. Expected output: Run the unit and integration tests of the lifecycle on both cases: every allowed transition raises its event, the activation of a suspended tenant carries the previous state, every refused one answers a conflict, the Orleans case holds the persisted state in the grain after each event and fails the planted direct call, and the MassTransit case passes its command and event tests, which proves AC1 to AC4 of AIFACTORY-US-250 (ADR-0015).. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Run the unit and integration tests of the lifecycle on both cases: every allowed transition raises its event, the activation of a suspended tenant carries the previous state, every refused one answers a conflict, the Orleans case holds the persisted state in the grain after each event and fails the planted direct call, and the MassTransit case passes its command and event tests, which proves AC1 to AC4 of AIFACTORY-US-250 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1148]",
      "number": 1148
    },
    {
      "id": "AIFACTORY-US-251",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-163",
      "title": "SaaS Tenants template: every Tenants integration event carries the complete envelope base, which the Factory profile maps, and is published through the outbox of the Orleans messaging profile",
      "sequence": "18.15.03",
      "description": "As an asset maintainer, I want the Tenants events to carry the complete envelope base of the template and to leave the service through a transactional outbox, so that a Factory service that consumes a tenant event can attribute and deduplicate it and never sees an event for a change that was rolled back. ADR-0014 decision 1 fixes the run event envelope of Factory integration events, and its schema (docs/reference/schemas/run-event-envelope.schema.json) names the required fields: `eventId`, `eventType`, `schemaVersion`, `occurredAt`, `producer`, `tenantId`, `correlationId` and `payload`. `causationId`, project, run and attempt are optional. The amendment of that decision (D114) settles who writes it: a Factory service writes the run event envelope of the contracts package for its integration events, while the generic SaaS templates keep their own envelope base and the Factory profile maps it. The Tenants template is generic, it serves the Factory tenants and the product tenants of every generated product, so it pins no Factory package and writes no run event envelope. Its base is the common integration event envelope of the SaaS family (saas-INTEG-F03 of the gap backlog of the template, Docs/backlog/tenants-gap-backlog.md of the template): `tenantId`, `aggregateId`, `aggregateVersion`, `schemaVersion`, `correlationId`, an optional `causationId` and `occurredOn`. Feature saas-TEN-F05 of the same backlog records that the Tenants events carry it only in part: tenant, aggregate identifier, aggregate version and time, without schema version and correlation id. Decision 4 has the state transition and the outbox record written in one transaction of the selected messaging profile, and the template publishes through MassTransit today. This PBI completes the envelope base on the five event types of the messaging model and records in the published language of the template the mapping that the Factory profile of the base template applies on receipt (AIFACTORY-US-227): `tenantId`, `schemaVersion`, `correlationId` and `causationId` map by name, `occurredOn` is `occurredAt`, the message id of the publication is `eventId`, the topic name is `eventType`, the messaging service name of the Tenants service is `producer`, the event body is `payload`, and `aggregateId` with `aggregateVersion` gives the ordering key and the aggregate revision, so that every required field of the run event envelope has a source. The PBI also lets the template generate with the Orleans messaging profile that the base template gains in its Factory profile feature. That value reaches this template only through its `base-template` submodule, so the submodule pointer moves to the base template that carries it, the template metadata is reconciled and `build/MaterializedDirectory.Packages.props` is regenerated. The outbox dispatcher and the inbox grains then come through the submodule, and the template adds no messaging code and no second envelope type. The Orleans messaging adapter needs SQL Server and the NHibernate unit of work, while the template advertises several dialects, so the Orleans case generates with NHibernate on SQL Server and another dialect is refused with the symbols named. The correlation id is taken from the inbound correlation or trace context of the REST or gRPC call. The causation id is the identifier of the command that caused the event and is absent when there is none; the trace id is diagnostics and never stands in for it. The fields of the run event envelope that a tenant event has no value for, such as project, run and attempt, have no source in the base and stay absent after the mapping, as the envelope allows. An event whose base field is missing is refused at publication with the field named. MassTransit stays the selectable transport of generated products and its topology does not change. Golden files fix the serialised form of each event, and a consumer test reads an activation and a suspension from the Orleans inbox with every field of the base filled. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0024. Depends on: AIFACTORY-US-250, feature:component-base-template-factory-profile. Sources: model/components.yaml, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0024-durable-execution-substrate.md, docs/reference/event-envelope.md, docs/reference/schemas/run-event-envelope.schema.json, model/template-parameters/connectsoft-saas-tenants.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the five event types of the Tenants messaging model, when each is serialised, then it carries the envelope base of the template complete, `tenantId`, `aggregateId`, `aggregateVersion`, `schemaVersion`, `correlationId` and `occurredOn`, and the mapping table of the published language names a source for every required field of the run event envelope, `eventId`, `eventType`, `schemaVersion`, `occurredAt`, `producer`, `tenantId`, `correlationId` and `payload`; the correlation id is the inbound correlation or trace context of the call, the causation id is the identifier of the command that caused the event and is absent when there is none; its golden file matches, publication of an event with a missing base field is refused with the field named, and the template pins no Factory package (ADR-0014 decision 1 and its amendment on envelopes per event family, saas-TEN-F05 of the gap backlog of the template, docs/reference/schemas/run-event-envelope.schema.json).",
        "AC2: Given the base-template submodule moved to the base template that carries the Orleans value, when a Tenants service is generated with the Orleans messaging profile, then it generates with NHibernate on SQL Server and another dialect is refused with the symbols named; when a command changes the tenant and its unit of work commits, then the outbox record of the event is committed in the same transaction, and when the unit of work rolls back no record exists and no event is delivered (ADR-0014 decision 4, ADR-0012 decision 4, ADR-0024).",
        "AC3: Given a consumer on the Orleans inbox, when a tenant is activated and then suspended, then the consumer reads both events with every field of the envelope base filled and the correlation id of the call that caused them, each field the mapping onto the run event envelope needs has a value, and a second delivery of either message id has no effect (ADR-0014 decision 3, ADR-0012).",
        "AC4: Given a generation of the template with MassTransit, when its tests run, then the events carry the same envelope base and the topology and topic names are unchanged, so that MassTransit stays a selectable transport for products (ADR-0012 decision 3, model/template-parameters/connectsoft-saas-tenants.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/template-parameters/connectsoft-saas-tenants.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1176",
        "AIFACTORY-TASK-1149",
        "AIFACTORY-TASK-603",
        "AIFACTORY-TASK-1150",
        "AIFACTORY-TASK-1151"
      ],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1503,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-250",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/reference/event-envelope.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "model/template-parameters/connectsoft-saas-tenants.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-251]",
      "number": 251
    },
    {
      "id": "AIFACTORY-TASK-1176",
      "type": "task",
      "parent": "AIFACTORY-US-251",
      "title": "Base-template submodule moved to the Orleans value with the template metadata and the package snapshot regenerated",
      "sequence": "18.15.03.01",
      "description": "BEFORE DEVELOPMENT. Base-template submodule moved to the Orleans value with the template metadata and the package snapshot regenerated. Expected output: The `base-template` submodule of the Tenants template points at the base template that carries the value Orleans of `MessagingModelType`, the template metadata of `connectsoft-saas-tenants` offers the value with its SQL Server and NHibernate constraint, `build/MaterializedDirectory.Packages.props` is regenerated and its check passes; no file inside the submodule is edited.. Kind: operations. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet new connectsoft-saas-tenants --help lists the value Orleans | the package snapshot check passes and the authoring solution builds in Release.",
      "acceptanceCriteria": [
        "The `base-template` submodule of the Tenants template points at the base template that carries the value Orleans of `MessagingModelType`, the template metadata of `connectsoft-saas-tenants` offers the value with its SQL Server and NHibernate constraint, `build/MaterializedDirectory.Packages.props` is regenerated and its check passes; no file inside the submodule is edited."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1503,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1176]",
      "number": 1176
    },
    {
      "id": "AIFACTORY-TASK-1149",
      "type": "task",
      "parent": "AIFACTORY-US-251",
      "title": "Complete envelope base on the five Tenants event types with golden files and the mapping table",
      "sequence": "18.15.03.02",
      "description": "BEFORE DEVELOPMENT. Complete envelope base on the five Tenants event types with golden files and the mapping table. Expected output: The five event types of the messaging model implement the envelope base of the template with `schemaVersion`, `correlationId` and the optional `causationId` beside the fields they have, with the correlation id from the inbound call and the causation id from the command; the published language page of the template holds the table that maps the base onto the run event envelope; a golden JSON file per event fixes the serialised form, the architecture test for the published language fails on an event type without the base, and the template pins no Factory package.. Kind: contract. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The five event types of the messaging model implement the envelope base of the template with `schemaVersion`, `correlationId` and the optional `causationId` beside the fields they have, with the correlation id from the inbound call and the causation id from the command; the published language page of the template holds the table that maps the base onto the run event envelope; a golden JSON file per event fixes the serialised form, the architecture test for the published language fails on an event type without the base, and the template pins no Factory package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1503,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1149]",
      "number": 1149
    },
    {
      "id": "AIFACTORY-TASK-603",
      "type": "task",
      "parent": "AIFACTORY-US-251",
      "title": "Envelope base and the Orleans messaging profile on the Tenants events",
      "sequence": "18.15.03.03",
      "description": "BEFORE DEVELOPMENT. Envelope base and the Orleans messaging profile on the Tenants events. Expected output: Every integration event of the template carries the complete envelope base of the template, which the Factory profile maps onto the run event envelope (ADR-0014), and is published through the outbox of the Orleans messaging profile (ADR-0024), which generates with NHibernate on SQL Server; a consumer test reads TenantActivated and TenantSuspended with the envelope fields filled.. Kind: implementation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Every integration event of the template carries the complete envelope base of the template, which the Factory profile maps onto the run event envelope (ADR-0014), and is published through the outbox of the Orleans messaging profile (ADR-0024), which generates with NHibernate on SQL Server; a consumer test reads TenantActivated and TenantSuspended with the envelope fields filled."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-603]",
      "number": 603
    },
    {
      "id": "AIFACTORY-TASK-1150",
      "type": "task",
      "parent": "AIFACTORY-US-251",
      "title": "Consumer test on the Orleans inbox and the rollback test of the outbox",
      "sequence": "18.15.03.04",
      "description": "BEFORE DEVELOPMENT. Consumer test on the Orleans inbox and the rollback test of the outbox. Expected output: The acceptance suite of the Orleans case holds a consumer that reads an activation and a suspension with every required field, a duplicate delivery test and a rollback test that finds no outbox record.. Kind: fixture. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The acceptance suite of the Orleans case holds a consumer that reads an activation and a suspension with every required field, a duplicate delivery test and a rollback test that finds no outbox record."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1503,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1150]",
      "number": 1150
    },
    {
      "id": "AIFACTORY-TASK-1151",
      "type": "task",
      "parent": "AIFACTORY-US-251",
      "title": "Verify the envelope on both messaging profiles",
      "sequence": "18.15.03.05",
      "description": "BEFORE DEVELOPMENT. Verify the envelope on both messaging profiles. Expected output: Generate the template with the Orleans messaging profile and with MassTransit, build both in Release and run the golden file, consumer and rollback tests; all pass on both and an Orleans generation with another dialect is refused, which proves AC1 to AC4 of AIFACTORY-US-251 (ADR-0014, ADR-0012).. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Generate the template with the Orleans messaging profile and with MassTransit, build both in Release and run the golden file, consumer and rollback tests; all pass on both and an Orleans generation with another dialect is refused, which proves AC1 to AC4 of AIFACTORY-US-251 (ADR-0014, ADR-0012)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1151]",
      "number": 1151
    },
    {
      "id": "AIFACTORY-US-252",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-163",
      "title": "SaaS Tenants template: a two-tenant fixture proves that a caller reads only its own rows and gets 404 for the other tenant, and real architecture tests replace the placeholders",
      "sequence": "18.15.04",
      "description": "As an asset maintainer, I want the isolation of the Tenants service and its layering rules to be proven by tests that can fail, so that the Factory resolves tenants from a service whose tenant filter and structure are verified and not assumed. The isolation recipe of the SaaS family (Docs/OP-020-SaaS-Two-Tenant-Isolation.md of the entitlements template) is a planning record with no fixture yet. It sets the cases: each of two tenants reads its own data, a caller of one tenant that targets the other gets 404 and no payload of the other, a principal without a resolvable tenant gets 401 before the query runs, overlapping requests keep their own context, and no tenant value survives from one request to the next. It fixes the conditions too: one test server and one disposable shared database with two synthetic tenants, the production tenancy wiring with the tenant claim required and no default tenant, no reuse of the acceptance startup that can drop the configured catalog, and, when the cross-tenant case fails, the evidence is kept and the assertion is not weakened. This PBI builds that fixture for the Tenants service, whose read by identifier is the operation under test. Feature saas-TEN-F06 of the gap backlog of the template (Docs/backlog/tenants-gap-backlog.md of the template) records that two architecture tests of the template are placeholders that always pass. This PBI replaces them with rules that can fail: one aggregate root per repository, the published-language rule with the envelope on every event type, both after the reference implementation in the products catalog template, and it keeps the layering test that is already real. A rule that inspects no type fails instead of passing. Kind: enabling. Traces: adrs: ADR-0014, ADR-0015; requirements: FR-11. Relates: nfrs: NFR-01. Depends on: AIFACTORY-US-251. Sources: model/components.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, model/services/generated-saas/GeneratedSaasFoundations.yaml, docs/planes/control/tenancy.md.",
      "acceptanceCriteria": [
        "AC1: Given two synthetic tenants on one disposable shared database and one test server with the production tenancy wiring, when each tenant reads its own tenant row, then each gets 200 with its own data; when a caller of one tenant reads the identifier of the other, then the answer is 404 with no data of the other tenant (ADR-0015 decision 3 and its amendment on a resource of another tenant, D113; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC2: Given an authenticated principal without a tenant claim and no other tenant source, when it calls the read, then the answer is 401 before the query runs; given overlapping and repeated requests of the two tenants on the same host, when they run, then each keeps its own tenant context and no tenant value survives from another request (ADR-0015 decision 1, NFR-01).",
        "AC3: Given the architecture tests of the template, when a second aggregate root, an event type without the envelope or a forbidden reference across the published language is planted, then the matching rule fails with the type named, the existing layering rule still passes on the clean code, and a rule that inspected no type fails (saas-TEN-F06 of the gap backlog of the template, ADR-0014 decision 1, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/planes/control/tenancy.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1152",
        "AIFACTORY-TASK-1153",
        "AIFACTORY-TASK-604"
      ],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1504,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-251"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/planes/control/tenancy.md"
      ],
      "titlePrefix": "[AIFACTORY-US-252]",
      "number": 252
    },
    {
      "id": "AIFACTORY-TASK-1152",
      "type": "task",
      "parent": "AIFACTORY-US-252",
      "title": "Disposable shared database with two synthetic tenants on a test server with production tenancy wiring",
      "sequence": "18.15.04.01",
      "description": "BEFORE DEVELOPMENT. Disposable shared database with two synthetic tenants on a test server with production tenancy wiring. Expected output: A fixture of the acceptance tests creates a disposable shared database, seeds two synthetic tenants and starts one test server with the tenant claim required, no default tenant and the resolver pipeline of production; it does not use the acceptance startup that can drop the configured catalog and it removes the database when it ends.. Kind: fixture. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A fixture of the acceptance tests creates a disposable shared database, seeds two synthetic tenants and starts one test server with the tenant claim required, no default tenant and the resolver pipeline of production; it does not use the acceptance startup that can drop the configured catalog and it removes the database when it ends."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1152]",
      "number": 1152
    },
    {
      "id": "AIFACTORY-TASK-1153",
      "type": "task",
      "parent": "AIFACTORY-US-252",
      "title": "Architecture rules that replace the two placeholder tests",
      "sequence": "18.15.04.02",
      "description": "BEFORE DEVELOPMENT. Architecture rules that replace the two placeholder tests. Expected output: The one-aggregate-root rule and the published-language rule with the envelope check are implemented with the architecture test library after the products catalog template, assert that they inspected at least one type, and fail on a planted violation; the layering test is unchanged.. Kind: implementation. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The one-aggregate-root rule and the published-language rule with the envelope check are implemented with the architecture test library after the products catalog template, assert that they inspected at least one type, and fail on a planted violation; the layering test is unchanged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1153]",
      "number": 1153
    },
    {
      "id": "AIFACTORY-TASK-604",
      "type": "task",
      "parent": "AIFACTORY-US-252",
      "title": "Two-tenant isolation fixture and real architecture tests",
      "sequence": "18.15.04.03",
      "description": "BEFORE DEVELOPMENT. Two-tenant isolation fixture and real architecture tests. Expected output: The acceptance run on the two-tenant fixture shows that a caller of one tenant reads only its own rows and gets 404 for the other and 401 without tenant context (the OP-020 cases), and the architecture run shows the placeholder tests of saas-TEN-F06 replaced by rules that fail on a planted violation, which proves AC1 to AC3 of AIFACTORY-US-252.. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The acceptance run on the two-tenant fixture shows that a caller of one tenant reads only its own rows and gets 404 for the other and 401 without tenant context (the OP-020 cases), and the architecture run shows the placeholder tests of saas-TEN-F06 replaced by rules that fail on a planted violation, which proves AC1 to AC3 of AIFACTORY-US-252."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-604]",
      "number": 604
    },
    {
      "id": "AIFACTORY-US-253",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-163",
      "title": "SaaS Tenants template: the packed template passes the Orleans and MassTransit cases of the shared template pipeline, descriptor validated and isolation tested, before the package publishes",
      "sequence": "18.15.05",
      "description": "As an asset maintainer, I want the Tenants template to be gated by solutions generated from its package, so that the Factory tenants and every product tenant come from a package whose descriptor is true and whose isolation is tested. The estate gates its templates with the shared template pipeline of ConnectSoft.AzurePipelines (`template-ci/v1`), whose rollout ledger lists the Tenants template as pending. The Tenants template packs `connectsoft-saas-tenants` and composes on the base template through its submodule. This PBI is the proof of the feature and adopts that mechanism. A `build/template-ci.json` manifest declares two cases, one generated with MassTransit and one with the Orleans messaging profile. The MassTransit case is the default generation of the template and stays gated as today. The Orleans case is the one additional gating case that the amendment of ADR-0028 (D114) admits for a declared profile, here the Orleans messaging profile, and the admission in the shared tooling is AIFACTORY-TASK-1464 of the feature `component-base-template-factory-profile`, on which this PBI depends. Both cases carry the validation mode of the regenerate script as the case validator of the descriptor, the test filter of each case and the services the tests need: SQL Server for the outbox and the two-tenant fixture, and a co-hosted silo for the Orleans case. The template pipeline imports the shared installer jobs: the candidate is packed once and installed, each case is generated, its descriptor is validated, the solution is restored and built in Release, its tests run with the discovery and completion checks, with the lifecycle tests, the envelope golden files, the consumer test and the two-tenant fixture among them, and the dependency audit runs. The MassTransit case runs the command and event tests and no orchestration test, as the lifecycle PBI states. The Scripts check of the shared tooling runs in check mode against the Scripts folder of the base-template submodule. A descriptor that drifts, a failing isolation case or an incomplete run fails the run with the case and the stage named, and the package is not published. Publication requires the complete reports of both cases bound to the candidate and pushes a version that is not yet on the ConnectSoft feed. The PBI proves ADR-0025 for the Tenants descriptor, the isolation rule of ADR-0015 and the release gate of FR-11, before the tenancy integration feature resolves the first Factory tenant. Kind: evidence. Traces: adrs: ADR-0014, ADR-0015, ADR-0025, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-249, AIFACTORY-US-250, AIFACTORY-US-251, AIFACTORY-US-252, feature:component-base-template-findings, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/services/generated-saas/GeneratedSaasFoundations.yaml, docs/architecture/adr/0025-saas-descriptor-import.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, model/template-parameters/connectsoft-saas-tenants.yaml, docs/architecture/catalogs/templates.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the Tenants template, when its template pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the MassTransit case, the default generation gated as today, and the Orleans case, the one additional gating case of the declared Orleans messaging profile, are generated, the descriptor of each is validated by its case validator, each is restored and built in Release, its tests run with the discovery and completion checks against the services the manifest declares, SQL Server for the outbox and the two-tenant fixture and a co-hosted silo for the Orleans case, the dependency audit runs, and the Scripts check passes in check mode (ADR-0025, ADR-0015, ADR-0028 amendment on one additional gating case per declared profile, FR-11).",
        "AC2: Given a planted descriptor drift, a planted failure of the cross-tenant case or an incomplete run, when the pipeline evaluates the run, then it fails with the case and the stage named and the package is not published (FR-11, docs/architecture/adr/0025-saas-descriptor-import.md).",
        "AC3: Given complete reports of both cases bound to the candidate hash, when the publication job runs, then the package is pushed with a version that was not on the feed, and a fresh install of that version generates a Tenants service whose descriptor validates and whose lifecycle, envelope and isolation tests pass unchanged (ADR-0014, ADR-0015, model/template-parameters/connectsoft-saas-tenants.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/architecture/adr/0025-saas-descriptor-import.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-saas-tenants.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1154",
        "AIFACTORY-TASK-1177",
        "AIFACTORY-TASK-1155",
        "AIFACTORY-TASK-1156"
      ],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1505,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0025",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-249",
        "AIFACTORY-US-250",
        "AIFACTORY-US-251",
        "AIFACTORY-US-252",
        "feature:component-base-template-findings",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "docs/architecture/adr/0025-saas-descriptor-import.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "model/template-parameters/connectsoft-saas-tenants.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-253]",
      "number": 253
    },
    {
      "id": "AIFACTORY-TASK-1154",
      "type": "task",
      "parent": "AIFACTORY-US-253",
      "title": "Shared template pipeline manifest of the Tenants template with the Orleans and MassTransit cases",
      "sequence": "18.15.05.01",
      "description": "BEFORE DEVELOPMENT. Shared template pipeline manifest of the Tenants template with the Orleans and MassTransit cases. Expected output: `build/template-ci.json` of the Tenants template declares the package, the solutions and the tests, the MassTransit case as the default generation and the Orleans case as the one additional gating case of the declared Orleans messaging profile, with the validation mode of `build/regenerate.ps1` as the descriptor validator of each, the test filter of each case and the required services SQL Server and, for the Orleans case, a silo; `azure-pipelines-template.yml` imports `template-ci/v1/installer-jobs.yml` of the shared tooling and holds no stage of its own for generation, tests or audit; publication requires the complete reports of both cases bound to the candidate.. Kind: operations. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: azure-pipelines-template.yml runs both cases through the shared installer jobs and the run is green.",
      "acceptanceCriteria": [
        "`build/template-ci.json` of the Tenants template declares the package, the solutions and the tests, the MassTransit case as the default generation and the Orleans case as the one additional gating case of the declared Orleans messaging profile, with the validation mode of `build/regenerate.ps1` as the descriptor validator of each, the test filter of each case and the required services SQL Server and, for the Orleans case, a silo; `azure-pipelines-template.yml` imports `template-ci/v1/installer-jobs.yml` of the shared tooling and holds no stage of its own for generation, tests or audit; publication requires the complete reports of both cases bound to the candidate."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1505,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1154]",
      "number": 1154
    },
    {
      "id": "AIFACTORY-TASK-1177",
      "type": "task",
      "parent": "AIFACTORY-US-253",
      "title": "Scripts check of the Tenants template in check mode",
      "sequence": "18.15.05.02",
      "description": "BEFORE DEVELOPMENT. Scripts check of the Tenants template in check mode. Expected output: The manifest of the Tenants template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside the package snapshot check and fails with the missing and the changed files named.. Kind: operations. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: the pipeline runs the Scripts check and a removed file fails it.",
      "acceptanceCriteria": [
        "The manifest of the Tenants template holds the entry of the Scripts check, the root Scripts folder is written from the Scripts folder of the base-template submodule, and the pipeline runs the check in check mode beside the package snapshot check and fails with the missing and the changed files named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1505,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1177]",
      "number": 1177
    },
    {
      "id": "AIFACTORY-TASK-1155",
      "type": "task",
      "parent": "AIFACTORY-US-253",
      "title": "Planted descriptor drift and planted isolation failure for the gate",
      "sequence": "18.15.05.03",
      "description": "BEFORE DEVELOPMENT. Planted descriptor drift and planted isolation failure for the gate. Expected output: Pipeline fixtures plant an extra descriptor property and a disabled tenant filter, and assert that each run fails at its stage with the case named and that publication is not reached; publication refuses a version that is already on the feed.. Kind: fixture. Repository: ConnectSoft.Saas.TenantsTemplate. Verification: each planted run stops before publication.",
      "acceptanceCriteria": [
        "Pipeline fixtures plant an extra descriptor property and a disabled tenant filter, and assert that each run fails at its stage with the case named and that publication is not reached; publication refuses a version that is already on the feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1505,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1155]",
      "number": 1155
    },
    {
      "id": "AIFACTORY-TASK-1156",
      "type": "task",
      "parent": "AIFACTORY-US-253",
      "title": "Verify the gate of the Tenants template on a green and on the planted runs",
      "sequence": "18.15.05.04",
      "description": "BEFORE DEVELOPMENT. Verify the gate of the Tenants template on a green and on the planted runs. Expected output: One green run publishes the package and a fresh install generates a Tenants service whose tests pass; the two planted runs fail before publication; together they prove AC1 to AC3 of AIFACTORY-US-253 (ADR-0025, ADR-0015, FR-11).. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "One green run publishes the package and a fresh install generates a Tenants service whose tests pass; the two planted runs fail before publication; together they prove AC1 to AC3 of AIFACTORY-US-253 (ADR-0025, ADR-0015, FR-11)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1156]",
      "number": 1156
    },
    {
      "id": "AIFACTORY-US-109",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-163",
      "title": "SaaS Tenants template: descriptor, lifecycle, envelope and isolation before the Factory resolves tenants is delivered and proven on a generated solution",
      "sequence": "18.15.06",
      "description": "As an asset maintainer, I want SaaS Tenants service to carry descriptor, lifecycle, envelope and isolation before the Factory resolves tenants, so that it serves factory tenants (BC-33) and product tenants (BC-31) without later rework. This is the integration PBI of the feature. The Factory resolves its tenants from the SaaS Tenants service from the first increment and every generated product gets its product tenants from the same template, whose gap backlog is not started. What the Factory needs first is taken from that backlog and the rest stays with the template: the durable saga of the MassTransit profile, the residency path and the rich tenant aggregate. With the descriptor reconciled with the code, the lifecycle commands with suspension, restore and decommissioning and the lifecycle grain as the write path of the Orleans profile, the complete envelope base on every event, mapped by the Factory profile onto the run event envelope, through the outbox of the Orleans messaging profile, the two-tenant isolation fixture with real architecture tests, and the two cases in the shared template pipeline, the asset maintainer runs the pipeline end to end: pack, install, generate both messaging cases, validate, build, test and audit, then publish. A failing case blocks publication. The migrated tasks sit under the PBIs that deliver them, and the verification task of this PBI is the proof on the published package. The feature is done when a Tenants service generated from the published package validates its descriptor and passes its lifecycle, envelope and isolation tests unchanged. Kind: enabling. Traces: adrs: ADR-0014, ADR-0015, ADR-0025. Depends on: AIFACTORY-US-249, AIFACTORY-US-250, AIFACTORY-US-251, AIFACTORY-US-252, AIFACTORY-US-253. Sources: model/components.yaml, model/services/generated-saas/GeneratedSaasFoundations.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.Saas.TenantsTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution builds and its tests pass before the package publishes with a verified version (ADR-0015, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-601 (descriptor reconciled with the code, saas-TEN-F04) is done, then the Tenants descriptor JSON and its entity-model schema describe exactly the aggregate, enumerations and events the code has, the generator validates the descriptor on every build and the generated projects are not hand edited, so that the descriptor import of the Factory reads a true descriptor (ADR-0025).",
        "AC3: Given the work of AIFACTORY-TASK-602 (full tenant lifecycle with Suspended and Decommissioned, saas-TEN-F03) is done, then activate, suspend and decommission are commands of the aggregate with events, restore is the activation of a suspended tenant, the lifecycle grain of the Orleans profile handles each of them and not creation alone, and the vocabulary decision of saas-TEN-F05 is recorded in a decision record of the template (ADR-0015, model/services/generated-saas/GeneratedSaasFoundations.yaml).",
        "AC4: Given the work of AIFACTORY-TASK-603 (envelope base and the Orleans messaging profile on the Tenants events) is done, then every integration event of the template carries the complete envelope base of the template, which the Factory profile maps onto the run event envelope of ADR-0014, and is published through the outbox of the Orleans messaging profile, and a consumer test reads an activation and a suspension with the envelope fields filled.",
        "AC5: Given the work of AIFACTORY-TASK-604 (two-tenant isolation fixture and real architecture tests) is done, then an acceptance fixture with two tenants proves that a caller of one tenant reads only its own rows and gets 404 for the other and 401 without tenant context, and the placeholder architecture tests of saas-TEN-F06 are replaced by the layering rules the template documents (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-691"
      ],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1506,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0025"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-249",
        "AIFACTORY-US-250",
        "AIFACTORY-US-251",
        "AIFACTORY-US-252",
        "AIFACTORY-US-253"
      ],
      "source": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-109]",
      "number": 109
    },
    {
      "id": "AIFACTORY-TASK-691",
      "type": "task",
      "parent": "AIFACTORY-US-109",
      "title": "Verify saas-tenants-template-delivered by running the declared command",
      "sequence": "18.15.06.01",
      "description": "BEFORE DEVELOPMENT. Verify saas-tenants-template-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the Tenants service generated from the published package; they pass and prove AC1 to AC5 of AIFACTORY-US-109.. Kind: verification. Repository: ConnectSoft.Saas.TenantsTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the Tenants service generated from the published package; they pass and prove AC1 to AC5 of AIFACTORY-US-109."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/generated-saas/GeneratedSaasFoundations.yaml",
        "ConnectSoft.Saas.TenantsTemplate/Docs/backlog/tenants-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/OP-020-SaaS-Two-Tenant-Isolation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.TenantsTemplate"
      ],
      "children": [],
      "buildOrder": 15,
      "phase": "templates-and-libraries",
      "stackRank": 1506,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-691]",
      "number": 691
    },
    {
      "id": "AIFACTORY-FEAT-171",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Worker template: the Factory worker profile on the Orleans messaging profile",
      "sequence": "18.16",
      "description": "The runtime worker, the reconcilers and the dispatchers of the Factory are scaffolded from the worker template (AgentRuntimeService names it). The template's own control-plane backlog (docs/Control Plane) has landed drain and work-aware readiness, the idempotency store, the worker-owned failed-work record, the job catalog with Hangfire and PeriodicTimer adapters, the singleton lease, the shard filter, the ops surface and the MCP tools, so the Factory inherits a real worker. What it does not have is the Factory's shape: its trigger adapters are MassTransit, NServiceBus, Hangfire, PeriodicTimer and config-only Azure queues, while Factory messages travel on the Orleans messaging profile under the accepted envelope (ADR-0012, ADR-0014, ADR-0024); failed work and processed messages carry no tenant or project; the WorkerOps policy is the template's own rather than the Factory operator role of the token contract; and three of its own gaps stay open (the Jobs table is not the runtime catalog, the bound Scale options are missing from the generated settings, Hangfire recurring execution skips the lease). Component: WorkerTemplate (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-172, AIFACTORY-FEAT-157, AIFACTORY-FEAT-162. Increment I0: Readiness. Build order 18 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-209",
        "AIFACTORY-US-210",
        "AIFACTORY-US-211",
        "AIFACTORY-US-212",
        "AIFACTORY-US-213",
        "AIFACTORY-US-112"
      ],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1800,
      "titlePrefix": "[AIFACTORY-FEAT-171]",
      "number": 171
    },
    {
      "id": "AIFACTORY-US-209",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-171",
      "title": "Worker template: a work trigger over the Orleans messaging profile reads the envelope identity into the dispatch and honours pause, drain and replay",
      "sequence": "18.16.01",
      "description": "As an asset maintainer, I want the worker template to take its message-shaped work from the Orleans messaging profile through the same trigger contract as its other adapters, so that a Factory worker consumes Factory messages under the accepted envelope without a broker and without a second dispatch path. The worker-core page of the worker template describes the trigger contract of the worker: a trigger has a name that is stored as the source of failed work, an enabled flag, a flag that says whether it accepts new work, a dispatch operation and a replay operation, and the adapters of the first version are MassTransit, NServiceBus, Hangfire, the periodic timer and two Azure queue listeners. The messaging choice of the template offers None, NServiceBus and MassTransit. Factory messages travel on the Orleans messaging profile, which ADR-0012 and ADR-0024 make the default of Factory hosts, under the run event envelope of the contracts package that a Factory service writes for its integration events (ADR-0014 and its amendment on envelopes per event family), so a Factory worker has no trigger for them. The Orleans value of the messaging choice, with the outbox dispatcher, the inbox grains and the envelope on every record, is delivered to the base template by the feature `component-base-template-factory-profile`; the worker template composes on the base template through its submodule and receives the choice by moving the submodule pointer. This PBI adds the host adapter: a trigger over the inbox of the Orleans profile that joins the existing adapters, is selected by the existing messaging and trigger symbols, and dispatches a message to the message use case after the idempotency check. It reads the tenant, project, run, step and attempt identity, the event id and the correlation id of the envelope into the scoped work item of the engine, which the feature `component-workers-runtime-library` delivers. While the trigger is paused or the process drains, it accepts no new work and an undelivered message stays in the inbox for redelivery. Replay of a failed work record enqueues the message again through the outbox to its original destination. The replay operation of a trigger does not write the failed work record itself, as the worker-core page states: the replay use case of the worker opens one transaction in which the trigger writes the outbox record of the replayed message and the use case changes the record to Replayed, so the two writes commit together or not at all; a replay that fails leaves the record Open. A message without the required scope never reaches the trigger, because the inbox validation of the base profile dead-letters it. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0024. Depends on: feature:component-workers-runtime-library, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/template-parameters/connectsoft-worker.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a worker generated with the Orleans messaging choice, when a message is delivered by the inbox of the profile, then the Orleans trigger dispatches it to the message use case after the idempotency check with the tenant, project, run, step and attempt identity of the envelope in the scoped work item, and the sample message flow of the template runs on it in the acceptance tests (ADR-0012, ADR-0014 decision 1, ADR-0024).",
        "AC2: Given the trigger is paused or the process is draining, when a message is ready for delivery, then the trigger accepts no new work, the message stays in the inbox for redelivery and in-flight work finishes within the drain timeout; after resume the message is dispatched once (ADR-0012 decision 2 asks the profile to state acknowledgement and retry ownership, model/components.yaml).",
        "AC3: Given an Open failed work record whose source is the Orleans trigger, when an operator replays it, then the message is enqueued again through the outbox to its original destination and the record becomes Replayed: the outbox record of the replayed message and the change of the failed work record to Replayed commit in one transaction, which is the transaction rule of ADR-0012 decision 4; when they cannot commit together, or the adapter cannot enqueue, the record stays Open and the answer is 502."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-worker.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-619",
        "AIFACTORY-TASK-1019",
        "AIFACTORY-TASK-1020",
        "AIFACTORY-TASK-1021"
      ],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1801,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-workers-runtime-library",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-worker.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-209]",
      "number": 209
    },
    {
      "id": "AIFACTORY-TASK-619",
      "type": "task",
      "parent": "AIFACTORY-US-209",
      "title": "Trigger adapter for the Orleans messaging profile",
      "sequence": "18.16.01.01",
      "description": "BEFORE DEVELOPMENT. Trigger adapter for the Orleans messaging profile. Expected output: An `IWorkTrigger` adapter over the outbox and inbox grains of the Orleans messaging profile joins the adapters of the first version and is selected by the existing messaging symbols; the identifiers of the accepted envelope (run, step, attempt, tenant, project) are read into the scoped work item of the pinned engine, and the sample message flow runs on it in the acceptance tests.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An `IWorkTrigger` adapter over the outbox and inbox grains of the Orleans messaging profile joins the adapters of the first version and is selected by the existing messaging symbols; the identifiers of the accepted envelope (run, step, attempt, tenant, project) are read into the scoped work item of the pinned engine, and the sample message flow runs on it in the acceptance tests."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-619]",
      "number": 619
    },
    {
      "id": "AIFACTORY-TASK-1019",
      "type": "task",
      "parent": "AIFACTORY-US-209",
      "title": "Base-template submodule moved to the Orleans messaging choice and the worker symbols derived from it",
      "sequence": "18.16.01.02",
      "description": "BEFORE DEVELOPMENT. Base-template submodule moved to the Orleans messaging choice and the worker symbols derived from it. Expected output: The base-template submodule of the worker template points at the base template commit that carries the Orleans value of the messaging choice and the symbol UseFactoryProfile; the messaging and trigger symbols of the worker template accept that value and the trigger settings section gains the Orleans adapter; the template pins the engine version that carries the scoped work item.. Kind: operations. Repository: ConnectSoft.WorkerTemplate. Verification: the default generated case and the Orleans generated case build.",
      "acceptanceCriteria": [
        "The base-template submodule of the worker template points at the base template commit that carries the Orleans value of the messaging choice and the symbol UseFactoryProfile; the messaging and trigger symbols of the worker template accept that value and the trigger settings section gains the Orleans adapter; the template pins the engine version that carries the scoped work item."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1801,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1019]",
      "number": 1019
    },
    {
      "id": "AIFACTORY-TASK-1020",
      "type": "task",
      "parent": "AIFACTORY-US-209",
      "title": "Pause, drain and replay through the Orleans trigger",
      "sequence": "18.16.01.03",
      "description": "BEFORE DEVELOPMENT. Pause, drain and replay through the Orleans trigger. Expected output: The Orleans trigger reports that it accepts no new work while it is paused or the process drains and leaves undelivered messages in the inbox; its replay operation writes the outbox record of the original message inside the transaction of the replay use case, which changes the failed work record to Replayed in the same transaction, and on a failure nothing commits, the record stays Open and the route answers 502; the admin routes for trigger pause and failure replay resolve the adapter by its name.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Orleans trigger reports that it accepts no new work while it is paused or the process drains and leaves undelivered messages in the inbox; its replay operation writes the outbox record of the original message inside the transaction of the replay use case, which changes the failed work record to Replayed in the same transaction, and on a failure nothing commits, the record stays Open and the route answers 502; the admin routes for trigger pause and failure replay resolve the adapter by its name."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1020]",
      "number": 1020
    },
    {
      "id": "AIFACTORY-TASK-1021",
      "type": "task",
      "parent": "AIFACTORY-US-209",
      "title": "Verify the sample message flow, pause and replay on the Orleans profile",
      "sequence": "18.16.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the sample message flow, pause and replay on the Orleans profile. Expected output: Run the unit and acceptance tests of a worker generated with the Orleans messaging choice; the scenarios of the sample message flow, the paused trigger and the replayed failure pass and prove AC1 to AC3 of AIFACTORY-US-209 (ADR-0012, ADR-0014).. Kind: verification. Repository: ConnectSoft.WorkerTemplate.",
      "acceptanceCriteria": [
        "Run the unit and acceptance tests of a worker generated with the Orleans messaging choice; the scenarios of the sample message flow, the paused trigger and the replayed failure pass and prove AC1 to AC3 of AIFACTORY-US-209 (ADR-0012, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1021]",
      "number": 1021
    },
    {
      "id": "AIFACTORY-US-210",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-171",
      "title": "Worker template: under the Factory profile failed work and processed messages carry tenant and project, an Operator acts only on rows of their own projects and Platform admin on the worker level",
      "sequence": "18.16.02",
      "description": "As an asset maintainer, I want the records and the admin surface of a Factory worker to be bound to the scope of the work and of the token, so that an operator of one project sees and replays only the failed work of that project and only a platform admin changes what belongs to the whole worker. The worker owns its failed work: the worker-core page of the template makes the failed-work table the system of record, with processed messages beside it for idempotency, and exposes list, acknowledge, replay and discard under the admin routes, the operations page and the MCP tools. A locked decision of the template backlog keeps that surface an operations tool for one tenant under a policy of its own named `WorkerOps`, and the stored rows name no tenant and no project. A Factory worker processes messages of many tenants and projects, and ADR-0015 assigns the Operator role per project, issued as a claim by the authorization server and enforced by every backend. This PBI gives the Factory profile of the template, the boolean `UseFactoryProfile`, that shape and leaves the default worker as it is, as decision D114 and the amendment of ADR-0028 on the Factory profile switch settle: the default worker keeps the processed-message key of today, message id and payload hash, its tables, its `WorkerOps` policy and its behaviour, and nothing of this PBI is generated without the profile. Under the profile a migration adds tenant and project, and the run, step and attempt identity, to the failed-work and processed-message tables, filled from the scoped work item of the engine. The same migration replaces the primary key of the processed-message table with tenant, project and message id and keeps the payload hash as a column, and the profile selects the scoped key option of the engine, which needs that key: without it the generated worker would reject the same message id of a second tenant with a key violation. The worker operations are settled by the amendment of ADR-0015 on worker operations. An Operator sees and replays only the rows of their own projects: the list operations return only rows inside the scope of the token; acknowledge, replay and discard of a row of another tenant are answered 404, as the amendment of ADR-0015 on foreign tenants decides for every Factory service, and of a row of another project of the same tenant 403. The worker-level operations need the Platform admin role: the job catalog with its upsert, pause and resume, the pause and resume of a trigger, and the list, acknowledge, replay and discard of failed work without a scope, which is the failed work of job-shaped work. An Operator who calls a worker-level operation is refused with 403, and a list an Operator requests never returns a row without a scope. The role names are the constants of the Factory token contract that the base template profile pins, the roles are issued by the authorization server of the feature `component-auth-server-template-factory-tokens`, and the worker types no role name. The MCP tools apply the same checks as the routes. Kind: enabling. Traces: adrs: ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-209, feature:component-workers-runtime-library, feature:component-auth-server-template-factory-tokens. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a worker generated with `UseFactoryProfile`, when a scoped message is processed or fails after its retries, then the processed-message row and the failed work record carry the tenant, project, run, step and attempt identity of the envelope, added by a migration that is generated only under the profile and that also makes tenant, project and message id the key of the processed-message table, so that the same message id of a second tenant is stored and not rejected; a worker generated without the profile contains no such migration, keeps the key of message id and payload hash and behaves as today (ADR-0014 decision 1 and decision 3, ADR-0028 amendment on the Factory profile switch).",
        "AC2: Given a worker generated with `UseFactoryProfile` and a token with the Operator role for one project, when its holder lists failed work through the admin routes, the operations page or the MCP tools, then only rows of that tenant and project are returned and no row without a scope; acknowledge, replay or discard of a row of another tenant is answered 404 and of a row of another project of the same tenant 403, as ADR-0015 decision 5 and its amendments on foreign tenants and on worker operations require.",
        "AC3: Given a token without the Operator and without the Platform admin role, when it calls an admin route or an MCP write tool of a worker generated with `UseFactoryProfile`, then it is refused with 401 or 403 while the health route stays public; a worker generated without the profile keeps the `WorkerOps` policy and the unscoped rows of the template unchanged, and a test covers a token of another project (ADR-0015 decision 6 has the backend enforce the role claim).",
        "AC4: Given a worker generated with `UseFactoryProfile`, when the job catalog is listed or changed, a trigger is paused or resumed, or failed work without a scope is listed, acknowledged, replayed or discarded, through a route, the operations page or an MCP tool, then the call succeeds only for a token with the Platform admin role, and a token that holds only the Operator role is refused with 403, as the amendment of ADR-0015 on worker operations decides."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-620",
        "AIFACTORY-TASK-1022",
        "AIFACTORY-TASK-1023",
        "AIFACTORY-TASK-1024"
      ],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1802,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-209",
        "feature:component-workers-runtime-library",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-210]",
      "number": 210
    },
    {
      "id": "AIFACTORY-TASK-620",
      "type": "task",
      "parent": "AIFACTORY-US-210",
      "title": "Factory scope on failed work, idempotency and the admin surface",
      "sequence": "18.16.02.01",
      "description": "BEFORE DEVELOPMENT. Factory scope on failed work, idempotency and the admin surface. Expected output: Under `UseFactoryProfile` FailedWork and ProcessedMessages rows carry the tenant and project of the envelope, and the host registration selects the scoped key option and the scope requirement of the pinned engine; the admin routes, the operations page and the MCP tools read the scope from the Factory token and refuse a row outside it; the scoped failed-work operations require the Operator role and the worker-level operations the Platform admin role of the token contract, with a test for a token of another project; without the profile none of this is generated and the worker keeps its key, its tables and its `WorkerOps` policy.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` FailedWork and ProcessedMessages rows carry the tenant and project of the envelope, and the host registration selects the scoped key option and the scope requirement of the pinned engine; the admin routes, the operations page and the MCP tools read the scope from the Factory token and refuse a row outside it; the scoped failed-work operations require the Operator role and the worker-level operations the Platform admin role of the token contract, with a test for a token of another project; without the profile none of this is generated and the worker keeps its key, its tables and its `WorkerOps` policy."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-620]",
      "number": 620
    },
    {
      "id": "AIFACTORY-TASK-1022",
      "type": "task",
      "parent": "AIFACTORY-US-210",
      "title": "Migration that adds the scope columns and the scoped key to FailedWork and ProcessedMessages under the Factory profile",
      "sequence": "18.16.02.02",
      "description": "BEFORE DEVELOPMENT. Migration that adds the scope columns and the scoped key to FailedWork and ProcessedMessages under the Factory profile. Expected output: A migration that the template generates only with `UseFactoryProfile` adds tenant, project, run, step and attempt columns to the FailedWork and ProcessedMessages tables, with an index on tenant and project for the list operations, and replaces the primary key of ProcessedMessages, message id and payload hash, with tenant, project and message id, keeping the payload hash as a column; it runs on the database of a worker scaffolded with the profile and is reversible on an empty database; a worker generated without the profile contains no such migration and its key is unchanged; a test of the template compares the tables its migrations create with the schema script of the pinned engine, the default generation against the default shape and the profile generation against the scoped shape, and fails on a difference.. Kind: migration. Repository: ConnectSoft.WorkerTemplate. Verification: under the profile the migration applies to a fresh database after the earlier migrations | a generation without the profile contains no such migration and keeps the key of message id and payload hash.",
      "acceptanceCriteria": [
        "A migration that the template generates only with `UseFactoryProfile` adds tenant, project, run, step and attempt columns to the FailedWork and ProcessedMessages tables, with an index on tenant and project for the list operations, and replaces the primary key of ProcessedMessages, message id and payload hash, with tenant, project and message id, keeping the payload hash as a column; it runs on the database of a worker scaffolded with the profile and is reversible on an empty database; a worker generated without the profile contains no such migration and its key is unchanged; a test of the template compares the tables its migrations create with the schema script of the pinned engine, the default generation against the default shape and the profile generation against the scoped shape, and fails on a difference."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1802,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1022]",
      "number": 1022
    },
    {
      "id": "AIFACTORY-TASK-1023",
      "type": "task",
      "parent": "AIFACTORY-US-210",
      "title": "Operator scope filter and Platform admin requirement on the routes, the operations page and the MCP tools",
      "sequence": "18.16.02.03",
      "description": "BEFORE DEVELOPMENT. Operator scope filter and Platform admin requirement on the routes, the operations page and the MCP tools. Expected output: With `UseFactoryProfile` on, the scoped failed-work operations require the Operator role claim of the Factory token: list operations filter by the tenant and project of the token and never return a row without a scope; acknowledge, replay and discard answer 404 for a row of another tenant and 403 for a row of another project. The job catalog routes, the trigger pause and resume and the operations on failed work without a scope require the Platform admin role and answer 403 to a token that holds only the Operator role. The role names come from the token contract constants the base template profile pins, and the MCP tools call the same checks.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With `UseFactoryProfile` on, the scoped failed-work operations require the Operator role claim of the Factory token: list operations filter by the tenant and project of the token and never return a row without a scope; acknowledge, replay and discard answer 404 for a row of another tenant and 403 for a row of another project. The job catalog routes, the trigger pause and resume and the operations on failed work without a scope require the Platform admin role and answer 403 to a token that holds only the Operator role. The role names come from the token contract constants the base template profile pins, and the MCP tools call the same checks."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1023]",
      "number": 1023
    },
    {
      "id": "AIFACTORY-TASK-1024",
      "type": "task",
      "parent": "AIFACTORY-US-210",
      "title": "Verify the scope on the records and the refusals of the admin surface",
      "sequence": "18.16.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the scope on the records and the refusals of the admin surface. Expected output: Run the unit and acceptance tests of a worker generated with `UseFactoryProfile` with tokens of two tenants, of two projects of one tenant and of a Platform admin, and with one message id and one payload hash processed for two tenants on the SQL store without a key violation; the scoped rows, the filtered lists, the 404 and 403 refusals and the worker-level operations that only the Platform admin token passes, together with the tests of a worker generated without the profile, which has no scope migration and keeps the key of message id and payload hash, prove AC1 to AC4 of AIFACTORY-US-210 (ADR-0015).. Kind: verification. Repository: ConnectSoft.WorkerTemplate.",
      "acceptanceCriteria": [
        "Run the unit and acceptance tests of a worker generated with `UseFactoryProfile` with tokens of two tenants, of two projects of one tenant and of a Platform admin, and with one message id and one payload hash processed for two tenants on the SQL store without a key violation; the scoped rows, the filtered lists, the 404 and 403 refusals and the worker-level operations that only the Platform admin token passes, together with the tests of a worker generated without the profile, which has no scope migration and keeps the key of message id and payload hash, prove AC1 to AC4 of AIFACTORY-US-210 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1024]",
      "number": 1024
    },
    {
      "id": "AIFACTORY-US-211",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-171",
      "title": "Worker template: the Jobs table is the runtime catalog, the Scale section is in the generated settings and Hangfire recurring jobs take the singleton lease",
      "sequence": "18.16.03",
      "description": "As an asset maintainer, I want the three gaps the worker template records against its own backlog to be closed before the Factory scaffolds a worker from it, so that a Factory worker keeps its operator changes across a restart, is shardable from its settings and never runs a singleton job twice. The pages of the worker template record three gaps that stay open after its control-plane backlog. First, the worker-core page states that the runtime catalog is an in-memory overlay seeded from configuration and that the Jobs table is not read at run time, although its design asks that a change made by an operator persists in the worker store; a pause or a schedule change is therefore lost when the process restarts. Second, the worker-ops page states that the shard queues and shard tags are bound on the Scale section while the application settings of the template are unchanged, so a generated worker has no place where the section is visible and documented. Third, both pages state that Hangfire recurring execution does not take the singleton lease that every other singleton source takes, and that the storage election of Hangfire is not to be reimplemented. This PBI closes them. The overlay is the engine type `InMemoryJobCatalog` of `ConnectSoft.Workers.Runtime`, which already seeds from configuration, lets the operator win and logs the override. The durable catalog is therefore delivered in the engine, as the SQL `IJobCatalog` of the feature `component-workers-runtime-library`, beside the other SQL stores of the engine, and the template neither re-implements nor wraps it. The template owns the Jobs table, which its migration `WorkerControlPlaneMigration` creates, and the wiring: the columns the SQL catalog reads, the catalog provider option in the generated settings, the registration and a restart test on the pinned engine. With that, the Jobs table is the runtime catalog and the in-memory catalog its cache: the catalog is loaded from the table at start, the configuration seeds a job the table does not have, and a change made by an operator wins over the seed and is logged. Here an operator is whoever the admin policy of the worker admits; under the Factory profile that caller holds the Platform admin role, because the job catalog is a worker-level operation, as AIFACTORY-US-210 states. The Scale section appears in the generated settings with empty arrays, which own every queue and tag, and in the two-replica runbook. Hangfire recurring execution takes the lease before it runs a singleton job and skips the run when it does not hold it; if that proves incompatible with the Hangfire server, the reason is recorded in the worker-core page together with a test that proves a single run across two replicas. Kind: enabling. Traces: adrs: ADR-0028. Depends on: feature:component-workers-runtime-library. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a worker with a SQL store whose generated settings select the SQL catalog provider of the pinned engine, when an operator pauses a job or changes its schedule and the process restarts, then the SQL `IJobCatalog` of `ConnectSoft.Workers.Runtime`, with `InMemoryJobCatalog` as its cache, loads the catalog from the Jobs table of the template with the change in place, a job that exists only in the configuration is seeded, and the change of the operator wins over the seed and is logged (docs/architecture/ecosystem-composition.md lists the catalog gap; ADR-0028).",
        "AC2: Given a generated worker, when its application settings are read, then the Scale section is present with empty shard queues and shard tags, which own every queue and tag, and two replicas configured with disjoint shards each dispatch only their own jobs, as the two-replica runbook of the template states (docs/architecture/ecosystem-composition.md lists the scale gap; ADR-0028).",
        "AC3: Given two replicas with a SQL or Redis lease provider and a Hangfire recurring job marked singleton, when its schedule fires, then the job runs once because the execution takes the singleton lease and the replica without the lease skips the run; if the lease cannot be taken on that path, the reason is recorded in the worker-core page with a test that proves the single run (ADR-0028, docs/architecture/ecosystem-composition.md lists the lease gap)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-621",
        "AIFACTORY-TASK-1025",
        "AIFACTORY-TASK-1026",
        "AIFACTORY-TASK-1027"
      ],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1803,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-workers-runtime-library"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-211]",
      "number": 211
    },
    {
      "id": "AIFACTORY-TASK-621",
      "type": "task",
      "parent": "AIFACTORY-US-211",
      "title": "Jobs table as the runtime catalog with the in-memory overlay as its cache",
      "sequence": "18.16.03.01",
      "description": "BEFORE DEVELOPMENT. Jobs table as the runtime catalog with the in-memory overlay as its cache. Expected output: The template side of the durable catalog, on the pinned engine that carries the SQL `IJobCatalog`: the Jobs table of `WorkerControlPlaneMigration` has the columns that catalog reads, the generated settings carry the catalog provider option with the SQL value when the worker has a SQL store, the host registration passes the option to the engine, and a restart test of the template proves that an operator mutation survives a restart. With that the Jobs table is the runtime catalog and the in-memory catalog of the engine its cache; the template defines no catalog type of its own.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template side of the durable catalog, on the pinned engine that carries the SQL `IJobCatalog`: the Jobs table of `WorkerControlPlaneMigration` has the columns that catalog reads, the generated settings carry the catalog provider option with the SQL value when the worker has a SQL store, the host registration passes the option to the engine, and a restart test of the template proves that an operator mutation survives a restart. With that the Jobs table is the runtime catalog and the in-memory catalog of the engine its cache; the template defines no catalog type of its own."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-621]",
      "number": 621
    },
    {
      "id": "AIFACTORY-TASK-1025",
      "type": "task",
      "parent": "AIFACTORY-US-211",
      "title": "Scale section in the generated settings and in the two-replica runbook",
      "sequence": "18.16.03.02",
      "description": "BEFORE DEVELOPMENT. Scale section in the generated settings and in the two-replica runbook. Expected output: The generated application settings carry the Scale section with empty shard queues and shard tags; the compose file of the two-replica runbook sets disjoint shards for the two workers; the scale runbook page of the template describes the section.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated application settings carry the Scale section with empty shard queues and shard tags; the compose file of the two-replica runbook sets disjoint shards for the two workers; the scale runbook page of the template describes the section."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1025]",
      "number": 1025
    },
    {
      "id": "AIFACTORY-TASK-1026",
      "type": "task",
      "parent": "AIFACTORY-US-211",
      "title": "Singleton lease on Hangfire recurring execution or the recorded reason",
      "sequence": "18.16.03.03",
      "description": "BEFORE DEVELOPMENT. Singleton lease on Hangfire recurring execution or the recorded reason. Expected output: Hangfire recurring execution of a singleton job takes the singleton lease like the other singleton sources and skips the run without it; if the lease cannot be taken on that path, the worker-core page records the reason and a test proves a single run across two replicas.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Hangfire recurring execution of a singleton job takes the singleton lease like the other singleton sources and skips the run without it; if the lease cannot be taken on that path, the worker-core page records the reason and a test proves a single run across two replicas."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1026]",
      "number": 1026
    },
    {
      "id": "AIFACTORY-TASK-1027",
      "type": "task",
      "parent": "AIFACTORY-US-211",
      "title": "Verify the persisted catalog, the shards and the single run on two replicas",
      "sequence": "18.16.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the persisted catalog, the shards and the single run on two replicas. Expected output: Run the tests of the template with two worker processes on one SQL store and the pinned engine: an operator change survives a restart through the SQL catalog of the engine, disjoint shards split the jobs and a singleton recurring job runs once; the run proves AC1 to AC3 of AIFACTORY-US-211 (ADR-0028).. Kind: verification. Repository: ConnectSoft.WorkerTemplate.",
      "acceptanceCriteria": [
        "Run the tests of the template with two worker processes on one SQL store and the pinned engine: an operator change survives a restart through the SQL catalog of the engine, disjoint shards split the jobs and a singleton recurring job runs once; the run proves AC1 to AC3 of AIFACTORY-US-211 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1027]",
      "number": 1027
    },
    {
      "id": "AIFACTORY-US-212",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-171",
      "title": "Worker template: the boolean `UseFactoryProfile` turns on the Orleans trigger, the scope, the role requirements and the readiness tags together",
      "sequence": "18.16.04",
      "description": "As an asset maintainer, I want one template symbol that generates a worker in the shape of the Factory, so that the runtime worker, the reconcilers and the dispatchers are scaffolded with one option instead of a list of options that can be combined wrongly. The worker template has a parameter for the trigger with the values Bus, Hangfire, Timer, Queue and All, one for the idempotency provider with None, Sql and Redis, one for the failure sinks, the switch `EnableAdmin`, false by default, without which the admin routes, the operations page and the `WorkerOps` policy are not generated, and the messaging and actor model choices it inherits from the base template, where `UseOrleans` is computed from `ActorModelType` (model/template-parameters/connectsoft-worker.yaml). The pieces of the earlier PBIs each hang on one of them, and a Factory worker needs all of them at once: the Orleans messaging choice with its trigger, the Orleans actor model that choice needs, a durable idempotency and failed-work store, the required scope on message-shaped work, and the admin surface with the Operator and Platform admin requirements on it. The profile symbol is settled by decision D114 and the amendment of ADR-0028 on the Factory profile switch: the boolean `UseFactoryProfile`, off by default, with the same name in the base, worker, gateway and library templates, passed by the Factory scaffold command. The worker template composes on the base template through its submodule, so `UseFactoryProfile` is one symbol of the composed configuration: the base template declares it and derives its own shape from it, and this PBI adds the computed symbols of the worker in `template/worker.template.extend.json` and declares no second profile symbol. With the symbol on, computed symbols derive the Orleans actor model, the Orleans messaging choice, the bus trigger on the Orleans adapter, the SQL idempotency provider with the scoped key and its migration, `EnableAdmin` true, the scope requirement and the Operator and Platform admin requirements of the admin surface, whatever the single options say, and the broker registrations and the saga scaffolding of the flow model are excluded, as ADR-0024 decision 4 removes broker sagas from the design. The rule for a conflicting single option is stated once: under the profile it is overridden by the computed symbols and is not refused, so the effective actor model is always Orleans and the admin surface always exists. The refusal of the base template, which names both symbols when the Orleans messaging choice meets another actor model, applies to a generation without the profile and is never reached under it. The health checks of the Orleans trigger, the stores and the lease are registered with the readiness tag of the work-aware readiness the worker-core page describes, so that a worker that cannot take work is not ready. With the symbol off, which is its default, the template generates what it generates today, the processed-message key of message id and payload hash included. The parameters page of the template documents the symbol, and the inventory of the documentation repository picks it up. Kind: enabling. Traces: adrs: ADR-0012, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-209, AIFACTORY-US-210, AIFACTORY-US-211. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-worker.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given the worker template, when a worker is generated with `UseFactoryProfile` true and no other option, then it carries the Orleans actor model, the Orleans messaging choice with its trigger, the SQL idempotency and failed-work stores with the scoped key and its migration, the admin routes, the operations page and the `WorkerOps` policy that `EnableAdmin` generates, with the Operator and Platform admin requirements of AIFACTORY-US-210 on them, and the required scope on message-shaped work; it contains no broker registration and no saga type, and it builds and passes its tests (ADR-0012, ADR-0024 decision 4).",
        "AC2: Given `UseFactoryProfile` is true and a conflicting single option is passed, such as a broker messaging value, the idempotency provider None, `--enable-admin false` or another actor model, when the worker is generated, then the computed symbols of the profile win and the generated settings and projects show the profile values, the admin surface and the Orleans actor model included; with the symbol off, which is its default, the generated worker is unchanged from the template of today, the processed-message key of message id and payload hash included, which a comparison of the default case proves (ADR-0028 amendment on the Factory profile switch, model/template-parameters/connectsoft-worker.yaml lists `UseFactoryProfile` after the next inventory).",
        "AC3: Given a worker generated with `UseFactoryProfile`, when its Orleans trigger, its store or its lease is unavailable, then the readiness of the worker reports not ready through the tagged health checks while the liveness route stays healthy, and the parameters page of the template documents `UseFactoryProfile` and what it turns on (ADR-0028, docs/architecture/catalogs/templates.md keeps the row of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-worker.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1028",
        "AIFACTORY-TASK-1029",
        "AIFACTORY-TASK-1030"
      ],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1804,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-209",
        "AIFACTORY-US-210",
        "AIFACTORY-US-211"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-worker.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-212]",
      "number": 212
    },
    {
      "id": "AIFACTORY-TASK-1028",
      "type": "task",
      "parent": "AIFACTORY-US-212",
      "title": "UseFactoryProfile and the computed symbols of the worker in the composed template configuration",
      "sequence": "18.16.04.01",
      "description": "BEFORE DEVELOPMENT. UseFactoryProfile and the computed symbols of the worker in the composed template configuration. Expected output: The composed template configuration carries the boolean `UseFactoryProfile`, off by default, under the name the base template declares and received with the submodule of AIFACTORY-TASK-1019; `template/worker.template.extend.json` adds the computed symbols of the worker, which derive the Orleans actor model, the Orleans messaging choice, the bus trigger, the SQL idempotency provider with the scoped key and its migration, `EnableAdmin` true, the scope requirement and the Operator and Platform admin requirements from it, override a conflicting single option and exclude the broker registrations and the saga scaffolding; the worker declares no second profile symbol, and the command line host file exposes the option.. Kind: contract. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The composed template configuration carries the boolean `UseFactoryProfile`, off by default, under the name the base template declares and received with the submodule of AIFACTORY-TASK-1019; `template/worker.template.extend.json` adds the computed symbols of the worker, which derive the Orleans actor model, the Orleans messaging choice, the bus trigger, the SQL idempotency provider with the scoped key and its migration, `EnableAdmin` true, the scope requirement and the Operator and Platform admin requirements from it, override a conflicting single option and exclude the broker registrations and the saga scaffolding; the worker declares no second profile symbol, and the command line host file exposes the option."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1804,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1028]",
      "number": 1028
    },
    {
      "id": "AIFACTORY-TASK-1029",
      "type": "task",
      "parent": "AIFACTORY-US-212",
      "title": "Readiness tags and generated settings of the profile",
      "sequence": "18.16.04.02",
      "description": "BEFORE DEVELOPMENT. Readiness tags and generated settings of the profile. Expected output: With UseFactoryProfile on, the health checks of the Orleans trigger, the idempotency and failed-work stores and the lease carry the readiness tag, the generated settings hold the trigger, idempotency, lease and scope sections with the profile values, and the parameters page of the template documents the symbol.. Kind: implementation. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With UseFactoryProfile on, the health checks of the Orleans trigger, the idempotency and failed-work stores and the lease carry the readiness tag, the generated settings hold the trigger, idempotency, lease and scope sections with the profile values, and the parameters page of the template documents the symbol."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1029]",
      "number": 1029
    },
    {
      "id": "AIFACTORY-TASK-1030",
      "type": "task",
      "parent": "AIFACTORY-US-212",
      "title": "Verify the profile on, the profile off and the conflicting option",
      "sequence": "18.16.04.03",
      "description": "BEFORE DEVELOPMENT. Verify the profile on, the profile off and the conflicting option. Expected output: Generate a worker with `UseFactoryProfile` true, one without it, one with the profile on and a broker messaging value, one with the profile on and `--enable-admin false` and one with the profile on and another actor model; build and test each; every profile case carries the profile values, the Orleans actor model, the admin surface under the Operator and Platform admin requirements and no broker registration, and the case without the symbol equals the default case, the key of message id and payload hash included, which proves AC1 to AC3 of AIFACTORY-US-212 (ADR-0024).. Kind: verification. Repository: ConnectSoft.WorkerTemplate.",
      "acceptanceCriteria": [
        "Generate a worker with `UseFactoryProfile` true, one without it, one with the profile on and a broker messaging value, one with the profile on and `--enable-admin false` and one with the profile on and another actor model; build and test each; every profile case carries the profile values, the Orleans actor model, the admin surface under the Operator and Platform admin requirements and no broker registration, and the case without the symbol equals the default case, the key of message id and payload hash included, which proves AC1 to AC3 of AIFACTORY-US-212 (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1030]",
      "number": 1030
    },
    {
      "id": "AIFACTORY-US-213",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-171",
      "title": "Worker template: the shared template pipeline gates the default generation and one Factory profile case, and the package publishes only on their complete reports",
      "sequence": "18.16.05",
      "description": "As an asset maintainer, I want every change of the worker template to be gated by its generated cases, so that a package that would generate a worker that does not build, start or pass its tests never reaches the feed. This PBI is the gate of the feature. The amendment of ADR-0028 on the Factory templates scaffolds a Factory repository only from a template package, and the epic is done only when each template publishes a package that passes its generated-solution gate. The estate has one gate mechanism for templates, the shared template pipeline of `ConnectSoft.AzurePipelines` (`template-ci/v1`): one packed candidate, the scaffold cases of the manifest `build/template-ci.json` of the consumer, result validation and publication on the complete reports of every selected case. Its rollout ledger lists the worker template as pending behind the base template, and its Domain profile declares one case per supported artifact kind. Decision D114 and the amendment of ADR-0028 on the Factory profile switch admit one additional gating case per declared profile and keep the default generations gated as today. The worker template declares one profile, `UseFactoryProfile`, so its manifest holds the default cases and exactly one more gating case: a worker generated with `UseFactoryProfile` true and no other option. The two further generations the feature exercises, the profile with the Redis lease provider and the generation with every trigger on, are not gating cases: they are cases of the Compatibility profile of the manifest, which runs on request and never decides publication. For each gating case the shared installer jobs install the candidate, generate the solution, restore it with the engine `ConnectSoft.Workers.Runtime` taken from the ConnectSoft feed at the pinned version, build in Release, run the unit, architecture and acceptance tests with the discovery and completion checks, and run the validator of the case, which scans the output for template placeholders that were not replaced. The scope migration, the two-tenant case of the scoped key and the sample message flow on the Orleans trigger run in the Factory profile case only, since the default generation selects none of them. A case that fails any stage fails the run with the case and the stage named, and no later stage of that case is reported as passed. Publication requires the complete reports of the default cases and of the Factory profile case, pushes the package with a verified version and refuses a version that is already on the feed. A fixture with a planted defect proves that the gate refuses. The logs of every case are kept as artifacts of the run. The gate proves the template; it does not prove a deployed worker, which is the work of the services that are scaffolded from the package. Kind: evidence. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-212. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the worker template, when its pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the default generation is gated as today and exactly one additional gating case is generated with `UseFactoryProfile` true, and each gating case is restored with the engine from the ConnectSoft feed, built in Release, tested with the discovery and completion checks and scanned for placeholders; the scope migration, the two-tenant case of the scoped key and the sample message flow on the Orleans trigger run in the Factory profile case (ADR-0028 amendments on the Factory templates and on the Factory profile switch, model/components.yaml).",
        "AC2: Given a gating case fails any stage, when the pipeline evaluates the run, then the run fails with the case and the stage named, no later stage of that case is reported as passed and publication is not reached; a fixture with a planted defect in the Factory profile case proves the refusal, and the Compatibility cases, the profile with the Redis lease provider and the generation with every trigger on, run on request and never decide publication (ADR-0028).",
        "AC3: Given the complete reports of the default cases and of the Factory profile case, when publication runs, then the package is pushed to the ConnectSoft feed with a verified version, a version that is already on the feed is refused, the logs of every case are kept as artifacts, and an install of the published package followed by a generation with `UseFactoryProfile` builds unchanged (ADR-0028, model/backlog/epics.yaml states the gate as the completion of the epic)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1031",
        "AIFACTORY-TASK-1032",
        "AIFACTORY-TASK-1033",
        "AIFACTORY-TASK-622"
      ],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1805,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-212"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-213]",
      "number": 213
    },
    {
      "id": "AIFACTORY-TASK-1031",
      "type": "task",
      "parent": "AIFACTORY-US-213",
      "title": "Template pipeline manifest of the worker template with the default cases and the one Factory profile case",
      "sequence": "18.16.05.01",
      "description": "BEFORE DEVELOPMENT. Template pipeline manifest of the worker template with the default cases and the one Factory profile case. Expected output: The worker template adopts the shared template pipeline: `build/template-ci.json` names its identity, solution, packaging and tests, declares in the Domain profile the default cases and one additional gating case that generates with `UseFactoryProfile` true, with its test filter and the required services SQL Server and a co-hosted silo, and holds the profile with the Redis lease provider and the generation with every trigger on as cases of the Compatibility profile; `azure-pipelines-template.yml` runs the shared installer jobs, each gating case restores from the ConnectSoft feed, builds, tests and is scanned for placeholders, and the logs are kept as artifacts.. Kind: operations. Repository: ConnectSoft.WorkerTemplate. Verification: azure-pipelines-template.yml runs the shared installer jobs and the manifest lists the default cases and one Factory profile case.",
      "acceptanceCriteria": [
        "The worker template adopts the shared template pipeline: `build/template-ci.json` names its identity, solution, packaging and tests, declares in the Domain profile the default cases and one additional gating case that generates with `UseFactoryProfile` true, with its test filter and the required services SQL Server and a co-hosted silo, and holds the profile with the Redis lease provider and the generation with every trigger on as cases of the Compatibility profile; `azure-pipelines-template.yml` runs the shared installer jobs, each gating case restores from the ConnectSoft feed, builds, tests and is scanned for placeholders, and the logs are kept as artifacts."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1805,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1031]",
      "number": 1031
    },
    {
      "id": "AIFACTORY-TASK-1032",
      "type": "task",
      "parent": "AIFACTORY-US-213",
      "title": "Planted failing case fixture for the gate",
      "sequence": "18.16.05.02",
      "description": "BEFORE DEVELOPMENT. Planted failing case fixture for the gate. Expected output: A pipeline fixture generates the Factory profile case with a planted defect in its settings and asserts that the run fails at the test stage with the case named and that the publication stage is not reached.. Kind: fixture. Repository: ConnectSoft.WorkerTemplate. Verification: the planted-case run fails before publication.",
      "acceptanceCriteria": [
        "A pipeline fixture generates the Factory profile case with a planted defect in its settings and asserts that the run fails at the test stage with the case named and that the publication stage is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1805,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1032]",
      "number": 1032
    },
    {
      "id": "AIFACTORY-TASK-1033",
      "type": "task",
      "parent": "AIFACTORY-US-213",
      "title": "Publication on the complete reports of the gating cases, with the version guard",
      "sequence": "18.16.05.03",
      "description": "BEFORE DEVELOPMENT. Publication on the complete reports of the gating cases, with the version guard. Expected output: Publication of the template pipeline requires the complete reports of the default cases and of the Factory profile case, bound to the candidate, pushes the package to the ConnectSoft feed with a verified version and refuses a version that is already on the feed with the reason; a failed or incomplete gating case skips publication, and a Compatibility case never decides it.. Kind: operations. Repository: ConnectSoft.WorkerTemplate. Verification: a run with one failing gating case stops before publication and names the case.",
      "acceptanceCriteria": [
        "Publication of the template pipeline requires the complete reports of the default cases and of the Factory profile case, bound to the candidate, pushes the package to the ConnectSoft feed with a verified version and refuses a version that is already on the feed with the reason; a failed or incomplete gating case skips publication, and a Compatibility case never decides it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1805,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1033]",
      "number": 1033
    },
    {
      "id": "AIFACTORY-TASK-622",
      "type": "task",
      "parent": "AIFACTORY-US-213",
      "title": "Factory worker parameters and the generated-solution gate",
      "sequence": "18.16.05.04",
      "description": "BEFORE DEVELOPMENT. Factory worker parameters and the generated-solution gate. Expected output: One green run and one planted run of the gate: the shared installer jobs generate the default cases and the one Factory profile case, with `UseFactoryProfile` true, from the packed template, build and test the generated solutions, and the package is published to the feed with a verified version only on the green run, which proves AC1 to AC3 of AIFACTORY-US-213 (ADR-0028).. Kind: verification. Repository: ConnectSoft.WorkerTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One green run and one planted run of the gate: the shared installer jobs generate the default cases and the one Factory profile case, with `UseFactoryProfile` true, from the packed template, build and test the generated solutions, and the package is published to the feed with a verified version only on the green run, which proves AC1 to AC3 of AIFACTORY-US-213 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1805,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-622]",
      "number": 622
    },
    {
      "id": "AIFACTORY-US-112",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-171",
      "title": "Worker template: the Factory worker profile on the Orleans messaging profile is delivered and proven on a generated solution",
      "sequence": "18.16.06",
      "description": "As an asset maintainer, I want WorkerTemplate to carry the Factory worker profile on the Orleans messaging profile, so that it serves runtime worker, reconcilers, dispatchers; the Workers.Runtime engine in base-template services with background loops without later rework. This is the integration PBI of the feature. An asset maintainer packs the worker template with the Orleans trigger, the scope on its records, the Operator and Platform admin requirements on its admin surface, the closed catalog, scale and lease gaps and the symbol `UseFactoryProfile` of the earlier PBIs, and the shared template pipeline installs the package and gates the default generation and one Factory profile case. Every gating case restores the engine from the ConnectSoft feed, builds and passes its unit, architecture and acceptance tests before the package is allowed to publish with a verified version; a case that fails any stage fails the run and blocks publication. The implementation lives in the earlier PBIs of this file and in the library, base-template and authorization-server features the feature depends on; this PBI proves them together on a worker generated from the published package with `UseFactoryProfile`. The feature is done when such a worker consumes a scoped message from the Orleans messaging profile, records failed work with its tenant and project, lets an Operator of that project replay it and refuses an Operator of another, leaves the job catalog, the triggers and failed work without a scope to the Platform admin role, keeps a change of the catalog across a restart and runs a singleton job once on two replicas, while a worker generated without the profile keeps the processed-message key and the behaviour of today. Repository of the feature: ConnectSoft.WorkerTemplate. The service that is scaffolded from the package in a later increment is the agent runtime. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-209, AIFACTORY-US-210, AIFACTORY-US-211, AIFACTORY-US-212, AIFACTORY-US-213. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-worker.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.WorkerTemplate, when the template is packed, installed and instantiated in its pipeline, then the generated solution of every gating 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-619 (trigger adapter for the Orleans messaging profile) is done, then a trigger over the outbox and inbox grains of the Orleans messaging profile joins the adapters of the first version and is selected by the existing messaging symbols, the identifiers of the accepted envelope are read into the dispatch, and the sample message flow runs on it in the acceptance tests (ADR-0012, ADR-0014 decision 1).",
        "AC3: Given the work of AIFACTORY-TASK-620 (Factory scope on failed work, idempotency and the admin surface) is done, then under `UseFactoryProfile` failed work and processed-message rows carry the tenant and project of the envelope, the admin routes, the operations page and the MCP tools read the scope from the Factory token and refuse a row outside it, an Operator acts only on the rows of their own projects and the worker-level operations need the Platform admin role, with a test for a token of another project, while a worker generated without the profile keeps its key and its policy (ADR-0015 decision 5 and its amendment on worker operations).",
        "AC4: Given the work of AIFACTORY-TASK-621 (Jobs table as the runtime catalog) and of the scale and lease tasks of AIFACTORY-US-211 is done, then operator mutations survive a restart, the Scale section is in the generated settings, and Hangfire recurring execution takes the singleton lease or the reason it must not is recorded with a test that proves a single run (ADR-0028, docs/architecture/ecosystem-composition.md).",
        "AC5: Given the work of AIFACTORY-TASK-622 (Factory worker parameters and the generated-solution gate) is done, then the boolean `UseFactoryProfile` turns the Orleans trigger, the scope and the readiness tags on together, the shared template pipeline gates the default generation and one case generated with the symbol, builds and tests the generated solutions, and the package is published to the feed with a verified version (ADR-0024, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-worker.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1034",
        "AIFACTORY-TASK-694"
      ],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1806,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-209",
        "AIFACTORY-US-210",
        "AIFACTORY-US-211",
        "AIFACTORY-US-212",
        "AIFACTORY-US-213"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-worker.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-112]",
      "number": 112
    },
    {
      "id": "AIFACTORY-TASK-1034",
      "type": "task",
      "parent": "AIFACTORY-US-112",
      "title": "Template inventory of the documentation repository lists UseFactoryProfile",
      "sequence": "18.16.06.01",
      "description": "BEFORE DEVELOPMENT. Template inventory of the documentation repository lists UseFactoryProfile. Expected output: After the package is published, `python -I tools/docs_model inventory-templates` is run so that `UseFactoryProfile` and the Orleans value of the messaging choice appear in model/template-parameters/connectsoft-worker.yaml and in the switches of the worker template in model/templates.yaml without a hand edit.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "After the package is published, `python -I tools/docs_model inventory-templates` is run so that `UseFactoryProfile` and the Orleans value of the messaging choice appear in model/template-parameters/connectsoft-worker.yaml and in the switches of the worker template in model/templates.yaml without a hand edit."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1806,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1034]",
      "number": 1034
    },
    {
      "id": "AIFACTORY-TASK-694",
      "type": "task",
      "parent": "AIFACTORY-US-112",
      "title": "Verify worker-template-factory-profile-delivered by running the declared command",
      "sequence": "18.16.06.02",
      "description": "BEFORE DEVELOPMENT. Verify worker-template-factory-profile-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on a worker generated from the published package with UseFactoryProfile; they pass and prove AC1 to AC5 of AIFACTORY-US-112.. Kind: verification. Repository: ConnectSoft.WorkerTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on a worker generated from the published package with UseFactoryProfile; they pass and prove AC1 to AC5 of AIFACTORY-US-112."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-core.md",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 18,
      "phase": "templates-and-libraries",
      "stackRank": 1806,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-694]",
      "number": 694
    },
    {
      "id": "AIFACTORY-FEAT-172",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Workers.Runtime library: the worker engine published and shaped for Factory services",
      "sequence": "18.17",
      "description": "The worker template's engine already lives in its own repository and package, ConnectSoft.Workers.Runtime (B-F06): options, drain, idempotency store, failed-work model and sinks, job catalog and lease, IWorkTrigger, shard filter and metric names, with the ASP.NET host, Hangfire dashboard, MCP and Pulumi kept in the template. Its status page records that the package pipeline is not created and the template cannot restore it from the feed. The Factory's base-template services with background loops (environment promotion, pipeline polling, retention sweeps, outbox maintenance) would each write their own drain, idempotency and lease; they register this engine instead, once it carries scope and the envelope identifiers in its contracts. Component: WorkerTemplate (extend), library ConnectSoft.Workers.Runtime. BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 17 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-206",
        "AIFACTORY-US-219",
        "AIFACTORY-US-207",
        "AIFACTORY-US-208",
        "AIFACTORY-US-111"
      ],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1700,
      "titlePrefix": "[AIFACTORY-FEAT-172]",
      "number": 172
    },
    {
      "id": "AIFACTORY-US-206",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-172",
      "title": "Workers.Runtime library: work items and failed work carry tenant, project, run, step and attempt identity, and the scoped idempotency key is an option beside the unchanged default store",
      "sequence": "18.17.01",
      "description": "As an asset maintainer, I want the contracts of the worker engine to carry the scope and the envelope identity of the work they dispatch, so that a Factory service that registers the engine attributes every processed message and every failed work record to its tenant, project and run. The Features page of `ConnectSoft.Workers.Runtime` lists what the engine owns: registration through `AddWorkersRuntime`, the drain coordinator, idempotency with in-memory, SQL and Redis stores, the failed-work store with its sinks, the job catalog, the singleton lease, the triggers and the dispatcher. The worker-core page of the worker template describes the stored shapes: a processed message is keyed by message id and payload hash with a completion time, and failed work has the statuses Open, Acked, Replayed and Discarded. None of these contracts names a tenant, a project or a run, because the template is an operations tool for one tenant by a locked decision of its own backlog. A Factory message travels under the envelope of ADR-0014, whose decision 1 requires tenant, project, run, step and attempt identity and whose decision 3 defines idempotency per trusted scope and operation. This PBI adds a scope value to the engine, in the namespace of the library, with tenant id, project id, run id, step id, attempt id, event id and correlation id; the engine keeps this minimal scope type of its own and references no AI package, so a host that registers only the engine takes no Factory library. `WorkItem` carries it, a trigger fills it from the envelope of the message, the dispatcher hands it to the message and job handlers, and the failure sinks report it. The stored key is settled by decision D114 and the amendment of ADR-0028 on the Factory profile switch: the key scoped by tenant and project is an option of the engine that the Factory profile selects, and the default store does not change. Without the option a processed message is keyed by message id and payload hash exactly as today: `SqlIdempotencyStore` reads the table `ProcessedMessages` under its primary key of message id and payload hash, the failed-work table keeps its columns, and an existing worker behaves as before. With the option, the stored key of a processed message is tenant, project and message id with the payload hash as a compared column: the same message id and hash of two tenants do not collide, a repeat with the same payload hash is answered as already processed, and a repeat with a different hash is a conflict that is recorded as failed work. Under the same option the SQL failed-work store writes the scope columns of `FailedWorkRecord` and the failed-work filter selects by tenant and project. A second option requires the scope for message-shaped work, and work that arrives without it is refused and recorded; the Factory profile sets both options together, so no processed-message row without a tenant and a project is written under the scoped key. Job-shaped work of the catalog stays unscoped, and the catalog itself stays per worker. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0024, ADR-0028. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a trigger that dispatches a message read from an envelope, when the dispatcher calls the message handler, then the `WorkItem` carries the tenant id, project id, run id, step id, attempt id, event id and correlation id of the envelope as a scope value of the namespace `ConnectSoft.Workers.Runtime`, and the handler and the failure sinks receive it unchanged (ADR-0014 decision 1).",
        "AC2: Given the SQL and the Redis idempotency stores with the scoped key selected, whose stored key of a processed message is tenant, project and message id with the payload hash as a compared column, when the same message id with the same payload hash is processed for two tenants, then the two do not collide; a repeat of the same scope, message id and payload hash is answered as already processed and a repeat with a different payload hash is a conflict recorded as failed work, which is the idempotency rule of ADR-0014 decision 3 and the deduplication scope ADR-0012 decision 2 asks a profile to declare.",
        "AC3: Given the option that requires scope for message-shaped work, when a message arrives without tenant or project, then the dispatcher refuses it before the handler and records it as failed work with the reason; with the scoped key selected the SQL failed-work store writes the scope of `FailedWorkRecord` and the failed-work filter selects by tenant and project, and job-shaped work of the catalog is dispatched without a scope, since the job catalog stays per worker (ADR-0014, model/components.yaml).",
        "AC4: Given a host that does not select the scoped key, when the engine is registered and a message is processed, then the processed message is keyed by message id and payload hash as today, `SqlIdempotencyStore` and the SQL failed-work store read and write the tables of today without a new column or key, and the existing tests of the stores pass unchanged, because the scoped key exists only as the option the Factory profile selects (ADR-0028 amendment on the Factory profile switch, ADR-0014 decision 3)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-624",
        "AIFACTORY-TASK-1010",
        "AIFACTORY-TASK-1011",
        "AIFACTORY-TASK-1012"
      ],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1701,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-206]",
      "number": 206
    },
    {
      "id": "AIFACTORY-TASK-624",
      "type": "task",
      "parent": "AIFACTORY-US-206",
      "title": "Scope and envelope identifiers in the engine contracts",
      "sequence": "18.17.01.01",
      "description": "BEFORE DEVELOPMENT. Scope and envelope identifiers in the engine contracts. Expected output: `IWorkTrigger`, the work item of the dispatch and the failed-work model carry tenant, project, run, step and attempt identity as library types in the `ConnectSoft.Workers.Runtime` namespace, in a minimal scope type of the engine that references no AI package; the idempotency key takes the scope when the scoped key is selected; the message and job handler contracts receive the scope; the Generic Host sample of the getting started page shows a scoped work item.. Kind: implementation. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`IWorkTrigger`, the work item of the dispatch and the failed-work model carry tenant, project, run, step and attempt identity as library types in the `ConnectSoft.Workers.Runtime` namespace, in a minimal scope type of the engine that references no AI package; the idempotency key takes the scope when the scoped key is selected; the message and job handler contracts receive the scope; the Generic Host sample of the getting started page shows a scoped work item."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-624]",
      "number": 624
    },
    {
      "id": "AIFACTORY-TASK-1010",
      "type": "task",
      "parent": "AIFACTORY-US-206",
      "title": "Scoped idempotency key as an option of the in-memory, SQL and Redis stores",
      "sequence": "18.17.01.02",
      "description": "BEFORE DEVELOPMENT. Scoped idempotency key as an option of the in-memory, SQL and Redis stores. Expected output: The options of the engine gain the scoped key, off by default. Without it the in-memory, SQL and Redis idempotency stores key a processed message by message id and payload hash as today, and `SqlIdempotencyStore` reads and writes `ProcessedMessages` under the key of today. With it the stores key a processed message by tenant, project and message id and keep the payload hash as a compared value: a repeat with the same hash is reported as already processed and a repeat with a different hash as a conflict. docs/Features.md of the library lists the option and names the Factory profile of the worker template as what selects it.. Kind: implementation. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The options of the engine gain the scoped key, off by default. Without it the in-memory, SQL and Redis idempotency stores key a processed message by message id and payload hash as today, and `SqlIdempotencyStore` reads and writes `ProcessedMessages` under the key of today. With it the stores key a processed message by tenant, project and message id and keep the payload hash as a compared value: a repeat with the same hash is reported as already processed and a repeat with a different hash as a conflict. docs/Features.md of the library lists the option and names the Factory profile of the worker template as what selects it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1010]",
      "number": 1010
    },
    {
      "id": "AIFACTORY-TASK-1011",
      "type": "task",
      "parent": "AIFACTORY-US-206",
      "title": "Scope columns and the scoped key of the SQL stores and the schema check at start",
      "sequence": "18.17.01.03",
      "description": "BEFORE DEVELOPMENT. Scope columns and the scoped key of the SQL stores and the schema check at start. Expected output: With the scoped key selected the SQL failed-work and idempotency stores read and write tenant, project, run, step and attempt columns, and `ProcessedMessages` is read under the key of tenant, project and message id with the payload hash as a column. The schema script of the engine that AIFACTORY-TASK-1057 ships carries that scoped shape beside the default shape, whose key of message id and payload hash is the one migration 2 of the worker template created. At start the stores check the columns and the key of the shape the options select and fail with the missing column or the other key named; without the option the stores run on the tables of today and need no new column.. Kind: migration. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With the scoped key selected the SQL failed-work and idempotency stores read and write tenant, project, run, step and attempt columns, and `ProcessedMessages` is read under the key of tenant, project and message id with the payload hash as a column. The schema script of the engine that AIFACTORY-TASK-1057 ships carries that scoped shape beside the default shape, whose key of message id and payload hash is the one migration 2 of the worker template created. At start the stores check the columns and the key of the shape the options select and fail with the missing column or the other key named; without the option the stores run on the tables of today and need no new column."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1701,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1011]",
      "number": 1011
    },
    {
      "id": "AIFACTORY-TASK-1012",
      "type": "task",
      "parent": "AIFACTORY-US-206",
      "title": "Verify scoped dispatch, scoped idempotency and the refusal of unscoped messages",
      "sequence": "18.17.01.04",
      "description": "BEFORE DEVELOPMENT. Verify scoped dispatch, scoped idempotency and the refusal of unscoped messages. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the tests of the scoped work item, of two tenants with the same message id and the same payload hash on the in-memory and on the SQL store with the scoped key selected, of the hash conflict, of the refused message without scope and of the unchanged default stores on the key of message id and payload hash pass and prove AC1 to AC4 of AIFACTORY-US-206 (ADR-0014).. Kind: verification. Repository: ConnectSoft.Workers.Runtime.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the tests of the scoped work item, of two tenants with the same message id and the same payload hash on the in-memory and on the SQL store with the scoped key selected, of the hash conflict, of the refused message without scope and of the unchanged default stores on the key of message id and payload hash pass and prove AC1 to AC4 of AIFACTORY-US-206 (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1012]",
      "number": 1012
    },
    {
      "id": "AIFACTORY-US-219",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-172",
      "title": "Workers.Runtime library: a SQL job catalog loads the Jobs table at start, persists operator changes and keeps the in-memory catalog as its cache",
      "sequence": "18.17.02",
      "description": "As an asset maintainer, I want the job catalog of the worker engine to have a durable provider beside the in-memory one, so that a pause or a schedule change made by an operator survives a restart in every host that registers the engine, the worker template and a base-template service alike. The job catalog of the engine is the type `InMemoryJobCatalog`, the only implementation of `IJobCatalog` in `ConnectSoft.Workers.Runtime`. It is the in-memory overlay the worker-core page of the worker template describes: it is seeded from configuration, a change made by an operator wins over the seed and the override is logged, and the change is lost when the process restarts, because nothing reads the Jobs table that the migration of the worker template creates. Every other durable store of the engine lives in the engine and reads a table the host creates: `SqlIdempotencyStore`, `SqlFailedWorkStore` and `SqlSingletonLease`. The durable catalog belongs beside them, so that the worker template and a base-template service that registers the engine get the same behaviour and the template only wires it. This PBI adds a SQL implementation of `IJobCatalog` to the engine. At start it loads the catalog from the Jobs table, seeds a job that exists only in the configuration and keeps the in-memory catalog as its cache for reads. Upsert, Pause and Resume are written to the table before the cache changes; a change made by an operator wins over the seed of the configuration and is logged. A catalog provider option selects the in-memory or the SQL catalog, and the in-memory catalog stays the default, so an existing host is unchanged. When the SQL provider is selected and the Jobs table or one of its columns is missing, the start fails with the missing object named. When the store is unreachable during a mutation, the mutation is refused and the cache is not changed, so the cache never shows a state the table does not hold. The catalog stays per worker and carries no tenant or project. Kind: enabling. Traces: adrs: ADR-0028. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a host that selects the SQL catalog provider of `ConnectSoft.Workers.Runtime`, when an operator pauses a job or changes its schedule through `IJobCatalog` and the process restarts, then the catalog is loaded from the Jobs table with the change in place, a job that exists only in the configuration is seeded into the table, and the change of the operator wins over the seed and is logged (docs/architecture/ecosystem-composition.md lists the catalog gap of the worker template; ADR-0028).",
        "AC2: Given the SQL catalog, when Upsert, Pause or Resume is called, then the change is written to the Jobs table before the in-memory cache changes and reads are served from the cache; a mutation while the store is unreachable is refused and leaves the cache unchanged, proven by a test with a failing connection (ADR-0028 decision 5 gives each service its own store, model/components.yaml).",
        "AC3: Given a host that sets no catalog provider, when the engine is registered, then `InMemoryJobCatalog` is used as before; and given the SQL provider with a missing Jobs table or a missing column, when the host starts, then the start fails with the missing object named (ADR-0028, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1055",
        "AIFACTORY-TASK-1056",
        "AIFACTORY-TASK-1058"
      ],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1702,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-219]",
      "number": 219
    },
    {
      "id": "AIFACTORY-TASK-1055",
      "type": "task",
      "parent": "AIFACTORY-US-219",
      "title": "SQL job catalog beside the in-memory catalog",
      "sequence": "18.17.02.01",
      "description": "BEFORE DEVELOPMENT. SQL job catalog beside the in-memory catalog. Expected output: A SQL `IJobCatalog` beside `InMemoryJobCatalog` in `ConnectSoft.Workers.Runtime` loads the catalog from the Jobs table at start, seeds a job found only in configuration, persists Upsert, Pause and Resume before the cache changes, logs an operator override and keeps the in-memory catalog as its cache; a mutation with the store unreachable is refused and leaves the cache unchanged.. Kind: implementation. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A SQL `IJobCatalog` beside `InMemoryJobCatalog` in `ConnectSoft.Workers.Runtime` loads the catalog from the Jobs table at start, seeds a job found only in configuration, persists Upsert, Pause and Resume before the cache changes, logs an operator override and keeps the in-memory catalog as its cache; a mutation with the store unreachable is refused and leaves the cache unchanged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1055]",
      "number": 1055
    },
    {
      "id": "AIFACTORY-TASK-1056",
      "type": "task",
      "parent": "AIFACTORY-US-219",
      "title": "Catalog provider option, registration and the start check of the Jobs table",
      "sequence": "18.17.02.02",
      "description": "BEFORE DEVELOPMENT. Catalog provider option, registration and the start check of the Jobs table. Expected output: The options of the engine gain a catalog provider with the in-memory catalog as its default and the SQL catalog as its second value; `AddWorkersRuntime` registers the catalog the option selects; with the SQL provider the start checks the Jobs table and its columns and fails with the missing object named; docs/Features.md of the library lists the provider.. Kind: implementation. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The options of the engine gain a catalog provider with the in-memory catalog as its default and the SQL catalog as its second value; `AddWorkersRuntime` registers the catalog the option selects; with the SQL provider the start checks the Jobs table and its columns and fails with the missing object named; docs/Features.md of the library lists the provider."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1056]",
      "number": 1056
    },
    {
      "id": "AIFACTORY-TASK-1058",
      "type": "task",
      "parent": "AIFACTORY-US-219",
      "title": "Verify the persisted catalog across a restart and the refused mutation",
      "sequence": "18.17.02.03",
      "description": "BEFORE DEVELOPMENT. Verify the persisted catalog across a restart and the refused mutation. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the tests of the reload after a restart, the seeded job, the operator override, the refused mutation with a failing connection, the default provider and the start check pass and prove AC1 to AC3 of AIFACTORY-US-219 (ADR-0028).. Kind: verification. Repository: ConnectSoft.Workers.Runtime.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the tests of the reload after a restart, the seeded job, the operator override, the refused mutation with a failing connection, the default provider and the start check pass and prove AC1 to AC3 of AIFACTORY-US-219 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1058]",
      "number": 1058
    },
    {
      "id": "AIFACTORY-US-207",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-172",
      "title": "Workers.Runtime library: a base-template service registers the engine for its background loop with drain, idempotency, failed work and the singleton lease",
      "sequence": "18.17.03",
      "description": "As an asset maintainer, I want a guide and a conformance suite for a base-template service that registers the worker engine, so that the services with background loops reuse one drain, idempotency, failed-work and lease implementation instead of writing their own. The Factory has services on the base template that run background loops: environment promotion, pipeline polling, retention sweeps and outbox maintenance. Each would otherwise write its own drain, idempotency, failed-work handling and single-run guarantee. The worker-ops page of the worker template sets the boundary of the engine: the package uses the Generic Host and dependency injection abstractions only, and the ASP.NET host, the Hangfire dashboard, the MCP server, the operations pages and Pulumi stay in the template. The getting started page of the library holds a Generic Host sample. This PBI makes the engine consumable by a base-template service. The getting started page gains the registration of a reconciler loop in such a service: the job in the catalog, the handler, the drain coordinator wired to the stop of the host, the idempotency and failed-work stores on the relational store the service owns, and the singleton lease so that two replicas do not run the same job. The engine has no schema of its own today: its SQL stores read the tables `ProcessedMessages`, `FailedWork` and `Leases`, and the SQL catalog the table `Jobs`, of the schema `ConnectSoft.WorkerTemplate`, which only the migration of the worker template creates. The engine therefore ships an idempotent schema script for the four tables with a configurable schema name and the two shapes of the stores: the default shape, which equals the tables of today, and the scoped shape with the scope columns and the scoped key, which a Factory service selects together with the scoped key option. A base-template service applies the script from its own migration, and a test of the worker template keeps its migrations equal to the script, the default generation in the default shape and the Factory profile in the scoped shape. The page states the rules the pages of the template record: a periodic timer ticks only with a SQL or Redis lease provider and fails the start otherwise, and readiness mapping stays with the host. A conformance suite in the test support of the library lets a consuming service prove drain, a single run under two replicas, a repeat answered by idempotency and a failed-work record after exhausted retries. The guide and the suite are proven here on a sample host: a Generic Host test host under the tests folder of the library, which registers the engine the way the guide shows for a base-template service and has no template dependency. The proof on a generated base-template service belongs to the first service that registers the engine in a later increment. An architecture test keeps the forbidden references out of the package. The engine is for background loops; run and workflow state stays on the grains of ADR-0024 and never moves into the engine. Kind: enabling. Traces: adrs: ADR-0024, ADR-0028. Depends on: AIFACTORY-US-206, AIFACTORY-US-219. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0024-durable-execution-substrate.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the getting started page of the library, when a maintainer of a base-template service follows it, then the service registers `AddWorkersRuntime` for a reconciler loop with a catalog job, a handler, drain on host stop, idempotency and failed work on the relational store the service owns and the singleton lease, and the tables are created in the store of the service from the schema script of the engine, in the scoped shape when the service selects the scoped key, applied by the migration of the service under its own schema name, as ADR-0028 decision 5 gives each service its own store.",
        "AC2: Given the conformance suite of the library, when a consuming service runs it against its registration, then it proves that a stop request drains in-flight work, that two replicas run a singleton job once, that a repeated message is answered by idempotency and that exhausted retries leave one Open failed-work record; a periodic timer without a SQL or Redis lease provider fails the start (ADR-0024, model/components.yaml).",
        "AC3: Given the package `ConnectSoft.Workers.Runtime`, when the architecture test runs, then the package references no ASP.NET shared framework, no Hangfire dashboard, no MCP server package and no Pulumi package, and holds no run or workflow state type, which ADR-0024 decision 1 keeps on grains."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1013",
        "AIFACTORY-TASK-1057",
        "AIFACTORY-TASK-1014",
        "AIFACTORY-TASK-625"
      ],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1703,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-206",
        "AIFACTORY-US-219"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0024-durable-execution-substrate.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-207]",
      "number": 207
    },
    {
      "id": "AIFACTORY-TASK-1013",
      "type": "task",
      "parent": "AIFACTORY-US-207",
      "title": "Reconciler loop of a base-template service in the getting started page",
      "sequence": "18.17.03.01",
      "description": "BEFORE DEVELOPMENT. Reconciler loop of a base-template service in the getting started page. Expected output: docs/GettingStarted.md of the library shows a base-template service that registers `AddWorkersRuntime` for a reconciler loop: catalog job, handler, drain on host stop, SQL idempotency and failed work on the store of the service, the tables created from the schema script of the engine by the migration of the service, the singleton lease, the scoped key option and the option that requires the scope; the page lists what stays on the host.. Kind: documentation. Repository: ConnectSoft.Workers.Runtime. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "docs/GettingStarted.md of the library shows a base-template service that registers `AddWorkersRuntime` for a reconciler loop: catalog job, handler, drain on host stop, SQL idempotency and failed work on the store of the service, the tables created from the schema script of the engine by the migration of the service, the singleton lease, the scoped key option and the option that requires the scope; the page lists what stays on the host."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1703,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1013]",
      "number": 1013
    },
    {
      "id": "AIFACTORY-TASK-1057",
      "type": "task",
      "parent": "AIFACTORY-US-207",
      "title": "Schema script of the engine for ProcessedMessages, FailedWork, Leases and Jobs",
      "sequence": "18.17.03.02",
      "description": "BEFORE DEVELOPMENT. Schema script of the engine for ProcessedMessages, FailedWork, Leases and Jobs. Expected output: The engine ships an idempotent schema script for the tables `ProcessedMessages`, `FailedWork`, `Leases` and `Jobs` with a configurable schema name and a shape parameter: the default shape creates the tables as migration 2 of the worker template does, with message id and payload hash as the key of `ProcessedMessages`, and the scoped shape adds the scope columns and makes tenant, project and message id the key; the SQL stores and the SQL catalog read the schema name from the options, with `ConnectSoft.WorkerTemplate` as the default in place of the fixed name; docs/GettingStarted.md shows a base-template service applying the script in the scoped shape from its own migration; a test of the library applies the script twice to an empty database in each shape and runs the SQL stores on the result, and the script is the reference a test of the worker template compares its migrations with (AIFACTORY-TASK-1022).. Kind: migration. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The engine ships an idempotent schema script for the tables `ProcessedMessages`, `FailedWork`, `Leases` and `Jobs` with a configurable schema name and a shape parameter: the default shape creates the tables as migration 2 of the worker template does, with message id and payload hash as the key of `ProcessedMessages`, and the scoped shape adds the scope columns and makes tenant, project and message id the key; the SQL stores and the SQL catalog read the schema name from the options, with `ConnectSoft.WorkerTemplate` as the default in place of the fixed name; docs/GettingStarted.md shows a base-template service applying the script in the scoped shape from its own migration; a test of the library applies the script twice to an empty database in each shape and runs the SQL stores on the result, and the script is the reference a test of the worker template compares its migrations with (AIFACTORY-TASK-1022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1703,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1057]",
      "number": 1057
    },
    {
      "id": "AIFACTORY-TASK-1014",
      "type": "task",
      "parent": "AIFACTORY-US-207",
      "title": "Conformance suite for a consuming host",
      "sequence": "18.17.03.03",
      "description": "BEFORE DEVELOPMENT. Conformance suite for a consuming host. Expected output: A conformance suite in the test support of the library takes the service collection of a consuming host and runs the drain, single-run, idempotent repeat and failed-work cases against it with in-memory and SQL providers.. Kind: fixture. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A conformance suite in the test support of the library takes the service collection of a consuming host and runs the drain, single-run, idempotent repeat and failed-work cases against it with in-memory and SQL providers."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1014]",
      "number": 1014
    },
    {
      "id": "AIFACTORY-TASK-625",
      "type": "task",
      "parent": "AIFACTORY-US-207",
      "title": "Consumption guide and conformance tests for a base-template service",
      "sequence": "18.17.03.04",
      "description": "BEFORE DEVELOPMENT. Consumption guide and conformance tests for a base-template service. Expected output: The guide of AIFACTORY-TASK-1013 and the suite of AIFACTORY-TASK-1014 are run on a sample host: a Generic Host test host under tests/ of `ConnectSoft.Workers.Runtime` that registers the engine the way the guide shows for a base-template service (catalog job, handler, drain on host stop, SQL stores on tables created from the schema script, singleton lease) and has no template dependency. It registers `AddWorkersRuntime` for its reconciler loop and passes the suite; an architecture test keeps `Microsoft.AspNetCore.App`, the Hangfire dashboard, MCP and Pulumi out of the library, which proves AC1 to AC3 of AIFACTORY-US-207.. Kind: verification. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The guide of AIFACTORY-TASK-1013 and the suite of AIFACTORY-TASK-1014 are run on a sample host: a Generic Host test host under tests/ of `ConnectSoft.Workers.Runtime` that registers the engine the way the guide shows for a base-template service (catalog job, handler, drain on host stop, SQL stores on tables created from the schema script, singleton lease) and has no template dependency. It registers `AddWorkersRuntime` for its reconciler loop and passes the suite; an architecture test keeps `Microsoft.AspNetCore.App`, the Hangfire dashboard, MCP and Pulumi out of the library, which proves AC1 to AC3 of AIFACTORY-US-207."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-625]",
      "number": 625
    },
    {
      "id": "AIFACTORY-US-208",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-172",
      "title": "Workers.Runtime library: the pipeline exists, the package is published to the ConnectSoft feed and the worker template restores it from the feed",
      "sequence": "18.17.04",
      "description": "As an asset maintainer, I want proof that the worker engine is on the ConnectSoft feed with a version the worker template and the services pin, so that no consumer restores the engine from a local source or carries a pin for a version that was never published. This PBI is the publication proof of the feature. The worker-ops page of the worker template and the Runbook page of the library record the same open point: the repository has a pipeline definition that tests and packs on `master`, but the pipeline has not been created, so the worker template cannot restore the package from the feed and carries a pin for a version that is not published. The Runbook also records that the coverage threshold of the pipeline is zero. The pipeline is created from the definition in the repository, builds, tests, packs and pushes the package to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to, which decision D114 makes the Factory feed, and refuses a version that is already on the feed. The coverage threshold is raised from zero to the value the measured coverage of the engine supports, and the value is recorded in the Runbook. Two consumers prove the result. A clean Generic Host probe that has the ConnectSoft feed as its only source restores the published version, registers the engine and dispatches one scoped work item. The pipeline of the worker template restores the same version from the feed, with no local source and no project reference, as the locked decision of its backlog requires. The published version replaces the pin in the worker template and is recorded in the Runbook, where the base-template services read it. Kind: evidence. Traces: adrs: ADR-0014, ADR-0028. Depends on: AIFACTORY-US-206, AIFACTORY-US-207, AIFACTORY-US-219. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline definition in the library repository, when the pipeline is created and runs on `master`, then the package is built, tested, packed and pushed to the ConnectSoft feed, a version already on the feed is refused, the coverage threshold is no longer zero, and the published version is recorded in the Runbook page (ADR-0028, model/backlog/epics.yaml).",
        "AC2: Given a clean Generic Host probe with the ConnectSoft feed as its only package source, when it restores the published version, registers `AddWorkersRuntime` and dispatches one scoped work item, then the handler receives the scope and the probe ends without a failed-work record (ADR-0014 decision 1, docs/architecture/ecosystem-composition.md names the engine package on the feed as a need of this component).",
        "AC3: Given the pipeline of the worker template, when it restores its packages, then `ConnectSoft.Workers.Runtime` comes from the ConnectSoft feed at the published version, with no local source and no project reference, and the template solution builds and passes its tests on it (ADR-0028, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-623",
        "AIFACTORY-TASK-1015",
        "AIFACTORY-TASK-1016",
        "AIFACTORY-TASK-1017"
      ],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1704,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-206",
        "AIFACTORY-US-207",
        "AIFACTORY-US-219"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-208]",
      "number": 208
    },
    {
      "id": "AIFACTORY-TASK-623",
      "type": "task",
      "parent": "AIFACTORY-US-208",
      "title": "Package published from its own pipeline",
      "sequence": "18.17.04.01",
      "description": "BEFORE DEVELOPMENT. Package published from its own pipeline. Expected output: The runtime repository has its pipeline in Azure DevOps, created from the definition in the repository; it packs `ConnectSoft.Workers.Runtime` on `master` and pushes it to the feed; the worker template restores the package from the feed in its pipeline and not from a local source, and the version is verified.. Kind: operations. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The runtime repository has its pipeline in Azure DevOps, created from the definition in the repository; it packs `ConnectSoft.Workers.Runtime` on `master` and pushes it to the feed; the worker template restores the package from the feed in its pipeline and not from a local source, and the version is verified."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1704,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-623]",
      "number": 623
    },
    {
      "id": "AIFACTORY-TASK-1015",
      "type": "task",
      "parent": "AIFACTORY-US-208",
      "title": "Version guard and coverage threshold in the runtime pipeline",
      "sequence": "18.17.04.02",
      "description": "BEFORE DEVELOPMENT. Version guard and coverage threshold in the runtime pipeline. Expected output: The publication stage of the runtime pipeline refuses a version that is already on the feed with the reason; the coverage threshold is set to the value the measured coverage supports and is recorded, with the published version, in the Runbook page of the library.. Kind: operations. Repository: ConnectSoft.Workers.Runtime. Verification: azure-pipelines.yml publishes after the tests; a repeated version is refused.",
      "acceptanceCriteria": [
        "The publication stage of the runtime pipeline refuses a version that is already on the feed with the reason; the coverage threshold is set to the value the measured coverage supports and is recorded, with the published version, in the Runbook page of the library."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1704,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1015]",
      "number": 1015
    },
    {
      "id": "AIFACTORY-TASK-1016",
      "type": "task",
      "parent": "AIFACTORY-US-208",
      "title": "Generic Host feed probe for the published engine",
      "sequence": "18.17.04.03",
      "description": "BEFORE DEVELOPMENT. Generic Host feed probe for the published engine. Expected output: A probe project with the ConnectSoft feed as its only source restores the published version, registers the engine with in-memory providers and dispatches one scoped work item to a recording handler; the probe runs as the last stage of the runtime pipeline.. Kind: fixture. Repository: ConnectSoft.Workers.Runtime. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe project with the ConnectSoft feed as its only source restores the published version, registers the engine with in-memory providers and dispatches one scoped work item to a recording handler; the probe runs as the last stage of the runtime pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1704,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1016]",
      "number": 1016
    },
    {
      "id": "AIFACTORY-TASK-1017",
      "type": "task",
      "parent": "AIFACTORY-US-208",
      "title": "Verify the published engine by the probe and by the worker template restore",
      "sequence": "18.17.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the published engine by the probe and by the worker template restore. Expected output: One run of the runtime pipeline publishes the package and the probe passes; one run of the worker template pipeline restores the published version from the feed and builds and tests the template solution; both runs prove AC1 to AC3 of AIFACTORY-US-208 (ADR-0028).. Kind: verification. Repository: ConnectSoft.WorkerTemplate.",
      "acceptanceCriteria": [
        "One run of the runtime pipeline publishes the package and the probe passes; one run of the worker template pipeline restores the published version from the feed and builds and tests the template solution; both runs prove AC1 to AC3 of AIFACTORY-US-208 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.WorkerTemplate"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1017]",
      "number": 1017
    },
    {
      "id": "AIFACTORY-US-111",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-172",
      "title": "Workers.Runtime library: the worker engine published and shaped for Factory services is delivered and proven by its consumers",
      "sequence": "18.17.05",
      "description": "As an asset maintainer, I want WorkerTemplate to carry the worker engine published and shaped for Factory services, so that it serves runtime worker, reconcilers, dispatchers; the Workers.Runtime engine in base-template services with background loops without later rework. This is the integration PBI of the feature. An asset maintainer takes the worker engine from a repository whose package has never been published to a package on the ConnectSoft feed that carries the scope and the envelope identity in its contracts and that a base-template service can register for its background loop. The implementation lives in the earlier PBIs of this file; this PBI proves them together from the side of the two consumers. The worker template restores the published version from the feed and builds on it, and the sample host of the library, a Generic Host test host that registers the engine for a reconciler loop the way the guide shows for a base-template service, passes the conformance suite with the scoped key selected and scoped work: a message of one tenant is processed once, the same message id of another tenant is processed as well, a message without scope is refused and recorded, and a stop request drains. The feature is done when the engine is on the feed with a recorded version, its contracts carry tenant, project, run, step and attempt identity, the scoped idempotency key is an option beside the unchanged default store, an operator change of the job catalog survives a restart under the SQL catalog, the tables of the stores can be created from the schema script of the engine, and no reference to the ASP.NET host, the Hangfire dashboard, MCP or Pulumi has entered the package. Repository of the feature: ConnectSoft.Workers.Runtime. The service that reaches the engine in a later increment is the agent runtime, through the worker template. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-206, AIFACTORY-US-207, AIFACTORY-US-208, AIFACTORY-US-219. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repository ConnectSoft.Workers.Runtime, when its pipeline runs, then the package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-623 (package published from its own pipeline) is done, then the runtime repository has its pipeline, the package is on the feed, and the worker template restores it from the feed in its pipeline and not from a local source, with the version verified (ADR-0028, docs/architecture/ecosystem-composition.md).",
        "AC3: Given the work of AIFACTORY-TASK-624 (scope and envelope identifiers in the engine contracts) is done, then the trigger contract, the work item and the failed-work model carry tenant, project, run and step identity as library types in the namespace of the library, the scoped idempotency key is an option of the SQL and Redis stores beside the unchanged default key and the Generic Host sample shows them (ADR-0014 decision 1 and decision 3).",
        "AC4: Given the work of AIFACTORY-TASK-625 (consumption guide and conformance tests for a base-template service) is done, then the getting started page and the conformance suite show a base-template service registering the engine for its reconciler loop with drain, idempotency, failed work and the singleton lease, and an architecture test keeps the ASP.NET shared framework, the Hangfire dashboard, MCP and Pulumi out of the library (ADR-0024, ADR-0028 decision 5).",
        "AC5: Given the work of AIFACTORY-TASK-1055 (SQL job catalog beside the in-memory catalog) and of AIFACTORY-TASK-1057 (schema script of the engine) is done, then a host that selects the SQL catalog keeps an operator change of a job across a restart, and a base-template service creates the tables of the stores and of the catalog in its own store from the script of the engine (ADR-0028 decision 5, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1018",
        "AIFACTORY-TASK-695"
      ],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1705,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-206",
        "AIFACTORY-US-207",
        "AIFACTORY-US-208",
        "AIFACTORY-US-219"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-111]",
      "number": 111
    },
    {
      "id": "AIFACTORY-TASK-1018",
      "type": "task",
      "parent": "AIFACTORY-US-111",
      "title": "Scoped conformance run of the sample host on the published engine",
      "sequence": "18.17.05.01",
      "description": "BEFORE DEVELOPMENT. Scoped conformance run of the sample host on the published engine. Expected output: The sample host of AIFACTORY-TASK-625, a Generic Host test host under tests/ of `ConnectSoft.Workers.Runtime` that registers the engine the way the guide shows for a base-template service (catalog job, handler, drain on host stop, SQL stores, singleton lease) with no template dependency, is built for this run against the engine package of the ConnectSoft feed in place of the project reference and passes the conformance suite with the scoped key selected and scoped work of two tenants, a message without scope and a stop request; the run proves AC3 and AC4 of AIFACTORY-US-111 (ADR-0014).. Kind: verification. Repository: ConnectSoft.Workers.Runtime. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "The sample host of AIFACTORY-TASK-625, a Generic Host test host under tests/ of `ConnectSoft.Workers.Runtime` that registers the engine the way the guide shows for a base-template service (catalog job, handler, drain on host stop, SQL stores, singleton lease) with no template dependency, is built for this run against the engine package of the ConnectSoft feed in place of the project reference and passes the conformance suite with the scoped key selected and scoped work of two tenants, a message without scope and a stop request; the run proves AC3 and AC4 of AIFACTORY-US-111 (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1018]",
      "number": 1018
    },
    {
      "id": "AIFACTORY-TASK-695",
      "type": "task",
      "parent": "AIFACTORY-US-111",
      "title": "Verify workers-runtime-library-delivered by running the declared command",
      "sequence": "18.17.05.02",
      "description": "BEFORE DEVELOPMENT. Verify workers-runtime-library-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and on the worker template solution restored from the feed; they pass and prove AC1 to AC5 of AIFACTORY-US-111.. Kind: verification. Repository: ConnectSoft.Workers.Runtime.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and on the worker template solution restored from the feed; they pass and prove AC1 to AC5 of AIFACTORY-US-111."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.WorkerTemplate/docs/Control Plane/worker-ops.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Workers.Runtime"
      ],
      "children": [],
      "buildOrder": 17,
      "phase": "templates-and-libraries",
      "stackRank": 1705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-695]",
      "number": 695
    },
    {
      "id": "AIFACTORY-FEAT-175",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Observability libraries: the Factory telemetry conventions as one registration",
      "sequence": "18.18",
      "description": "Sixty-plus Factory services emit traces, logs and metrics through the Extensions.Observability and Extensions.Telemetry libraries, which carry OpenTelemetry, health and metrics wiring but know nothing of a run, a step, an attempt, an agent, a tenant or a project. Without a shared convention each service would write its own enricher and the Studio and the dashboards would correlate nothing. The libraries gain one registration that enriches every signal from the scope accessor and the run event envelope, the health and meter conventions the worker and aggregator templates already follow, and the rule of ADR-0019 that no prompt, completion or tool output reaches telemetry by default. Component: Observability libraries (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-090. Increment I0: Readiness. Build order 19 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-257",
        "AIFACTORY-US-258",
        "AIFACTORY-US-259",
        "AIFACTORY-US-260",
        "AIFACTORY-US-115"
      ],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1900,
      "titlePrefix": "[AIFACTORY-FEAT-175]",
      "number": 175
    },
    {
      "id": "AIFACTORY-US-257",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-175",
      "title": "Observability libraries: one registration puts the scope on every activity and log record, the agent inside an agent host, and tenant and project on every instrument recorded through its helper",
      "sequence": "18.18.01",
      "description": "As a platform admin, I want one telemetry registration that reads the Factory scope and enriches every signal of a service, so that no Factory service writes its own enricher and a run can be followed across services under the same attribute names. The Features page of the Observability library lists what the library holds today: option classes for OpenTelemetry, the stack and the backends, their validators, the option registrations `AddObservabilityStackOptions`, `AddObservabilityBackendOptions` and `AddOpenTelemetryOptions`, and the attribute name constants of `OpenTelemetryAttributeName`. The Overview page of the Telemetry library describes a latency exporter that tags the current activity and logs under a scope. Neither library knows a tenant, a project, a run, a step, an attempt or an agent, which ADR-0014 decision 1 names as the identity of every Factory event and ADR-0015 decision 2 requires on every contract. This PBI delivers the single enrichment registration that decision D114 placed in increment I0, so that the Factory profile of the base template (AIFACTORY-US-229) can pin it. A host makes one call of the registration in `ConnectSoft.Extensions.Observability`. The call installs enrichers that live in `ConnectSoft.Extensions.Telemetry` and read the scope from the one accessor of `ConnectSoft.Extensions.AI.Factory.Abstractions`, which AIFACTORY-US-220 of the feature `component-extensions-ai` delivers. The libraries take the abstractions package by a version pin and define no scope type of their own. The attribute names are the ones docs/planes/trust-operations/observability/observability.md fixes for the spans and metrics of the Factory: `connectsoft.factory.tenant_id`, `connectsoft.factory.project_id`, `connectsoft.factory.run_id`, `connectsoft.factory.step_id`, `connectsoft.factory.attempt_id` and `connectsoft.factory.agent_id`. They exist once, as constants beside `OpenTelemetryAttributeName`, and the first five map to the envelope fields `tenantId`, `projectId`, `runId`, `stepId` and `attemptId` of the contracts package. Every activity started while a scope is established and every log record written under it carries the first five; an identifier the scope does not hold, such as the run outside a run, is absent and never an empty value. The agent identifier is no part of the scope of the accessor. The trace context of the pinned abstractions package, `AgentTraceContext`, holds it as the agent origin, so the library offers one method that an agent host calls with the trace context of a request, as the generated agent host of AIFACTORY-US-144 does, and only while that call is in effect the enrichers write `connectsoft.factory.agent_id` as well; a service that is no agent host never calls it and the attribute is absent. The workflow, which the migrated text listed beside the agent, is no identity of the envelope and gets no scope attribute: a service that needs it records it as the metric dimension `workflow`, the name the metrics of model/services use, and the library holds that key and the key `agent` as constants only. The other attributes the observability page lists, such as the model profile and the tool identifier, belong to the spans of the agent runtime and of tool calls and are not written by this registration. Metrics are tagged where they are recorded. A .NET meter has no hook that adds a tag to a measurement after it was recorded, and the Metrics catalog page of the Telemetry library requires no OpenTelemetry reference, so a scope tag provider returns the tags of the current scope filtered by an allowlist of the options, and an instrument helper built on `IMeterFactory` creates the counters, histograms and gauges that record through it. The tag keys are `tenant` and `project`, the dimension names model/services gives its metrics. By default the provider returns these two only, because the catalog page treats unbounded label values as a cardinality risk; `run`, `step` and `attempt` travel on activities and log records and reach a measurement only when the allowlist names them (D115). The Factory preset of AIFACTORY-US-229 keeps the default allowlist, so a generated service does not carry the three on every metric, and a service that needs one of them on a series names it in the allowlist of its own options. A meter of a library or of the runtime, which does not record through the helper, is not tagged. When no scope is established, at start-up or on a health probe, the enrichers and the provider add nothing and the typed exception of the accessor never reaches the host. A second call of the registration has no effect: the enrichers are registered once. Kind: enabling. Traces: descriptors: execution-scope-v1, run-event-envelope-v1; adrs: ADR-0014, ADR-0015, ADR-0018. Relates: nfrs: NFR-10. Depends on: feature:component-extensions-ai, feature:contracts-package. Sources: model/components.yaml, model/nfr-targets.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/reference/schemas/run-event-envelope.schema.json, docs/planes/trust-operations/observability/observability.md.",
      "acceptanceCriteria": [
        "AC1: Given a host that calls the single registration and establishes a scope through the middleware of the pinned abstractions package, when a REST call, a gRPC call and a message handler each start an activity and write a log record, then the exported activity and the log record carry `connectsoft.factory.tenant_id`, `connectsoft.factory.project_id`, `connectsoft.factory.run_id`, `connectsoft.factory.step_id` and `connectsoft.factory.attempt_id` with the values of the accessor, the names docs/planes/trust-operations/observability/observability.md lists, and an identifier the scope does not hold is absent and not an empty value (ADR-0014 decision 1, ADR-0015 decision 2).",
        "AC2: Given an instrument created through the instrument helper and a measurement recorded while a scope is established, when it is exported, then it carries the tags `tenant` and `project`, the dimension names of model/services, and no `run`, `step` or `attempt` tag unless the allowlist of the options names that identifier; given the allowlist names all three, then the measurement carries them, and the Factory preset of AIFACTORY-US-229 leaves the allowlist at its default; a measurement of a meter that does not record through the helper carries no scope tag, so that the label cardinality of the series the objectives of model/nfr-targets.yaml are evaluated from stays a decision of the options (ADR-0018).",
        "AC3: Given no scope is established, at start-up or on a health probe, when an activity starts, a log record is written and a measurement is recorded through the helper, then no scope attribute or tag is added and no exception leaves the enrichers or the provider; given the registration is called twice, then the enrichers are registered once and each attribute appears once on a signal (ADR-0015 decision 2 keeps the accessor as the only source of the scope).",
        "AC4: Given the scope attribute name constants, when the contract test runs against the pinned contracts package, then the six constants equal the names docs/planes/trust-operations/observability/observability.md lists, the first five map one to one to the envelope fields `tenantId`, `projectId`, `runId`, `stepId` and `attemptId` of docs/reference/schemas/run-event-envelope.schema.json, and an architecture test finds the scope type only in the pinned abstractions package and none in the two library solutions (ADR-0014 decision 1).",
        "AC5: Given an agent host that calls the trace context method of the library with an `AgentTraceContext` whose agent origin is set, when an activity starts and a log record is written inside that call, then both carry `connectsoft.factory.agent_id` with the agent origin beside the scope attributes; outside the call, and in a host that never makes it, the attribute is absent, and no signal carries a workflow attribute from this registration (ADR-0014 decision 1, docs/planes/trust-operations/observability/observability.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/nfr-targets.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/trust-operations/observability/observability.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1178",
        "AIFACTORY-TASK-632",
        "AIFACTORY-TASK-1179",
        "AIFACTORY-TASK-1180",
        "AIFACTORY-TASK-1289"
      ],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1901,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "execution-scope-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0018"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "feature:component-extensions-ai",
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/nfr-targets.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/planes/trust-operations/observability/observability.md"
      ],
      "titlePrefix": "[AIFACTORY-US-257]",
      "number": 257
    },
    {
      "id": "AIFACTORY-TASK-1178",
      "type": "task",
      "parent": "AIFACTORY-US-257",
      "title": "Scope attribute name constants and the signature of the single registration",
      "sequence": "18.18.01.01",
      "description": "BEFORE DEVELOPMENT. Scope attribute name constants and the signature of the single registration. Expected output: A nested group of `OpenTelemetryAttributeName` holds the six scope attribute names `connectsoft.factory.tenant_id`, `connectsoft.factory.project_id`, `connectsoft.factory.run_id`, `connectsoft.factory.step_id`, `connectsoft.factory.attempt_id` and `connectsoft.factory.agent_id` and the metric dimension keys `tenant`, `project`, `run`, `step`, `attempt`, `agent` and `workflow` as constants; the single registration is one extension method with an options type that holds the metric tag allowlist; a contract test compares the six names with docs/planes/trust-operations/observability/observability.md and maps the first five to the envelope fields of the pinned contracts package (docs/reference/schemas/run-event-envelope.schema.json).. Kind: contract. Repository: ConnectSoft.Extensions.Observability. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A nested group of `OpenTelemetryAttributeName` holds the six scope attribute names `connectsoft.factory.tenant_id`, `connectsoft.factory.project_id`, `connectsoft.factory.run_id`, `connectsoft.factory.step_id`, `connectsoft.factory.attempt_id` and `connectsoft.factory.agent_id` and the metric dimension keys `tenant`, `project`, `run`, `step`, `attempt`, `agent` and `workflow` as constants; the single registration is one extension method with an options type that holds the metric tag allowlist; a contract test compares the six names with docs/planes/trust-operations/observability/observability.md and maps the first five to the envelope fields of the pinned contracts package (docs/reference/schemas/run-event-envelope.schema.json)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1901,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1178]",
      "number": 1178
    },
    {
      "id": "AIFACTORY-TASK-632",
      "type": "task",
      "parent": "AIFACTORY-US-257",
      "title": "Factory enrichment of traces, logs and metrics",
      "sequence": "18.18.01.02",
      "description": "BEFORE DEVELOPMENT. Factory enrichment of traces, logs and metrics. Expected output: Enrichers in `ConnectSoft.Extensions.Telemetry` read the scope from the accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package and add the tenant, project, run, step and attempt attributes to every activity and log record, and the agent attribute while the trace context method is in effect; a scope tag provider returns the tags `tenant` and `project` of the current scope, and `run`, `step` and `attempt` only when the allowlist names them; an instrument helper built on `IMeterFactory` creates the instruments that record through the provider; an identifier the scope does not hold is absent, an absent scope adds nothing, the exception of the accessor is not propagated, and a meter that does not use the helper is not tagged.. Kind: implementation. Repository: ConnectSoft.Extensions.Telemetry. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Enrichers in `ConnectSoft.Extensions.Telemetry` read the scope from the accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package and add the tenant, project, run, step and attempt attributes to every activity and log record, and the agent attribute while the trace context method is in effect; a scope tag provider returns the tags `tenant` and `project` of the current scope, and `run`, `step` and `attempt` only when the allowlist names them; an instrument helper built on `IMeterFactory` creates the instruments that record through the provider; an identifier the scope does not hold is absent, an absent scope adds nothing, the exception of the accessor is not propagated, and a meter that does not use the helper is not tagged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-632]",
      "number": 632
    },
    {
      "id": "AIFACTORY-TASK-1179",
      "type": "task",
      "parent": "AIFACTORY-US-257",
      "title": "Single registration that installs the enrichers once",
      "sequence": "18.18.01.03",
      "description": "BEFORE DEVELOPMENT. Single registration that installs the enrichers once. Expected output: One extension method of `ConnectSoft.Extensions.Observability` installs the activity and log enrichers, the scope tag provider and the instrument helper of the Telemetry library and binds its options; a second call registers nothing more, and the Getting Started page of the library shows the one call a host makes and how it creates an instrument through the helper.. Kind: implementation. Repository: ConnectSoft.Extensions.Observability. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One extension method of `ConnectSoft.Extensions.Observability` installs the activity and log enrichers, the scope tag provider and the instrument helper of the Telemetry library and binds its options; a second call registers nothing more, and the Getting Started page of the library shows the one call a host makes and how it creates an instrument through the helper."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1179]",
      "number": 1179
    },
    {
      "id": "AIFACTORY-TASK-1180",
      "type": "task",
      "parent": "AIFACTORY-US-257",
      "title": "Verify the registration over REST, gRPC and a message handler in the Observability solution",
      "sequence": "18.18.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the registration over REST, gRPC and a message handler in the Observability solution. Expected output: Run `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Observability`; the tests with an in-memory exporter over a REST call, a gRPC call and a message handler, the double registration test and the constant mapping test pass and prove AC1, AC3 and AC4 of AIFACTORY-US-257 (ADR-0014, ADR-0015).. Kind: verification. Repository: ConnectSoft.Extensions.Observability.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Observability`; the tests with an in-memory exporter over a REST call, a gRPC call and a message handler, the double registration test and the constant mapping test pass and prove AC1, AC3 and AC4 of AIFACTORY-US-257 (ADR-0014, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1180]",
      "number": 1180
    },
    {
      "id": "AIFACTORY-TASK-1289",
      "type": "task",
      "parent": "AIFACTORY-US-257",
      "title": "Verify the enrichers, the scope tag provider and the instrument helper in the Telemetry solution",
      "sequence": "18.18.01.05",
      "description": "BEFORE DEVELOPMENT. Verify the enrichers, the scope tag provider and the instrument helper in the Telemetry solution. Expected output: Run `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Telemetry`; the enricher tests, the absent-scope test, the helper tests with the default and the extended allowlist, the test of a meter that does not use the helper and the agent attribute test pass and prove AC2, AC3 and AC5 of AIFACTORY-US-257 (ADR-0014, ADR-0018).. Kind: verification. Repository: ConnectSoft.Extensions.Telemetry.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Telemetry`; the enricher tests, the absent-scope test, the helper tests with the default and the extended allowlist, the test of a meter that does not use the helper and the agent attribute test pass and prove AC2, AC3 and AC5 of AIFACTORY-US-257 (ADR-0014, ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1289]",
      "number": 1289
    },
    {
      "id": "AIFACTORY-US-258",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-175",
      "title": "Observability libraries: the ready and live health tags, the declared `connectsoft.` meter names and the drain, backlog and lease series are one convention with a conformance test package",
      "sequence": "18.18.02",
      "description": "As a platform admin, I want the health tags, the meter names and the background work series of a service stated once and checked by a shared test package, so that dashboards, probes and objectives read the same names from every Factory service. The conventions a Factory service follows for health and meters exist today only as habits of single repositories. The Features page of the health checks library tags its self check as live. The Configuration page of the worker template fails readiness on the tag `ready` while the worker drains or its work in flight exceeds `BacklogThreshold`, and the worker and aggregator templates publish drain, backlog and lease series. The Health Checks page of the base template registers its resource utilization, disk storage, memory and Hangfire checks under other tags only (`resource utilization`, `diskstorage`, `memory`, `application hangfire`). The Metrics catalog page of the Telemetry library names its own meter `ConnectSoft.Extensions.Telemetry` and asks that the catalog stay aligned when a metric is renamed. The model names every metric of a Factory service `connectsoft.factory.<area>.<metric>`, for example `connectsoft.factory.usage.cost_usd` of CostUsageService, and one service may hold more than one area: RunControlService has metrics under `connectsoft.factory.runs` and under `connectsoft.factory.attempts`. ADR-0018 sets objectives per service class, and nothing can evaluate them across sixty services unless the names agree. This PBI states the convention once in the Observability library. Constants name the two health tags. A check that must gate a probe carries one of them; a check with neither tag is informational, is reported by neither probe and is listed as such, so the inherited checks of the base template stay valid without a retag. A service declares its meter names through a helper: a name is lower case, dotted and starts with `connectsoft.`; under the Factory profile it is the `connectsoft.factory.<area>` prefix that model/services gives the metrics of that service, and a service may declare more than one; the template habit `connectsoft.<service>`, for example `connectsoft.workertemplate`, stays valid for other generations. Every instrument of a declared meter sits under the declared name and has a unit. The drain, backlog and lease series that a service with a background loop publishes get fixed names, units and tag sets. A convention page of the library documents the three. A conformance test package is published beside the library, and a service references it from its architecture tests. It fails a check with neither tag that a probe reports, a meter created by an assembly of the solution under a name that was not declared, an instrument of the solution that lies outside its declared name, has no unit or was not created through the instrument helper of AIFACTORY-US-257, a service with a background loop that lacks one of the three series, and a type in the solution that enriches a signal with a scope attribute of its own, which is the check the base template plants in its Factory preset. Meters of libraries and of the runtime are outside the assertion, with `ConnectSoft.Extensions.Telemetry` as the example. The test checks the shape of a declared meter name and does not compare the declared names with the model of a service. Each failure names the offending check, meter, instrument or type. Kind: enabling. Traces: adrs: ADR-0014, ADR-0018. Relates: nfrs: NFR-17. Sources: model/components.yaml, model/nfr-targets.yaml, model/services/control-plane/RunControlService.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/nfr-baseline.md, docs/architecture/adr/0018-nfr-baseline.md.",
      "acceptanceCriteria": [
        "AC1: Given a service that registers its health checks with the tag constants of the library, when the liveness and the readiness endpoints are probed, then liveness reports the checks tagged live and readiness the checks tagged ready; a check with neither tag, such as the resource utilization, disk storage, memory and Hangfire checks the base template registers, is reported by neither probe and listed by the conformance test as informational, and the test fails only when a probe reports a check without its tag, and names the check (ADR-0018, docs/architecture/nfr-baseline.md).",
        "AC2: Given a service that declares its meter names through the helper and has a background loop, when the conformance test runs, then it passes when every declared name is lower case, dotted and starts with `connectsoft.`, every meter created by an assembly of the solution has a declared name, every instrument sits under a declared name with a unit, and the drain, backlog and lease series exist with the names, units and tags of the convention page; one service that declares `connectsoft.factory.runs` and `connectsoft.factory.attempts` passes, as model/services/control-plane/RunControlService.yaml names its metrics, a meter of a library such as `ConnectSoft.Extensions.Telemetry` is not examined, and an undeclared meter, an instrument outside its declared name or a missing series fails the test with its name (ADR-0018, model/nfr-targets.yaml).",
        "AC3: Given a solution that defines an enricher which writes a tenant, project, run, step, attempt or agent attribute of its own, or an instrument that was not created through the instrument helper, when the conformance test runs, then it fails and names the type or the instrument, so that the single registration stays the only source of the scope attributes and tags (ADR-0014 decision 1).",
        "AC4: Given the convention page of the library, when it is compared with the constants and with the conformance test package, then every tag, meter rule and series the page names is a constant or an assertion of the package, which closes the health and meter part of the need model/components.yaml records for this component; the enrichment part of that need, the agent identifier included, is closed by AIFACTORY-US-257 (ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/nfr-targets.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/nfr-baseline.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-633",
        "AIFACTORY-TASK-1181",
        "AIFACTORY-TASK-1182",
        "AIFACTORY-TASK-1183"
      ],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1902,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0018"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-17"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/nfr-targets.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/nfr-baseline.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "titlePrefix": "[AIFACTORY-US-258]",
      "number": 258
    },
    {
      "id": "AIFACTORY-TASK-633",
      "type": "task",
      "parent": "AIFACTORY-US-258",
      "title": "Health and meter conventions",
      "sequence": "18.18.02.01",
      "description": "BEFORE DEVELOPMENT. Health and meter conventions. Expected output: Constants for the ready and live health tags, a helper through which a service declares its meter names under the rule that a name is lower case, dotted and starts with `connectsoft.` (under the Factory profile the `connectsoft.factory.<area>` prefixes model/services gives the metrics of the service, more than one per service allowed, and the template habit `connectsoft.<service>` for other generations), and the fixed names, units and tag sets of the drain, backlog and lease series the worker and aggregator templates publish exist in `ConnectSoft.Extensions.Observability` as the Factory convention.. Kind: implementation. Repository: ConnectSoft.Extensions.Observability. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Constants for the ready and live health tags, a helper through which a service declares its meter names under the rule that a name is lower case, dotted and starts with `connectsoft.` (under the Factory profile the `connectsoft.factory.<area>` prefixes model/services gives the metrics of the service, more than one per service allowed, and the template habit `connectsoft.<service>` for other generations), and the fixed names, units and tag sets of the drain, backlog and lease series the worker and aggregator templates publish exist in `ConnectSoft.Extensions.Observability` as the Factory convention."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-633]",
      "number": 633
    },
    {
      "id": "AIFACTORY-TASK-1181",
      "type": "task",
      "parent": "AIFACTORY-US-258",
      "title": "Conformance test package for health tags, declared meter names, instruments, series and own enrichers",
      "sequence": "18.18.02.02",
      "description": "BEFORE DEVELOPMENT. Conformance test package for health tags, declared meter names, instruments, series and own enrichers. Expected output: A test package published beside the library holds the assertions a service calls from its architecture tests: the readiness and liveness endpoints report only checks with the ready and the live tag, and a check with neither is listed as informational; every meter created by an assembly of the solution has a declared name, and each of its instruments sits under a declared name, has a unit and was created through the instrument helper, while meters of libraries and of the runtime, such as `ConnectSoft.Extensions.Telemetry`, are not examined; a service with a background loop exposes the three series; and no type of the solution enriches a signal with a scope attribute; each failure names the offender.. Kind: fixture. Repository: ConnectSoft.Extensions.Observability. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A test package published beside the library holds the assertions a service calls from its architecture tests: the readiness and liveness endpoints report only checks with the ready and the live tag, and a check with neither is listed as informational; every meter created by an assembly of the solution has a declared name, and each of its instruments sits under a declared name, has a unit and was created through the instrument helper, while meters of libraries and of the runtime, such as `ConnectSoft.Extensions.Telemetry`, are not examined; a service with a background loop exposes the three series; and no type of the solution enriches a signal with a scope attribute; each failure names the offender."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1181]",
      "number": 1181
    },
    {
      "id": "AIFACTORY-TASK-1182",
      "type": "task",
      "parent": "AIFACTORY-US-258",
      "title": "Convention page of the Observability library",
      "sequence": "18.18.02.03",
      "description": "BEFORE DEVELOPMENT. Convention page of the Observability library. Expected output: A convention page of the documentation of the library names the two health tags and the informational checks, the rule for declared meter names with the `connectsoft.factory.<area>` prefixes of the Factory profile, the template habit that stays valid, the units, the scope of the assertion that leaves library and runtime meters out, and the drain, backlog and lease series with their tags, and names for each the constant and the assertion of the conformance test package that checks it; the Features page lists the page.. Kind: documentation. Repository: ConnectSoft.Extensions.Observability. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "A convention page of the documentation of the library names the two health tags and the informational checks, the rule for declared meter names with the `connectsoft.factory.<area>` prefixes of the Factory profile, the template habit that stays valid, the units, the scope of the assertion that leaves library and runtime meters out, and the drain, backlog and lease series with their tags, and names for each the constant and the assertion of the conformance test package that checks it; the Features page lists the page."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1902,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1182]",
      "number": 1182
    },
    {
      "id": "AIFACTORY-TASK-1183",
      "type": "task",
      "parent": "AIFACTORY-US-258",
      "title": "Verify the conventions on a conforming and on five planted hosts",
      "sequence": "18.18.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the conventions on a conforming and on five planted hosts. Expected output: Run the conformance test package against a conforming test host, which declares the two modelled names `connectsoft.factory.runs` and `connectsoft.factory.attempts`, carries a library meter and an informational check with neither tag, and against five hosts with a planted untagged check that the readiness probe reports, a planted undeclared meter, an instrument created outside the helper, a missing lease series and a planted enricher; the first passes and each of the five fails with its offender named, which proves AC1 to AC4 of AIFACTORY-US-258 (ADR-0018).. Kind: verification. Repository: ConnectSoft.Extensions.Observability.",
      "acceptanceCriteria": [
        "Run the conformance test package against a conforming test host, which declares the two modelled names `connectsoft.factory.runs` and `connectsoft.factory.attempts`, carries a library meter and an informational check with neither tag, and against five hosts with a planted untagged check that the readiness probe reports, a planted undeclared meter, an instrument created outside the helper, a missing lease series and a planted enricher; the first passes and each of the five fails with its offender named, which proves AC1 to AC4 of AIFACTORY-US-258 (ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1183]",
      "number": 1183
    },
    {
      "id": "AIFACTORY-US-259",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-175",
      "title": "Observability libraries: activities and log records refuse prompt, completion and tool-output content by default and carry its reference instead",
      "sequence": "18.18.03",
      "description": "As a platform admin, I want telemetry that cannot carry a prompt, a completion or a tool output unless a classification decision allows the field, so that no Factory service leaks customer content into traces and logs by writing one careless property. ADR-0019 decision 3 forbids raw prompt, response and tool-output logging by default, and docs/architecture/data-governance.md states what telemetry carries instead: hashes, token counts, model and profile identifiers, policy receipts and sizes, while content lives only in the artifact store under the classification of the tenant. The Runbook page of the Telemetry library says that the redaction of the host applies to its log scope when the host enables it, so today the protection is opt-in and one service that forgets it leaks. This PBI turns the default around for the content of the Factory. The single registration installs a content guard that lives in `ConnectSoft.Extensions.Telemetry`. The guard knows three kinds of content field, prompt, completion and tool output, by the content attributes of the OpenTelemetry GenAI conventions that NFR-10 names and by the property names the Factory libraries use for them. When such a field is set as an activity tag, as an attribute of an activity event or as a property of a log record, the guard replaces the value by its reference: the hash and the size of the value and, when the caller supplies it, the artifact identifier. Nothing is thrown, so a careless property never fails a request, and every replacement is counted on a metric of the library without the value. The guard asks one decision interface whether a field may pass. In this increment no implementation of the interface allows anything, so the default is a refusal for every field of the three kinds; the Compliance library supplies the implementation that answers from the classification of a field in the next increment. The guard sees fields and attributes, not text a caller has already interpolated into a message; the convention page states that limit. Kind: enabling. Traces: adrs: ADR-0019. Relates: nfrs: NFR-10. Depends on: AIFACTORY-US-257. Sources: model/components.yaml, docs/architecture/adr/0019-data-governance.md, docs/architecture/data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a host with the single registration and no allow decision registered, when a prompt is placed in a property of a log record, then the exported record carries the hash and the size of the prompt under that property and not its text, and the replacement counter of the library grows by one without the value (ADR-0019 decision 3).",
        "AC2: Given the same host, when a completion is set as an activity tag and a tool output as an attribute of an activity event, then the exported activity carries their references and not their values, the artifact identifier appears in the reference when the caller supplied it, and no exception leaves the guard (ADR-0019 decision 3, docs/architecture/data-governance.md).",
        "AC3: Given a registered implementation of the decision interface that allows one named field, when that field and another content field are written, then the allowed field passes unchanged and the other is replaced by its reference; given no implementation is registered, then no field of the three kinds passes, which is the default ADR-0019 decision 3 requires."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1184",
        "AIFACTORY-TASK-634",
        "AIFACTORY-TASK-1185",
        "AIFACTORY-TASK-1186"
      ],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1903,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0019"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-257"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-259]",
      "number": 259
    },
    {
      "id": "AIFACTORY-TASK-1184",
      "type": "task",
      "parent": "AIFACTORY-US-259",
      "title": "Content field kinds, the reference shape and the allow decision interface",
      "sequence": "18.18.03.01",
      "description": "BEFORE DEVELOPMENT. Content field kinds, the reference shape and the allow decision interface. Expected output: The Telemetry library defines the three content field kinds with the attribute and property names that identify them, the reference that replaces a value (hash, size and an optional artifact identifier) and one decision interface with the field name and kind as its input; no implementation of the interface ships in the library.. Kind: contract. Repository: ConnectSoft.Extensions.Telemetry. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Telemetry library defines the three content field kinds with the attribute and property names that identify them, the reference that replaces a value (hash, size and an optional artifact identifier) and one decision interface with the field name and kind as its input; no implementation of the interface ships in the library."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1903,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1184]",
      "number": 1184
    },
    {
      "id": "AIFACTORY-TASK-634",
      "type": "task",
      "parent": "AIFACTORY-US-259",
      "title": "No prompt, completion or tool output in telemetry by default",
      "sequence": "18.18.03.02",
      "description": "BEFORE DEVELOPMENT. No prompt, completion or tool output in telemetry by default. Expected output: Activity and log enrichment replace prompt, completion and tool-output fields by their reference unless a registered decision allows the field (ADR-0019); the guard is installed by the single registration, throws nothing and counts every replacement on a metric of the library, with a test that a prompt placed in a log property is replaced by its reference.. Kind: implementation. Repository: ConnectSoft.Extensions.Telemetry. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Activity and log enrichment replace prompt, completion and tool-output fields by their reference unless a registered decision allows the field (ADR-0019); the guard is installed by the single registration, throws nothing and counts every replacement on a metric of the library, with a test that a prompt placed in a log property is replaced by its reference."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-634]",
      "number": 634
    },
    {
      "id": "AIFACTORY-TASK-1185",
      "type": "task",
      "parent": "AIFACTORY-US-259",
      "title": "Planted content tests over log properties, activity tags and activity events",
      "sequence": "18.18.03.03",
      "description": "BEFORE DEVELOPMENT. Planted content tests over log properties, activity tags and activity events. Expected output: A test fixture writes a planted prompt, completion and tool output through a log property, an activity tag and an activity event, with and without a registered allow decision, and asserts on the exported signals that no planted text appears where it was not allowed.. Kind: fixture. Repository: ConnectSoft.Extensions.Telemetry. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A test fixture writes a planted prompt, completion and tool output through a log property, an activity tag and an activity event, with and without a registered allow decision, and asserts on the exported signals that no planted text appears where it was not allowed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1903,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1185]",
      "number": 1185
    },
    {
      "id": "AIFACTORY-TASK-1186",
      "type": "task",
      "parent": "AIFACTORY-US-259",
      "title": "Verify that no planted content reaches an exported signal",
      "sequence": "18.18.03.04",
      "description": "BEFORE DEVELOPMENT. Verify that no planted content reaches an exported signal. Expected output: Run `dotnet test -c Release --no-build` on the Telemetry solution; the planted content tests pass and a search of every exported signal of the suite finds no planted text outside the allowed field, which proves AC1 to AC3 of AIFACTORY-US-259 (ADR-0019).. Kind: verification. Repository: ConnectSoft.Extensions.Telemetry.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the Telemetry solution; the planted content tests pass and a search of every exported signal of the suite finds no planted text outside the allowed field, which proves AC1 to AC3 of AIFACTORY-US-259 (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1186]",
      "number": 1186
    },
    {
      "id": "AIFACTORY-US-260",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-175",
      "title": "Observability libraries: the Telemetry, Observability and conformance test packages are built, tested and published to the ConnectSoft feed with the versions the base template pins",
      "sequence": "18.18.04",
      "description": "As a platform admin, I want the packages with the Factory conventions on the feed under versions a consumer can pin, so that the Factory profile of the base template wires its telemetry through a published registration and not through a local build. This PBI is the publication proof of the feature. The epic is done only when each library publishes before the Factory code that consumes it is built (model/backlog/epics.yaml), and the Factory profile of the base template pins the single registration in the same increment. The Runbook page of the Telemetry library states that build, test, pack and publish run in `azure-pipelines.yml` in the pattern of the other `ConnectSoft.Extensions.*` repositories. The feed is the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to; the amendment of ADR-0028 on the Factory profile switch names that feed as the one the Factory publishes to and restores from. The pipelines publish in dependency order: the Telemetry package first, then the Observability package that references it, then the conformance test package. The abstractions package with the scope accessor is restored from the feed at the version the feature `component-extensions-ai` published, never from a project reference. A stage publishes only after the tests of its solution pass and refuses a version that is already on the feed. A probe then proves the result from the side of a consumer: a clean host that takes every ConnectSoft package from the feed and holds no project reference restores the published versions, makes the one call of the registration, establishes a scope and exports an activity and a log record with the five attributes, and a planted prompt in a log property leaves the host as a reference. The published versions are recorded on the Runbook pages of the two libraries, where the base template reads its pin. This is an evidence PBI (D113): a library feature has no scenario, so the probe names what it proves through its ADRs, the requirement on release gates and its sources. Kind: evidence. Traces: adrs: ADR-0014, ADR-0019, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-257, AIFACTORY-US-258, AIFACTORY-US-259, feature:component-extensions-ai. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/catalogs/libraries.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipelines of the two library repositories after the work of the feature, when they run, then the Telemetry package, the Observability package and the conformance test package are built, tested, packed and pushed to the ConnectSoft feed in that order, each stage publishes only after the tests of its solution pass, and the published versions are recorded on the Runbook pages of the libraries (FR-11, ADR-0028, model/backlog/epics.yaml).",
        "AC2: Given a clean probe host that restores every ConnectSoft package from the feed and holds no project reference, when it makes the one call of the registration, establishes a scope and writes an activity and a log record, then both carry tenant, project, run, step and attempt, and a planted prompt in a log property is exported as its reference (ADR-0014 decision 1, ADR-0019 decision 3).",
        "AC3: Given a failing test in a library solution or a version that is already on the feed, when the pipeline reaches the publication stage, then the stage is refused with the reason and the downstream package is not published on top of it; a run with a planted failing test proves the refusal (FR-11, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1187",
        "AIFACTORY-TASK-1286",
        "AIFACTORY-TASK-1188",
        "AIFACTORY-TASK-1189",
        "AIFACTORY-TASK-1287",
        "AIFACTORY-TASK-1190"
      ],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1904,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-257",
        "AIFACTORY-US-258",
        "AIFACTORY-US-259",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-260]",
      "number": 260
    },
    {
      "id": "AIFACTORY-TASK-1187",
      "type": "task",
      "parent": "AIFACTORY-US-260",
      "title": "Publication order and version guard in the Observability pipeline",
      "sequence": "18.18.04.01",
      "description": "BEFORE DEVELOPMENT. Publication order and version guard in the Observability pipeline. Expected output: The pipeline of `ConnectSoft.Extensions.Observability` names the pipeline of the Telemetry library as its upstream pipeline resource, restores the Telemetry and abstractions packages from the ConnectSoft feed, publishes the library and the conformance test package after the tests of its solution pass, and refuses a version that is already on the feed with the reason.. Kind: operations. Repository: ConnectSoft.Extensions.Observability. Verification: azure-pipelines.yml of the Observability repository publishes after its tests and a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipeline of `ConnectSoft.Extensions.Observability` names the pipeline of the Telemetry library as its upstream pipeline resource, restores the Telemetry and abstractions packages from the ConnectSoft feed, publishes the library and the conformance test package after the tests of its solution pass, and refuses a version that is already on the feed with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1904,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1187]",
      "number": 1187
    },
    {
      "id": "AIFACTORY-TASK-1286",
      "type": "task",
      "parent": "AIFACTORY-US-260",
      "title": "Version guard in the Telemetry pipeline",
      "sequence": "18.18.04.02",
      "description": "BEFORE DEVELOPMENT. Version guard in the Telemetry pipeline. Expected output: The pipeline of `ConnectSoft.Extensions.Telemetry` restores the abstractions package from the ConnectSoft feed, publishes the Telemetry package only after the tests of its solution pass and refuses a version that is already on the feed with the reason, so that the Observability pipeline downstream never publishes on top of a Telemetry version that is not on the feed.. Kind: operations. Repository: ConnectSoft.Extensions.Telemetry. Verification: azure-pipelines.yml of the Telemetry repository publishes after its tests and a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipeline of `ConnectSoft.Extensions.Telemetry` restores the abstractions package from the ConnectSoft feed, publishes the Telemetry package only after the tests of its solution pass and refuses a version that is already on the feed with the reason, so that the Observability pipeline downstream never publishes on top of a Telemetry version that is not on the feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1904,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1286]",
      "number": 1286
    },
    {
      "id": "AIFACTORY-TASK-1188",
      "type": "task",
      "parent": "AIFACTORY-US-260",
      "title": "Feed probe host for the published observability packages",
      "sequence": "18.18.04.03",
      "description": "BEFORE DEVELOPMENT. Feed probe host for the published observability packages. Expected output: A probe project that restores every ConnectSoft package from the feed and holds no project reference makes the one call of the registration, establishes a scope and exports an activity and a log record to an in-memory exporter, with a planted prompt in a log property; the probe runs as the last stage of the Observability pipeline.. Kind: fixture. Repository: ConnectSoft.Extensions.Observability. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe project that restores every ConnectSoft package from the feed and holds no project reference makes the one call of the registration, establishes a scope and exports an activity and a log record to an in-memory exporter, with a planted prompt in a log property; the probe runs as the last stage of the Observability pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1904,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1188]",
      "number": 1188
    },
    {
      "id": "AIFACTORY-TASK-1189",
      "type": "task",
      "parent": "AIFACTORY-US-260",
      "title": "Published versions recorded on the Runbook page of the Observability library",
      "sequence": "18.18.04.04",
      "description": "BEFORE DEVELOPMENT. Published versions recorded on the Runbook page of the Observability library. Expected output: The Runbook page of the Observability library names the version its package published, the version of the conformance test package and the versions of the Telemetry and abstractions packages it pins.. Kind: documentation. Repository: ConnectSoft.Extensions.Observability. Verification: the documentation pipeline of the Observability library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Runbook page of the Observability library names the version its package published, the version of the conformance test package and the versions of the Telemetry and abstractions packages it pins."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1904,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1189]",
      "number": 1189
    },
    {
      "id": "AIFACTORY-TASK-1287",
      "type": "task",
      "parent": "AIFACTORY-US-260",
      "title": "Published version recorded on the Runbook page of the Telemetry library",
      "sequence": "18.18.04.05",
      "description": "BEFORE DEVELOPMENT. Published version recorded on the Runbook page of the Telemetry library. Expected output: The Runbook page of the Telemetry library names the version its package published and the version of the abstractions package it pins.. Kind: documentation. Repository: ConnectSoft.Extensions.Telemetry. Verification: the documentation pipeline of the Telemetry library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Runbook page of the Telemetry library names the version its package published and the version of the abstractions package it pins."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1904,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1287]",
      "number": 1287
    },
    {
      "id": "AIFACTORY-TASK-1190",
      "type": "task",
      "parent": "AIFACTORY-US-260",
      "title": "Verify the published packages by the probe and by a planted failing run",
      "sequence": "18.18.04.06",
      "description": "BEFORE DEVELOPMENT. Verify the published packages by the probe and by a planted failing run. Expected output: One run of the Telemetry pipeline followed by one run of the Observability pipeline publishes the three packages and the probe of the Observability pipeline passes; one run with a planted failing test in the Telemetry solution stops before publication and the Observability pipeline publishes nothing on top of it; both runs prove AC1 to AC3 of AIFACTORY-US-260 (FR-11, ADR-0028).. Kind: verification. Repository: ConnectSoft.Extensions.Observability.",
      "acceptanceCriteria": [
        "One run of the Telemetry pipeline followed by one run of the Observability pipeline publishes the three packages and the probe of the Observability pipeline passes; one run with a planted failing test in the Telemetry solution stops before publication and the Observability pipeline publishes nothing on top of it; both runs prove AC1 to AC3 of AIFACTORY-US-260 (FR-11, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1190]",
      "number": 1190
    },
    {
      "id": "AIFACTORY-US-115",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-175",
      "title": "Observability libraries: the Factory telemetry conventions as one registration is delivered and proven by its consumers",
      "sequence": "18.18.05",
      "description": "As a platform admin, I want Observability libraries to carry the Factory telemetry conventions as one registration, so that it serves OpenTelemetry, health, metrics without later rework. This is the integration PBI of the feature. With the enrichment registration, the health and meter conventions with their conformance test package, the content guard and the publication proof of the earlier PBIs, the platform admin holds one answer to how a Factory service emits telemetry: it makes one call of the registration of the pinned `ConnectSoft.Extensions.Observability` package, creates its instruments through the instrument helper and references the conformance test package from its architecture tests. Every activity and log record then carries the tenant, project, run, step and attempt attributes under the `connectsoft.factory.` names of docs/planes/trust-operations/observability/observability.md from the scope accessor of the abstractions package, and the agent attribute inside an agent host; every instrument created through the helper carries the tags `tenant` and `project`; the workflow stays a dimension name and is no scope attribute; the health tags and the declared meter names follow one convention; and a prompt, a completion or a tool output leaves the process only as a reference. A service that writes its own enricher or creates a meter it did not declare is refused by its own architecture tests and not by a reviewer. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature and the pages a consumer reads. The feature is done when the three packages are on the ConnectSoft feed with the versions the Runbook pages name and the probe host proves them from the feed, which is what the Factory profile of the base template pins in the same increment. Kind: enabling. Traces: adrs: ADR-0014, ADR-0018, ADR-0019. Depends on: AIFACTORY-US-257, AIFACTORY-US-258, AIFACTORY-US-259, AIFACTORY-US-260. Sources: model/components.yaml, docs/architecture/adr/0019-data-governance.md, docs/architecture/adr/0018-nfr-baseline.md, docs/planes/trust-operations/observability/observability.md.",
      "acceptanceCriteria": [
        "AC1: Given the two library repositories with the work of this feature, when their pipelines run, then the packages build, their tests pass and they publish to the ConnectSoft feed with the versions the consuming repositories pin (ADR-0018, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-632 (factory enrichment of traces, logs and metrics) is done, then one registration adds the tenant, project, run, step and attempt attributes to activities and log records from the scope accessor under the names docs/planes/trust-operations/observability/observability.md lists, adds the agent attribute while an agent host supplies its trace context, and tags the instruments created through the helper with `tenant` and `project`; the workflow of the migrated text is a metric dimension name only; the first five attribute names map to the envelope fields of the contracts package, and the conformance test fails a service that writes its own enricher (ADR-0014 decision 1).",
        "AC3: Given the work of AIFACTORY-TASK-633 (health and meter conventions) is done, then the ready and live health tags, the meter names a service declares under `connectsoft.`, which are the `connectsoft.factory.<area>` prefixes of model/services under the Factory profile, and the drain, backlog and lease series are documented as the Factory convention and checked by the conformance test package a service references (ADR-0018, docs/architecture/nfr-baseline.md).",
        "AC4: Given the work of AIFACTORY-TASK-634 (no prompt, completion or tool output in telemetry by default) is done, then activity and log enrichment replace prompt, completion and tool-output fields by their reference unless a registered decision allows the field, with a test that a prompt placed in a log property is replaced by its reference (ADR-0019 decision 3)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md",
        "docs/planes/trust-operations/observability/observability.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1191",
        "AIFACTORY-TASK-1288",
        "AIFACTORY-TASK-686",
        "AIFACTORY-TASK-1290"
      ],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1905,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0018",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-257",
        "AIFACTORY-US-258",
        "AIFACTORY-US-259",
        "AIFACTORY-US-260"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md",
        "docs/planes/trust-operations/observability/observability.md"
      ],
      "titlePrefix": "[AIFACTORY-US-115]",
      "number": 115
    },
    {
      "id": "AIFACTORY-TASK-1191",
      "type": "task",
      "parent": "AIFACTORY-US-115",
      "title": "Features and Getting Started pages of the Observability library describe the Factory conventions",
      "sequence": "18.18.05.01",
      "description": "BEFORE DEVELOPMENT. Features and Getting Started pages of the Observability library describe the Factory conventions. Expected output: The Features and Getting Started pages of the Observability library describe the single registration, the six scope attributes, the conventions with their conformance test package and where the content guard is documented, so that a consumer reads one page of the library and no source.. Kind: documentation. Repository: ConnectSoft.Extensions.Observability. Verification: the documentation pipeline of the Observability library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Features and Getting Started pages of the Observability library describe the single registration, the six scope attributes, the conventions with their conformance test package and where the content guard is documented, so that a consumer reads one page of the library and no source."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1905,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1191]",
      "number": 1191
    },
    {
      "id": "AIFACTORY-TASK-1288",
      "type": "task",
      "parent": "AIFACTORY-US-115",
      "title": "Features page of the Telemetry library describes the enrichers, the instrument helper and the content guard",
      "sequence": "18.18.05.02",
      "description": "BEFORE DEVELOPMENT. Features page of the Telemetry library describes the enrichers, the instrument helper and the content guard. Expected output: The Features page of the Telemetry library describes the activity and log enrichers, the scope tag provider with the metric tag allowlist, the instrument helper, the trace context method for the agent attribute and the content guard with its limit.. Kind: documentation. Repository: ConnectSoft.Extensions.Telemetry. Verification: the documentation pipeline of the Telemetry library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Features page of the Telemetry library describes the activity and log enrichers, the scope tag provider with the metric tag allowlist, the instrument helper, the trace context method for the agent attribute and the content guard with its limit."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1905,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1288]",
      "number": 1288
    },
    {
      "id": "AIFACTORY-TASK-686",
      "type": "task",
      "parent": "AIFACTORY-US-115",
      "title": "Verify observability-factory-conventions-delivered by running the declared command",
      "sequence": "18.18.05.03",
      "description": "BEFORE DEVELOPMENT. Verify observability-factory-conventions-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Observability` and the probe host of AIFACTORY-TASK-1188 against the published versions; they pass and prove AC1 to AC4 of AIFACTORY-US-115 from the side of the Observability library and of a consumer.. Kind: verification. Repository: ConnectSoft.Extensions.Observability.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Observability` and the probe host of AIFACTORY-TASK-1188 against the published versions; they pass and prove AC1 to AC4 of AIFACTORY-US-115 from the side of the Observability library and of a consumer."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Observability"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-686]",
      "number": 686
    },
    {
      "id": "AIFACTORY-TASK-1290",
      "type": "task",
      "parent": "AIFACTORY-US-115",
      "title": "Verify the Telemetry solution for the delivered conventions",
      "sequence": "18.18.05.04",
      "description": "BEFORE DEVELOPMENT. Verify the Telemetry solution for the delivered conventions. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Telemetry`; they pass and prove the enrichment of AC2 and the content guard of AC4 of AIFACTORY-US-115 in the repository that holds them.. Kind: verification. Repository: ConnectSoft.Extensions.Telemetry.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of `ConnectSoft.Extensions.Telemetry`; they pass and prove the enrichment of AC2 and the content guard of AC4 of AIFACTORY-US-115 in the repository that holds them."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0018-nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Telemetry"
      ],
      "children": [],
      "buildOrder": 19,
      "phase": "templates-and-libraries",
      "stackRank": 1905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1290]",
      "number": 1290
    },
    {
      "id": "AIFACTORY-FEAT-183",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Library template: target frameworks, a manifest and Factory diagnostics for generated libraries",
      "sequence": "18.19",
      "description": "The contracts package (FEAT-090), the gateway client packages (FEAT-178) and every Backend Library module of a generated product (blueprint backend-library, workflow generate-libraries) are scaffolded from the library template (connectsoft-library). The template ships a multi-target class library with optional dependency injection, logging, options binding, metrics and an ActivitySource sample, MSTest, central package management, analyzers, an Azure pipeline and a MkDocs layout; its own pages record that the Framework parameter is a documentation moniker that does not change TargetFrameworks, that the pipeline variables live outside the template parameters, and that eighteen existing libraries still await the alignment checklist (analyzers Include, stylecop.json, .slnx, MkDocs) the template defines. A library generated for the Factory needs one parameter that sets its target frameworks, a manifest the template registry imports, samples on the Factory diagnostics names, and a pipeline that publishes to the Factory feed with the pipeline results the quality gates expect. Component: Library template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I0: Readiness. Build order 20 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-214",
        "AIFACTORY-US-215",
        "AIFACTORY-US-216",
        "AIFACTORY-US-217",
        "AIFACTORY-US-218",
        "AIFACTORY-US-113"
      ],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2000,
      "titlePrefix": "[AIFACTORY-FEAT-183]",
      "number": 183
    },
    {
      "id": "AIFACTORY-US-214",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-183",
      "title": "Library template: one parameter sets the target frameworks of the generated library, its tests and its pipeline",
      "sequence": "18.19.01",
      "description": "As an asset maintainer, I want a parameter of the library template that decides which frameworks a generated library targets, so that a library generated for the Factory targets the framework of the Factory backend without a hand edit of its project files. The template configuration of the library template has a choice named `Framework` with the values net8.0, net9.0 and net10.0, and its own description says what it does: it is the primary framework moniker for the command line, the editor and the documentation, the generated library always targets all three frameworks, and the parameter does not change the target frameworks. The Features page repeats that statement and the Runbook page explains that the sample pipeline installs three SDK versions so that the three targets build. ADR-0001 standardizes the Factory backend on .NET 10, so the contracts package, the gateway client packages and the backend library modules of a generated product need a library that targets one framework. This PBI adds one parameter that sets the target frameworks. Its values are the multi-target set of today, which stays the default so that existing consumers of the template see no change, and the single framework of ADR-0001. The Factory scaffold passes the single framework as a value of this parameter; the profile symbol `UseFactoryProfile` of the template does not derive it. The project file of the library, the unit test project and the SDK installation steps of the generated pipeline follow the chosen set, and no file of the generated repository names a framework outside it. The `Framework` choice keeps its meaning as the primary moniker; the template engine has no constraint between symbols, so a primary moniker that is not a member of the chosen set is replaced by the highest framework of the set through a computed symbol instead of being refused. The name and the semantics of the parameter are recorded on the Features page so that the AI skills library template can adopt the same parameter in its own feature. Kind: enabling. Traces: adrs: ADR-0001, ADR-0028. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-library.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the library template, when a library is generated with the target-frameworks parameter set to the single framework of ADR-0001, then the project file of the library and of its tests target that framework only, the generated pipeline installs only that SDK, the solution builds and its tests pass, and no generated file names another framework.",
        "AC2: Given the library template, when a library is generated without the parameter, then it targets the same three frameworks as today and the generated repository is unchanged from the output of the current template except for the files of this feature; the parameter with its values appears in model/template-parameters/connectsoft-library.yaml after the next inventory (ADR-0028).",
        "AC3: Given a primary moniker that is not a member of the chosen set, when the library is generated, then the highest framework of the set is used as the primary moniker through a computed symbol and the generation succeeds; the scaffold tests cover the combination, and the Features page states the name and the semantics of the parameter (ADR-0001, model/templates.yaml keeps the targets of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-647",
        "AIFACTORY-TASK-1035",
        "AIFACTORY-TASK-1036"
      ],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2001,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0001",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-214]",
      "number": 214
    },
    {
      "id": "AIFACTORY-TASK-647",
      "type": "task",
      "parent": "AIFACTORY-US-214",
      "title": "Target frameworks as a parameter of the generated library",
      "sequence": "18.19.01.01",
      "description": "BEFORE DEVELOPMENT. Target frameworks as a parameter of the generated library. Expected output: One parameter of the template configuration sets the `TargetFrameworks` of the generated library, with the multi-target set of today as the default and the single .NET 10 framework as a value; the `Framework` choice keeps its meaning as the primary moniker, which its description records, and a computed symbol replaces a primary moniker outside the chosen set; the Features page records the name and semantics for the AI skills library template.. Kind: contract. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One parameter of the template configuration sets the `TargetFrameworks` of the generated library, with the multi-target set of today as the default and the single .NET 10 framework as a value; the `Framework` choice keeps its meaning as the primary moniker, which its description records, and a computed symbol replaces a primary moniker outside the chosen set; the Features page records the name and semantics for the AI skills library template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2001,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-647]",
      "number": 647
    },
    {
      "id": "AIFACTORY-TASK-1035",
      "type": "task",
      "parent": "AIFACTORY-US-214",
      "title": "Project files, test project and pipeline SDK steps follow the chosen frameworks",
      "sequence": "18.19.01.02",
      "description": "BEFORE DEVELOPMENT. Project files, test project and pipeline SDK steps follow the chosen frameworks. Expected output: The project file of the library, the unit test project and the SDK installation steps of the generated pipeline are generated from the chosen set; with the single framework chosen no generated file names another framework and the pipeline installs one SDK.. Kind: implementation. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The project file of the library, the unit test project and the SDK installation steps of the generated pipeline are generated from the chosen set; with the single framework chosen no generated file names another framework and the pipeline installs one SDK."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1035]",
      "number": 1035
    },
    {
      "id": "AIFACTORY-TASK-1036",
      "type": "task",
      "parent": "AIFACTORY-US-214",
      "title": "Verify the single-framework, the default and the mismatched-moniker generations",
      "sequence": "18.19.01.03",
      "description": "BEFORE DEVELOPMENT. Verify the single-framework, the default and the mismatched-moniker generations. Expected output: Run the scaffold tests of the template for the single framework, the default set and a primary moniker outside the chosen set; each generated solution builds and passes its tests, which proves AC1 to AC3 of AIFACTORY-US-214 (ADR-0001).. Kind: verification. Repository: ConnectSoft.LibraryTemplate.",
      "acceptanceCriteria": [
        "Run the scaffold tests of the template for the single framework, the default set and a primary moniker outside the chosen set; each generated solution builds and passes its tests, which proves AC1 to AC3 of AIFACTORY-US-214 (ADR-0001)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1036]",
      "number": 1036
    },
    {
      "id": "AIFACTORY-US-215",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-183",
      "title": "Library template: the generated repository carries a manifest of its generation and the package exports a symbol catalog",
      "sequence": "18.19.02",
      "description": "As an asset maintainer, I want every generated library to record the template, the version and the parameter values it was generated with, and the template to publish the list of its symbols, so that the template registry can import the template and a generation recipe can pin it and reproduce a library. A library generated from the template today keeps no record of how it was generated: nothing in the repository names the template, its version or the values of `UseDI`, `UseLogging`, `UseOptions`, `UseMetrics`, `UseActivitySource` and the framework choices, and the symbols of the template can be learned only by reading its configuration file. The generation contract of ADR-0027 lets a recipe pin every input of a module by id, version and hash, and the documentation template feature of this epic names the same need as a manifest and a symbol catalog; the library template is the first template to carry both because the contracts package and the gateway clients are scaffolded from it before any service. This PBI adds a manifest to the generated repository, the file `.connectsoft/template-manifest.json`. It is written at generation and holds the template id `connectsoft-library`, the version of the template package and the value of every parameter. It is preserved: a later regeneration of the same library reads it as its input, and a scaffold test fails when the manifest disagrees with the generated project files. The manifest guarantees that a regeneration reproduces the parameter values, not an identical output: the template has a generated symbol `currentYear` that writes the year of the generation, and that year is outside the reproducibility the manifest guarantees. The template package exports a symbol catalog, the file `.template.config/symbol-catalog.json` beside the template configuration, produced at pack time from that configuration: every symbol with its type, data type, default, choices and description, in the shape the template inventory of the documentation repository reads into model/template-parameters/connectsoft-library.yaml. A manifest schema, the file `.template.config/template-manifest.schema.json`, is published with the catalog. The three file names are set here, by the first template that carries them, so that the template registry and the documentation template feature read the same files. The import by the template registry is work of that service in a later increment; this PBI delivers the two files it will read. Kind: enabling. Traces: adrs: ADR-0027, ADR-0028. Depends on: AIFACTORY-US-214. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-library.yaml, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given a library generated from the template, when its repository is inspected, then the manifest `.connectsoft/template-manifest.json` holds the template id `connectsoft-library`, the version of the template package and the value of every parameter of the generation, and the scaffold tests read the manifest back and compare it with the generated project files (ADR-0027 decision 2 pins a generation input by id, version and hash).",
        "AC2: Given the packed template, when the package is inspected, then it contains the symbol catalog `.template.config/symbol-catalog.json` with every symbol, its type, data type, default, choices and description, produced from the template configuration at pack time, and the catalog lists the same symbols as model/template-parameters/connectsoft-library.yaml after the next inventory (ADR-0028).",
        "AC3: Given a generated library whose manifest was edited so that it disagrees with its project files, when the scaffold tests run, then they fail with the differing parameter named; a regeneration that takes the manifest as its input reproduces the same parameter values, the year the `currentYear` symbol generates being outside that guarantee, and the manifest validates against the published schema `.template.config/template-manifest.schema.json` (ADR-0027, model/templates.yaml lists the switches the catalog must cover)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1037",
        "AIFACTORY-TASK-1038",
        "AIFACTORY-TASK-1039",
        "AIFACTORY-TASK-1040"
      ],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2002,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-214"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-215]",
      "number": 215
    },
    {
      "id": "AIFACTORY-TASK-1037",
      "type": "task",
      "parent": "AIFACTORY-US-215",
      "title": "Manifest schema of a generated library",
      "sequence": "18.19.02.01",
      "description": "BEFORE DEVELOPMENT. Manifest schema of a generated library. Expected output: The schema file `.template.config/template-manifest.schema.json` in the template repository defines the manifest of a generated library, the file `.connectsoft/template-manifest.json` of the generated repository, with the template id, the template package version and one entry per parameter; the schema is packed with the template beside the symbol catalog.. Kind: contract. Repository: ConnectSoft.LibraryTemplate. Verification: the schema validates the manifest of the default generated case.",
      "acceptanceCriteria": [
        "The schema file `.template.config/template-manifest.schema.json` in the template repository defines the manifest of a generated library, the file `.connectsoft/template-manifest.json` of the generated repository, with the template id, the template package version and one entry per parameter; the schema is packed with the template beside the symbol catalog."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2002,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1037]",
      "number": 1037
    },
    {
      "id": "AIFACTORY-TASK-1038",
      "type": "task",
      "parent": "AIFACTORY-US-215",
      "title": "Manifest written at generation and preserved on regeneration",
      "sequence": "18.19.02.02",
      "description": "BEFORE DEVELOPMENT. Manifest written at generation and preserved on regeneration. Expected output: The template writes the manifest `.connectsoft/template-manifest.json` into the generated repository with the chosen value of every parameter and the version of the template package; a regeneration reads the manifest as its input and reproduces the parameter values; the year the generated symbol `currentYear` writes is outside that reproducibility, which the Features page states.. Kind: implementation. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template writes the manifest `.connectsoft/template-manifest.json` into the generated repository with the chosen value of every parameter and the version of the template package; a regeneration reads the manifest as its input and reproduces the parameter values; the year the generated symbol `currentYear` writes is outside that reproducibility, which the Features page states."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1038]",
      "number": 1038
    },
    {
      "id": "AIFACTORY-TASK-1039",
      "type": "task",
      "parent": "AIFACTORY-US-215",
      "title": "Symbol catalog exported at pack time",
      "sequence": "18.19.02.03",
      "description": "BEFORE DEVELOPMENT. Symbol catalog exported at pack time. Expected output: A pack step reads the template configuration and writes the symbol catalog `.template.config/symbol-catalog.json` into the package with every symbol, its type, data type, default, choices and description; the pipeline fails when the catalog and the configuration differ.. Kind: implementation. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A pack step reads the template configuration and writes the symbol catalog `.template.config/symbol-catalog.json` into the package with every symbol, its type, data type, default, choices and description; the pipeline fails when the catalog and the configuration differ."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1039]",
      "number": 1039
    },
    {
      "id": "AIFACTORY-TASK-1040",
      "type": "task",
      "parent": "AIFACTORY-US-215",
      "title": "Verify the manifest read-back and the symbol catalog",
      "sequence": "18.19.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the manifest read-back and the symbol catalog. Expected output: Run the scaffold tests of the template; the manifest of every generated case is read back and compared with the project files, an edited manifest fails the comparison and the catalog of the package equals the configuration, which proves AC1 to AC3 of AIFACTORY-US-215 (ADR-0027).. Kind: verification. Repository: ConnectSoft.LibraryTemplate.",
      "acceptanceCriteria": [
        "Run the scaffold tests of the template; the manifest of every generated case is read back and compared with the project files, an edited manifest fails the comparison and the catalog of the package equals the configuration, which proves AC1 to AC3 of AIFACTORY-US-215 (ADR-0027)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1040]",
      "number": 1040
    },
    {
      "id": "AIFACTORY-US-216",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-183",
      "title": "Library template: the metrics and ActivitySource samples follow the diagnostics names and the no-payload rule, and `UseFactoryProfile` adds the scope tags of the Factory",
      "sequence": "18.19.03",
      "description": "As an asset maintainer, I want the diagnostics samples of a generated library to start on the names and rules the Factory uses, so that no library generated for the Factory needs a later rename of its meter or its activity source and none records payload in telemetry. The library template generates a metrics sample when `UseMetrics` is on and a diagnostics class with an activity source, a sample and tests when `UseActivitySource` is on; the Features page describes both, and the Runbook page states that a class library hosts no ASP.NET Core endpoints and no health endpoints of its own, although further down the same page shows a section of health check endpoints and a web app slot swap; this PBI removes that contradiction from the page. The activity source of the sample is named after the library. The telemetry conventions of the Factory are fixed for the observability libraries by a later feature of this epic, so the template does not wait for them: it adopts the naming the ConnectSoft libraries already publish, a meter under the `connectsoft.` prefix in lower case derived from the library name and an activity source named after the library, so that a library generated today is already on the names the convention will confirm. The Factory part of the samples belongs to the Factory profile of the template, which decision D114 and the amendment of ADR-0028 on the Factory profile switch name: the boolean `UseFactoryProfile`, off by default, with the same name as in the base, worker and gateway templates, passed by the Factory scaffold command. This PBI adds the symbol to the template configuration. With it on, the samples gain the scope tags of the Factory: the activity sample shows how tenant, project, run, step and attempt identity are set as tags from values the caller passes, and the allow list of the tag test holds those names. With it off, the samples carry no scope tag, so a generation outside the Factory does not change in this respect. The symbol derives nothing else: the target frameworks and the feed stay parameters of their own, and the manifest records its value. In both cases the metric sample uses bounded dimensions only and never a run or attempt identifier. The samples follow the telemetry rule of ADR-0019 decision 3: no prompt, response, tool output or message body is written to a tag, a metric dimension or a log message. A unit test in the generated solution checks the tag names of the samples against an allow list, so that a library author who adds a payload tag is told by a failing test. The library still hosts no endpoint. Kind: enabling. Traces: adrs: ADR-0019, ADR-0028. Sources: model/components.yaml, model/template-parameters/connectsoft-library.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a library generated with `UseMetrics` and `UseActivitySource` on, when its diagnostics are inspected, then the meter name is lower case under the `connectsoft.` prefix derived from the library name and the activity source is named after the library, on every target framework, and the Features page of the template states the two names (ADR-0028, model/template-parameters/connectsoft-library.yaml lists the two switches).",
        "AC2: Given a library generated with `UseFactoryProfile` and both diagnostics switches on, when an activity is started with a scope passed by the caller, then tenant, project, run, step and attempt identity appear as tags of the activity, while a library generated without `UseFactoryProfile`, its default, carries no scope tag (ADR-0028 amendment on the Factory profile switch); in both generations the metric sample carries bounded dimensions only, and neither sample writes a prompt, a response, a tool output or a message body to a tag, a dimension or a log message, as ADR-0019 decision 3 requires.",
        "AC3: Given the unit tests of a generated library, when a tag outside the allow list is added to a sample, then the tag test fails with the tag named; the generated library references no ASP.NET Core package and maps no endpoint, as the Runbook page of the template states (ADR-0019, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-648",
        "AIFACTORY-TASK-1060",
        "AIFACTORY-TASK-1041",
        "AIFACTORY-TASK-1042",
        "AIFACTORY-TASK-1043"
      ],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2003,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0019",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-216]",
      "number": 216
    },
    {
      "id": "AIFACTORY-TASK-648",
      "type": "task",
      "parent": "AIFACTORY-US-216",
      "title": "Samples on the Factory diagnostics conventions",
      "sequence": "18.19.03.01",
      "description": "BEFORE DEVELOPMENT. Samples on the Factory diagnostics conventions. Expected output: The metrics and ActivitySource samples use the meter and activity-source naming the ConnectSoft libraries publish under the `connectsoft.` prefix and the no-payload rule, and with `UseFactoryProfile` on the activity sample carries the scope tags, so a library generated for the Factory starts on the conventions without a later rename; the library still hosts no ASP.NET Core endpoints, as the Runbook page states.. Kind: implementation. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The metrics and ActivitySource samples use the meter and activity-source naming the ConnectSoft libraries publish under the `connectsoft.` prefix and the no-payload rule, and with `UseFactoryProfile` on the activity sample carries the scope tags, so a library generated for the Factory starts on the conventions without a later rename; the library still hosts no ASP.NET Core endpoints, as the Runbook page states."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-648]",
      "number": 648
    },
    {
      "id": "AIFACTORY-TASK-1060",
      "type": "task",
      "parent": "AIFACTORY-US-216",
      "title": "UseFactoryProfile in the configuration of the library template",
      "sequence": "18.19.03.02",
      "description": "BEFORE DEVELOPMENT. UseFactoryProfile in the configuration of the library template. Expected output: The template configuration defines the boolean `UseFactoryProfile`, off by default, under the name the base, worker and gateway templates use; with it on the activity sample carries the Factory scope tags and the allow list of the tag test holds them, and it changes neither the target frameworks nor the feed; the command line host file exposes the option, the manifest records its value and the Features page documents it.. Kind: contract. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template configuration defines the boolean `UseFactoryProfile`, off by default, under the name the base, worker and gateway templates use; with it on the activity sample carries the Factory scope tags and the allow list of the tag test holds them, and it changes neither the target frameworks nor the feed; the command line host file exposes the option, the manifest records its value and the Features page documents it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2003,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1060]",
      "number": 1060
    },
    {
      "id": "AIFACTORY-TASK-1041",
      "type": "task",
      "parent": "AIFACTORY-US-216",
      "title": "Tag allow-list test in the generated unit test project",
      "sequence": "18.19.03.03",
      "description": "BEFORE DEVELOPMENT. Tag allow-list test in the generated unit test project. Expected output: The unit test project of a generated library holds a test that collects the tag and dimension names of the samples and compares them with an allow list, which holds the scope tag names only when UseFactoryProfile is on; a name outside the list fails the test with the name reported; the test is generated only when a diagnostics switch is on.. Kind: fixture. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project of a generated library holds a test that collects the tag and dimension names of the samples and compares them with an allow list, which holds the scope tag names only when UseFactoryProfile is on; a name outside the list fails the test with the name reported; the test is generated only when a diagnostics switch is on."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2003,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1041]",
      "number": 1041
    },
    {
      "id": "AIFACTORY-TASK-1042",
      "type": "task",
      "parent": "AIFACTORY-US-216",
      "title": "Features and Runbook pages state the diagnostics names and the no-payload rule",
      "sequence": "18.19.03.04",
      "description": "BEFORE DEVELOPMENT. Features and Runbook pages state the diagnostics names and the no-payload rule. Expected output: The Features page of the template names the meter and activity-source convention and the scope tags the samples carry under `UseFactoryProfile`; the Runbook page states the no-payload rule and the allow-list test and keeps the statement that a library hosts no endpoints; the health check endpoint section and the web app slot swap and rollback sections of the Runbook page, which contradict that statement, are removed or marked as guidance for the consuming host.. Kind: documentation. Repository: ConnectSoft.LibraryTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "The Features page of the template names the meter and activity-source convention and the scope tags the samples carry under `UseFactoryProfile`; the Runbook page states the no-payload rule and the allow-list test and keeps the statement that a library hosts no endpoints; the health check endpoint section and the web app slot swap and rollback sections of the Runbook page, which contradict that statement, are removed or marked as guidance for the consuming host."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2003,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1042]",
      "number": 1042
    },
    {
      "id": "AIFACTORY-TASK-1043",
      "type": "task",
      "parent": "AIFACTORY-US-216",
      "title": "Verify the names, the scope tags and the allow-list test on generated libraries",
      "sequence": "18.19.03.05",
      "description": "BEFORE DEVELOPMENT. Verify the names, the scope tags and the allow-list test on generated libraries. Expected output: Generate a library with `UseFactoryProfile` and both diagnostics switches on, one with both switches on and without the profile, and one with both switches off, build and test them; the name, scope tag and allow-list tests pass on the first, the second carries the names and no scope tag, and the third contains no diagnostics file, which proves AC1 to AC3 of AIFACTORY-US-216 (ADR-0019).. Kind: verification. Repository: ConnectSoft.LibraryTemplate.",
      "acceptanceCriteria": [
        "Generate a library with `UseFactoryProfile` and both diagnostics switches on, one with both switches on and without the profile, and one with both switches off, build and test them; the name, scope tag and allow-list tests pass on the first, the second carries the names and no scope tag, and the third contains no diagnostics file, which proves AC1 to AC3 of AIFACTORY-US-216 (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1043]",
      "number": 1043
    },
    {
      "id": "AIFACTORY-US-217",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-183",
      "title": "Library template: the generated pipeline publishes to the feed it is given with symbols, an SBOM and the PIPE-001 results, and the alignment checklist is the generated default",
      "sequence": "18.19.04",
      "description": "As an asset maintainer, I want a generated library to publish to the ConnectSoft feed with the pipeline results the Factory expects and to need no later alignment pass, so that the contracts package and the gateway clients are published correctly from their first pipeline run. The Runbook page of the library template states that the pipeline variables of a generated library, such as the coverage threshold and the feed identifiers, live in the pipeline file of the generated repository and are not passed when scaffolding, so a library generated for the Factory starts with a feed and a threshold that someone has to edit. The Alignment page of the template defines a checklist that eighteen existing libraries still await: the analyzers included and not only updated in the build properties, a style configuration file wired as an additional file, the documentation site with its pipeline, central package management kept, a solution file in the new format and the multi-target set kept unless a task documents a single-framework constraint. Rule PIPE-001 of model/blueprints.yaml lists the typed results a pipeline produces: build, tests, coverage, analysis, scan, SBOM, packages, images and attestations. This PBI makes the generated repository correct from the start. The generated pipeline produces the build, tests, coverage, analysis and scan results, the analysis result being the analyzer result of the build and the scan result a dependency vulnerability scan; it packs the library, produces an SBOM with the package and publishes the package and its symbols to the configured feed with a version that is verified against the feed before the push. A library pipeline builds no image and signs no attestation, so those two results of the rule are stated as not produced. The feed and the coverage threshold become template parameters whose defaults are the values the template generates today, so that an existing consumer sees no change. The feed is settled by decision D114: the Factory feed is the Azure Artifacts feed the ConnectSoft libraries already publish to, which is the feed the generated pipeline names today, so the template keeps its feed default and the Factory scaffold passes no other feed. A consumer that publishes elsewhere, or that needs another threshold, passes the value as a parameter, and the manifest of the generated library records both values, so nothing is edited after generation. Every item of the alignment checklist is what the template generates by default, with the single-framework choice of the earlier PBI as the documented constraint the checklist allows. A publication with a version that is already on the feed is refused by the generated pipeline with the reason. Kind: enabling. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-214, AIFACTORY-US-215. Sources: model/components.yaml, model/blueprints.yaml, model/template-parameters/connectsoft-library.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given a library generated from the template, when its pipeline runs on its publishing branch, then it produces the build, tests, coverage (measured against the generated threshold), analysis (the analyzer result), scan (the dependency vulnerability scan), SBOM and packages results of rule PIPE-001 of model/blueprints.yaml, and publishes the package and its symbols to the configured feed with a version verified against the feed; images and attestations, the two remaining results of the rule, are stated as not produced by a library pipeline (ADR-0028).",
        "AC2: Given the template parameters for the feed and the coverage threshold, when a library is generated without pipeline options, then the generated pipeline holds the values the template generates today, the ConnectSoft feed among them, so that an existing consumer sees no change and the Factory scaffold, which passes no other feed, publishes to that feed; when a scaffold passes another feed or threshold, then the generated pipeline holds the passed values and no pipeline file needs an edit after generation; the manifest records both values in either case, the parameters appear in model/template-parameters/connectsoft-library.yaml after the next inventory, and a version that is already on the feed is refused by the generated pipeline with the reason (ADR-0028).",
        "AC3: Given a library generated with the defaults, when it is compared with the checklist of the Alignment page of the template, then every item holds: the analyzers are included, the style configuration is an additional file, the documentation site and its pipeline exist, central package management is on and the solution file is in the new format, so that no alignment task is opened for a generated library (ADR-0028, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1044",
        "AIFACTORY-TASK-1045",
        "AIFACTORY-TASK-1046",
        "AIFACTORY-TASK-1047"
      ],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2004,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-214",
        "AIFACTORY-US-215"
      ],
      "source": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-217]",
      "number": 217
    },
    {
      "id": "AIFACTORY-TASK-1044",
      "type": "task",
      "parent": "AIFACTORY-US-217",
      "title": "Feed and coverage threshold as template parameters with the defaults of today",
      "sequence": "18.19.04.01",
      "description": "BEFORE DEVELOPMENT. Feed and coverage threshold as template parameters with the defaults of today. Expected output: The template configuration defines parameters for the package feed and the coverage threshold of the generated pipeline; their defaults are the values the template generates today, the feed being the ConnectSoft feed that is also the Factory feed, so the Factory scaffold passes no other feed; the manifest records both values; the generated pipeline file reads them and the Runbook page no longer tells the reader to edit the pipeline after generation.. Kind: contract. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The template configuration defines parameters for the package feed and the coverage threshold of the generated pipeline; their defaults are the values the template generates today, the feed being the ConnectSoft feed that is also the Factory feed, so the Factory scaffold passes no other feed; the manifest records both values; the generated pipeline file reads them and the Runbook page no longer tells the reader to edit the pipeline after generation."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2004,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1044]",
      "number": 1044
    },
    {
      "id": "AIFACTORY-TASK-1045",
      "type": "task",
      "parent": "AIFACTORY-US-217",
      "title": "Package, symbols, SBOM, analysis and scan results with a version check in the generated pipeline",
      "sequence": "18.19.04.02",
      "description": "BEFORE DEVELOPMENT. Package, symbols, SBOM, analysis and scan results with a version check in the generated pipeline. Expected output: The generated pipeline builds, tests and measures coverage, publishes the analyzer result of the build as the analysis result, runs a dependency vulnerability scan as the scan result, packs the library, produces an SBOM, checks the version against the feed and publishes the package and its symbols to the configured feed; a version already on the feed is refused with the reason and the run fails; images and attestations are not produced by a library pipeline.. Kind: operations. Repository: ConnectSoft.LibraryTemplate. Verification: the generated pipeline of the default case publishes to a test feed and refuses a repeated version.",
      "acceptanceCriteria": [
        "The generated pipeline builds, tests and measures coverage, publishes the analyzer result of the build as the analysis result, runs a dependency vulnerability scan as the scan result, packs the library, produces an SBOM, checks the version against the feed and publishes the package and its symbols to the configured feed; a version already on the feed is refused with the reason and the run fails; images and attestations are not produced by a library pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2004,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1045]",
      "number": 1045
    },
    {
      "id": "AIFACTORY-TASK-1046",
      "type": "task",
      "parent": "AIFACTORY-US-217",
      "title": "Alignment checklist as the generated default",
      "sequence": "18.19.04.03",
      "description": "BEFORE DEVELOPMENT. Alignment checklist as the generated default. Expected output: The generated repository includes the analyzers in its build properties, wires the style configuration as an additional file, carries the documentation site with its pipeline, keeps central package management and uses the new solution file format; the Alignment page records that a generated library needs no alignment task.. Kind: implementation. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated repository includes the analyzers in its build properties, wires the style configuration as an additional file, carries the documentation site with its pipeline, keeps central package management and uses the new solution file format; the Alignment page records that a generated library needs no alignment task."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1046]",
      "number": 1046
    },
    {
      "id": "AIFACTORY-TASK-1047",
      "type": "task",
      "parent": "AIFACTORY-US-217",
      "title": "Verify the generated pipeline results and the checklist on a generated library",
      "sequence": "18.19.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the generated pipeline results and the checklist on a generated library. Expected output: Generate a library with the defaults and one with a test feed and another threshold passed as parameter values; the pipeline file of the first names the ConnectSoft feed, run the pipeline of the second against the test feed and compare both repositories with the checklist of the Alignment page; the build, tests, coverage, analysis, scan, SBOM and packages results of PIPE-001 are produced with the package and its symbols, the passed values are in the pipeline file and in the manifest, a repeated version is refused and every checklist item holds, which proves AC1 to AC3 of AIFACTORY-US-217 (ADR-0028, model/blueprints.yaml).. Kind: verification. Repository: ConnectSoft.LibraryTemplate.",
      "acceptanceCriteria": [
        "Generate a library with the defaults and one with a test feed and another threshold passed as parameter values; the pipeline file of the first names the ConnectSoft feed, run the pipeline of the second against the test feed and compare both repositories with the checklist of the Alignment page; the build, tests, coverage, analysis, scan, SBOM and packages results of PIPE-001 are produced with the package and its symbols, the passed values are in the pipeline file and in the manifest, a repeated version is refused and every checklist item holds, which proves AC1 to AC3 of AIFACTORY-US-217 (ADR-0028, model/blueprints.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1047]",
      "number": 1047
    },
    {
      "id": "AIFACTORY-US-218",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-183",
      "title": "Library template: the shared template pipeline gates the default generation and one Factory profile case, the scaffold tests cover the parameter matrix, and only then the package publishes",
      "sequence": "18.19.05",
      "description": "As an asset maintainer, I want every change of the library template to be gated by the libraries it generates, so that a template package that would generate a library that does not build or test never reaches the feed. This PBI is the gate of the feature. The amendment of ADR-0028 on the Factory templates scaffolds a Factory repository only from a template package, and the epic is done only when each template publishes a package that passes its generated-solution gate. The estate has one gate mechanism for templates, the shared template pipeline of `ConnectSoft.AzurePipelines` (`template-ci/v1`): one packed candidate, the scaffold cases of the manifest `build/template-ci.json` of the consumer, result validation and publication on the complete reports of every selected case. Its Domain profile declares one case per supported artifact kind, and decision D114 with the amendment of ADR-0028 on the Factory profile switch admits one additional gating case per declared profile while default generations stay gated as today. The library template is not yet a consumer of the shared pipeline: its template pipeline packs and pushes without a generated case, and the rollout ledger of the shared pipeline has no row for it. This PBI makes it one. The template declares one profile, `UseFactoryProfile`, so the manifest holds two gating cases: the default generation, and the Factory profile case, a library generated with `UseFactoryProfile` true, the single framework of ADR-0001, dependency injection, options and the activity source sample, which is the shape of the contracts package with the sample that carries the scope tags of the profile. The parameter matrix is not a set of pipeline cases. The template repository already holds a scaffold test project, and the matrix of the five feature switches `UseDI`, `UseLogging`, `UseOptions`, `UseMetrics` and `UseActivitySource`, of `UseFactoryProfile` and of the values of the target-frameworks parameter runs there as tests of the authoring solution, as the scaffold tests run today, reduced to the pairs of values so that the run stays bounded while every pair of options is covered. For each gating case and each output of the matrix the solution is restored and built in Release, the unit tests of the generated library run, the manifest is read back, the tag allow-list test runs where a diagnostics switch is on and the output is scanned for template placeholders that were not replaced. A gating case or an output that fails any stage fails the run with the case or the parameter values and the stage named, and no later stage of it is reported as passed. Publication requires the complete reports of both gating cases and green scaffold tests, pushes the template package with a verified version and refuses a version that is already on the feed. A fixture with a planted defect in the Factory profile case proves the refusal. A final probe installs the published package and generates the Factory profile case, which builds unchanged. Kind: evidence. Traces: adrs: ADR-0028. Depends on: AIFACTORY-US-214, AIFACTORY-US-215, AIFACTORY-US-216, AIFACTORY-US-217. Sources: model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-library.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the library template, when its pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the default generation and exactly one additional gating case, generated with `UseFactoryProfile` true, the single framework, dependency injection, options and the activity source sample, are restored, built in Release, tested, checked against their manifests and scanned for placeholders, and the scaffold tests of the authoring solution instantiate the template across the pairwise matrix of `UseDI`, `UseLogging`, `UseOptions`, `UseMetrics`, `UseActivitySource`, `UseFactoryProfile` and the target-framework choices (ADR-0028 amendments on the Factory templates and on the Factory profile switch, model/template-parameters/connectsoft-library.yaml).",
        "AC2: Given a gating case or an output of the matrix fails any stage, when the pipeline evaluates the run, then the run fails with the case or the parameter values and the stage named, no later stage of it is reported as passed and publication is not reached; a fixture with a planted defect in the Factory profile case proves the refusal (ADR-0028).",
        "AC3: Given the complete reports of both gating cases and green scaffold tests, when publication runs, then the template package is pushed to the ConnectSoft feed with a verified version, a version that is already on the feed is refused, and an install of the published package followed by the generation of the Factory profile case builds unchanged (ADR-0028, model/backlog/epics.yaml states the gate as the completion of the epic)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1048",
        "AIFACTORY-TASK-1061",
        "AIFACTORY-TASK-1049",
        "AIFACTORY-TASK-1050",
        "AIFACTORY-TASK-649"
      ],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2005,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-214",
        "AIFACTORY-US-215",
        "AIFACTORY-US-216",
        "AIFACTORY-US-217"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-218]",
      "number": 218
    },
    {
      "id": "AIFACTORY-TASK-1048",
      "type": "task",
      "parent": "AIFACTORY-US-218",
      "title": "Template pipeline manifest with the default and the Factory profile case, and the pairwise matrix in the scaffold tests",
      "sequence": "18.19.05.01",
      "description": "BEFORE DEVELOPMENT. Template pipeline manifest with the default and the Factory profile case, and the pairwise matrix in the scaffold tests. Expected output: The library template adopts the shared template pipeline: `build/template-ci.json` names its identity, solution, packaging and tests and declares the default case and one additional gating case that generates with `UseFactoryProfile` true, the single framework, dependency injection, options and the activity source sample; `azure-pipelines-template.yml` runs the shared installer jobs on it; the scaffold test project defines the matrix of the five feature switches, `UseFactoryProfile` and the target-framework choices as a pairwise set of tests, each of which restores, builds, tests, reads the manifest back and scans for placeholders.. Kind: operations. Repository: ConnectSoft.LibraryTemplate. Verification: azure-pipelines-template.yml runs the shared installer jobs and the manifest lists the default case and one Factory profile case.",
      "acceptanceCriteria": [
        "The library template adopts the shared template pipeline: `build/template-ci.json` names its identity, solution, packaging and tests and declares the default case and one additional gating case that generates with `UseFactoryProfile` true, the single framework, dependency injection, options and the activity source sample; `azure-pipelines-template.yml` runs the shared installer jobs on it; the scaffold test project defines the matrix of the five feature switches, `UseFactoryProfile` and the target-framework choices as a pairwise set of tests, each of which restores, builds, tests, reads the manifest back and scans for placeholders."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2005,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1048]",
      "number": 1048
    },
    {
      "id": "AIFACTORY-TASK-1061",
      "type": "task",
      "parent": "AIFACTORY-US-218",
      "title": "Library template as a consumer of the shared template pipeline",
      "sequence": "18.19.05.02",
      "description": "BEFORE DEVELOPMENT. Library template as a consumer of the shared template pipeline. Expected output: The rollout ledger of the shared template pipeline, `template-ci/rollout-status.md`, gains the row of the library template, and the installer self-tests of `template-ci/v1` gain a consumer fixture of a class library template: the `template` artifact kind only, no required service, the default case and one additional gating case of a declared profile; the fixture passes in the Windows and Linux jobs of the shared pipeline.. Kind: operations. Repository: ConnectSoft.AzurePipelines. Verification: the self-test entry points of the shared pipeline pass with the library template fixture.",
      "acceptanceCriteria": [
        "The rollout ledger of the shared template pipeline, `template-ci/rollout-status.md`, gains the row of the library template, and the installer self-tests of `template-ci/v1` gain a consumer fixture of a class library template: the `template` artifact kind only, no required service, the default case and one additional gating case of a declared profile; the fixture passes in the Windows and Linux jobs of the shared pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2005,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1061]",
      "number": 1061
    },
    {
      "id": "AIFACTORY-TASK-1049",
      "type": "task",
      "parent": "AIFACTORY-US-218",
      "title": "Planted failing output fixture for the gate",
      "sequence": "18.19.05.03",
      "description": "BEFORE DEVELOPMENT. Planted failing output fixture for the gate. Expected output: A pipeline fixture generates the Factory profile case with a planted compile defect and asserts that the run fails at the build stage with the case named and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.LibraryTemplate. Verification: the planted Factory profile case fails before publication.",
      "acceptanceCriteria": [
        "A pipeline fixture generates the Factory profile case with a planted compile defect and asserts that the run fails at the build stage with the case named and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2005,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1049]",
      "number": 1049
    },
    {
      "id": "AIFACTORY-TASK-1050",
      "type": "task",
      "parent": "AIFACTORY-US-218",
      "title": "Publication on the complete reports of both gating cases and green scaffold tests, with the version guard",
      "sequence": "18.19.05.04",
      "description": "BEFORE DEVELOPMENT. Publication on the complete reports of both gating cases and green scaffold tests, with the version guard. Expected output: Publication of the template pipeline requires the complete reports of the default case and of the Factory profile case, bound to the candidate, and green scaffold tests, pushes the template package to the ConnectSoft feed with a verified version and refuses a version that is already on the feed with the reason; a failed gating case or a failed scaffold test skips publication.. Kind: operations. Repository: ConnectSoft.LibraryTemplate. Verification: a run with one failing gating case stops before publication and names the case.",
      "acceptanceCriteria": [
        "Publication of the template pipeline requires the complete reports of the default case and of the Factory profile case, bound to the candidate, and green scaffold tests, pushes the template package to the ConnectSoft feed with a verified version and refuses a version that is already on the feed with the reason; a failed gating case or a failed scaffold test skips publication."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2005,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1050]",
      "number": 1050
    },
    {
      "id": "AIFACTORY-TASK-649",
      "type": "task",
      "parent": "AIFACTORY-US-218",
      "title": "ConnectSoft feed publication and a generated-solution gate",
      "sequence": "18.19.05.05",
      "description": "BEFORE DEVELOPMENT. ConnectSoft feed publication and a generated-solution gate. Expected output: One green run and one planted run of the gate: the shared installer jobs generate the default case and the Factory profile case from the packed template, the scaffold tests instantiate it across the parameter matrix (UseDI, UseLogging, UseOptions, UseMetrics, UseActivitySource, UseFactoryProfile and the target-framework choices), each output is built and tested before the package publishes, and the package reaches the feed only on the green run, which proves AC1 to AC3 of AIFACTORY-US-218 (ADR-0028).. Kind: verification. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One green run and one planted run of the gate: the shared installer jobs generate the default case and the Factory profile case from the packed template, the scaffold tests instantiate it across the parameter matrix (UseDI, UseLogging, UseOptions, UseMetrics, UseActivitySource, UseFactoryProfile and the target-framework choices), each output is built and tested before the package publishes, and the package reaches the feed only on the green run, which proves AC1 to AC3 of AIFACTORY-US-218 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-649]",
      "number": 649
    },
    {
      "id": "AIFACTORY-US-113",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-183",
      "title": "Library template: target frameworks, a manifest and Factory diagnostics for generated libraries is delivered and proven on a generated solution",
      "sequence": "18.19.06",
      "description": "As an asset maintainer, I want Library template to carry target frameworks, a manifest and Factory diagnostics for generated libraries, so that it serves the contracts package, the gateway client packages and every Backend Library module of a generated product without later rework. This is the integration PBI of the feature. An asset maintainer packs the library template with the target-frameworks parameter, the manifest and the symbol catalog, the diagnostics samples on the Factory names, the symbol `UseFactoryProfile`, the generated pipeline that publishes to the ConnectSoft feed and the alignment checklist as the default; the shared template pipeline installs the package and gates the default generation and one Factory profile case, and the scaffold tests instantiate it across the parameter matrix. Every gating case and every output of the matrix builds and passes its tests before the template package is allowed to publish with a verified version; one 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 first. From the published package a library in the shape of the contracts package is generated, with `UseFactoryProfile` true, the activity source sample on and the single framework passed beside it; its manifest names the template, the version and the parameter values; its pipeline, generated with the feed default of the template and no feed passed, publishes the package, the symbols and an SBOM to the ConnectSoft feed, which is the Factory feed; its samples carry the diagnostics names, the scope tags and no payload; and it meets the alignment checklist without a change. The feature is done when that library is on the feed from its first pipeline run. Repository of the feature: ConnectSoft.LibraryTemplate. The contracts package, the gateway client packages and the backend library modules of a generated product are scaffolded from the package in this and in later increments. Kind: enabling. Traces: adrs: ADR-0001, ADR-0019, ADR-0027, ADR-0028. Depends on: AIFACTORY-US-214, AIFACTORY-US-215, AIFACTORY-US-216, AIFACTORY-US-217, AIFACTORY-US-218. Sources: model/components.yaml, model/templates.yaml, model/blueprints.yaml, model/template-parameters/connectsoft-library.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.LibraryTemplate, 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-647 (target frameworks as a parameter of the generated library) and of the manifest tasks of AIFACTORY-US-215 is done, then one parameter sets the target frameworks of a generated library, the generated repository carries a preserved manifest with the template id, the template version and the chosen parameter values, the package exports a symbol catalog, and the scaffold tests read the manifest back (ADR-0001, ADR-0027, ADR-0028, model/template-parameters/connectsoft-library.yaml).",
        "AC3: Given the work of AIFACTORY-TASK-648 (samples on the Factory diagnostics conventions) is done, then the metrics and ActivitySource samples use the meter and activity-source naming under the `connectsoft.` prefix, the scope tags under `UseFactoryProfile` and the no-payload rule, so a library generated for the Factory starts on the conventions without a later rename, and the library hosts no ASP.NET Core endpoints (ADR-0019, ADR-0028, docs/architecture/ecosystem-composition.md).",
        "AC4: Given the work of AIFACTORY-TASK-649 (ConnectSoft feed publication and a generated-solution gate) is done, then the generated pipeline produces the build, tests, coverage, analysis, scan, SBOM and packages results of rule PIPE-001 and publishes the package to the ConnectSoft feed with a verified version and symbols, the alignment checklist of the Alignment page of the template is the generated default, and the shared template pipeline gates the default generation and one Factory profile case while the scaffold tests instantiate the packed template across the parameter matrix and build and test each output before the package publishes (ADR-0028, model/blueprints.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "model/template-parameters/connectsoft-library.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1051",
        "AIFACTORY-TASK-684"
      ],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2006,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0001",
          "ADR-0019",
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-214",
        "AIFACTORY-US-215",
        "AIFACTORY-US-216",
        "AIFACTORY-US-217",
        "AIFACTORY-US-218"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "model/template-parameters/connectsoft-library.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-113]",
      "number": 113
    },
    {
      "id": "AIFACTORY-TASK-1051",
      "type": "task",
      "parent": "AIFACTORY-US-113",
      "title": "Generate the contracts package shape from the published template and publish it to a test feed",
      "sequence": "18.19.06.01",
      "description": "BEFORE DEVELOPMENT. Generate the contracts package shape from the published template and publish it to a test feed. Expected output: A probe installs the published template package and generates the Factory profile case, a library with `UseFactoryProfile` true, the single framework, dependency injection, options and the activity source sample, once without a feed parameter and once with a test feed passed for the probe run only; the pipeline file of the first names the ConnectSoft feed, the generated pipeline of the second runs against the test feed, and the probe checks the manifest, the diagnostics names, the scope tags and the alignment checklist; the run proves AC2 to AC4 of AIFACTORY-US-113 (ADR-0028).. Kind: verification. Repository: ConnectSoft.LibraryTemplate. Verification: dotnet new install of the published package, dotnet new connectsoft-library, dotnet build -c Release, dotnet test -c Release.",
      "acceptanceCriteria": [
        "A probe installs the published template package and generates the Factory profile case, a library with `UseFactoryProfile` true, the single framework, dependency injection, options and the activity source sample, once without a feed parameter and once with a test feed passed for the probe run only; the pipeline file of the first names the ConnectSoft feed, the generated pipeline of the second runs against the test feed, and the probe checks the manifest, the diagnostics names, the scope tags and the alignment checklist; the run proves AC2 to AC4 of AIFACTORY-US-113 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1051]",
      "number": 1051
    },
    {
      "id": "AIFACTORY-TASK-684",
      "type": "task",
      "parent": "AIFACTORY-US-113",
      "title": "Verify library-template-factory-profile-delivered by running the declared command",
      "sequence": "18.19.06.02",
      "description": "BEFORE DEVELOPMENT. Verify library-template-factory-profile-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every output of the parameter matrix after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-113.. Kind: verification. Repository: ConnectSoft.LibraryTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every output of the parameter matrix after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-113."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.LibraryTemplate/docs/Features.md",
        "ConnectSoft.LibraryTemplate/docs/Runbook.md",
        "ConnectSoft.LibraryTemplate/docs/Alignment.md",
        "ConnectSoft.LibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i0-readiness",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.LibraryTemplate"
      ],
      "children": [],
      "buildOrder": 20,
      "phase": "templates-and-libraries",
      "stackRank": 2006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-684]",
      "number": 684
    },
    {
      "id": "AIFACTORY-FEAT-160",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Base template: the symbol catalog and determinism the generation recipe needs",
      "sequence": "18.20",
      "description": "The Factory generates products from the base template (D95): a Module Blueprint names the template switches of each module and the generation recipe turns them into a scaffold (workflow definitions module-blueprints and generate-product). The recipe needs a stable, versioned catalog of the symbols of the template with their allowed values and defaults, a generation whose output is the same for the same inputs (no generated ports, years or build numbers that differ between runs), a post-action that reports success by exit code, and a product tenant profile for a generated SaaS module. Component: BaseTemplate (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-157. Increment I1: Generate a microservice. Build order 21 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-275",
        "AIFACTORY-US-276",
        "AIFACTORY-US-277",
        "AIFACTORY-US-278",
        "AIFACTORY-US-114"
      ],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2100,
      "titlePrefix": "[AIFACTORY-FEAT-160]",
      "number": 160
    },
    {
      "id": "AIFACTORY-US-275",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-160",
      "title": "Base template: the package carries a versioned catalog of its symbols with allowed values, defaults and the dependencies between them, generated from the template configuration at pack time",
      "sequence": "18.20.01",
      "description": "As an asset maintainer, I want the symbols of the base template published as a catalog inside the package, so that a recipe can be validated against the pinned template version without reading a checkout of the repository. A Module Blueprint names the template switches of its module, rule MOD-002 of model/blueprints.yaml requires that the switches used are declared by the pinned template version, and ADR-0027 decision 2 has every module entry of a recipe pin its inputs by identifier, version and hash. The only machine-readable statement of the symbols of `connectsoft-base` is the template configuration itself: 86 parameters, 113 computed and 11 generated symbols by the snapshot model/template-parameters/connectsoft-base.yaml, which the documentation repository derives by reading a checked-out repository. A validator that runs inside the Factory cannot read a checkout. The library template feature of this epic set the file a template package exports for this purpose, `.template.config/symbol-catalog.json`, produced from the template configuration at pack time. This PBI gives the base template package the same file under the same name and in the same shape, and adds what a recipe validator needs from a template with as many switches: for every parameter its name, its command line name, its data type, its default and its choices; for every computed symbol its expression and the parameters it depends on; for every generated symbol its generator and the parameter that can supply its value; and the combinations the template refuses, each with the symbols it names. The catalog names the template identity, the short name and the version of the package it travels in, so a catalog is never read against another version. It is produced by a step of the pack scripts of the template and never edited by hand. A test compares it with the template configuration and fails on a symbol that is missing, added or different. The step is part of the scripts a template that composes on the base template through the submodule already shares, so that such a template can produce its own catalog the same way; producing those catalogs and importing a catalog into the template registry of the Factory are not part of this PBI. Kind: enabling. Traces: services: TemplateRegistryService, GenerationRecipeService; adrs: ADR-0025, ADR-0027, ADR-0028. Relates: nfrs: NFR-14. Depends on: feature:component-base-template-factory-profile, feature:component-library-template-factory-profile. Sources: model/components.yaml, model/blueprints.yaml, model/template-parameters/connectsoft-base.yaml, docs/planes/agent-runtime/workflow-definitions/module-blueprints.md, docs/templates-docs/base-template.md, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given the packed base template, when the package is inspected, then it contains `.template.config/symbol-catalog.json` with the template identity, the short name, the package version and every parameter with its command line name, data type, default and choices, and the catalog lists the same parameters as model/template-parameters/connectsoft-base.yaml after the next template inventory (ADR-0027 decision 2, model/blueprints.yaml).",
        "AC2: Given the catalog, when a computed symbol, a generated symbol and a refused combination are looked up, then the computed symbol shows its expression and the parameters it depends on, the generated symbol shows its generator and the parameter that can supply its value, and the refused combination names its symbols, so that a recipe can be checked without generating (ADR-0027 decision 2, ADR-0025 decision 1).",
        "AC3: Given a template configuration that was changed without repacking the catalog, when the pipeline of the template runs, then the comparison test fails and names the symbol that is missing, added or different; a planted change proves the refusal, and the catalog version always equals the version of the package (ADR-0028, docs/planes/agent-runtime/workflow-definitions/module-blueprints.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1241",
        "AIFACTORY-TASK-591",
        "AIFACTORY-TASK-1242",
        "AIFACTORY-TASK-1243"
      ],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2101,
      "kind": "enabling",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "GenerationRecipeService"
        ],
        "adrs": [
          "ADR-0025",
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-14"
        ]
      },
      "dependsOn": [
        "feature:component-base-template-factory-profile",
        "feature:component-library-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-275]",
      "number": 275
    },
    {
      "id": "AIFACTORY-TASK-1241",
      "type": "task",
      "parent": "AIFACTORY-US-275",
      "title": "Catalog shape of the base template with dependencies, generators and refused combinations",
      "sequence": "18.20.01.01",
      "description": "BEFORE DEVELOPMENT. Catalog shape of the base template with dependencies, generators and refused combinations. Expected output: The shape of `.template.config/symbol-catalog.json` the library template set is extended, without changing its existing fields, by the expression and dependencies of a computed symbol, the generator and supplying parameter of a generated symbol and the list of refused combinations; a schema file beside the catalog describes the shape and the catalog of the base template validates against it.. Kind: contract. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The shape of `.template.config/symbol-catalog.json` the library template set is extended, without changing its existing fields, by the expression and dependencies of a computed symbol, the generator and supplying parameter of a generated symbol and the list of refused combinations; a schema file beside the catalog describes the shape and the catalog of the base template validates against it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2101,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1241]",
      "number": 1241
    },
    {
      "id": "AIFACTORY-TASK-591",
      "type": "task",
      "parent": "AIFACTORY-US-275",
      "title": "Versioned symbol catalog published with the template",
      "sequence": "18.20.01.02",
      "description": "BEFORE DEVELOPMENT. Versioned symbol catalog published with the template. Expected output: A step of the pack scripts reads the template configuration and writes the machine-readable catalog of its symbols, allowed values, defaults and dependencies between symbols into the package, versioned with the package; the step is usable by a template that composes on the base template through the submodule; the file is the one the template registry of the Factory will import.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A step of the pack scripts reads the template configuration and writes the machine-readable catalog of its symbols, allowed values, defaults and dependencies between symbols into the package, versioned with the package; the step is usable by a template that composes on the base template through the submodule; the file is the one the template registry of the Factory will import."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-591]",
      "number": 591
    },
    {
      "id": "AIFACTORY-TASK-1242",
      "type": "task",
      "parent": "AIFACTORY-US-275",
      "title": "Comparison test of the catalog against the template configuration with a planted change",
      "sequence": "18.20.01.03",
      "description": "BEFORE DEVELOPMENT. Comparison test of the catalog against the template configuration with a planted change. Expected output: A test of the template pipeline compares the catalog of the packed candidate with template.json symbol by symbol and fails with the symbol named; a fixture plants an added choice in the configuration without repacking and asserts the failure.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A test of the template pipeline compares the catalog of the packed candidate with template.json symbol by symbol and fails with the symbol named; a fixture plants an added choice in the configuration without repacking and asserts the failure."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2101,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1242]",
      "number": 1242
    },
    {
      "id": "AIFACTORY-TASK-1243",
      "type": "task",
      "parent": "AIFACTORY-US-275",
      "title": "Verify the catalog of the packed template",
      "sequence": "18.20.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the catalog of the packed template. Expected output: Pack the template and run the comparison test and the schema validation on the candidate; both pass, the planted change fails, and the parameters of the catalog equal those of model/template-parameters/connectsoft-base.yaml after the template inventory, which proves AC1 to AC3 of AIFACTORY-US-275 (ADR-0027).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Pack the template and run the comparison test and the schema validation on the candidate; both pass, the planted change fails, and the parameters of the catalog equal those of model/template-parameters/connectsoft-base.yaml after the template inventory, which proves AC1 to AC3 of AIFACTORY-US-275 (ADR-0027)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1243]",
      "number": 1243
    },
    {
      "id": "AIFACTORY-US-276",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-160",
      "title": "Base template: a generation with every input supplied is byte-identical when repeated and ends with exit code zero when scripts are not allowed",
      "sequence": "18.20.02",
      "description": "As an asset maintainer, I want a generation that a recipe can run unattended and repeat with the same result, so that a generation run produces a change set whose content depends only on its pinned inputs and reads success from the exit code. The recipe path of the Factory scaffolds with `dotnet new` in the sandbox (ADR-0025 decision 5), and a generation run produces a reviewable change set with provenance (decision 1). Two properties of the template stand in the way. First, some inputs differ between two runs with the same parameters. The generated symbol `currentYear` writes the year of the generation, `HttpPortGenerated` and `HttpsPortGenerated` draw ports that the replacers `HttpPortReplacer` and `HttpsPortReplacer` take whenever the parameters `HttpPort` and `HttpsPort` are absent, and `buildDefinitionNumber` is empty unless it is given (model/template-parameters/connectsoft-base.yaml). Two more inputs differ and are no generated symbol. The `guids` list of the template configuration holds `b981603d-39fd-4556-a4a5-b0c2f6e09686`, which the engine replaces by a new value on every generation and which is the `UserSecretsId` of the Application project. And the post-action that restores the NuGet packages of the generated solution writes `obj` folders with absolute paths. Second, the template has a script post-action that opens the page `TODO.html`; the Build Process page of the template describes the prompt and the option `--allow-scripts No`, and under that option the generation ends with exit code 104 although every file was written, so a recipe cannot tell success from failure. This PBI removes both. Every generated symbol whose value differs between runs gets a parameter that supplies it, by the coalesce pattern the two ports already follow, the year among them. The secrets identifier leaves the `guids` list and becomes a symbol of the same kind: a generated identifier that a parameter replaces when it is supplied. The catalog of the earlier PBI marks every symbol a caller must supply for a repeatable output, the secrets identifier included. The repeat generation of the gate and the recipe run with the restore post-action off, by `--no-restore`, so no restore output is part of the generated folder; the restore is a later stage of its own. A generation in which all marked symbols are supplied is byte-identical when repeated, in every file. A generation that supplies none behaves as today: it draws ports and a new secrets identifier and writes the current year. The script post-action is conditioned on a parameter the recipe sets, so an unattended generation has no script post-action and ends with exit code zero when its files are complete, while an interactive generation still offers the page. A generation that really fails, by an unknown parameter value or a refused combination, still ends with a non-zero exit code and names the reason. The checks of this PBI are validator scripts that the cases of `build/template-ci.json` call, because AIFACTORY-US-235 of the findings feature turns the presets of `build/Test-BaseTemplateRegressions.ps1` into cases of that manifest. Kind: enabling. Traces: services: GenerationRecipeService; adrs: ADR-0025, ADR-0027, ADR-0028. Depends on: AIFACTORY-US-275. Sources: model/components.yaml, model/template-parameters/connectsoft-base.yaml, docs/templates-docs/base-template.md, docs/architecture/adr/0025-saas-descriptor-import.md.",
      "acceptanceCriteria": [
        "AC1: Given the same parameters with every symbol the catalog marks as required for a repeatable output supplied, that is the unattended parameter, both ports, the year, the secrets identifier and the build number, and the restore post-action off by `--no-restore`, when the template is generated twice into two folders, then a recursive comparison of the folders finds no difference, the launch settings, the year, the `UserSecretsId` of the Application project and the build number included (ADR-0025 decisions 1 and 5, model/template-parameters/connectsoft-base.yaml).",
        "AC2: Given a generation that supplies none of those symbols, when it runs, then it draws its ports and a new secrets identifier and writes the current year as the template does today, and the catalog marks exactly the symbols whose absence makes two outputs differ, the secrets identifier among them (ADR-0027 decision 2, ADR-0028).",
        "AC3: Given an unattended generation with scripts not allowed and the unattended parameter set, when it completes its files, then `dotnet new` ends with exit code zero; given an unknown parameter value or a refused combination, then it ends with a non-zero exit code and names the reason; an interactive generation still offers the page `TODO.html` (ADR-0025 decision 5, docs/templates-docs/base-template.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/templates-docs/base-template.md",
        "docs/architecture/adr/0025-saas-descriptor-import.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-592",
        "AIFACTORY-TASK-593",
        "AIFACTORY-TASK-1244",
        "AIFACTORY-TASK-1245"
      ],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2102,
      "kind": "enabling",
      "traces": {
        "services": [
          "GenerationRecipeService"
        ],
        "adrs": [
          "ADR-0025",
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-275"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/templates-docs/base-template.md",
        "docs/architecture/adr/0025-saas-descriptor-import.md"
      ],
      "titlePrefix": "[AIFACTORY-US-276]",
      "number": 276
    },
    {
      "id": "AIFACTORY-TASK-592",
      "type": "task",
      "parent": "AIFACTORY-US-276",
      "title": "Deterministic generation for the same inputs",
      "sequence": "18.20.02.01",
      "description": "BEFORE DEVELOPMENT. Deterministic generation for the same inputs. Expected output: Two generations with the same symbols produce byte-identical output: every generated symbol whose value differs between runs (the generated ports, the current year) takes its value from a parameter by the coalesce pattern when the parameter is supplied; the entry `b981603d-39fd-4556-a4a5-b0c2f6e09686` leaves the `guids` list and becomes a generated secrets identifier that a parameter replaces by the same pattern; the build number comes from its parameter; the catalog marks these symbols; a generation that supplies none behaves as before; the repeat generation runs with `--no-restore`, and the validator script of AIFACTORY-TASK-1244 generates twice and compares.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: pwsh build/Test-RepeatGeneration.ps1 reads the marked symbols of the catalog, passes the unattended parameter, both ports, the year, the secrets identifier and the build number with --no-restore to two generations of ConnectSoft.Probe and runs diff -r on the two folders.",
      "acceptanceCriteria": [
        "Two generations with the same symbols produce byte-identical output: every generated symbol whose value differs between runs (the generated ports, the current year) takes its value from a parameter by the coalesce pattern when the parameter is supplied; the entry `b981603d-39fd-4556-a4a5-b0c2f6e09686` leaves the `guids` list and becomes a generated secrets identifier that a parameter replaces by the same pattern; the build number comes from its parameter; the catalog marks these symbols; a generation that supplies none behaves as before; the repeat generation runs with `--no-restore`, and the validator script of AIFACTORY-TASK-1244 generates twice and compares."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-592]",
      "number": 592
    },
    {
      "id": "AIFACTORY-TASK-593",
      "type": "task",
      "parent": "AIFACTORY-US-276",
      "title": "Post-action exit code under disallowed scripts",
      "sequence": "18.20.02.02",
      "description": "BEFORE DEVELOPMENT. Post-action exit code under disallowed scripts. Expected output: The script post-action that opens `TODO.html` is conditioned on a parameter an unattended caller sets, so `dotnet new` no longer ends with exit code 104 when scripts are not allowed and a recipe reads success from the exit code; a real failure still ends non-zero with the reason. The product tenant profile this task also named is delivered by AIFACTORY-TASK-1246 to AIFACTORY-TASK-1249 of AIFACTORY-US-277.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The script post-action that opens `TODO.html` is conditioned on a parameter an unattended caller sets, so `dotnet new` no longer ends with exit code 104 when scripts are not allowed and a recipe reads success from the exit code; a real failure still ends non-zero with the reason. The product tenant profile this task also named is delivered by AIFACTORY-TASK-1246 to AIFACTORY-TASK-1249 of AIFACTORY-US-277."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-593]",
      "number": 593
    },
    {
      "id": "AIFACTORY-TASK-1244",
      "type": "task",
      "parent": "AIFACTORY-US-276",
      "title": "Validator scripts for the repeat generation and the exit code, called by the cases of the manifest",
      "sequence": "18.20.02.03",
      "description": "BEFORE DEVELOPMENT. Validator scripts for the repeat generation and the exit code, called by the cases of the manifest. Expected output: Two validator scripts that a case of `build/template-ci.json` calls: `build/Test-RepeatGeneration.ps1` reads the marked symbols of the catalog, generates the case twice with all of them supplied and `--no-restore` and compares the two folders recursively; `build/Test-GenerationExitCode.ps1` generates once with scripts not allowed and the unattended parameter and asserts exit code zero, and once with an unknown parameter value and asserts a non-zero exit code with the reason; neither is added to `build/Test-BaseTemplateRegressions.ps1`, whose presets AIFACTORY-US-235 turns into cases of the manifest.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: the template pipeline runs the cases of build/template-ci.json with both validators and the run is green.",
      "acceptanceCriteria": [
        "Two validator scripts that a case of `build/template-ci.json` calls: `build/Test-RepeatGeneration.ps1` reads the marked symbols of the catalog, generates the case twice with all of them supplied and `--no-restore` and compares the two folders recursively; `build/Test-GenerationExitCode.ps1` generates once with scripts not allowed and the unattended parameter and asserts exit code zero, and once with an unknown parameter value and asserts a non-zero exit code with the reason; neither is added to `build/Test-BaseTemplateRegressions.ps1`, whose presets AIFACTORY-US-235 turns into cases of the manifest."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1244]",
      "number": 1244
    },
    {
      "id": "AIFACTORY-TASK-1245",
      "type": "task",
      "parent": "AIFACTORY-US-276",
      "title": "Verify the repeatable output and the exit codes",
      "sequence": "18.20.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the repeatable output and the exit codes. Expected output: Run the cases of the manifest with the repeat-generation and exit code validators on the packed candidate; the two folders of each case are identical, the `UserSecretsId` included, the unattended generation ends with exit code zero and the planted failure ends non-zero, which proves AC1 to AC3 of AIFACTORY-US-276 (ADR-0025, model/template-parameters/connectsoft-base.yaml).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Run the cases of the manifest with the repeat-generation and exit code validators on the packed candidate; the two folders of each case are identical, the `UserSecretsId` included, the unattended generation ends with exit code zero and the planted failure ends non-zero, which proves AC1 to AC3 of AIFACTORY-US-276 (ADR-0025, model/template-parameters/connectsoft-base.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1245]",
      "number": 1245
    },
    {
      "id": "AIFACTORY-US-277",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-160",
      "title": "Base template: the product tenant profile generates the tenant resolution of a product module against the Tenants service of the product and changes nothing that `UseFactoryProfile` generates",
      "sequence": "18.20.03",
      "description": "As an asset maintainer, I want a profile of the base template for a module of a generated SaaS product that resolves its tenant, so that a generated product module refuses a tenant that does not exist or is not active without code written by hand. ADR-0015 decision 4 keeps a Factory tenant and a tenant of a generated product as distinct identities and stores, and makes any mapping between them an explicit contract of the generation recipe. The base template has the parameter `UseIdentityPlatform`, on by default, which gives a generated service the normalized identity context, the trusted gateway headers and tenant-required requests (model/template-parameters/connectsoft-base.yaml); it does not check that the tenant of a request exists or is active. A generated SaaS product has its own Tenants service, and the package `ConnectSoft.Saas.Tenants.ServiceModel` of that service offers a typed resolution client that never answers with a default tenant, which the feature `component-saas-tenants` delivers. This PBI adds the product tenant profile to the base template: the boolean parameter `ProductTenant`, off by default. With it on, the generated module takes the tenant from the validated token of the product, resolves it through the typed client, which it pins by version without copying a type, and establishes the tenant context of the SaaS libraries for the request and for message handlers. A request of an active tenant proceeds and reads only the rows of that tenant. A request whose tenant is unknown, suspended or decommissioned is refused with 403 and a problem body that names the reason. When the Tenants service cannot be reached the request is refused with 503; no default tenant is ever used and nothing is written. How long a resolution may be reused is an option of the generated module with a short default. The profile is separate from the Factory profile, as decision D114 requires: a generation with `UseFactoryProfile` produces the same output whether or not this PBI exists, which a comparison of the Factory preset proves, and a generation with both parameters on is refused with both symbols named, because a Factory service resolves a Factory tenant and a product module a product tenant. The product tenant profile is a declared profile of the template and gets its own gating case. Kind: enabling. Traces: adrs: ADR-0015, ADR-0027, ADR-0028. Relates: nfrs: NFR-01. Depends on: AIFACTORY-US-275, feature:component-saas-tenants, feature:component-saas-extensions, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/template-parameters/connectsoft-base.yaml, docs/planes/control/tenancy.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a module generated with `ProductTenant` and a Tenants service with two active tenants, when callers of both tenants read and write, then each request runs under the tenant context of its token after one resolution through the typed client, each caller reads only its own rows, and a row of the other tenant addressed by identifier is answered 404 (ADR-0015 decisions 1 and 4 and its amendment on a resource of another tenant).",
        "AC2: Given a token whose tenant is unknown, suspended or decommissioned, when a request arrives, then it is refused with 403 and a problem body that names the reason; given the Tenants service cannot be reached, then the request is refused with 503, no default tenant is used and nothing is written (ADR-0015 decision 1 on the inherited fail-closed rule, docs/planes/control/tenancy.md).",
        "AC3: Given the template with this profile, when the Factory preset is generated with `UseFactoryProfile` and `ProductTenant` off, then its output equals the output of the Factory preset before this PBI; given both parameters on, then the generation is refused with both symbols named (ADR-0028 amendment on the Factory profile switch, ADR-0015 decision 4).",
        "AC4: Given the template with `ProductTenant` off and `UseFactoryProfile` off, when the default case is generated, then its output is unchanged, and the symbol catalog and, after the next template inventory, model/template-parameters/connectsoft-base.yaml list the parameter with its default and the refused combination (ADR-0028, ADR-0027 decision 2)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/planes/control/tenancy.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1246",
        "AIFACTORY-TASK-1247",
        "AIFACTORY-TASK-1248",
        "AIFACTORY-TASK-1249"
      ],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2103,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-275",
        "feature:component-saas-tenants",
        "feature:component-saas-extensions",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/planes/control/tenancy.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-277]",
      "number": 277
    },
    {
      "id": "AIFACTORY-TASK-1246",
      "type": "task",
      "parent": "AIFACTORY-US-277",
      "title": "Parameter `ProductTenant`, its computed symbols and the refused combination",
      "sequence": "18.20.03.01",
      "description": "BEFORE DEVELOPMENT. Parameter `ProductTenant`, its computed symbols and the refused combination. Expected output: The template configuration defines the boolean parameter `ProductTenant`, off by default, with its description, the computed symbols that include the resolution code and the pin of the ServiceModel package of the Tenants service, and the refusal of a generation with `ProductTenant` and `UseFactoryProfile` both on that names both symbols; the catalog lists all three.. Kind: contract. Repository: ConnectSoft.BaseTemplate. Verification: dotnet new connectsoft-base --help lists the parameter and a generation with both profiles is refused.",
      "acceptanceCriteria": [
        "The template configuration defines the boolean parameter `ProductTenant`, off by default, with its description, the computed symbols that include the resolution code and the pin of the ServiceModel package of the Tenants service, and the refusal of a generation with `ProductTenant` and `UseFactoryProfile` both on that names both symbols; the catalog lists all three."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2103,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1246]",
      "number": 1246
    },
    {
      "id": "AIFACTORY-TASK-1247",
      "type": "task",
      "parent": "AIFACTORY-US-277",
      "title": "Tenant resolution of a product module through the typed client",
      "sequence": "18.20.03.02",
      "description": "BEFORE DEVELOPMENT. Tenant resolution of a product module through the typed client. Expected output: With `ProductTenant` on, the generated module resolves the tenant of the validated token through the typed resolution client of the pinned `ConnectSoft.Saas.Tenants.ServiceModel` package, establishes the tenant context of the SaaS libraries for requests and message handlers, refuses an unknown, suspended or decommissioned tenant with 403 and an unreachable Tenants service with 503, and reuses a resolution for the period its options set.. Kind: implementation. Repository: ConnectSoft.BaseTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "With `ProductTenant` on, the generated module resolves the tenant of the validated token through the typed resolution client of the pinned `ConnectSoft.Saas.Tenants.ServiceModel` package, establishes the tenant context of the SaaS libraries for requests and message handlers, refuses an unknown, suspended or decommissioned tenant with 403 and an unreachable Tenants service with 503, and reuses a resolution for the period its options set."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1247]",
      "number": 1247
    },
    {
      "id": "AIFACTORY-TASK-1248",
      "type": "task",
      "parent": "AIFACTORY-US-277",
      "title": "Resolution tests against a stub Tenants service inside the generated solution and the comparison validator of the Factory preset",
      "sequence": "18.20.03.03",
      "description": "BEFORE DEVELOPMENT. Resolution tests against a stub Tenants service inside the generated solution and the comparison validator of the Factory preset. Expected output: The generated solution of the product tenant case holds tests against a stub Tenants service, which runs inside those tests and is no service of the pipeline, for two active tenants, an unknown, a suspended and a decommissioned tenant and an unreachable service; a validator script `build/Test-FactoryPresetUnchanged.ps1`, called by the Factory preset case of `build/template-ci.json`, compares the generated Factory preset with its recorded output, a list of files with their hashes recorded before the profile was added, and fails on a difference with the file named.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: dotnet test -c Release --no-build | the template pipeline runs the Factory preset case of build/template-ci.json with the comparison validator and the run is green.",
      "acceptanceCriteria": [
        "The generated solution of the product tenant case holds tests against a stub Tenants service, which runs inside those tests and is no service of the pipeline, for two active tenants, an unknown, a suspended and a decommissioned tenant and an unreachable service; a validator script `build/Test-FactoryPresetUnchanged.ps1`, called by the Factory preset case of `build/template-ci.json`, compares the generated Factory preset with its recorded output, a list of files with their hashes recorded before the profile was added, and fails on a difference with the file named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2103,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1248]",
      "number": 1248
    },
    {
      "id": "AIFACTORY-TASK-1249",
      "type": "task",
      "parent": "AIFACTORY-US-277",
      "title": "Verify the product tenant profile and the unchanged Factory preset",
      "sequence": "18.20.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the product tenant profile and the unchanged Factory preset. Expected output: Generate the product tenant case, the Factory preset and the default case, build each in Release and run their tests; the resolution tests pass, the Factory preset and the default case equal their earlier output and the generation with both profiles is refused, which proves AC1 to AC4 of AIFACTORY-US-277 (ADR-0015, ADR-0028).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Generate the product tenant case, the Factory preset and the default case, build each in Release and run their tests; the resolution tests pass, the Factory preset and the default case equal their earlier output and the generation with both profiles is refused, which proves AC1 to AC4 of AIFACTORY-US-277 (ADR-0015, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1249]",
      "number": 1249
    },
    {
      "id": "AIFACTORY-US-278",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-160",
      "title": "Base template: the catalog check, the repeat-generation check and the product tenant case pass in the shared template pipeline before the package publishes",
      "sequence": "18.20.04",
      "description": "As an asset maintainer, I want the catalog, the repeatable generation and the product tenant profile gated on every change of the base template, so that a package whose catalog lies, whose output differs between runs or whose product module admits an unknown tenant never reaches the feed. This PBI is the gate of the feature. The findings feature of the base template moves the template onto the shared template pipeline of ConnectSoft.AzurePipelines (`template-ci/v1`), and its Factory profile feature adds the Factory preset as a case of the manifest `build/template-ci.json`. The amendment of ADR-0028 on the Factory profile switch has the shared pipeline admit one additional gating case per declared profile beside the default case. This PBI adds the product tenant case, a generation with `ProductTenant` under the name of a product module. The case declares only the infrastructure it needs, because its stub Tenants service runs inside the tests of the generated solution and is no service of the pipeline. The PBI also registers in the manifest the checks the earlier PBIs deliver as validator scripts: the comparison of the symbol catalog with the template configuration, the repeat generation of the default case, the Factory preset and the product tenant case with `--no-restore` and a recursive comparison of each pair of outputs, the exit code check, and the comparison of the Factory preset with its recorded output. The candidate is packed once and installed; each case is generated with scripts not allowed and must end with exit code zero, then restored and built in Release; its tests run with the discovery and completion checks; the dependency audit runs. A catalog that differs from the configuration, two outputs that differ, a non-zero exit code of a complete generation or a failing resolution test fails the run with the case and the stage named, and publication is not reached. Publication requires the complete reports of every case bound to the candidate and pushes a version that is not yet on the ConnectSoft feed. This is an evidence PBI (D113): a template feature has no scenario, so the gate names what it proves through its ADRs, the requirement on release gates and its sources: the pinned inputs of ADR-0027, the generation contract of ADR-0025 and the generated-solution gate the epic requires of every template. Kind: evidence. Traces: adrs: ADR-0025, ADR-0027, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-275, AIFACTORY-US-276, AIFACTORY-US-277, feature:component-base-template-findings, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-base.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the base template, when the template pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the catalog comparison passes, the default case, the Factory preset and the product tenant case are each generated twice with scripts not allowed and the restore post-action off, end with exit code zero and compare equal, and each case is restored, built in Release and tested with the discovery and completion checks (FR-11, ADR-0027 decision 2, ADR-0028 amendment on the Factory profile switch).",
        "AC2: Given a planted catalog that differs from the configuration, a planted file that carries the time of the generation or a planted admission of an unknown tenant, when the pipeline evaluates the run, then it fails at the stage of that check with the case named and the package is not published (FR-11, ADR-0025 decision 1).",
        "AC3: Given complete reports of every case bound to the candidate, when the publication job runs, then the package is pushed to the ConnectSoft feed with a version that was not on it, a fresh install of that version carries the catalog of that version and generates the three cases unchanged, and model/template-parameters/connectsoft-base.yaml lists the new parameters after the next template inventory (ADR-0028, model/backlog/epics.yaml states the gate as the completion of the epic)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1250",
        "AIFACTORY-TASK-1251",
        "AIFACTORY-TASK-1252",
        "AIFACTORY-TASK-1253"
      ],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2104,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0025",
          "ADR-0027",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-275",
        "AIFACTORY-US-276",
        "AIFACTORY-US-277",
        "feature:component-base-template-findings",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-base.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-278]",
      "number": 278
    },
    {
      "id": "AIFACTORY-TASK-1250",
      "type": "task",
      "parent": "AIFACTORY-US-278",
      "title": "Product tenant case and the registration of the validators in the pipeline manifest",
      "sequence": "18.20.04.01",
      "description": "BEFORE DEVELOPMENT. Product tenant case and the registration of the validators in the pipeline manifest. Expected output: `build/template-ci.json` of the template holds the product tenant case with `ProductTenant`, a product module name, its test filter and only the infrastructure it needs among its required services, such as SQL Server for its store; the stub Tenants service runs inside the tests of the generated solution and is not declared; the manifest registers the catalog comparison of AIFACTORY-TASK-1242 and the validator scripts of AIFACTORY-TASK-1244 and AIFACTORY-TASK-1248 on the default case, the Factory preset and the product tenant case, and the shared installer jobs run them on every change.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: azure-pipelines-template.yml runs the three cases with their registered validators through the shared installer jobs.",
      "acceptanceCriteria": [
        "`build/template-ci.json` of the template holds the product tenant case with `ProductTenant`, a product module name, its test filter and only the infrastructure it needs among its required services, such as SQL Server for its store; the stub Tenants service runs inside the tests of the generated solution and is not declared; the manifest registers the catalog comparison of AIFACTORY-TASK-1242 and the validator scripts of AIFACTORY-TASK-1244 and AIFACTORY-TASK-1248 on the default case, the Factory preset and the product tenant case, and the shared installer jobs run them on every change."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2104,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1250]",
      "number": 1250
    },
    {
      "id": "AIFACTORY-TASK-1251",
      "type": "task",
      "parent": "AIFACTORY-US-278",
      "title": "Planted catalog drift, planted time-dependent file and planted tenant admission for the gate",
      "sequence": "18.20.04.02",
      "description": "BEFORE DEVELOPMENT. Planted catalog drift, planted time-dependent file and planted tenant admission for the gate. Expected output: Pipeline fixtures plant a catalog that differs from the configuration, a generated file that carries the time of the generation and a product tenant case that admits an unknown tenant, and assert that each run fails at its stage with the case named and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.BaseTemplate. Verification: each planted run stops before publication.",
      "acceptanceCriteria": [
        "Pipeline fixtures plant a catalog that differs from the configuration, a generated file that carries the time of the generation and a product tenant case that admits an unknown tenant, and assert that each run fails at its stage with the case named and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2104,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1251]",
      "number": 1251
    },
    {
      "id": "AIFACTORY-TASK-1252",
      "type": "task",
      "parent": "AIFACTORY-US-278",
      "title": "Publication bound to the complete reports of the three cases and both checks",
      "sequence": "18.20.04.03",
      "description": "BEFORE DEVELOPMENT. Publication bound to the complete reports of the three cases and both checks. Expected output: The publication job of the template pipeline requires the complete reports of the default case, the Factory preset and the product tenant case and the results of the catalog comparison and the repeat generation, each bound to the candidate; a missing or failed stage or a version that is already on the ConnectSoft feed refuses publication with the reason.. Kind: operations. Repository: ConnectSoft.BaseTemplate. Verification: a run with an incomplete report or a repeated version is refused at publication.",
      "acceptanceCriteria": [
        "The publication job of the template pipeline requires the complete reports of the default case, the Factory preset and the product tenant case and the results of the catalog comparison and the repeat generation, each bound to the candidate; a missing or failed stage or a version that is already on the ConnectSoft feed refuses publication with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2104,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1252]",
      "number": 1252
    },
    {
      "id": "AIFACTORY-TASK-1253",
      "type": "task",
      "parent": "AIFACTORY-US-278",
      "title": "Verify the gate on a green run and on the three planted runs",
      "sequence": "18.20.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the gate on a green run and on the three planted runs. Expected output: One pipeline run with every case and both checks green reaches publication and a fresh install of the published version carries its catalog and generates the three cases unchanged; the three planted runs fail before publication; together they prove AC1 to AC3 of AIFACTORY-US-278 (FR-11, ADR-0027, ADR-0028).. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "One pipeline run with every case and both checks green reaches publication and a fresh install of the published version carries its catalog and generates the three cases unchanged; the three planted runs fail before publication; together they prove AC1 to AC3 of AIFACTORY-US-278 (FR-11, ADR-0027, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1253]",
      "number": 1253
    },
    {
      "id": "AIFACTORY-US-114",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-160",
      "title": "Base template: the symbol catalog and determinism the generation recipe needs is delivered and proven on a generated solution",
      "sequence": "18.20.05",
      "description": "As an asset maintainer, I want BaseTemplate to carry the symbol catalog and determinism the generation recipe needs, so that it serves every Factory service that is not a gateway or an agent host, and every generated product module (D94, D95) without later rework. This is the integration PBI of the feature. With the symbol catalog, the unattended and repeatable generation, the product tenant profile and the gate of the earlier PBIs, the base template is a generation input the recipe path of the Factory can pin and trust. A recipe names the template by identity and version, reads from the catalog inside that package which switches exist, which values they take, which symbols depend on which and which combinations are refused, supplies every symbol the catalog marks, runs `dotnet new` in the sandbox with scripts not allowed, and reads success from exit code zero. The same inputs give the same bytes, so the change set of a generation run depends only on its pins. A module of a generated SaaS product is generated with `ProductTenant` and refuses a tenant its Tenants service does not know or does not hold active. A Factory service is generated with `UseFactoryProfile` exactly as before this feature. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature and the snapshot of the parameters in the documentation repository. The feature is done when the packed template passes the three cases and both checks in the shared template pipeline and the package is on the ConnectSoft feed with its catalog, before the blueprint, recipe and template registry services of this increment read it. Kind: enabling. Traces: services: TemplateRegistryService, GenerationRecipeService; adrs: ADR-0015, ADR-0025, ADR-0027, ADR-0028. Depends on: AIFACTORY-US-275, AIFACTORY-US-276, AIFACTORY-US-277, AIFACTORY-US-278. Sources: model/components.yaml, model/blueprints.yaml, docs/planes/agent-runtime/workflow-definitions/module-blueprints.md, docs/templates-docs/base-template.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.BaseTemplate 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-591 (versioned symbol catalog published with the template) is done, then the template ships a machine-readable catalog of its symbols, allowed values, defaults and dependencies between symbols, versioned with the package, in the file the template registry of the Factory imports, and a test compares the catalog with template.json (ADR-0027 decision 2, model/blueprints.yaml).",
        "AC3: Given the work of AIFACTORY-TASK-592 (deterministic generation for the same inputs) is done, then two generations with the same symbols and the restore post-action off produce byte-identical output, with the generated ports, the current year, the secrets identifier and the build number supplied by parameters, and a validator generates twice and diffs (ADR-0025 decision 1, model/template-parameters/connectsoft-base.yaml).",
        "AC4: Given the work of AIFACTORY-TASK-593 (post-action exit code) and of AIFACTORY-US-277 (product tenant profile) is done, then `dotnet new` no longer ends with exit code 104 when scripts are not allowed, so the recipe reads success from the exit code, and the parameter `ProductTenant` generates the tenant resolution of a product module against the Tenants service of the product without changing what `UseFactoryProfile` generates (ADR-0025 decision 5, ADR-0015 decision 4)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1254",
        "AIFACTORY-TASK-674"
      ],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2105,
      "kind": "enabling",
      "traces": {
        "services": [
          "TemplateRegistryService",
          "GenerationRecipeService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0025",
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-275",
        "AIFACTORY-US-276",
        "AIFACTORY-US-277",
        "AIFACTORY-US-278"
      ],
      "source": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-114]",
      "number": 114
    },
    {
      "id": "AIFACTORY-TASK-1254",
      "type": "task",
      "parent": "AIFACTORY-US-114",
      "title": "Template inventory of the documentation repository re-run for the new parameters",
      "sequence": "18.20.05.01",
      "description": "BEFORE DEVELOPMENT. Template inventory of the documentation repository re-run for the new parameters. Expected output: After the package is published, `python -I tools/docs_model inventory-templates` is run in the documentation repository so that model/template-parameters/connectsoft-base.yaml lists `ProductTenant`, the unattended parameter and the parameters that supply the generated symbols and the secrets identifier, with their group and binding authored; no other file of the model is edited by hand.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model inventory-templates lists the new parameters of connectsoft-base.",
      "acceptanceCriteria": [
        "After the package is published, `python -I tools/docs_model inventory-templates` is run in the documentation repository so that model/template-parameters/connectsoft-base.yaml lists `ProductTenant`, the unattended parameter and the parameters that supply the generated symbols and the secrets identifier, with their group and binding authored; no other file of the model is edited by hand."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2105,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1254]",
      "number": 1254
    },
    {
      "id": "AIFACTORY-TASK-674",
      "type": "task",
      "parent": "AIFACTORY-US-114",
      "title": "Verify base-template-product-profile-delivered by running the declared command",
      "sequence": "18.20.05.02",
      "description": "BEFORE DEVELOPMENT. Verify base-template-product-profile-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on the default case, the Factory preset and the product tenant case generated from the published package; they pass and prove AC1 to AC4 of AIFACTORY-US-114.. Kind: verification. Repository: ConnectSoft.BaseTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on the default case, the Factory preset and the product tenant case generated from the published package; they pass and prove AC1 to AC4 of AIFACTORY-US-114."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md",
        "docs/templates-docs/base-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.BaseTemplate"
      ],
      "children": [],
      "buildOrder": 21,
      "phase": "templates-and-libraries",
      "stackRank": 2105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-674]",
      "number": 674
    },
    {
      "id": "AIFACTORY-FEAT-176",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Audit library: the Factory audit evidence record and its sink",
      "sequence": "18.21",
      "description": "Eleven Factory services depend on the Audit.NET integration library for audit evidence, and ADR-0019 keeps that evidence seven years, redacted and immutable. The library records generic audit events; the Factory needs the record shape of audit-evidence.schema.json (scope, run, step, the kind of actor, an evidence reference), generated from the contracts package rather than typed in each service, and a sink that carries the records to the Audit service under the accepted envelope with a durable fallback. Component: Audit.NET integration (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-090. Increment I1: Generate a microservice. Build order 22 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-261",
        "AIFACTORY-US-262",
        "AIFACTORY-US-263",
        "AIFACTORY-US-116"
      ],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2200,
      "titlePrefix": "[AIFACTORY-FEAT-176]",
      "number": 176
    },
    {
      "id": "AIFACTORY-US-261",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-176",
      "title": "Audit library: an audit scope yields the evidence record of `audit-evidence-v1` from the contracts package, with tenant and actor from the trusted scope, and a record without a tenant is refused",
      "sequence": "18.21.01",
      "description": "As a platform admin, I want every Factory service to build its audit evidence from one record type and one builder, so that evidence from eleven services has the same shape and none of them types a field of its own. The Features page of the Audit.NET integration library lists what the library configures: the options `AuditNetOptions`, two data providers selected by `AuditDataProviderType`, SQL Server and file system, and the registration `AddConnectSoftAuditNet`. The events it records are the generic events of Audit.NET, JSON documents with an event type, a target type and durations. Eleven Factory services name the library for audit evidence, and the shape of that evidence is fixed by docs/reference/schemas/audit-evidence.schema.json: an evidence identifier, the tenant and optionally the project, the time, an actor with an identifier and one of the kinds user, workload, partner-agent and system, one action of a closed list, a subject with kind, identifier and hash, an outcome, a redacted reason, the policy decision, a correlation with run, approval and event identifiers, and the list of redacted fields. The feature text and model/components.yaml also name a step and an evidence reference. The schema has no field for a step: its correlation holds `runId`, `approvalId` and `eventId` and admits no additional property, so the record carries no step; the evidence reference of the feature text is the evidence identifier together with the hash of the subject. This PBI adds the Factory evidence mapping to the library. The record type is the one the contracts package generates from the schema; the library pins that package and types no field of its own. A builder turns an audit scope into the record: tenant and project come from the scope accessor of `ConnectSoft.Extensions.AI.Factory.Abstractions`, the actor identifier, kind, roles and delegation from the validated token, the run of the correlation from the scope while a run is in flight, and the action, the subject and the outcome from the caller. A workload token carries service scopes and no tenant claim, so for a workload actor the tenant is the one the workload forwards and the scope accessor admits. The builder refuses a record without a tenant, an action outside the list and a subject without an identifier with a typed error that names the field, and writes nothing. It accepts no prompt text, payload or secret value, which the invariant of `AuditEntry` in model/services/governance/AuditService.yaml forbids: a caller passes the hash of the object acted upon. The chain hash is no part of what a service submits: the library never sets it, because only the Audit service knows the previous record of the tenant, and the Audit service computes the hash when its command `SubmitEvidence` appends the record. Kind: enabling. Traces: services: AuditService; descriptors: audit-evidence-v1, execution-scope-v1; adrs: ADR-0015, ADR-0019, ADR-0021. Relates: nfrs: NFR-04. Depends on: feature:contracts-package, feature:component-extensions-ai. Sources: model/components.yaml, model/services/governance/AuditService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0019-data-governance.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a host with a scope established and a validated user token, when a command completes inside an audit scope with an action, a subject and an outcome, then the builder yields a record of `audit-evidence-v1` whose tenant and project equal the scope, whose actor carries the identifier, the kind user, the roles and the delegation of the token, and whose correlation carries the run of the scope (ADR-0019 decision 3, docs/reference/schemas/audit-evidence.schema.json).",
        "AC2: Given a call under a workload token, which carries service scopes and no tenant claim, when the builder runs, then the actor kind is workload and the tenant is the one the workload forwarded and the scope accessor admitted; given a background loop without a caller, then the actor kind is system and the tenant is the tenant of the work item (ADR-0015 decision 2 and its amendment on workload tokens).",
        "AC3: Given no scope is established, an action outside the closed list or a subject without an identifier, when the builder runs, then it refuses with a typed error that names the field and no record is written; the actions of the list include the publications and approval decisions that ADR-0021 has recorded, and a free text reason is never taken as content (ADR-0019 decision 3).",
        "AC4: Given the record type of the library, when the contract test runs against the pinned contracts package, then the library defines no evidence type of its own and the serialised record validates against the schema of `audit-evidence-v1` in every field except the chain hash, which is no part of a submitted record and is computed by the Audit service when it appends the record (model/services/governance/AuditService.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1192",
        "AIFACTORY-TASK-635",
        "AIFACTORY-TASK-1193",
        "AIFACTORY-TASK-1194"
      ],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2201,
      "kind": "enabling",
      "traces": {
        "services": [
          "AuditService"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0019",
          "ADR-0021"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "feature:contracts-package",
        "feature:component-extensions-ai"
      ],
      "source": [
        "model/components.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-261]",
      "number": 261
    },
    {
      "id": "AIFACTORY-TASK-1192",
      "type": "task",
      "parent": "AIFACTORY-US-261",
      "title": "Evidence builder contract over the record type of the contracts package",
      "sequence": "18.21.01.01",
      "description": "BEFORE DEVELOPMENT. Evidence builder contract over the record type of the contracts package. Expected output: The library exposes one builder interface that takes an action, a subject with its hash, an outcome and an optional reason and policy decision and returns the evidence record type of the pinned contracts package; a contract test proves that the library declares no evidence type and that the record validates against docs/reference/schemas/audit-evidence.schema.json apart from the chain hash.. Kind: contract. Repository: ConnectSoft.Extensions.AuditNet. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The library exposes one builder interface that takes an action, a subject with its hash, an outcome and an optional reason and policy decision and returns the evidence record type of the pinned contracts package; a contract test proves that the library declares no evidence type and that the record validates against docs/reference/schemas/audit-evidence.schema.json apart from the chain hash."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2201,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1192]",
      "number": 1192
    },
    {
      "id": "AIFACTORY-TASK-635",
      "type": "task",
      "parent": "AIFACTORY-US-261",
      "title": "Factory audit record shape",
      "sequence": "18.21.01.02",
      "description": "BEFORE DEVELOPMENT. Factory audit record shape. Expected output: The builder fills tenant and project from the scope accessor, the actor identifier, kind (user, workload, partner-agent or system), roles and delegation from the validated token, and the run of the correlation from the scope, per audit-evidence.schema.json and with the record type generated in the contracts package, with a test that a record without a tenant is refused.. Kind: implementation. Repository: ConnectSoft.Extensions.AuditNet. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The builder fills tenant and project from the scope accessor, the actor identifier, kind (user, workload, partner-agent or system), roles and delegation from the validated token, and the run of the correlation from the scope, per audit-evidence.schema.json and with the record type generated in the contracts package, with a test that a record without a tenant is refused."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-635]",
      "number": 635
    },
    {
      "id": "AIFACTORY-TASK-1193",
      "type": "task",
      "parent": "AIFACTORY-US-261",
      "title": "Refusal tests of the evidence builder",
      "sequence": "18.21.01.03",
      "description": "BEFORE DEVELOPMENT. Refusal tests of the evidence builder. Expected output: A test fixture builds evidence under a user token, a workload token and a background loop, and plants a missing scope, an action outside the list, a subject without an identifier and a content value passed as a reason; each planted case is refused with the field named and writes nothing.. Kind: fixture. Repository: ConnectSoft.Extensions.AuditNet. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A test fixture builds evidence under a user token, a workload token and a background loop, and plants a missing scope, an action outside the list, a subject without an identifier and a content value passed as a reason; each planted case is refused with the field named and writes nothing."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2201,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1193]",
      "number": 1193
    },
    {
      "id": "AIFACTORY-TASK-1194",
      "type": "task",
      "parent": "AIFACTORY-US-261",
      "title": "Verify the evidence record against the schema and the refusals",
      "sequence": "18.21.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the evidence record against the schema and the refusals. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the builder tests for the three actor kinds, the schema validation test and the refusal tests pass and prove AC1 to AC4 of AIFACTORY-US-261 (ADR-0019, docs/reference/schemas/audit-evidence.schema.json).. Kind: verification. Repository: ConnectSoft.Extensions.AuditNet.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the builder tests for the three actor kinds, the schema validation test and the refusal tests pass and prove AC1 to AC4 of AIFACTORY-US-261 (ADR-0019, docs/reference/schemas/audit-evidence.schema.json)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1194]",
      "number": 1194
    },
    {
      "id": "AIFACTORY-US-262",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-176",
      "title": "Audit library: a sink publishes each evidence record under the run event envelope through the messaging port, in the transaction of the command, with a durable local fallback",
      "sequence": "18.21.02",
      "description": "As a platform admin, I want the evidence of a command to travel to the Audit service with the state change that caused it, so that a committed command cannot lose its evidence and a rolled back command leaves none. The library writes audit events to SQL Server or to files in the service that raised them. Factory evidence belongs to the Audit service, which appends it to the hash chain of the tenant and mirrors it to the immutable store (model/services/governance/AuditService.yaml). This PBI adds a third data provider beside the two of `AuditDataProviderType`: the Factory sink. The sink redacts the record with the audit profile of the Compliance library, which the feature `component-compliance-factory-classifications` delivers, and lists the removed fields in `redactions`. It wraps the record as the payload of the run event envelope of the contracts package, with tenant, project, run and correlation from the scope and the classification restricted, the class docs/architecture/data-governance.md assigns to audit evidence, and hands it to the messaging port. The evidence event travels on the topic `audit.evidence.v1.evidence-submitted`. Its event type name and that topic are constants of the pinned contracts package, where every Factory event type is declared; the library declares neither, and a golden file fixes the envelope and the payload without `chainHash`, which the Audit service computes and a service never submits. `AgentEventEnvelope` is not used here: the amendment of ADR-0014 on envelopes per event family keeps it for agent lifecycle events. The path of the evidence is decided (D115): evidence travels as an event that a service writes to its outbox in the transaction of its command, because only an outbox record can commit with the state change of the command. model/services/governance/AuditService.yaml gives the Audit service the command `SubmitEvidence` for that event, handled by `AuditEntry`: the record is appended once per evidence identifier by the same append `Audit.Record` performs, and the gRPC operation `Audit.Record` stays for commands that are not events, so both end in one record of the chain. When a unit of work is open, the outbox record of the evidence is committed with the state change of the command, as ADR-0014 decision 4 requires, so a rolled back command leaves no evidence and a committed command cannot lose it. When the port cannot take the record, because no unit of work is open or the store of the outbox refuses, the sink appends the redacted record to the durable local provider the library already has, SQL Server or file system, and a forwarder hands the stored records to the port in their order when it accepts again. A record is never dropped and never written unredacted. A record whose redaction fails is refused with the field named and counted on a metric without its value. The event identifier of the envelope is the evidence identifier, so a record forwarded twice is one record for the Audit service. The sink references the messaging port and no transport. Kind: enabling. Traces: services: AuditService; descriptors: audit-evidence-v1, run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0019. Relates: nfrs: NFR-04. Depends on: AIFACTORY-US-261, feature:contracts-package, feature:component-compliance-factory-classifications. Sources: model/components.yaml, model/services/governance/AuditService.yaml, docs/architecture/data-governance.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md, docs/reference/schemas/run-event-envelope.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a command that changes state inside a unit of work and completes an audit scope, when the unit of work commits, then the outbox holds one event of the evidence event type, on the topic `audit.evidence.v1.evidence-submitted` that the pinned contracts package names, under `run-event-envelope-v1`, whose payload is the evidence record without `chainHash`, whose tenant, project, run and correlation equal the scope, whose classification is restricted and whose event identifier is the evidence identifier, and the serialised event matches its golden file; when the unit of work rolls back, then no outbox record and no evidence exists (ADR-0014 decision 4, docs/architecture/data-governance.md).",
        "AC2: Given the messaging port cannot take a record, when an audit scope completes, then the redacted record is appended to the durable local provider and the command is not failed by the sink; when the port accepts again, then the forwarder publishes the stored records in their order and a record published twice carries the same event identifier, so that the command `SubmitEvidence` of the Audit service appends it once per evidence identifier (ADR-0014 decision 3, model/services/governance/AuditService.yaml).",
        "AC3: Given a record with a field the audit profile redacts, when the sink writes it to the port or to the local provider, then the field is replaced before the write and named in `redactions`; given a record whose redaction fails, then the sink refuses it with the field named, counts the refusal and writes the value nowhere (ADR-0019 decisions 2 and 3).",
        "AC4: Given the sink assembly, when the architecture test of the library runs, then it references the messaging port and the run event envelope of the pinned contracts package and no transport client, and it does not reference `AgentEventEnvelope` (ADR-0012 decision on the messaging port, ADR-0014 amendment on envelopes per event family)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/data-governance.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1291",
        "AIFACTORY-TASK-636",
        "AIFACTORY-TASK-1195",
        "AIFACTORY-TASK-1196",
        "AIFACTORY-TASK-1197"
      ],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2202,
      "kind": "enabling",
      "traces": {
        "services": [
          "AuditService"
        ],
        "descriptors": [
          "audit-evidence-v1",
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0019"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-04"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-261",
        "feature:contracts-package",
        "feature:component-compliance-factory-classifications"
      ],
      "source": [
        "model/components.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/architecture/data-governance.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md",
        "docs/reference/schemas/run-event-envelope.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-262]",
      "number": 262
    },
    {
      "id": "AIFACTORY-TASK-1291",
      "type": "task",
      "parent": "AIFACTORY-US-262",
      "title": "Evidence event type, its topic constant and the golden file of the envelope",
      "sequence": "18.21.02.01",
      "description": "BEFORE DEVELOPMENT. Evidence event type, its topic constant and the golden file of the envelope. Expected output: The sink takes the event type name and the topic constant of the evidence event, `audit.evidence.v1.evidence-submitted`, from the pinned contracts package and declares neither; a golden JSON file fixes the run event envelope with the evidence record as its payload and without `chainHash`; a contract test fails when the serialised event differs from the file or when the library declares an event type or a topic of its own; the Features page states that the command `SubmitEvidence` of the Audit service appends the event once per evidence identifier by the same append as `Audit.Record`, which stays for commands that are not events (model/services/governance/AuditService.yaml).. Kind: contract. Repository: ConnectSoft.Extensions.AuditNet. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The sink takes the event type name and the topic constant of the evidence event, `audit.evidence.v1.evidence-submitted`, from the pinned contracts package and declares neither; a golden JSON file fixes the run event envelope with the evidence record as its payload and without `chainHash`; a contract test fails when the serialised event differs from the file or when the library declares an event type or a topic of its own; the Features page states that the command `SubmitEvidence` of the Audit service appends the event once per evidence identifier by the same append as `Audit.Record`, which stays for commands that are not events (model/services/governance/AuditService.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2202,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1291]",
      "number": 1291
    },
    {
      "id": "AIFACTORY-TASK-636",
      "type": "task",
      "parent": "AIFACTORY-US-262",
      "title": "Audit sink to the Audit service under the envelope",
      "sequence": "18.21.02.02",
      "description": "BEFORE DEVELOPMENT. Audit sink to the Audit service under the envelope. Expected output: A third data provider of the library publishes each evidence record through the messaging port, as the evidence event type and on the topic `audit.evidence.v1.evidence-submitted` of the pinned contracts package, under the run event envelope of that package to the Audit service, enlisted in the open unit of work so that the outbox record commits with the state change, with redaction by the audit profile of the Compliance library before the write and the evidence identifier as the event identifier.. Kind: implementation. Repository: ConnectSoft.Extensions.AuditNet. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A third data provider of the library publishes each evidence record through the messaging port, as the evidence event type and on the topic `audit.evidence.v1.evidence-submitted` of the pinned contracts package, under the run event envelope of that package to the Audit service, enlisted in the open unit of work so that the outbox record commits with the state change, with redaction by the audit profile of the Compliance library before the write and the evidence identifier as the event identifier."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-636]",
      "number": 636
    },
    {
      "id": "AIFACTORY-TASK-1195",
      "type": "task",
      "parent": "AIFACTORY-US-262",
      "title": "Durable local fallback and its ordered forwarder",
      "sequence": "18.21.02.03",
      "description": "BEFORE DEVELOPMENT. Durable local fallback and its ordered forwarder. Expected output: When the port cannot take a record the sink appends the redacted record to the SQL Server or file system provider of the library, and a hosted forwarder hands the stored records to the port in their order when it accepts again and removes each only after the port took it; the options of `AuditNetOptions` select the fallback provider and are validated at start.. Kind: implementation. Repository: ConnectSoft.Extensions.AuditNet. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "When the port cannot take a record the sink appends the redacted record to the SQL Server or file system provider of the library, and a hosted forwarder hands the stored records to the port in their order when it accepts again and removes each only after the port took it; the options of `AuditNetOptions` select the fallback provider and are validated at start."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1195]",
      "number": 1195
    },
    {
      "id": "AIFACTORY-TASK-1196",
      "type": "task",
      "parent": "AIFACTORY-US-262",
      "title": "Commit, rollback, outage and failed redaction tests of the sink",
      "sequence": "18.21.02.04",
      "description": "BEFORE DEVELOPMENT. Commit, rollback, outage and failed redaction tests of the sink. Expected output: A test fixture with an in-memory messaging port and a real unit of work proves the committed and the rolled back command, an outage of the port with ordered forwarding and a duplicate forward, and a record whose redaction fails; an architecture test asserts that the sink references no transport client and no `AgentEventEnvelope`.. Kind: fixture. Repository: ConnectSoft.Extensions.AuditNet. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A test fixture with an in-memory messaging port and a real unit of work proves the committed and the rolled back command, an outage of the port with ordered forwarding and a duplicate forward, and a record whose redaction fails; an architecture test asserts that the sink references no transport client and no `AgentEventEnvelope`."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2202,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1196]",
      "number": 1196
    },
    {
      "id": "AIFACTORY-TASK-1197",
      "type": "task",
      "parent": "AIFACTORY-US-262",
      "title": "Verify the sink on commit, rollback, outage and redaction",
      "sequence": "18.21.02.05",
      "description": "BEFORE DEVELOPMENT. Verify the sink on commit, rollback, outage and redaction. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the golden file test of the evidence event, the commit, rollback, outage, duplicate and failed redaction tests and the architecture test pass and prove AC1 to AC4 of AIFACTORY-US-262 (ADR-0014, ADR-0019).. Kind: verification. Repository: ConnectSoft.Extensions.AuditNet.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the golden file test of the evidence event, the commit, rollback, outage, duplicate and failed redaction tests and the architecture test pass and prove AC1 to AC4 of AIFACTORY-US-262 (ADR-0014, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1197]",
      "number": 1197
    },
    {
      "id": "AIFACTORY-US-263",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-176",
      "title": "Audit library: the package with the evidence record and the sink is built, tested and published to the ConnectSoft feed with a version its consumers pin",
      "sequence": "18.21.03",
      "description": "As a platform admin, I want the audit package with the Factory evidence on the feed under a version a service can pin, so that the services of this increment record evidence through a published package and not through a local build. This PBI is the publication proof of the feature. The Overview page of the library names packaging and deployment through Azure DevOps among what the repository provides, and the epic is done only when each library publishes before the Factory code that consumes it is built (model/backlog/epics.yaml). The pipeline of the repository builds the library, runs its tests, packs and pushes the package to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to. The contracts package, the abstractions package and the Compliance package are restored from that feed at their published versions and never from a project reference. Publication is reached only when the tests pass and refuses a version that is already on the feed. A probe then proves the package from the side of a consumer: a clean host that takes every ConnectSoft package from the feed registers `AddConnectSoftAuditNet` with the Factory sink, establishes a scope, completes one audit scope inside a unit of work and finds one evidence event under the run event envelope in an in-memory messaging port, with the tenant of the scope and the field of a planted secret named in its redactions. The published version is recorded on the Runbook page of the library, where the eleven consuming services read their pin. This is an evidence PBI (D113): a library feature has no scenario, so the probe names what it proves through its ADRs, the requirement on release gates and its sources. Kind: evidence. Traces: adrs: ADR-0014, ADR-0019, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-261, AIFACTORY-US-262. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/catalogs/libraries.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the library repository after the work of the feature, when it runs, then the package is built, tested, packed and pushed to the ConnectSoft feed, the contracts, abstractions and Compliance packages are restored from the feed at their published versions, and the published version is recorded on the Runbook page (FR-11, ADR-0028, model/backlog/epics.yaml).",
        "AC2: Given a clean probe host that restores every ConnectSoft package from the feed and holds no project reference, when it completes one audit scope inside a unit of work under an established scope, then its in-memory messaging port holds one evidence event under the run event envelope with the tenant of the scope, and a planted secret value appears nowhere in the event while its field is named in the redactions (ADR-0014 decision 4, ADR-0019 decision 3).",
        "AC3: Given a failing test or a version that is already on the feed, when the pipeline reaches the publication stage, then the stage is refused with the reason and nothing is pushed; a run with a planted failing test proves the refusal (FR-11, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1198",
        "AIFACTORY-TASK-1199",
        "AIFACTORY-TASK-1200",
        "AIFACTORY-TASK-1201"
      ],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2203,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-261",
        "AIFACTORY-US-262"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "titlePrefix": "[AIFACTORY-US-263]",
      "number": 263
    },
    {
      "id": "AIFACTORY-TASK-1198",
      "type": "task",
      "parent": "AIFACTORY-US-263",
      "title": "Version guard and feed restore in the audit library pipeline",
      "sequence": "18.21.03.01",
      "description": "BEFORE DEVELOPMENT. Version guard and feed restore in the audit library pipeline. Expected output: The pipeline of the repository restores the contracts, abstractions and Compliance packages from the ConnectSoft feed, publishes the package only after the tests of the solution pass and refuses a version that is already on the feed with the reason.. Kind: operations. Repository: ConnectSoft.Extensions.AuditNet. Verification: azure-pipelines.yml publishes after the tests and a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipeline of the repository restores the contracts, abstractions and Compliance packages from the ConnectSoft feed, publishes the package only after the tests of the solution pass and refuses a version that is already on the feed with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2203,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1198]",
      "number": 1198
    },
    {
      "id": "AIFACTORY-TASK-1199",
      "type": "task",
      "parent": "AIFACTORY-US-263",
      "title": "Feed probe host for the published audit package",
      "sequence": "18.21.03.02",
      "description": "BEFORE DEVELOPMENT. Feed probe host for the published audit package. Expected output: A probe project that restores every ConnectSoft package from the feed and holds no project reference registers the Factory sink with an in-memory messaging port, completes one audit scope with a planted secret inside a unit of work and asserts on the evidence event; the probe runs as the last stage of the pipeline.. Kind: fixture. Repository: ConnectSoft.Extensions.AuditNet. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe project that restores every ConnectSoft package from the feed and holds no project reference registers the Factory sink with an in-memory messaging port, completes one audit scope with a planted secret inside a unit of work and asserts on the evidence event; the probe runs as the last stage of the pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2203,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1199]",
      "number": 1199
    },
    {
      "id": "AIFACTORY-TASK-1200",
      "type": "task",
      "parent": "AIFACTORY-US-263",
      "title": "Published version and the Factory provider recorded on the library pages",
      "sequence": "18.21.03.03",
      "description": "BEFORE DEVELOPMENT. Published version and the Factory provider recorded on the library pages. Expected output: The Runbook page of the library names the published version and the versions of the contracts, abstractions and Compliance packages it pins, and the Features and Getting Started pages describe the evidence builder, the Factory sink as the third data provider and its fallback.. Kind: documentation. Repository: ConnectSoft.Extensions.AuditNet. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Runbook page of the library names the published version and the versions of the contracts, abstractions and Compliance packages it pins, and the Features and Getting Started pages describe the evidence builder, the Factory sink as the third data provider and its fallback."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2203,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1200]",
      "number": 1200
    },
    {
      "id": "AIFACTORY-TASK-1201",
      "type": "task",
      "parent": "AIFACTORY-US-263",
      "title": "Verify the published audit package by the probe and by a planted failing run",
      "sequence": "18.21.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the published audit package by the probe and by a planted failing run. Expected output: One run of the pipeline publishes the package and the probe passes; one run with a planted failing test stops before publication; both runs prove AC1 to AC3 of AIFACTORY-US-263 (FR-11, ADR-0028).. Kind: verification. Repository: ConnectSoft.Extensions.AuditNet.",
      "acceptanceCriteria": [
        "One run of the pipeline publishes the package and the probe passes; one run with a planted failing test stops before publication; both runs prove AC1 to AC3 of AIFACTORY-US-263 (FR-11, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1201]",
      "number": 1201
    },
    {
      "id": "AIFACTORY-US-116",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-176",
      "title": "Audit library: the Factory audit evidence record and its sink is delivered and proven by its consumers",
      "sequence": "18.21.04",
      "description": "As a platform admin, I want Audit.NET integration to carry the Factory audit evidence record and its sink, so that it serves audit evidence without later rework. This is the integration PBI of the feature. With the evidence builder, the Factory sink and the publication proof of the earlier PBIs, a Factory service records audit evidence by three steps and no code of its own: it pins the published `ConnectSoft.Extensions.AuditNet` package, registers `AddConnectSoftAuditNet` with the Factory sink, and completes an audit scope with an action, a subject and an outcome inside the unit of work of its command. The record has the shape of the contracts package, its tenant and actor come from the trusted scope, it is redacted by the audit profile of the Compliance library, and it leaves the service under the run event envelope together with the state change. A record without a tenant is refused, a rolled back command leaves no evidence, and an outage of the port delays evidence in a durable local store without losing or reordering it. ADR-0019 keeps this evidence seven years, redacted and immutable; the library delivers the redacted record and its transport, and the Audit service keeps the chain. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature. The feature is done when the package is on the ConnectSoft feed with the version the Runbook page names and the probe host proves it from the feed. Kind: enabling. Traces: services: AuditService; adrs: ADR-0019, ADR-0021. Depends on: AIFACTORY-US-261, AIFACTORY-US-262, AIFACTORY-US-263. Sources: model/components.yaml, model/services/governance/AuditService.yaml, docs/reference/schemas/audit-evidence.schema.json, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repository ConnectSoft.Extensions.AuditNet with the work of this feature, when its pipeline runs, then the package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0019, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-635 (factory audit record shape) is done, then the evidence record carries tenant and project from the scope, the actor with its kind, the action, the subject with its hash, the outcome and the correlation with the run per docs/reference/schemas/audit-evidence.schema.json, with the record type generated in the contracts package and a test that a record without a tenant is refused; the step of the migrated text is not carried because the schema has no field for it, and its evidence reference is the evidence identifier with the hash of the subject (ADR-0019 decision 3, ADR-0021).",
        "AC3: Given the work of AIFACTORY-TASK-636 (audit sink to the Audit service under the envelope) is done, then the sink publishes evidence through the messaging port under the run event envelope in the transaction of the command, with a durable local fallback when the port cannot take the record and redaction by the Compliance library before the write (ADR-0019 decision 2, model/services/governance/AuditService.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1202",
        "AIFACTORY-TASK-670"
      ],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2204,
      "kind": "enabling",
      "traces": {
        "services": [
          "AuditService"
        ],
        "adrs": [
          "ADR-0019",
          "ADR-0021"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-261",
        "AIFACTORY-US-262",
        "AIFACTORY-US-263"
      ],
      "source": [
        "model/components.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-116]",
      "number": 116
    },
    {
      "id": "AIFACTORY-TASK-1202",
      "type": "task",
      "parent": "AIFACTORY-US-116",
      "title": "Use case page for recording Factory evidence from a service",
      "sequence": "18.21.04.01",
      "description": "BEFORE DEVELOPMENT. Use case page for recording Factory evidence from a service. Expected output: The Use Cases page of the library holds one worked case of a Factory service: the registration with the Factory sink, an audit scope around a command inside its unit of work, the resulting evidence event and what the service sees on a refusal and on an outage of the port.. Kind: documentation. Repository: ConnectSoft.Extensions.AuditNet. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Use Cases page of the library holds one worked case of a Factory service: the registration with the Factory sink, an audit scope around a command inside its unit of work, the resulting evidence event and what the service sees on a refusal and on an outage of the port."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2204,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1202]",
      "number": 1202
    },
    {
      "id": "AIFACTORY-TASK-670",
      "type": "task",
      "parent": "AIFACTORY-US-116",
      "title": "Verify audit-factory-evidence-delivered by running the declared command",
      "sequence": "18.21.04.02",
      "description": "BEFORE DEVELOPMENT. Verify audit-factory-evidence-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and the probe host of AIFACTORY-TASK-1199 against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-116.. Kind: verification. Repository: ConnectSoft.Extensions.AuditNet.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and the probe host of AIFACTORY-TASK-1199 against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-116."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/audit-evidence.schema.json",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.AuditNet"
      ],
      "children": [],
      "buildOrder": 22,
      "phase": "templates-and-libraries",
      "stackRank": 2204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-670]",
      "number": 670
    },
    {
      "id": "AIFACTORY-FEAT-177",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Compliance library: the Factory data classes and redaction profiles",
      "sequence": "18.22",
      "description": "ADR-0019 fixes four classification classes, pii and classification markers on model fields, redaction in every projection and notification, and no raw prompt, response or tool-output logging. The Compliance library (classification, redaction; D31) carries the mechanism but not the Factory's data classes: prompts, completions, tool outputs, secret references, customer source code and tenant personal data. The library gains those classes and the redaction profiles the telemetry, audit and artifact projections apply, so that redaction is one implementation rather than one per service. Component: Compliance (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I1: Generate a microservice. Build order 23 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-264",
        "AIFACTORY-US-265",
        "AIFACTORY-US-266",
        "AIFACTORY-US-117"
      ],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2300,
      "titlePrefix": "[AIFACTORY-FEAT-177]",
      "number": 177
    },
    {
      "id": "AIFACTORY-US-264",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-177",
      "title": "Compliance library: six Factory data classes join the taxonomy and map to the four classification classes and to the pii and classification field markers of the model",
      "sequence": "18.22.01",
      "description": "As a platform admin, I want the data kinds of the Factory to be classes of the one taxonomy every service already uses, so that a field is classified once by a marker and no service keeps its own list of what is sensitive. The README of the Compliance library describes a shared taxonomy with marker attributes such as `[EmailData]`, `[PhoneData]` and `[TenantIdData]`, custom redactors, the registration `AddConnectSoftCompliance` and the profiles default, audit and strict that configuration selects. The Overview and Features pages of its documentation site still carry the text of the library template the repository was scaffolded from and do not describe the library. ADR-0019 decision 2 fixes four classification classes, public, internal, confidential and restricted, and has model fields carry `pii` and `classification`; docs/architecture/data-governance.md places source code, prompts and outputs in confidential and credentials, secret references and personal fields in restricted. The README and the source of the library already hold the class of a secret value, `[SecretData]` with the generic secret redactor, and personal data attributes such as `[EmailData]`, `[PhoneData]`, `[PersonNameData]`, `[PostalAddressData]` and `[GovernmentIdData]`. The taxonomy has no class for a prompt, a completion, a tool output, a secret reference or source code, and none that gathers the personal attributes under the name the Factory uses. This PBI adds six data classes to `ConnectSoftTaxonomy`, each with its marker attribute: prompt, completion, tool output, secret reference, source code and tenant personal data. Each class declares the classification class it belongs to. One table in the library maps the taxonomy and the two field markers of the model, and it states the relation of the new classes to what exists. The existing personal data attributes are members of tenant personal data and keep their own redactors. `[SecretData]` stays the class of a secret value and takes the fixed mask, while secret reference is the new class of a value that only points at a secret and passes as the reference. A member may carry one existing attribute together with the Factory class that attribute is a member of, and no other pair. A field marked `pii` is tenant personal data, and a field with a `classification` takes the default treatment of that class unless a marker attribute names a narrower data class. The registration `AddConnectSoftCompliance(configuration, environment)` takes no list of types today, so it gains an option that names the assemblies to scan. A validation at registration runs over the types of those assemblies and refuses a type that marks one member with two data classes of the Factory, with an existing attribute and a Factory class it is no member of, or with a data class weaker than the `classification` of the member, and names the member; with no assembly named nothing is scanned and the registration behaves as it does today. Nothing is redacted by this PBI. It gives the redaction profiles of the next PBI the classes they act on, and it replaces the template text of the two documentation pages with the description of the library, so that a consumer can read which classes exist. Kind: enabling. Traces: adrs: ADR-0019. Relates: nfrs: NFR-03. Sources: model/components.yaml, docs/architecture/adr/0019-data-governance.md, docs/architecture/data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given the library with the work of this PBI, when a type marks members with the six marker attributes, then the taxonomy resolves each member to its data class, and each data class reports its classification class as docs/architecture/data-governance.md assigns it: prompt, completion, tool output and source code are confidential, and secret reference and tenant personal data are restricted (ADR-0019 decision 2).",
        "AC2: Given a model field marked `pii`, a model field with a `classification` and no marker attribute, and members marked `[EmailData]` and `[SecretData]`, when the mapping table resolves them, then the first is tenant personal data, the second takes the default treatment of its classification class, the `[EmailData]` member is a member of tenant personal data that keeps its own redactor, and the `[SecretData]` member stays a secret value and is not a secret reference; a test covers each of the four classification classes and each existing attribute the table lists (ADR-0019 decision 2).",
        "AC3: Given the option of the registration names an assembly with a type that marks one member with two data classes of the Factory, with an existing attribute and a Factory class it is no member of, or with a data class weaker than the `classification` of the member, when `AddConnectSoftCompliance` validates the types of the named assemblies, then registration is refused and the member is named; a member that carries `[EmailData]` together with the tenant personal data marker registers, and with no assembly named nothing is scanned (ADR-0019 decision 2, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1203",
        "AIFACTORY-TASK-637",
        "AIFACTORY-TASK-1204",
        "AIFACTORY-TASK-1205"
      ],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2301,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0019"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-264]",
      "number": 264
    },
    {
      "id": "AIFACTORY-TASK-1203",
      "type": "task",
      "parent": "AIFACTORY-US-264",
      "title": "Six Factory data classes, their marker attributes and the mapping table with the existing attributes",
      "sequence": "18.22.01.01",
      "description": "BEFORE DEVELOPMENT. Six Factory data classes, their marker attributes and the mapping table with the existing attributes. Expected output: The taxonomy declares prompt, completion, tool output, secret reference, source code and tenant personal data as data classes with one marker attribute each and the classification class of each; one table maps the `pii` and `classification` field markers of the model to the taxonomy, lists the existing personal data attributes as members of tenant personal data that keep their own redactors, keeps `[SecretData]` as the class of a secret value with the fixed mask beside the new secret reference, and names the one pair of markers a member may carry; unit tests cover every class and every row of the table.. Kind: contract. Repository: ConnectSoft.Extensions.Compliance. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The taxonomy declares prompt, completion, tool output, secret reference, source code and tenant personal data as data classes with one marker attribute each and the classification class of each; one table maps the `pii` and `classification` field markers of the model to the taxonomy, lists the existing personal data attributes as members of tenant personal data that keep their own redactors, keeps `[SecretData]` as the class of a secret value with the fixed mask beside the new secret reference, and names the one pair of markers a member may carry; unit tests cover every class and every row of the table."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2301,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1203]",
      "number": 1203
    },
    {
      "id": "AIFACTORY-TASK-637",
      "type": "task",
      "parent": "AIFACTORY-US-264",
      "title": "Factory data classes resolved per member and validated at registration, before the redaction profiles",
      "sequence": "18.22.01.02",
      "description": "BEFORE DEVELOPMENT. Factory data classes resolved per member and validated at registration, before the redaction profiles. Expected output: A resolver returns the data class and the classification class of a member from its marker attributes and model markers by the table of AIFACTORY-TASK-1203; the registration gains an option that names the assemblies to scan, and its validation refuses a member with two Factory data classes, with an existing attribute and a Factory class it is no member of, or with a class weaker than its classification, and names the member; the redaction profiles the migrated title named are AIFACTORY-TASK-1206.. Kind: implementation. Repository: ConnectSoft.Extensions.Compliance. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A resolver returns the data class and the classification class of a member from its marker attributes and model markers by the table of AIFACTORY-TASK-1203; the registration gains an option that names the assemblies to scan, and its validation refuses a member with two Factory data classes, with an existing attribute and a Factory class it is no member of, or with a class weaker than its classification, and names the member; the redaction profiles the migrated title named are AIFACTORY-TASK-1206."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-637]",
      "number": 637
    },
    {
      "id": "AIFACTORY-TASK-1204",
      "type": "task",
      "parent": "AIFACTORY-US-264",
      "title": "Overview and Features pages describe the library and its data classes",
      "sequence": "18.22.01.03",
      "description": "BEFORE DEVELOPMENT. Overview and Features pages describe the library and its data classes. Expected output: The Overview and Features pages of the documentation of the library no longer carry the text of the library template; they describe the taxonomy, the marker attributes with the six data classes of the Factory and their classification classes, the redactors and the registration, in agreement with the README of the repository.. Kind: documentation. Repository: ConnectSoft.Extensions.Compliance. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Overview and Features pages of the documentation of the library no longer carry the text of the library template; they describe the taxonomy, the marker attributes with the six data classes of the Factory and their classification classes, the redactors and the registration, in agreement with the README of the repository."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2301,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1204]",
      "number": 1204
    },
    {
      "id": "AIFACTORY-TASK-1205",
      "type": "task",
      "parent": "AIFACTORY-US-264",
      "title": "Verify the data classes, the mapping table and the registration refusal",
      "sequence": "18.22.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the data classes, the mapping table and the registration refusal. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the tests of the six classes, of the mapping table over the four classification classes and the existing attributes, of the three refused conflicts, of the admitted pair and of a registration that names no assembly pass and prove AC1 to AC3 of AIFACTORY-US-264 (ADR-0019, docs/architecture/data-governance.md).. Kind: verification. Repository: ConnectSoft.Extensions.Compliance.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the tests of the six classes, of the mapping table over the four classification classes and the existing attributes, of the three refused conflicts, of the admitted pair and of a registration that names no assembly pass and prove AC1 to AC3 of AIFACTORY-US-264 (ADR-0019, docs/architecture/data-governance.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1205]",
      "number": 1205
    },
    {
      "id": "AIFACTORY-US-265",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-177",
      "title": "Compliance library: one redaction profile per projection replaces Factory content by its reference, and a secret never leaves a service as a value",
      "sequence": "18.22.02",
      "description": "As a platform admin, I want one redaction implementation with a profile for every place data leaves a service, so that telemetry, audit evidence, notifications and events are redacted the same way by every service. ADR-0019 decision 2 requires redaction in every projection and notification, and decision 3 forbids raw prompt, response and tool-output logging. The Compliance library selects one of three profiles, default, audit and strict, by configuration, and its README names idempotent redactors as a design goal. A Factory service projects the same record to several places with different rules, so one profile per process is not enough. This PBI adds a redaction profile per projection on top of the data classes of the earlier PBI: log, audit, notification, envelope and artifact projection. In the log, audit, notification and envelope profiles a prompt, a completion, a tool output and source code are replaced by their reference, the hash and the size of the value and the artifact identifier when there is one. In the artifact projection profile they pass only when the caller states the explicit scope docs/architecture/data-governance.md requires for showing confidential content, and are a reference otherwise. A secret is never a value in any profile: a member marked as a secret reference, such as a secret broker reference, stays the reference, and a member marked `[SecretData]`, such as a model provider key, is replaced by a fixed mask. Tenant personal data is redacted in the log, notification and envelope profiles, each existing personal data attribute by its own redactor; the audit profile keeps the actor identifier the evidence schema requires and redacts every other personal field. The notification profile removes every restricted field and lists it, so that a restricted field never reaches a notification. A field with a marker and no rule in the selected profile is redacted in full, so that a new class fails closed. Redacting a redacted value changes nothing. The log profile is also the implementation of the allow decision of the content guard that the observability feature ships without one: registering the Compliance library registers it, and it allows a field only when its class is public or internal. Kind: enabling. Traces: descriptors: run-event-envelope-v1; adrs: ADR-0019. Relates: nfrs: NFR-03, NFR-10. Depends on: AIFACTORY-US-264, feature:component-observability-factory-conventions. Sources: model/components.yaml, docs/architecture/adr/0019-data-governance.md, docs/architecture/data-governance.md, docs/reference/schemas/audit-evidence.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a record with a prompt, a completion, a tool output and source code, when it is projected with the log, audit, notification and envelope profiles, then each of the four fields is replaced by its hash and size, with the artifact identifier when there is one, and the artifact projection profile passes them only with the explicit scope stated and returns the reference otherwise (ADR-0019 decisions 2 and 3, docs/architecture/data-governance.md).",
        "AC2: Given a record with a secret broker reference marked as a secret reference and a model provider key marked `[SecretData]`, when it is projected with the log, audit and envelope profiles, then the reference is kept as the reference, the key is replaced by the fixed mask and the value of the key appears in no projection (ADR-0019 decision 2).",
        "AC3: Given a record with a restricted field and tenant personal data, when it is projected with the notification profile, then every restricted field is removed and listed and no personal value remains; when it is projected with the audit profile, then the actor identifier is kept and every other personal field is redacted (ADR-0019 decision 2, docs/reference/schemas/audit-evidence.schema.json).",
        "AC4: Given a host that registers the Compliance library beside the single registration of the observability library, when a prompt and a field classified internal are written to a log record, then the content guard replaces the prompt by its reference and lets the internal field pass, because the log profile answers the allow decision from the class of the field (ADR-0019 decision 3).",
        "AC5: Given a field with a marker attribute and no rule in the selected profile, when it is projected, then it is redacted in full; given a value that was already redacted, when it is redacted again, then it is unchanged (ADR-0019 decision 2, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/data-governance.md",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1206",
        "AIFACTORY-TASK-1207",
        "AIFACTORY-TASK-638",
        "AIFACTORY-TASK-1208"
      ],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2302,
      "kind": "enabling",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0019"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-03",
          "NFR-10"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-264",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/data-governance.md",
        "docs/reference/schemas/audit-evidence.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-265]",
      "number": 265
    },
    {
      "id": "AIFACTORY-TASK-1206",
      "type": "task",
      "parent": "AIFACTORY-US-265",
      "title": "Redaction profiles for the log, audit, notification, envelope and artifact projections",
      "sequence": "18.22.02.01",
      "description": "BEFORE DEVELOPMENT. Redaction profiles for the log, audit, notification, envelope and artifact projections. Expected output: Five named profiles apply the rules of the data classes per projection: content classes become a reference, a secret value becomes the fixed mask, personal data is redacted except the actor identifier in the audit profile, the notification profile removes and lists restricted fields, the artifact projection profile passes content only with the explicit scope, and a marked field without a rule is redacted in full; the profile is chosen per call and no longer only per process.. Kind: implementation. Repository: ConnectSoft.Extensions.Compliance. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Five named profiles apply the rules of the data classes per projection: content classes become a reference, a secret value becomes the fixed mask, personal data is redacted except the actor identifier in the audit profile, the notification profile removes and lists restricted fields, the artifact projection profile passes content only with the explicit scope, and a marked field without a rule is redacted in full; the profile is chosen per call and no longer only per process."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1206]",
      "number": 1206
    },
    {
      "id": "AIFACTORY-TASK-1207",
      "type": "task",
      "parent": "AIFACTORY-US-265",
      "title": "Log profile as the allow decision of the telemetry content guard",
      "sequence": "18.22.02.02",
      "description": "BEFORE DEVELOPMENT. Log profile as the allow decision of the telemetry content guard. Expected output: The registration of the library registers an implementation of the allow decision interface of the pinned `ConnectSoft.Extensions.Telemetry` package that answers from the classification class of the field and allows only public and internal fields; the library defines no content guard of its own.. Kind: implementation. Repository: ConnectSoft.Extensions.Compliance. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The registration of the library registers an implementation of the allow decision interface of the pinned `ConnectSoft.Extensions.Telemetry` package that answers from the classification class of the field and allows only public and internal fields; the library defines no content guard of its own."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1207]",
      "number": 1207
    },
    {
      "id": "AIFACTORY-TASK-638",
      "type": "task",
      "parent": "AIFACTORY-US-265",
      "title": "A secret reference never leaves as a value",
      "sequence": "18.22.02.03",
      "description": "BEFORE DEVELOPMENT. A secret reference never leaves as a value. Expected output: Redaction tests across the log, audit and envelope projections prove that a secret broker reference and a model provider key are replaced by their reference or mask in every projection, that a restricted field never reaches a notification, that a marked field without a rule is redacted in full and that redaction is idempotent.. Kind: fixture. Repository: ConnectSoft.Extensions.Compliance. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Redaction tests across the log, audit and envelope projections prove that a secret broker reference and a model provider key are replaced by their reference or mask in every projection, that a restricted field never reaches a notification, that a marked field without a rule is redacted in full and that redaction is idempotent."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2302,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-638]",
      "number": 638
    },
    {
      "id": "AIFACTORY-TASK-1208",
      "type": "task",
      "parent": "AIFACTORY-US-265",
      "title": "Verify the five profiles and the content guard decision",
      "sequence": "18.22.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the five profiles and the content guard decision. Expected output: Run `dotnet test -c Release --no-build` on the library solution; the profile tests over the five projections, the secret tests, the notification test, the fail-closed and idempotency tests and the content guard test pass and prove AC1 to AC5 of AIFACTORY-US-265 (ADR-0019).. Kind: verification. Repository: ConnectSoft.Extensions.Compliance.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library solution; the profile tests over the five projections, the secret tests, the notification test, the fail-closed and idempotency tests and the content guard test pass and prove AC1 to AC5 of AIFACTORY-US-265 (ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1208]",
      "number": 1208
    },
    {
      "id": "AIFACTORY-US-266",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-177",
      "title": "Compliance library: the package with the Factory data classes and the redaction profiles is built, tested and published to the ConnectSoft feed with a version its consumers pin",
      "sequence": "18.22.03",
      "description": "As a platform admin, I want the Compliance package with the Factory classes on the feed under a version a service can pin, so that the audit sink, the telemetry guard and every service redact through one published implementation. This PBI is the publication proof of the feature. The README of the library names the package in the ConnectSoft feed and the Azure DevOps pipeline of the repository, and the epic is done only when each library publishes before the Factory code that consumes it is built (model/backlog/epics.yaml). The pipeline builds the library, runs its tests, with the table-driven and snapshot tests the README describes extended to the six data classes and the five profiles, packs and pushes the package to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to. The Telemetry package with the allow decision interface is restored from that feed at its published version. Publication is reached only when the tests pass and refuses a version that is already on the feed. A probe then proves the package from the side of a consumer: a clean host that takes every ConnectSoft package from the feed registers `AddConnectSoftCompliance` beside the single registration of the observability library, projects one record with a planted prompt, a planted provider key and a planted personal field through the five profiles and writes it to a log record, and no planted value is found in any output. The published version is recorded on the Runbook page of the library, where the audit library and the services read their pin. This is an evidence PBI (D113): a library feature has no scenario, so the probe names what it proves through its ADRs, the requirement on release gates and its sources. Kind: evidence. Traces: adrs: ADR-0019, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-264, AIFACTORY-US-265. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/catalogs/libraries.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the library repository after the work of the feature, when it runs, then the package is built, tested with the snapshot tests of the six data classes and the five profiles, packed and pushed to the ConnectSoft feed, and the published version is recorded on the Runbook page (FR-11, ADR-0028, model/backlog/epics.yaml).",
        "AC2: Given a clean probe host that restores every ConnectSoft package from the feed and holds no project reference, when it projects a record with a planted prompt, a planted provider key and a planted personal field through the five profiles and writes it to a log record, then a search of every output finds no planted value (ADR-0019 decisions 2 and 3).",
        "AC3: Given a failing test, a changed snapshot or a version that is already on the feed, when the pipeline reaches the publication stage, then the stage is refused with the reason and nothing is pushed; a run with a planted changed snapshot proves the refusal (FR-11, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1209",
        "AIFACTORY-TASK-1210",
        "AIFACTORY-TASK-1211",
        "AIFACTORY-TASK-1212"
      ],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2303,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0019",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-264",
        "AIFACTORY-US-265"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/catalogs/libraries.md"
      ],
      "titlePrefix": "[AIFACTORY-US-266]",
      "number": 266
    },
    {
      "id": "AIFACTORY-TASK-1209",
      "type": "task",
      "parent": "AIFACTORY-US-266",
      "title": "Version guard and snapshot gate in the compliance library pipeline",
      "sequence": "18.22.03.01",
      "description": "BEFORE DEVELOPMENT. Version guard and snapshot gate in the compliance library pipeline. Expected output: The pipeline of the repository restores the Telemetry package from the ConnectSoft feed, publishes the package only after the tests and the snapshot comparison of the solution pass and refuses a version that is already on the feed with the reason.. Kind: operations. Repository: ConnectSoft.Extensions.Compliance. Verification: azure-pipelines.yml publishes after the tests and a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipeline of the repository restores the Telemetry package from the ConnectSoft feed, publishes the package only after the tests and the snapshot comparison of the solution pass and refuses a version that is already on the feed with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2303,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1209]",
      "number": 1209
    },
    {
      "id": "AIFACTORY-TASK-1210",
      "type": "task",
      "parent": "AIFACTORY-US-266",
      "title": "Feed probe host for the published compliance package",
      "sequence": "18.22.03.02",
      "description": "BEFORE DEVELOPMENT. Feed probe host for the published compliance package. Expected output: A probe project that restores every ConnectSoft package from the feed and holds no project reference registers the library beside the single registration of the observability library, projects one record with three planted values through the five profiles and a log record, and searches every output for the planted values; the probe runs as the last stage of the pipeline.. Kind: fixture. Repository: ConnectSoft.Extensions.Compliance. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A probe project that restores every ConnectSoft package from the feed and holds no project reference registers the library beside the single registration of the observability library, projects one record with three planted values through the five profiles and a log record, and searches every output for the planted values; the probe runs as the last stage of the pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2303,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1210]",
      "number": 1210
    },
    {
      "id": "AIFACTORY-TASK-1211",
      "type": "task",
      "parent": "AIFACTORY-US-266",
      "title": "Published version and the profiles recorded on the library pages",
      "sequence": "18.22.03.03",
      "description": "BEFORE DEVELOPMENT. Published version and the profiles recorded on the library pages. Expected output: The Runbook page of the library names the published version and the version of the Telemetry package it pins, and the Use Cases page describes the five profiles with the projection each belongs to and the fail-closed rule.. Kind: documentation. Repository: ConnectSoft.Extensions.Compliance. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Runbook page of the library names the published version and the version of the Telemetry package it pins, and the Use Cases page describes the five profiles with the projection each belongs to and the fail-closed rule."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2303,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1211]",
      "number": 1211
    },
    {
      "id": "AIFACTORY-TASK-1212",
      "type": "task",
      "parent": "AIFACTORY-US-266",
      "title": "Verify the published compliance package by the probe and by a planted changed snapshot",
      "sequence": "18.22.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the published compliance package by the probe and by a planted changed snapshot. Expected output: One run of the pipeline publishes the package and the probe finds no planted value; one run with a planted changed snapshot stops before publication; both runs prove AC1 to AC3 of AIFACTORY-US-266 (FR-11, ADR-0019).. Kind: verification. Repository: ConnectSoft.Extensions.Compliance.",
      "acceptanceCriteria": [
        "One run of the pipeline publishes the package and the probe finds no planted value; one run with a planted changed snapshot stops before publication; both runs prove AC1 to AC3 of AIFACTORY-US-266 (FR-11, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1212]",
      "number": 1212
    },
    {
      "id": "AIFACTORY-US-117",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-177",
      "title": "Compliance library: the Factory data classes and redaction profiles is delivered and proven by its consumers",
      "sequence": "18.22.04",
      "description": "As a platform admin, I want Compliance to carry the Factory data classes and redaction profiles, so that it serves data classification and redaction (D31) without later rework. This is the integration PBI of the feature. With the six data classes, the five redaction profiles and the publication proof of the earlier PBIs, redaction in the Factory is one implementation and not one per service. A service marks a field once, with a marker attribute or with the `pii` and `classification` markers of the model, pins the published `ConnectSoft.Extensions.Compliance` package and registers `AddConnectSoftCompliance`. Every projection of the field then follows the profile of its destination: a prompt, a completion, a tool output and source code leave the service as a reference, a secret never leaves as a value, a restricted field never reaches a notification, and a field the selected profile has no rule for is redacted in full. The telemetry content guard of the observability libraries and the sink of the audit library take their decisions from this package and hold no rules of their own. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature. The feature is done when the package is on the ConnectSoft feed with the version the Runbook page names, the probe host finds no planted value in any projection, and the audit library of the same increment restores the package from the feed. Kind: enabling. Traces: services: ArtifactService, AuditService, ContextBuilderService; adrs: ADR-0019. Depends on: AIFACTORY-US-264, AIFACTORY-US-265, AIFACTORY-US-266. Sources: model/components.yaml, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given the library repository ConnectSoft.Extensions.Compliance with the work of this feature, when its pipeline runs, then the package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0019, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-637 (factory data classes resolved and validated) and of AIFACTORY-TASK-1206 (redaction profiles) is done, then prompt, completion, tool output, secret reference, source code and tenant personal data are data classes of the taxonomy with redaction profiles for logs, audit, notifications, envelopes and artifact projections, and the pii and classification field markers and the existing attributes map to them (ADR-0019 decision 2, docs/architecture/data-governance.md).",
        "AC3: Given the work of AIFACTORY-TASK-638 (a secret reference never leaves as a value) is done, then redaction tests across the log, audit and envelope projections prove that a secret broker reference and a model provider key are replaced by their reference or mask in every projection, and that a restricted field never reaches a notification (ADR-0019 decisions 2 and 3)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1213",
        "AIFACTORY-TASK-678"
      ],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2304,
      "kind": "enabling",
      "traces": {
        "services": [
          "ArtifactService",
          "AuditService",
          "ContextBuilderService"
        ],
        "adrs": [
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-264",
        "AIFACTORY-US-265",
        "AIFACTORY-US-266"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-117]",
      "number": 117
    },
    {
      "id": "AIFACTORY-TASK-1213",
      "type": "task",
      "parent": "AIFACTORY-US-117",
      "title": "Getting Started page for classifying and projecting a Factory record",
      "sequence": "18.22.04.01",
      "description": "BEFORE DEVELOPMENT. Getting Started page for classifying and projecting a Factory record. Expected output: The Getting Started page of the library holds one worked case of a Factory service: a record marked with the marker attributes and the model markers, the registration, and the same record projected to a log, an audit record, a notification and an event, with what each profile leaves.. Kind: documentation. Repository: ConnectSoft.Extensions.Compliance. Verification: the documentation pipeline of the library builds its site without warnings.",
      "acceptanceCriteria": [
        "The Getting Started page of the library holds one worked case of a Factory service: a record marked with the marker attributes and the model markers, the registration, and the same record projected to a log, an audit record, a notification and an event, with what each profile leaves."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2304,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1213]",
      "number": 1213
    },
    {
      "id": "AIFACTORY-TASK-678",
      "type": "task",
      "parent": "AIFACTORY-US-117",
      "title": "Verify compliance-factory-classifications-delivered by running the declared command",
      "sequence": "18.22.04.02",
      "description": "BEFORE DEVELOPMENT. Verify compliance-factory-classifications-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and the probe host of AIFACTORY-TASK-1210 against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-117.. Kind: verification. Repository: ConnectSoft.Extensions.Compliance.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library solution and the probe host of AIFACTORY-TASK-1210 against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-117."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Extensions.Compliance"
      ],
      "children": [],
      "buildOrder": 23,
      "phase": "templates-and-libraries",
      "stackRank": 2304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-678]",
      "number": 678
    },
    {
      "id": "AIFACTORY-FEAT-180",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "API library template: OpenAPI generation, scope and propagation before the gateway clients",
      "sequence": "18.23",
      "description": "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). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-090. Increment I1: Generate a microservice. Build order 24 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-301",
        "AIFACTORY-US-302",
        "AIFACTORY-US-303",
        "AIFACTORY-US-304",
        "AIFACTORY-US-118"
      ],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2400,
      "titlePrefix": "[AIFACTORY-FEAT-180]",
      "number": 180
    },
    {
      "id": "AIFACTORY-US-301",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-180",
      "title": "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",
      "sequence": "18.23.01",
      "description": "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. Kind: enabling. 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "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"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1321",
        "AIFACTORY-TASK-641",
        "AIFACTORY-TASK-1322",
        "AIFACTORY-TASK-1323"
      ],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2401,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "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"
      ],
      "titlePrefix": "[AIFACTORY-US-301]",
      "number": 301
    },
    {
      "id": "AIFACTORY-TASK-1321",
      "type": "task",
      "parent": "AIFACTORY-US-301",
      "title": "Generation switch and document path as symbols of the template configuration",
      "sequence": "18.23.01.01",
      "description": "BEFORE DEVELOPMENT. Generation switch and document path as symbols of the template configuration. Expected output: 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.. Kind: contract. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet new connectsoft-api-library --help lists the switch and the path parameter.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2401,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1321]",
      "number": 1321
    },
    {
      "id": "AIFACTORY-TASK-641",
      "type": "task",
      "parent": "AIFACTORY-US-301",
      "title": "Client generation from an OpenAPI document",
      "sequence": "18.23.01.02",
      "description": "BEFORE DEVELOPMENT. Client generation from an OpenAPI document. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-641]",
      "number": 641
    },
    {
      "id": "AIFACTORY-TASK-1322",
      "type": "task",
      "parent": "AIFACTORY-US-301",
      "title": "Fixture gateway document and scaffold cases for the generated client",
      "sequence": "18.23.01.03",
      "description": "BEFORE DEVELOPMENT. Fixture gateway document and scaffold cases for the generated client. Expected output: 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.. Kind: fixture. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet test -c Release --filter TestCategory=Scaffold.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2401,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1322]",
      "number": 1322
    },
    {
      "id": "AIFACTORY-TASK-1323",
      "type": "task",
      "parent": "AIFACTORY-US-301",
      "title": "Verify generation on, generation off and the two failing documents",
      "sequence": "18.23.01.04",
      "description": "BEFORE DEVELOPMENT. Verify generation on, generation off and the two failing documents. Expected output: 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.. Kind: verification. Repository: ConnectSoft.ApiLibraryTemplate.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1323]",
      "number": 1323
    },
    {
      "id": "AIFACTORY-US-302",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-180",
      "title": "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",
      "sequence": "18.23.02",
      "description": "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. Kind: enabling. 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "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"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1324",
        "AIFACTORY-TASK-639",
        "AIFACTORY-TASK-1325",
        "AIFACTORY-TASK-1326"
      ],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2402,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:contracts-package",
        "feature:component-extensions-ai",
        "feature:component-auth-server-template-factory-tokens"
      ],
      "source": [
        "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"
      ],
      "titlePrefix": "[AIFACTORY-US-302]",
      "number": 302
    },
    {
      "id": "AIFACTORY-TASK-1324",
      "type": "task",
      "parent": "AIFACTORY-US-302",
      "title": "`UseFactoryProfile` and the JWT bearer choice in the template configuration",
      "sequence": "18.23.02.01",
      "description": "BEFORE DEVELOPMENT. `UseFactoryProfile` and the JWT bearer choice in the template configuration. Expected output: 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.. Kind: contract. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet new connectsoft-api-library --help lists `UseFactoryProfile` and the JWT bearer choice.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2402,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1324]",
      "number": 1324
    },
    {
      "id": "AIFACTORY-TASK-639",
      "type": "task",
      "parent": "AIFACTORY-US-302",
      "title": "Scope and workload-token propagation",
      "sequence": "18.23.02.02",
      "description": "BEFORE DEVELOPMENT. Scope and workload-token propagation. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-639]",
      "number": 639
    },
    {
      "id": "AIFACTORY-TASK-1325",
      "type": "task",
      "parent": "AIFACTORY-US-302",
      "title": "WireMock token endpoint and gateway stub for the Factory profile",
      "sequence": "18.23.02.03",
      "description": "BEFORE DEVELOPMENT. WireMock token endpoint and gateway stub for the Factory profile. Expected output: 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.. Kind: fixture. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2402,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1325]",
      "number": 1325
    },
    {
      "id": "AIFACTORY-TASK-1326",
      "type": "task",
      "parent": "AIFACTORY-US-302",
      "title": "Verify the scope headers, the workload token and the refusals",
      "sequence": "18.23.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the scope headers, the workload token and the refusals. Expected output: 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).. Kind: verification. Repository: ConnectSoft.ApiLibraryTemplate.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1326]",
      "number": 1326
    },
    {
      "id": "AIFACTORY-US-303",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-180",
      "title": "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",
      "sequence": "18.23.03",
      "description": "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. Kind: enabling. 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.",
      "acceptanceCriteria": [
        "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`)."
      ],
      "sourceArtifacts": [
        "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"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-642",
        "AIFACTORY-TASK-1327",
        "AIFACTORY-TASK-1328"
      ],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2403,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-302",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "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"
      ],
      "titlePrefix": "[AIFACTORY-US-303]",
      "number": 303
    },
    {
      "id": "AIFACTORY-TASK-642",
      "type": "task",
      "parent": "AIFACTORY-US-303",
      "title": "Header propagation and instrumentation",
      "sequence": "18.23.03.01",
      "description": "BEFORE DEVELOPMENT. Header propagation and instrumentation. Expected output: 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.. Kind: implementation. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-642]",
      "number": 642
    },
    {
      "id": "AIFACTORY-TASK-1327",
      "type": "task",
      "parent": "AIFACTORY-US-303",
      "title": "Configuration and Service Discovery pages describe propagation and telemetry",
      "sequence": "18.23.03.02",
      "description": "BEFORE DEVELOPMENT. Configuration and Service Discovery pages describe propagation and telemetry. Expected output: 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.. Kind: documentation. Repository: ConnectSoft.ApiLibraryTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2403,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1327]",
      "number": 1327
    },
    {
      "id": "AIFACTORY-TASK-1328",
      "type": "task",
      "parent": "AIFACTORY-US-303",
      "title": "Verify propagation, telemetry names and the missing-registration failure",
      "sequence": "18.23.03.03",
      "description": "BEFORE DEVELOPMENT. Verify propagation, telemetry names and the missing-registration failure. Expected output: 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.. Kind: verification. Repository: ConnectSoft.ApiLibraryTemplate.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1328]",
      "number": 1328
    },
    {
      "id": "AIFACTORY-US-304",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-180",
      "title": "API library template: the packed template is installed, instantiated for every layout and for the Factory profile, built and tested before the package publishes",
      "sequence": "18.23.04",
      "description": "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. Kind: evidence. 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "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"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1329",
        "AIFACTORY-TASK-1330",
        "AIFACTORY-TASK-1331",
        "AIFACTORY-TASK-643"
      ],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2404,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-301",
        "AIFACTORY-US-302",
        "AIFACTORY-US-303",
        "feature:component-base-template-findings"
      ],
      "source": [
        "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"
      ],
      "titlePrefix": "[AIFACTORY-US-304]",
      "number": 304
    },
    {
      "id": "AIFACTORY-TASK-1329",
      "type": "task",
      "parent": "AIFACTORY-US-304",
      "title": "Installer pipeline instantiates the packed candidate across the layout matrix",
      "sequence": "18.23.04.01",
      "description": "BEFORE DEVELOPMENT. Installer pipeline instantiates the packed candidate across the layout matrix. Expected output: 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.. Kind: operations. Repository: ConnectSoft.ApiLibraryTemplate. Verification: azure-pipelines-template.yml passes every case to the gate hook of the shared installer job and pushes only after them.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2404,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1329]",
      "number": 1329
    },
    {
      "id": "AIFACTORY-TASK-1330",
      "type": "task",
      "parent": "AIFACTORY-US-304",
      "title": "Planted failing case fixture for the gate",
      "sequence": "18.23.04.02",
      "description": "BEFORE DEVELOPMENT. Planted failing case fixture for the gate. Expected output: 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.. Kind: fixture. Repository: ConnectSoft.ApiLibraryTemplate. Verification: the planted run fails at the build stage.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2404,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1330]",
      "number": 1330
    },
    {
      "id": "AIFACTORY-TASK-1331",
      "type": "task",
      "parent": "AIFACTORY-US-304",
      "title": "Maintainer checklist and Roadmap page reconciled with what ships",
      "sequence": "18.23.04.03",
      "description": "BEFORE DEVELOPMENT. Maintainer checklist and Roadmap page reconciled with what ships. Expected output: 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.. Kind: documentation. Repository: ConnectSoft.ApiLibraryTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2404,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1331]",
      "number": 1331
    },
    {
      "id": "AIFACTORY-TASK-643",
      "type": "task",
      "parent": "AIFACTORY-US-304",
      "title": "Generated-solution gate across layouts and the checklist reconciled",
      "sequence": "18.23.04.04",
      "description": "BEFORE DEVELOPMENT. Generated-solution gate across layouts and the checklist reconciled. Expected output: 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).. Kind: verification. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-643]",
      "number": 643
    },
    {
      "id": "AIFACTORY-US-118",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-180",
      "title": "API library template: OpenAPI generation, scope and propagation before the gateway clients is delivered and proven on a generated solution",
      "sequence": "18.23.05",
      "description": "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. Kind: enabling. 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.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "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"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1332",
        "AIFACTORY-TASK-669"
      ],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2405,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-301",
        "AIFACTORY-US-302",
        "AIFACTORY-US-303",
        "AIFACTORY-US-304"
      ],
      "source": [
        "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"
      ],
      "titlePrefix": "[AIFACTORY-US-118]",
      "number": 118
    },
    {
      "id": "AIFACTORY-TASK-1332",
      "type": "task",
      "parent": "AIFACTORY-US-118",
      "title": "Generate a gateway client shape from the published package and run its tests",
      "sequence": "18.23.05.01",
      "description": "BEFORE DEVELOPMENT. Generate a gateway client shape from the published package and run its tests. Expected output: 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).. Kind: verification. Repository: ConnectSoft.ApiLibraryTemplate. Verification: dotnet new install of the published version, dotnet new connectsoft-api-library with `UseFactoryProfile`, dotnet build -c Release, dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "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)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1332]",
      "number": 1332
    },
    {
      "id": "AIFACTORY-TASK-669",
      "type": "task",
      "parent": "AIFACTORY-US-118",
      "title": "Verify api-library-template-factory-clients-delivered by running the declared command",
      "sequence": "18.23.05.02",
      "description": "BEFORE DEVELOPMENT. Verify api-library-template-factory-clients-delivered by running the declared command. Expected output: 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.. Kind: verification. Repository: ConnectSoft.ApiLibraryTemplate.",
      "acceptanceCriteria": [
        "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."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.ApiLibraryTemplate/Docs/Template TODO.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/Roadmap.md",
        "ConnectSoft.ApiLibraryTemplate/Docs/ServiceDiscovery.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.ApiLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 24,
      "phase": "templates-and-libraries",
      "stackRank": 2405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-669]",
      "number": 669
    },
    {
      "id": "AIFACTORY-FEAT-181",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Documentation template: generated sections, a stale check and a packable template for Factory repositories",
      "sequence": "18.24",
      "description": "Every Factory repository publishes a documentation site, and the Documentation site module of a generated product is scaffolded from the documentation template (connectsoft-documentation). The template is a MkDocs Material site with four parameters (title, description, repository URL, build definition), log4brains ADRs, the panzoom, exclude and search plugins and an Azure documentation pipeline; the template inventory records it as empty because it has no project to pack. It knows nothing of the distinction the documentation blueprint draws between generated and hand-written sections (blueprint-documentation.schema.json), has no check that a generated page is current, and no manifest or symbol catalog. The pattern this repository's own generator follows (model, generated pages written only when changed, a check that fails on a stale page, a strict build) becomes the template's. Component: Documentation template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I1: Generate a microservice. Build order 26 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-305",
        "AIFACTORY-US-306",
        "AIFACTORY-US-307",
        "AIFACTORY-US-308",
        "AIFACTORY-US-120"
      ],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2600,
      "titlePrefix": "[AIFACTORY-FEAT-181]",
      "number": 181
    },
    {
      "id": "AIFACTORY-US-305",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-181",
      "title": "Documentation template: a generated site marks each section as generated or hand-written, writes generated pages only on change and fails a check on a stale page",
      "sequence": "18.24.01",
      "description": "As an asset maintainer, I want the documentation template to separate generated sections from hand-written ones and to check that generated pages are current, so that a Factory repository never publishes a generated page that no longer matches its source. The documentation blueprint (docs/reference/schemas/blueprint-documentation.schema.json) describes a site as a template reference and a list of sections, each with an id, a title and a source that is either generated or hand-written. The documentation template scaffolds a MkDocs Material site with four parameters and knows nothing of that distinction: every page is a file somebody edits, and nothing tells a reader or a pipeline which pages a tool owns. This PBI gives the generated site the pattern this documentation repository follows for its own pages. The site carries a sections file beside `mkdocs.yml` that lists each section with its id, its title and its source in the two values of the blueprint. Pages of a generated section live in a folder of that section and carry a marker comment that names their generator. The generated site holds a tool folder `tools/docs_site` with two entry points. `python -I tools/docs_site generate` writes a generated page only when its content changed, so an unchanged run leaves the working tree clean. `python -I tools/docs_site check` regenerates in memory and fails with the list of stale pages when a committed page differs, and fails when a page without the marker sits inside a generated section, because a hand-written page there would be overwritten. A hand-written section is never touched by either command. The documentation pipeline file of the generated site (`azure-pipelines-documentation.yml`) does not build the site itself: it calls the shared documentation step `generate/generate-microservice-documentation-steps.yaml` of ConnectSoft.AzurePipelines, which installs a fixed plugin list and builds without the strict flag. The shared step therefore gains a strict switch, an input for the requirements file of the site and a hook that runs before the build; the pipeline file of the generated site switches the strict build on and passes the check command as the hook, so a failed check stops the run before the build and a build warning fails it. Consumers of the shared step that set neither keep the build of today. The site description of the template README explains the two kinds of section and the two commands. Kind: enabling. Traces: adrs: ADR-0027, ADR-0028. Relates: nfrs: NFR-14. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-documentation.yaml, docs/reference/schemas/blueprint-documentation.schema.json, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given a site generated from the template, when its sections file is read, then every section has an id, a title and a source of generated or hand-written, the two values docs/reference/schemas/blueprint-documentation.schema.json defines, and the pages of a generated section carry the marker of their generator (ADR-0027: a generation input is pinned and reproducible).",
        "AC2: Given an unchanged source, when the generate command runs twice, then the second run writes no file; given a changed source and a committed page that was not regenerated, when the check command runs, then it fails and lists the stale page (ADR-0027, NFR-14: the generated and the preserved parts of a repository stay split).",
        "AC3: Given a page without the generator marker inside a generated section, when `python -I tools/docs_site check` runs, then it fails with the page named, and a page of a hand-written section is changed by neither command; the documentation pipeline of the generated site passes the check as the pre-build hook of the shared documentation step of ConnectSoft.AzurePipelines and switches its strict build on, so a failed check stops the run before the build, and a consumer of the shared step that sets neither switch builds as today (ADR-0028, NFR-14)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1333",
        "AIFACTORY-TASK-644",
        "AIFACTORY-TASK-1424",
        "AIFACTORY-TASK-1334",
        "AIFACTORY-TASK-1335"
      ],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2601,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-14"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-305]",
      "number": 305
    },
    {
      "id": "AIFACTORY-TASK-1333",
      "type": "task",
      "parent": "AIFACTORY-US-305",
      "title": "Sections file of a generated site in the vocabulary of the documentation blueprint",
      "sequence": "18.24.01.01",
      "description": "BEFORE DEVELOPMENT. Sections file of a generated site in the vocabulary of the documentation blueprint. Expected output: The generated site holds a sections file beside `mkdocs.yml` with the id, title and source of each section, the source being generated or hand-written as docs/reference/schemas/blueprint-documentation.schema.json names them, and a schema for that file ships in the template; the marker comment of a generated page is defined on the README of the generated site.. Kind: contract. Repository: ConnectSoft.DocumentationTemplate. Verification: the sections file of a generated site validates against its schema.",
      "acceptanceCriteria": [
        "The generated site holds a sections file beside `mkdocs.yml` with the id, title and source of each section, the source being generated or hand-written as docs/reference/schemas/blueprint-documentation.schema.json names them, and a schema for that file ships in the template; the marker comment of a generated page is defined on the README of the generated site."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2601,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1333]",
      "number": 1333
    },
    {
      "id": "AIFACTORY-TASK-644",
      "type": "task",
      "parent": "AIFACTORY-US-305",
      "title": "Generated and hand-written sections with a stale check",
      "sequence": "18.24.01.02",
      "description": "BEFORE DEVELOPMENT. Generated and hand-written sections with a stale check. Expected output: Sections carry a source marker, generated or hand-written as the documentation blueprint names them. The generated site holds the tool folder `tools/docs_site` with the entry points `python -I tools/docs_site generate`, which writes a generated page only when its content changes, and `python -I tools/docs_site check`, which exits non-zero with the page named when a generated page is stale or when a page without the marker sits inside a generated section; a hand-written section is never touched by either.. Kind: implementation. Repository: ConnectSoft.DocumentationTemplate. Verification: python -I tools/docs_site generate | python -I tools/docs_site check | DISABLE_MKDOCS_2_WARNING=true python -m mkdocs build --strict.",
      "acceptanceCriteria": [
        "Sections carry a source marker, generated or hand-written as the documentation blueprint names them. The generated site holds the tool folder `tools/docs_site` with the entry points `python -I tools/docs_site generate`, which writes a generated page only when its content changes, and `python -I tools/docs_site check`, which exits non-zero with the page named when a generated page is stale or when a page without the marker sits inside a generated section; a hand-written section is never touched by either."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-644]",
      "number": 644
    },
    {
      "id": "AIFACTORY-TASK-1424",
      "type": "task",
      "parent": "AIFACTORY-US-305",
      "title": "Strict switch, requirements input and pre-build hook in the shared documentation step",
      "sequence": "18.24.01.03",
      "description": "BEFORE DEVELOPMENT. Strict switch, requirements input and pre-build hook in the shared documentation step. Expected output: The shared step `generate/generate-microservice-documentation-steps.yaml` gains a strict parameter that adds the strict flag to the MkDocs build, a parameter for a requirements file that replaces the fixed plugin list when it is set, and a parameter for a pre-build command that runs before the build and fails the step on a non-zero exit; all three default to the behaviour of today, so existing consumers are unchanged.. Kind: operations. Repository: ConnectSoft.AzurePipelines. Verification: a consumer run with the strict switch on and a planted build warning fails; a consumer run without the new parameters builds as before.",
      "acceptanceCriteria": [
        "The shared step `generate/generate-microservice-documentation-steps.yaml` gains a strict parameter that adds the strict flag to the MkDocs build, a parameter for a requirements file that replaces the fixed plugin list when it is set, and a parameter for a pre-build command that runs before the build and fails the step on a non-zero exit; all three default to the behaviour of today, so existing consumers are unchanged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2601,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1424]",
      "number": 1424
    },
    {
      "id": "AIFACTORY-TASK-1334",
      "type": "task",
      "parent": "AIFACTORY-US-305",
      "title": "Documentation pipeline of the generated site switches the check and the strict build on",
      "sequence": "18.24.01.04",
      "description": "BEFORE DEVELOPMENT. Documentation pipeline of the generated site switches the check and the strict build on. Expected output: The documentation pipeline file `azure-pipelines-documentation.yml` of the generated site calls the shared documentation step of AIFACTORY-TASK-1424 with the strict switch on, the requirements file of the site and `python -I tools/docs_site check` as the pre-build command, and keeps the log4brains build; a failed check or a build warning fails the run before the site artifact is published.. Kind: operations. Repository: ConnectSoft.DocumentationTemplate. Verification: azure-pipelines-documentation.yml of a generated site fails on a planted stale page and on a planted build warning.",
      "acceptanceCriteria": [
        "The documentation pipeline file `azure-pipelines-documentation.yml` of the generated site calls the shared documentation step of AIFACTORY-TASK-1424 with the strict switch on, the requirements file of the site and `python -I tools/docs_site check` as the pre-build command, and keeps the log4brains build; a failed check or a build warning fails the run before the site artifact is published."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2601,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1334]",
      "number": 1334
    },
    {
      "id": "AIFACTORY-TASK-1335",
      "type": "task",
      "parent": "AIFACTORY-US-305",
      "title": "Verify the idempotent generation, the stale page and the misplaced page",
      "sequence": "18.24.01.05",
      "description": "BEFORE DEVELOPMENT. Verify the idempotent generation, the stale page and the misplaced page. Expected output: On a generated site run `python -I tools/docs_site generate` twice, plant a stale generated page and a page without marker in a generated section, and run `python -I tools/docs_site check`; the second generation writes nothing and both planted pages fail the check by name, and the documentation pipeline of the site stops on the planted page before the build, which proves AC1 to AC3 of AIFACTORY-US-305 (ADR-0027).. Kind: verification. Repository: ConnectSoft.DocumentationTemplate.",
      "acceptanceCriteria": [
        "On a generated site run `python -I tools/docs_site generate` twice, plant a stale generated page and a page without marker in a generated section, and run `python -I tools/docs_site check`; the second generation writes nothing and both planted pages fail the check by name, and the documentation pipeline of the site stops on the planted page before the build, which proves AC1 to AC3 of AIFACTORY-US-305 (ADR-0027)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1335]",
      "number": 1335
    },
    {
      "id": "AIFACTORY-US-306",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-181",
      "title": "Documentation template: the API reference renders from the OpenAPI document of the repository and the ADR section from its log4brains records, so the first build is complete",
      "sequence": "18.24.02",
      "description": "As an asset maintainer, I want the site of a service repository to render its API reference and its decisions from what the repository already holds, so that a freshly scaffolded Factory repository publishes a complete site without a hand-written page. The documentation template carries an `api` folder and an `adr` folder with starter content, a log4brains configuration, and a documentation pipeline that builds the ADRs with log4brains and merges them into the site. Nothing connects those folders to the repository that hosts the site: the API pages are sample text and the home page is the generic one. A Factory service repository holds an OpenAPI document of its REST surface and records its decisions as log4brains records. This PBI makes two sections of the generated site generated sections in the sense of the sections file. The API reference section is produced from the OpenAPI document of the repository, one page per tag with its operations, their parameters, their responses and the scopes they require; the path of the document is a setting of the generate command, and a repository without a document, a library for example, gets no API section and no empty page. The ADR section lists the log4brains records of the repository with their status and links the pages the log4brains build produces. The home page names the site from `siteTitle` and `siteDescription` and the repository from `repoUrl`, and lists the sections of the sections file. With both generated sections a site scaffolded for a service builds strictly on its first run with no page written by hand. The sample API and architecture pages of the template become hand-written starter sections that a repository may delete. Kind: enabling. Traces: adrs: ADR-0027, ADR-0028. Depends on: AIFACTORY-US-305. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-documentation.yaml, docs/reference/schemas/blueprint-documentation.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a generated site in a repository with an OpenAPI document, when the generate command runs, then the API reference section holds one page per tag with the operations, parameters, responses and required scopes of the document, each page carries the generator marker, and the strict build passes (ADR-0028: every service has its own repository and its own published surface; docs/reference/schemas/blueprint-documentation.schema.json names the section source).",
        "AC2: Given a generated site in a repository without an OpenAPI document, when the generate command runs, then no API section and no empty page is produced and the navigation holds no dead entry; the ADR section lists the log4brains records of the repository with their status (ADR-0028, model/templates.yaml row of `connectsoft-documentation`).",
        "AC3: Given a site scaffolded with `siteTitle`, `siteDescription` and `repoUrl` for a service repository, when it is built strictly for the first time, then the build passes with no hand-written page added, and the home page names the site, the repository and the sections (ADR-0027, model/template-parameters/connectsoft-documentation.yaml lists the three parameters)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1336",
        "AIFACTORY-TASK-645",
        "AIFACTORY-TASK-1337"
      ],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2602,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-305"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-306]",
      "number": 306
    },
    {
      "id": "AIFACTORY-TASK-1336",
      "type": "task",
      "parent": "AIFACTORY-US-306",
      "title": "API reference generator over the OpenAPI document of the repository",
      "sequence": "18.24.02.01",
      "description": "BEFORE DEVELOPMENT. API reference generator over the OpenAPI document of the repository. Expected output: The generate command of the generated site reads the OpenAPI document at the configured path and writes one page per tag with operations, parameters, responses and required scopes into the API reference section; without a document it writes no section and removes the navigation entry.. Kind: implementation. Repository: ConnectSoft.DocumentationTemplate. Verification: DISABLE_MKDOCS_2_WARNING=true python -m mkdocs build --strict.",
      "acceptanceCriteria": [
        "The generate command of the generated site reads the OpenAPI document at the configured path and writes one page per tag with operations, parameters, responses and required scopes into the API reference section; without a document it writes no section and removes the navigation entry."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2602,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1336]",
      "number": 1336
    },
    {
      "id": "AIFACTORY-TASK-645",
      "type": "task",
      "parent": "AIFACTORY-US-306",
      "title": "API reference and ADR sections from the repository",
      "sequence": "18.24.02.02",
      "description": "BEFORE DEVELOPMENT. API reference and ADR sections from the repository. Expected output: The API reference section renders from the OpenAPI document of the repository and the ADR section from the log4brains records the template already carries, so a Factory service repository scaffolds a site that is complete on the first build without a hand-written page; the home page names the service from the template parameters; the sample API and architecture pages are marked as hand-written starter sections.. Kind: documentation. Repository: ConnectSoft.DocumentationTemplate. Verification: DISABLE_MKDOCS_2_WARNING=true python -m mkdocs build --strict.",
      "acceptanceCriteria": [
        "The API reference section renders from the OpenAPI document of the repository and the ADR section from the log4brains records the template already carries, so a Factory service repository scaffolds a site that is complete on the first build without a hand-written page; the home page names the service from the template parameters; the sample API and architecture pages are marked as hand-written starter sections."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2602,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-645]",
      "number": 645
    },
    {
      "id": "AIFACTORY-TASK-1337",
      "type": "task",
      "parent": "AIFACTORY-US-306",
      "title": "Verify the first strict build with and without an OpenAPI document",
      "sequence": "18.24.02.03",
      "description": "BEFORE DEVELOPMENT. Verify the first strict build with and without an OpenAPI document. Expected output: Scaffold one site into a fixture repository with an OpenAPI document and log4brains records and one into a repository without a document, generate and build both strictly; the first holds the API pages per tag, the second holds no API section, which proves AC1 to AC3 of AIFACTORY-US-306.. Kind: verification. Repository: ConnectSoft.DocumentationTemplate.",
      "acceptanceCriteria": [
        "Scaffold one site into a fixture repository with an OpenAPI document and log4brains records and one into a repository without a document, generate and build both strictly; the first holds the API pages per tag, the second holds no API section, which proves AC1 to AC3 of AIFACTORY-US-306."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1337]",
      "number": 1337
    },
    {
      "id": "AIFACTORY-US-307",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-181",
      "title": "Documentation template: the repository gains a pack project, a generated site carries `.connectsoft/template-manifest.json` and the package exports its symbol catalog",
      "sequence": "18.24.03",
      "description": "As an asset maintainer, I want the documentation template to pack like the other templates and to record how a site was generated, so that the inventory lists it as a shipping template and a recipe can pin it by id and version. The template inventory of this repository records the documentation template as empty with the reason that it has no project file: the repository holds a nuspec, a solution file and the template configuration, but no project to pack. The internal guide of the template (`build.md` of the template) tells a maintainer to run `dotnet pack` and to update the version in a project file that does not exist, and draws a `Docs` folder where the repository has `docs`. A site generated from the template keeps no record of the template, its version or the values of `siteTitle`, `siteDescription`, `repoUrl` and `buildDefinitionNumber`. This PBI makes the template a packable one and gives it the manifest and the catalog under the file names the library template feature of this epic sets, without inventing others. The repository gains a pack project beside the nuspec so that the inventory finds a project and the package is produced by one command. A generated site carries `.connectsoft/template-manifest.json` with the template id `connectsoft-documentation`, the version of the template package and the value of every parameter; it is preserved, and a regeneration reads it as its input. The package carries `.template.config/template-manifest.schema.json` and `.template.config/symbol-catalog.json`, the catalog produced from the template configuration at pack time with every symbol, its type, default and description. The shapes of the manifest and of the catalog are those of the library template; the template adopts them and defines no variant. The internal guide is corrected to the commands and folders that exist. Kind: enabling. Traces: adrs: ADR-0027, ADR-0028. Depends on: feature:component-library-template-factory-profile. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-documentation.yaml, model/backlog/pbis/component-extensions/component-library-template-factory-profile.yaml, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository with its pack project, when the template inventory of this repository runs, then the row of `connectsoft-documentation` in model/templates.yaml records a project and no longer the status empty, and the packed package installs with `dotnet new install` (ADR-0028 amendment on scaffolding from published templates).",
        "AC2: Given a site generated from the installed package, when its repository is inspected, then `.connectsoft/template-manifest.json` holds the template id `connectsoft-documentation`, the version of the package and the values of `siteTitle`, `siteDescription`, `repoUrl` and `buildDefinitionNumber`, validates against `.template.config/template-manifest.schema.json` of the package and is read as the input of a regeneration (ADR-0027 decision 2 pins a generation input by id, version and hash).",
        "AC3: Given the packed template, when the package is inspected, then `.template.config/symbol-catalog.json` lists every symbol of the template configuration with its type, default and description and equals the symbols of model/template-parameters/connectsoft-documentation.yaml after the next inventory; the file names and shapes are those the library template sets (ADR-0027, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "model/backlog/pbis/component-extensions/component-library-template-factory-profile.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-646",
        "AIFACTORY-TASK-1338",
        "AIFACTORY-TASK-1339",
        "AIFACTORY-TASK-1340",
        "AIFACTORY-TASK-1341"
      ],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2603,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-library-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "model/backlog/pbis/component-extensions/component-library-template-factory-profile.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-307]",
      "number": 307
    },
    {
      "id": "AIFACTORY-TASK-646",
      "type": "task",
      "parent": "AIFACTORY-US-307",
      "title": "A packable template with a manifest and symbol catalog",
      "sequence": "18.24.03.01",
      "description": "BEFORE DEVELOPMENT. A packable template with a manifest and symbol catalog. Expected output: The template gains the pack project the inventory misses, packs and installs like the other templates, and its package carries the manifest schema `.template.config/template-manifest.schema.json` and the symbol catalog `.template.config/symbol-catalog.json` in the shapes the library template defines; the manifest of a generated site is the file `.connectsoft/template-manifest.json`.. Kind: contract. Repository: ConnectSoft.DocumentationTemplate. Verification: DISABLE_MKDOCS_2_WARNING=true python -m mkdocs build --strict.",
      "acceptanceCriteria": [
        "The template gains the pack project the inventory misses, packs and installs like the other templates, and its package carries the manifest schema `.template.config/template-manifest.schema.json` and the symbol catalog `.template.config/symbol-catalog.json` in the shapes the library template defines; the manifest of a generated site is the file `.connectsoft/template-manifest.json`."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2603,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-646]",
      "number": 646
    },
    {
      "id": "AIFACTORY-TASK-1338",
      "type": "task",
      "parent": "AIFACTORY-US-307",
      "title": "Manifest written at generation and catalog produced at pack time",
      "sequence": "18.24.03.02",
      "description": "BEFORE DEVELOPMENT. Manifest written at generation and catalog produced at pack time. Expected output: The template writes `.connectsoft/template-manifest.json` into a generated site with the template id, the package version and the value of every parameter and preserves it on regeneration; a pack step reads the template configuration and writes `.template.config/symbol-catalog.json` into the package.. Kind: implementation. Repository: ConnectSoft.DocumentationTemplate. Verification: the manifest of a generated site validates against the schema of the package.",
      "acceptanceCriteria": [
        "The template writes `.connectsoft/template-manifest.json` into a generated site with the template id, the package version and the value of every parameter and preserves it on regeneration; a pack step reads the template configuration and writes `.template.config/symbol-catalog.json` into the package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1338]",
      "number": 1338
    },
    {
      "id": "AIFACTORY-TASK-1339",
      "type": "task",
      "parent": "AIFACTORY-US-307",
      "title": "Internal guide of the template corrected to the commands and folders that exist",
      "sequence": "18.24.03.03",
      "description": "BEFORE DEVELOPMENT. Internal guide of the template corrected to the commands and folders that exist. Expected output: The internal guide `build.md` of the template names the pack project, the real folder `docs`, the pack and install commands that work and the manifest and catalog files, and no longer refers to a project file or a folder the repository does not hold.. Kind: documentation. Repository: ConnectSoft.DocumentationTemplate. Verification: every command of the guide runs as written on a clean clone.",
      "acceptanceCriteria": [
        "The internal guide `build.md` of the template names the pack project, the real folder `docs`, the pack and install commands that work and the manifest and catalog files, and no longer refers to a project file or a folder the repository does not hold."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2603,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1339]",
      "number": 1339
    },
    {
      "id": "AIFACTORY-TASK-1340",
      "type": "task",
      "parent": "AIFACTORY-US-307",
      "title": "Template inventory of the documentation repository re-run for the packable template",
      "sequence": "18.24.03.04",
      "description": "BEFORE DEVELOPMENT. Template inventory of the documentation repository re-run for the packable template. Expected output: After `python -I tools/docs_model inventory-templates` the row of `connectsoft-documentation` in model/templates.yaml records its project and the status shipping, model/template-parameters/connectsoft-documentation.yaml lists the symbols of the catalog, and docs/architecture/catalogs/templates.md renders the row.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "After `python -I tools/docs_model inventory-templates` the row of `connectsoft-documentation` in model/templates.yaml records its project and the status shipping, model/template-parameters/connectsoft-documentation.yaml lists the symbols of the catalog, and docs/architecture/catalogs/templates.md renders the row."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2603,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1340]",
      "number": 1340
    },
    {
      "id": "AIFACTORY-TASK-1341",
      "type": "task",
      "parent": "AIFACTORY-US-307",
      "title": "Verify the pack, the manifest read-back and the symbol catalog",
      "sequence": "18.24.03.05",
      "description": "BEFORE DEVELOPMENT. Verify the pack, the manifest read-back and the symbol catalog. Expected output: Pack and install the template, generate a site, read the manifest back and compare it with the parameters passed, and compare the catalog of the package with model/template-parameters/connectsoft-documentation.yaml; the three comparisons pass and prove AC1 to AC3 of AIFACTORY-US-307.. Kind: verification. Repository: ConnectSoft.DocumentationTemplate.",
      "acceptanceCriteria": [
        "Pack and install the template, generate a site, read the manifest back and compare it with the parameters passed, and compare the catalog of the package with model/template-parameters/connectsoft-documentation.yaml; the three comparisons pass and prove AC1 to AC3 of AIFACTORY-US-307."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1341]",
      "number": 1341
    },
    {
      "id": "AIFACTORY-US-308",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-181",
      "title": "Documentation template: the packed template is installed, instantiated, checked and built strictly before the package publishes to the ConnectSoft feed",
      "sequence": "18.24.04",
      "description": "As an asset maintainer, I want every change of the documentation template to be gated by the site it generates from the packed candidate, so that a package that would scaffold a site that does not build never reaches the feed. This PBI is the gate of the feature. The installer pipeline of the template (`azure-pipelines-template.yml` of the template) packs the nuspec and pushes the installer package; it neither installs the packed candidate nor generates a site from it, and the internal guide of the template lists a template testing pipeline as a future improvement. The gate turns the local test of that guide into cases of the installer pipeline, which calls the shared installer job of ConnectSoft.AzurePipelines 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, and the hook runs the cases against it after the pack and before the push. A site is instantiated with the four parameters `siteTitle`, `siteDescription`, `repoUrl` and `buildDefinitionNumber` into a fixture repository that holds an OpenAPI document and log4brains records, and a second site into a repository without a document. For each site the Python requirements are installed, the generate command and the check command run, the site is built strictly, the ADRs are built with log4brains, the manifest is read back and the output is scanned for template placeholders that were not replaced. A site that fails any stage fails the run with the case and the stage named, and the push is not reached. A fixture with a planted stale page proves that the check stops the run. Publication follows both cases and 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. This is an evidence PBI: a template feature has no scenario, so the gate names what it proves through `traces.adrs` and its sources. Kind: evidence. Traces: adrs: ADR-0027, ADR-0028. Depends on: AIFACTORY-US-305, AIFACTORY-US-306, AIFACTORY-US-307, feature:component-base-template-findings. Sources: model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-documentation.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the template, when its installer pipeline runs, then the candidate is packed once and installed, the gate hook of the shared installer steps (AIFACTORY-TASK-1426) runs the two cases, a site is instantiated with the four parameters into a repository with an OpenAPI document and into one without, and each site is generated, checked, built strictly, built with log4brains, compared with its manifest and scanned for placeholders (ADR-0028 amendment on scaffolding from published templates; model/template-parameters/connectsoft-documentation.yaml lists the four parameters).",
        "AC2: Given a site fails any stage, when the pipeline evaluates the run, then the gate hook fails the run with the case and the stage named and the push is not reached; a fixture with a planted stale generated page proves that the check stops the run before the build (ADR-0027, model/backlog/epics.yaml states the gate as the completion of the epic).",
        "AC3: Given both cases are green, when the push step runs, then the package is pushed to the ConnectSoft feed with a version that is not on the feed and the version guard of the shared installer steps, which the template switches on, refuses a repeated version with the reason (ADR-0028, docs/architecture/catalogs/templates.md keeps the row of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1342",
        "AIFACTORY-TASK-1343",
        "AIFACTORY-TASK-1344"
      ],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2604,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-305",
        "AIFACTORY-US-306",
        "AIFACTORY-US-307",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-308]",
      "number": 308
    },
    {
      "id": "AIFACTORY-TASK-1342",
      "type": "task",
      "parent": "AIFACTORY-US-308",
      "title": "Installer pipeline instantiates the packed candidate and builds the generated sites",
      "sequence": "18.24.04.01",
      "description": "BEFORE DEVELOPMENT. Installer pipeline instantiates the packed candidate and builds the generated sites. Expected output: 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, and switches on the gate hook and the version guard of AIFACTORY-TASK-1426; the command it passes to the hook instantiates the two site cases, installs the Python requirements, runs the generate and check commands, the strict build and the log4brains build, reads the manifest back and scans for placeholders; the push follows only when both cases passed, and the guard refuses a version that is already on the feed.. Kind: operations. Repository: ConnectSoft.DocumentationTemplate. Verification: azure-pipelines-template.yml passes both site cases to the gate hook of the shared installer job and pushes only after them.",
      "acceptanceCriteria": [
        "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, and switches on the gate hook and the version guard of AIFACTORY-TASK-1426; the command it passes to the hook instantiates the two site cases, installs the Python requirements, runs the generate and check commands, the strict build and the log4brains build, reads the manifest back and scans for placeholders; the push follows only when both cases passed, and the guard refuses a version that is already on the feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2604,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1342]",
      "number": 1342
    },
    {
      "id": "AIFACTORY-TASK-1343",
      "type": "task",
      "parent": "AIFACTORY-US-308",
      "title": "Fixture repositories and a planted stale page for the gate",
      "sequence": "18.24.04.02",
      "description": "BEFORE DEVELOPMENT. Fixture repositories and a planted stale page for the gate. Expected output: The template repository holds a fixture with an OpenAPI document and log4brains records, a fixture without a document, and a planted case whose generated page is stale; the planted case asserts that the run fails at the check stage with the page named and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.DocumentationTemplate. Verification: the planted run fails at the check stage.",
      "acceptanceCriteria": [
        "The template repository holds a fixture with an OpenAPI document and log4brains records, a fixture without a document, and a planted case whose generated page is stale; the planted case asserts that the run fails at the check stage with the page named and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2604,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1343]",
      "number": 1343
    },
    {
      "id": "AIFACTORY-TASK-1344",
      "type": "task",
      "parent": "AIFACTORY-US-308",
      "title": "Verify the gate on a green run and on the planted run",
      "sequence": "18.24.04.03",
      "description": "BEFORE DEVELOPMENT. Verify the gate on a green run and on the planted run. Expected output: One pipeline run with both site cases green reaches publication and one run with the planted stale page fails before it; both runs prove AC1 to AC3 of AIFACTORY-US-308 (ADR-0027, ADR-0028).. Kind: verification. Repository: ConnectSoft.DocumentationTemplate.",
      "acceptanceCriteria": [
        "One pipeline run with both site cases green reaches publication and one run with the planted stale page fails before it; both runs prove AC1 to AC3 of AIFACTORY-US-308 (ADR-0027, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1344]",
      "number": 1344
    },
    {
      "id": "AIFACTORY-US-120",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-181",
      "title": "Documentation template: generated sections, a stale check and a packable template for Factory repositories is delivered and proven on a generated solution",
      "sequence": "18.24.05",
      "description": "As an asset maintainer, I want Documentation template to carry generated sections, a stale check and a packable template for Factory repositories, so that it serves documentation sites of Factory repositories; the Documentation site module of generated products without later rework. This is the integration PBI of the feature. An asset maintainer packs the documentation template with the sections file, the generate and check commands, the API reference and ADR sections, the manifest and the symbol catalog, installs the package and instantiates it in the installer pipeline. Each generated site passes its check and its strict build before the package is allowed to publish; a stale page or a build warning fails the run and blocks publication. The implementation lives in the earlier PBIs of this file; this PBI proves them together on the site a Factory service repository gets. From the published package a site is generated into a fixture repository in the shape of a Factory service, with an OpenAPI document and decision records. Its first strict build is complete with no page written by hand, its manifest names the template, the version and the parameter values, and its documentation pipeline stops on a planted stale page. The feature is done when that site builds from a fresh install of the published package. Repository of the feature: ConnectSoft.DocumentationTemplate. The Documentation site module of a generated product is scaffolded from the same package in a later increment. Kind: enabling. Traces: adrs: ADR-0027, ADR-0028. Depends on: AIFACTORY-US-305, AIFACTORY-US-306, AIFACTORY-US-307, AIFACTORY-US-308. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-documentation.yaml, docs/reference/schemas/blueprint-documentation.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.DocumentationTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then each generated site passes its check and its strict build before the package publishes with a verified version (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-644 (generated and hand-written sections with a stale check) is done, then sections carry a source of generated or hand-written as docs/reference/schemas/blueprint-documentation.schema.json names them, generated pages are written only when their content changes, a check command fails on a stale page and on a hand-written page inside a generated section, and the documentation pipeline runs the check and the strict build (ADR-0027).",
        "AC3: Given the work of AIFACTORY-TASK-645 (API reference and ADR sections from the repository) is done, then the API reference section renders from the OpenAPI document of the repository and the ADR section from its log4brains records, so a Factory service repository scaffolds a site that is complete on the first build without a hand-written page (ADR-0028, model/templates.yaml).",
        "AC4: Given the work of AIFACTORY-TASK-646 (a packable template with a manifest and symbol catalog) is done, then the template has the pack project the inventory misses, a generated site carries `.connectsoft/template-manifest.json` with the template id and version, the package carries `.template.config/symbol-catalog.json`, and the pipeline instantiates the packed template, builds the site strictly and publishes the package to the ConnectSoft feed with a verified version (ADR-0027, model/template-parameters/connectsoft-documentation.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1345",
        "AIFACTORY-TASK-679"
      ],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2605,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0027",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-305",
        "AIFACTORY-US-306",
        "AIFACTORY-US-307",
        "AIFACTORY-US-308"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-documentation.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-120]",
      "number": 120
    },
    {
      "id": "AIFACTORY-TASK-1345",
      "type": "task",
      "parent": "AIFACTORY-US-120",
      "title": "Generate the site of a Factory service repository shape from the published package",
      "sequence": "18.24.05.01",
      "description": "BEFORE DEVELOPMENT. Generate the site of a Factory service repository shape from the published package. Expected output: A probe installs the published template package, generates a site into a fixture repository in the shape of a Factory service, runs the generate and check commands and the strict build, and plants a stale page that the documentation pipeline of the site refuses; the run proves AC2 to AC4 of AIFACTORY-US-120 on the published package (ADR-0027, ADR-0028).. Kind: verification. Repository: ConnectSoft.DocumentationTemplate. Verification: dotnet new install of the published version, dotnet new connectsoft-documentation, the check command, python -m mkdocs build --strict.",
      "acceptanceCriteria": [
        "A probe installs the published template package, generates a site into a fixture repository in the shape of a Factory service, runs the generate and check commands and the strict build, and plants a stale page that the documentation pipeline of the site refuses; the run proves AC2 to AC4 of AIFACTORY-US-120 on the published package (ADR-0027, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1345]",
      "number": 1345
    },
    {
      "id": "AIFACTORY-TASK-679",
      "type": "task",
      "parent": "AIFACTORY-US-120",
      "title": "Verify documentation-template-factory-docs-delivered by running the declared command",
      "sequence": "18.24.05.02",
      "description": "BEFORE DEVELOPMENT. Verify documentation-template-factory-docs-delivered by running the declared command. Expected output: Run `DISABLE_MKDOCS_2_WARNING=true python -m mkdocs build --strict` on the template site and on every generated site of the gate after the published package is installed; it passes and proves AC1 to AC4 of AIFACTORY-US-120.. Kind: verification. Repository: ConnectSoft.DocumentationTemplate.",
      "acceptanceCriteria": [
        "Run `DISABLE_MKDOCS_2_WARNING=true python -m mkdocs build --strict` on the template site and on every generated site of the gate after the published package is installed; it passes and proves AC1 to AC4 of AIFACTORY-US-120."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json",
        "ConnectSoft.DocumentationTemplate/build.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.DocumentationTemplate"
      ],
      "children": [],
      "buildOrder": 26,
      "phase": "templates-and-libraries",
      "stackRank": 2605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-679]",
      "number": 679
    },
    {
      "id": "AIFACTORY-FEAT-184",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "AI skills library template: skill packages the registry publishes and the agent host loads",
      "sequence": "18.25",
      "description": "A skill the Factory publishes as an asset (AssetKind Skill in AgentRegistryService, SkillManifest in asset-manifests.schema.json) may be implemented as a compiled package of AIFunctions; the AI skills library template (connectsoft-aiskills-library) scaffolds such a package on the Microsoft Agent Framework with an orchestrator function and supporting functions, immutable request and result records, typed error codes, redaction through Microsoft.Extensions.Compliance and ConnectSoft.Extensions.Compliance, an embeddings pipeline on Microsoft.Extensions.VectorData, an MCP tool wrapper and a Microsoft Learn MCP client, with contract, serialization, DI and telemetry tests. Its pages are out of step with its code: the Features page is the library template''s copied (UseDI and UseTracing where the symbols are useDI and no tracing switch exists), the versioning page names Semantic Kernel and .NET 8 and 9 while the code is on the Agent Framework (ADR-0002) and net10, and a Framework choice and a targetFrameworks string coexist. For the Factory the package must carry its SkillManifest, expose its functions as governed tools under the caller''s scope, redact and measure on the Factory conventions, and build across its parameters before the package publishes. Generating skill packages from skill definitions belongs to the Factory assets epic once the chain runs. Component: AI skills library template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-183, AIFACTORY-FEAT-090, AIFACTORY-FEAT-098, AIFACTORY-FEAT-175, AIFACTORY-FEAT-177. Increment I1: Generate a microservice. Build order 27 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-309",
        "AIFACTORY-US-310",
        "AIFACTORY-US-311",
        "AIFACTORY-US-312",
        "AIFACTORY-US-313",
        "AIFACTORY-US-121"
      ],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2700,
      "titlePrefix": "[AIFACTORY-FEAT-184]",
      "number": 184
    },
    {
      "id": "AIFACTORY-US-309",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-184",
      "title": "AI skills library template: under `UseFactoryProfile` the generated package carries a SkillManifest that validates against the schema and names every function of the package",
      "sequence": "18.25.01",
      "description": "As an asset maintainer, I want a skill package generated from the template to carry the manifest the registry needs, so that the package can be submitted as a Skill release candidate without a manifest written by hand. AgentRegistryService publishes a skill as an asset of kind Skill, and the SkillManifest of docs/reference/schemas/asset-manifests.schema.json is its document: id, version, name, purpose, inputs and outputs are required, and requires, compatibility, tests, evaluations and failure modes are optional. The AI skills library template scaffolds a package of AIFunctions on the Microsoft Agent Framework with an orchestrator function and supporting functions, immutable request and result records and typed error codes, but nothing in the generated package describes it as a skill. This PBI adds the manifest as part of the Factory shape of the template. The amendment of ADR-0028 on the Factory profile switch puts the Factory shape of every template behind the boolean parameter `UseFactoryProfile`, off by default, so that other generations do not change; this PBI defines that parameter for the template, and the later PBIs of this file put their work under it. The template also gains parameters for the skill id and the purpose, which take effect only under the profile; the name comes from the library name. Under the profile the generated package holds a manifest file beside the code that is packed into the package. Its inputs and outputs name the request and result records of the functions with their descriptors, `compatibility.libraries` lists the packages the library pins, `tests` lists the test projects and `evaluations` names the suites the release gate runs. The manifest holds no evaluation result: the evaluation record of ADR-0021 is attached by the gate when the candidate is evaluated, not by the package. A test of the generated solution validates the manifest against the schema, which the solution takes from the contracts package by a version pin made only under the profile, and a second test fails when a function of the package is missing from the manifest or the manifest names a function that does not exist. The manifest is what a maintainer submits to AgentRegistryService as the release candidate, with the hash of the package in the dependency closure. A package generated without the profile equals the output of the current template: it holds no manifest, restores no Factory package and ignores the two parameters. Kind: enabling. Traces: adrs: ADR-0002, ADR-0021; descriptors: skill-manifest-v1. Depends on: feature:contracts-package. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-aiskills-library.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/reference/schemas/asset-manifests.schema.json, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a skill package generated with `UseFactoryProfile`, when its manifest is validated, then it holds the required fields id, version, name, purpose, inputs and outputs of the SkillManifest of docs/reference/schemas/asset-manifests.schema.json, validates against that schema and is contained in the packed package (skill-manifest-v1, ADR-0021 decision 2: a skill release candidate is evaluated on its declared profile).",
        "AC2: Given a function added to a package generated with the profile without a manifest entry, or a manifest entry without a function, when the unit tests run, then the drift test fails with the function named (skill-manifest-v1, model/services/control-plane/AgentRegistryService.yaml keeps the dependency closure of a release).",
        "AC3: Given the generated manifest, when it is inspected, then `compatibility.libraries` lists the pinned packages, `tests` the test projects and `evaluations` the suites to run, and it holds no evaluation result, because the evidence of ADR-0021 decision 3 is an artifact the gate attaches to the release.",
        "AC4: Given a package generated without `UseFactoryProfile`, when its output is compared with the output of the current template, then the two are equal: it holds no manifest file, its central package management pins no Factory package and the skill id and purpose parameters change no file; `UseFactoryProfile` and the two parameters appear in model/template-parameters/connectsoft-aiskills-library.yaml after the next inventory (docs/architecture/adr/0028-one-repository-and-deployable-per-service.md amendment on the Factory profile switch: off by default, so other generations do not change)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-650",
        "AIFACTORY-TASK-1346",
        "AIFACTORY-TASK-1347",
        "AIFACTORY-TASK-1348"
      ],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2701,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0002",
          "ADR-0021"
        ],
        "descriptors": [
          "skill-manifest-v1"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-309]",
      "number": 309
    },
    {
      "id": "AIFACTORY-TASK-650",
      "type": "task",
      "parent": "AIFACTORY-US-309",
      "title": "Skill manifest in the generated package",
      "sequence": "18.25.01.01",
      "description": "BEFORE DEVELOPMENT. Skill manifest in the generated package. Expected output: Under `UseFactoryProfile` the generated package carries a SkillManifest with id, version, name, purpose, inputs, outputs, requires, `compatibility.libraries`, tests and evaluations as docs/reference/schemas/asset-manifests.schema.json defines them, produced from the template parameters and kept beside the code, with the functions of the package as its inputs and outputs; the manifest is what AgentRegistryService takes as a Skill release candidate with the package hash in its closure, and the evaluation record of ADR-0021 is attached by the gate, not by the package.. Kind: contract. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` the generated package carries a SkillManifest with id, version, name, purpose, inputs, outputs, requires, `compatibility.libraries`, tests and evaluations as docs/reference/schemas/asset-manifests.schema.json defines them, produced from the template parameters and kept beside the code, with the functions of the package as its inputs and outputs; the manifest is what AgentRegistryService takes as a Skill release candidate with the package hash in its closure, and the evaluation record of ADR-0021 is attached by the gate, not by the package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2701,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-650]",
      "number": 650
    },
    {
      "id": "AIFACTORY-TASK-1346",
      "type": "task",
      "parent": "AIFACTORY-US-309",
      "title": "`UseFactoryProfile`, the skill id and purpose parameters and the packed manifest file",
      "sequence": "18.25.01.02",
      "description": "BEFORE DEVELOPMENT. `UseFactoryProfile`, the skill id and purpose parameters and the packed manifest file. Expected output: The template configuration defines the boolean parameter `UseFactoryProfile`, off by default, and parameters for the skill id and the purpose that take effect only under it. Under the profile the project file of the generated library packs the manifest file into the package and the central package management pins the contracts package from which the schema is read; without the profile neither the manifest file, the pack entry nor the pin is generated.. Kind: implementation. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet new connectsoft-aiskills-library --help lists `UseFactoryProfile`, the skill id and the purpose; dotnet pack -c Release of a profile package contains the manifest.",
      "acceptanceCriteria": [
        "The template configuration defines the boolean parameter `UseFactoryProfile`, off by default, and parameters for the skill id and the purpose that take effect only under it. Under the profile the project file of the generated library packs the manifest file into the package and the central package management pins the contracts package from which the schema is read; without the profile neither the manifest file, the pack entry nor the pin is generated."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1346]",
      "number": 1346
    },
    {
      "id": "AIFACTORY-TASK-1347",
      "type": "task",
      "parent": "AIFACTORY-US-309",
      "title": "Schema validation, manifest drift and unchanged-default tests",
      "sequence": "18.25.01.03",
      "description": "BEFORE DEVELOPMENT. Schema validation, manifest drift and unchanged-default tests. Expected output: The unit test project of a package generated with the profile holds a test that validates the manifest against the SkillManifest schema and a test that compares the functions of the package with the manifest entries and fails with the differing function named. The template repository holds a comparison that generates a package without the profile and fails when its files differ from the recorded output of the current template or when its central package file names a Factory package.. Kind: fixture. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project of a package generated with the profile holds a test that validates the manifest against the SkillManifest schema and a test that compares the functions of the package with the manifest entries and fails with the differing function named. The template repository holds a comparison that generates a package without the profile and fails when its files differ from the recorded output of the current template or when its central package file names a Factory package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2701,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1347]",
      "number": 1347
    },
    {
      "id": "AIFACTORY-TASK-1348",
      "type": "task",
      "parent": "AIFACTORY-US-309",
      "title": "Verify the manifest against the schema and the drift test",
      "sequence": "18.25.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the manifest against the schema and the drift test. Expected output: Generate a package with `UseFactoryProfile`, validate its manifest against docs/reference/schemas/asset-manifests.schema.json, add a function without a manifest entry and run the tests, then generate a package without the profile and run the comparison; the validation passes, the drift test fails by name and the default output equals the current template, which proves AC1 to AC4 of AIFACTORY-US-309 (skill-manifest-v1).. Kind: verification. Repository: ConnectSoft.AISkillsLibraryTemplate.",
      "acceptanceCriteria": [
        "Generate a package with `UseFactoryProfile`, validate its manifest against docs/reference/schemas/asset-manifests.schema.json, add a function without a manifest entry and run the tests, then generate a package without the profile and run the comparison; the validation passes, the drift test fails by name and the default output equals the current template, which proves AC1 to AC4 of AIFACTORY-US-309 (skill-manifest-v1)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1348]",
      "number": 1348
    },
    {
      "id": "AIFACTORY-US-310",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-184",
      "title": "AI skills library template: under `UseFactoryProfile` every AIFunction declares a tool descriptor, runs under the scope of the caller and is exposed through the MCP library",
      "sequence": "18.25.02",
      "description": "As an asset maintainer, I want the functions of a generated skill package to be governed tools that run under the scope of their caller, so that no function of a skill is reachable outside the governed tool path. The template exposes its functions in two ways: as AIFunctions an agent calls in process, and through its own wrapper `LibraryTemplateAgentMcpTool`, registered together with a Microsoft Learn MCP client by one extension. Neither path knows a tenant, a project or a side-effect class. ADR-0022 makes every tool an MCP capability with a descriptor in the tool registry and sends every call through the governed executor, and the MCP library of this epic authenticates every server by default and passes the scope of the authenticated caller to the tool handler. This PBI puts the governed tool path under the parameter `UseFactoryProfile` that AIFACTORY-US-309 defines. Under the profile every AIFunction has a `tool-descriptor-v1` document with its JSON schema, its side-effect class, its timeout, retry and rate limits and its audit requirements, packed beside the manifest. The manifest itself holds no descriptor: its `requires` is an object of three string arrays and the schema admits no further property, so `requires.tools` names by tool id only the tools the skill calls, which in a generated package are the supporting functions its orchestrator calls, and the functions the package exposes are named in `inputs` and `outputs` as AIFACTORY-US-309 defines. A function executes under the tenant and project the scope accessor of `ConnectSoft.Extensions.AI.Factory.Abstractions` delivers; the package pins that library and defines no scope type. A function resolved or called without a scope is refused. The wrapper of the template is replaced by exposure through `ConnectSoft.Extensions.ModelContextProtocol` with authorization on, so a call without a token is refused by the library and the template carries no server code of its own. The Microsoft Learn client stays in the template as a sample of an MCP client; under the profile it is not registered as a tool of the skill. Without the profile the package keeps the wrapper and the registration of today. Kind: enabling. Traces: adrs: ADR-0022; descriptors: tool-descriptor-v1, tool-invocation-v1. Depends on: AIFACTORY-US-309, feature:component-mcp, feature:component-extensions-ai, feature:contracts-package. Sources: model/components.yaml, model/template-parameters/connectsoft-aiskills-library.yaml, docs/reference/schemas/asset-manifests.schema.json, docs/architecture/adr/0022-mcp-as-tool-protocol.md.",
      "acceptanceCriteria": [
        "AC1: Given a package generated with `UseFactoryProfile`, when it is packed and inspected, then every AIFunction has a `tool-descriptor-v1` document packed beside the manifest with schema, side-effect class, timeout, retry, rate limit and audit fields, a test fails when a function has none, `requires.tools` of the manifest holds tool ids only, every one of which resolves to a packed descriptor, and the manifest still validates against docs/reference/schemas/asset-manifests.schema.json (tool-descriptor-v1, ADR-0022 decision 3).",
        "AC2: Given the same package and no scope in the scope accessor, when a function is resolved from the container or invoked, then the call is refused with an error that names the missing scope; with a scope the function runs and its invocation record carries the tenant and the project (tool-invocation-v1, ADR-0022 decision 2).",
        "AC3: Given a host that maps the functions of the package through the MCP library, when a client calls a tool without a token, then the call is refused with 401, and the generated code holds no `LibraryTemplateAgentMcpTool` and no server code of its own (ADR-0022 decision 4: authentication is on by default; docs/architecture/adr/0022-mcp-as-tool-protocol.md).",
        "AC4: Given a package generated without `UseFactoryProfile`, when its output is compared with the output of the current template, then it is unchanged: it keeps the wrapper and the registration of today and holds no descriptor document (ADR-0022; tool-descriptor-v1 is required only under the profile; model/template-parameters/connectsoft-aiskills-library.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1349",
        "AIFACTORY-TASK-651",
        "AIFACTORY-TASK-1350",
        "AIFACTORY-TASK-1351"
      ],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2702,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0022"
        ],
        "descriptors": [
          "tool-descriptor-v1",
          "tool-invocation-v1"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-309",
        "feature:component-mcp",
        "feature:component-extensions-ai",
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "docs/architecture/adr/0022-mcp-as-tool-protocol.md"
      ],
      "titlePrefix": "[AIFACTORY-US-310]",
      "number": 310
    },
    {
      "id": "AIFACTORY-TASK-1349",
      "type": "task",
      "parent": "AIFACTORY-US-310",
      "title": "A tool descriptor document per function, packed beside the manifest",
      "sequence": "18.25.02.01",
      "description": "BEFORE DEVELOPMENT. A tool descriptor document per function, packed beside the manifest. Expected output: Under `UseFactoryProfile`, the parameter AIFACTORY-TASK-1346 defines, every AIFunction of the generated package has a `tool-descriptor-v1` document with schema, side-effect class, limits and audit fields in the shape of the contracts package, and the project file packs the documents beside the manifest; `requires.tools` of the manifest names by tool id the tools the skill calls and holds no descriptor.. Kind: contract. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet pack -c Release of a profile package contains one descriptor document per function.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile`, the parameter AIFACTORY-TASK-1346 defines, every AIFunction of the generated package has a `tool-descriptor-v1` document with schema, side-effect class, limits and audit fields in the shape of the contracts package, and the project file packs the documents beside the manifest; `requires.tools` of the manifest names by tool id the tools the skill calls and holds no descriptor."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2702,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1349]",
      "number": 1349
    },
    {
      "id": "AIFACTORY-TASK-651",
      "type": "task",
      "parent": "AIFACTORY-US-310",
      "title": "AIFunctions as governed tools under the scope of the caller",
      "sequence": "18.25.02.02",
      "description": "BEFORE DEVELOPMENT. AIFunctions as governed tools under the scope of the caller. Expected output: Under the profile every AIFunction executes under the tenant and project scope the pinned scope accessor delivers and refuses a call without scope; the wrapper `LibraryTemplateAgentMcpTool` of the template is replaced by exposure through `ConnectSoft.Extensions.ModelContextProtocol` with authorization on; the Microsoft Learn client stays as a sample client and is not registered as a tool of the skill.. Kind: implementation. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under the profile every AIFunction executes under the tenant and project scope the pinned scope accessor delivers and refuses a call without scope; the wrapper `LibraryTemplateAgentMcpTool` of the template is replaced by exposure through `ConnectSoft.Extensions.ModelContextProtocol` with authorization on; the Microsoft Learn client stays as a sample client and is not registered as a tool of the skill."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2702,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-651]",
      "number": 651
    },
    {
      "id": "AIFACTORY-TASK-1350",
      "type": "task",
      "parent": "AIFACTORY-US-310",
      "title": "Dependency injection and MCP refusal tests of the generated package",
      "sequence": "18.25.02.03",
      "description": "BEFORE DEVELOPMENT. Dependency injection and MCP refusal tests of the generated package. Expected output: The test projects of a package generated with the profile hold a dependency injection test that proves a function cannot be resolved without the scope accessor, an invocation test without scope, a descriptor completeness test, a test that every id in `requires.tools` resolves to a packed descriptor document, and an acceptance test in which an MCP call without a token is refused with 401.. Kind: fixture. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The test projects of a package generated with the profile hold a dependency injection test that proves a function cannot be resolved without the scope accessor, an invocation test without scope, a descriptor completeness test, a test that every id in `requires.tools` resolves to a packed descriptor document, and an acceptance test in which an MCP call without a token is refused with 401."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2702,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1350]",
      "number": 1350
    },
    {
      "id": "AIFACTORY-TASK-1351",
      "type": "task",
      "parent": "AIFACTORY-US-310",
      "title": "Verify descriptors, scope refusal and MCP authorization on a generated package",
      "sequence": "18.25.02.04",
      "description": "BEFORE DEVELOPMENT. Verify descriptors, scope refusal and MCP authorization on a generated package. Expected output: Generate one package with `UseFactoryProfile` and one without, build and test both; the tests of AIFACTORY-TASK-1350 pass on the first and the second is unchanged, which proves AC1 to AC4 of AIFACTORY-US-310 (ADR-0022, tool-descriptor-v1).. Kind: verification. Repository: ConnectSoft.AISkillsLibraryTemplate.",
      "acceptanceCriteria": [
        "Generate one package with `UseFactoryProfile` and one without, build and test both; the tests of AIFACTORY-TASK-1350 pass on the first and the second is unchanged, which proves AC1 to AC4 of AIFACTORY-US-310 (ADR-0022, tool-descriptor-v1)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1351]",
      "number": 1351
    },
    {
      "id": "AIFACTORY-US-311",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-184",
      "title": "AI skills library template: redaction uses the Factory data classes, telemetry carries no payload and the embeddings pipeline takes its store from the host profile",
      "sequence": "18.25.03",
      "description": "As an asset maintainer, I want a generated skill package to redact, measure and embed on the conventions of the Factory, so that a skill never logs a prompt, never names its own redactor and never chooses a vector store for a tenant. The template registers its own redactor through Microsoft.Extensions.Compliance and ConnectSoft.Extensions.Compliance, emits activities and meters through `LibraryTemplateTelemetry`, `AgentFrameworkMetrics` and `LibraryTemplateMetrics`, and registers an embeddings pipeline on Microsoft.Extensions.VectorData with a store of its own choice. ADR-0019 decision 3 forbids a prompt, a response or a tool output in a log, a trace or a metric; the Compliance library of this epic carries the Factory data classes and redaction profiles; the observability libraries carry the telemetry conventions as one registration; and ADR-0013 makes the vector backend a profile whose authorized scope is supplied by the trusted host and enforced before selection. This PBI moves the generated package onto those three under `UseFactoryProfile`. Redaction applies the data classes and the redaction profile of the Compliance library to the request and result records, and the redactor registration of the template is removed under the profile. The activities and meters keep their purpose but take their names, their scope tags and their bounded dimensions from the single registration of the observability libraries, and no prompt, completion, tool output or embedded text is written to a tag, a dimension or a log message. The embeddings pipeline resolves its vector store from the host, which registers the store of its profile; the package registers none, and an upsert or a search without a scope is refused. A telemetry test collects the tags of every activity and compares them with an allow list. Kind: enabling. Traces: adrs: ADR-0013, ADR-0019. Depends on: AIFACTORY-US-310, feature:component-compliance-factory-classifications, feature:component-observability-factory-conventions. Sources: model/components.yaml, model/template-parameters/connectsoft-aiskills-library.yaml, docs/architecture/adr/0013-vector-store-profiles.md, docs/architecture/adr/0019-data-governance.md.",
      "acceptanceCriteria": [
        "AC1: Given a package generated with `UseFactoryProfile`, when a request with a field of a Factory data class is processed, then the logged and traced forms of the request and the result are redacted by the profile of the Compliance library and the generated code holds no redactor registration of its own (ADR-0019 decision 3, model/components.yaml row of the Compliance library).",
        "AC2: Given the same package, when a function runs under an activity listener and a meter listener, then the activity and meter names and the scope tags are those of the single registration of the observability libraries, the metric dimensions are bounded, and the telemetry test finds no prompt, completion, tool output or embedded text in any tag, dimension or log message (ADR-0019 decision 3).",
        "AC3: Given a host that registers the vector store of its profile, when the embeddings pipeline of the package upserts and searches, then it uses that store and registers none of its own, and an upsert or a search without a scope is refused, as ADR-0013 decision 1 requires the authorized scope to come from the trusted host."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-652",
        "AIFACTORY-TASK-1352",
        "AIFACTORY-TASK-1353"
      ],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2703,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0013",
          "ADR-0019"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-310",
        "feature:component-compliance-factory-classifications",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "docs/architecture/adr/0013-vector-store-profiles.md",
        "docs/architecture/adr/0019-data-governance.md"
      ],
      "titlePrefix": "[AIFACTORY-US-311]",
      "number": 311
    },
    {
      "id": "AIFACTORY-TASK-652",
      "type": "task",
      "parent": "AIFACTORY-US-311",
      "title": "Redaction, telemetry and embeddings on the Factory conventions",
      "sequence": "18.25.03.01",
      "description": "BEFORE DEVELOPMENT. Redaction, telemetry and embeddings on the Factory conventions. Expected output: Under the profile redaction uses the Factory data classes and redaction profiles of the Compliance library in place of the redactor registration of the template; the activities and meters of `LibraryTemplateTelemetry`, `AgentFrameworkMetrics` and `LibraryTemplateMetrics` follow the single registration of the observability libraries and carry no prompt, completion or tool output (ADR-0019); the embeddings pipeline takes its store from the vector store profile of the host (ADR-0013) and refuses a call without scope.. Kind: implementation. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under the profile redaction uses the Factory data classes and redaction profiles of the Compliance library in place of the redactor registration of the template; the activities and meters of `LibraryTemplateTelemetry`, `AgentFrameworkMetrics` and `LibraryTemplateMetrics` follow the single registration of the observability libraries and carry no prompt, completion or tool output (ADR-0019); the embeddings pipeline takes its store from the vector store profile of the host (ADR-0013) and refuses a call without scope."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-652]",
      "number": 652
    },
    {
      "id": "AIFACTORY-TASK-1352",
      "type": "task",
      "parent": "AIFACTORY-US-311",
      "title": "Payload-absence and redaction tests of the generated package",
      "sequence": "18.25.03.02",
      "description": "BEFORE DEVELOPMENT. Payload-absence and redaction tests of the generated package. Expected output: The unit test project of a package generated with the profile holds a telemetry test that compares the tags and dimensions of every activity and meter with an allow list and fails with the tag named, a redaction test over the request and result records, and an embeddings test with an in-memory store registered by the test host.. Kind: fixture. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project of a package generated with the profile holds a telemetry test that compares the tags and dimensions of every activity and meter with an allow list and fails with the tag named, a redaction test over the request and result records, and an embeddings test with an in-memory store registered by the test host."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1352]",
      "number": 1352
    },
    {
      "id": "AIFACTORY-TASK-1353",
      "type": "task",
      "parent": "AIFACTORY-US-311",
      "title": "Verify redaction, payload absence and the host vector store",
      "sequence": "18.25.03.03",
      "description": "BEFORE DEVELOPMENT. Verify redaction, payload absence and the host vector store. Expected output: Generate a package with `UseFactoryProfile`, build and run the tests of AIFACTORY-TASK-1352, then add a payload tag to a sample and rerun; the first run passes and the second fails with the tag named, which proves AC1 to AC3 of AIFACTORY-US-311 (ADR-0013, ADR-0019).. Kind: verification. Repository: ConnectSoft.AISkillsLibraryTemplate.",
      "acceptanceCriteria": [
        "Generate a package with `UseFactoryProfile`, build and run the tests of AIFACTORY-TASK-1352, then add a payload tag to a sample and rerun; the first run passes and the second fails with the tag named, which proves AC1 to AC3 of AIFACTORY-US-311 (ADR-0013, ADR-0019)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1353]",
      "number": 1353
    },
    {
      "id": "AIFACTORY-US-312",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-184",
      "title": "AI skills library template: one target-frameworks parameter, the template manifest and symbol catalog of the library template, and pages that describe the code",
      "sequence": "18.25.04",
      "description": "As an asset maintainer, I want the parameters and the pages of the AI skills library template to say what the template does, so that a maintainer who reads the pages generates the package the pages describe. The pages of the template are out of step with its code. The Features page is a copy of the page of the library template: it lists `UseDI`, `UseLogging`, `UseOptions`, `UseMetrics` and `UseTracing`, while the template configuration defines `useDI`, `useOptions`, `useLogging`, `useMetrics`, `targetFrameworks`, `Framework`, `buildDefinitionNumber` and `SkipRestore` and has no tracing switch; it promises health check endpoints a class library does not host and multi-targeting of two frameworks. The versioning page (`TEMPLATE_VERSIONING.md` of the template) names Semantic Kernel and two older frameworks, while the README and the code are on the Microsoft Agent Framework, which ADR-0002 chose, and target the framework of the Factory backend. A `Framework` choice, a `targetFrameworks` string and a generated override symbol coexist. This PBI reconciles them. The template adopts the target-frameworks parameter of the library template with the same name and semantics, so both library templates are driven the same way, and the `Framework` choice keeps its meaning as the primary moniker. A generated repository carries the manifest `.connectsoft/template-manifest.json` with the template id `connectsoft-aiskills-library`, the package version and the parameter values, and the package carries `.template.config/template-manifest.schema.json` and `.template.config/symbol-catalog.json`, in the names and shapes the library template sets. The Features page lists the real parameters and drops what the template does not have; the versioning page names the Agent Framework and the frameworks the template targets. Kind: enabling. Traces: adrs: ADR-0002. Depends on: feature:component-library-template-factory-profile. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-aiskills-library.yaml, model/template-parameters/connectsoft-library.yaml, model/backlog/pbis/component-extensions/component-library-template-factory-profile.yaml, docs/architecture/adr/0002-microsoft-agent-framework-over-semantic-kernel.md.",
      "acceptanceCriteria": [
        "AC1: Given the template, when a package is generated with the target-frameworks parameter set to the single framework of the Factory backend, then the library and its test projects target that framework only, and the parameter has the name and the semantics the library template defines in model/template-parameters/connectsoft-library.yaml (ADR-0002, model/template-parameters/connectsoft-aiskills-library.yaml lists it after the next inventory).",
        "AC2: Given a generated package, when its repository and the template package are inspected, then `.connectsoft/template-manifest.json` holds the template id `connectsoft-aiskills-library`, the package version and every parameter value, and the package holds `.template.config/template-manifest.schema.json` and `.template.config/symbol-catalog.json` in the shapes of the library template (ADR-0002, model/backlog/pbis/component-extensions/component-library-template-factory-profile.yaml sets the names).",
        "AC3: Given the pages of the template, when they are compared with the template configuration, then the Features page lists exactly the parameters of model/template-parameters/connectsoft-aiskills-library.yaml, names no tracing switch and no health endpoint, and the versioning page names the Microsoft Agent Framework that ADR-0002 chose and the frameworks the template targets."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "model/backlog/pbis/component-extensions/component-library-template-factory-profile.yaml",
        "docs/architecture/adr/0002-microsoft-agent-framework-over-semantic-kernel.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1354",
        "AIFACTORY-TASK-1355",
        "AIFACTORY-TASK-1356",
        "AIFACTORY-TASK-1357"
      ],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2704,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0002"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-library-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "model/template-parameters/connectsoft-library.yaml",
        "model/backlog/pbis/component-extensions/component-library-template-factory-profile.yaml",
        "docs/architecture/adr/0002-microsoft-agent-framework-over-semantic-kernel.md"
      ],
      "titlePrefix": "[AIFACTORY-US-312]",
      "number": 312
    },
    {
      "id": "AIFACTORY-TASK-1354",
      "type": "task",
      "parent": "AIFACTORY-US-312",
      "title": "Target-frameworks parameter as the library template defines it",
      "sequence": "18.25.04.01",
      "description": "BEFORE DEVELOPMENT. Target-frameworks parameter as the library template defines it. Expected output: The template configuration replaces the free `targetFrameworks` string and the generated override symbol by the target-frameworks parameter of the library template, with the same name, values and default; the project files of the library and of the two test projects follow the chosen set and `Framework` stays the primary moniker.. Kind: contract. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet new connectsoft-aiskills-library --help lists the parameter with the values of the library template.",
      "acceptanceCriteria": [
        "The template configuration replaces the free `targetFrameworks` string and the generated override symbol by the target-frameworks parameter of the library template, with the same name, values and default; the project files of the library and of the two test projects follow the chosen set and `Framework` stays the primary moniker."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2704,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1354]",
      "number": 1354
    },
    {
      "id": "AIFACTORY-TASK-1355",
      "type": "task",
      "parent": "AIFACTORY-US-312",
      "title": "Template manifest written at generation and symbol catalog exported at pack time",
      "sequence": "18.25.04.02",
      "description": "BEFORE DEVELOPMENT. Template manifest written at generation and symbol catalog exported at pack time. Expected output: The template writes `.connectsoft/template-manifest.json` into the generated repository with the template id, the package version and every parameter value and preserves it on regeneration; a pack step writes `.template.config/symbol-catalog.json` beside `.template.config/template-manifest.schema.json` into the package, in the shapes of the library template.. Kind: implementation. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: the manifest of a generated package validates against the schema of the template package.",
      "acceptanceCriteria": [
        "The template writes `.connectsoft/template-manifest.json` into the generated repository with the template id, the package version and every parameter value and preserves it on regeneration; a pack step writes `.template.config/symbol-catalog.json` beside `.template.config/template-manifest.schema.json` into the package, in the shapes of the library template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2704,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1355]",
      "number": 1355
    },
    {
      "id": "AIFACTORY-TASK-1356",
      "type": "task",
      "parent": "AIFACTORY-US-312",
      "title": "Features and versioning pages rewritten from the template configuration",
      "sequence": "18.25.04.03",
      "description": "BEFORE DEVELOPMENT. Features and versioning pages rewritten from the template configuration. Expected output: The Features page lists the real parameters of the template with their defaults and drops `UseTracing`, the health endpoints and the two-framework claim; the versioning page names the Microsoft Agent Framework and the targeted frameworks and no longer Semantic Kernel.. Kind: documentation. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "The Features page lists the real parameters of the template with their defaults and drops `UseTracing`, the health endpoints and the two-framework claim; the versioning page names the Microsoft Agent Framework and the targeted frameworks and no longer Semantic Kernel."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2704,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1356]",
      "number": 1356
    },
    {
      "id": "AIFACTORY-TASK-1357",
      "type": "task",
      "parent": "AIFACTORY-US-312",
      "title": "Verify the single-framework generation, the manifest and the pages",
      "sequence": "18.25.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the single-framework generation, the manifest and the pages. Expected output: Generate a package for the single framework, read its manifest back, compare the catalog of the template package with model/template-parameters/connectsoft-aiskills-library.yaml and the Features page with the catalog; the comparisons pass and prove AC1 to AC3 of AIFACTORY-US-312 (ADR-0002).. Kind: verification. Repository: ConnectSoft.AISkillsLibraryTemplate.",
      "acceptanceCriteria": [
        "Generate a package for the single framework, read its manifest back, compare the catalog of the template package with model/template-parameters/connectsoft-aiskills-library.yaml and the Features page with the catalog; the comparisons pass and prove AC1 to AC3 of AIFACTORY-US-312 (ADR-0002)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1357]",
      "number": 1357
    },
    {
      "id": "AIFACTORY-US-313",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-184",
      "title": "AI skills library template: the packed template is installed, instantiated across its parameters and for the Factory profile, built and tested before the package publishes",
      "sequence": "18.25.05",
      "description": "As an asset maintainer, I want every change of the AI skills library template to be gated by the packages it generates from the packed candidate, so that a template package that would scaffold a skill that does not build or pass never reaches the feed. This PBI is the gate of the feature. The installer pipeline of the template (`azure-pipelines-template.yml` of the template) packs the nuspec and pushes the installer package without instantiating the packed candidate, and the repository holds a unit test project and an acceptance test project but no scaffold tests. The gate adds them and runs them 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, whose push allows package conflicts today, 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, and the hook runs the scaffold tests against it after the pack and before the push; they instantiate it across the parameter matrix: `useDI`, `useOptions`, `useLogging` and `useMetrics` on and off and the values of the target-frameworks parameter, reduced to the pairs of values so that the run stays bounded while every pair of options is covered. The gate and the publication rest on two texts of ADR-0028 and on the epic: the amendment on scaffolding from the published templates (D94) names this feature among the template extensions that precede development, the amendment on the Factory profile switch (D114) admits one additional gating case per declared profile beside the default case, and model/backlog/epics.yaml makes a package that passes its generated-solution gate the completion of the epic. ADR-0021 and ADR-0022 apply only to what the gate checks inside the profile output: the SkillManifest a release candidate is evaluated with and the tool descriptor documents. For each output the pipeline restores, builds in Release, runs the unit and acceptance tests, reads the template manifest back and scans for placeholders that were not replaced; for the profile case it also validates the SkillManifest and the descriptor documents and runs the scope, MCP and payload-absence tests. An output that fails any stage fails the run with the parameter values and the stage named, and the push is not reached. Publication pushes the template 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. Kind: evidence. Traces: adrs: ADR-0021, ADR-0022. Depends on: AIFACTORY-US-309, AIFACTORY-US-310, AIFACTORY-US-311, AIFACTORY-US-312, feature:component-base-template-findings. Sources: model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-aiskills-library.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0021-quality-gates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the template, when its pipeline runs, then the candidate is packed once and installed, the gate hook of the shared installer steps (AIFACTORY-TASK-1426) runs the scaffold tests, which instantiate it across the matrix of `useDI`, `useOptions`, `useLogging`, `useMetrics` and the target-framework values and for the Factory profile case, each output is restored, built in Release, tested, checked against its template manifest and scanned for placeholders, and the profile output also passes the validation of its SkillManifest and of its descriptor documents (docs/architecture/adr/0028-one-repository-and-deployable-per-service.md amendments D94 and D114: this feature precedes development and the template pipeline admits one additional gating case per declared profile; ADR-0022 decision 3 for the descriptors; model/template-parameters/connectsoft-aiskills-library.yaml lists the parameters of the matrix).",
        "AC2: Given an output fails any stage, when the pipeline evaluates the run, then the gate hook fails the run with the parameter values and the stage named, no later stage of that output is reported as passed and the push is not reached; a fixture with a planted defect in one output proves the refusal (docs/architecture/adr/0028-one-repository-and-deployable-per-service.md amendment D114; model/backlog/epics.yaml states the gate as the completion of the epic).",
        "AC3: Given every output is green, when the push step runs, then the template package is pushed to the ConnectSoft feed with a version that is not on the feed and the version guard of the shared installer steps, which the template switches on, refuses a repeated version with the reason (model/backlog/epics.yaml: each template publishes a package that passes its generated-solution gate; docs/architecture/catalogs/templates.md keeps the row of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1358",
        "AIFACTORY-TASK-1359",
        "AIFACTORY-TASK-653"
      ],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2705,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0021",
          "ADR-0022"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-309",
        "AIFACTORY-US-310",
        "AIFACTORY-US-311",
        "AIFACTORY-US-312",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0021-quality-gates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-313]",
      "number": 313
    },
    {
      "id": "AIFACTORY-TASK-1358",
      "type": "task",
      "parent": "AIFACTORY-US-313",
      "title": "Scaffold test project and the parameter matrix in the installer pipeline",
      "sequence": "18.25.05.01",
      "description": "BEFORE DEVELOPMENT. Scaffold test project and the parameter matrix in the installer pipeline. Expected output: The template repository gains a scaffold test project that instantiates the installed candidate across the pairwise matrix of the four feature switches and the target-framework values and for the Factory profile case; the installer pipeline file 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 these cases, each named in its output; the push follows only when every case passed, and the guard refuses a version that is already on the feed.. Kind: operations. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: azure-pipelines-template.yml passes every case to the gate hook of the shared installer job and pushes only after them.",
      "acceptanceCriteria": [
        "The template repository gains a scaffold test project that instantiates the installed candidate across the pairwise matrix of the four feature switches and the target-framework values and for the Factory profile case; the installer pipeline file 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 these cases, each named in its output; the push follows only when every case passed, and the guard refuses a version that is already on the feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2705,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1358]",
      "number": 1358
    },
    {
      "id": "AIFACTORY-TASK-1359",
      "type": "task",
      "parent": "AIFACTORY-US-313",
      "title": "Planted failing output fixture for the gate",
      "sequence": "18.25.05.02",
      "description": "BEFORE DEVELOPMENT. Planted failing output fixture for the gate. Expected output: A pipeline fixture generates the Factory profile output with a planted manifest defect and asserts that the run fails at the manifest validation stage with the parameter values named and that the push is not reached.. Kind: fixture. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: the planted run fails at the manifest validation stage.",
      "acceptanceCriteria": [
        "A pipeline fixture generates the Factory profile output with a planted manifest defect and asserts that the run fails at the manifest validation stage with the parameter values named and that the push is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2705,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1359]",
      "number": 1359
    },
    {
      "id": "AIFACTORY-TASK-653",
      "type": "task",
      "parent": "AIFACTORY-US-313",
      "title": "Pages, parameters and a generated-solution gate reconciled",
      "sequence": "18.25.05.03",
      "description": "BEFORE DEVELOPMENT. Pages, parameters and a generated-solution gate reconciled. Expected output: One green run and one planted run of the gate: the scaffold tests instantiate the packed template across the parameter matrix and for the Factory profile case, build and test each output and validate the manifests and descriptor documents of the profile output, the planted output stops the run before publication and the green run publishes the package with a verified version, which proves AC1 to AC3 of AIFACTORY-US-313 (ADR-0022, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).. Kind: verification. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One green run and one planted run of the gate: the scaffold tests instantiate the packed template across the parameter matrix and for the Factory profile case, build and test each output and validate the manifests and descriptor documents of the profile output, the planted output stops the run before publication and the green run publishes the package with a verified version, which proves AC1 to AC3 of AIFACTORY-US-313 (ADR-0022, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-653]",
      "number": 653
    },
    {
      "id": "AIFACTORY-US-121",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-184",
      "title": "AI skills library template: skill packages the registry publishes and the agent host loads is delivered and proven on a generated solution",
      "sequence": "18.25.06",
      "description": "As an asset maintainer, I want AI skills library template to carry skill packages the registry publishes and the agent host loads, so that it serves compiled skill packages (AIFunctions on the Agent Framework) the registry publishes as Skill assets and the agent host loads without later rework. This is the integration PBI of the feature. An asset maintainer packs the AI skills library template with the SkillManifest, the Factory profile, the Factory redaction and telemetry, the reconciled parameters and pages and the template manifest, installs the package and instantiates it across its parameters in the installer pipeline. Every generated package builds and passes its tests before the template package is allowed to publish; an output 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 skill package the Factory builds first. From the published template package a skill package is generated with `UseFactoryProfile` for the single framework of the Factory backend. It builds unchanged; its SkillManifest validates against the schema and names every function; a function called without scope is refused; an MCP call without a token is refused; and its telemetry carries no payload. The feature is done when that package builds from a fresh install of the published template package. Generating skill packages from skill definitions belongs to the Factory assets epic. Repository of the feature: ConnectSoft.AISkillsLibraryTemplate. Kind: enabling. Traces: adrs: ADR-0002, ADR-0013, ADR-0019, ADR-0021, ADR-0022. Depends on: AIFACTORY-US-309, AIFACTORY-US-310, AIFACTORY-US-311, AIFACTORY-US-312, AIFACTORY-US-313. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-aiskills-library.yaml, model/services/control-plane/AgentRegistryService.yaml, docs/reference/schemas/asset-manifests.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.AISkillsLibraryTemplate 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-0021, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-650 (skill manifest in the generated package) is done, then under `UseFactoryProfile` the generated package carries a SkillManifest as docs/reference/schemas/asset-manifests.schema.json defines it, a test validates it against the schema, a package generated without the profile equals the output of the current template, and the manifest is what AgentRegistryService takes as a Skill release candidate, with the evaluation record of ADR-0021 attached by the gate and not by the package.",
        "AC3: Given the work of AIFACTORY-TASK-651 (AIFunctions as governed tools under the scope of the caller) is done, then under `UseFactoryProfile` every AIFunction has a tool descriptor document packed beside the manifest, executes under the tenant and project scope of the caller, refuses a call without scope and is exposed through the MCP library with authorization on in place of the wrapper of the template (ADR-0022 decisions 2 to 4).",
        "AC4: Given the work of AIFACTORY-TASK-652 (redaction, telemetry and embeddings on the Factory conventions) is done, then redaction uses the Factory data classes, the activities and meters carry no prompt, completion or tool output (ADR-0019 decision 3), and the embeddings pipeline takes its store from the vector store profile of the host (ADR-0013 decision 1).",
        "AC5: Given the work of AIFACTORY-TASK-653 (pages, parameters and a generated-solution gate reconciled) is done, then the Features page lists the real parameters of model/template-parameters/connectsoft-aiskills-library.yaml, the versioning page names the Agent Framework of ADR-0002, the target-frameworks parameter is the one of the library template, and the scaffold tests instantiate the packed template across the parameter matrix before the package publishes to the ConnectSoft feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1360",
        "AIFACTORY-TASK-667"
      ],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2706,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0002",
          "ADR-0013",
          "ADR-0019",
          "ADR-0021",
          "ADR-0022"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-309",
        "AIFACTORY-US-310",
        "AIFACTORY-US-311",
        "AIFACTORY-US-312",
        "AIFACTORY-US-313"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-aiskills-library.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-121]",
      "number": 121
    },
    {
      "id": "AIFACTORY-TASK-1360",
      "type": "task",
      "parent": "AIFACTORY-US-121",
      "title": "Generate a Factory skill package from the published template and run its tests",
      "sequence": "18.25.06.01",
      "description": "BEFORE DEVELOPMENT. Generate a Factory skill package from the published template and run its tests. Expected output: A probe installs the published template package, generates a skill package with `UseFactoryProfile` for the single framework, builds it in Release unchanged and runs its manifest, scope, MCP and payload-absence tests; the run proves AC2 to AC4 of AIFACTORY-US-121 on the published package (ADR-0019, ADR-0022).. Kind: verification. Repository: ConnectSoft.AISkillsLibraryTemplate. Verification: dotnet new install of the published version, dotnet new connectsoft-aiskills-library with `UseFactoryProfile`, dotnet build -c Release, dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A probe installs the published template package, generates a skill package with `UseFactoryProfile` for the single framework, builds it in Release unchanged and runs its manifest, scope, MCP and payload-absence tests; the run proves AC2 to AC4 of AIFACTORY-US-121 on the published package (ADR-0019, ADR-0022)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2706,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1360]",
      "number": 1360
    },
    {
      "id": "AIFACTORY-TASK-667",
      "type": "task",
      "parent": "AIFACTORY-US-121",
      "title": "Verify aiskills-library-template-skill-packages-delivered by running the declared command",
      "sequence": "18.25.06.02",
      "description": "BEFORE DEVELOPMENT. Verify aiskills-library-template-skill-packages-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every output of the parameter matrix after the published package is installed; they pass and prove AC1 to AC5 of AIFACTORY-US-121.. Kind: verification. Repository: ConnectSoft.AISkillsLibraryTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every output of the parameter matrix after the published package is installed; they pass and prove AC1 to AC5 of AIFACTORY-US-121."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "docs/reference/schemas/asset-manifests.schema.json",
        "ConnectSoft.AISkillsLibraryTemplate/README.md",
        "ConnectSoft.AISkillsLibraryTemplate/docs/Features.md",
        "ConnectSoft.AISkillsLibraryTemplate/TEMPLATE_VERSIONING.md",
        "ConnectSoft.AISkillsLibraryTemplate/.template.config/template.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i1-generate-a-microservice",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.AISkillsLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 27,
      "phase": "templates-and-libraries",
      "stackRank": 2706,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-667]",
      "number": 667
    },
    {
      "id": "AIFACTORY-FEAT-173",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Health aggregator template: the Factory fleet profile with scoped targets and readiness events",
      "sequence": "18.26",
      "description": "The health aggregator template is the component behind environment, SLO and fleet health (RuntimeEnvironmentService, SloService, FleetInventoryService and the generated product host name it). Its own control-plane backlog is complete through B-F06: merged inventory with an ops registry and Kubernetes scrape, multi-probe polling with adaptive intervals and hysteresis, aggregator-owned incidents with notify-only sinks, history and SLO tables, the Blazor graph, MCP tools, Redis leader election and the engine library. Its locked decisions make the registry single-tenant and ops-only and keep the sinks outside the Factory: the Factory needs targets that belong to an environment, a tenant and a project, reads filtered by the Factory token, health flips and the readiness bundle (readiness-bundle.schema.json, ADR-0014) as Factory events, and discovery from the Factory's own environment inventory. Component: HealthChecks aggregator (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-174, AIFACTORY-FEAT-162. Increment I2: Deliver it. Build order 29 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-270",
        "AIFACTORY-US-271",
        "AIFACTORY-US-272",
        "AIFACTORY-US-273",
        "AIFACTORY-US-274",
        "AIFACTORY-US-123"
      ],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2900,
      "titlePrefix": "[AIFACTORY-FEAT-173]",
      "number": 173
    },
    {
      "id": "AIFACTORY-US-270",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-173",
      "title": "Health aggregator template: under the Factory profile a target belongs to an environment, a tenant and a project, and the admin, health and graph routes return only what the Factory token grants",
      "sequence": "18.26.01",
      "description": "As an asset maintainer, I want the registry and the reads of a generated aggregator to be scoped by the Factory token, so that one aggregator serves the environments of many tenants and no caller sees a target of another tenant. The locked decisions of the template (Docs/Control Plane/Index.md of the template) make the runtime registry ops-only and single-tenant behind the Identity Platform policy `HealthAggregatorOps`, authenticate `/api/admin/*`, `/api/health/*` and `/graph`, and leave the orchestrator `/health` and readiness anonymous. That suits one operations team and one inventory. A Factory estate has many tenants, and ADR-0015 decision 3 enforces authorization at the backend for every read and write. Under `UseFactoryProfile` this PBI gives every target an environment, a tenant and a project: the rows of `HealthCheckTargets`, the configured `Services[]`, the history tables and the incidents carry the three identifiers through the scoped records of the engine feature, and the template defines no second copy of those records. A request takes its tenant from the validated token through the scope accessor of the pinned `ConnectSoft.Extensions.AI.Factory.Abstractions` package, and a project is admitted only when the token grants a role in it. The policy `HealthAggregatorOps` on the admin routes is satisfied by the Operator role of the project of the target, by its Workspace admin and by a Platform admin of the tenant, with the role names taken from the token contract of the abstractions package and typed nowhere in the template. The health and graph routes answer a holder of any role of the project and return only its targets. A target of another tenant is answered 404, the same answer as for a name that does not exist, and a missing role inside the tenant of the caller is answered 403, as the amendments of ADR-0015 state. A user token has one audience, the gateway that fronts the aggregator. The environment and SLO services call with a workload token that carries a service scope and no tenant claim; the aggregator reads the tenant and project such a caller forwards only when the token holds the service scope that names it. The anonymous `/health` and readiness report the state of the aggregator itself and no target of any tenant. The audit events of the registry, `TargetCreated`, `TargetUpdated`, `TargetDeleted` and `TargetEnabledChanged`, record the scope with the actor. Kind: enabling. Traces: services: RuntimeEnvironmentService; adrs: ADR-0015, ADR-0028. Relates: nfrs: NFR-01. Depends on: feature:component-healthchecks-aggregator-engine-library, feature:component-auth-server-template-factory-tokens, feature:component-extensions-ai, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/template-parameters/connectsoft-healthchecks-aggregator.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md, docs/planes/control/tenancy.md.",
      "acceptanceCriteria": [
        "AC1: Given an aggregator generated with `UseFactoryProfile` that holds targets of two tenants, when a caller of the first tenant lists targets on the admin route, reads the health detail and opens the graph, then every answer holds only targets of projects in which the token grants a role, and no target, history row or incident of the second tenant appears (ADR-0015 decision 3).",
        "AC2: Given a caller of one tenant, when it reads, changes or deletes a target of another tenant by name, then the answer is 404 with the same body as for a name that does not exist; given a caller without the Operator role in the project of a target of its own tenant, when it calls an admin route for that target, then the answer is 403 (ADR-0015 amendment on a resource of another tenant, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC3: Given a workload token with the service scope that names the forwarded scope and no tenant claim, when the caller forwards a tenant and a project, then the aggregator reads them and answers within that scope; given a workload token without that service scope, then the forwarded scope is ignored and the answer is 403 (ADR-0015 amendment on audience and workload tokens).",
        "AC4: Given the anonymous `/health` and readiness endpoints of the generated aggregator, when they are probed without a token, then they report the state of the aggregator itself and name no target of any tenant, as the locked decision on public and authenticated routes keeps them (ADR-0015 decision 3, model/components.yaml).",
        "AC5: Given a registry write under the profile, when a target is created, changed, enabled or deleted, then the audit event of the registry records the actor and the environment, tenant and project of the target; given a generation without `UseFactoryProfile`, then the registry stays single-tenant and its tests pass unchanged (ADR-0028 amendment on the Factory profile switch)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/tenancy.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-626",
        "AIFACTORY-TASK-1224",
        "AIFACTORY-TASK-1225",
        "AIFACTORY-TASK-1226"
      ],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2901,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "feature:component-healthchecks-aggregator-engine-library",
        "feature:component-auth-server-template-factory-tokens",
        "feature:component-extensions-ai",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md",
        "docs/planes/control/tenancy.md"
      ],
      "titlePrefix": "[AIFACTORY-US-270]",
      "number": 270
    },
    {
      "id": "AIFACTORY-TASK-626",
      "type": "task",
      "parent": "AIFACTORY-US-270",
      "title": "Targets scoped by environment, tenant and project",
      "sequence": "18.26.01.01",
      "description": "BEFORE DEVELOPMENT. Targets scoped by environment, tenant and project. Expected output: Under `UseFactoryProfile` target records and the ops registry carry environment, tenant and project; /api/admin/*, /api/health/* and /graph read the scope from the Factory token through the scope accessor of the pinned abstractions package (HealthAggregatorOps satisfied by the Factory operator role of the project) and return only targets within it; a target of another tenant is answered 404 and a missing role 403; the orchestrator /health and readiness stay anonymous.. Kind: implementation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` target records and the ops registry carry environment, tenant and project; /api/admin/*, /api/health/* and /graph read the scope from the Factory token through the scope accessor of the pinned abstractions package (HealthAggregatorOps satisfied by the Factory operator role of the project) and return only targets within it; a target of another tenant is answered 404 and a missing role 403; the orchestrator /health and readiness stay anonymous."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-626]",
      "number": 626
    },
    {
      "id": "AIFACTORY-TASK-1224",
      "type": "task",
      "parent": "AIFACTORY-US-270",
      "title": "Scope columns and indexes on the target, history and incident tables",
      "sequence": "18.26.01.02",
      "description": "BEFORE DEVELOPMENT. Scope columns and indexes on the target, history and incident tables. Expected output: A migration adds the environment, tenant and project columns to `HealthCheckTargets`, `HealthCheckSamples`, `HealthCheckFlips` and the incident and SLO tables under the profile, makes the target name unique per scope and adds the tenant filter of the persistence layer; mapping tests run against an isolated test database.. Kind: migration. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration adds the environment, tenant and project columns to `HealthCheckTargets`, `HealthCheckSamples`, `HealthCheckFlips` and the incident and SLO tables under the profile, makes the target name unique per scope and adds the tenant filter of the persistence layer; mapping tests run against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2901,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1224]",
      "number": 1224
    },
    {
      "id": "AIFACTORY-TASK-1225",
      "type": "task",
      "parent": "AIFACTORY-US-270",
      "title": "Two-tenant fixture over the admin, health and graph routes",
      "sequence": "18.26.01.03",
      "description": "BEFORE DEVELOPMENT. Two-tenant fixture over the admin, health and graph routes. Expected output: An acceptance fixture seeds targets of two tenants and calls every admin, health and graph route with user tokens of both tenants, with a token without the Operator role and with workload tokens with and without the service scope; it asserts the filtered answers, the 404 and the 403.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An acceptance fixture seeds targets of two tenants and calls every admin, health and graph route with user tokens of both tenants, with a token without the Operator role and with workload tokens with and without the service scope; it asserts the filtered answers, the 404 and the 403."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2901,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1225]",
      "number": 1225
    },
    {
      "id": "AIFACTORY-TASK-1226",
      "type": "task",
      "parent": "AIFACTORY-US-270",
      "title": "Verify the scoped reads and the 404 and 403 answers",
      "sequence": "18.26.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the scoped reads and the 404 and 403 answers. Expected output: Generate the template with `UseFactoryProfile`, build it in Release and run the two-tenant fixture and the mapping tests; all pass, and the default generation passes its registry tests unchanged, which proves AC1 to AC5 of AIFACTORY-US-270 (ADR-0015).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "Generate the template with `UseFactoryProfile`, build it in Release and run the two-tenant fixture and the mapping tests; all pass, and the default generation passes its registry tests unchanged, which proves AC1 to AC5 of AIFACTORY-US-270 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1226]",
      "number": 1226
    },
    {
      "id": "AIFACTORY-US-271",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-173",
      "title": "Health aggregator template: health flips, incident changes and readiness changes of an environment are published under the run event envelope through the Orleans messaging profile",
      "sequence": "18.26.02",
      "description": "As an asset maintainer, I want the aggregator to announce what it observes as Factory events, so that the environment, SLO and fleet services react to a health change without polling the aggregator. The template keeps the aggregator as the system of record of incidents: a flip is a row of `HealthCheckFlips`, an incident is a row of its own tables, and the `IHealthIncidentSink` adapters for webhooks, PagerDuty and Azure Event Grid only notify. The parameter `MessagingModelType` offers None, NServiceBus and MassTransit (model/template-parameters/connectsoft-healthchecks-aggregator.yaml), and nothing is published for another service to consume. Under `UseFactoryProfile` this PBI adds three event types: a target changed its health state, an incident was opened, changed or resolved, and the stabilized readiness of an environment changed, which is the result of the hysteresis machine over the targets of that environment. The three are inputs of the environment, SLO and fleet services and are not the events those services are modelled with: `ServiceHealthChanged` of SloService and `IncidentOpened`, `IncidentStateChanged` and `IncidentResolved` of FleetIncidentService stay what those services publish from what they derive. An incident of the aggregator records that one target is failing and is not a fleet incident; a fleet incident is opened by FleetIncidentService under its own rules. No modelled service lists a `consumes` row for the aggregator events yet, which this PBI reports as a gap of the model and does not close. Each event is published under the run event envelope of the contracts package, as the amendment of ADR-0014 on envelopes per event family requires of a Factory service, with the tenant and project of the target and the environment in the payload. The outbox record is written in the same transaction as the flip row or the incident row (ADR-0014 decision 4) and dispatched through the Orleans messaging profile, whose value the template receives from the base template through its `base-template` submodule; the template adds no messaging code of its own. Leader election stays on the Redis lock, as the locked decision states, so only the leader writes rows and outbox records. The readiness bundle of docs/reference/schemas/readiness-bundle.schema.json is the pinned input set of a readiness-activated workflow and is assembled by the workflow engine; its members may be signal references with a producer, an event, an object identifier, an object version and an event identifier. The aggregator does not assemble a bundle. Its readiness event carries exactly what such a member needs: the environment as the object, a version that grows with every transition, and the event identifier. An authenticated read returns the current readiness of an environment in the same shape for a consumer that missed the event. The sinks stay notify-only: an event is published whether or not a sink is configured, and a failing sink never holds back an event. Kind: enabling. Traces: services: RuntimeEnvironmentService; descriptors: run-event-envelope-v1, readiness-bundle-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0028. Depends on: AIFACTORY-US-270, feature:component-base-template-factory-profile, feature:contracts-package. Sources: model/components.yaml, model/template-parameters/connectsoft-healthchecks-aggregator.yaml, docs/reference/schemas/readiness-bundle.schema.json, docs/reference/schemas/handoff-refs.schema.json, docs/reference/schemas/run-event-envelope.schema.json, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given an aggregator generated with `UseFactoryProfile`, when a target of an environment changes its health state, then the flip row and one outbox record are committed in one transaction and the event is published under `run-event-envelope-v1` with the tenant and project of the target, a correlation identifier and the environment, target, previous and new state in its payload; when the transaction rolls back, then neither the row nor the event exists (ADR-0014 decision 4).",
        "AC2: Given an incident that is opened, changed and resolved, when each transition commits, then one event per transition is published with the incident identifier, and a consumer that receives the same event identifier twice applies it once; a configured sink that fails delays no event and is retried on its own (ADR-0014 decision 3, ADR-0012).",
        "AC3: Given the stabilized readiness of an environment changes, when the readiness event is published, then it carries the producer, the event name, the environment identifier as the object, a version that grows with every transition and the event identifier, and a test validates that a member built from it is a valid signal reference of `readiness-bundle-v1` (docs/reference/schemas/readiness-bundle.schema.json, docs/reference/schemas/handoff-refs.schema.json).",
        "AC4: Given a caller within the scope of an environment, when it reads the current readiness of that environment, then the answer has the shape of the last readiness event with its version, and a caller of another tenant is answered 404 (ADR-0015 amendment on a resource of another tenant, ADR-0014).",
        "AC5: Given a generation without `UseFactoryProfile`, when its tests run, then no event is published, the sinks behave as before and the messaging choices of the template are unchanged (ADR-0028 amendment on the Factory profile switch, model/template-parameters/connectsoft-healthchecks-aggregator.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/reference/schemas/readiness-bundle.schema.json",
        "docs/reference/schemas/handoff-refs.schema.json",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1227",
        "AIFACTORY-TASK-627",
        "AIFACTORY-TASK-1228",
        "AIFACTORY-TASK-1229"
      ],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2902,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "descriptors": [
          "run-event-envelope-v1",
          "readiness-bundle-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-270",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/reference/schemas/readiness-bundle.schema.json",
        "docs/reference/schemas/handoff-refs.schema.json",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-271]",
      "number": 271
    },
    {
      "id": "AIFACTORY-TASK-1227",
      "type": "task",
      "parent": "AIFACTORY-US-271",
      "title": "Contracts and topics of the three aggregator event types with golden files",
      "sequence": "18.26.02.01",
      "description": "BEFORE DEVELOPMENT. Contracts and topics of the three aggregator event types with golden files. Expected output: The messaging model of the template declares the health flip, incident change and environment readiness event types with their payload fields and topic names, each carried by the run event envelope of the pinned contracts package; one golden JSON file per event type fixes the serialised form, and a test builds a signal reference from the readiness event and validates it against docs/reference/schemas/handoff-refs.schema.json.. Kind: contract. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The messaging model of the template declares the health flip, incident change and environment readiness event types with their payload fields and topic names, each carried by the run event envelope of the pinned contracts package; one golden JSON file per event type fixes the serialised form, and a test builds a signal reference from the readiness event and validates it against docs/reference/schemas/handoff-refs.schema.json."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2902,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1227]",
      "number": 1227
    },
    {
      "id": "AIFACTORY-TASK-627",
      "type": "task",
      "parent": "AIFACTORY-US-271",
      "title": "Health flips and the readiness bundle as Factory events",
      "sequence": "18.26.02.02",
      "description": "BEFORE DEVELOPMENT. Health flips and the readiness bundle as Factory events. Expected output: Under `UseFactoryProfile` health flips, incident changes and readiness changes of an environment are published under the run event envelope through the Orleans messaging profile, with the outbox record in the transaction of the row; the readiness event carries what a signal member of a readiness bundle needs against readiness-bundle.schema.json, an authenticated read returns the current readiness of an environment in the same shape, and the IHealthIncidentSink adapters stay notify-only.. Kind: implementation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` health flips, incident changes and readiness changes of an environment are published under the run event envelope through the Orleans messaging profile, with the outbox record in the transaction of the row; the readiness event carries what a signal member of a readiness bundle needs against readiness-bundle.schema.json, an authenticated read returns the current readiness of an environment in the same shape, and the IHealthIncidentSink adapters stay notify-only."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-627]",
      "number": 627
    },
    {
      "id": "AIFACTORY-TASK-1228",
      "type": "task",
      "parent": "AIFACTORY-US-271",
      "title": "Consumer, duplicate and rollback tests on the Orleans inbox",
      "sequence": "18.26.02.03",
      "description": "BEFORE DEVELOPMENT. Consumer, duplicate and rollback tests on the Orleans inbox. Expected output: The acceptance suite of the Factory case holds a consumer that reads a flip, the three incident transitions and a readiness change from the Orleans inbox with every required envelope field, a duplicate delivery test, a rollback test that finds no outbox record and a test in which a failing sink delays no event.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The acceptance suite of the Factory case holds a consumer that reads a flip, the three incident transitions and a readiness change from the Orleans inbox with every required envelope field, a duplicate delivery test, a rollback test that finds no outbox record and a test in which a failing sink delays no event."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1228]",
      "number": 1228
    },
    {
      "id": "AIFACTORY-TASK-1229",
      "type": "task",
      "parent": "AIFACTORY-US-271",
      "title": "Verify the published events and the readiness read",
      "sequence": "18.26.02.04",
      "description": "BEFORE DEVELOPMENT. Verify the published events and the readiness read. Expected output: Generate the template with `UseFactoryProfile`, build it in Release and run the golden file, consumer, duplicate, rollback and readiness read tests; all pass, and the default generation publishes nothing, which proves AC1 to AC5 of AIFACTORY-US-271 (ADR-0014, docs/reference/schemas/readiness-bundle.schema.json).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "Generate the template with `UseFactoryProfile`, build it in Release and run the golden file, consumer, duplicate, rollback and readiness read tests; all pass, and the default generation publishes nothing, which proves AC1 to AC5 of AIFACTORY-US-271 (ADR-0014, docs/reference/schemas/readiness-bundle.schema.json)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1229]",
      "number": 1229
    },
    {
      "id": "AIFACTORY-US-272",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-173",
      "title": "Health aggregator template: a discovery source reads targets from the environment inventory of the Factory and merges them by the existing inventory rules",
      "sequence": "18.26.03",
      "description": "As an asset maintainer, I want the aggregator to take its targets from the inventory the Factory already keeps of each environment, so that a workload that is deployed is probed without anyone registering it by hand. The core page of the template (Docs/Control Plane/health-agg-core.md of the template) fixes the merge of the inventory: the runtime registry first, then the Kubernetes scrape snapshot, then the configured `Services[]`, then the resolution of discovery-scheme addresses; a name the registry and the scrape share is skipped silently, and a name the scrape and the configuration share is logged as `TargetCollision`. The parameter `Discovery` has the values Static and ServiceDiscovery. In a Factory estate the workloads of an environment and their endpoints are already known: RuntimeEnvironmentService keeps the observed inventory of every environment (model/services/runtime-cloud/RuntimeEnvironmentService.yaml). Its operation `GetRuntimeInventory`, a GET on `/factory/environments/{environmentId}/inventory` under the scope `factory.runtime.read`, returns the inventory of one environment with its staleness, and each `ObservedWorkload` of it carries a name, a kind, a version, the ready and the desired replicas, `endpoints` as a list of strings and a health value. The inventory carries no health address and no criticality, and tenant and project belong to the environment and not to the workload. This PBI adds a further discovery source behind a port. For every environment its options name, with the tenant and the project of that environment, the inventory provider calls `GetRuntimeInventory` with a workload token that holds `factory.runtime.read` and turns each workload into targets: one target per entry of `endpoints`, with the health address derived from the endpoint and the health path an option names, the workload name as the target name, and the environment, tenant and project of the configured environment. Criticality comes from a default of the options and can be overridden for one target by a registry row. The tests of the template run the provider against a stub that serves recorded responses of `GetRuntimeInventory` in exactly that shape, because the service is scaffolded after the template is published; the operation is Factory code of a later feature and is therefore named under the sources of this PBI and not among its traces. The `Discovery` parameter gains a value for this source, which `UseFactoryProfile` selects. The precedence is recorded on the core page and in a test: the registry wins over the inventory, so that an operator can override or mute a discovered target, and the inventory wins over the Kubernetes scrape and the configuration, because it alone is bound to a scope. A collision is decided per target key, the name with its three identifiers: a key the registry shares with the inventory is skipped silently, as a name the registry shares with the scrape is today, and a key the inventory shares with the scrape or with the configuration is logged as `TargetCollision`. When the inventory cannot be read the last known targets stay and are reported as Degraded, the rule the page already applies when a discovery address cannot be resolved; a response that is marked stale removes no target. A target that is gone from a fresh inventory is removed after the next successful read and its open incident is resolved with that reason. Kind: enabling. Traces: services: RuntimeEnvironmentService; adrs: ADR-0014, ADR-0015, ADR-0018. Depends on: AIFACTORY-US-270, AIFACTORY-US-271. Sources: model/components.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, model/template-parameters/connectsoft-healthchecks-aggregator.yaml, docs/architecture/nfr-baseline.md.",
      "acceptanceCriteria": [
        "AC1: Given a stub that serves recorded responses of `GetRuntimeInventory` for two environments of two tenants, each with `ObservedWorkload` entries that carry name, kind, version, replicas, `endpoints` and health, when the aggregator starts with the inventory discovery selected and a workload token that holds `factory.runtime.read`, then it polls one target per endpoint at the health address derived from the endpoint and the health path of the options, every target carries the environment, tenant and project of its configured environment and the default criticality of the options, a registry row overrides the criticality of one target, and a token without the scope is refused by the stub with 403 (ADR-0015 decision 2, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC2: Given the same target key in the registry, the inventory, the Kubernetes scrape and the configuration, when the inventory is merged, then the registry row wins over the inventory and that collision is skipped silently, as a name the registry shares with the scrape is today, the inventory wins over the scrape and over the configuration and each of those two collisions is logged as `TargetCollision`, and the core page of the template states this precedence and what is logged per pair (ADR-0018, model/components.yaml).",
        "AC3: Given `GetRuntimeInventory` cannot be reached, when the refresh interval passes, then the last known targets keep being polled and are reported as Degraded with the reason, and when the operation answers again the targets are refreshed and the state clears; a response that is marked stale removes no target (ADR-0018, docs/architecture/nfr-baseline.md).",
        "AC4: Given a workload that is gone from a fresh inventory, when the next successful read is merged, then its target is no longer polled and its open incident is resolved with the reason that the target left the inventory, and the resolution is published as an incident event of the profile (ADR-0014, ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/architecture/nfr-baseline.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1230",
        "AIFACTORY-TASK-628",
        "AIFACTORY-TASK-1231",
        "AIFACTORY-TASK-1232"
      ],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2903,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0018"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-270",
        "AIFACTORY-US-271"
      ],
      "source": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/architecture/nfr-baseline.md"
      ],
      "titlePrefix": "[AIFACTORY-US-272]",
      "number": 272
    },
    {
      "id": "AIFACTORY-TASK-1230",
      "type": "task",
      "parent": "AIFACTORY-US-272",
      "title": "Inventory provider port, the client contract of `GetRuntimeInventory` and the recorded precedence",
      "sequence": "18.26.03.01",
      "description": "BEFORE DEVELOPMENT. Inventory provider port, the client contract of `GetRuntimeInventory` and the recorded precedence. Expected output: The template declares the inventory provider port, a client contract for the response of `GetRuntimeInventory` with the `ObservedWorkload` fields of model/services/runtime-cloud/RuntimeEnvironmentService.yaml (name, kind, version, replicas, `endpoints` and health, with the staleness of the inventory), the options of the HTTP implementation (the environments with their tenant and project, the workload token with `factory.runtime.read`, the health path and the default criticality), the new value of the `Discovery` parameter, and the merge precedence with what is logged per pair written on the core page of the template.. Kind: contract. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The template declares the inventory provider port, a client contract for the response of `GetRuntimeInventory` with the `ObservedWorkload` fields of model/services/runtime-cloud/RuntimeEnvironmentService.yaml (name, kind, version, replicas, `endpoints` and health, with the staleness of the inventory), the options of the HTTP implementation (the environments with their tenant and project, the workload token with `factory.runtime.read`, the health path and the default criticality), the new value of the `Discovery` parameter, and the merge precedence with what is logged per pair written on the core page of the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2903,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1230]",
      "number": 1230
    },
    {
      "id": "AIFACTORY-TASK-628",
      "type": "task",
      "parent": "AIFACTORY-US-272",
      "title": "Discovery from the Factory environment inventory",
      "sequence": "18.26.03.02",
      "description": "BEFORE DEVELOPMENT. Discovery from the Factory environment inventory. Expected output: A discovery source calls `GetRuntimeInventory` for each configured environment beside static configuration and the Kubernetes scrape, derives one target per endpoint with the health path of the options, the scope of the environment and the default criticality that a registry row can override, merges by the existing inventory rules and is selected by the discovery parameter, with the merge precedence recorded; last known targets stay Degraded while the inventory cannot be read, and a target that left a fresh inventory is removed and its incident resolved.. Kind: implementation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A discovery source calls `GetRuntimeInventory` for each configured environment beside static configuration and the Kubernetes scrape, derives one target per endpoint with the health path of the options, the scope of the environment and the default criticality that a registry row can override, merges by the existing inventory rules and is selected by the discovery parameter, with the merge precedence recorded; last known targets stay Degraded while the inventory cannot be read, and a target that left a fresh inventory is removed and its incident resolved."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-628]",
      "number": 628
    },
    {
      "id": "AIFACTORY-TASK-1231",
      "type": "task",
      "parent": "AIFACTORY-US-272",
      "title": "Stub inventory and the merge, outage and removal tests",
      "sequence": "18.26.03.03",
      "description": "BEFORE DEVELOPMENT. Stub inventory and the merge, outage and removal tests. Expected output: A stub that serves recorded responses of `GetRuntimeInventory` for two environments in the shape of model/services/runtime-cloud/RuntimeEnvironmentService.yaml and refuses a token without `factory.runtime.read`, and tests that cover the derived health address, the default criticality with its registry override, the four-way collision with its precedence and its log records, an unreadable inventory with last known targets kept as Degraded, a stale response and a workload that leaves the inventory with its incident resolved.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A stub that serves recorded responses of `GetRuntimeInventory` for two environments in the shape of model/services/runtime-cloud/RuntimeEnvironmentService.yaml and refuses a token without `factory.runtime.read`, and tests that cover the derived health address, the default criticality with its registry override, the four-way collision with its precedence and its log records, an unreadable inventory with last known targets kept as Degraded, a stale response and a workload that leaves the inventory with its incident resolved."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2903,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1231]",
      "number": 1231
    },
    {
      "id": "AIFACTORY-TASK-1232",
      "type": "task",
      "parent": "AIFACTORY-US-272",
      "title": "Verify the inventory discovery against the stub",
      "sequence": "18.26.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the inventory discovery against the stub. Expected output: Generate the template with `UseFactoryProfile`, build it in Release and run the discovery tests against the stub of `GetRuntimeInventory`; the scoped targets with their derived health address and criticality, the precedence, the outage and the removal tests pass and prove AC1 to AC4 of AIFACTORY-US-272 (ADR-0018, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "Generate the template with `UseFactoryProfile`, build it in Release and run the discovery tests against the stub of `GetRuntimeInventory`; the scoped targets with their derived health address and criticality, the precedence, the outage and the removal tests pass and prove AC1 to AC4 of AIFACTORY-US-272 (ADR-0018, model/services/runtime-cloud/RuntimeEnvironmentService.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1232]",
      "number": 1232
    },
    {
      "id": "AIFACTORY-US-273",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-173",
      "title": "Health aggregator template: the boolean parameter `UseFactoryProfile`, off by default, turns scope, Factory events and inventory discovery on together and leaves every other generation unchanged",
      "sequence": "18.26.04",
      "description": "As an asset maintainer, I want one profile parameter that generates the Factory shape of the aggregator, so that a Factory aggregator is generated by one switch and a generation without it is what it was. The amendment of ADR-0028 on the Factory profile switch selects the Factory shape of a template by the boolean parameter `UseFactoryProfile`, off by default and named the same in every template that has a Factory shape. The A-F06 page of the template lists its own parameters, `--discovery`, `--enable-registry`, `--probe-auth` and `--alert-sinks`, and the template composes its symbols on those of the base template through `template/healthchecks.template.extend.json` and its merge script. The pieces of the earlier PBIs each hang on one of these: the registry needs `EnableRegistry` and the identity platform, the events need the Orleans messaging value with NHibernate persistence on SQL Server, and the discovery needs its new value. A Factory aggregator needs all of them at once. This PBI brings `UseFactoryProfile` into the template as the symbol the base template defines, received through the `base-template` submodule and not declared a second time. The submodule pointer moves to the base template that carries the symbol and the Orleans messaging value, `build/MaterializedDirectory.Packages.props` is regenerated, and no file inside the submodule is edited, as the pages of the template require. With the parameter on, computed symbols of the extend file derive the registry, the identity platform, NHibernate persistence, the Orleans messaging choice with the actor model it needs, the inventory discovery value, the scope requirement and the operator role policy, whatever the single options say; a conflicting single option is overridden by the computed symbols and is not refused, the rule AIFACTORY-US-212 of the feature `component-worker-template-factory-profile` sets for the profile of the worker template. Leader election stays on the Redis lock under the profile. With the parameter off, the template generates what it generates today, which a comparison of the default case proves. The parameters page of the template documents the parameter and what it turns on, and the template inventory of the documentation repository picks it up. Kind: enabling. Traces: adrs: ADR-0012, ADR-0028. Depends on: AIFACTORY-US-270, AIFACTORY-US-271, AIFACTORY-US-272, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-healthchecks-aggregator.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the template, when an aggregator is generated with `UseFactoryProfile` and no other option, then it carries the scoped registry with the operator role policy, the three event types on the Orleans messaging profile, the inventory discovery and NHibernate persistence, and it builds in Release and passes its tests (ADR-0028 amendment on the Factory profile switch, ADR-0012).",
        "AC2: Given `UseFactoryProfile` is on and a conflicting single option is passed, such as `--enable-registry false`, a broker messaging value or `--discovery Static`, when the aggregator is generated, then the computed symbols of the profile win and the generated settings show the profile values; given the parameter is off, then the output of the default case equals the output of the template before this feature (ADR-0028, model/template-parameters/connectsoft-healthchecks-aggregator.yaml).",
        "AC3: Given the composed template configuration, when it is inspected, then `UseFactoryProfile` is defined once, by the base template of the submodule, the package snapshot check passes, and after the next template inventory model/template-parameters/connectsoft-healthchecks-aggregator.yaml lists the parameter and the new value of `Discovery` (ADR-0028, docs/architecture/catalogs/templates.md keeps the row of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1233",
        "AIFACTORY-TASK-1234",
        "AIFACTORY-TASK-1235",
        "AIFACTORY-TASK-1236"
      ],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2904,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-270",
        "AIFACTORY-US-271",
        "AIFACTORY-US-272",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-healthchecks-aggregator.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-273]",
      "number": 273
    },
    {
      "id": "AIFACTORY-TASK-1233",
      "type": "task",
      "parent": "AIFACTORY-US-273",
      "title": "Computed symbols of the Factory profile in the extend file of the template",
      "sequence": "18.26.04.01",
      "description": "BEFORE DEVELOPMENT. Computed symbols of the Factory profile in the extend file of the template. Expected output: `template/healthchecks.template.extend.json` and the merge script derive, from the `UseFactoryProfile` symbol of the base template, the registry, the identity platform, NHibernate persistence, the Orleans messaging choice with its actor model, the inventory discovery value, the scope requirement and the operator role policy; the composed configuration defines `UseFactoryProfile` once.. Kind: contract. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet new connectsoft-healthchecks-aggregator --help lists UseFactoryProfile once.",
      "acceptanceCriteria": [
        "`template/healthchecks.template.extend.json` and the merge script derive, from the `UseFactoryProfile` symbol of the base template, the registry, the identity platform, NHibernate persistence, the Orleans messaging choice with its actor model, the inventory discovery value, the scope requirement and the operator role policy; the composed configuration defines `UseFactoryProfile` once."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2904,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1233]",
      "number": 1233
    },
    {
      "id": "AIFACTORY-TASK-1234",
      "type": "task",
      "parent": "AIFACTORY-US-273",
      "title": "Base-template submodule moved to the base template with the profile and the package snapshot regenerated",
      "sequence": "18.26.04.02",
      "description": "BEFORE DEVELOPMENT. Base-template submodule moved to the base template with the profile and the package snapshot regenerated. Expected output: The `base-template` submodule of the template points at the base template that carries `UseFactoryProfile` and the Orleans value of `MessagingModelType`, `build/MaterializedDirectory.Packages.props` is regenerated and its check passes, and no file inside the submodule is edited.. Kind: operations. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: the package snapshot check passes and the authoring solution builds in Release.",
      "acceptanceCriteria": [
        "The `base-template` submodule of the template points at the base template that carries `UseFactoryProfile` and the Orleans value of `MessagingModelType`, `build/MaterializedDirectory.Packages.props` is regenerated and its check passes, and no file inside the submodule is edited."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2904,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1234]",
      "number": 1234
    },
    {
      "id": "AIFACTORY-TASK-1235",
      "type": "task",
      "parent": "AIFACTORY-US-273",
      "title": "Parameters page of the template documents the Factory profile",
      "sequence": "18.26.04.03",
      "description": "BEFORE DEVELOPMENT. Parameters page of the template documents the Factory profile. Expected output: The A-F06 page and the consumer documentation of the template describe `UseFactoryProfile`, the symbols it derives, the override rule for a conflicting single option and the new value of `Discovery`, so that `python -I tools/docs_model inventory-templates` of the documentation repository lists them in model/template-parameters/connectsoft-healthchecks-aggregator.yaml without a hand edit.. Kind: documentation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "The A-F06 page and the consumer documentation of the template describe `UseFactoryProfile`, the symbols it derives, the override rule for a conflicting single option and the new value of `Discovery`, so that `python -I tools/docs_model inventory-templates` of the documentation repository lists them in model/template-parameters/connectsoft-healthchecks-aggregator.yaml without a hand edit."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2904,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1235]",
      "number": 1235
    },
    {
      "id": "AIFACTORY-TASK-1236",
      "type": "task",
      "parent": "AIFACTORY-US-273",
      "title": "Verify the profile on, the profile off and the conflicting options",
      "sequence": "18.26.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the profile on, the profile off and the conflicting options. Expected output: Generate an aggregator with the profile on, one with it off and three with the profile on and one conflicting option each; build and test each; every profile case shows the profile values and the default case equals the output before the feature, which proves AC1 to AC3 of AIFACTORY-US-273 (ADR-0028).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "Generate an aggregator with the profile on, one with it off and three with the profile on and one conflicting option each; build and test each; every profile case shows the profile values and the default case equals the output before the feature, which proves AC1 to AC3 of AIFACTORY-US-273 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1236]",
      "number": 1236
    },
    {
      "id": "AIFACTORY-US-274",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-173",
      "title": "Health aggregator template: the packed template passes the default cases and the Factory profile case of the shared template pipeline before the package publishes",
      "sequence": "18.26.05",
      "description": "As an asset maintainer, I want every change of the aggregator template gated by its generated cases, the Factory profile case among them, so that a package that would generate an aggregator which leaks a target or loses an event never reaches the feed. This PBI is the gate of the feature. The estate gates its templates with the shared template pipeline of ConnectSoft.AzurePipelines (`template-ci/v1`). The aggregator template already owns the manifest `build/template-ci.json` with a case for the template kind and a case for the solution kind and the payload validator `build/Test-HealthChecksPayload.ps1`, and the rollout ledger of the shared pipeline lists the repository as pending. The status table on the index page of the control plane backlog of the template keeps the features of A-F02 to A-F06 and of B-F01 to B-F06 open until the remaining review of their implementations closes, and the work of this feature changes exactly that code: the scoped registry changes the registry of A-F02, the incident events the incidents of A-F05 and the scope columns the history tables of B-F01. The amendment of ADR-0028 on the Factory profile switch has the shared pipeline admit one additional gating case per declared profile beside the default case. This PBI first closes every review that table lists as open, A-F02 to A-F06 and B-F01 to B-F05 here and B-F06 through AIFACTORY-US-269 of the engine library feature, so that the gate runs on reviewed code, and then adds the Factory profile case to the manifest: a generation with `UseFactoryProfile` under the name of a Factory service repository, with the services the case needs, SQL Server for the outbox and the two-tenant fixture, a co-hosted silo and Redis for the leader lock. The candidate is packed once and installed; each case is generated, restored and built in Release; its tests run with the discovery and completion checks, the two-tenant fixture, the event tests and the inventory discovery tests among them for the Factory case; the dependency audit runs. A case that fails any stage fails the run with the case and the stage named, and publication is not reached. Publication requires the complete reports of every case bound to the candidate and pushes a version that is not yet on the ConnectSoft feed. This is an evidence PBI (D113): a template feature has no scenario, so the gate names what it proves through its ADRs, the requirement on release gates and its sources: the isolation rule of ADR-0015 and the generated-solution gate the epic requires of every template. Kind: evidence. Traces: adrs: ADR-0015, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-270, AIFACTORY-US-271, AIFACTORY-US-272, AIFACTORY-US-273, feature:component-base-template-findings. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/catalogs/templates.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the aggregator template with the reviews of the A-F02 to A-F06 and B-F01 to B-F06 implementations closed, which the status table of the template lists as open, when the template pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the default cases and the Factory profile case are generated, restored and built in Release, their tests run with the discovery and completion checks against the services the manifest declares, and the dependency audit runs (FR-11, ADR-0028 amendment on the Factory profile switch).",
        "AC2: Given a planted defect in the Factory profile case, a disabled tenant filter or an event published outside its transaction, when the pipeline evaluates the run, then the run fails at the test stage with the case named, no later stage of that case is reported as passed and the package is not published (FR-11, ADR-0015 decision 3).",
        "AC3: Given complete reports of every case bound to the candidate, when the publication job runs, then the package is pushed to the ConnectSoft feed with a version that was not on it, and a fresh install of that version generates an aggregator with `UseFactoryProfile` whose two-tenant, event and discovery tests pass unchanged (ADR-0028, model/backlog/epics.yaml states the gate as the completion of the epic)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/catalogs/templates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1237",
        "AIFACTORY-TASK-1238",
        "AIFACTORY-TASK-1239",
        "AIFACTORY-TASK-629"
      ],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2905,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0015",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-270",
        "AIFACTORY-US-271",
        "AIFACTORY-US-272",
        "AIFACTORY-US-273",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/catalogs/templates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-274]",
      "number": 274
    },
    {
      "id": "AIFACTORY-TASK-1237",
      "type": "task",
      "parent": "AIFACTORY-US-274",
      "title": "Factory profile case in the template pipeline manifest",
      "sequence": "18.26.05.01",
      "description": "BEFORE DEVELOPMENT. Factory profile case in the template pipeline manifest. Expected output: `build/template-ci.json` of the template holds, beside its default cases, one Factory profile case that generates with `UseFactoryProfile` under a Factory service name, with its test filter and the required services SQL Server, a silo and Redis; the shared installer jobs run the case on every change of the template.. Kind: operations. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: azure-pipelines-template.yml runs the default cases and the Factory profile case through the shared installer jobs.",
      "acceptanceCriteria": [
        "`build/template-ci.json` of the template holds, beside its default cases, one Factory profile case that generates with `UseFactoryProfile` under a Factory service name, with its test filter and the required services SQL Server, a silo and Redis; the shared installer jobs run the case on every change of the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2905,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1237]",
      "number": 1237
    },
    {
      "id": "AIFACTORY-TASK-1238",
      "type": "task",
      "parent": "AIFACTORY-US-274",
      "title": "Planted isolation and transaction defects for the gate",
      "sequence": "18.26.05.02",
      "description": "BEFORE DEVELOPMENT. Planted isolation and transaction defects for the gate. Expected output: Pipeline fixtures generate the Factory profile case with a disabled tenant filter and with an event published outside its transaction, and assert that each run fails at the test stage with the case named and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: each planted run stops before publication.",
      "acceptanceCriteria": [
        "Pipeline fixtures generate the Factory profile case with a disabled tenant filter and with an event published outside its transaction, and assert that each run fails at the test stage with the case named and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2905,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1238]",
      "number": 1238
    },
    {
      "id": "AIFACTORY-TASK-1239",
      "type": "task",
      "parent": "AIFACTORY-US-274",
      "title": "Open reviews closed and publication bound to the complete reports",
      "sequence": "18.26.05.03",
      "description": "BEFORE DEVELOPMENT. Open reviews closed and publication bound to the complete reports. Expected output: The reviews of the A-F02 to A-F06 and B-F01 to B-F05 implementations the status table of the template lists as open are closed, the review of B-F06 is closed by AIFACTORY-US-269, and the table says so for every row; the publication job requires the complete report of every case bound to the candidate and refuses a missing or failed stage and a version that is already on the ConnectSoft feed with the reason.. Kind: operations. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: a run with an incomplete report or a repeated version is refused at publication.",
      "acceptanceCriteria": [
        "The reviews of the A-F02 to A-F06 and B-F01 to B-F05 implementations the status table of the template lists as open are closed, the review of B-F06 is closed by AIFACTORY-US-269, and the table says so for every row; the publication job requires the complete report of every case bound to the candidate and refuses a missing or failed stage and a version that is already on the ConnectSoft feed with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2905,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1239]",
      "number": 1239
    },
    {
      "id": "AIFACTORY-TASK-629",
      "type": "task",
      "parent": "AIFACTORY-US-274",
      "title": "Factory parameters and the generated-solution gate",
      "sequence": "18.26.05.04",
      "description": "BEFORE DEVELOPMENT. Factory parameters and the generated-solution gate. Expected output: One green run and the two planted runs of the gate: the pipeline instantiates the packed template with `UseFactoryProfile`, builds and tests the generated solution with scope, the Factory event publication and the inventory discovery on together, and publishes only on the green run, after the reviews of the A-F02 to A-F06 and B-F01 to B-F06 implementations are closed; the runs prove AC1 to AC3 of AIFACTORY-US-274 (FR-11, ADR-0028).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One green run and the two planted runs of the gate: the pipeline instantiates the packed template with `UseFactoryProfile`, builds and tests the generated solution with scope, the Factory event publication and the inventory discovery on together, and publishes only on the green run, after the reviews of the A-F02 to A-F06 and B-F01 to B-F06 implementations are closed; the runs prove AC1 to AC3 of AIFACTORY-US-274 (FR-11, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2905,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-629]",
      "number": 629
    },
    {
      "id": "AIFACTORY-US-123",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-173",
      "title": "Health aggregator template: the Factory fleet profile with scoped targets and readiness events is delivered and proven on a generated solution",
      "sequence": "18.26.06",
      "description": "As an asset maintainer, I want HealthChecks aggregator to carry the Factory fleet profile with scoped targets and readiness events, so that it serves fleet and Factory health; the engine library in the environment and SLO services without later rework. This is the integration PBI of the feature. With the scoped targets, the Factory events, the inventory discovery, the profile parameter and the gate of the earlier PBIs, an asset maintainer generates the aggregator of a Factory estate by one command: `dotnet new connectsoft-healthchecks-aggregator` with `UseFactoryProfile`. The generated service takes its targets from the environment inventory, keeps each under its environment, tenant and project, answers its admin, health and graph routes only within what the Factory token grants, with 404 for a target of another tenant and 403 for a missing role, and publishes health flips, incident changes and readiness changes of an environment under the run event envelope with the row that records them. A generation without the parameter is the single-tenant aggregator the template generated before. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature. The feature is done when the packed template passes its default cases and the Factory profile case in the shared template pipeline, the package is on the ConnectSoft feed, and a fresh install of it generates the Factory aggregator that builds and passes its tests unchanged, which is the component the environment service of this increment and the SLO and fleet services of later increments name for their health. Kind: enabling. Traces: services: RuntimeEnvironmentService; adrs: ADR-0014, ADR-0015, ADR-0018, ADR-0028. Depends on: AIFACTORY-US-270, AIFACTORY-US-271, AIFACTORY-US-272, AIFACTORY-US-273, AIFACTORY-US-274. Sources: model/components.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/reference/schemas/readiness-bundle.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.HealthChecksAggregatorTemplate 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-626 (targets scoped by environment, tenant and project) is done, then target records and the ops registry carry environment, tenant and project, the admin, health and graph routes read the scope from the Factory token and return only targets within it, proven by a two-tenant test, and the orchestrator health and readiness stay anonymous (ADR-0015 decision 3).",
        "AC3: Given the work of AIFACTORY-TASK-627 (health flips and the readiness bundle as Factory events) is done, then health flips, incident changes and readiness changes are published under the run event envelope through the Orleans messaging profile, the readiness event carries what a signal member of docs/reference/schemas/readiness-bundle.schema.json needs, and the sinks stay notify-only (ADR-0014 decision 4).",
        "AC4: Given the work of AIFACTORY-TASK-628 (discovery from the Factory environment inventory) is done, then a discovery source reads targets from the environment inventory of the Factory beside static configuration and the Kubernetes scrape, merged by the existing inventory rules and selected by the discovery parameter, with the merge precedence recorded (ADR-0018, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC5: Given the work of AIFACTORY-TASK-629 (factory parameters and the generated-solution gate) is done, then `UseFactoryProfile` turns scope, the Factory event publication and the inventory discovery on together, the pipeline instantiates the packed template with it, builds and tests the generated solution, and the reviews the status table of the template lists as open, A-F02 to A-F06 and B-F01 to B-F06 and not only B-F04 to B-F06 as the migrated text had it, are closed first (ADR-0028 amendment on the Factory profile switch)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1240",
        "AIFACTORY-TASK-682"
      ],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2906,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0018",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-270",
        "AIFACTORY-US-271",
        "AIFACTORY-US-272",
        "AIFACTORY-US-273",
        "AIFACTORY-US-274"
      ],
      "source": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-123]",
      "number": 123
    },
    {
      "id": "AIFACTORY-TASK-1240",
      "type": "task",
      "parent": "AIFACTORY-US-123",
      "title": "Locked decisions of the template extended for the Factory profile",
      "sequence": "18.26.06.01",
      "description": "BEFORE DEVELOPMENT. Locked decisions of the template extended for the Factory profile. Expected output: The table of locked decisions on the index page of the control plane backlog of the template states, beside each decision the profile touches (the ops-only single-tenant registry, the notify-only sinks, the discovery default and the Redis leader election), what holds under `UseFactoryProfile` and that the decision is unchanged without it.. Kind: documentation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "The table of locked decisions on the index page of the control plane backlog of the template states, beside each decision the profile touches (the ops-only single-tenant registry, the notify-only sinks, the discovery default and the Redis leader election), what holds under `UseFactoryProfile` and that the decision is unchanged without it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2906,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1240]",
      "number": 1240
    },
    {
      "id": "AIFACTORY-TASK-682",
      "type": "task",
      "parent": "AIFACTORY-US-123",
      "title": "Verify healthchecks-aggregator-fleet-profile-delivered by running the declared command",
      "sequence": "18.26.06.02",
      "description": "BEFORE DEVELOPMENT. Verify healthchecks-aggregator-fleet-profile-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on the default and Factory profile cases generated from the published package; they pass and prove AC1 to AC5 of AIFACTORY-US-123.. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on the default and Factory profile cases generated from the published package; they pass and prove AC1 to AC5 of AIFACTORY-US-123."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/Index.md",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/health-agg-core.md",
        "docs/reference/schemas/readiness-bundle.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 29,
      "phase": "templates-and-libraries",
      "stackRank": 2906,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-682]",
      "number": 682
    },
    {
      "id": "AIFACTORY-FEAT-174",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "HealthChecks.Aggregator engine library: published and reusable from a base-template service",
      "sequence": "18.27",
      "description": "The aggregation engine ConnectSoft.HealthChecks.Aggregator ships as a project inside the aggregator template (B-F06) with a console sample and a pack pipeline; the move to a sibling repository is deferred. The environment and SLO services of the Factory probe environments through this engine (poller, adaptive intervals, hysteresis readiness, incident state machine) rather than running one full aggregator per environment, which needs the engine on the feed with a verified version and its types carrying environment, tenant and project. Component: HealthChecks aggregator (extend), library ConnectSoft.HealthChecks.Aggregator. BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I2: Deliver it. Build order 28 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-267",
        "AIFACTORY-US-268",
        "AIFACTORY-US-269",
        "AIFACTORY-US-122"
      ],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2800,
      "titlePrefix": "[AIFACTORY-FEAT-174]",
      "number": 174
    },
    {
      "id": "AIFACTORY-US-267",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-174",
      "title": "HealthChecks.Aggregator engine: targets, samples, flips and incidents carry environment, tenant and project, and the engine passes them through unchanged",
      "sequence": "18.27.01",
      "description": "As an asset maintainer, I want the engine types to carry the environment, tenant and project a target belongs to, so that a Factory service can probe the targets of many environments through one engine without mixing their state. The B-F06 page of the aggregator template (Docs/Control Plane/b-f06-library.md of the template) specifies the engine package `ConnectSoft.HealthChecks.Aggregator`: a packable facade in `src/ConnectSoft.HealthChecks.Aggregator` whose public surface is `HealthCheckAggregatorOptions`, `DownstreamServiceOptions`, the probe types, `IHealthCheckAggregatorService`, `IReadinessGateEvaluator`, `IHealthIncidentSink` with the incident and mute records, `SloMath` and `SloRules`, `ILeaderElection` and the registration `AddHealthChecksAggregatorEngine`. The locked decisions of the template keep its registry single-tenant, so none of these types knows which environment, tenant or project a target belongs to. The environment and SLO services of the Factory probe the workloads of many environments through this engine, and ADR-0015 decision 2 has every Factory contract carry the trusted tenant and project. This PBI adds three optional identifiers, environment, tenant and project, to the target options and to the sample, flip, readiness transition and incident records the engine hands to its seams. The engine never resolves or checks them: it copies the identifiers of a target onto everything it produces for that target and passes them to `IHealthIncidentSink` and to the history interfaces. The identifiers are plain values named as the envelope fields of ADR-0014 decision 1 name them; the engine references no Factory package and forks no scope type. A host that sets none of them, such as the sample `samples/MinimalHost`, behaves as before, and no existing public name changes, as the page requires for the first version. Two targets with the same name in different environments are distinct: the key of a target in the cache, in the hysteresis machine and in the incident state is the name together with the three identifiers, so the state of one environment never leaks into another. The options validation refuses a target that sets a project without a tenant and names the target. Kind: enabling. Traces: services: RuntimeEnvironmentService; adrs: ADR-0014, ADR-0015, ADR-0018, ADR-0028. Sources: model/components.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a target configured with an environment, a tenant and a project, when the engine polls it, flips its state, changes the readiness of its group and opens an incident, then every sample, flip, readiness transition and incident handed to the history interfaces and to `IHealthIncidentSink` carries the three identifiers of the target unchanged (ADR-0015 decision 2, ADR-0014 decision 1).",
        "AC2: Given two targets with the same name in two environments, when one fails and the other stays healthy, then the cache entry, the hysteresis state and the incident of the failing target are kept under its own key and the readiness of the other environment does not change (ADR-0018, model/components.yaml).",
        "AC3: Given a host that sets none of the three identifiers, when the unit tests and the contract test `LibrarySpecContractTests` of the library run, then the behaviour and every public name of the engine are unchanged; given a target with a project and no tenant, then the options validation refuses it and names the target (ADR-0015 decision 2, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1214",
        "AIFACTORY-TASK-1215",
        "AIFACTORY-TASK-1216",
        "AIFACTORY-TASK-1217"
      ],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2801,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0018",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-267]",
      "number": 267
    },
    {
      "id": "AIFACTORY-TASK-1214",
      "type": "task",
      "parent": "AIFACTORY-US-267",
      "title": "Environment, tenant and project on the target options and the engine records",
      "sequence": "18.27.01.01",
      "description": "BEFORE DEVELOPMENT. Environment, tenant and project on the target options and the engine records. Expected output: `DownstreamServiceOptions` and the sample, flip, readiness transition and incident records of the engine gain the optional identifiers environment, tenant and project, named as the envelope fields name them; the options validation refuses a project without a tenant; `LibrarySpecContractTests` lists the added members and finds no renamed one.. Kind: contract. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`DownstreamServiceOptions` and the sample, flip, readiness transition and incident records of the engine gain the optional identifiers environment, tenant and project, named as the envelope fields name them; the options validation refuses a project without a tenant; `LibrarySpecContractTests` lists the added members and finds no renamed one."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2801,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1214]",
      "number": 1214
    },
    {
      "id": "AIFACTORY-TASK-1215",
      "type": "task",
      "parent": "AIFACTORY-US-267",
      "title": "Identifiers copied through the poll cycle and into the target key",
      "sequence": "18.27.01.02",
      "description": "BEFORE DEVELOPMENT. Identifiers copied through the poll cycle and into the target key. Expected output: The poll cycle copies the identifiers of a target onto every sample, flip, readiness transition and incident, and the key of a target in the cache, the hysteresis machine and the incident state is the name together with the three identifiers; a host without identifiers keeps the key and the behaviour it has.. Kind: implementation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The poll cycle copies the identifiers of a target onto every sample, flip, readiness transition and incident, and the key of a target in the cache, the hysteresis machine and the incident state is the name together with the three identifiers; a host without identifiers keeps the key and the behaviour it has."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1215]",
      "number": 1215
    },
    {
      "id": "AIFACTORY-TASK-1216",
      "type": "task",
      "parent": "AIFACTORY-US-267",
      "title": "Two-environment tests of the engine state",
      "sequence": "18.27.01.03",
      "description": "BEFORE DEVELOPMENT. Two-environment tests of the engine state. Expected output: Unit tests poll two targets with the same name in two environments through scripted probe results, assert the identifiers on every record the sink and the history interfaces receive, and assert that a failure in one environment changes no cache entry, hysteresis state or incident of the other.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Unit tests poll two targets with the same name in two environments through scripted probe results, assert the identifiers on every record the sink and the history interfaces receive, and assert that a failure in one environment changes no cache entry, hysteresis state or incident of the other."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2801,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1216]",
      "number": 1216
    },
    {
      "id": "AIFACTORY-TASK-1217",
      "type": "task",
      "parent": "AIFACTORY-US-267",
      "title": "Verify the scoped engine records and the unchanged default behaviour",
      "sequence": "18.27.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the scoped engine records and the unchanged default behaviour. Expected output: Run `dotnet test -c Release --no-build` on the library and its test projects; the two-environment tests, the validation test and `LibrarySpecContractTests` pass and the sample `samples/MinimalHost` runs unchanged, which proves AC1 to AC3 of AIFACTORY-US-267 (ADR-0015, ADR-0018).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the library and its test projects; the two-environment tests, the validation test and `LibrarySpecContractTests` pass and the sample `samples/MinimalHost` runs unchanged, which proves AC1 to AC3 of AIFACTORY-US-267 (ADR-0015, ADR-0018)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1217]",
      "number": 1217
    },
    {
      "id": "AIFACTORY-US-268",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-174",
      "title": "HealthChecks.Aggregator engine: a service generated from the base template polls scoped targets through the package with adaptive intervals and hysteresis and without a host stack of the aggregator",
      "sequence": "18.27.02",
      "description": "As an asset maintainer, I want the engine proven inside a service that is not the aggregator host, so that the environment and SLO services reuse the poller instead of running one aggregator per environment. The B-F06 page divides the host from the library. The ASP.NET controllers, the Blazor `/graph` page, the MCP tools, the Kubernetes watcher, the Redis lock implementation and the identity middleware stay in the template host. The engine holds the probe executors, the poll cycle given an `ILeaderElection`, the readiness strategies with the hysteresis machine, the incident model and the SLO math, and its architecture test `AggregatorLibraryMustNotDependOnHostStacks` keeps the facade free of ASP.NET MVC, Blazor, MCP, Kubernetes and Redis references. The only consumer proven so far is the console sample `samples/MinimalHost`, which uses a project reference. The Factory reuses the engine in services scaffolded from the base template, where RuntimeEnvironmentService names the component (model/services/runtime-cloud/RuntimeEnvironmentService.yaml). This PBI proves that reuse and closes what stands in its way. A test host is generated at test time from the pinned published base template package with `UseFactoryProfile` into a scratch folder. The generated solution is not committed, so it cannot go stale against the base template, and it stays outside the installer payload that `build/Stage-InstallerPayload.ps1` stages; only the overlay files of the host, its registration, its election, its sink and its scripted targets, live among the tests of the template repository. The host references the engine as a package from a local feed, registers `AddHealthChecksAggregatorEngine`, supplies its own `ILeaderElection` and its own `IHealthIncidentSink`, and polls two targets of two environments, one healthy and one that fails and recovers. The adaptive intervals shorten the interval of the failing target, the hysteresis machine holds the readiness of its environment until the configured number of consecutive results, and the sink receives one incident opened and one resolved with the identifiers of the target. The page records that the engine types still live in the fork-layer projects and reach the package through private project references, which the pack already copies into it (`PrivateAssets=all` with `CopyProjectReferencesToPackage`). The copy exists; what is missing is a proof from the side of a consumer. This PBI adds a pack test that restores the package into an empty project from a local feed and fails when a type of the public surface cannot be loaded, and the test host restores the same package, so a package that lacks one of those assemblies cannot ship. The default `AlwaysLeaderElection` suits a single replica only: two instances of the test host with a shared election prove that only the leader polls, and the page of the library states that a service with more than one replica registers its own election. Kind: enabling. Traces: services: RuntimeEnvironmentService; adrs: ADR-0018, ADR-0028. Depends on: AIFACTORY-US-267, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a test host generated at test time from the pinned published base template package, which references the engine as a package and registers `AddHealthChecksAggregatorEngine`, when it polls a healthy target and a target that fails and recovers in two environments, then the interval of the failing target shortens, the readiness of its environment changes only after the configured number of consecutive results, and the sink of the host receives one opened and one resolved incident with the identifiers of the target (ADR-0018, model/services/runtime-cloud/RuntimeEnvironmentService.yaml).",
        "AC2: Given the packed engine, when the pack test restores it from a local feed into an empty project and the test host restores it without any project reference into the template, then the restore and the build succeed, every type of the public surface loads from the fork-layer assemblies inside the package, and the architecture test `AggregatorLibraryMustNotDependOnHostStacks` finds no reference to ASP.NET MVC, Blazor, MCP, Kubernetes, Redis or a Factory package in the engine (ADR-0028, model/components.yaml).",
        "AC3: Given two instances of the test host that share one implementation of `ILeaderElection`, when both run, then only the leader polls and writes samples, and when the leader stops the other instance takes over within the lease of the election, so that a service with several replicas does not probe a target twice (ADR-0018, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1218",
        "AIFACTORY-TASK-1219",
        "AIFACTORY-TASK-631"
      ],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2802,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0018",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-267",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-268]",
      "number": 268
    },
    {
      "id": "AIFACTORY-TASK-1218",
      "type": "task",
      "parent": "AIFACTORY-US-268",
      "title": "Test host generated at test time from the base template that consumes the engine as a package",
      "sequence": "18.27.02.01",
      "description": "BEFORE DEVELOPMENT. Test host generated at test time from the base template that consumes the engine as a package. Expected output: A test fixture generates a host from the pinned published base template package with `UseFactoryProfile` into a scratch folder at test time; the generated solution is not committed and is outside the installer payload `build/Stage-InstallerPayload.ps1` stages; only the overlay files of the host live among the tests of the template repository: the registration of `AddHealthChecksAggregatorEngine`, its own leader election, its incident sink and two scripted targets of two environments; the host restores the packed engine from a local feed.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A test fixture generates a host from the pinned published base template package with `UseFactoryProfile` into a scratch folder at test time; the generated solution is not committed and is outside the installer payload `build/Stage-InstallerPayload.ps1` stages; only the overlay files of the host live among the tests of the template repository: the registration of `AddHealthChecksAggregatorEngine`, its own leader election, its incident sink and two scripted targets of two environments; the host restores the packed engine from a local feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1218]",
      "number": 1218
    },
    {
      "id": "AIFACTORY-TASK-1219",
      "type": "task",
      "parent": "AIFACTORY-US-268",
      "title": "Pack test that loads the public surface of the engine from the restored package",
      "sequence": "18.27.02.02",
      "description": "BEFORE DEVELOPMENT. Pack test that loads the public surface of the engine from the restored package. Expected output: The pack of `src/ConnectSoft.HealthChecks.Aggregator` already copies the fork-layer assemblies of its private project references into the package (`PrivateAssets=all` with `CopyProjectReferencesToPackage`); the added pack test restores the package into an empty project from a local feed, asserts that the package declares only published packages as dependencies, and fails when a type of the public surface cannot be loaded.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet pack -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The pack of `src/ConnectSoft.HealthChecks.Aggregator` already copies the fork-layer assemblies of its private project references into the package (`PrivateAssets=all` with `CopyProjectReferencesToPackage`); the added pack test restores the package into an empty project from a local feed, asserts that the package declares only published packages as dependencies, and fails when a type of the public surface cannot be loaded."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1219]",
      "number": 1219
    },
    {
      "id": "AIFACTORY-TASK-631",
      "type": "task",
      "parent": "AIFACTORY-US-268",
      "title": "Scope in the engine types and host-free reuse proven",
      "sequence": "18.27.02.03",
      "description": "BEFORE DEVELOPMENT. Scope in the engine types and host-free reuse proven. Expected output: Run the test host of AIFACTORY-TASK-1218 and the architecture test of the library: the engine references no ASP.NET host, Blazor graph, MCP, Kubernetes or Redis lock implementation, the test host built on the base template polls two targets through the engine with adaptive intervals and hysteresis, and two instances with a shared election poll once, which proves AC1 to AC3 of AIFACTORY-US-268 (ADR-0018, ADR-0028).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Run the test host of AIFACTORY-TASK-1218 and the architecture test of the library: the engine references no ASP.NET host, Blazor graph, MCP, Kubernetes or Redis lock implementation, the test host built on the base template polls two targets through the engine with adaptive intervals and hysteresis, and two instances with a shared election poll once, which proves AC1 to AC3 of AIFACTORY-US-268 (ADR-0018, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-631]",
      "number": 631
    },
    {
      "id": "AIFACTORY-US-269",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-174",
      "title": "HealthChecks.Aggregator engine: the package is built, tested and published to the ConnectSoft feed with a version its consumers pin, and the deferred repository decision is recorded",
      "sequence": "18.27.03",
      "description": "As an asset maintainer, I want the engine on the feed under a version a service can pin, so that the environment service of this increment restores the engine from the feed and not from the template repository. This PBI is the publication proof of the feature. The B-F06 page locks the feed and the mechanism: the internal ConnectSoft feed through `azure-pipelines-healthchecks-aggregator.yml`, which packs and pushes on `master`, with the version key in `Directory.Packages.props`; it defers the move of the library to a sibling repository, and the status page of the control plane backlog keeps the feature of B-F06 open until the review of its implementation closes. The need the Factory records for this component is the engine on the feed (model/components.yaml). This PBI closes that review, then has the pipeline build the library, run its unit tests, the architecture test and the contract test, pack it and push it to the ConnectSoft feed, the Azure Artifacts feed the ConnectSoft libraries already publish to. The version is raised from the first version of the page, because the scope identifiers were added to the public records, and a version that is already on the feed is refused. The deferred decision is taken and recorded as a decision record of the template repository: the library stays in the template repository or moves to a sibling repository, and in both cases the package identifier `ConnectSoft.HealthChecks.Aggregator` and its feed do not change, so a consumer pin survives the decision. A probe proves the package from the side of a consumer: a copy of the sample `samples/MinimalHost` that references the published package and no project of the template restores it from the feed and prints one aggregated report. The published version is recorded on the B-F06 page, where the consuming services read their pin. This is an evidence PBI (D113): a library feature has no scenario, so the probe names what it proves through its ADRs, the requirement on release gates and its sources. Kind: evidence. Traces: adrs: ADR-0018, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-267, AIFACTORY-US-268. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the review of the B-F06 implementation is closed, when `azure-pipelines-healthchecks-aggregator.yml` runs on `master`, then the library is built, its unit tests, architecture test and contract test pass, and the package `ConnectSoft.HealthChecks.Aggregator` is pushed to the ConnectSoft feed with a version higher than the first version and recorded on the B-F06 page (FR-11, ADR-0028, model/components.yaml).",
        "AC2: Given the published package, when a copy of the sample host that references the package and no project of the template restores it from the feed and runs, then it prints one aggregated report for its configured target, which proves that a consumer outside the template repository can use the engine (ADR-0018, docs/architecture/ecosystem-composition.md).",
        "AC3: Given a failing test or a version that is already on the feed, when the pipeline reaches the push, then the push is refused with the reason; and given the decision record of the repository, when it is read, then it states whether the library stays or moves and that the package identifier and the feed do not change (FR-11, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-630",
        "AIFACTORY-TASK-1220",
        "AIFACTORY-TASK-1221",
        "AIFACTORY-TASK-1222"
      ],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2803,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0018",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-267",
        "AIFACTORY-US-268"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-269]",
      "number": 269
    },
    {
      "id": "AIFACTORY-TASK-630",
      "type": "task",
      "parent": "AIFACTORY-US-269",
      "title": "Engine package published with a verified version",
      "sequence": "18.27.03.01",
      "description": "BEFORE DEVELOPMENT. Engine package published with a verified version. Expected output: azure-pipelines-healthchecks-aggregator.yml builds, tests and packs ConnectSoft.HealthChecks.Aggregator and pushes it to the ConnectSoft feed on master after the tests pass, refuses a version that is already on the feed, and the version key of `Directory.Packages.props` holds the raised version.. Kind: operations. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: azure-pipelines-healthchecks-aggregator.yml pushes after the tests and a repeated version is refused.",
      "acceptanceCriteria": [
        "azure-pipelines-healthchecks-aggregator.yml builds, tests and packs ConnectSoft.HealthChecks.Aggregator and pushes it to the ConnectSoft feed on master after the tests pass, refuses a version that is already on the feed, and the version key of `Directory.Packages.props` holds the raised version."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2803,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-630]",
      "number": 630
    },
    {
      "id": "AIFACTORY-TASK-1220",
      "type": "task",
      "parent": "AIFACTORY-US-269",
      "title": "Decision record of the library home, the election guidance and the published version on the B-F06 page",
      "sequence": "18.27.03.02",
      "description": "BEFORE DEVELOPMENT. Decision record of the library home, the election guidance and the published version on the B-F06 page. Expected output: A decision record of the template repository states whether the library stays in the repository or moves to a sibling repository and that the package identifier and the feed do not change; the B-F06 page names the published version, the scope identifiers of the records and the rule that a service with more than one replica registers its own `ILeaderElection`; the status page closes the feature of B-F06.. Kind: documentation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "A decision record of the template repository states whether the library stays in the repository or moves to a sibling repository and that the package identifier and the feed do not change; the B-F06 page names the published version, the scope identifiers of the records and the rule that a service with more than one replica registers its own `ILeaderElection`; the status page closes the feature of B-F06."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2803,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1220]",
      "number": 1220
    },
    {
      "id": "AIFACTORY-TASK-1221",
      "type": "task",
      "parent": "AIFACTORY-US-269",
      "title": "Feed probe from a copy of the sample host",
      "sequence": "18.27.03.03",
      "description": "BEFORE DEVELOPMENT. Feed probe from a copy of the sample host. Expected output: A copy of `samples/MinimalHost` that references the published package and no project of the template restores it from the ConnectSoft feed, configures one target and prints one aggregated report; the probe runs as the last stage of the library pipeline.. Kind: fixture. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: the probe stage of the pipeline is green.",
      "acceptanceCriteria": [
        "A copy of `samples/MinimalHost` that references the published package and no project of the template restores it from the ConnectSoft feed, configures one target and prints one aggregated report; the probe runs as the last stage of the library pipeline."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2803,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1221]",
      "number": 1221
    },
    {
      "id": "AIFACTORY-TASK-1222",
      "type": "task",
      "parent": "AIFACTORY-US-269",
      "title": "Verify the published engine by the probe and by a repeated version",
      "sequence": "18.27.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the published engine by the probe and by a repeated version. Expected output: One run of the library pipeline publishes the package and the probe prints its report; a second run with the same version is refused at the push; both runs prove AC1 to AC3 of AIFACTORY-US-269 (FR-11, ADR-0028).. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "One run of the library pipeline publishes the package and the probe prints its report; a second run with the same version is refused at the push; both runs prove AC1 to AC3 of AIFACTORY-US-269 (FR-11, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1222]",
      "number": 1222
    },
    {
      "id": "AIFACTORY-US-122",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-174",
      "title": "HealthChecks.Aggregator engine library: published and reusable from a base-template service is delivered and proven by its consumers",
      "sequence": "18.27.04",
      "description": "As an asset maintainer, I want the HealthChecks.Aggregator engine to be published and reusable from a base-template service, so that it serves fleet and Factory health in the environment and SLO services without later rework. This is the integration PBI of the feature. With the scope identifiers on the engine records, the reuse proven from a service generated from the base template and the publication proof of the earlier PBIs, a Factory service probes the targets of its environments by three steps: it pins the published `ConnectSoft.HealthChecks.Aggregator` package, registers `AddHealthChecksAggregatorEngine` with its own leader election and incident sink, and configures targets with their environment, tenant and project. The poller, the adaptive intervals, the hysteresis readiness and the incident state machine then run inside the service, and every sample, flip and incident it receives names the environment it belongs to. The service runs no aggregator host: no controller, graph page, MCP tool, Kubernetes watcher or Redis lock of the template is referenced, which the architecture test of the library keeps true. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature. The feature is done when the package is on the ConnectSoft feed with the version the B-F06 page names, the probe host restores it from the feed, and the decision on the home of the library is recorded, which gives the fleet profile of the aggregator template and the environment service of the same increment the scoped engine they depend on. Kind: enabling. Traces: services: RuntimeEnvironmentService; adrs: ADR-0018, ADR-0028. Depends on: AIFACTORY-US-267, AIFACTORY-US-268, AIFACTORY-US-269. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.HealthChecksAggregatorTemplate with the work of this feature, when the library pipeline runs, then the engine package builds, its tests pass and it publishes to the ConnectSoft feed with a verified version that the consuming repositories pin (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-630 (engine package published with a verified version) is done, then azure-pipelines-healthchecks-aggregator.yml packs ConnectSoft.HealthChecks.Aggregator and pushes it to the feed on master, the deferred sibling-repository decision is taken and recorded, and a copy of the MinimalHost sample restores the package from the feed (ADR-0028, docs/architecture/ecosystem-composition.md).",
        "AC3: Given the work of AIFACTORY-TASK-631 (scope in the engine types and host-free reuse proven) is done, then target, sample, flip and incident types carry environment, tenant and project, an architecture test proves the engine references no ASP.NET host, Blazor graph, MCP, Kubernetes or Redis lock implementation, and a test host built on the base template polls two targets through the engine with adaptive intervals and hysteresis (ADR-0018, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1223",
        "AIFACTORY-TASK-681"
      ],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2804,
      "kind": "enabling",
      "traces": {
        "services": [
          "RuntimeEnvironmentService"
        ],
        "adrs": [
          "ADR-0018",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-267",
        "AIFACTORY-US-268",
        "AIFACTORY-US-269"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-122]",
      "number": 122
    },
    {
      "id": "AIFACTORY-TASK-1223",
      "type": "task",
      "parent": "AIFACTORY-US-122",
      "title": "Consumer page of the engine for a base-template service",
      "sequence": "18.27.04.01",
      "description": "BEFORE DEVELOPMENT. Consumer page of the engine for a base-template service. Expected output: The B-F06 page gains a consumer section for a service generated from the base template: the package reference, the registration with its own leader election and incident sink, targets with their environment, tenant and project, and what the service receives on a flip and on an incident.. Kind: documentation. Repository: ConnectSoft.HealthChecksAggregatorTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "The B-F06 page gains a consumer section for a service generated from the base template: the package reference, the registration with its own leader election and incident sink, targets with their environment, tenant and project, and what the service receives on a flip and on an incident."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2804,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1223]",
      "number": 1223
    },
    {
      "id": "AIFACTORY-TASK-681",
      "type": "task",
      "parent": "AIFACTORY-US-122",
      "title": "Verify healthchecks-aggregator-engine-library-delivered by running the declared command",
      "sequence": "18.27.04.02",
      "description": "BEFORE DEVELOPMENT. Verify healthchecks-aggregator-engine-library-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library, its tests and the test host of AIFACTORY-TASK-1218, and the feed probe of AIFACTORY-TASK-1221 against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-122.. Kind: verification. Repository: ConnectSoft.HealthChecksAggregatorTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the library, its tests and the test host of AIFACTORY-TASK-1218, and the feed probe of AIFACTORY-TASK-1221 against the published version; they pass and prove AC1 to AC3 of AIFACTORY-US-122."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.HealthChecksAggregatorTemplate/Docs/Control Plane/b-f06-library.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.HealthChecksAggregatorTemplate"
      ],
      "children": [],
      "buildOrder": 28,
      "phase": "templates-and-libraries",
      "stackRank": 2804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-681]",
      "number": 681
    },
    {
      "id": "AIFACTORY-FEAT-185",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Platform template: the environment stack of a Factory estate, as a real template",
      "sequence": "18.28",
      "description": "The platform template repository (connectsoft-platform-template) holds what a whole estate needs and no single service template carries: a Pulumi infrastructure project with an Azure stack and an AWS stack and per-stack configuration (ADR-0004), Kubernetes deployment, service and network-policy manifests, docker-compose files for a local estate and for CI, and the observability stack scripts (OpenTelemetry collector, Prometheus, Grafana) with four pages on configuring, running and debugging it. It is not a template yet: there is no .template.config, the inventory records zero switches, the README is the base template''s scaffold with its TODO markers, the Solution Structure page lists about forty projects the repository does not contain, and the hand-written platform-template page of this site describes a multi-service SaaS generator the repository does not implement. Delivering a generated service to a preview environment and promoting it (I2) needs exactly what the repository holds, bound to the Factory''s infrastructure blueprint and deployment profiles: the environment baseline, the per-service workload manifests, the observability specification and a local estate. Component: Platform template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-157, AIFACTORY-FEAT-175. Increment I2: Deliver it. Build order 30 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-314",
        "AIFACTORY-US-315",
        "AIFACTORY-US-316",
        "AIFACTORY-US-317",
        "AIFACTORY-US-318",
        "AIFACTORY-US-124"
      ],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3000,
      "titlePrefix": "[AIFACTORY-FEAT-185]",
      "number": 185
    },
    {
      "id": "AIFACTORY-US-314",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-185",
      "title": "Platform template: the repository becomes a packable template with estate parameters, `UseFactoryProfile` and pages that describe what it contains",
      "sequence": "18.28.01",
      "description": "As an asset maintainer, I want the platform template repository to be a template with parameters and honest pages, so that an estate is generated by a command and the inventory can bind every parameter. The platform template repository holds a Pulumi infrastructure project with an Azure stack and an AWS stack, Kubernetes deployment, service and network-policy manifests, docker-compose files for a local estate and for CI, and the observability stack scripts. It is not a template: it has no template configuration, the inventory of this repository records zero switches for it, its README is the scaffold of the base template with its TODO markers, its Solution Structure page lists projects the repository does not contain, and docs/templates-docs/platform-template.md of this site describes a multi-service generator the repository does not implement. Its Observability Stack page already names two template parameters, `ObservabilityStack` and `ObservabilityBackend`, that no configuration defines. This PBI makes the repository a template. It gains a template configuration with the symbols an estate needs: the estate name, the cloud, the deployment profile in the four values of ADR-0017, `ObservabilityStack` and `ObservabilityBackend` as the page names them, the list of services to include and the path of the infrastructure blueprint. A template configuration cannot emit a set of files per element of a list parameter, so the list is written by plain replacement into an estate definition file of the generated repository, and the files of each service are written from that file by the generate command AIFACTORY-US-316 defines. The Factory shape is selected by the boolean parameter `UseFactoryProfile`, off by default, the name every template uses; the later PBIs of this file put the blueprint input and the Factory conventions under it. The repository packs, installs and instantiates like the other templates. The README and the Solution Structure page describe the infrastructure project, the manifests, the compose files and the scripts that exist and drop the scaffold text and the TODO markers. This site corrects its platform template page, and the next inventory writes the parameter snapshot with a Factory binding for every parameter. Kind: enabling. Traces: adrs: ADR-0004, ADR-0017, ADR-0028. Sources: model/components.yaml, model/templates.yaml, docs/templates-docs/platform-template.md, docs/architecture/adr/0017-deployment-profiles.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository with its template configuration, when it is packed and installed and an estate is instantiated with an estate name, the Azure cloud, a deployment profile, an observability backend and two services, then the generated repository holds the infrastructure project, the estate definition file that names the two services, the estate generator and the observability files of the chosen backend, and builds (ADR-0028 amendment on scaffolding from published templates; ADR-0017 names the four profiles the parameter offers).",
        "AC2: Given the next template inventory of this repository, when it runs, then model/templates.yaml records a switch count above zero for `connectsoft-platform-template`, a parameter snapshot exists under model/template-parameters with a Factory binding for every parameter including `UseFactoryProfile`, and docs/templates-docs/platform-template.md describes what the repository contains and carries no warning about an intended template (ADR-0028).",
        "AC3: Given the pages of the template, when they are compared with the repository, then the README and the Solution Structure page name only projects, folders and scripts that exist, hold no scaffold text of the base template and no TODO markers, and the Observability Stack page names the two parameters with the values the template configuration defines (ADR-0004: the infrastructure project is a Pulumi program; docs/templates-docs/platform-template.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/templates-docs/platform-template.md",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1361",
        "AIFACTORY-TASK-654",
        "AIFACTORY-TASK-1362",
        "AIFACTORY-TASK-1363"
      ],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3001,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0004",
          "ADR-0017",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/templates-docs/platform-template.md",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-314]",
      "number": 314
    },
    {
      "id": "AIFACTORY-TASK-1361",
      "type": "task",
      "parent": "AIFACTORY-US-314",
      "title": "Template configuration with the estate symbols and `UseFactoryProfile`",
      "sequence": "18.28.01.01",
      "description": "BEFORE DEVELOPMENT. Template configuration with the estate symbols and `UseFactoryProfile`. Expected output: The repository holds a template configuration with the short name `connectsoft-platform-template` and symbols for the estate name, the cloud, the deployment profile, `ObservabilityStack`, `ObservabilityBackend`, the list of services, the path of the infrastructure blueprint and the boolean `UseFactoryProfile`, off by default, each with its command-line name, its choices and its description; the list of services is written by replacement into the estate definition file `estate.yaml` of the generated repository, and the blueprint path seeds the stack configuration key `blueprintPath`.. Kind: contract. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet new connectsoft-platform-template --help lists every symbol.",
      "acceptanceCriteria": [
        "The repository holds a template configuration with the short name `connectsoft-platform-template` and symbols for the estate name, the cloud, the deployment profile, `ObservabilityStack`, `ObservabilityBackend`, the list of services, the path of the infrastructure blueprint and the boolean `UseFactoryProfile`, off by default, each with its command-line name, its choices and its description; the list of services is written by replacement into the estate definition file `estate.yaml` of the generated repository, and the blueprint path seeds the stack configuration key `blueprintPath`."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3001,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1361]",
      "number": 1361
    },
    {
      "id": "AIFACTORY-TASK-654",
      "type": "task",
      "parent": "AIFACTORY-US-314",
      "title": "A packable template with parameters and its own pages",
      "sequence": "18.28.01.02",
      "description": "BEFORE DEVELOPMENT. A packable template with parameters and its own pages. Expected output: The repository packs, installs and instantiates in its pipeline like the other templates; the symbols gate the files of each cloud and backend, while the files of each service are not template output and are written from the estate definition file by the generate command of AIFACTORY-TASK-1425; the README and the Solution Structure page describe what the repository contains and drop the scaffold text of the base template and the TODO markers; the Observability Stack page names the parameters the configuration defines.. Kind: implementation. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository packs, installs and instantiates in its pipeline like the other templates; the symbols gate the files of each cloud and backend, while the files of each service are not template output and are written from the estate definition file by the generate command of AIFACTORY-TASK-1425; the README and the Solution Structure page describe what the repository contains and drop the scaffold text of the base template and the TODO markers; the Observability Stack page names the parameters the configuration defines."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-654]",
      "number": 654
    },
    {
      "id": "AIFACTORY-TASK-1362",
      "type": "task",
      "parent": "AIFACTORY-US-314",
      "title": "Platform template page of this site and the parameter snapshot with Factory bindings",
      "sequence": "18.28.01.03",
      "description": "BEFORE DEVELOPMENT. Platform template page of this site and the parameter snapshot with Factory bindings. Expected output: docs/templates-docs/platform-template.md describes the infrastructure project, the manifests, the compose estate and the observability stack of the template and its parameters; after `python -I tools/docs_model inventory-templates` model/templates.yaml lists the switches and the snapshot under model/template-parameters holds a binding for every parameter.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "docs/templates-docs/platform-template.md describes the infrastructure project, the manifests, the compose estate and the observability stack of the template and its parameters; after `python -I tools/docs_model inventory-templates` model/templates.yaml lists the switches and the snapshot under model/template-parameters holds a binding for every parameter."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3001,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1362]",
      "number": 1362
    },
    {
      "id": "AIFACTORY-TASK-1363",
      "type": "task",
      "parent": "AIFACTORY-US-314",
      "title": "Verify the instantiation, the inventory and the pages",
      "sequence": "18.28.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the instantiation, the inventory and the pages. Expected output: Pack and install the template, instantiate an estate of two services and build it; run the inventory and the validator of this repository; the estate builds, model/templates.yaml lists the switches and the pages name only what exists, which proves AC1 to AC3 of AIFACTORY-US-314 (ADR-0028).. Kind: verification. Repository: ConnectSoft.PlatformTemplate.",
      "acceptanceCriteria": [
        "Pack and install the template, instantiate an estate of two services and build it; run the inventory and the validator of this repository; the estate builds, model/templates.yaml lists the switches and the pages name only what exists, which proves AC1 to AC3 of AIFACTORY-US-314 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1363]",
      "number": 1363
    },
    {
      "id": "AIFACTORY-US-315",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-185",
      "title": "Platform template: the Azure Pulumi stack declares the environment baseline, network and data of an estate from the infrastructure blueprint, one store per service",
      "sequence": "18.28.02",
      "description": "As an asset maintainer, I want the Azure stack of a generated estate to be driven by the infrastructure blueprint and the deployment profiles, so that the program the provisioning service plans and applies is the one the blueprint describes. The infrastructure project of the repository holds an Azure stack and an AWS stack with per-stack configuration files and unit tests that run both against Pulumi mocks; the resources are fixed in code. The infrastructure blueprint (docs/reference/schemas/blueprint-infrastructure.schema.json) names the IaC tool, the program path and the stacks, the topology, the region, the resources with their kind, store id and SKU, and the environments with their class and approval flag. IaCProvisioningService keeps a deployment specification per environment that refers to a Pulumi program in Git and applies it; its specification kinds are EnvironmentBaseline, Workload, Network, Data and Observability. This PBI binds the two under `UseFactoryProfile`. The inputs are named: the blueprint path symbol of the template seeds the stack configuration key `blueprintPath` of the generated estate, and the services with their store ids come from the estate definition file. The Azure stack reads the blueprint document at that key and the estate definition file and declares three groups of resources that match the specification kinds EnvironmentBaseline, Network and Data: the cluster, registry and identity of the environment, the network with its segments, and the stores. The deployment profile parameter, one of the four of ADR-0017, selects placement, network and secret handling, which is where decision 2 of that ADR confines the differences between profiles. Every store of the blueprint becomes one resource that belongs to exactly one service, as ADR-0028 requires; a store shared by two services is refused at preview. The program takes configuration and secrets by reference only and writes no secret value into a stack file. A preview of a fixture stack runs in the pipeline, and a missing `blueprintPath` key or a blueprint document that does not validate against the schema fails the preview with the key or the violated rule named. The AWS stack stays in the repository as a sample outside the Factory profile and its tests keep running. Kind: enabling. Traces: adrs: ADR-0004, ADR-0017, ADR-0028. Depends on: AIFACTORY-US-314. Sources: model/components.yaml, docs/reference/schemas/blueprint-infrastructure.schema.json, model/services/runtime-cloud/IaCProvisioningService.yaml, docs/architecture/adr/0004-pulumi-over-bicep-iac.md, docs/architecture/adr/0017-deployment-profiles.md.",
      "acceptanceCriteria": [
        "AC1: Given an estate generated with `UseFactoryProfile` and a fixture blueprint that validates against docs/reference/schemas/blueprint-infrastructure.schema.json, when the Azure stack is previewed, then it declares the baseline, network and data resources for the topology, the region, the resources and the environments of the blueprint, and Pulumi is the only engine used (ADR-0004, ADR-0017 decision 4).",
        "AC2: Given a blueprint whose resources name a store for each service, when the stack is previewed, then every store is one resource owned by exactly one service, and a blueprint that assigns one store to two services fails the preview with both services named (ADR-0028: one store per service; model/services/runtime-cloud/IaCProvisioningService.yaml names the specification kinds the three groups match).",
        "AC3: Given a blueprint document that violates the schema, or a stack file that holds a secret value, when the fixture preview runs in the pipeline, then it fails with the violated rule or the offending key named; the AWS stack is generated only outside the Factory profile and its unit tests still pass (ADR-0004, docs/reference/schemas/blueprint-infrastructure.schema.json)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/architecture/adr/0004-pulumi-over-bicep-iac.md",
        "docs/architecture/adr/0017-deployment-profiles.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-655",
        "AIFACTORY-TASK-1364",
        "AIFACTORY-TASK-1365"
      ],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3002,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0004",
          "ADR-0017",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-314"
      ],
      "source": [
        "model/components.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/architecture/adr/0004-pulumi-over-bicep-iac.md",
        "docs/architecture/adr/0017-deployment-profiles.md"
      ],
      "titlePrefix": "[AIFACTORY-US-315]",
      "number": 315
    },
    {
      "id": "AIFACTORY-TASK-655",
      "type": "task",
      "parent": "AIFACTORY-US-315",
      "title": "Environment baseline from the infrastructure blueprint",
      "sequence": "18.28.02.01",
      "description": "BEFORE DEVELOPMENT. Environment baseline from the infrastructure blueprint. Expected output: Under `UseFactoryProfile` the Azure Pulumi stack reads the infrastructure blueprint (topology, region, resources with store ids and SKUs, environments) at the stack configuration key `blueprintPath`, which the blueprint path symbol seeds, and the services of the estate definition file, and declares the EnvironmentBaseline, Network and Data resources IaCProvisioningService applies, one store per service as ADR-0028 requires; the deployment profile parameter selects placement, network and secret handling (ADR-0017 decision 2); a missing key fails the preview by name; the AWS stack stays a sample outside the Factory profile; configuration and secrets are references only.. Kind: implementation. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet build -c Release | pulumi preview --stack fixture --non-interactive.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` the Azure Pulumi stack reads the infrastructure blueprint (topology, region, resources with store ids and SKUs, environments) at the stack configuration key `blueprintPath`, which the blueprint path symbol seeds, and the services of the estate definition file, and declares the EnvironmentBaseline, Network and Data resources IaCProvisioningService applies, one store per service as ADR-0028 requires; the deployment profile parameter selects placement, network and secret handling (ADR-0017 decision 2); a missing key fails the preview by name; the AWS stack stays a sample outside the Factory profile; configuration and secrets are references only."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-655]",
      "number": 655
    },
    {
      "id": "AIFACTORY-TASK-1364",
      "type": "task",
      "parent": "AIFACTORY-US-315",
      "title": "Fixture blueprints and the fixture stack of the preview",
      "sequence": "18.28.02.02",
      "description": "BEFORE DEVELOPMENT. Fixture blueprints and the fixture stack of the preview. Expected output: The template repository holds a valid fixture blueprint of two services with one store each, a fixture with a shared store, a fixture that violates the schema and a fixture stack file; unit tests against Pulumi mocks assert the declared resources of the valid fixture, and the pipeline previews the fixture stack.. Kind: fixture. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The template repository holds a valid fixture blueprint of two services with one store each, a fixture with a shared store, a fixture that violates the schema and a fixture stack file; unit tests against Pulumi mocks assert the declared resources of the valid fixture, and the pipeline previews the fixture stack."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3002,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1364]",
      "number": 1364
    },
    {
      "id": "AIFACTORY-TASK-1365",
      "type": "task",
      "parent": "AIFACTORY-US-315",
      "title": "Verify the preview of the valid, the shared-store and the invalid blueprint",
      "sequence": "18.28.02.03",
      "description": "BEFORE DEVELOPMENT. Verify the preview of the valid, the shared-store and the invalid blueprint. Expected output: Run `pulumi preview --stack fixture --non-interactive` for the three fixtures of AIFACTORY-TASK-1364; the valid one lists the baseline, network and data resources, the shared store and the invalid document fail by name, which proves AC1 to AC3 of AIFACTORY-US-315 (ADR-0004, ADR-0028).. Kind: verification. Repository: ConnectSoft.PlatformTemplate.",
      "acceptanceCriteria": [
        "Run `pulumi preview --stack fixture --non-interactive` for the three fixtures of AIFACTORY-TASK-1364; the valid one lists the baseline, network and data resources, the shared store and the invalid document fail by name, which proves AC1 to AC3 of AIFACTORY-US-315 (ADR-0004, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1365]",
      "number": 1365
    },
    {
      "id": "AIFACTORY-US-316",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-185",
      "title": "Platform template: deployment, service and network-policy manifests are written per service of the estate definition file by a generate command, with the declared dependencies as the only egress",
      "sequence": "18.28.03",
      "description": "As an asset maintainer, I want the Kubernetes manifests of an estate to be generated per included service from what the service declares, so that a service is deployed with the replicas, ports and network reach its model entry states and no more. The repository holds one deployment manifest, one service manifest and one network-policy manifest under its Kubernetes deployment folder, written for a single placeholder workload. ADR-0028 makes every service its own deployable with a declared replica range, and the model entry of a service names its hosting, its replicas and the services it calls. A template configuration cannot emit a set of files per element of a list parameter, so this PBI names the mechanism. The template instantiates an estate definition file, `estate.yaml`, that lists the services of the estate, each with its replica range, its ports, its dependencies, its store id and the gateway that fronts it; the list parameter of the template seeds the service names and the entries are completed in that file. The generated repository holds an estate generator with two commands. `generate` writes the deployment, service and network-policy manifest of every service of the file and writes a file only when its content changed. `check` regenerates in memory and fails with the file named when a committed output is stale, and with the service and the field named when an entry is incomplete. Under `UseFactoryProfile` an entry takes the `deployment.runtime` range and the ports of the service entry of the model, and the liveness and readiness probes point at the health endpoints the base template profile generates. The network policy allows ingress from the gateway that fronts the service and egress only to the dependencies the service declares, to its own store and to the telemetry collector; every other egress is denied, so a call to an undeclared service fails in the cluster and not in a review. The manifests carry configuration and secret references and no value. The pipeline of the template runs the check and validates every generated manifest against the schema of the cluster API, and fails with the manifest and the field named. The manifests are the Workload part of what the provisioning service applies for an environment. Kind: enabling. Traces: adrs: ADR-0017, ADR-0028. Relates: nfrs: NFR-17. Depends on: AIFACTORY-US-314, feature:component-base-template-factory-profile. Sources: model/components.yaml, model/services/runtime-cloud/IaCProvisioningService.yaml, docs/architecture/adr/0017-deployment-profiles.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given an estate whose estate definition file lists two services and a gateway, when the generate command runs, then each service has its own deployment, service and network-policy manifest with the replica range and the ports of its entry and probes on its health endpoints, a second run writes no file, and the check command fails with the file named when an entry changed without a regeneration (ADR-0028 amendment: every service declares its replica range under `deployment.runtime`; the consequences of ADR-0028 make health and readiness work of every service, provided by the base template; NFR-17).",
        "AC2: Given the generated network policy of a service, when it is inspected, then ingress is allowed from its gateway and egress only to its declared dependencies, its own store and the collector, and a fixture service that calls an undeclared service is denied by the policy test (ADR-0028: every service is its own deployable with its own store; model/components.yaml row of the platform template).",
        "AC3: Given a generated manifest with a field the cluster API does not define, or with a secret value in place of a reference, when the pipeline validates the manifests, then it fails with the manifest and the field named (ADR-0017 decision 2: differences between profiles are confined to placement, network and secrets; model/services/runtime-cloud/IaCProvisioningService.yaml keeps secrets as references)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-656",
        "AIFACTORY-TASK-1425",
        "AIFACTORY-TASK-1366",
        "AIFACTORY-TASK-1367"
      ],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3003,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0017",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-17"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-314",
        "feature:component-base-template-factory-profile"
      ],
      "source": [
        "model/components.yaml",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/architecture/adr/0017-deployment-profiles.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-316]",
      "number": 316
    },
    {
      "id": "AIFACTORY-TASK-656",
      "type": "task",
      "parent": "AIFACTORY-US-316",
      "title": "Workload manifests and the observability specification per environment",
      "sequence": "18.28.03.01",
      "description": "BEFORE DEVELOPMENT. Workload manifests and the observability specification per environment. Expected output: The Kubernetes deployment, service and network-policy manifests of every service of the estate definition file are produced by the generate command of AIFACTORY-TASK-1425 from manifest templates of the repository, with the `deployment.runtime` range and the ports of the service entry, probes on its health endpoints and its declared dependencies as the only allowed egress, and carry references instead of configuration and secret values; the observability part of this task is delivered by AIFACTORY-TASK-1368 and AIFACTORY-TASK-1369.. Kind: implementation. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Kubernetes deployment, service and network-policy manifests of every service of the estate definition file are produced by the generate command of AIFACTORY-TASK-1425 from manifest templates of the repository, with the `deployment.runtime` range and the ports of the service entry, probes on its health endpoints and its declared dependencies as the only allowed egress, and carry references instead of configuration and secret values; the observability part of this task is delivered by AIFACTORY-TASK-1368 and AIFACTORY-TASK-1369."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-656]",
      "number": 656
    },
    {
      "id": "AIFACTORY-TASK-1425",
      "type": "task",
      "parent": "AIFACTORY-US-316",
      "title": "Estate definition file and the generate and check commands of a generated estate",
      "sequence": "18.28.03.02",
      "description": "BEFORE DEVELOPMENT. Estate definition file and the generate and check commands of a generated estate. Expected output: The generated repository holds the estate definition file `estate.yaml` with its schema (per service the replica range, the ports, the dependencies, the store id and the gateway) and an estate generator project with two commands: `generate` writes the per-service manifests, the scrape configuration and the two compose files from the file and writes only on change; `check` exits non-zero with the file named on a stale output and with the service and the field named on an incomplete entry.. Kind: implementation. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet run --project tools/EstateGenerator -- generate | dotnet run --project tools/EstateGenerator -- check.",
      "acceptanceCriteria": [
        "The generated repository holds the estate definition file `estate.yaml` with its schema (per service the replica range, the ports, the dependencies, the store id and the gateway) and an estate generator project with two commands: `generate` writes the per-service manifests, the scrape configuration and the two compose files from the file and writes only on change; `check` exits non-zero with the file named on a stale output and with the service and the field named on an incomplete entry."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1425]",
      "number": 1425
    },
    {
      "id": "AIFACTORY-TASK-1366",
      "type": "task",
      "parent": "AIFACTORY-US-316",
      "title": "Manifest schema validation and the network policy test in the pipeline",
      "sequence": "18.28.03.03",
      "description": "BEFORE DEVELOPMENT. Manifest schema validation and the network policy test in the pipeline. Expected output: The pipeline of the template runs the check command of the estate generator, validates every generated manifest against the schema of the cluster API and runs a policy test over a fixture estate in which one service calls an undeclared service; a stale output, an invalid field, a secret value or an allowed undeclared egress fails the run with the file named.. Kind: fixture. Repository: ConnectSoft.PlatformTemplate. Verification: the pipeline validation stage is green on the fixture estate and red on the planted manifest.",
      "acceptanceCriteria": [
        "The pipeline of the template runs the check command of the estate generator, validates every generated manifest against the schema of the cluster API and runs a policy test over a fixture estate in which one service calls an undeclared service; a stale output, an invalid field, a secret value or an allowed undeclared egress fails the run with the file named."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3003,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1366]",
      "number": 1366
    },
    {
      "id": "AIFACTORY-TASK-1367",
      "type": "task",
      "parent": "AIFACTORY-US-316",
      "title": "Verify the per-service manifests, the egress rule and the validation",
      "sequence": "18.28.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the per-service manifests, the egress rule and the validation. Expected output: Instantiate the fixture estate of two services and a gateway, run the generate and the check command, validate the manifests and run the policy test; each service has its three manifests, a second generation writes nothing, a stale output fails the check, the undeclared call is denied and the planted manifest fails by name, which proves AC1 to AC3 of AIFACTORY-US-316 (ADR-0028).. Kind: verification. Repository: ConnectSoft.PlatformTemplate.",
      "acceptanceCriteria": [
        "Instantiate the fixture estate of two services and a gateway, run the generate and the check command, validate the manifests and run the policy test; each service has its three manifests, a second generation writes nothing, a stale output fails the check, the undeclared call is denied and the planted manifest fails by name, which proves AC1 to AC3 of AIFACTORY-US-316 (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1367]",
      "number": 1367
    },
    {
      "id": "AIFACTORY-US-317",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-185",
      "title": "Platform template: the collector, Prometheus and Grafana files become the observability specification of an environment, and a compose estate runs the included services locally and in CI",
      "sequence": "18.28.04",
      "description": "As an asset maintainer, I want the observability stack and the local estate of the template to be generated for the services and the backend of the estate, so that every environment and every developer machine observes the services on the same conventions. The repository carries the observability stack as scripts and compose files for an OpenTelemetry collector with Prometheus and Grafana, Jaeger, an ELK stack and Seq, and five pages on the stack, its configuration, its local setup and its debugging. The Observability Stack page describes a collector mode, in which every service sends its telemetry to one collector endpoint that routes it to the backends, and a direct export mode it calls legacy. The repository also holds a compose file for a local estate and one for CI. This PBI turns both into generated parts of an estate. The collector configuration, with one pipeline per signal and the exporters of the chosen backends, and the dashboards are template output gated by `ObservabilityStack` and `ObservabilityBackend`. The scrape configuration and the compose estate hold one entry per service, so they are written by the generate command of the estate generator from the estate definition file and covered by its check. Under `UseFactoryProfile` the collector mode is the only mode, the collector keeps the scope and run attributes the single registration of the observability libraries writes, and a processor drops any attribute outside the allow list of the conventions, so that a payload attribute a service emitted by mistake does not reach a backend; decision 3 of ADR-0019 allows no raw prompt, response or tool output in telemetry. The compose estate is assembled from the services of the file, their stores and the collector with the chosen backend, in the two existing variants for local runs and for CI. The pages are corrected to the generated files, and the direct export mode is described as unavailable under the profile. Kind: enabling. Traces: adrs: ADR-0028. Relates: nfrs: NFR-17. Depends on: AIFACTORY-US-314, feature:component-observability-factory-conventions. Sources: model/components.yaml, model/templates.yaml, docs/architecture/adr/0019-data-governance.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given an estate instantiated with the collector mode and one backend, when the estate is generated, then it holds a collector configuration with a pipeline per signal and the exporter of that backend, a scrape configuration with one target per service of the estate definition file and the dashboards, and no file of a backend that was not chosen (the consequences of ADR-0028 make telemetry wiring work of every service, provided by the base template; NFR-17; model/components.yaml row of the platform template).",
        "AC2: Given an estate generated with `UseFactoryProfile`, when a fixture service emits a span with the scope attributes of the conventions and one attribute outside the allow list, then the collector forwards the scope attributes and drops the other, and a generation that asks for the direct export mode is refused (docs/architecture/adr/0019-data-governance.md decision 3: no raw prompt, response or tool output in telemetry; ADR-0028).",
        "AC3: Given the generated compose estate, when it is started locally and in the CI variant, then the services of the estate definition file, their stores and the collector start, each service reports ready and its telemetry is visible in the chosen backend; the observability pages of the template name the generated files (ADR-0028: each service has its own store in the estate; NFR-17)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1368",
        "AIFACTORY-TASK-1369",
        "AIFACTORY-TASK-1370",
        "AIFACTORY-TASK-1371"
      ],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3004,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-17"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-314",
        "feature:component-observability-factory-conventions"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/architecture/adr/0019-data-governance.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-317]",
      "number": 317
    },
    {
      "id": "AIFACTORY-TASK-1368",
      "type": "task",
      "parent": "AIFACTORY-US-317",
      "title": "Observability specification generated from the stack and backend parameters",
      "sequence": "18.28.04.01",
      "description": "BEFORE DEVELOPMENT. Observability specification generated from the stack and backend parameters. Expected output: The collector configuration and the dashboards of an estate are template output gated by `ObservabilityStack` and `ObservabilityBackend`, and the scrape configuration is written by the generate command of AIFACTORY-TASK-1425 with one target per service of the estate definition file; under `UseFactoryProfile` only the collector mode is generated and a processor keeps the scope and run attributes of the conventions and drops attributes outside their allow list.. Kind: implementation. Repository: ConnectSoft.PlatformTemplate. Verification: the collector validates its generated configuration.",
      "acceptanceCriteria": [
        "The collector configuration and the dashboards of an estate are template output gated by `ObservabilityStack` and `ObservabilityBackend`, and the scrape configuration is written by the generate command of AIFACTORY-TASK-1425 with one target per service of the estate definition file; under `UseFactoryProfile` only the collector mode is generated and a processor keeps the scope and run attributes of the conventions and drops attributes outside their allow list."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1368]",
      "number": 1368
    },
    {
      "id": "AIFACTORY-TASK-1369",
      "type": "task",
      "parent": "AIFACTORY-US-317",
      "title": "Compose estate assembled from the included services for local runs and CI",
      "sequence": "18.28.04.02",
      "description": "BEFORE DEVELOPMENT. Compose estate assembled from the included services for local runs and CI. Expected output: The two compose files of the deployment folder are written by the generate command of AIFACTORY-TASK-1425 from the services of the estate definition file with their stores, the collector and the chosen backend; the CI variant starts without interactive ports and waits for the readiness of every service.. Kind: implementation. Repository: ConnectSoft.PlatformTemplate. Verification: docker compose config validates both generated files.",
      "acceptanceCriteria": [
        "The two compose files of the deployment folder are written by the generate command of AIFACTORY-TASK-1425 from the services of the estate definition file with their stores, the collector and the chosen backend; the CI variant starts without interactive ports and waits for the readiness of every service."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1369]",
      "number": 1369
    },
    {
      "id": "AIFACTORY-TASK-1370",
      "type": "task",
      "parent": "AIFACTORY-US-317",
      "title": "Observability pages of the template corrected to the generated files",
      "sequence": "18.28.04.03",
      "description": "BEFORE DEVELOPMENT. Observability pages of the template corrected to the generated files. Expected output: The five observability pages of the template describe the generated collector configuration, the backends by parameter value, the compose estate and the debugging steps, and state that the direct export mode is unavailable under the Factory profile.. Kind: documentation. Repository: ConnectSoft.PlatformTemplate. Verification: every file path named on the pages exists in a generated estate.",
      "acceptanceCriteria": [
        "The five observability pages of the template describe the generated collector configuration, the backends by parameter value, the compose estate and the debugging steps, and state that the direct export mode is unavailable under the Factory profile."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3004,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1370]",
      "number": 1370
    },
    {
      "id": "AIFACTORY-TASK-1371",
      "type": "task",
      "parent": "AIFACTORY-US-317",
      "title": "Verify the generated specification, the attribute allow list and the compose estate",
      "sequence": "18.28.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the generated specification, the attribute allow list and the compose estate. Expected output: Instantiate the fixture estate with the profile, run the generate command, start its CI compose variant, emit the fixture span and query the backend; the services report ready, the scope attributes arrive and the attribute outside the allow list does not, which proves AC1 to AC3 of AIFACTORY-US-317 (NFR-17, docs/architecture/adr/0019-data-governance.md).. Kind: verification. Repository: ConnectSoft.PlatformTemplate.",
      "acceptanceCriteria": [
        "Instantiate the fixture estate with the profile, run the generate command, start its CI compose variant, emit the fixture span and query the backend; the services report ready, the scope attributes arrive and the attribute outside the allow list does not, which proves AC1 to AC3 of AIFACTORY-US-317 (NFR-17, docs/architecture/adr/0019-data-governance.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1371]",
      "number": 1371
    },
    {
      "id": "AIFACTORY-US-318",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-185",
      "title": "Platform template: a fixture estate is provisioned, deployed, observed ready and destroyed in a preview stage before the template package publishes",
      "sequence": "18.28.05",
      "description": "As an asset maintainer, I want every change of the platform template to be gated by an estate it provisions and deploys from the packed candidate, so that a template package that would produce an environment that does not come up never reaches the feed. This PBI is the gate of the feature. A template that generates infrastructure cannot be proven by a build alone, so its generated-solution gate is a preview environment. The candidate is packed once and installed, and a fixture estate of two services and a gateway is instantiated with `UseFactoryProfile`. The two services are generated from the base template with its Factory profile and the gateway from the API gateway template `connectsoft-apigateway` with its Factory profile, so the estate deploys what the Factory deploys. The generate and check commands of the estate generator run, the generated solution is built and its unit tests run against Pulumi mocks. In the preview stage of the pipeline the Azure stack of the estate is previewed and applied to a disposable environment, the generated manifests are applied to its cluster, and the readiness of each service is observed through the collector of the estate: every service reports ready and its readiness signal carries the attributes of the conventions. The estate is destroyed at the end of the stage whether the observation passed or failed, and a destroy that leaves a resource fails the run with the resource named. A case that fails any stage fails the run with the stage named, and the publication stage is not reached. Publication pushes the template package to the ConnectSoft feed with a version that is not yet on the feed. A planted fixture whose service never reports ready proves that the gate stops the run. This is an evidence PBI: a template feature has no scenario, so the gate names what it proves through `traces.adrs` and its sources. Kind: evidence. Traces: adrs: ADR-0004, ADR-0028. Relates: nfrs: NFR-17. Depends on: AIFACTORY-US-314, AIFACTORY-US-315, AIFACTORY-US-316, AIFACTORY-US-317, feature:component-base-template-factory-profile, feature:component-api-gateway-template. Sources: model/components.yaml, model/backlog/epics.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the template, when its pipeline runs, then the candidate is packed once and installed, the fixture estate of two services and a gateway is instantiated with `UseFactoryProfile`, built and tested, its Azure stack is applied to a disposable environment, its manifests are applied and each service is observed ready through the collector (ADR-0028 amendment on scaffolding from published templates; ADR-0004: the stack is applied by Pulumi).",
        "AC2: Given a service of the estate never reports ready, or any stage fails, when the pipeline evaluates the run, then the run fails with the stage named, the estate is destroyed all the same, a resource left behind fails the run with its name, and the publication stage is not reached; a planted fixture proves the refusal (the consequences of ADR-0028 make health and readiness work of every service; NFR-17; model/backlog/epics.yaml states the gate as the completion of the epic).",
        "AC3: Given the preview stage is green and the estate is destroyed, when the publication stage runs, then the template package is pushed to the ConnectSoft feed with a version that is not on the feed and a repeated version is refused with the reason (ADR-0028, docs/architecture/catalogs/templates.md keeps the row of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1372",
        "AIFACTORY-TASK-1373",
        "AIFACTORY-TASK-657"
      ],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3005,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0004",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-17"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-314",
        "AIFACTORY-US-315",
        "AIFACTORY-US-316",
        "AIFACTORY-US-317",
        "feature:component-base-template-factory-profile",
        "feature:component-api-gateway-template"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-318]",
      "number": 318
    },
    {
      "id": "AIFACTORY-TASK-1372",
      "type": "task",
      "parent": "AIFACTORY-US-318",
      "title": "Preview stage of the template pipeline with an unconditional destroy",
      "sequence": "18.28.05.01",
      "description": "BEFORE DEVELOPMENT. Preview stage of the template pipeline with an unconditional destroy. Expected output: The pipeline of the template packs once, installs the candidate, instantiates and builds the fixture estate, applies its Azure stack to a disposable environment, applies the manifests, waits for the readiness of each service through the collector and destroys the estate in a step that always runs; the publication stage depends on the preview stage and refuses a version that is already on the feed.. Kind: operations. Repository: ConnectSoft.PlatformTemplate. Verification: azure-pipelines.yml runs the preview stage before the push and the destroy step on every outcome.",
      "acceptanceCriteria": [
        "The pipeline of the template packs once, installs the candidate, instantiates and builds the fixture estate, applies its Azure stack to a disposable environment, applies the manifests, waits for the readiness of each service through the collector and destroys the estate in a step that always runs; the publication stage depends on the preview stage and refuses a version that is already on the feed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3005,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1372]",
      "number": 1372
    },
    {
      "id": "AIFACTORY-TASK-1373",
      "type": "task",
      "parent": "AIFACTORY-US-318",
      "title": "Fixture estate of two services and a gateway, and a planted service that never reports ready",
      "sequence": "18.28.05.02",
      "description": "BEFORE DEVELOPMENT. Fixture estate of two services and a gateway, and a planted service that never reports ready. Expected output: The template repository holds the fixture estate definition with two services generated from the base template with its Factory profile and a gateway generated from `connectsoft-apigateway` with its Factory profile, and a planted variant whose second service fails its readiness probe; the planted run asserts that the run fails at the observation step, that the estate is destroyed and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.PlatformTemplate. Verification: the planted run fails at the readiness observation and leaves no resource.",
      "acceptanceCriteria": [
        "The template repository holds the fixture estate definition with two services generated from the base template with its Factory profile and a gateway generated from `connectsoft-apigateway` with its Factory profile, and a planted variant whose second service fails its readiness probe; the planted run asserts that the run fails at the observation step, that the estate is destroyed and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3005,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1373]",
      "number": 1373
    },
    {
      "id": "AIFACTORY-TASK-657",
      "type": "task",
      "parent": "AIFACTORY-US-318",
      "title": "Preview-environment gate",
      "sequence": "18.28.05.03",
      "description": "BEFORE DEVELOPMENT. Preview-environment gate. Expected output: One green run and one planted run of the gate: a fixture estate of two services and a gateway is provisioned from the generated stack in the preview stage of the pipeline, the manifests are applied, the readiness of each service is observed through the collector and the estate is destroyed; the template package publishes only when the gate passes, which proves AC1 to AC3 of AIFACTORY-US-318 (ADR-0028, NFR-17).. Kind: verification. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet build -c Release | pulumi preview --stack fixture --non-interactive | pulumi up --stack fixture --yes --non-interactive | pulumi destroy --stack fixture --yes --non-interactive.",
      "acceptanceCriteria": [
        "One green run and one planted run of the gate: a fixture estate of two services and a gateway is provisioned from the generated stack in the preview stage of the pipeline, the manifests are applied, the readiness of each service is observed through the collector and the estate is destroyed; the template package publishes only when the gate passes, which proves AC1 to AC3 of AIFACTORY-US-318 (ADR-0028, NFR-17)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-657]",
      "number": 657
    },
    {
      "id": "AIFACTORY-US-124",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-185",
      "title": "Platform template: the environment stack of a Factory estate, as a real template is delivered and proven on a generated solution",
      "sequence": "18.28.06",
      "description": "As an asset maintainer, I want Platform template to carry the environment stack of a Factory estate, as a real template, so that it serves environment baseline, workload manifests, observability specification and local estate of a Factory estate and of a generated product without later rework. This is the integration PBI of the feature. An asset maintainer packs the platform template with its template configuration, the blueprint-driven Azure stack, the estate definition file with its generate and check commands, the per-service manifests, the generated observability specification and the compose estate, installs the package and runs the preview-environment gate in the pipeline. The fixture estate is provisioned, deployed, observed ready and destroyed before the template package is allowed to publish; a stage that fails stops the run and blocks publication. The implementation lives in the earlier PBIs of this file; this PBI proves them together on the estate shape the Factory needs when it delivers a generated service to a preview environment and promotes it. From the published package an estate is generated with `UseFactoryProfile` from a fixture infrastructure blueprint, for the one region the workload baseline of ADR-0018 assumes. Its preview lists the baseline, network and data resources of the blueprint with one store per service, its manifests validate against the cluster API, its compose estate starts with every service ready, and its collector forwards the scope attributes and no payload. The feature is done when that estate is generated from a fresh install of the published package. Repository of the feature: ConnectSoft.PlatformTemplate. Kind: enabling. Traces: adrs: ADR-0004, ADR-0017, ADR-0018, ADR-0028. Relates: nfrs: NFR-17. Depends on: AIFACTORY-US-314, AIFACTORY-US-315, AIFACTORY-US-316, AIFACTORY-US-317, AIFACTORY-US-318. Sources: model/components.yaml, model/templates.yaml, docs/reference/schemas/blueprint-infrastructure.schema.json, model/services/runtime-cloud/IaCProvisioningService.yaml, docs/templates-docs/platform-template.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.PlatformTemplate with the work of this feature, when the template is packed, installed and instantiated in its pipeline, then the generated solution builds, its tests pass and the preview-environment gate is green before the package publishes with a verified version (ADR-0028, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-654 (a packable template with parameters and its own pages) is done, then the repository has a template configuration with the symbols an estate needs and `UseFactoryProfile`, packs, installs and instantiates, appears in the parameter snapshot under model/template-parameters with a Factory binding per parameter, and its pages and docs/templates-docs/platform-template.md describe what the repository contains (ADR-0028).",
        "AC3: Given the work of AIFACTORY-TASK-655 (environment baseline from the infrastructure blueprint) is done, then the Azure Pulumi stack reads the infrastructure blueprint at its stack configuration key and the services of the estate definition file, under a deployment profile that is one of the four of ADR-0017, and declares the baseline, network and data resources the provisioning service applies, one store per service as ADR-0028 requires, the AWS stack stays a sample outside the Factory profile, and a fixture preview fails on a document that violates docs/reference/schemas/blueprint-infrastructure.schema.json (ADR-0004).",
        "AC4: Given the work of AIFACTORY-TASK-656 (workload manifests and the observability specification per environment) is done, then the deployment, service and network-policy manifests are written per service of the estate definition file by the generate command, with the `deployment.runtime` range and the ports of the service entry and its declared dependencies as the only egress, and validated against the cluster API, the collector, Prometheus and Grafana files are the generated observability specification of the environment, and a compose estate is assembled from the services of the file (ADR-0028, NFR-17).",
        "AC5: Given the work of AIFACTORY-TASK-657 (preview-environment gate) is done, then a fixture estate of two services and a gateway is provisioned in the preview stage, deployed, observed ready through the collector and destroyed, and the template package publishes to the ConnectSoft feed only when the gate passes (ADR-0028, NFR-17, docs/architecture/catalogs/templates.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1374",
        "AIFACTORY-TASK-687"
      ],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3006,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0004",
          "ADR-0017",
          "ADR-0018",
          "ADR-0028"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-17"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-314",
        "AIFACTORY-US-315",
        "AIFACTORY-US-316",
        "AIFACTORY-US-317",
        "AIFACTORY-US-318"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "docs/templates-docs/platform-template.md"
      ],
      "titlePrefix": "[AIFACTORY-US-124]",
      "number": 124
    },
    {
      "id": "AIFACTORY-TASK-1374",
      "type": "task",
      "parent": "AIFACTORY-US-124",
      "title": "Generate a Factory estate from the published package and a fixture blueprint",
      "sequence": "18.28.06.01",
      "description": "BEFORE DEVELOPMENT. Generate a Factory estate from the published package and a fixture blueprint. Expected output: A probe installs the published template package, generates an estate with `UseFactoryProfile` from the fixture infrastructure blueprint, builds it, previews its Azure stack, validates its manifests and starts its CI compose variant; the run proves AC2 to AC4 of AIFACTORY-US-124 on the published package (ADR-0004, ADR-0028).. Kind: verification. Repository: ConnectSoft.PlatformTemplate. Verification: dotnet new install of the published version, dotnet new connectsoft-platform-template with `UseFactoryProfile`, dotnet build -c Release, pulumi preview --stack fixture --non-interactive.",
      "acceptanceCriteria": [
        "A probe installs the published template package, generates an estate with `UseFactoryProfile` from the fixture infrastructure blueprint, builds it, previews its Azure stack, validates its manifests and starts its CI compose variant; the run proves AC2 to AC4 of AIFACTORY-US-124 on the published package (ADR-0004, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1374]",
      "number": 1374
    },
    {
      "id": "AIFACTORY-TASK-687",
      "type": "task",
      "parent": "AIFACTORY-US-124",
      "title": "Verify platform-template-environment-stack-delivered by running the declared command",
      "sequence": "18.28.06.02",
      "description": "BEFORE DEVELOPMENT. Verify platform-template-environment-stack-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `pulumi preview --stack fixture --non-interactive` on the authoring solution and on the fixture estate after the published package is installed, and take the green run of the preview-environment gate of AIFACTORY-TASK-657 with its apply and destroy; they pass and prove AC1 to AC5 of AIFACTORY-US-124.. Kind: verification. Repository: ConnectSoft.PlatformTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `pulumi preview --stack fixture --non-interactive` on the authoring solution and on the fixture estate after the published package is installed, and take the green run of the preview-environment gate of AIFACTORY-TASK-657 with its apply and destroy; they pass and prove AC1 to AC5 of AIFACTORY-US-124."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "docs/reference/schemas/blueprint-infrastructure.schema.json",
        "model/services/runtime-cloud/IaCProvisioningService.yaml",
        "ConnectSoft.PlatformTemplate/Docs/README.md",
        "ConnectSoft.PlatformTemplate/Docs/Solution Structure.md",
        "ConnectSoft.PlatformTemplate/Docs/Observability Stack.md",
        "docs/templates-docs/platform-template.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:devops-engineer",
        "slice:i2-deliver-it",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.PlatformTemplate"
      ],
      "children": [],
      "buildOrder": 30,
      "phase": "templates-and-libraries",
      "stackRank": 3006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-687]",
      "number": 687
    },
    {
      "id": "AIFACTORY-FEAT-167",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Blazor shell template: gateway adapters, filter diagnostics and pinned packages before the Studio",
      "sequence": "18.29",
      "description": "Factory Studio is a Blazor shell composed of microfrontends behind StudioBff (ADR-0007). The shell template's own runtime backlog (docs/Control Plane) records what the Studio would otherwise inherit: the named ApiGateway client has host adapters for products and entitlements only, while the tenant list, feature flags, notifications and activity still fall back to in-memory or deny-all; a hidden navigation entry cannot be explained (OP-025: a filter result of false does not say whether a flag, an entitlement, a missing tenant or a gateway failure caused it); and the UIKit and Shell.Services pins drift between the shell, the microfrontend library and the sample templates (the integration checklist). Component: Blazor Shell + MFEs + UIKit (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I3: Studio. Build order 31 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-319",
        "AIFACTORY-US-335",
        "AIFACTORY-US-320",
        "AIFACTORY-US-321",
        "AIFACTORY-US-322",
        "AIFACTORY-US-125"
      ],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3100,
      "titlePrefix": "[AIFACTORY-FEAT-167]",
      "number": 167
    },
    {
      "id": "AIFACTORY-US-319",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-167",
      "title": "Blazor shell template: host adapters fill tenants, flags, notifications and activity from a configured gateway, fail closed, and each gateway client holds its own token",
      "sequence": "18.29.01",
      "description": "As an asset maintainer, I want the shell template to fill its switchers, flags, notifications and activity from a gateway when authentication is on, so that a shell built from the template shows real scope and real notices without a hand-written adapter per product. The runtime backlog of the shell template (the Control Plane index of its documentation) records the state the Studio would inherit: the named HTTP client `ApiGateway` with `GatewayAccessTokenHandler` and a correlation handler has host adapters for products and entitlements only, while the tenant list, the feature flags, the notifications and the activity have no source and fall back to in-memory data or deny everything. Its locked decisions say where the missing adapters belong: package defaults stay in-memory or null, HTTP adapters are host overrides when authentication is enabled, they live in the host and not in types a microfrontend can reach, the switcher items reuse `ShellScopeItem`, a gateway failure fails closed, and the template gains no company symbol. This PBI adds the four missing host adapters under those decisions, so the template stays generic and gains no Factory parameter; a product binds them by configuration. Each adapter reads a route the host configures for the gateway client; an adapter without a configured route keeps the in-memory or null default, so the template invents no notification backend. With authentication on, a 401, a 403 or an unreachable gateway yields no extra tenants and denied flags, with the reason logged and never a token or a header value. A 404 for an item means the item belongs to another tenant and is left out without an error; a 403 means the token lacks a scope inside the tenant and denies with that reason. A user token has one audience, the gateway that fronts its scopes: the token handler requests the token for the audience of the gateway its named client fronts, so a host that calls a second gateway registers a second named client with its own token and never sends a token to a gateway it was not issued for. With authentication off the shell keeps its in-memory demo data. Kind: enabling. Traces: adrs: ADR-0007, ADR-0015; services: StudioBff. Sources: model/components.yaml, model/template-parameters/connectsoft-blazor-shell.yaml, model/services/factory-studio/StudioBff.yaml, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a shell generated from the template with authentication on and routes configured for tenants, flags, notifications and activity, when a user opens the shell, then the switchers list the tenant, project and environment items the gateway returns as `ShellScopeItem`, the flags, notifications and activity come from the gateway, and no adapter type is reachable from a microfrontend assembly (ADR-0007: microfrontends share the auth context of the shell; model/services/factory-studio/StudioBff.yaml is the gateway the Studio configures).",
        "AC2: Given the gateway answers 401 or 403 or is unreachable, when the shell loads its scope and flags, then no extra tenant is listed, flags and entitlements deny, the reason is logged and no log line holds a token or a header value; given 404 for an item, then the item is left out without an error, as the amendment of ADR-0015 on a resource of another tenant prescribes.",
        "AC3: Given a host with two named gateway clients, when both are called in one session, then each request carries a token whose audience is the gateway of its client and no token is sent to the other gateway (ADR-0015 amendment on the token audience: one audience per user token).",
        "AC4: Given a shell with authentication off, or an adapter whose route is not configured, when the shell renders, then it shows the in-memory demo data or the null default of today and calls no gateway (ADR-0007, model/template-parameters/connectsoft-blazor-shell.yaml gains no parameter by this PBI)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1375",
        "AIFACTORY-TASK-610",
        "AIFACTORY-TASK-1376",
        "AIFACTORY-TASK-1377"
      ],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3101,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007",
          "ADR-0015"
        ],
        "services": [
          "StudioBff"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-319]",
      "number": 319
    },
    {
      "id": "AIFACTORY-TASK-1375",
      "type": "task",
      "parent": "AIFACTORY-US-319",
      "title": "Route configuration of the four adapters and the audience of a named gateway client",
      "sequence": "18.29.01.01",
      "description": "BEFORE DEVELOPMENT. Route configuration of the four adapters and the audience of a named gateway client. Expected output: The configuration section of the gateway client defines one route key each for the tenant list, the feature flags, the notifications and the activity and an audience per named gateway client; the Control Plane index, the gateway route catalog and the Auth and Gateway runbook of the template describe the keys, the fail-closed rule and the meaning of 404 and 403.. Kind: contract. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: the options of the gateway client validate at start-up and name a missing audience.",
      "acceptanceCriteria": [
        "The configuration section of the gateway client defines one route key each for the tenant list, the feature flags, the notifications and the activity and an audience per named gateway client; the Control Plane index, the gateway route catalog and the Auth and Gateway runbook of the template describe the keys, the fail-closed rule and the meaning of 404 and 403."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3101,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1375]",
      "number": 1375
    },
    {
      "id": "AIFACTORY-TASK-610",
      "type": "task",
      "parent": "AIFACTORY-US-319",
      "title": "Gateway adapters for tenants, feature flags, notifications and activity (B-F01 to B-F03)",
      "sequence": "18.29.01.02",
      "description": "BEFORE DEVELOPMENT. Gateway adapters for tenants, feature flags, notifications and activity (B-F01 to B-F03). Expected output: The shell populates its tenant, project and environment switchers, flags, entitlements, notifications and activity from the named gateway client when authentication is on, as host overrides that reuse `ShellScopeItem`; it fails closed on 401, 403 or a gateway outage with the reason logged and never a token or header value, leaves out an item answered 404, requests one token per gateway audience, and keeps the in-memory data of the auth-off demo mode and of an adapter without a route.. Kind: implementation. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The shell populates its tenant, project and environment switchers, flags, entitlements, notifications and activity from the named gateway client when authentication is on, as host overrides that reuse `ShellScopeItem`; it fails closed on 401, 403 or a gateway outage with the reason logged and never a token or header value, leaves out an item answered 404, requests one token per gateway audience, and keeps the in-memory data of the auth-off demo mode and of an adapter without a route."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-610]",
      "number": 610
    },
    {
      "id": "AIFACTORY-TASK-1376",
      "type": "task",
      "parent": "AIFACTORY-US-319",
      "title": "Gateway stub with the success, refusal, foreign-tenant and outage cases",
      "sequence": "18.29.01.03",
      "description": "BEFORE DEVELOPMENT. Gateway stub with the success, refusal, foreign-tenant and outage cases. Expected output: The unit test project of the shell holds a gateway stub with the cases 200, 401, 403, 404 for one item and connection failure, a second stub for a second named client that records the audience of every token it receives, and a log capture that fails a test when a token or a header value is written.. Kind: fixture. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project of the shell holds a gateway stub with the cases 200, 401, 403, 404 for one item and connection failure, a second stub for a second named client that records the audience of every token it receives, and a log capture that fails a test when a token or a header value is written."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3101,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1376]",
      "number": 1376
    },
    {
      "id": "AIFACTORY-TASK-1377",
      "type": "task",
      "parent": "AIFACTORY-US-319",
      "title": "Verify the adapters, the fail-closed rule and the token per gateway",
      "sequence": "18.29.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the adapters, the fail-closed rule and the token per gateway. Expected output: Run the adapter tests against the stubs of AIFACTORY-TASK-1376 with authentication on and off; the gateway data is shown, the refusals deny, the 404 item is absent and each stub sees only tokens of its own audience, which proves AC1 to AC4 of AIFACTORY-US-319 (ADR-0015).. Kind: verification. Repository: ConnectSoft.Blazor.ShellTemplate.",
      "acceptanceCriteria": [
        "Run the adapter tests against the stubs of AIFACTORY-TASK-1376 with authentication on and off; the gateway data is shown, the refusals deny, the 404 item is absent and each stub sees only tokens of its own audience, which proves AC1 to AC4 of AIFACTORY-US-319 (ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1377]",
      "number": 1377
    },
    {
      "id": "AIFACTORY-US-335",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-167",
      "title": "Blazor shell service packages: an optional evaluation contract and one evaluation core return the visible entries with their reasons, published to the ConnectSoft feed with a version",
      "sequence": "18.29.02",
      "description": "As an asset maintainer, I want the shell service packages to return the reasons of the navigation filter from the same evaluation that yields the visible entries, so that the shell template pins one published version of each package and explains a hidden entry without a copy of the filter. The repositories ConnectSoft.Blazor.Shell.Services.Abstractions and ConnectSoft.Blazor.Shell.Services belong to this component and are used as packages (D115; model/components.yaml lists both under `cmp-blazor-shell`). Their pages state the split. The abstractions package holds the interfaces a microfrontend may depend on, among them `IShellNavigationFilter`, the flag and entitlement filter that does not evaluate `RequiredPolicy`. The services package holds the host defaults that `AddShellServices` registers with `TryAdd`, among them `ShellNavigationFilter`, `NullFeatureFlagService` and `NullEntitlementContext`, and a microfrontend never references it. The diagnostics backlog page of the shell template (OP-025 in its documentation) records what the filter does today: it keeps the entries whose flag and entitlement pass, checks a nonblank feature flag first and returns before the entitlement check when the flag fails, sorts by group order, order and identifier, and returns the visible subset only, so a caller cannot tell why an entry is missing. The second part of that page asks for an optional compatible diagnostic contract, a default filter refactored around one evaluation core, and a proof of parity and of call counts. This PBI delivers that part. The abstractions package gains an optional evaluation contract beside `IShellNavigationFilter`: one call returns the visible subset and, for every candidate, the outcome of its flag check and of its entitlement check with the explanations of the page, `PassesFilter`, `FeatureFlagNotEnabled`, `EntitlementNotGranted` and `NotEvaluated`, extended by the causes the page says a result of false hides: the null provider, no selected tenant and a gateway failure. A provider may state why it denied through an optional part of the contract; a provider that states nothing yields the plain flag or entitlement explanation. An entry with a host policy only passes, with host authorization reported as not evaluated. The services package gains the evaluation core: `Filter` and the evaluation run the same code, so the visible subset, the order, the short circuit and the number of provider calls are those of today, and existing callers of `Filter` compile unchanged. The null providers state the null provider, and a denial while `ITenantContext` holds no tenant is reported as no selected tenant. A filter that a host registered before `AddShellServices` stays the one resolved; when it does not implement the contract, the evaluation says that no explanation is available and replaces nothing. An explanation holds the identifiers of the entry, of the flag and of the entitlement and never a token or a header value. Where an explanation may be shown is a rule of the host and belongs to AIFACTORY-US-320. Publication is part of this PBI, although the backlog page left it out: the pipeline of the abstractions repository publishes first, the services repository pins that version and publishes second, each to the ConnectSoft feed with a version that is not yet on the feed. The pins of the shell template are the reference of the family, so the microfrontend library template follows them under the pin check of AIFACTORY-US-321. Kind: enabling. Traces: adrs: ADR-0007. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given the six rows of the explanation matrix of the backlog page (no requirement, flag false, entitlement false, both declared with the flag false, both allowed, host policy only), when one evaluation of the services package runs, then the visible subset equals the result of `Filter` in content and order and every candidate carries its explanation: `PassesFilter`, `FeatureFlagNotEnabled`, `EntitlementNotGranted`, the entitlement `NotEvaluated` after a failed flag, and a pass with host authorization not evaluated for the policy row (ADR-0007: the shell composes the modules of the Studio; model/components.yaml names the filter diagnostics as a need of this component).",
        "AC2: Given the null providers of `AddShellServices`, a tenant context without a tenant, and a provider that states a gateway failure through the optional part of the contract, when the evaluation runs, then the explanation names the null provider, the missing tenant or the gateway failure, a provider that states nothing yields the plain flag or entitlement explanation, and no explanation holds a token or a header value (ADR-0007; model/components.yaml lists both repositories under `cmp-blazor-shell`).",
        "AC3: Given the existing callers of `Filter` and a host that registers its own `IShellNavigationFilter` before `AddShellServices`, when they build and run against the new versions, then the callers compile unchanged, the order, the short circuit and the number of calls to each provider equal those before the change, `RequiredPolicy` is not evaluated, the filter of the host stays the one resolved, and an evaluation over a filter without the contract reports that no explanation is available (ADR-0007, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md).",
        "AC4: Given the unit tests of both repositories are green, when their pipelines run, then the abstractions package is pushed to the ConnectSoft feed with a version that is not on the feed, the services package pins that version and is pushed with a version of its own that is not on the feed, a probe project with the ConnectSoft feed as its only source restores both and resolves the evaluation from `AddShellServices`, and the abstractions package holds no reference to the services package (ADR-0007: the modules share one shell contract that is maintained; model/components.yaml lists both repositories under `cmp-blazor-shell`)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1436",
        "AIFACTORY-TASK-1437",
        "AIFACTORY-TASK-1438",
        "AIFACTORY-TASK-1439",
        "AIFACTORY-TASK-1440",
        "AIFACTORY-TASK-1441"
      ],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3102,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-335]",
      "number": 335
    },
    {
      "id": "AIFACTORY-TASK-1436",
      "type": "task",
      "parent": "AIFACTORY-US-335",
      "title": "Optional evaluation contract of the navigation filter in the abstractions package",
      "sequence": "18.29.02.01",
      "description": "BEFORE DEVELOPMENT. Optional evaluation contract of the navigation filter in the abstractions package. Expected output: The abstractions package holds an optional evaluation contract beside the unchanged `IShellNavigationFilter`: one call that returns the visible subset and, per candidate, the outcome of the flag check and of the entitlement check with the explanations `PassesFilter`, `FeatureFlagNotEnabled`, `EntitlementNotGranted` and `NotEvaluated`, the causes null provider, no selected tenant and gateway failure, the mark that host authorization was not evaluated, and an optional part by which a flag or entitlement provider states why it denied; the Features page and the README of the repository list the contract.. Kind: contract. Repository: ConnectSoft.Blazor.Shell.Services.Abstractions. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The abstractions package holds an optional evaluation contract beside the unchanged `IShellNavigationFilter`: one call that returns the visible subset and, per candidate, the outcome of the flag check and of the entitlement check with the explanations `PassesFilter`, `FeatureFlagNotEnabled`, `EntitlementNotGranted` and `NotEvaluated`, the causes null provider, no selected tenant and gateway failure, the mark that host authorization was not evaluated, and an optional part by which a flag or entitlement provider states why it denied; the Features page and the README of the repository list the contract."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Blazor.Shell.Services.Abstractions"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3102,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1436]",
      "number": 1436
    },
    {
      "id": "AIFACTORY-TASK-1437",
      "type": "task",
      "parent": "AIFACTORY-US-335",
      "title": "Abstractions package with the evaluation contract published to the ConnectSoft feed",
      "sequence": "18.29.02.02",
      "description": "BEFORE DEVELOPMENT. Abstractions package with the evaluation contract published to the ConnectSoft feed. Expected output: The pipeline of the abstractions repository builds, tests, packs and pushes the package that carries the evaluation contract to the ConnectSoft feed with a version that is not yet on the feed, and the package of that version restores from the feed in a clean project.. Kind: operations. Repository: ConnectSoft.Blazor.Shell.Services.Abstractions. Verification: the pipeline run pushes the package and a clean restore of the published version succeeds.",
      "acceptanceCriteria": [
        "The pipeline of the abstractions repository builds, tests, packs and pushes the package that carries the evaluation contract to the ConnectSoft feed with a version that is not yet on the feed, and the package of that version restores from the feed in a clean project."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Blazor.Shell.Services.Abstractions"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3102,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1437]",
      "number": 1437
    },
    {
      "id": "AIFACTORY-TASK-1438",
      "type": "task",
      "parent": "AIFACTORY-US-335",
      "title": "Default navigation filter refactored around one evaluation core",
      "sequence": "18.29.02.03",
      "description": "BEFORE DEVELOPMENT. Default navigation filter refactored around one evaluation core. Expected output: `ShellNavigationFilter` implements the evaluation contract around one evaluation core that `Filter` also runs, so the visible subset, the order, the short circuit and the provider calls are unchanged; `NullFeatureFlagService` and `NullEntitlementContext` state the null provider, a denial without a tenant in `ITenantContext` is reported as no selected tenant, a reason a provider states is passed through, and `AddShellServices` registers the evaluation with `TryAdd` so that a filter of the host stays authoritative; the central package file of the repository pins the abstractions version of AIFACTORY-TASK-1437.. Kind: implementation. Repository: ConnectSoft.Blazor.Shell.Services. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`ShellNavigationFilter` implements the evaluation contract around one evaluation core that `Filter` also runs, so the visible subset, the order, the short circuit and the provider calls are unchanged; `NullFeatureFlagService` and `NullEntitlementContext` state the null provider, a denial without a tenant in `ITenantContext` is reported as no selected tenant, a reason a provider states is passed through, and `AddShellServices` registers the evaluation with `TryAdd` so that a filter of the host stays authoritative; the central package file of the repository pins the abstractions version of AIFACTORY-TASK-1437."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.Shell.Services"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3102,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1438]",
      "number": 1438
    },
    {
      "id": "AIFACTORY-TASK-1439",
      "type": "task",
      "parent": "AIFACTORY-US-335",
      "title": "Explanation matrix, parity and call count tests of the evaluation core",
      "sequence": "18.29.02.04",
      "description": "BEFORE DEVELOPMENT. Explanation matrix, parity and call count tests of the evaluation core. Expected output: The unit test project of the services repository holds the six rows of the explanation matrix of the backlog page, extended by the null provider, the missing tenant and a provider that states a gateway failure; parity tests that compare the evaluation with `Filter` in content and order; counting providers that fail a test when a provider is called more often than before the change; and a host override case with a filter that does not implement the contract.. Kind: fixture. Repository: ConnectSoft.Blazor.Shell.Services. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project of the services repository holds the six rows of the explanation matrix of the backlog page, extended by the null provider, the missing tenant and a provider that states a gateway failure; parity tests that compare the evaluation with `Filter` in content and order; counting providers that fail a test when a provider is called more often than before the change; and a host override case with a filter that does not implement the contract."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.Shell.Services"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1439]",
      "number": 1439
    },
    {
      "id": "AIFACTORY-TASK-1440",
      "type": "task",
      "parent": "AIFACTORY-US-335",
      "title": "Services package with the evaluation core published to the ConnectSoft feed",
      "sequence": "18.29.02.05",
      "description": "BEFORE DEVELOPMENT. Services package with the evaluation core published to the ConnectSoft feed. Expected output: The pipeline of the services repository builds, tests, packs and pushes the package that carries the evaluation core to the ConnectSoft feed with a version that is not yet on the feed, after the abstractions version it pins is on the feed; the Features page and the README of the repository describe the evaluation and keep the rule that a microfrontend never references this package.. Kind: operations. Repository: ConnectSoft.Blazor.Shell.Services. Verification: the pipeline run pushes the package after the abstractions version it pins is on the feed.",
      "acceptanceCriteria": [
        "The pipeline of the services repository builds, tests, packs and pushes the package that carries the evaluation core to the ConnectSoft feed with a version that is not yet on the feed, after the abstractions version it pins is on the feed; the Features page and the README of the repository describe the evaluation and keep the rule that a microfrontend never references this package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Blazor.Shell.Services"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3102,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1440]",
      "number": 1440
    },
    {
      "id": "AIFACTORY-TASK-1441",
      "type": "task",
      "parent": "AIFACTORY-US-335",
      "title": "Verify the evaluation, the parity and the two published versions",
      "sequence": "18.29.02.06",
      "description": "BEFORE DEVELOPMENT. Verify the evaluation, the parity and the two published versions. Expected output: Run the tests of AIFACTORY-TASK-1439 and restore the two published versions in a probe project whose only source is the ConnectSoft feed; every row shows its explanation, the evaluation equals `Filter`, no provider is called more often and the probe resolves the evaluation from `AddShellServices`, which proves AC1 to AC4 of AIFACTORY-US-335 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.Shell.Services.",
      "acceptanceCriteria": [
        "Run the tests of AIFACTORY-TASK-1439 and restore the two published versions in a probe project whose only source is the ConnectSoft feed; every row shows its explanation, the evaluation equals `Filter`, no provider is called more often and the probe resolves the evaluation from `AddShellServices`, which proves AC1 to AC4 of AIFACTORY-US-335 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.Shell.Services"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1441]",
      "number": 1441
    },
    {
      "id": "AIFACTORY-US-320",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-167",
      "title": "Blazor shell template: a developer can ask why a navigation entry or a command is hidden and gets the cause, in Development and by explicit opt-in only",
      "sequence": "18.29.03",
      "description": "As an asset maintainer, I want the shell to explain the decision of its navigation filter to a developer, so that a hidden work area of the Studio is diagnosed from the shell and not from logs. The navigation filter of the shell keeps an entry when its feature flag and its entitlement both allow it, and the diagnostics backlog page of the template (OP-025 in its documentation) records the gap: a result of false does not say whether an unknown flag, a null provider, a missing grant, a cleared cache, a missing tenant or a gateway failure caused it, and an entry that never entered the candidate sequence cannot be labelled rejected. The page keeps the work behind a decision gate and fixes the contract: `Filter` stays source-compatible, one evaluation supplies both the visible subset and the reasons, the flag is checked before the entitlement, `RequiredPolicy` stays a concern of the host and is not evaluated by the filter, and diagnostics need both the Development environment and an explicit opt-in, also when the option is set in Production. The page splits the work in three parts: the adopter decision, the evaluation contract and evaluation core in the shell service packages, and the diagnostic surface in the template. This PBI covers the first and the third; the second is AIFACTORY-US-335 of this feature. The proceed decision is the one the owner took for the Studio (D99). It is recorded with the seven work areas filtered by role, flag and entitlement as the case, and with the plain statement that no observed behaviour exists, because the Studio is built after this feature and the page says that synthetic fixtures do not establish demand. Both surfaces, the navigation menu and the command palette, are recorded as selected. The second part is delivered by AIFACTORY-US-335: the repositories of the shell service abstractions and of the shell services belong to this component and are used as packages (D115), so the optional diagnostic contract and the single evaluation core are published from them to the ConnectSoft feed, each with a version. The template pins those two versions in its central package file and never copies a filter type. It binds the menu and the palette to the evaluation result of the packages, its host adapters state a gateway failure as the reason of a denial through the contract, and it renders the explanation for a developer: the entry passes, its flag is not enabled, its entitlement is not granted, a check was not evaluated because an earlier one failed, the provider is the null provider, no tenant is selected, or the gateway failed. In Production neither the view nor its payload exists. Kind: enabling. Traces: adrs: ADR-0007, ADR-0015. Depends on: AIFACTORY-US-319, AIFACTORY-US-335. Sources: model/components.yaml, model/template-parameters/connectsoft-blazor-shell.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a template whose central package file pins the versions of the shell service packages that AIFACTORY-US-335 publishes, and a shell in Development with the diagnostic option on and entries hidden by a flag, by an entitlement, by a null provider, by a missing tenant and by a gateway failure, when a developer opens the diagnostic view, then every entry shows its own cause, an entry whose flag failed shows its entitlement as not evaluated, and the visible entries equal the result of the filter (ADR-0007: the shell composes the modules of the Studio; model/components.yaml names the filter diagnostics as a need of this component).",
        "AC2: Given a shell in Production with the diagnostic option set to true, or a shell in Development without the option, when it renders, then the diagnostic view is not registered, no response holds an explanation payload, and the names of rejected entries appear in no markup (ADR-0015 amendment on a resource of another tenant: what the scope of a caller does not cover is answered as absent; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md).",
        "AC3: Given an entry that needs a host policy only, when it is evaluated, then the filter reports that it passes and that host authorization was not evaluated, the order and the short circuit of the filter are unchanged, existing callers of `Filter` compile unchanged and the template source holds no copy of a filter or evaluation type, and the central package file of the template pins the two versions that AIFACTORY-US-335 publishes, which restore from the ConnectSoft feed (ADR-0007, model/template-parameters/connectsoft-blazor-shell.yaml gains no parameter by this PBI)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1378",
        "AIFACTORY-TASK-611",
        "AIFACTORY-TASK-1379",
        "AIFACTORY-TASK-1380"
      ],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3103,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007",
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-319",
        "AIFACTORY-US-335"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-320]",
      "number": 320
    },
    {
      "id": "AIFACTORY-TASK-1378",
      "type": "task",
      "parent": "AIFACTORY-US-320",
      "title": "Proceed decision, selected surfaces and the pinned package versions recorded on the backlog page",
      "sequence": "18.29.03.01",
      "description": "BEFORE DEVELOPMENT. Proceed decision, selected surfaces and the pinned package versions recorded on the backlog page. Expected output: The diagnostics backlog page of the template records the proceed decision of the owner for the Factory Studio (D99) with the seven work areas filtered by role, flag and entitlement as the case, states that no observed behaviour exists because the Studio is built after this feature, records that both surfaces, the navigation menu and the command palette, are selected, and carries the bounded contract: the causes a developer sees and the two exposure conditions. It names the evaluation contract and the evaluation core of the shell service packages, the two repositories that own them as repositories of this component (D115), and the two published versions of AIFACTORY-US-335 that the template pins.. Kind: documentation. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: the page names the decision, the case, the two surfaces and the two pinned package versions.",
      "acceptanceCriteria": [
        "The diagnostics backlog page of the template records the proceed decision of the owner for the Factory Studio (D99) with the seven work areas filtered by role, flag and entitlement as the case, states that no observed behaviour exists because the Studio is built after this feature, records that both surfaces, the navigation menu and the command palette, are selected, and carries the bounded contract: the causes a developer sees and the two exposure conditions. It names the evaluation contract and the evaluation core of the shell service packages, the two repositories that own them as repositories of this component (D115), and the two published versions of AIFACTORY-US-335 that the template pins."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3103,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1378]",
      "number": 1378
    },
    {
      "id": "AIFACTORY-TASK-611",
      "type": "task",
      "parent": "AIFACTORY-US-320",
      "title": "Navigation filter diagnostics (OP-025)",
      "sequence": "18.29.03.02",
      "description": "BEFORE DEVELOPMENT. Navigation filter diagnostics (OP-025). Expected output: The central package file of the template pins the versions of the shell service abstractions and of the shell services that AIFACTORY-US-335 publishes, and the navigation menu and the command palette take their visible entries and the reasons from one evaluation of the packages; the host adapters of AIFACTORY-US-319 state a gateway failure as the reason of a denial through the contract; a developer can ask why an entry or command is hidden and gets the cause: the flag, the entitlement, a check not evaluated, the null provider, the missing tenant or a gateway failure; the view is registered only in Development with the explicit option and never in Production; the template source holds no copy of a filter type.. Kind: implementation. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The central package file of the template pins the versions of the shell service abstractions and of the shell services that AIFACTORY-US-335 publishes, and the navigation menu and the command palette take their visible entries and the reasons from one evaluation of the packages; the host adapters of AIFACTORY-US-319 state a gateway failure as the reason of a denial through the contract; a developer can ask why an entry or command is hidden and gets the cause: the flag, the entitlement, a check not evaluated, the null provider, the missing tenant or a gateway failure; the view is registered only in Development with the explicit option and never in Production; the template source holds no copy of a filter type."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-611]",
      "number": 611
    },
    {
      "id": "AIFACTORY-TASK-1379",
      "type": "task",
      "parent": "AIFACTORY-US-320",
      "title": "Explanation matrix and exposure tests of the shell",
      "sequence": "18.29.03.03",
      "description": "BEFORE DEVELOPMENT. Explanation matrix and exposure tests of the shell. Expected output: The unit test project holds the explanation matrix of the backlog page as component tests (open entry, flag false, entitlement false, both declared, both allowed, policy only) extended by the null provider, the missing tenant and the gateway failure, and exposure tests for Production with the option on and Development without it.. Kind: fixture. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project holds the explanation matrix of the backlog page as component tests (open entry, flag false, entitlement false, both declared, both allowed, policy only) extended by the null provider, the missing tenant and the gateway failure, and exposure tests for Production with the option on and Development without it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3103,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1379]",
      "number": 1379
    },
    {
      "id": "AIFACTORY-TASK-1380",
      "type": "task",
      "parent": "AIFACTORY-US-320",
      "title": "Verify the explanations and the two exposure conditions",
      "sequence": "18.29.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the explanations and the two exposure conditions. Expected output: Run the tests of AIFACTORY-TASK-1379; every row of the matrix shows its cause, the visible entries equal the filter result and neither exposure case renders the view or a payload, which proves AC1 to AC3 of AIFACTORY-US-320 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.ShellTemplate.",
      "acceptanceCriteria": [
        "Run the tests of AIFACTORY-TASK-1379; every row of the matrix shows its cause, the visible entries equal the filter result and neither exposure case renders the view or a payload, which proves AC1 to AC3 of AIFACTORY-US-320 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1380]",
      "number": 1380
    },
    {
      "id": "AIFACTORY-US-321",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-167",
      "title": "Blazor shell family: a standalone microfrontend composes into the empty shell through its descriptor pair, and the UIKit and shell package pins are the same in every template",
      "sequence": "18.29.04",
      "description": "As an asset maintainer, I want one composition contract and one set of package pins across the shell template and the microfrontend library template, so that a microfrontend built from one template composes into a shell built from the other without a version conflict. The shell template ships an empty microfrontend registry on purpose, and the integration validation checklist of the microfrontend library template describes how a microfrontend joins a shell: a static descriptor with its assembly and its navigation items, and one registration method the shell calls once; the shell aggregates the assemblies and the navigation and passes the assemblies to the router. The same checklist records a known pin drift: the empty shell template pins one version of the UI kit and of the shell services package while the library and the sample templates pin others, and a test locks the pins of the library so that nobody moves them alone. The Studio is a shell from one template composing microfrontends from the other, so a drift between them is a restore conflict in the Studio repository. This PBI verifies the contract and aligns the pins of the two templates the Studio is built from. A fixture microfrontend that follows the descriptor pair is composed into a shell generated from the template, and a test proves that its routes answer and its navigation items appear in order. The pins of the UI kit, of the shell contracts, of the shell service abstractions and of the shell services are made equal in the shell template and in the microfrontend library template. A pin check joins the shared template installer job of ConnectSoft.AzurePipelines as an optional step that is off by default: it compares the UI kit and shell package pins of the consuming template with the pins of the latest published shell template package, which is the one reference of the family, and fails on a difference. The shell template and the microfrontend library template switch it on for all four pins; a consumer may limit the comparison to the shell package pins, which the Studio does. The sample templates the checklist names, the Identity administration and self-service microfrontend templates, are other repositories outside this component: they keep their recorded pins, their pipelines do not run the check, and the checklist says so until their own work aligns them and switches it on. The Tokens, Flowbite and DaisyUI adapter repositories of the UI kit stay outside this component as well: the check compares no adapter pin and their pins stay as recorded. The architecture test that a microfrontend never references the shell services package runs in both templates. Kind: enabling. Traces: adrs: ADR-0007. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-blazor-shell.yaml, model/template-parameters/connectsoft-blazor-mfe.yaml, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given a shell generated from the template and a fixture microfrontend with a descriptor and a registration method, when the shell registers it and passes its assembly to the router, then the routes of the microfrontend answer and its navigation items appear in the order of their `Order` values (ADR-0007: each module of the Studio is a microfrontend composed into the shell; docs/architecture/adr/0007-blazor-mfe-studio-frontend.md).",
        "AC2: Given the central package files of the shell template and of the microfrontend library template, when they are compared, then the pins of the UI kit, the shell contracts, the shell service abstractions and the shell services are equal, and the pin test of the library template asserts the aligned values (ADR-0007: the modules share one design system; model/templates.yaml lists both templates).",
        "AC3: Given the shell template or the microfrontend library template, which switch the optional pin check of the shared installer job on, and a pin that differs from the pins of the latest published shell template package, when the pipeline runs, then the pin check fails with the package and both versions named, and a template pipeline that has not switched the check on, such as that of a sample template, runs as before; given a microfrontend project that references the shell services package, then the architecture test fails in either template (ADR-0007, model/components.yaml names aligned pins as a need of this component)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-612",
        "AIFACTORY-TASK-1381",
        "AIFACTORY-TASK-1382",
        "AIFACTORY-TASK-1383"
      ],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3104,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-321]",
      "number": 321
    },
    {
      "id": "AIFACTORY-TASK-612",
      "type": "task",
      "parent": "AIFACTORY-US-321",
      "title": "Composition contract verified and pins aligned across the shell family",
      "sequence": "18.29.04.01",
      "description": "BEFORE DEVELOPMENT. Composition contract verified and pins aligned across the shell family. Expected output: A fixture microfrontend composes into the empty shell through the `{X}Mfe` and `Add{X}Mfe` pair and its routes answer; the UIKit and shell package pins of the shell template are the reference of the family; the architecture test that a microfrontend never references the shell services package runs in the shell template.. Kind: contract. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A fixture microfrontend composes into the empty shell through the `{X}Mfe` and `Add{X}Mfe` pair and its routes answer; the UIKit and shell package pins of the shell template are the reference of the family; the architecture test that a microfrontend never references the shell services package runs in the shell template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3104,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-612]",
      "number": 612
    },
    {
      "id": "AIFACTORY-TASK-1381",
      "type": "task",
      "parent": "AIFACTORY-US-321",
      "title": "Pins of the microfrontend library template moved to the reference",
      "sequence": "18.29.04.02",
      "description": "BEFORE DEVELOPMENT. Pins of the microfrontend library template moved to the reference. Expected output: The central package file of the microfrontend library template pins the UI kit, the shell contracts, the shell service abstractions and the shell services at the versions of the shell template; the pin test `IntegrationContractTests` asserts the aligned values; the integration validation checklist states the aligned values of the two templates, names the latest published shell template package as the reference of the pin check, and records that the sample templates keep their own pins and do not run the check until their own work switches it on.. Kind: implementation. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The central package file of the microfrontend library template pins the UI kit, the shell contracts, the shell service abstractions and the shell services at the versions of the shell template; the pin test `IntegrationContractTests` asserts the aligned values; the integration validation checklist states the aligned values of the two templates, names the latest published shell template package as the reference of the pin check, and records that the sample templates keep their own pins and do not run the check until their own work switches it on."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1381]",
      "number": 1381
    },
    {
      "id": "AIFACTORY-TASK-1382",
      "type": "task",
      "parent": "AIFACTORY-US-321",
      "title": "Pin check in the shared template installer job",
      "sequence": "18.29.04.03",
      "description": "BEFORE DEVELOPMENT. Pin check in the shared template installer job. Expected output: The shared installer job `template/dotnet-template-installer-job.yaml` gains an optional step, off by default, that compares the UI kit and shell package pins of the consuming template with the pins of the latest published shell template package and fails with the package and both versions named; the shell template and the microfrontend library template switch it on for all four pins, a consumer may limit the comparison to the shell package pins, which the Studio does because its single central package file may adopt a newer published kit version, and a consumer that does not switch the step on is unchanged.. Kind: operations. Repository: ConnectSoft.AzurePipelines. Verification: a consumer run with the check on and a planted differing pin fails at the pin check; a consumer run without the switch is unchanged.",
      "acceptanceCriteria": [
        "The shared installer job `template/dotnet-template-installer-job.yaml` gains an optional step, off by default, that compares the UI kit and shell package pins of the consuming template with the pins of the latest published shell template package and fails with the package and both versions named; the shell template and the microfrontend library template switch it on for all four pins, a consumer may limit the comparison to the shell package pins, which the Studio does because its single central package file may adopt a newer published kit version, and a consumer that does not switch the step on is unchanged."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.AzurePipelines"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3104,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1382]",
      "number": 1382
    },
    {
      "id": "AIFACTORY-TASK-1383",
      "type": "task",
      "parent": "AIFACTORY-US-321",
      "title": "Verify the composition, the equal pins and the pin check",
      "sequence": "18.29.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the composition, the equal pins and the pin check. Expected output: Compose the fixture microfrontend into a generated shell, compare the pins of the two templates and run both pipelines with and without a planted differing pin; the routes answer, the pins are equal and the planted pin fails the check, which proves AC1 to AC3 of AIFACTORY-US-321 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.ShellTemplate.",
      "acceptanceCriteria": [
        "Compose the fixture microfrontend into a generated shell, compare the pins of the two templates and run both pipelines with and without a planted differing pin; the routes answer, the pins are equal and the planted pin fails the check, which proves AC1 to AC3 of AIFACTORY-US-321 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1383]",
      "number": 1383
    },
    {
      "id": "AIFACTORY-US-322",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-167",
      "title": "Blazor shell template: the packed template is installed, instantiated, restored, built and tested, and a shell with a composed microfrontend answers, before the package publishes",
      "sequence": "18.29.05",
      "description": "As an asset maintainer, I want every change of the shell template to be gated by the shell it generates from the packed candidate, so that a package that would scaffold a shell that does not build, pass or start never reaches the feed. This PBI is the gate of the feature. The installer pipeline file of the shell template (`azure-pipelines-template.yml` of the template) only calls the shared installer job of ConnectSoft.AzurePipelines, whose steps pack, validate one instantiation and push in one sequence; the template passes a smoke argument that skips the restore, so the generated shell is neither restored nor built there, and a repeated version is governed by the `allowPackageConflicts` parameter of the shared job. A gate between pack and push and a refusal of a repeated version therefore cannot be written in the file of the template. The smoke validation checklist of the template is a manual list in which the generation without tests is still unchecked. The gate rests on the shared installer steps and on the cases of the template. The gate hook and the version guard of the shared installer steps are delivered by AIFACTORY-TASK-1426 of the feature component-base-template-findings, in the first increment, because the template gates of the increments before this one already rely on the hook. The hook runs the generated cases of a consumer against the installed candidate after the pack and before the push. The version guard is opt-in and off by default: switched on, it refuses a version already on the feed, and `allowPackageConflicts` stays for a consumer that does not switch it on. The shell template switches the hook and the guard on and defines its cases in its scaffold test project. The default case and the case without the test project are instantiated, restored, built in Release and, where tests exist, tested, and each output is scanned for template placeholders that were not replaced. A composition case generates the shell, adds the fixture microfrontend, starts the host with authentication off and probes the home route and a route of the microfrontend. An adapter case starts the host with authentication on against the gateway stub and asserts the fail-closed behaviour. A case that fails any stage fails the run with the case and the stage named, and the push is not reached. Publication pushes the installer package to the ConnectSoft feed with a version that is not yet on the feed. The template gains no Factory profile, so no additional profile case is declared. This is an evidence PBI: a template feature has no scenario, so the gate names what it proves through `traces.adrs` and its sources. Kind: evidence. Traces: adrs: ADR-0007. Depends on: AIFACTORY-US-319, AIFACTORY-US-320, AIFACTORY-US-321, feature:component-base-template-findings. Sources: model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-blazor-shell.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the shell template, when its installer pipeline runs, then the candidate is packed once and installed, the default case and the case without tests are instantiated, restored, built in Release, tested and scanned, and the composition case starts the generated shell and gets an answer from the home route and from a route of the fixture microfrontend (ADR-0007; model/template-parameters/connectsoft-blazor-shell.yaml lists `includeTests` and `skipRestore`).",
        "AC2: Given a case fails any stage, when the pipeline evaluates the run, then the gate hook of the shared installer steps (AIFACTORY-TASK-1426) fails the run with the case and the stage named and the push step is not reached; a fixture with a planted failing case proves the refusal (ADR-0007, 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 installer package is pushed to the ConnectSoft feed with a version that is not on the feed, and the version guard of the shared installer steps, which the template switches on, refuses a repeated version with the reason (ADR-0007, docs/architecture/catalogs/templates.md keeps the row of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1384",
        "AIFACTORY-TASK-1385",
        "AIFACTORY-TASK-1386"
      ],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3105,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-319",
        "AIFACTORY-US-320",
        "AIFACTORY-US-321",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-322]",
      "number": 322
    },
    {
      "id": "AIFACTORY-TASK-1384",
      "type": "task",
      "parent": "AIFACTORY-US-322",
      "title": "Generated cases of the shell template passed to the gate hook of the shared installer steps",
      "sequence": "18.29.05.01",
      "description": "BEFORE DEVELOPMENT. Generated cases of the shell template passed to the gate hook of the shared installer steps. Expected output: The scaffold test project of the shell template defines the default case, the case without tests, the composition case and the adapter case against the installed candidate, with restore and build instead of the smoke argument that skips the restore; the installer pipeline file of the template switches the gate hook and the version guard of AIFACTORY-TASK-1426 on and passes the hook these cases; the smoke validation checklist points at the cases.. Kind: operations. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: azure-pipelines-template.yml passes the four cases to the gate hook of the shared installer job.",
      "acceptanceCriteria": [
        "The scaffold test project of the shell template defines the default case, the case without tests, the composition case and the adapter case against the installed candidate, with restore and build instead of the smoke argument that skips the restore; the installer pipeline file of the template switches the gate hook and the version guard of AIFACTORY-TASK-1426 on and passes the hook these cases; the smoke validation checklist points at the cases."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3105,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1384]",
      "number": 1384
    },
    {
      "id": "AIFACTORY-TASK-1385",
      "type": "task",
      "parent": "AIFACTORY-US-322",
      "title": "Planted failing case fixture for the gate",
      "sequence": "18.29.05.02",
      "description": "BEFORE DEVELOPMENT. Planted failing case fixture for the gate. Expected output: A pipeline fixture generates the composition case with a microfrontend whose route is not registered and asserts that the run fails at the probe stage with the case named and that the publication stage is not reached.. Kind: fixture. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: the planted run fails at the probe stage.",
      "acceptanceCriteria": [
        "A pipeline fixture generates the composition case with a microfrontend whose route is not registered and asserts that the run fails at the probe stage with the case named and that the publication stage is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3105,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1385]",
      "number": 1385
    },
    {
      "id": "AIFACTORY-TASK-1386",
      "type": "task",
      "parent": "AIFACTORY-US-322",
      "title": "Verify the gate on a green run and on the planted run",
      "sequence": "18.29.05.03",
      "description": "BEFORE DEVELOPMENT. Verify the gate on a green run and on the planted run. Expected output: One pipeline run with the four cases green reaches publication and one run with the planted case fails before it; both runs prove AC1 to AC3 of AIFACTORY-US-322 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.ShellTemplate.",
      "acceptanceCriteria": [
        "One pipeline run with the four cases green reaches publication and one run with the planted case fails before it; both runs prove AC1 to AC3 of AIFACTORY-US-322 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3105,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1386]",
      "number": 1386
    },
    {
      "id": "AIFACTORY-US-125",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-167",
      "title": "Blazor shell template: gateway adapters, filter diagnostics and pinned packages before the Studio is delivered and proven on a generated solution",
      "sequence": "18.29.06",
      "description": "As an asset maintainer, I want Blazor Shell + MFEs + UIKit to carry gateway adapters, filter diagnostics and pinned packages before the Studio, so that it serves Factory Studio and generated product UIs without later rework. This is the integration PBI of the feature. An asset maintainer packs the shell template with the four gateway adapters, the token per gateway client, the navigation filter diagnostics, the verified composition contract and the aligned pins, installs the package and runs its generated cases in the installer pipeline. Every generated shell restores, builds and passes its tests, and the composed shell answers, 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 shell the Studio is built from. From the published package a shell is generated and a standalone microfrontend is composed into it. With authentication on against a gateway stub it lists the scope items the gateway returns, denies on a refusal and leaves out an item of another tenant, and its pins equal those of the microfrontend library template. In Development with the diagnostic option it explains a hidden entry from the evaluation of the shell service packages that AIFACTORY-US-335 publishes and the template pins. The feature is done when that shell is generated from a fresh install of the published package. Repositories of the feature: ConnectSoft.Blazor.ShellTemplate, and ConnectSoft.Blazor.Shell.Services.Abstractions and ConnectSoft.Blazor.Shell.Services for the evaluation contract and the evaluation core; one task changes the microfrontend library template and one the shared pipeline tooling. Kind: enabling. Traces: adrs: ADR-0007, ADR-0015; services: StudioBff. Depends on: AIFACTORY-US-319, AIFACTORY-US-335, AIFACTORY-US-320, AIFACTORY-US-321, AIFACTORY-US-322. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-blazor-shell.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.Blazor.ShellTemplate 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-0007, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-610 (gateway adapters for tenants, feature flags, notifications and activity) is done, then the shell populates its tenant, project and environment switchers, flags, entitlements, notifications and activity from the named gateway client when authentication is on, fails closed on 401, 403 or a gateway outage with the reason logged and never a token or header value, and keeps its in-memory data in the auth-off demo mode (ADR-0015 amendments on the token audience and on a resource of another tenant).",
        "AC3: Given the work of AIFACTORY-TASK-611 (navigation filter diagnostics) is done, which pins the versions of the shell service packages that AIFACTORY-US-335 publishes, then a developer can ask the shell why a navigation entry or command is hidden and gets the cause, the flag, the entitlement, the missing tenant, a null provider or a gateway failure, and the diagnostic is behind a development switch and never renders in production (ADR-0007, docs/architecture/ecosystem-composition.md).",
        "AC4: Given the work of AIFACTORY-TASK-612 (composition contract verified and pins aligned across the shell family) is done, then a standalone microfrontend composes into the empty shell through its descriptor pair and its routes answer, the UIKit and shell package pins are the same in the shell template and the microfrontend library template, both of which switch the optional pin check on, and the architecture test that a microfrontend never references the shell services package runs in both (ADR-0007, model/templates.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1387",
        "AIFACTORY-TASK-676"
      ],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3106,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007",
          "ADR-0015"
        ],
        "services": [
          "StudioBff"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-319",
        "AIFACTORY-US-335",
        "AIFACTORY-US-320",
        "AIFACTORY-US-321",
        "AIFACTORY-US-322"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-shell.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-125]",
      "number": 125
    },
    {
      "id": "AIFACTORY-TASK-1387",
      "type": "task",
      "parent": "AIFACTORY-US-125",
      "title": "Generate a shell from the published package and compose a standalone microfrontend",
      "sequence": "18.29.06.01",
      "description": "BEFORE DEVELOPMENT. Generate a shell from the published package and compose a standalone microfrontend. Expected output: A probe installs the published installer package, generates a shell, composes the fixture microfrontend, starts the host against the gateway stub with authentication on and in Development with the diagnostic option, and compares its pins with the microfrontend library template; the run proves AC2 to AC4 of AIFACTORY-US-125 on the published package (ADR-0007, ADR-0015).. Kind: verification. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: dotnet new install of the published version, dotnet new connectsoft-blazor-shell, dotnet build -c Release, dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A probe installs the published installer package, generates a shell, composes the fixture microfrontend, starts the host against the gateway stub with authentication on and in Development with the diagnostic option, and compares its pins with the microfrontend library template; the run proves AC2 to AC4 of AIFACTORY-US-125 on the published package (ADR-0007, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1387]",
      "number": 1387
    },
    {
      "id": "AIFACTORY-TASK-676",
      "type": "task",
      "parent": "AIFACTORY-US-125",
      "title": "Verify blazor-shell-template-studio-delivered by running the declared command",
      "sequence": "18.29.06.02",
      "description": "BEFORE DEVELOPMENT. Verify blazor-shell-template-studio-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-125.. Kind: verification. Repository: ConnectSoft.Blazor.ShellTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-125."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/Control Plane/Index.md",
        "ConnectSoft.Blazor.ShellTemplate/docs/OP-025-Shell-Navigation-Filter-Diagnostics.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/INTEGRATION-VALIDATION-CHECKLIST.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 31,
      "phase": "templates-and-libraries",
      "stackRank": 3106,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-676]",
      "number": 676
    },
    {
      "id": "AIFACTORY-FEAT-168",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Blazor microfrontend library template: AppShell chrome, a neutral exemplar and a generated-solution gate",
      "sequence": "18.30",
      "description": "The Studio microfrontends are scaffolded from the microfrontend library template. Its own F11 record logs the gaps left open: the sample chrome is a custom navigation instead of the UIKit AppShell and still uses raw Tailwind colours instead of the cs-* semantic tokens, the sample microfrontends are Identity teaching stubs, the build has no MAX_PATH redirect, and the epic-level acceptance of the template (install, generate every parameter combination, build, run) is still unchecked. Component: Blazor Shell + MFEs + UIKit (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-167. Increment I3: Studio. Build order 32 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-323",
        "AIFACTORY-US-324",
        "AIFACTORY-US-325",
        "AIFACTORY-US-326",
        "AIFACTORY-US-126"
      ],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3200,
      "titlePrefix": "[AIFACTORY-FEAT-168]",
      "number": 168
    },
    {
      "id": "AIFACTORY-US-323",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-168",
      "title": "Blazor microfrontend library template: the generated shell host renders the UIKit AppShell bound to the shell abstractions, and its chrome uses only the `cs-*` tokens",
      "sequence": "18.30.01",
      "description": "As an asset maintainer, I want the shell host of the microfrontend library template to use the same chrome as the standalone shell template, so that a Studio microfrontend is developed inside the chrome it will be composed into. The F11 record of the template lists its chrome as a gap: the layout of the core project and its stylesheet are a custom header and navigation, not the UIKit AppShell, and the sample chrome still uses raw Tailwind `gray-*` and `dark:` utilities and legacy classes instead of the `cs-*` semantic tokens; the record leaves the migration as a follow-up. The manual compose matrix of its integration checklist still has two unchecked items: light and dark themes without raw colour regressions, and a mirrored navigation in right-to-left direction. The standalone shell template already renders the AppShell with its regions A to E bound to the shell abstractions. A microfrontend developed in one chrome and composed into another is reviewed twice, so this PBI moves the generated shell host of the library onto the same chrome. The layout of the core project renders the AppShell regions bound to the shell abstractions as the standalone shell template does, with the navigation taken from the microfrontend registry through the navigation filter. The layout and the stylesheet hold no raw `gray-*` utility, no `dark:` variant and no legacy class; colour, spacing, type and radius come from the `cs-*` tokens, so the `theme`, `density` and `enableRTL` parameters of the template switch the chrome through the tokens and the direction attribute. The Gallery sample stays the minimal stub the record describes. The record and the integration checklist mark the two gaps and the two matrix items as closed. Kind: enabling. Traces: adrs: ADR-0007. Depends on: feature:component-blazor-shell-template-studio, feature:component-uikit-factory-compositions. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-blazor-mfe.yaml, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given a solution generated from the template, when its shell host renders, then the layout of the core project is the UIKit AppShell with its regions bound to the shell abstractions and its navigation comes from the registry through the navigation filter, as in a shell generated from the standalone shell template (ADR-0007: the modules share a common design system and auth context; model/templates.yaml lists both templates).",
        "AC2: Given the layout and the stylesheet of the core project, when the token test scans them, then it finds no raw `gray-*` utility, no `dark:` variant and no legacy class, and a planted raw utility fails the test with the file and the class named (ADR-0007, model/components.yaml names the AppShell chrome as a need of this component).",
        "AC3: Given solutions generated with `theme` Light and Dark, with each `density` value and with `enableRTL` on, when the chrome renders, then theme and density change through the tokens only and the navigation is mirrored in right-to-left direction with no clipped text (ADR-0007, model/template-parameters/connectsoft-blazor-mfe.yaml lists the three parameters)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-613",
        "AIFACTORY-TASK-1388",
        "AIFACTORY-TASK-1389"
      ],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3201,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-blazor-shell-template-studio",
        "feature:component-uikit-factory-compositions"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-323]",
      "number": 323
    },
    {
      "id": "AIFACTORY-TASK-613",
      "type": "task",
      "parent": "AIFACTORY-US-323",
      "title": "Sample chrome on the UIKit AppShell with cs-* tokens",
      "sequence": "18.30.01.01",
      "description": "BEFORE DEVELOPMENT. Sample chrome on the UIKit AppShell with cs-* tokens. Expected output: The generated shell host of the library renders the UIKit AppShell regions A to E bound to the shell abstractions, as the standalone shell template does; no raw `gray-*` utility, `dark:` variant or legacy class remains in the core layout and its stylesheet; theme, density and direction switch through the tokens; the F11 record and the integration checklist mark the chrome gaps as closed.. Kind: implementation. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The generated shell host of the library renders the UIKit AppShell regions A to E bound to the shell abstractions, as the standalone shell template does; no raw `gray-*` utility, `dark:` variant or legacy class remains in the core layout and its stylesheet; theme, density and direction switch through the tokens; the F11 record and the integration checklist mark the chrome gaps as closed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-613]",
      "number": 613
    },
    {
      "id": "AIFACTORY-TASK-1388",
      "type": "task",
      "parent": "AIFACTORY-US-323",
      "title": "Token scan test and chrome component tests of the core layout",
      "sequence": "18.30.01.02",
      "description": "BEFORE DEVELOPMENT. Token scan test and chrome component tests of the core layout. Expected output: The unit test project holds a scan test over the core layout and its stylesheet that fails on a raw `gray-*` utility, a `dark:` variant or a legacy class with the file named, and component tests that render the chrome for both themes, the three density values and right-to-left direction.. Kind: fixture. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project holds a scan test over the core layout and its stylesheet that fails on a raw `gray-*` utility, a `dark:` variant or a legacy class with the file named, and component tests that render the chrome for both themes, the three density values and right-to-left direction."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3201,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1388]",
      "number": 1388
    },
    {
      "id": "AIFACTORY-TASK-1389",
      "type": "task",
      "parent": "AIFACTORY-US-323",
      "title": "Verify the AppShell chrome, the token scan and the theme, density and direction cases",
      "sequence": "18.30.01.03",
      "description": "BEFORE DEVELOPMENT. Verify the AppShell chrome, the token scan and the theme, density and direction cases. Expected output: Generate solutions for the theme, density and direction values and run the tests of AIFACTORY-TASK-1388; the chrome is the AppShell, the scan is clean and fails on a planted utility, which proves AC1 to AC3 of AIFACTORY-US-323 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate.",
      "acceptanceCriteria": [
        "Generate solutions for the theme, density and direction values and run the tests of AIFACTORY-TASK-1388; the chrome is the AppShell, the scan is clean and fails on a planted utility, which proves AC1 to AC3 of AIFACTORY-US-323 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1389]",
      "number": 1389
    },
    {
      "id": "AIFACTORY-US-324",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-168",
      "title": "Blazor microfrontend library template: one neutral exemplar microfrontend replaces the Identity teaching stubs and shows the contract a Studio microfrontend follows",
      "sequence": "18.30.02",
      "description": "As an asset maintainer, I want the microfrontend the template generates to be a neutral example of the composition contract, so that a Studio microfrontend starts from a clean pattern and not from identity screens it must delete. The template generates two sample microfrontends, an Identity administration one and an Identity self-service one, and its F11 record calls their screens teaching stubs. They carry a product domain the Studio does not have, and the integration checklist warns that the embedded samples and the standalone Identity templates follow two different navigation contracts that must not be mixed in one host. The composition contract itself is small and is documented in the record: a static descriptor with the assembly and the navigation items of the microfrontend, each item with an id, a text, a target, an icon, an optional required policy and an order, and one registration method that owns the dependency injection and the authorization policies of the microfrontend and that the shell calls once. A microfrontend references the shell contracts and the shell service abstractions and never the shell services package. This PBI replaces the two Identity stubs in the generated solution by one neutral exemplar microfrontend that carries no product domain. It has a descriptor, two navigation items of which one requires a policy, the registration method, one page that reads the scope and the user from the shell abstractions and one page that shows the loading, empty and error states with the kit components, and component tests for both. The registry, the host wiring, the contract tests and the scaffold test of the template follow the exemplar. Two parameters were meant for the Identity samples and gate nothing: `IncludeSampleData` is a symbol definition without a use, and `UseLocalDb` appears only in a conditional whose branches change no generated file; the parameter snapshot of this repository already binds `UseLocalDb` to false because a microfrontend holds no database. With the samples gone both are removed from the template configuration and its host files, and a scaffold test keeps the rule that every remaining parameter changes at least one generated file. The standalone Identity sample templates are other repositories and stay as they are. The record, the sample notes and the checklist describe the exemplar as the pattern. Kind: enabling. Traces: adrs: ADR-0007. Depends on: AIFACTORY-US-323. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-blazor-mfe.yaml, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given a solution generated from the template, when its projects are listed, then it holds one exemplar microfrontend project and no Identity sample project, the exemplar has a descriptor with its assembly and two navigation items and one registration method, and the shell host composes it through the registry (ADR-0007: each module of the Studio is a microfrontend composed into the shell; model/templates.yaml row of `connectsoft-blazor-mfe`).",
        "AC2: Given the exemplar project, when the architecture tests run, then it references the shell contracts and the shell service abstractions only, a planted reference to the shell services package fails the test, and no type or route of the exemplar names a product domain (ADR-0007, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md).",
        "AC3: Given the generated solution, when its tests run, then the component tests of the two exemplar pages pass, the item that requires a policy is hidden from a user without it, and the contract tests assert the ids, targets and unique orders of the exemplar navigation (ADR-0007, model/components.yaml names the neutral exemplar as a need of this component).",
        "AC4: Given the template configuration after this PBI, when the parameter-effect test generates a solution per value of every parameter, then every parameter changes at least one generated file, `UseLocalDb` and `IncludeSampleData` are defined in no configuration or host file of the template, and a planted parameter that gates nothing fails the test by name; the next inventory drops both from model/template-parameters/connectsoft-blazor-mfe.yaml (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-614",
        "AIFACTORY-TASK-1390",
        "AIFACTORY-TASK-1427",
        "AIFACTORY-TASK-1391",
        "AIFACTORY-TASK-1392"
      ],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3202,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-323"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-324]",
      "number": 324
    },
    {
      "id": "AIFACTORY-TASK-614",
      "type": "task",
      "parent": "AIFACTORY-US-324",
      "title": "Neutral exemplar microfrontend with its descriptor and navigation contribution",
      "sequence": "18.30.02.01",
      "description": "BEFORE DEVELOPMENT. Neutral exemplar microfrontend with its descriptor and navigation contribution. Expected output: One neutral exemplar microfrontend with its descriptor, its navigation contribution, the `{X}Mfe` and `Add{X}Mfe` pair, two pages and component tests shows the contract a Studio microfrontend follows; the exemplar carries no product domain and references the shell contracts and abstractions only.. Kind: contract. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "One neutral exemplar microfrontend with its descriptor, its navigation contribution, the `{X}Mfe` and `Add{X}Mfe` pair, two pages and component tests shows the contract a Studio microfrontend follows; the exemplar carries no product domain and references the shell contracts and abstractions only."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3202,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-614]",
      "number": 614
    },
    {
      "id": "AIFACTORY-TASK-1390",
      "type": "task",
      "parent": "AIFACTORY-US-324",
      "title": "Identity teaching stubs removed and the host, registry and tests moved to the exemplar",
      "sequence": "18.30.02.02",
      "description": "BEFORE DEVELOPMENT. Identity teaching stubs removed and the host, registry and tests moved to the exemplar. Expected output: The two Identity sample projects leave the template and the solution; the registry, the host wiring, the contract tests, the coverage tests and the scaffold test that asserted both Identity microfrontends assert the exemplar; the template configuration and the nuspec name no removed project.. Kind: implementation. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The two Identity sample projects leave the template and the solution; the registry, the host wiring, the contract tests, the coverage tests and the scaffold test that asserted both Identity microfrontends assert the exemplar; the template configuration and the nuspec name no removed project."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1390]",
      "number": 1390
    },
    {
      "id": "AIFACTORY-TASK-1427",
      "type": "task",
      "parent": "AIFACTORY-US-324",
      "title": "Dead parameters `UseLocalDb` and `IncludeSampleData` removed and a parameter-effect test added",
      "sequence": "18.30.02.03",
      "description": "BEFORE DEVELOPMENT. Dead parameters `UseLocalDb` and `IncludeSampleData` removed and a parameter-effect test added. Expected output: The template configuration, `dotnetcli.host.json` and `ide.host.json` of the template no longer define `UseLocalDb` and `IncludeSampleData`, and the conditional on `UseLocalDb` whose branches change nothing is gone; the scaffold test project holds a parameter-effect test that generates a solution per value of every parameter and fails with the parameter named when a parameter changes no generated file; the removal is noted for the next inventory of model/template-parameters/connectsoft-blazor-mfe.yaml.. Kind: contract. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet new connectsoft-blazor-mfe --help lists neither `UseLocalDb` nor `IncludeSampleData` | dotnet test -c Release --filter TestCategory=Scaffold.",
      "acceptanceCriteria": [
        "The template configuration, `dotnetcli.host.json` and `ide.host.json` of the template no longer define `UseLocalDb` and `IncludeSampleData`, and the conditional on `UseLocalDb` whose branches change nothing is gone; the scaffold test project holds a parameter-effect test that generates a solution per value of every parameter and fails with the parameter named when a parameter changes no generated file; the removal is noted for the next inventory of model/template-parameters/connectsoft-blazor-mfe.yaml."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3202,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1427]",
      "number": 1427
    },
    {
      "id": "AIFACTORY-TASK-1391",
      "type": "task",
      "parent": "AIFACTORY-US-324",
      "title": "F11 record, sample notes and integration checklist describe the exemplar",
      "sequence": "18.30.02.04",
      "description": "BEFORE DEVELOPMENT. F11 record, sample notes and integration checklist describe the exemplar. Expected output: The F11 record, the sample notes of the source folder, the Architecture page and the integration validation checklist of the template describe the exemplar as the composition pattern, drop the embedded Identity routes and keep the note that the standalone Identity templates are separate.. Kind: documentation. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: no page of the template names a removed Identity sample project.",
      "acceptanceCriteria": [
        "The F11 record, the sample notes of the source folder, the Architecture page and the integration validation checklist of the template describe the exemplar as the composition pattern, drop the embedded Identity routes and keep the note that the standalone Identity templates are separate."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3202,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1391]",
      "number": 1391
    },
    {
      "id": "AIFACTORY-TASK-1392",
      "type": "task",
      "parent": "AIFACTORY-US-324",
      "title": "Verify the exemplar contract, the reference rule and the navigation tests",
      "sequence": "18.30.02.05",
      "description": "BEFORE DEVELOPMENT. Verify the exemplar contract, the reference rule and the navigation tests. Expected output: Generate a solution, build and test it, plant a reference to the shell services package in the exemplar and plant a parameter that gates nothing; the solution holds the exemplar only, its tests pass, the planted reference fails the architecture test and the planted parameter fails the parameter-effect test, which proves AC1 to AC4 of AIFACTORY-US-324 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate.",
      "acceptanceCriteria": [
        "Generate a solution, build and test it, plant a reference to the shell services package in the exemplar and plant a parameter that gates nothing; the solution holds the exemplar only, its tests pass, the planted reference fails the architecture test and the planted parameter fails the parameter-effect test, which proves AC1 to AC4 of AIFACTORY-US-324 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1392]",
      "number": 1392
    },
    {
      "id": "AIFACTORY-US-325",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-168",
      "title": "Blazor microfrontend library template: a generated solution shortens its intermediate and output roots so that long nested paths build on Windows",
      "sequence": "18.30.03",
      "description": "As an asset maintainer, I want a solution generated from the template to build under a long repository path on Windows, so that a Studio repository with long project names does not fail on the path length limit. The F11 record of the template states that its build properties file is present but holds no redirect of the intermediate output path, unlike the administration microfrontend templates of the SaaS family, which shorten their intermediate and output roots for the Windows path limit; the record leaves the redirect as a follow-up to adopt when a build hits the limit. The repositories of the Factory carry long names, and a solution generated under such a name nests the project name several times inside its intermediate folders, so the Studio is the case the record anticipated. This PBI adopts the redirect. The build properties file of a generated solution sets short roots for the intermediate and the output folders of the source, test and sample projects, in the style the record points at, and the ignore file, the test settings and the pipeline of the generated solution follow the new roots. The redirect changes no assembly name and no package content. A generation under a root path near the limit, with a solution name of the length of a Factory repository name, restores, builds and tests on a Windows agent. The record marks the gap as closed and names the roots. Kind: enabling. Traces: adrs: ADR-0007. Sources: model/components.yaml, model/template-parameters/connectsoft-blazor-mfe.yaml, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given a solution generated under a deep root path with a name as long as a Factory repository name, when it is restored, built in Release and tested on a Windows agent, then no step fails on the path length limit (ADR-0007; model/components.yaml names the generated-solution gate of this template, which this case joins).",
        "AC2: Given a generated solution with the short roots, when its package content and assembly names are compared with those of a solution built without the redirect, then they are equal, and the ignore file and the pipeline of the generated solution name the new roots (ADR-0007, model/template-parameters/connectsoft-blazor-mfe.yaml gains no parameter by this PBI)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1393",
        "AIFACTORY-TASK-1394"
      ],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3203,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-325]",
      "number": 325
    },
    {
      "id": "AIFACTORY-TASK-1393",
      "type": "task",
      "parent": "AIFACTORY-US-325",
      "title": "Short intermediate and output roots in the build properties of a generated solution",
      "sequence": "18.30.03.01",
      "description": "BEFORE DEVELOPMENT. Short intermediate and output roots in the build properties of a generated solution. Expected output: The build properties file of a generated solution redirects the intermediate and the output folders of its source, test and sample projects to short roots; the ignore file, the test settings and the pipeline follow them; the F11 record names the roots and marks the gap as closed.. Kind: implementation. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The build properties file of a generated solution redirects the intermediate and the output folders of its source, test and sample projects to short roots; the ignore file, the test settings and the pipeline follow them; the F11 record names the roots and marks the gap as closed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1393]",
      "number": 1393
    },
    {
      "id": "AIFACTORY-TASK-1394",
      "type": "task",
      "parent": "AIFACTORY-US-325",
      "title": "Verify a deep-path generation on a Windows agent",
      "sequence": "18.30.03.02",
      "description": "BEFORE DEVELOPMENT. Verify a deep-path generation on a Windows agent. Expected output: Generate a solution with a long name under a deep root on a Windows agent, restore, build and test it, and compare its package content with a build without the redirect; no path error occurs and the content is equal, which proves AC1 and AC2 of AIFACTORY-US-325.. Kind: verification. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate.",
      "acceptanceCriteria": [
        "Generate a solution with a long name under a deep root on a Windows agent, restore, build and test it, and compare its package content with a build without the redirect; no path error occurs and the content is equal, which proves AC1 and AC2 of AIFACTORY-US-325."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1394]",
      "number": 1394
    },
    {
      "id": "AIFACTORY-US-326",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-168",
      "title": "Blazor microfrontend library template: the packed template is installed, generated across its documented parameters, built, tested and started before the package publishes",
      "sequence": "18.30.04",
      "description": "As an asset maintainer, I want every change of the microfrontend library template to be gated by the solutions it generates from the packed candidate, so that a package that would scaffold a solution that does not build or start never reaches the feed. This PBI is the gate of the feature. The planning page of the template keeps its epic-level acceptance unchecked: the template installs, generates a complete solution that builds, the generated solution runs with its shell and microfrontends, the UI kit works with all three adapters, every parameter is functional and the pipelines are tested. The installer pipeline file of the template only calls the shared installer job of ConnectSoft.AzurePipelines, whose steps pack, validate one instantiation and push in one sequence, and the scaffold test project of the repository covers one composed solution. A gate between pack and push and a refusal of a repeated version are changes of the shared steps: the gate hook and the version guard that AIFACTORY-TASK-1426 of the feature `component-base-template-findings` adds, the guard being opt-in. This template switches the hook on and defines its cases, which turn the acceptance list into cases of the pipeline. The candidate is packed once and installed. The scaffold tests instantiate it across the parameters that gate generated files: `uiKitAdapter` in its three values, `theme`, `density`, `enableRTL`, `includeTests` and `EnableHttps`, reduced to the pairs of values so that the run stays bounded while every pair is covered, and the deep-path case on a Windows agent. The two dead parameters AIFACTORY-US-324 removes are not part of the matrix, and its parameter-effect test is what proves the line that every parameter is functional. Each output is restored, built in Release and tested; its host is started and the home route and the route of the exemplar are probed; the output is scanned for template placeholders that were not replaced. A case that fails any stage fails the run with the parameter values and the stage named, and the push is not reached. Publication pushes the package to the ConnectSoft feed with a version that is not yet on the feed. The template gains no Factory profile, so no additional profile case is declared. The planning page marks its acceptance by the cases that prove it. This is an evidence PBI: a template feature has no scenario, so the gate names what it proves through `traces.adrs` and its sources. Kind: evidence. Traces: adrs: ADR-0007. Depends on: AIFACTORY-US-323, AIFACTORY-US-324, AIFACTORY-US-325, feature:component-blazor-shell-template-studio, feature:component-base-template-findings. Sources: model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-blazor-mfe.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the template, when its installer pipeline runs, then the candidate is packed once and installed, the gate hook of the shared installer steps runs the scaffold cases across the pairwise matrix of `uiKitAdapter`, `theme`, `density`, `enableRTL`, `includeTests` and `EnableHttps` and for the deep-path case, and each output is restored, built in Release, tested, started, probed on the home route and the exemplar route and scanned (ADR-0007; model/template-parameters/connectsoft-blazor-mfe.yaml lists the parameters of the matrix).",
        "AC2: Given a case fails any stage, when the pipeline evaluates the run, then the run fails with the parameter values and the stage named, no later stage of that case is reported as passed and the publication stage is not reached; a fixture with a planted failing case proves the refusal (ADR-0007, 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 refuses a repeated version with the reason, and the planning page of the template marks each line of its epic-level acceptance by the case that proves it, the line on functional parameters by the parameter-effect test of AIFACTORY-US-324 (ADR-0007, docs/architecture/catalogs/templates.md keeps the row of the template)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1395",
        "AIFACTORY-TASK-1396",
        "AIFACTORY-TASK-615"
      ],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3204,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-323",
        "AIFACTORY-US-324",
        "AIFACTORY-US-325",
        "feature:component-blazor-shell-template-studio",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-326]",
      "number": 326
    },
    {
      "id": "AIFACTORY-TASK-1395",
      "type": "task",
      "parent": "AIFACTORY-US-326",
      "title": "Parameter matrix of the scaffold tests passed to the gate hook of the shared installer steps",
      "sequence": "18.30.04.01",
      "description": "BEFORE DEVELOPMENT. Parameter matrix of the scaffold tests passed to the gate hook of the shared installer steps. Expected output: The scaffold test project defines the pairwise matrix of `uiKitAdapter`, `theme`, `density`, `enableRTL`, `includeTests` and `EnableHttps` and the deep-path case, each case restoring, building, testing, starting and probing its output; the installer pipeline file of the template switches on the gate hook of the shared installer steps, delivered by AIFACTORY-TASK-1426 of the feature component-base-template-findings, passes it these cases and sets no `allowPackageConflicts`; the planning page maps each acceptance line to its case.. Kind: operations. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: azure-pipelines-template.yml passes the cases to the gate hook of the shared installer job.",
      "acceptanceCriteria": [
        "The scaffold test project defines the pairwise matrix of `uiKitAdapter`, `theme`, `density`, `enableRTL`, `includeTests` and `EnableHttps` and the deep-path case, each case restoring, building, testing, starting and probing its output; the installer pipeline file of the template switches on the gate hook of the shared installer steps, delivered by AIFACTORY-TASK-1426 of the feature component-base-template-findings, passes it these cases and sets no `allowPackageConflicts`; the planning page maps each acceptance line to its case."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3204,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1395]",
      "number": 1395
    },
    {
      "id": "AIFACTORY-TASK-1396",
      "type": "task",
      "parent": "AIFACTORY-US-326",
      "title": "Planted failing case fixture for the gate",
      "sequence": "18.30.04.02",
      "description": "BEFORE DEVELOPMENT. Planted failing case fixture for the gate. Expected output: A pipeline fixture generates one case whose exemplar route is not registered and asserts that the run fails at the probe stage with the parameter values named and that the publication stage is not reached.. Kind: fixture. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: the planted run fails at the probe stage.",
      "acceptanceCriteria": [
        "A pipeline fixture generates one case whose exemplar route is not registered and asserts that the run fails at the probe stage with the parameter values named and that the publication stage is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3204,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1396]",
      "number": 1396
    },
    {
      "id": "AIFACTORY-TASK-615",
      "type": "task",
      "parent": "AIFACTORY-US-326",
      "title": "Generated-solution gate and MAX_PATH redirect",
      "sequence": "18.30.04.03",
      "description": "BEFORE DEVELOPMENT. Generated-solution gate and MAX_PATH redirect. Expected output: One green run and one planted run of the gate: the pipeline installs the packed template, generates the parameter combinations the template documents and the deep-path case, builds, tests and starts each generated solution and fails when any case fails; 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-326 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: azure-pipelines-template.yml runs the generated cases; the run is green.",
      "acceptanceCriteria": [
        "One green run and one planted run of the gate: the pipeline installs the packed template, generates the parameter combinations the template documents and the deep-path case, builds, tests and starts each generated solution and fails when any case fails; 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-326 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-615]",
      "number": 615
    },
    {
      "id": "AIFACTORY-US-126",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-168",
      "title": "Blazor microfrontend library template: AppShell chrome, a neutral exemplar and a generated-solution gate is delivered and proven on a generated solution",
      "sequence": "18.30.05",
      "description": "As an asset maintainer, I want Blazor Shell + MFEs + UIKit to carry AppShell chrome, a neutral exemplar and a generated-solution gate, so that it serves Factory Studio and generated product UIs without later rework. This is the integration PBI of the feature. An asset maintainer packs the microfrontend library template with the AppShell chrome on the `cs-*` tokens, the neutral exemplar, the short build roots and the aligned pins of the shell family, installs the package and instantiates it across its parameters in the installer pipeline. Every generated solution builds, passes its tests and starts 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 solution a Studio microfrontend is developed in. From the published package a solution is generated with the Tokens adapter under a long repository name. Its shell host renders the AppShell with the exemplar in the navigation, the exemplar follows the descriptor pair and references no shell services package, the chrome holds no raw colour utility, and the solution builds on a Windows agent. The feature is done when that solution is generated from a fresh install of the published package. Repository of the feature: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Kind: enabling. Traces: adrs: ADR-0007. Depends on: AIFACTORY-US-323, AIFACTORY-US-324, AIFACTORY-US-325, AIFACTORY-US-326. Sources: model/components.yaml, model/templates.yaml, model/template-parameters/connectsoft-blazor-mfe.yaml, docs/architecture/catalogs/templates.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.Blazor.MicrofrontendLibraryTemplate 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-0007, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-613 (sample chrome on the UIKit AppShell with cs-* tokens) is done, then the generated shell host of the library renders the UIKit AppShell regions bound to the shell abstractions, as the standalone shell template does, no raw `gray-*` or `dark:` utility remains in the core layout and its stylesheet, and theme, density and direction switch through the tokens (ADR-0007, model/template-parameters/connectsoft-blazor-mfe.yaml).",
        "AC3: Given the work of AIFACTORY-TASK-614 (neutral exemplar microfrontend with its descriptor and navigation contribution) is done, then the Identity teaching stubs are replaced by one neutral exemplar microfrontend whose descriptor, navigation contribution, descriptor pair and component tests show the contract a Studio microfrontend follows, and the exemplar carries no product domain (ADR-0007, model/templates.yaml).",
        "AC4: Given the work of AIFACTORY-TASK-615 (generated-solution gate and MAX_PATH redirect) is done, then the pipeline installs the packed template, generates the combinations of the parameters that gate generated files, builds and runs each generated solution and fails when any case fails, and a generated solution shortens its intermediate and output roots so that long nested paths build on Windows (ADR-0007, docs/architecture/catalogs/templates.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1397",
        "AIFACTORY-TASK-675"
      ],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3205,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-323",
        "AIFACTORY-US-324",
        "AIFACTORY-US-325",
        "AIFACTORY-US-326"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/template-parameters/connectsoft-blazor-mfe.yaml",
        "docs/architecture/catalogs/templates.md"
      ],
      "titlePrefix": "[AIFACTORY-US-126]",
      "number": 126
    },
    {
      "id": "AIFACTORY-TASK-1397",
      "type": "task",
      "parent": "AIFACTORY-US-126",
      "title": "Generate a solution from the published package under a long name and start it",
      "sequence": "18.30.05.01",
      "description": "BEFORE DEVELOPMENT. Generate a solution from the published package under a long name and start it. Expected output: A probe installs the published package, generates a solution with the Tokens adapter under a name of the length of a Factory repository name on a Windows agent, builds and tests it, starts the host and probes the home route and the exemplar route; the run proves AC2 to AC4 of AIFACTORY-US-126 on the published package (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet new install of the published version, dotnet new connectsoft-blazor-mfe, dotnet build -c Release, dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A probe installs the published package, generates a solution with the Tokens adapter under a name of the length of a Factory repository name on a Windows agent, builds and tests it, starts the host and probes the home route and the exemplar route; the run proves AC2 to AC4 of AIFACTORY-US-126 on the published package (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1397]",
      "number": 1397
    },
    {
      "id": "AIFACTORY-TASK-675",
      "type": "task",
      "parent": "AIFACTORY-US-126",
      "title": "Verify blazor-mfe-library-template-delivered by running the declared command",
      "sequence": "18.30.05.02",
      "description": "BEFORE DEVELOPMENT. Verify blazor-mfe-library-template-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-126.. Kind: verification. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on every generated case after the published package is installed; they pass and prove AC1 to AC4 of AIFACTORY-US-126."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/F11-microfrontend-library.md",
        "ConnectSoft.Blazor.MicrofrontendLibraryTemplate/docs/EPIC-PLANNING.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 32,
      "phase": "templates-and-libraries",
      "stackRank": 3205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-675]",
      "number": 675
    },
    {
      "id": "AIFACTORY-FEAT-169",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "UI kit: the token work and the Factory compositions the alignment gate ranks first",
      "sequence": "18.31",
      "description": "The UI kit's own alignment gate (F01) against the design prototypes lists what the Studio screens need and the kit does not have: density that does not reach the cs-* spacing and type tokens, no named elevation scale, no motion tokens; the P0 primitives JsonViewer, DiffViewer and LogStream; and the P0 Factory compositions FactoryRunCard, AgentExecutionGraph, QualityGatePanel, TraceViewerPanel, ArtifactExplorer, ArtifactDiffPanel, ArtifactLineageGraph and HumanReviewQueue. The state-family, run-timeline and approval components are FEAT-101; this feature closes the rest of the P0 list and the adapter conformance of every new component across the Tokens, Flowbite and DaisyUI adapters. Component: Blazor Shell + MFEs + UIKit (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I3: Studio. Build order 33 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-327",
        "AIFACTORY-US-328",
        "AIFACTORY-US-329",
        "AIFACTORY-US-330",
        "AIFACTORY-US-127"
      ],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3300,
      "titlePrefix": "[AIFACTORY-FEAT-169]",
      "number": 169
    },
    {
      "id": "AIFACTORY-US-327",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-169",
      "title": "UI kit: the density bridge, the elevation scale and the motion tokens hold in the light, dark and accessibility variants and are locked by a test",
      "sequence": "18.31.01",
      "description": "As an asset maintainer, I want the three token gaps of the alignment gate to be closed in every variant of the token spine and kept closed by a test, so that a Studio screen changes density, depth and motion through tokens in every theme. The alignment gate of the UI kit (the F01 page of its documentation) lists three token gaps as its first work: the density attribute reassigns only the older spacing, font size and radius variables and not the `cs-*` spacing, type and radius tokens; there is one `cs-*` shadow and no named elevation scale; and there are no `cs-*` motion tokens for fast, base and slow. The coverage page of the kit (its F02 page) records the three as closed, with the elevation and motion tokens in the `cs-*` token file and the Tailwind preset and the density bridge in the density token file. The ledger does not say whether the new tokens hold in the dark register and in the accessibility variants, and no test keeps them. This PBI confirms what the ledger records and completes what the confirmation finds missing. A token test reads the token files and asserts that the elevation scale from extra small to extra large and the three motion tokens are defined in the light register, in the dark register and in the accessibility variants, that each density value reassigns the `cs-*` spacing, type and radius tokens, and that no component stylesheet of the kit uses a raw shadow or a raw duration where a token exists. The motion tokens resolve to no motion under the reduced-motion preference. The token page of the documentation and a gallery route show the three families in every variant. A family the test finds missing in a variant is added in that variant, and the coverage page is corrected to what the test proves. Kind: enabling. Traces: adrs: ADR-0007; requirements: FUX-12. Relates: nfrs: NFR-15. Sources: model/components.yaml, model/templates.yaml, model/traceability/nfr.yaml, model/traceability/fux.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given the token files of the kit, when the token test runs, then the named elevation scale and the fast, base and slow motion tokens are defined in the light register, the dark register and the accessibility variants, and removing one of them from one variant fails the test with the token and the variant named (ADR-0007: the modules of the Studio share one design system; model/components.yaml names the token work as a need of this component).",
        "AC2: Given an element with each value of the density attribute, when its computed style is read in a component test, then the `cs-*` spacing, type and radius tokens differ between the values as the density token file defines, and under the reduced-motion preference the motion tokens resolve to no motion (ADR-0007: the modules share one design system, so density is a token concern of the kit; NFR-15 sets the accessibility level the motion behaviour is tested against; FUX-12).",
        "AC3: Given the documentation and the gallery of the kit, when the token page and the token gallery route are opened, then they show the elevation, motion and density families in the light, dark and accessibility variants, and the coverage page of the kit states for each family the test that proves it (ADR-0007, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/traceability/nfr.yaml",
        "model/traceability/fux.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-616",
        "AIFACTORY-TASK-1398",
        "AIFACTORY-TASK-1399",
        "AIFACTORY-TASK-1400"
      ],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3301,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-12"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/traceability/nfr.yaml",
        "model/traceability/fux.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-327]",
      "number": 327
    },
    {
      "id": "AIFACTORY-TASK-616",
      "type": "task",
      "parent": "AIFACTORY-US-327",
      "title": "Density bridge, elevation scale and motion tokens",
      "sequence": "18.31.01.01",
      "description": "BEFORE DEVELOPMENT. Density bridge, elevation scale and motion tokens. Expected output: The density attribute reassigns the `cs-*` spacing, type and radius tokens; a named `cs-*` elevation scale and the fast, base and slow motion tokens exist in the token spine and in the dark and accessibility variants, a variant the token test finds incomplete is completed, and the motion tokens resolve to no motion under the reduced-motion preference.. Kind: implementation. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The density attribute reassigns the `cs-*` spacing, type and radius tokens; a named `cs-*` elevation scale and the fast, base and slow motion tokens exist in the token spine and in the dark and accessibility variants, a variant the token test finds incomplete is completed, and the motion tokens resolve to no motion under the reduced-motion preference."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-616]",
      "number": 616
    },
    {
      "id": "AIFACTORY-TASK-1398",
      "type": "task",
      "parent": "AIFACTORY-US-327",
      "title": "Token test over the spine, the dark register and the accessibility variants",
      "sequence": "18.31.01.02",
      "description": "BEFORE DEVELOPMENT. Token test over the spine, the dark register and the accessibility variants. Expected output: The unit test project of the kit holds a token test that parses the token files and asserts the elevation scale, the motion tokens and the density reassignment in every variant, and a scan that fails when a component stylesheet uses a raw shadow or duration where a token exists.. Kind: fixture. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project of the kit holds a token test that parses the token files and asserts the elevation scale, the motion tokens and the density reassignment in every variant, and a scan that fails when a component stylesheet uses a raw shadow or duration where a token exists."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3301,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1398]",
      "number": 1398
    },
    {
      "id": "AIFACTORY-TASK-1399",
      "type": "task",
      "parent": "AIFACTORY-US-327",
      "title": "Token page, token gallery route and coverage page state the three families",
      "sequence": "18.31.01.03",
      "description": "BEFORE DEVELOPMENT. Token page, token gallery route and coverage page state the three families. Expected output: The token page of the documentation and a gallery route show the elevation, motion and density families in the light, dark and accessibility variants, and the coverage page names the token test as the evidence of each family.. Kind: documentation. Repository: ConnectSoft.Blazor.UIKit. Verification: the documentation pipeline of the kit builds its site without warnings.",
      "acceptanceCriteria": [
        "The token page of the documentation and a gallery route show the elevation, motion and density families in the light, dark and accessibility variants, and the coverage page names the token test as the evidence of each family."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3301,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1399]",
      "number": 1399
    },
    {
      "id": "AIFACTORY-TASK-1400",
      "type": "task",
      "parent": "AIFACTORY-US-327",
      "title": "Verify the token families in every variant",
      "sequence": "18.31.01.04",
      "description": "BEFORE DEVELOPMENT. Verify the token families in every variant. Expected output: Run the token test and the density component tests, then remove a motion token from the dark register and rerun; the first run passes and the second fails with the token and the variant named, which proves AC1 to AC3 of AIFACTORY-US-327 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.UIKit.",
      "acceptanceCriteria": [
        "Run the token test and the density component tests, then remove a motion token from the dark register and rerun; the first run passes and the second fails with the token and the variant named, which proves AC1 to AC3 of AIFACTORY-US-327 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1400]",
      "number": 1400
    },
    {
      "id": "AIFACTORY-US-328",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-169",
      "title": "UI kit: JsonViewer, DiffViewer and LogStream carry their accessibility contracts, the behaviours the Studio needs and render under the Tokens, Flowbite and DaisyUI adapters",
      "sequence": "18.31.02",
      "description": "As an asset maintainer, I want the three operational primitives to be complete for the artifact, diff and log views of the Studio, so that no Studio microfrontend builds its own viewer for a document, a diff or a stream. The alignment gate of the kit ranks four new primitives first, and three of them are what the artifact, change and log views of the Studio are made of: JsonViewer, DiffViewer and LogStream. The coverage page records the three as closed with a gallery route for operational data and component tests named after each primitive. The ledger does not record an accessibility contract for them, does not say which behaviours they have, and does not show them under the three adapter packages of the kit. This PBI confirms what exists and completes each primitive to what the Studio needs. JsonViewer renders a document as a collapsible tree that is operated by keyboard, keeps large documents responsive by rendering only what is expanded, and never evaluates content. DiffViewer renders a unified and a side-by-side diff of two texts, announces additions and removals as text and not by colour alone, and lets a reader move between changes by keyboard. LogStream follows an appended stream, pauses and resumes following, searches within the received lines and announces new lines politely so that a screen reader is not flooded. Each primitive has a page in the documentation with its parameters and its accessibility contract, renders in right-to-left direction, and is rendered by a test under the Tokens, the Flowbite and the DaisyUI adapter. The adapter conformance suite of the kit, which covers the dialog, toast and validation adapters, keeps passing for the three adapters. The primitives take their data through parameters and make no HTTP call. Kind: enabling. Traces: adrs: ADR-0007; requirements: FUX-12. Relates: nfrs: NFR-15. Depends on: AIFACTORY-US-327. Sources: model/components.yaml, model/ux/screens.yaml, docs/architecture/ecosystem-composition.md, model/traceability/nfr.yaml, model/traceability/fux.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the three primitives, when their component and accessibility tests run, then JsonViewer expands and collapses by keyboard, DiffViewer renders a unified and a side-by-side diff with additions and removals given as text, and LogStream follows a stream, pauses, resumes and searches, each with the roles and labels of its documented accessibility contract (NFR-15: WCAG 2.2 AA and keyboard operation; FUX-12: accessible journeys; model/ux/screens.yaml lists the screens `artifacts` and `run-detail` with the read models these views show).",
        "AC2: Given each primitive, when the render matrix test runs, then it renders without error and with the same accessible structure under the Tokens, the Flowbite and the DaisyUI adapter and in right-to-left direction, and the adapter conformance suite of the kit passes for the three adapters (ADR-0007: one design system for every module; NFR-15 for the right-to-left direction; model/components.yaml names the primitives as a need of this component).",
        "AC3: Given the documentation and the gallery of the kit, when the pages of the three primitives are opened, then each states its parameters, its behaviours and its accessibility contract and has a gallery route, and the kit library holds no reference to a shell or microfrontend project and no HTTP client (ADR-0007, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/ecosystem-composition.md",
        "model/traceability/nfr.yaml",
        "model/traceability/fux.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-617",
        "AIFACTORY-TASK-1401",
        "AIFACTORY-TASK-1402"
      ],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3302,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-12"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-327"
      ],
      "source": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/ecosystem-composition.md",
        "model/traceability/nfr.yaml",
        "model/traceability/fux.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-328]",
      "number": 328
    },
    {
      "id": "AIFACTORY-TASK-617",
      "type": "task",
      "parent": "AIFACTORY-US-328",
      "title": "P0 primitives JsonViewer, DiffViewer and LogStream",
      "sequence": "18.31.02.01",
      "description": "BEFORE DEVELOPMENT. P0 primitives JsonViewer, DiffViewer and LogStream. Expected output: The three primitives exist with their accessibility contracts, documentation pages, gallery routes and component tests; DiffViewer renders a unified and a side-by-side diff with changes given as text; LogStream follows a stream with pause, resume and search and polite announcements; JsonViewer is a keyboard-operated collapsible tree; each renders under the three adapters and in right-to-left direction and takes its data through parameters.. Kind: implementation. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The three primitives exist with their accessibility contracts, documentation pages, gallery routes and component tests; DiffViewer renders a unified and a side-by-side diff with changes given as text; LogStream follows a stream with pause, resume and search and polite announcements; JsonViewer is a keyboard-operated collapsible tree; each renders under the three adapters and in right-to-left direction and takes its data through parameters."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-617]",
      "number": 617
    },
    {
      "id": "AIFACTORY-TASK-1401",
      "type": "task",
      "parent": "AIFACTORY-US-328",
      "title": "Render matrix and accessibility tests of the three primitives",
      "sequence": "18.31.02.02",
      "description": "BEFORE DEVELOPMENT. Render matrix and accessibility tests of the three primitives. Expected output: The unit test project holds a render matrix that renders each primitive under the Tokens, Flowbite and DaisyUI adapters and in both directions and compares the accessible structure, and accessibility tests for the keyboard paths, the text form of changes and the announcement of new log lines.. Kind: fixture. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project holds a render matrix that renders each primitive under the Tokens, Flowbite and DaisyUI adapters and in both directions and compares the accessible structure, and accessibility tests for the keyboard paths, the text form of changes and the announcement of new log lines."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3302,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1401]",
      "number": 1401
    },
    {
      "id": "AIFACTORY-TASK-1402",
      "type": "task",
      "parent": "AIFACTORY-US-328",
      "title": "Verify the behaviours, the accessibility contracts and the three adapters",
      "sequence": "18.31.02.03",
      "description": "BEFORE DEVELOPMENT. Verify the behaviours, the accessibility contracts and the three adapters. Expected output: Run the tests of AIFACTORY-TASK-1401 and the adapter conformance suite; every primitive passes under the three adapters and in both directions, which proves AC1 to AC3 of AIFACTORY-US-328 (ADR-0007, NFR-15).. Kind: verification. Repository: ConnectSoft.Blazor.UIKit.",
      "acceptanceCriteria": [
        "Run the tests of AIFACTORY-TASK-1401 and the adapter conformance suite; every primitive passes under the three adapters and in both directions, which proves AC1 to AC3 of AIFACTORY-US-328 (ADR-0007, NFR-15)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1402]",
      "number": 1402
    },
    {
      "id": "AIFACTORY-US-329",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-169",
      "title": "UI kit: the eight Factory compositions take the shapes and state families of the UX model through parameters and render under the three adapters",
      "sequence": "18.31.03",
      "description": "As an asset maintainer, I want the Factory compositions of the kit to accept what the Studio screens receive from their read models, so that a Studio microfrontend binds a screen model to a composition without an adapter layer of its own. The alignment gate of the kit names eight Factory compositions as its first new compositions: FactoryRunCard, AgentExecutionGraph, QualityGatePanel, TraceViewerPanel, ArtifactExplorer, ArtifactDiffPanel, ArtifactLineageGraph and HumanReviewQueue. The coverage page records all eight as closed with one gallery route for the Factory compositions and one shared component test class. They were built against the design prototypes; the screens of the Studio are defined by the UX model of this repository, where every screen names its read models and its state families, and the state families fix the values a run, an approval, an asset, a delivery or a source can show. This PBI binds the compositions to that model. Each composition takes its data through typed parameters whose state values are the values of the matching family of model/ux/states.yaml, so a run shows the run family, a review item the approval family and every panel the freshness family of its source; a state is always given as text beside its colour. A composition makes no HTTP call and holds no subscription; the microfrontend passes it the screen model it received. A mapping table on the coverage page names, for each composition, the screens of model/ux/screens.yaml that use it. Each composition has a documentation page with its parameters and its accessibility contract, its own component tests in place of the single shared class, loading, empty and error states, and a render under the Tokens, Flowbite and DaisyUI adapters and in right-to-left direction. The state-family, run-timeline and approval components belong to the Studio shell feature of this epic and are not part of this PBI. Kind: enabling. Traces: adrs: ADR-0007; requirements: FUX-12. Relates: nfrs: NFR-15. Depends on: AIFACTORY-US-327, AIFACTORY-US-328. Sources: model/components.yaml, model/ux/screens.yaml, model/ux/states.yaml, model/ux/prototype-alignment.yaml, model/traceability/nfr.yaml, model/traceability/fux.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the eight compositions, when their parameter models are compared with model/ux/states.yaml, then every state parameter accepts exactly the values of its family, an unknown value is rendered as unknown and never as a success, and every state is given as text beside its colour (model/ux/states.yaml defines the families and their values; NFR-15 for a state that is not given by colour alone; model/ux/screens.yaml names the read models and the state families of each screen).",
        "AC2: Given each composition, when its component tests and the render matrix run, then it renders its loaded, loading, empty and error states under the Tokens, the Flowbite and the DaisyUI adapter and in right-to-left direction, and a test fails when a composition references an HTTP client or a shell or microfrontend project (ADR-0007, NFR-15 for the right-to-left direction, model/components.yaml names the Factory compositions as a need of this component).",
        "AC3: Given the coverage page and the documentation of the kit, when they are read, then a table maps each of the eight compositions to the screens of model/ux/screens.yaml that use it, and each composition has a page with its parameters and its accessibility contract and a gallery route (FUX-12: documented views, states and permissions; model/ux/screens.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "model/traceability/nfr.yaml",
        "model/traceability/fux.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1403",
        "AIFACTORY-TASK-618",
        "AIFACTORY-TASK-1404",
        "AIFACTORY-TASK-1405"
      ],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3303,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007"
        ],
        "requirements": [
          "FUX-12"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-327",
        "AIFACTORY-US-328"
      ],
      "source": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "model/ux/prototype-alignment.yaml",
        "model/traceability/nfr.yaml",
        "model/traceability/fux.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-329]",
      "number": 329
    },
    {
      "id": "AIFACTORY-TASK-1403",
      "type": "task",
      "parent": "AIFACTORY-US-329",
      "title": "Parameter models of the eight compositions in the vocabulary of the UX model",
      "sequence": "18.31.03.01",
      "description": "BEFORE DEVELOPMENT. Parameter models of the eight compositions in the vocabulary of the UX model. Expected output: Each of the eight compositions has a typed parameter model whose state values are the values of its family in model/ux/states.yaml, with an explicit unknown value; the coverage page of the kit holds the table that maps each composition to the screens of model/ux/screens.yaml that use it.. Kind: contract. Repository: ConnectSoft.Blazor.UIKit. Verification: a test compares the state enumerations of the kit with a snapshot of the families.",
      "acceptanceCriteria": [
        "Each of the eight compositions has a typed parameter model whose state values are the values of its family in model/ux/states.yaml, with an explicit unknown value; the coverage page of the kit holds the table that maps each composition to the screens of model/ux/screens.yaml that use it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3303,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1403]",
      "number": 1403
    },
    {
      "id": "AIFACTORY-TASK-618",
      "type": "task",
      "parent": "AIFACTORY-US-329",
      "title": "P0 Factory compositions",
      "sequence": "18.31.03.02",
      "description": "BEFORE DEVELOPMENT. P0 Factory compositions. Expected output: FactoryRunCard, AgentExecutionGraph, QualityGatePanel, TraceViewerPanel, ArtifactExplorer, ArtifactDiffPanel, ArtifactLineageGraph and HumanReviewQueue exist as compositions over the kit primitives, bound to the parameter models of AIFACTORY-TASK-1403, with loading, empty and error states, state given as text, documentation pages, gallery routes and no HTTP call.. Kind: implementation. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "FactoryRunCard, AgentExecutionGraph, QualityGatePanel, TraceViewerPanel, ArtifactExplorer, ArtifactDiffPanel, ArtifactLineageGraph and HumanReviewQueue exist as compositions over the kit primitives, bound to the parameter models of AIFACTORY-TASK-1403, with loading, empty and error states, state given as text, documentation pages, gallery routes and no HTTP call."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-618]",
      "number": 618
    },
    {
      "id": "AIFACTORY-TASK-1404",
      "type": "task",
      "parent": "AIFACTORY-US-329",
      "title": "Component tests per composition and the three-adapter render matrix",
      "sequence": "18.31.03.03",
      "description": "BEFORE DEVELOPMENT. Component tests per composition and the three-adapter render matrix. Expected output: The single shared composition test class is split into one test class per composition that covers the loaded, loading, empty and error states and the text form of every state; the render matrix renders each composition under the three adapters and in both directions; an architecture test forbids an HTTP client and a shell or microfrontend reference in the kit.. Kind: fixture. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The single shared composition test class is split into one test class per composition that covers the loaded, loading, empty and error states and the text form of every state; the render matrix renders each composition under the three adapters and in both directions; an architecture test forbids an HTTP client and a shell or microfrontend reference in the kit."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3303,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1404]",
      "number": 1404
    },
    {
      "id": "AIFACTORY-TASK-1405",
      "type": "task",
      "parent": "AIFACTORY-US-329",
      "title": "Verify the state vocabulary, the states and the adapters of the compositions",
      "sequence": "18.31.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the state vocabulary, the states and the adapters of the compositions. Expected output: Run the tests of AIFACTORY-TASK-1404 and the snapshot comparison with model/ux/states.yaml; every composition passes under the three adapters and the state enumerations equal the families, which proves AC1 to AC3 of AIFACTORY-US-329 (FUX-12, model/ux/states.yaml).. Kind: verification. Repository: ConnectSoft.Blazor.UIKit.",
      "acceptanceCriteria": [
        "Run the tests of AIFACTORY-TASK-1404 and the snapshot comparison with model/ux/states.yaml; every composition passes under the three adapters and the state enumerations equal the families, which proves AC1 to AC3 of AIFACTORY-US-329 (FUX-12, model/ux/states.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1405]",
      "number": 1405
    },
    {
      "id": "AIFACTORY-US-330",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-169",
      "title": "UI kit: the components package is built, tested and published to the ConnectSoft feed, proven with the adapter packages on the feed and pinned by the two templates of the shell family",
      "sequence": "18.31.04",
      "description": "As an asset maintainer, I want proof that the kit with the token work, the primitives and the Factory compositions is on the feed under one version, so that the shell template, the microfrontend library template and the Studio pin the same published kit. This PBI is the publication proof of the feature. The kit is a library that the shell template, the microfrontend library template, the sample templates and the Studio consume by a version pin, and the integration checklist of the microfrontend library template records that the templates pin different versions of it. The pipeline of the kit restores, checks deprecated and vulnerable packages, builds, tests with a coverage threshold, packs, verifies that the package ships its web assets as static web assets only, and pushes to the feed. It packs the components package only: the Tokens, Flowbite and DaisyUI adapters ship from their own repositories, which are not repositories of this component, so this PBI publishes no adapter package and changes none. The proof adds what a consumer needs. The publication step runs only after the token test, the render matrix, the accessibility tests and the adapter conformance suite pass, pushes the components package `ConnectSoft.Blazor.UIKit` and refuses a version that is already on the feed. A probe proves the package from the side of a consumer: a clean Blazor host with the ConnectSoft feed as its only source restores the published kit version together with the version of each adapter package that is already on the feed, each adapter in turn, and renders a page with the three primitives and the eight compositions in the light and the dark theme and in right-to-left direction. The published version, what it carries and the adapter versions it was proven with are recorded on the release notes page of the kit. The last leg is the pin. The central package file of the shell template pins the published version and the template republishes through its gate; then the microfrontend library template pins the same version. The order matters because the pin check of the shell family (AIFACTORY-TASK-1382) has one reference, the pins of the latest published shell template package; the release notes page tells a maintainer which version to move to and is not a reference of the check. A new primitive or composition that needs a change inside an adapter cannot be delivered here, because the three adapter repositories would have to join the component first; that case is raised to the owner. This is an evidence PBI: a library feature has no scenario, so the proof names what it shows through `traces.adrs` and its sources. Kind: evidence. Traces: adrs: ADR-0007. Depends on: AIFACTORY-US-327, AIFACTORY-US-328, AIFACTORY-US-329, feature:component-blazor-shell-template-studio. Sources: model/components.yaml, model/templates.yaml, model/backlog/epics.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the pipeline of the kit after the work of this feature, when it runs, then the components package `ConnectSoft.Blazor.UIKit` is built, tested, packed and pushed to the ConnectSoft feed only after the token test, the render matrix, the accessibility tests and the adapter conformance suite pass, the pipeline packs and pushes no adapter package, and a version that is already on the feed is refused with the reason (ADR-0007, model/backlog/epics.yaml states publication before consumption as the completion of the epic).",
        "AC2: Given a clean probe host with the ConnectSoft feed as its only package source, when it restores the published kit version with the Tokens, the Flowbite and the DaisyUI adapter package versions already on the feed, each in turn, then a page with the three primitives and the eight compositions renders in the light and the dark theme and in right-to-left direction with no missing static web asset (ADR-0007: one design system shared by every module; model/templates.yaml lists the templates that pin the kit).",
        "AC3: Given the release notes page of the kit, when a maintainer of a consuming template reads it, then it names the published version, the token families, the primitives and the compositions the version carries and the adapter package versions it was proven with; and the central package files of the shell template and of the microfrontend library template pin that version, both solutions build and pass their tests, and the pin check of both pipelines is green against the republished shell template package (ADR-0007, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1406",
        "AIFACTORY-TASK-1407",
        "AIFACTORY-TASK-1408",
        "AIFACTORY-TASK-1428",
        "AIFACTORY-TASK-1429",
        "AIFACTORY-TASK-1409"
      ],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3304,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0007"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-327",
        "AIFACTORY-US-328",
        "AIFACTORY-US-329",
        "feature:component-blazor-shell-template-studio"
      ],
      "source": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/backlog/epics.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-330]",
      "number": 330
    },
    {
      "id": "AIFACTORY-TASK-1406",
      "type": "task",
      "parent": "AIFACTORY-US-330",
      "title": "Publication step of the components package after the new suites, with a version guard",
      "sequence": "18.31.04.01",
      "description": "BEFORE DEVELOPMENT. Publication step of the components package after the new suites, with a version guard. Expected output: The pipeline of the kit runs the token test, the render matrix, the accessibility tests and the adapter conformance suite before it packs, pushes the components package `ConnectSoft.Blazor.UIKit` only to the ConnectSoft feed, and refuses a version that is already on the feed with the reason; it packs and pushes no adapter package.. Kind: operations. Repository: ConnectSoft.Blazor.UIKit. Verification: azure-pipelines.yml publishes after the suites; a repeated version is refused.",
      "acceptanceCriteria": [
        "The pipeline of the kit runs the token test, the render matrix, the accessibility tests and the adapter conformance suite before it packs, pushes the components package `ConnectSoft.Blazor.UIKit` only to the ConnectSoft feed, and refuses a version that is already on the feed with the reason; it packs and pushes no adapter package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3304,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1406]",
      "number": 1406
    },
    {
      "id": "AIFACTORY-TASK-1407",
      "type": "task",
      "parent": "AIFACTORY-US-330",
      "title": "Feed probe host for the published kit with the adapter packages on the feed",
      "sequence": "18.31.04.02",
      "description": "BEFORE DEVELOPMENT. Feed probe host for the published kit with the adapter packages on the feed. Expected output: A probe host with the ConnectSoft feed as its only source restores the published kit version together with the adapter package versions already on the feed, each adapter in turn, and renders a page with the three primitives and the eight compositions in both themes and both directions; the probe runs as the last stage of the pipeline, fails on a missing static web asset and writes the adapter versions it used to its log.. Kind: fixture. Repository: ConnectSoft.Blazor.UIKit. Verification: the probe stage of the pipeline is green for the three adapters.",
      "acceptanceCriteria": [
        "A probe host with the ConnectSoft feed as its only source restores the published kit version together with the adapter package versions already on the feed, each adapter in turn, and renders a page with the three primitives and the eight compositions in both themes and both directions; the probe runs as the last stage of the pipeline, fails on a missing static web asset and writes the adapter versions it used to its log."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3304,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1407]",
      "number": 1407
    },
    {
      "id": "AIFACTORY-TASK-1408",
      "type": "task",
      "parent": "AIFACTORY-US-330",
      "title": "Release notes page records the published version and what it carries",
      "sequence": "18.31.04.03",
      "description": "BEFORE DEVELOPMENT. Release notes page records the published version and what it carries. Expected output: The release notes page of the kit names the published version, the token families, the three primitives, the eight compositions and the adapter package versions the probe proved the kit with, and the coverage page points at it.. Kind: documentation. Repository: ConnectSoft.Blazor.UIKit. Verification: the documentation pipeline of the kit builds its site without warnings.",
      "acceptanceCriteria": [
        "The release notes page of the kit names the published version, the token families, the three primitives, the eight compositions and the adapter package versions the probe proved the kit with, and the coverage page points at it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3304,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1408]",
      "number": 1408
    },
    {
      "id": "AIFACTORY-TASK-1428",
      "type": "task",
      "parent": "AIFACTORY-US-330",
      "title": "Shell template pins the published UI kit version",
      "sequence": "18.31.04.04",
      "description": "BEFORE DEVELOPMENT. Shell template pins the published UI kit version. Expected output: The central package file of the shell template pins the UI kit version published by AIFACTORY-TASK-1406, the solution builds and its tests pass, and the template republishes through its generated-solution gate, so that the latest published shell template package, the reference of the pin check of AIFACTORY-TASK-1382, carries the new pin.. Kind: implementation. Repository: ConnectSoft.Blazor.ShellTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The central package file of the shell template pins the UI kit version published by AIFACTORY-TASK-1406, the solution builds and its tests pass, and the template republishes through its generated-solution gate, so that the latest published shell template package, the reference of the pin check of AIFACTORY-TASK-1382, carries the new pin."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.ShellTemplate"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1428]",
      "number": 1428
    },
    {
      "id": "AIFACTORY-TASK-1429",
      "type": "task",
      "parent": "AIFACTORY-US-330",
      "title": "Microfrontend library template pins the published UI kit version",
      "sequence": "18.31.04.05",
      "description": "BEFORE DEVELOPMENT. Microfrontend library template pins the published UI kit version. Expected output: The central package file of the microfrontend library template pins the same UI kit version as the republished shell template, the pin test `IntegrationContractTests` asserts it, the solution builds and its tests pass, and the pin check of its pipeline is green.. Kind: implementation. Repository: ConnectSoft.Blazor.MicrofrontendLibraryTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The central package file of the microfrontend library template pins the same UI kit version as the republished shell template, the pin test `IntegrationContractTests` asserts it, the solution builds and its tests pass, and the pin check of its pipeline is green."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.MicrofrontendLibraryTemplate"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1429]",
      "number": 1429
    },
    {
      "id": "AIFACTORY-TASK-1409",
      "type": "task",
      "parent": "AIFACTORY-US-330",
      "title": "Verify the published package by the probe host and the two pinned templates",
      "sequence": "18.31.04.06",
      "description": "BEFORE DEVELOPMENT. Verify the published package by the probe host and the two pinned templates. Expected output: One pipeline run publishes the components package and the probe host renders the page with each adapter package version on the feed; a rerun with the same version is refused; the shell template and the microfrontend library template build and test green on the pinned version with a green pin check; the runs prove AC1 to AC3 of AIFACTORY-US-330 (ADR-0007).. Kind: verification. Repository: ConnectSoft.Blazor.UIKit.",
      "acceptanceCriteria": [
        "One pipeline run publishes the components package and the probe host renders the page with each adapter package version on the feed; a rerun with the same version is refused; the shell template and the microfrontend library template build and test green on the pinned version with a green pin check; the runs prove AC1 to AC3 of AIFACTORY-US-330 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1409]",
      "number": 1409
    },
    {
      "id": "AIFACTORY-US-127",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-169",
      "title": "UI kit: the token work and the Factory compositions the alignment gate ranks first is delivered and proven on a generated solution",
      "sequence": "18.31.05",
      "description": "As an asset maintainer, I want Blazor Shell + MFEs + UIKit to carry the token work and the Factory compositions the alignment gate ranks first, so that it serves Factory Studio and generated product UIs without later rework. This is the integration PBI of the feature. An asset maintainer builds the UI kit with the token families locked in every variant, the three operational primitives with their contracts and the eight Factory compositions on the vocabulary of the UX model, runs its suites and publishes the components package. The adapter packages ship from their own repositories and are not published here; the probe proves the kit with the adapter versions on the feed. A failing token, accessibility, render or conformance test blocks the publication. The implementation lives in the earlier PBIs of this file; this PBI proves them together from the side of the first consumer. The kit is also shipped as a template for component libraries; this feature changes the library and its package, and the template of the kit is not in its scope. From the published version a host in the shape of a Studio microfrontend renders a run card with the run family, a review queue with the approval family and an artifact diff, under the Tokens adapter, in the dark theme, at compact density and in right-to-left direction, with every state given as text. The feature is done when that host restores the published version from the ConnectSoft feed and renders the page, and the shell template and the microfrontend library template pin that version. Repository of the feature: ConnectSoft.Blazor.UIKit; one task each moves the pin in the two templates. Kind: enabling. Traces: adrs: ADR-0007, ADR-0026; requirements: FUX-12. Relates: nfrs: NFR-15. Depends on: AIFACTORY-US-327, AIFACTORY-US-328, AIFACTORY-US-329, AIFACTORY-US-330. Sources: model/components.yaml, model/ux/screens.yaml, model/ux/states.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given the repository ConnectSoft.Blazor.UIKit with the work of this feature, when its pipeline runs, then the components package builds, its tests pass and it publishes to the ConnectSoft feed under one verified version, the probe proves it with the adapter package versions on the feed, and the shell template and the microfrontend library template pin that version (ADR-0007, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-616 (density bridge, elevation scale and motion tokens) is done, then the density attribute reassigns the `cs-*` spacing, type and radius tokens, a named elevation scale and the fast, base and slow motion tokens exist in the token spine and in the dark and accessibility variants, and the token documentation and the gallery show them (ADR-0007, docs/architecture/ecosystem-composition.md).",
        "AC3: Given the work of AIFACTORY-TASK-617 (P0 primitives JsonViewer, DiffViewer and LogStream) is done, then the three primitives exist with their accessibility contracts, gallery routes and component tests, DiffViewer renders a unified and a side-by-side diff, LogStream follows a stream with pause and search, and each renders under the three adapters (NFR-15, model/ux/screens.yaml).",
        "AC4: Given the work of AIFACTORY-TASK-618 (P0 Factory compositions) is done, then FactoryRunCard, AgentExecutionGraph, QualityGatePanel, TraceViewerPanel, ArtifactExplorer, ArtifactDiffPanel, ArtifactLineageGraph and HumanReviewQueue exist as compositions over the kit primitives, bound to the state families of model/ux/states.yaml, with gallery routes, component tests and a render under the Tokens, Flowbite and DaisyUI adapters (FUX-12, NFR-15)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1410",
        "AIFACTORY-TASK-693"
      ],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3305,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007",
          "ADR-0026"
        ],
        "requirements": [
          "FUX-12"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-327",
        "AIFACTORY-US-328",
        "AIFACTORY-US-329",
        "AIFACTORY-US-330"
      ],
      "source": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-127]",
      "number": 127
    },
    {
      "id": "AIFACTORY-TASK-1410",
      "type": "task",
      "parent": "AIFACTORY-US-127",
      "title": "Render a Studio-shaped page from the published kit",
      "sequence": "18.31.05.01",
      "description": "BEFORE DEVELOPMENT. Render a Studio-shaped page from the published kit. Expected output: A probe host in the shape of a Studio microfrontend restores the published version from the ConnectSoft feed and renders a run card, a review queue and an artifact diff under the Tokens adapter, in the dark theme, at compact density and in right-to-left direction with every state given as text; the run proves AC2 to AC4 of AIFACTORY-US-127 on the published package (ADR-0007, NFR-15).. Kind: verification. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A probe host in the shape of a Studio microfrontend restores the published version from the ConnectSoft feed and renders a run card, a review queue and an artifact diff under the Tokens adapter, in the dark theme, at compact density and in right-to-left direction with every state given as text; the run proves AC2 to AC4 of AIFACTORY-US-127 on the published package (ADR-0007, NFR-15)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1410]",
      "number": 1410
    },
    {
      "id": "AIFACTORY-TASK-693",
      "type": "task",
      "parent": "AIFACTORY-US-127",
      "title": "Verify uikit-factory-compositions-delivered by running the declared command",
      "sequence": "18.31.05.02",
      "description": "BEFORE DEVELOPMENT. Verify uikit-factory-compositions-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of the kit and on the probe host after the published version is restored; they pass and prove AC1 to AC4 of AIFACTORY-US-127.. Kind: verification. Repository: ConnectSoft.Blazor.UIKit.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the solution of the kit and on the probe host after the published version is restored; they pass and prove AC1 to AC4 of AIFACTORY-US-127."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Blazor.UIKit/docs/F01-alignment-gate.md",
        "ConnectSoft.Blazor.UIKit/docs/F02-uikit-coverage.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:frontend-developer",
        "slice:i3-studio",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 33,
      "phase": "templates-and-libraries",
      "stackRank": 3305,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-693]",
      "number": 693
    },
    {
      "id": "AIFACTORY-FEAT-101",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Blazor shell, microfrontends and UI kit for the Studio",
      "sequence": "18.32",
      "description": "The Blazor shell template, the microfrontend library template and the UI kit are extended with what the Studio needs: the work-area navigation, the state families, the run timeline and approval components, and the realtime connection. Component: Blazor Shell + MFEs + UIKit (extend). Depends on: AIFACTORY-FEAT-167, AIFACTORY-FEAT-168, AIFACTORY-FEAT-169. Increment I3: Studio. Build order 122 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-331",
        "AIFACTORY-US-332",
        "AIFACTORY-US-333",
        "AIFACTORY-US-334",
        "AIFACTORY-US-039"
      ],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12200,
      "titlePrefix": "[AIFACTORY-FEAT-101]",
      "number": 101
    },
    {
      "id": "AIFACTORY-US-331",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-101",
      "title": "Studio shell: the Studio repository is generated from the published shell template, composes a first microfrontend and calls the Studio backend through a generated client",
      "sequence": "18.32.01",
      "description": "As an asset maintainer, I want the Studio shell to be assembled from the published shell template, microfrontend library template, UI kit and API library template, so that the Studio starts from proven packages and holds no copy of what a template or a library owns. ADR-0007 builds the Studio as a Blazor shell that composes microfrontends, and the three template features this feature depends on deliver what it is built from: the shell template with gateway adapters, a token per gateway client, filter diagnostics and aligned pins; the microfrontend library template with the AppShell chrome and a neutral exemplar; and the UI kit with its Factory compositions. This PBI assembles the shell of the Studio from their published packages in the Studio repository. The shell is generated from the published shell template package, and at generation its package pins for the UI kit and the shell packages equal those of the template. Afterwards the central package file of the Studio is the one place a kit or shell package version is set for the shell and every microfrontend of the Studio; the pin check of the shared installer job keeps the shell package pins equal to the template, while the kit pin may move ahead when the Studio adopts a newer published kit version. The gateway adapters of the template are bound by configuration to the routes of StudioBff, so the Studio writes no adapter of its own. The client the shell uses for StudioBff is generated with the API library template from the OpenAPI document of StudioBff, with the JWT bearer layout because the shell forwards the token of the signed-in user; it takes the shared types from the contracts package by a version pin and defines none. A first microfrontend, generated from the exemplar of the microfrontend library template, is composed through the registry to prove the contract; the work-area features of the Studio add their microfrontends the same way. Architecture tests keep the rules of the templates in the Studio: a microfrontend references the shell contracts and abstractions and never the shell services package or the host, no project holds a hand-written gateway client, and every named gateway client declares its audience. Kind: enabling. Traces: adrs: ADR-0007, ADR-0028; services: StudioBff; apis: StudioBff/GetStudioSession. Depends on: feature:component-blazor-shell-template-studio, feature:component-blazor-mfe-library-template, feature:component-uikit-factory-compositions, feature:component-api-library-template-factory-clients, feature:contracts-package, feature:studio-bff. Sources: model/components.yaml, model/services/factory-studio/StudioBff.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0007-blazor-mfe-studio-frontend.md.",
      "acceptanceCriteria": [
        "AC1: Given the Studio repository generated from the published shell template package, when it is restored and built in Release, then it builds unchanged, its pins for the UI kit and the shell packages equal those of the shell template, no project sets a kit or shell package version outside the central package file, and the pin check of its pipeline passes for the shell package pins (ADR-0007: the Studio is a shell composing microfrontends on one design system; ADR-0028: the Studio is its own repository scaffolded from a published template).",
        "AC2: Given the shell with authentication on and its gateway routes configured for StudioBff, when a user signs in, then the switchers, the flags and the notifications come from StudioBff/GetStudioSession and the notification route through the adapters of the template and the generated client, and the repository holds no hand-written adapter or client for StudioBff (ADR-0007, model/services/factory-studio/StudioBff.yaml).",
        "AC3: Given the composed first microfrontend, when the architecture tests of the Studio run, then its routes answer in the shell, it references the shell contracts and abstractions only, a planted reference to the shell services package fails the test, and a named gateway client without an audience fails the test (ADR-0007, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1411",
        "AIFACTORY-TASK-1412",
        "AIFACTORY-TASK-1413",
        "AIFACTORY-TASK-1414"
      ],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12201,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007",
          "ADR-0028"
        ],
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetStudioSession"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-blazor-shell-template-studio",
        "feature:component-blazor-mfe-library-template",
        "feature:component-uikit-factory-compositions",
        "feature:component-api-library-template-factory-clients",
        "feature:contracts-package",
        "feature:studio-bff"
      ],
      "source": [
        "model/components.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0007-blazor-mfe-studio-frontend.md"
      ],
      "titlePrefix": "[AIFACTORY-US-331]",
      "number": 331
    },
    {
      "id": "AIFACTORY-TASK-1411",
      "type": "task",
      "parent": "AIFACTORY-US-331",
      "title": "Studio shell generated from the published shell template with its adapters bound to StudioBff",
      "sequence": "18.32.01.01",
      "description": "Studio shell generated from the published shell template with its adapters bound to StudioBff. Expected output: The Studio repository holds the shell generated from the published `connectsoft-blazor-shell` package with the pins of the template, the gateway routes of the tenant, flag, notification and activity adapters configured for StudioBff, the audience of its gateway client set, and a first microfrontend generated from the exemplar of the microfrontend library template composed through the registry.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Studio repository holds the shell generated from the published `connectsoft-blazor-shell` package with the pins of the template, the gateway routes of the tenant, flag, notification and activity adapters configured for StudioBff, the audience of its gateway client set, and a first microfrontend generated from the exemplar of the microfrontend library template composed through the registry."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1411]",
      "number": 1411
    },
    {
      "id": "AIFACTORY-TASK-1412",
      "type": "task",
      "parent": "AIFACTORY-US-331",
      "title": "StudioBff client generated with the API library template",
      "sequence": "18.32.01.02",
      "description": "StudioBff client generated with the API library template. Expected output: The client of StudioBff is generated with `connectsoft-api-library` from the OpenAPI document of StudioBff with the JWT bearer layout and with generation on, pins the contracts package for the shared types and is the only code of the Studio that calls StudioBff; a change of the document regenerates it at build.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The client of StudioBff is generated with `connectsoft-api-library` from the OpenAPI document of StudioBff with the JWT bearer layout and with generation on, pins the contracts package for the shared types and is the only code of the Studio that calls StudioBff; a change of the document regenerates it at build."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1412]",
      "number": 1412
    },
    {
      "id": "AIFACTORY-TASK-1413",
      "type": "task",
      "parent": "AIFACTORY-US-331",
      "title": "Architecture tests of the Studio for references, clients and audiences",
      "sequence": "18.32.01.03",
      "description": "Architecture tests of the Studio for references, clients and audiences. Expected output: The architecture test project of the Studio fails when a microfrontend references the shell services package or the host, when a microfrontend opens a connection to StudioRealtimeGateway of its own instead of using the subscription abstraction of the contracts project of the Studio, when a project other than the generated client calls StudioBff, when a named gateway client declares no audience, and when a project sets a kit or shell package version outside the central package file; a pipeline step runs the pin check of the shared installer job limited to the shell package pins.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Architecture.",
      "acceptanceCriteria": [
        "The architecture test project of the Studio fails when a microfrontend references the shell services package or the host, when a microfrontend opens a connection to StudioRealtimeGateway of its own instead of using the subscription abstraction of the contracts project of the Studio, when a project other than the generated client calls StudioBff, when a named gateway client declares no audience, and when a project sets a kit or shell package version outside the central package file; a pipeline step runs the pin check of the shared installer job limited to the shell package pins."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12201,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1413]",
      "number": 1413
    },
    {
      "id": "AIFACTORY-TASK-1414",
      "type": "task",
      "parent": "AIFACTORY-US-331",
      "title": "Verify the assembled shell against a StudioBff stub",
      "sequence": "18.32.01.04",
      "description": "Verify the assembled shell against a StudioBff stub. Expected output: Build the Studio shell, start it against a stub of StudioBff/GetStudioSession and run the architecture tests with the planted reference and the planted client; the shell shows the session data, the composed route answers and both planted cases fail, which proves AC1 to AC3 of AIFACTORY-US-331 (ADR-0007).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Build the Studio shell, start it against a stub of StudioBff/GetStudioSession and run the architecture tests with the planted reference and the planted client; the shell shows the session data, the composed route answers and both planted cases fail, which proves AC1 to AC3 of AIFACTORY-US-331 (ADR-0007)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1414]",
      "number": 1414
    },
    {
      "id": "AIFACTORY-US-332",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-101",
      "title": "I see the work areas my role allows and switch tenant, project and environment without gaining anything by the switch",
      "sequence": "18.32.02",
      "description": "As a requester, I want the Studio to show the work areas of my role and to let me change the tenant, project and environment I work in, so that I always know in which scope I act and never see an area I may not use. A signed-in user opens the Studio. The shell asks StudioBff for the session projection, which carries the scope, a snapshot of the permissions, the work area and the feature flags, and renders its chrome from it. The navigation shows the seven work areas of the UX model, Workspace, Software Factory, Assets, Intelligence, Quality and releases, Operations and usage, and Governance and administration, each only when a role of the user, its flag and its entitlement allow it; the entries pass the navigation filter of the shell and the host policy of each entry. The switchers list the tenant, the project and the environment items the session offers. When the user picks another item the shell sends the switch to StudioBff, which validates it; on success the shell reloads the session and rebuilds the navigation for the new scope. A switch grants nothing: the permissions of the new scope are whatever the session returns for it. A switch that StudioBff refuses leaves the scope unchanged and tells the user why: a 403 means the token lacks the scope inside the tenant, and a 404 means the item does not exist for this user, which is also the answer for an item of another tenant. When StudioBff cannot be reached the shell fails closed: it shows no work area beyond the home page and says that the scope could not be loaded. Every successful switch is recorded by StudioBff with the session; the shell records nothing of its own. The navigation and the switchers live in the Studio repository because the generic shell template ships an empty registry. Kind: behavior. Traces: services: StudioBff; apis: StudioBff/GetStudioSession, StudioBff/SetStudioScope; adrs: ADR-0015; requirements: FUX-01. Relates: screens: my-work; nfrs: NFR-01. Depends on: AIFACTORY-US-331, feature:studio-bff. Sources: model/components.yaml, model/ux/screens.yaml, model/services/factory-studio/StudioBff.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a user whose session from StudioBff/GetStudioSession holds the Requester role in one project, when the shell renders, then the navigation shows only the work areas that role, the flags and the entitlements allow, and the switchers list the tenant, project and environment items of the session (FUX-01; the screen `my-work` of model/ux/screens.yaml reads the session).",
        "AC2: Given the user picks another project, when the shell calls StudioBff/SetStudioScope and the switch is accepted, then the shell reloads the session and the navigation and every open screen reflect the new scope, and a role the user holds only in the former project is no longer applied (FUX-01, NFR-01).",
        "AC3: Given StudioBff/SetStudioScope answers 403 for a scope the token lacks or 404 for an item that is not visible to the user, when the shell handles the answer, then the scope stays unchanged, the user is told the reason and an item answered 404 leaves the switcher, as the amendment of ADR-0015 on a resource of another tenant prescribes.",
        "AC4: Given StudioBff cannot be reached or answers 401, when the shell loads the session, then no work area beyond the home page is shown, the user is told that the scope could not be loaded, and no token or header value is logged (ADR-0015, NFR-01)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-359",
        "AIFACTORY-TASK-1415",
        "AIFACTORY-TASK-1416",
        "AIFACTORY-TASK-1417"
      ],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12202,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/GetStudioSession",
          "StudioBff/SetStudioScope"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-01"
        ]
      },
      "relates": {
        "screens": [
          "my-work"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-331",
        "feature:studio-bff"
      ],
      "source": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-332]",
      "number": 332
    },
    {
      "id": "AIFACTORY-TASK-359",
      "type": "task",
      "parent": "AIFACTORY-US-332",
      "title": "Work-area navigation and scope switchers in the shell",
      "sequence": "18.32.02.01",
      "description": "Work-area navigation and scope switchers in the shell. Expected output: The Studio shell shows the seven work areas by role, flag and entitlement and the tenant, project and environment switchers from the session projection; a switcher sends the change to StudioBff, reloads the session on success and grants nothing by itself; a refused switch leaves the scope unchanged with its reason, and an unreachable StudioBff fails closed.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Studio shell shows the seven work areas by role, flag and entitlement and the tenant, project and environment switchers from the session projection; a switcher sends the change to StudioBff, reloads the session on success and grants nothing by itself; a refused switch leaves the scope unchanged with its reason, and an unreachable StudioBff fails closed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-359]",
      "number": 359
    },
    {
      "id": "AIFACTORY-TASK-1415",
      "type": "task",
      "parent": "AIFACTORY-US-332",
      "title": "Navigation entries of the seven work areas and the switcher region of the chrome",
      "sequence": "18.32.02.02",
      "description": "Navigation entries of the seven work areas and the switcher region of the chrome. Expected output: The registry of the Studio shell holds one navigation group per work area of model/ux/screens.yaml with its flag, entitlement and host policy, and the switcher region of the AppShell chrome renders the three switchers with their loading, empty and refused states in the three locales.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The registry of the Studio shell holds one navigation group per work area of model/ux/screens.yaml with its flag, entitlement and host policy, and the switcher region of the AppShell chrome renders the three switchers with their loading, empty and refused states in the three locales."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12202,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-1415]",
      "number": 1415
    },
    {
      "id": "AIFACTORY-TASK-1416",
      "type": "task",
      "parent": "AIFACTORY-US-332",
      "title": "StudioBff stub with roles, a refused switch and an outage",
      "sequence": "18.32.02.03",
      "description": "StudioBff stub with roles, a refused switch and an outage. Expected output: The test project of the Studio shell holds a stub of StudioBff/GetStudioSession and StudioBff/SetStudioScope with sessions for each role, a switch answered 403, a switch answered 404 and an unreachable backend, and a log capture that fails a test when a token or a header value is written.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The test project of the Studio shell holds a stub of StudioBff/GetStudioSession and StudioBff/SetStudioScope with sessions for each role, a switch answered 403, a switch answered 404 and an unreachable backend, and a log capture that fails a test when a token or a header value is written."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12202,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1416]",
      "number": 1416
    },
    {
      "id": "AIFACTORY-TASK-1417",
      "type": "task",
      "parent": "AIFACTORY-US-332",
      "title": "Verify the navigation by role, the accepted switch and the refusals",
      "sequence": "18.32.02.04",
      "description": "Verify the navigation by role, the accepted switch and the refusals. Expected output: Run the shell tests against the stub of AIFACTORY-TASK-1416; each role sees its work areas only, an accepted switch reloads the session, and the 403, 404 and outage cases leave the scope unchanged or fail closed, which proves AC1 to AC4 of AIFACTORY-US-332 (FUX-01).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the shell tests against the stub of AIFACTORY-TASK-1416; each role sees its work areas only, an accepted switch reloads the session, and the 403, 404 and outage cases leave the scope unchanged or fail closed, which proves AC1 to AC4 of AIFACTORY-US-332 (FUX-01)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1417]",
      "number": 1417
    },
    {
      "id": "AIFACTORY-US-333",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-101",
      "title": "UI kit: components for the state families of the UX model, the run timeline and the approval card, with their accessibility contracts",
      "sequence": "18.32.03",
      "description": "As an asset maintainer, I want the UI kit to carry the state, timeline and approval components every Studio work area shows, so that a run state or an approval looks and reads the same in every microfrontend. The UX model of this repository fixes eight state families, among them the run, the approval, the usage and the freshness family, each with its values and its colour group, and the screens of the Studio name the families they show. The kit already documents a status badge and a timeline component, and its Factory compositions are closed by the preceding feature; what the Studio still lacks are the three components this feature names. This PBI adds them to the kit as library components, because a shared type lives in the library and a microfrontend consumes it by the version pin. The state indicator renders any value of any family of model/ux/states.yaml with the colour group of the family and always with the value as text, so a state is never given by colour alone, and renders a value it does not know as unknown. The run timeline renders the steps and attempts of a run in order with their states, marks the step that waits for an approval, and is read and operated by keyboard. The approval card shows the proposal a decision is bound to with its exact version, the expiry of a pending request, the state Superseded when the proposal changed, and the decision actions as parameters the microfrontend wires; the card decides nothing and calls nothing. Each component has a documentation page with its parameters and its accessibility contract, a gallery route, component tests, a render under the Tokens, Flowbite and DaisyUI adapters and in right-to-left direction, and honours the reduced-motion preference through the motion tokens. The components reach the Studio as a published package and not as a project reference: after the snapshot, keyboard and render tests pass, the pipeline of the kit publishes the components package under the version guard of AIFACTORY-US-330, the release notes page of the kit names the version, and the central package file of the Studio pins it. Kind: enabling. Traces: adrs: ADR-0007, ADR-0026; requirements: FUX-04, FUX-05. Relates: screens: run-detail, run-timeline, approval-card. Depends on: feature:component-uikit-factory-compositions, AIFACTORY-US-331. Sources: model/components.yaml, model/ux/states.yaml, model/ux/screens.yaml, docs/architecture/adr/0026-requirements-to-ux-handoff.md.",
      "acceptanceCriteria": [
        "AC1: Given the state indicator, when it is rendered with every value of every family of model/ux/states.yaml, then each value appears as text with the colour group of its family, an unknown value appears as unknown, and a snapshot test fails when a family of the model gains a value the kit does not know (FUX-04, ADR-0026).",
        "AC2: Given a run with steps and attempts in mixed states, when the run timeline renders, then steps and attempts appear in order with their states as text, the step that waits for an approval is marked, and the timeline is read and operated by keyboard with visible focus (FUX-04; the screens `run-detail` and `run-timeline` of model/ux/screens.yaml use it).",
        "AC3: Given a pending approval bound to a proposal version, when the approval card renders, then it shows the proposal and its exact version and the expiry, shows Superseded when the proposal changed, exposes the decision actions as parameters and makes no call of its own (FUX-05; the screen `approval-card` of model/ux/screens.yaml uses it).",
        "AC4: Given the three components, when the render matrix runs, then each renders under the Tokens, the Flowbite and the DaisyUI adapter and in right-to-left direction, plays no animation under the reduced-motion preference, and has a documentation page and a gallery route; and the components package that carries them is on the ConnectSoft feed under a version the release notes page of the kit names, and the Studio builds against that pinned version (ADR-0007, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/ux/states.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-360",
        "AIFACTORY-TASK-1418",
        "AIFACTORY-TASK-1419",
        "AIFACTORY-TASK-1432",
        "AIFACTORY-TASK-1433",
        "AIFACTORY-TASK-1420"
      ],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12203,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0007",
          "ADR-0026"
        ],
        "requirements": [
          "FUX-04",
          "FUX-05"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "run-timeline",
          "approval-card"
        ]
      },
      "dependsOn": [
        "feature:component-uikit-factory-compositions",
        "AIFACTORY-US-331"
      ],
      "source": [
        "model/components.yaml",
        "model/ux/states.yaml",
        "model/ux/screens.yaml",
        "docs/architecture/adr/0026-requirements-to-ux-handoff.md"
      ],
      "titlePrefix": "[AIFACTORY-US-333]",
      "number": 333
    },
    {
      "id": "AIFACTORY-TASK-360",
      "type": "task",
      "parent": "AIFACTORY-US-333",
      "title": "State-family, run timeline and approval components in the UI kit",
      "sequence": "18.32.03.01",
      "description": "State-family, run timeline and approval components in the UI kit. Expected output: Components for the state families of the UX model, the run timeline and the approval card exist in the kit with their accessibility contracts, documentation pages and gallery routes; every state is given as text beside its colour, the approval card shows the exact proposal version and the expiry and makes no call; the components reach the Studio through the publication of AIFACTORY-TASK-1432 and the pin of AIFACTORY-TASK-1433.. Kind: ui. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Components for the state families of the UX model, the run timeline and the approval card exist in the kit with their accessibility contracts, documentation pages and gallery routes; every state is given as text beside its colour, the approval card shows the exact proposal version and the expiry and makes no call; the components reach the Studio through the publication of AIFACTORY-TASK-1432 and the pin of AIFACTORY-TASK-1433."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12203,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-360]",
      "number": 360
    },
    {
      "id": "AIFACTORY-TASK-1418",
      "type": "task",
      "parent": "AIFACTORY-US-333",
      "title": "Family snapshot, keyboard and render matrix tests of the three components",
      "sequence": "18.32.03.02",
      "description": "Family snapshot, keyboard and render matrix tests of the three components. Expected output: The unit test project of the kit holds a snapshot of the families of model/ux/states.yaml that the state indicator is tested against, keyboard and focus tests of the run timeline and the approval card, a reduced-motion test and a render of each component under the three adapters and in both directions.. Kind: fixture. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The unit test project of the kit holds a snapshot of the families of model/ux/states.yaml that the state indicator is tested against, keyboard and focus tests of the run timeline and the approval card, a reduced-motion test and a render of each component under the three adapters and in both directions."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12203,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1418]",
      "number": 1418
    },
    {
      "id": "AIFACTORY-TASK-1419",
      "type": "task",
      "parent": "AIFACTORY-US-333",
      "title": "Component pages and gallery routes of the three components",
      "sequence": "18.32.03.03",
      "description": "Component pages and gallery routes of the three components. Expected output: The documentation of the kit holds a page per component with its parameters, its states and its accessibility contract, and the gallery shows each component with every family, a mixed run and a pending, an expired and a superseded approval.. Kind: documentation. Repository: ConnectSoft.Blazor.UIKit. Verification: the documentation pipeline of the kit builds its site without warnings.",
      "acceptanceCriteria": [
        "The documentation of the kit holds a page per component with its parameters, its states and its accessibility contract, and the gallery shows each component with every family, a mixed run and a pending, an expired and a superseded approval."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12203,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1419]",
      "number": 1419
    },
    {
      "id": "AIFACTORY-TASK-1432",
      "type": "task",
      "parent": "AIFACTORY-US-333",
      "title": "Kit pipeline publishes the version that carries the three components",
      "sequence": "18.32.03.04",
      "description": "Kit pipeline publishes the version that carries the three components. Expected output: After the family snapshot, keyboard, reduced-motion and render matrix tests of AIFACTORY-TASK-1418 pass, the pipeline of the kit publishes the components package `ConnectSoft.Blazor.UIKit` to the ConnectSoft feed under the version guard of AIFACTORY-US-330, and the release notes page of the kit names the version and the state indicator, the run timeline and the approval card it carries.. Kind: operations. Repository: ConnectSoft.Blazor.UIKit. Verification: azure-pipelines.yml publishes after the suites; a repeated version is refused.",
      "acceptanceCriteria": [
        "After the family snapshot, keyboard, reduced-motion and render matrix tests of AIFACTORY-TASK-1418 pass, the pipeline of the kit publishes the components package `ConnectSoft.Blazor.UIKit` to the ConnectSoft feed under the version guard of AIFACTORY-US-330, and the release notes page of the kit names the version and the state indicator, the run timeline and the approval card it carries."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12203,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1432]",
      "number": 1432
    },
    {
      "id": "AIFACTORY-TASK-1433",
      "type": "task",
      "parent": "AIFACTORY-US-333",
      "title": "Studio pins the kit version that carries the three components",
      "sequence": "18.32.03.05",
      "description": "Studio pins the kit version that carries the three components. Expected output: The central package file of the Studio, the one place the kit version is set for the shell and every microfrontend, pins the UI kit version published by AIFACTORY-TASK-1432; the solution builds in Release and a component test of the first microfrontend renders the state indicator, the run timeline and the approval card from the pinned package.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The central package file of the Studio, the one place the kit version is set for the shell and every microfrontend, pins the UI kit version published by AIFACTORY-TASK-1432; the solution builds in Release and a component test of the first microfrontend renders the state indicator, the run timeline and the approval card from the pinned package."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1433]",
      "number": 1433
    },
    {
      "id": "AIFACTORY-TASK-1420",
      "type": "task",
      "parent": "AIFACTORY-US-333",
      "title": "Verify the three components against the families, the adapters and the published version",
      "sequence": "18.32.03.06",
      "description": "Verify the three components against the families, the adapters and the published version. Expected output: Run the tests of AIFACTORY-TASK-1418; every value of every family renders as text, the timeline and the card pass their keyboard tests and each component renders under the three adapters. Then name the version AIFACTORY-TASK-1432 published, as the release notes page of the kit records it, and build the Studio against the pin of AIFACTORY-TASK-1433; the published version and the green Studio build are the proof of AC4, and the runs together prove AC1 to AC4 of AIFACTORY-US-333 (FUX-04, FUX-05).. Kind: verification. Repository: ConnectSoft.Blazor.UIKit.",
      "acceptanceCriteria": [
        "Run the tests of AIFACTORY-TASK-1418; every value of every family renders as text, the timeline and the card pass their keyboard tests and each component renders under the three adapters. Then name the version AIFACTORY-TASK-1432 published, as the release notes page of the kit records it, and build the Studio against the pin of AIFACTORY-TASK-1433; the published version and the green Studio build are the proof of AC4, and the runs together prove AC1 to AC4 of AIFACTORY-US-333 (FUX-04, FUX-05)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1420]",
      "number": 1420
    },
    {
      "id": "AIFACTORY-US-334",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-101",
      "title": "I see live updates through one connection per session, and the Studio tells me when they are unavailable",
      "sequence": "18.32.04",
      "description": "As a requester, I want the Studio to keep the screens I watch current and to say so when it cannot, so that I never take a stale run state for a live one. A user watches a run or an approval list in the Studio. The shell opens one connection to StudioRealtimeGateway for the session, and no microfrontend opens a connection of its own. A microfrontend may reference only the shell contracts and abstractions, so the subscription abstraction lives in the contracts project of the Studio repository, `ConnectSoft.AI.SoftwareFactory.Studio.Contracts`, which references neither the host nor the shell services package; its implementation lives in the shell host. The connection carries a token issued for the audience of the realtime gateway; a user token has one audience, so the shell requests this token separately from the one it sends to StudioBff and never sends either to the other gateway. A subscription names what a screen watches and is bounded by the scope of the session; the gateway refuses a subscription outside it, and the shell shows the refusal on the screen and does not retry it. When the connection drops, the shell reconnects with a growing delay, subscribes again to everything the open screens watch and asks each screen to reload its model once, because updates were missed in between. While the connection is down or a source is degraded, every watching screen shows the freshness family of the UX model: the data is marked stale or degraded with the last observation, never hidden and never shown as fresh. When the user switches the scope, the shell drops every subscription of the old scope before it subscribes under the new one, so no update of the former project reaches a screen of the new one. When the session ends, the connection is closed. The shell keeps no update on disk and writes no payload of an update to a log. Kind: behavior. Traces: services: StudioRealtimeGateway, StudioBff; apis: StudioRealtimeGateway/Realtime.Subscribe; adrs: ADR-0015; requirements: FUX-04. Relates: screens: run-detail, my-work; nfrs: NFR-01. Depends on: AIFACTORY-US-331, AIFACTORY-US-332, feature:studio-realtime-gateway, feature:studio-bff. Sources: model/components.yaml, model/ux/states.yaml, model/ux/screens.yaml, model/services/factory-studio/StudioRealtimeGateway.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a session with two screens that watch a run, when both subscribe, then the shell holds exactly one connection to the realtime gateway, negotiated through StudioRealtimeGateway/Realtime.Subscribe with a token whose audience is that gateway, and the token sent to StudioBff is never sent on the connection (FUX-04; ADR-0015 amendment on the token audience).",
        "AC2: Given the connection drops and returns, when the shell reconnects, then it subscribes again to everything the open screens watch, each screen reloads its model once, and while the connection was down every watching screen showed the freshness state stale with the last observation (FUX-04; the screen `run-detail` of model/ux/screens.yaml carries the freshness family).",
        "AC3: Given the user switches the project, when the shell applies the new scope, then every subscription of the former scope is dropped before a new one is made and no update of the former project reaches a screen; a subscription the gateway refuses is shown as refused and is not retried (ADR-0015, NFR-01).",
        "AC4: Given live updates cannot be established at all, when a watching screen renders, then it says that live updates are unavailable, keeps working by reload, and no update payload is written to a log (FUX-04; the screen `my-work` of model/ux/screens.yaml stays usable)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/ux/states.yaml",
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-361",
        "AIFACTORY-TASK-1421",
        "AIFACTORY-TASK-1422",
        "AIFACTORY-TASK-1423"
      ],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12204,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioRealtimeGateway",
          "StudioBff"
        ],
        "apis": [
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FUX-04"
        ]
      },
      "relates": {
        "screens": [
          "run-detail",
          "my-work"
        ],
        "nfrs": [
          "NFR-01"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-331",
        "AIFACTORY-US-332",
        "feature:studio-realtime-gateway",
        "feature:studio-bff"
      ],
      "source": [
        "model/components.yaml",
        "model/ux/states.yaml",
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioRealtimeGateway.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-334]",
      "number": 334
    },
    {
      "id": "AIFACTORY-TASK-361",
      "type": "task",
      "parent": "AIFACTORY-US-334",
      "title": "Realtime connection of the shell",
      "sequence": "18.32.04.01",
      "description": "Realtime connection of the shell. Expected output: The Studio shell holds one connection to StudioRealtimeGateway per session. The subscription abstraction lives in the contracts project `ConnectSoft.AI.SoftwareFactory.Studio.Contracts` of the Studio, which a microfrontend may reference and which references neither the host nor the shell services package; its implementation in the shell host re-subscribes after a reconnect, asks the watching screens to reload once and shows the freshness state and a notice when live updates are unavailable; the architecture test of AIFACTORY-TASK-1413 forbids a connection a microfrontend opens itself.. Kind: ui. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Studio shell holds one connection to StudioRealtimeGateway per session. The subscription abstraction lives in the contracts project `ConnectSoft.AI.SoftwareFactory.Studio.Contracts` of the Studio, which a microfrontend may reference and which references neither the host nor the shell services package; its implementation in the shell host re-subscribes after a reconnect, asks the watching screens to reload once and shows the freshness state and a notice when live updates are unavailable; the architecture test of AIFACTORY-TASK-1413 forbids a connection a microfrontend opens itself."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:ui",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12204,
      "kind": "ui",
      "titlePrefix": "[AIFACTORY-TASK-361]",
      "number": 361
    },
    {
      "id": "AIFACTORY-TASK-1421",
      "type": "task",
      "parent": "AIFACTORY-US-334",
      "title": "Token of the realtime audience and subscriptions that follow the scope",
      "sequence": "18.32.04.02",
      "description": "Token of the realtime audience and subscriptions that follow the scope. Expected output: The realtime service of the shell requests a token for the audience of the realtime gateway through a second named client, drops every subscription on a scope switch before it subscribes under the new scope, closes the connection at the end of the session and logs no update payload.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The realtime service of the shell requests a token for the audience of the realtime gateway through a second named client, drops every subscription on a scope switch before it subscribes under the new scope, closes the connection at the end of the session and logs no update payload."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1421]",
      "number": 1421
    },
    {
      "id": "AIFACTORY-TASK-1422",
      "type": "task",
      "parent": "AIFACTORY-US-334",
      "title": "Hub stub with a drop, a refused subscription and an unreachable gateway",
      "sequence": "18.32.04.03",
      "description": "Hub stub with a drop, a refused subscription and an unreachable gateway. Expected output: The test project of the Studio shell holds a hub stub that records the audience of the token of every connection and the subscriptions it receives, drops and restores the connection on demand, refuses a subscription outside the scope and can be unreachable from the start.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The test project of the Studio shell holds a hub stub that records the audience of the token of every connection and the subscriptions it receives, drops and restores the connection on demand, refuses a subscription outside the scope and can be unreachable from the start."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12204,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1422]",
      "number": 1422
    },
    {
      "id": "AIFACTORY-TASK-1423",
      "type": "task",
      "parent": "AIFACTORY-US-334",
      "title": "Verify the single connection, the reconnect, the scope switch and the unavailable state",
      "sequence": "18.32.04.04",
      "description": "Verify the single connection, the reconnect, the scope switch and the unavailable state. Expected output: Run the realtime tests against the hub stub of AIFACTORY-TASK-1422; one connection serves two screens, a reconnect re-subscribes and reloads once, a scope switch drops the former subscriptions and the unreachable gateway shows the notice, which proves AC1 to AC4 of AIFACTORY-US-334 (FUX-04, StudioRealtimeGateway/Realtime.Subscribe).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run the realtime tests against the hub stub of AIFACTORY-TASK-1422; one connection serves two screens, a reconnect re-subscribes and reloads once, a scope switch drops the former subscriptions and the unreachable gateway shows the notice, which proves AC1 to AC4 of AIFACTORY-US-334 (FUX-04, StudioRealtimeGateway/Realtime.Subscribe)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1423]",
      "number": 1423
    },
    {
      "id": "AIFACTORY-US-039",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-101",
      "title": "The Studio works with a keyboard, in my language and direction",
      "sequence": "18.32.05",
      "description": "As a reviewer, I want to use the Studio with a keyboard, in my locale and reading direction, with the motion I can tolerate, so that I can decide and submit without barriers. This is the integration PBI of the feature: it proves the assembled shell, its navigation and switchers, the kit components and the realtime connection together on the two paths every user of the Studio walks. A reviewer sets the locale, the theme and the reduced-motion preference; the shell stores them through StudioBff and reads them back with the session, so they hold on the next sign-in and on another device. Storing and reading back is work of the Studio shell and not of the kit: the kit is a component library that makes no call, and it delivers the mechanism, the two directions, the localised state texts and the motion tokens. The Studio supports English, Hebrew and Russian. In Hebrew the shell and every kit component render in right-to-left direction: the navigation, the tables and the timelines are mirrored and no text is clipped. With a keyboard alone a requester submits a run and a reviewer opens an approval card and decides it; focus is always visible and never trapped, and the order of focus follows the reading order of the direction. With the reduced-motion preference a live update changes the screen without an animation. A state shown by colour is also given as text, in the locale of the user. A preference StudioBff refuses is not applied locally: the shell keeps the stored value and says that the change was not saved. The kit changes of this PBI reach the Studio as a published version that the Studio pins. The paths are covered by automated accessibility tests that run in the pipeline of the Studio, so a microfrontend that breaks a path fails the run. Usability at this level is the baseline of the Factory: the accessibility level, the three locales, the direction and the keyboard are requirements of every screen. Kind: behavior. Traces: services: StudioBff; apis: StudioBff/SetStudioPreferences, StudioBff/GetStudioSession; adrs: ADR-0026; requirements: FUX-12. Relates: screens: run-submit, approval-card; nfrs: NFR-15. Depends on: AIFACTORY-US-331, AIFACTORY-US-332, AIFACTORY-US-333, AIFACTORY-US-334, feature:studio-bff. Sources: model/components.yaml, model/ux/screens.yaml, model/ux/states.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given a right-to-left locale set through StudioBff/SetStudioPreferences, when the shell renders, then navigation, tables and timelines are mirrored and no text is clipped, and the locale is read back from StudioBff/GetStudioSession on the next sign-in (NFR-15, FUX-12).",
        "AC2: Given only a keyboard, when a user submits a run and decides an approval, then both complete without a pointer, focus is always visible and never trapped, and the focus order follows the reading order of the direction (NFR-15; the screens `run-submit` and `approval-card` of model/ux/screens.yaml are the two paths).",
        "AC3: Given the reduced-motion preference stored through StudioBff/SetStudioPreferences, when a screen updates live, then no animation plays; given StudioBff refuses a preference, then the shell keeps the stored value and tells the user that the change was not saved (NFR-15, ADR-0026).",
        "AC4: Given a state shown by colour, when it renders in each of the three locales, then the state is also given as text in that locale, for every family of model/ux/states.yaml (FUX-12, NFR-15)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-533",
        "AIFACTORY-TASK-534",
        "AIFACTORY-TASK-535",
        "AIFACTORY-TASK-1430",
        "AIFACTORY-TASK-1431",
        "AIFACTORY-TASK-1434",
        "AIFACTORY-TASK-1435",
        "AIFACTORY-TASK-677"
      ],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "behavior",
      "traces": {
        "services": [
          "StudioBff"
        ],
        "apis": [
          "StudioBff/SetStudioPreferences",
          "StudioBff/GetStudioSession"
        ],
        "adrs": [
          "ADR-0026"
        ],
        "requirements": [
          "FUX-12"
        ]
      },
      "relates": {
        "screens": [
          "run-submit",
          "approval-card"
        ],
        "nfrs": [
          "NFR-15"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-331",
        "AIFACTORY-US-332",
        "AIFACTORY-US-333",
        "AIFACTORY-US-334",
        "feature:studio-bff"
      ],
      "source": [
        "model/components.yaml",
        "model/ux/screens.yaml",
        "model/ux/states.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-039]",
      "number": 39
    },
    {
      "id": "AIFACTORY-TASK-533",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "Direction and locale in the shell and the kit",
      "sequence": "18.32.05.01",
      "description": "Direction and locale in the shell and the kit. Expected output: Every kit component renders in both directions and in each of the three supported locales; the state texts of the families of model/ux/states.yaml are localised resources of the kit; a test renders the AppShell chrome and the components in the right-to-left locale and fails on clipped text.. Kind: implementation. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Every kit component renders in both directions and in each of the three supported locales; the state texts of the families of model/ux/states.yaml are localised resources of the kit; a test renders the AppShell chrome and the components in the right-to-left locale and fails on clipped text."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-533]",
      "number": 533
    },
    {
      "id": "AIFACTORY-TASK-534",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "Keyboard paths for submit and decide",
      "sequence": "18.32.05.02",
      "description": "Keyboard paths for submit and decide. Expected output: The two paths, submitting a run on the screen `run-submit` and deciding on the screen `approval-card`, are covered by automated keyboard tests of the Studio that assert visible focus, no focus trap and the focus order of each direction.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "The two paths, submitting a run on the screen `run-submit` and deciding on the screen `approval-card`, are covered by automated keyboard tests of the Studio that assert visible focus, no focus trap and the focus order of each direction."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-534]",
      "number": 534
    },
    {
      "id": "AIFACTORY-TASK-535",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "Reduced motion and state text",
      "sequence": "18.32.05.03",
      "description": "Reduced motion and state text. Expected output: Live updates of the kit components honour the reduced-motion preference through the motion tokens of the kit, and every state family of model/ux/states.yaml has a text form in the three locales; the kit stores no preference and makes no call.. Kind: implementation. Repository: ConnectSoft.Blazor.UIKit. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Live updates of the kit components honour the reduced-motion preference through the motion tokens of the kit, and every state family of model/ux/states.yaml has a text form in the three locales; the kit stores no preference and makes no call."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-535]",
      "number": 535
    },
    {
      "id": "AIFACTORY-TASK-1430",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "Locale, theme and reduced motion stored through StudioBff and read back with the session",
      "sequence": "18.32.05.04",
      "description": "Locale, theme and reduced motion stored through StudioBff and read back with the session. Expected output: The Studio shell stores the locale, the theme and the reduced-motion preference through StudioBff/SetStudioPreferences, reads them back from StudioBff/GetStudioSession at sign-in and applies them to the direction, the theme and the motion setting the kit components read; when StudioBff refuses a change the shell keeps the stored value and shows a notice that the change was not saved.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The Studio shell stores the locale, the theme and the reduced-motion preference through StudioBff/SetStudioPreferences, reads them back from StudioBff/GetStudioSession at sign-in and applies them to the direction, the theme and the motion setting the kit components read; when StudioBff refuses a change the shell keeps the stored value and shows a notice that the change was not saved."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1430]",
      "number": 1430
    },
    {
      "id": "AIFACTORY-TASK-1431",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "StudioBff stub with an accepted and a refused preference",
      "sequence": "18.32.05.05",
      "description": "StudioBff stub with an accepted and a refused preference. Expected output: The test project of the Studio shell holds a stub of StudioBff/SetStudioPreferences and StudioBff/GetStudioSession with an accepted change that the next session returns and a refused change, and tests that assert the read-back on a new session and the kept value with the notice on the refusal.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet test -c Release --filter Category=Accessibility.",
      "acceptanceCriteria": [
        "The test project of the Studio shell holds a stub of StudioBff/SetStudioPreferences and StudioBff/GetStudioSession with an accepted change that the next session returns and a refused change, and tests that assert the read-back on a new session and the kept value with the notice on the refusal."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1431]",
      "number": 1431
    },
    {
      "id": "AIFACTORY-TASK-1434",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "Kit pipeline publishes the version that carries the localised state texts and the reduced-motion behaviour",
      "sequence": "18.32.05.06",
      "description": "Kit pipeline publishes the version that carries the localised state texts and the reduced-motion behaviour. Expected output: After the direction, locale and reduced-motion tests of AIFACTORY-TASK-533 and AIFACTORY-TASK-535 pass, the pipeline of the kit publishes the components package to the ConnectSoft feed under the version guard of AIFACTORY-US-330, and the release notes page of the kit names the version and what it carries.. Kind: operations. Repository: ConnectSoft.Blazor.UIKit. Verification: azure-pipelines.yml publishes after the suites; a repeated version is refused.",
      "acceptanceCriteria": [
        "After the direction, locale and reduced-motion tests of AIFACTORY-TASK-533 and AIFACTORY-TASK-535 pass, the pipeline of the kit publishes the components package to the ConnectSoft feed under the version guard of AIFACTORY-US-330, and the release notes page of the kit names the version and what it carries."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.Blazor.UIKit"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1434]",
      "number": 1434
    },
    {
      "id": "AIFACTORY-TASK-1435",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "Studio pins the kit version of the accessibility work",
      "sequence": "18.32.05.07",
      "description": "Studio pins the kit version of the accessibility work. Expected output: The central package file of the Studio pins the UI kit version published by AIFACTORY-TASK-1434 and the solution builds in Release against it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Studio. Verification: dotnet build -c Release.",
      "acceptanceCriteria": [
        "The central package file of the Studio pins the UI kit version published by AIFACTORY-TASK-1434 and the solution builds in Release against it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1435]",
      "number": 1435
    },
    {
      "id": "AIFACTORY-TASK-677",
      "type": "task",
      "parent": "AIFACTORY-US-039",
      "title": "Verify studio-shell-accessible-and-localised by running the declared command",
      "sequence": "18.32.05.08",
      "description": "Verify studio-shell-accessible-and-localised by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Accessibility` on the Studio shell pinned to the kit version of AIFACTORY-TASK-1435, including the preference tests of AIFACTORY-TASK-1430 against the stub of AIFACTORY-TASK-1431; it passes and proves AC1 to AC4 of AIFACTORY-US-039.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Accessibility` on the Studio shell pinned to the kit version of AIFACTORY-TASK-1435, including the preference tests of AIFACTORY-TASK-1430 against the stub of AIFACTORY-TASK-1431; it passes and proves AC1 to AC4 of AIFACTORY-US-039."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 122,
      "phase": "factory",
      "stackRank": 12205,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-677]",
      "number": 677
    },
    {
      "id": "AIFACTORY-FEAT-164",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "SaaS Metering template: idempotent usage, windows and the quota contract before usage export",
      "sequence": "18.33",
      "description": "CostUsageService exports usage to the SaaS Metering service and the export must be repeatable without a duplicate meter (FEAT-102); budgets are capped per period and invoices read the same measurement. The template's own gap backlog (saas-EPIC-MET) is not started: a usage record has no idempotency key, counters are flat with a boolean reset instead of windows, the quota events name Dimension where Billing expects MeterKey, and the inbound usage topic is not registered. FEAT-102 depends on this feature. Component: SaaS Metering service (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I4: Trust and accountability. Build order 34 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development"
      ],
      "children": [
        "AIFACTORY-US-279",
        "AIFACTORY-US-280",
        "AIFACTORY-US-288",
        "AIFACTORY-US-281",
        "AIFACTORY-US-282",
        "AIFACTORY-US-283",
        "AIFACTORY-US-128"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3400,
      "titlePrefix": "[AIFACTORY-FEAT-164]",
      "number": 164
    },
    {
      "id": "AIFACTORY-US-279",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-164",
      "title": "SaaS Metering template: a usage record carries an idempotency key, and a repeated record changes no counter and returns the first result",
      "sequence": "18.33.01",
      "description": "As an asset maintainer, I want usage ingestion of a generated Metering service to be idempotent on a key the caller supplies, so that an exporter can repeat a delivery without inflating a counter. Feature saas-MET-F01 of the gap backlog of the template (Docs/backlog/metering-gap-backlog.md of the template) records that usage ingestion is not idempotent. `RecordUsageInput` and `RecordUsageRequest` carry a tenant, a dimension and a delta; `DefaultUsageMetersProcessor.RecordUsageAsync` always increments the counter, raises the aggregate version and publishes the usage-recorded event; the descriptor `ConnectSoft.Saas.Metering.json` lists no value object. The published language of the SaaS family requires deduplication on tenant, dimension and idempotency key under at-least-once delivery. The Factory exports its usage to this service and must be able to repeat an export, and CostUsageService creates a usage record from a receipt exactly once (model/services/control-plane/CostUsageService.yaml). This PBI adds the value object `UsageRecord` with the time of occurrence, the quantity, the source and the idempotency key, puts the key on the REST and gRPC record operations, where it is required, and has the processor count a usage once per tenant, dimension and key. A repeated record with the same key and the same quantity changes no counter, publishes no second event and returns the result of the first. A record with the same key and a different quantity is refused as a conflict and changes nothing, the rule ADR-0014 decision 3 states for idempotency. A record without a key is refused as invalid. The saga path that records usage from an inbound message derives the key from the identifier of that message. The deduplication row, the counter change and the outbox record of the event are committed in one transaction of the store of the service, so a rollback leaves none of them. The descriptor lists the value object, because the descriptor is the import format of ADR-0025 and must describe the code. The script `build/regenerate.ps1` cannot prove that it does: without a Factory endpoint it only parses the descriptor as JSON and reads neither the code nor a schema. This PBI therefore adds a descriptor drift test, as AIFACTORY-TASK-1143 did for the Tenants template: an architecture test that compares `ConnectSoft.Saas.Metering.json` in both directions with the usage meter entity, the value objects and the published and consumed event types, validates it against `ConnectSoft.Saas.Metering.schema.json` and names the member on a difference. The later PBIs of the feature and its gate use this test as the validator of the descriptor. Kind: enabling. Traces: services: CostUsageService; adrs: ADR-0014, ADR-0020, ADR-0025. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, model/template-parameters/connectsoft-saas-metering.yaml, docs/architecture/adr/0020-commercial-model.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given a usage record with an idempotency key, when the same record is delivered three times over REST and over gRPC, then the counter grows once, one usage-recorded event is published and all three calls return the result of the first (ADR-0014 decision 3, ADR-0020 decision 3).",
        "AC2: Given a recorded key, when a record with the same key and a different quantity arrives, then it is refused as a conflict with 409 and no counter or event changes; given a record without a key, then it is refused with 400; given two records with different keys on one dimension, then both are counted (ADR-0014 decision 3).",
        "AC3: Given a record whose transaction rolls back after the counter change, when the store is read, then no deduplication row, no counter change and no outbox record exists, and a later delivery of the same key is counted once (ADR-0014 decision 4, model/services/control-plane/CostUsageService.yaml).",
        "AC4: Given the descriptor `ConnectSoft.Saas.Metering.json`, when the descriptor drift test runs, then the descriptor validates against `ConnectSoft.Saas.Metering.schema.json`, lists the value object `UsageRecord` with its fields, and equals the usage meter entity, the value objects and the published and consumed event types of the code in both directions; a planted extra property, which is valid JSON and passes the parse of `build/regenerate.ps1`, fails the test with the member named (ADR-0025 decision 2)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1255",
        "AIFACTORY-TASK-1292",
        "AIFACTORY-TASK-605",
        "AIFACTORY-TASK-1256",
        "AIFACTORY-TASK-1257"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3401,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020",
          "ADR-0025"
        ]
      },
      "relates": {},
      "dependsOn": [],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-279]",
      "number": 279
    },
    {
      "id": "AIFACTORY-TASK-1255",
      "type": "task",
      "parent": "AIFACTORY-US-279",
      "title": "Value object `UsageRecord`, the key on the record contracts and the descriptor entry",
      "sequence": "18.33.01.01",
      "description": "BEFORE DEVELOPMENT. Value object `UsageRecord`, the key on the record contracts and the descriptor entry. Expected output: The entity model declares the value object `UsageRecord` with time of occurrence, quantity, source and idempotency key; `RecordUsageInput`, `RecordUsageRequest` and the gRPC contract carry the key as a required field with the 400 and 409 answers documented on the REST and gRPC pages; the descriptor `ConnectSoft.Saas.Metering.json` lists the value object.. Kind: contract. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The entity model declares the value object `UsageRecord` with time of occurrence, quantity, source and idempotency key; `RecordUsageInput`, `RecordUsageRequest` and the gRPC contract carry the key as a required field with the 400 and 409 answers documented on the REST and gRPC pages; the descriptor `ConnectSoft.Saas.Metering.json` lists the value object."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3401,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1255]",
      "number": 1255
    },
    {
      "id": "AIFACTORY-TASK-1292",
      "type": "task",
      "parent": "AIFACTORY-US-279",
      "title": "Descriptor drift test over the usage meter entity, the value objects and the event types",
      "sequence": "18.33.01.02",
      "description": "BEFORE DEVELOPMENT. Descriptor drift test over the usage meter entity, the value objects and the event types. Expected output: An architecture test reads `ConnectSoft.Saas.Metering.json`, validates it against `ConnectSoft.Saas.Metering.schema.json` and compares it in both directions with the usage meter entity, the value objects and the published and consumed event types of the messaging model; a difference fails the test with the member named, and a planted extra property proves it; `build/regenerate.ps1` stays the parse of the descriptor it is.. Kind: fixture. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "An architecture test reads `ConnectSoft.Saas.Metering.json`, validates it against `ConnectSoft.Saas.Metering.schema.json` and compares it in both directions with the usage meter entity, the value objects and the published and consumed event types of the messaging model; a difference fails the test with the member named, and a planted extra property proves it; `build/regenerate.ps1` stays the parse of the descriptor it is."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3401,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1292]",
      "number": 1292
    },
    {
      "id": "AIFACTORY-TASK-605",
      "type": "task",
      "parent": "AIFACTORY-US-279",
      "title": "Usage record with an idempotency key (saas-MET-F01)",
      "sequence": "18.33.01.03",
      "description": "BEFORE DEVELOPMENT. Usage record with an idempotency key (saas-MET-F01). Expected output: RecordUsage carries a usage record with a caller-supplied idempotency key; `DefaultUsageMetersProcessor.RecordUsageAsync` counts once per tenant, dimension and key, a repeated record with the same key changes no counter and returns the first result, the same key with another quantity is a conflict, and the saga path derives the key from the message identifier; a test delivers the same record three times.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "RecordUsage carries a usage record with a caller-supplied idempotency key; `DefaultUsageMetersProcessor.RecordUsageAsync` counts once per tenant, dimension and key, a repeated record with the same key changes no counter and returns the first result, the same key with another quantity is a conflict, and the saga path derives the key from the message identifier; a test delivers the same record three times."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-605]",
      "number": 605
    },
    {
      "id": "AIFACTORY-TASK-1256",
      "type": "task",
      "parent": "AIFACTORY-US-279",
      "title": "Deduplication table with its unique index and mapping",
      "sequence": "18.33.01.04",
      "description": "BEFORE DEVELOPMENT. Deduplication table with its unique index and mapping. Expected output: A migration adds the usage record table with a unique index on tenant, dimension and idempotency key and its mapping; the row is written in the transaction of the counter change and the outbox record; mapping tests run against an isolated test database and include the rollback case.. Kind: migration. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration adds the usage record table with a unique index on tenant, dimension and idempotency key and its mapping; the row is written in the transaction of the counter change and the outbox record; mapping tests run against an isolated test database and include the rollback case."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3401,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1256]",
      "number": 1256
    },
    {
      "id": "AIFACTORY-TASK-1257",
      "type": "task",
      "parent": "AIFACTORY-US-279",
      "title": "Verify the idempotent record over REST and gRPC",
      "sequence": "18.33.01.05",
      "description": "BEFORE DEVELOPMENT. Verify the idempotent record over REST and gRPC. Expected output: Run `dotnet test -c Release --no-build` on the template solution; the triple delivery, conflict, missing key and rollback tests over both transports and the descriptor drift test with its planted property pass and prove AC1 to AC4 of AIFACTORY-US-279 (ADR-0014, ADR-0020).. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the template solution; the triple delivery, conflict, missing key and rollback tests over both transports and the descriptor drift test with its planted property pass and prove AC1 to AC4 of AIFACTORY-US-279 (ADR-0014, ADR-0020)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1257]",
      "number": 1257
    },
    {
      "id": "AIFACTORY-US-280",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-164",
      "title": "SaaS Metering template: a counter belongs to a window, a roll or the passed boundary of a Fixed window closes it and opens the next, and threshold and quota events carry the window",
      "sequence": "18.33.02",
      "description": "As an asset maintainer, I want usage counted per window that follows the subscription period, so that a budget is capped per period and an invoice reads the usage of exactly its period. Feature saas-MET-F02 of the gap backlog of the template records that a meter is one scalar `CounterValue` per tenant and dimension, that a window is only approximated by the flags `ThresholdCrossedEmitted` and `QuotaExceededEmitted`, which `RollUsageCounterInnerAsync` resets on a roll, that a roll is manual or driven by an API call and not tied to a period boundary, and that the events carry no window identifier. ADR-0020 has budgets capped per period and invoices read the same measurement, so the Factory needs to say which period a usage was counted in. This PBI adds the value object `Window` with its kind, fixed or rolling, its size, its anchor and a window identifier, and makes the counter belong to the open window of its meter. Within an open window the counter never decreases. A roll closes the open window, keeps its total and opens the next window with a counter of zero; the counter-rolled event and the threshold and quota events carry the window identifier, and the two flags are kept per window, so a threshold is announced once per window. A window does not wait for a caller. A Fixed window whose anchor plus size has passed is closed and the next one opened by the service itself, by a scheduled job of the scheduler model of the template and, at the latest, by the next record that arrives after the boundary, with one counter-rolled event and no API call; two instances that reach the boundary together roll once. Without this no window of a tenant would close before Billing publishes a rating-window event, and a reconciliation would have nothing to compare. A usage record is counted in the window that is open when it is recorded, and its result names that window, the start of that window and the time of occurrence of the record, so that a caller can tell a record whose time of occurrence precedes the window it was counted in. The rating-window event of Billing, which the backlog names as an optional trigger and marks as the dependency saas-BIL-F07 of the Billing template, opens the window an invoice period needs; a second delivery of the same event opens nothing. The Billing template does not publish that event in this increment, so the Metering template declares the inbound contract itself until the Billing template publishes against it, with a golden file, a topic constant, its registration in `MeteringMassTransitTopology` and its entry among the consumed events of the descriptor, the very omission saas-MET-F03 records for the usage-reported event, and its test publishes the message. A roll of a window that is already closed is refused as a conflict. The existing counter of a meter becomes its first open window when the migration runs. The descriptor lists the value object. Kind: enabling. Traces: services: CostUsageService; adrs: ADR-0014, ADR-0020, ADR-0025. Depends on: AIFACTORY-US-279. Sources: model/components.yaml, model/template-parameters/connectsoft-saas-metering.yaml, docs/architecture/adr/0020-commercial-model.md, docs/architecture/commercial-model.md.",
      "acceptanceCriteria": [
        "AC1: Given a meter with usage in its open window, when the window is rolled, then the window is closed with its total kept, a new window with a counter of zero is open, and the counter-rolled event carries the identifiers of both windows; a roll of a closed window is refused with 409 (ADR-0020 decision 3, model/components.yaml).",
        "AC2: Given a quota and a threshold on a meter, when usage crosses them in one window and again in the next, then the threshold and quota events are published once per window and each carries its window identifier; the result of a usage record names the window it was counted in, the start of that window and the time of occurrence of the record (ADR-0020 decision 3).",
        "AC3: Given the inbound rating-window contract the Metering template declares itself, with its golden file, its topic constant, its registration in `MeteringMassTransitTopology` and its entry among the consumed events of the descriptor, when a test publishes a rating-window message for a subscription period, because saas-BIL-F07 of the Billing template is not delivered in this increment, then the window of that period is opened for the meters of the tenant, and a second delivery of the same message opens no further window (ADR-0014 decision 3, ADR-0020 decision 2).",
        "AC4: Given a store with flat counters of the template before this PBI, when the migration runs, then each counter is the total of the first open window of its meter and no usage is lost; the descriptor lists the value object `Window` and the inbound rating-window event, and the descriptor drift test passes (ADR-0025 decision 2).",
        "AC5: Given a meter with a Fixed window whose anchor plus size has passed and no caller that rolls it, when the scheduled job of the service runs or the next usage record arrives, then the window is closed with its total kept, the next window is open, exactly one counter-rolled event is published although two instances reach the boundary together, and the arriving record is counted in the new window (ADR-0020 decision 3, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1258",
        "AIFACTORY-TASK-606",
        "AIFACTORY-TASK-1297",
        "AIFACTORY-TASK-1259",
        "AIFACTORY-TASK-1260"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3402,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020",
          "ADR-0025"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-279"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md"
      ],
      "titlePrefix": "[AIFACTORY-US-280]",
      "number": 280
    },
    {
      "id": "AIFACTORY-TASK-1258",
      "type": "task",
      "parent": "AIFACTORY-US-280",
      "title": "Value object `Window`, the window identifier on the events, the inbound rating-window contract and the descriptor entries",
      "sequence": "18.33.02.01",
      "description": "BEFORE DEVELOPMENT. Value object `Window`, the window identifier on the events, the inbound rating-window contract and the descriptor entries. Expected output: The entity model declares the value object `Window` with kind, size, anchor and window identifier; the counter-rolled, threshold and quota events and the usage record carry the window identifier as an added field of their current version, and the result of a record names the window and its start; the messaging model declares the inbound rating-window contract with a topic constant and a golden JSON file; the descriptor lists the value object and the inbound event among its consumed events, and the events page of the template names the field and the inbound topic.. Kind: contract. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The entity model declares the value object `Window` with kind, size, anchor and window identifier; the counter-rolled, threshold and quota events and the usage record carry the window identifier as an added field of their current version, and the result of a record names the window and its start; the messaging model declares the inbound rating-window contract with a topic constant and a golden JSON file; the descriptor lists the value object and the inbound event among its consumed events, and the events page of the template names the field and the inbound topic."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3402,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1258]",
      "number": 1258
    },
    {
      "id": "AIFACTORY-TASK-606",
      "type": "task",
      "parent": "AIFACTORY-US-280",
      "title": "Window semantics aligned with the subscription period (saas-MET-F02)",
      "sequence": "18.33.02.02",
      "description": "BEFORE DEVELOPMENT. Window semantics aligned with the subscription period (saas-MET-F02). Expected output: A counter belongs to a window; a roll closes the window and opens the next; threshold and quota events carry the window id and their flags are kept per window; `MeteringMassTransitTopology` registers the inbound rating-window contract, and its consumer opens the window the invoice period needs and is idempotent; `RollUsageCounterInnerAsync` and `PrepareQuotaTransitions` work on the open window and no longer on bare flags.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A counter belongs to a window; a roll closes the window and opens the next; threshold and quota events carry the window id and their flags are kept per window; `MeteringMassTransitTopology` registers the inbound rating-window contract, and its consumer opens the window the invoice period needs and is idempotent; `RollUsageCounterInnerAsync` and `PrepareQuotaTransitions` work on the open window and no longer on bare flags."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-606]",
      "number": 606
    },
    {
      "id": "AIFACTORY-TASK-1297",
      "type": "task",
      "parent": "AIFACTORY-US-280",
      "title": "Fixed window closed at its boundary by the service itself",
      "sequence": "18.33.02.03",
      "description": "BEFORE DEVELOPMENT. Fixed window closed at its boundary by the service itself. Expected output: A scheduled job of the scheduler model of the template closes every Fixed window whose anchor plus size has passed and opens the next, and the record path does the same before it counts a record that arrives after the boundary; the roll is guarded so that two instances roll a window once and publish one counter-rolled event; no API call and no event of Billing is needed.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A scheduled job of the scheduler model of the template closes every Fixed window whose anchor plus size has passed and opens the next, and the record path does the same before it counts a record that arrives after the boundary; the roll is guarded so that two instances roll a window once and publish one counter-rolled event; no API call and no event of Billing is needed."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1297]",
      "number": 1297
    },
    {
      "id": "AIFACTORY-TASK-1259",
      "type": "task",
      "parent": "AIFACTORY-US-280",
      "title": "Window columns on the meter store and the migration of flat counters",
      "sequence": "18.33.02.04",
      "description": "BEFORE DEVELOPMENT. Window columns on the meter store and the migration of flat counters. Expected output: A migration adds the window table and the window reference of the usage record and turns the existing counter of every meter into the total of its first open window; a migration test runs on a store seeded with flat counters and compares the totals before and after.. Kind: migration. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration adds the window table and the window reference of the usage record and turns the existing counter of every meter into the total of its first open window; a migration test runs on a store seeded with flat counters and compares the totals before and after."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:migration",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3402,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1259]",
      "number": 1259
    },
    {
      "id": "AIFACTORY-TASK-1260",
      "type": "task",
      "parent": "AIFACTORY-US-280",
      "title": "Verify the roll, the per-window events and the migration",
      "sequence": "18.33.02.05",
      "description": "BEFORE DEVELOPMENT. Verify the roll, the per-window events and the migration. Expected output: Run `dotnet test -c Release --no-build` on the template solution; the roll invariants, the boundary close by the job and by the next record with two instances, the per-window threshold and quota events, the rating-window consumer with its golden file and its duplicate delivery, the descriptor drift test and the migration test pass and prove AC1 to AC5 of AIFACTORY-US-280 (ADR-0020).. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the template solution; the roll invariants, the boundary close by the job and by the next record with two instances, the per-window threshold and quota events, the rating-window consumer with its golden file and its duplicate delivery, the descriptor drift test and the migration test pass and prove AC1 to AC5 of AIFACTORY-US-280 (ADR-0020)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1260]",
      "number": 1260
    },
    {
      "id": "AIFACTORY-US-288",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-164",
      "title": "SaaS Metering template: a tenant scoped, paged query returns the usage records of one tenant, dimension and window and the total of a closed window, over REST and gRPC",
      "sequence": "18.33.03",
      "description": "As an asset maintainer, I want a generated Metering service to return the usage records and the total of one window, so that a caller can compare what it recorded with what the service counted, record by record. The usage meters controller of the template offers two reads, `queries/by-tenant-dimension` and `queries/by-id`, and each returns one meter with its counter (`UsageMeterDto.CounterValue`). With the usage record and the window of the earlier PBIs the service stores which record was counted in which window, but no operation returns them. The meter reconciliation of the feature `component-saas-metering` (AIFACTORY-US-286) compares the settled usage of the Factory with the usage records and the total of one window of the Metering service, and AIFACTORY-US-287 proves it against a generated service without a stub, so the generated service must offer that read. This PBI adds it. The requests, the responses and the operations on the two service interfaces are declared in `ConnectSoft.Saas.Metering.ServiceModel`, the package the REST page of the template names as the home of the contracts, and the REST controller and the code first gRPC service implement them. The query takes a dimension and a window identifier; the tenant is the tenant context of the call and never a free field of the request. It returns the window with its kind, start, end and state, the total of the window, which is final once the window is closed and marked as running while it is open, and one page of usage records, each with its idempotency key, quantity, time of occurrence, source and window identifier, in a stable order by time of occurrence and key with a continuation token. A second operation lists the windows of a tenant and dimension that closed after a given window, so that a caller finds what it has not compared yet. A window identifier of another tenant is answered 404, the same answer as for an identifier that does not exist, an unknown dimension is answered 404, and a page size above the limit of the options is refused with 400. The query only reads and changes no counter, and it adds nothing to the descriptor, so the descriptor drift test stays as it is. Kind: enabling. Traces: services: CostUsageService; adrs: ADR-0015, ADR-0020. Depends on: AIFACTORY-US-279, AIFACTORY-US-280. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/adr/0020-commercial-model.md, docs/architecture/commercial-model.md, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a tenant with usage records in a closed window of one dimension, when the query is called over REST and over gRPC with the dimension and the window identifier, then both return the window with its start, end and state, its final total, and the usage records with idempotency key, quantity, time of occurrence, source and window identifier, and the sum of the quantities over all pages equals the total (ADR-0020 decision 3, model/components.yaml).",
        "AC2: Given more records than one page holds, when the caller follows the continuation token, then every record of the window is returned exactly once in a stable order although new usage is recorded in the open window meanwhile, and a page size above the limit of the options is refused with 400 (ADR-0020 decision 3, docs/architecture/commercial-model.md).",
        "AC3: Given a window identifier of another tenant, when the query is called, then the answer is 404 with the same body as for an identifier that does not exist, and over gRPC the status NOT_FOUND; the tenant of the query is the tenant context of the call and no field of the request (ADR-0015 amendment on a resource of another tenant).",
        "AC4: Given windows of a tenant and dimension that closed after a given window, when the list of closed windows is read, then it returns each with its identifier, start, end and total in the order they closed, and the record query of an open window returns its total marked as running, so that the reconciliation of model/services/control-plane/CostUsageService.yaml compares closed windows only (ADR-0020 decision 3)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1293",
        "AIFACTORY-TASK-1294",
        "AIFACTORY-TASK-1295",
        "AIFACTORY-TASK-1296"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3403,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0020"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-279",
        "AIFACTORY-US-280"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-288]",
      "number": 288
    },
    {
      "id": "AIFACTORY-TASK-1293",
      "type": "task",
      "parent": "AIFACTORY-US-288",
      "title": "Requests, responses and operations of the window query in the ServiceModel package",
      "sequence": "18.33.03.01",
      "description": "BEFORE DEVELOPMENT. Requests, responses and operations of the window query in the ServiceModel package. Expected output: `ConnectSoft.Saas.Metering.ServiceModel` declares the request and the paged response of the usage records of a window (the window with kind, start, end and state, the total with its running mark, the records with idempotency key, quantity, time of occurrence, source and window identifier, and the continuation token), the request and the response of the list of closed windows, and both operations on the REST and the code first gRPC service interfaces, with the 400 and 404 answers documented on the REST and gRPC pages of the template.. Kind: contract. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`ConnectSoft.Saas.Metering.ServiceModel` declares the request and the paged response of the usage records of a window (the window with kind, start, end and state, the total with its running mark, the records with idempotency key, quantity, time of occurrence, source and window identifier, and the continuation token), the request and the response of the list of closed windows, and both operations on the REST and the code first gRPC service interfaces, with the 400 and 404 answers documented on the REST and gRPC pages of the template."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3403,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1293]",
      "number": 1293
    },
    {
      "id": "AIFACTORY-TASK-1294",
      "type": "task",
      "parent": "AIFACTORY-US-288",
      "title": "Window query in the REST controller and the gRPC service over a tenant filtered, paged read",
      "sequence": "18.33.03.02",
      "description": "BEFORE DEVELOPMENT. Window query in the REST controller and the gRPC service over a tenant filtered, paged read. Expected output: The usage meters controller and the gRPC service implement the two operations over a read of the usage record and window tables that is filtered by the tenant context, ordered by time of occurrence and key, paged by a continuation token and bounded by the page size limit of the options; a window of another tenant, an unknown identifier and an unknown dimension are answered 404, and nothing is written.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The usage meters controller and the gRPC service implement the two operations over a read of the usage record and window tables that is filtered by the tenant context, ordered by time of occurrence and key, paged by a continuation token and bounded by the page size limit of the options; a window of another tenant, an unknown identifier and an unknown dimension are answered 404, and nothing is written."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1294]",
      "number": 1294
    },
    {
      "id": "AIFACTORY-TASK-1295",
      "type": "task",
      "parent": "AIFACTORY-US-288",
      "title": "Query tests over both transports with paging, a foreign tenant and an open window",
      "sequence": "18.33.03.03",
      "description": "BEFORE DEVELOPMENT. Query tests over both transports with paging, a foreign tenant and an open window. Expected output: Acceptance tests of the template seed two tenants with closed and open windows and call both operations over REST and gRPC: the sum of the pages equals the total, paging returns every record once while usage is recorded, a window of the other tenant is answered 404, a page size above the limit is refused with 400, the total of an open window is marked as running, and the list of closed windows is in closing order.. Kind: fixture. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Acceptance tests of the template seed two tenants with closed and open windows and call both operations over REST and gRPC: the sum of the pages equals the total, paging returns every record once while usage is recorded, a window of the other tenant is answered 404, a page size above the limit is refused with 400, the total of an open window is marked as running, and the list of closed windows is in closing order."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3403,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1295]",
      "number": 1295
    },
    {
      "id": "AIFACTORY-TASK-1296",
      "type": "task",
      "parent": "AIFACTORY-US-288",
      "title": "Verify the window query over REST and gRPC",
      "sequence": "18.33.03.04",
      "description": "BEFORE DEVELOPMENT. Verify the window query over REST and gRPC. Expected output: Run `dotnet test -c Release --no-build` on the template solution; the query tests over both transports pass and prove AC1 to AC4 of AIFACTORY-US-288 (ADR-0020, ADR-0015).. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the template solution; the query tests over both transports pass and prove AC1 to AC4 of AIFACTORY-US-288 (ADR-0020, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1296]",
      "number": 1296
    },
    {
      "id": "AIFACTORY-US-281",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-164",
      "title": "SaaS Metering template: the quota events carry the meter key Billing reads, and the inbound usage-reported topic is registered so that reported usage reaches the quota saga",
      "sequence": "18.33.04",
      "description": "As an asset maintainer, I want the two contracts that connect Metering to its neighbours to hold from end to end, so that reported usage is counted and a quota that is exceeded is understood by the service that acts on it. Two features of the gap backlog of the template carry its highest priority because they block the path from end to end. Feature saas-MET-F03 records that the inbound event `UsageReportedForQuotaInboundEvent` and the saga `UsageMeterQuotaEnforcementStateMachine` exist, and that the saga calls the record operation, but that `MeteringMassTransitTopology` registers three other inbound events and not this one, and that no topic constant exists, so a publisher has nothing to bind to. Feature saas-MET-F04 records that `QuotaExceededIntegrationEvent` and `QuotaThresholdCrossedIntegrationEvent` publish a property named `Dimension`, while the inbound contract of Billing expects `MeterKey`; the topic names already agree. The cross-cutting slice saas-INTEG-F02 of the same backlog names `MeterKey` as the name on the Metering events. This PBI closes both. The two quota events carry `MeterKey`; `Dimension` stays as a deprecated alias with the same value in the current version of the events, an additive change under the versioning rule of the events page of the template, so no second topic is needed. Golden files fix the serialised form of both events, and a contract test reads them back through the field Billing expects; the golden files are the fixture the Billing template consumes in its own inbound test. The inbound usage-reported topic gets its constant, its registration in the topology and its entry among the consumed events of the descriptor, with the canonical topic name of the published language. A test publishes a usage-reported message and finds the usage recorded once through the saga, with the idempotency key derived from the message identifier, and a second delivery of the message counted nowhere. The MassTransit topology is the transport of generated products and stays; what the Factory profile publishes is the next PBI. Kind: enabling. Traces: adrs: ADR-0012, ADR-0014, ADR-0020, ADR-0025. Depends on: AIFACTORY-US-279. Sources: model/components.yaml, model/template-parameters/connectsoft-saas-metering.yaml, docs/architecture/adr/0020-commercial-model.md, docs/architecture/adr/0012-messaging-port-and-transport-profiles.md.",
      "acceptanceCriteria": [
        "AC1: Given a quota that is exceeded and a threshold that is crossed, when the two quota events are serialised, then each carries `MeterKey` and the alias `Dimension` with the same value, each matches its golden file, and the contract test reads the meter identity through the field Billing expects (ADR-0020 decision 2, model/components.yaml).",
        "AC2: Given the topology and the descriptor of the template, when they are inspected, then the usage-reported inbound topic has a constant, a registration and an entry among the consumed events of the descriptor, and the descriptor drift test passes (ADR-0025 decision 2, ADR-0012).",
        "AC3: Given a publisher that sends a usage-reported message to the registered topic, when the saga consumes it, then the usage is recorded once with the key derived from the message identifier and the quota is evaluated; a second delivery of the same message changes no counter (ADR-0014 decision 3)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-607",
        "AIFACTORY-TASK-1261",
        "AIFACTORY-TASK-1262",
        "AIFACTORY-TASK-1263"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3404,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0020",
          "ADR-0025"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-279"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md"
      ],
      "titlePrefix": "[AIFACTORY-US-281]",
      "number": 281
    },
    {
      "id": "AIFACTORY-TASK-607",
      "type": "task",
      "parent": "AIFACTORY-US-281",
      "title": "Quota contract aligned with Billing and the inbound usage topology (saas-MET-F03, saas-MET-F04)",
      "sequence": "18.33.04.01",
      "description": "BEFORE DEVELOPMENT. Quota contract aligned with Billing and the inbound usage topology (saas-MET-F03, saas-MET-F04). Expected output: The quota events carry `MeterKey`, the field Billing deserializes, with `Dimension` kept as a deprecated alias, proven by golden files and a contract test that reads them through the field Billing expects; the UsageReportedForQuota inbound topic has its constant, and the events page of the template names the canonical field and the topic.. Kind: contract. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The quota events carry `MeterKey`, the field Billing deserializes, with `Dimension` kept as a deprecated alias, proven by golden files and a contract test that reads them through the field Billing expects; the UsageReportedForQuota inbound topic has its constant, and the events page of the template names the canonical field and the topic."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3404,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-607]",
      "number": 607
    },
    {
      "id": "AIFACTORY-TASK-1261",
      "type": "task",
      "parent": "AIFACTORY-US-281",
      "title": "Inbound usage-reported topic registered in the topology and the descriptor",
      "sequence": "18.33.04.02",
      "description": "BEFORE DEVELOPMENT. Inbound usage-reported topic registered in the topology and the descriptor. Expected output: `MeteringMassTransitTopology` registers the entity name of `UsageReportedForQuotaInboundEvent` under the topic constant, the descriptor lists the event among its consumed events, `PrepareQuotaTransitions` fills `MeterKey`, and the saga passes the key derived from the message identifier to the record operation.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "`MeteringMassTransitTopology` registers the entity name of `UsageReportedForQuotaInboundEvent` under the topic constant, the descriptor lists the event among its consumed events, `PrepareQuotaTransitions` fills `MeterKey`, and the saga passes the key derived from the message identifier to the record operation."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1261]",
      "number": 1261
    },
    {
      "id": "AIFACTORY-TASK-1262",
      "type": "task",
      "parent": "AIFACTORY-US-281",
      "title": "Golden files of the quota events and the saga test of reported usage",
      "sequence": "18.33.04.03",
      "description": "BEFORE DEVELOPMENT. Golden files of the quota events and the saga test of reported usage. Expected output: Golden JSON files of the two quota events are kept with the tests and published as a test artifact of the template pipeline for the Billing template to consume; a saga test publishes a usage-reported message twice and asserts one recorded usage and one quota evaluation.. Kind: fixture. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Golden JSON files of the two quota events are kept with the tests and published as a test artifact of the template pipeline for the Billing template to consume; a saga test publishes a usage-reported message twice and asserts one recorded usage and one quota evaluation."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3404,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1262]",
      "number": 1262
    },
    {
      "id": "AIFACTORY-TASK-1263",
      "type": "task",
      "parent": "AIFACTORY-US-281",
      "title": "Verify the quota contract and the inbound usage path",
      "sequence": "18.33.04.04",
      "description": "BEFORE DEVELOPMENT. Verify the quota contract and the inbound usage path. Expected output: Run `dotnet test -c Release --no-build` on the template solution; the golden file tests, the contract test of the meter key, the descriptor drift test and the saga test pass and prove AC1 to AC3 of AIFACTORY-US-281 (ADR-0020, ADR-0025).. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --no-build` on the template solution; the golden file tests, the contract test of the meter key, the descriptor drift test and the saga test pass and prove AC1 to AC3 of AIFACTORY-US-281 (ADR-0020, ADR-0025)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1263]",
      "number": 1263
    },
    {
      "id": "AIFACTORY-US-282",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-164",
      "title": "SaaS Metering template: under `UseFactoryProfile` the events keep the complete envelope base that a Factory consumer maps, leave through the Orleans outbox, and only allowed dimensions are counted",
      "sequence": "18.33.05",
      "description": "As an asset maintainer, I want the Metering service of the Factory to publish its events in the envelope and on the profile every Factory service uses, so that the usage reconciliation of the Factory correlates a meter event by tenant and run without a second envelope. The events page of the template (Docs/events.md of the template) names the common envelope of the metering events, tenant, aggregate identifier, aggregate version, schema version, correlation identifier and causation identifier, four topics, and delivery through the built-in outbox of MassTransit. The envelope has no time of occurrence, which the run event envelope requires, and no run. The amendment of ADR-0014 on envelopes per event family keeps a generic SaaS template on its own envelope base and has the Factory profile map it. That mapping is applied on receipt, in the inbox of the consuming Factory service, by the scope chain of the base template profile (AIFACTORY-US-227), as AIFACTORY-US-251 of the Tenants template records for its events. No outbound mapping exists in any PBI, so the Metering service does not write the run event envelope. The amendment of ADR-0028 on the Factory profile switch selects the Factory shape by the boolean parameter `UseFactoryProfile`, off by default. This PBI brings the parameter into the template as the symbol the base template defines, received through the `base-template` submodule: the submodule pointer moves to the base template that carries the symbol and the Orleans value of `MessagingModelType`, the template metadata is reconciled and `build/MaterializedDirectory.Packages.props` is regenerated. The envelope base of the four outbound events is completed with `occurredOn`, in every generation, as an added field of the current version. The usage record gains an optional run identifier beside its source, and the body of the usage-recorded event carries it when the record names one. With the parameter on, the four events keep that envelope base on the wire and are dispatched through the outbox of the Orleans messaging profile, committed with the counter change. The events page records the mapping table onto the run event envelope that the consuming service applies: `tenantId`, `schemaVersion`, `correlationId` and `causationId` map by name, `occurredOn` is `occurredAt`, the message identifier of the publication is `eventId`, the topic name is `eventType`, the messaging service name of the Metering service is `producer`, the event body is `payload`, the run identifier of the usage-recorded body is `runId`, and `aggregateId` with `aggregateVersion` gives the ordering key. The template adds no envelope type and no messaging code. The REST page of the template states that every endpoint requires a `tid` claim, and a workload token carries a service scope and no tenant claim. Under the profile the tenant a caller forwards is admitted into the tenant context the endpoints require when its workload token holds the service scope that names the Metering service; without that scope the call is refused with 403, and a usage meter of another tenant is answered 404. The profile also binds an allowed dimension option. The template takes a free string dimension per tenant today (`EnsureUsageMeterProvisionedRequest`), has no registry of dimensions and no unit, and counts in 64 bit integers (`UsageMeterDto.CounterValue`, `RecordUsageRequest.Delta`). Under the profile the option lists the allowed dimensions, each with its key and its unit, the smallest whole unit the integer counter counts in. It is bound and validated at start, a meter is provisioned and a usage is recorded only for a listed key, and another key is refused with 400; an empty list refuses the start. Without the profile the dimension stays the free string a product takes from its Products Catalog. With the parameter off, the template generates what it generates today: its own envelope on the MassTransit topology with the same topics, completed with `occurredOn`. Kind: enabling. Traces: services: CostUsageService; descriptors: run-event-envelope-v1; adrs: ADR-0012, ADR-0014, ADR-0015, ADR-0020, ADR-0024, ADR-0028. Depends on: AIFACTORY-US-279, AIFACTORY-US-280, AIFACTORY-US-281, feature:component-base-template-factory-profile, feature:contracts-package. Sources: model/components.yaml, model/template-parameters/connectsoft-saas-metering.yaml, model/services/control-plane/CostUsageService.yaml, docs/reference/schemas/run-event-envelope.schema.json, docs/reference/event-envelope.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given a Metering service generated with `UseFactoryProfile`, when a usage is recorded, a counter is rolled and a quota is crossed and exceeded, then each of the four events is serialised in the envelope base of the template, complete with `occurredOn`, the usage-recorded body carries the run identifier when the usage record names one, each event matches its golden file, and the mapping table of the events page names a source for every required field of `run-event-envelope-v1` (ADR-0014 decision 1 and its amendment on envelopes per event family, docs/reference/schemas/run-event-envelope.schema.json).",
        "AC2: Given the same service, when the unit of work of a record commits, then the outbox record of the event is committed with the counter change and dispatched through the Orleans messaging profile, and when it rolls back no record and no event exists; a consumer on the Orleans inbox that applies the mapping of AIFACTORY-US-227 reads the usage-recorded event with every required field of the run event envelope, and a second delivery of the same message identifier has no effect (ADR-0014 decisions 3 and 4, ADR-0024, ADR-0012).",
        "AC3: Given a workload token with the service scope that names the Metering service and no tenant claim, when the caller records usage for the tenant it forwards, then the forwarded tenant is admitted into the tenant context the endpoints require and the usage is counted for that tenant; without that scope the answer is 403, and a read of a usage meter of another tenant is answered 404 (ADR-0015 amendments on workload tokens and on a resource of another tenant).",
        "AC4: Given the allowed dimension option of the profile with a list of keys and units, when the service starts, then the list is bound and validated and an empty or malformed list refuses the start; a meter is provisioned and a usage is recorded for a listed key, a usage for another key is refused with 400 and changes nothing, and the meter of a listed dimension returns its unit (ADR-0020 decision 2, model/services/control-plane/CostUsageService.yaml).",
        "AC5: Given a generation without `UseFactoryProfile`, when its tests run, then the events carry the envelope base of the template with the added `occurredOn` on the MassTransit topology with unchanged topics, a dimension stays a free string, and the output of the default case equals the output before this PBI apart from that field and the work of the earlier PBIs (ADR-0028 amendment on the Factory profile switch, model/template-parameters/connectsoft-saas-metering.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/reference/event-envelope.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1264",
        "AIFACTORY-TASK-608",
        "AIFACTORY-TASK-1298",
        "AIFACTORY-TASK-1299",
        "AIFACTORY-TASK-1300",
        "AIFACTORY-TASK-1265",
        "AIFACTORY-TASK-1266"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0012",
          "ADR-0014",
          "ADR-0015",
          "ADR-0020",
          "ADR-0024",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-279",
        "AIFACTORY-US-280",
        "AIFACTORY-US-281",
        "feature:component-base-template-factory-profile",
        "feature:contracts-package"
      ],
      "source": [
        "model/components.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/reference/schemas/run-event-envelope.schema.json",
        "docs/reference/event-envelope.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-282]",
      "number": 282
    },
    {
      "id": "AIFACTORY-TASK-1264",
      "type": "task",
      "parent": "AIFACTORY-US-282",
      "title": "Base-template submodule moved to the base template with the Factory profile and the package snapshot regenerated",
      "sequence": "18.33.05.01",
      "description": "BEFORE DEVELOPMENT. Base-template submodule moved to the base template with the Factory profile and the package snapshot regenerated. Expected output: The `base-template` submodule of the Metering template points at the base template that carries `UseFactoryProfile` and the Orleans value of `MessagingModelType`, the template metadata of `connectsoft-saas-metering` offers both, `build/MaterializedDirectory.Packages.props` is regenerated and its check passes; no file inside the submodule is edited.. Kind: operations. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet new connectsoft-saas-metering --help lists UseFactoryProfile once | the package snapshot check passes and the authoring solution builds in Release.",
      "acceptanceCriteria": [
        "The `base-template` submodule of the Metering template points at the base template that carries `UseFactoryProfile` and the Orleans value of `MessagingModelType`, the template metadata of `connectsoft-saas-metering` offers both, `build/MaterializedDirectory.Packages.props` is regenerated and its check passes; no file inside the submodule is edited."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1264]",
      "number": 1264
    },
    {
      "id": "AIFACTORY-TASK-608",
      "type": "task",
      "parent": "AIFACTORY-US-282",
      "title": "Accepted envelope on the metering events",
      "sequence": "18.33.05.02",
      "description": "BEFORE DEVELOPMENT. Accepted envelope on the metering events. Expected output: The envelope base of every integration event of the template is completed with `occurredOn`, and the usage record and the usage-recorded body gain the optional run identifier; under `UseFactoryProfile` the events keep that base on the wire and are published through the outbox of the Orleans messaging profile; the events page records the mapping table onto the run event envelope (ADR-0014) that AIFACTORY-US-227 applies on receipt, so the usage reconciliation of the Factory (TASK-363) correlates by run and tenant; without the parameter the events change only by the added field.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The envelope base of every integration event of the template is completed with `occurredOn`, and the usage record and the usage-recorded body gain the optional run identifier; under `UseFactoryProfile` the events keep that base on the wire and are published through the outbox of the Orleans messaging profile; the events page records the mapping table onto the run event envelope (ADR-0014) that AIFACTORY-US-227 applies on receipt, so the usage reconciliation of the Factory (TASK-363) correlates by run and tenant; without the parameter the events change only by the added field."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-608]",
      "number": 608
    },
    {
      "id": "AIFACTORY-TASK-1298",
      "type": "task",
      "parent": "AIFACTORY-US-282",
      "title": "Forwarded tenant of a workload token admitted into the tenant context",
      "sequence": "18.33.05.03",
      "description": "BEFORE DEVELOPMENT. Forwarded tenant of a workload token admitted into the tenant context. Expected output: Under `UseFactoryProfile` the tenant a caller forwards is admitted into the tenant context the REST endpoints and the gRPC services require when the validated workload token holds the service scope that names the Metering service and no tenant claim; a workload token without that scope is refused with 403, and a user token keeps the `tid` claim as its only source of the tenant.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` the tenant a caller forwards is admitted into the tenant context the REST endpoints and the gRPC services require when the validated workload token holds the service scope that names the Metering service and no tenant claim; a workload token without that scope is refused with 403, and a user token keeps the `tid` claim as its only source of the tenant."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1298]",
      "number": 1298
    },
    {
      "id": "AIFACTORY-TASK-1299",
      "type": "task",
      "parent": "AIFACTORY-US-282",
      "title": "Allowed dimension option of the Factory profile with key and unit",
      "sequence": "18.33.05.04",
      "description": "BEFORE DEVELOPMENT. Allowed dimension option of the Factory profile with key and unit. Expected output: The options project declares the allowed dimension option with one entry per dimension, its key and its unit, and its validator; the provisioning and record contracts document the 400 answer for a key outside the list, the meter response carries the unit, and the configuration page of the template describes the option and that it is bound only under `UseFactoryProfile`.. Kind: contract. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The options project declares the allowed dimension option with one entry per dimension, its key and its unit, and its validator; the provisioning and record contracts document the 400 answer for a key outside the list, the meter response carries the unit, and the configuration page of the template describes the option and that it is bound only under `UseFactoryProfile`."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:contract",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1299]",
      "number": 1299
    },
    {
      "id": "AIFACTORY-TASK-1300",
      "type": "task",
      "parent": "AIFACTORY-US-282",
      "title": "Allowed dimensions bound at start and enforced on provisioning and recording",
      "sequence": "18.33.05.05",
      "description": "BEFORE DEVELOPMENT. Allowed dimensions bound at start and enforced on provisioning and recording. Expected output: Under `UseFactoryProfile` the allowed dimension option is bound and validated at start and an empty or malformed list refuses the start; `EnsureUsageMeterProvisionedRequest` and the record path accept only a listed key and refuse another with 400 before any counter changes; without the profile the dimension stays a free string.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Under `UseFactoryProfile` the allowed dimension option is bound and validated at start and an empty or malformed list refuses the start; `EnsureUsageMeterProvisionedRequest` and the record path accept only a listed key and refuse another with 400 before any counter changes; without the profile the dimension stays a free string."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1300]",
      "number": 1300
    },
    {
      "id": "AIFACTORY-TASK-1265",
      "type": "task",
      "parent": "AIFACTORY-US-282",
      "title": "Golden files, the mapped consumer test on the Orleans inbox, the workload scope tests and the allowed dimension tests",
      "sequence": "18.33.05.06",
      "description": "BEFORE DEVELOPMENT. Golden files, the mapped consumer test on the Orleans inbox, the workload scope tests and the allowed dimension tests. Expected output: The acceptance suite of the Factory case holds a golden JSON file per event in the envelope base of the template, a consumer that applies the mapping and reads a usage-recorded event from the Orleans inbox with every required field of the run event envelope, a duplicate delivery test, a rollback test, tests of a workload token with and without the service scope and of a read across tenants, and tests of the allowed dimension option with a listed key, another key and an empty list.. Kind: fixture. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The acceptance suite of the Factory case holds a golden JSON file per event in the envelope base of the template, a consumer that applies the mapping and reads a usage-recorded event from the Orleans inbox with every required field of the run event envelope, a duplicate delivery test, a rollback test, tests of a workload token with and without the service scope and of a read across tenants, and tests of the allowed dimension option with a listed key, another key and an empty list."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1265]",
      "number": 1265
    },
    {
      "id": "AIFACTORY-TASK-1266",
      "type": "task",
      "parent": "AIFACTORY-US-282",
      "title": "Verify the envelope on the Factory profile and the unchanged default",
      "sequence": "18.33.05.07",
      "description": "BEFORE DEVELOPMENT. Verify the envelope on the Factory profile and the unchanged default. Expected output: Generate the template with `UseFactoryProfile` and without it, build both in Release and run their tests; the golden file, mapped consumer, duplicate, rollback, scope and allowed dimension tests pass on the Factory case and the default case keeps its envelope base and topics, which proves AC1 to AC5 of AIFACTORY-US-282 (ADR-0014, ADR-0028).. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "Generate the template with `UseFactoryProfile` and without it, build both in Release and run their tests; the golden file, mapped consumer, duplicate, rollback, scope and allowed dimension tests pass on the Factory case and the default case keeps its envelope base and topics, which proves AC1 to AC5 of AIFACTORY-US-282 (ADR-0014, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3405,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1266]",
      "number": 1266
    },
    {
      "id": "AIFACTORY-US-283",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-164",
      "title": "SaaS Metering template: the packed template passes the default case and the Factory profile case of the shared template pipeline, descriptor validated, before the package publishes",
      "sequence": "18.33.06",
      "description": "As an asset maintainer, I want every change of the Metering template gated by its generated cases, so that a package that would generate a service which counts a usage twice never reaches the feed. This PBI is the gate of the feature. The estate gates its templates with the shared template pipeline of ConnectSoft.AzurePipelines (`template-ci/v1`), whose rollout ledger lists the Metering template as pending, and the template has no manifest for it yet. The amendment of ADR-0028 on the Factory profile switch has the shared pipeline admit one additional gating case per declared profile beside the default case. This PBI adopts the mechanism. A manifest `build/template-ci.json` declares the default case, generated with MassTransit as the template does today, and the Factory profile case, generated with `UseFactoryProfile`. The validator of the descriptor in each case is the descriptor drift test of AIFACTORY-TASK-1292, which compares the descriptor with the code and validates it against its schema. The script `build/regenerate.ps1` is not that validator: without a Factory endpoint it only parses the descriptor as JSON, so it stays in the cases as the parse it is and decides nothing about drift. The manifest names the test filter of each case and the services it needs, SQL Server for the store and the outbox, the broker of the default case and a co-hosted silo for the Factory case. The template pipeline imports the shared installer jobs: the candidate is packed once and installed, each case is generated, its descriptor is validated by the drift test, the solution is restored and built in Release, its tests run with the discovery and completion checks, the idempotency, window, window query, quota contract, envelope and allowed dimension tests among them, and the dependency audit runs. A descriptor that differs from the code, a usage that is counted twice or an incomplete run fails the run with the case and the stage named, and the package is not published. Publication requires the complete reports of both cases bound to the candidate and pushes a version that is not yet on the ConnectSoft feed. This is an evidence PBI (D113): a template feature has no scenario, so the gate names what it proves through its ADRs, the requirement on release gates and its sources: the measurement of ADR-0020, the descriptor of ADR-0025 and the generated-solution gate the epic requires, before the metering integration feature exports the first usage. Kind: evidence. Traces: adrs: ADR-0020, ADR-0025, ADR-0028; requirements: FR-11. Depends on: AIFACTORY-US-279, AIFACTORY-US-280, AIFACTORY-US-281, AIFACTORY-US-282, AIFACTORY-US-288, feature:component-base-template-findings. Sources: model/components.yaml, model/backlog/epics.yaml, model/template-parameters/connectsoft-saas-metering.yaml, docs/architecture/catalogs/templates.md, docs/architecture/adr/0025-saas-descriptor-import.md.",
      "acceptanceCriteria": [
        "AC1: Given a change of the Metering template, when its template pipeline runs the shared installer jobs with `build/template-ci.json`, then the candidate is packed once and installed, the default case and the Factory profile case are generated, the descriptor of each is validated by the descriptor drift test against the code and against `ConnectSoft.Saas.Metering.schema.json`, each is restored and built in Release, its tests run with the discovery and completion checks against the services the manifest declares, the window query tests among them in both cases, and the dependency audit runs (FR-11, ADR-0025 decision 2, ADR-0028 amendment on the Factory profile switch).",
        "AC2: Given a planted extra descriptor property, which is valid JSON and passes the parse of `build/regenerate.ps1`, a planted removal of the deduplication index or an incomplete run, when the pipeline evaluates the run, then the descriptor drift test fails the first with the member named, the triple delivery test fails the second, and each run fails with the case and the stage named and the package is not published (FR-11, ADR-0020 decision 3).",
        "AC3: Given complete reports of both cases bound to the candidate, when the publication job runs, then the package is pushed to the ConnectSoft feed with a version that was not on it, a fresh install of that version generates a Metering service with `UseFactoryProfile` whose tests pass unchanged, and model/template-parameters/connectsoft-saas-metering.yaml lists the parameter after the next template inventory (ADR-0028, model/backlog/epics.yaml states the gate as the completion of the epic)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0025-saas-descriptor-import.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1267",
        "AIFACTORY-TASK-1268",
        "AIFACTORY-TASK-1269",
        "AIFACTORY-TASK-1270"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3406,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0020",
          "ADR-0025",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-279",
        "AIFACTORY-US-280",
        "AIFACTORY-US-281",
        "AIFACTORY-US-282",
        "AIFACTORY-US-288",
        "feature:component-base-template-findings"
      ],
      "source": [
        "model/components.yaml",
        "model/backlog/epics.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/catalogs/templates.md",
        "docs/architecture/adr/0025-saas-descriptor-import.md"
      ],
      "titlePrefix": "[AIFACTORY-US-283]",
      "number": 283
    },
    {
      "id": "AIFACTORY-TASK-1267",
      "type": "task",
      "parent": "AIFACTORY-US-283",
      "title": "Shared template pipeline manifest of the Metering template with the default and the Factory profile cases",
      "sequence": "18.33.06.01",
      "description": "BEFORE DEVELOPMENT. Shared template pipeline manifest of the Metering template with the default and the Factory profile cases. Expected output: `build/template-ci.json` of the Metering template declares the package, the solutions and the tests, the default case and the Factory profile case with the descriptor drift test of AIFACTORY-TASK-1292 as the descriptor validator of each and `build/regenerate.ps1` only as the parse of the descriptor, the test filter of each case, which includes the window query tests, and the required services SQL Server, the broker of the default case and a silo for the Factory case; `azure-pipelines-template.yml` imports the shared installer jobs.. Kind: operations. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: azure-pipelines-template.yml runs both cases through the shared installer jobs and the run is green.",
      "acceptanceCriteria": [
        "`build/template-ci.json` of the Metering template declares the package, the solutions and the tests, the default case and the Factory profile case with the descriptor drift test of AIFACTORY-TASK-1292 as the descriptor validator of each and `build/regenerate.ps1` only as the parse of the descriptor, the test filter of each case, which includes the window query tests, and the required services SQL Server, the broker of the default case and a silo for the Factory case; `azure-pipelines-template.yml` imports the shared installer jobs."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3406,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1267]",
      "number": 1267
    },
    {
      "id": "AIFACTORY-TASK-1268",
      "type": "task",
      "parent": "AIFACTORY-US-283",
      "title": "Planted descriptor difference and planted double count for the gate",
      "sequence": "18.33.06.02",
      "description": "BEFORE DEVELOPMENT. Planted descriptor difference and planted double count for the gate. Expected output: Pipeline fixtures plant an extra descriptor property, which passes the parse of `build/regenerate.ps1` and which the descriptor drift test must fail with the member named, and a removed deduplication index, which the triple delivery test must fail, and assert that each run fails at its stage with the case named and that publication is not reached.. Kind: fixture. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: each planted run stops before publication.",
      "acceptanceCriteria": [
        "Pipeline fixtures plant an extra descriptor property, which passes the parse of `build/regenerate.ps1` and which the descriptor drift test must fail with the member named, and a removed deduplication index, which the triple delivery test must fail, and assert that each run fails at its stage with the case named and that publication is not reached."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3406,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1268]",
      "number": 1268
    },
    {
      "id": "AIFACTORY-TASK-1269",
      "type": "task",
      "parent": "AIFACTORY-US-283",
      "title": "Publication bound to the complete reports of both cases",
      "sequence": "18.33.06.03",
      "description": "BEFORE DEVELOPMENT. Publication bound to the complete reports of both cases. Expected output: The publication job of the template pipeline requires the complete reports of the default case and the Factory profile case bound to the candidate; a missing or failed stage, an incomplete report or a version that is already on the ConnectSoft feed refuses publication with the reason.. Kind: operations. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: a run with an incomplete report or a repeated version is refused at publication.",
      "acceptanceCriteria": [
        "The publication job of the template pipeline requires the complete reports of the default case and the Factory profile case bound to the candidate; a missing or failed stage, an incomplete report or a version that is already on the ConnectSoft feed refuses publication with the reason."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:operations",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3406,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1269]",
      "number": 1269
    },
    {
      "id": "AIFACTORY-TASK-1270",
      "type": "task",
      "parent": "AIFACTORY-US-283",
      "title": "Verify the gate of the Metering template on a green and on the planted runs",
      "sequence": "18.33.06.04",
      "description": "BEFORE DEVELOPMENT. Verify the gate of the Metering template on a green and on the planted runs. Expected output: One green run publishes the package and a fresh install generates a Metering service with `UseFactoryProfile` whose tests pass; the two planted runs fail before publication; together they prove AC1 to AC3 of AIFACTORY-US-283 (FR-11, ADR-0020, ADR-0025).. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "One green run publishes the package and a fresh install generates a Metering service with `UseFactoryProfile` whose tests pass; the two planted runs fail before publication; together they prove AC1 to AC3 of AIFACTORY-US-283 (FR-11, ADR-0020, ADR-0025)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3406,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1270]",
      "number": 1270
    },
    {
      "id": "AIFACTORY-US-128",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-164",
      "title": "SaaS Metering template: idempotent usage, windows and the quota contract before usage export is delivered and proven on a generated solution",
      "sequence": "18.33.07",
      "description": "As an asset maintainer, I want SaaS Metering service to carry idempotent usage, windows and the quota contract before usage export, so that it serves usage meters and quotas (BC-05/BC-34) without later rework. This is the integration PBI of the feature. With the idempotent usage record, the windows, the query of the usage records of a window, the quota contract with the inbound usage topic, the Factory profile of the events and the gate of the earlier PBIs, the Metering template generates a service the usage export of the Factory can rely on. An exporter records a usage with an idempotency key and may repeat the call: the counter grows once and the answer is the first result. The usage is counted in a window that follows the subscription period, a roll or the passed boundary of a Fixed window closes the window and opens the next, and the threshold and quota events name the window and the meter key Billing reads. A caller reads the usage records and the total of a window back, page by page. Usage reported on the registered inbound topic reaches the quota saga. A service generated with `UseFactoryProfile` publishes its events in the complete envelope base of the template through the Orleans messaging profile, a Factory consumer maps them onto the run event envelope on receipt, and the service counts only the dimensions its allowed dimension option lists; a service generated without the parameter keeps the envelope and the MassTransit topology of the template and a free dimension. The descriptor is held to the code by the descriptor drift test. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature. The feature is done when the packed template passes its default case and its Factory profile case in the shared template pipeline with the descriptor validated and the package is on the ConnectSoft feed, which is what the metering integration feature of this increment depends on before it exports the first usage record. Kind: enabling. Traces: services: CostUsageService; adrs: ADR-0014, ADR-0020, ADR-0025. Depends on: AIFACTORY-US-279, AIFACTORY-US-280, AIFACTORY-US-281, AIFACTORY-US-282, AIFACTORY-US-283, AIFACTORY-US-288. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/adr/0020-commercial-model.md.",
      "acceptanceCriteria": [
        "AC1: Given the template repository ConnectSoft.Saas.MeteringTemplate 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-0020, model/components.yaml).",
        "AC2: Given the work of AIFACTORY-TASK-605 (usage record with an idempotency key, saas-MET-F01) is done, then RecordUsage carries a usage record with a caller-supplied idempotency key, a repeated record with the same key changes no counter and returns the first result, and a test delivers the same record three times (ADR-0014 decision 3).",
        "AC3: Given the work of AIFACTORY-TASK-606 (window semantics aligned with the subscription period, saas-MET-F02) is done, then a counter belongs to a window, a roll or the passed boundary of a Fixed window closes the window and opens the next, threshold and quota events carry the window id, and a rating-window event from Billing opens the window the invoice period needs (ADR-0020 decision 3).",
        "AC4: Given the work of AIFACTORY-TASK-607 (quota contract aligned with Billing and the inbound usage topology, saas-MET-F03 and saas-MET-F04) is done, then the quota events carry the field Billing deserializes, proven by a contract test over golden files, and the UsageReportedForQuota inbound topic is registered in the topology and the descriptor so reported usage reaches the quota saga (ADR-0025 decision 2).",
        "AC5: Given the work of AIFACTORY-TASK-608 (accepted envelope on the metering events) is done, then every integration event of the template carries the complete envelope base with `occurredOn`, the usage-recorded body carries the run when the record names one, the events page records the mapping onto the run event envelope that the consuming Factory service applies on receipt, and under `UseFactoryProfile` the events leave through the outbox of the Orleans messaging profile, so the usage reconciliation of the Factory correlates by run and tenant; without the parameter the events change only by the added field (ADR-0014 amendment on envelopes per event family)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1271",
        "AIFACTORY-TASK-689"
      ],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3407,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020",
          "ADR-0025"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-279",
        "AIFACTORY-US-280",
        "AIFACTORY-US-281",
        "AIFACTORY-US-282",
        "AIFACTORY-US-283",
        "AIFACTORY-US-288"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "titlePrefix": "[AIFACTORY-US-128]",
      "number": 128
    },
    {
      "id": "AIFACTORY-TASK-1271",
      "type": "task",
      "parent": "AIFACTORY-US-128",
      "title": "Gap backlog and gap analysis pages of the template record the closed items",
      "sequence": "18.33.07.01",
      "description": "BEFORE DEVELOPMENT. Gap backlog and gap analysis pages of the template record the closed items. Expected output: The gap backlog and the gap analysis pages of the template mark saas-MET-F01 to saas-MET-F04 as closed with the tests that prove each, state what `UseFactoryProfile` adds on top of them, and leave saas-MET-F05 to saas-MET-F09 as the open items they are.. Kind: documentation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: the documentation pipeline of the template builds its site without warnings.",
      "acceptanceCriteria": [
        "The gap backlog and the gap analysis pages of the template mark saas-MET-F01 to saas-MET-F04 as closed with the tests that prove each, state what `UseFactoryProfile` adds on top of them, and leave saas-MET-F05 to saas-MET-F09 as the open items they are."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:documentation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3407,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1271]",
      "number": 1271
    },
    {
      "id": "AIFACTORY-TASK-689",
      "type": "task",
      "parent": "AIFACTORY-US-128",
      "title": "Verify saas-metering-template-delivered by running the declared command",
      "sequence": "18.33.07.02",
      "description": "BEFORE DEVELOPMENT. Verify saas-metering-template-delivered by running the declared command. Expected output: Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on the default and Factory profile cases generated from the published package; they pass and prove AC1 to AC5 of AIFACTORY-US-128.. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "Run `dotnet build -c Release` and `dotnet test -c Release --no-build` on the authoring solution and on the default and Factory profile cases generated from the published package; they pass and prove AC1 to AC5 of AIFACTORY-US-128."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "ConnectSoft.Saas.MeteringTemplate/Docs/backlog/metering-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:before-development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 34,
      "phase": "templates-and-libraries",
      "stackRank": 3407,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-689]",
      "number": 689
    },
    {
      "id": "AIFACTORY-FEAT-102",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Metering integration for usage accounting",
      "sequence": "18.34",
      "description": "Usage that CostUsageService records is exported to the SaaS Metering service in its units, so that budgets and invoices use one measurement. Component: SaaS Metering service (extend). Depends on: AIFACTORY-FEAT-164. Increment I4: Trust and accountability. Build order 135 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-289",
        "AIFACTORY-US-284",
        "AIFACTORY-US-290",
        "AIFACTORY-US-285",
        "AIFACTORY-US-286",
        "AIFACTORY-US-287",
        "AIFACTORY-US-088"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13500,
      "titlePrefix": "[AIFACTORY-FEAT-102]",
      "number": 102
    },
    {
      "id": "AIFACTORY-US-289",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-102",
      "title": "Metering integration: the ServiceModel package of the Metering service offers a typed client for record usage and the window query with typed outcomes and is published to the ConnectSoft feed",
      "sequence": "18.34.01",
      "description": "As an asset maintainer, I want a typed client for record usage and for the window query in the package the Metering service publishes its contracts in, so that CostUsageService reaches the Metering service by a version pin and no Factory repository writes its own client or copies a contract. The REST page of the Metering template states that the contracts and the typed client facades of the service live in the package `ConnectSoft.Saas.Metering.ServiceModel`. The project holds requests, responses and the two service interfaces today and no client facade, and the service model pipeline of the template, `azure-pipelines-service-model.yml`, has a build, a pack and a push step and no test. CostUsageService must reach the Metering service by a version pin and without copying a type, and it can pin only what is on the feed, so the package has to be published before the export is built. The Tenants integration has a PBI for exactly this (AIFACTORY-US-255), and this PBI follows it. It adds a client facade to the package for REST and for the code first gRPC client with three operations: record usage with its idempotency key, the query of the usage records and the total of one window that AIFACTORY-US-288 of the feature `component-saas-metering-template` declares, and its list of closed windows. The facade takes the transport the consumer configured, with the workload token of the consumer, the forwarded tenant and the propagation of correlation and trace context, and adds no authentication, no retry and no cache of its own. It returns typed outcomes and never an exception for an answer of the service: the recorded usage with its window and the start of that window, the conflict of a key with a different quantity with both quantities, the refusal of an invalid record or of a dimension that is not allowed with the reason, the unknown window, and the failure to reach the service, which is never turned into one of the others. Contract tests in the template run the facade against a Metering service generated from the packed template over both transports, so that the client and the service cannot drift apart inside one package version. The service model pipeline gains a test step that runs them, publishes the package to the ConnectSoft feed only after they pass and refuses a version that is already on the feed. The published version is recorded on the documentation of the template, because the model of this repository holds no package versions. Kind: enabling. Traces: adrs: ADR-0014, ADR-0015, ADR-0020, ADR-0028; requirements: FR-11. Depends on: feature:component-saas-metering-template. Sources: model/components.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0020-commercial-model.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the client facade of the ServiceModel package and a Metering service generated from the packed template, when a usage is recorded three times with one idempotency key over REST and over gRPC, then every call returns the typed recorded outcome with the same window and its start and the service counted once; a record with the same key and another quantity returns the typed conflict with both quantities, and an invalid record or a dimension outside the allowed list returns the typed refusal with the reason (ADR-0014 decision 3, ADR-0020 decision 2).",
        "AC2: Given usage records in a closed window, when the facade queries the window and lists the closed windows over both transports, then it returns the pages, the total and the windows as the service holds them, an unknown window and a window of another tenant are the typed unknown window, and a service that cannot be reached is the typed failure and never an empty window (ADR-0020 decision 3, ADR-0015 amendment on a resource of another tenant).",
        "AC3: Given the facade, when a consumer configures its transport with a workload token, a forwarded tenant and trace context, then the call carries all three unchanged, the facade holds no cache, no retry and no credential, and the contract tests of the template fail when the facade and the service contract differ (ADR-0028, ADR-0015 amendment on workload tokens).",
        "AC4: Given the service model pipeline of the Metering template, when it runs, then the package builds, the contract tests of the facade pass in its test step, and the package is published to the ConnectSoft feed; a failing test or a version that is already on the feed refuses publication with the reason, and the documentation of the template records the published version (FR-11, ADR-0028, model/components.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1301",
        "AIFACTORY-TASK-1302",
        "AIFACTORY-TASK-1282",
        "AIFACTORY-TASK-1303"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13501,
      "kind": "enabling",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0020",
          "ADR-0028"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:component-saas-metering-template"
      ],
      "source": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-289]",
      "number": 289
    },
    {
      "id": "AIFACTORY-TASK-1301",
      "type": "task",
      "parent": "AIFACTORY-US-289",
      "title": "Typed client facade for record usage and the window query over REST and gRPC in the ServiceModel package",
      "sequence": "18.34.01.01",
      "description": "Typed client facade for record usage and the window query over REST and gRPC in the ServiceModel package. Expected output: The package `ConnectSoft.Saas.Metering.ServiceModel` holds a client facade for REST and for the code first gRPC client with record usage, the query of the usage records of a window and the list of closed windows, and typed outcomes for the recorded usage with its window, the conflict, the refusal, the unknown window and the failure; it takes the configured transport of the consumer and holds no cache, retry or credential.. Kind: implementation. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The package `ConnectSoft.Saas.Metering.ServiceModel` holds a client facade for REST and for the code first gRPC client with record usage, the query of the usage records of a window and the list of closed windows, and typed outcomes for the recorded usage with its window, the conflict, the refusal, the unknown window and the failure; it takes the configured transport of the consumer and holds no cache, retry or credential."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1301]",
      "number": 1301
    },
    {
      "id": "AIFACTORY-TASK-1302",
      "type": "task",
      "parent": "AIFACTORY-US-289",
      "title": "Contract tests of the facade against a service generated from the packed template",
      "sequence": "18.34.01.02",
      "description": "Contract tests of the facade against a service generated from the packed template. Expected output: Tests of the template run the facade against a Metering service generated from the packed template over both transports for a triple delivery, a conflict, an invalid record, a dimension that is not allowed, a closed window with several pages, a window of another tenant and a stopped service, and assert the typed outcome of each.. Kind: fixture. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "Tests of the template run the facade against a Metering service generated from the packed template over both transports for a triple delivery, a conflict, an invalid record, a dimension that is not allowed, a closed window with several pages, a window of another tenant and a stopped service, and assert the typed outcome of each."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13501,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1302]",
      "number": 1302
    },
    {
      "id": "AIFACTORY-TASK-1282",
      "type": "task",
      "parent": "AIFACTORY-US-289",
      "title": "ServiceModel package of the Metering service tested and published with a version guard",
      "sequence": "18.34.01.03",
      "description": "ServiceModel package of the Metering service tested and published with a version guard. Expected output: `azure-pipelines-service-model.yml` of the Metering template gains a test step that runs the contract tests of the facade, publishes `ConnectSoft.Saas.Metering.ServiceModel` with the idempotent record contract, the window query and the typed client to the ConnectSoft feed only after the tests pass, refuses a version that is already on the feed, and the documentation of the template records the published version.. Kind: operations. Repository: ConnectSoft.Saas.MeteringTemplate. Verification: azure-pipelines-service-model.yml runs its test step, publishes after the tests and refuses a repeated version.",
      "acceptanceCriteria": [
        "`azure-pipelines-service-model.yml` of the Metering template gains a test step that runs the contract tests of the facade, publishes `ConnectSoft.Saas.Metering.ServiceModel` with the idempotent record contract, the window query and the typed client to the ConnectSoft feed only after the tests pass, refuses a version that is already on the feed, and the documentation of the template records the published version."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13501,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1282]",
      "number": 1282
    },
    {
      "id": "AIFACTORY-TASK-1303",
      "type": "task",
      "parent": "AIFACTORY-US-289",
      "title": "Verify the typed outcomes of the facade and the published package",
      "sequence": "18.34.01.04",
      "description": "Verify the typed outcomes of the facade and the published package. Expected output: Run the contract tests of the facade and one run of the service model pipeline; the seven cases return their typed outcomes over both transports, the package is on the ConnectSoft feed and a second run with the same version is refused, which proves AC1 to AC4 of AIFACTORY-US-289 (FR-11, ADR-0020).. Kind: verification. Repository: ConnectSoft.Saas.MeteringTemplate.",
      "acceptanceCriteria": [
        "Run the contract tests of the facade and one run of the service model pipeline; the seven cases return their typed outcomes over both transports, the package is on the ConnectSoft feed and a second run with the same version is refused, which proves AC1 to AC4 of AIFACTORY-US-289 (FR-11, ADR-0020)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.Saas.MeteringTemplate"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1303]",
      "number": 1303
    },
    {
      "id": "AIFACTORY-US-284",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-102",
      "title": "Metering integration: the seven Factory meters are dimensions of the Metering service with declared units, and CostUsageService reaches the service through its pinned ServiceModel client",
      "sequence": "18.34.02",
      "description": "As an operator, I want every Factory meter to have one dimension and one unit in the Metering service, so that a quantity the Factory observed means the same in a budget and in an invoice. CostUsageService records usage on seven meters, `ModelTokens`, `RunsAccepted`, `RunsCompleted`, `ToolInvocations`, `SandboxMinutes`, `StorageGb` and `ProductCapacity`, each with a decimal quantity, a pricing revision and a status (model/services/control-plane/CostUsageService.yaml). The Metering service counts a delta per tenant and dimension, and its counter and its delta are 64 bit integers. ADR-0020 decision 2 implements the commercial model by extending the SaaS templates so that budgets and invoices read one measurement, and docs/architecture/ecosystem-composition.md lists Factory-specific meters among what the SaaS services need once their gaps are closed. Nothing states today which dimension and which unit a Factory meter is, or how CostUsageService reaches the Metering service. This PBI settles both. A meter map in CostUsageService holds, for every value of the `Meter` enumeration, the dimension key of the Metering service, the unit of that dimension and the factor that converts the Factory quantity into it. Because the counter is an integer, the unit of each dimension is its smallest whole unit, so that a decimal quantity of the Factory becomes a whole number of units. A meter without an entry stops the service at start with the meter named. A quantity the factor cannot express as a whole number of the unit is never rounded: its export row takes the state Refused with the reason that the conversion is not exact, nothing is sent, and the row is listed by the meter reconciliation. The Metering template has no registry of dimensions; under `UseFactoryProfile` it binds the allowed dimension option that AIFACTORY-US-282 of the feature `component-saas-metering-template` delivers behind the gate of the template, and refuses usage for a key outside it. This PBI changes nothing in the template, so the template does not pass its gate a second time: the seven entries of the map, key and unit, become the configuration of that option in the repository `ConnectSoft.AI.SoftwareFactory.MeteringService`, where AIFACTORY-US-290 scaffolds, configures and deploys the Factory instance of the Metering service (D115). The concrete unit and conversion factor of each of the seven dimensions are an owner input; this PBI fixes the rule and the shape of the map and names no value. CostUsageService takes the contracts and the typed client of the Metering service from the package `ConnectSoft.Saas.Metering.ServiceModel` at the version AIFACTORY-US-289 published, and copies no type. It calls with its workload token, which carries a service scope and no tenant claim, and forwards the tenant of the usage record; the Metering service admits that tenant only because the token holds the service scope that names it. The model lists the library `ConnectSoft.Extensions.Saas.Metering` for the service; its README describes marker interfaces for tenant scoped metering adapters, and the export adapter of this feature implements them, so the entry of the model stays; CostUsageService does not host that library as its meter store, because the meter store is the Factory Metering service behind the typed client (D115). A Factory tenant is the tenant of the Factory instance of the Metering service; the meters of a generated product live in the stores of the product (ADR-0020 decision 4) and are not touched here. Kind: enabling. Traces: services: CostUsageService; adrs: ADR-0015, ADR-0020, ADR-0028. Depends on: AIFACTORY-US-289, feature:component-saas-metering-template, feature:cost-usage-service-complete. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0020-commercial-model.md, docs/architecture/commercial-model.md.",
      "acceptanceCriteria": [
        "AC1: Given the meter map of CostUsageService, when the service starts, then every value of the `Meter` enumeration of model/services/control-plane/CostUsageService.yaml has a dimension key, a unit that is the smallest whole unit of the dimension and a conversion factor, and a meter without an entry stops the start with the meter named; a quantity that is no whole number of its unit after conversion is not rounded and its export row becomes Refused with the reason that the conversion is not exact (ADR-0020 decision 2).",
        "AC2: Given a Metering service generated with `UseFactoryProfile` whose allowed dimension option holds the seven entries of the meter map, when the service starts and its meters are read, then the seven Factory dimensions are accepted with the units of the meter map, and a usage for a dimension outside them is refused with 400; a contract test compares the keys and units the service returns with the map and fails on a difference, and the same seven entries are the configuration of the Factory instance that AIFACTORY-US-290 deploys (ADR-0020 decision 2, docs/architecture/ecosystem-composition.md).",
        "AC3: Given CostUsageService with the ServiceModel package at the version AIFACTORY-US-289 published, when it calls the Metering service, then it uses the typed client with a workload token that carries the service scope and no tenant claim and forwards the tenant of the usage record, its export adapter implements the tenant scope marker interfaces of `ConnectSoft.Extensions.Saas.Metering`, and an architecture test finds no copied contract type of the Metering service in the solution (ADR-0015 amendment on workload tokens, ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1272",
        "AIFACTORY-TASK-1273",
        "AIFACTORY-TASK-1274"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13502,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0020",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-289",
        "feature:component-saas-metering-template",
        "feature:cost-usage-service-complete"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md"
      ],
      "titlePrefix": "[AIFACTORY-US-284]",
      "number": 284
    },
    {
      "id": "AIFACTORY-TASK-1272",
      "type": "task",
      "parent": "AIFACTORY-US-284",
      "title": "Meter map of the seven Factory meters with dimension, unit and factor",
      "sequence": "18.34.02.01",
      "description": "Meter map of the seven Factory meters with dimension, unit and factor. Expected output: CostUsageService holds a validated meter map with one entry per value of the `Meter` enumeration: the dimension key, the unit, which is the smallest whole unit of the dimension because the Metering counter is an integer, and the conversion factor; start fails on a missing entry with the meter named, and a conversion that gives no whole number of the unit is refused and never rounded; the map is documented on the service page.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "CostUsageService holds a validated meter map with one entry per value of the `Meter` enumeration: the dimension key, the unit, which is the smallest whole unit of the dimension because the Metering counter is an integer, and the conversion factor; start fails on a missing entry with the meter named, and a conversion that gives no whole number of the unit is refused and never rounded; the map is documented on the service page."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13502,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1272]",
      "number": 1272
    },
    {
      "id": "AIFACTORY-TASK-1273",
      "type": "task",
      "parent": "AIFACTORY-US-284",
      "title": "Pinned ServiceModel client of the Metering service with the workload token",
      "sequence": "18.34.02.02",
      "description": "Pinned ServiceModel client of the Metering service with the workload token. Expected output: CostUsageService references `ConnectSoft.Saas.Metering.ServiceModel` at the version AIFACTORY-US-289 published, registers the typed client facade with the workload token of the service and the forwarding of the tenant, its export adapter implements the tenant scope marker interfaces of `ConnectSoft.Extensions.Saas.Metering`, and an architecture test fails on a contract type of the Metering service declared in the solution.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "CostUsageService references `ConnectSoft.Saas.Metering.ServiceModel` at the version AIFACTORY-US-289 published, registers the typed client facade with the workload token of the service and the forwarding of the tenant, its export adapter implements the tenant scope marker interfaces of `ConnectSoft.Extensions.Saas.Metering`, and an architecture test fails on a contract type of the Metering service declared in the solution."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1273]",
      "number": 1273
    },
    {
      "id": "AIFACTORY-TASK-1274",
      "type": "task",
      "parent": "AIFACTORY-US-284",
      "title": "Verify the meter map against the seeded dimensions",
      "sequence": "18.34.02.03",
      "description": "Verify the meter map against the seeded dimensions. Expected output: Run the contract test of CostUsageService against a Metering service generated with `UseFactoryProfile` and configured with the entries of the meter map; the map and the allowed dimensions agree, a usage for an unknown dimension is refused, a quantity that is no whole number of its unit is refused and not rounded, and the architecture test passes, which proves AC1 to AC3 of AIFACTORY-US-284 (ADR-0020, model/services/control-plane/CostUsageService.yaml).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run the contract test of CostUsageService against a Metering service generated with `UseFactoryProfile` and configured with the entries of the meter map; the map and the allowed dimensions agree, a usage for an unknown dimension is refused, a quantity that is no whole number of its unit is refused and not rounded, and the architecture test passes, which proves AC1 to AC3 of AIFACTORY-US-284 (ADR-0020, model/services/control-plane/CostUsageService.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1274]",
      "number": 1274
    },
    {
      "id": "AIFACTORY-US-290",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-102",
      "title": "Metering integration: the Factory Metering service is scaffolded from the pinned Metering template into its own repository, configured with the seven Factory dimensions and deployed alone",
      "sequence": "18.34.03",
      "description": "As an operator, I want the Metering service of the Factory to run as its own service from its own repository, generated from a pinned version of the Metering template, so that the meters that budgets and invoices read live in one service that deploys and fails on its own and that CostUsageService reaches only through its typed client. The Factory runs its own Metering service from increment I4 (D115). model/components.yaml records it on the component: the instance is scaffolded from the Metering template into the repository `ConnectSoft.AI.SoftwareFactory.MeteringService` and has its own deployable, as ADR-0028 decision 1 requires of every Factory service, and model/services/control-plane/CostUsageService.yaml names it as the meter store that CostUsageService calls through the typed client. CostUsageService does not host the metering library as its store. No earlier PBI creates this instance: the acceptance suite of AIFACTORY-US-287 generates a service of its own for the proof and discards it. This PBI creates the repository with the scaffold command of ADR-0028 and its amendment on the Factory profile switch, `dotnet new connectsoft-saas-metering -n ConnectSoft.AI.SoftwareFactory.MeteringService --UseFactoryProfile true`, from the template package at the version the gate of the feature `component-saas-metering-template` published (AIFACTORY-US-283). The generated output is committed unchanged: the idempotent record, the windows, the window query, the allowed dimension option, the admission of a forwarded tenant and the outbox of the Orleans messaging profile are work of the template feature and are not rewritten in the repository. The repository records the version of the template package it was generated from and the version of `ConnectSoft.Saas.Metering.ServiceModel` that belongs to it, which is the version CostUsageService pins, so that the client and the service are one contract version and a later regeneration starts from a known template. The instance is configured in its own repository: the allowed dimension section holds the seven entries, key and unit, of the meter map of AIFACTORY-US-284, and the service binds and validates the section at start. The units and factors themselves are an owner input to that map and are not chosen here. The pipeline of the repository builds and tests the solution and publishes the service as its own deployable; it is deployed as its own workload from the Kubernetes manifests and the Helm chart the template generates (the Deployment page of the template), with its own relational store, its own messaging service name and its own transport credential, as ADR-0028 decisions 5 and 7 require. The service serves the liveness and the readiness endpoint of a generated Factory service: liveness answers alive, and readiness answers ready only after the store is migrated and the Orleans messaging profile has started, and names the dependency while it is unready. A start with an empty or malformed allowed dimension section is refused with the reason, a usage for a dimension outside the seven is refused with 400, and a caller whose workload token lacks the service scope that names the Metering service is answered 403. A Factory tenant is a tenant of this instance; the meters of a generated product live in the stores of the product (ADR-0020 decision 4) and are not touched. Kind: enabling. Traces: services: CostUsageService; adrs: ADR-0015, ADR-0020, ADR-0028. Depends on: AIFACTORY-US-284, feature:component-saas-metering-template, feature:cost-usage-service-complete. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, model/template-parameters/connectsoft-saas-metering.yaml, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md, docs/architecture/adr/0020-commercial-model.md.",
      "acceptanceCriteria": [
        "AC1: Given the Metering template package at the version the gate of the feature `component-saas-metering-template` published, when the repository `ConnectSoft.AI.SoftwareFactory.MeteringService` is created with `dotnet new connectsoft-saas-metering -n ConnectSoft.AI.SoftwareFactory.MeteringService --UseFactoryProfile true`, then the generated output is committed unchanged, the solution builds and its tests pass in the pipeline of the repository, and the repository records the template version it was generated from and the version of `ConnectSoft.Saas.Metering.ServiceModel` that belongs to it (ADR-0028 decision 1 and its amendment on the Factory profile switch, model/components.yaml).",
        "AC2: Given the pipeline of the repository, when it runs, then the service is published as its own deployable and deployed as its own workload with its own relational store, its own messaging service name and its own transport credential, and no other Factory service hosts the Metering service or the metering library as a meter store: CostUsageService reaches it only through the typed client (ADR-0028 decisions 1, 5 and 7, model/services/control-plane/CostUsageService.yaml).",
        "AC3: Given the deployed instance, when its liveness and readiness endpoints are probed, then liveness answers alive and readiness answers ready only after the store is migrated and the Orleans messaging profile has started, and names the dependency while it is unready; a start with an empty or malformed allowed dimension section is refused with the reason (ADR-0028 consequences on health and readiness per service, ADR-0020 decision 2).",
        "AC4: Given the instance configured with the seven entries of the meter map of model/services/control-plane/CostUsageService.yaml, when CostUsageService records usage with its workload token and a forwarded tenant, then a usage of one of the seven dimensions is counted for that tenant in the unit of the map, a usage for another dimension is refused with 400, and a caller without the service scope that names the Metering service is answered 403 (ADR-0020 decision 2, ADR-0015 amendment on workload tokens)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-1305",
        "AIFACTORY-TASK-362",
        "AIFACTORY-TASK-1306",
        "AIFACTORY-TASK-1307"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13503,
      "kind": "enabling",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0020",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-284",
        "feature:component-saas-metering-template",
        "feature:cost-usage-service-complete"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/template-parameters/connectsoft-saas-metering.yaml",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "titlePrefix": "[AIFACTORY-US-290]",
      "number": 290
    },
    {
      "id": "AIFACTORY-TASK-1305",
      "type": "task",
      "parent": "AIFACTORY-US-290",
      "title": "Create the repository ConnectSoft.AI.SoftwareFactory.MeteringService and scaffold it from the Metering template with the Factory profile",
      "sequence": "18.34.03.01",
      "description": "Create the repository ConnectSoft.AI.SoftwareFactory.MeteringService and scaffold it from the Metering template with the Factory profile. Expected output: The repository exists, the output of `dotnet new connectsoft-saas-metering -n ConnectSoft.AI.SoftwareFactory.MeteringService --UseFactoryProfile true` from the template package at the version the gate of AIFACTORY-US-283 published is committed unchanged, the solution builds and the tests of the generated solution pass in the repository pipeline; the documentation of the repository records the template version it was generated from and the version of `ConnectSoft.Saas.Metering.ServiceModel` that belongs to it, which is the version CostUsageService pins (AIFACTORY-TASK-1273).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.MeteringService. Verification: dotnet new connectsoft-saas-metering -n ConnectSoft.AI.SoftwareFactory.MeteringService --UseFactoryProfile true | dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository exists, the output of `dotnet new connectsoft-saas-metering -n ConnectSoft.AI.SoftwareFactory.MeteringService --UseFactoryProfile true` from the template package at the version the gate of AIFACTORY-US-283 published is committed unchanged, the solution builds and the tests of the generated solution pass in the repository pipeline; the documentation of the repository records the template version it was generated from and the version of `ConnectSoft.Saas.Metering.ServiceModel` that belongs to it, which is the version CostUsageService pins (AIFACTORY-TASK-1273)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.MeteringService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1305]",
      "number": 1305
    },
    {
      "id": "AIFACTORY-TASK-362",
      "type": "task",
      "parent": "AIFACTORY-US-290",
      "title": "The seven Factory dimensions supplied to the allowed dimension option of the Metering service",
      "sequence": "18.34.03.02",
      "description": "The seven Factory dimensions supplied to the allowed dimension option of the Metering service. Expected output: The repository of the Factory Metering service holds the configuration section of the allowed dimension option that AIFACTORY-TASK-1299 of the Metering template declares, with the seven entries, dimension key and unit, of the meter map of CostUsageService (AIFACTORY-TASK-1272), so that usage records are exported in the units the Metering service holds; the instance binds and validates the section at start, and a test of the repository starts the service with the section and reads the seven dimensions with their units; the units are the ones the owner supplies for the map and none is chosen by this task; no file of the Metering template changes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.MeteringService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The repository of the Factory Metering service holds the configuration section of the allowed dimension option that AIFACTORY-TASK-1299 of the Metering template declares, with the seven entries, dimension key and unit, of the meter map of CostUsageService (AIFACTORY-TASK-1272), so that usage records are exported in the units the Metering service holds; the instance binds and validates the section at start, and a test of the repository starts the service with the section and reads the seven dimensions with their units; the units are the ones the owner supplies for the map and none is chosen by this task; no file of the Metering template changes."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.MeteringService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-362]",
      "number": 362
    },
    {
      "id": "AIFACTORY-TASK-1306",
      "type": "task",
      "parent": "AIFACTORY-US-290",
      "title": "Pipeline and deployment of the Factory Metering service as its own workload",
      "sequence": "18.34.03.03",
      "description": "Pipeline and deployment of the Factory Metering service as its own workload. Expected output: The pipeline of the repository builds and tests the solution, publishes the container image of the service and deploys it as its own workload from the Kubernetes manifests and the Helm chart the template generates, with its own relational store, its own messaging service name and its own transport credential; the deployment probes the liveness and the readiness endpoint of the service, and no other Factory service shares its process or its database (ADR-0028 decisions 1, 5 and 7).. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.MeteringService. Verification: the pipeline publishes the image and the deployed workload reports ready.",
      "acceptanceCriteria": [
        "The pipeline of the repository builds and tests the solution, publishes the container image of the service and deploys it as its own workload from the Kubernetes manifests and the Helm chart the template generates, with its own relational store, its own messaging service name and its own transport credential; the deployment probes the liveness and the readiness endpoint of the service, and no other Factory service shares its process or its database (ADR-0028 decisions 1, 5 and 7)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.MeteringService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13503,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-1306]",
      "number": 1306
    },
    {
      "id": "AIFACTORY-TASK-1307",
      "type": "task",
      "parent": "AIFACTORY-US-290",
      "title": "Verify the deployed Factory Metering service by its health, its dimensions and its scope check",
      "sequence": "18.34.03.04",
      "description": "Verify the deployed Factory Metering service by its health, its dimensions and its scope check. Expected output: Probe the deployed instance: liveness answers alive and readiness answers ready after the store is migrated; a start with an empty allowed dimension section is refused with the reason; the contract test of CostUsageService from AIFACTORY-US-284, run against the instance, finds the seven dimensions and units equal to the meter map; a usage for another dimension is refused with 400 and a call without the service scope is answered 403; the recorded template version equals the version of the published gate; which proves AC1 to AC4 of AIFACTORY-US-290 (ADR-0028, ADR-0020).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.MeteringService.",
      "acceptanceCriteria": [
        "Probe the deployed instance: liveness answers alive and readiness answers ready after the store is migrated; a start with an empty allowed dimension section is refused with the reason; the contract test of CostUsageService from AIFACTORY-US-284, run against the instance, finds the seven dimensions and units equal to the meter map; a usage for another dimension is refused with 400 and a call without the service scope is answered 403; the recorded template version equals the version of the published gate; which proves AC1 to AC4 of AIFACTORY-US-290 (ADR-0028, ADR-0020)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.MeteringService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1307]",
      "number": 1307
    },
    {
      "id": "AIFACTORY-US-285",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-102",
      "title": "Metering integration: every settled usage record of CostUsageService is exported once to the Metering service in its units, and an outage leaves the record pending",
      "sequence": "18.34.04",
      "description": "As an operator, I want settled usage to reach the Metering service once, whatever fails on the way, so that the meters a tenant is billed from hold exactly what the Factory observed. An export worker of CostUsageService carries settled usage to the Metering service. A usage record is settled when its status is Observed, which `CostUsageService/UsageRecorded` announces, or Reconciled, which `CostUsageService/UsageReconciled` announces for a record that was Estimated or Uncertain; ADR-0020 decision 3 keeps unknown usage uncertain until it is reconciled, so an Estimated or Uncertain record is not exported, and a Reserved amount is not usage. When a `CostUsageService/UsageRecord` becomes settled, an export row in state Pending is written in the same transaction. The worker reads pending rows partitioned by tenant, converts the quantity by the meter map, and records the usage through the typed client of the Metering service with the usage identifier as the idempotency key, the time of occurrence of the record and the run it was metered for as its source and run identifier. A quantity that is no whole number of the unit of its dimension is not sent: the row is marked Refused with the reason that the conversion is not exact. On success the worker marks the row Exported and stores on it the window the Metering service reports for the usage and the start of that window. The Metering service counts a usage in the window that is open when it is recorded, so a record exported after the window of its period was rolled sits in the next window. The worker does not hide that shift: when the time of occurrence of the record precedes the start of the reported window, the row is marked late, and the meter reconciliation lists it. The call is repeatable: a crash between the call and the mark leads to a second call under the same key, which the Metering service answers with the first result and counts nowhere. When the Metering service cannot be reached the row stays Pending, the worker retries with exponential backoff, and nothing is marked exported. When the Metering service answers that the key exists with a different quantity, the row is marked as a conflict with both quantities and left for the meter reconciliation; the worker never sends a correction on its own. When the Metering service refuses the usage as invalid, the row is marked Refused with the reason and is not retried until it is changed. The worker records the attempts of each row and publishes the count and the age of pending rows as metrics, so that an export that falls behind is seen before a period closes. Kind: behavior. Traces: services: CostUsageService; aggregates: CostUsageService/UsageRecord; events: CostUsageService/UsageRecorded, CostUsageService/UsageReconciled; adrs: ADR-0014, ADR-0020; requirements: FR-09. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-284, feature:cost-usage-service-complete, feature:component-saas-metering-template. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/adr/0020-commercial-model.md, docs/reference/schemas/usage-record.schema.json.",
      "acceptanceCriteria": [
        "AC1: Given a `CostUsageService/UsageRecord` that became Observed and was announced by `CostUsageService/UsageRecorded`, when the export worker runs, then one usage exists in the Metering service for the tenant and the dimension of the meter with the converted quantity, the time of occurrence and the usage identifier as its key, and the export row is Exported with the window the Metering service reports for it and the start of that window; a record whose time of occurrence precedes that start is counted in the open window and its row is marked late (ADR-0020 decision 2).",
        "AC2: Given a usage record in status Estimated or Uncertain, when the export worker runs, then nothing is exported for it; when `CostUsageService/UsageReconciled` confirms the record, then it is exported once with the confirmed quantity (ADR-0020 decision 3, FR-09).",
        "AC3: Given an export whose call succeeded and whose mark was lost, when the worker runs again, then the second call under the same key adds no usage and no meter in the Metering service and the row becomes Exported (ADR-0014 decision 3).",
        "AC4: Given the Metering service is unreachable, when the export worker runs, then the rows stay Pending, the worker retries with backoff, nothing is marked exported, and the count and the age of pending rows are published as metrics of the service (ADR-0020 decision 3, NFR-12).",
        "AC5: Given the Metering service answers a conflict for a key with a different quantity or refuses a usage as invalid, or the quantity of a record is no whole number of the unit of its dimension, when the worker handles the row, then it is marked as a conflict or as Refused with the reason, it is not retried unchanged, no counter of the Metering service is rewritten, and the row is reported by the meter reconciliation (ADR-0014 decision 3, FR-09)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1275",
        "AIFACTORY-TASK-1276",
        "AIFACTORY-TASK-1277",
        "AIFACTORY-TASK-1278"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13504,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "aggregates": [
          "CostUsageService/UsageRecord"
        ],
        "events": [
          "CostUsageService/UsageRecorded",
          "CostUsageService/UsageReconciled"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-284",
        "feature:cost-usage-service-complete",
        "feature:component-saas-metering-template"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/reference/schemas/usage-record.schema.json"
      ],
      "titlePrefix": "[AIFACTORY-US-285]",
      "number": 285
    },
    {
      "id": "AIFACTORY-TASK-1275",
      "type": "task",
      "parent": "AIFACTORY-US-285",
      "title": "Export state of a usage record in the store of CostUsageService",
      "sequence": "18.34.04.01",
      "description": "Export state of a usage record in the store of CostUsageService. Expected output: A migration adds the export table to the store of the service: one row per settled usage record with the state Pending, Exported, Conflict or Refused, the attempts, the reason, the window the Metering service reported with its start and the late mark; the Pending row is written in the transaction that settles the record; mapping tests run against an isolated test database.. Kind: migration. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A migration adds the export table to the store of the service: one row per settled usage record with the state Pending, Exported, Conflict or Refused, the attempts, the reason, the window the Metering service reported with its start and the late mark; the Pending row is written in the transaction that settles the record; mapping tests run against an isolated test database."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:migration",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13504,
      "kind": "migration",
      "titlePrefix": "[AIFACTORY-TASK-1275]",
      "number": 1275
    },
    {
      "id": "AIFACTORY-TASK-1276",
      "type": "task",
      "parent": "AIFACTORY-US-285",
      "title": "Export worker with the usage identifier as the idempotency key",
      "sequence": "18.34.04.02",
      "description": "Export worker with the usage identifier as the idempotency key. Expected output: A worker of the service reads pending rows partitioned by tenant, converts the quantity by the meter map and refuses a conversion that is not exact, records the usage through the typed client with the usage identifier as the key, marks the row Exported with the reported window and its start and marks it late when the time of occurrence precedes that start, keeps it Pending with exponential backoff while the Metering service is unreachable, and marks a conflict or a refusal with its reason; a duplicate trigger has no second effect and the pending count and age are metrics of the service.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A worker of the service reads pending rows partitioned by tenant, converts the quantity by the meter map and refuses a conversion that is not exact, records the usage through the typed client with the usage identifier as the key, marks the row Exported with the reported window and its start and marks it late when the time of occurrence precedes that start, keeps it Pending with exponential backoff while the Metering service is unreachable, and marks a conflict or a refusal with its reason; a duplicate trigger has no second effect and the pending count and age are metrics of the service."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-1276]",
      "number": 1276
    },
    {
      "id": "AIFACTORY-TASK-1277",
      "type": "task",
      "parent": "AIFACTORY-US-285",
      "title": "Export tests for the lost mark, the outage, the conflict, the refusal, the inexact conversion and the late record",
      "sequence": "18.34.04.03",
      "description": "Export tests for the lost mark, the outage, the conflict, the refusal, the inexact conversion and the late record. Expected output: Acceptance tests of the service against a stub of the Metering contract cover an Observed record, an Uncertain record that is reconciled later, a call whose mark is lost, an outage with retries, a conflict on the key, a refused usage, a quantity that is no whole number of its unit and a record whose window was rolled before its export, and assert the export rows, the late mark and the calls the stub received.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet test -c Release --filter Category=Acceptance.",
      "acceptanceCriteria": [
        "Acceptance tests of the service against a stub of the Metering contract cover an Observed record, an Uncertain record that is reconciled later, a call whose mark is lost, an outage with retries, a conflict on the key, a refused usage, a quantity that is no whole number of its unit and a record whose window was rolled before its export, and assert the export rows, the late mark and the calls the stub received."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1277]",
      "number": 1277
    },
    {
      "id": "AIFACTORY-TASK-1278",
      "type": "task",
      "parent": "AIFACTORY-US-285",
      "title": "Verify the export of settled usage",
      "sequence": "18.34.04.04",
      "description": "Verify the export of settled usage. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` on CostUsageService; a zero-match filter counts as a failure; the export tests pass and prove AC1 to AC5 of AIFACTORY-US-285, that is the single export after CostUsageService/UsageRecorded and CostUsageService/UsageReconciled, the repeat without a duplicate and the pending rows under an outage.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` on CostUsageService; a zero-match filter counts as a failure; the export tests pass and prove AC1 to AC5 of AIFACTORY-US-285, that is the single export after CostUsageService/UsageRecorded and CostUsageService/UsageReconciled, the repeat without a duplicate and the pending rows under an outage."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1278]",
      "number": 1278
    },
    {
      "id": "AIFACTORY-US-286",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-102",
      "title": "Metering integration: Factory usage and metered usage are compared per tenant and window, every difference is listed with its record identifiers, and a clean window is marked reconciled",
      "sequence": "18.34.05",
      "description": "As an operator, I want a comparison of what the Factory observed with what the Metering service counted, window by window, so that a difference is found and named before an invoice is drawn from the meters. The model of CostUsageService has a reconciliation worker that confirms estimated and uncertain usage from provider statements. This PBI delivers a different comparison, the meter reconciliation: per tenant, dimension and window of the Metering service, the settled usage records the Factory holds are compared with the usage records the Metering service holds. A scheduled worker of CostUsageService asks the Metering service for the windows of every tenant and dimension that closed since its last run, reads the usage records and the total of each window through the window query that AIFACTORY-US-288 of the feature `component-saas-metering-template` delivers, by the typed client of AIFACTORY-US-289, and compares them with the `CostUsageService/UsageRecord` rows whose export row names the window. It lists four kinds of difference, each with the identifiers of the records involved: a record the Factory exported that the Metering service does not hold, a usage in the Metering service under a key the Factory does not know, a quantity that differs after conversion by the meter map, and a row that is still Pending, in conflict or refused. It lists a fifth kind of finding that is no difference: a late record, one whose export row is marked late because its time of occurrence precedes the start of the window it was counted in. Both stores agree on a late record, so it does not block the state Reconciled; it is listed so that an operator sees which usage of an earlier period the measurement of this window contains, since ADR-0020 has budgets and invoices read one measurement per period. The result is stored per tenant and window with the state Reconciled or Differs, the list of differences and the list of late records, written as a structured log record and counted on a metric. Nothing is repaired: the worker rewrites no counter and no usage record in either store, because a difference is a finding for an operator and a correction is a new usage record with its own receipt. A window with a pending export is never marked reconciled. A second run for the same tenant and window replaces the stored result and has no other effect, so a window becomes Reconciled once its last pending row is exported. When the Metering service cannot be reached the run of that tenant fails, is retried, and records no result. The service has no modelled read operation for the result; an operator reads it from the log and the metric until the model gains one, which is reported as a gap of the model. Kind: behavior. Traces: services: CostUsageService; aggregates: CostUsageService/UsageRecord; events: CostUsageService/UsageRecorded, CostUsageService/UsageReconciled; adrs: ADR-0014, ADR-0020; requirements: FR-09. Relates: nfrs: NFR-12. Depends on: AIFACTORY-US-285, AIFACTORY-US-289, feature:cost-usage-service-complete, feature:component-saas-metering-template. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/adr/0020-commercial-model.md, docs/architecture/commercial-model.md.",
      "acceptanceCriteria": [
        "AC1: Given a closed window of a tenant in which every settled `CostUsageService/UsageRecord` was exported and the Metering service holds the same records and total, when the meter reconciliation runs, then the window is stored as Reconciled with an empty list of differences (FR-09, ADR-0020 decision 3).",
        "AC2: Given a window with a record missing in the Metering service, a usage under an unknown key and a quantity that differs, when the reconciliation runs, then the window is stored as Differs and each difference is listed with its kind, the usage identifiers and both quantities, and no counter and no usage record is rewritten in either store (FR-09, ADR-0020 decision 3).",
        "AC3: Given a window with an export row that is Pending, in conflict or refused, when the reconciliation runs, then the window is not marked Reconciled and the row is listed; when the row is exported and the reconciliation runs again, then the stored result of that window is replaced by Reconciled and nothing else changes (ADR-0014 decision 3, model/services/control-plane/CostUsageService.yaml).",
        "AC4: Given the Metering service cannot be reached, when the reconciliation of a tenant runs, then the run fails and is retried, no result is stored for the window, and an earlier stored result is left as it was (ADR-0020 decision 3, NFR-12).",
        "AC5: Given a closed window that holds a record whose export row is marked late, because its time of occurrence precedes the start of the window it was counted in, when the reconciliation runs, then the record is listed as a late record with its usage identifier, its time of occurrence and the window, and the window is still stored as Reconciled when it has no difference (ADR-0020 decision 3, FR-09)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1279",
        "AIFACTORY-TASK-363",
        "AIFACTORY-TASK-1280",
        "AIFACTORY-TASK-1281"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13505,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "aggregates": [
          "CostUsageService/UsageRecord"
        ],
        "events": [
          "CostUsageService/UsageRecorded",
          "CostUsageService/UsageReconciled"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0020"
        ],
        "requirements": [
          "FR-09"
        ]
      },
      "relates": {
        "nfrs": [
          "NFR-12"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-285",
        "AIFACTORY-US-289",
        "feature:cost-usage-service-complete",
        "feature:component-saas-metering-template"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/adr/0020-commercial-model.md",
        "docs/architecture/commercial-model.md"
      ],
      "titlePrefix": "[AIFACTORY-US-286]",
      "number": 286
    },
    {
      "id": "AIFACTORY-TASK-1279",
      "type": "task",
      "parent": "AIFACTORY-US-286",
      "title": "Result and difference shape of the meter reconciliation",
      "sequence": "18.34.05.01",
      "description": "Result and difference shape of the meter reconciliation. Expected output: The service declares the stored result of a meter reconciliation, tenant, dimension, window, state Reconciled or Differs, the list of differences and the list of late records, the four difference kinds with the usage identifiers and quantities each carries, and the late record finding that does not change the state; a migration adds its table and the service page documents the shape and that nothing is repaired.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "The service declares the stored result of a meter reconciliation, tenant, dimension, window, state Reconciled or Differs, the list of differences and the list of late records, the four difference kinds with the usage identifiers and quantities each carries, and the late record finding that does not change the state; a migration adds its table and the service page documents the shape and that nothing is repaired."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13505,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-1279]",
      "number": 1279
    },
    {
      "id": "AIFACTORY-TASK-363",
      "type": "task",
      "parent": "AIFACTORY-US-286",
      "title": "Reconciliation of metered usage with the usage of the Factory",
      "sequence": "18.34.05.02",
      "description": "Reconciliation of metered usage with the usage of the Factory. Expected output: A scheduled worker reads the closed windows and their usage records through the typed client of the Metering service, compares the meters with the usage records per tenant, dimension and closed window, reports every difference with its record identifiers, lists late records without counting them as a difference, stores the window as Reconciled or Differs, never marks a window with a pending export as reconciled, rewrites nothing in either store and is idempotent per tenant and window.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet build -c Release | dotnet test -c Release --no-build.",
      "acceptanceCriteria": [
        "A scheduled worker reads the closed windows and their usage records through the typed client of the Metering service, compares the meters with the usage records per tenant, dimension and closed window, reports every difference with its record identifiers, lists late records without counting them as a difference, stores the window as Reconciled or Differs, never marks a window with a pending export as reconciled, rewrites nothing in either store and is idempotent per tenant and window."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-363]",
      "number": 363
    },
    {
      "id": "AIFACTORY-TASK-1280",
      "type": "task",
      "parent": "AIFACTORY-US-286",
      "title": "Reconciliation tests for a clean window, the four differences, a late record and an outage",
      "sequence": "18.34.05.03",
      "description": "Reconciliation tests for a clean window, the four differences, a late record and an outage. Expected output: Acceptance tests of the service against a stub of the Metering contract cover a clean window, each of the four difference kinds, a window with a late record that stays Reconciled, a window that becomes clean after its pending row is exported, a repeated run and an unreachable Metering service, and assert the stored results and that neither store was rewritten.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet test -c Release --filter Category=Acceptance.",
      "acceptanceCriteria": [
        "Acceptance tests of the service against a stub of the Metering contract cover a clean window, each of the four difference kinds, a window with a late record that stays Reconciled, a window that becomes clean after its pending row is exported, a repeated run and an unreachable Metering service, and assert the stored results and that neither store was rewritten."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13505,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1280]",
      "number": 1280
    },
    {
      "id": "AIFACTORY-TASK-1281",
      "type": "task",
      "parent": "AIFACTORY-US-286",
      "title": "Verify the meter reconciliation",
      "sequence": "18.34.05.04",
      "description": "Verify the meter reconciliation. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` on CostUsageService; a zero-match filter counts as a failure; the reconciliation tests pass and prove AC1 to AC5 of AIFACTORY-US-286 (FR-09, ADR-0020).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` on CostUsageService; a zero-match filter counts as a failure; the reconciliation tests pass and prove AC1 to AC5 of AIFACTORY-US-286 (FR-09, ADR-0020)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1281]",
      "number": 1281
    },
    {
      "id": "AIFACTORY-US-287",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-102",
      "title": "Metering integration: export and reconciliation pass against a Metering service generated from the published template, with the published ServiceModel package and no stub between the two services",
      "sequence": "18.34.06",
      "description": "As an operator, I want the export and the reconciliation proven against a real Metering service and not only against a stub, so that the two services cannot drift apart between the version one publishes and the version the other pins. This PBI is the proof of the feature across the two repositories. The package `ConnectSoft.Saas.Metering.ServiceModel` with the idempotent record contract, the window query and the typed client is on the ConnectSoft feed through AIFACTORY-US-289, and CostUsageService pins that version. Its acceptance suite then runs against a Metering service that the suite generates from the published template package with `UseFactoryProfile`, configures with the seven allowed dimensions of the meter map and hosts in the acceptance environment, with no stub between the two: a set of settled usage records is exported twice and the Metering service holds each once; the Metering service is stopped during an export and the records stay pending and arrive after it returns; a window is rolled and reconciled clean through the window query of the generated service; a record whose window was rolled before its export is counted in the open window, marked late and listed without blocking the reconciled state; a usage planted in the Metering service under an unknown key is listed as a difference. Neither service is built from a project reference to the other: both restore what they need from the feed. The PBI proves that budgets and invoices read one measurement, as ADR-0020 decides, the reservation and reconciliation requirement FR-09 for the pair of services, and the release gate of FR-11 for the pair of published versions. Kind: evidence. Traces: adrs: ADR-0020, ADR-0028; requirements: FR-09, FR-11. Depends on: AIFACTORY-US-284, AIFACTORY-US-285, AIFACTORY-US-286, AIFACTORY-US-289, feature:component-saas-metering-template. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/ecosystem-composition.md, docs/architecture/adr/0020-commercial-model.md.",
      "acceptanceCriteria": [
        "AC1: Given CostUsageService with the ServiceModel package at the version AIFACTORY-US-289 published and a Metering service that the acceptance suite generates from the published template package with `UseFactoryProfile`, when the suite starts, then both restore from the ConnectSoft feed without a project reference to each other and the Metering service accepts the seven allowed dimensions of the meter map (FR-11, ADR-0028, model/components.yaml).",
        "AC2: Given that pair of services, when a set of settled usage records is exported twice, then the Metering service holds each record once with the quantity, the unit, the tenant and the window the Metering service reports for it, stored on the export row, and a stop of the Metering service during an export leaves the records pending until it returns (FR-09, ADR-0020 decision 2).",
        "AC3: Given the same pair of services, when a window is rolled and the meter reconciliation runs, then the window is Reconciled; when a record whose window was rolled before its export is exported, then it is counted in the open window, marked late and listed as a late record while that window stays Reconciled; when a usage is planted in the Metering service under an unknown key and the reconciliation runs again, then the window Differs and the planted usage is listed (FR-09, docs/architecture/ecosystem-composition.md)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-1283",
        "AIFACTORY-TASK-1284"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13506,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0020",
          "ADR-0028"
        ],
        "requirements": [
          "FR-09",
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-284",
        "AIFACTORY-US-285",
        "AIFACTORY-US-286",
        "AIFACTORY-US-289",
        "feature:component-saas-metering-template"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/ecosystem-composition.md",
        "docs/architecture/adr/0020-commercial-model.md"
      ],
      "titlePrefix": "[AIFACTORY-US-287]",
      "number": 287
    },
    {
      "id": "AIFACTORY-TASK-1283",
      "type": "task",
      "parent": "AIFACTORY-US-287",
      "title": "Acceptance fixture that generates and hosts the Metering service of the published template",
      "sequence": "18.34.06.01",
      "description": "Acceptance fixture that generates and hosts the Metering service of the published template. Expected output: The acceptance suite of CostUsageService installs the published template package, generates a Metering service with `UseFactoryProfile`, configures it with the seven allowed dimensions, hosts it with its store in the acceptance environment and can stop and start it; the suite holds the double export, the outage, the clean window, the late record and the planted difference cases against it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService. Verification: dotnet test -c Release --filter Category=Acceptance.",
      "acceptanceCriteria": [
        "The acceptance suite of CostUsageService installs the published template package, generates a Metering service with `UseFactoryProfile`, configures it with the seven allowed dimensions, hosts it with its store in the acceptance environment and can stop and start it; the suite holds the double export, the outage, the clean window, the late record and the planted difference cases against it."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13506,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-1283]",
      "number": 1283
    },
    {
      "id": "AIFACTORY-TASK-1284",
      "type": "task",
      "parent": "AIFACTORY-US-287",
      "title": "Verify export and reconciliation against the generated Metering service",
      "sequence": "18.34.06.02",
      "description": "Verify export and reconciliation against the generated Metering service. Expected output: Run the acceptance suite of CostUsageService against the Metering service generated from the published template package; the double export, outage, clean window, late record and planted difference cases pass with no stub between the services and prove AC1 to AC3 of AIFACTORY-US-287 (FR-09, FR-11, ADR-0020).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run the acceptance suite of CostUsageService against the Metering service generated from the published template package; the double export, outage, clean window, late record and planted difference cases pass with no stub between the services and prove AC1 to AC3 of AIFACTORY-US-287 (FR-09, FR-11, ADR-0020)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13506,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-1284]",
      "number": 1284
    },
    {
      "id": "AIFACTORY-US-088",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-102",
      "title": "Factory usage is metered in the metering service and reconciled",
      "sequence": "18.34.07",
      "description": "As an operator, I want every settled usage record of the Factory exported to the metering service in its units and reconciled against it, so that what a tenant is billed for equals what the Factory observed. This is the integration PBI of the feature. With the published typed client, the meter map, the Metering service of the Factory in its own repository and deployable, the export worker, the meter reconciliation and the proof against a generated Metering service of the earlier PBIs, the usage of the Factory has one measurement. A usage record that CostUsageService settles, announced by `CostUsageService/UsageRecorded` or confirmed by `CostUsageService/UsageReconciled`, is written to the Metering service once, in the dimension and the unit of its meter, under the tenant and in the window the Metering service reports for it, which the export row stores, with the usage identifier as its idempotency key. A repeated export adds nothing. While the Metering service cannot be reached the record waits as pending and nothing is marked exported. When a window closes, the usage of the Factory and the usage of the Metering service are compared, every difference is listed with the identifiers of its records, a record that was counted in a later window than its time of occurrence is listed as late, and a window without a difference is marked reconciled; nothing is repaired by the comparison. An operator sees pending exports and differing windows through the metrics and the log of the service. The implementation lives in the tasks of the earlier PBIs; this PBI keeps the migrated verification of the feature and the entry of the two workers in the model of the service. The feature is done when the acceptance suite passes against a Metering service generated from the published template package and the Factory instance of AIFACTORY-US-290 is deployed and ready with the seven dimensions, so that what a tenant is billed for equals what the Factory observed. Kind: behavior. Traces: services: CostUsageService; aggregates: CostUsageService/UsageRecord; events: CostUsageService/UsageRecorded, CostUsageService/UsageReconciled; adrs: ADR-0020, ADR-0014; requirements: FR-09. Depends on: AIFACTORY-US-284, AIFACTORY-US-285, AIFACTORY-US-286, AIFACTORY-US-287, AIFACTORY-US-289, AIFACTORY-US-290, feature:cost-usage-service-complete. Sources: model/components.yaml, model/services/control-plane/CostUsageService.yaml, docs/architecture/ecosystem-composition.md.",
      "acceptanceCriteria": [
        "AC1: Given a settled usage record in CostUsageService, announced by `CostUsageService/UsageRecorded`, when the export runs, then one metered usage record exists in the metering service with the same quantity in its unit, the same tenant and the window the Metering service reports for it, stored on the export row, and a repeated export creates no duplicate (ADR-0020 decision 2, ADR-0014 decision 3).",
        "AC2: Given the usage of the Factory and the usage of the metering service for a closed window, when the meter reconciliation runs, then every difference is listed with its record identifiers, a late record is listed without counting as a difference, and a window with no difference is marked reconciled (FR-09, ADR-0020 decision 3).",
        "AC3: Given the metering service is unreachable, when the export runs, then the records stay pending, the export retries with backoff and nothing is marked exported (ADR-0020 decision 3, model/services/control-plane/CostUsageService.yaml)."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:pbi",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-1285",
        "AIFACTORY-TASK-690"
      ],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13507,
      "kind": "behavior",
      "traces": {
        "services": [
          "CostUsageService"
        ],
        "aggregates": [
          "CostUsageService/UsageRecord"
        ],
        "events": [
          "CostUsageService/UsageRecorded",
          "CostUsageService/UsageReconciled"
        ],
        "adrs": [
          "ADR-0020",
          "ADR-0014"
        ],
        "requirements": [
          "FR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-284",
        "AIFACTORY-US-285",
        "AIFACTORY-US-286",
        "AIFACTORY-US-287",
        "AIFACTORY-US-289",
        "AIFACTORY-US-290",
        "feature:cost-usage-service-complete"
      ],
      "source": [
        "model/components.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-088]",
      "number": 88
    },
    {
      "id": "AIFACTORY-TASK-1285",
      "type": "task",
      "parent": "AIFACTORY-US-088",
      "title": "Model of CostUsageService names the export and the meter reconciliation",
      "sequence": "18.34.07.01",
      "description": "Model of CostUsageService names the export and the meter reconciliation. Expected output: model/services/control-plane/CostUsageService.yaml names the export worker and the meter reconciliation worker with their triggers, retry policies and idempotency keys, the export and reconciliation result tables and the dependency on the typed client of the Metering service; the read operation for the reconciliation result, which the model lacks, is not invented by this task and stays a reported gap; the generated pages of the service are regenerated and `python -I tools/docs_model check` passes.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "model/services/control-plane/CostUsageService.yaml names the export worker and the meter reconciliation worker with their triggers, retry policies and idempotency keys, the export and reconciliation result tables and the dependency on the typed client of the Metering service; the read operation for the reconciliation result, which the model lacks, is not invented by this task and stays a reported gap; the generated pages of the service are regenerated and `python -I tools/docs_model check` passes."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13507,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-1285]",
      "number": 1285
    },
    {
      "id": "AIFACTORY-TASK-690",
      "type": "task",
      "parent": "AIFACTORY-US-088",
      "title": "Verify usage-metered-and-reconciled by running the declared command",
      "sequence": "18.34.07.02",
      "description": "Verify usage-metered-and-reconciled by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` against the Metering service generated from the published template package; a zero-match filter counts as a failure; it passes and proves AC1 to AC3 of AIFACTORY-US-088.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.CostUsageService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` against the Metering service generated from the published template package; a zero-match filter counts as a failure; it passes and proves AC1 to AC3 of AIFACTORY-US-088."
      ],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:task",
        "route:backend-developer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.CostUsageService"
      ],
      "children": [],
      "buildOrder": 135,
      "phase": "factory",
      "stackRank": 13507,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-690]",
      "number": 690
    },
    {
      "id": "AIFACTORY-FEAT-103",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Config Platform integration when it exists",
      "sequence": "18.35",
      "description": "Feature flags and runtime configuration of the Factory move to the Config Platform once that product is implemented; until then the services read configuration from their own options and degrade without it, as the model's dependency rows say. Component: Feature management and configuration (Config Platform) (develop). Increment I5: Knowledge and connections. Build order 152 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 152,
      "phase": "factory",
      "stackRank": 15200,
      "titlePrefix": "[AIFACTORY-FEAT-103]",
      "number": 103
    },
    {
      "id": "AIFACTORY-FEAT-166",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Identity, authorization server, SaaS, worker and health aggregator templates as generation inputs",
      "sequence": "18.36",
      "description": "A generated product with accounts, a token issuer or SaaS foundations is scaffolded from the specialized templates the way its modules are from the base template (ADR-0025, D95): the recipe needs each template's generated and preserved manifest, a versioned symbol catalog like the base template's (FEAT-160), a descriptor that validates against its schema, and the template's own generator present in the generation sandbox, because a missing external generator is a blocker and never a licence to hand-edit a descriptor-owned project (the extended-template rollout record). The Entitlements template records six mapping cases that fail on a UTC expression the object-mapping library cannot translate; that limitation sits in a shared library and is closed before the template is generated from. Components: Identity microservice, Authorization Server, the five SaaS services (extend). Scope when the wave is elaborated: a generated and preserved manifest and a versioned symbol catalog per template, imported by the template registry; the descriptor generator the SaaS templates call from build/regenerate.ps1 installed in the sandbox image, a missing generator failing the run by name; the five descriptors validated against their entity-model schemas in the descriptor import; the six excluded UTC mapping cases passing against the released object-mapping package; an identity module and an issuer module generated for a product blueprint with accounts, built and tested in the sandbox. The worker template (blueprint kinds with reconcilers and dispatchers) and the health aggregator template (the Health aggregator module of the worked examples) are generation inputs under the same rule, after their Factory profiles (FEAT-171, FEAT-173). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-160, AIFACTORY-FEAT-161, AIFACTORY-FEAT-162, AIFACTORY-FEAT-163. Increment I6: Full product generation. Build order 35 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0025-saas-descriptor-import.md",
        "ConnectSoft.IdentityTemplate/Docs/Extended-Template-Rollout-Status.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/alignment-verification.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i6-full-product-generation",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 35,
      "phase": "templates-and-libraries",
      "stackRank": 3500,
      "titlePrefix": "[AIFACTORY-FEAT-166]",
      "number": 166
    },
    {
      "id": "AIFACTORY-FEAT-170",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Blazor shell, SaaS shell, microfrontend and component library templates as generation inputs",
      "sequence": "18.37",
      "description": "A generated product with a user interface is scaffolded from the Blazor templates the blueprint kinds name (Shell, SaaS shell, Microfrontend, Component library) through the UX handoff (ADR-0026) and the generation recipe (ADR-0025, D95). Like the specialized service templates (FEAT-166), each needs a generated and preserved manifest and a versioned symbol catalog; the UI kit adapter is chosen at the shell level by configuration, since the shell template's locked decisions refuse a uiKitAdapter symbol; the SaaS shell chrome parity record (F03) still awaits its visual review gate; and the sample and admin microfrontend templates have no generated-solution gate of their own. Scope when the wave is elaborated: manifests and symbol catalogs for the four templates imported by the template registry; the adapter choice as a generated configuration value; the visual review gate of the SaaS shell chrome passed and recorded; a generated-solution gate for the admin microfrontend templates the SaaS foundations use; screens generated from the UX blueprint's screen descriptors onto the exemplar microfrontend contract. Component: Blazor Shell + MFEs + UIKit (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-160, AIFACTORY-FEAT-168. Increment I6: Full product generation. Build order 36 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "ConnectSoft.Blazor.ShellTemplate/docs/F03-saas-shell-chrome-alignment.md",
        "ConnectSoft.Blazor.UIKit/docs/F12-release-readiness.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:frontend-developer",
        "slice:i6-full-product-generation",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 36,
      "phase": "templates-and-libraries",
      "stackRank": 3600,
      "titlePrefix": "[AIFACTORY-FEAT-170]",
      "number": 170
    },
    {
      "id": "AIFACTORY-FEAT-179",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "MassTransit messaging adapter: outbox and inbox parity for generated products",
      "sequence": "18.38",
      "description": "The Factory's own services run on the Orleans messaging profile (ADR-0024), but generated products may choose the MassTransit transport profile over Azure Service Bus or RabbitMQ (ADR-0003, ADR-0012), and the MassTransit adapter of the MessagingModel library is options only, with no outbox or inbox, while the Orleans adapter has both with 33 tests. Scope when the wave is elaborated: an outbox dispatcher and an inbox with the same contract tests as the Orleans adapter; the accepted envelope and scope headers on every message; profile evidence (the contract tests the components table asks for) published with the package; the generation recipe choosing the profile from the blueprint. Component: MessagingModel MassTransit adapter (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-160. Increment I6: Full product generation. Build order 37 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/adr/0012-messaging-port-and-transport-profiles.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i6-full-product-generation",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 37,
      "phase": "templates-and-libraries",
      "stackRank": 3700,
      "titlePrefix": "[AIFACTORY-FEAT-179]",
      "number": 179
    },
    {
      "id": "AIFACTORY-FEAT-182",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Documentation site template as a generation input",
      "sequence": "18.39",
      "description": "The Documentation site module of a generated product is scaffolded from the documentation template through the producing workflow of the documentation blueprint kind (ADR-0030) and the generation recipe (ADR-0025, ADR-0027). Scope when the wave is elaborated: the manifest and symbol catalog of FEAT-181 imported by the template registry; the blueprint's sections list driving the navigation, each section marked generated or hand-written so the workflow writes only into generated ones; audiences as navigation sections selected with the exclude plugin and locales through a static language layout, both as template parameters with defaults; a two-locale, two-audience scaffold building strictly in the sandbox; the generated API reference bound to the product gateway's OpenAPI document. Component: Documentation template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-181, AIFACTORY-FEAT-160. Increment I6: Full product generation. Build order 38 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/blueprints.yaml",
        "docs/reference/schemas/blueprint-documentation.schema.json"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i6-full-product-generation",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 38,
      "phase": "templates-and-libraries",
      "stackRank": 3800,
      "titlePrefix": "[AIFACTORY-FEAT-182]",
      "number": 182
    },
    {
      "id": "AIFACTORY-FEAT-186",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Marketing site template as a product module",
      "sequence": "18.40",
      "description": "A generated product may include a marketing site (the Content example scaffolds one from connectsoft-marketing-site). The template is a Blazor Server site on the UI kit''s Flowbite adapter with page packs (minimal, standard, growth, full), computed page flags, a navigation catalog with legal navigation, generic placeholder copy, analytics and cookie-consent switches, an en or he default culture, an optional infra folder of Bicep files, unit, integration and E2E tests and a packaging pipeline that smoke-installs and builds the packed template before publishing; its B-F01 review gate pins the template to the live marketing site''s package line and keeps product-only surfaces out of the baseline. Scope when the wave is elaborated: the placeholder copy and metadata filled from the vision blueprint (product name, value proposition, company) and the page pack chosen from it; the FeatureManagement flags written at generation to match the pack (the template''s pages today say to set them by hand afterwards); locales and RTL from the localization blueprint rather than a two-value culture choice; analytics only through a connector the integration blueprint names, consent on; the infra folder excluded and infrastructure taken from the infrastructure blueprint and the platform template (ADR-0004, FEAT-185); the UI kit Tokens adapter (FEAT-168) beside Flowbite; telemetry on the Factory conventions (FEAT-175); the existing smoke pipeline extended across page packs and locales as the generated-solution gate. Component: Marketing site template (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-185, AIFACTORY-FEAT-169, AIFACTORY-FEAT-160. Increment I6: Full product generation. Build order 39 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/templates.yaml",
        "model/examples.yaml",
        "ConnectSoft.MarketingSiteTemplate/README.md",
        "ConnectSoft.MarketingSiteTemplate/docs/template-parameters.md",
        "ConnectSoft.MarketingSiteTemplate/docs/site-profiles.md",
        "ConnectSoft.MarketingSiteTemplate/docs/mk-tpl-sync-bf01-review.md",
        "ConnectSoft.MarketingSiteTemplate/docs/pipeline-configuration.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:frontend-developer",
        "slice:i6-full-product-generation",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 39,
      "phase": "templates-and-libraries",
      "stackRank": 3900,
      "titlePrefix": "[AIFACTORY-FEAT-186]",
      "number": 186
    },
    {
      "id": "AIFACTORY-FEAT-104",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Products catalog integration for Factory editions",
      "sequence": "18.41",
      "description": "The editions and plans of the Factory are defined in the SaaS Products Catalog and read by the Factory commercial service. Component: SaaS Products Catalog service (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-165. Increment I7: Operate and commercialise. Build order 41 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 41,
      "phase": "templates-and-libraries",
      "stackRank": 4100,
      "titlePrefix": "[AIFACTORY-FEAT-104]",
      "number": 104
    },
    {
      "id": "AIFACTORY-FEAT-105",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Entitlements integration for Factory features",
      "sequence": "18.42",
      "description": "Feature access and quotas of a tenant come from the SaaS Entitlements service and are enforced by policy and capacity. Component: SaaS Entitlements service (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-165. Increment I7: Operate and commercialise. Build order 42 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 42,
      "phase": "templates-and-libraries",
      "stackRank": 4200,
      "titlePrefix": "[AIFACTORY-FEAT-105]",
      "number": 105
    },
    {
      "id": "AIFACTORY-FEAT-106",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "Billing integration for Factory usage",
      "sequence": "18.43",
      "description": "Invoices for Factory usage are produced by the SaaS Billing service from metered usage and the tenant's plan. Component: SaaS Billing service (extend). BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Depends on: AIFACTORY-FEAT-165. Increment I7: Operate and commercialise. Build order 43 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "docs/architecture/ecosystem-composition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 43,
      "phase": "templates-and-libraries",
      "stackRank": 4300,
      "titlePrefix": "[AIFACTORY-FEAT-106]",
      "number": 106
    },
    {
      "id": "AIFACTORY-FEAT-165",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-018",
      "title": "SaaS Products Catalog, Entitlements and Billing templates before the Factory editions",
      "sequence": "18.44",
      "description": "FactoryCommercialService extends the SaaS Billing template and reads editions and entitlements from the Products Catalog and Entitlements templates (ADR-0020, FEAT-104 to FEAT-106); the marketplace LicenseService extends Billing as well. The templates' own gap backlogs record what blocks that use: Billing creates subscriptions Active instead of Draft, consumes non-canonical inbound topics, has no suspend-on-quota event and no decided invoice read model while the Factory models invoices; the Products Catalog has no ListEditions query; the Entitlements template pins a Products Catalog messaging package behind its documented version. FEAT-104, FEAT-105 and FEAT-106 depend on this feature; the rest of the gap backlogs stays with the templates. Components: SaaS Products Catalog, Entitlements and Billing services (extend). Scope when the wave is elaborated: subscriptions created Draft until activated and the invoice read-model decision recorded, with a projection for the Factory's ListInvoices if chosen (saas-BIL-F01, F03); canonical inbound topics, the MeterKey quota payload, a suspend-on-quota event and a rating-window event to Metering, all under the accepted envelope (saas-BIL-F02, F06, F07); ListEditions and get-by-id queries on the Products Catalog (saas-CAT-F06); the Entitlements template on the documented catalog package with the pin policy of saas-INTEG-F07 (saas-ENT-F08); architecture tests that fail on a layering violation or a write past the grain in all three. BEFORE DEVELOPMENT: template or library work that lands before the Factory's own repositories of this increment are developed. Increment I7: Operate and commercialise. Build order 40 of 185 (phase: Templates and libraries).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/components.yaml",
        "model/services/control-plane/FactoryCommercialService.yaml",
        "ConnectSoft.Saas.BillingTemplate/Docs/backlog/billing-gap-backlog.md",
        "ConnectSoft.Saas.ProductsCatalogTemplate/Docs/backlog/products-catalog-gap-backlog.md",
        "ConnectSoft.Saas.EntitlementsTemplate/Docs/backlog/entitlements-gap-backlog.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:components",
        "type:feature",
        "route:backend-developer",
        "slice:i7-operate-and-commercialise",
        "phase:before-development"
      ],
      "children": [],
      "buildOrder": 40,
      "phase": "templates-and-libraries",
      "stackRank": 4000,
      "titlePrefix": "[AIFACTORY-FEAT-165]",
      "number": 165
    },
    {
      "id": "AIFACTORY-EPIC-019",
      "type": "epic",
      "parent": null,
      "title": "Factory assets: workflow definitions, agents and skills",
      "sequence": "19",
      "description": "The versioned assets the Factory executes: the thirty workflow definitions with the agents and skills their steps name, published as releases and evaluated before publication. One feature per workflow definition, placed in the increment whose outcome needs it. Done when: Every workflow definition and agent release of the Factory is authored from the model, passes its fixture run and is loadable by WorkflowEngineService across I1 to I6; the releases of I2 and later are submitted and published through AgentRegistryService, with the evaluation gate from I4, and their runs pin the Published release (D140).",
      "acceptanceCriteria": [
        "Every workflow definition and agent release of the Factory is authored from the model, passes its fixture run and is loadable by WorkflowEngineService across I1 to I6; the releases of I2 and later are submitted and published through AgentRegistryService, with the evaluation gate from I4, and their runs pin the Published release (D140)."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:epic",
        "route:solution-architect",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-107",
        "AIFACTORY-FEAT-108",
        "AIFACTORY-FEAT-109",
        "AIFACTORY-FEAT-110",
        "AIFACTORY-FEAT-111",
        "AIFACTORY-FEAT-112",
        "AIFACTORY-FEAT-113",
        "AIFACTORY-FEAT-114",
        "AIFACTORY-FEAT-115",
        "AIFACTORY-FEAT-116",
        "AIFACTORY-FEAT-147",
        "AIFACTORY-FEAT-134",
        "AIFACTORY-FEAT-152",
        "AIFACTORY-FEAT-117",
        "AIFACTORY-FEAT-118",
        "AIFACTORY-FEAT-119",
        "AIFACTORY-FEAT-120",
        "AIFACTORY-FEAT-121",
        "AIFACTORY-FEAT-148",
        "AIFACTORY-FEAT-122",
        "AIFACTORY-FEAT-123",
        "AIFACTORY-FEAT-124",
        "AIFACTORY-FEAT-149",
        "AIFACTORY-FEAT-125",
        "AIFACTORY-FEAT-126",
        "AIFACTORY-FEAT-127",
        "AIFACTORY-FEAT-128",
        "AIFACTORY-FEAT-129",
        "AIFACTORY-FEAT-130",
        "AIFACTORY-FEAT-131",
        "AIFACTORY-FEAT-132",
        "AIFACTORY-FEAT-133",
        "AIFACTORY-FEAT-135",
        "AIFACTORY-FEAT-136",
        "AIFACTORY-FEAT-150",
        "AIFACTORY-FEAT-151"
      ],
      "stackRank": 8499,
      "titlePrefix": "[AIFACTORY-EPIC-019]",
      "number": 19
    },
    {
      "id": "AIFACTORY-FEAT-107",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Vision to blueprint",
      "sequence": "19.01",
      "description": "The workflow definition vision-to-blueprint as a published asset: Runs the Vision Architect Agent from a prompt and constraints to a validated Vision Blueprint with its artifacts, clarifying assumptions first and revising on validation findings. It has 6 steps, names the agents vision-architect and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I1: Generate a microservice. Build order 85 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-073",
        "AIFACTORY-US-181",
        "AIFACTORY-US-182",
        "AIFACTORY-US-183",
        "AIFACTORY-US-184"
      ],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8500,
      "titlePrefix": "[AIFACTORY-FEAT-107]",
      "number": 107
    },
    {
      "id": "AIFACTORY-US-073",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-107",
      "title": "The Vision to blueprint workflow runs from its published definition",
      "sequence": "19.01.01",
      "description": "As a requester, I want the vision to blueprint workflow to run from its published definition with the agents, tools and gates it declares, so that vision-blueprint, validation-receipt are produced the same way on every run, with evidence. The integration PBI of the definition `vision-to-blueprint`. A requester submits a run whose release pins the definition; RunControlService accepts it and publishes `RunAccepted` with the inputs `prompt` (run-submission-v1) and `constraints` (execution-scope-v1). WorkflowEngineService loads the Draft release through AgentRegistryService, opens its projection of the run and marks the six steps ready in the declared order: `clarify-intent`, `draft-vision`, `submit-version`, `validate`, `check-valid` and `store-artifacts`. Agent steps run the `vision-architect` release with its bound skills; tool steps call `blueprint-submit-version` and `blueprint-validate`; the condition reads the recorded receipt and loops back to the draft at most twice. Every agent and tool step declares `failure_policy` Retry in model/workflows/vision-to-blueprint.yaml and the release copies that value as it stands; the condition `check-valid` declares none. The one shared-write step, `submit-version`, also declares `idempotency_key` documentHash, which is what lets its Retry hold: Run Control retries a Failed attempt only when its failure class is transient and the step is of read or sandbox class, or of shared-write class with a declared idempotency key, and an attempt that fails with any other failure class fails its step without a retry (ADR-0014). A run whose definition, agent release or tool binding cannot be resolved is refused before any step runs. Every step records exactly one attempt outcome under the run envelope, the run reports exactly one outcome to Run Control (ADR-0014) and the run stays within the declared budget. The behaviour of each step pair is specified in AIFACTORY-US-181 to AIFACTORY-US-184; this PBI proves the whole chain on the recorded fixture. Kind: behavior. Traces: workflows: vision-to-blueprint; steps: vision-to-blueprint/clarify-intent, vision-to-blueprint/draft-vision, vision-to-blueprint/submit-version, vision-to-blueprint/validate, vision-to-blueprint/check-valid, vision-to-blueprint/store-artifacts; agents: vision-architect; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService; events: RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: workflow-definition-v1, run-submission-v1, execution-scope-v1, blueprint-vision-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0024, ADR-0026; requirements: FR-07, FR-08, FUX-06, FUX-11, XL-03. Depends on: AIFACTORY-US-181, AIFACTORY-US-182, AIFACTORY-US-183, AIFACTORY-US-184, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin. Sources: model/workflows/vision-to-blueprint.yaml, model/agents/vision-planning/vision-architect.yaml, docs/planes/agent-runtime/workflow-definitions/vision-to-blueprint.md.",
      "acceptanceCriteria": [
        "AC1: Given the Draft release of `vision-to-blueprint` is loadable by AgentRegistryService with its 6 steps, input mappings, retry policies, timeouts, the `failure_policy` each agent and tool step declares (Retry on all five) and the `idempotency_key` documentHash of vision-to-blueprint/submit-version exactly as in model/workflows/vision-to-blueprint.yaml, when a RunControlService/RunAccepted event arrives for that release with inputs `prompt` and `constraints`, then WorkflowEngineService/WorkflowRunStarted is emitted and the steps vision-to-blueprint/clarify-intent, vision-to-blueprint/draft-vision, vision-to-blueprint/submit-version, vision-to-blueprint/validate, vision-to-blueprint/check-valid and vision-to-blueprint/store-artifacts become ready in that order, each agent step on the pinned release of `vision-architect`.",
        "AC2: Given every step succeeds, when the run completes, then `vision-blueprint` (blueprint-vision-v1) and `validation-receipt` (blueprint-validation-receipt-v1) are recorded as the run outputs under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC3: Given an attempt of a step that declares `failure_policy` Retry settles Failed with failure class transient until the retry budget of the step is exhausted, or settles Failed with any other failure class, which is never retried, or the condition vision-to-blueprint/check-valid reaches its iteration limit, when the engine applies the compensation policy of model/workflows/vision-to-blueprint.yaml, then WorkflowEngineService/WorkflowRunFailed names the failed step and the failure class, the sandbox outputs stay in place as evidence, no blueprint version is submitted for publication and RunControlService/RunFailed is published exactly once (recovery, not replay, ADR-0014).",
        "AC4: Given the project policy gates blueprint drafts, when vision-to-blueprint/submit-version is reached, then the run waits WaitingForApproval on a RunControlService/ApprovalRequested for the gated tool invocation and resumes only on the matching RunControlService/ApprovalDecided, exactly as AIFACTORY-US-182 AC3 specifies the gate (ADR-0026, D64).",
        "AC5: Given the recorded fixture inputs of model/workflows/vision-to-blueprint.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/agents/vision-planning/vision-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/vision-to-blueprint.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-166",
        "AIFACTORY-TASK-167",
        "AIFACTORY-TASK-168",
        "AIFACTORY-TASK-739"
      ],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8501,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "vision-to-blueprint"
        ],
        "steps": [
          "vision-to-blueprint/clarify-intent",
          "vision-to-blueprint/draft-vision",
          "vision-to-blueprint/submit-version",
          "vision-to-blueprint/validate",
          "vision-to-blueprint/check-valid",
          "vision-to-blueprint/store-artifacts"
        ],
        "agents": [
          "vision-architect"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "events": [
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "run-submission-v1",
          "execution-scope-v1",
          "blueprint-vision-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026"
        ],
        "requirements": [
          "FR-07",
          "FR-08",
          "FUX-06",
          "FUX-11",
          "XL-03"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-181",
        "AIFACTORY-US-182",
        "AIFACTORY-US-183",
        "AIFACTORY-US-184",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin"
      ],
      "source": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/agents/vision-planning/vision-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/vision-to-blueprint.md"
      ],
      "titlePrefix": "[AIFACTORY-US-073]",
      "number": 73
    },
    {
      "id": "AIFACTORY-TASK-166",
      "type": "task",
      "parent": "AIFACTORY-US-073",
      "title": "Author the release of the workflow definition vision-to-blueprint from the model",
      "sequence": "19.01.01.01",
      "description": "Author the release of the workflow definition vision-to-blueprint from the model. Expected output: A Draft release of vision-to-blueprint (workflow-definition-v1) with its 6 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid and the compensation policy as in model/workflows/vision-to-blueprint.yaml, and with the failure_policy that each agent and tool step declares there copied as it stands and never derived (Retry on clarify-intent, draft-vision, submit-version, validate and store-artifacts; the condition check-valid declares none), together with the idempotency_key documentHash that the shared-write step submit-version declares and that makes its Retry valid; the release is loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService, which refuses an agent, tool or human step without a failure policy.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A Draft release of vision-to-blueprint (workflow-definition-v1) with its 6 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid and the compensation policy as in model/workflows/vision-to-blueprint.yaml, and with the failure_policy that each agent and tool step declares there copied as it stands and never derived (Retry on clarify-intent, draft-vision, submit-version, validate and store-artifacts; the condition check-valid declares none), together with the idempotency_key documentHash that the shared-write step submit-version declares and that makes its Retry valid; the release is loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService, which refuses an agent, tool or human step without a failure policy."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-166]",
      "number": 166
    },
    {
      "id": "AIFACTORY-TASK-167",
      "type": "task",
      "parent": "AIFACTORY-US-073",
      "title": "Author the agent release vision-architect with its prompts and skills",
      "sequence": "19.01.01.02",
      "description": "Author the agent release vision-architect with its prompts and skills. Expected output: A Draft release of vision-architect with its instructions, the six bound skills of model/agents/vision-planning/vision-architect.yaml, the tool bindings and the model profile reasoning-high; the release passes a smoke evaluation of the suite vision-planning-core-v1 on a fixture brief.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of vision-architect with its instructions, the six bound skills of model/agents/vision-planning/vision-architect.yaml, the tool bindings and the model profile reasoning-high; the release passes a smoke evaluation of the suite vision-planning-core-v1 on a fixture brief."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-167]",
      "number": 167
    },
    {
      "id": "AIFACTORY-TASK-168",
      "type": "task",
      "parent": "AIFACTORY-US-073",
      "title": "Fixture run of vision-to-blueprint against recorded inputs",
      "sequence": "19.01.01.03",
      "description": "Fixture run of vision-to-blueprint against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from a RunAccepted event to RunCompleted; every step output validates against its descriptor and the outputs vision-blueprint and validation-receipt match the recorded ones field by field (AC1, AC2, AC5 of AIFACTORY-US-073).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from a RunAccepted event to RunCompleted; every step output validates against its descriptor and the outputs vision-blueprint and validation-receipt match the recorded ones field by field (AC1, AC2, AC5 of AIFACTORY-US-073)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-168]",
      "number": 168
    },
    {
      "id": "AIFACTORY-TASK-739",
      "type": "task",
      "parent": "AIFACTORY-US-073",
      "title": "Verify vision-to-blueprint-runs-from-its-definition by running the declared command",
      "sequence": "19.01.01.04",
      "description": "Verify vision-to-blueprint-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-073, including the failure path of AC3 (WorkflowRunFailed then RunFailed exactly once) and, at chain level, the wait of AC4 (the run waits WaitingForApproval on the gated step and resumes on the matching decision; the gate itself is proven by AIFACTORY-TASK-927).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-073, including the failure path of AC3 (WorkflowRunFailed then RunFailed exactly once) and, at chain level, the wait of AC4 (the run waits WaitingForApproval on the gated step and resumes on the matching decision; the gate itself is proven by AIFACTORY-TASK-927)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-739]",
      "number": 739
    },
    {
      "id": "AIFACTORY-US-181",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-107",
      "title": "The Vision Architect clarifies the intent and drafts the Vision Blueprint from the prompt",
      "sequence": "19.01.02",
      "description": "As a requester, I want the open questions of my prompt listed with the assumptions taken, and a Vision Blueprint drafted on them, so that I can correct a wrong assumption before the blueprint is validated and stored. The first two agent steps of `vision-to-blueprint`. When the engine marks `clarify-intent` ready it resolves `brief` from `input.prompt` and `constraints` from `input.constraints`; the `vision-architect` release runs the skill `vision-architect-clarification` in read class and writes one artifact listing the open questions of the brief and the assumption taken for each, in a form the requester can correct. When `draft-vision` becomes ready it receives the same brief and constraints plus `assumptions` from `steps.clarify-intent.assumptions`, and on a revision pass the findings of the last validation receipt as feedback; the skill `vision-architect-author-the-vision-blueprint-document` writes the Vision Blueprint document (problem, goals, scope classes, personas, constraints and success measures) against blueprint-vision-v1 in sandbox class. Neither step touches a shared system, needs an approval or calls a service other than the Factory's own context and artifact stores. Each attempt records exactly one outcome with its evidence; both steps declare `failure_policy` Retry, and being of read and sandbox class a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts, while an attempt that fails with any other failure class is not retried. A step that exceeds its timeout PT30M, fails with a non-transient failure class or exhausts that retry budget fails the run with the evidence, nothing having been written outside the run envelope. Kind: behavior. Traces: workflows: vision-to-blueprint; steps: vision-to-blueprint/clarify-intent, vision-to-blueprint/draft-vision; agents: vision-architect; services: WorkflowEngineService; events: RunControlService/RunAccepted, WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: run-submission-v1, execution-scope-v1, artifact-v1, blueprint-vision-v1; scenarios: SCN-vision-to-blueprint-001, SCN-vision-to-blueprint-002; adrs: ADR-0014, ADR-0026; requirements: FR-07. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/vision-to-blueprint.yaml, model/agents/vision-planning/vision-architect.yaml, model/scenarios/vision-to-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with inputs `prompt` (run-submission-v1) and `constraints` (execution-scope-v1), when the engine marks vision-to-blueprint/clarify-intent ready and `vision-architect` executes it, then the output `assumptions` (artifact-v1) is recorded once under the run envelope, lists every open question with its assumption, and vision-to-blueprint/draft-vision becomes ready (SCN-vision-to-blueprint-001).",
        "AC2: Given `steps.clarify-intent.assumptions` is recorded, when vision-to-blueprint/draft-vision runs with `brief`, `constraints` and `assumptions` resolved, then the output `vision-blueprint-draft` validates against blueprint-vision-v1, carries the assumptions it relies on and is recorded once under the run envelope (SCN-vision-to-blueprint-002).",
        "AC3: Given a revision pass after the condition vision-to-blueprint/check-valid took its false branch, when vision-to-blueprint/draft-vision re-runs, then the findings of `steps.validate.validation-receipt` are present in its context as feedback and the new draft addresses each finding of the receipt by rule id (VIS-001 to VIS-004 or the schema path) (SCN-vision-to-blueprint-002, ADR-0026).",
        "AC4: Given an attempt of vision-to-blueprint/clarify-intent or vision-to-blueprint/draft-vision exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the retry budget of its declared `failure_policy` Retry (exponential, 3 attempts) is exhausted, when the engine applies the policy of model/workflows/vision-to-blueprint.yaml, then the attempt fails with evidence, the sandbox output stays in place, WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/agents/vision-planning/vision-architect.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-921",
        "AIFACTORY-TASK-922",
        "AIFACTORY-TASK-923"
      ],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8502,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "vision-to-blueprint"
        ],
        "steps": [
          "vision-to-blueprint/clarify-intent",
          "vision-to-blueprint/draft-vision"
        ],
        "agents": [
          "vision-architect"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "RunControlService/RunAccepted",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "run-submission-v1",
          "execution-scope-v1",
          "artifact-v1",
          "blueprint-vision-v1"
        ],
        "scenarios": [
          "SCN-vision-to-blueprint-001",
          "SCN-vision-to-blueprint-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-07"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/agents/vision-planning/vision-architect.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-181]",
      "number": 181
    },
    {
      "id": "AIFACTORY-TASK-921",
      "type": "task",
      "parent": "AIFACTORY-US-181",
      "title": "Recorded fixture for clarify-intent and draft-vision",
      "sequence": "19.01.02.01",
      "description": "Recorded fixture for clarify-intent and draft-vision. Expected output: A fixture brief and constraints with the expected assumptions artifact (artifact-v1) and the expected Vision Blueprint draft (blueprint-vision-v1), plus a second fixture carrying a receipt with findings as feedback for the revision pass of SCN-vision-to-blueprint-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture brief and constraints with the expected assumptions artifact (artifact-v1) and the expected Vision Blueprint draft (blueprint-vision-v1), plus a second fixture carrying a receipt with findings as feedback for the revision pass of SCN-vision-to-blueprint-002."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-921]",
      "number": 921
    },
    {
      "id": "AIFACTORY-TASK-922",
      "type": "task",
      "parent": "AIFACTORY-US-181",
      "title": "Verify the input mappings and skill selection of the two agent steps in the Draft release",
      "sequence": "19.01.02.02",
      "description": "Verify the input mappings and skill selection of the two agent steps in the Draft release. Expected output: The steps clarify-intent and draft-vision of the Draft release authored by AIFACTORY-TASK-166 resolve brief, constraints and assumptions exactly as mapped in model/workflows/vision-to-blueprint.yaml and select the skills vision-architect-clarification and vision-architect-author-the-vision-blueprint-document of the vision-architect release; the feedback attachment on the on_false branch is engine behaviour delivered by AIFACTORY-TASK-928 and is not repeated here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps clarify-intent and draft-vision of the Draft release authored by AIFACTORY-TASK-166 resolve brief, constraints and assumptions exactly as mapped in model/workflows/vision-to-blueprint.yaml and select the skills vision-architect-clarification and vision-architect-author-the-vision-blueprint-document of the vision-architect release; the feedback attachment on the on_false branch is engine behaviour delivered by AIFACTORY-TASK-928 and is not repeated here."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-922]",
      "number": 922
    },
    {
      "id": "AIFACTORY-TASK-923",
      "type": "task",
      "parent": "AIFACTORY-US-181",
      "title": "Prove the clarify and draft steps on the fixture",
      "sequence": "19.01.02.03",
      "description": "Prove the clarify and draft steps on the fixture. Expected output: A fixture run proves SCN-vision-to-blueprint-001 and SCN-vision-to-blueprint-002 (AC1 to AC3 of AIFACTORY-US-181) and the timeout and retry exhaustion path of AC4 with a WorkflowRunFailed that names the step; the outputs validate against artifact-v1 and blueprint-vision-v1.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-vision-to-blueprint-001 and SCN-vision-to-blueprint-002 (AC1 to AC3 of AIFACTORY-US-181) and the timeout and retry exhaustion path of AC4 with a WorkflowRunFailed that names the step; the outputs validate against artifact-v1 and blueprint-vision-v1."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-923]",
      "number": 923
    },
    {
      "id": "AIFACTORY-US-182",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-107",
      "title": "The draft is stored as a project-scope Draft version and validated with a receipt",
      "sequence": "19.01.03",
      "description": "As a requester, I want the drafted Vision Blueprint stored as a Draft version of my project and validated against its schema and the VIS rules, so that a validation verdict with findings exists for every draft before anything is published. The two tool steps of `vision-to-blueprint`. When `submit-version` becomes ready the engine resolves `document` from `steps.draft-vision.vision-blueprint-draft` and emits `StepReady` with `actionClass` shared-write; its part ends there, because the engine never owns run authority and runs no gate itself. Run Control dispatches the attempt and the tool `blueprint-submit-version` goes through the fixed pipeline of ToolAdapterService: schema validation, agent permission, tenant policy, side-effect classification and approval if required. Draft versions are autonomous by default; when the project policy (BC-20) gates blueprint drafts the pipeline moves the invocation to AwaitingApproval and requests the approval through `RunControl.RequestApproval`, bound to the invocation's request hash (which covers the document hash) and the exact tool version, with proposalKind tool-invocation; Run Control publishes `ApprovalRequested` and the run waits WaitingForApproval (D64). Only with an approving decision bound to that hash does the invocation reach `Blueprints.SubmitDraftVersion` of BlueprintService under the run's workload identity: the document is stored as a project-scope Draft `BlueprintVersion` of kind Vision, idempotent on its document hash, so the same document returns the same version. The step declares that hash as its `idempotency_key` documentHash in model/workflows/vision-to-blueprint.yaml, which is why Run Control may retry a Failed attempt of failure class transient although the step is shared-write; a Failed attempt of any other failure class is not retried. A rejected or expired decision denies the invocation (`ToolInvocationDenied`) and the attempt fails policy-denied. When `validate` becomes ready the tool `blueprint-validate` calls `Blueprints.Validate` with the version reference: BlueprintService validates the version against the blueprint-vision-v1 JSON Schema and the rules VIS-001 to VIS-004 and returns a receipt that carries the verdict, the document hash and the findings (a rule id or the schema path, severity and path). The call stays sandbox class and writes only the receipt; the tool never changes the state of the version. BlueprintService itself moves the version from Draft to Validated when it records ValidationPassed for that exact document hash and leaves it Draft when the receipt fails, and it emits `BlueprintValidated` with `passed` true or false and the document hash. A version reference that belongs to another tenant is answered with the gRPC status NOT_FOUND, the same answer as for a version that does not exist, so nothing confirms that it exists; the attempt that receives it takes the failure class permanent and is not retried (ADR-0015). A receipt with `passed` false is a successful step output, not a failure; both tool steps declare `failure_policy` Retry, which applies to a Failed attempt of failure class transient, and the validate step fails only on timeout PT5M, on a non-transient failure such as that NOT_FOUND, or on exhausted retries. The submit call is audited with blueprintId, version, kind and documentHash and the validate call with blueprintId, version, documentHash, kind, passed, validationReportRef and receiptHash, as the tool cards declare; the submit writes nothing beyond the Draft version and the validate call nothing beyond the receipt (ADR-0026). A submit attempt whose effect cannot be confirmed settles as Uncertain and, the step being shared-write, is never retried automatically, idempotency key or not: an operator settles it through `ConfirmToolEffect` before the run fails or continues. Kind: behavior. Traces: workflows: vision-to-blueprint; steps: vision-to-blueprint/submit-version, vision-to-blueprint/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, WorkflowEngineService, ToolAdapterService, RunControlService; aggregates: BlueprintService/BlueprintVersion, ToolAdapterService/ToolInvocation, RunControlService/Attempt; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, RunControlService/RunControl.RequestApproval, ToolAdapterService/ConfirmToolEffect; events: BlueprintService/BlueprintValidated, WorkflowEngineService/StepReady, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain; descriptors: blueprint-vision-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-vision-to-blueprint-003, SCN-vision-to-blueprint-004; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-08, FUX-06. Depends on: AIFACTORY-US-181, feature:blueprint-service, feature:workflow-engine-service, feature:run-control-service, feature:tool-adapter-service. Sources: model/workflows/vision-to-blueprint.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/services/template-library/BlueprintService.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/control-plane/RunControlService.yaml, model/scenarios/vision-to-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-vision.vision-blueprint-draft` is recorded and the project policy does not gate blueprint drafts, when vision-to-blueprint/submit-version runs `blueprint-submit-version` through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft `BlueprintVersion` of kind Vision exists in project scope, the output `version-ref` (blueprint-version-ref-v1) with blueprint id, version, kind, document hash and state Draft is recorded once under the run envelope and no approval is requested (SCN-vision-to-blueprint-003, D64).",
        "AC2: Given the same document is submitted again in the same project (a retry or a repeated run), when BlueprintService/Blueprints.SubmitDraftVersion is called with the same document hash, then the same version reference is returned, no second Draft version is created and the audit record carries blueprintId, version, kind and documentHash (SCN-vision-to-blueprint-003).",
        "AC3: Given the project policy gates blueprint drafts, when vision-to-blueprint/submit-version is reached, then WorkflowEngineService/StepReady carries `actionClass` shared-write, the pipeline of ToolAdapterService/ToolInvocation classifies the `blueprint-submit-version` invocation shared-write, moves it to AwaitingApproval and requests the approval through RunControlService/RunControl.RequestApproval bound to the invocation request hash (which covers the document hash) with proposalKind tool-invocation; a RunControlService/ApprovalRequested is published before any write, the run waits WaitingForApproval, and BlueprintService/Blueprints.SubmitDraftVersion is called only on an approving RunControlService/ApprovalDecided for that hash; a rejected or expired decision denies the invocation with ToolAdapterService/ToolInvocationDenied and the attempt fails policy-denied without a Draft version (SCN-vision-to-blueprint-003, ADR-0026, D64).",
        "AC4: Given `steps.submit-version.version-ref` is recorded, when vision-to-blueprint/validate runs `blueprint-validate` through BlueprintService/Blueprints.Validate, then the call writes only the receipt, whose findings carry a rule id (VIS-001 to VIS-004) or the schema path with severity and path, the output `validation-receipt` (blueprint-validation-receipt-v1) is recorded once under the run envelope whether it passed or not, BlueprintService/BlueprintValidated is emitted with `passed` true or false and the document hash, and BlueprintService itself moves the BlueprintService/BlueprintVersion from Draft to Validated with `validationReportRef` set when it records ValidationPassed for that exact document hash and leaves it Draft when the receipt fails; a version reference of another tenant is answered with the gRPC status NOT_FOUND like an unknown version, with no receipt and no state change, and the attempt takes the failure class permanent and is not retried (SCN-vision-to-blueprint-004, ADR-0015).",
        "AC5: Given an attempt of vision-to-blueprint/submit-version settles Failed with failure class transient (BlueprintService was unreachable before any effect), when Run Control evaluates the step, then the attempt is retried under the fixed budget (2 attempts, backoff 10s) of its declared `failure_policy` Retry, which holds for this shared-write step because it declares `idempotency_key` documentHash, and on exhaustion the attempt fails with evidence, a Draft version already stored stays a Draft and is never promoted, and the run follows the compensation policy of model/workflows/vision-to-blueprint.yaml; given the attempt settles Failed with any other failure class (BlueprintService refused the document), then it is not retried and the step fails the same way; given instead the attempt settles Uncertain (timeout PT2M after the call was dispatched, no receipt), then it is never retried automatically because the step is shared-write (RunControlService/Attempt invariant), the attempt stays Uncertain with ToolAdapterService/ToolEffectUncertain until an operator settles it through ToolAdapterService/ConfirmToolEffect, after which the run fails or continues, and the idempotency on documentHash guarantees that a confirmed effect is never duplicated; an attempt of vision-to-blueprint/validate that exceeds its timeout PT5M or settles Failed with failure class transient (sandbox class, `failure_policy` Retry, fixed, 2 attempts) is retried until exhausted and then fails with evidence (SCN-vision-to-blueprint-003, SCN-vision-to-blueprint-004, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-924",
        "AIFACTORY-TASK-925",
        "AIFACTORY-TASK-926",
        "AIFACTORY-TASK-927"
      ],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8503,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "vision-to-blueprint"
        ],
        "steps": [
          "vision-to-blueprint/submit-version",
          "vision-to-blueprint/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "WorkflowEngineService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion",
          "ToolAdapterService/ToolInvocation",
          "RunControlService/Attempt"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "RunControlService/RunControl.RequestApproval",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/StepReady",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "blueprint-vision-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-vision-to-blueprint-003",
          "SCN-vision-to-blueprint-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08",
          "FUX-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-181",
        "feature:blueprint-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-182]",
      "number": 182
    },
    {
      "id": "AIFACTORY-TASK-924",
      "type": "task",
      "parent": "AIFACTORY-US-182",
      "title": "Bind the blueprint tools to the BlueprintService gRPC methods with their audit fields",
      "sequence": "19.01.03.01",
      "description": "Bind the blueprint tools to the BlueprintService gRPC methods with their audit fields. Expected output: The tool bindings of blueprint-submit-version and blueprint-validate call Blueprints.SubmitDraftVersion and Blueprints.Validate with artifact-v1 and blueprint-version-ref-v1 requests, return blueprint-version-ref-v1 and blueprint-validation-receipt-v1, and write the audit fields of model/tools/blueprint-submit-version.yaml and model/tools/blueprint-validate.yaml; the Validate binding stays sandbox class and writes only the receipt, the move of the version from Draft to Validated being the act of BlueprintService itself when it records ValidationPassed for that exact document hash.. Kind: contract. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "The tool bindings of blueprint-submit-version and blueprint-validate call Blueprints.SubmitDraftVersion and Blueprints.Validate with artifact-v1 and blueprint-version-ref-v1 requests, return blueprint-version-ref-v1 and blueprint-validation-receipt-v1, and write the audit fields of model/tools/blueprint-submit-version.yaml and model/tools/blueprint-validate.yaml; the Validate binding stays sandbox class and writes only the receipt, the move of the version from Draft to Validated being the act of BlueprintService itself when it records ValidationPassed for that exact document hash."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:contract",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8503,
      "kind": "contract",
      "titlePrefix": "[AIFACTORY-TASK-924]",
      "number": 924
    },
    {
      "id": "AIFACTORY-TASK-925",
      "type": "task",
      "parent": "AIFACTORY-US-182",
      "title": "Gate the blueprint-submit-version invocation on the project policy with an approval bound to its request hash",
      "sequence": "19.01.03.02",
      "description": "Gate the blueprint-submit-version invocation on the project policy with an approval bound to its request hash. Expected output: The blueprint-submit-version invocation is classified shared-write, gated by the project policy (BC-20), and executes only with an approval bound to its request hash (which covers the document hash) requested through RunControl.RequestApproval with proposalKind tool-invocation; rejected or expired decisions deny the invocation (ToolInvocationDenied) and the attempt fails policy-denied; without a gating policy the Draft version is written autonomously (D64, ADR-0026).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The blueprint-submit-version invocation is classified shared-write, gated by the project policy (BC-20), and executes only with an approval bound to its request hash (which covers the document hash) requested through RunControl.RequestApproval with proposalKind tool-invocation; rejected or expired decisions deny the invocation (ToolInvocationDenied) and the attempt fails policy-denied; without a gating policy the Draft version is written autonomously (D64, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-925]",
      "number": 925
    },
    {
      "id": "AIFACTORY-TASK-926",
      "type": "task",
      "parent": "AIFACTORY-US-182",
      "title": "Fixture Vision Blueprint documents with their expected receipts",
      "sequence": "19.01.03.03",
      "description": "Fixture Vision Blueprint documents with their expected receipts. Expected output: One fixture document that passes VIS-001 to VIS-004 and one that fails VIS-002, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1 (passed, findings with rule id, severity and path, documentHash) and the expected version state after the verdict (Validated or Draft), plus a version reference that belongs to another tenant with the expected gRPC status NOT_FOUND, no receipt and an attempt of failure class permanent that is not retried.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture document that passes VIS-001 to VIS-004 and one that fails VIS-002, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1 (passed, findings with rule id, severity and path, documentHash) and the expected version state after the verdict (Validated or Draft), plus a version reference that belongs to another tenant with the expected gRPC status NOT_FOUND, no receipt and an attempt of failure class permanent that is not retried."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8503,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-926]",
      "number": 926
    },
    {
      "id": "AIFACTORY-TASK-927",
      "type": "task",
      "parent": "AIFACTORY-US-182",
      "title": "Prove the submit and validate steps on the fixture",
      "sequence": "19.01.03.04",
      "description": "Prove the submit and validate steps on the fixture. Expected output: A fixture run proves SCN-vision-to-blueprint-003 and SCN-vision-to-blueprint-004 (AC1 to AC5 of AIFACTORY-US-182), including the idempotent resubmission of the same document hash, the gated path (invocation AwaitingApproval, ApprovalRequested bound to the request hash, write only on the approving decision, ToolInvocationDenied and a policy-denied attempt on rejection or expiry), the Failed path of submit-version with failure class transient retried to exhaustion under its idempotency key documentHash, a Failed attempt of any other failure class not retried, the Uncertain path of submit-version (ToolEffectUncertain, no automatic retry, settled through ConfirmToolEffect, no duplicate version after confirmation), the Validate call writing only the receipt while BlueprintService itself moves the version to Validated when it records ValidationPassed for that exact document hash and leaves it Draft on a failed receipt, a version reference of another tenant answered with the gRPC status NOT_FOUND with no receipt and no state change, the attempt taking failure class permanent without a retry, and a BlueprintValidated with passed false whose receipt is still recorded as a step output.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-vision-to-blueprint-003 and SCN-vision-to-blueprint-004 (AC1 to AC5 of AIFACTORY-US-182), including the idempotent resubmission of the same document hash, the gated path (invocation AwaitingApproval, ApprovalRequested bound to the request hash, write only on the approving decision, ToolInvocationDenied and a policy-denied attempt on rejection or expiry), the Failed path of submit-version with failure class transient retried to exhaustion under its idempotency key documentHash, a Failed attempt of any other failure class not retried, the Uncertain path of submit-version (ToolEffectUncertain, no automatic retry, settled through ConfirmToolEffect, no duplicate version after confirmation), the Validate call writing only the receipt while BlueprintService itself moves the version to Validated when it records ValidationPassed for that exact document hash and leaves it Draft on a failed receipt, a version reference of another tenant answered with the gRPC status NOT_FOUND with no receipt and no state change, the attempt taking failure class permanent without a retry, and a BlueprintValidated with passed false whose receipt is still recorded as a step output."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-927]",
      "number": 927
    },
    {
      "id": "AIFACTORY-US-183",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-107",
      "title": "The engine checks the validation receipt and sends findings back to the draft at most twice",
      "sequence": "19.01.04",
      "description": "As a requester, I want a failed validation to send its findings back to the draft a bounded number of times and then fail the run with the report, so that the blueprint improves on real findings without looping forever or hiding the verdict. The condition step of `vision-to-blueprint`. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; a condition step never retries, never calls a service and completes within PT1M. When the receipt passed, the condition completes with one outcome and `store-artifacts` becomes ready. When it did not, the engine takes the `on_false` branch to `draft-vision` with `steps.validate.validation-receipt` as feedback: the draft, submit and validate steps re-run in order, the revised document gets its own Draft version and its own receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the last iteration the run fails with the validation report as its evidence, `WorkflowRunFailed` names `check-valid` with the failure class validation, Run Control records Failed exactly once and every Draft version created on the way stays a Draft. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026, D61). Kind: behavior. Traces: workflows: vision-to-blueprint; steps: vision-to-blueprint/check-valid, vision-to-blueprint/draft-vision; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1; scenarios: SCN-vision-to-blueprint-005, SCN-vision-to-blueprint-006; adrs: ADR-0014, ADR-0026; requirements: FR-08. Depends on: AIFACTORY-US-182, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/vision-to-blueprint.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/vision-to-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates vision-to-blueprint/check-valid, then the condition completes with exactly one outcome under the run envelope, no service is called and vision-to-blueprint/store-artifacts becomes ready (SCN-vision-to-blueprint-005).",
        "AC2: Given the recorded receipt has `passed` false and fewer than 2 iterations were counted on the run, when the engine evaluates vision-to-blueprint/check-valid, then it takes the false branch to vision-to-blueprint/draft-vision with the receipt as feedback, the steps vision-to-blueprint/submit-version and vision-to-blueprint/validate re-run on the revised draft, and the iteration count rises by one (SCN-vision-to-blueprint-006).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates vision-to-blueprint/check-valid, then the run fails with the validation report as evidence, WorkflowEngineService/WorkflowRunFailed carries `check-valid` as the failed step with failure class validation, RunControlService/RunFailed is published exactly once and no Draft version is promoted (SCN-vision-to-blueprint-006, ADR-0014).",
        "AC4: Given the receipt is missing, unreadable or the evaluation exceeds its timeout PT1M, when the engine evaluates vision-to-blueprint/check-valid, then the condition is not retried (none, 0 attempts), the step fails with evidence and the run follows the compensation policy of model/workflows/vision-to-blueprint.yaml (SCN-vision-to-blueprint-005, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-928",
        "AIFACTORY-TASK-929",
        "AIFACTORY-TASK-930"
      ],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8504,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "vision-to-blueprint"
        ],
        "steps": [
          "vision-to-blueprint/check-valid",
          "vision-to-blueprint/draft-vision"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-vision-to-blueprint-005",
          "SCN-vision-to-blueprint-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-182",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-183]",
      "number": 183
    },
    {
      "id": "AIFACTORY-TASK-928",
      "type": "task",
      "parent": "AIFACTORY-US-183",
      "title": "Evaluate check-valid over the recorded receipt and drive the bounded on_false loop",
      "sequence": "19.01.04.01",
      "description": "Evaluate check-valid over the recorded receipt and drive the bounded on_false loop. Expected output: The engine evaluates steps.validate.validation-receipt.passed == true from the recorded output without a service call, takes the on_false branch to draft-vision with the receipt as feedback at most 2 times while counting iterations on the run, and fails the run with the report and failure class validation after the limit, exactly as model/workflows/vision-to-blueprint.yaml declares.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The engine evaluates steps.validate.validation-receipt.passed == true from the recorded output without a service call, takes the on_false branch to draft-vision with the receipt as feedback at most 2 times while counting iterations on the run, and fails the run with the report and failure class validation after the limit, exactly as model/workflows/vision-to-blueprint.yaml declares."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-928]",
      "number": 928
    },
    {
      "id": "AIFACTORY-TASK-929",
      "type": "task",
      "parent": "AIFACTORY-US-183",
      "title": "Fixture receipt sequences for the pass, loop and limit paths",
      "sequence": "19.01.04.02",
      "description": "Fixture receipt sequences for the pass, loop and limit paths. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-929]",
      "number": 929
    },
    {
      "id": "AIFACTORY-TASK-930",
      "type": "task",
      "parent": "AIFACTORY-US-183",
      "title": "Prove the condition and the bounded loop on the fixture",
      "sequence": "19.01.04.03",
      "description": "Prove the condition and the bounded loop on the fixture. Expected output: A fixture run proves SCN-vision-to-blueprint-005 and SCN-vision-to-blueprint-006 (AC1 to AC4 of AIFACTORY-US-183); one outcome on pass, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-vision-to-blueprint-005 and SCN-vision-to-blueprint-006 (AC1 to AC4 of AIFACTORY-US-183); one outcome on pass, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-930]",
      "number": 930
    },
    {
      "id": "AIFACTORY-US-184",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-107",
      "title": "The validated blueprint is stored with lineage to the assumptions and the prompt and the run completes",
      "sequence": "19.01.05",
      "description": "As a requester, I want the validated Vision Blueprint stored as an artifact with lineage to my prompt and to the assumptions it rests on, so that every later blueprint can be traced back to the brief, the assumptions and the validation that approved it. The last agent step of `vision-to-blueprint`. When `check-valid` held, the engine marks `store-artifacts` ready and resolves `brief` from `input.prompt`, `constraints` from `input.constraints`, `assumptions` from `steps.clarify-intent.assumptions`, `version-ref` from `steps.submit-version.version-ref` and `validation-receipt` from `steps.validate.validation-receipt`. The `vision-architect` release runs the skill `vision-architect-store-artifacts` in sandbox class with the tools its card allows (knowledge-search, graph-query, list-files, read-range, write-file): it writes the validated blueprint document with `write-file` inside the isolated workspace, declaring the lineage it rests on (the prompt, the assumptions artifact and the validation receipt) and the validation of the version it was validated as, and returns `vision-blueprint` as its step output. The skill calls no gRPC method; AgentRuntimeService records that output under the run envelope through `Artifacts.Store` of ArtifactService with the producer run, attempt and agent and the declared lineage edges, ArtifactService being the one writer of artifacts. The link from the stored blueprint to the validated version is the field `validationRef` of the `Artifact`, which references the validation of `steps.submit-version.version-ref` by the `validationReportRef` of the validation receipt; no lineage edge is written for the version reference. The step stores the blueprint only, so exactly one new `ArtifactStored` results (descriptor blueprint-vision-v1): the assumptions artifact that `clarify-intent` recorded is linked by a lineage edge (inputKind artifact, relation derived-from) and is not stored again, and the prompt, the submission input of the run, is linked by a lineage edge of inputKind run-input (relation derived-from), which the `LineageEdge` of ArtifactService allows. The run then completes with `vision-blueprint` and `validation-receipt` as its outputs and Run Control records exactly one Completed outcome. The step does not submit the validated version for publication and requests no approval. The step declares `failure_policy` Retry and is of sandbox class, so a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts; an attempt that exceeds its timeout PT30M, fails with any other failure class or exhausts that budget fails with evidence; the validated version and the receipt stay as they are and the run ends Failed with the evidence, recovery not replay (ADR-0014). Kind: behavior. Traces: workflows: vision-to-blueprint; steps: vision-to-blueprint/store-artifacts, vision-to-blueprint/clarify-intent; agents: vision-architect; services: WorkflowEngineService, AgentRuntimeService, ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Store; events: ArtifactService/ArtifactStored, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCompleted; descriptors: artifact-v1, blueprint-vision-v1, blueprint-validation-receipt-v1; scenarios: SCN-vision-to-blueprint-007; adrs: ADR-0014; requirements: FR-08, FUX-06. Depends on: AIFACTORY-US-183, feature:artifact-service, feature:agent-runtime-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/vision-to-blueprint.yaml, model/agents/vision-planning/vision-architect.yaml, model/skills/vision-planning/vision-architect-store-artifacts.yaml, model/services/knowledge/ArtifactService.yaml, model/services/agent-mesh/AgentRuntimeService.yaml, model/scenarios/vision-to-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given vision-to-blueprint/check-valid held, when the engine marks vision-to-blueprint/store-artifacts ready, then `brief`, `constraints`, `assumptions`, `version-ref` and `validation-receipt` are resolved from the mappings of model/workflows/vision-to-blueprint.yaml and `vision-architect` executes the step on its pinned release (SCN-vision-to-blueprint-007).",
        "AC2: Given the step runs, when the skill `vision-architect-store-artifacts` writes the validated blueprint document with `write-file` in the workspace and returns it as the step output `vision-blueprint`, then AgentRuntimeService records that output through ArtifactService/Artifacts.Store with the producer run, attempt and agent, exactly one new ArtifactService/ArtifactStored is emitted (descriptor blueprint-vision-v1, with the producer run and the content hash), the lineage of the blueprint carries edges to the prompt (inputKind run-input, relation derived-from), to the assumptions artifact recorded by vision-to-blueprint/clarify-intent (inputKind artifact, relation derived-from, not stored again) and to the validation receipt (inputKind receipt, relation validated-by), and the field `validationRef` of the stored ArtifactService/Artifact references the validation of the validated version `steps.submit-version.version-ref` by the `validationReportRef` of the receipt, with no lineage edge for the version reference (SCN-vision-to-blueprint-007, FR-08).",
        "AC3: Given the blueprint artifact is stored, when the step completes, then the output `vision-blueprint` is recorded once under the run envelope, the run outputs `vision-blueprint` and `validation-receipt` are set, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC4: Given an attempt of vision-to-blueprint/store-artifacts exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the retry budget of its declared `failure_policy` Retry (exponential, 3 attempts) is exhausted, when the engine applies the compensation policy of model/workflows/vision-to-blueprint.yaml, then the attempt fails with evidence, the validated version and the receipt stay unchanged, WorkflowEngineService/WorkflowRunFailed names the step and no artifact is written twice on recovery, ArtifactService/Artifacts.Store being idempotent on tenant and hash (SCN-vision-to-blueprint-007, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/agents/vision-planning/vision-architect.yaml",
        "model/skills/vision-planning/vision-architect-store-artifacts.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-931",
        "AIFACTORY-TASK-934",
        "AIFACTORY-TASK-932",
        "AIFACTORY-TASK-933"
      ],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8505,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "vision-to-blueprint"
        ],
        "steps": [
          "vision-to-blueprint/store-artifacts",
          "vision-to-blueprint/clarify-intent"
        ],
        "agents": [
          "vision-architect"
        ],
        "services": [
          "WorkflowEngineService",
          "AgentRuntimeService",
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ArtifactService/ArtifactStored",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCompleted"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-vision-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-vision-to-blueprint-007"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "FUX-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-183",
        "feature:artifact-service",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/vision-to-blueprint.yaml",
        "model/agents/vision-planning/vision-architect.yaml",
        "model/skills/vision-planning/vision-architect-store-artifacts.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/services/agent-mesh/AgentRuntimeService.yaml",
        "model/scenarios/vision-to-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-184]",
      "number": 184
    },
    {
      "id": "AIFACTORY-TASK-931",
      "type": "task",
      "parent": "AIFACTORY-US-184",
      "title": "Bind the store-artifacts skill and map its output and the run outputs",
      "sequence": "19.01.05.01",
      "description": "Bind the store-artifacts skill and map its output and the run outputs. Expected output: The step store-artifacts of the Draft release runs vision-architect-store-artifacts with the five inputs mapped as in model/workflows/vision-to-blueprint.yaml; the skill writes the validated blueprint document with write-file in the workspace, declares its lineage (the prompt as a run-input edge, the assumptions artifact recorded by clarify-intent as a derived-from edge and the validation receipt as a validated-by edge) and the validation of the validated version for the validationRef field of the artifact, with no lineage edge for the version reference, and returns vision-blueprint (blueprint-vision-v1) as the only step output, the assumptions artifact not being stored again; the run outputs vision-blueprint and validation-receipt are set from the recorded step outputs.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step store-artifacts of the Draft release runs vision-architect-store-artifacts with the five inputs mapped as in model/workflows/vision-to-blueprint.yaml; the skill writes the validated blueprint document with write-file in the workspace, declares its lineage (the prompt as a run-input edge, the assumptions artifact recorded by clarify-intent as a derived-from edge and the validation receipt as a validated-by edge) and the validation of the validated version for the validationRef field of the artifact, with no lineage edge for the version reference, and returns vision-blueprint (blueprint-vision-v1) as the only step output, the assumptions artifact not being stored again; the run outputs vision-blueprint and validation-receipt are set from the recorded step outputs."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-931]",
      "number": 931
    },
    {
      "id": "AIFACTORY-TASK-934",
      "type": "task",
      "parent": "AIFACTORY-US-184",
      "title": "Record the store-artifacts step output through Artifacts.Store with its lineage edges",
      "sequence": "19.01.05.02",
      "description": "Record the store-artifacts step output through Artifacts.Store with its lineage edges. Expected output: The existing runtime path that records step outputs under the run envelope is reused and verified for store-artifacts; the vision-blueprint output is stored through Artifacts.Store with producer run, attempt and agent and the lineage edges the skill declared (prompt as inputKind run-input relation derived-from, assumptions artifact as inputKind artifact relation derived-from, validation receipt as inputKind receipt relation validated-by) and with the validationRef field of the Artifact referencing the validation of the validated version by the validationReportRef of the receipt, no lineage edge being written for the version reference, yielding exactly one new ArtifactStored and no second store of the unchanged assumptions artifact.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The existing runtime path that records step outputs under the run envelope is reused and verified for store-artifacts; the vision-blueprint output is stored through Artifacts.Store with producer run, attempt and agent and the lineage edges the skill declared (prompt as inputKind run-input relation derived-from, assumptions artifact as inputKind artifact relation derived-from, validation receipt as inputKind receipt relation validated-by) and with the validationRef field of the Artifact referencing the validation of the validated version by the validationReportRef of the receipt, no lineage edge being written for the version reference, yielding exactly one new ArtifactStored and no second store of the unchanged assumptions artifact."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-934]",
      "number": 934
    },
    {
      "id": "AIFACTORY-TASK-932",
      "type": "task",
      "parent": "AIFACTORY-US-184",
      "title": "Fixture expected blueprint artifact with its lineage",
      "sequence": "19.01.05.03",
      "description": "Fixture expected blueprint artifact with its lineage. Expected output: The expected vision-blueprint artifact of the fixture run with its descriptor blueprint-vision-v1, content hash, producer run and lineage edges (the prompt as inputKind run-input, the assumptions artifact recorded by clarify-intent as inputKind artifact relation derived-from, the validation receipt as inputKind receipt relation validated-by), its validationRef referencing the validation of the validated version by the validationReportRef of the receipt, and the expectation of exactly one new ArtifactStored, as the oracle of SCN-vision-to-blueprint-007.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected vision-blueprint artifact of the fixture run with its descriptor blueprint-vision-v1, content hash, producer run and lineage edges (the prompt as inputKind run-input, the assumptions artifact recorded by clarify-intent as inputKind artifact relation derived-from, the validation receipt as inputKind receipt relation validated-by), its validationRef referencing the validation of the validated version by the validationReportRef of the receipt, and the expectation of exactly one new ArtifactStored, as the oracle of SCN-vision-to-blueprint-007."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8505,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-932]",
      "number": 932
    },
    {
      "id": "AIFACTORY-TASK-933",
      "type": "task",
      "parent": "AIFACTORY-US-184",
      "title": "Prove the store step and the run completion on the fixture",
      "sequence": "19.01.05.04",
      "description": "Prove the store step and the run completion on the fixture. Expected output: A fixture run proves SCN-vision-to-blueprint-007 (AC1 to AC4 of AIFACTORY-US-184); exactly one new ArtifactStored (the blueprint) with the producer run and the lineage edges, the prompt linked by an edge of inputKind run-input, the assumptions artifact linked by a derived-from edge and not stored again, the validation receipt linked by a validated-by edge, the validationRef of the artifact referencing the validation of the validated version with no lineage edge for the version reference, the run outputs vision-blueprint and validation-receipt set, WorkflowRunCompleted and RunCompleted exactly once, and the timeout path ending Failed without a second write on recovery.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-vision-to-blueprint-007 (AC1 to AC4 of AIFACTORY-US-184); exactly one new ArtifactStored (the blueprint) with the producer run and the lineage edges, the prompt linked by an edge of inputKind run-input, the assumptions artifact linked by a derived-from edge and not stored again, the validation receipt linked by a validated-by edge, the validationRef of the artifact referencing the validation of the validated version with no lineage edge for the version reference, the run outputs vision-blueprint and validation-receipt set, WorkflowRunCompleted and RunCompleted exactly once, and the timeout path ending Failed without a second write on recovery."
      ],
      "sourceArtifacts": [
        "model/workflows/vision-to-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 85,
      "phase": "factory",
      "stackRank": 8505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-933]",
      "number": 933
    },
    {
      "id": "AIFACTORY-FEAT-108",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Architecture decomposition",
      "sequence": "19.02",
      "description": "The workflow definition architecture-decomposition as a published asset: Decomposes a validated Vision Blueprint into bounded contexts and modules with their domain models, producing the Service Blueprint from which BlueprintService derives the context map. It has 6 steps, names the agents domain-modeler, enterprise-architect and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I1: Generate a microservice. Build order 86 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-074",
        "AIFACTORY-US-1141",
        "AIFACTORY-US-1142",
        "AIFACTORY-US-1143",
        "AIFACTORY-US-1144"
      ],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8600,
      "titlePrefix": "[AIFACTORY-FEAT-108]",
      "number": 108
    },
    {
      "id": "AIFACTORY-US-074",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-108",
      "title": "The Architecture decomposition workflow runs from its published definition",
      "sequence": "19.02.01",
      "description": "As a requester, I want the architecture decomposition workflow to run from its published definition with the agents, tools and gates it declares, so that service-blueprint, validation-receipt are produced the same way on every run, with evidence. The integration PBI of the definition `architecture-decomposition`. The run is never submitted by a person: when BlueprintService publishes `BlueprintValidated` for a Vision Blueprint with `passed` true, the readiness correlation of WorkflowEngineService for the project satisfies the one required member `vision-blueprint` (blueprint-vision-v1) and submits exactly one run through `SubmitRun` of RunControlService with a service token that names the project, the release resolved from the alias when the correlation opened and the idempotency key scope, operation, workflow release and bundle fingerprint; a newer Vision version supersedes an open correlation. RunControlService accepts the run and publishes `RunAccepted`; WorkflowEngineService loads the Draft release through AgentRegistryService, opens its projection and marks the six steps ready in the declared order: `identify-contexts` and `draft-service-blueprint` on the `enterprise-architect` release, `model-domains` on the `domain-modeler` release, the tools `blueprint-submit-version` and `blueprint-validate`, and the condition `check-valid`, which loops back to the draft at most twice. Every agent and tool step declares `failure_policy` Retry and the shared-write step `submit-version` declares `idempotency_key` documentHash, which is what lets its Retry hold (ADR-0014). The run outputs are the last `service-blueprint-draft` as `service-blueprint` and the receipt; on a passed receipt BlueprintService itself derives the context map and the domain model and publishes `ContextMapDerived` and `DomainModelDerived`, the signals that activate `module-blueprints` and `database-blueprint`. The run reports exactly one outcome and stays within the declared budget. The behaviour of the steps is specified in AIFACTORY-US-1141 to AIFACTORY-US-1144; this PBI proves the whole chain on the recorded fixture. Kind: behavior. Traces: workflows: architecture-decomposition; steps: architecture-decomposition/identify-contexts, architecture-decomposition/model-domains, architecture-decomposition/draft-service-blueprint, architecture-decomposition/submit-version, architecture-decomposition/validate, architecture-decomposition/check-valid; agents: domain-modeler, enterprise-architect; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService, BlueprintService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun; events: BlueprintService/BlueprintValidated, BlueprintService/ContextMapDerived, BlueprintService/DomainModelDerived, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-vision-v1, blueprint-service-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0024, ADR-0026; requirements: FR-08, FR-11, FUX-11, XL-09. Depends on: AIFACTORY-US-1141, AIFACTORY-US-1142, AIFACTORY-US-1143, AIFACTORY-US-1144, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:blueprint-service, feature:wf-vision-to-blueprint. Sources: model/workflows/architecture-decomposition.yaml, model/agents/architecture/enterprise-architect.yaml, model/agents/architecture/domain-modeler.yaml, docs/planes/agent-runtime/workflow-definitions/architecture-decomposition.md.",
      "acceptanceCriteria": [
        "AC1: Given the Draft release of `architecture-decomposition` (workflow-definition-v1) is loadable by AgentRegistryService with its readiness activation, 6 steps, input mappings, retry policies, timeouts, the `failure_policy` Retry of the five agent and tool steps and the `idempotency_key` documentHash of architecture-decomposition/submit-version exactly as in model/workflows/architecture-decomposition.yaml, when BlueprintService/BlueprintValidated arrives for a Vision Blueprint with `passed` true, then the WorkflowEngineService/ReadinessCorrelation of the project submits one run through RunControlService/SubmitRun with a service token naming the project, WorkflowEngineService/ReadinessRunSubmitted is published and a repeated signal with the same fingerprint returns the same run.",
        "AC2: Given RunControlService/RunAccepted for that release with input `vision-blueprint`, when the engine opens the run, then WorkflowEngineService/WorkflowRunStarted is emitted and architecture-decomposition/identify-contexts, architecture-decomposition/model-domains, architecture-decomposition/draft-service-blueprint, architecture-decomposition/submit-version, architecture-decomposition/validate and architecture-decomposition/check-valid become ready in that order, each agent step on the pinned release of `enterprise-architect` or `domain-modeler`.",
        "AC3: Given every step succeeds, when the run completes, then `service-blueprint` (blueprint-service-v1) and `validation-receipt` (blueprint-validation-receipt-v1) are the run outputs under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once, RunControlService/RunCompleted follows exactly once and BlueprintService/ContextMapDerived and BlueprintService/DomainModelDerived exist for the validated version (ADR-0014, FR-08).",
        "AC4: Given a step settles Failed with a non-transient failure class, exhausts its retry budget or the condition architecture-decomposition/check-valid reaches its iteration limit, when the engine applies the compensation policy of model/workflows/architecture-decomposition.yaml, then WorkflowEngineService/WorkflowRunFailed names the failed step and the failure class, the sandbox outputs stay as evidence, every Draft version stays a Draft and RunControlService/RunFailed is published exactly once; given the project policy gates blueprint drafts, the run waits on RunControlService/ApprovalRequested and resumes only on the matching RunControlService/ApprovalDecided (ADR-0026).",
        "AC5: Given the recorded fixture inputs of model/workflows/architecture-decomposition.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget of 600000 tokens (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml",
        "model/agents/architecture/enterprise-architect.yaml",
        "model/agents/architecture/domain-modeler.yaml",
        "docs/planes/agent-runtime/workflow-definitions/architecture-decomposition.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-169",
        "AIFACTORY-TASK-170",
        "AIFACTORY-TASK-171",
        "AIFACTORY-TASK-721"
      ],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8601,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "architecture-decomposition"
        ],
        "steps": [
          "architecture-decomposition/identify-contexts",
          "architecture-decomposition/model-domains",
          "architecture-decomposition/draft-service-blueprint",
          "architecture-decomposition/submit-version",
          "architecture-decomposition/validate",
          "architecture-decomposition/check-valid"
        ],
        "agents": [
          "domain-modeler",
          "enterprise-architect"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "BlueprintService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "BlueprintService/ContextMapDerived",
          "BlueprintService/DomainModelDerived",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-vision-v1",
          "blueprint-service-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08",
          "FR-11",
          "FUX-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1141",
        "AIFACTORY-US-1142",
        "AIFACTORY-US-1143",
        "AIFACTORY-US-1144",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:blueprint-service",
        "feature:wf-vision-to-blueprint"
      ],
      "source": [
        "model/workflows/architecture-decomposition.yaml",
        "model/agents/architecture/enterprise-architect.yaml",
        "model/agents/architecture/domain-modeler.yaml",
        "docs/planes/agent-runtime/workflow-definitions/architecture-decomposition.md"
      ],
      "titlePrefix": "[AIFACTORY-US-074]",
      "number": 74
    },
    {
      "id": "AIFACTORY-TASK-169",
      "type": "task",
      "parent": "AIFACTORY-US-074",
      "title": "Author the release of the workflow definition architecture-decomposition from the model",
      "sequence": "19.02.01.01",
      "description": "Author the release of the workflow definition architecture-decomposition from the model. Expected output: A Draft release of architecture-decomposition (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Vision, its 6 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid, the compensation policy and the budget as in model/workflows/architecture-decomposition.yaml, with the failure_policy Retry of identify-contexts, model-domains, draft-service-blueprint, submit-version and validate copied as it stands and the idempotency_key documentHash of submit-version; loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A Draft release of architecture-decomposition (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Vision, its 6 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid, the compensation policy and the budget as in model/workflows/architecture-decomposition.yaml, with the failure_policy Retry of identify-contexts, model-domains, draft-service-blueprint, submit-version and validate copied as it stands and the idempotency_key documentHash of submit-version; loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-169]",
      "number": 169
    },
    {
      "id": "AIFACTORY-TASK-170",
      "type": "task",
      "parent": "AIFACTORY-US-074",
      "title": "Author the agent releases domain-modeler, enterprise-architect with their prompts and skills",
      "sequence": "19.02.01.02",
      "description": "Author the agent releases domain-modeler, enterprise-architect with their prompts and skills. Expected output: Draft releases of enterprise-architect and domain-modeler with their instructions, the skills enterprise-architect-identify-contexts, enterprise-architect-draft-service-blueprint and domain-modeler-model-domains among their bound skills, the tool bindings and the model profile reasoning-high; each release passes a smoke evaluation of the suite architecture-core-v1 on a fixture Vision Blueprint.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of enterprise-architect and domain-modeler with their instructions, the skills enterprise-architect-identify-contexts, enterprise-architect-draft-service-blueprint and domain-modeler-model-domains among their bound skills, the tool bindings and the model profile reasoning-high; each release passes a smoke evaluation of the suite architecture-core-v1 on a fixture Vision Blueprint."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-170]",
      "number": 170
    },
    {
      "id": "AIFACTORY-TASK-171",
      "type": "task",
      "parent": "AIFACTORY-US-074",
      "title": "Fixture run of architecture-decomposition against recorded inputs",
      "sequence": "19.02.01.03",
      "description": "Fixture run of architecture-decomposition against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from a BlueprintValidated of kind Vision through the readiness correlation to RunCompleted; every step output validates against its descriptor and the outputs service-blueprint and validation-receipt match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-074).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from a BlueprintValidated of kind Vision through the readiness correlation to RunCompleted; every step output validates against its descriptor and the outputs service-blueprint and validation-receipt match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-074)."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-171]",
      "number": 171
    },
    {
      "id": "AIFACTORY-TASK-721",
      "type": "task",
      "parent": "AIFACTORY-US-074",
      "title": "Verify architecture-decomposition-runs-from-its-definition by running the declared command",
      "sequence": "19.02.01.04",
      "description": "Verify architecture-decomposition-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-074, including the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once) and, at chain level, the wait on a gated submit-version; the gate itself is proven by AIFACTORY-TASK-4568.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-074, including the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once) and, at chain level, the wait on a gated submit-version; the gate itself is proven by AIFACTORY-TASK-4568."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-721]",
      "number": 721
    },
    {
      "id": "AIFACTORY-US-1141",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-108",
      "title": "The Enterprise Architect names the bounded contexts and the Domain Modeler models each domain",
      "sequence": "19.02.02",
      "description": "As a requester, I want the bounded contexts of my validated Vision Blueprint named with their responsibilities and each modelled as aggregates, invariants and events, so that the Service Blueprint rests on a domain model in the ubiquitous language instead of a guess. The two read-class agent steps that open `architecture-decomposition`. When the engine marks `identify-contexts` ready it resolves `vision-blueprint` from `input.vision-blueprint`, the validated Vision Blueprint the readiness bundle carried; the `enterprise-architect` release runs the skill `enterprise-architect-identify-contexts` with the tools its card allows for read class (knowledge-search, graph-query, list-files, read-range) and returns `context-candidates` (artifact-v1): each candidate context with its responsibility, the capabilities of the vision it owns and its relationships to the others. When `model-domains` becomes ready it receives the same blueprint and `context-candidates` from `steps.identify-contexts.context-candidates`; the `domain-modeler` release runs `domain-modeler-model-domains` and returns `domain-models` (artifact-v1): per context the aggregates with a root entity, an identity and at least one invariant, the entities, value objects and the published events, each event naming its aggregate, which is what SVC-002 and SVC-003 later check. Neither step writes outside the run envelope, calls a service of another context or needs an approval. Each attempt records exactly one outcome; both steps declare `failure_policy` Retry, so a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, an attempt of any other failure class is not retried, and a step that exceeds PT30M or exhausts its budget fails the run with the evidence; nothing has succeeded before it that needs compensation. Kind: behavior. Traces: workflows: architecture-decomposition; steps: architecture-decomposition/identify-contexts, architecture-decomposition/model-domains; agents: enterprise-architect, domain-modeler; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-vision-v1, artifact-v1; scenarios: SCN-architecture-decomposition-001, SCN-architecture-decomposition-002; adrs: ADR-0014; requirements: FR-11. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/architecture-decomposition.yaml, model/skills/architecture/enterprise-architect-identify-contexts.yaml, model/skills/architecture/domain-modeler-model-domains.yaml, model/scenarios/architecture-decomposition.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with input `vision-blueprint` (blueprint-vision-v1), when the engine marks architecture-decomposition/identify-contexts ready and `enterprise-architect` executes it with `enterprise-architect-identify-contexts`, then `context-candidates` (artifact-v1) names every candidate context with its responsibility, owned capabilities and relationships, is recorded once under the run envelope and architecture-decomposition/model-domains becomes ready (SCN-architecture-decomposition-001).",
        "AC2: Given `steps.identify-contexts.context-candidates` is recorded, when `domain-modeler` executes architecture-decomposition/model-domains, then `domain-models` (artifact-v1) holds per context the aggregates, each with a root entity, an identity and at least one invariant, the value objects and the published events each naming its aggregate, and is recorded once under the run envelope (SCN-architecture-decomposition-002).",
        "AC3: Given an attempt of either step exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/architecture-decomposition.yaml, then the attempt fails with evidence, WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml",
        "model/skills/architecture/enterprise-architect-identify-contexts.yaml",
        "model/skills/architecture/domain-modeler-model-domains.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4561",
        "AIFACTORY-TASK-4562",
        "AIFACTORY-TASK-4563"
      ],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8602,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "architecture-decomposition"
        ],
        "steps": [
          "architecture-decomposition/identify-contexts",
          "architecture-decomposition/model-domains"
        ],
        "agents": [
          "enterprise-architect",
          "domain-modeler"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-vision-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-architecture-decomposition-001",
          "SCN-architecture-decomposition-002"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/architecture-decomposition.yaml",
        "model/skills/architecture/enterprise-architect-identify-contexts.yaml",
        "model/skills/architecture/domain-modeler-model-domains.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1141]",
      "number": 1141
    },
    {
      "id": "AIFACTORY-TASK-4561",
      "type": "task",
      "parent": "AIFACTORY-US-1141",
      "title": "Recorded fixture for identify-contexts and model-domains",
      "sequence": "19.02.02.01",
      "description": "Recorded fixture for identify-contexts and model-domains. Expected output: A fixture Vision Blueprint with three capabilities and the expected context-candidates and domain-models artifacts (artifact-v1), where every aggregate has a root entity, an identity and an invariant and every event names its aggregate, as the oracle of SCN-architecture-decomposition-001 and SCN-architecture-decomposition-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture Vision Blueprint with three capabilities and the expected context-candidates and domain-models artifacts (artifact-v1), where every aggregate has a root entity, an identity and an invariant and every event names its aggregate, as the oracle of SCN-architecture-decomposition-001 and SCN-architecture-decomposition-002."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8602,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4561]",
      "number": 4561
    },
    {
      "id": "AIFACTORY-TASK-4562",
      "type": "task",
      "parent": "AIFACTORY-US-1141",
      "title": "Verify the two analysis steps of the Draft release against the definition",
      "sequence": "19.02.02.02",
      "description": "Verify the two analysis steps of the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-169 against model/workflows/architecture-decomposition.yaml proves that the steps identify-contexts and model-domains carry kind agent, the agents enterprise-architect and domain-modeler, the skills enterprise-architect-identify-contexts and domain-modeler-model-domains, side_effect_class read, failure_policy Retry, the exponential retry of 3 attempts with backoff 30s, timeout PT30M and the mappings vision-blueprint from input.vision-blueprint and context-candidates from steps.identify-contexts.context-candidates; nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-169 against model/workflows/architecture-decomposition.yaml proves that the steps identify-contexts and model-domains carry kind agent, the agents enterprise-architect and domain-modeler, the skills enterprise-architect-identify-contexts and domain-modeler-model-domains, side_effect_class read, failure_policy Retry, the exponential retry of 3 attempts with backoff 30s, timeout PT30M and the mappings vision-blueprint from input.vision-blueprint and context-candidates from steps.identify-contexts.context-candidates; nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4562]",
      "number": 4562
    },
    {
      "id": "AIFACTORY-TASK-4563",
      "type": "task",
      "parent": "AIFACTORY-US-1141",
      "title": "Prove the analysis steps on the fixture",
      "sequence": "19.02.02.03",
      "description": "Prove the analysis steps on the fixture. Expected output: A fixture run proves SCN-architecture-decomposition-001 and SCN-architecture-decomposition-002 (AC1 to AC3 of AIFACTORY-US-1141), including the timeout and retry exhaustion path with a WorkflowRunFailed that names the step; both outputs validate against artifact-v1.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-architecture-decomposition-001 and SCN-architecture-decomposition-002 (AC1 to AC3 of AIFACTORY-US-1141), including the timeout and retry exhaustion path with a WorkflowRunFailed that names the step; both outputs validate against artifact-v1."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4563]",
      "number": 4563
    },
    {
      "id": "AIFACTORY-US-1142",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-108",
      "title": "The Enterprise Architect assembles the Service Blueprint from the domain models",
      "sequence": "19.02.03",
      "description": "As a requester, I want contexts, modules, operations and events assembled into one Service Blueprint document, so that the platform can validate it and derive the context map that every later module is generated from. The sandbox-class agent step `draft-service-blueprint` of `architecture-decomposition`. When the engine marks it ready it resolves `vision-blueprint` from `input.vision-blueprint` and `domain-models` from `steps.model-domains.domain-models`; on a revision pass after `check-valid` took its false branch the findings of `steps.validate.validation-receipt` are attached as feedback. The `enterprise-architect` release runs the skill `enterprise-architect-draft-service-blueprint`, writes the Service Blueprint document with `write-file` inside the isolated workspace and returns `service-blueprint-draft` (blueprint-service-v1): the contexts and their modules, the operations and the published events, the security scope and the quality constraints, so that every feature of the vision maps to an aggregate or an operation (SVC-001) and every rule of the Service rule set can be met. On a revision pass the new draft addresses each finding by rule id (SVC-001 to SVC-005) or by schema path. The step writes nothing outside the run envelope and needs no approval; the document becomes a shared object only in the next step. It declares `failure_policy` Retry with the exponential budget of 3 attempts and backoff 30s for a Failed attempt of failure class transient; an attempt that exceeds PT30M, fails with another failure class or exhausts the budget fails the run with the evidence, the sandbox output staying in place (ADR-0014, recovery not replay). Kind: behavior. Traces: workflows: architecture-decomposition; steps: architecture-decomposition/draft-service-blueprint; agents: enterprise-architect; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-service-v1, blueprint-validation-receipt-v1; scenarios: SCN-architecture-decomposition-003; adrs: ADR-0014, ADR-0026; requirements: FR-11. Depends on: AIFACTORY-US-1141, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/architecture-decomposition.yaml, model/skills/architecture/enterprise-architect-draft-service-blueprint.yaml, model/blueprints.yaml, model/scenarios/architecture-decomposition.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.model-domains.domain-models` is recorded, when `enterprise-architect` executes architecture-decomposition/draft-service-blueprint with `enterprise-architect-draft-service-blueprint`, then `service-blueprint-draft` validates against blueprint-service-v1, maps every feature of the vision to an aggregate or an operation, is recorded once under the run envelope and architecture-decomposition/submit-version becomes ready with it mapped as `document` (SCN-architecture-decomposition-003).",
        "AC2: Given a revision pass after architecture-decomposition/check-valid took its false branch, when the step re-runs, then the findings of `steps.validate.validation-receipt` are in its context as feedback and the new draft addresses each finding by rule id SVC-001 to SVC-005 or by schema path (SCN-architecture-decomposition-003, ADR-0026).",
        "AC3: Given an attempt exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the compensation policy of model/workflows/architecture-decomposition.yaml, then the attempt fails with evidence, the sandbox output stays in place, WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-architecture-decomposition-003, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml",
        "model/skills/architecture/enterprise-architect-draft-service-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4564",
        "AIFACTORY-TASK-4565"
      ],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8603,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "architecture-decomposition"
        ],
        "steps": [
          "architecture-decomposition/draft-service-blueprint"
        ],
        "agents": [
          "enterprise-architect"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-service-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-architecture-decomposition-003"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1141",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/architecture-decomposition.yaml",
        "model/skills/architecture/enterprise-architect-draft-service-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1142]",
      "number": 1142
    },
    {
      "id": "AIFACTORY-TASK-4564",
      "type": "task",
      "parent": "AIFACTORY-US-1142",
      "title": "Fixture Service Blueprint drafts with and without findings as feedback",
      "sequence": "19.02.03.01",
      "description": "Fixture Service Blueprint drafts with and without findings as feedback. Expected output: The expected service-blueprint-draft (blueprint-service-v1) for the fixture domain models, and a second fixture with a receipt carrying an SVC-003 finding as feedback together with the revised draft that resolves it, as the oracle of SCN-architecture-decomposition-003.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected service-blueprint-draft (blueprint-service-v1) for the fixture domain models, and a second fixture with a receipt carrying an SVC-003 finding as feedback together with the revised draft that resolves it, as the oracle of SCN-architecture-decomposition-003."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8603,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4564]",
      "number": 4564
    },
    {
      "id": "AIFACTORY-TASK-4565",
      "type": "task",
      "parent": "AIFACTORY-US-1142",
      "title": "Prove the draft step and its revision pass on the fixture",
      "sequence": "19.02.03.02",
      "description": "Prove the draft step and its revision pass on the fixture. Expected output: A fixture run proves SCN-architecture-decomposition-003 (AC1 to AC3 of AIFACTORY-US-1142); the draft validates against blueprint-service-v1, the revision pass carries the receipt as feedback and resolves the finding by rule id, and the timeout path ends in a WorkflowRunFailed that names the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-architecture-decomposition-003 (AC1 to AC3 of AIFACTORY-US-1142); the draft validates against blueprint-service-v1, the revision pass carries the receipt as feedback and resolves the finding by rule id, and the timeout path ends in a WorkflowRunFailed that names the step."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4565]",
      "number": 4565
    },
    {
      "id": "AIFACTORY-US-1143",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-108",
      "title": "The Service Blueprint draft is stored as a Draft version and validated with a receipt against the SVC rules",
      "sequence": "19.02.04",
      "description": "As a requester, I want the drafted Service Blueprint stored as a Draft version of my project and validated against its schema and the SVC rules, so that a verdict with findings exists for every draft, and a passed one yields the context map and domain model the next workflows start from. The two tool steps of `architecture-decomposition`, whose service behaviour BlueprintService and ToolAdapterService deliver; this PBI binds them and proves what the definition expects. `submit-version` resolves `document` from `steps.draft-service-blueprint.service-blueprint-draft`; the engine emits `StepReady` with `actionClass` shared-write and Run Control dispatches the attempt. The tool `blueprint-submit-version` goes through the fixed pipeline of ToolAdapterService and reaches `Blueprints.SubmitDraftVersion`, which stores the document as a project-scope Draft `BlueprintVersion` of kind Service, idempotent on its document hash. Draft versions are autonomous by default; when the project policy (BC-20) gates blueprint drafts the invocation waits AwaitingApproval on an approval requested through `RunControl.RequestApproval` with proposalKind tool-invocation that names the run and the step and is bound to the request hash and the exact tool version, and a rejected or expired decision denies it and fails the attempt policy-denied (D64). The step declares `idempotency_key` documentHash, so Run Control may retry a Failed attempt of failure class transient under the fixed budget of 2 attempts; an Uncertain attempt is never retried and waits for an operator through `ConfirmToolEffect`. `validate` resolves `version-ref` and calls `Blueprints.Validate`: the version is checked against blueprint-service-v1 and the rules SVC-001 to SVC-005 and a receipt with verdict, document hash and findings is returned and recorded whether it passed or not; the call writes only the receipt. BlueprintService itself moves the version from Draft to Validated for a passed receipt, derives the context map and the domain model per context and publishes `BlueprintValidated`, `ContextMapDerived` and `DomainModelDerived`; a failed receipt leaves the version Draft and derives nothing. A version reference of another tenant is answered NOT_FOUND like an unknown one and the attempt takes the failure class permanent (ADR-0015). Kind: behavior. Traces: workflows: architecture-decomposition; steps: architecture-decomposition/submit-version, architecture-decomposition/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, ToolAdapterService, RunControlService, WorkflowEngineService; aggregates: BlueprintService/BlueprintVersion, ToolAdapterService/ToolInvocation; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, ToolAdapterService/ConfirmToolEffect, RunControlService/RunControl.RequestApproval; events: BlueprintService/BlueprintValidated, BlueprintService/ContextMapDerived, BlueprintService/DomainModelDerived, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain; descriptors: blueprint-service-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-architecture-decomposition-004, SCN-architecture-decomposition-005; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-08. Depends on: AIFACTORY-US-1142, feature:blueprint-service, feature:tool-adapter-service, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/architecture-decomposition.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/services/template-library/BlueprintService.yaml, model/blueprints.yaml, model/scenarios/architecture-decomposition.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-service-blueprint.service-blueprint-draft` is recorded and the project policy does not gate blueprint drafts, when architecture-decomposition/submit-version runs `blueprint-submit-version` through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Service exists in project scope, `version-ref` (blueprint-version-ref-v1) is recorded once and the same document submitted again returns the same version reference (SCN-architecture-decomposition-004, D64).",
        "AC2: Given the project policy gates blueprint drafts, when architecture-decomposition/submit-version is reached, then the ToolAdapterService/ToolInvocation waits AwaitingApproval, the approval is requested through RunControlService/RunControl.RequestApproval with proposalKind tool-invocation, bound to the invocation request hash and the exact tool version, RunControlService/ApprovalRequested names the run and the step before any write, the write happens only on an approving RunControlService/ApprovalDecided, and a rejected or expired decision yields ToolAdapterService/ToolInvocationDenied and an attempt failed policy-denied without a Draft version (SCN-architecture-decomposition-004, ADR-0026).",
        "AC3: Given an attempt of architecture-decomposition/submit-version settles Failed with failure class transient, when Run Control evaluates it, then it is retried under the fixed budget of 2 attempts because the step declares `idempotency_key` documentHash, another failure class is not retried, and an Uncertain attempt raises ToolAdapterService/ToolEffectUncertain and is settled only through ToolAdapterService/ConfirmToolEffect, never by an automatic retry (SCN-architecture-decomposition-004, ADR-0014).",
        "AC4: Given `steps.submit-version.version-ref` is recorded, when architecture-decomposition/validate runs `blueprint-validate` through BlueprintService/Blueprints.Validate, then `validation-receipt` (blueprint-validation-receipt-v1) with findings by rule id SVC-001 to SVC-005 or schema path is recorded once whether it passed or not, BlueprintService/BlueprintValidated carries `passed` and the document hash, and for a passed receipt the version is Validated and BlueprintService/ContextMapDerived and BlueprintService/DomainModelDerived follow, while a failed one leaves it Draft (SCN-architecture-decomposition-005).",
        "AC5: Given a version reference of another tenant, or an attempt of architecture-decomposition/validate that exceeds PT5M or settles Failed with failure class transient until the fixed budget of 2 attempts is spent, when the step runs, then the other tenant is answered NOT_FOUND with no receipt and the attempt takes failure class permanent without a retry, and the exhausted case fails with evidence; the version keeps its state in both cases (SCN-architecture-decomposition-005, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/blueprints.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4566",
        "AIFACTORY-TASK-4567",
        "AIFACTORY-TASK-4568"
      ],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8604,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "architecture-decomposition"
        ],
        "steps": [
          "architecture-decomposition/submit-version",
          "architecture-decomposition/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "ToolAdapterService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion",
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "ToolAdapterService/ConfirmToolEffect",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "BlueprintService/ContextMapDerived",
          "BlueprintService/DomainModelDerived",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "blueprint-service-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-architecture-decomposition-004",
          "SCN-architecture-decomposition-005"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1142",
        "feature:blueprint-service",
        "feature:tool-adapter-service",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/architecture-decomposition.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/blueprints.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1143]",
      "number": 1143
    },
    {
      "id": "AIFACTORY-TASK-4566",
      "type": "task",
      "parent": "AIFACTORY-US-1143",
      "title": "Fixture Service Blueprint documents with their expected receipts and derived models",
      "sequence": "19.02.04.01",
      "description": "Fixture Service Blueprint documents with their expected receipts and derived models. Expected output: One fixture Service Blueprint that passes SVC-001 to SVC-005 with its expected blueprint-version-ref-v1, receipt, Validated state, context map and per-context domain models, one that fails SVC-002 with its receipt and Draft state and no derivation, and a version reference of another tenant with the expected NOT_FOUND and no receipt.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture Service Blueprint that passes SVC-001 to SVC-005 with its expected blueprint-version-ref-v1, receipt, Validated state, context map and per-context domain models, one that fails SVC-002 with its receipt and Draft state and no derivation, and a version reference of another tenant with the expected NOT_FOUND and no receipt."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8604,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4566]",
      "number": 4566
    },
    {
      "id": "AIFACTORY-TASK-4567",
      "type": "task",
      "parent": "AIFACTORY-US-1143",
      "title": "Verify submit-version and validate of the Draft release against the definition",
      "sequence": "19.02.04.02",
      "description": "Verify submit-version and validate of the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-169 against model/workflows/architecture-decomposition.yaml proves that the steps submit-version and validate name the tools blueprint-submit-version and blueprint-validate, carry side_effect_class shared-write and sandbox, failure_policy Retry, the idempotency_key documentHash on submit-version only, the fixed retry of 2 attempts with backoff 10s, the timeouts PT2M and PT5M and the mappings document from steps.draft-service-blueprint.service-blueprint-draft and version-ref from steps.submit-version.version-ref; the tool bindings are consumed from feature tool-adapter-service and nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-169 against model/workflows/architecture-decomposition.yaml proves that the steps submit-version and validate name the tools blueprint-submit-version and blueprint-validate, carry side_effect_class shared-write and sandbox, failure_policy Retry, the idempotency_key documentHash on submit-version only, the fixed retry of 2 attempts with backoff 10s, the timeouts PT2M and PT5M and the mappings document from steps.draft-service-blueprint.service-blueprint-draft and version-ref from steps.submit-version.version-ref; the tool bindings are consumed from feature tool-adapter-service and nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4567]",
      "number": 4567
    },
    {
      "id": "AIFACTORY-TASK-4568",
      "type": "task",
      "parent": "AIFACTORY-US-1143",
      "title": "Prove the submit and validate steps for a Service Blueprint on the fixture",
      "sequence": "19.02.04.03",
      "description": "Prove the submit and validate steps for a Service Blueprint on the fixture. Expected output: A fixture run proves SCN-architecture-decomposition-004 and SCN-architecture-decomposition-005 (AC1 to AC5 of AIFACTORY-US-1143), including the idempotent resubmission, the gated path with ApprovalRequested naming the run and the step and ToolInvocationDenied on rejection, the transient retry and the Uncertain path settled through ConfirmToolEffect, the passed receipt followed by ContextMapDerived and DomainModelDerived, the failed receipt leaving the version Draft, and the NOT_FOUND of another tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-architecture-decomposition-004 and SCN-architecture-decomposition-005 (AC1 to AC5 of AIFACTORY-US-1143), including the idempotent resubmission, the gated path with ApprovalRequested naming the run and the step and ToolInvocationDenied on rejection, the transient retry and the Uncertain path settled through ConfirmToolEffect, the passed receipt followed by ContextMapDerived and DomainModelDerived, the failed receipt leaving the version Draft, and the NOT_FOUND of another tenant."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4568]",
      "number": 4568
    },
    {
      "id": "AIFACTORY-US-1144",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-108",
      "title": "The engine checks the Service Blueprint receipt and sends findings back to the draft at most twice",
      "sequence": "19.02.05",
      "description": "As a requester, I want a failed validation of my Service Blueprint to send its findings back to the draft a bounded number of times and then fail the run with the report, so that the blueprint improves on real findings without looping forever or hiding the verdict. The condition step of `architecture-decomposition`. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; the condition is read class, calls no service, never retries and completes within PT1M. When the receipt passed, the condition completes with one outcome, no further step exists, and the run completes with the last draft as `service-blueprint` and the receipt as `validation-receipt`. When it did not, the engine takes the `on_false` branch to `draft-service-blueprint` with `steps.validate.validation-receipt` as feedback: the draft, submit and validate steps re-run in order, the revised document gets its own Draft version and its own receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the second iteration the run fails with the validation report as evidence, `WorkflowRunFailed` names `check-valid` with the failure class validation, Run Control records Failed exactly once and every Draft version created on the way stays a Draft, never Validated, so no context map is derived and `module-blueprints` is never activated. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026, D61). Kind: behavior. Traces: workflows: architecture-decomposition; steps: architecture-decomposition/check-valid, architecture-decomposition/draft-service-blueprint; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1; scenarios: SCN-architecture-decomposition-006, SCN-architecture-decomposition-007; adrs: ADR-0014, ADR-0026; requirements: FR-08. Depends on: AIFACTORY-US-1143, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/architecture-decomposition.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/architecture-decomposition.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates architecture-decomposition/check-valid, then the condition completes with exactly one outcome, no service is called and WorkflowEngineService/WorkflowRunCompleted follows with the run outputs set (SCN-architecture-decomposition-006).",
        "AC2: Given the receipt has `passed` false and fewer than 2 iterations were counted, when the engine evaluates architecture-decomposition/check-valid, then it takes the false branch to architecture-decomposition/draft-service-blueprint with the receipt as feedback, the submit and validate steps re-run on the revised draft and the iteration count rises by one (SCN-architecture-decomposition-007).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates architecture-decomposition/check-valid, then WorkflowEngineService/WorkflowRunFailed names `check-valid` with failure class validation and the report as evidence, RunControlService/RunFailed is published exactly once and no Draft version became Validated (SCN-architecture-decomposition-007, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable or the evaluation exceeds PT1M, when the engine evaluates architecture-decomposition/check-valid, then the condition is not retried, the step fails with evidence and the run follows the compensation policy of model/workflows/architecture-decomposition.yaml (SCN-architecture-decomposition-006, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4569",
        "AIFACTORY-TASK-4570"
      ],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8605,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "architecture-decomposition"
        ],
        "steps": [
          "architecture-decomposition/check-valid",
          "architecture-decomposition/draft-service-blueprint"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-architecture-decomposition-006",
          "SCN-architecture-decomposition-007"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1143",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/architecture-decomposition.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/architecture-decomposition.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1144]",
      "number": 1144
    },
    {
      "id": "AIFACTORY-TASK-4569",
      "type": "task",
      "parent": "AIFACTORY-US-1144",
      "title": "Fixture receipt sequences for the pass, loop and limit paths of check-valid",
      "sequence": "19.02.05.01",
      "description": "Fixture receipt sequences for the pass, loop and limit paths of check-valid. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of architecture-decomposition through the pass, a single loop and the iteration limit, each with the expected run outcome and iteration count.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of architecture-decomposition through the pass, a single loop and the iteration limit, each with the expected run outcome and iteration count."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8605,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4569]",
      "number": 4569
    },
    {
      "id": "AIFACTORY-TASK-4570",
      "type": "task",
      "parent": "AIFACTORY-US-1144",
      "title": "Prove the condition and the bounded loop of architecture-decomposition on the fixture",
      "sequence": "19.02.05.02",
      "description": "Prove the condition and the bounded loop of architecture-decomposition on the fixture. Expected output: A fixture run proves SCN-architecture-decomposition-006 and SCN-architecture-decomposition-007 (AC1 to AC4 of AIFACTORY-US-1144); one outcome on pass, a loop back to draft-service-blueprint with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-architecture-decomposition-006 and SCN-architecture-decomposition-007 (AC1 to AC4 of AIFACTORY-US-1144); one outcome on pass, a loop back to draft-service-blueprint with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/architecture-decomposition.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 86,
      "phase": "factory",
      "stackRank": 8605,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4570]",
      "number": 4570
    },
    {
      "id": "AIFACTORY-FEAT-109",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Module blueprints",
      "sequence": "19.03",
      "description": "The workflow definition module-blueprints as a published asset: Produces one Module Blueprint per context of a derived context map: the clean-architecture layout, template switches and adapters each module will be scaffolded with. It has 6 steps, names the agents solution-architect and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I1: Generate a microservice. Build order 87 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-010",
        "AIFACTORY-US-1145",
        "AIFACTORY-US-1146",
        "AIFACTORY-US-1147",
        "AIFACTORY-US-1148"
      ],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8700,
      "titlePrefix": "[AIFACTORY-FEAT-109]",
      "number": 109
    },
    {
      "id": "AIFACTORY-US-010",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-109",
      "title": "One Module Blueprint per context, drafted in parallel",
      "sequence": "19.03.01",
      "description": "As a requester, I want a validated Module Blueprint for every context of my product, so that each module can be designed and generated on its own. The integration PBI of the definition `module-blueprints`. The run is activated, not submitted by a person: the readiness correlation of WorkflowEngineService for the project waits for two required members, `service-blueprint` satisfied by `BlueprintValidated` of kind Service with `passed` true and `context-map` satisfied by `ContextMapDerived` with at least one context for that blueprint version, and then submits exactly one run through `SubmitRun` of RunControlService with a service token that names the project and the idempotency key of scope, operation, workflow release and bundle fingerprint; a newer Service Blueprint version opens a new correlation and supersedes the open one. After `RunAccepted` the engine loads the Draft release through AgentRegistryService and runs `fan-out-contexts`, which starts one branch per context of the map; in each branch the `solution-architect` release drafts the Module Blueprint, the tools `blueprint-submit-version` and `blueprint-validate` store and validate it, and `check-valid` loops back to the draft at most twice; `join` waits for every branch. Every agent and tool step declares `failure_policy` Retry and `submit-version` declares `idempotency_key` documentHash (ADR-0014). The run outputs are the Module Blueprints of every branch and their receipts; each passed receipt publishes `BlueprintValidated` of kind Module, the signal that activates `application-design` and lets GenerationRecipeService pin the module. The run reports exactly one outcome within the declared budget. The step behaviour is specified in AIFACTORY-US-1145 to AIFACTORY-US-1148; this PBI proves the chain on the recorded fixture. How a branch is bound to its context and whether the loop limit counts per branch are not declared by the definition and are carried as assumptions by AIFACTORY-US-1145 and AIFACTORY-US-1148. The tasks AIFACTORY-TASK-209 and AIFACTORY-TASK-210 of this PBI moved to AIFACTORY-US-1146 and AIFACTORY-US-1145, the PBIs whose behaviour they prove, with their repository and kind unchanged. Kind: behavior. Traces: workflows: module-blueprints; steps: module-blueprints/fan-out-contexts, module-blueprints/draft-module, module-blueprints/submit-version, module-blueprints/validate, module-blueprints/check-valid, module-blueprints/join; agents: solution-architect; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService, BlueprintService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun; events: BlueprintService/BlueprintValidated, BlueprintService/ContextMapDerived, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-service-v1, blueprint-module-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0024, ADR-0026, ADR-0027; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1145, AIFACTORY-US-1146, AIFACTORY-US-1147, AIFACTORY-US-1148, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:blueprint-service, feature:wf-architecture-decomposition. Sources: model/workflows/module-blueprints.yaml, model/agents/architecture/solution-architect.yaml, docs/planes/agent-runtime/workflow-definitions/module-blueprints.md.",
      "acceptanceCriteria": [
        "AC1: Given the Draft release of `module-blueprints` (workflow-definition-v1) with its readiness activation, 6 steps, mappings, retry policies, timeouts and the `idempotency_key` documentHash of module-blueprints/submit-version exactly as in model/workflows/module-blueprints.yaml, when BlueprintService/BlueprintValidated of kind Service with `passed` true and BlueprintService/ContextMapDerived for that version both arrive, then the WorkflowEngineService/ReadinessCorrelation submits one run through RunControlService/SubmitRun with a service token naming the project and WorkflowEngineService/ReadinessRunSubmitted is published.",
        "AC2: Given RunControlService/RunAccepted with inputs `service-blueprint` and `context-map` of three contexts, when the run executes, then WorkflowEngineService/WorkflowRunStarted is emitted, module-blueprints/fan-out-contexts starts three branches, each runs module-blueprints/draft-module, module-blueprints/submit-version, module-blueprints/validate and module-blueprints/check-valid on the pinned release of `solution-architect`, and module-blueprints/join completes after the last branch.",
        "AC3: Given every branch passes, when the run completes, then `module-blueprints` (blueprint-module-v1) holds one validated Module Blueprint per context, BlueprintService/BlueprintValidated of kind Module was published once per module with `passed` true, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014, FR-11).",
        "AC4: Given one branch fails, when module-blueprints/join is reached, then WorkflowEngineService/WorkflowRunFailed names the failed step, the Module Blueprints of the other branches stay recorded as artifacts and as Draft or Validated versions, RunControlService/RunFailed is published exactly once, and a gated submit waits on RunControlService/ApprovalRequested until RunControlService/ApprovalDecided (ADR-0026).",
        "AC5: Given the recorded fixture inputs of model/workflows/module-blueprints.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml",
        "model/agents/architecture/solution-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-172",
        "AIFACTORY-TASK-173",
        "AIFACTORY-TASK-174",
        "AIFACTORY-TASK-730"
      ],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8701,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "module-blueprints"
        ],
        "steps": [
          "module-blueprints/fan-out-contexts",
          "module-blueprints/draft-module",
          "module-blueprints/submit-version",
          "module-blueprints/validate",
          "module-blueprints/check-valid",
          "module-blueprints/join"
        ],
        "agents": [
          "solution-architect"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "BlueprintService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "BlueprintService/ContextMapDerived",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-service-v1",
          "blueprint-module-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1145",
        "AIFACTORY-US-1146",
        "AIFACTORY-US-1147",
        "AIFACTORY-US-1148",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:blueprint-service",
        "feature:wf-architecture-decomposition"
      ],
      "source": [
        "model/workflows/module-blueprints.yaml",
        "model/agents/architecture/solution-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/module-blueprints.md"
      ],
      "titlePrefix": "[AIFACTORY-US-010]",
      "number": 10
    },
    {
      "id": "AIFACTORY-TASK-172",
      "type": "task",
      "parent": "AIFACTORY-US-010",
      "title": "Author the release of the workflow definition module-blueprints from the model",
      "sequence": "19.03.01.01",
      "description": "Author the release of the workflow definition module-blueprints from the model. Expected output: A Draft release of module-blueprints (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Service and ContextMapDerived, its 6 steps with the parallel fan-out-contexts and join, input mappings, retry policies, timeouts, the on_false loop of check-valid, the compensation policy and the budget as in model/workflows/module-blueprints.yaml, the failure_policy Retry of draft-module, submit-version and validate copied as it stands and the idempotency_key documentHash of submit-version; loadable by AgentRegistryService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A Draft release of module-blueprints (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Service and ContextMapDerived, its 6 steps with the parallel fan-out-contexts and join, input mappings, retry policies, timeouts, the on_false loop of check-valid, the compensation policy and the budget as in model/workflows/module-blueprints.yaml, the failure_policy Retry of draft-module, submit-version and validate copied as it stands and the idempotency_key documentHash of submit-version; loadable by AgentRegistryService."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-172]",
      "number": 172
    },
    {
      "id": "AIFACTORY-TASK-173",
      "type": "task",
      "parent": "AIFACTORY-US-010",
      "title": "Author the agent releases solution-architect with their prompts and skills",
      "sequence": "19.03.01.02",
      "description": "Author the agent releases solution-architect with their prompts and skills. Expected output: A Draft release of solution-architect with its instructions, the skill solution-architect-draft-module among its bound skills, the tool bindings and the model profile reasoning-high; the release passes a smoke evaluation of the suite architecture-core-v1 on a fixture Service Blueprint and context map.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of solution-architect with its instructions, the skill solution-architect-draft-module among its bound skills, the tool bindings and the model profile reasoning-high; the release passes a smoke evaluation of the suite architecture-core-v1 on a fixture Service Blueprint and context map."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-173]",
      "number": 173
    },
    {
      "id": "AIFACTORY-TASK-174",
      "type": "task",
      "parent": "AIFACTORY-US-010",
      "title": "Fixture run of module-blueprints against recorded inputs",
      "sequence": "19.03.01.03",
      "description": "Fixture run of module-blueprints against recorded inputs. Expected output: The definition runs end to end on a fixture project from the readiness signals to RunCompleted; every step output of every branch validates against its descriptor and the outputs module-blueprints and validation-receipt match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-010).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project from the readiness signals to RunCompleted; every step output of every branch validates against its descriptor and the outputs module-blueprints and validation-receipt match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-010)."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-174]",
      "number": 174
    },
    {
      "id": "AIFACTORY-TASK-730",
      "type": "task",
      "parent": "AIFACTORY-US-010",
      "title": "Verify module-blueprints-in-parallel by running the declared command",
      "sequence": "19.03.01.04",
      "description": "Verify module-blueprints-in-parallel by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-010, including the failed branch of AC4 with the other branches kept and RunFailed exactly once.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-010, including the failed branch of AC4 with the other branches kept and RunFailed exactly once."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-730]",
      "number": 730
    },
    {
      "id": "AIFACTORY-US-1145",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-109",
      "title": "The engine starts one branch per context of the map and joins them with every output kept",
      "sequence": "19.03.02",
      "description": "As a requester, I want every context of my context map drafted in its own branch, in parallel, and one failed branch to fail the run without losing the others, so that the modules are designed at the same time and a single bad module does not erase the good ones. The two parallel steps of `module-blueprints`, which the engine evaluates itself without an agent, a tool or a retry. The step summary says `fan-out-contexts` starts one branch per context of the context map and the branches run in parallel within the token, cost and time caps of the run. The definition does not say how: it gives the fan-out no input and no collection expression, it gives `draft-module` no branch item but the whole `input.context-map`, and WorkflowEngineService defines only the step kinds Fanout and Join and the option `Workflows:Engine:MaxFanout` (default 16). This PBI therefore states as an assumption, pending the owner, that the engine iterates the contexts of the recorded `context-map` input and that each branch carries its context to `draft-module`, `submit-version`, `validate` and `check-valid`; what happens when the map names more contexts than MaxFanout is not stated and is reported to the owner as well. A context map without contexts never reaches the engine, because the readiness member requires `contexts` greater than zero. The fan-out completes with exactly one outcome within PT1M. When `join` becomes ready it waits for every branch: when all branches passed their `check-valid` it completes with one outcome and the run completes with the Module Blueprints and receipts of every branch as outputs; when one branch failed, because a step exhausted its retries or its condition reached the iteration limit, the join fails the run with that branch's evidence while the outputs of the other branches stay recorded as artifacts under the run envelope and their versions stay as BlueprintService left them. Neither step changes a shared system; a fan-out or join that exceeds its timeout PT1M fails with evidence and is not retried (none, 0 attempts). Kind: behavior. Traces: workflows: module-blueprints; steps: module-blueprints/fan-out-contexts, module-blueprints/join; services: WorkflowEngineService; aggregates: WorkflowEngineService/WorkflowRun; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: artifact-v1, blueprint-module-v1; scenarios: SCN-module-blueprints-001, SCN-module-blueprints-007; adrs: ADR-0014; requirements: FR-11. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/module-blueprints.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/module-blueprints.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the recorded input `context-map` names three contexts, when the engine evaluates module-blueprints/fan-out-contexts, then, under the assumption of this PBI that the fan-out iterates the contexts of that input and binds one to each branch, three branches start, each with module-blueprints/draft-module ready for its own context, and the fan-out records exactly one outcome under the run envelope; the binding and the case of more contexts than `Workflows:Engine:MaxFanout` stay pending the owner (SCN-module-blueprints-001).",
        "AC2: Given every branch passed module-blueprints/check-valid, when the engine evaluates module-blueprints/join, then the join completes with one outcome and WorkflowEngineService/WorkflowRunCompleted carries the Module Blueprints and receipts of all branches as run outputs (SCN-module-blueprints-007).",
        "AC3: Given one branch failed and the others passed, when module-blueprints/join is reached, then WorkflowEngineService/WorkflowRunFailed names the failed step of that branch, the outputs of the other branches stay recorded as artifacts and no version is changed by the join (SCN-module-blueprints-007, ADR-0014).",
        "AC4: Given the fan-out or the join exceeds its timeout PT1M, when the engine applies the policy of model/workflows/module-blueprints.yaml, then the step fails with evidence without a retry and the run follows the compensation policy (SCN-module-blueprints-001, SCN-module-blueprints-007)."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-210",
        "AIFACTORY-TASK-4571",
        "AIFACTORY-TASK-4572"
      ],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8702,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "module-blueprints"
        ],
        "steps": [
          "module-blueprints/fan-out-contexts",
          "module-blueprints/join"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-module-v1"
        ],
        "scenarios": [
          "SCN-module-blueprints-001",
          "SCN-module-blueprints-007"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/module-blueprints.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1145]",
      "number": 1145
    },
    {
      "id": "AIFACTORY-TASK-210",
      "type": "task",
      "parent": "AIFACTORY-US-1145",
      "title": "Fixture run with three contexts",
      "sequence": "19.03.02.01",
      "description": "Fixture run with three contexts. Expected output: A fixture Service Blueprint whose context map names three contexts yields three branches and three validated Module Blueprints, and a second fixture in which the branch of one context fails after its iteration limit while the two other Module Blueprints stay recorded; proves SCN-module-blueprints-001 and SCN-module-blueprints-007 (AC1 to AC4 of AIFACTORY-US-1145).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture Service Blueprint whose context map names three contexts yields three branches and three validated Module Blueprints, and a second fixture in which the branch of one context fails after its iteration limit while the two other Module Blueprints stay recorded; proves SCN-module-blueprints-001 and SCN-module-blueprints-007 (AC1 to AC4 of AIFACTORY-US-1145)."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-210]",
      "number": 210
    },
    {
      "id": "AIFACTORY-TASK-4571",
      "type": "task",
      "parent": "AIFACTORY-US-1145",
      "title": "Verify the fan-out and the join of the Draft release against the definition",
      "sequence": "19.03.02.02",
      "description": "Verify the fan-out and the join of the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-172 against model/workflows/module-blueprints.yaml proves that fan-out-contexts and join carry kind parallel, gate none, side_effect_class sandbox, timeout PT1M and no retry, that draft-module depends on fan-out-contexts and join on check-valid, and that draft-module maps service-blueprint and context-map from the run inputs; the branch binding and the per-branch iteration count are not checked, because the definition declares neither and both are pending the owner.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-172 against model/workflows/module-blueprints.yaml proves that fan-out-contexts and join carry kind parallel, gate none, side_effect_class sandbox, timeout PT1M and no retry, that draft-module depends on fan-out-contexts and join on check-valid, and that draft-module maps service-blueprint and context-map from the run inputs; the branch binding and the per-branch iteration count are not checked, because the definition declares neither and both are pending the owner."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4571]",
      "number": 4571
    },
    {
      "id": "AIFACTORY-TASK-4572",
      "type": "task",
      "parent": "AIFACTORY-US-1145",
      "title": "Recorded context maps for the parallel paths",
      "sequence": "19.03.02.03",
      "description": "Recorded context maps for the parallel paths. Expected output: Recorded context-map inputs (artifact-v1) with one and with three contexts and the expected branch list, as the oracle of SCN-module-blueprints-001.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded context-map inputs (artifact-v1) with one and with three contexts and the expected branch list, as the oracle of SCN-module-blueprints-001."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8702,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4572]",
      "number": 4572
    },
    {
      "id": "AIFACTORY-US-1146",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-109",
      "title": "The Solution Architect drafts the Module Blueprint of one context with template, switches and adapters",
      "sequence": "19.03.03",
      "description": "As a requester, I want each module of my product drafted with the template, the switches and the adapters it will be scaffolded with, so that generation scaffolds every module from an explicit, checkable choice. The sandbox-class agent step `draft-module`, run once in every branch. When the engine marks it ready it resolves `service-blueprint` from `input.service-blueprint` and `context-map` from `input.context-map`, the whole map, since the definition declares no branch item; that the branch names the context the module is drafted for is the binding assumed by AIFACTORY-US-1145, pending the owner. On a revision pass the findings of the branch's last receipt are attached as feedback. The `solution-architect` release runs the skill `solution-architect-draft-module`, writes the Module Blueprint with `write-file` in the isolated workspace and returns `module-blueprint-draft` (blueprint-module-v1): the one bounded context it references (MOD-001), the template id and version, the switches it uses (persistence, messaging profile, actors, scheduler, AI), each outbound dependency with its port and owning context (MOD-003) and for persistence the store class and the TenantId convention (MOD-004). The step writes nothing outside the run envelope and needs no approval. It declares `failure_policy` Retry with the exponential budget of 3 attempts and backoff 30s for a Failed attempt of failure class transient; an attempt that exceeds PT30M, fails with another failure class or exhausts the budget fails its branch with evidence, which `join` turns into a failed run. Kind: behavior. Traces: workflows: module-blueprints; steps: module-blueprints/draft-module; agents: solution-architect; services: WorkflowEngineService; events: WorkflowEngineService/StepReady; descriptors: blueprint-service-v1, artifact-v1, blueprint-module-v1; scenarios: SCN-module-blueprints-002; adrs: ADR-0014, ADR-0026, ADR-0027; requirements: FR-11. Depends on: AIFACTORY-US-1145, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/module-blueprints.yaml, model/skills/architecture/solution-architect-draft-module.yaml, model/blueprints.yaml, model/scenarios/module-blueprints.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a branch for one context under the binding assumed by AIFACTORY-US-1145, when `solution-architect` executes module-blueprints/draft-module with `solution-architect-draft-module`, then `module-blueprint-draft` validates against blueprint-module-v1, references exactly that context of the Service Blueprint, names the template version, the switches and the adapters, and is recorded once under the run envelope (SCN-module-blueprints-002).",
        "AC2: Given a revision pass of the branch after module-blueprints/check-valid took its false branch, when the step re-runs, then the findings of the branch's receipt are in its context and the new draft addresses each finding by rule id MOD-001 to MOD-004 or by schema path (SCN-module-blueprints-002, ADR-0026).",
        "AC3: Given an attempt exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the policy of model/workflows/module-blueprints.yaml, then the branch fails with evidence, the sandbox output stays in place and no shared system is changed (SCN-module-blueprints-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml",
        "model/skills/architecture/solution-architect-draft-module.yaml",
        "model/blueprints.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-209",
        "AIFACTORY-TASK-4573",
        "AIFACTORY-TASK-4574"
      ],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8703,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "module-blueprints"
        ],
        "steps": [
          "module-blueprints/draft-module"
        ],
        "agents": [
          "solution-architect"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady"
        ],
        "descriptors": [
          "blueprint-service-v1",
          "artifact-v1",
          "blueprint-module-v1"
        ],
        "scenarios": [
          "SCN-module-blueprints-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1145",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/module-blueprints.yaml",
        "model/skills/architecture/solution-architect-draft-module.yaml",
        "model/blueprints.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1146]",
      "number": 1146
    },
    {
      "id": "AIFACTORY-TASK-209",
      "type": "task",
      "parent": "AIFACTORY-US-1146",
      "title": "Solution architect release",
      "sequence": "19.03.03.01",
      "description": "Solution architect release. Expected output: The step draft-module of the release authored by AIFACTORY-TASK-172 runs solution-architect-draft-module with service-blueprint and context-map mapped as in model/workflows/module-blueprints.yaml and the context of its branch under the binding assumed by AIFACTORY-US-1145; the release chooses template version, switches and adapters for a context and its fixture output is valid against blueprint-module-v1.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step draft-module of the release authored by AIFACTORY-TASK-172 runs solution-architect-draft-module with service-blueprint and context-map mapped as in model/workflows/module-blueprints.yaml and the context of its branch under the binding assumed by AIFACTORY-US-1145; the release chooses template version, switches and adapters for a context and its fixture output is valid against blueprint-module-v1."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-209]",
      "number": 209
    },
    {
      "id": "AIFACTORY-TASK-4573",
      "type": "task",
      "parent": "AIFACTORY-US-1146",
      "title": "Fixture Module Blueprint drafts per context with a revision pass",
      "sequence": "19.03.03.02",
      "description": "Fixture Module Blueprint drafts per context with a revision pass. Expected output: The expected module-blueprint-draft (blueprint-module-v1) for each of the three fixture contexts, and a revision fixture with a MOD-003 finding as feedback and the draft that resolves it, as the oracle of SCN-module-blueprints-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected module-blueprint-draft (blueprint-module-v1) for each of the three fixture contexts, and a revision fixture with a MOD-003 finding as feedback and the draft that resolves it, as the oracle of SCN-module-blueprints-002."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4573]",
      "number": 4573
    },
    {
      "id": "AIFACTORY-TASK-4574",
      "type": "task",
      "parent": "AIFACTORY-US-1146",
      "title": "Prove the draft-module step on the fixture",
      "sequence": "19.03.03.03",
      "description": "Prove the draft-module step on the fixture. Expected output: A fixture run proves SCN-module-blueprints-002 (AC1 to AC3 of AIFACTORY-US-1146); every draft references exactly its context, the revision pass resolves the finding by rule id, and the timeout path fails the branch with evidence.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-module-blueprints-002 (AC1 to AC3 of AIFACTORY-US-1146); every draft references exactly its context, the revision pass resolves the finding by rule id, and the timeout path fails the branch with evidence."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4574]",
      "number": 4574
    },
    {
      "id": "AIFACTORY-US-1147",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-109",
      "title": "Each Module Blueprint is stored as a Draft version and validated against the MOD rules and the pinned template manifest",
      "sequence": "19.03.04",
      "description": "As a requester, I want every drafted Module Blueprint stored as a Draft version and validated against its schema, the MOD rules and the manifest of the template it pins, so that a module never reaches generation with a switch its template does not declare. The two tool steps of each branch, whose service behaviour BlueprintService, ToolAdapterService and TemplateRegistryService deliver; this PBI binds them and proves what the definition expects. `submit-version` resolves `document` from `steps.draft-module.module-blueprint-draft`, the engine emits `StepReady` with `actionClass` shared-write, and `blueprint-submit-version` reaches `Blueprints.SubmitDraftVersion`, which stores a project-scope Draft `BlueprintVersion` of kind Module, idempotent on its document hash; Draft versions are autonomous unless the project policy (BC-20) gates blueprint drafts, in which case the invocation waits on an approval requested through `RunControl.RequestApproval` with proposalKind tool-invocation that names the run and the step and is bound to the request hash and the exact tool version (D64). The declared `idempotency_key` documentHash lets Run Control retry a Failed attempt of failure class transient under the fixed budget of 2 attempts; an Uncertain attempt is settled only by an operator through `ConfirmToolEffect`. `validate` calls `Blueprints.Validate` with the version reference: BlueprintService checks blueprint-module-v1 and the rules MOD-001 to MOD-004 and evaluates MOD-002 against the manifest of the pinned template version, which it reads through `Catalog.ResolveManifest` of TemplateRegistryService, one finding per switch the manifest does not declare. The receipt is recorded whether it passed or not and `BlueprintValidated` of kind Module carries `passed`; BlueprintService moves a passed version to Validated and leaves a failed one Draft. While the registry does not answer the call is answered Unavailable, the version stays as it was and the attempt is transient and retried; a version reference of another tenant is answered NOT_FOUND and the attempt is permanent and not retried (ADR-0015). Kind: behavior. Traces: workflows: module-blueprints; steps: module-blueprints/submit-version, module-blueprints/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, TemplateRegistryService, ToolAdapterService, RunControlService, WorkflowEngineService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, TemplateRegistryService/Catalog.ResolveManifest, ToolAdapterService/ConfirmToolEffect, RunControlService/RunControl.RequestApproval; events: BlueprintService/BlueprintValidated, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain; descriptors: blueprint-module-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-module-blueprints-003, SCN-module-blueprints-004; adrs: ADR-0014, ADR-0015, ADR-0026, ADR-0027; requirements: FR-11. Depends on: AIFACTORY-US-1146, feature:blueprint-service, feature:template-registry-service, feature:tool-adapter-service, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/module-blueprints.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/services/template-library/BlueprintService.yaml, model/services/template-library/TemplateRegistryService.yaml, model/scenarios/module-blueprints.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-module.module-blueprint-draft` is recorded and the project policy does not gate blueprint drafts, when module-blueprints/submit-version runs `blueprint-submit-version` through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Module exists in project scope, `version-ref` is recorded once and a resubmission of the same document returns the same reference (SCN-module-blueprints-003, D64).",
        "AC2: Given the project policy gates blueprint drafts, or an attempt settles Failed transient or Uncertain, when module-blueprints/submit-version runs, then the approval is requested through RunControlService/RunControl.RequestApproval with proposalKind tool-invocation, bound to the invocation request hash and the exact tool version, the write waits for an approving RunControlService/ApprovalDecided after RunControlService/ApprovalRequested naming the run and the step, a rejection yields ToolAdapterService/ToolInvocationDenied, a transient failure is retried under the fixed budget of 2 attempts, and an Uncertain attempt raises ToolAdapterService/ToolEffectUncertain and waits for ToolAdapterService/ConfirmToolEffect (SCN-module-blueprints-003, ADR-0014).",
        "AC3: Given `steps.submit-version.version-ref` is recorded, when module-blueprints/validate runs `blueprint-validate` through BlueprintService/Blueprints.Validate, then MOD-002 is evaluated against the manifest that TemplateRegistryService/Catalog.ResolveManifest returns for the pinned template version, `validation-receipt` is recorded once with findings by rule id MOD-001 to MOD-004 whether it passed or not, and BlueprintService/BlueprintValidated of kind Module carries `passed` (SCN-module-blueprints-004).",
        "AC4: Given TemplateRegistryService does not answer, when module-blueprints/validate runs, then the call is answered Unavailable, no receipt is written, the version stays as it was and the attempt is retried as transient until the fixed budget of 2 attempts or the timeout PT5M is spent; given a version reference of another tenant, it is answered NOT_FOUND and the attempt takes failure class permanent without a retry (SCN-module-blueprints-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4575",
        "AIFACTORY-TASK-4576",
        "AIFACTORY-TASK-4577"
      ],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8704,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "module-blueprints"
        ],
        "steps": [
          "module-blueprints/submit-version",
          "module-blueprints/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "TemplateRegistryService",
          "ToolAdapterService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "TemplateRegistryService/Catalog.ResolveManifest",
          "ToolAdapterService/ConfirmToolEffect",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "blueprint-module-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-module-blueprints-003",
          "SCN-module-blueprints-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1146",
        "feature:blueprint-service",
        "feature:template-registry-service",
        "feature:tool-adapter-service",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/module-blueprints.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1147]",
      "number": 1147
    },
    {
      "id": "AIFACTORY-TASK-4575",
      "type": "task",
      "parent": "AIFACTORY-US-1147",
      "title": "Fixture Module Blueprints with their manifests and expected receipts",
      "sequence": "19.03.04.01",
      "description": "Fixture Module Blueprints with their manifests and expected receipts. Expected output: One fixture Module Blueprint whose switches the pinned template manifest declares, with its expected receipt and Validated state, one that uses an undeclared switch with its MOD-002 finding and Draft state, a registry that does not answer with the expected Unavailable and unchanged version, and a version reference of another tenant with the expected NOT_FOUND.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture Module Blueprint whose switches the pinned template manifest declares, with its expected receipt and Validated state, one that uses an undeclared switch with its MOD-002 finding and Draft state, a registry that does not answer with the expected Unavailable and unchanged version, and a version reference of another tenant with the expected NOT_FOUND."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8704,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4575]",
      "number": 4575
    },
    {
      "id": "AIFACTORY-TASK-4576",
      "type": "task",
      "parent": "AIFACTORY-US-1147",
      "title": "Verify submit-version and validate of the Draft release against the definition",
      "sequence": "19.03.04.02",
      "description": "Verify submit-version and validate of the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-172 against model/workflows/module-blueprints.yaml proves that the steps submit-version and validate name the tools blueprint-submit-version and blueprint-validate, carry side_effect_class shared-write and sandbox, failure_policy Retry, the idempotency_key documentHash on submit-version only, the fixed retry of 2 attempts with backoff 10s, the timeouts PT2M and PT5M and the mappings document from steps.draft-module.module-blueprint-draft and version-ref from steps.submit-version.version-ref; the tool bindings are consumed from feature tool-adapter-service and nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-172 against model/workflows/module-blueprints.yaml proves that the steps submit-version and validate name the tools blueprint-submit-version and blueprint-validate, carry side_effect_class shared-write and sandbox, failure_policy Retry, the idempotency_key documentHash on submit-version only, the fixed retry of 2 attempts with backoff 10s, the timeouts PT2M and PT5M and the mappings document from steps.draft-module.module-blueprint-draft and version-ref from steps.submit-version.version-ref; the tool bindings are consumed from feature tool-adapter-service and nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4576]",
      "number": 4576
    },
    {
      "id": "AIFACTORY-TASK-4577",
      "type": "task",
      "parent": "AIFACTORY-US-1147",
      "title": "Prove the submit and validate steps for Module Blueprints on the fixture",
      "sequence": "19.03.04.03",
      "description": "Prove the submit and validate steps for Module Blueprints on the fixture. Expected output: A fixture run proves SCN-module-blueprints-003 and SCN-module-blueprints-004 (AC1 to AC4 of AIFACTORY-US-1147), including the idempotent resubmission, the gated path, the Uncertain path settled through ConfirmToolEffect, the MOD-002 finding against the manifest returned by Catalog.ResolveManifest, the transient retry while the registry does not answer and the NOT_FOUND of another tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-module-blueprints-003 and SCN-module-blueprints-004 (AC1 to AC4 of AIFACTORY-US-1147), including the idempotent resubmission, the gated path, the Uncertain path settled through ConfirmToolEffect, the MOD-002 finding against the manifest returned by Catalog.ResolveManifest, the transient retry while the registry does not answer and the NOT_FOUND of another tenant."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4577]",
      "number": 4577
    },
    {
      "id": "AIFACTORY-US-1148",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-109",
      "title": "The engine checks each branch's receipt and sends its findings back to its draft at most twice",
      "sequence": "19.03.05",
      "description": "As a requester, I want a failed Module Blueprint validation to go back to its own draft a bounded number of times, so that each module improves on its findings while the other branches are not held back. The condition step of each branch of `module-blueprints`. When `check-valid` becomes ready in a branch the engine evaluates `steps.validate.validation-receipt.passed == true` over that branch's recorded receipt; the condition is read class, calls no service, never retries and completes within PT1M. A passed receipt completes the branch with one outcome and the branch waits at `join`. A failed one takes the `on_false` branch to `draft-module` of the same branch with that receipt as feedback; `draft-module`, `submit-version` and `validate` re-run in order for that context only, and the revised document gets its own Draft version and receipt. The definition declares `max_iterations` 2 but not whether it counts per branch or per run, WorkflowEngineService does not say either, and the scenario derived from the definition counts the iteration on the run. This PBI assumes a count per branch, so that one context's revisions do not use up another's, and reports the point to the owner; the per-branch statements below hold only under that assumption. When the receipt is still failed after the second iteration the branch fails with the validation report as evidence and failure class validation, its Draft versions stay Draft, and `join` fails the run while the other branches' outputs stay recorded. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026, D61). Kind: behavior. Traces: workflows: module-blueprints; steps: module-blueprints/check-valid, module-blueprints/draft-module, module-blueprints/join; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1; scenarios: SCN-module-blueprints-005, SCN-module-blueprints-006; adrs: ADR-0014, ADR-0026; requirements: FR-11. Depends on: AIFACTORY-US-1147, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/module-blueprints.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/module-blueprints.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a branch's receipt is recorded with `passed` true, when the engine evaluates module-blueprints/check-valid for that branch, then the condition completes with exactly one outcome, no service is called and the branch reaches module-blueprints/join (SCN-module-blueprints-005).",
        "AC2: Given a branch's receipt has `passed` false and fewer than 2 iterations were counted, per branch under the assumption of this PBI that is pending the owner, when the engine evaluates module-blueprints/check-valid, then it takes the false branch to module-blueprints/draft-module of the same branch with the receipt as feedback and only that branch re-runs submit and validate (SCN-module-blueprints-006).",
        "AC3: Given a branch's receipt is still `passed` false after the second iteration, when the engine evaluates module-blueprints/check-valid, then the branch fails with the report and failure class validation, WorkflowEngineService/WorkflowRunFailed names `check-valid` once module-blueprints/join is reached, and RunControlService/RunFailed is published exactly once (SCN-module-blueprints-006, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable or the evaluation exceeds PT1M, when the engine evaluates module-blueprints/check-valid, then the condition is not retried and the branch fails with evidence as the compensation policy of model/workflows/module-blueprints.yaml says (SCN-module-blueprints-005, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4578",
        "AIFACTORY-TASK-4579"
      ],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8705,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "module-blueprints"
        ],
        "steps": [
          "module-blueprints/check-valid",
          "module-blueprints/draft-module",
          "module-blueprints/join"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-module-blueprints-005",
          "SCN-module-blueprints-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1147",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/module-blueprints.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/module-blueprints.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1148]",
      "number": 1148
    },
    {
      "id": "AIFACTORY-TASK-4578",
      "type": "task",
      "parent": "AIFACTORY-US-1148",
      "title": "Fixture receipt sequences per branch for the pass, loop and limit paths",
      "sequence": "19.03.05.01",
      "description": "Fixture receipt sequences per branch for the pass, loop and limit paths. Expected output: Recorded receipt sequences for a three-branch run in which one branch passes at once, one passes after a loop and one fails three times, with the expected run outcome and the expected iteration count per branch, the latter dependent on the owner decision whether max_iterations counts per branch or per run.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences for a three-branch run in which one branch passes at once, one passes after a loop and one fails three times, with the expected run outcome and the expected iteration count per branch, the latter dependent on the owner decision whether max_iterations counts per branch or per run."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8705,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4578]",
      "number": 4578
    },
    {
      "id": "AIFACTORY-TASK-4579",
      "type": "task",
      "parent": "AIFACTORY-US-1148",
      "title": "Prove the per-branch condition and bounded loop on the fixture",
      "sequence": "19.03.05.02",
      "description": "Prove the per-branch condition and bounded loop on the fixture. Expected output: A fixture run proves SCN-module-blueprints-005 and SCN-module-blueprints-006 (AC1 to AC4 of AIFACTORY-US-1148); one outcome on pass, a loop back to the draft of the same branch with feedback, iteration counts per branch as assumed pending the owner, and WorkflowRunFailed naming check-valid after the limit with the other branches kept.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-module-blueprints-005 and SCN-module-blueprints-006 (AC1 to AC4 of AIFACTORY-US-1148); one outcome on pass, a loop back to the draft of the same branch with feedback, iteration counts per branch as assumed pending the owner, and WorkflowRunFailed naming check-valid after the limit with the other branches kept."
      ],
      "sourceArtifacts": [
        "model/workflows/module-blueprints.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 87,
      "phase": "factory",
      "stackRank": 8705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4579]",
      "number": 4579
    },
    {
      "id": "AIFACTORY-FEAT-110",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Application design",
      "sequence": "19.04",
      "description": "The workflow definition application-design as a published asset: Produces the application design of every module from its validated Module Blueprint: use cases and handlers, input and output ports, adapters and the telemetry span plan, stored as a typed artifact the generation recipe pins. It has 4 steps, names the agents application-architect and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I1: Generate a microservice. Build order 88 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-011",
        "AIFACTORY-US-1149",
        "AIFACTORY-US-1150",
        "AIFACTORY-US-1151"
      ],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8800,
      "titlePrefix": "[AIFACTORY-FEAT-110]",
      "number": 110
    },
    {
      "id": "AIFACTORY-US-011",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-110",
      "title": "An application design for every module",
      "sequence": "19.04.01",
      "description": "As a requester, I want use cases, ports, adapters and telemetry spans designed for each module from its blueprint, so that the backend developer role fills code against a precise design. The integration PBI of the definition `application-design`. The run is activated, not submitted by a person: the definition has one required readiness member, `module-blueprints`, satisfied by `BlueprintValidated` of kind Module with `passed` true, so every validated Module Blueprint version satisfies its own correlation and the readiness correlation of WorkflowEngineService submits one run for it through `SubmitRun` of RunControlService with a service token that names the project; a newer version of the same Module Blueprint supersedes an open correlation. After `RunAccepted` the engine loads the Draft release through AgentRegistryService and runs four agent steps in order on the `application-architect` release: `discover-use-cases`, `design-ports`, `plan-telemetry` and `assemble-design`. Every step declares `failure_policy` Retry with the exponential budget of 3 attempts; the definition has no tool step, no condition and no approval, because no step writes to a shared system: the design is an artifact of the run. The last step stores the `application-design-v1` body bound to the exact Module Blueprint version and hash through ArtifactService, whose `ArtifactStored` carries the descriptor, so that GenerationRecipeService can offer the design for a backend module entry of a recipe (ADR-0027, D66). The run reports exactly one outcome within the declared budget. The step behaviour is specified in AIFACTORY-US-1149 to AIFACTORY-US-1151; this PBI proves the chain on the recorded fixture. The tasks AIFACTORY-TASK-211 and AIFACTORY-TASK-212 of this PBI moved to AIFACTORY-US-1149 and AIFACTORY-US-1151, the PBIs whose behaviour they prove; AIFACTORY-TASK-212 also moved from an ArtifactService contract task to an AgentRuntimeService implementation task, because ArtifactService delivers the storage with descriptor and lineage itself and the step only needs the runtime path that records its output. Kind: behavior. Traces: workflows: application-design; steps: application-design/discover-use-cases, application-design/design-ports, application-design/plan-telemetry, application-design/assemble-design; agents: application-architect; services: WorkflowEngineService, RunControlService, AgentRegistryService, ArtifactService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun; events: BlueprintService/BlueprintValidated, ArtifactService/ArtifactStored, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-module-v1, application-design-v1; adrs: ADR-0014, ADR-0024, ADR-0026, ADR-0027; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1149, AIFACTORY-US-1150, AIFACTORY-US-1151, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:blueprint-service, feature:artifact-service, feature:wf-module-blueprints. Sources: model/workflows/application-design.yaml, model/agents/architecture/application-architect.yaml, docs/planes/agent-runtime/workflow-definitions/application-design.md.",
      "acceptanceCriteria": [
        "AC1: Given the Draft release of `application-design` (workflow-definition-v1) with its readiness activation, 4 steps, mappings, retry policies and timeouts exactly as in model/workflows/application-design.yaml, when BlueprintService/BlueprintValidated of kind Module with `passed` true arrives, then the WorkflowEngineService/ReadinessCorrelation submits one run for that Module Blueprint version through RunControlService/SubmitRun with a service token naming the project and WorkflowEngineService/ReadinessRunSubmitted is published.",
        "AC2: Given RunControlService/RunAccepted with input `module-blueprints`, when the run executes, then WorkflowEngineService/WorkflowRunStarted is emitted and application-design/discover-use-cases, application-design/design-ports, application-design/plan-telemetry and application-design/assemble-design become ready in that order on the pinned release of `application-architect`.",
        "AC3: Given every step succeeds, when the run completes, then `application-design` (application-design-v1) names the exact Module Blueprint version and hash, ArtifactService/ArtifactStored carries the descriptor, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014, ADR-0027).",
        "AC4: Given a step settles Failed with a non-transient failure class or exhausts its retry budget, when the engine applies the compensation policy of model/workflows/application-design.yaml, then WorkflowEngineService/WorkflowRunFailed names the step, the outputs recorded so far stay as evidence, no design is offered for a recipe unless it was stored before the failure, and RunControlService/RunFailed is published exactly once.",
        "AC5: Given the recorded fixture inputs of model/workflows/application-design.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml",
        "model/agents/architecture/application-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/application-design.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-175",
        "AIFACTORY-TASK-176",
        "AIFACTORY-TASK-177",
        "AIFACTORY-TASK-720"
      ],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8801,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "application-design"
        ],
        "steps": [
          "application-design/discover-use-cases",
          "application-design/design-ports",
          "application-design/plan-telemetry",
          "application-design/assemble-design"
        ],
        "agents": [
          "application-architect"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "ArtifactService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "ArtifactService/ArtifactStored",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-module-v1",
          "application-design-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1149",
        "AIFACTORY-US-1150",
        "AIFACTORY-US-1151",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:blueprint-service",
        "feature:artifact-service",
        "feature:wf-module-blueprints"
      ],
      "source": [
        "model/workflows/application-design.yaml",
        "model/agents/architecture/application-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/application-design.md"
      ],
      "titlePrefix": "[AIFACTORY-US-011]",
      "number": 11
    },
    {
      "id": "AIFACTORY-TASK-175",
      "type": "task",
      "parent": "AIFACTORY-US-011",
      "title": "Author the release of the workflow definition application-design from the model",
      "sequence": "19.04.01.01",
      "description": "Author the release of the workflow definition application-design from the model. Expected output: A Draft release of application-design (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Module, its 4 agent steps, input mappings, retry policies, timeouts, the compensation policy and the budget as in model/workflows/application-design.yaml, with the failure_policy Retry of every step copied as it stands; loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A Draft release of application-design (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Module, its 4 agent steps, input mappings, retry policies, timeouts, the compensation policy and the budget as in model/workflows/application-design.yaml, with the failure_policy Retry of every step copied as it stands; loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-175]",
      "number": 175
    },
    {
      "id": "AIFACTORY-TASK-176",
      "type": "task",
      "parent": "AIFACTORY-US-011",
      "title": "Author the agent releases application-architect with their prompts and skills",
      "sequence": "19.04.01.02",
      "description": "Author the agent releases application-architect with their prompts and skills. Expected output: A Draft release of application-architect with its instructions, the skills application-architect-use-case-discovery, application-architect-output-port-designer, application-architect-telemetry-span-planner and application-architect-assemble-design among its bound skills, the tool bindings and the model profile reasoning; the release passes a smoke evaluation of the suite architecture-core-v1 on a fixture Module Blueprint.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of application-architect with its instructions, the skills application-architect-use-case-discovery, application-architect-output-port-designer, application-architect-telemetry-span-planner and application-architect-assemble-design among its bound skills, the tool bindings and the model profile reasoning; the release passes a smoke evaluation of the suite architecture-core-v1 on a fixture Module Blueprint."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-176]",
      "number": 176
    },
    {
      "id": "AIFACTORY-TASK-177",
      "type": "task",
      "parent": "AIFACTORY-US-011",
      "title": "Fixture run of application-design against recorded inputs",
      "sequence": "19.04.01.03",
      "description": "Fixture run of application-design against recorded inputs. Expected output: The definition runs end to end on a fixture project from a BlueprintValidated of kind Module to RunCompleted; every step output validates against its descriptor and the stored application design matches the recorded one field by field (AC1 to AC3 and AC5 of AIFACTORY-US-011).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project from a BlueprintValidated of kind Module to RunCompleted; every step output validates against its descriptor and the stored application design matches the recorded one field by field (AC1 to AC3 and AC5 of AIFACTORY-US-011)."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-177]",
      "number": 177
    },
    {
      "id": "AIFACTORY-TASK-720",
      "type": "task",
      "parent": "AIFACTORY-US-011",
      "title": "Verify application-design-per-module by running the declared command",
      "sequence": "19.04.01.04",
      "description": "Verify application-design-per-module by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-011, including the failure path of AC4 with WorkflowRunFailed and RunFailed exactly once.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-011, including the failure path of AC4 with WorkflowRunFailed and RunFailed exactly once."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-720]",
      "number": 720
    },
    {
      "id": "AIFACTORY-US-1149",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-110",
      "title": "The Application Architect discovers the use cases of a module and designs their ports and adapters",
      "sequence": "19.04.02",
      "description": "As a requester, I want the commands, queries, event handlers and scheduled work of each module listed with their authorization, and a port and adapter for each, so that the backend code is generated against an explicit list of use cases rather than invented ones. The two read-class agent steps that open `application-design`, both on the `application-architect` release. When `discover-use-cases` becomes ready the engine resolves `module-blueprint` from `input.module-blueprints`, the validated Module Blueprint the readiness bundle carried; the skill `application-architect-use-case-discovery` reads the module's aggregates and returns `use-cases` (artifact-v1): per aggregate the commands, queries, event handlers and scheduled work, each with its authorization and whether it is tenant scoped. When `design-ports` becomes ready it receives the same blueprint and `use-cases` from `steps.discover-use-cases.use-cases`; the skill `application-architect-output-port-designer` returns `ports` (artifact-v1): the input port of every use case, its output ports, each with a direction and a contract, and the adapter that implements each port on the template switches the Module Blueprint declares, so a port is never designed for a switch the module does not use. Both steps use only the read-class tools of their skills (knowledge-search, graph-query, list-files, read-range), write nothing outside the run envelope and need no approval. Each declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, another failure class is not retried, and a step that exceeds PT30M or exhausts the budget fails the run with evidence. Kind: behavior. Traces: workflows: application-design; steps: application-design/discover-use-cases, application-design/design-ports; agents: application-architect; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-module-v1, artifact-v1; scenarios: SCN-application-design-001, SCN-application-design-002; adrs: ADR-0014, ADR-0027; requirements: FR-11. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/application-design.yaml, model/skills/architecture/application-architect-use-case-discovery.yaml, model/skills/architecture/application-architect-output-port-designer.yaml, model/scenarios/application-design.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with input `module-blueprints` (blueprint-module-v1), when `application-architect` executes application-design/discover-use-cases, then `use-cases` (artifact-v1) lists per aggregate of the module its commands, queries, event handlers and scheduled work with authorization and tenant scope, is recorded once under the run envelope and application-design/design-ports becomes ready (SCN-application-design-001).",
        "AC2: Given `steps.discover-use-cases.use-cases` is recorded, when application-design/design-ports runs, then `ports` (artifact-v1) gives every use case an input port, every port a direction and a contract, and every port an adapter on a switch the Module Blueprint declares, and is recorded once under the run envelope (SCN-application-design-002).",
        "AC3: Given an attempt of either step exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the policy of model/workflows/application-design.yaml, then the attempt fails with evidence, WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-application-design-001, SCN-application-design-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml",
        "model/skills/architecture/application-architect-use-case-discovery.yaml",
        "model/skills/architecture/application-architect-output-port-designer.yaml",
        "model/scenarios/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-211",
        "AIFACTORY-TASK-4580",
        "AIFACTORY-TASK-4581"
      ],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8802,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "application-design"
        ],
        "steps": [
          "application-design/discover-use-cases",
          "application-design/design-ports"
        ],
        "agents": [
          "application-architect"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-module-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-application-design-001",
          "SCN-application-design-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/application-design.yaml",
        "model/skills/architecture/application-architect-use-case-discovery.yaml",
        "model/skills/architecture/application-architect-output-port-designer.yaml",
        "model/scenarios/application-design.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1149]",
      "number": 1149
    },
    {
      "id": "AIFACTORY-TASK-211",
      "type": "task",
      "parent": "AIFACTORY-US-1149",
      "title": "Application architect release",
      "sequence": "19.04.02.01",
      "description": "Application architect release. Expected output: The steps discover-use-cases and design-ports of the release authored by AIFACTORY-TASK-175 run application-architect-use-case-discovery and application-architect-output-port-designer with module-blueprint and use-cases mapped as in model/workflows/application-design.yaml and only the read-class tools of their skills.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The steps discover-use-cases and design-ports of the release authored by AIFACTORY-TASK-175 run application-architect-use-case-discovery and application-architect-output-port-designer with module-blueprint and use-cases mapped as in model/workflows/application-design.yaml and only the read-class tools of their skills."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-211]",
      "number": 211
    },
    {
      "id": "AIFACTORY-TASK-4580",
      "type": "task",
      "parent": "AIFACTORY-US-1149",
      "title": "Fixture use cases and ports for a Module Blueprint with persistence and messaging",
      "sequence": "19.04.02.02",
      "description": "Fixture use cases and ports for a Module Blueprint with persistence and messaging. Expected output: A fixture Module Blueprint with two aggregates and the persistence and messaging switches, with the expected use-cases and ports artifacts (artifact-v1), as the oracle of SCN-application-design-001 and SCN-application-design-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture Module Blueprint with two aggregates and the persistence and messaging switches, with the expected use-cases and ports artifacts (artifact-v1), as the oracle of SCN-application-design-001 and SCN-application-design-002."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4580]",
      "number": 4580
    },
    {
      "id": "AIFACTORY-TASK-4581",
      "type": "task",
      "parent": "AIFACTORY-US-1149",
      "title": "Prove the use-case and port steps on the fixture",
      "sequence": "19.04.02.03",
      "description": "Prove the use-case and port steps on the fixture. Expected output: A fixture run proves SCN-application-design-001 and SCN-application-design-002 (AC1 to AC3 of AIFACTORY-US-1149); every use case has authorization and tenant scope, every port a direction, a contract and an adapter on a declared switch, and the timeout path ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-application-design-001 and SCN-application-design-002 (AC1 to AC3 of AIFACTORY-US-1149); every use case has authorization and tenant scope, every port a direction, a contract and an adapter on a declared switch, and the timeout path ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4581]",
      "number": 4581
    },
    {
      "id": "AIFACTORY-US-1150",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-110",
      "title": "The Application Architect plans one telemetry span per use case with the required attributes",
      "sequence": "19.04.03",
      "description": "As a requester, I want one span planned for every use case of a module with the attributes the observability conventions require, so that every generated handler is traced the same way from its first build. The read-class agent step `plan-telemetry` of `application-design`. When the engine marks it ready it resolves `module-blueprint` from `input.module-blueprints`, `use-cases` from `steps.discover-use-cases.use-cases` and `ports` from `steps.design-ports.ports`; the `application-architect` release runs the skill `application-architect-telemetry-span-planner` and returns `span-plan` (artifact-v1): exactly one span per use case, named after the use case, with the attributes the observability conventions require, among them the tenant of a tenant-scoped use case, and the output ports the span covers. A use case without a span or a span without a use case is an error of the step output, not something a later step repairs. The step uses only the read-class tools of its skill, writes nothing outside the run envelope and needs no approval. It declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, another failure class is not retried, and an attempt that exceeds PT30M or exhausts the budget fails the run with evidence, the use cases and ports recorded before it staying in place (ADR-0014, recovery not replay). Kind: behavior. Traces: workflows: application-design; steps: application-design/plan-telemetry; agents: application-architect; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunFailed; descriptors: artifact-v1; scenarios: SCN-application-design-003; adrs: ADR-0014; requirements: FR-11. Depends on: AIFACTORY-US-1149, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/application-design.yaml, model/skills/architecture/application-architect-telemetry-span-planner.yaml, model/scenarios/application-design.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `use-cases` and `ports` are recorded, when `application-architect` executes application-design/plan-telemetry, then `span-plan` (artifact-v1) holds exactly one span per use case with the required attributes and the output ports it covers, and is recorded once under the run envelope (SCN-application-design-003).",
        "AC2: Given a tenant-scoped use case, when its span is planned, then the span carries the tenant attribute, and given a use case that is not tenant scoped, then the span does not invent one (SCN-application-design-003).",
        "AC3: Given an attempt exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the policy of model/workflows/application-design.yaml, then the attempt fails with evidence, WorkflowEngineService/WorkflowRunFailed names the step and the recorded use cases and ports stay in place (SCN-application-design-003, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml",
        "model/skills/architecture/application-architect-telemetry-span-planner.yaml",
        "model/scenarios/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4582",
        "AIFACTORY-TASK-4583"
      ],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8803,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "application-design"
        ],
        "steps": [
          "application-design/plan-telemetry"
        ],
        "agents": [
          "application-architect"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-application-design-003"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1149",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/application-design.yaml",
        "model/skills/architecture/application-architect-telemetry-span-planner.yaml",
        "model/scenarios/application-design.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1150]",
      "number": 1150
    },
    {
      "id": "AIFACTORY-TASK-4582",
      "type": "task",
      "parent": "AIFACTORY-US-1150",
      "title": "Fixture span plan for the fixture use cases",
      "sequence": "19.04.03.01",
      "description": "Fixture span plan for the fixture use cases. Expected output: The expected span-plan (artifact-v1) for the fixture use cases and ports, one span per use case with the tenant attribute on the tenant-scoped ones, as the oracle of SCN-application-design-003.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected span-plan (artifact-v1) for the fixture use cases and ports, one span per use case with the tenant attribute on the tenant-scoped ones, as the oracle of SCN-application-design-003."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8803,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4582]",
      "number": 4582
    },
    {
      "id": "AIFACTORY-TASK-4583",
      "type": "task",
      "parent": "AIFACTORY-US-1150",
      "title": "Prove the telemetry planning step on the fixture",
      "sequence": "19.04.03.02",
      "description": "Prove the telemetry planning step on the fixture. Expected output: A fixture run proves SCN-application-design-003 (AC1 to AC3 of AIFACTORY-US-1150); one span per use case, the tenant attribute exactly on tenant-scoped use cases, and the timeout path failing the run with the earlier outputs kept.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-application-design-003 (AC1 to AC3 of AIFACTORY-US-1150); one span per use case, the tenant attribute exactly on tenant-scoped use cases, and the timeout path failing the run with the earlier outputs kept."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4583]",
      "number": 4583
    },
    {
      "id": "AIFACTORY-US-1151",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-110",
      "title": "The application design is assembled against its schema and stored as a typed artifact bound to the Module Blueprint version",
      "sequence": "19.04.04",
      "description": "As a requester, I want the use cases, ports and span plan of a module assembled into one application design stored with its descriptor, so that a generation recipe can pin exactly that design for the backend module. The last agent step of `application-design`. When `plan-telemetry` succeeded the engine marks `assemble-design` ready and resolves `module-blueprint`, `use-cases`, `ports` and `span-plan` from the mappings of the definition. The `application-architect` release runs the skill `application-architect-assemble-design` in sandbox class: it writes the `application-design-v1` body with `write-file` in the isolated workspace, with `moduleBlueprintRef` naming the exact Module Blueprint id, version and hash, every use case with its handler and every port with its direction and contract, so that the body validates against docs/reference/schemas/application-design.schema.json, and returns it as the step output `application-design`. The skill calls no gRPC method; AgentRuntimeService records the output under the run envelope through `Artifacts.Store` of ArtifactService, the one writer of artifacts, with the producer run, attempt and agent and the lineage the skill declared: the Module Blueprint as the run input and the use cases, ports and span plan as artifacts it derives from. Exactly one new `ArtifactStored` results and it carries the descriptor application-design-v1, which GenerationRecipeService hears to offer the design for a backend module entry; the intermediate artifacts are not stored again. The step requests no approval. It declares `failure_policy` Retry with the exponential budget of 3 attempts; an attempt that exceeds PT30M, fails with another failure class or exhausts the budget fails the run with evidence, and a design already stored is not written twice on recovery because `Artifacts.Store` is idempotent on tenant and hash (ADR-0014). Kind: behavior. Traces: workflows: application-design; steps: application-design/assemble-design; agents: application-architect; services: WorkflowEngineService, AgentRuntimeService, ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Store; events: ArtifactService/ArtifactStored, WorkflowEngineService/WorkflowRunFailed; descriptors: application-design-v1, blueprint-module-v1, artifact-v1; scenarios: SCN-application-design-004; adrs: ADR-0014, ADR-0027; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1150, feature:artifact-service, feature:agent-runtime-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/application-design.yaml, model/skills/architecture/application-architect-assemble-design.yaml, model/services/knowledge/ArtifactService.yaml, docs/reference/schemas/application-design.schema.json, model/scenarios/application-design.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `use-cases`, `ports` and `span-plan` are recorded, when `application-architect` executes application-design/assemble-design, then the output `application-design` validates against application-design-v1, names the exact Module Blueprint version and hash in `moduleBlueprintRef`, gives every use case a handler and every port a direction and a contract (SCN-application-design-004, ADR-0027).",
        "AC2: Given the output is returned, when AgentRuntimeService records it through ArtifactService/Artifacts.Store, then exactly one new ArtifactService/ArtifactStored is emitted with the descriptor application-design-v1, the producer run and the content hash, and the lineage of the ArtifactService/Artifact links the Module Blueprint and the use cases, ports and span plan artifacts, which are not stored again (SCN-application-design-004).",
        "AC3: Given an attempt exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the compensation policy of model/workflows/application-design.yaml, then the attempt fails with evidence, WorkflowEngineService/WorkflowRunFailed names the step and no artifact is written twice on recovery (SCN-application-design-004, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml",
        "model/skills/architecture/application-architect-assemble-design.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/application-design.schema.json",
        "model/scenarios/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-212",
        "AIFACTORY-TASK-4584",
        "AIFACTORY-TASK-4585"
      ],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8804,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "application-design"
        ],
        "steps": [
          "application-design/assemble-design"
        ],
        "agents": [
          "application-architect"
        ],
        "services": [
          "WorkflowEngineService",
          "AgentRuntimeService",
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ArtifactService/ArtifactStored",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "application-design-v1",
          "blueprint-module-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-application-design-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1150",
        "feature:artifact-service",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/application-design.yaml",
        "model/skills/architecture/application-architect-assemble-design.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "docs/reference/schemas/application-design.schema.json",
        "model/scenarios/application-design.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1151]",
      "number": 1151
    },
    {
      "id": "AIFACTORY-TASK-212",
      "type": "task",
      "parent": "AIFACTORY-US-1151",
      "title": "Record the assembled design through Artifacts.Store with its descriptor and lineage",
      "sequence": "19.04.04.01",
      "description": "Record the assembled design through Artifacts.Store with its descriptor and lineage. Expected output: The existing runtime path that records step outputs under the run envelope is reused and verified for assemble-design; the application-design output is stored through Artifacts.Store with producer run, attempt and agent, the descriptor application-design-v1 and the lineage the skill declared, yielding exactly one new ArtifactStored that carries the descriptor and no second store of the use-cases, ports and span-plan artifacts.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "The existing runtime path that records step outputs under the run envelope is reused and verified for assemble-design; the application-design output is stored through Artifacts.Store with producer run, attempt and agent, the descriptor application-design-v1 and the lineage the skill declared, yielding exactly one new ArtifactStored that carries the descriptor and no second store of the use-cases, ports and span-plan artifacts."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-212]",
      "number": 212
    },
    {
      "id": "AIFACTORY-TASK-4584",
      "type": "task",
      "parent": "AIFACTORY-US-1151",
      "title": "Fixture expected application design with its lineage",
      "sequence": "19.04.04.02",
      "description": "Fixture expected application design with its lineage. Expected output: The expected application-design-v1 body of the fixture run with its moduleBlueprintRef, use cases with handlers and ports with direction and contract, its content hash and lineage, and the expectation of exactly one new ArtifactStored, as the oracle of SCN-application-design-004.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected application-design-v1 body of the fixture run with its moduleBlueprintRef, use cases with handlers and ports with direction and contract, its content hash and lineage, and the expectation of exactly one new ArtifactStored, as the oracle of SCN-application-design-004."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8804,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4584]",
      "number": 4584
    },
    {
      "id": "AIFACTORY-TASK-4585",
      "type": "task",
      "parent": "AIFACTORY-US-1151",
      "title": "Prove the assemble and store step on the fixture",
      "sequence": "19.04.04.03",
      "description": "Prove the assemble and store step on the fixture. Expected output: A fixture run proves SCN-application-design-004 (AC1 to AC3 of AIFACTORY-US-1151); the design validates against docs/reference/schemas/application-design.schema.json, exactly one ArtifactStored carries the descriptor application-design-v1, and the recovery path writes nothing twice.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-application-design-004 (AC1 to AC3 of AIFACTORY-US-1151); the design validates against docs/reference/schemas/application-design.schema.json, exactly one ArtifactStored carries the descriptor application-design-v1, and the recovery path writes nothing twice."
      ],
      "sourceArtifacts": [
        "model/workflows/application-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 88,
      "phase": "factory",
      "stackRank": 8804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4585]",
      "number": 4585
    },
    {
      "id": "AIFACTORY-FEAT-111",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Database blueprint",
      "sequence": "19.05",
      "description": "The workflow definition database-blueprint as a published asset: Builds the Database Blueprint from the Service Blueprint and the derived domain model: stores per context, tables with tenant and classification conventions, retention and migration policy; validated against the DSL. A product without persistence yields a blueprint with no stores. It has 5 steps, names the agents database-engineer and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I1: Generate a microservice. Build order 89 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-012",
        "AIFACTORY-US-1152",
        "AIFACTORY-US-1153",
        "AIFACTORY-US-1154"
      ],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8900,
      "titlePrefix": "[AIFACTORY-FEAT-111]",
      "number": 111
    },
    {
      "id": "AIFACTORY-US-012",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-111",
      "title": "A Database Blueprint from the domain model",
      "sequence": "19.05.01",
      "description": "As a requester, I want stores, tables and conventions designed from the domain model before any code is generated, so that the database role generates mappings and migrations from an approved design. The integration PBI of the definition `database-blueprint`. The run is activated, not submitted by a person: the readiness correlation of WorkflowEngineService for the project waits for two required members, `service-blueprint` satisfied by `BlueprintValidated` of kind Service with `passed` true and `domain-model` satisfied by `DomainModelDerived` with at least one aggregate, and then submits exactly one run through `SubmitRun` of RunControlService with a service token that names the project and the idempotency key of scope, operation, workflow release and bundle fingerprint. After `RunAccepted` the engine loads the Draft release through AgentRegistryService and runs five steps in order: `derive-stores` and `draft-database-blueprint` on the `database-engineer` release, the tools `blueprint-submit-version` and `blueprint-validate`, and the condition `check-valid`, which loops back to the draft at most twice. Every agent and tool step declares `failure_policy` Retry and `submit-version` declares `idempotency_key` documentHash (ADR-0014). The run outputs are the last `database-blueprint-draft` as `database-blueprint` and the receipt; a passed receipt publishes `BlueprintValidated` of kind Database, which lets GenerationRecipeService pin the blueprint for a module with persistence. The workflow summary says a product without persistence yields a blueprint with no stores, but blueprint-database-v1 describes one store per document and requires `owningModule`, `storeClass`, `profile`, `backupClass`, `tables` and `migrations`, so a blueprint without a store cannot pass its schema; this conflict, and whether one draft covers the stores of several contexts, is reported to the owner, and no schema validity is asserted for a product without persistence until it is decided. The run reports exactly one outcome within the declared budget. The step behaviour is specified in AIFACTORY-US-1152 to AIFACTORY-US-1154; this PBI proves the chain on the recorded fixture with persistence. The tasks AIFACTORY-TASK-213 and AIFACTORY-TASK-214 of this PBI moved to AIFACTORY-US-1152, the PBI whose behaviour they prove, with their repository and kind unchanged. Kind: behavior. Traces: workflows: database-blueprint; steps: database-blueprint/derive-stores, database-blueprint/draft-database-blueprint, database-blueprint/submit-version, database-blueprint/validate, database-blueprint/check-valid; agents: database-engineer; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService, BlueprintService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun; events: BlueprintService/DomainModelDerived, BlueprintService/BlueprintValidated, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-service-v1, blueprint-database-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0024, ADR-0026, ADR-0027; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1152, AIFACTORY-US-1153, AIFACTORY-US-1154, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:blueprint-service, feature:wf-architecture-decomposition. Sources: model/workflows/database-blueprint.yaml, model/agents/engineering/database-engineer.yaml, docs/planes/agent-runtime/workflow-definitions/database-blueprint.md.",
      "acceptanceCriteria": [
        "AC1: Given the Draft release of `database-blueprint` (workflow-definition-v1) with its readiness activation, 5 steps, mappings, retry policies, timeouts and the `idempotency_key` documentHash of database-blueprint/submit-version exactly as in model/workflows/database-blueprint.yaml, when BlueprintService/BlueprintValidated of kind Service with `passed` true and BlueprintService/DomainModelDerived for that blueprint arrive, then the WorkflowEngineService/ReadinessCorrelation submits one run through RunControlService/SubmitRun with a service token naming the project and WorkflowEngineService/ReadinessRunSubmitted is published.",
        "AC2: Given RunControlService/RunAccepted with inputs `service-blueprint` and `domain-model`, when the run executes, then WorkflowEngineService/WorkflowRunStarted is emitted and database-blueprint/derive-stores, database-blueprint/draft-database-blueprint, database-blueprint/submit-version, database-blueprint/validate and database-blueprint/check-valid become ready in that order on the pinned release of `database-engineer`.",
        "AC3: Given every step succeeds, when the run completes, then `database-blueprint` (blueprint-database-v1) and `validation-receipt` are the run outputs, BlueprintService/BlueprintValidated carries the Database kind with `passed` true, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once; the run of a product without persistence is not asserted, because the store-less blueprint the workflow summary names conflicts with the required fields of blueprint-database-v1, a point pending the owner (ADR-0014, FR-11).",
        "AC4: Given a step settles Failed with a non-transient failure class, exhausts its retry budget or the condition database-blueprint/check-valid reaches its iteration limit, when the engine applies the compensation policy of model/workflows/database-blueprint.yaml, then WorkflowEngineService/WorkflowRunFailed names the step, every Draft version stays a Draft and RunControlService/RunFailed is published exactly once; a gated submit waits on RunControlService/ApprovalRequested until RunControlService/ApprovalDecided (ADR-0026).",
        "AC5: Given the recorded fixture inputs of model/workflows/database-blueprint.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml",
        "model/agents/engineering/database-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/database-blueprint.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-178",
        "AIFACTORY-TASK-179",
        "AIFACTORY-TASK-180",
        "AIFACTORY-TASK-724"
      ],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8901,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "database-blueprint"
        ],
        "steps": [
          "database-blueprint/derive-stores",
          "database-blueprint/draft-database-blueprint",
          "database-blueprint/submit-version",
          "database-blueprint/validate",
          "database-blueprint/check-valid"
        ],
        "agents": [
          "database-engineer"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "BlueprintService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun"
        ],
        "events": [
          "BlueprintService/DomainModelDerived",
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-service-v1",
          "blueprint-database-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1152",
        "AIFACTORY-US-1153",
        "AIFACTORY-US-1154",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:blueprint-service",
        "feature:wf-architecture-decomposition"
      ],
      "source": [
        "model/workflows/database-blueprint.yaml",
        "model/agents/engineering/database-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/database-blueprint.md"
      ],
      "titlePrefix": "[AIFACTORY-US-012]",
      "number": 12
    },
    {
      "id": "AIFACTORY-TASK-178",
      "type": "task",
      "parent": "AIFACTORY-US-012",
      "title": "Author the release of the workflow definition database-blueprint from the model",
      "sequence": "19.05.01.01",
      "description": "Author the release of the workflow definition database-blueprint from the model. Expected output: A Draft release of database-blueprint (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Service and DomainModelDerived, its 5 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid, the compensation policy and the budget as in model/workflows/database-blueprint.yaml, with the failure_policy Retry of derive-stores, draft-database-blueprint, submit-version and validate copied as it stands and the idempotency_key documentHash of submit-version; loadable by AgentRegistryService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A Draft release of database-blueprint (workflow-definition-v1) with its readiness activation on BlueprintValidated of kind Service and DomainModelDerived, its 5 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid, the compensation policy and the budget as in model/workflows/database-blueprint.yaml, with the failure_policy Retry of derive-stores, draft-database-blueprint, submit-version and validate copied as it stands and the idempotency_key documentHash of submit-version; loadable by AgentRegistryService."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-178]",
      "number": 178
    },
    {
      "id": "AIFACTORY-TASK-179",
      "type": "task",
      "parent": "AIFACTORY-US-012",
      "title": "Author the agent releases database-engineer with their prompts and skills",
      "sequence": "19.05.01.02",
      "description": "Author the agent releases database-engineer with their prompts and skills. Expected output: A Draft release of database-engineer with its instructions, the skills database-engineer-derive-stores and database-engineer-draft-database-blueprint among its bound skills, the tool bindings and the model profile code-agent; the release passes a smoke evaluation of the suite engineering-core-v1 on a fixture domain model.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of database-engineer with its instructions, the skills database-engineer-derive-stores and database-engineer-draft-database-blueprint among its bound skills, the tool bindings and the model profile code-agent; the release passes a smoke evaluation of the suite engineering-core-v1 on a fixture domain model."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-179]",
      "number": 179
    },
    {
      "id": "AIFACTORY-TASK-180",
      "type": "task",
      "parent": "AIFACTORY-US-012",
      "title": "Fixture run of database-blueprint against recorded inputs",
      "sequence": "19.05.01.03",
      "description": "Fixture run of database-blueprint against recorded inputs. Expected output: The definition runs end to end on a fixture project from the readiness signals to RunCompleted; every step output validates against its descriptor and the outputs database-blueprint and validation-receipt match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-012).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project from the readiness signals to RunCompleted; every step output validates against its descriptor and the outputs database-blueprint and validation-receipt match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-012)."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-180]",
      "number": 180
    },
    {
      "id": "AIFACTORY-TASK-724",
      "type": "task",
      "parent": "AIFACTORY-US-012",
      "title": "Verify database-blueprint by running the declared command",
      "sequence": "19.05.01.04",
      "description": "Verify database-blueprint by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-012 on the fixture product with persistence, including the failure path of AC4 with RunFailed exactly once; a product without persistence is added only once the owner decides the store-less blueprint.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-012 on the fixture product with persistence, including the failure path of AC4 with RunFailed exactly once; a product without persistence is added only once the owner decides the store-less blueprint."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-724]",
      "number": 724
    },
    {
      "id": "AIFACTORY-US-1152",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-111",
      "title": "The Database Engineer derives the stores per context and drafts the Database Blueprint",
      "sequence": "19.05.02",
      "description": "As a requester, I want the stores of my product derived from its aggregates and written into a Database Blueprint with tenant, classification and retention conventions, so that persistence is designed explicitly, and a product without persistence says so instead of getting an empty guess. The two agent steps of `database-blueprint`, both on the `database-engineer` release. When `derive-stores` becomes ready the engine resolves `domain-model` from `input.domain-model` and `service-blueprint` from `input.service-blueprint`; the read-class skill `database-engineer-derive-stores` returns `store-plan` (artifact-v1): per context the store it owns and the aggregates it persists, one owning service per store, and the contexts that have no persistence named as such. When `draft-database-blueprint` becomes ready it receives the same inputs and `store-plan` from `steps.derive-stores.store-plan`, and on a revision pass the findings of the last receipt as feedback; the sandbox-class skill `database-engineer-draft-database-blueprint` writes the Database Blueprint with `write-file` in the isolated workspace and returns `database-blueprint-draft` (blueprint-database-v1): its owning module, tables and keys, the TenantId column on every table not marked platform-scoped, the store class and engine profile, the classification and retention per table and the migration policy, so that DB-001 to DB-004 can hold. Two points are not settled and are reported to the owner. The schema holds one `owningModule` per document, so whether one draft covers the stores of several contexts of the plan is open. The workflow summary says a product without persistence yields a blueprint with no stores, while blueprint-database-v1 requires `owningModule`, `storeClass`, `profile`, `backupClass`, `tables` and `migrations`, so such a draft fails its schema; this PBI asserts no draft for a store plan without stores. Neither step writes outside the run envelope or needs an approval. Each declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, another failure class is not retried, and a step that exceeds PT30M or exhausts the budget fails the run with evidence, the sandbox output staying in place. Kind: behavior. Traces: workflows: database-blueprint; steps: database-blueprint/derive-stores, database-blueprint/draft-database-blueprint; agents: database-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: artifact-v1, blueprint-service-v1, blueprint-database-v1; scenarios: SCN-database-blueprint-001, SCN-database-blueprint-002; adrs: ADR-0014, ADR-0026, ADR-0027; requirements: FR-11. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/database-blueprint.yaml, model/skills/engineering/database-engineer-derive-stores.yaml, model/skills/engineering/database-engineer-draft-database-blueprint.yaml, model/blueprints.yaml, model/scenarios/database-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `service-blueprint` and `domain-model`, when `database-engineer` executes database-blueprint/derive-stores, then `store-plan` (artifact-v1) names per context its store, its owning service and its persisted aggregates, names every context without persistence, and is recorded once under the run envelope (SCN-database-blueprint-001).",
        "AC2: Given `steps.derive-stores.store-plan` is recorded with a store, when database-blueprint/draft-database-blueprint runs, then `database-blueprint-draft` validates against blueprint-database-v1 with its owning module, tables, keys, the TenantId convention, store class, classification, retention and migration policy, and is recorded once; the draft for a store plan without stores, and a draft that covers several contexts, are pending the owner and not asserted (SCN-database-blueprint-002, FR-11).",
        "AC3: Given a revision pass after database-blueprint/check-valid took its false branch, when the draft step re-runs, then the findings of `steps.validate.validation-receipt` are in its context and the new draft addresses each by rule id DB-001 to DB-004 or schema path (SCN-database-blueprint-002, ADR-0026).",
        "AC4: Given an attempt of either step exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the policy of model/workflows/database-blueprint.yaml, then the attempt fails with evidence, WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-database-blueprint-001, SCN-database-blueprint-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml",
        "model/skills/engineering/database-engineer-derive-stores.yaml",
        "model/skills/engineering/database-engineer-draft-database-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-213",
        "AIFACTORY-TASK-4586",
        "AIFACTORY-TASK-214"
      ],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8902,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "database-blueprint"
        ],
        "steps": [
          "database-blueprint/derive-stores",
          "database-blueprint/draft-database-blueprint"
        ],
        "agents": [
          "database-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-service-v1",
          "blueprint-database-v1"
        ],
        "scenarios": [
          "SCN-database-blueprint-001",
          "SCN-database-blueprint-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/database-blueprint.yaml",
        "model/skills/engineering/database-engineer-derive-stores.yaml",
        "model/skills/engineering/database-engineer-draft-database-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/database-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1152]",
      "number": 1152
    },
    {
      "id": "AIFACTORY-TASK-213",
      "type": "task",
      "parent": "AIFACTORY-US-1152",
      "title": "Database engineer release for blueprint authoring",
      "sequence": "19.05.02.01",
      "description": "Database engineer release for blueprint authoring. Expected output: The steps derive-stores and draft-database-blueprint of the release authored by AIFACTORY-TASK-178 run database-engineer-derive-stores in read class and database-engineer-draft-database-blueprint in sandbox class with domain-model, service-blueprint and store-plan mapped as in model/workflows/database-blueprint.yaml; the fixture draft validates against blueprint-database-v1.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The steps derive-stores and draft-database-blueprint of the release authored by AIFACTORY-TASK-178 run database-engineer-derive-stores in read class and database-engineer-draft-database-blueprint in sandbox class with domain-model, service-blueprint and store-plan mapped as in model/workflows/database-blueprint.yaml; the fixture draft validates against blueprint-database-v1."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8902,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-213]",
      "number": 213
    },
    {
      "id": "AIFACTORY-TASK-4586",
      "type": "task",
      "parent": "AIFACTORY-US-1152",
      "title": "Fixture domain models with and without persistence and their expected drafts",
      "sequence": "19.05.02.02",
      "description": "Fixture domain models with and without persistence and their expected drafts. Expected output: A fixture domain model with one persisted context and one context without persistence, with the expected store-plan (artifact-v1) and database-blueprint-draft (blueprint-database-v1), as the oracle of SCN-database-blueprint-001 and SCN-database-blueprint-002; the fixture product without persistence and its store-plan are recorded, while its expected draft declaring no stores depends on the owner decision on store-less blueprints and on drafts covering several contexts.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture domain model with one persisted context and one context without persistence, with the expected store-plan (artifact-v1) and database-blueprint-draft (blueprint-database-v1), as the oracle of SCN-database-blueprint-001 and SCN-database-blueprint-002; the fixture product without persistence and its store-plan are recorded, while its expected draft declaring no stores depends on the owner decision on store-less blueprints and on drafts covering several contexts."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4586]",
      "number": 4586
    },
    {
      "id": "AIFACTORY-TASK-214",
      "type": "task",
      "parent": "AIFACTORY-US-1152",
      "title": "Fixture runs with and without persistence",
      "sequence": "19.05.02.03",
      "description": "Fixture runs with and without persistence. Expected output: Both fixture products run derive-stores and prove SCN-database-blueprint-001, and the product with persistence runs draft-database-blueprint and proves SCN-database-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1152); the product without persistence yields a store plan that names its contexts without persistence, its draft is asserted only once the owner decides the store-less blueprint, the revision pass resolves a DB-002 finding by rule id, and the timeout path ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Both fixture products run derive-stores and prove SCN-database-blueprint-001, and the product with persistence runs draft-database-blueprint and proves SCN-database-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1152); the product without persistence yields a store plan that names its contexts without persistence, its draft is asserted only once the owner decides the store-less blueprint, the revision pass resolves a DB-002 finding by rule id, and the timeout path ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-214]",
      "number": 214
    },
    {
      "id": "AIFACTORY-US-1153",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-111",
      "title": "The Database Blueprint draft is stored as a Draft version and validated with a receipt against the DB rules",
      "sequence": "19.05.03",
      "description": "As a requester, I want the drafted Database Blueprint stored as a Draft version of my project and validated against its schema and the DB rules, so that only a Database Blueprint with tenant, classification and retention conventions reaches a generation recipe. The two tool steps of `database-blueprint`, whose service behaviour BlueprintService and ToolAdapterService deliver; this PBI binds them and proves what the definition expects. `submit-version` resolves `document` from `steps.draft-database-blueprint.database-blueprint-draft`, the engine emits `StepReady` with `actionClass` shared-write, and `blueprint-submit-version` reaches `Blueprints.SubmitDraftVersion`, which stores a project-scope Draft `BlueprintVersion` of kind Database, idempotent on its document hash. Draft versions are autonomous unless the project policy (BC-20) gates blueprint drafts, in which case the invocation waits on an approval requested through `RunControl.RequestApproval` with proposalKind tool-invocation that names the run and the step and is bound to the request hash and the exact tool version, and a rejected or expired decision denies it (D64). The declared `idempotency_key` documentHash lets Run Control retry a Failed attempt of failure class transient under the fixed budget of 2 attempts; an Uncertain attempt is settled only by an operator through `ConfirmToolEffect`. `validate` calls `Blueprints.Validate` with the version reference: BlueprintService checks blueprint-database-v1 and the rules DB-001 to DB-004 from what the document declares, records the receipt whether it passed or not, moves a passed version to Validated, leaves a failed one Draft and publishes `BlueprintValidated` with the Database kind, `passed` and the document hash; the call writes only the receipt. A blueprint that declares no stores is not asserted to pass: blueprint-database-v1 requires `owningModule`, `storeClass`, `profile`, `backupClass`, `tables` and `migrations`, and the conflict with the workflow summary is reported to the owner. A version reference of another tenant is answered NOT_FOUND like an unknown one, and the attempt takes failure class permanent and is not retried (ADR-0015). Kind: behavior. Traces: workflows: database-blueprint; steps: database-blueprint/submit-version, database-blueprint/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, ToolAdapterService, RunControlService, WorkflowEngineService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, ToolAdapterService/ConfirmToolEffect, RunControlService/RunControl.RequestApproval; events: BlueprintService/BlueprintValidated, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain; descriptors: blueprint-database-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-database-blueprint-003, SCN-database-blueprint-004; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-11. Depends on: AIFACTORY-US-1152, feature:blueprint-service, feature:tool-adapter-service, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/database-blueprint.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/services/template-library/BlueprintService.yaml, model/blueprints.yaml, model/scenarios/database-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the draft is recorded and the project policy does not gate blueprint drafts, when database-blueprint/submit-version runs `blueprint-submit-version` through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Database exists in project scope, `version-ref` is recorded once and the same document submitted again returns the same reference (SCN-database-blueprint-003, D64).",
        "AC2: Given the project policy gates blueprint drafts, or an attempt settles Failed transient or Uncertain, when database-blueprint/submit-version runs, then the approval is requested through RunControlService/RunControl.RequestApproval with proposalKind tool-invocation, bound to the invocation request hash and the exact tool version, the write waits for an approving RunControlService/ApprovalDecided after RunControlService/ApprovalRequested naming the run and the step, a rejection yields ToolAdapterService/ToolInvocationDenied, a transient failure is retried under the fixed budget of 2 attempts, and an Uncertain attempt raises ToolAdapterService/ToolEffectUncertain and waits for ToolAdapterService/ConfirmToolEffect (SCN-database-blueprint-003, ADR-0014).",
        "AC3: Given `steps.submit-version.version-ref` is recorded, when database-blueprint/validate runs `blueprint-validate` through BlueprintService/Blueprints.Validate, then `validation-receipt` with findings by rule id DB-001 to DB-004 or schema path is recorded once whether it passed or not, BlueprintService/BlueprintValidated carries the Database kind and `passed`, a passed version is Validated and a failed one stays Draft (SCN-database-blueprint-004).",
        "AC4: Given a version reference of another tenant, or an attempt of database-blueprint/validate that exceeds PT5M or settles Failed transient until the fixed budget of 2 attempts is spent, when the step runs, then the other tenant is answered NOT_FOUND with no receipt and the attempt is permanent and not retried, the exhausted case fails with evidence, and the version keeps its state (SCN-database-blueprint-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/blueprints.yaml",
        "model/scenarios/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4587",
        "AIFACTORY-TASK-4588",
        "AIFACTORY-TASK-4589"
      ],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8903,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "database-blueprint"
        ],
        "steps": [
          "database-blueprint/submit-version",
          "database-blueprint/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "ToolAdapterService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "ToolAdapterService/ConfirmToolEffect",
          "RunControlService/RunControl.RequestApproval"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "blueprint-database-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-database-blueprint-003",
          "SCN-database-blueprint-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1152",
        "feature:blueprint-service",
        "feature:tool-adapter-service",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/database-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/blueprints.yaml",
        "model/scenarios/database-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1153]",
      "number": 1153
    },
    {
      "id": "AIFACTORY-TASK-4587",
      "type": "task",
      "parent": "AIFACTORY-US-1153",
      "title": "Fixture Database Blueprints with their expected receipts",
      "sequence": "19.05.03.01",
      "description": "Fixture Database Blueprints with their expected receipts. Expected output: One fixture Database Blueprint that passes DB-001 to DB-004 with its expected receipt and Validated state, one that omits TenantId on a tenant table with its DB-002 finding and Draft state, and a version reference of another tenant with the expected NOT_FOUND; a fixture that declares no stores, and its expected receipt, depend on the owner decision on store-less blueprints and are not part of this task until it is taken.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture Database Blueprint that passes DB-001 to DB-004 with its expected receipt and Validated state, one that omits TenantId on a tenant table with its DB-002 finding and Draft state, and a version reference of another tenant with the expected NOT_FOUND; a fixture that declares no stores, and its expected receipt, depend on the owner decision on store-less blueprints and are not part of this task until it is taken."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8903,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4587]",
      "number": 4587
    },
    {
      "id": "AIFACTORY-TASK-4588",
      "type": "task",
      "parent": "AIFACTORY-US-1153",
      "title": "Verify submit-version and validate of the Draft release against the definition",
      "sequence": "19.05.03.02",
      "description": "Verify submit-version and validate of the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-178 against model/workflows/database-blueprint.yaml proves that the steps submit-version and validate name the tools blueprint-submit-version and blueprint-validate, carry side_effect_class shared-write and sandbox, failure_policy Retry, the idempotency_key documentHash on submit-version only, the fixed retry of 2 attempts with backoff 10s, the timeouts PT2M and PT5M and the mappings document from steps.draft-database-blueprint.database-blueprint-draft and version-ref from steps.submit-version.version-ref; the tool bindings are consumed from feature tool-adapter-service and nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-178 against model/workflows/database-blueprint.yaml proves that the steps submit-version and validate name the tools blueprint-submit-version and blueprint-validate, carry side_effect_class shared-write and sandbox, failure_policy Retry, the idempotency_key documentHash on submit-version only, the fixed retry of 2 attempts with backoff 10s, the timeouts PT2M and PT5M and the mappings document from steps.draft-database-blueprint.database-blueprint-draft and version-ref from steps.submit-version.version-ref; the tool bindings are consumed from feature tool-adapter-service and nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4588]",
      "number": 4588
    },
    {
      "id": "AIFACTORY-TASK-4589",
      "type": "task",
      "parent": "AIFACTORY-US-1153",
      "title": "Prove the submit and validate steps for Database Blueprints on the fixture",
      "sequence": "19.05.03.03",
      "description": "Prove the submit and validate steps for Database Blueprints on the fixture. Expected output: A fixture run proves SCN-database-blueprint-003 and SCN-database-blueprint-004 (AC1 to AC4 of AIFACTORY-US-1153), including the idempotent resubmission, the gated path, the Uncertain path settled through ConfirmToolEffect, the DB-002 finding leaving the version Draft and the NOT_FOUND of another tenant; a blueprint without stores is not proven until the owner decides it.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-database-blueprint-003 and SCN-database-blueprint-004 (AC1 to AC4 of AIFACTORY-US-1153), including the idempotent resubmission, the gated path, the Uncertain path settled through ConfirmToolEffect, the DB-002 finding leaving the version Draft and the NOT_FOUND of another tenant; a blueprint without stores is not proven until the owner decides it."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4589]",
      "number": 4589
    },
    {
      "id": "AIFACTORY-US-1154",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-111",
      "title": "The engine checks the Database Blueprint receipt and sends findings back to the draft at most twice",
      "sequence": "19.05.04",
      "description": "As a requester, I want a failed Database Blueprint validation to send its findings back to the draft a bounded number of times and then fail the run with the report, so that the blueprint improves on real findings without looping forever. The condition step of `database-blueprint`. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; the condition is read class, calls no service, never retries and completes within PT1M. A passed receipt completes the condition with one outcome, no further step exists and the run completes with the last draft as `database-blueprint` and the receipt as `validation-receipt`. A failed one takes the `on_false` branch to `draft-database-blueprint` with the receipt as feedback; the draft, submit and validate steps re-run in order, `derive-stores` does not, the revised document gets its own Draft version and receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the second iteration the run fails with the validation report as evidence, `WorkflowRunFailed` names `check-valid` with failure class validation, Run Control records Failed exactly once and every Draft version stays a Draft, so no Database Blueprint becomes available to a recipe. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026, D61). Kind: behavior. Traces: workflows: database-blueprint; steps: database-blueprint/check-valid, database-blueprint/draft-database-blueprint; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1; scenarios: SCN-database-blueprint-005, SCN-database-blueprint-006; adrs: ADR-0014, ADR-0026; requirements: FR-11. Depends on: AIFACTORY-US-1153, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/database-blueprint.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/database-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates database-blueprint/check-valid, then the condition completes with exactly one outcome, no service is called and WorkflowEngineService/WorkflowRunCompleted follows with the run outputs set (SCN-database-blueprint-005).",
        "AC2: Given the receipt has `passed` false and fewer than 2 iterations were counted, when the engine evaluates database-blueprint/check-valid, then it takes the false branch to database-blueprint/draft-database-blueprint with the receipt as feedback, the submit and validate steps re-run and the iteration count rises by one, while database-blueprint/derive-stores does not re-run (SCN-database-blueprint-006).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates database-blueprint/check-valid, then WorkflowEngineService/WorkflowRunFailed names `check-valid` with failure class validation and the report, and RunControlService/RunFailed is published exactly once (SCN-database-blueprint-006, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable or the evaluation exceeds PT1M, when the engine evaluates database-blueprint/check-valid, then the condition is not retried and the step fails with evidence as the compensation policy of model/workflows/database-blueprint.yaml says (SCN-database-blueprint-005, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4590",
        "AIFACTORY-TASK-4591"
      ],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8904,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "database-blueprint"
        ],
        "steps": [
          "database-blueprint/check-valid",
          "database-blueprint/draft-database-blueprint"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-database-blueprint-005",
          "SCN-database-blueprint-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1153",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/database-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/database-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1154]",
      "number": 1154
    },
    {
      "id": "AIFACTORY-TASK-4590",
      "type": "task",
      "parent": "AIFACTORY-US-1154",
      "title": "Fixture receipt sequences for the pass, loop and limit paths of the Database Blueprint",
      "sequence": "19.05.04.01",
      "description": "Fixture receipt sequences for the pass, loop and limit paths of the Database Blueprint. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of database-blueprint through the pass, a single loop and the iteration limit, each with the expected run outcome and iteration count.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of database-blueprint through the pass, a single loop and the iteration limit, each with the expected run outcome and iteration count."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8904,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4590]",
      "number": 4590
    },
    {
      "id": "AIFACTORY-TASK-4591",
      "type": "task",
      "parent": "AIFACTORY-US-1154",
      "title": "Prove the condition and the bounded loop of database-blueprint on the fixture",
      "sequence": "19.05.04.02",
      "description": "Prove the condition and the bounded loop of database-blueprint on the fixture. Expected output: A fixture run proves SCN-database-blueprint-005 and SCN-database-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1154); one outcome on pass, a loop back to draft-database-blueprint without re-running derive-stores, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-database-blueprint-005 and SCN-database-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1154); one outcome on pass, a loop back to draft-database-blueprint without re-running derive-stores, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/database-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 89,
      "phase": "factory",
      "stackRank": 8904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4591]",
      "number": 4591
    },
    {
      "id": "AIFACTORY-FEAT-112",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Generate a product",
      "sequence": "19.06",
      "description": "The workflow definition generate-product as a published asset: Executes an approved generation recipe: reads the recipe and the design inputs it pins, scaffolds every module from its template in the sandbox, fills the backend and, when the module plan has such modules, the frontend and the database, validates by build and test, records the outputs with provenance and proposes the change set under approval. It has 12 steps, names the agents backend-developer, database-engineer, frontend-developer, microservice-generator and the tools build-and-test, get-approved-recipe, propose-change-set, and is executed by WorkflowEngineService under Run Control. Increment I1: Generate a microservice. Build order 90 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-015",
        "AIFACTORY-US-1155",
        "AIFACTORY-US-1156",
        "AIFACTORY-US-1157",
        "AIFACTORY-US-1158",
        "AIFACTORY-US-1159",
        "AIFACTORY-US-016",
        "AIFACTORY-US-1160",
        "AIFACTORY-US-1161"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9000,
      "titlePrefix": "[AIFACTORY-FEAT-112]",
      "number": 112
    },
    {
      "id": "AIFACTORY-US-015",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "Generation scaffolds the modules and fills them from the design",
      "sequence": "19.06.01",
      "description": "As a requester, I want the approved recipe to be executed: modules scaffolded from their templates and filled with backend, frontend and database code, so that I receive working code that follows my blueprints. The integration PBI of the definition `generate-product`. The run is activated by the approved recipe alone: the one required readiness member `recipe` is satisfied by `RecipeApproved` of GenerationRecipeService with `approvedBy` set, and the readiness correlation of WorkflowEngineService submits exactly one run through `SubmitRun` of RunControlService with a service token that names the project and the idempotency key of scope, operation, workflow release and bundle fingerprint. A newer recipe version supersedes an open correlation; a newer blueprint version never does, because the run reads every design input through the versions the recipe pins (ADR-0027, D67). After `RunAccepted` the engine loads the Draft release through AgentRegistryService and runs twelve steps: the read tool `get-approved-recipe`, the `microservice-generator` scaffold, a parallel fill with `backend-developer` always and `frontend-developer` and `database-engineer` only when the module plan needs them (D68), the join, the sandbox tool `build-and-test`, the condition `check-build` that returns to the fill at most twice, the shared-write provenance step `record-outputs`, the human step `approve-proposal` and the shared-write tool `propose-change-set`. Until I4 the approval of `approve-proposal` always runs; from I4 the step carries a policy guard and is recorded Skipped when the policy answers allow (D133). The run outputs are `generated-outputs` and `change-proposal`. `record-outputs` records every generated output through the tool `record-generated-output`, which calls `Recipes.RecordOutput` of GenerationRecipeService with the tool executor as its caller: the first call moves the recipe from Approved to Executing, and when the run completes the recipe reaches Generated and `GenerationCompleted` is published (D133); a failed or cancelled run returns an Executing recipe to Approved. `propose-change-set` opens the pull request through the connection and records it with `Pipelines.RecordProposal` of PipelineExecutionService (D135). The run reports exactly one outcome within the declared budget. The step behaviour is specified in AIFACTORY-US-016 and AIFACTORY-US-1155 to AIFACTORY-US-1161; this PBI proves the chain on recorded fixtures with and without a user interface module. The tasks AIFACTORY-TASK-221, AIFACTORY-TASK-222 and AIFACTORY-TASK-223 of this PBI moved to AIFACTORY-US-1155, AIFACTORY-US-1158 and AIFACTORY-US-1159, the PBIs whose behaviour they prove; AIFACTORY-TASK-221 changed to a verification in WorkflowEngineService, because the tool binding it once described belongs to feature tool-adapter-service. Kind: behavior. Traces: workflows: generate-product; steps: generate-product/resolve-recipe, generate-product/scaffold-modules, generate-product/fan-out-fill, generate-product/fill-backend, generate-product/fill-frontend, generate-product/fill-database, generate-product/join-fill, generate-product/build-and-test, generate-product/check-build, generate-product/record-outputs, generate-product/approve-proposal, generate-product/propose-change-set; agents: microservice-generator, backend-developer, frontend-developer, database-engineer; tools: get-approved-recipe, build-and-test, record-generated-output, propose-change-set; services: WorkflowEngineService, RunControlService, AgentRegistryService, GenerationRecipeService, PipelineExecutionService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun; events: GenerationRecipeService/RecipeApproved, GenerationRecipeService/GenerationCompleted, PipelineExecutionService/ChangeProposalOpened, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, change-set-v1, pull-request-proposal-v1; adrs: ADR-0014, ADR-0024, ADR-0027; requirements: FR-05, FR-06, FR-08, FR-11, FUX-05, FUX-06, XL-09, XL-10. Depends on: AIFACTORY-US-016, AIFACTORY-US-1155, AIFACTORY-US-1156, AIFACTORY-US-1157, AIFACTORY-US-1158, AIFACTORY-US-1159, AIFACTORY-US-1160, AIFACTORY-US-1161, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:generation-recipe-service, feature:pipeline-execution-service-thin, feature:wf-module-blueprints, feature:wf-application-design, feature:wf-database-blueprint. Sources: model/workflows/generate-product.yaml, model/agents/engineering/microservice-generator.yaml, docs/planes/agent-runtime/workflow-definitions/generate-product.md, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given the Draft release of `generate-product` (workflow-definition-v1) with its readiness activation, 12 steps, the `when` guards of fill-frontend and fill-database, mappings, retry policies, timeouts, failure policies and the approval of generate-product/approve-proposal exactly as in model/workflows/generate-product.yaml, when GenerationRecipeService/RecipeApproved arrives, then the WorkflowEngineService/ReadinessCorrelation submits one run through RunControlService/SubmitRun with a service token naming the project and WorkflowEngineService/ReadinessRunSubmitted is published.",
        "AC2: Given RunControlService/RunAccepted with input `recipe`, when the run executes, then WorkflowEngineService/WorkflowRunStarted is emitted and generate-product/resolve-recipe, generate-product/scaffold-modules, generate-product/fan-out-fill, generate-product/join-fill, generate-product/build-and-test, generate-product/check-build, generate-product/record-outputs, generate-product/approve-proposal and generate-product/propose-change-set follow in that order, with the fill branches between the fan-out and the join (FR-05, FR-06).",
        "AC3: Given every step succeeds and the Reviewer approves, when the run completes, then `generated-outputs` (change-set-v1) and `change-proposal` (pull-request-proposal-v1) are the run outputs, PipelineExecutionService/ChangeProposalOpened names the run, WorkflowEngineService/WorkflowRunCompleted is emitted once, RunControlService/RunCompleted follows exactly once, and the recipe reaches Generated with GenerationRecipeService/GenerationCompleted published once for it (D133, ADR-0014, XL-10).",
        "AC4: Given a step fails terminally, check-build reaches its iteration limit or the approval is rejected or expires, when the engine applies the compensation policy of model/workflows/generate-product.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and the failure class, the sandbox outputs stay as evidence and RunControlService/RunFailed is published exactly once, an Executing recipe returns to Approved and GenerationRecipeService/GenerationCompleted is not published; a failed generate-product/propose-change-set withdraws nothing, because a step's own compensation runs only after its effect is confirmed (D133, AIFACTORY-US-1161).",
        "AC5: Given the recorded fixture recipes of model/workflows/generate-product.yaml with and without a shell module, when the fixture runs execute in the pipeline, then their outputs match the recorded ones field by field, every step output validates against its descriptor and each run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/agents/engineering/microservice-generator.yaml",
        "docs/planes/agent-runtime/workflow-definitions/generate-product.md",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-181",
        "AIFACTORY-TASK-182",
        "AIFACTORY-TASK-183",
        "AIFACTORY-TASK-727"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9001,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/resolve-recipe",
          "generate-product/scaffold-modules",
          "generate-product/fan-out-fill",
          "generate-product/fill-backend",
          "generate-product/fill-frontend",
          "generate-product/fill-database",
          "generate-product/join-fill",
          "generate-product/build-and-test",
          "generate-product/check-build",
          "generate-product/record-outputs",
          "generate-product/approve-proposal",
          "generate-product/propose-change-set"
        ],
        "agents": [
          "microservice-generator",
          "backend-developer",
          "frontend-developer",
          "database-engineer"
        ],
        "tools": [
          "get-approved-recipe",
          "build-and-test",
          "record-generated-output",
          "propose-change-set"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "GenerationRecipeService",
          "PipelineExecutionService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun"
        ],
        "events": [
          "GenerationRecipeService/RecipeApproved",
          "GenerationRecipeService/GenerationCompleted",
          "PipelineExecutionService/ChangeProposalOpened",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "change-set-v1",
          "pull-request-proposal-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "FR-08",
          "FR-11",
          "FUX-05",
          "FUX-06",
          "XL-09",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-016",
        "AIFACTORY-US-1155",
        "AIFACTORY-US-1156",
        "AIFACTORY-US-1157",
        "AIFACTORY-US-1158",
        "AIFACTORY-US-1159",
        "AIFACTORY-US-1160",
        "AIFACTORY-US-1161",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:generation-recipe-service",
        "feature:pipeline-execution-service-thin",
        "feature:wf-module-blueprints",
        "feature:wf-application-design",
        "feature:wf-database-blueprint"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/agents/engineering/microservice-generator.yaml",
        "docs/planes/agent-runtime/workflow-definitions/generate-product.md",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-015]",
      "number": 15
    },
    {
      "id": "AIFACTORY-TASK-181",
      "type": "task",
      "parent": "AIFACTORY-US-015",
      "title": "Author the release of the workflow definition generate-product from the model",
      "sequence": "19.06.01.01",
      "description": "Author the release of the workflow definition generate-product from the model. Expected output: A Draft release of generate-product (workflow-definition-v1) with its readiness activation on RecipeApproved, its 12 steps, input mappings, the when guards of fill-frontend and fill-database, retry policies, timeouts, the failure policies (Retry on the agent and tool steps, Fail on approve-proposal, Compensate on propose-change-set), the shared-write class and idempotency_key runId + recipeId + changeSetHash of record-outputs, the approval block and the policy guard from I4 of approve-proposal, the on_false loop of check-build, the compensation of propose-change-set and the budget exactly as in model/workflows/generate-product.yaml; loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A Draft release of generate-product (workflow-definition-v1) with its readiness activation on RecipeApproved, its 12 steps, input mappings, the when guards of fill-frontend and fill-database, retry policies, timeouts, the failure policies (Retry on the agent and tool steps, Fail on approve-proposal, Compensate on propose-change-set), the shared-write class and idempotency_key runId + recipeId + changeSetHash of record-outputs, the approval block and the policy guard from I4 of approve-proposal, the on_false loop of check-build, the compensation of propose-change-set and the budget exactly as in model/workflows/generate-product.yaml; loadable by AgentRegistryService and accepted by ValidateWorkflowDefinition of WorkflowEngineService."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-181]",
      "number": 181
    },
    {
      "id": "AIFACTORY-TASK-182",
      "type": "task",
      "parent": "AIFACTORY-US-015",
      "title": "Author the agent releases backend-developer, database-engineer, frontend-developer, microservice-generator with their prompts and skills",
      "sequence": "19.06.01.02",
      "description": "Author the agent releases backend-developer, database-engineer, frontend-developer, microservice-generator with their prompts and skills. Expected output: Draft releases of microservice-generator, backend-developer, frontend-developer and database-engineer with their instructions, the skills microservice-generator-template-assembly, microservice-generator-record-outputs, backend-developer-use-case-implementation, frontend-developer-fill-frontend and database-engineer-mappings-and-migrations among their bound skills, the tool bindings and the model profiles of their cards; each release passes a smoke evaluation of the suite engineering-core-v1 on the fixture recipe.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of microservice-generator, backend-developer, frontend-developer and database-engineer with their instructions, the skills microservice-generator-template-assembly, microservice-generator-record-outputs, backend-developer-use-case-implementation, frontend-developer-fill-frontend and database-engineer-mappings-and-migrations among their bound skills, the tool bindings and the model profiles of their cards; each release passes a smoke evaluation of the suite engineering-core-v1 on the fixture recipe."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-182]",
      "number": 182
    },
    {
      "id": "AIFACTORY-TASK-183",
      "type": "task",
      "parent": "AIFACTORY-US-015",
      "title": "Fixture run of generate-product against recorded inputs",
      "sequence": "19.06.01.03",
      "description": "Fixture run of generate-product against recorded inputs. Expected output: The definition runs end to end on two fixture recipes, one with a shell module and one without, from RecipeApproved to RunCompleted with a fixture Reviewer decision; every step output validates against its descriptor and the outputs generated-outputs and change-proposal match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-015).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on two fixture recipes, one with a shell module and one without, from RecipeApproved to RunCompleted with a fixture Reviewer decision; every step output validates against its descriptor and the outputs generated-outputs and change-proposal match the recorded ones field by field (AC1 to AC3 and AC5 of AIFACTORY-US-015)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-183]",
      "number": 183
    },
    {
      "id": "AIFACTORY-TASK-727",
      "type": "task",
      "parent": "AIFACTORY-US-015",
      "title": "Verify generate-and-fill by running the declared command",
      "sequence": "19.06.01.04",
      "description": "Verify generate-and-fill by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-015, including GenerationCompleted once on a completed run and the failure path of AC4 with WorkflowRunFailed and RunFailed exactly once, the recipe back in Approved and no withdrawal after a failed proposal.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-015, including GenerationCompleted once on a completed run and the failure path of AC4 with WorkflowRunFailed and RunFailed exactly once, the recipe back in Approved and no withdrawal after a failed proposal."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-727]",
      "number": 727
    },
    {
      "id": "AIFACTORY-US-1155",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "The run reads the approved recipe and resolves every design input it pins",
      "sequence": "19.06.02",
      "description": "As a requester, I want the generation run to read my approved recipe and every blueprint and design version it pins, and nothing else, so that the code is generated from exactly the versions that were approved. The first step of `generate-product`, the read-class tool `get-approved-recipe`. When the engine marks `resolve-recipe` ready it resolves `recipe` from `bundle.recipe`, the recipe id and version that satisfied the readiness member, and Run Control dispatches the attempt; ToolAdapterService executes the tool under the run's workload identity and the tool calls `Recipes.GetApprovedRecipe` of GenerationRecipeService, whose behaviour that feature delivers. The step declares seven outputs recorded once under the run envelope: `module-plan` with the counts by module kind, among them `frontendModules` and `persistenceModules`, and, per module, the pinned `module-blueprints`, `application-designs`, `domain-model`, `database-blueprints`, `frontend-blueprints` and `ux-blueprint` versions, each by id, version and hash. The generation-recipe-service feature reports the gap between them and the call: `Recipes.GetApprovedRecipe` takes execution-scope-v1, which names no recipe, and answers one artifact-v1 reference to the recipe document, not seven typed outputs, and the model names no component that maps the document onto the seven outputs; this PBI states the outputs the definition declares and reports the mapping component to the owner. That an input the plan does not need, such as the Frontend and UX Blueprints of a plan without a shell or microfrontend module, is recorded empty is an assumption of this PBI, because no model text says how such an output is recorded, and it is reported as well. The read writes nothing and is audited with recipeId, recipeVersion, projectId, modules and pinnedInputs. A recipe that is not Approved or Executing is answered FailedPrecondition and a recipe of another tenant NOT_FOUND like an unknown one; both are permanent and not retried, and the run fails before any sandbox work. The step declares `failure_policy` Retry, so a Failed attempt of failure class transient is retried under the fixed budget of 2 attempts with backoff 10s; an attempt that exceeds PT2M or exhausts the budget fails the run with evidence and the recipe stays Approved. Kind: behavior. Traces: workflows: generate-product; steps: generate-product/resolve-recipe; tools: get-approved-recipe; services: GenerationRecipeService, ToolAdapterService, WorkflowEngineService; aggregates: GenerationRecipeService/GenerationRecipe; apis: GenerationRecipeService/Recipes.GetApprovedRecipe; events: WorkflowEngineService/WorkflowRunFailed; descriptors: artifact-v1, blueprint-module-v1, application-design-v1, blueprint-database-v1, blueprint-frontend-v1, blueprint-ux-v1; scenarios: SCN-generate-product-001; adrs: ADR-0014, ADR-0015, ADR-0027; requirements: FR-05. Depends on: feature:generation-recipe-service, feature:tool-adapter-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/generate-product.yaml, model/tools/get-approved-recipe.yaml, model/services/template-library/GenerationRecipeService.yaml, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted for an Approved recipe, when generate-product/resolve-recipe runs `get-approved-recipe` through GenerationRecipeService/Recipes.GetApprovedRecipe, then `module-plan` with the counts by module kind and the pinned `module-blueprints`, `application-designs`, `domain-model`, `database-blueprints`, `frontend-blueprints` and `ux-blueprint` are recorded once under the run envelope, each pin naming id, version and hash (SCN-generate-product-001, ADR-0027).",
        "AC2: Given a recipe plan without a shell or microfrontend module, when the step records its outputs, then `frontendModules` is zero and no blueprint outside the recipe's pins is read; that `frontend-blueprints` and `ux-blueprint` are then recorded empty is the assumption of this PBI pending the owner, as is the component that maps the artifact-v1 reply of GenerationRecipeService/Recipes.GetApprovedRecipe onto the seven outputs (SCN-generate-product-001).",
        "AC3: Given a recipe of another tenant, or a GenerationRecipeService/GenerationRecipe that is neither Approved nor Executing, when the tool calls GenerationRecipeService/Recipes.GetApprovedRecipe, then the answer is NOT_FOUND or FailedPrecondition, the attempt takes failure class permanent without a retry and WorkflowEngineService/WorkflowRunFailed names the step before any sandbox work (SCN-generate-product-001, ADR-0015).",
        "AC4: Given an attempt settles Failed with failure class transient until the fixed budget of 2 attempts is spent or exceeds PT2M, when Run Control evaluates the step, then it is retried under that budget, then fails with evidence, and the recipe stays Approved (SCN-generate-product-001, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/tools/get-approved-recipe.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-221",
        "AIFACTORY-TASK-4592",
        "AIFACTORY-TASK-4593"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9002,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/resolve-recipe"
        ],
        "tools": [
          "get-approved-recipe"
        ],
        "services": [
          "GenerationRecipeService",
          "ToolAdapterService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "GenerationRecipeService/GenerationRecipe"
        ],
        "apis": [
          "GenerationRecipeService/Recipes.GetApprovedRecipe"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-module-v1",
          "application-design-v1",
          "blueprint-database-v1",
          "blueprint-frontend-v1",
          "blueprint-ux-v1"
        ],
        "scenarios": [
          "SCN-generate-product-001"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:generation-recipe-service",
        "feature:tool-adapter-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/tools/get-approved-recipe.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1155]",
      "number": 1155
    },
    {
      "id": "AIFACTORY-TASK-221",
      "type": "task",
      "parent": "AIFACTORY-US-1155",
      "title": "Verify that resolve-recipe consumes the get-approved-recipe binding of the tool feature",
      "sequence": "19.06.02.01",
      "description": "Verify that resolve-recipe consumes the get-approved-recipe binding of the tool feature. Expected output: A check of the release authored by AIFACTORY-TASK-181 proves that the step resolve-recipe calls the get-approved-recipe binding that feature tool-adapter-service delivers, with recipe mapped from bundle.recipe, side_effect_class read, the fixed retry of 2 attempts and timeout PT2M, and records the outputs module-plan, module-blueprints, application-designs, domain-model, database-blueprints, frontend-blueprints and ux-blueprint under the descriptors model/workflows/generate-product.yaml declares; the binding is not re-implemented here and the component that maps the recipe document onto these outputs stays pending the owner.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-181 proves that the step resolve-recipe calls the get-approved-recipe binding that feature tool-adapter-service delivers, with recipe mapped from bundle.recipe, side_effect_class read, the fixed retry of 2 attempts and timeout PT2M, and records the outputs module-plan, module-blueprints, application-designs, domain-model, database-blueprints, frontend-blueprints and ux-blueprint under the descriptors model/workflows/generate-product.yaml declares; the binding is not re-implemented here and the component that maps the recipe document onto these outputs stays pending the owner."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-221]",
      "number": 221
    },
    {
      "id": "AIFACTORY-TASK-4592",
      "type": "task",
      "parent": "AIFACTORY-US-1155",
      "title": "Fixture recipes with and without a user interface module",
      "sequence": "19.06.02.02",
      "description": "Fixture recipes with and without a user interface module. Expected output: Two fixture Approved recipes, one with a backend module with persistence and a shell module and one with a backend module only, each with its recipe document and the expected seven resolve-recipe outputs, plus a recipe of another tenant and a Draft recipe with their expected refusals, as the oracle of SCN-generate-product-001.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.GenerationRecipeService.",
      "acceptanceCriteria": [
        "Two fixture Approved recipes, one with a backend module with persistence and a shell module and one with a backend module only, each with its recipe document and the expected seven resolve-recipe outputs, plus a recipe of another tenant and a Draft recipe with their expected refusals, as the oracle of SCN-generate-product-001."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.GenerationRecipeService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9002,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4592]",
      "number": 4592
    },
    {
      "id": "AIFACTORY-TASK-4593",
      "type": "task",
      "parent": "AIFACTORY-US-1155",
      "title": "Prove the recipe resolution step on the fixture",
      "sequence": "19.06.02.03",
      "description": "Prove the recipe resolution step on the fixture. Expected output: A fixture run proves SCN-generate-product-001 (AC1 to AC4 of AIFACTORY-US-1155); the seven outputs match the pins, the plan without a shell records frontendModules zero with empty frontend inputs as assumed pending the owner, NOT_FOUND and FailedPrecondition fail the run without a retry, and the transient path is retried twice and then fails.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-generate-product-001 (AC1 to AC4 of AIFACTORY-US-1155); the seven outputs match the pins, the plan without a shell records frontendModules zero with empty frontend inputs as assumed pending the owner, NOT_FOUND and FailedPrecondition fail the run without a retry, and the transient path is retried twice and then fails."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4593]",
      "number": 4593
    },
    {
      "id": "AIFACTORY-US-1156",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "The Microservice Generator scaffolds every module from its pinned template version in the sandbox",
      "sequence": "19.06.03",
      "description": "As a requester, I want every module of the plan created from the template version and switches the recipe pins, inside the sandbox, so that the generated solution starts from the same scaffold every time and nothing reaches a shared repository unreviewed. The sandbox-class agent step `scaffold-modules` of `generate-product`. When `resolve-recipe` succeeded the engine marks it ready and resolves `recipe` from `input.recipe`, `module-blueprint` from `steps.resolve-recipe.module-blueprints`, `module-plan` from `steps.resolve-recipe.module-plan` and `manifests` from the optional input `input.manifests`. The `microservice-generator` release runs the skill `microservice-generator-template-assembly` with the sandbox tools of its card (shell-sandbox, write-file, apply-patch, build-and-test among them): one module at a time it runs the template id and version the module entry names with the switches and parameters the recipe pins, at the path of the repository layout, and returns `scaffold` (change-set-v1) with every created file, its change kind and the hash of the change set; nothing is pushed. A module is never scaffolded from another template version than its pin. The step writes nothing outside the isolated workspace and needs no approval. It declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, another failure class is not retried, and an attempt that exceeds PT30M or exhausts the budget fails the run with evidence; the workspace stays as evidence and the recipe stays Approved, because it leaves Approved only on the first `Recipes.RecordOutput` of the run, which comes after this step (ADR-0014, recovery not replay). Kind: behavior. Traces: workflows: generate-product; steps: generate-product/scaffold-modules; agents: microservice-generator; tools: shell-sandbox, write-file, apply-patch; services: WorkflowEngineService, AgentRuntimeService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: artifact-v1, blueprint-module-v1, change-set-v1; scenarios: SCN-generate-product-002; adrs: ADR-0014, ADR-0027; requirements: FR-05, FR-06. Depends on: AIFACTORY-US-1155, feature:agent-runtime-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/generate-product.yaml, model/skills/engineering/microservice-generator-template-assembly.yaml, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `module-plan` and `module-blueprints` are recorded, when `microservice-generator` executes generate-product/scaffold-modules with `microservice-generator-template-assembly`, then every module of the plan is created from its pinned template id and version with the recipe's switches and parameters at its path, and `scaffold` (change-set-v1) is recorded once under the run envelope (SCN-generate-product-002, FR-05).",
        "AC2: Given the scaffold is recorded, when the change set is inspected, then it lists every created file with its change kind and carries its hash, and no branch was pushed and no shared system was written (SCN-generate-product-002, ADR-0027).",
        "AC3: Given an attempt exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the compensation policy of model/workflows/generate-product.yaml, then the attempt fails with evidence, WorkflowEngineService/WorkflowRunFailed names the step and the workspace stays as evidence (SCN-generate-product-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/skills/engineering/microservice-generator-template-assembly.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4594",
        "AIFACTORY-TASK-4595",
        "AIFACTORY-TASK-4596"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9003,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/scaffold-modules"
        ],
        "agents": [
          "microservice-generator"
        ],
        "tools": [
          "shell-sandbox",
          "write-file",
          "apply-patch"
        ],
        "services": [
          "WorkflowEngineService",
          "AgentRuntimeService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-module-v1",
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-generate-product-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05",
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1155",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/skills/engineering/microservice-generator-template-assembly.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1156]",
      "number": 1156
    },
    {
      "id": "AIFACTORY-TASK-4594",
      "type": "task",
      "parent": "AIFACTORY-US-1156",
      "title": "Verify the template assembly skill binding of the scaffold step",
      "sequence": "19.06.03.01",
      "description": "Verify the template assembly skill binding of the scaffold step. Expected output: A check of the microservice-generator release authored by AIFACTORY-TASK-182 and of the step scaffold-modules of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves the skill microservice-generator-template-assembly with only the sandbox tools of the skill, side_effect_class sandbox, the exponential retry of 3 attempts with backoff 30s, timeout PT30M and the mappings recipe from input.recipe, module-blueprint from steps.resolve-recipe.module-blueprints, module-plan from steps.resolve-recipe.module-plan and manifests from input.manifests; nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A check of the microservice-generator release authored by AIFACTORY-TASK-182 and of the step scaffold-modules of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves the skill microservice-generator-template-assembly with only the sandbox tools of the skill, side_effect_class sandbox, the exponential retry of 3 attempts with backoff 30s, timeout PT30M and the mappings recipe from input.recipe, module-blueprint from steps.resolve-recipe.module-blueprints, module-plan from steps.resolve-recipe.module-plan and manifests from input.manifests; nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4594]",
      "number": 4594
    },
    {
      "id": "AIFACTORY-TASK-4595",
      "type": "task",
      "parent": "AIFACTORY-US-1156",
      "title": "Fixture scaffolds of the fixture recipes",
      "sequence": "19.06.03.02",
      "description": "Fixture scaffolds of the fixture recipes. Expected output: The expected scaffold change sets (change-set-v1) of the two fixture recipes, with every created file, its change kind and the change-set hash, as the oracle of SCN-generate-product-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected scaffold change sets (change-set-v1) of the two fixture recipes, with every created file, its change kind and the change-set hash, as the oracle of SCN-generate-product-002."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9003,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4595]",
      "number": 4595
    },
    {
      "id": "AIFACTORY-TASK-4596",
      "type": "task",
      "parent": "AIFACTORY-US-1156",
      "title": "Prove the scaffold step on the fixture",
      "sequence": "19.06.03.03",
      "description": "Prove the scaffold step on the fixture. Expected output: A fixture run proves SCN-generate-product-002 (AC1 to AC3 of AIFACTORY-US-1156); every module is created from its pinned template version with the recipe's switches, nothing is pushed, and the timeout path ends in WorkflowRunFailed with the workspace kept.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-generate-product-002 (AC1 to AC3 of AIFACTORY-US-1156); every module is created from its pinned template version with the recipe's switches, nothing is pushed, and the timeout path ends in WorkflowRunFailed with the workspace kept."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4596]",
      "number": 4596
    },
    {
      "id": "AIFACTORY-US-1157",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "The engine runs the fill branches in parallel on the scaffold and joins them, Skipped branches counting as satisfied",
      "sequence": "19.06.04",
      "description": "As a requester, I want backend, frontend and database work done in parallel on the scaffold and joined into one result, so that generation is not serialized, and a branch my product does not need does not block it. The two parallel steps of `generate-product`, which the engine evaluates without an agent, a tool or a retry. When `scaffold-modules` succeeded the engine evaluates `fan-out-fill` and makes the three branches ready on the scaffold: `fill-backend`, and `fill-frontend` and `fill-database` subject to their `when` guards; a branch whose guard does not hold is recorded Skipped by the engine at that moment, a state the Step of RunControlService names, and dispatches no attempt (ADR-0027, D68). The fan-out completes with exactly one outcome within PT1M. On a pass back from `check-build` the fan-out runs again with `steps.build-and-test.validation-results` as feedback for the branches that run. When `join-fill` becomes ready it waits for every branch that ran; a Skipped branch counts as satisfied. When every branch that ran succeeded the join completes with one outcome and `build-and-test` becomes ready; when one branch failed the join fails the run with that branch's evidence while the change sets of the other branches stay recorded as artifacts under the run envelope. Neither step changes a shared system; a fan-out or join that exceeds its timeout PT1M fails with evidence and is not retried (none, 0 attempts). Kind: behavior. Traces: workflows: generate-product; steps: generate-product/fan-out-fill, generate-product/join-fill, generate-product/fill-backend, generate-product/fill-frontend, generate-product/fill-database; services: WorkflowEngineService, RunControlService; aggregates: WorkflowEngineService/WorkflowRun, RunControlService/Step; events: WorkflowEngineService/StepReady, WorkflowEngineService/StepRunStateChanged, WorkflowEngineService/WorkflowRunFailed; descriptors: change-set-v1; scenarios: SCN-generate-product-003, SCN-generate-product-007; adrs: ADR-0014, ADR-0027; requirements: FR-06. Depends on: AIFACTORY-US-1156, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/generate-product.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, docs/architecture/adr/0027-generation-input-contract.md, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `scaffold` is recorded and the module plan has frontend and persistence modules, when the engine evaluates generate-product/fan-out-fill, then generate-product/fill-backend, generate-product/fill-frontend and generate-product/fill-database become ready in parallel and the fan-out records exactly one outcome (SCN-generate-product-003, ADR-0027).",
        "AC2: Given the plan has no frontend module, when the engine evaluates generate-product/fan-out-fill, then generate-product/fill-frontend is recorded Skipped without an attempt and the other branches run (SCN-generate-product-003).",
        "AC3: Given every branch that ran succeeded and the others are Skipped, when the engine evaluates generate-product/join-fill, then the join completes with one outcome and generate-product/build-and-test becomes ready (SCN-generate-product-007).",
        "AC4: Given one branch failed, or the fan-out or the join exceeds PT1M, when generate-product/join-fill is reached, then WorkflowEngineService/WorkflowRunFailed names the failed step, the change sets of the other branches stay recorded and no step is retried (SCN-generate-product-007, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4597",
        "AIFACTORY-TASK-4598",
        "AIFACTORY-TASK-4599"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9004,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/fan-out-fill",
          "generate-product/join-fill",
          "generate-product/fill-backend",
          "generate-product/fill-frontend",
          "generate-product/fill-database"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "WorkflowEngineService/WorkflowRun",
          "RunControlService/Step"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/StepRunStateChanged",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-generate-product-003",
          "SCN-generate-product-007"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1156",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1157]",
      "number": 1157
    },
    {
      "id": "AIFACTORY-TASK-4597",
      "type": "task",
      "parent": "AIFACTORY-US-1157",
      "title": "Verify the fill fan-out, the join and the guards of the Draft release against the definition",
      "sequence": "19.06.04.01",
      "description": "Verify the fill fan-out, the join and the guards of the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that fan-out-fill and join-fill carry kind parallel, side_effect_class sandbox, timeout PT1M and no retry, that fill-backend, fill-frontend and fill-database depend on fan-out-fill and join-fill on all three, and that fill-frontend carries the when guard steps.resolve-recipe.module-plan.frontendModules > 0 and fill-database steps.resolve-recipe.module-plan.persistenceModules > 0; recording a guarded branch Skipped is engine behaviour of feature workflow-engine-service and nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that fan-out-fill and join-fill carry kind parallel, side_effect_class sandbox, timeout PT1M and no retry, that fill-backend, fill-frontend and fill-database depend on fan-out-fill and join-fill on all three, and that fill-frontend carries the when guard steps.resolve-recipe.module-plan.frontendModules > 0 and fill-database steps.resolve-recipe.module-plan.persistenceModules > 0; recording a guarded branch Skipped is engine behaviour of feature workflow-engine-service and nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4597]",
      "number": 4597
    },
    {
      "id": "AIFACTORY-TASK-4598",
      "type": "task",
      "parent": "AIFACTORY-US-1157",
      "title": "Fixture branch outcomes for the join",
      "sequence": "19.06.04.02",
      "description": "Fixture branch outcomes for the join. Expected output: Recorded branch outcomes (all three succeeded; frontend Skipped; database branch failed) with the expected join outcome and the change sets that stay recorded, as the oracle of SCN-generate-product-003 and SCN-generate-product-007.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded branch outcomes (all three succeeded; frontend Skipped; database branch failed) with the expected join outcome and the change sets that stay recorded, as the oracle of SCN-generate-product-003 and SCN-generate-product-007."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9004,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4598]",
      "number": 4598
    },
    {
      "id": "AIFACTORY-TASK-4599",
      "type": "task",
      "parent": "AIFACTORY-US-1157",
      "title": "Prove the fan-out and the join on the fixture",
      "sequence": "19.06.04.03",
      "description": "Prove the fan-out and the join on the fixture. Expected output: A fixture run proves SCN-generate-product-003 and SCN-generate-product-007 (AC1 to AC4 of AIFACTORY-US-1157); parallel branches, a Skipped branch counted as satisfied, and one failed branch failing the run with the other change sets kept.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-generate-product-003 and SCN-generate-product-007 (AC1 to AC4 of AIFACTORY-US-1157); parallel branches, a Skipped branch counted as satisfied, and one failed branch failing the run with the other change sets kept."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4599]",
      "number": 4599
    },
    {
      "id": "AIFACTORY-US-1158",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "The Backend Developer fills handlers, DTOs, validation, authorization and tenant enforcement from the application design",
      "sequence": "19.06.05",
      "description": "As a requester, I want the backend of every module filled with one handler per use case of its application design, with validation, authorization and tenant enforcement, so that the generated service does what its design says and nothing the design does not name. The unguarded fill branch `fill-backend` of `generate-product`. When the fan-out makes it ready the engine resolves `application-design` from `steps.resolve-recipe.application-designs`, `module-code` from `steps.scaffold-modules.scaffold` and `module-blueprint` from `steps.resolve-recipe.module-blueprints`; on a pass back from `check-build` the validation results are attached as feedback. The `backend-developer` release runs the skill `backend-developer-use-case-implementation` in sandbox class with the tools of its card: for every use case of the pinned application design it implements the handler on its input port, the DTOs, the validation, the authorization the use case names and the tenant enforcement of a tenant-scoped use case, wires the output ports to the adapters the design names, and returns `backend-change-set` (change-set-v1) over the scaffold. A use case without a handler or a handler without a use case is an error of the output; on a feedback pass the change set addresses every failing build or test of the results. The step writes only inside the isolated workspace and needs no approval. It declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, another failure class is not retried, and an attempt that exceeds PT30M or exhausts the budget fails its branch with evidence, which `join-fill` turns into a failed run. Kind: behavior. Traces: workflows: generate-product; steps: generate-product/fill-backend; agents: backend-developer; services: WorkflowEngineService; descriptors: application-design-v1, blueprint-module-v1, change-set-v1; scenarios: SCN-generate-product-004; adrs: ADR-0014, ADR-0027; requirements: FR-06. Depends on: AIFACTORY-US-1157, feature:workflow-engine-service, feature:run-control-service, feature:agent-runtime-service. Sources: model/workflows/generate-product.yaml, model/skills/engineering/backend-developer-use-case-implementation.yaml, docs/reference/schemas/application-design.schema.json, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the pinned application design and the scaffold are recorded, when `backend-developer` executes generate-product/fill-backend, then `backend-change-set` (change-set-v1) holds one handler per use case of the application-design-v1 body with its DTOs, validation, authorization and tenant enforcement, and is recorded once under the run envelope (SCN-generate-product-004, FR-06).",
        "AC2: Given a pass back from generate-product/check-build, when the step re-runs, then the validation results are in its context as feedback and the new change set addresses each failing build or test they name (SCN-generate-product-004).",
        "AC3: Given an attempt exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the policy of model/workflows/generate-product.yaml, then the branch fails with evidence, the workspace stays as evidence and no shared system is changed (SCN-generate-product-004, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/skills/engineering/backend-developer-use-case-implementation.yaml",
        "docs/reference/schemas/application-design.schema.json",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-222",
        "AIFACTORY-TASK-4600",
        "AIFACTORY-TASK-4601"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9005,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/fill-backend"
        ],
        "agents": [
          "backend-developer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "descriptors": [
          "application-design-v1",
          "blueprint-module-v1",
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-generate-product-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1157",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-runtime-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/skills/engineering/backend-developer-use-case-implementation.yaml",
        "docs/reference/schemas/application-design.schema.json",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1158]",
      "number": 1158
    },
    {
      "id": "AIFACTORY-TASK-222",
      "type": "task",
      "parent": "AIFACTORY-US-1158",
      "title": "Backend developer release bound to the fill-backend step",
      "sequence": "19.06.05.01",
      "description": "Backend developer release bound to the fill-backend step. Expected output: The step fill-backend of the release authored by AIFACTORY-TASK-181 runs backend-developer-use-case-implementation with application-design, module-code and module-blueprint mapped as in model/workflows/generate-product.yaml; on the fixture recipe the release produces a backend change set with one handler per use case of the pinned application design.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step fill-backend of the release authored by AIFACTORY-TASK-181 runs backend-developer-use-case-implementation with application-design, module-code and module-blueprint mapped as in model/workflows/generate-product.yaml; on the fixture recipe the release produces a backend change set with one handler per use case of the pinned application design."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9005,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-222]",
      "number": 222
    },
    {
      "id": "AIFACTORY-TASK-4600",
      "type": "task",
      "parent": "AIFACTORY-US-1158",
      "title": "Fixture backend change set and a feedback pass",
      "sequence": "19.06.05.02",
      "description": "Fixture backend change set and a feedback pass. Expected output: The expected backend-change-set (change-set-v1) for the fixture application design, and a feedback fixture whose validation results name a failing test together with the change set that fixes it, as the oracle of SCN-generate-product-004.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected backend-change-set (change-set-v1) for the fixture application design, and a feedback fixture whose validation results name a failing test together with the change set that fixes it, as the oracle of SCN-generate-product-004."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9005,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4600]",
      "number": 4600
    },
    {
      "id": "AIFACTORY-TASK-4601",
      "type": "task",
      "parent": "AIFACTORY-US-1158",
      "title": "Prove the backend fill on the fixture",
      "sequence": "19.06.05.03",
      "description": "Prove the backend fill on the fixture. Expected output: A fixture run proves SCN-generate-product-004 (AC1 to AC3 of AIFACTORY-US-1158); one handler per use case, the feedback pass fixing the named test, and the timeout path failing the branch with the workspace kept.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-generate-product-004 (AC1 to AC3 of AIFACTORY-US-1158); one handler per use case, the feedback pass fixing the named test, and the timeout path failing the branch with the workspace kept."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9005,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4601]",
      "number": 4601
    },
    {
      "id": "AIFACTORY-US-1159",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "The frontend and database branches fill the modules only when the module plan has such modules, otherwise they are Skipped",
      "sequence": "19.06.06",
      "description": "As a requester, I want screens and clients generated only when my product has a shell or microfrontend, and mappings and migrations only when it has persistence, so that a backend-only product is generated without inventing a user interface or a database. The two guarded fill branches of `generate-product` (ADR-0027, D68). `fill-frontend` carries the guard `steps.resolve-recipe.module-plan.frontendModules > 0`: when it holds the engine resolves `ux-blueprint`, `frontend-blueprint` from `steps.resolve-recipe.frontend-blueprints` and `module-code` from the scaffold, and the `frontend-developer` release runs `frontend-developer-fill-frontend`, producing the screens, components and API clients from the UX Blueprint and the API contracts as `frontend-change-set` (change-set-v1). `fill-database` carries the guard `steps.resolve-recipe.module-plan.persistenceModules > 0`: when it holds the engine resolves `domain-model`, `database-blueprint` from `steps.resolve-recipe.database-blueprints` and `module-code`, and the `database-engineer` release runs `database-engineer-mappings-and-migrations`, producing the mappings, migrations and seeds from the domain model and the Database Blueprint, with TenantId on every tenant table, as `database-change-set` (change-set-v1). When a guard does not hold the engine records the step Skipped, dispatches no attempt and records no change set, and the join counts it as satisfied. Both steps are sandbox class, write only inside the isolated workspace and need no approval; each declares `failure_policy` Retry with the exponential budget of 3 attempts and backoff 30s for a Failed attempt of failure class transient, and an attempt that exceeds PT30M, fails with another failure class or exhausts the budget fails its branch with evidence. Kind: behavior. Traces: workflows: generate-product; steps: generate-product/fill-frontend, generate-product/fill-database; agents: frontend-developer, database-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepRunStateChanged; descriptors: blueprint-ux-v1, blueprint-frontend-v1, blueprint-database-v1, artifact-v1, change-set-v1; scenarios: SCN-generate-product-005, SCN-generate-product-006; adrs: ADR-0014, ADR-0027; requirements: FR-06, FUX-05, FUX-06. Depends on: AIFACTORY-US-1157, feature:workflow-engine-service, feature:run-control-service, feature:agent-runtime-service. Sources: model/workflows/generate-product.yaml, model/skills/engineering/frontend-developer-fill-frontend.yaml, model/skills/engineering/database-engineer-mappings-and-migrations.yaml, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the module plan has a shell or microfrontend module, when `frontend-developer` executes generate-product/fill-frontend, then `frontend-change-set` (change-set-v1) holds the screens, components and clients the pinned UX and Frontend Blueprints name and is recorded once (SCN-generate-product-005, FUX-05, FUX-06).",
        "AC2: Given the module plan has a module with persistence, when `database-engineer` executes generate-product/fill-database, then `database-change-set` (change-set-v1) holds the mappings, migrations and seeds of the pinned Database Blueprint and domain model with TenantId on every tenant table, and is recorded once (SCN-generate-product-006).",
        "AC3: Given the module plan has no frontend module or no persistence module, when the fan-out reaches generate-product/fill-frontend or generate-product/fill-database, then that step is recorded Skipped without an attempt or a change set and WorkflowEngineService/StepRunStateChanged shows Skipped (SCN-generate-product-005, SCN-generate-product-006, ADR-0027).",
        "AC4: Given an attempt of either step exceeds PT30M, settles Failed with a non-transient failure class or exhausts the exponential budget of 3 attempts, when the engine applies the policy of model/workflows/generate-product.yaml, then the branch fails with evidence and no shared system is changed (SCN-generate-product-005, SCN-generate-product-006, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/skills/engineering/frontend-developer-fill-frontend.yaml",
        "model/skills/engineering/database-engineer-mappings-and-migrations.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4602",
        "AIFACTORY-TASK-4603",
        "AIFACTORY-TASK-223"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9006,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/fill-frontend",
          "generate-product/fill-database"
        ],
        "agents": [
          "frontend-developer",
          "database-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepRunStateChanged"
        ],
        "descriptors": [
          "blueprint-ux-v1",
          "blueprint-frontend-v1",
          "blueprint-database-v1",
          "artifact-v1",
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-generate-product-005",
          "SCN-generate-product-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "FUX-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1157",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-runtime-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/skills/engineering/frontend-developer-fill-frontend.yaml",
        "model/skills/engineering/database-engineer-mappings-and-migrations.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1159]",
      "number": 1159
    },
    {
      "id": "AIFACTORY-TASK-4602",
      "type": "task",
      "parent": "AIFACTORY-US-1159",
      "title": "Verify the frontend and database skill bindings of the guarded steps",
      "sequence": "19.06.06.01",
      "description": "Verify the frontend and database skill bindings of the guarded steps. Expected output: A check of the frontend-developer and database-engineer releases authored by AIFACTORY-TASK-182 and of the steps fill-frontend and fill-database of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves the skills frontend-developer-fill-frontend and database-engineer-mappings-and-migrations, side_effect_class sandbox, the exponential retry of 3 attempts with backoff 30s, timeout PT30M and the mappings of ux-blueprint, frontend-blueprint, domain-model, database-blueprint and module-code; nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A check of the frontend-developer and database-engineer releases authored by AIFACTORY-TASK-182 and of the steps fill-frontend and fill-database of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves the skills frontend-developer-fill-frontend and database-engineer-mappings-and-migrations, side_effect_class sandbox, the exponential retry of 3 attempts with backoff 30s, timeout PT30M and the mappings of ux-blueprint, frontend-blueprint, domain-model, database-blueprint and module-code; nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4602]",
      "number": 4602
    },
    {
      "id": "AIFACTORY-TASK-4603",
      "type": "task",
      "parent": "AIFACTORY-US-1159",
      "title": "Fixture frontend and database change sets",
      "sequence": "19.06.06.02",
      "description": "Fixture frontend and database change sets. Expected output: The expected frontend-change-set and database-change-set (change-set-v1) for the fixture recipe with a shell module and persistence, as the oracle of SCN-generate-product-005 and SCN-generate-product-006.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected frontend-change-set and database-change-set (change-set-v1) for the fixture recipe with a shell module and persistence, as the oracle of SCN-generate-product-005 and SCN-generate-product-006."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9006,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4603]",
      "number": 4603
    },
    {
      "id": "AIFACTORY-TASK-223",
      "type": "task",
      "parent": "AIFACTORY-US-1159",
      "title": "Fixture runs with and without a user interface module",
      "sequence": "19.06.06.03",
      "description": "Fixture runs with and without a user interface module. Expected output: Both fixture recipes end the fill stage and prove SCN-generate-product-005 and SCN-generate-product-006 (AC1 to AC4 of AIFACTORY-US-1159); the first produces frontend and database change sets, the second records fill-frontend Skipped without an attempt and the join continues.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Both fixture recipes end the fill stage and prove SCN-generate-product-005 and SCN-generate-product-006 (AC1 to AC4 of AIFACTORY-US-1159); the first produces frontend and database change sets, the second records fill-frontend Skipped without an attempt and the join continues."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9006,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-223]",
      "number": 223
    },
    {
      "id": "AIFACTORY-US-016",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "Generated code is built, tested and recorded with provenance",
      "sequence": "19.06.07",
      "description": "As a requester, I want the generated modules to be built and tested in the sandbox and their provenance recorded, so that I only ever review code that compiles and passes its tests. The validation and provenance steps of `generate-product`. When the join succeeded the engine marks `build-and-test` ready and resolves the backend, frontend and database change sets of the branches that ran; a Skipped branch contributes no change set. ToolAdapterService executes the sandbox-class tool `build-and-test`, which restores, compiles and runs the generated tests in the sandbox and returns `validation-results` (artifact-v1) with `passed` and the result per module, audited with workspace, command, exitCode and reportRef. A failing build or test is a successful step output with `passed` false, not a step failure. The step declares `failure_policy` Retry under the fixed budget of 3 attempts with backoff 10s and PT45M. The condition `check-build` evaluates `steps.build-and-test.validation-results.passed == true` without a service call or a retry; when it does not hold the engine returns to `fan-out-fill` with the results as feedback, at most 2 times, and then fails the run with the evidence and failure class validation. When it holds, `record-outputs` runs in shared-write class on the `microservice-generator` release with `microservice-generator-record-outputs`: from the change sets of the branches that ran and the validation results it assembles `generated-outputs` (change-set-v1) and `provenance` (artifact-v1), every generated module with its recipe version, template version, manifest hash, run, attempt, agent release and file hashes, and both are recorded once under the run envelope. The skill records them through the tool `record-generated-output`: ToolAdapterService, the tool executor, calls `Recipes.RecordOutput` of GenerationRecipeService with its workload identity and the scope `factory.recipes.write`, so one `GeneratedOutput` and one `GeneratedOutputRecorded` exist per module, the first call of the run moves the recipe from Approved to Executing, and when the run completes the recipe reaches Generated and `GenerationCompleted` is published (D133). The step declares `idempotency_key` runId + recipeId + changeSetHash and the call is idempotent on the same three values, so its `failure_policy` Retry with the exponential budget of 3 attempts, backoff 30s and PT30M holds for a shared-write step (D114) and a retried attempt records nothing twice; an Uncertain attempt is never retried automatically and waits for an operator decision of the project (D119). A run that fails after a recorded output keeps the recorded provenance as evidence and returns the Executing recipe to Approved. The tasks AIFACTORY-TASK-224 and AIFACTORY-TASK-225 of this PBI are verifications in WorkflowEngineService of the step mappings; the build-and-test and record-generated-output bindings themselves belong to feature tool-adapter-service and the RecordOutput handler to feature generation-recipe-service. Kind: behavior. Traces: workflows: generate-product; steps: generate-product/build-and-test, generate-product/check-build, generate-product/fan-out-fill, generate-product/record-outputs; tools: build-and-test, record-generated-output; agents: microservice-generator; services: GenerationRecipeService, ToolAdapterService, WorkflowEngineService; aggregates: GenerationRecipeService/GeneratedOutput, GenerationRecipeService/GenerationRecipe; apis: GenerationRecipeService/Recipes.RecordOutput; events: GenerationRecipeService/GeneratedOutputRecorded, GenerationRecipeService/GenerationCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: change-set-v1, artifact-v1; scenarios: SCN-generate-product-008, SCN-generate-product-009, SCN-generate-product-010, SCN-generate-product-011; adrs: ADR-0014, ADR-0027; requirements: FR-08, XL-10. Depends on: AIFACTORY-US-1157, AIFACTORY-US-1158, AIFACTORY-US-1159, feature:generation-recipe-service, feature:tool-adapter-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/generate-product.yaml, model/tools/build-and-test.yaml, model/tools/record-generated-output.yaml, model/skills/engineering/microservice-generator-record-outputs.yaml, model/services/template-library/GenerationRecipeService.yaml, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the change sets of the branches that ran, when generate-product/build-and-test runs `build-and-test`, then `validation-results` with `passed` and the result per module is recorded once whether the build passed or not, and a Skipped branch contributes no change set (SCN-generate-product-008).",
        "AC2: Given `passed` true, when the engine evaluates generate-product/check-build, then it completes with one outcome and generate-product/record-outputs becomes ready; given `passed` false and fewer than 2 iterations, then the engine returns to generate-product/fan-out-fill with the results as feedback and counts the iteration (SCN-generate-product-009, SCN-generate-product-010).",
        "AC3: Given `passed` is still false after the second iteration, or the results are missing, when the engine evaluates generate-product/check-build, then WorkflowEngineService/WorkflowRunFailed names `check-build` with the evidence, RunControlService/RunFailed is published once and nothing leaves the sandbox (SCN-generate-product-010, ADR-0014).",
        "AC4: Given the build passed, when `microservice-generator` executes generate-product/record-outputs with `microservice-generator-record-outputs`, then `generated-outputs` (change-set-v1) and `provenance` (artifact-v1) are recorded once under the run envelope, listing every generated module with its hash, template version, recipe version and run; the tool `record-generated-output` calls GenerationRecipeService/Recipes.RecordOutput, one GenerationRecipeService/GeneratedOutput and one GenerationRecipeService/GeneratedOutputRecorded exist per module and the GenerationRecipeService/GenerationRecipe moves from Approved to Executing (SCN-generate-product-011, D133, XL-10).",
        "AC5: Given an attempt of generate-product/record-outputs settles Failed with failure class transient, when Run Control evaluates it, then it is retried under its budget because the step declares its idempotency key, and a repeated GenerationRecipeService/Recipes.RecordOutput for the same run, recipe and change-set hash records nothing new; given an attempt of generate-product/build-and-test or generate-product/record-outputs exceeds its timeout or exhausts its retry budget, then the step fails with evidence, the run ends Failed with the sandbox outputs and any recorded provenance kept, the recipe returns to Approved, nothing is proposed and GenerationRecipeService/GenerationCompleted is never published for the run (SCN-generate-product-008, SCN-generate-product-011, D114)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/tools/build-and-test.yaml",
        "model/tools/record-generated-output.yaml",
        "model/skills/engineering/microservice-generator-record-outputs.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-224",
        "AIFACTORY-TASK-225",
        "AIFACTORY-TASK-4604",
        "AIFACTORY-TASK-728"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9007,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/build-and-test",
          "generate-product/check-build",
          "generate-product/fan-out-fill",
          "generate-product/record-outputs"
        ],
        "tools": [
          "build-and-test",
          "record-generated-output"
        ],
        "agents": [
          "microservice-generator"
        ],
        "services": [
          "GenerationRecipeService",
          "ToolAdapterService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "GenerationRecipeService/GeneratedOutput",
          "GenerationRecipeService/GenerationRecipe"
        ],
        "apis": [
          "GenerationRecipeService/Recipes.RecordOutput"
        ],
        "events": [
          "GenerationRecipeService/GeneratedOutputRecorded",
          "GenerationRecipeService/GenerationCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "change-set-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-generate-product-008",
          "SCN-generate-product-009",
          "SCN-generate-product-010",
          "SCN-generate-product-011"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-08",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1157",
        "AIFACTORY-US-1158",
        "AIFACTORY-US-1159",
        "feature:generation-recipe-service",
        "feature:tool-adapter-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/tools/build-and-test.yaml",
        "model/tools/record-generated-output.yaml",
        "model/skills/engineering/microservice-generator-record-outputs.yaml",
        "model/services/template-library/GenerationRecipeService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-016]",
      "number": 16
    },
    {
      "id": "AIFACTORY-TASK-224",
      "type": "task",
      "parent": "AIFACTORY-US-016",
      "title": "Verify that build-and-test consumes the binding of the tool feature",
      "sequence": "19.06.07.01",
      "description": "Verify that build-and-test consumes the binding of the tool feature. Expected output: A check of the release authored by AIFACTORY-TASK-181 proves that the step build-and-test calls the build-and-test binding that feature tool-adapter-service delivers, with backend-change-set, frontend-change-set and database-change-set mapped from steps.fill-backend, steps.fill-frontend and steps.fill-database and a Skipped branch mapping no change set, side_effect_class sandbox, the fixed retry of 3 attempts with backoff 10s and timeout PT45M, and records validation-results (artifact-v1) once; a fixture with a failing test shows passed false on a succeeded step (SCN-generate-product-008). The binding is not re-implemented here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-181 proves that the step build-and-test calls the build-and-test binding that feature tool-adapter-service delivers, with backend-change-set, frontend-change-set and database-change-set mapped from steps.fill-backend, steps.fill-frontend and steps.fill-database and a Skipped branch mapping no change set, side_effect_class sandbox, the fixed retry of 3 attempts with backoff 10s and timeout PT45M, and records validation-results (artifact-v1) once; a fixture with a failing test shows passed false on a succeeded step (SCN-generate-product-008). The binding is not re-implemented here."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9007,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-224]",
      "number": 224
    },
    {
      "id": "AIFACTORY-TASK-225",
      "type": "task",
      "parent": "AIFACTORY-US-016",
      "title": "Verify the mappings and outputs of the record-outputs step",
      "sequence": "19.06.07.02",
      "description": "Verify the mappings and outputs of the record-outputs step. Expected output: A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that the step record-outputs runs microservice-generator-record-outputs on microservice-generator in side_effect_class shared-write with idempotency_key runId + recipeId + changeSetHash and recipe, module-blueprint, backend-change-set, frontend-change-set, database-change-set and validation-results mapped as declared, records generated-outputs (change-set-v1) and provenance (artifact-v1) once under the run envelope, and reaches Recipes.RecordOutput only through the record-generated-output binding of feature tool-adapter-service, one call per module and none repeated on a retry (SCN-generate-product-011).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that the step record-outputs runs microservice-generator-record-outputs on microservice-generator in side_effect_class shared-write with idempotency_key runId + recipeId + changeSetHash and recipe, module-blueprint, backend-change-set, frontend-change-set, database-change-set and validation-results mapped as declared, records generated-outputs (change-set-v1) and provenance (artifact-v1) once under the run envelope, and reaches Recipes.RecordOutput only through the record-generated-output binding of feature tool-adapter-service, one call per module and none repeated on a retry (SCN-generate-product-011)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9007,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-225]",
      "number": 225
    },
    {
      "id": "AIFACTORY-TASK-4604",
      "type": "task",
      "parent": "AIFACTORY-US-016",
      "title": "Fixture validation results for the pass, loop and limit paths of check-build",
      "sequence": "19.06.07.03",
      "description": "Fixture validation results for the pass, loop and limit paths of check-build. Expected output: Recorded validation results (passed; failed then passed; failed three times) that drive check-build through the pass, a return to fan-out-fill with feedback and the iteration limit, each with the expected run outcome, as the oracle of SCN-generate-product-009 and SCN-generate-product-010.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded validation results (passed; failed then passed; failed three times) that drive check-build through the pass, a return to fan-out-fill with feedback and the iteration limit, each with the expected run outcome, as the oracle of SCN-generate-product-009 and SCN-generate-product-010."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9007,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4604]",
      "number": 4604
    },
    {
      "id": "AIFACTORY-TASK-728",
      "type": "task",
      "parent": "AIFACTORY-US-016",
      "title": "Verify build-test-record by running the declared command",
      "sequence": "19.06.07.04",
      "description": "Verify build-test-record by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-016 and SCN-generate-product-008 to SCN-generate-product-011, including the loop back to the fill with the results as feedback, the failed run after the second iteration, one GeneratedOutputRecorded per module with the recipe in Executing, and a retried record-outputs attempt that records nothing twice.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-016 and SCN-generate-product-008 to SCN-generate-product-011, including the loop back to the fill with the results as feedback, the failed run after the second iteration, one GeneratedOutputRecorded per module with the recipe in Executing, and a retried record-outputs attempt that records nothing twice."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9007,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-728]",
      "number": 728
    },
    {
      "id": "AIFACTORY-US-1160",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "A Reviewer approves the exact generated change set of the run before anything is proposed",
      "sequence": "19.06.08",
      "description": "As a reviewer, I want to approve the exact generated change set of a run before it becomes a pull request in the system of record, so that nothing generated reaches a shared repository without a decision bound to what I saw. The Human step `approve-proposal` of `generate-product`. When `record-outputs` succeeded the engine marks it ready; it has no task contract, and Run Control opens an `ApprovalRequest` of kind approval whose subject is the run and the step `approve-proposal`, with action class shared-write, proposal kind diff and the proposal hash of `steps.record-outputs.generated-outputs`, and publishes `ApprovalRequested`; the run waits WaitingForApproval and the engine's projection WaitingForHuman. Eligibility is role Reviewer in project scope and the requester of the run never decides (D18). A decision authorizes exactly that hash; a regenerated change set makes the pending request Stale, which never advances the run. An approving `ApprovalDecided` resumes the run and `propose-change-set` becomes ready (AIFACTORY-US-1161). The step has timeout P7D and `failure_policy` Fail: a rejected request, or an expired one, which fails while no approval rule is supplied (D115), fails the run with failure class policy-denied and nothing is proposed. A request still Pending when the run is cancelled or fails ends Cancelled, as RunControlService states, and nothing is proposed. Until I4 the approval always runs, whatever the project policy says about autonomous proposals (D133). From I4 the step carries a policy guard of action kind tool-invocation and class shared-write over `steps.record-outputs.generated-outputs`: the engine asks PolicyEngineService before it emits `StepReady`, and an answer allow records the step run Skipped and opens no approval, any other answer opens the request as above. The release carries that guard from the start; evaluating it is engine behaviour of I4 and is not proven by this I1 feature. One branch is not settled by the model: a ChangesRequested decision returns the run to the lease holder with the reason of the reviewer, but a Human step has no lease holder, so what regenerates the change set stays open. Kind: behavior. Traces: workflows: generate-product; steps: generate-product/approve-proposal; services: RunControlService, WorkflowEngineService; aggregates: RunControlService/ApprovalRequest, RunControlService/Run, WorkflowEngineService/WorkflowRun; apis: RunControlService/DecideApproval; events: RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, WorkflowEngineService/WorkflowRunFailed; descriptors: change-set-v1; scenarios: SCN-generate-product-012; adrs: ADR-0014, ADR-0015; requirements: FR-08. Depends on: AIFACTORY-US-016, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/generate-product.yaml, model/services/control-plane/RunControlService.yaml, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.record-outputs.generated-outputs` is recorded, when the engine marks generate-product/approve-proposal ready, then a RunControlService/ApprovalRequest of kind approval names the run and the step, carries action class shared-write, proposal kind diff and the change-set hash, RunControlService/ApprovalRequested is published and the run waits WaitingForApproval (SCN-generate-product-012, ADR-0015).",
        "AC2: Given an eligible Reviewer who is not the requester of the run decides through RunControlService/DecideApproval, when the decision approves the pending hash, then RunControlService/ApprovalDecided resumes the run and generate-product/propose-change-set becomes ready; a decision by the requester is refused and a decision on a Stale request never advances the run (SCN-generate-product-012).",
        "AC3: Given the request is rejected or expires after P7D, when Run Control applies the decision, then the run fails with failure class policy-denied, WorkflowEngineService/WorkflowRunFailed names `approve-proposal` and nothing is proposed; given the run is cancelled or fails while the request is Pending, the RunControlService/ApprovalRequest ends Cancelled and nothing is proposed (SCN-generate-product-012, ADR-0014).",
        "AC4: Given an eligible Reviewer decides ChangesRequested with a reason through RunControlService/DecideApproval, when Run Control records it, then RunControlService/ApprovalDecided carries ChangesRequested and the reason and the run does not reach generate-product/propose-change-set; which step regenerates the change set is pending the owner and not asserted, because RunControlService returns such a run to the lease holder and a Human step has none (SCN-generate-product-012).",
        "AC5: Given a project policy that would allow autonomous change proposals, when a run of this increment reaches generate-product/approve-proposal, then the request of AC1 is opened all the same, because until I4 the approval always runs, and the Draft release carries the `policy_guard` of model/workflows/generate-product.yaml with `from_increment` I4 unchanged for the engine to evaluate from I4 (SCN-generate-product-012, D133)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4605",
        "AIFACTORY-TASK-4606",
        "AIFACTORY-TASK-4607"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9008,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/approve-proposal"
        ],
        "services": [
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "RunControlService/Run",
          "WorkflowEngineService/WorkflowRun"
        ],
        "apis": [
          "RunControlService/DecideApproval"
        ],
        "events": [
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-generate-product-012"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-016",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1160]",
      "number": 1160
    },
    {
      "id": "AIFACTORY-TASK-4605",
      "type": "task",
      "parent": "AIFACTORY-US-1160",
      "title": "Verify the approval block of approve-proposal in the Draft release against the definition",
      "sequence": "19.06.08.01",
      "description": "Verify the approval block of approve-proposal in the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that the step approve-proposal carries kind human, gate approval, side_effect_class shared-write, timeout P7D, failure_policy Fail, no when guard, the approval block with action_class shared-write, proposal_kind diff, proposal_from steps.record-outputs.generated-outputs, the approver rule and the stale rule, and the policy_guard with from_increment I4, action_kind tool-invocation and skip_when allow; nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that the step approve-proposal carries kind human, gate approval, side_effect_class shared-write, timeout P7D, failure_policy Fail, no when guard, the approval block with action_class shared-write, proposal_kind diff, proposal_from steps.record-outputs.generated-outputs, the approver rule and the stale rule, and the policy_guard with from_increment I4, action_kind tool-invocation and skip_when allow; nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9008,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4605]",
      "number": 4605
    },
    {
      "id": "AIFACTORY-TASK-4606",
      "type": "task",
      "parent": "AIFACTORY-US-1160",
      "title": "Fixture decisions on the change-set approval",
      "sequence": "19.06.08.02",
      "description": "Fixture decisions on the change-set approval. Expected output: Recorded decisions on the request of approve-proposal (approve by an eligible Reviewer, decision by the requester refused, reject, expiry after P7D, Stale after a regenerated hash, Cancelled when the run is cancelled) with the expected run outcome, and a ChangesRequested decision with its expected ApprovalDecided only, as the oracle of SCN-generate-product-012.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded decisions on the request of approve-proposal (approve by an eligible Reviewer, decision by the requester refused, reject, expiry after P7D, Stale after a regenerated hash, Cancelled when the run is cancelled) with the expected run outcome, and a ChangesRequested decision with its expected ApprovalDecided only, as the oracle of SCN-generate-product-012."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9008,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4606]",
      "number": 4606
    },
    {
      "id": "AIFACTORY-TASK-4607",
      "type": "task",
      "parent": "AIFACTORY-US-1160",
      "title": "Prove the change-set approval on the fixture",
      "sequence": "19.06.08.03",
      "description": "Prove the change-set approval on the fixture. Expected output: A fixture run proves SCN-generate-product-012 (AC1 to AC5 of AIFACTORY-US-1160); the approval request names the run and the step and the change-set hash, only an eligible Reviewer advances the run, rejection and expiry fail it policy-denied, a Pending request ends Cancelled with the run, a ChangesRequested decision does not reach propose-change-set, and under a policy that would allow autonomous proposals the request is still opened, because until I4 the approval always runs (D133).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-generate-product-012 (AC1 to AC5 of AIFACTORY-US-1160); the approval request names the run and the step and the change-set hash, only an eligible Reviewer advances the run, rejection and expiry fail it policy-denied, a Pending request ends Cancelled with the run, a ChangesRequested decision does not reach propose-change-set, and under a policy that would allow autonomous proposals the request is still opened, because until I4 the approval always runs (D133)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9008,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4607]",
      "number": 4607
    },
    {
      "id": "AIFACTORY-US-1161",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-112",
      "title": "The approved change set is proposed as a pull request under the approval bound to its request hash",
      "sequence": "19.06.09",
      "description": "As a reviewer, I want the pull request opened only for the change set I approved, under my approval and nothing else, so that a changed change set or another tool version can never reach the system of record under my decision. The last step of `generate-product`, the shared-write tool `propose-change-set`. When `approve-proposal` was approved the engine marks it ready and resolves `change-set` from `steps.record-outputs.generated-outputs`, `provenance` from `steps.record-outputs.provenance` and `validation-results` from `steps.build-and-test.validation-results`. Run Control dispatches the attempt and ToolAdapterService executes the tool under the run's workload identity through its fixed pipeline, whose behaviour feature tool-adapter-service delivers (AIFACTORY-US-604): `Policy.Decide` answers for the tool-invocation, and under `allow-with-approval`, the answer for this tool unless the project policy allows autonomous proposals, the call executes only with the `approvalId` of the `approve-proposal` request, which ToolAdapterService validates before anything is brokered: same tenant and run, state Approved, proposal hash equal to the request hash of the invocation, which covers the tool id, the exact tool version and the arguments. Whether the proposal hash of that request, the hash of `generated-outputs`, equals the request hash the executor computes is the open point AIFACTORY-US-604 reports; this PBI cites it and does not resolve it. Under `allow` the call executes with no `approvalId`. The tool pushes the branch and opens the pull request through the connection of the project, with the credential IntegrationService resolves through the Secret Broker, the provenance and the validation results attached; it then records the proposal with `Pipelines.RecordProposal` of PipelineExecutionService under the scope `factory.delivery.propose`, sending change-proposal-record-v1 with the change set, the run, the attempt, the agent release, the pull-request reference and the tool receipt (D135). The proposal is recorded in PullRequestOpen, `ChangeProposalOpened` names the run and `change-proposal` (pull-request-proposal-v1) is recorded once; `OpenChangeProposal` stays the route of a person and is not called. The step declares `failure_policy` Compensate, a fixed retry of 2 attempts and no `idempotency_key`, so a Failed attempt is not retried (ADR-0014): the run ends Failed with the evidence and the sandbox outputs stay recorded. A step's own compensation runs only after its effect is confirmed (D133), so a Failed attempt, which opened nothing, withdraws nothing, and no succeeded step before it declares a compensation. The declared withdrawal applies only to an effect an operator confirms and then chooses to compensate, and no operation of PipelineExecutionService implements a withdrawal yet, which stays an open point. An Uncertain attempt raises `ToolEffectUncertain` and waits for an operator through `ConfirmToolEffect`. Kind: behavior. Traces: workflows: generate-product; steps: generate-product/propose-change-set; tools: propose-change-set; services: ToolAdapterService, PipelineExecutionService, RunControlService, WorkflowEngineService; aggregates: ToolAdapterService/ToolInvocation, PipelineExecutionService/ChangeProposal; apis: PipelineExecutionService/Pipelines.RecordProposal, ToolAdapterService/ConfirmToolEffect; events: PipelineExecutionService/ChangeProposalOpened, ToolAdapterService/ToolEffectUncertain, WorkflowEngineService/WorkflowRunFailed; descriptors: change-set-v1, artifact-v1, pull-request-proposal-v1, change-proposal-record-v1; scenarios: SCN-generate-product-013; adrs: ADR-0014, ADR-0015; requirements: FR-08, XL-10. Depends on: AIFACTORY-US-1160, feature:tool-adapter-service, feature:pipeline-execution-service-thin, feature:integration-service-thin, feature:secret-broker-service, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/generate-product.yaml, model/tools/propose-change-set.yaml, model/services/tools-mcp/ToolAdapterService.yaml, model/services/devops-gitops/PipelineExecutionService.yaml, model/scenarios/generate-product.yaml.",
      "acceptanceCriteria": [
        "AC1: Given approve-proposal was approved and `Policy.Decide` answers `allow-with-approval`, when generate-product/propose-change-set calls `propose-change-set`, then the ToolAdapterService/ToolInvocation carries the `approvalId` of the approve-proposal request and ToolAdapterService validates it against the request hash and the exact tool version before anything is brokered, an approval that does not bind leaving the invocation AwaitingApproval; given the answer `allow`, the call executes without an `approvalId`; the correspondence of the change-set hash with the request hash stays the open point of AIFACTORY-US-604 (SCN-generate-product-013).",
        "AC2: Given the invocation executes, when the tool has opened the pull request through the connection and records it through PipelineExecutionService/Pipelines.RecordProposal with change-proposal-record-v1, then the pull request carries exactly the approved change set with the provenance and the validation results, the PipelineExecutionService/ChangeProposal is recorded in PullRequestOpen with the run, attempt, agent release, pull-request reference and tool receipt, PipelineExecutionService/ChangeProposalOpened names the run and `change-proposal` (pull-request-proposal-v1) is recorded once under the run envelope (SCN-generate-product-013, D135, XL-10).",
        "AC3: Given an attempt of generate-product/propose-change-set settles Failed, when Run Control evaluates it, then it is not retried, because the shared-write step declares no idempotency key, WorkflowEngineService/WorkflowRunFailed names the step and the run ends Failed with the evidence and the sandbox outputs kept; nothing is withdrawn, because a step's own compensation runs only after its effect is confirmed and the Failed attempt opened nothing (SCN-generate-product-013, D133, ADR-0014).",
        "AC4: Given an attempt settles Uncertain, the PT30M timeout passing after the call was dispatched with no answer, when Run Control records it, then ToolAdapterService/ToolEffectUncertain is raised, no automatic retry follows and the attempt stays Uncertain until an operator settles it through ToolAdapterService/ConfirmToolEffect (SCN-generate-product-013, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml",
        "model/tools/propose-change-set.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4608",
        "AIFACTORY-TASK-4609",
        "AIFACTORY-TASK-4610"
      ],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9009,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/propose-change-set"
        ],
        "tools": [
          "propose-change-set"
        ],
        "services": [
          "ToolAdapterService",
          "PipelineExecutionService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "ToolAdapterService/ToolInvocation",
          "PipelineExecutionService/ChangeProposal"
        ],
        "apis": [
          "PipelineExecutionService/Pipelines.RecordProposal",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "PipelineExecutionService/ChangeProposalOpened",
          "ToolAdapterService/ToolEffectUncertain",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "change-set-v1",
          "artifact-v1",
          "pull-request-proposal-v1",
          "change-proposal-record-v1"
        ],
        "scenarios": [
          "SCN-generate-product-013"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-08",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1160",
        "feature:tool-adapter-service",
        "feature:pipeline-execution-service-thin",
        "feature:integration-service-thin",
        "feature:secret-broker-service",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/generate-product.yaml",
        "model/tools/propose-change-set.yaml",
        "model/services/tools-mcp/ToolAdapterService.yaml",
        "model/services/devops-gitops/PipelineExecutionService.yaml",
        "model/scenarios/generate-product.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1161]",
      "number": 1161
    },
    {
      "id": "AIFACTORY-TASK-4608",
      "type": "task",
      "parent": "AIFACTORY-US-1161",
      "title": "Verify the propose-change-set step of the Draft release against the definition",
      "sequence": "19.06.09.01",
      "description": "Verify the propose-change-set step of the Draft release against the definition. Expected output: A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that the step propose-change-set names the tool propose-change-set, carries side_effect_class shared-write, failure_policy Compensate, no idempotency_key, the fixed retry of 2 attempts with backoff 10s, timeout PT30M, the compensation text as declared and the mappings change-set from steps.record-outputs.generated-outputs, provenance from steps.record-outputs.provenance and validation-results from steps.build-and-test.validation-results; the tool binding is consumed from feature tool-adapter-service and nothing is authored here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A check of the release authored by AIFACTORY-TASK-181 against model/workflows/generate-product.yaml proves that the step propose-change-set names the tool propose-change-set, carries side_effect_class shared-write, failure_policy Compensate, no idempotency_key, the fixed retry of 2 attempts with backoff 10s, timeout PT30M, the compensation text as declared and the mappings change-set from steps.record-outputs.generated-outputs, provenance from steps.record-outputs.provenance and validation-results from steps.build-and-test.validation-results; the tool binding is consumed from feature tool-adapter-service and nothing is authored here."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9009,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4608]",
      "number": 4608
    },
    {
      "id": "AIFACTORY-TASK-4609",
      "type": "task",
      "parent": "AIFACTORY-US-1161",
      "title": "Fixture proposal outcomes for the bound, allowed, failed and uncertain paths",
      "sequence": "19.06.09.02",
      "description": "Fixture proposal outcomes for the bound, allowed, failed and uncertain paths. Expected output: Recorded outcomes of propose-change-set (opened under a bound approvalId and recorded through Pipelines.RecordProposal with its change-proposal-record-v1 request, an approval of another hash leaving the invocation AwaitingApproval, opened without approvalId under a policy answer allow, Failed without a retry or a withdrawal, Uncertain until ConfirmToolEffect) with the expected run outcome, as the oracle of SCN-generate-product-013.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded outcomes of propose-change-set (opened under a bound approvalId and recorded through Pipelines.RecordProposal with its change-proposal-record-v1 request, an approval of another hash leaving the invocation AwaitingApproval, opened without approvalId under a policy answer allow, Failed without a retry or a withdrawal, Uncertain until ConfirmToolEffect) with the expected run outcome, as the oracle of SCN-generate-product-013."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9009,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4609]",
      "number": 4609
    },
    {
      "id": "AIFACTORY-TASK-4610",
      "type": "task",
      "parent": "AIFACTORY-US-1161",
      "title": "Prove the change-set proposal on the fixture",
      "sequence": "19.06.09.03",
      "description": "Prove the change-set proposal on the fixture. Expected output: A fixture run proves SCN-generate-product-013 (AC1 to AC4 of AIFACTORY-US-1161); the call executes only under a bound approvalId or a policy answer allow, the opened pull request carries the approved change set and is recorded through Pipelines.RecordProposal in PullRequestOpen with ChangeProposalOpened, a Failed attempt is not retried and fails the run with the sandbox outputs kept and nothing withdrawn, and an Uncertain attempt waits for ConfirmToolEffect.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-generate-product-013 (AC1 to AC4 of AIFACTORY-US-1161); the call executes only under a bound approvalId or a policy answer allow, the opened pull request carries the approved change set and is recorded through Pipelines.RecordProposal in PullRequestOpen with ChangeProposalOpened, a Failed attempt is not retried and fails the run with the sandbox outputs kept and nothing withdrawn, and an Uncertain attempt waits for ConfirmToolEffect."
      ],
      "sourceArtifacts": [
        "model/workflows/generate-product.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 90,
      "phase": "factory",
      "stackRank": 9009,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4610]",
      "number": 4610
    },
    {
      "id": "AIFACTORY-FEAT-113",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Project bootstrap",
      "sequence": "19.07",
      "description": "The workflow definition project-bootstrap as a published asset: Creates the system-of-record project, repositories, pipelines and boards for a new Factory project through connectors, under one shared-write approval, and records the trace scaffolding. It has 5 steps, names the agents devops-engineer and the tools propose-change-set, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I2: Deliver it. Build order 102 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-021",
        "AIFACTORY-US-1181",
        "AIFACTORY-US-1182",
        "AIFACTORY-US-1183"
      ],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10200,
      "titlePrefix": "[AIFACTORY-FEAT-113]",
      "number": 113
    },
    {
      "id": "AIFACTORY-US-021",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-113",
      "title": "A new project gets its bootstrap change proposal and trace scaffolding under one approval",
      "sequence": "19.07.01",
      "description": "As a workspace administrator, I want the repositories, pipeline definitions and boards of a new project proposed to the system of record as one approved change set, with its trace scaffolding recorded, so that delivery starts from a proposal that matches the plan and that nobody assembled by hand. The integration PBI of the definition `project-bootstrap`. When ProjectService publishes `ProjectCreated` with a key, WorkflowEngineService satisfies the one required readiness member `project` (execution-scope-v1) of the project scope, computes the bundle fingerprint and submits the run itself through `SubmitRun` of RunControlService with a service token that names the project, the idempotency key `{scope}:{operation}:{workflowReleaseId}:{bundleFingerprint}` and the release alias latest resolved when the correlation opens (D131). The same key returns the existing run, so a repeated `ProjectCreated` never starts a second bootstrap; a newer member version supersedes the open correlation. Run Control accepts the run and publishes `RunAccepted`; the engine loads the Published release the run pinned through AgentRegistryService and marks the five steps ready in the declared order: `plan-bootstrap`, `scaffold-resources`, `approve-shared-write`, `apply-bootstrap` and `record-trace`. Agent steps run the `devops-engineer` release, the tool step calls `propose-change-set` and the human step is the one shared-write approval of the run. Every step records exactly one outcome under the run envelope, the run reports exactly one outcome to Run Control (ADR-0014) and stays within the declared budget of model/workflows/project-bootstrap.yaml. The definition says the resources are created, but the bound tool `propose-change-set` only opens a pull request; creating repositories, pipelines and boards has no modelled operation, so this PBI promises the change proposal and the trace scaffolding only and the creation is reported as an open question. Before any run, the definition release and the agent release of `devops-engineer`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release, no evaluation verdict is required before I4, and the runs pin the Published release, never a Draft one (D140). The behaviour of the steps is specified in AIFACTORY-US-1181 to AIFACTORY-US-1183; this PBI proves the whole chain on the recorded fixture. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService, AgentRegistryService, ProjectService, ToolAdapterService; workflows: project-bootstrap; steps: project-bootstrap/plan-bootstrap, project-bootstrap/scaffold-resources, project-bootstrap/approve-shared-write, project-bootstrap/apply-bootstrap, project-bootstrap/record-trace; agents: devops-engineer; tools: propose-change-set; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, ProjectService/ProjectCreated, WorkflowEngineService/ReadinessSatisfied, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, execution-scope-v1, pull-request-proposal-v1, artifact-v1; adrs: ADR-0014, ADR-0024, ADR-0027; requirements: FR-05, FR-06, FR-08, FUX-05, XL-01, XL-10. Depends on: AIFACTORY-US-1181, AIFACTORY-US-1182, AIFACTORY-US-1183, feature:project-service, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:agent-registry-service-publication. Sources: model/workflows/project-bootstrap.yaml, model/agents/devops-delivery/devops-engineer.yaml, docs/planes/agent-runtime/workflow-definitions/project-bootstrap.md.",
      "acceptanceCriteria": [
        "AC1: Given ProjectService/ProjectCreated is published with a key for a project of the trusted tenant, when the readiness member `project` is satisfied, then WorkflowEngineService/ReadinessSatisfied and WorkflowEngineService/ReadinessRunSubmitted are emitted once, the run is submitted through RunControlService/SubmitRun with a service token naming the project (D131) and the bundle idempotency key, and a repeated ProjectCreated for the same project returns the existing run instead of a second one.",
        "AC2: Given the Published release of `project-bootstrap`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter (D140), with its 5 steps, input mappings, retry policies, timeouts and the failure policy each step declares exactly as in model/workflows/project-bootstrap.yaml, when RunControlService/RunAccepted arrives for a run that pinned it, then WorkflowEngineService/WorkflowRunStarted is emitted and the steps project-bootstrap/plan-bootstrap, project-bootstrap/scaffold-resources, project-bootstrap/approve-shared-write, project-bootstrap/apply-bootstrap and project-bootstrap/record-trace become ready in that order, each agent step on the pinned Published release of `devops-engineer`, and no Draft release is loaded.",
        "AC3: Given every step succeeds, when the run completes, then the opened change proposal `bootstrap-change-proposal` (pull-request-proposal-v1) and `trace-scaffolding` (artifact-v1) are the run outputs under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014); no repository, pipeline or board is asserted as created beyond the opened proposal.",
        "AC4: Given a step fails after its retry budget, the apply step fails before its effect is confirmed, or record-trace fails after the confirmed apply and the compensation of apply-bootstrap runs, when the engine applies the failure policy of that step, then WorkflowEngineService/WorkflowRunFailed names the failed step and RunControlService/RunFailed is published exactly once (ADR-0014, D133); given the approval is rejected or expires with no re-request left, then Run Control moves the run from WaitingForApproval to Failed (ApprovalRejectedOrExpired) and publishes RunControlService/RunFailed exactly once, the engine closes its projection on RunFailed and publishes no WorkflowEngineService/WorkflowRunFailed (D119, D121), and nothing is written to the system of record.",
        "AC5: Given the recorded fixture inputs of model/workflows/project-bootstrap.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml",
        "model/agents/devops-delivery/devops-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/project-bootstrap.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-314",
        "AIFACTORY-TASK-269",
        "AIFACTORY-TASK-270",
        "AIFACTORY-TASK-271",
        "AIFACTORY-TASK-735"
      ],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10201,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "ProjectService",
          "ToolAdapterService"
        ],
        "workflows": [
          "project-bootstrap"
        ],
        "steps": [
          "project-bootstrap/plan-bootstrap",
          "project-bootstrap/scaffold-resources",
          "project-bootstrap/approve-shared-write",
          "project-bootstrap/apply-bootstrap",
          "project-bootstrap/record-trace"
        ],
        "agents": [
          "devops-engineer"
        ],
        "tools": [
          "propose-change-set"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "ProjectService/ProjectCreated",
          "WorkflowEngineService/ReadinessSatisfied",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "execution-scope-v1",
          "pull-request-proposal-v1",
          "artifact-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "FR-08",
          "FUX-05",
          "XL-01",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1181",
        "AIFACTORY-US-1182",
        "AIFACTORY-US-1183",
        "feature:project-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/project-bootstrap.yaml",
        "model/agents/devops-delivery/devops-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/project-bootstrap.md"
      ],
      "titlePrefix": "[AIFACTORY-US-021]",
      "number": 21
    },
    {
      "id": "AIFACTORY-TASK-314",
      "type": "task",
      "parent": "AIFACTORY-US-021",
      "title": "Readiness start on a created project",
      "sequence": "19.07.01.01",
      "description": "Readiness start on a created project. Expected output: The readiness bundle of project-bootstrap is satisfied by ProjectCreated with a key, the run is submitted through SubmitRun with a service token naming the project and the bundle idempotency key, and a repeated ProjectCreated returns the existing run (AC1 of AIFACTORY-US-021).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The readiness bundle of project-bootstrap is satisfied by ProjectCreated with a key, the run is submitted through SubmitRun with a service token naming the project and the bundle idempotency key, and a repeated ProjectCreated returns the existing run (AC1 of AIFACTORY-US-021)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-314]",
      "number": 314
    },
    {
      "id": "AIFACTORY-TASK-269",
      "type": "task",
      "parent": "AIFACTORY-US-021",
      "title": "Author, submit and publish the release of the workflow definition project-bootstrap with its agent release",
      "sequence": "19.07.01.02",
      "description": "Author, submit and publish the release of the workflow definition project-bootstrap with its agent release. Expected output: The release of project-bootstrap (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy each step declares (Retry on the agent steps, Fail on approve-shared-write, Compensate on apply-bootstrap with its compensation) and the approval block of the human step exactly as in model/workflows/project-bootstrap.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent release devops-engineer of AIFACTORY-TASK-270 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of project-bootstrap (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy each step declares (Retry on the agent steps, Fail on approve-shared-write, Compensate on apply-bootstrap with its compensation) and the approval block of the human step exactly as in model/workflows/project-bootstrap.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent release devops-engineer of AIFACTORY-TASK-270 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-269]",
      "number": 269
    },
    {
      "id": "AIFACTORY-TASK-270",
      "type": "task",
      "parent": "AIFACTORY-US-021",
      "title": "Author the agent release devops-engineer with its prompts and skills",
      "sequence": "19.07.01.03",
      "description": "Author the agent release devops-engineer with its prompts and skills. Expected output: A Draft release of devops-engineer with its instructions, the skills devops-engineer-plan-bootstrap, devops-engineer-scaffold-resources and devops-engineer-record-trace among its bound skills, the tool bindings and the model profile of model/agents/devops-delivery/devops-engineer.yaml; the release passes a smoke run on a fixture project in the template tests and is submitted for publication by AIFACTORY-TASK-269, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of devops-engineer with its instructions, the skills devops-engineer-plan-bootstrap, devops-engineer-scaffold-resources and devops-engineer-record-trace among its bound skills, the tool bindings and the model profile of model/agents/devops-delivery/devops-engineer.yaml; the release passes a smoke run on a fixture project in the template tests and is submitted for publication by AIFACTORY-TASK-269, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-270]",
      "number": 270
    },
    {
      "id": "AIFACTORY-TASK-271",
      "type": "task",
      "parent": "AIFACTORY-US-021",
      "title": "Fixture run of project-bootstrap against recorded inputs",
      "sequence": "19.07.01.04",
      "description": "Fixture run of project-bootstrap against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from ProjectCreated to RunCompleted on the Published releases of AIFACTORY-TASK-269; every step output validates against its descriptor and the run outputs match the recorded ones field by field (AC2, AC3 and AC5 of AIFACTORY-US-021).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from ProjectCreated to RunCompleted on the Published releases of AIFACTORY-TASK-269; every step output validates against its descriptor and the run outputs match the recorded ones field by field (AC2, AC3 and AC5 of AIFACTORY-US-021)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-271]",
      "number": 271
    },
    {
      "id": "AIFACTORY-TASK-735",
      "type": "task",
      "parent": "AIFACTORY-US-021",
      "title": "Verify bootstrap-project-resources by running the declared command",
      "sequence": "19.07.01.05",
      "description": "Verify bootstrap-project-resources by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-021, including both failure paths of AC4 (WorkflowRunFailed then RunFailed exactly once for a failed step, RunFailed alone for a rejected or expired approval); the output names the Published release ids of project-bootstrap and devops-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-021, including both failure paths of AC4 (WorkflowRunFailed then RunFailed exactly once for a failed step, RunFailed alone for a rejected or expired approval); the output names the Published release ids of project-bootstrap and devops-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-735]",
      "number": 735
    },
    {
      "id": "AIFACTORY-US-1181",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-113",
      "title": "The DevOps Engineer plans the bootstrap and scaffolds the resources in the run's isolated workspace",
      "sequence": "19.07.02",
      "description": "As a workspace administrator, I want the repositories, pipelines and boards my project needs planned and scaffolded before anything is written to the system of record, so that the reviewer decides on one exact change set that nothing outside the run has touched. The first two agent steps of `project-bootstrap`. When the engine marks `plan-bootstrap` ready it resolves `project` from `input.project` (execution-scope-v1) and `system-of-record-connection` from `input.system-of-record-connection` (artifact-v1, optional); the `devops-engineer` release runs the skill `devops-engineer-plan-bootstrap` in read class with read tools only and writes one artifact, `bootstrap-plan` (artifact-v1), naming every repository, pipeline definition and board the project needs from its edition and the capabilities of the connection, with lineage to the project scope. When `scaffold-resources` becomes ready it receives `project` and `bootstrap-plan` from `steps.plan-bootstrap.bootstrap-plan`; the skill `devops-engineer-scaffold-resources` writes repository layouts, pipeline files and board templates in sandbox class inside the run's isolated workspace with `apply-patch`, `write-file`, `shell-sandbox` and `build-and-test`, and returns `change-set` (change-set-v1) with its diff reference and hash. Neither step touches the system of record or needs an approval. Both declare `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, an attempt of any other failure class is not retried, and a step that exceeds its timeout PT30M or spends its budget fails the run with the evidence while no shared system has changed. Kind: behavior. Traces: workflows: project-bootstrap; steps: project-bootstrap/plan-bootstrap, project-bootstrap/scaffold-resources; agents: devops-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/StepSettled; descriptors: execution-scope-v1, artifact-v1, change-set-v1; scenarios: SCN-project-bootstrap-001, SCN-project-bootstrap-002; adrs: ADR-0014; requirements: FR-05. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/project-bootstrap.yaml, model/skills/devops-delivery/devops-engineer-plan-bootstrap.yaml, model/skills/devops-delivery/devops-engineer-scaffold-resources.yaml, model/scenarios/project-bootstrap.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `project` and an optional `system-of-record-connection`, when the engine marks project-bootstrap/plan-bootstrap ready and `devops-engineer` executes it, then `bootstrap-plan` (artifact-v1) is recorded once under the run envelope, names every repository, pipeline definition and board with lineage to the project, and project-bootstrap/scaffold-resources becomes ready (SCN-project-bootstrap-001).",
        "AC2: Given `steps.plan-bootstrap.bootstrap-plan` is recorded, when project-bootstrap/scaffold-resources runs in the isolated workspace, then `change-set` (change-set-v1) is recorded once with its diff reference and hash, every planned resource has its scaffold in the change set and nothing is written to the system of record (SCN-project-bootstrap-002).",
        "AC3: Given an attempt of either step settles Failed with failure class transient until the exponential budget of 3 attempts is spent, settles Failed with any other failure class, or exceeds its timeout PT30M, when Run Control settles the step through RunControlService/StepSettled, then the engine reports WorkflowEngineService/WorkflowRunFailed naming the step, the sandbox output stays in place as evidence and no shared system is changed (SCN-project-bootstrap-001, SCN-project-bootstrap-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml",
        "model/skills/devops-delivery/devops-engineer-plan-bootstrap.yaml",
        "model/skills/devops-delivery/devops-engineer-scaffold-resources.yaml",
        "model/scenarios/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-315",
        "AIFACTORY-TASK-4721",
        "AIFACTORY-TASK-4722"
      ],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10202,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "project-bootstrap"
        ],
        "steps": [
          "project-bootstrap/plan-bootstrap",
          "project-bootstrap/scaffold-resources"
        ],
        "agents": [
          "devops-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/StepSettled"
        ],
        "descriptors": [
          "execution-scope-v1",
          "artifact-v1",
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-project-bootstrap-001",
          "SCN-project-bootstrap-002"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/project-bootstrap.yaml",
        "model/skills/devops-delivery/devops-engineer-plan-bootstrap.yaml",
        "model/skills/devops-delivery/devops-engineer-scaffold-resources.yaml",
        "model/scenarios/project-bootstrap.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1181]",
      "number": 1181
    },
    {
      "id": "AIFACTORY-TASK-315",
      "type": "task",
      "parent": "AIFACTORY-US-1181",
      "title": "Plan and scaffold in the isolated workspace",
      "sequence": "19.07.02.01",
      "description": "Plan and scaffold in the isolated workspace. Expected output: The devops-engineer skills devops-engineer-plan-bootstrap and devops-engineer-scaffold-resources produce the bootstrap plan (artifact-v1) and the change set (change-set-v1) of repository, pipeline and board files in the sandbox workspace, with the input mappings of model/workflows/project-bootstrap.yaml.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The devops-engineer skills devops-engineer-plan-bootstrap and devops-engineer-scaffold-resources produce the bootstrap plan (artifact-v1) and the change set (change-set-v1) of repository, pipeline and board files in the sandbox workspace, with the input mappings of model/workflows/project-bootstrap.yaml."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10202,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-315]",
      "number": 315
    },
    {
      "id": "AIFACTORY-TASK-4721",
      "type": "task",
      "parent": "AIFACTORY-US-1181",
      "title": "Recorded fixture of a project scope with its expected plan and change set",
      "sequence": "19.07.02.02",
      "description": "Recorded fixture of a project scope with its expected plan and change set. Expected output: A fixture project scope and connection with the expected bootstrap plan naming each repository, pipeline definition and board, and the expected change set with its hash, as the oracle of SCN-project-bootstrap-001 and SCN-project-bootstrap-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture project scope and connection with the expected bootstrap plan naming each repository, pipeline definition and board, and the expected change set with its hash, as the oracle of SCN-project-bootstrap-001 and SCN-project-bootstrap-002."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10202,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4721]",
      "number": 4721
    },
    {
      "id": "AIFACTORY-TASK-4722",
      "type": "task",
      "parent": "AIFACTORY-US-1181",
      "title": "Prove the plan and scaffold steps on the fixture",
      "sequence": "19.07.02.03",
      "description": "Prove the plan and scaffold steps on the fixture. Expected output: A fixture run proves SCN-project-bootstrap-001 and SCN-project-bootstrap-002 (AC1 to AC3 of AIFACTORY-US-1181), including the transient retry to exhaustion and the WorkflowRunFailed that names the step with no shared system changed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-project-bootstrap-001 and SCN-project-bootstrap-002 (AC1 to AC3 of AIFACTORY-US-1181), including the transient retry to exhaustion and the WorkflowRunFailed that names the step with no shared system changed."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4722]",
      "number": 4722
    },
    {
      "id": "AIFACTORY-US-1182",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-113",
      "title": "A reviewer approves the exact change set and only then is the change proposal opened through the connector",
      "sequence": "19.07.03",
      "description": "As a reviewer of the project, I want to decide on the exact change set that will create the project's resources, and see it applied only after my decision, so that no repository, pipeline or board appears in the system of record without a decision bound to what is written. The human step and the tool step of `project-bootstrap`. When `approve-shared-write` becomes ready the engine emits `StepReady` for a Human step, with action class shared-write and no task contract; Run Control opens an approval request whose subject is the run and the step, of action class shared-write and proposal kind diff, with the hash of `steps.scaffold-resources.change-set` as proposal hash and the approver rule role Reviewer in project scope, where the requester of the run never decides (ADR-0015, D18, D129). `ApprovalRequested` is published, the run waits WaitingForApproval and the engine projection WaitingForHuman. An approving `ApprovalDecided` bound to that hash completes the step; on a rejection, or an expiry without a re-request left, Run Control moves the run from WaitingForApproval to Failed (ApprovalRejectedOrExpired) and publishes `RunFailed` exactly once, and the engine closes its projection on `RunFailed` without `WorkflowRunFailed` (D119, D121), with nothing written; a regenerated change set makes the pending request Stale. Until I4 this approval always runs; from I4 the step carries a policy guard: before the approval opens the engine asks PolicyEngineService with the action kind tool-invocation and the action class shared-write over the change set, an answer allow records the step run Skipped and opens no approval, and any other answer opens it (D133); this PBI asserts the I2 behaviour, where the approval always runs. The definition says the step creates the resources, but the bound tool only opens a pull request; creating repositories, pipelines and boards has no modelled operation and is reported as an open question. When `apply-bootstrap` becomes ready the tool `propose-change-set` receives `change-set` from `steps.scaffold-resources.change-set` and, through ToolAdapterService under the run's workload identity, pushes the branch and opens the pull request through the connection, IntegrationService with the credential the Secret Broker issues, auditing repository, branch, changeSetHash and pullRequestRef; it then records the proposal with `Pipelines.RecordProposal` of PipelineExecutionService (change-proposal-record-v1, scope factory.delivery.propose), which carries the run, the attempt, the agent release, the pull-request reference and the tool receipt, and the proposal starts in PullRequestOpen (D135). The output `bootstrap-change-proposal` (pull-request-proposal-v1) is recorded once. The step is shared-write with `failure_policy` Compensate and no idempotency key, so a Failed attempt is never retried although the definition declares a fixed budget of 2 attempts. Its own compensation runs only after its effect is confirmed (D133), so a Failed attempt, whose proposal was never confirmed, withdraws nothing: the step fails, `CompensationStarted` finds no confirmed effect to compensate and the run ends Failed. An Uncertain attempt goes to an operator decision of the project (D119). Kind: behavior. Traces: workflows: project-bootstrap; steps: project-bootstrap/approve-shared-write, project-bootstrap/apply-bootstrap; tools: propose-change-set; services: WorkflowEngineService, RunControlService, ToolAdapterService, PipelineExecutionService; aggregates: RunControlService/ApprovalRequest; apis: PipelineExecutionService/Pipelines.RecordProposal; events: WorkflowEngineService/StepReady, WorkflowEngineService/CompensationStarted, WorkflowEngineService/WorkflowRunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, RunControlService/RunFailed, ToolAdapterService/ToolEffectUncertain; descriptors: change-set-v1, pull-request-proposal-v1, change-proposal-record-v1, approval-request-v1; scenarios: SCN-project-bootstrap-003, SCN-project-bootstrap-004; adrs: ADR-0014, ADR-0015; requirements: FR-06, XL-10. Depends on: AIFACTORY-US-1181, feature:workflow-engine-service, feature:run-control-service, feature:tool-adapter-service, feature:integration-service-thin, feature:connector-registry-service-thin, feature:secret-broker-service, feature:pipeline-execution-service-thin. Sources: model/workflows/project-bootstrap.yaml, model/tools/propose-change-set.yaml, model/services/control-plane/RunControlService.yaml, model/scenarios/project-bootstrap.yaml.",
      "acceptanceCriteria": [
        "AC1: Given project-bootstrap/scaffold-resources succeeded in an increment before I4, when project-bootstrap/approve-shared-write becomes ready, then the approval always runs: RunControlService/ApprovalRequested is published for the run and the step with action class shared-write, proposal kind diff, the change-set hash as proposal hash and the approver rule role Reviewer with separation of duties, and the run waits WaitingForApproval (SCN-project-bootstrap-003, ADR-0015, D129, D133).",
        "AC2: Given the pending request, when RunControlService/ApprovalDecided records an approval bound to that hash, then the step completes with one outcome and project-bootstrap/apply-bootstrap becomes ready; when it records a rejection, or the request expires and the on-expiry rule leaves no re-request, then Run Control moves the run from WaitingForApproval to Failed (ApprovalRejectedOrExpired) and publishes RunControlService/RunFailed exactly once; the engine hears RunFailed, moves its projection from WaitingForHuman to Failed and its open step runs to Cancelled, and publishes no WorkflowEngineService/WorkflowRunFailed (D119, D121); nothing is written to the system of record (SCN-project-bootstrap-003).",
        "AC3: Given the approval holds, when `propose-change-set` runs for project-bootstrap/apply-bootstrap, then the pull request is opened through the connection with the credential the Secret Broker issues, the audit record carries repository, branch, changeSetHash and pullRequestRef, the proposal is recorded once through PipelineExecutionService/Pipelines.RecordProposal in PullRequestOpen with the run, the attempt, the agent release, the pull-request reference and the tool receipt, and `bootstrap-change-proposal` (pull-request-proposal-v1) is recorded once under the run envelope (SCN-project-bootstrap-004, D135).",
        "AC4: Given an attempt of project-bootstrap/apply-bootstrap settles Failed or exceeds its timeout PT30M, when Run Control settles the step, then it is not retried because the shared-write step declares no idempotency key, the engine emits WorkflowEngineService/CompensationStarted, no proposal is withdrawn because the effect of the step was never confirmed, and the run ends Failed with WorkflowEngineService/WorkflowRunFailed naming `apply-bootstrap`; given the attempt settles Uncertain, then ToolAdapterService/ToolEffectUncertain is emitted and the step waits for an operator decision (SCN-project-bootstrap-004, ADR-0014, D133)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml",
        "model/tools/propose-change-set.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4723",
        "AIFACTORY-TASK-316",
        "AIFACTORY-TASK-4724"
      ],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10203,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "project-bootstrap"
        ],
        "steps": [
          "project-bootstrap/approve-shared-write",
          "project-bootstrap/apply-bootstrap"
        ],
        "tools": [
          "propose-change-set"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "ToolAdapterService",
          "PipelineExecutionService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest"
        ],
        "apis": [
          "PipelineExecutionService/Pipelines.RecordProposal"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/CompensationStarted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunFailed",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "change-set-v1",
          "pull-request-proposal-v1",
          "change-proposal-record-v1",
          "approval-request-v1"
        ],
        "scenarios": [
          "SCN-project-bootstrap-003",
          "SCN-project-bootstrap-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-06",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1181",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:tool-adapter-service",
        "feature:integration-service-thin",
        "feature:connector-registry-service-thin",
        "feature:secret-broker-service",
        "feature:pipeline-execution-service-thin"
      ],
      "source": [
        "model/workflows/project-bootstrap.yaml",
        "model/tools/propose-change-set.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/scenarios/project-bootstrap.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1182]",
      "number": 1182
    },
    {
      "id": "AIFACTORY-TASK-4723",
      "type": "task",
      "parent": "AIFACTORY-US-1182",
      "title": "Bind the approval block and the compensation of the bootstrap steps in the Draft release",
      "sequence": "19.07.03.01",
      "description": "Bind the approval block and the compensation of the bootstrap steps in the Draft release. Expected output: The human step approve-shared-write carries action class shared-write, proposal kind diff, proposal from steps.scaffold-resources.change-set, the approver rule, the stale rule and the policy guard that applies from I4, apply-bootstrap carries failure policy Compensate with its compensation, and record-trace carries failure policy Compensate, exactly as model/workflows/project-bootstrap.yaml declares.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The human step approve-shared-write carries action class shared-write, proposal kind diff, proposal from steps.scaffold-resources.change-set, the approver rule, the stale rule and the policy guard that applies from I4, apply-bootstrap carries failure policy Compensate with its compensation, and record-trace carries failure policy Compensate, exactly as model/workflows/project-bootstrap.yaml declares."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10203,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4723]",
      "number": 4723
    },
    {
      "id": "AIFACTORY-TASK-316",
      "type": "task",
      "parent": "AIFACTORY-US-1182",
      "title": "Approved apply through the connector with receipts",
      "sequence": "19.07.03.02",
      "description": "Approved apply through the connector with receipts. Expected output: The propose-change-set invocation of apply-bootstrap runs only after the approval bound to the change-set hash, writes the audit fields of model/tools/propose-change-set.yaml, records the proposal once through Pipelines.RecordProposal in PullRequestOpen and yields one bootstrap-change-proposal per run; a rejected or expired approval writes nothing (SCN-project-bootstrap-003, SCN-project-bootstrap-004).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "The propose-change-set invocation of apply-bootstrap runs only after the approval bound to the change-set hash, writes the audit fields of model/tools/propose-change-set.yaml, records the proposal once through Pipelines.RecordProposal in PullRequestOpen and yields one bootstrap-change-proposal per run; a rejected or expired approval writes nothing (SCN-project-bootstrap-003, SCN-project-bootstrap-004)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-316]",
      "number": 316
    },
    {
      "id": "AIFACTORY-TASK-4724",
      "type": "task",
      "parent": "AIFACTORY-US-1182",
      "title": "Prove the approval and the apply paths on the fixture",
      "sequence": "19.07.03.03",
      "description": "Prove the approval and the apply paths on the fixture. Expected output: A fixture run proves SCN-project-bootstrap-003 and SCN-project-bootstrap-004 (AC1 to AC4 of AIFACTORY-US-1182) with an approving decision, a rejecting and an expiring decision that end in RunFailed without WorkflowRunFailed, a stale request after a regenerated change set, a Failed apply that is not retried and withdraws nothing, and an Uncertain apply that waits for an operator decision.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-project-bootstrap-003 and SCN-project-bootstrap-004 (AC1 to AC4 of AIFACTORY-US-1182) with an approving decision, a rejecting and an expiring decision that end in RunFailed without WorkflowRunFailed, a stale request after a regenerated change set, a Failed apply that is not retried and withdraws nothing, and an Uncertain apply that waits for an operator decision."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4724]",
      "number": 4724
    },
    {
      "id": "AIFACTORY-US-1183",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-113",
      "title": "The DevOps Engineer verifies the opened proposal and records the trace scaffolding of the project",
      "sequence": "19.07.04",
      "description": "As a workspace administrator, I want the result of the bootstrap verified and recorded as trace scaffolding with its receipts, so that every later run of the project can trace its work back to the resources the bootstrap created. The last agent step of `project-bootstrap`. When `apply-bootstrap` succeeded the engine marks `record-trace` ready and resolves `project` from `input.project` and `bootstrap-change-proposal` from `steps.apply-bootstrap.bootstrap-change-proposal`. The `devops-engineer` release runs the skill `devops-engineer-record-trace` in read class with read tools only: it compares the opened proposal with the resources the project needs and writes `trace-scaffolding` (artifact-v1), the trace scaffolding of the project with the receipts of the apply, recorded once under the run envelope. The run then completes with `bootstrap-change-proposal` and `trace-scaffolding` as its outputs and Run Control records one Completed outcome. The step changes nothing in the system of record and requests no approval. It is read class and follows the effect of `apply-bootstrap`, so it declares `failure_policy` Compensate (D133): a Failed attempt of failure class transient is retried under the declared exponential budget of 3 attempts with backoff 30s, and an attempt that exceeds its timeout PT30M, fails with any other failure class or spends the budget fails the step. The engine then moves the run to Compensating (StepFailedWithCompensatePolicy) and emits `CompensationStarted`; the compensation of the confirmed `apply-bootstrap` runs, which withdraws the proposal and records the partial creation as a finding, and `WorkflowRunFailed` names `record-trace` with compensated true. No operation withdraws a recorded proposal, so the withdrawal itself is reported as an open question and this PBI asserts that the compensation is started for the confirmed apply and that the finding of the partial creation is recorded. Kind: behavior. Traces: workflows: project-bootstrap; steps: project-bootstrap/record-trace, project-bootstrap/apply-bootstrap; agents: devops-engineer; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, WorkflowEngineService/CompensationStarted; descriptors: artifact-v1, pull-request-proposal-v1; scenarios: SCN-project-bootstrap-005; adrs: ADR-0014; requirements: FR-08, XL-01. Depends on: AIFACTORY-US-1182, feature:artifact-service, feature:agent-runtime-service, feature:workflow-engine-service. Sources: model/workflows/project-bootstrap.yaml, model/skills/devops-delivery/devops-engineer-record-trace.yaml, model/scenarios/project-bootstrap.yaml.",
      "acceptanceCriteria": [
        "AC1: Given project-bootstrap/apply-bootstrap succeeded, when the engine marks project-bootstrap/record-trace ready, then `project` and `bootstrap-change-proposal` are resolved from the mappings of model/workflows/project-bootstrap.yaml and `devops-engineer` executes the step on its pinned release (SCN-project-bootstrap-005).",
        "AC2: Given the step runs, when it returns `trace-scaffolding`, then the output is recorded once under the run envelope with the producer run, attempt and agent and the run completes with WorkflowEngineService/WorkflowRunCompleted once (SCN-project-bootstrap-005, ADR-0014).",
        "AC3: Given an attempt exceeds its timeout PT30M, settles Failed with a non-transient failure class, or spends the exponential budget of 3 attempts, when Run Control settles the step Failed, then the engine emits WorkflowEngineService/CompensationStarted, the compensation of the confirmed project-bootstrap/apply-bootstrap runs and records the partial creation as a finding, and WorkflowEngineService/WorkflowRunFailed names record-trace with compensated true (StepFailedWithCompensatePolicy, SCN-project-bootstrap-005, D133)."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml",
        "model/skills/devops-delivery/devops-engineer-record-trace.yaml",
        "model/scenarios/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4725",
        "AIFACTORY-TASK-4726",
        "AIFACTORY-TASK-4727"
      ],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10204,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "project-bootstrap"
        ],
        "steps": [
          "project-bootstrap/record-trace",
          "project-bootstrap/apply-bootstrap"
        ],
        "agents": [
          "devops-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "WorkflowEngineService/CompensationStarted"
        ],
        "descriptors": [
          "artifact-v1",
          "pull-request-proposal-v1"
        ],
        "scenarios": [
          "SCN-project-bootstrap-005"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "XL-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1182",
        "feature:artifact-service",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/project-bootstrap.yaml",
        "model/skills/devops-delivery/devops-engineer-record-trace.yaml",
        "model/scenarios/project-bootstrap.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1183]",
      "number": 1183
    },
    {
      "id": "AIFACTORY-TASK-4725",
      "type": "task",
      "parent": "AIFACTORY-US-1183",
      "title": "Bind the record-trace skill and map the run outputs",
      "sequence": "19.07.04.01",
      "description": "Bind the record-trace skill and map the run outputs. Expected output: The step record-trace of the Draft release runs devops-engineer-record-trace with project and bootstrap-change-proposal mapped as in model/workflows/project-bootstrap.yaml, and the run outputs bootstrap-change-proposal and trace-scaffolding are set from the recorded step outputs.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step record-trace of the Draft release runs devops-engineer-record-trace with project and bootstrap-change-proposal mapped as in model/workflows/project-bootstrap.yaml, and the run outputs bootstrap-change-proposal and trace-scaffolding are set from the recorded step outputs."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10204,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4725]",
      "number": 4725
    },
    {
      "id": "AIFACTORY-TASK-4726",
      "type": "task",
      "parent": "AIFACTORY-US-1183",
      "title": "Fixture expected trace scaffolding with its receipts",
      "sequence": "19.07.04.02",
      "description": "Fixture expected trace scaffolding with its receipts. Expected output: The expected trace-scaffolding artifact (artifact-v1) of the fixture run with its producer run and the receipts of the apply recorded once, and a failing verification with the expected compensation of the apply and its finding, as the oracle of SCN-project-bootstrap-005.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected trace-scaffolding artifact (artifact-v1) of the fixture run with its producer run and the receipts of the apply recorded once, and a failing verification with the expected compensation of the apply and its finding, as the oracle of SCN-project-bootstrap-005."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10204,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4726]",
      "number": 4726
    },
    {
      "id": "AIFACTORY-TASK-4727",
      "type": "task",
      "parent": "AIFACTORY-US-1183",
      "title": "Prove the record step, the run completion and the compensation of the apply",
      "sequence": "19.07.04.03",
      "description": "Prove the record step, the run completion and the compensation of the apply. Expected output: A fixture run proves SCN-project-bootstrap-005 (AC1 to AC3 of AIFACTORY-US-1183); trace-scaffolding recorded once, WorkflowRunCompleted and RunCompleted exactly once, and a timeout path that emits CompensationStarted, runs the compensation of apply-bootstrap with its finding of the partial creation and ends the run Failed with WorkflowRunFailed naming record-trace with compensated true.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-project-bootstrap-005 (AC1 to AC3 of AIFACTORY-US-1183); trace-scaffolding recorded once, WorkflowRunCompleted and RunCompleted exactly once, and a timeout path that emits CompensationStarted, runs the compensation of apply-bootstrap with its finding of the partial creation and ends the run Failed with WorkflowRunFailed naming record-trace with compensated true."
      ],
      "sourceArtifacts": [
        "model/workflows/project-bootstrap.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 102,
      "phase": "factory",
      "stackRank": 10204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4727]",
      "number": 4727
    },
    {
      "id": "AIFACTORY-FEAT-114",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Delivery run",
      "sequence": "19.08",
      "description": "The workflow definition delivery-run as a published asset: Evaluates a completed pipeline run's typed results, prepares the release manifest and requests the promotion; a production promotion waits for its approval. Deployment is a promotion, never a pipeline stage. It has 5 steps, names the agents deployment-orchestrator, devops-engineer, release-manager and the tools none, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I2: Deliver it. Build order 103 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-077",
        "AIFACTORY-US-1184",
        "AIFACTORY-US-1185",
        "AIFACTORY-US-1186"
      ],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10300,
      "titlePrefix": "[AIFACTORY-FEAT-114]",
      "number": 114
    },
    {
      "id": "AIFACTORY-US-077",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-114",
      "title": "The Delivery run workflow runs from its published definition",
      "sequence": "19.08.01",
      "description": "As an operator, I want the delivery run workflow to run from its published definition with the agents, tools and gates it declares, so that release manifests are produced the same way on every run, with evidence. The integration PBI of the definition `delivery-run`. When PipelineExecutionService publishes `PipelineRunCompleted` in state Succeeded or PartiallySucceeded, WorkflowEngineService satisfies the required readiness member `pipeline-results` (artifact-v1, hashed on the commit) of the project scope, and the optional member `pipeline-blueprint` when a validated Pipeline Blueprint exists; it submits the run itself through `SubmitRun` of RunControlService with a service token that names the project and the bundle idempotency key (D131), so a repeated completion of the same pipeline run returns the existing run and a newer member version supersedes the open correlation. Run Control accepts the run and publishes `RunAccepted`; the engine loads the Published release the run pinned through AgentRegistryService and marks the five steps ready in the declared order: `evaluate-results`, `gates-passed`, `prepare-release`, `request-promotion` and `approve-production`, with the agents `devops-engineer`, `release-manager` and `deployment-orchestrator` on their pinned releases. Deployment is a promotion and never a pipeline stage. Every step records exactly one outcome, the run reports exactly one outcome to Run Control (ADR-0014) and stays within the declared budget. Before any run, the definition release and the agent releases of its three agents, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release, no evaluation verdict is required before I4, and the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1184 to AIFACTORY-US-1186; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: delivery-run; steps: delivery-run/evaluate-results, delivery-run/gates-passed, delivery-run/prepare-release, delivery-run/request-promotion, delivery-run/approve-production; agents: deployment-orchestrator, devops-engineer, release-manager; services: WorkflowEngineService, RunControlService, AgentRegistryService, PipelineExecutionService; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, PipelineExecutionService/PipelineRunCompleted, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, release-manifest-v1; adrs: ADR-0014, ADR-0017, ADR-0024, ADR-0027; requirements: FR-05, FR-06, FUX-05, XL-10, XL-11. Depends on: AIFACTORY-US-1184, AIFACTORY-US-1185, AIFACTORY-US-1186, feature:pipeline-execution-service-complete, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:agent-registry-service-publication. Sources: model/workflows/delivery-run.yaml, docs/planes/agent-runtime/workflow-definitions/delivery-run.md.",
      "acceptanceCriteria": [
        "AC1: Given PipelineExecutionService/PipelineRunCompleted is published in state Succeeded or PartiallySucceeded for a project of the trusted tenant, when the readiness member `pipeline-results` is satisfied, then WorkflowEngineService/ReadinessRunSubmitted is emitted once, the run is submitted through RunControlService/SubmitRun with a service token naming the project (D131) and a repeated completion of the same pipeline run returns the existing run.",
        "AC2: Given the Published release of `delivery-run`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter (D140), with its 5 steps, input mappings, retry policies, timeouts, the `idempotency_key` of request-promotion and the `when` guard of approve-production exactly as in model/workflows/delivery-run.yaml, when RunControlService/RunAccepted arrives for a run that pinned it, then WorkflowEngineService/WorkflowRunStarted is emitted and delivery-run/evaluate-results, delivery-run/gates-passed, delivery-run/prepare-release, delivery-run/request-promotion and delivery-run/approve-production become ready in that order, each agent step on the pinned Published release of its agent, and no Draft release is loaded.",
        "AC3: Given every step succeeds or the approval step is skipped by its guard, when the run completes, then `release-manifest` (release-manifest-v1) is the run output under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC4: Given the gate condition fails or a step spends its retry budget, when the engine applies the failure policy of that step, then WorkflowEngineService/WorkflowRunFailed names the step, RunControlService/RunFailed is published exactly once and no deployment runs outside a promotion (ADR-0017); given the promotion gate the production approval waits on is rejected or expires with no re-request left, then WorkflowEngineService/WorkflowRunFailed names `approve-production` and RunControlService/RunFailed is published exactly once (D121, D133).",
        "AC5: Given the recorded fixture inputs of model/workflows/delivery-run.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml",
        "docs/planes/agent-runtime/workflow-definitions/delivery-run.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-272",
        "AIFACTORY-TASK-273",
        "AIFACTORY-TASK-274",
        "AIFACTORY-TASK-726"
      ],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10301,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "delivery-run"
        ],
        "steps": [
          "delivery-run/evaluate-results",
          "delivery-run/gates-passed",
          "delivery-run/prepare-release",
          "delivery-run/request-promotion",
          "delivery-run/approve-production"
        ],
        "agents": [
          "deployment-orchestrator",
          "devops-engineer",
          "release-manager"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "PipelineExecutionService"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "PipelineExecutionService/PipelineRunCompleted",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "release-manifest-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0017",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "FUX-05",
          "XL-10",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1184",
        "AIFACTORY-US-1185",
        "AIFACTORY-US-1186",
        "feature:pipeline-execution-service-complete",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/delivery-run.yaml",
        "docs/planes/agent-runtime/workflow-definitions/delivery-run.md"
      ],
      "titlePrefix": "[AIFACTORY-US-077]",
      "number": 77
    },
    {
      "id": "AIFACTORY-TASK-272",
      "type": "task",
      "parent": "AIFACTORY-US-077",
      "title": "Author, submit and publish the release of the workflow definition delivery-run with its agent releases",
      "sequence": "19.08.01.01",
      "description": "Author, submit and publish the release of the workflow definition delivery-run with its agent releases. Expected output: The release of delivery-run (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy of each agent and human step, the idempotency_key releaseId + targetEnvironment of request-promotion and the when guard of approve-production exactly as in model/workflows/delivery-run.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases deployment-orchestrator, devops-engineer and release-manager of AIFACTORY-TASK-273 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of delivery-run (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy of each agent and human step, the idempotency_key releaseId + targetEnvironment of request-promotion and the when guard of approve-production exactly as in model/workflows/delivery-run.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases deployment-orchestrator, devops-engineer and release-manager of AIFACTORY-TASK-273 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-272]",
      "number": 272
    },
    {
      "id": "AIFACTORY-TASK-273",
      "type": "task",
      "parent": "AIFACTORY-US-077",
      "title": "Author the agent releases deployment-orchestrator, devops-engineer, release-manager with their prompts and skills",
      "sequence": "19.08.01.02",
      "description": "Author the agent releases deployment-orchestrator, devops-engineer, release-manager with their prompts and skills. Expected output: Draft releases of deployment-orchestrator, devops-engineer and release-manager with their instructions, the skills devops-engineer-evaluate-results, release-manager-prepare-release and deployment-orchestrator-request-promotion among their bound skills, tool bindings and model profiles of model/agents/devops-delivery/; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-272, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of deployment-orchestrator, devops-engineer and release-manager with their instructions, the skills devops-engineer-evaluate-results, release-manager-prepare-release and deployment-orchestrator-request-promotion among their bound skills, tool bindings and model profiles of model/agents/devops-delivery/; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-272, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10301,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-273]",
      "number": 273
    },
    {
      "id": "AIFACTORY-TASK-274",
      "type": "task",
      "parent": "AIFACTORY-US-077",
      "title": "Fixture run of delivery-run against recorded inputs",
      "sequence": "19.08.01.03",
      "description": "Fixture run of delivery-run against recorded inputs. Expected output: The definition runs end to end on a fixture pipeline run in the acceptance environment from PipelineRunCompleted to RunCompleted on the Published releases of AIFACTORY-TASK-272; every step output validates against its descriptor and release-manifest matches the recorded one field by field (AC1 to AC3 and AC5 of AIFACTORY-US-077).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture pipeline run in the acceptance environment from PipelineRunCompleted to RunCompleted on the Published releases of AIFACTORY-TASK-272; every step output validates against its descriptor and release-manifest matches the recorded one field by field (AC1 to AC3 and AC5 of AIFACTORY-US-077)."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-274]",
      "number": 274
    },
    {
      "id": "AIFACTORY-TASK-726",
      "type": "task",
      "parent": "AIFACTORY-US-077",
      "title": "Verify delivery-run-runs-from-its-definition by running the declared command",
      "sequence": "19.08.01.04",
      "description": "Verify delivery-run-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-077, including both failure paths of AC4 (WorkflowRunFailed then RunFailed exactly once for a failed gate or step, and for a rejected or expired promotion gate the production approval waits on); the output names the Published release ids of delivery-run, deployment-orchestrator, devops-engineer and release-manager that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-077, including both failure paths of AC4 (WorkflowRunFailed then RunFailed exactly once for a failed gate or step, and for a rejected or expired promotion gate the production approval waits on); the output names the Published release ids of delivery-run, deployment-orchestrator, devops-engineer and release-manager that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-726]",
      "number": 726
    },
    {
      "id": "AIFACTORY-US-1184",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-114",
      "title": "The DevOps Engineer evaluates the typed pipeline results and the run stops on any blocking failure",
      "sequence": "19.08.02",
      "description": "As an operator, I want the typed results of a completed pipeline run evaluated and the run stopped when a blocking failure exists, so that no release manifest is prepared for a build whose tests, scans or quality gates block it. The first agent step and the gate condition of `delivery-run`. When the engine marks `evaluate-results` ready it resolves `pipeline-results` from `input.pipeline-results` (artifact-v1) and `pipeline-blueprint` from `input.pipeline-blueprint` (blueprint-pipeline-v1, optional); the `devops-engineer` release runs the skill `devops-engineer-evaluate-results` in read class with read tools only. It reads tests, scans and quality gates as typed results, names each blocking failure and writes `evaluation` (artifact-v1) with the field `blocking`, the count of blocking failures. The step declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, any other failure class is not retried and a step that exceeds its timeout PT30M or spends the budget fails the run. When `gates-passed` becomes ready the engine evaluates `steps.evaluate-results.evaluation.blocking == 0` over the recorded output without calling any service; the condition never retries and completes within PT1M. When it holds the step completes with one outcome and `prepare-release` becomes ready. When it does not hold the definition declares no branch, so the engine fails the run with the evaluation as its evidence: `WorkflowRunFailed` names `gates-passed`, no manifest is prepared and no promotion is requested. A missing or unreadable evaluation fails the condition with evidence instead of being read as passed. Kind: behavior. Traces: workflows: delivery-run; steps: delivery-run/evaluate-results, delivery-run/gates-passed; agents: devops-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/StepSettled; descriptors: artifact-v1, blueprint-pipeline-v1; scenarios: SCN-delivery-run-001, SCN-delivery-run-002; adrs: ADR-0014; requirements: FR-05, XL-10. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/delivery-run.yaml, model/skills/devops-delivery/devops-engineer-evaluate-results.yaml, model/scenarios/delivery-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `pipeline-results` and an optional `pipeline-blueprint`, when `devops-engineer` executes delivery-run/evaluate-results, then `evaluation` (artifact-v1) is recorded once under the run envelope with the count `blocking` and every blocking failure named by its typed result (SCN-delivery-run-001).",
        "AC2: Given an attempt of delivery-run/evaluate-results settles Failed with failure class transient until the exponential budget of 3 attempts is spent, settles Failed with any other failure class, or exceeds its timeout PT30M, when Run Control settles the step through RunControlService/StepSettled, then the engine reports WorkflowEngineService/WorkflowRunFailed naming the step and no shared system is changed (SCN-delivery-run-001).",
        "AC3: Given the recorded evaluation has `blocking` 0, when the engine evaluates delivery-run/gates-passed, then the condition completes with one outcome, no service is called and delivery-run/prepare-release becomes ready (SCN-delivery-run-002).",
        "AC4: Given the recorded evaluation has `blocking` above 0, or the evaluation is missing or unreadable, or the evaluation exceeds PT1M, when the engine evaluates delivery-run/gates-passed, then the condition is not retried, WorkflowEngineService/WorkflowRunFailed names `gates-passed` with the evaluation as evidence and no release manifest or promotion request exists for the run (SCN-delivery-run-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml",
        "model/skills/devops-delivery/devops-engineer-evaluate-results.yaml",
        "model/scenarios/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4728",
        "AIFACTORY-TASK-4729",
        "AIFACTORY-TASK-4730"
      ],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10302,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "delivery-run"
        ],
        "steps": [
          "delivery-run/evaluate-results",
          "delivery-run/gates-passed"
        ],
        "agents": [
          "devops-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/StepSettled"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-pipeline-v1"
        ],
        "scenarios": [
          "SCN-delivery-run-001",
          "SCN-delivery-run-002"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-05",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/delivery-run.yaml",
        "model/skills/devops-delivery/devops-engineer-evaluate-results.yaml",
        "model/scenarios/delivery-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1184]",
      "number": 1184
    },
    {
      "id": "AIFACTORY-TASK-4728",
      "type": "task",
      "parent": "AIFACTORY-US-1184",
      "title": "Bind the evaluate-results skill and the blocking count of its output",
      "sequence": "19.08.02.01",
      "description": "Bind the evaluate-results skill and the blocking count of its output. Expected output: The step evaluate-results of the Draft release runs devops-engineer-evaluate-results with pipeline-results and pipeline-blueprint mapped as in model/workflows/delivery-run.yaml and returns evaluation with the field blocking that the condition gates-passed reads.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step evaluate-results of the Draft release runs devops-engineer-evaluate-results with pipeline-results and pipeline-blueprint mapped as in model/workflows/delivery-run.yaml and returns evaluation with the field blocking that the condition gates-passed reads."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10302,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4728]",
      "number": 4728
    },
    {
      "id": "AIFACTORY-TASK-4729",
      "type": "task",
      "parent": "AIFACTORY-US-1184",
      "title": "Fixture pipeline results with and without blocking failures",
      "sequence": "19.08.02.02",
      "description": "Fixture pipeline results with and without blocking failures. Expected output: Two recorded pipeline results, one with every test, scan and quality gate passing and one with a blocking scan finding, each with the expected evaluation and blocking count, as the oracle of SCN-delivery-run-001 and SCN-delivery-run-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Two recorded pipeline results, one with every test, scan and quality gate passing and one with a blocking scan finding, each with the expected evaluation and blocking count, as the oracle of SCN-delivery-run-001 and SCN-delivery-run-002."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10302,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4729]",
      "number": 4729
    },
    {
      "id": "AIFACTORY-TASK-4730",
      "type": "task",
      "parent": "AIFACTORY-US-1184",
      "title": "Prove the evaluation and the gate condition on the fixture",
      "sequence": "19.08.02.03",
      "description": "Prove the evaluation and the gate condition on the fixture. Expected output: A fixture run proves SCN-delivery-run-001 and SCN-delivery-run-002 (AC1 to AC4 of AIFACTORY-US-1184); the passing results reach prepare-release, the blocking results fail the run at gates-passed with the evaluation as evidence, and the retry exhaustion of evaluate-results ends in WorkflowRunFailed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-delivery-run-001 and SCN-delivery-run-002 (AC1 to AC4 of AIFACTORY-US-1184); the passing results reach prepare-release, the blocking results fail the run at gates-passed with the evaluation as evidence, and the retry exhaustion of evaluate-results ends in WorkflowRunFailed."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4730]",
      "number": 4730
    },
    {
      "id": "AIFACTORY-US-1185",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-114",
      "title": "The Release Manager assembles the release manifest with its bill of materials and attestations",
      "sequence": "19.08.03",
      "description": "As an operator, I want a release manifest assembled from the evaluated pipeline results with the bill of materials and the attestations, so that the promotion request and the production decision refer to one exact release version. The release preparation step of `delivery-run`. When `gates-passed` held, the engine marks `prepare-release` ready and resolves `pipeline-results` from `input.pipeline-results` and `evaluation` from `steps.evaluate-results.evaluation`. The `release-manager` release runs the skill `release-manager-prepare-release` in sandbox class with the tools `knowledge-search`, `read-range` and `write-file`: it assembles the release manifest of the build with its software bill of materials, its attestations and the evaluation it rests on, writes it in the isolated workspace and returns `release-manifest` (release-manifest-v1) as its step output, which is also the output of the run. This PBI delivers that step output and requests no approval. The definition names ReleaseService and emits `ReleaseReady`, but the bound skill holds no tool that reaches `CreateProductRelease` of ReleaseService; this is reported as an open question, and whether a product release record exists after this step is not asserted here. The step declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, an attempt of any other failure class is not retried, and a step that exceeds its timeout PT30M or spends its budget fails the run with the evidence, the workspace output staying in place and no shared system changed. Kind: behavior. Traces: workflows: delivery-run; steps: delivery-run/prepare-release; agents: release-manager; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunFailed; descriptors: release-manifest-v1, artifact-v1; scenarios: SCN-delivery-run-003; adrs: ADR-0014; requirements: FR-06, XL-11. Depends on: AIFACTORY-US-1184, feature:workflow-engine-service. Sources: model/workflows/delivery-run.yaml, model/skills/devops-delivery/release-manager-prepare-release.yaml, model/scenarios/delivery-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given delivery-run/gates-passed held, when the engine marks delivery-run/prepare-release ready, then `pipeline-results` and `evaluation` are resolved from the mappings of model/workflows/delivery-run.yaml and `release-manager` executes the step on its pinned release (SCN-delivery-run-003).",
        "AC2: Given the step runs, when it returns `release-manifest`, then the output validates against release-manifest-v1, carries the bill of materials, the attestations and the reference of the evaluation, is recorded once under the run envelope and delivery-run/request-promotion becomes ready with it mapped as `release` (SCN-delivery-run-003).",
        "AC3: Given an attempt exceeds its timeout PT30M, settles Failed with a non-transient failure class, or spends the exponential budget of 3 attempts, when Run Control settles the step, then WorkflowEngineService/WorkflowRunFailed names the step, no promotion is requested and no shared system is changed (SCN-delivery-run-003, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml",
        "model/skills/devops-delivery/release-manager-prepare-release.yaml",
        "model/scenarios/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4731",
        "AIFACTORY-TASK-4732",
        "AIFACTORY-TASK-4733"
      ],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10303,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "delivery-run"
        ],
        "steps": [
          "delivery-run/prepare-release"
        ],
        "agents": [
          "release-manager"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "release-manifest-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-delivery-run-003"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-06",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1184",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/delivery-run.yaml",
        "model/skills/devops-delivery/release-manager-prepare-release.yaml",
        "model/scenarios/delivery-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1185]",
      "number": 1185
    },
    {
      "id": "AIFACTORY-TASK-4731",
      "type": "task",
      "parent": "AIFACTORY-US-1185",
      "title": "Bind the prepare-release skill and map the run output",
      "sequence": "19.08.03.01",
      "description": "Bind the prepare-release skill and map the run output. Expected output: The step prepare-release of the Draft release runs release-manager-prepare-release with pipeline-results and evaluation mapped as in model/workflows/delivery-run.yaml and returns release-manifest (release-manifest-v1), which is set as the run output.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step prepare-release of the Draft release runs release-manager-prepare-release with pipeline-results and evaluation mapped as in model/workflows/delivery-run.yaml and returns release-manifest (release-manifest-v1), which is set as the run output."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10303,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4731]",
      "number": 4731
    },
    {
      "id": "AIFACTORY-TASK-4732",
      "type": "task",
      "parent": "AIFACTORY-US-1185",
      "title": "Fixture expected release manifest",
      "sequence": "19.08.03.02",
      "description": "Fixture expected release manifest. Expected output: The expected release-manifest of the fixture build with its bill of materials, attestations and evaluation reference, as the oracle of SCN-delivery-run-003.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected release-manifest of the fixture build with its bill of materials, attestations and evaluation reference, as the oracle of SCN-delivery-run-003."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10303,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4732]",
      "number": 4732
    },
    {
      "id": "AIFACTORY-TASK-4733",
      "type": "task",
      "parent": "AIFACTORY-US-1185",
      "title": "Prove the release preparation step on the fixture",
      "sequence": "19.08.03.03",
      "description": "Prove the release preparation step on the fixture. Expected output: A fixture run proves SCN-delivery-run-003 (AC1 to AC3 of AIFACTORY-US-1185); the manifest validates against release-manifest-v1 and is recorded once, and the timeout path ends in WorkflowRunFailed with no promotion requested.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-delivery-run-003 (AC1 to AC3 of AIFACTORY-US-1185); the manifest validates against release-manifest-v1 and is recorded once, and the timeout path ends in WorkflowRunFailed with no promotion requested."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4733]",
      "number": 4733
    },
    {
      "id": "AIFACTORY-US-1186",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-114",
      "title": "The Deployment Orchestrator requests the promotion and a production target waits for its approval",
      "sequence": "19.08.04",
      "description": "As a reviewer of the project, I want a promotion into production to wait for my decision on the exact release version, while lower environments proceed without me, so that production changes only on a decision that someone other than the requester took. The promotion request and the production approval of `delivery-run`. When `prepare-release` succeeded the engine marks `request-promotion` ready and resolves `release` from `steps.prepare-release.release-manifest`. The `deployment-orchestrator` release runs the skill `deployment-orchestrator-request-promotion` in shared-write class and requests the promotion of the release to the next environment through EnvironmentPromotionService with the tool `deploy-environment`, then returns `promotion-request` (artifact-v1) with the target environment and the flag `isProduction`. The step declares `failure_policy` Retry with `idempotency_key` releaseId + targetEnvironment, so a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts and never creates a second promotion (D114); an Uncertain attempt is never retried automatically and goes to an operator decision of the project (D119). `approve-production` carries the guard `steps.request-promotion.promotion-request.isProduction == true`: for a lower environment the engine records it Skipped and the run completes (ADR-0027). For production a person gives one production approval: the approval gate of the promotion that `request-promotion` opened, bound to the release id and the production environment (D133). The engine opens no approval of its own; the step declares `waits_on` that gate, which requests the approval through `RequestApproval` of RunControlService with the service identity of EnvironmentPromotionService, the subject kind promotion and the promotion id as subject id, of action class production, with the approver rule role Reviewer in project scope, where the requester never decides (ADR-0015, D18, D135). An approving `ApprovalDecided` that names the gate for that release id and environment completes the step; a rejection, an expiry the on-expiry rule does not re-request, or the timeout P7D ends the promotion Rejected and fails the step under `failure_policy` Fail, so the engine reports `WorkflowRunFailed` naming `approve-production` and Run Control publishes `RunFailed` once (D121). A promotion that EnvironmentPromotionService refuses or ends Rejected at a gate other than the approval, because the release is not Ready there or a gate fails, fails `request-promotion` with failure class permanent and is not retried; a request without a strategy is refused with 422 (D135). `deploy-environment` is production class inside a shared-write step; whether that class mismatch is allowed is reported as an open question, so AC1 asserts the promotion request for a non-production target and AC4 the gate a production request opens. Kind: behavior. Traces: workflows: delivery-run; steps: delivery-run/request-promotion, delivery-run/approve-production; agents: deployment-orchestrator; services: WorkflowEngineService, RunControlService, EnvironmentPromotionService; aggregates: RunControlService/ApprovalRequest, EnvironmentPromotionService/Promotion; apis: EnvironmentPromotionService/Promotions.Request; events: EnvironmentPromotionService/PromotionRequested, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, RunControlService/RunFailed, WorkflowEngineService/WorkflowRunFailed; descriptors: release-manifest-v1, artifact-v1, approval-request-v1; scenarios: SCN-delivery-run-004, SCN-delivery-run-005; adrs: ADR-0014, ADR-0015, ADR-0017, ADR-0027; requirements: FR-06, FUX-05, XL-11. Depends on: AIFACTORY-US-1185, feature:environment-promotion-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/delivery-run.yaml, model/skills/devops-delivery/deployment-orchestrator-request-promotion.yaml, model/tools/deploy-environment.yaml, model/services/devops-gitops/EnvironmentPromotionService.yaml, model/scenarios/delivery-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.prepare-release.release-manifest` is recorded and the next environment of the promotion path is a non-production environment, when `deployment-orchestrator` executes delivery-run/request-promotion, then the promotion is requested once through EnvironmentPromotionService/Promotions.Request, EnvironmentPromotionService/PromotionRequested names the run, and `promotion-request` (artifact-v1) with the target environment and `isProduction` is recorded once under the run envelope (SCN-delivery-run-004).",
        "AC2: Given an attempt of delivery-run/request-promotion settles Failed with failure class transient, when Run Control evaluates the step, then it is retried under the exponential budget of 3 attempts because the shared-write step declares `idempotency_key` releaseId + targetEnvironment and no second promotion is created; given it settles Uncertain, then it is not retried and the run waits for an operator decision; given the release is not Ready in ReleaseService or a gate fails, then the promotion is refused or ends Rejected, `promotion-request` records the refusal and the step fails with failure class permanent without a retry; on exhaustion or refusal WorkflowEngineService/WorkflowRunFailed names the step (SCN-delivery-run-004, D114).",
        "AC3: Given `isProduction` is false, when the engine reaches delivery-run/approve-production, then the step is recorded Skipped, no RunControlService/ApprovalRequested is published and the run completes (SCN-delivery-run-005, ADR-0027).",
        "AC4: Given `isProduction` is true, when delivery-run/approve-production becomes ready, then the engine opens no approval request of its own, RunControlService/ApprovalRequested is published only for the promotion gate that request-promotion opened, with the subject kind promotion, action class production, the binding to the release id and the production environment and the approver rule role Reviewer that excludes the requester, and the step waits until RunControlService/ApprovalDecided names that gate (SCN-delivery-run-005, ADR-0015, D133).",
        "AC5: Given the gate is rejected, expires with no re-request left, or the step reaches P7D without a decision, when the outcome is recorded, then the promotion ends Rejected, delivery-run/approve-production fails under `failure_policy` Fail, WorkflowEngineService/WorkflowRunFailed names `approve-production`, RunControlService/RunFailed is published exactly once and nothing is deployed to production (SCN-delivery-run-005, D121, D133)."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml",
        "model/skills/devops-delivery/deployment-orchestrator-request-promotion.yaml",
        "model/tools/deploy-environment.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/scenarios/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4734",
        "AIFACTORY-TASK-4735",
        "AIFACTORY-TASK-4736"
      ],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10304,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "delivery-run"
        ],
        "steps": [
          "delivery-run/request-promotion",
          "delivery-run/approve-production"
        ],
        "agents": [
          "deployment-orchestrator"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "EnvironmentPromotionService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "EnvironmentPromotionService/Promotions.Request"
        ],
        "events": [
          "EnvironmentPromotionService/PromotionRequested",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunFailed",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "release-manifest-v1",
          "artifact-v1",
          "approval-request-v1"
        ],
        "scenarios": [
          "SCN-delivery-run-004",
          "SCN-delivery-run-005"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0017",
          "ADR-0027"
        ],
        "requirements": [
          "FR-06",
          "FUX-05",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1185",
        "feature:environment-promotion-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/delivery-run.yaml",
        "model/skills/devops-delivery/deployment-orchestrator-request-promotion.yaml",
        "model/tools/deploy-environment.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/scenarios/delivery-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1186]",
      "number": 1186
    },
    {
      "id": "AIFACTORY-TASK-4734",
      "type": "task",
      "parent": "AIFACTORY-US-1186",
      "title": "Bind the request-promotion skill, its idempotency key and the guarded approval block",
      "sequence": "19.08.04.01",
      "description": "Bind the request-promotion skill, its idempotency key and the guarded approval block. Expected output: The step request-promotion of the Draft release runs deployment-orchestrator-request-promotion with release mapped from steps.prepare-release.release-manifest and the idempotency_key releaseId + targetEnvironment, and approve-production carries the when guard and waits on the promotion gate of EnvironmentPromotionService with subject kind promotion, bound to the release id and the production environment, opening no approval of its own, exactly as model/workflows/delivery-run.yaml declares.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The step request-promotion of the Draft release runs deployment-orchestrator-request-promotion with release mapped from steps.prepare-release.release-manifest and the idempotency_key releaseId + targetEnvironment, and approve-production carries the when guard and waits on the promotion gate of EnvironmentPromotionService with subject kind promotion, bound to the release id and the production environment, opening no approval of its own, exactly as model/workflows/delivery-run.yaml declares."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10304,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4734]",
      "number": 4734
    },
    {
      "id": "AIFACTORY-TASK-4735",
      "type": "task",
      "parent": "AIFACTORY-US-1186",
      "title": "Fixture promotion requests to a test and a production environment",
      "sequence": "19.08.04.02",
      "description": "Fixture promotion requests to a test and a production environment. Expected output: Two recorded promotion requests, one to a test environment with isProduction false and one to production with isProduction true, with the expected Skipped approval step and the expected ApprovalRequested of the promotion gate bound to the release id and the production environment, plus a request for a release that is not Ready with its expected refusal, as the oracle of SCN-delivery-run-004 and SCN-delivery-run-005.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Two recorded promotion requests, one to a test environment with isProduction false and one to production with isProduction true, with the expected Skipped approval step and the expected ApprovalRequested of the promotion gate bound to the release id and the production environment, plus a request for a release that is not Ready with its expected refusal, as the oracle of SCN-delivery-run-004 and SCN-delivery-run-005."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10304,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4735]",
      "number": 4735
    },
    {
      "id": "AIFACTORY-TASK-4736",
      "type": "task",
      "parent": "AIFACTORY-US-1186",
      "title": "Prove the promotion request and the production approval on the fixture",
      "sequence": "19.08.04.03",
      "description": "Prove the promotion request and the production approval on the fixture. Expected output: A fixture run proves SCN-delivery-run-004 and SCN-delivery-run-005 (AC1 to AC5 of AIFACTORY-US-1186); one promotion per release and target under transient retries, an Uncertain attempt waiting for an operator decision, a refused promotion that fails the step without a retry, the skipped approval for a test target, and the approve path for production with no approval opened by the engine, the requester refused as decider and the reject and expire paths ending in WorkflowRunFailed naming approve-production and RunFailed once.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-delivery-run-004 and SCN-delivery-run-005 (AC1 to AC5 of AIFACTORY-US-1186); one promotion per release and target under transient retries, an Uncertain attempt waiting for an operator decision, a refused promotion that fails the step without a retry, the skipped approval for a test target, and the approve path for production with no approval opened by the engine, the requester refused as decider and the reject and expire paths ending in WorkflowRunFailed naming approve-production and RunFailed once."
      ],
      "sourceArtifacts": [
        "model/workflows/delivery-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 103,
      "phase": "factory",
      "stackRank": 10304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4736]",
      "number": 4736
    },
    {
      "id": "AIFACTORY-FEAT-115",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Preview environment",
      "sequence": "19.09",
      "description": "The workflow definition preview-environment as a published asset: Creates a per-developer preview environment from a change proposal, keeps it for its time to live and tears it down; a later capability of Runtime Cloud exposed as a workflow. It has 5 steps, names the agents devops-engineer, environment-manager and the tools none, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I2: Deliver it. Build order 104 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-027",
        "AIFACTORY-US-1187",
        "AIFACTORY-US-1188",
        "AIFACTORY-US-1189"
      ],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10400,
      "titlePrefix": "[AIFACTORY-FEAT-115]",
      "number": 115
    },
    {
      "id": "AIFACTORY-US-027",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-115",
      "title": "A change proposal gets a preview environment that tears itself down",
      "sequence": "19.09.01",
      "description": "As a requester, I want a preview environment with my proposed change deployed, kept for a limited time, so that I can try the generated service before it is merged, without leaving infrastructure behind. The integration PBI of the definition `preview-environment`. When PipelineExecutionService publishes `ChangeProposalOpened` for a project and BlueprintService has published `BlueprintValidated` for a passed Infrastructure Blueprint of the same project, WorkflowEngineService satisfies the two required readiness members `change-proposal` (pull-request-proposal-v1, hashed on the pull request reference) and `infrastructure-blueprint` (blueprint-infrastructure-v1), and the optional `pipeline-blueprint` when a validated Pipeline Blueprint exists. It submits the run itself through `SubmitRun` of RunControlService with a service token that names the project and the bundle idempotency key (D131): the same proposal version returns the existing run and a new version of a member supersedes the open correlation. Run Control accepts the run and publishes `RunAccepted`; the engine loads the Published release the run pinned through AgentRegistryService and marks the five steps ready in the declared order: `resolve-change`, `approve-preview`, `request-preview`, `time-to-live` and `teardown`, with the agents `environment-manager` and `devops-engineer` on their pinned releases. Every step records exactly one outcome, the run reports exactly one outcome to Run Control (ADR-0014) and stays within the declared budget. Before any run, the definition release and the agent releases of its two agents, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release, no evaluation verdict is required before I4, and the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1187 to AIFACTORY-US-1189; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: preview-environment; steps: preview-environment/resolve-change, preview-environment/approve-preview, preview-environment/request-preview, preview-environment/time-to-live, preview-environment/teardown; agents: environment-manager, devops-engineer; services: WorkflowEngineService, RunControlService, PipelineExecutionService, BlueprintService, AgentRegistryService; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, PipelineExecutionService/ChangeProposalOpened, BlueprintService/BlueprintValidated, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, RunControlService/RunAccepted, RunControlService/RunCompleted; descriptors: workflow-definition-v1, readiness-bundle-v1, pull-request-proposal-v1, blueprint-infrastructure-v1, blueprint-pipeline-v1; adrs: ADR-0014, ADR-0017, ADR-0024, ADR-0027; requirements: FR-09, XL-12. Depends on: AIFACTORY-US-1187, AIFACTORY-US-1188, AIFACTORY-US-1189, feature:pipeline-execution-service-thin, feature:blueprint-service, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:agent-registry-service-publication. Sources: model/workflows/preview-environment.yaml, docs/planes/agent-runtime/workflow-definitions/preview-environment.md.",
      "acceptanceCriteria": [
        "AC1: Given PipelineExecutionService/ChangeProposalOpened for a project and a BlueprintService/BlueprintValidated with kind Infrastructure and passed true for the same project and tenant, when both required members are satisfied, then WorkflowEngineService/ReadinessRunSubmitted is emitted once and the run is submitted through RunControlService/SubmitRun with a service token naming the project (D131); a repeated event for the same proposal version returns the existing run.",
        "AC2: Given a newer version of the proposal or of the Infrastructure Blueprint is announced while a correlation is open, when the readiness bundle is recomputed, then WorkflowEngineService/ReadinessSuperseded is emitted for the open correlation and a new correlation opens with the new fingerprint.",
        "AC3: Given the Published release of `preview-environment`, authored exactly as in model/workflows/preview-environment.yaml, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter (D140), when RunControlService/RunAccepted arrives for a run that pinned it, then WorkflowEngineService/WorkflowRunStarted is emitted and preview-environment/resolve-change, preview-environment/approve-preview, preview-environment/request-preview, preview-environment/time-to-live and preview-environment/teardown become ready in that order, each agent step on the pinned Published release of its agent, and no Draft release is loaded.",
        "AC4: Given every step succeeds, when the teardown completes, then `preview-environment` (artifact-v1) is the run output, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC5: Given the recorded fixture inputs of model/workflows/preview-environment.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml",
        "docs/planes/agent-runtime/workflow-definitions/preview-environment.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-333",
        "AIFACTORY-TASK-275",
        "AIFACTORY-TASK-276",
        "AIFACTORY-TASK-277",
        "AIFACTORY-TASK-734"
      ],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10401,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "preview-environment"
        ],
        "steps": [
          "preview-environment/resolve-change",
          "preview-environment/approve-preview",
          "preview-environment/request-preview",
          "preview-environment/time-to-live",
          "preview-environment/teardown"
        ],
        "agents": [
          "environment-manager",
          "devops-engineer"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "PipelineExecutionService",
          "BlueprintService",
          "AgentRegistryService"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "PipelineExecutionService/ChangeProposalOpened",
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "pull-request-proposal-v1",
          "blueprint-infrastructure-v1",
          "blueprint-pipeline-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0017",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-09",
          "XL-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1187",
        "AIFACTORY-US-1188",
        "AIFACTORY-US-1189",
        "feature:pipeline-execution-service-thin",
        "feature:blueprint-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/preview-environment.yaml",
        "docs/planes/agent-runtime/workflow-definitions/preview-environment.md"
      ],
      "titlePrefix": "[AIFACTORY-US-027]",
      "number": 27
    },
    {
      "id": "AIFACTORY-TASK-333",
      "type": "task",
      "parent": "AIFACTORY-US-027",
      "title": "Readiness start on an open change proposal and a validated Infrastructure Blueprint",
      "sequence": "19.09.01.01",
      "description": "Readiness start on an open change proposal and a validated Infrastructure Blueprint. Expected output: The preview run starts once per proposal version when both required members are satisfied, through SubmitRun with a service token naming the project, and a newer member version supersedes the open correlation (AC1 and AC2 of AIFACTORY-US-027).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The preview run starts once per proposal version when both required members are satisfied, through SubmitRun with a service token naming the project, and a newer member version supersedes the open correlation (AC1 and AC2 of AIFACTORY-US-027)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-333]",
      "number": 333
    },
    {
      "id": "AIFACTORY-TASK-275",
      "type": "task",
      "parent": "AIFACTORY-US-027",
      "title": "Author, submit and publish the release of the workflow definition preview-environment with its agent releases",
      "sequence": "19.09.01.02",
      "description": "Author, submit and publish the release of the workflow definition preview-environment with its agent releases. Expected output: The release of preview-environment (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy of each agent and human step, the compensation of request-preview and the timer and compensation steps exactly as in model/workflows/preview-environment.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases devops-engineer and environment-manager of AIFACTORY-TASK-276 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of preview-environment (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy of each agent and human step, the compensation of request-preview and the timer and compensation steps exactly as in model/workflows/preview-environment.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases devops-engineer and environment-manager of AIFACTORY-TASK-276 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-275]",
      "number": 275
    },
    {
      "id": "AIFACTORY-TASK-276",
      "type": "task",
      "parent": "AIFACTORY-US-027",
      "title": "Author the agent releases devops-engineer, environment-manager with their prompts and skills",
      "sequence": "19.09.01.03",
      "description": "Author the agent releases devops-engineer, environment-manager with their prompts and skills. Expected output: Draft releases of devops-engineer and environment-manager with their instructions, the skills environment-manager-resolve-change and devops-engineer-request-preview among their bound skills, tool bindings and model profiles of model/agents/devops-delivery/; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-275, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of devops-engineer and environment-manager with their instructions, the skills environment-manager-resolve-change and devops-engineer-request-preview among their bound skills, tool bindings and model profiles of model/agents/devops-delivery/; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-275, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10401,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-276]",
      "number": 276
    },
    {
      "id": "AIFACTORY-TASK-277",
      "type": "task",
      "parent": "AIFACTORY-US-027",
      "title": "Fixture run of preview-environment against recorded inputs",
      "sequence": "19.09.01.04",
      "description": "Fixture run of preview-environment against recorded inputs. Expected output: The definition runs end to end on a fixture proposal and Infrastructure Blueprint in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-275; every step output validates against its descriptor (AC3 to AC5 of AIFACTORY-US-027).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture proposal and Infrastructure Blueprint in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-275; every step output validates against its descriptor (AC3 to AC5 of AIFACTORY-US-027)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-277]",
      "number": 277
    },
    {
      "id": "AIFACTORY-TASK-734",
      "type": "task",
      "parent": "AIFACTORY-US-027",
      "title": "Verify preview-environment-lifecycle by running the declared command",
      "sequence": "19.09.01.05",
      "description": "Verify preview-environment-lifecycle by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-027; the output names the Published release ids of preview-environment, devops-engineer and environment-manager that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-027; the output names the Published release ids of preview-environment, devops-engineer and environment-manager that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10401,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-734]",
      "number": 734
    },
    {
      "id": "AIFACTORY-US-1187",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-115",
      "title": "The Environment Manager resolves the proposal to a buildable change set and a reviewer approves the preview",
      "sequence": "19.09.02",
      "description": "As a reviewer of the project, I want the change behind a proposal resolved to the modules it touches, and to decide on that exact deployment before a preview environment is created, so that no non-production environment is created from a change nobody has looked at. The first agent step and the human step of `preview-environment`. When the engine marks `resolve-change` ready it resolves `infrastructure-blueprint` from `input.infrastructure-blueprint` (blueprint-infrastructure-v1) and `change-proposal` from `input.change-proposal` (pull-request-proposal-v1); the `environment-manager` release runs the skill `environment-manager-resolve-change` in read class with `knowledge-search` and `read-range` and writes `change-set` (artifact-v1): the buildable change set of the proposal and the modules of the Infrastructure Blueprint it touches. The step declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, any other failure class is not retried, and a step that exceeds its timeout PT30M or spends its budget fails the run with nothing created. When `approve-preview` becomes ready the engine emits `StepReady` for a Human step and Run Control opens an approval request whose subject is the run and the step, of action class shared-write and proposal kind deployment-manifest, with the hash of `steps.resolve-change.change-set` as proposal hash and the approver rule role Reviewer in project scope, where the requester of the run never decides (ADR-0015, D129). The definition gates this approval on the project policy, but the step carries no guard and policy-decision-v1 has no action kind for non-production environment creation; this is reported as an open question (D127, D129), and whether a run without such a policy skips the request is not asserted here. An approving decision bound to that hash completes the step; on a rejection, an expiry the on-expiry rule does not re-request, or the timeout P2D, Run Control fails the run (ApprovalRejectedOrExpired) and publishes `RunFailed` exactly once, and the engine closes its projection on `RunFailed` without `WorkflowRunFailed`; no environment is created. A regenerated change set makes the pending request Stale. Kind: behavior. Traces: workflows: preview-environment; steps: preview-environment/resolve-change, preview-environment/approve-preview; agents: environment-manager; services: WorkflowEngineService, RunControlService; aggregates: RunControlService/ApprovalRequest; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, RunControlService/RunFailed; descriptors: blueprint-infrastructure-v1, pull-request-proposal-v1, artifact-v1, approval-request-v1; scenarios: SCN-preview-environment-001, SCN-preview-environment-002; adrs: ADR-0014, ADR-0015; requirements: FR-09. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/preview-environment.yaml, model/skills/devops-delivery/environment-manager-resolve-change.yaml, model/scenarios/preview-environment.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `change-proposal` and `infrastructure-blueprint`, when `environment-manager` executes preview-environment/resolve-change, then `change-set` (artifact-v1) is recorded once under the run envelope with the buildable change set and the touched modules of the Infrastructure Blueprint (SCN-preview-environment-001).",
        "AC2: Given an attempt of preview-environment/resolve-change spends the exponential budget of 3 attempts, settles Failed with a non-transient failure class or exceeds PT30M, when Run Control settles the step, then WorkflowEngineService/WorkflowRunFailed names the step and no environment is requested (SCN-preview-environment-001, ADR-0014).",
        "AC3: Given `steps.resolve-change.change-set` is recorded, when preview-environment/approve-preview becomes ready, then RunControlService/ApprovalRequested is published for the run and the step with action class shared-write, proposal kind deployment-manifest, the change-set hash and the approver rule role Reviewer that excludes the requester, and the run waits WaitingForApproval (SCN-preview-environment-002, ADR-0015).",
        "AC4: Given the pending request, when RunControlService/ApprovalDecided approves it for that hash, then preview-environment/request-preview becomes ready; when it rejects it, the request expires with no re-request left or the step reaches P2D without a decision, then Run Control fails the run (ApprovalRejectedOrExpired) and publishes RunControlService/RunFailed exactly once; the engine closes its projection on RunFailed without WorkflowEngineService/WorkflowRunFailed; no environment is created (SCN-preview-environment-002, D119, D121)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml",
        "model/skills/devops-delivery/environment-manager-resolve-change.yaml",
        "model/scenarios/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4737",
        "AIFACTORY-TASK-4738",
        "AIFACTORY-TASK-4739"
      ],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10402,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "preview-environment"
        ],
        "steps": [
          "preview-environment/resolve-change",
          "preview-environment/approve-preview"
        ],
        "agents": [
          "environment-manager"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-infrastructure-v1",
          "pull-request-proposal-v1",
          "artifact-v1",
          "approval-request-v1"
        ],
        "scenarios": [
          "SCN-preview-environment-001",
          "SCN-preview-environment-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015"
        ],
        "requirements": [
          "FR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/preview-environment.yaml",
        "model/skills/devops-delivery/environment-manager-resolve-change.yaml",
        "model/scenarios/preview-environment.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1187]",
      "number": 1187
    },
    {
      "id": "AIFACTORY-TASK-4737",
      "type": "task",
      "parent": "AIFACTORY-US-1187",
      "title": "Bind the resolve-change skill and the approval block of approve-preview",
      "sequence": "19.09.02.01",
      "description": "Bind the resolve-change skill and the approval block of approve-preview. Expected output: The step resolve-change of the Draft release runs environment-manager-resolve-change with infrastructure-blueprint and change-proposal mapped as in model/workflows/preview-environment.yaml, and approve-preview carries action class shared-write, proposal kind deployment-manifest, proposal from steps.resolve-change.change-set, the approver rule and the stale rule.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The step resolve-change of the Draft release runs environment-manager-resolve-change with infrastructure-blueprint and change-proposal mapped as in model/workflows/preview-environment.yaml, and approve-preview carries action class shared-write, proposal kind deployment-manifest, proposal from steps.resolve-change.change-set, the approver rule and the stale rule."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10402,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4737]",
      "number": 4737
    },
    {
      "id": "AIFACTORY-TASK-4738",
      "type": "task",
      "parent": "AIFACTORY-US-1187",
      "title": "Fixture proposal with its expected change set and approval request",
      "sequence": "19.09.02.02",
      "description": "Fixture proposal with its expected change set and approval request. Expected output: A recorded proposal and Infrastructure Blueprint with the expected change set and touched modules, and the expected ApprovalRequested bound to the change-set hash, as the oracle of SCN-preview-environment-001 and SCN-preview-environment-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A recorded proposal and Infrastructure Blueprint with the expected change set and touched modules, and the expected ApprovalRequested bound to the change-set hash, as the oracle of SCN-preview-environment-001 and SCN-preview-environment-002."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10402,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4738]",
      "number": 4738
    },
    {
      "id": "AIFACTORY-TASK-4739",
      "type": "task",
      "parent": "AIFACTORY-US-1187",
      "title": "Prove the resolve step and the preview approval on the fixture",
      "sequence": "19.09.02.03",
      "description": "Prove the resolve step and the preview approval on the fixture. Expected output: A fixture run proves SCN-preview-environment-001 and SCN-preview-environment-002 (AC1 to AC4 of AIFACTORY-US-1187), with the approve and stale paths, the reject and expire paths ending in RunFailed without WorkflowRunFailed, and the requester refused as decider.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-preview-environment-001 and SCN-preview-environment-002 (AC1 to AC4 of AIFACTORY-US-1187), with the approve and stale paths, the reject and expire paths ending in RunFailed without WorkflowRunFailed, and the requester refused as decider."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10402,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4739]",
      "number": 4739
    },
    {
      "id": "AIFACTORY-US-1188",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-115",
      "title": "The DevOps Engineer requests the preview environment and a failed request is compensated by a teardown",
      "sequence": "19.09.03",
      "description": "As a requester, I want the approved change set deployed into a preview environment whose address I receive as an artifact, so that I can try my change, and a failed request never leaves a half-created environment behind. The request step of `preview-environment`. When `approve-preview` held, the engine marks `request-preview` ready and resolves `change-set` from `steps.resolve-change.change-set` and `pipeline-blueprint` from `input.pipeline-blueprint` (blueprint-pipeline-v1, optional). The `devops-engineer` release runs the skill `devops-engineer-request-preview` in shared-write class with its bound tools `list-files`, `search-text`, `search-symbols`, `find-references`, `read-range`, `get-dependencies`, `get-git-diff`, `knowledge-search`, `write-file`, `propose-change-set`, `mcp-azure-devops` and `mcp-github`, and returns `preview-environment` (artifact-v1): the identity and address of the preview environment with the change set deployed, which is also the run output. The definition names RuntimeEnvironmentService as the service that creates the preview, but that service models no operation that creates an environment, so this PBI delivers the step contract, its output and its compensation and traces no service operation for the creation. The step declares `failure_policy` Compensate with the compensation `request the teardown` and no idempotency key, so a Failed attempt is never retried although the definition declares an exponential budget of 3 attempts: the step fails, the engine starts the compensation, the teardown is requested and the run ends Failed with the evidence. An Uncertain attempt is never retried automatically and goes to an operator decision of the project (D119). The step requests no approval of its own; the approval of `approve-preview` covers it. Kind: behavior. Traces: workflows: preview-environment; steps: preview-environment/request-preview; agents: devops-engineer; services: WorkflowEngineService, RunControlService; events: WorkflowEngineService/CompensationStarted, RunControlService/StepSettled, RunControlService/ApprovalRequested; descriptors: artifact-v1, blueprint-pipeline-v1; scenarios: SCN-preview-environment-003; adrs: ADR-0014, ADR-0017; requirements: FR-09, XL-12. Depends on: AIFACTORY-US-1187, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/preview-environment.yaml, model/skills/devops-delivery/devops-engineer-request-preview.yaml, model/scenarios/preview-environment.yaml.",
      "acceptanceCriteria": [
        "AC1: Given preview-environment/approve-preview held, when `devops-engineer` executes preview-environment/request-preview with `change-set` and the optional `pipeline-blueprint`, then `preview-environment` (artifact-v1) with the environment identity and address is recorded once under the run envelope and preview-environment/time-to-live becomes ready (SCN-preview-environment-003).",
        "AC2: Given an attempt of preview-environment/request-preview settles Failed or exceeds PT30M, when Run Control settles the step through RunControlService/StepSettled, then it is not retried because the shared-write step declares no idempotency key, WorkflowEngineService/CompensationStarted is emitted, the compensation requests the teardown and the run ends Failed with the evidence (SCN-preview-environment-003, ADR-0014).",
        "AC3: Given an attempt of preview-environment/request-preview settles Uncertain, when Run Control records it, then it is not retried and RunControlService/ApprovalRequested of kind operator-decision is opened for the Operator of the project; the run continues or compensates only on that decision (SCN-preview-environment-003)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml",
        "model/skills/devops-delivery/devops-engineer-request-preview.yaml",
        "model/scenarios/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4740",
        "AIFACTORY-TASK-4741",
        "AIFACTORY-TASK-4742"
      ],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10403,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "preview-environment"
        ],
        "steps": [
          "preview-environment/request-preview"
        ],
        "agents": [
          "devops-engineer"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "events": [
          "WorkflowEngineService/CompensationStarted",
          "RunControlService/StepSettled",
          "RunControlService/ApprovalRequested"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-pipeline-v1"
        ],
        "scenarios": [
          "SCN-preview-environment-003"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0017"
        ],
        "requirements": [
          "FR-09",
          "XL-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1187",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/preview-environment.yaml",
        "model/skills/devops-delivery/devops-engineer-request-preview.yaml",
        "model/scenarios/preview-environment.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1188]",
      "number": 1188
    },
    {
      "id": "AIFACTORY-TASK-4740",
      "type": "task",
      "parent": "AIFACTORY-US-1188",
      "title": "Bind the request-preview skill and its compensation in the Draft release",
      "sequence": "19.09.03.01",
      "description": "Bind the request-preview skill and its compensation in the Draft release. Expected output: The step request-preview of the Draft release runs devops-engineer-request-preview with change-set and pipeline-blueprint mapped as in model/workflows/preview-environment.yaml, declares failure policy Compensate with the compensation request the teardown, and sets preview-environment as the run output.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The step request-preview of the Draft release runs devops-engineer-request-preview with change-set and pipeline-blueprint mapped as in model/workflows/preview-environment.yaml, declares failure policy Compensate with the compensation request the teardown, and sets preview-environment as the run output."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10403,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4740]",
      "number": 4740
    },
    {
      "id": "AIFACTORY-TASK-4741",
      "type": "task",
      "parent": "AIFACTORY-US-1188",
      "title": "Fixture expected preview environment artifact",
      "sequence": "19.09.03.02",
      "description": "Fixture expected preview environment artifact. Expected output: The expected preview-environment artifact of the fixture run with the environment identity and address, and a recorded failed and an Uncertain attempt with their expected compensation and operator decision, as the oracle of SCN-preview-environment-003.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected preview-environment artifact of the fixture run with the environment identity and address, and a recorded failed and an Uncertain attempt with their expected compensation and operator decision, as the oracle of SCN-preview-environment-003."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10403,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4741]",
      "number": 4741
    },
    {
      "id": "AIFACTORY-TASK-4742",
      "type": "task",
      "parent": "AIFACTORY-US-1188",
      "title": "Prove the preview request and its compensation on the fixture",
      "sequence": "19.09.03.03",
      "description": "Prove the preview request and its compensation on the fixture. Expected output: A fixture run proves SCN-preview-environment-003 (AC1 to AC3 of AIFACTORY-US-1188); the artifact recorded once, a Failed attempt not retried that starts the compensation, and an Uncertain attempt that waits for an operator decision.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-preview-environment-003 (AC1 to AC3 of AIFACTORY-US-1188); the artifact recorded once, a Failed attempt not retried that starts the compensation, and an Uncertain attempt that waits for an operator decision."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10403,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4742]",
      "number": 4742
    },
    {
      "id": "AIFACTORY-US-1189",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-115",
      "title": "The preview environment is kept for its time to live and then torn down with its lifetime and cost recorded",
      "sequence": "19.09.04",
      "description": "As a requester, I want my preview environment kept for its time to live and torn down afterwards with its lifetime and cost recorded, so that previews never outlive their use and their cost is visible. The timer and the teardown of `preview-environment`. When `request-preview` succeeded the engine marks `time-to-live` ready: it is an engine timer with no agent, no tool and no attempt; the engine stores a durable timer entry for the configured time to live, at most P3D, moves its projection of the run to WaitingForTimer and returns it to Running when the timer fires and `TimerFired` is emitted. A timer that fires after its step already advanced is a no-op. The definition says the time to live is extended by use, but the model carries no signal that extends a timer, so this PBI delivers the fixed time to live only and the extension by use is reported as an open question. When the timer fired the engine marks `teardown` ready: a step of kind compensation in sandbox class, for which the engine stores a task contract in ArtifactService before it announces the step (D125), so Run Control dispatches its attempt like any other. The teardown requests the removal of the preview environment and records its lifetime and cost as the output of its attempt, an artifact-v1 under the run envelope stored through `Artifacts.Store`; the definition declares no output for the step, and where the cost figure comes from is reported as an open question. A Failed attempt of failure class transient is retried under the fixed budget of 3 attempts with backoff 10s, and a teardown that exceeds PT30M or spends its budget ends the run Failed with an operator follow-up, never silently. A run that Run Control cancels or fails while it waits for the timer closes the engine projection Cancelled or Failed; on `RunCancelled` the engine skips its pending timers and has no path to compensation, and on `RunFailed` it only closes the projection and cancels open step runs (D121), so no teardown runs and the environment is left for an operator follow-up. The model has no early-end path that tears the environment down, which is reported as an open question. When the teardown succeeds the run completes with `preview-environment` as its output. Kind: behavior. Traces: workflows: preview-environment; steps: preview-environment/time-to-live, preview-environment/teardown; services: WorkflowEngineService, RunControlService, ArtifactService; apis: ArtifactService/Artifacts.Store; events: WorkflowEngineService/TimerFired, WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCancelled, RunControlService/RunFailed; descriptors: agent-task-contract-v1, artifact-v1; scenarios: SCN-preview-environment-004, SCN-preview-environment-005; adrs: ADR-0014; requirements: FR-09, XL-12. Depends on: AIFACTORY-US-1188, feature:workflow-engine-service, feature:run-control-service, feature:artifact-service. Sources: model/workflows/preview-environment.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/preview-environment.yaml.",
      "acceptanceCriteria": [
        "AC1: Given preview-environment/request-preview succeeded, when the engine reaches preview-environment/time-to-live, then a durable timer entry for the configured time to live of at most P3D is stored, the run projection is WaitingForTimer and no attempt is dispatched (SCN-preview-environment-004).",
        "AC2: Given the timer is due, when it fires, then WorkflowEngineService/TimerFired is emitted once, the projection returns to Running and preview-environment/teardown becomes ready; a second firing for the same step is a no-op (SCN-preview-environment-004).",
        "AC3: Given preview-environment/teardown becomes ready, when the engine announces it with WorkflowEngineService/StepReady carrying the reference and hash of its stored task contract (agent-task-contract-v1), then its attempt requests the teardown, the lifetime and cost of the environment are recorded as an artifact-v1 under the run envelope through ArtifactService/Artifacts.Store, and the run completes with WorkflowEngineService/WorkflowRunCompleted once (SCN-preview-environment-005, ADR-0014).",
        "AC4: Given a teardown attempt settles Failed with failure class transient until the fixed budget of 3 attempts is spent, or exceeds PT30M, when Run Control settles the step, then the run ends Failed with WorkflowEngineService/WorkflowRunFailed naming `teardown` and an operator follow-up, never silently (SCN-preview-environment-005).",
        "AC5: Given the run is cancelled or failed by Run Control while it waits in preview-environment/time-to-live, when the engine hears RunControlService/RunCancelled or RunControlService/RunFailed, then the projection ends Cancelled or Failed, no teardown step runs and the environment is left for an operator follow-up (SCN-preview-environment-004, D121)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-334",
        "AIFACTORY-TASK-335",
        "AIFACTORY-TASK-4743"
      ],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10404,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "preview-environment"
        ],
        "steps": [
          "preview-environment/time-to-live",
          "preview-environment/teardown"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "ArtifactService"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "WorkflowEngineService/TimerFired",
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCancelled",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "agent-task-contract-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-preview-environment-004",
          "SCN-preview-environment-005"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-09",
          "XL-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1188",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:artifact-service"
      ],
      "source": [
        "model/workflows/preview-environment.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/preview-environment.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1189]",
      "number": 1189
    },
    {
      "id": "AIFACTORY-TASK-334",
      "type": "task",
      "parent": "AIFACTORY-US-1189",
      "title": "Preview time to live and teardown",
      "sequence": "19.09.04.01",
      "description": "Preview time to live and teardown. Expected output: The timer step time-to-live waits the configured time to live of at most P3D on a durable timer entry, and the compensation step teardown is announced with its stored task contract, requests the teardown and records the lifetime and cost of the environment (SCN-preview-environment-004, SCN-preview-environment-005).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The timer step time-to-live waits the configured time to live of at most P3D on a durable timer entry, and the compensation step teardown is announced with its stored task contract, requests the teardown and records the lifetime and cost of the environment (SCN-preview-environment-004, SCN-preview-environment-005)."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-334]",
      "number": 334
    },
    {
      "id": "AIFACTORY-TASK-335",
      "type": "task",
      "parent": "AIFACTORY-US-1189",
      "title": "Preview commands in the command-line client",
      "sequence": "19.09.04.02",
      "description": "Preview commands in the command-line client. Expected output: The client shows the preview run of a proposal with the preview-environment artifact, its address and the remaining time to live; it offers no early end, because the model has no act that tears the environment down before the timer fires.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "The client shows the preview run of a proposal with the preview-environment artifact, its address and the remaining time to live; it offers no early end, because the model has no act that tears the environment down before the timer fires."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10404,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-335]",
      "number": 335
    },
    {
      "id": "AIFACTORY-TASK-4743",
      "type": "task",
      "parent": "AIFACTORY-US-1189",
      "title": "Prove the timer and the teardown on the fixture",
      "sequence": "19.09.04.03",
      "description": "Prove the timer and the teardown on the fixture. Expected output: A fixture run with a shortened time to live proves SCN-preview-environment-004 and SCN-preview-environment-005 (AC1 to AC5 of AIFACTORY-US-1189); one TimerFired, a no-op second firing, the teardown with lifetime and cost recorded as an artifact, a run cancelled while waiting that runs no teardown and leaves the environment for an operator follow-up, and a teardown that spends its budget ending the run Failed with an operator follow-up.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run with a shortened time to live proves SCN-preview-environment-004 and SCN-preview-environment-005 (AC1 to AC5 of AIFACTORY-US-1189); one TimerFired, a no-op second firing, the teardown with lifetime and cost recorded as an artifact, a run cancelled while waiting that runs no teardown and leaves the environment for an operator follow-up, and a teardown that spends its budget ending the run Failed with an operator follow-up."
      ],
      "sourceArtifacts": [
        "model/workflows/preview-environment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 104,
      "phase": "factory",
      "stackRank": 10404,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4743]",
      "number": 4743
    },
    {
      "id": "AIFACTORY-FEAT-116",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Release promotion",
      "sequence": "19.10",
      "description": "The workflow definition release as a published asset: Promotes a milestone-validated release through the environments: verifies readiness, promotes to staging, bakes against the guards, waits for the production approval, promotes and verifies; a failed verification requests the rollback. It has 6 steps, names the agents deployment-orchestrator, devops-engineer, release-manager and the tools none, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I2: Deliver it. Build order 105 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-029",
        "AIFACTORY-US-1190",
        "AIFACTORY-US-1191",
        "AIFACTORY-US-1192",
        "AIFACTORY-US-1193"
      ],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10500,
      "titlePrefix": "[AIFACTORY-FEAT-116]",
      "number": 116
    },
    {
      "id": "AIFACTORY-US-029",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-116",
      "title": "A release moves to production through staging, a bake and my approval",
      "sequence": "19.10.01",
      "description": "As a reviewer, I want a release to pass staging and a bake period before I am asked to approve production, so that I decide on evidence, and a failed production promotion requests the rollback of the previous version. The integration PBI of the definition `release`. When ReleaseService publishes `ReleaseReady` for a product release and PipelineExecutionService publishes `PipelineRunCompleted` in state Succeeded or PartiallySucceeded for the same project, WorkflowEngineService satisfies the two required readiness members `release` (release-manifest-v1, versioned on the release version) and `pipeline-results` (artifact-v1, hashed on the commit). It submits the run itself through `SubmitRun` of RunControlService with a service token that names the project and the bundle idempotency key (D131): the same release version returns the existing run and a newer member supersedes the open correlation. Run Control accepts the run and publishes `RunAccepted`; the engine loads the Published release of the definition that the run pinned through AgentRegistryService and marks the seven steps ready in the declared order: `verify-readiness`, the condition `check-readiness`, `promote-staging`, `bake`, `promote-production`, `approve-production` and `verify`, with the agents `release-manager`, `devops-engineer` and `deployment-orchestrator` on their pinned releases. A negative readiness verdict stops the release at `check-readiness`, before `promote-staging`, and nothing is promoted (D133). `promote-production` requests the production promotion, which opens the gate of EnvironmentPromotionService; `approve-production` opens no approval of its own: a person gives one production approval, that gate bound to the release id and the production environment, and the step waits on it, so the promotion is handed off to production only after the approval (D133, D139). Every step records exactly one outcome and the run reports exactly one outcome to Run Control (ADR-0014). A failed production promotion compensates by requesting the rollback, and `verify` declares Compensate because it follows the effect of `promote-production`, so a failed verification compensates that confirmed effect with the same rollback (D133); a rollback is a new promotion of the previous release that skips the approval gate (D135). Before any run, the definition release and the agent releases of its three agents, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release, no evaluation verdict is required before I4, and the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1190 to AIFACTORY-US-1193; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService, ReleaseService, PipelineExecutionService, EnvironmentPromotionService, AgentRegistryService; workflows: release; steps: release/verify-readiness, release/check-readiness, release/promote-staging, release/bake, release/approve-production, release/promote-production, release/verify; agents: release-manager, devops-engineer, deployment-orchestrator; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, ReleaseService/ReleaseReady, PipelineExecutionService/PipelineRunCompleted, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, WorkflowEngineService/CompensationStarted, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, release-manifest-v1, artifact-v1; adrs: ADR-0014, ADR-0017, ADR-0024, ADR-0027; requirements: FR-05, FR-06, FR-10, FUX-05, XL-10, XL-11. Depends on: AIFACTORY-US-1190, AIFACTORY-US-1191, AIFACTORY-US-1192, AIFACTORY-US-1193, feature:release-service, feature:pipeline-execution-service-complete, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:agent-registry-service-publication. Sources: model/workflows/release.yaml, docs/planes/agent-runtime/workflow-definitions/release.md.",
      "acceptanceCriteria": [
        "AC1: Given ReleaseService/ReleaseReady and PipelineExecutionService/PipelineRunCompleted in state Succeeded for the same project and tenant, when both required members are satisfied, then WorkflowEngineService/ReadinessRunSubmitted is emitted once and the run is submitted through RunControlService/SubmitRun with a service token naming the project (D131); a repeated ReleaseReady for the same version returns the existing run.",
        "AC2: Given the Published release of the definition `release`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter (D140), with its 7 steps, input mappings, retry policies, timeouts, the failure policy of each agent and human step, the condition of check-readiness, the `waits_on` block of approve-production, the `idempotency_key` of promote-staging and the compensation of promote-production exactly as in model/workflows/release.yaml, when RunControlService/RunAccepted arrives for a run that pinned it, then WorkflowEngineService/WorkflowRunStarted is emitted and release/verify-readiness, release/check-readiness, release/promote-staging, release/bake, release/promote-production, release/approve-production and release/verify become ready in that order, each agent step on the pinned Published release of its agent, and no Draft release is loaded (D139).",
        "AC3: Given every step succeeds, when the run completes, then `promotion-evidence` (artifact-v1) is the run output, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC4: Given release/promote-production fails under its `failure_policy` Compensate, when the engine applies it, then WorkflowEngineService/CompensationStarted is emitted, the rollback to the previous release is requested with the evidence recorded and RunControlService/RunFailed is published exactly once; given release/verify fails after release/promote-production succeeded, then the engine compensates under the `failure_policy` Compensate of `verify`, WorkflowEngineService/CompensationStarted is emitted, the compensation of promote-production requests the rollback to the previous release, WorkflowEngineService/WorkflowRunFailed names `verify` with compensated true and RunControlService/RunFailed follows once; given release/check-readiness finds a negative verdict, then WorkflowEngineService/WorkflowRunFailed names `check-readiness` and nothing is promoted (D133, D135, ADR-0014, ADR-0017).",
        "AC5: Given the recorded fixture inputs of model/workflows/release.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml",
        "docs/planes/agent-runtime/workflow-definitions/release.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-339",
        "AIFACTORY-TASK-278",
        "AIFACTORY-TASK-279",
        "AIFACTORY-TASK-280",
        "AIFACTORY-TASK-736"
      ],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10501,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "ReleaseService",
          "PipelineExecutionService",
          "EnvironmentPromotionService",
          "AgentRegistryService"
        ],
        "workflows": [
          "release"
        ],
        "steps": [
          "release/verify-readiness",
          "release/check-readiness",
          "release/promote-staging",
          "release/bake",
          "release/approve-production",
          "release/promote-production",
          "release/verify"
        ],
        "agents": [
          "release-manager",
          "devops-engineer",
          "deployment-orchestrator"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "ReleaseService/ReleaseReady",
          "PipelineExecutionService/PipelineRunCompleted",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "WorkflowEngineService/CompensationStarted",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "release-manifest-v1",
          "artifact-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0017",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "FR-10",
          "FUX-05",
          "XL-10",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1190",
        "AIFACTORY-US-1191",
        "AIFACTORY-US-1192",
        "AIFACTORY-US-1193",
        "feature:release-service",
        "feature:pipeline-execution-service-complete",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/release.yaml",
        "docs/planes/agent-runtime/workflow-definitions/release.md"
      ],
      "titlePrefix": "[AIFACTORY-US-029]",
      "number": 29
    },
    {
      "id": "AIFACTORY-TASK-339",
      "type": "task",
      "parent": "AIFACTORY-US-029",
      "title": "Readiness start on a ready release and its pipeline results",
      "sequence": "19.10.01.01",
      "description": "Readiness start on a ready release and its pipeline results. Expected output: The release run starts once per release version when ReleaseReady and PipelineRunCompleted are both satisfied, through SubmitRun with a service token naming the project, and a newer member version supersedes the open correlation (AC1 of AIFACTORY-US-029).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The release run starts once per release version when ReleaseReady and PipelineRunCompleted are both satisfied, through SubmitRun with a service token naming the project, and a newer member version supersedes the open correlation (AC1 of AIFACTORY-US-029)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-339]",
      "number": 339
    },
    {
      "id": "AIFACTORY-TASK-278",
      "type": "task",
      "parent": "AIFACTORY-US-029",
      "title": "Author, submit and publish the release of the workflow definition release with its agent releases",
      "sequence": "19.10.01.02",
      "description": "Author, submit and publish the release of the workflow definition release with its agent releases. Expected output: The release of release (workflow-definition-v1) authored with its 7 steps, input mappings, retry policies, timeouts, the condition of check-readiness, the failure policy of each agent and human step (Compensate on promote-production and verify), the waits_on block of approve-production on the promotion gate of EnvironmentPromotionService, the idempotency_key releaseId + staging of promote-staging and the compensation of promote-production exactly as in model/workflows/release.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases deployment-orchestrator, devops-engineer and release-manager of AIFACTORY-TASK-279 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of release (workflow-definition-v1) authored with its 7 steps, input mappings, retry policies, timeouts, the condition of check-readiness, the failure policy of each agent and human step (Compensate on promote-production and verify), the waits_on block of approve-production on the promotion gate of EnvironmentPromotionService, the idempotency_key releaseId + staging of promote-staging and the compensation of promote-production exactly as in model/workflows/release.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases deployment-orchestrator, devops-engineer and release-manager of AIFACTORY-TASK-279 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-278]",
      "number": 278
    },
    {
      "id": "AIFACTORY-TASK-279",
      "type": "task",
      "parent": "AIFACTORY-US-029",
      "title": "Author the agent releases deployment-orchestrator, devops-engineer, release-manager with their prompts and skills",
      "sequence": "19.10.01.03",
      "description": "Author the agent releases deployment-orchestrator, devops-engineer, release-manager with their prompts and skills. Expected output: Draft releases of deployment-orchestrator, devops-engineer and release-manager with their instructions, the skills release-manager-verify-readiness, devops-engineer-promote-staging, deployment-orchestrator-promote-production and release-manager-verify among their bound skills, tool bindings and model profiles of model/agents/devops-delivery/; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-278, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of deployment-orchestrator, devops-engineer and release-manager with their instructions, the skills release-manager-verify-readiness, devops-engineer-promote-staging, deployment-orchestrator-promote-production and release-manager-verify among their bound skills, tool bindings and model profiles of model/agents/devops-delivery/; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-278, and no evaluation verdict of the suite devops-delivery-core-v1 is required for its publication before I4 (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10501,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-279]",
      "number": 279
    },
    {
      "id": "AIFACTORY-TASK-280",
      "type": "task",
      "parent": "AIFACTORY-US-029",
      "title": "Fixture run of release against recorded inputs",
      "sequence": "19.10.01.04",
      "description": "Fixture run of release against recorded inputs. Expected output: The definition runs end to end on a fixture release and pipeline run in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-278; every step output validates against its descriptor (AC2, AC3 and AC5 of AIFACTORY-US-029).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture release and pipeline run in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-278; every step output validates against its descriptor (AC2, AC3 and AC5 of AIFACTORY-US-029)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-280]",
      "number": 280
    },
    {
      "id": "AIFACTORY-TASK-736",
      "type": "task",
      "parent": "AIFACTORY-US-029",
      "title": "Verify release-through-environments by running the declared command",
      "sequence": "19.10.01.05",
      "description": "Verify release-through-environments by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-029, including the compensation path of a failed production promotion, the compensated failed verification and the stop at check-readiness of AC4; the output names the Published release ids of the definition release, deployment-orchestrator, devops-engineer and release-manager that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-029, including the compensation path of a failed production promotion, the compensated failed verification and the stop at check-readiness of AC4; the output names the Published release ids of the definition release, deployment-orchestrator, devops-engineer and release-manager that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10501,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-736]",
      "number": 736
    },
    {
      "id": "AIFACTORY-US-1190",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-116",
      "title": "The Release Manager verifies readiness, a negative verdict stops the release, and the DevOps Engineer requests the staging promotion",
      "sequence": "19.10.02",
      "description": "As a reviewer of the project, I want the readiness of a release verified from its bill of materials, attestations, gates and open findings, a release judged not ready stopped, and a ready release promoted to staging once, so that nothing reaches staging or production on a negative readiness verdict. The first two agent steps of `release` and the condition between them. When the engine marks `verify-readiness` ready it resolves `pipeline-results` from `input.pipeline-results` and `release` from `input.release` (release-manifest-v1); the `release-manager` release runs the skill `release-manager-verify-readiness` in read class with `knowledge-search` and `read-range` and writes `readiness` (artifact-v1): the verdict over the software bill of materials, the attestations, the gates and the open findings of the release, with the member `passed`. The step declares `failure_policy` Retry with the exponential budget of 3 attempts. The engine then evaluates the condition `check-readiness`, `steps.verify-readiness.readiness.passed == true`, over the recorded output without a service call, within PT1M and without a retry. A negative verdict stops the release before `promote-staging`: the definition declares no false branch, so the run fails with the readiness verdict as its evidence and nothing is promoted (D133); a missing or unreadable verdict fails the condition the same way instead of being read as passed. When it holds, `promote-staging` becomes ready and receives `release` and `readiness` from `steps.verify-readiness.readiness`; the `devops-engineer` release runs the skill `devops-engineer-promote-staging` in shared-write class with its bound tools `list-files`, `search-text`, `search-symbols`, `find-references`, `read-range`, `get-dependencies`, `get-git-diff`, `knowledge-search`, `write-file`, `propose-change-set`, `mcp-azure-devops` and `mcp-github`, and returns `staging-promotion` (artifact-v1). The definition says the step requests the staging promotion through EnvironmentPromotionService, but none of those tools reaches that service, and the only tool that does, `deploy-environment`, is production class above the shared-write class of the step; this is reported as an open question, so this PBI asserts the recorded staging-promotion artifact and its mappings only. The step declares `failure_policy` Retry with `idempotency_key` releaseId + staging, so a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s (D114); an attempt of any other failure class is not retried, and an Uncertain attempt goes to an operator decision of the project (D119). Either step that exceeds PT30M or spends its budget fails the run, and neither step has a compensation. Kind: behavior. Traces: workflows: release; steps: release/verify-readiness, release/check-readiness, release/promote-staging; agents: release-manager, devops-engineer; services: WorkflowEngineService, RunControlService; events: RunControlService/StepSettled, WorkflowEngineService/WorkflowRunFailed; descriptors: release-manifest-v1, artifact-v1; scenarios: SCN-release-001, SCN-release-007, SCN-release-002; adrs: ADR-0014, ADR-0017; requirements: FR-10, XL-11. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/release.yaml, model/skills/devops-delivery/release-manager-verify-readiness.yaml, model/skills/devops-delivery/devops-engineer-promote-staging.yaml, model/scenarios/release.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `release` and `pipeline-results`, when `release-manager` executes release/verify-readiness, then `readiness` (artifact-v1) is recorded once under the run envelope with the verdict over the bill of materials, the attestations, the gates and the open findings (SCN-release-001).",
        "AC2: Given `steps.verify-readiness.readiness` is recorded with `passed` false, or is missing or unreadable, or the evaluation exceeds PT1M, when the engine evaluates release/check-readiness, then the condition is not retried, WorkflowEngineService/WorkflowRunFailed names `check-readiness` with the verdict as evidence, release/promote-staging never becomes ready and nothing is promoted; given `passed` true, then the condition completes with exactly one outcome and release/promote-staging becomes ready (SCN-release-007, D133).",
        "AC3: Given release/check-readiness held, when `devops-engineer` executes release/promote-staging with `release` from `input.release` and `readiness` from `steps.verify-readiness.readiness`, then `staging-promotion` (artifact-v1) is recorded once under the run envelope and release/bake becomes ready (SCN-release-002).",
        "AC4: Given an attempt of release/promote-staging settles Failed with failure class transient, when Run Control evaluates the step, then it is retried under the exponential budget of 3 attempts because the step declares `idempotency_key` releaseId + staging, no second `staging-promotion` is recorded, and an Uncertain attempt is not retried and waits for an operator decision (SCN-release-002, D114).",
        "AC5: Given an attempt of either agent step spends its budget, settles Failed with a non-transient failure class or exceeds PT30M, when Run Control settles the step through RunControlService/StepSettled, then WorkflowEngineService/WorkflowRunFailed names the step and production is never asked for (SCN-release-001, SCN-release-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml",
        "model/skills/devops-delivery/release-manager-verify-readiness.yaml",
        "model/skills/devops-delivery/devops-engineer-promote-staging.yaml",
        "model/scenarios/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4744",
        "AIFACTORY-TASK-4745",
        "AIFACTORY-TASK-4746"
      ],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10502,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "release"
        ],
        "steps": [
          "release/verify-readiness",
          "release/check-readiness",
          "release/promote-staging"
        ],
        "agents": [
          "release-manager",
          "devops-engineer"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "events": [
          "RunControlService/StepSettled",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "release-manifest-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-release-001",
          "SCN-release-007",
          "SCN-release-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0017"
        ],
        "requirements": [
          "FR-10",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/release.yaml",
        "model/skills/devops-delivery/release-manager-verify-readiness.yaml",
        "model/skills/devops-delivery/devops-engineer-promote-staging.yaml",
        "model/scenarios/release.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1190]",
      "number": 1190
    },
    {
      "id": "AIFACTORY-TASK-4744",
      "type": "task",
      "parent": "AIFACTORY-US-1190",
      "title": "Bind the verify-readiness and promote-staging skills, the readiness condition and the staging idempotency key",
      "sequence": "19.10.02.01",
      "description": "Bind the verify-readiness and promote-staging skills, the readiness condition and the staging idempotency key. Expected output: The steps verify-readiness and promote-staging of the Draft release run release-manager-verify-readiness and devops-engineer-promote-staging with the input mappings of model/workflows/release.yaml, the condition check-readiness reads steps.verify-readiness.readiness.passed == true with timeout PT1M and no false branch, and promote-staging depends on check-readiness and carries failure policy Retry with idempotency_key releaseId + staging.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps verify-readiness and promote-staging of the Draft release run release-manager-verify-readiness and devops-engineer-promote-staging with the input mappings of model/workflows/release.yaml, the condition check-readiness reads steps.verify-readiness.readiness.passed == true with timeout PT1M and no false branch, and promote-staging depends on check-readiness and carries failure policy Retry with idempotency_key releaseId + staging."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10502,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4744]",
      "number": 4744
    },
    {
      "id": "AIFACTORY-TASK-4745",
      "type": "task",
      "parent": "AIFACTORY-US-1190",
      "title": "Fixture release with its expected readiness verdict and staging promotion",
      "sequence": "19.10.02.02",
      "description": "Fixture release with its expected readiness verdict and staging promotion. Expected output: A recorded release manifest and pipeline results with the expected readiness verdict and the expected staging-promotion artifact, a second release whose verdict is negative with the expected failed run at check-readiness, plus a transient failure of the staging request, as the oracle of SCN-release-001, SCN-release-007 and SCN-release-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A recorded release manifest and pipeline results with the expected readiness verdict and the expected staging-promotion artifact, a second release whose verdict is negative with the expected failed run at check-readiness, plus a transient failure of the staging request, as the oracle of SCN-release-001, SCN-release-007 and SCN-release-002."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10502,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4745]",
      "number": 4745
    },
    {
      "id": "AIFACTORY-TASK-4746",
      "type": "task",
      "parent": "AIFACTORY-US-1190",
      "title": "Prove readiness verification and the staging promotion on the fixture",
      "sequence": "19.10.02.03",
      "description": "Prove readiness verification and the staging promotion on the fixture. Expected output: A fixture run proves SCN-release-001, SCN-release-007 and SCN-release-002 (AC1 to AC5 of AIFACTORY-US-1190); a negative verdict ending in WorkflowRunFailed naming check-readiness with nothing promoted, one staging-promotion artifact per release under transient retries, an Uncertain attempt waiting for an operator decision and the exhaustion path ending in WorkflowRunFailed.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-release-001, SCN-release-007 and SCN-release-002 (AC1 to AC5 of AIFACTORY-US-1190); a negative verdict ending in WorkflowRunFailed naming check-readiness with nothing promoted, one staging-promotion artifact per release under transient retries, an Uncertain attempt waiting for an operator decision and the exhaustion path ending in WorkflowRunFailed."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10502,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4746]",
      "number": 4746
    },
    {
      "id": "AIFACTORY-US-1191",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-116",
      "title": "The release bakes in staging for its declared window before production is asked for",
      "sequence": "19.10.03",
      "description": "As a reviewer of the project, I want the release to stay in staging for its bake window before the production approval is requested, so that I am never asked to approve a release that has not run in staging. The bake timer of `release`. When `promote-staging` succeeded the engine marks `bake` ready: it is an engine timer in sandbox class with no agent, no tool and no attempt. The engine stores a durable timer entry for the bake window of PT2H, moves its projection of the run to WaitingForTimer and returns it to Running when the timer fires and `TimerFired` is emitted; a timer that fires after its step already advanced is a no-op, and a run cancelled while it waits ends Cancelled. Only then does `promote-production` become ready, so no production promotion, and with it no production approval of its gate, is requested before the bake window has passed (D139). The definition fails the run on a guard breach during the window, but no I2 service evaluates the guards: SloService is delivered in I4 and the timer step itself evaluates nothing. This PBI delivers the bake window, its ordering before the production approval and the cancellation branch; the breach branch of SCN-release-003 stays untraced, and whether the staging verification of EnvironmentPromotionService, with its SLO window, is the guard the bake relies on in I2 is reported as an open question. The step has no failure policy and no retry; it changes no shared system. Kind: behavior. Traces: workflows: release; steps: release/bake; services: WorkflowEngineService; events: WorkflowEngineService/TimerFired, RunControlService/RunCancelled; scenarios: SCN-release-003; adrs: ADR-0014, ADR-0017; requirements: FR-10. Depends on: AIFACTORY-US-1190, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/release.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/release.yaml.",
      "acceptanceCriteria": [
        "AC1: Given release/promote-staging succeeded, when the engine reaches release/bake, then a durable timer entry for the bake window PT2H is stored, the run projection is WaitingForTimer and no attempt is dispatched (SCN-release-003).",
        "AC2: Given the bake window is due, when the timer fires, then WorkflowEngineService/TimerFired is emitted once, the projection returns to Running and release/promote-production becomes ready; a second firing is a no-op (SCN-release-003, D139).",
        "AC3: Given the run is cancelled while it waits, when RunControlService/RunCancelled is heard, then the projection ends Cancelled, the timer is not fired into a new step and no production approval is requested (SCN-release-003, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-340",
        "AIFACTORY-TASK-4747"
      ],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10503,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "release"
        ],
        "steps": [
          "release/bake"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/TimerFired",
          "RunControlService/RunCancelled"
        ],
        "scenarios": [
          "SCN-release-003"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0017"
        ],
        "requirements": [
          "FR-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1190",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/release.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/release.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1191]",
      "number": 1191
    },
    {
      "id": "AIFACTORY-TASK-340",
      "type": "task",
      "parent": "AIFACTORY-US-1191",
      "title": "Bake timer before the production approval",
      "sequence": "19.10.03.01",
      "description": "Bake timer before the production approval. Expected output: The timer step bake of the Draft release waits the bake window PT2H on a durable timer entry and only then makes promote-production ready, as model/workflows/release.yaml declares (SCN-release-003).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The timer step bake of the Draft release waits the bake window PT2H on a durable timer entry and only then makes promote-production ready, as model/workflows/release.yaml declares (SCN-release-003)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10503,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-340]",
      "number": 340
    },
    {
      "id": "AIFACTORY-TASK-4747",
      "type": "task",
      "parent": "AIFACTORY-US-1191",
      "title": "Prove the bake window on the fixture",
      "sequence": "19.10.03.02",
      "description": "Prove the bake window on the fixture. Expected output: A fixture run with a shortened bake window proves SCN-release-003 (AC1 to AC3 of AIFACTORY-US-1191); one TimerFired, a no-op second firing, promote-production ready only after the window, and a cancelled run that requests no approval.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run with a shortened bake window proves SCN-release-003 (AC1 to AC3 of AIFACTORY-US-1191); one TimerFired, a no-op second firing, promote-production ready only after the window, and a cancelled run that requests no approval."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10503,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4747]",
      "number": 4747
    },
    {
      "id": "AIFACTORY-US-1192",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-116",
      "title": "A reviewer approves production on the readiness evidence and the Deployment Orchestrator requests the promotion",
      "sequence": "19.10.04",
      "description": "As a reviewer of the project, I want to approve the production promotion of the exact release on its readiness evidence, and the promotion handed off to production only after my decision, so that production changes on a decision someone other than the requester took, with a rollback ready if it fails. The production promotion and the production approval of `release`. A person gives one production approval: the approval gate of EnvironmentPromotionService, bound to the release id and the production environment (D133). The promotion is requested first and waits for that approval (D139). When `bake` fired the engine marks `promote-production` ready and resolves `release` from `input.release`; the `deployment-orchestrator` release runs the skill `deployment-orchestrator-promote-production` in production class and requests the production promotion through EnvironmentPromotionService with the tool `deploy-environment`; the promotion enters AwaitingApproval and its gate requests the approval through `RequestApproval` of RunControlService with the service identity of EnvironmentPromotionService, the subject kind promotion and the promotion id as subject id, of action class production, with the approver rule role Reviewer in project scope, where the requester never decides (ADR-0015, D18, D135); the step returns `production-promotion` (artifact-v1) naming the promotion. The engine then emits `StepReady` for the Human step `approve-production`, which opens no approval of its own: it declares `waits_on` the gate that `promote-production` opened, and the engine advances it when `ApprovalDecided` names that gate for the release id and the production environment. An approving decision completes the step with exactly one outcome and EnvironmentPromotionService hands the promotion off through `PromotionApproved`, so its saga applies and verifies only after the approval; a rejection, an expiry the on-expiry rule does not re-request, or the timeout P7D fails the step, and since the step declares `failure_policy` Fail the engine reports `WorkflowRunFailed` naming `approve-production` and Run Control publishes `RunFailed` once, with the staging promotion in place and nothing deployed to production. `promote-production` declares `failure_policy` Compensate and no retry, so a Failed attempt or a timeout PT30M is not retried and the compensation, which runs only once the effect of the step is confirmed, requests the rollback to the previous release and records the incident link. A rollback opens a new promotion of the previous release whose `rollbackOfPromotionId` names the failed one; it skips the approval gate, hands off through `PromotionApproved` like any promotion, and the failed promotion ends RolledBack with `RollbackCompleted` when the new one completes (D135). The identity a compensation calls `RollbackPromotion` with, a scope the Operator holds by role, is left to the owner as an open question. An Uncertain attempt goes to an operator decision of the project (D119). Kind: behavior. Traces: workflows: release; steps: release/approve-production, release/promote-production; agents: deployment-orchestrator; services: WorkflowEngineService, RunControlService, EnvironmentPromotionService; aggregates: RunControlService/ApprovalRequest, EnvironmentPromotionService/Promotion; apis: EnvironmentPromotionService/Promotions.Request, EnvironmentPromotionService/RollbackPromotion; events: RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, RunControlService/RunFailed, EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/PromotionFailed, EnvironmentPromotionService/RollbackCompleted, WorkflowEngineService/WorkflowRunFailed, WorkflowEngineService/CompensationStarted; descriptors: release-manifest-v1, artifact-v1, approval-request-v1; scenarios: SCN-release-004, SCN-release-005; adrs: ADR-0014, ADR-0015, ADR-0017; requirements: FR-10, FUX-05, XL-11. Depends on: AIFACTORY-US-1191, feature:environment-promotion-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/release.yaml, model/skills/devops-delivery/deployment-orchestrator-promote-production.yaml, model/tools/deploy-environment.yaml, model/scenarios/release.yaml.",
      "acceptanceCriteria": [
        "AC1: Given release/bake fired, when `deployment-orchestrator` executes release/promote-production, then one production promotion of `input.release` is requested through EnvironmentPromotionService/Promotions.Request, the promotion waits in AwaitingApproval, RunControlService/ApprovalRequested is published once for its gate with the subject kind promotion, action class production, the binding to the release id and the production environment and the approver rule role Reviewer that excludes the requester, and `production-promotion` (artifact-v1) is recorded once under the run envelope (SCN-release-005, ADR-0015, D133, D139).",
        "AC2: Given release/promote-production succeeded, when release/approve-production becomes ready, then the engine opens no approval request of its own and no second production approval is requested; the step waits on the gate that promote-production opened, and nothing is handed off to production while it waits (SCN-release-004, D133, D139).",
        "AC3: Given the step waits on the gate, when RunControlService/ApprovalDecided approves the gate for that release id and environment, then release/approve-production completes once and EnvironmentPromotionService/PromotionApproved hands the promotion off; when it rejects or expires the gate with no re-request left, or the step reaches P7D without a decision, then the step fails under `failure_policy` Fail, WorkflowEngineService/WorkflowRunFailed names `approve-production`, RunControlService/RunFailed follows once, nothing is deployed to production and the staging promotion stays in place (SCN-release-004, D119, D121).",
        "AC4: Given an attempt of release/promote-production settles Failed or exceeds PT30M, when Run Control settles the step, then it is not retried, WorkflowEngineService/CompensationStarted is emitted and the compensation requests the rollback through EnvironmentPromotionService/RollbackPromotion, which opens a new promotion of the previous release that skips the approval gate and hands off through EnvironmentPromotionService/PromotionApproved, records the incident link, and WorkflowEngineService/WorkflowRunFailed names `promote-production` with compensated true; when EnvironmentPromotionService/PromotionFailed reports rolledBack true, the compensation records the existing rollback evidence and requests no second rollback; an Uncertain attempt waits for an operator decision (SCN-release-005, ADR-0014, D135).",
        "AC5: Given the rollback promotion of the previous release completes, when EnvironmentPromotionService records its completion, then the failed promotion ends RolledBack, EnvironmentPromotionService/RollbackCompleted is published once naming the rollback promotion, and the previous release is the current release of production (SCN-release-005, D135)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml",
        "model/skills/devops-delivery/deployment-orchestrator-promote-production.yaml",
        "model/tools/deploy-environment.yaml",
        "model/scenarios/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-341",
        "AIFACTORY-TASK-4748",
        "AIFACTORY-TASK-4749"
      ],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10504,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "release"
        ],
        "steps": [
          "release/approve-production",
          "release/promote-production"
        ],
        "agents": [
          "deployment-orchestrator"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "EnvironmentPromotionService"
        ],
        "aggregates": [
          "RunControlService/ApprovalRequest",
          "EnvironmentPromotionService/Promotion"
        ],
        "apis": [
          "EnvironmentPromotionService/Promotions.Request",
          "EnvironmentPromotionService/RollbackPromotion"
        ],
        "events": [
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "RunControlService/RunFailed",
          "EnvironmentPromotionService/PromotionApproved",
          "EnvironmentPromotionService/PromotionFailed",
          "EnvironmentPromotionService/RollbackCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "WorkflowEngineService/CompensationStarted"
        ],
        "descriptors": [
          "release-manifest-v1",
          "artifact-v1",
          "approval-request-v1"
        ],
        "scenarios": [
          "SCN-release-004",
          "SCN-release-005"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0017"
        ],
        "requirements": [
          "FR-10",
          "FUX-05",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1191",
        "feature:environment-promotion-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/release.yaml",
        "model/skills/devops-delivery/deployment-orchestrator-promote-production.yaml",
        "model/tools/deploy-environment.yaml",
        "model/scenarios/release.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1192]",
      "number": 1192
    },
    {
      "id": "AIFACTORY-TASK-341",
      "type": "task",
      "parent": "AIFACTORY-US-1192",
      "title": "Production step waiting on the promotion gate and the guarded production promotion",
      "sequence": "19.10.04.01",
      "description": "Production step waiting on the promotion gate and the guarded production promotion. Expected output: The agent step promote-production requests the production promotion first, and the human step approve-production that follows opens no approval of its own and waits on the promotion gate of EnvironmentPromotionService with subject kind promotion, bound to the release id and the production environment, failing under failure policy Fail on a rejected or expired gate, and promote-production carries failure policy Compensate with the rollback compensation that opens a new promotion of the previous release, exactly as model/workflows/release.yaml declares.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The agent step promote-production requests the production promotion first, and the human step approve-production that follows opens no approval of its own and waits on the promotion gate of EnvironmentPromotionService with subject kind promotion, bound to the release id and the production environment, failing under failure policy Fail on a rejected or expired gate, and promote-production carries failure policy Compensate with the rollback compensation that opens a new promotion of the previous release, exactly as model/workflows/release.yaml declares."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10504,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-341]",
      "number": 341
    },
    {
      "id": "AIFACTORY-TASK-4748",
      "type": "task",
      "parent": "AIFACTORY-US-1192",
      "title": "Fixture production decisions and promotion outcomes",
      "sequence": "19.10.04.02",
      "description": "Fixture production decisions and promotion outcomes. Expected output: Recorded approving, rejecting and expiring decisions of the promotion gate bound to the release id and the production environment, a decision attempted by the requester, and a succeeding, a failing and an Uncertain production promotion with the expected rollback promotion and RollbackCompleted, as the oracle of SCN-release-004 and SCN-release-005.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded approving, rejecting and expiring decisions of the promotion gate bound to the release id and the production environment, a decision attempted by the requester, and a succeeding, a failing and an Uncertain production promotion with the expected rollback promotion and RollbackCompleted, as the oracle of SCN-release-004 and SCN-release-005."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10504,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4748]",
      "number": 4748
    },
    {
      "id": "AIFACTORY-TASK-4749",
      "type": "task",
      "parent": "AIFACTORY-US-1192",
      "title": "Prove the production approval and the production promotion on the fixture",
      "sequence": "19.10.04.03",
      "description": "Prove the production approval and the production promotion on the fixture. Expected output: A fixture run proves SCN-release-004 and SCN-release-005 (AC1 to AC5 of AIFACTORY-US-1192); no approval request opened by the engine, the requester refused as decider, one production promotion requested before the waiting step and handed off only after an approving gate decision, the rejecting and expiring decisions ending in WorkflowRunFailed naming approve-production and RunFailed once, the rollback compensation as a new promotion of the previous release without approval, the failed promotion ending RolledBack with RollbackCompleted, and no second rollback when PromotionFailed reports rolledBack true.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-release-004 and SCN-release-005 (AC1 to AC5 of AIFACTORY-US-1192); no approval request opened by the engine, the requester refused as decider, one production promotion requested before the waiting step and handed off only after an approving gate decision, the rejecting and expiring decisions ending in WorkflowRunFailed naming approve-production and RunFailed once, the rollback compensation as a new promotion of the previous release without approval, the failed promotion ending RolledBack with RollbackCompleted, and no second rollback when PromotionFailed reports rolledBack true."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10504,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4749]",
      "number": 4749
    },
    {
      "id": "AIFACTORY-US-1193",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-116",
      "title": "The Release Manager verifies the production promotion and records the evidence, and a failed verification rolls production back",
      "sequence": "19.10.05",
      "description": "As a reviewer of the project, I want the production promotion verified on health and smoke results and the evidence recorded, and a failed verification answered by a rollback to the previous release, so that every production promotion ends either verified with evidence or rolled back with the evidence of the failure. The last agent step of `release`. When `approve-production` completed on the approved gate and the promotion was handed off (D139), the engine marks `verify` ready and resolves `pipeline-results` from `input.pipeline-results`, `release` from `input.release` and `production-promotion` from `steps.promote-production.production-promotion`. The `release-manager` release runs the skill `release-manager-verify` in read class with `knowledge-search` and `read-range`: it reads the health and smoke results of the promotion and writes `promotion-evidence` (artifact-v1), which is the run output and is recorded once under the run envelope. When the verification holds the run completes with exactly one Completed outcome. The step follows the effect of `promote-production` and declares `failure_policy` Compensate (D133): a Failed attempt of failure class transient is retried under the declared exponential budget of 3 attempts with backoff 30s, while any other failure class, a failed verification included, is not retried. When the step settles Failed on a failed verification, a timeout PT30M or a spent budget, the engine moves the run to Compensating and emits `CompensationStarted`; the compensations of the succeeded steps run in reverse order, and since the effect of `promote-production` is confirmed its compensation requests the rollback to the previous release, which opens a new promotion of that release without an approval (D135), and records the incident link. `WorkflowRunFailed` names `verify` with compensated true and `RunFailed` follows once; the evidence of the failure stays recorded. Kind: behavior. Traces: workflows: release; steps: release/verify, release/promote-production; agents: release-manager; services: WorkflowEngineService, EnvironmentPromotionService; apis: EnvironmentPromotionService/RollbackPromotion; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, WorkflowEngineService/CompensationStarted, RunControlService/RunFailed; descriptors: artifact-v1; scenarios: SCN-release-006; adrs: ADR-0014, ADR-0017; requirements: FR-10, XL-10. Depends on: AIFACTORY-US-1192, feature:environment-promotion-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/release.yaml, model/skills/devops-delivery/release-manager-verify.yaml, model/scenarios/release.yaml.",
      "acceptanceCriteria": [
        "AC1: Given release/promote-production succeeded and release/approve-production completed, when the engine marks release/verify ready, then `pipeline-results`, `release` and `production-promotion` are resolved from the mappings of model/workflows/release.yaml and `release-manager` executes the step on its pinned release (SCN-release-006).",
        "AC2: Given health and smoke results pass, when the step returns `promotion-evidence`, then the output is recorded once under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and the run output is set (SCN-release-006, ADR-0014).",
        "AC3: Given the verification fails, or an attempt exceeds PT30M or spends the exponential budget of 3 attempts, when Run Control settles the step Failed, then the engine emits WorkflowEngineService/CompensationStarted, the compensation of release/promote-production requests the rollback through EnvironmentPromotionService/RollbackPromotion, WorkflowEngineService/WorkflowRunFailed names `verify` with compensated true and RunControlService/RunFailed follows once; the evidence of the failure stays recorded (SCN-release-006, D133, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml",
        "model/skills/devops-delivery/release-manager-verify.yaml",
        "model/scenarios/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4750",
        "AIFACTORY-TASK-4751",
        "AIFACTORY-TASK-4752"
      ],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10505,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "release"
        ],
        "steps": [
          "release/verify",
          "release/promote-production"
        ],
        "agents": [
          "release-manager"
        ],
        "services": [
          "WorkflowEngineService",
          "EnvironmentPromotionService"
        ],
        "apis": [
          "EnvironmentPromotionService/RollbackPromotion"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "WorkflowEngineService/CompensationStarted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-release-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0017"
        ],
        "requirements": [
          "FR-10",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1192",
        "feature:environment-promotion-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/release.yaml",
        "model/skills/devops-delivery/release-manager-verify.yaml",
        "model/scenarios/release.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1193]",
      "number": 1193
    },
    {
      "id": "AIFACTORY-TASK-4750",
      "type": "task",
      "parent": "AIFACTORY-US-1193",
      "title": "Bind the verify skill and map the run output",
      "sequence": "19.10.05.01",
      "description": "Bind the verify skill and map the run output. Expected output: The step verify of the Draft release runs release-manager-verify with pipeline-results, release and production-promotion mapped as in model/workflows/release.yaml, and promotion-evidence is set as the run output.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step verify of the Draft release runs release-manager-verify with pipeline-results, release and production-promotion mapped as in model/workflows/release.yaml, and promotion-evidence is set as the run output."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10505,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4750]",
      "number": 4750
    },
    {
      "id": "AIFACTORY-TASK-4751",
      "type": "task",
      "parent": "AIFACTORY-US-1193",
      "title": "Fixture passing and failing verifications",
      "sequence": "19.10.05.02",
      "description": "Fixture passing and failing verifications. Expected output: Recorded health and smoke results of a verified and of a failed production promotion with the expected promotion-evidence and the expected failed run with compensated true and one rollback request, as the oracle of SCN-release-006.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Recorded health and smoke results of a verified and of a failed production promotion with the expected promotion-evidence and the expected failed run with compensated true and one rollback request, as the oracle of SCN-release-006."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10505,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4751]",
      "number": 4751
    },
    {
      "id": "AIFACTORY-TASK-4752",
      "type": "task",
      "parent": "AIFACTORY-US-1193",
      "title": "Prove the verification and the failed verification on the fixture",
      "sequence": "19.10.05.03",
      "description": "Prove the verification and the failed verification on the fixture. Expected output: A fixture run proves SCN-release-006 (AC1 to AC3 of AIFACTORY-US-1193); the evidence recorded once and the run completed, and a failed verification that emits CompensationStarted, requests one rollback of promote-production and ends the run Failed with WorkflowRunFailed naming verify with compensated true and RunFailed once.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-release-006 (AC1 to AC3 of AIFACTORY-US-1193); the evidence recorded once and the run completed, and a failed verification that emits CompensationStarted, requests one rollback of promote-production and ends the run Failed with WorkflowRunFailed naming verify with compensated true and RunFailed once."
      ],
      "sourceArtifacts": [
        "model/workflows/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 105,
      "phase": "factory",
      "stackRank": 10505,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4752]",
      "number": 4752
    },
    {
      "id": "AIFACTORY-FEAT-147",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Security blueprint",
      "sequence": "19.11",
      "description": "The workflow definition security-blueprint as a published asset: Builds the Security Blueprint from the validated Service Blueprint: threat model, roles and scopes per operation, data classification, secrets and key handling and the controls each threat maps to; validated against the DSL. It has 5 steps, names the agents security-architect and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I2: Deliver it. Build order 106 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-078",
        "AIFACTORY-US-1194",
        "AIFACTORY-US-1195",
        "AIFACTORY-US-1196"
      ],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10600,
      "titlePrefix": "[AIFACTORY-FEAT-147]",
      "number": 147
    },
    {
      "id": "AIFACTORY-US-078",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-147",
      "title": "The Security blueprint workflow runs from its published definition",
      "sequence": "19.11.01",
      "description": "As a requester, I want the security blueprint workflow to run from its published definition with the agents, tools and gates it declares, so that the Security Blueprint and its validation receipt are produced the same way on every run, with evidence. The integration PBI of the definition `security-blueprint`, the producing definition of the Security Blueprint kind (ADR-0030). When BlueprintService publishes `BlueprintValidated` with kind Service and passed true, WorkflowEngineService satisfies the one required readiness member `service-blueprint` (blueprint-service-v1) of the project scope and submits the run itself through `SubmitRun` of RunControlService with a service token that names the project and the bundle idempotency key (D131); the same Service Blueprint version returns the existing run and a newer version supersedes the open correlation. Run Control accepts the run and publishes `RunAccepted`; the engine loads the Published release the run pinned through AgentRegistryService and marks the five steps ready in the declared order: `model-threats`, `draft-security-blueprint`, `submit-version`, `validate` and `check-valid`. Agent steps run the `security-architect` release, the tool steps call `blueprint-submit-version` and `blueprint-validate`, and the condition loops back to the draft at most twice. Every step records exactly one outcome, the run reports exactly one outcome to Run Control (ADR-0014) and stays within the declared budget. Before any run, the definition release and the agent release of `security-architect`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release, no evaluation verdict is required before I4, and the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1194 to AIFACTORY-US-1196; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: security-blueprint; steps: security-blueprint/model-threats, security-blueprint/draft-security-blueprint, security-blueprint/submit-version, security-blueprint/validate, security-blueprint/check-valid; agents: security-architect; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService, BlueprintService; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, BlueprintService/BlueprintValidated, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-service-v1, blueprint-security-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0024, ADR-0026, ADR-0027, ADR-0030; requirements: FR-05, XL-10, XL-11. Depends on: AIFACTORY-US-1194, AIFACTORY-US-1195, AIFACTORY-US-1196, feature:wf-architecture-decomposition, feature:blueprint-service, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:agent-registry-service-publication. Sources: model/workflows/security-blueprint.yaml, model/agents/architecture/security-architect.yaml, docs/planes/agent-runtime/workflow-definitions/security-blueprint.md.",
      "acceptanceCriteria": [
        "AC1: Given BlueprintService/BlueprintValidated with kind Service and passed true for a project of the trusted tenant, when the readiness member `service-blueprint` is satisfied, then WorkflowEngineService/ReadinessRunSubmitted is emitted once and the run is submitted through RunControlService/SubmitRun with a service token naming the project (D131); a newer Service Blueprint version emits WorkflowEngineService/ReadinessSuperseded for the open correlation.",
        "AC2: Given the Published release of `security-blueprint`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter (D140), with its 5 steps, input mappings, retry policies, timeouts, the failure policy of each agent and tool step, the `idempotency_key` documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/security-blueprint.yaml, when RunControlService/RunAccepted arrives for a run that pinned it, then WorkflowEngineService/WorkflowRunStarted is emitted and security-blueprint/model-threats, security-blueprint/draft-security-blueprint, security-blueprint/submit-version, security-blueprint/validate and security-blueprint/check-valid become ready in that order, each agent step on the pinned Published release of `security-architect`, and no Draft release is loaded.",
        "AC3: Given every step succeeds and the receipt passed, when the run completes, then `security-blueprint` (blueprint-security-v1) and `validation-receipt` (blueprint-validation-receipt-v1) are the run outputs, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC4: Given a step spends its retry budget or the condition reaches its iteration limit, when the engine applies the compensation policy of model/workflows/security-blueprint.yaml, then WorkflowEngineService/WorkflowRunFailed names the step, the sandbox outputs stay as evidence, no Draft version is promoted and RunControlService/RunFailed is published exactly once (ADR-0026).",
        "AC5: Given the recorded fixture inputs of model/workflows/security-blueprint.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml",
        "model/agents/architecture/security-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/security-blueprint.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-344",
        "AIFACTORY-TASK-345",
        "AIFACTORY-TASK-346",
        "AIFACTORY-TASK-737"
      ],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10601,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "security-blueprint"
        ],
        "steps": [
          "security-blueprint/model-threats",
          "security-blueprint/draft-security-blueprint",
          "security-blueprint/submit-version",
          "security-blueprint/validate",
          "security-blueprint/check-valid"
        ],
        "agents": [
          "security-architect"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "BlueprintService"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-service-v1",
          "blueprint-security-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027",
          "ADR-0030"
        ],
        "requirements": [
          "FR-05",
          "XL-10",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1194",
        "AIFACTORY-US-1195",
        "AIFACTORY-US-1196",
        "feature:wf-architecture-decomposition",
        "feature:blueprint-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/security-blueprint.yaml",
        "model/agents/architecture/security-architect.yaml",
        "docs/planes/agent-runtime/workflow-definitions/security-blueprint.md"
      ],
      "titlePrefix": "[AIFACTORY-US-078]",
      "number": 78
    },
    {
      "id": "AIFACTORY-TASK-344",
      "type": "task",
      "parent": "AIFACTORY-US-078",
      "title": "Author, submit and publish the release of the workflow definition security-blueprint with its agent release",
      "sequence": "19.11.01.01",
      "description": "Author, submit and publish the release of the workflow definition security-blueprint with its agent release. Expected output: The release of security-blueprint (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy Retry of each agent and tool step, the idempotency_key documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/security-blueprint.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent release security-architect of AIFACTORY-TASK-345 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of security-blueprint (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy Retry of each agent and tool step, the idempotency_key documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/security-blueprint.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent release security-architect of AIFACTORY-TASK-345 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-344]",
      "number": 344
    },
    {
      "id": "AIFACTORY-TASK-345",
      "type": "task",
      "parent": "AIFACTORY-US-078",
      "title": "Author the agent release security-architect with its prompts and skills",
      "sequence": "19.11.01.02",
      "description": "Author the agent release security-architect with its prompts and skills. Expected output: A Draft release of security-architect with its instructions, the skills security-architect-model-threats and security-architect-draft-security-blueprint among its bound skills, the tool bindings and the model profile of model/agents/architecture/security-architect.yaml; the release passes a smoke run on a fixture Service Blueprint in the template tests and is submitted for publication by AIFACTORY-TASK-344, and no evaluation verdict is required for its publication before I4 (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of security-architect with its instructions, the skills security-architect-model-threats and security-architect-draft-security-blueprint among its bound skills, the tool bindings and the model profile of model/agents/architecture/security-architect.yaml; the release passes a smoke run on a fixture Service Blueprint in the template tests and is submitted for publication by AIFACTORY-TASK-344, and no evaluation verdict is required for its publication before I4 (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-345]",
      "number": 345
    },
    {
      "id": "AIFACTORY-TASK-346",
      "type": "task",
      "parent": "AIFACTORY-US-078",
      "title": "Fixture run of security-blueprint against recorded inputs",
      "sequence": "19.11.01.03",
      "description": "Fixture run of security-blueprint against recorded inputs. Expected output: The definition runs end to end on a fixture Service Blueprint in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-344; every step output validates against its descriptor (AC1 to AC3 and AC5 of AIFACTORY-US-078).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture Service Blueprint in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-344; every step output validates against its descriptor (AC1 to AC3 and AC5 of AIFACTORY-US-078)."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-346]",
      "number": 346
    },
    {
      "id": "AIFACTORY-TASK-737",
      "type": "task",
      "parent": "AIFACTORY-US-078",
      "title": "Verify security-blueprint-runs-from-its-definition by running the declared command",
      "sequence": "19.11.01.04",
      "description": "Verify security-blueprint-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-078, including the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of security-blueprint and security-architect that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-078, including the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of security-blueprint and security-architect that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-737]",
      "number": 737
    },
    {
      "id": "AIFACTORY-US-1194",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-147",
      "title": "The Security Architect models the threats and drafts the Security Blueprint from the Service Blueprint",
      "sequence": "19.11.02",
      "description": "As a requester, I want the threats of my service modelled per bounded context and a Security Blueprint drafted with a control for each of them, so that roles, scopes, data classification and secrets are designed before any code is generated. The two agent steps of `security-blueprint`. When the engine marks `model-threats` ready it resolves `service-blueprint` from `input.service-blueprint` (blueprint-service-v1); the `security-architect` release runs the skill `security-architect-model-threats` in read class with `knowledge-search`, `graph-query`, `list-files` and `read-range` and writes `threat-model` (artifact-v1): the assets, trust boundaries and threats per bounded context of the Service Blueprint with the data classification each context handles. When `draft-security-blueprint` becomes ready it receives the same `service-blueprint` plus `threat-model` from `steps.model-threats.threat-model`, and on a revision pass the findings of the last validation receipt as feedback; the skill `security-architect-draft-security-blueprint` writes, in sandbox class, the Security Blueprint against blueprint-security-v1: roles, scopes and policies per operation, the control for every modelled threat, the secret and key handling and the scan gates the pipeline must enforce, addressing the rules SEC-001 to SEC-004. Neither step touches a shared system or needs an approval. Both declare `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, an attempt of any other failure class is not retried, and a step that exceeds PT30M or spends its budget fails the run with the evidence. Kind: behavior. Traces: workflows: security-blueprint; steps: security-blueprint/model-threats, security-blueprint/draft-security-blueprint; agents: security-architect; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/StepSettled; descriptors: blueprint-service-v1, artifact-v1, blueprint-security-v1; scenarios: SCN-security-blueprint-001, SCN-security-blueprint-002; adrs: ADR-0014, ADR-0026, ADR-0030; requirements: FR-05, XL-11. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/security-blueprint.yaml, model/skills/architecture/security-architect-model-threats.yaml, model/skills/architecture/security-architect-draft-security-blueprint.yaml, model/blueprints.yaml, model/scenarios/security-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `service-blueprint`, when `security-architect` executes security-blueprint/model-threats, then `threat-model` (artifact-v1) is recorded once under the run envelope with assets, trust boundaries, threats and the data classification of every bounded context (SCN-security-blueprint-001).",
        "AC2: Given `steps.model-threats.threat-model` is recorded, when security-blueprint/draft-security-blueprint runs, then `security-blueprint-draft` validates against blueprint-security-v1, maps every modelled threat to a control and every operation to a scope and a role, and is recorded once under the run envelope (SCN-security-blueprint-002).",
        "AC3: Given a revision pass after security-blueprint/check-valid took its false branch, when security-blueprint/draft-security-blueprint re-runs, then the findings of `steps.validate.validation-receipt` are in its context as feedback and the new draft addresses each finding by rule id (SEC-001 to SEC-004) or schema path (SCN-security-blueprint-002, ADR-0026).",
        "AC4: Given an attempt of either step exceeds PT30M, settles Failed with a non-transient failure class, or spends the exponential budget of 3 attempts, when Run Control settles the step through RunControlService/StepSettled, then WorkflowEngineService/WorkflowRunFailed names the step, the sandbox output stays in place and no shared system is changed (SCN-security-blueprint-001, SCN-security-blueprint-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml",
        "model/skills/architecture/security-architect-model-threats.yaml",
        "model/skills/architecture/security-architect-draft-security-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4753",
        "AIFACTORY-TASK-4754",
        "AIFACTORY-TASK-4755"
      ],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10602,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "security-blueprint"
        ],
        "steps": [
          "security-blueprint/model-threats",
          "security-blueprint/draft-security-blueprint"
        ],
        "agents": [
          "security-architect"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/StepSettled"
        ],
        "descriptors": [
          "blueprint-service-v1",
          "artifact-v1",
          "blueprint-security-v1"
        ],
        "scenarios": [
          "SCN-security-blueprint-001",
          "SCN-security-blueprint-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026",
          "ADR-0030"
        ],
        "requirements": [
          "FR-05",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/security-blueprint.yaml",
        "model/skills/architecture/security-architect-model-threats.yaml",
        "model/skills/architecture/security-architect-draft-security-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/security-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1194]",
      "number": 1194
    },
    {
      "id": "AIFACTORY-TASK-4753",
      "type": "task",
      "parent": "AIFACTORY-US-1194",
      "title": "Recorded fixture of a Service Blueprint with its expected threat model and Security Blueprint",
      "sequence": "19.11.02.01",
      "description": "Recorded fixture of a Service Blueprint with its expected threat model and Security Blueprint. Expected output: A fixture Service Blueprint with the expected threat model (artifact-v1) and the expected Security Blueprint draft (blueprint-security-v1), plus a receipt with SEC-002 and SEC-004 findings as feedback for the revision pass of SCN-security-blueprint-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture Service Blueprint with the expected threat model (artifact-v1) and the expected Security Blueprint draft (blueprint-security-v1), plus a receipt with SEC-002 and SEC-004 findings as feedback for the revision pass of SCN-security-blueprint-002."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10602,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4753]",
      "number": 4753
    },
    {
      "id": "AIFACTORY-TASK-4754",
      "type": "task",
      "parent": "AIFACTORY-US-1194",
      "title": "Verify the input mappings and skill selection of the two agent steps in the Draft release",
      "sequence": "19.11.02.02",
      "description": "Verify the input mappings and skill selection of the two agent steps in the Draft release. Expected output: The steps model-threats and draft-security-blueprint of the Draft release authored by AIFACTORY-TASK-344 resolve service-blueprint and threat-model exactly as mapped in model/workflows/security-blueprint.yaml and select the skills security-architect-model-threats and security-architect-draft-security-blueprint.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps model-threats and draft-security-blueprint of the Draft release authored by AIFACTORY-TASK-344 resolve service-blueprint and threat-model exactly as mapped in model/workflows/security-blueprint.yaml and select the skills security-architect-model-threats and security-architect-draft-security-blueprint."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4754]",
      "number": 4754
    },
    {
      "id": "AIFACTORY-TASK-4755",
      "type": "task",
      "parent": "AIFACTORY-US-1194",
      "title": "Prove the threat and draft steps on the fixture",
      "sequence": "19.11.02.03",
      "description": "Prove the threat and draft steps on the fixture. Expected output: A fixture run proves SCN-security-blueprint-001 and SCN-security-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1194); the outputs validate against artifact-v1 and blueprint-security-v1, the revision pass addresses each finding, and the retry exhaustion ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-security-blueprint-001 and SCN-security-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1194); the outputs validate against artifact-v1 and blueprint-security-v1, the revision pass addresses each finding, and the retry exhaustion ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4755]",
      "number": 4755
    },
    {
      "id": "AIFACTORY-US-1195",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-147",
      "title": "The Security Blueprint draft is stored as a project-scope Draft version and validated with a receipt",
      "sequence": "19.11.03",
      "description": "As a requester, I want the drafted Security Blueprint stored as a Draft version of my project and validated against its schema and the SEC rules, so that a verdict with findings exists for every draft before infrastructure is planned on it. The two tool steps of `security-blueprint`; they reuse the tool bindings of `blueprint-submit-version` and `blueprint-validate` that the feature wf-vision-to-blueprint delivers and fork nothing. When `submit-version` becomes ready the engine resolves `document` from `steps.draft-security-blueprint.security-blueprint-draft` and emits `StepReady` with action class shared-write; Run Control dispatches the attempt and the invocation goes through the pipeline of ToolAdapterService. Draft versions are autonomous by default; when the project policy gates blueprint drafts, Policy.Decide answers allow-with-approval for the action kind tool-invocation and an approval whose subject is the run is requested, bound to the invocation request hash, which covers the document hash, with proposal kind tool-invocation; the run waits WaitingForApproval and the write happens only on an approving decision (D64, D129). The tool stores the document as a project-scope Draft BlueprintVersion of kind Security, idempotent on its document hash, and returns `version-ref` (blueprint-version-ref-v1). The step declares `failure_policy` Retry with `idempotency_key` documentHash, so a Failed attempt of failure class transient is retried under the fixed budget of 2 attempts with backoff 10s (D114); an Uncertain attempt is never retried automatically and waits for an operator decision with a finding (D119). When `validate` becomes ready the tool `blueprint-validate` validates the version against blueprint-security-v1 and the rules SEC-001 to SEC-004 in sandbox class and returns `validation-receipt` (blueprint-validation-receipt-v1) with passed, documentHash and findings; a receipt with passed false is a successful step output. A version reference of another tenant is answered NOT_FOUND and the attempt takes failure class permanent (ADR-0015). Kind: behavior. Traces: workflows: security-blueprint; steps: security-blueprint/submit-version, security-blueprint/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, ToolAdapterService, RunControlService, WorkflowEngineService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, ToolAdapterService/ConfirmToolEffect; events: BlueprintService/BlueprintValidated, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-security-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-security-blueprint-003, SCN-security-blueprint-004; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-05, XL-10. Depends on: AIFACTORY-US-1194, feature:wf-vision-to-blueprint, feature:blueprint-service, feature:tool-adapter-service, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/security-blueprint.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/scenarios/security-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-security-blueprint.security-blueprint-draft` is recorded and the project policy does not gate blueprint drafts, when security-blueprint/submit-version runs `blueprint-submit-version` through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Security exists in project scope, `version-ref` is recorded once and the same document submitted again returns the same version (SCN-security-blueprint-003, D64).",
        "AC2: Given the project policy gates blueprint drafts, when security-blueprint/submit-version is reached, then RunControlService/ApprovalRequested is published for the run bound to the invocation request hash with proposal kind tool-invocation before any write, BlueprintService/Blueprints.SubmitDraftVersion is called only on an approving RunControlService/ApprovalDecided, and a rejected or expired decision ends in ToolAdapterService/ToolInvocationDenied with no Draft version (SCN-security-blueprint-003, ADR-0026).",
        "AC3: Given a submit attempt settles Failed with failure class transient, when Run Control evaluates it, then it is retried under the fixed budget of 2 attempts because the step declares `idempotency_key` documentHash; given it settles Uncertain, then ToolAdapterService/ToolEffectUncertain is emitted, it is not retried and the step waits until an operator settles it through ToolAdapterService/ConfirmToolEffect (SCN-security-blueprint-003, ADR-0014).",
        "AC4: Given `steps.submit-version.version-ref` is recorded, when security-blueprint/validate runs `blueprint-validate` through BlueprintService/Blueprints.Validate, then `validation-receipt` with passed, documentHash and findings by rule id SEC-001 to SEC-004 or schema path is recorded once whether it passed or not, and BlueprintService/BlueprintValidated is emitted with passed true or false (SCN-security-blueprint-004, ADR-0026).",
        "AC5: Given the version reference belongs to another tenant, or a validate attempt exceeds PT5M or spends the fixed budget of 2 attempts, when the step settles, then a foreign reference is answered NOT_FOUND with no receipt and failure class permanent without a retry, and WorkflowEngineService/WorkflowRunFailed names the step (SCN-security-blueprint-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/scenarios/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4756",
        "AIFACTORY-TASK-4757",
        "AIFACTORY-TASK-4758"
      ],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10603,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "security-blueprint"
        ],
        "steps": [
          "security-blueprint/submit-version",
          "security-blueprint/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "ToolAdapterService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-security-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-security-blueprint-003",
          "SCN-security-blueprint-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-05",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1194",
        "feature:wf-vision-to-blueprint",
        "feature:blueprint-service",
        "feature:tool-adapter-service",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/security-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/scenarios/security-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1195]",
      "number": 1195
    },
    {
      "id": "AIFACTORY-TASK-4756",
      "type": "task",
      "parent": "AIFACTORY-US-1195",
      "title": "Bind the submit and validate steps to the shared blueprint tool bindings",
      "sequence": "19.11.03.01",
      "description": "Bind the submit and validate steps to the shared blueprint tool bindings. Expected output: The steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate as delivered by the feature wf-vision-to-blueprint, with document and version-ref mapped as in model/workflows/security-blueprint.yaml and the idempotency_key documentHash on submit-version.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate as delivered by the feature wf-vision-to-blueprint, with document and version-ref mapped as in model/workflows/security-blueprint.yaml and the idempotency_key documentHash on submit-version."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4756]",
      "number": 4756
    },
    {
      "id": "AIFACTORY-TASK-4757",
      "type": "task",
      "parent": "AIFACTORY-US-1195",
      "title": "Fixture Security Blueprint documents with their expected receipts",
      "sequence": "19.11.03.02",
      "description": "Fixture Security Blueprint documents with their expected receipts. Expected output: One fixture document that passes SEC-001 to SEC-004 and one that fails SEC-001, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1, plus a version reference of another tenant with the expected NOT_FOUND, as the oracle of SCN-security-blueprint-003 and SCN-security-blueprint-004.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture document that passes SEC-001 to SEC-004 and one that fails SEC-001, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1, plus a version reference of another tenant with the expected NOT_FOUND, as the oracle of SCN-security-blueprint-003 and SCN-security-blueprint-004."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10603,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4757]",
      "number": 4757
    },
    {
      "id": "AIFACTORY-TASK-4758",
      "type": "task",
      "parent": "AIFACTORY-US-1195",
      "title": "Prove the submit and validate steps on the fixture",
      "sequence": "19.11.03.03",
      "description": "Prove the submit and validate steps on the fixture. Expected output: A fixture run proves SCN-security-blueprint-003 and SCN-security-blueprint-004 (AC1 to AC5 of AIFACTORY-US-1195), including the idempotent resubmission, the gated path with ApprovalRequested and ToolInvocationDenied, the transient retry, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the foreign version reference answered NOT_FOUND.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-security-blueprint-003 and SCN-security-blueprint-004 (AC1 to AC5 of AIFACTORY-US-1195), including the idempotent resubmission, the gated path with ApprovalRequested and ToolInvocationDenied, the transient retry, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the foreign version reference answered NOT_FOUND."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4758]",
      "number": 4758
    },
    {
      "id": "AIFACTORY-US-1196",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-147",
      "title": "The engine checks the Security Blueprint receipt and sends findings back to the draft at most twice",
      "sequence": "19.11.04",
      "description": "As a requester, I want a failed validation of my Security Blueprint to return its findings to the draft a bounded number of times and then fail with the report, so that the blueprint improves on real findings without looping forever or hiding the verdict. The condition step of `security-blueprint`. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; a condition step never retries, never calls a service and completes within PT1M. When the receipt passed, the condition completes with one outcome and, being the last step, the run completes with the validated draft as `security-blueprint` and the receipt as `validation-receipt`. When it did not, the engine takes the `on_false` branch to `draft-security-blueprint` with `steps.validate.validation-receipt` as feedback: the draft, submit and validate steps re-run in order, the revised document gets its own Draft version and its own receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the last iteration the run fails with the validation report as its evidence, `WorkflowRunFailed` names `check-valid` with the failure class validation, Run Control records Failed exactly once and every Draft version created on the way stays a Draft. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026, D61). Kind: behavior. Traces: workflows: security-blueprint; steps: security-blueprint/check-valid, security-blueprint/draft-security-blueprint; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1, blueprint-security-v1; scenarios: SCN-security-blueprint-005, SCN-security-blueprint-006; adrs: ADR-0014, ADR-0026; requirements: FR-05. Depends on: AIFACTORY-US-1195, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/security-blueprint.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/security-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates security-blueprint/check-valid, then the condition completes with one outcome, no service is called and the run completes with WorkflowEngineService/WorkflowRunCompleted once (SCN-security-blueprint-005).",
        "AC2: Given the recorded receipt has `passed` false and fewer than 2 iterations were counted, when the engine evaluates security-blueprint/check-valid, then it takes the false branch to security-blueprint/draft-security-blueprint with the receipt as feedback and the iteration count rises by one (SCN-security-blueprint-006).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates the condition, then WorkflowEngineService/WorkflowRunFailed names `check-valid` with failure class validation and the report as evidence, RunControlService/RunFailed is published exactly once and no Draft version is promoted (SCN-security-blueprint-006, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable, or the evaluation exceeds PT1M, when the engine evaluates security-blueprint/check-valid, then the condition is not retried, it fails with evidence and the run follows the compensation policy of model/workflows/security-blueprint.yaml (SCN-security-blueprint-005, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4759",
        "AIFACTORY-TASK-4760",
        "AIFACTORY-TASK-4761"
      ],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10604,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "security-blueprint"
        ],
        "steps": [
          "security-blueprint/check-valid",
          "security-blueprint/draft-security-blueprint"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1",
          "blueprint-security-v1"
        ],
        "scenarios": [
          "SCN-security-blueprint-005",
          "SCN-security-blueprint-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1195",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/security-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/security-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1196]",
      "number": 1196
    },
    {
      "id": "AIFACTORY-TASK-4759",
      "type": "task",
      "parent": "AIFACTORY-US-1196",
      "title": "Map the run outputs from the passing draft and its receipt",
      "sequence": "19.11.04.01",
      "description": "Map the run outputs from the passing draft and its receipt. Expected output: When check-valid holds the run outputs security-blueprint and validation-receipt of the Draft release are set from the draft that passed and its receipt, as model/workflows/security-blueprint.yaml declares.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "When check-valid holds the run outputs security-blueprint and validation-receipt of the Draft release are set from the draft that passed and its receipt, as model/workflows/security-blueprint.yaml declares."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4759]",
      "number": 4759
    },
    {
      "id": "AIFACTORY-TASK-4760",
      "type": "task",
      "parent": "AIFACTORY-US-1196",
      "title": "Fixture receipt sequences for the pass, loop and limit paths",
      "sequence": "19.11.04.02",
      "description": "Fixture receipt sequences for the pass, loop and limit paths. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10604,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4760]",
      "number": 4760
    },
    {
      "id": "AIFACTORY-TASK-4761",
      "type": "task",
      "parent": "AIFACTORY-US-1196",
      "title": "Prove the condition and the bounded loop on the fixture",
      "sequence": "19.11.04.03",
      "description": "Prove the condition and the bounded loop on the fixture. Expected output: A fixture run proves SCN-security-blueprint-005 and SCN-security-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1196); one outcome on pass, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-security-blueprint-005 and SCN-security-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1196); one outcome on pass, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/security-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 106,
      "phase": "factory",
      "stackRank": 10604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4761]",
      "number": 4761
    },
    {
      "id": "AIFACTORY-FEAT-134",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Infrastructure plan",
      "sequence": "19.12",
      "description": "The workflow definition infrastructure-plan as a published asset: Derives the Infrastructure Blueprint and the Pulumi program from the module, database, security and observability blueprints, previews it in the sandbox and records the output; nothing is applied. It has 8 steps, names the agents infrastructure-architect, infrastructure-engineer and the tools blueprint-submit-version, blueprint-validate, shell-sandbox, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I2: Deliver it. Build order 107 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-031",
        "AIFACTORY-US-1197",
        "AIFACTORY-US-1198",
        "AIFACTORY-US-1199",
        "AIFACTORY-US-1200",
        "AIFACTORY-US-1201"
      ],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10700,
      "titlePrefix": "[AIFACTORY-FEAT-134]",
      "number": 134
    },
    {
      "id": "AIFACTORY-US-031",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-134",
      "title": "The infrastructure of a product is planned from its design",
      "sequence": "19.12.01",
      "description": "As an operator, I want the Infrastructure Blueprint of a product produced from its validated design, with a previewed infrastructure program, so that delivery never waits for a person to write a blueprint, and I read a plan before anything is provisioned. The integration PBI of the definition `infrastructure-plan`. When BlueprintService has published `BlueprintValidated` with passed true for the Module, Database, Security and Observability Blueprints of a project, the last two produced by the definitions `security-blueprint` and `observability-blueprint`, WorkflowEngineService satisfies the four required readiness members `module-blueprints`, `database-blueprint`, `security-blueprint` and `observability-blueprint` of the project scope and submits the run itself through `SubmitRun` of RunControlService with a service token that names the project and the bundle idempotency key (D131); the same versions return the existing run and a newer version of any member supersedes the open correlation and starts a new one. Run Control accepts the run and publishes `RunAccepted`; the engine loads the Published release the run pinned through AgentRegistryService and marks the eight steps ready in the declared order: `derive-topology`, `draft-blueprint`, `submit-version`, `validate`, `check-valid`, `generate-pulumi`, `preview` and `record-outputs`, with the agents `infrastructure-architect` and `infrastructure-engineer` on their pinned releases. Nothing is applied: the program is previewed in the sandbox only (ADR-0004). Every step records exactly one outcome and the run reports exactly one outcome to Run Control (ADR-0014). Before any run, the definition release and the agent releases of its two agents, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release, no evaluation verdict is required before I4, and the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1197 to AIFACTORY-US-1201; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: services: WorkflowEngineService, RunControlService, BlueprintService, ToolAdapterService, ArtifactService, AgentRegistryService; workflows: infrastructure-plan; steps: infrastructure-plan/derive-topology, infrastructure-plan/draft-blueprint, infrastructure-plan/submit-version, infrastructure-plan/validate, infrastructure-plan/check-valid, infrastructure-plan/generate-pulumi, infrastructure-plan/preview, infrastructure-plan/record-outputs; agents: infrastructure-architect, infrastructure-engineer; tools: blueprint-submit-version, blueprint-validate, shell-sandbox; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, BlueprintService/BlueprintValidated, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, RunControlService/RunAccepted, RunControlService/RunCompleted; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-module-v1, blueprint-database-v1, blueprint-security-v1, blueprint-observability-v1, blueprint-infrastructure-v1, change-set-v1; adrs: ADR-0004, ADR-0014, ADR-0017, ADR-0024, ADR-0027, ADR-0030; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1197, AIFACTORY-US-1198, AIFACTORY-US-1199, AIFACTORY-US-1200, AIFACTORY-US-1201, feature:wf-security-blueprint, feature:wf-observability-blueprint, feature:wf-module-blueprints, feature:wf-database-blueprint, feature:blueprint-service, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:agent-registry-service-publication. Sources: model/workflows/infrastructure-plan.yaml, docs/planes/agent-runtime/workflow-definitions/infrastructure-plan.md.",
      "acceptanceCriteria": [
        "AC1: Given BlueprintService/BlueprintValidated with passed true for the kinds Module, Database, Security and Observability of one project and tenant, when the last of the four members is satisfied, then WorkflowEngineService/ReadinessRunSubmitted is emitted once and the run is submitted through RunControlService/SubmitRun with a service token naming the project (D131); no run starts while a member is missing.",
        "AC2: Given one of the awaited blueprints gets a new validated version while a correlation is open, when the bundle is recomputed, then WorkflowEngineService/ReadinessSuperseded is emitted for the open correlation and a new run is submitted with the new fingerprint.",
        "AC3: Given the Published release of `infrastructure-plan`, authored exactly as in model/workflows/infrastructure-plan.yaml, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter (D140), when RunControlService/RunAccepted arrives for a run that pinned it, then WorkflowEngineService/WorkflowRunStarted is emitted and infrastructure-plan/derive-topology, infrastructure-plan/draft-blueprint, infrastructure-plan/submit-version, infrastructure-plan/validate, infrastructure-plan/check-valid, infrastructure-plan/generate-pulumi, infrastructure-plan/preview and infrastructure-plan/record-outputs become ready in that order, each agent step on the pinned Published release of its agent, and no Draft release is loaded.",
        "AC4: Given every step succeeds, when the run completes, then `infrastructure-blueprint` (blueprint-infrastructure-v1), `pulumi-program` (change-set-v1) and `validation-receipt` are the run outputs, nothing is applied to any environment, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0004, ADR-0014).",
        "AC5: Given the recorded fixture inputs of model/workflows/infrastructure-plan.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml",
        "docs/planes/agent-runtime/workflow-definitions/infrastructure-plan.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-353",
        "AIFACTORY-TASK-350",
        "AIFACTORY-TASK-351",
        "AIFACTORY-TASK-352",
        "AIFACTORY-TASK-729"
      ],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10701,
      "kind": "behavior",
      "traces": {
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "BlueprintService",
          "ToolAdapterService",
          "ArtifactService",
          "AgentRegistryService"
        ],
        "workflows": [
          "infrastructure-plan"
        ],
        "steps": [
          "infrastructure-plan/derive-topology",
          "infrastructure-plan/draft-blueprint",
          "infrastructure-plan/submit-version",
          "infrastructure-plan/validate",
          "infrastructure-plan/check-valid",
          "infrastructure-plan/generate-pulumi",
          "infrastructure-plan/preview",
          "infrastructure-plan/record-outputs"
        ],
        "agents": [
          "infrastructure-architect",
          "infrastructure-engineer"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate",
          "shell-sandbox"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-module-v1",
          "blueprint-database-v1",
          "blueprint-security-v1",
          "blueprint-observability-v1",
          "blueprint-infrastructure-v1",
          "change-set-v1"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0014",
          "ADR-0017",
          "ADR-0024",
          "ADR-0027",
          "ADR-0030"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1197",
        "AIFACTORY-US-1198",
        "AIFACTORY-US-1199",
        "AIFACTORY-US-1200",
        "AIFACTORY-US-1201",
        "feature:wf-security-blueprint",
        "feature:wf-observability-blueprint",
        "feature:wf-module-blueprints",
        "feature:wf-database-blueprint",
        "feature:blueprint-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/infrastructure-plan.yaml",
        "docs/planes/agent-runtime/workflow-definitions/infrastructure-plan.md"
      ],
      "titlePrefix": "[AIFACTORY-US-031]",
      "number": 31
    },
    {
      "id": "AIFACTORY-TASK-353",
      "type": "task",
      "parent": "AIFACTORY-US-031",
      "title": "Readiness start of the infrastructure plan on its four validated blueprints",
      "sequence": "19.12.01.01",
      "description": "Readiness start of the infrastructure plan on its four validated blueprints. Expected output: The infrastructure plan starts once per version set of its four awaited blueprints, only when all four members are validated, through SubmitRun with a service token naming the project, and a newer member version supersedes the open correlation (AC1 and AC2 of AIFACTORY-US-031).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The infrastructure plan starts once per version set of its four awaited blueprints, only when all four members are validated, through SubmitRun with a service token naming the project, and a newer member version supersedes the open correlation (AC1 and AC2 of AIFACTORY-US-031)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-353]",
      "number": 353
    },
    {
      "id": "AIFACTORY-TASK-350",
      "type": "task",
      "parent": "AIFACTORY-US-031",
      "title": "Author, submit and publish the release of the workflow definition infrastructure-plan with its agent releases",
      "sequence": "19.12.01.02",
      "description": "Author, submit and publish the release of the workflow definition infrastructure-plan with its agent releases. Expected output: The release of infrastructure-plan (workflow-definition-v1) authored with its 8 steps, input mappings, retry policies, timeouts, the failure policy Retry of each agent and tool step, the idempotency_key documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/infrastructure-plan.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases infrastructure-architect and infrastructure-engineer of AIFACTORY-TASK-351 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of infrastructure-plan (workflow-definition-v1) authored with its 8 steps, input mappings, retry policies, timeouts, the failure policy Retry of each agent and tool step, the idempotency_key documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/infrastructure-plan.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases infrastructure-architect and infrastructure-engineer of AIFACTORY-TASK-351 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-350]",
      "number": 350
    },
    {
      "id": "AIFACTORY-TASK-351",
      "type": "task",
      "parent": "AIFACTORY-US-031",
      "title": "Author the agent releases infrastructure-architect, infrastructure-engineer with their prompts and skills",
      "sequence": "19.12.01.03",
      "description": "Author the agent releases infrastructure-architect, infrastructure-engineer with their prompts and skills. Expected output: Draft releases of infrastructure-architect and infrastructure-engineer with their instructions, the skills infrastructure-architect-derive-topology, infrastructure-architect-draft-blueprint, infrastructure-engineer-generate-pulumi and infrastructure-engineer-record-outputs among their bound skills, tool bindings and model profiles; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-350, and no evaluation verdict is required for its publication before I4 (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of infrastructure-architect and infrastructure-engineer with their instructions, the skills infrastructure-architect-derive-topology, infrastructure-architect-draft-blueprint, infrastructure-engineer-generate-pulumi and infrastructure-engineer-record-outputs among their bound skills, tool bindings and model profiles; each release passes a smoke run on a fixture input in the template tests and is submitted for publication by AIFACTORY-TASK-350, and no evaluation verdict is required for its publication before I4 (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-351]",
      "number": 351
    },
    {
      "id": "AIFACTORY-TASK-352",
      "type": "task",
      "parent": "AIFACTORY-US-031",
      "title": "Fixture run of infrastructure-plan against recorded inputs",
      "sequence": "19.12.01.04",
      "description": "Fixture run of infrastructure-plan against recorded inputs. Expected output: The definition runs end to end on four fixture blueprints in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-350 with nothing applied; every step output validates against its descriptor (AC3 to AC5 of AIFACTORY-US-031).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on four fixture blueprints in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-350 with nothing applied; every step output validates against its descriptor (AC3 to AC5 of AIFACTORY-US-031)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-352]",
      "number": 352
    },
    {
      "id": "AIFACTORY-TASK-729",
      "type": "task",
      "parent": "AIFACTORY-US-031",
      "title": "Verify infrastructure-planned-from-design by running the declared command",
      "sequence": "19.12.01.05",
      "description": "Verify infrastructure-planned-from-design by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-031; the output names the Published release ids of infrastructure-plan, infrastructure-architect and infrastructure-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-031; the output names the Published release ids of infrastructure-plan, infrastructure-architect and infrastructure-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-729]",
      "number": 729
    },
    {
      "id": "AIFACTORY-US-1197",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-134",
      "title": "The Infrastructure Architect derives the topology and drafts the Infrastructure Blueprint from the four blueprints",
      "sequence": "19.12.02",
      "description": "As an operator, I want the deployment profile, regions, stores and pools of a product chosen from its validated design and written as an Infrastructure Blueprint, so that infrastructure follows the design and the residency rules instead of a hand-written plan. The two agent steps of the architect in `infrastructure-plan`. When the engine marks `derive-topology` ready it resolves `module-blueprints`, `database-blueprint`, `security-blueprint` and `observability-blueprint` from the run inputs of the same names; the `infrastructure-architect` release runs the skill `infrastructure-architect-derive-topology` in read class with `knowledge-search`, `graph-query`, `list-files` and `read-range` and writes `topology` (artifact-v1): the deployment profile, regions, stores and pools chosen from the blueprints and the NFR class (ADR-0017). When `draft-blueprint` becomes ready it receives the four blueprints and `topology` from `steps.derive-topology.topology`, and on a revision pass the findings of the last validation receipt as feedback; the skill `infrastructure-architect-draft-blueprint` writes, in sandbox class, the Infrastructure Blueprint against blueprint-infrastructure-v1, addressing the rules INF-001 to INF-003: a Pulumi program as the target (ADR-0004), regions that respect the residency rule of the tenant and production applies gated through promotions or provisioning runs. Neither step touches a shared system or needs an approval. Both declare `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, any other failure class is not retried, and a step that exceeds PT30M or spends its budget fails the run with the evidence. Kind: behavior. Traces: workflows: infrastructure-plan; steps: infrastructure-plan/derive-topology, infrastructure-plan/draft-blueprint; agents: infrastructure-architect; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/StepSettled; descriptors: blueprint-module-v1, blueprint-database-v1, blueprint-security-v1, blueprint-observability-v1, artifact-v1, blueprint-infrastructure-v1; scenarios: SCN-infrastructure-plan-001, SCN-infrastructure-plan-002; adrs: ADR-0004, ADR-0014, ADR-0017, ADR-0026; requirements: FR-11, XL-09. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/infrastructure-plan.yaml, model/skills/architecture/infrastructure-architect-derive-topology.yaml, model/skills/architecture/infrastructure-architect-draft-blueprint.yaml, model/blueprints.yaml, model/scenarios/infrastructure-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with the four blueprints, when `infrastructure-architect` executes infrastructure-plan/derive-topology, then `topology` (artifact-v1) is recorded once under the run envelope with the deployment profile, regions, stores and pools and the NFR class they follow (SCN-infrastructure-plan-001, ADR-0017).",
        "AC2: Given `steps.derive-topology.topology` is recorded, when infrastructure-plan/draft-blueprint runs, then `infrastructure-blueprint` validates against blueprint-infrastructure-v1, names a Pulumi program as the target and is recorded once (SCN-infrastructure-plan-002, ADR-0004).",
        "AC3: Given a revision pass after infrastructure-plan/check-valid took its false branch, when infrastructure-plan/draft-blueprint re-runs, then the findings of `steps.validate.validation-receipt` are in its context as feedback and the new draft addresses each finding by rule id (INF-001 to INF-003) or schema path (SCN-infrastructure-plan-002, ADR-0026).",
        "AC4: Given an attempt of either step exceeds PT30M, settles Failed with a non-transient failure class, or spends the exponential budget of 3 attempts, when Run Control settles the step through RunControlService/StepSettled, then WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-infrastructure-plan-001, SCN-infrastructure-plan-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml",
        "model/skills/architecture/infrastructure-architect-derive-topology.yaml",
        "model/skills/architecture/infrastructure-architect-draft-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4771",
        "AIFACTORY-TASK-4772",
        "AIFACTORY-TASK-4773"
      ],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10702,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "infrastructure-plan"
        ],
        "steps": [
          "infrastructure-plan/derive-topology",
          "infrastructure-plan/draft-blueprint"
        ],
        "agents": [
          "infrastructure-architect"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/StepSettled"
        ],
        "descriptors": [
          "blueprint-module-v1",
          "blueprint-database-v1",
          "blueprint-security-v1",
          "blueprint-observability-v1",
          "artifact-v1",
          "blueprint-infrastructure-v1"
        ],
        "scenarios": [
          "SCN-infrastructure-plan-001",
          "SCN-infrastructure-plan-002"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0014",
          "ADR-0017",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/infrastructure-plan.yaml",
        "model/skills/architecture/infrastructure-architect-derive-topology.yaml",
        "model/skills/architecture/infrastructure-architect-draft-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1197]",
      "number": 1197
    },
    {
      "id": "AIFACTORY-TASK-4771",
      "type": "task",
      "parent": "AIFACTORY-US-1197",
      "title": "Recorded fixture of the four blueprints with the expected topology and Infrastructure Blueprint",
      "sequence": "19.12.02.01",
      "description": "Recorded fixture of the four blueprints with the expected topology and Infrastructure Blueprint. Expected output: Fixture Module, Database, Security and Observability Blueprints with the expected topology (artifact-v1) and the expected Infrastructure Blueprint draft (blueprint-infrastructure-v1), plus a receipt with an INF-002 finding as feedback for the revision pass of SCN-infrastructure-plan-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Fixture Module, Database, Security and Observability Blueprints with the expected topology (artifact-v1) and the expected Infrastructure Blueprint draft (blueprint-infrastructure-v1), plus a receipt with an INF-002 finding as feedback for the revision pass of SCN-infrastructure-plan-002."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10702,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4771]",
      "number": 4771
    },
    {
      "id": "AIFACTORY-TASK-4772",
      "type": "task",
      "parent": "AIFACTORY-US-1197",
      "title": "Verify the input mappings and skill selection of the architect steps in the Draft release",
      "sequence": "19.12.02.02",
      "description": "Verify the input mappings and skill selection of the architect steps in the Draft release. Expected output: The steps derive-topology and draft-blueprint of the Draft release authored by AIFACTORY-TASK-350 resolve the four blueprints and topology exactly as mapped in model/workflows/infrastructure-plan.yaml and select the skills infrastructure-architect-derive-topology and infrastructure-architect-draft-blueprint.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps derive-topology and draft-blueprint of the Draft release authored by AIFACTORY-TASK-350 resolve the four blueprints and topology exactly as mapped in model/workflows/infrastructure-plan.yaml and select the skills infrastructure-architect-derive-topology and infrastructure-architect-draft-blueprint."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4772]",
      "number": 4772
    },
    {
      "id": "AIFACTORY-TASK-4773",
      "type": "task",
      "parent": "AIFACTORY-US-1197",
      "title": "Prove the topology and draft steps on the fixture",
      "sequence": "19.12.02.03",
      "description": "Prove the topology and draft steps on the fixture. Expected output: A fixture run proves SCN-infrastructure-plan-001 and SCN-infrastructure-plan-002 (AC1 to AC4 of AIFACTORY-US-1197); the outputs validate against artifact-v1 and blueprint-infrastructure-v1, the revision pass addresses each finding, and the retry exhaustion ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-infrastructure-plan-001 and SCN-infrastructure-plan-002 (AC1 to AC4 of AIFACTORY-US-1197); the outputs validate against artifact-v1 and blueprint-infrastructure-v1, the revision pass addresses each finding, and the retry exhaustion ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4773]",
      "number": 4773
    },
    {
      "id": "AIFACTORY-US-1198",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-134",
      "title": "The Infrastructure Blueprint draft is stored as a project-scope Draft version and validated with a receipt",
      "sequence": "19.12.03",
      "description": "As an operator, I want the drafted Infrastructure Blueprint stored as a Draft version of my project and validated against its schema and the INF rules, so that no infrastructure program is generated from a blueprint that has not passed validation. The two tool steps of `infrastructure-plan`; they reuse the tool bindings of `blueprint-submit-version` and `blueprint-validate` that the feature wf-vision-to-blueprint delivers and fork nothing. When `submit-version` becomes ready the engine resolves `document` from `steps.draft-blueprint.infrastructure-blueprint` and emits `StepReady` with action class shared-write; Run Control dispatches the attempt through the pipeline of ToolAdapterService. Draft versions are autonomous by default; when the project policy gates blueprint drafts, Policy.Decide answers allow-with-approval for the action kind tool-invocation and an approval whose subject is the run is requested, bound to the invocation request hash, which covers the document hash, with proposal kind tool-invocation; the run waits WaitingForApproval and the write happens only on an approving decision (D64, D129). The tool stores the document as a project-scope Draft BlueprintVersion of kind Infrastructure, idempotent on its document hash, and returns `version-ref` (blueprint-version-ref-v1). The step declares `failure_policy` Retry with `idempotency_key` documentHash, so a Failed attempt of failure class transient is retried under the fixed budget of 2 attempts with backoff 10s (D114); an Uncertain attempt is never retried automatically and waits for an operator decision with a finding (D119). When `validate` becomes ready the tool `blueprint-validate` validates the version against blueprint-infrastructure-v1 and the rules INF-001 to INF-003 in sandbox class and returns `validation-receipt` with passed, documentHash and findings; a receipt with passed false is a successful step output. A version reference of another tenant is answered NOT_FOUND and the attempt takes failure class permanent (ADR-0015). Kind: behavior. Traces: workflows: infrastructure-plan; steps: infrastructure-plan/submit-version, infrastructure-plan/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, ToolAdapterService, RunControlService, WorkflowEngineService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, ToolAdapterService/ConfirmToolEffect; events: BlueprintService/BlueprintValidated, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-infrastructure-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-infrastructure-plan-003, SCN-infrastructure-plan-004; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-11. Depends on: AIFACTORY-US-1197, feature:wf-vision-to-blueprint, feature:blueprint-service, feature:tool-adapter-service, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/infrastructure-plan.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/blueprints.yaml, model/scenarios/infrastructure-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-blueprint.infrastructure-blueprint` is recorded and the project policy does not gate blueprint drafts, when infrastructure-plan/submit-version runs through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Infrastructure exists in project scope, `version-ref` is recorded once and the same document submitted again returns the same version (SCN-infrastructure-plan-003, D64).",
        "AC2: Given the project policy gates blueprint drafts, when infrastructure-plan/submit-version is reached, then RunControlService/ApprovalRequested is published for the run bound to the invocation request hash with proposal kind tool-invocation before any write, the write happens only on an approving RunControlService/ApprovalDecided, and a rejected or expired decision ends in ToolAdapterService/ToolInvocationDenied with no Draft version (SCN-infrastructure-plan-003, ADR-0026).",
        "AC3: Given a submit attempt settles Failed with failure class transient, when Run Control evaluates it, then it is retried under the fixed budget of 2 attempts because the step declares `idempotency_key` documentHash; given it settles Uncertain, then ToolAdapterService/ToolEffectUncertain is emitted, it is not retried and the step waits until an operator settles it through ToolAdapterService/ConfirmToolEffect (SCN-infrastructure-plan-003, ADR-0014).",
        "AC4: Given `steps.submit-version.version-ref` is recorded, when infrastructure-plan/validate runs through BlueprintService/Blueprints.Validate, then `validation-receipt` with passed, documentHash and findings by rule id INF-001 to INF-003 or schema path is recorded once whether it passed or not, and BlueprintService/BlueprintValidated is emitted with passed true or false (SCN-infrastructure-plan-004).",
        "AC5: Given the version reference belongs to another tenant, or a validate attempt exceeds PT5M or spends the fixed budget of 2 attempts, when the step settles, then a foreign reference is answered NOT_FOUND with no receipt and failure class permanent without a retry, and WorkflowEngineService/WorkflowRunFailed names the step (SCN-infrastructure-plan-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/blueprints.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-354",
        "AIFACTORY-TASK-4774",
        "AIFACTORY-TASK-4775",
        "AIFACTORY-TASK-4776"
      ],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10703,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "infrastructure-plan"
        ],
        "steps": [
          "infrastructure-plan/submit-version",
          "infrastructure-plan/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "ToolAdapterService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-infrastructure-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-infrastructure-plan-003",
          "SCN-infrastructure-plan-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1197",
        "feature:wf-vision-to-blueprint",
        "feature:blueprint-service",
        "feature:tool-adapter-service",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/infrastructure-plan.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/blueprints.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1198]",
      "number": 1198
    },
    {
      "id": "AIFACTORY-TASK-354",
      "type": "task",
      "parent": "AIFACTORY-US-1198",
      "title": "Verify the Infrastructure rule set on the delivered BlueprintService",
      "sequence": "19.12.03.01",
      "description": "Verify the Infrastructure rule set on the delivered BlueprintService. Expected output: A fixture run proves that Blueprints.Validate evaluates INF-001 to INF-003 as delivered by the feature blueprint-service, returning a receipt with findings by rule id, severity and path for the fixture documents of the validate step; nothing of BlueprintService is implemented here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves that Blueprints.Validate evaluates INF-001 to INF-003 as delivered by the feature blueprint-service, returning a receipt with findings by rule id, severity and path for the fixture documents of the validate step; nothing of BlueprintService is implemented here."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-354]",
      "number": 354
    },
    {
      "id": "AIFACTORY-TASK-4774",
      "type": "task",
      "parent": "AIFACTORY-US-1198",
      "title": "Bind the submit and validate steps to the shared blueprint tool bindings",
      "sequence": "19.12.03.02",
      "description": "Bind the submit and validate steps to the shared blueprint tool bindings. Expected output: The steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate as delivered by the feature wf-vision-to-blueprint, with document and version-ref mapped as in model/workflows/infrastructure-plan.yaml and the idempotency_key documentHash on submit-version.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate as delivered by the feature wf-vision-to-blueprint, with document and version-ref mapped as in model/workflows/infrastructure-plan.yaml and the idempotency_key documentHash on submit-version."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4774]",
      "number": 4774
    },
    {
      "id": "AIFACTORY-TASK-4775",
      "type": "task",
      "parent": "AIFACTORY-US-1198",
      "title": "Fixture Infrastructure Blueprint documents with their expected receipts",
      "sequence": "19.12.03.03",
      "description": "Fixture Infrastructure Blueprint documents with their expected receipts. Expected output: One fixture document that passes INF-001 to INF-003 and one that fails INF-001 by naming Bicep, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1, plus a version reference of another tenant with the expected NOT_FOUND, as the oracle of SCN-infrastructure-plan-003 and SCN-infrastructure-plan-004.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture document that passes INF-001 to INF-003 and one that fails INF-001 by naming Bicep, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1, plus a version reference of another tenant with the expected NOT_FOUND, as the oracle of SCN-infrastructure-plan-003 and SCN-infrastructure-plan-004."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4775]",
      "number": 4775
    },
    {
      "id": "AIFACTORY-TASK-4776",
      "type": "task",
      "parent": "AIFACTORY-US-1198",
      "title": "Prove the submit and validate steps on the fixture",
      "sequence": "19.12.03.04",
      "description": "Prove the submit and validate steps on the fixture. Expected output: A fixture run proves SCN-infrastructure-plan-003 and SCN-infrastructure-plan-004 (AC1 to AC5 of AIFACTORY-US-1198), including the idempotent resubmission, the gated path, the transient retry, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the foreign version reference answered NOT_FOUND.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-infrastructure-plan-003 and SCN-infrastructure-plan-004 (AC1 to AC5 of AIFACTORY-US-1198), including the idempotent resubmission, the gated path, the transient retry, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the foreign version reference answered NOT_FOUND."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4776]",
      "number": 4776
    },
    {
      "id": "AIFACTORY-US-1199",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-134",
      "title": "The engine checks the Infrastructure Blueprint receipt and sends findings back to the draft at most twice",
      "sequence": "19.12.04",
      "description": "As an operator, I want a failed validation of the Infrastructure Blueprint to return its findings to the draft a bounded number of times and then fail with the report, so that the program is generated only from a validated blueprint and a failing blueprint never loops forever. The condition step of `infrastructure-plan`. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; a condition step never retries, never calls a service and completes within PT1M. When the receipt passed, the condition completes with one outcome and `generate-pulumi` becomes ready. When it did not, the engine takes the `on_false` branch to `draft-blueprint` with `steps.validate.validation-receipt` as feedback: the draft, submit and validate steps re-run in order, the revised document gets its own Draft version and its own receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the last iteration the run fails with the validation report as its evidence, `WorkflowRunFailed` names `check-valid` with the failure class validation, Run Control records Failed exactly once, no program is generated and every Draft version created on the way stays a Draft. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026, D61). Kind: behavior. Traces: workflows: infrastructure-plan; steps: infrastructure-plan/check-valid, infrastructure-plan/draft-blueprint; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1; scenarios: SCN-infrastructure-plan-005, SCN-infrastructure-plan-006; adrs: ADR-0014, ADR-0026; requirements: FR-11. Depends on: AIFACTORY-US-1198, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/infrastructure-plan.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/infrastructure-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates infrastructure-plan/check-valid, then the condition completes with one outcome, no service is called and infrastructure-plan/generate-pulumi becomes ready (SCN-infrastructure-plan-005).",
        "AC2: Given the recorded receipt has `passed` false and fewer than 2 iterations were counted, when the engine evaluates infrastructure-plan/check-valid, then it takes the false branch to infrastructure-plan/draft-blueprint with the receipt as feedback and the iteration count rises by one (SCN-infrastructure-plan-006).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates the condition, then WorkflowEngineService/WorkflowRunFailed names `check-valid` with failure class validation and the report as evidence, RunControlService/RunFailed is published exactly once and no program is generated (SCN-infrastructure-plan-006, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable, or the evaluation exceeds PT1M, when the engine evaluates infrastructure-plan/check-valid, then the condition is not retried, it fails with evidence and the run follows the compensation policy of model/workflows/infrastructure-plan.yaml (SCN-infrastructure-plan-005, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4777",
        "AIFACTORY-TASK-4778"
      ],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10704,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "infrastructure-plan"
        ],
        "steps": [
          "infrastructure-plan/check-valid",
          "infrastructure-plan/draft-blueprint"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-infrastructure-plan-005",
          "SCN-infrastructure-plan-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1198",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/infrastructure-plan.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1199]",
      "number": 1199
    },
    {
      "id": "AIFACTORY-TASK-4777",
      "type": "task",
      "parent": "AIFACTORY-US-1199",
      "title": "Fixture receipt sequences for the pass, loop and limit paths",
      "sequence": "19.12.04.01",
      "description": "Fixture receipt sequences for the pass, loop and limit paths. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of infrastructure-plan through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of infrastructure-plan through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10704,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4777]",
      "number": 4777
    },
    {
      "id": "AIFACTORY-TASK-4778",
      "type": "task",
      "parent": "AIFACTORY-US-1199",
      "title": "Prove the condition and the bounded loop on the fixture",
      "sequence": "19.12.04.02",
      "description": "Prove the condition and the bounded loop on the fixture. Expected output: A fixture run proves SCN-infrastructure-plan-005 and SCN-infrastructure-plan-006 (AC1 to AC4 of AIFACTORY-US-1199); generate-pulumi ready on pass, a loop back with feedback on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-infrastructure-plan-005 and SCN-infrastructure-plan-006 (AC1 to AC4 of AIFACTORY-US-1199); generate-pulumi ready on pass, a loop back with feedback on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10704,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4778]",
      "number": 4778
    },
    {
      "id": "AIFACTORY-US-1200",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-134",
      "title": "The Infrastructure Engineer generates the Pulumi program and previews it in the sandbox without applying it",
      "sequence": "19.12.05",
      "description": "As an operator, I want the infrastructure program generated from the validated blueprint and previewed against a sandbox stack, so that I read the planned changes, destructive ones flagged, before anything is provisioned. The generation and preview steps of `infrastructure-plan`. When `check-valid` held the engine marks `generate-pulumi` ready and resolves `infrastructure-blueprint` from `steps.draft-blueprint.infrastructure-blueprint` and `topology` from `steps.derive-topology.topology`. The `infrastructure-engineer` release runs the skill `infrastructure-engineer-generate-pulumi` in sandbox class with its bound tools `list-files`, `search-text`, `search-symbols`, `find-references`, `read-range`, `get-dependencies`, `get-git-diff`, `knowledge-search`, `apply-patch`, `write-file`, `shell-sandbox` and `build-and-test`, and generates the Pulumi program and its stack configuration in the run's isolated workspace (ADR-0004), returning `pulumi-program` (change-set-v1) with its diff reference and hash. The step declares `failure_policy` Retry with the exponential budget of 3 attempts. When `preview` becomes ready the tool `shell-sandbox` receives `pulumi-program` from `steps.generate-pulumi.pulumi-program` and runs the preview against the sandbox stack under the allow-list and block-list of the tool and its egress allow-list, auditing commandLine, exitCode, durationMs and sandbox; it returns `preview-report` (artifact-v1), in which every destructive operation of the diff is a finding. Nothing is applied to any environment: a command on the block-list is denied, and the step stays sandbox class. The preview declares `failure_policy` Retry: a Failed attempt of failure class transient is retried under the fixed budget of 2 attempts with backoff 10s, any other failure class is not retried, and a step that exceeds PT20M or spends its budget fails the run with the workspace output in place. Kind: behavior. Traces: workflows: infrastructure-plan; steps: infrastructure-plan/generate-pulumi, infrastructure-plan/preview; agents: infrastructure-engineer; tools: shell-sandbox; services: WorkflowEngineService, ToolAdapterService; events: ToolAdapterService/ToolInvocationDenied, RunControlService/StepSettled, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-infrastructure-v1, change-set-v1, artifact-v1; scenarios: SCN-infrastructure-plan-007, SCN-infrastructure-plan-008; adrs: ADR-0004, ADR-0014; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1199, feature:tool-adapter-service, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/infrastructure-plan.yaml, model/skills/devops-delivery/infrastructure-engineer-generate-pulumi.yaml, model/tools/shell-sandbox.yaml, model/scenarios/infrastructure-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given infrastructure-plan/check-valid held, when `infrastructure-engineer` executes infrastructure-plan/generate-pulumi, then `pulumi-program` (change-set-v1) with the program and stack configuration is recorded once under the run envelope and nothing leaves the isolated workspace (SCN-infrastructure-plan-007, ADR-0004).",
        "AC2: Given `steps.generate-pulumi.pulumi-program` is recorded, when infrastructure-plan/preview runs `shell-sandbox` against the sandbox stack, then `preview-report` (artifact-v1) is recorded once, every destructive operation of the diff is a finding, the audit record carries commandLine, exitCode, durationMs and sandbox, and no environment is changed (SCN-infrastructure-plan-008).",
        "AC3: Given a command of the preview matches the block-list of `shell-sandbox`, when the invocation is evaluated, then it is denied with ToolAdapterService/ToolInvocationDenied and the attempt fails without a retry (SCN-infrastructure-plan-008).",
        "AC4: Given an attempt of infrastructure-plan/generate-pulumi spends its exponential budget of 3 attempts or exceeds PT30M, or an attempt of infrastructure-plan/preview spends its fixed budget of 2 attempts or exceeds PT20M, when Run Control settles the step through RunControlService/StepSettled, then WorkflowEngineService/WorkflowRunFailed names the step (SCN-infrastructure-plan-007, SCN-infrastructure-plan-008, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml",
        "model/skills/devops-delivery/infrastructure-engineer-generate-pulumi.yaml",
        "model/tools/shell-sandbox.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-355",
        "AIFACTORY-TASK-4779",
        "AIFACTORY-TASK-4780"
      ],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10705,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "infrastructure-plan"
        ],
        "steps": [
          "infrastructure-plan/generate-pulumi",
          "infrastructure-plan/preview"
        ],
        "agents": [
          "infrastructure-engineer"
        ],
        "tools": [
          "shell-sandbox"
        ],
        "services": [
          "WorkflowEngineService",
          "ToolAdapterService"
        ],
        "events": [
          "ToolAdapterService/ToolInvocationDenied",
          "RunControlService/StepSettled",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-infrastructure-v1",
          "change-set-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-infrastructure-plan-007",
          "SCN-infrastructure-plan-008"
        ],
        "adrs": [
          "ADR-0004",
          "ADR-0014"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1199",
        "feature:tool-adapter-service",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/infrastructure-plan.yaml",
        "model/skills/devops-delivery/infrastructure-engineer-generate-pulumi.yaml",
        "model/tools/shell-sandbox.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1200]",
      "number": 1200
    },
    {
      "id": "AIFACTORY-TASK-355",
      "type": "task",
      "parent": "AIFACTORY-US-1200",
      "title": "Infrastructure program generation and sandbox preview",
      "sequence": "19.12.05.01",
      "description": "Infrastructure program generation and sandbox preview. Expected output: The infrastructure-engineer skill infrastructure-engineer-generate-pulumi generates the Pulumi program and stack configuration from the validated blueprint, and the preview step runs shell-sandbox against the sandbox stack and returns a preview report with destructive operations as findings (SCN-infrastructure-plan-007, SCN-infrastructure-plan-008).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The infrastructure-engineer skill infrastructure-engineer-generate-pulumi generates the Pulumi program and stack configuration from the validated blueprint, and the preview step runs shell-sandbox against the sandbox stack and returns a preview report with destructive operations as findings (SCN-infrastructure-plan-007, SCN-infrastructure-plan-008)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10705,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-355]",
      "number": 355
    },
    {
      "id": "AIFACTORY-TASK-4779",
      "type": "task",
      "parent": "AIFACTORY-US-1200",
      "title": "Fixture program and preview reports with and without destructive operations",
      "sequence": "19.12.05.02",
      "description": "Fixture program and preview reports with and without destructive operations. Expected output: The expected pulumi-program of the fixture blueprint and two recorded preview reports, one additive and one with a destructive operation flagged as a finding, plus a block-listed command with its expected denial, as the oracle of SCN-infrastructure-plan-007 and SCN-infrastructure-plan-008.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected pulumi-program of the fixture blueprint and two recorded preview reports, one additive and one with a destructive operation flagged as a finding, plus a block-listed command with its expected denial, as the oracle of SCN-infrastructure-plan-007 and SCN-infrastructure-plan-008."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10705,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4779]",
      "number": 4779
    },
    {
      "id": "AIFACTORY-TASK-4780",
      "type": "task",
      "parent": "AIFACTORY-US-1200",
      "title": "Prove the generation and the preview on the fixture",
      "sequence": "19.12.05.03",
      "description": "Prove the generation and the preview on the fixture. Expected output: A fixture run proves SCN-infrastructure-plan-007 and SCN-infrastructure-plan-008 (AC1 to AC4 of AIFACTORY-US-1200); the program and the report recorded once, the destructive operation reported as a finding, the block-listed command denied and nothing applied to any environment.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-infrastructure-plan-007 and SCN-infrastructure-plan-008 (AC1 to AC4 of AIFACTORY-US-1200); the program and the report recorded once, the destructive operation reported as a finding, the block-listed command denied and nothing applied to any environment."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10705,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4780]",
      "number": 4780
    },
    {
      "id": "AIFACTORY-US-1201",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-134",
      "title": "The Infrastructure Engineer records the blueprint, the program and the preview with lineage and the run completes",
      "sequence": "19.12.06",
      "description": "As an operator, I want the validated blueprint, the generated program and its preview recorded together with lineage, so that provisioning later starts from outputs that trace back to the design and to the preview I read. The last agent step of `infrastructure-plan`. When `preview` succeeded the engine marks `record-outputs` ready and resolves `infrastructure-blueprint` from `steps.draft-blueprint.infrastructure-blueprint`, `pulumi-program` from `steps.generate-pulumi.pulumi-program` and `preview-report` from `steps.preview.preview-report`. The `infrastructure-engineer` release runs the skill `infrastructure-engineer-record-outputs` in sandbox class: it assembles the generated outputs of the plan, the blueprint and the program with lineage to the preview report, and returns `generated-outputs` (change-set-v1). AgentRuntimeService records that output under the run envelope through `Artifacts.Store` of ArtifactService with the producer run, attempt and agent and the declared lineage, so exactly one new `ArtifactStored` results for it. The run then completes with `infrastructure-blueprint`, `pulumi-program` and `validation-receipt` as its outputs and Run Control records one Completed outcome. The step applies nothing, opens no proposal and requests no approval. It declares `failure_policy` Retry and is sandbox class, so a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s; an attempt that exceeds PT30M, fails with any other failure class or spends the budget fails the run with the evidence, and an output already stored is not written twice on recovery. Kind: behavior. Traces: workflows: infrastructure-plan; steps: infrastructure-plan/record-outputs; agents: infrastructure-engineer; services: WorkflowEngineService, AgentRuntimeService, ArtifactService; apis: ArtifactService/Artifacts.Store; events: ArtifactService/ArtifactStored, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-infrastructure-v1, change-set-v1, artifact-v1; scenarios: SCN-infrastructure-plan-009; adrs: ADR-0014; requirements: FR-11. Depends on: AIFACTORY-US-1200, feature:artifact-service, feature:agent-runtime-service, feature:workflow-engine-service. Sources: model/workflows/infrastructure-plan.yaml, model/skills/devops-delivery/infrastructure-engineer-record-outputs.yaml, model/scenarios/infrastructure-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given infrastructure-plan/preview succeeded, when the engine marks infrastructure-plan/record-outputs ready, then `infrastructure-blueprint`, `pulumi-program` and `preview-report` are resolved from the mappings of model/workflows/infrastructure-plan.yaml and `infrastructure-engineer` executes the step on its pinned release (SCN-infrastructure-plan-009).",
        "AC2: Given the step returns `generated-outputs`, when AgentRuntimeService records it, then it is stored once through ArtifactService/Artifacts.Store with the producer run, attempt and agent and lineage to the blueprint, the program and the preview report, and exactly one new ArtifactService/ArtifactStored is emitted for it (SCN-infrastructure-plan-009).",
        "AC3: Given the output is stored, when the step completes, then the run outputs are set and WorkflowEngineService/WorkflowRunCompleted is emitted once; given an attempt exceeds PT30M or spends its budget, then WorkflowEngineService/WorkflowRunFailed names the step and no output is written twice on recovery (SCN-infrastructure-plan-009, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml",
        "model/skills/devops-delivery/infrastructure-engineer-record-outputs.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4781",
        "AIFACTORY-TASK-4782",
        "AIFACTORY-TASK-4783"
      ],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10706,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "infrastructure-plan"
        ],
        "steps": [
          "infrastructure-plan/record-outputs"
        ],
        "agents": [
          "infrastructure-engineer"
        ],
        "services": [
          "WorkflowEngineService",
          "AgentRuntimeService",
          "ArtifactService"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ArtifactService/ArtifactStored",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-infrastructure-v1",
          "change-set-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-infrastructure-plan-009"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1200",
        "feature:artifact-service",
        "feature:agent-runtime-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/infrastructure-plan.yaml",
        "model/skills/devops-delivery/infrastructure-engineer-record-outputs.yaml",
        "model/scenarios/infrastructure-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1201]",
      "number": 1201
    },
    {
      "id": "AIFACTORY-TASK-4781",
      "type": "task",
      "parent": "AIFACTORY-US-1201",
      "title": "Bind the record-outputs skill and map the run outputs",
      "sequence": "19.12.06.01",
      "description": "Bind the record-outputs skill and map the run outputs. Expected output: The step record-outputs of the Draft release runs infrastructure-engineer-record-outputs with the three inputs mapped as in model/workflows/infrastructure-plan.yaml, and the run outputs infrastructure-blueprint, pulumi-program and validation-receipt are set from the recorded step outputs.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The step record-outputs of the Draft release runs infrastructure-engineer-record-outputs with the three inputs mapped as in model/workflows/infrastructure-plan.yaml, and the run outputs infrastructure-blueprint, pulumi-program and validation-receipt are set from the recorded step outputs."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10706,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4781]",
      "number": 4781
    },
    {
      "id": "AIFACTORY-TASK-4782",
      "type": "task",
      "parent": "AIFACTORY-US-1201",
      "title": "Fixture expected generated outputs with their lineage",
      "sequence": "19.12.06.02",
      "description": "Fixture expected generated outputs with their lineage. Expected output: The expected generated-outputs of the fixture run (change-set-v1) with the producer run and lineage to the blueprint, the program and the preview report, and the expectation of exactly one new ArtifactStored, as the oracle of SCN-infrastructure-plan-009.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected generated-outputs of the fixture run (change-set-v1) with the producer run and lineage to the blueprint, the program and the preview report, and the expectation of exactly one new ArtifactStored, as the oracle of SCN-infrastructure-plan-009."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10706,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4782]",
      "number": 4782
    },
    {
      "id": "AIFACTORY-TASK-4783",
      "type": "task",
      "parent": "AIFACTORY-US-1201",
      "title": "Prove the record step and the run completion on the fixture",
      "sequence": "19.12.06.03",
      "description": "Prove the record step and the run completion on the fixture. Expected output: A fixture run proves SCN-infrastructure-plan-009 (AC1 to AC3 of AIFACTORY-US-1201); one ArtifactStored with lineage, the run outputs set, WorkflowRunCompleted and RunCompleted exactly once, and the timeout path ending Failed without a second write on recovery.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-infrastructure-plan-009 (AC1 to AC3 of AIFACTORY-US-1201); one ArtifactStored with lineage, the run outputs set, WorkflowRunCompleted and RunCompleted exactly once, and the timeout path ending Failed without a second write on recovery."
      ],
      "sourceArtifacts": [
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 107,
      "phase": "factory",
      "stackRank": 10706,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4783]",
      "number": 4783
    },
    {
      "id": "AIFACTORY-FEAT-152",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Observability blueprint",
      "sequence": "19.13",
      "description": "The workflow definition observability-blueprint as a published asset: Builds the Observability Blueprint from the Service and Module Blueprints: spans, metrics and log events per module, health checks, service level objectives and the alerts that guard them; validated against the DSL. It has 5 steps, names the agents observability-engineer and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I2: Deliver it. Build order 108 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-079",
        "AIFACTORY-US-1202",
        "AIFACTORY-US-1203",
        "AIFACTORY-US-1204"
      ],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10800,
      "titlePrefix": "[AIFACTORY-FEAT-152]",
      "number": 152
    },
    {
      "id": "AIFACTORY-US-079",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-152",
      "title": "The Observability blueprint workflow runs from its published definition",
      "sequence": "19.13.01",
      "description": "As an operator, I want the observability blueprint workflow to run from its published definition with the agents, tools and gates it declares, so that the Observability Blueprint and its validation receipt are produced the same way on every run, with evidence. The integration PBI of the definition `observability-blueprint`, the producing definition of the Observability Blueprint kind (ADR-0030). When BlueprintService has published `BlueprintValidated` with passed true for the Service Blueprint and for the Module Blueprints of a project, WorkflowEngineService satisfies the two required readiness members `service-blueprint` (blueprint-service-v1) and `module-blueprints` (blueprint-module-v1) of the project scope and submits the run itself through `SubmitRun` of RunControlService with a service token that names the project and the bundle idempotency key (D131); the same versions return the existing run and a newer version of either member supersedes the open correlation. Run Control accepts the run and publishes `RunAccepted`; the engine loads the Published release the run pinned through AgentRegistryService and marks the five steps ready in the declared order: `derive-signals`, `draft-observability-blueprint`, `submit-version`, `validate` and `check-valid`. Agent steps run the `observability-engineer` release, the tool steps call `blueprint-submit-version` and `blueprint-validate`, and the condition loops back to the draft at most twice. Every step records exactly one outcome, the run reports exactly one outcome to Run Control (ADR-0014) and stays within the declared budget. Before any run, the definition release and the agent release of `observability-engineer`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release, no evaluation verdict is required before I4, and the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1202 to AIFACTORY-US-1204; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: observability-blueprint; steps: observability-blueprint/derive-signals, observability-blueprint/draft-observability-blueprint, observability-blueprint/submit-version, observability-blueprint/validate, observability-blueprint/check-valid; agents: observability-engineer; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService, BlueprintService; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, BlueprintService/BlueprintValidated, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-service-v1, blueprint-module-v1, blueprint-observability-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0024, ADR-0026, ADR-0027, ADR-0030; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1202, AIFACTORY-US-1203, AIFACTORY-US-1204, feature:wf-architecture-decomposition, feature:wf-module-blueprints, feature:blueprint-service, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-thin, feature:agent-registry-service-publication. Sources: model/workflows/observability-blueprint.yaml, model/agents/operations/observability-engineer.yaml, docs/planes/agent-runtime/workflow-definitions/observability-blueprint.md.",
      "acceptanceCriteria": [
        "AC1: Given BlueprintService/BlueprintValidated with passed true for the kinds Service and Module of one project and tenant, when both required members are satisfied, then WorkflowEngineService/ReadinessRunSubmitted is emitted once and the run is submitted through RunControlService/SubmitRun with a service token naming the project (D131); a newer member version emits WorkflowEngineService/ReadinessSuperseded for the open correlation.",
        "AC2: Given the Published release of `observability-blueprint`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter (D140), with its 5 steps, input mappings, retry policies, timeouts, the failure policy of each agent and tool step, the `idempotency_key` documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/observability-blueprint.yaml, when RunControlService/RunAccepted arrives for a run that pinned it, then WorkflowEngineService/WorkflowRunStarted is emitted and observability-blueprint/derive-signals, observability-blueprint/draft-observability-blueprint, observability-blueprint/submit-version, observability-blueprint/validate and observability-blueprint/check-valid become ready in that order, each agent step on the pinned Published release of `observability-engineer`, and no Draft release is loaded.",
        "AC3: Given every step succeeds and the receipt passed, when the run completes, then `observability-blueprint` (blueprint-observability-v1) and `validation-receipt` (blueprint-validation-receipt-v1) are the run outputs, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC4: Given a step spends its retry budget or the condition reaches its iteration limit, when the engine applies the compensation policy of model/workflows/observability-blueprint.yaml, then WorkflowEngineService/WorkflowRunFailed names the step, no Draft version is promoted and RunControlService/RunFailed is published exactly once (ADR-0026).",
        "AC5: Given the recorded fixture inputs of model/workflows/observability-blueprint.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml",
        "model/agents/operations/observability-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/observability-blueprint.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-347",
        "AIFACTORY-TASK-348",
        "AIFACTORY-TASK-349",
        "AIFACTORY-TASK-731"
      ],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10801,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "observability-blueprint"
        ],
        "steps": [
          "observability-blueprint/derive-signals",
          "observability-blueprint/draft-observability-blueprint",
          "observability-blueprint/submit-version",
          "observability-blueprint/validate",
          "observability-blueprint/check-valid"
        ],
        "agents": [
          "observability-engineer"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService",
          "BlueprintService"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-service-v1",
          "blueprint-module-v1",
          "blueprint-observability-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027",
          "ADR-0030"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1202",
        "AIFACTORY-US-1203",
        "AIFACTORY-US-1204",
        "feature:wf-architecture-decomposition",
        "feature:wf-module-blueprints",
        "feature:blueprint-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-thin",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/observability-blueprint.yaml",
        "model/agents/operations/observability-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/observability-blueprint.md"
      ],
      "titlePrefix": "[AIFACTORY-US-079]",
      "number": 79
    },
    {
      "id": "AIFACTORY-TASK-347",
      "type": "task",
      "parent": "AIFACTORY-US-079",
      "title": "Author, submit and publish the release of the workflow definition observability-blueprint with its agent release",
      "sequence": "19.13.01.01",
      "description": "Author, submit and publish the release of the workflow definition observability-blueprint with its agent release. Expected output: The release of observability-blueprint (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy Retry of each agent and tool step, the idempotency_key documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/observability-blueprint.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent release observability-engineer of AIFACTORY-TASK-348 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of observability-blueprint (workflow-definition-v1) authored with its 5 steps, input mappings, retry policies, timeouts, the failure policy Retry of each agent and tool step, the idempotency_key documentHash of submit-version and the on_false loop of check-valid exactly as in model/workflows/observability-blueprint.yaml and accepted by ValidateWorkflowDefinition; it is submitted through SubmitRelease of AgentRegistryService together with the agent release observability-engineer of AIFACTORY-TASK-348 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); no evaluation verdict is required before I4, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-347]",
      "number": 347
    },
    {
      "id": "AIFACTORY-TASK-348",
      "type": "task",
      "parent": "AIFACTORY-US-079",
      "title": "Author the agent release observability-engineer with its prompts and skills",
      "sequence": "19.13.01.02",
      "description": "Author the agent release observability-engineer with its prompts and skills. Expected output: A Draft release of observability-engineer with its instructions, the skills observability-engineer-derive-signals and observability-engineer-draft-observability-blueprint among its bound skills, the tool bindings and the model profile of model/agents/operations/observability-engineer.yaml; the release passes a smoke run on fixture Service and Module Blueprints in the template tests and is submitted for publication by AIFACTORY-TASK-347, and no evaluation verdict is required for its publication before I4 (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of observability-engineer with its instructions, the skills observability-engineer-derive-signals and observability-engineer-draft-observability-blueprint among its bound skills, the tool bindings and the model profile of model/agents/operations/observability-engineer.yaml; the release passes a smoke run on fixture Service and Module Blueprints in the template tests and is submitted for publication by AIFACTORY-TASK-347, and no evaluation verdict is required for its publication before I4 (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-348]",
      "number": 348
    },
    {
      "id": "AIFACTORY-TASK-349",
      "type": "task",
      "parent": "AIFACTORY-US-079",
      "title": "Fixture run of observability-blueprint against recorded inputs",
      "sequence": "19.13.01.03",
      "description": "Fixture run of observability-blueprint against recorded inputs. Expected output: The definition runs end to end on fixture Service and Module Blueprints in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-347; every step output validates against its descriptor (AC1 to AC3 and AC5 of AIFACTORY-US-079).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on fixture Service and Module Blueprints in the acceptance environment from the readiness start to RunCompleted on the Published releases of AIFACTORY-TASK-347; every step output validates against its descriptor (AC1 to AC3 and AC5 of AIFACTORY-US-079)."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-349]",
      "number": 349
    },
    {
      "id": "AIFACTORY-TASK-731",
      "type": "task",
      "parent": "AIFACTORY-US-079",
      "title": "Verify observability-blueprint-runs-from-its-definition by running the declared command",
      "sequence": "19.13.01.04",
      "description": "Verify observability-blueprint-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-079, including the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of observability-blueprint and observability-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-079, including the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of observability-blueprint and observability-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-731]",
      "number": 731
    },
    {
      "id": "AIFACTORY-US-1202",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-152",
      "title": "The Observability Engineer derives the signals and drafts the Observability Blueprint from the design",
      "sequence": "19.13.02",
      "description": "As an operator, I want the spans, metrics, log events, health checks, objectives and alerts of a product derived from its Service and Module Blueprints, so that every generated service is observable from its first deployment without a person writing the plan. The two agent steps of `observability-blueprint`. When the engine marks `derive-signals` ready it resolves `service-blueprint` from `input.service-blueprint` (blueprint-service-v1) and `module-blueprints` from `input.module-blueprints` (blueprint-module-v1); the `observability-engineer` release runs the skill `observability-engineer-derive-signals` in read class with read tools only and writes `signal-plan` (artifact-v1): spans, metrics and log events per module and per published operation, with the attributes the observability conventions require and the objectives the Service Blueprint states. When `draft-observability-blueprint` becomes ready it receives both blueprints plus `signal-plan` from `steps.derive-signals.signal-plan`, and on a revision pass the findings of the last validation receipt as feedback; the skill `observability-engineer-draft-observability-blueprint` writes, in sandbox class, the Observability Blueprint against blueprint-observability-v1: the signal catalogue per module, health checks, service level objectives with their indicators and alert rules with their routes, addressing the rules OBS-001 to OBS-003. Neither step touches a shared system or needs an approval. Both declare `failure_policy` Retry: a Failed attempt of failure class transient is retried under the exponential budget of 3 attempts with backoff 30s, any other failure class is not retried, and a step that exceeds PT30M or spends its budget fails the run. Kind: behavior. Traces: workflows: observability-blueprint; steps: observability-blueprint/derive-signals, observability-blueprint/draft-observability-blueprint; agents: observability-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/StepSettled; descriptors: blueprint-service-v1, blueprint-module-v1, artifact-v1, blueprint-observability-v1; scenarios: SCN-observability-blueprint-001, SCN-observability-blueprint-002; adrs: ADR-0014, ADR-0026, ADR-0030; requirements: FR-11. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/observability-blueprint.yaml, model/skills/operations/observability-engineer-derive-signals.yaml, model/skills/operations/observability-engineer-draft-observability-blueprint.yaml, model/blueprints.yaml, model/scenarios/observability-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `service-blueprint` and `module-blueprints`, when `observability-engineer` executes observability-blueprint/derive-signals, then `signal-plan` (artifact-v1) is recorded once under the run envelope with spans, metrics and log events for every module and published operation (SCN-observability-blueprint-001).",
        "AC2: Given `steps.derive-signals.signal-plan` is recorded, when observability-blueprint/draft-observability-blueprint runs, then `observability-blueprint-draft` validates against blueprint-observability-v1 with health checks, objectives with indicators and alert rules with routes, and is recorded once (SCN-observability-blueprint-002).",
        "AC3: Given a revision pass after observability-blueprint/check-valid took its false branch, when the draft step re-runs, then the findings of `steps.validate.validation-receipt` are in its context as feedback and the new draft addresses each finding by rule id (OBS-001 to OBS-003) or schema path (SCN-observability-blueprint-002, ADR-0026).",
        "AC4: Given an attempt of either step exceeds PT30M, settles Failed with a non-transient failure class, or spends the exponential budget of 3 attempts, when Run Control settles the step through RunControlService/StepSettled, then WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-observability-blueprint-001, SCN-observability-blueprint-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml",
        "model/skills/operations/observability-engineer-derive-signals.yaml",
        "model/skills/operations/observability-engineer-draft-observability-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4762",
        "AIFACTORY-TASK-4763",
        "AIFACTORY-TASK-4764"
      ],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10802,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "observability-blueprint"
        ],
        "steps": [
          "observability-blueprint/derive-signals",
          "observability-blueprint/draft-observability-blueprint"
        ],
        "agents": [
          "observability-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/StepSettled"
        ],
        "descriptors": [
          "blueprint-service-v1",
          "blueprint-module-v1",
          "artifact-v1",
          "blueprint-observability-v1"
        ],
        "scenarios": [
          "SCN-observability-blueprint-001",
          "SCN-observability-blueprint-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026",
          "ADR-0030"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/observability-blueprint.yaml",
        "model/skills/operations/observability-engineer-derive-signals.yaml",
        "model/skills/operations/observability-engineer-draft-observability-blueprint.yaml",
        "model/blueprints.yaml",
        "model/scenarios/observability-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1202]",
      "number": 1202
    },
    {
      "id": "AIFACTORY-TASK-4762",
      "type": "task",
      "parent": "AIFACTORY-US-1202",
      "title": "Recorded fixture of Service and Module Blueprints with the expected signal plan and draft",
      "sequence": "19.13.02.01",
      "description": "Recorded fixture of Service and Module Blueprints with the expected signal plan and draft. Expected output: Fixture Service and Module Blueprints with the expected signal plan (artifact-v1) and the expected Observability Blueprint draft (blueprint-observability-v1), plus a receipt with an OBS-002 finding as feedback for the revision pass of SCN-observability-blueprint-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Fixture Service and Module Blueprints with the expected signal plan (artifact-v1) and the expected Observability Blueprint draft (blueprint-observability-v1), plus a receipt with an OBS-002 finding as feedback for the revision pass of SCN-observability-blueprint-002."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4762]",
      "number": 4762
    },
    {
      "id": "AIFACTORY-TASK-4763",
      "type": "task",
      "parent": "AIFACTORY-US-1202",
      "title": "Verify the input mappings and skill selection of the two agent steps in the Draft release",
      "sequence": "19.13.02.02",
      "description": "Verify the input mappings and skill selection of the two agent steps in the Draft release. Expected output: The steps derive-signals and draft-observability-blueprint of the Draft release authored by AIFACTORY-TASK-347 resolve service-blueprint, module-blueprints and signal-plan exactly as mapped in model/workflows/observability-blueprint.yaml and select the skills observability-engineer-derive-signals and observability-engineer-draft-observability-blueprint.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps derive-signals and draft-observability-blueprint of the Draft release authored by AIFACTORY-TASK-347 resolve service-blueprint, module-blueprints and signal-plan exactly as mapped in model/workflows/observability-blueprint.yaml and select the skills observability-engineer-derive-signals and observability-engineer-draft-observability-blueprint."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4763]",
      "number": 4763
    },
    {
      "id": "AIFACTORY-TASK-4764",
      "type": "task",
      "parent": "AIFACTORY-US-1202",
      "title": "Prove the signal and draft steps on the fixture",
      "sequence": "19.13.02.03",
      "description": "Prove the signal and draft steps on the fixture. Expected output: A fixture run proves SCN-observability-blueprint-001 and SCN-observability-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1202); the outputs validate against artifact-v1 and blueprint-observability-v1, the revision pass addresses each finding, and the retry exhaustion ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-observability-blueprint-001 and SCN-observability-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1202); the outputs validate against artifact-v1 and blueprint-observability-v1, the revision pass addresses each finding, and the retry exhaustion ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4764]",
      "number": 4764
    },
    {
      "id": "AIFACTORY-US-1203",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-152",
      "title": "The Observability Blueprint draft is stored as a project-scope Draft version and validated with a receipt",
      "sequence": "19.13.03",
      "description": "As an operator, I want the drafted Observability Blueprint stored as a Draft version of my project and validated against its schema and the OBS rules, so that a verdict with findings exists for every draft before infrastructure is planned on it. The two tool steps of `observability-blueprint`; they reuse the tool bindings of `blueprint-submit-version` and `blueprint-validate` that the feature wf-vision-to-blueprint delivers and fork nothing. When `submit-version` becomes ready the engine resolves `document` from `steps.draft-observability-blueprint.observability-blueprint-draft` and emits `StepReady` with action class shared-write; Run Control dispatches the attempt through the pipeline of ToolAdapterService. Draft versions are autonomous by default; when the project policy gates blueprint drafts, Policy.Decide answers allow-with-approval for the action kind tool-invocation and an approval whose subject is the run is requested, bound to the invocation request hash, which covers the document hash, with proposal kind tool-invocation; the run waits WaitingForApproval and the write happens only on an approving decision (D64, D129). The tool stores the document as a project-scope Draft BlueprintVersion of kind Observability, idempotent on its document hash, and returns `version-ref` (blueprint-version-ref-v1). The step declares `failure_policy` Retry with `idempotency_key` documentHash, so a Failed attempt of failure class transient is retried under the fixed budget of 2 attempts with backoff 10s (D114); an Uncertain attempt is never retried automatically and waits for an operator decision with a finding (D119). When `validate` becomes ready the tool `blueprint-validate` validates the version against blueprint-observability-v1 and the rules OBS-001 to OBS-003 in sandbox class and returns `validation-receipt` with passed, documentHash and findings; a receipt with passed false is a successful step output. A version reference of another tenant is answered NOT_FOUND and the attempt takes failure class permanent (ADR-0015). Kind: behavior. Traces: workflows: observability-blueprint; steps: observability-blueprint/submit-version, observability-blueprint/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, ToolAdapterService, RunControlService, WorkflowEngineService; aggregates: BlueprintService/BlueprintVersion; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, ToolAdapterService/ConfirmToolEffect; events: BlueprintService/BlueprintValidated, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-observability-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-observability-blueprint-003, SCN-observability-blueprint-004; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-11, XL-09. Depends on: AIFACTORY-US-1202, feature:wf-vision-to-blueprint, feature:blueprint-service, feature:tool-adapter-service, feature:run-control-service, feature:workflow-engine-service. Sources: model/workflows/observability-blueprint.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/scenarios/observability-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-observability-blueprint.observability-blueprint-draft` is recorded and the project policy does not gate blueprint drafts, when observability-blueprint/submit-version runs through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Observability exists in project scope, `version-ref` is recorded once and the same document submitted again returns the same version (SCN-observability-blueprint-003, D64).",
        "AC2: Given the project policy gates blueprint drafts, when observability-blueprint/submit-version is reached, then RunControlService/ApprovalRequested is published for the run bound to the invocation request hash with proposal kind tool-invocation before any write, the write happens only on an approving RunControlService/ApprovalDecided, and a rejected or expired decision ends in ToolAdapterService/ToolInvocationDenied with no Draft version (SCN-observability-blueprint-003, ADR-0026).",
        "AC3: Given a submit attempt settles Failed with failure class transient, when Run Control evaluates it, then it is retried under the fixed budget of 2 attempts because the step declares `idempotency_key` documentHash; given it settles Uncertain, then ToolAdapterService/ToolEffectUncertain is emitted, it is not retried and the step waits until an operator settles it through ToolAdapterService/ConfirmToolEffect (SCN-observability-blueprint-003, ADR-0014).",
        "AC4: Given `steps.submit-version.version-ref` is recorded, when observability-blueprint/validate runs through BlueprintService/Blueprints.Validate, then `validation-receipt` with passed, documentHash and findings by rule id OBS-001 to OBS-003 or schema path is recorded once whether it passed or not, and BlueprintService/BlueprintValidated is emitted with passed true or false (SCN-observability-blueprint-004).",
        "AC5: Given the version reference belongs to another tenant, or a validate attempt exceeds PT5M or spends the fixed budget of 2 attempts, when the step settles, then a foreign reference is answered NOT_FOUND with no receipt and failure class permanent without a retry, and WorkflowEngineService/WorkflowRunFailed names the step (SCN-observability-blueprint-004, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/scenarios/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4765",
        "AIFACTORY-TASK-4766",
        "AIFACTORY-TASK-4767"
      ],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10803,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "observability-blueprint"
        ],
        "steps": [
          "observability-blueprint/submit-version",
          "observability-blueprint/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "ToolAdapterService",
          "RunControlService",
          "WorkflowEngineService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-observability-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-observability-blueprint-003",
          "SCN-observability-blueprint-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1202",
        "feature:wf-vision-to-blueprint",
        "feature:blueprint-service",
        "feature:tool-adapter-service",
        "feature:run-control-service",
        "feature:workflow-engine-service"
      ],
      "source": [
        "model/workflows/observability-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/scenarios/observability-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1203]",
      "number": 1203
    },
    {
      "id": "AIFACTORY-TASK-4765",
      "type": "task",
      "parent": "AIFACTORY-US-1203",
      "title": "Bind the submit and validate steps to the shared blueprint tool bindings",
      "sequence": "19.13.03.01",
      "description": "Bind the submit and validate steps to the shared blueprint tool bindings. Expected output: The steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate as delivered by the feature wf-vision-to-blueprint, with document and version-ref mapped as in model/workflows/observability-blueprint.yaml and the idempotency_key documentHash on submit-version.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate as delivered by the feature wf-vision-to-blueprint, with document and version-ref mapped as in model/workflows/observability-blueprint.yaml and the idempotency_key documentHash on submit-version."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4765]",
      "number": 4765
    },
    {
      "id": "AIFACTORY-TASK-4766",
      "type": "task",
      "parent": "AIFACTORY-US-1203",
      "title": "Fixture Observability Blueprint documents with their expected receipts",
      "sequence": "19.13.03.02",
      "description": "Fixture Observability Blueprint documents with their expected receipts. Expected output: One fixture document that passes OBS-001 to OBS-003 and one that fails OBS-003, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1, plus a version reference of another tenant with the expected NOT_FOUND, as the oracle of SCN-observability-blueprint-003 and SCN-observability-blueprint-004.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture document that passes OBS-001 to OBS-003 and one that fails OBS-003, each with its expected blueprint-version-ref-v1 and blueprint-validation-receipt-v1, plus a version reference of another tenant with the expected NOT_FOUND, as the oracle of SCN-observability-blueprint-003 and SCN-observability-blueprint-004."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10803,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4766]",
      "number": 4766
    },
    {
      "id": "AIFACTORY-TASK-4767",
      "type": "task",
      "parent": "AIFACTORY-US-1203",
      "title": "Prove the submit and validate steps on the fixture",
      "sequence": "19.13.03.03",
      "description": "Prove the submit and validate steps on the fixture. Expected output: A fixture run proves SCN-observability-blueprint-003 and SCN-observability-blueprint-004 (AC1 to AC5 of AIFACTORY-US-1203), including the idempotent resubmission, the gated path, the transient retry, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the foreign version reference answered NOT_FOUND.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-observability-blueprint-003 and SCN-observability-blueprint-004 (AC1 to AC5 of AIFACTORY-US-1203), including the idempotent resubmission, the gated path, the transient retry, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the foreign version reference answered NOT_FOUND."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4767]",
      "number": 4767
    },
    {
      "id": "AIFACTORY-US-1204",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-152",
      "title": "The engine checks the Observability Blueprint receipt and sends findings back to the draft at most twice",
      "sequence": "19.13.04",
      "description": "As an operator, I want a failed validation of the Observability Blueprint to return its findings to the draft a bounded number of times and then fail with the report, so that the blueprint improves on real findings without looping forever or hiding the verdict. The condition step of `observability-blueprint`. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; a condition step never retries, never calls a service and completes within PT1M. When the receipt passed, the condition completes with one outcome and, being the last step, the run completes with the validated draft as `observability-blueprint` and the receipt as `validation-receipt`. When it did not, the engine takes the `on_false` branch to `draft-observability-blueprint` with `steps.validate.validation-receipt` as feedback: the draft, submit and validate steps re-run in order, the revised document gets its own Draft version and its own receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the last iteration the run fails with the validation report as its evidence, `WorkflowRunFailed` names `check-valid` with the failure class validation, Run Control records Failed exactly once and every Draft version created on the way stays a Draft. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026, D61). Kind: behavior. Traces: workflows: observability-blueprint; steps: observability-blueprint/check-valid, observability-blueprint/draft-observability-blueprint; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1, blueprint-observability-v1; scenarios: SCN-observability-blueprint-005, SCN-observability-blueprint-006; adrs: ADR-0014, ADR-0026; requirements: FR-11. Depends on: AIFACTORY-US-1203, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/observability-blueprint.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/observability-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates observability-blueprint/check-valid, then the condition completes with one outcome, no service is called and the run completes with WorkflowEngineService/WorkflowRunCompleted once (SCN-observability-blueprint-005).",
        "AC2: Given the recorded receipt has `passed` false and fewer than 2 iterations were counted, when the engine evaluates observability-blueprint/check-valid, then it takes the false branch to observability-blueprint/draft-observability-blueprint with the receipt as feedback and the iteration count rises by one (SCN-observability-blueprint-006).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates the condition, then WorkflowEngineService/WorkflowRunFailed names `check-valid` with failure class validation and the report as evidence, RunControlService/RunFailed is published exactly once and no Draft version is promoted (SCN-observability-blueprint-006, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable, or the evaluation exceeds PT1M, when the engine evaluates observability-blueprint/check-valid, then the condition is not retried, it fails with evidence and the run follows the compensation policy of model/workflows/observability-blueprint.yaml (SCN-observability-blueprint-005)."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4768",
        "AIFACTORY-TASK-4769",
        "AIFACTORY-TASK-4770"
      ],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10804,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "observability-blueprint"
        ],
        "steps": [
          "observability-blueprint/check-valid",
          "observability-blueprint/draft-observability-blueprint"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1",
          "blueprint-observability-v1"
        ],
        "scenarios": [
          "SCN-observability-blueprint-005",
          "SCN-observability-blueprint-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1203",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/observability-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/observability-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1204]",
      "number": 1204
    },
    {
      "id": "AIFACTORY-TASK-4768",
      "type": "task",
      "parent": "AIFACTORY-US-1204",
      "title": "Map the run outputs from the passing draft and its receipt",
      "sequence": "19.13.04.01",
      "description": "Map the run outputs from the passing draft and its receipt. Expected output: When check-valid holds the run outputs observability-blueprint and validation-receipt of the Draft release are set from the draft that passed and its receipt, as model/workflows/observability-blueprint.yaml declares.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "When check-valid holds the run outputs observability-blueprint and validation-receipt of the Draft release are set from the draft that passed and its receipt, as model/workflows/observability-blueprint.yaml declares."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10804,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4768]",
      "number": 4768
    },
    {
      "id": "AIFACTORY-TASK-4769",
      "type": "task",
      "parent": "AIFACTORY-US-1204",
      "title": "Fixture receipt sequences for the pass, loop and limit paths",
      "sequence": "19.13.04.02",
      "description": "Fixture receipt sequences for the pass, loop and limit paths. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of observability-blueprint through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid of observability-blueprint through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10804,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4769]",
      "number": 4769
    },
    {
      "id": "AIFACTORY-TASK-4770",
      "type": "task",
      "parent": "AIFACTORY-US-1204",
      "title": "Prove the condition and the bounded loop on the fixture",
      "sequence": "19.13.04.03",
      "description": "Prove the condition and the bounded loop on the fixture. Expected output: A fixture run proves SCN-observability-blueprint-005 and SCN-observability-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1204); one outcome on pass, a loop back with feedback on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-observability-blueprint-005 and SCN-observability-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1204); one outcome on pass, a loop back with feedback on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/observability-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 108,
      "phase": "factory",
      "stackRank": 10804,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4770]",
      "number": 4770
    },
    {
      "id": "AIFACTORY-FEAT-117",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Compliance check",
      "sequence": "19.14",
      "description": "The workflow definition compliance-check as a published asset: Checks generated code and infrastructure against the selected compliance rule sets, raises findings to audit and blocks on critical findings. It has 7 steps, names the agents privacy-compliance, security-engineer and the tools none, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I4: Trust and accountability. Build order 136 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-089",
        "AIFACTORY-US-1231",
        "AIFACTORY-US-1232",
        "AIFACTORY-US-1233"
      ],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13600,
      "titlePrefix": "[AIFACTORY-FEAT-117]",
      "number": 117
    },
    {
      "id": "AIFACTORY-US-089",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-117",
      "title": "The Compliance check workflow runs from its published definition",
      "sequence": "19.14.01",
      "description": "As a reviewer, I want the compliance check workflow to run from its published definition with the agents, tools and gates it declares, so that findings are produced the same way on every run, with evidence. The integration PBI of the definition `compliance-check`. The definition is readiness-activated: its activation block names four required members of one project, the generation run (`GenerationCompleted` of GenerationRecipeService with at least one module) and the validated Infrastructure, Database and Security Blueprints (`BlueprintValidated` with `passed` true and the matching kind). When every member is satisfied the `ReadinessCorrelator` of WorkflowEngineService submits exactly one run through `SubmitRun` of RunControlService with its service token naming the project, the release resolved when the correlation opened and the idempotency key `{scope}:{operation}:{workflowReleaseId}:{bundleFingerprint}`; a newer member version supersedes the open correlation. On `RunAccepted` the engine loads the Published release the run pinned through AgentRegistryService and marks the seven steps ready in their declared order: `select-rule-sets`, the fan-out `fan-out-scans`, the parallel `scan-code` and `scan-infrastructure`, the join `join-scans`, `raise-findings` and the condition `block-on-critical`. The agent steps run the releases of `privacy-compliance` and `security-engineer`; every agent step declares `failure_policy` Retry, which Run Control applies only to a Failed attempt of failure class transient, three agent steps being of read or sandbox class and `raise-findings` of shared-write class with `idempotency_key` finding id (D133). No step declares a compensation, so a failed run leaves its sandbox outputs as evidence (ADR-0014). The run reports exactly one outcome and stays within its budget of 600000 tokens, 60 USD and 240 minutes. Before any run, the definition release and the agent releases of `privacy-compliance` and `security-engineer`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release. In I4 the evaluation gate of the complete delivery applies: where an evaluation suite exists for the asset kind, a release is published only with a passed evaluation record (ADR-0021), and an agent release published before I4 without one is resubmitted through the gate as a new version; the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1231 to AIFACTORY-US-1233; this PBI proves the whole chain on the recorded fixture. Kind: behavior. Traces: workflows: compliance-check; steps: compliance-check/select-rule-sets, compliance-check/fan-out-scans, compliance-check/scan-code, compliance-check/scan-infrastructure, compliance-check/join-scans, compliance-check/raise-findings, compliance-check/block-on-critical; agents: privacy-compliance, security-engineer; services: WorkflowEngineService, RunControlService, AgentRegistryService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, WorkflowEngineService/ReadinessSatisfied, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, change-set-v1, blueprint-infrastructure-v1, blueprint-database-v1, blueprint-security-v1, findings-v1; adrs: ADR-0014, ADR-0019, ADR-0021, ADR-0027; requirements: FR-05, XL-10, XL-11. Depends on: AIFACTORY-US-1231, AIFACTORY-US-1232, AIFACTORY-US-1233, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-complete, feature:agent-registry-service-publication. Sources: model/workflows/compliance-check.yaml, model/agents/operations/privacy-compliance.yaml, model/agents/operations/security-engineer.yaml, docs/planes/agent-runtime/workflow-definitions/compliance-check.md.",
      "acceptanceCriteria": [
        "AC1: Given the Published release of `compliance-check`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter and with a passed evaluation record where an evaluation suite exists for its asset kind (ADR-0021, D140), carries the activation block, the 7 steps, input mappings, retry policies, timeouts and the `failure_policy` Retry of the four agent steps exactly as in model/workflows/compliance-check.yaml, when the last required member of an open WorkflowEngineService/ReadinessCorrelation of the project is satisfied, then WorkflowEngineService/ReadinessSatisfied is published, one run is submitted through RunControlService/SubmitRun with the service token of the engine naming the project and the bundle idempotency key, and WorkflowEngineService/ReadinessRunSubmitted names the returned run; a repeated submission with the same key and body returns the same run; the same key with a different body is answered 409 by RunControlService/SubmitRun and the correlation becomes Superseded with reason conflict, publishing WorkflowEngineService/ReadinessSuperseded and no run; and a newer member version publishes WorkflowEngineService/ReadinessSuperseded instead of a second run (ADR-0014).",
        "AC2: Given RunControlService/RunAccepted for that release with the inputs `generated-outputs` (change-set-v1), `infrastructure-blueprint`, `database-blueprint` and `security-blueprint`, when the engine opens its projection, then WorkflowEngineService/WorkflowRunStarted is emitted and the steps compliance-check/select-rule-sets, compliance-check/fan-out-scans, compliance-check/scan-code, compliance-check/scan-infrastructure, compliance-check/join-scans, compliance-check/raise-findings and compliance-check/block-on-critical become ready in that order, each agent step on the pinned Published release of `privacy-compliance` or `security-engineer`, and no Draft release is loaded (D140).",
        "AC3: Given every step succeeds, `findings` (findings-v1) is recorded with `critical` 0 and compliance-check/block-on-critical holds, when the run completes, then `findings` is recorded as the run output under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014, D133).",
        "AC4: Given an agent step is settled Failed with its retry budget spent or with a failure class other than transient, a parallel step exceeds its timeout, or compliance-check/block-on-critical finds a critical finding, when the engine applies the compensation policy of model/workflows/compliance-check.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and the failure class, the sandbox outputs stay in place as evidence and RunControlService/RunFailed is published exactly once (recovery, not replay, ADR-0014).",
        "AC5: Given the recorded fixture inputs of model/workflows/compliance-check.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0027)."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/privacy-compliance.yaml",
        "model/agents/operations/security-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/compliance-check.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-395",
        "AIFACTORY-TASK-396",
        "AIFACTORY-TASK-397",
        "AIFACTORY-TASK-723"
      ],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13601,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "compliance-check"
        ],
        "steps": [
          "compliance-check/select-rule-sets",
          "compliance-check/fan-out-scans",
          "compliance-check/scan-code",
          "compliance-check/scan-infrastructure",
          "compliance-check/join-scans",
          "compliance-check/raise-findings",
          "compliance-check/block-on-critical"
        ],
        "agents": [
          "privacy-compliance",
          "security-engineer"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "WorkflowEngineService/ReadinessSatisfied",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "change-set-v1",
          "blueprint-infrastructure-v1",
          "blueprint-database-v1",
          "blueprint-security-v1",
          "findings-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0019",
          "ADR-0021",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05",
          "XL-10",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1231",
        "AIFACTORY-US-1232",
        "AIFACTORY-US-1233",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-complete",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/privacy-compliance.yaml",
        "model/agents/operations/security-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/compliance-check.md"
      ],
      "titlePrefix": "[AIFACTORY-US-089]",
      "number": 89
    },
    {
      "id": "AIFACTORY-TASK-395",
      "type": "task",
      "parent": "AIFACTORY-US-089",
      "title": "Author, submit and publish the release of the workflow definition compliance-check with its agent releases",
      "sequence": "19.14.01.01",
      "description": "Author, submit and publish the release of the workflow definition compliance-check with its agent releases. Expected output: The release of compliance-check (workflow-definition-v1) authored with its activation block of four required members, its 7 steps, input mappings, retry policies, timeouts, the condition of block-on-critical and the compensation policy as in model/workflows/compliance-check.yaml, the failure_policy Retry of the four agent steps copied as it stands, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases privacy-compliance and security-engineer of AIFACTORY-TASK-396 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of compliance-check (workflow-definition-v1) authored with its activation block of four required members, its 7 steps, input mappings, retry policies, timeouts, the condition of block-on-critical and the compensation policy as in model/workflows/compliance-check.yaml, the failure_policy Retry of the four agent steps copied as it stands, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases privacy-compliance and security-engineer of AIFACTORY-TASK-396 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-395]",
      "number": 395
    },
    {
      "id": "AIFACTORY-TASK-396",
      "type": "task",
      "parent": "AIFACTORY-US-089",
      "title": "Author the agent releases privacy-compliance and security-engineer with their prompts and skills",
      "sequence": "19.14.01.02",
      "description": "Author the agent releases privacy-compliance and security-engineer with their prompts and skills. Expected output: Draft releases of privacy-compliance (the ten bound skills of model/agents/operations/privacy-compliance.yaml, model profile reasoning-high) and security-engineer (the eight bound skills of model/agents/operations/security-engineer.yaml, model profile code-agent-strong) with their instructions and tool bindings; each is evaluated with the suite operations-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-395 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of privacy-compliance (the ten bound skills of model/agents/operations/privacy-compliance.yaml, model profile reasoning-high) and security-engineer (the eight bound skills of model/agents/operations/security-engineer.yaml, model profile code-agent-strong) with their instructions and tool bindings; each is evaluated with the suite operations-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-395 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13601,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-396]",
      "number": 396
    },
    {
      "id": "AIFACTORY-TASK-397",
      "type": "task",
      "parent": "AIFACTORY-US-089",
      "title": "Fixture run of compliance-check against recorded inputs",
      "sequence": "19.14.01.03",
      "description": "Fixture run of compliance-check against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to the outcome of block-on-critical on the Published releases of AIFACTORY-TASK-395; every step output validates against its descriptor and the output findings (findings-v1) matches the recorded one field by field (AC1 to AC3 and AC5 of AIFACTORY-US-089); a fixture without a critical finding ends Completed with findings as the run output and a fixture with one ends Failed at block-on-critical.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to the outcome of block-on-critical on the Published releases of AIFACTORY-TASK-395; every step output validates against its descriptor and the output findings (findings-v1) matches the recorded one field by field (AC1 to AC3 and AC5 of AIFACTORY-US-089); a fixture without a critical finding ends Completed with findings as the run output and a fixture with one ends Failed at block-on-critical."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-397]",
      "number": 397
    },
    {
      "id": "AIFACTORY-TASK-723",
      "type": "task",
      "parent": "AIFACTORY-US-089",
      "title": "Verify compliance-check-runs-from-its-definition by running the declared command",
      "sequence": "19.14.01.04",
      "description": "Verify compliance-check-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-089, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, the superseded correlation of AC1, the Completed path of AC3 and the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of compliance-check, privacy-compliance and security-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-089, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, the superseded correlation of AC1, the Completed path of AC3 and the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of compliance-check, privacy-compliance and security-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13601,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-723]",
      "number": 723
    },
    {
      "id": "AIFACTORY-US-1231",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-117",
      "title": "The privacy and compliance role selects the rule sets from classification, residency and edition",
      "sequence": "19.14.02",
      "description": "As a reviewer, I want the compliance rule sets of a generation chosen from the tenant's classification, residency and the product's edition, so that the scans check exactly the obligations that apply to this product. The first step of `compliance-check`. When the engine marks `select-rule-sets` ready it resolves `database-blueprint`, `security-blueprint` and `generated-outputs` from the run inputs of the same names. The `privacy-compliance` release runs in read class with the tools its card allows (knowledge-search, graph-query, list-files, read-range) and the skills that classify fields and weigh residency, such as `privacy-compliance-classify-fields` and `privacy-compliance-cross-region-risk`: it reads the data classes of the Database Blueprint, the controls of the Security Blueprint and the edition of the generated product and writes one artifact `rule-sets` that names each selected rule set with the reason it applies (classification, residency region under ADR-0019, edition). The step changes no shared system, needs no approval and records exactly one attempt outcome. It declares `failure_policy` Retry with an exponential budget of 3 attempts and backoff 30s: a Failed attempt of failure class transient is retried, any other failure class is not, and a step that exceeds its timeout PT30M or spends its budget fails the run with the evidence; no step succeeded before it, so nothing is compensated. Kind: behavior. Traces: workflows: compliance-check; steps: compliance-check/select-rule-sets; agents: privacy-compliance; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-database-v1, blueprint-security-v1, change-set-v1, artifact-v1; scenarios: SCN-compliance-check-001; adrs: ADR-0014, ADR-0019; requirements: FR-05, XL-10. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/compliance-check.yaml, model/agents/operations/privacy-compliance.yaml, model/scenarios/compliance-check.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with the inputs `database-blueprint` (blueprint-database-v1), `security-blueprint` (blueprint-security-v1) and `generated-outputs` (change-set-v1), when the engine marks compliance-check/select-rule-sets ready and `privacy-compliance` executes it, then the output `rule-sets` (artifact-v1) is recorded once under the run envelope with exactly one attempt outcome (SCN-compliance-check-001).",
        "AC2: Given a fixture tenant whose classification includes restricted data and whose residency region is fixed, when compliance-check/select-rule-sets runs, then every rule set in `rule-sets` names the classification, residency or edition that selected it, and a rule set whose reason does not apply to the fixture is absent (ADR-0019, SCN-compliance-check-001).",
        "AC3: Given an attempt of compliance-check/select-rule-sets exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/compliance-check.yaml, then WorkflowEngineService/WorkflowRunFailed names the step, the run ends Failed with the evidence and no shared system is changed (SCN-compliance-check-001, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/privacy-compliance.yaml",
        "model/scenarios/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4921",
        "AIFACTORY-TASK-4922",
        "AIFACTORY-TASK-4923"
      ],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13602,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "compliance-check"
        ],
        "steps": [
          "compliance-check/select-rule-sets"
        ],
        "agents": [
          "privacy-compliance"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-database-v1",
          "blueprint-security-v1",
          "change-set-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-compliance-check-001"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0019"
        ],
        "requirements": [
          "FR-05",
          "XL-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/privacy-compliance.yaml",
        "model/scenarios/compliance-check.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1231]",
      "number": 1231
    },
    {
      "id": "AIFACTORY-TASK-4921",
      "type": "task",
      "parent": "AIFACTORY-US-1231",
      "title": "Recorded fixture for the rule set selection",
      "sequence": "19.14.02.01",
      "description": "Recorded fixture for the rule set selection. Expected output: A fixture Database, Security Blueprint and generated output of a product with restricted data in one residency region and a named edition, with the expected rule-sets artifact (artifact-v1) naming the reason of every selected rule set, as the oracle of SCN-compliance-check-001.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture Database, Security Blueprint and generated output of a product with restricted data in one residency region and a named edition, with the expected rule-sets artifact (artifact-v1) naming the reason of every selected rule set, as the oracle of SCN-compliance-check-001."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13602,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4921]",
      "number": 4921
    },
    {
      "id": "AIFACTORY-TASK-4922",
      "type": "task",
      "parent": "AIFACTORY-US-1231",
      "title": "Verify the input mappings and read class of select-rule-sets in the Draft release",
      "sequence": "19.14.02.02",
      "description": "Verify the input mappings and read class of select-rule-sets in the Draft release. Expected output: The step select-rule-sets of the Draft release authored by AIFACTORY-TASK-395 resolves database-blueprint, security-blueprint and generated-outputs exactly as mapped in model/workflows/compliance-check.yaml, is announced with actionClass read and runs privacy-compliance with no tool of a class above read.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The step select-rule-sets of the Draft release authored by AIFACTORY-TASK-395 resolves database-blueprint, security-blueprint and generated-outputs exactly as mapped in model/workflows/compliance-check.yaml, is announced with actionClass read and runs privacy-compliance with no tool of a class above read."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4922]",
      "number": 4922
    },
    {
      "id": "AIFACTORY-TASK-4923",
      "type": "task",
      "parent": "AIFACTORY-US-1231",
      "title": "Prove the rule set selection on the fixture",
      "sequence": "19.14.02.03",
      "description": "Prove the rule set selection on the fixture. Expected output: A fixture run proves SCN-compliance-check-001 (AC1 to AC3 of AIFACTORY-US-1231); the output validates against artifact-v1, and the timeout and retry exhaustion path ends in a WorkflowRunFailed that names select-rule-sets.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-compliance-check-001 (AC1 to AC3 of AIFACTORY-US-1231); the output validates against artifact-v1, and the timeout and retry exhaustion path ends in a WorkflowRunFailed that names select-rule-sets."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13602,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4923]",
      "number": 4923
    },
    {
      "id": "AIFACTORY-US-1232",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-117",
      "title": "The security role scans the code and the infrastructure in parallel and the engine joins both scans",
      "sequence": "19.14.03",
      "description": "As a reviewer, I want the code and the infrastructure of a generation scanned against the selected rule sets at the same time, so that both kinds of findings are ready together without one scan waiting on the other. The parallel section of `compliance-check`. After `select-rule-sets` the engine evaluates the fan-out step `fan-out-scans` itself, without an agent or a service call, within PT1M, and marks `scan-code` and `scan-infrastructure` ready together. Both run the `security-engineer` release in sandbox class with the rule sets from `steps.select-rule-sets.rule-sets` and the Security Blueprint from `input.security-blueprint`. `scan-code` also receives `generated-outputs` and runs the static and dependency checks inside the isolated workspace with the tools its card allows (search-text, get-dependencies, shell-sandbox, build-and-test) and the skills `security-engineer-policy-resolver` and `security-engineer-risk-scoring`; it writes `code-findings`. `scan-infrastructure` also receives `infrastructure-blueprint` and checks it and its program against the policy rules; it writes `infrastructure-findings`. Neither scan changes the generated outputs or proposes a change set; a fix is a later run. The join `join-scans` waits for both branches, with no quorum declared, and completes within PT1M. Each scan declares `failure_policy` Retry, exponential, 3 attempts; a scan that fails for good fails the run, and no further step of the run becomes ready. Kind: behavior. Traces: workflows: compliance-check; steps: compliance-check/fan-out-scans, compliance-check/scan-code, compliance-check/scan-infrastructure, compliance-check/join-scans; agents: security-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: artifact-v1, blueprint-security-v1, blueprint-infrastructure-v1, change-set-v1; scenarios: SCN-compliance-check-002, SCN-compliance-check-003, SCN-compliance-check-004, SCN-compliance-check-005; adrs: ADR-0014; requirements: FR-05, XL-11. Depends on: AIFACTORY-US-1231, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/compliance-check.yaml, model/agents/operations/security-engineer.yaml, model/scenarios/compliance-check.yaml.",
      "acceptanceCriteria": [
        "AC1: Given compliance-check/select-rule-sets succeeded, when the engine evaluates compliance-check/fan-out-scans, then the step completes with exactly one outcome under the run envelope within PT1M, no attempt is dispatched for it, and WorkflowEngineService/StepReady is emitted for compliance-check/scan-code and compliance-check/scan-infrastructure in the same advance (SCN-compliance-check-002).",
        "AC2: Given the two scan steps are ready, when `security-engineer` executes compliance-check/scan-code with `security-blueprint`, `generated-outputs` and `rule-sets`, then the output `code-findings` (artifact-v1) is recorded once and names for every finding the rule, the severity and the file or dependency it concerns, and no change set is proposed (SCN-compliance-check-003).",
        "AC3: Given the two scan steps are ready, when `security-engineer` executes compliance-check/scan-infrastructure with `security-blueprint`, `infrastructure-blueprint` and `rule-sets`, then the output `infrastructure-findings` (artifact-v1) is recorded once and names for every finding the rule, the severity and the resource of the Infrastructure Blueprint it concerns (SCN-compliance-check-004).",
        "AC4: Given both scans succeeded, when the engine evaluates compliance-check/join-scans, then it completes with exactly one outcome and compliance-check/raise-findings becomes ready; given one scan is settled Failed with its budget spent or a non-transient failure class, then the join never completes, WorkflowEngineService/WorkflowRunFailed names that scan, RunControlService/RunFailed follows exactly once and no further step of the run becomes ready (SCN-compliance-check-005, ADR-0014).",
        "AC5: Given compliance-check/fan-out-scans or compliance-check/join-scans exceeds its timeout PT1M, when the engine applies the policy of model/workflows/compliance-check.yaml, then the step is not retried (none, 0 attempts), it fails with evidence and the run ends Failed with no shared system changed (SCN-compliance-check-002, SCN-compliance-check-005)."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/security-engineer.yaml",
        "model/scenarios/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4924",
        "AIFACTORY-TASK-4925",
        "AIFACTORY-TASK-4926"
      ],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13603,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "compliance-check"
        ],
        "steps": [
          "compliance-check/fan-out-scans",
          "compliance-check/scan-code",
          "compliance-check/scan-infrastructure",
          "compliance-check/join-scans"
        ],
        "agents": [
          "security-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "blueprint-security-v1",
          "blueprint-infrastructure-v1",
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-compliance-check-002",
          "SCN-compliance-check-003",
          "SCN-compliance-check-004",
          "SCN-compliance-check-005"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-05",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1231",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/security-engineer.yaml",
        "model/scenarios/compliance-check.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1232]",
      "number": 1232
    },
    {
      "id": "AIFACTORY-TASK-4924",
      "type": "task",
      "parent": "AIFACTORY-US-1232",
      "title": "Recorded fixture of a generation with code and infrastructure findings",
      "sequence": "19.14.03.01",
      "description": "Recorded fixture of a generation with code and infrastructure findings. Expected output: A fixture generated output with one vulnerable dependency and one insecure code path, and a fixture Infrastructure Blueprint with one resource that breaks a policy rule, with the expected code-findings and infrastructure-findings (artifact-v1), as the oracle of SCN-compliance-check-003 and SCN-compliance-check-004.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture generated output with one vulnerable dependency and one insecure code path, and a fixture Infrastructure Blueprint with one resource that breaks a policy rule, with the expected code-findings and infrastructure-findings (artifact-v1), as the oracle of SCN-compliance-check-003 and SCN-compliance-check-004."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13603,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4924]",
      "number": 4924
    },
    {
      "id": "AIFACTORY-TASK-4925",
      "type": "task",
      "parent": "AIFACTORY-US-1232",
      "title": "Map the fan-out, the two scans and the join of the Draft release onto the engine step kinds",
      "sequence": "19.14.03.02",
      "description": "Map the fan-out, the two scans and the join of the Draft release onto the engine step kinds. Expected output: The parallel steps fan-out-scans and join-scans of the Draft release are loaded as the engine step kinds Fanout and Join with timeout PT1M and no retry, the two scans depend on the fan-out and the join on both scans exactly as declared in model/workflows/compliance-check.yaml, and the scans map their inputs as declared.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The parallel steps fan-out-scans and join-scans of the Draft release are loaded as the engine step kinds Fanout and Join with timeout PT1M and no retry, the two scans depend on the fan-out and the join on both scans exactly as declared in model/workflows/compliance-check.yaml, and the scans map their inputs as declared."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13603,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4925]",
      "number": 4925
    },
    {
      "id": "AIFACTORY-TASK-4926",
      "type": "task",
      "parent": "AIFACTORY-US-1232",
      "title": "Prove the parallel scans and the join on the fixture",
      "sequence": "19.14.03.03",
      "description": "Prove the parallel scans and the join on the fixture. Expected output: A fixture run proves SCN-compliance-check-002 to SCN-compliance-check-005 (AC1 to AC5 of AIFACTORY-US-1232); both scans are announced in one advance, the join completes only after both, and a scan failed with its budget spent ends in WorkflowRunFailed naming that scan, RunFailed once and no later step of the run becoming ready.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-compliance-check-002 to SCN-compliance-check-005 (AC1 to AC5 of AIFACTORY-US-1232); both scans are announced in one advance, the join completes only after both, and a scan failed with its budget spent ends in WorkflowRunFailed naming that scan, RunFailed once and no later step of the run becoming ready."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13603,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4926]",
      "number": 4926
    },
    {
      "id": "AIFACTORY-US-1233",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-117",
      "title": "The findings are raised with severity, owner and evidence and a critical finding fails the run",
      "sequence": "19.14.04",
      "description": "As a reviewer, I want every finding of the two scans recorded with severity, owner and evidence, and the run failed when one is critical, so that no promotion can proceed on a generation that carries a critical compliance or security finding. The last two steps of `compliance-check`. When `join-scans` completed the engine marks `raise-findings` ready and resolves `database-blueprint`, `security-blueprint`, `code-findings` from `steps.scan-code.code-findings` and `infrastructure-findings` from `steps.scan-infrastructure.infrastructure-findings`. The `privacy-compliance` release runs in shared-write class with the skills `privacy-compliance-compliance-risk-scorer` and `privacy-compliance-compliance-report-emitter`: it merges both lists, gives every finding an id, a category, a severity, an owner, its evidence references and a redacted summary, and returns `findings` (findings-v1) with the member `critical`, the count of the findings of severity critical, recorded once under the run envelope (D133). The findings are raised through `Audit.RaiseFindings` of AuditService (scope factory.audit.write), which records each finding as an open finding with one audit entry for the call and publishes `FindingRaised` once per recorded finding; the step declares `idempotency_key` finding id, so a retried attempt raises no finding twice, and a document whose `critical` count differs from the findings of severity critical it lists is refused with nothing recorded. The step binds no tool that reaches `Audit.RaiseFindings`, which is reported as an open question. When `raise-findings` succeeded the engine evaluates the condition `block-on-critical`, `steps.raise-findings.findings.critical == 0`, over the recorded output without a service call, within PT1M and without retry. A run with no critical finding completes with `findings` as its output; a critical finding fails the run with the findings as evidence, the definition declaring no false branch, so no promotion can proceed on this generation; a missing or unreadable output fails the condition instead of being read as passed (ADR-0027). Kind: behavior. Traces: workflows: compliance-check; steps: compliance-check/raise-findings, compliance-check/block-on-critical; agents: privacy-compliance; services: WorkflowEngineService, AuditService; aggregates: AuditService/Finding; apis: AuditService/Audit.RaiseFindings; events: WorkflowEngineService/StepReady, AuditService/FindingRaised, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: artifact-v1, findings-v1; scenarios: SCN-compliance-check-006, SCN-compliance-check-007; adrs: ADR-0014, ADR-0019, ADR-0027; requirements: FR-05, XL-10, XL-11. Depends on: AIFACTORY-US-1232, feature:workflow-engine-service, feature:run-control-service, feature:audit-service-complete. Sources: model/workflows/compliance-check.yaml, model/agents/operations/privacy-compliance.yaml, model/services/governance/AuditService.yaml, docs/reference/schemas/findings.schema.json, model/scenarios/compliance-check.yaml.",
      "acceptanceCriteria": [
        "AC1: Given compliance-check/join-scans completed, when `privacy-compliance` executes compliance-check/raise-findings with the four mapped inputs, then the output `findings` (findings-v1) is recorded once under the run envelope with exactly one attempt outcome, every finding of both scans carries its id, category, severity, owner, evidence references and summary, and `critical` equals the count of the findings of severity critical (SCN-compliance-check-006, ADR-0027, D133).",
        "AC2: Given `findings` is recorded, when the findings are raised through AuditService/Audit.RaiseFindings, then each finding is recorded once as an open finding of AuditService/Finding, AuditService/FindingRaised is published once per recorded finding, and a retried attempt under `idempotency_key` finding id raises no finding twice; given an attempt exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, then WorkflowEngineService/WorkflowRunFailed names the step, the two scan outputs stay in place as evidence and the run ends Failed (SCN-compliance-check-006, ADR-0014, D133).",
        "AC3: Given `steps.raise-findings.findings` is recorded with `critical` 0, when the engine evaluates compliance-check/block-on-critical, then the condition completes with exactly one outcome without a service call, WorkflowEngineService/WorkflowRunCompleted is emitted once with `findings` as the run output and RunControlService/RunCompleted follows exactly once (SCN-compliance-check-007, D133).",
        "AC4: Given `steps.raise-findings.findings` is recorded with `critical` above 0, or is missing or unreadable, or the evaluation exceeds PT1M, when the engine evaluates compliance-check/block-on-critical, then the condition fails with evidence instead of being read as passed, without a retry, WorkflowEngineService/WorkflowRunFailed names `block-on-critical` with the findings as evidence and RunControlService/RunFailed is published exactly once, so that no promotion can proceed on this generation (SCN-compliance-check-007, ADR-0014, ADR-0027)."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/privacy-compliance.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/findings.schema.json",
        "model/scenarios/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4927",
        "AIFACTORY-TASK-4928",
        "AIFACTORY-TASK-4929"
      ],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13604,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "compliance-check"
        ],
        "steps": [
          "compliance-check/raise-findings",
          "compliance-check/block-on-critical"
        ],
        "agents": [
          "privacy-compliance"
        ],
        "services": [
          "WorkflowEngineService",
          "AuditService"
        ],
        "aggregates": [
          "AuditService/Finding"
        ],
        "apis": [
          "AuditService/Audit.RaiseFindings"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "AuditService/FindingRaised",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "findings-v1"
        ],
        "scenarios": [
          "SCN-compliance-check-006",
          "SCN-compliance-check-007"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0019",
          "ADR-0027"
        ],
        "requirements": [
          "FR-05",
          "XL-10",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1232",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:audit-service-complete"
      ],
      "source": [
        "model/workflows/compliance-check.yaml",
        "model/agents/operations/privacy-compliance.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/findings.schema.json",
        "model/scenarios/compliance-check.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1233]",
      "number": 1233
    },
    {
      "id": "AIFACTORY-TASK-4927",
      "type": "task",
      "parent": "AIFACTORY-US-1233",
      "title": "Fixture findings sequences for the pass and the critical block",
      "sequence": "19.14.04.01",
      "description": "Fixture findings sequences for the pass and the critical block. Expected output: Two recorded scan output pairs, one with findings of severity at most high and one with one critical finding, each with the expected findings output valid against findings-v1 with its `critical` count, the expected FindingRaised per finding and the expected run outcome (Completed for the first pair, Failed naming block-on-critical for the second), as the oracle of SCN-compliance-check-006 and SCN-compliance-check-007.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Two recorded scan output pairs, one with findings of severity at most high and one with one critical finding, each with the expected findings output valid against findings-v1 with its `critical` count, the expected FindingRaised per finding and the expected run outcome (Completed for the first pair, Failed naming block-on-critical for the second), as the oracle of SCN-compliance-check-006 and SCN-compliance-check-007."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13604,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4927]",
      "number": 4927
    },
    {
      "id": "AIFACTORY-TASK-4928",
      "type": "task",
      "parent": "AIFACTORY-US-1233",
      "title": "Evaluate block-on-critical over the recorded findings and fail the run on a critical finding",
      "sequence": "19.14.04.02",
      "description": "Evaluate block-on-critical over the recorded findings and fail the run on a critical finding. Expected output: The condition block-on-critical of the Draft release reads steps.raise-findings.findings from the recorded output without a service call, exactly as model/workflows/compliance-check.yaml states; a `critical` count above 0, a missing or an unreadable output fails the condition with evidence and is never read as passed, and a count of 0 completes the run with findings as its output.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The condition block-on-critical of the Draft release reads steps.raise-findings.findings from the recorded output without a service call, exactly as model/workflows/compliance-check.yaml states; a `critical` count above 0, a missing or an unreadable output fails the condition with evidence and is never read as passed, and a count of 0 completes the run with findings as its output."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13604,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4928]",
      "number": 4928
    },
    {
      "id": "AIFACTORY-TASK-4929",
      "type": "task",
      "parent": "AIFACTORY-US-1233",
      "title": "Prove the raised findings and the critical block on the fixture",
      "sequence": "19.14.04.03",
      "description": "Prove the raised findings and the critical block on the fixture. Expected output: A fixture run proves SCN-compliance-check-006 and SCN-compliance-check-007 (AC1 to AC4 of AIFACTORY-US-1233); both sequences record findings valid against findings-v1 and raise each finding once through Audit.RaiseFindings, a retried attempt raises nothing twice, the pass sequence ends Completed with findings as the run output and the critical sequence ends in WorkflowRunFailed naming block-on-critical and RunFailed once.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-compliance-check-006 and SCN-compliance-check-007 (AC1 to AC4 of AIFACTORY-US-1233); both sequences record findings valid against findings-v1 and raise each finding once through Audit.RaiseFindings, a retried attempt raises nothing twice, the pass sequence ends Completed with findings as the run output and the critical sequence ends in WorkflowRunFailed naming block-on-critical and RunFailed once."
      ],
      "sourceArtifacts": [
        "model/workflows/compliance-check.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 136,
      "phase": "factory",
      "stackRank": 13604,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4929]",
      "number": 4929
    },
    {
      "id": "AIFACTORY-FEAT-118",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Technical debt review",
      "sequence": "19.15",
      "description": "The workflow definition debt-review as a published asset: Collects reviewer comments and analyzer results of a pipeline run, classifies the shortcuts as debt with owners and severity, and raises them as findings. It has 3 steps, names the agents code-reviewer, tech-lead and the tools none, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I4: Trust and accountability. Build order 137 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-090",
        "AIFACTORY-US-1234",
        "AIFACTORY-US-1235"
      ],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13700,
      "titlePrefix": "[AIFACTORY-FEAT-118]",
      "number": 118
    },
    {
      "id": "AIFACTORY-US-090",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-118",
      "title": "The Technical debt review workflow runs from its published definition",
      "sequence": "19.15.01",
      "description": "As a reviewer, I want the technical debt review workflow to run from its published definition with the agents, tools and gates it declares, so that debt-findings are produced the same way on every run, with evidence. The integration PBI of the definition `debt-review`. The definition is readiness-activated with three required members of one project: the analysis results of a pipeline run (`PipelineRunCompleted` of PipelineExecutionService in the state Succeeded, PartiallySucceeded or Failed), the merged change (`ChangeProposalMerged`) and the approved recipe (`RecipeApproved` of GenerationRecipeService). The optional input `review-comments` has no member slot, so a run the correlation submits carries no review comments and the review reads the analyzer results alone. When every member is satisfied the `ReadinessCorrelator` of WorkflowEngineService submits exactly one run through `SubmitRun` of RunControlService with its service token naming the project and the bundle idempotency key; a newer member version supersedes the open correlation. On `RunAccepted` the engine loads the Published release the run pinned through AgentRegistryService and marks the three agent steps ready in order: `collect-signals` on the `code-reviewer` release, then `classify-debt` and `raise-findings` on the `tech-lead` release. Every step declares `failure_policy` Retry, applied by Run Control only to a Failed attempt of failure class transient, the first two steps being of read and sandbox class and `raise-findings` of shared-write class with `idempotency_key` finding id (D133). No step declares a compensation (ADR-0014). The run reports exactly one outcome within its budget. Before any run, the definition release and the agent releases of `code-reviewer` and `tech-lead`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release. In I4 the evaluation gate of the complete delivery applies: where an evaluation suite exists for the asset kind, a release is published only with a passed evaluation record (ADR-0021), and an agent release published before I4 without one is resubmitted through the gate as a new version; the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1234 and AIFACTORY-US-1235; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: debt-review; steps: debt-review/collect-signals, debt-review/classify-debt, debt-review/raise-findings; agents: code-reviewer, tech-lead; services: WorkflowEngineService, RunControlService, AgentRegistryService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, WorkflowEngineService/ReadinessSatisfied, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, artifact-v1, change-set-v1, findings-v1; adrs: ADR-0014, ADR-0021, ADR-0024, ADR-0027; requirements: FR-08, XL-15. Depends on: AIFACTORY-US-1234, AIFACTORY-US-1235, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-complete, feature:agent-registry-service-publication. Sources: model/workflows/debt-review.yaml, model/agents/engineering/code-reviewer.yaml, model/agents/engineering/tech-lead.yaml, docs/planes/agent-runtime/workflow-definitions/debt-review.md.",
      "acceptanceCriteria": [
        "AC1: Given the Published release of `debt-review`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter and with a passed evaluation record where an evaluation suite exists for its asset kind (ADR-0021, D140), carries the activation block, the 3 steps, input mappings, retry policies, timeouts and the `failure_policy` Retry of every step exactly as in model/workflows/debt-review.yaml, when the last required member of an open WorkflowEngineService/ReadinessCorrelation of the project is satisfied, then WorkflowEngineService/ReadinessSatisfied is published, one run is submitted through RunControlService/SubmitRun with the service token of the engine naming the project and the bundle idempotency key and WorkflowEngineService/ReadinessRunSubmitted names the returned run; a repeated submission with the same key and body returns the same run; the same key with a different body is answered 409 by RunControlService/SubmitRun and the correlation becomes Superseded with reason conflict, publishing WorkflowEngineService/ReadinessSuperseded and no run; and a newer member version publishes WorkflowEngineService/ReadinessSuperseded instead of a second run (ADR-0014).",
        "AC2: Given RunControlService/RunAccepted for that release with the inputs `analysis-results`, `change-set` and `recipe`, when the engine opens its projection, then WorkflowEngineService/WorkflowRunStarted is emitted and debt-review/collect-signals, debt-review/classify-debt and debt-review/raise-findings become ready in that order on the pinned Published releases of `code-reviewer` and `tech-lead`, and no Draft release is loaded (D140).",
        "AC3: Given every step succeeds, when the run completes, then `debt-findings` (findings-v1) is recorded as the run output under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC4: Given a step is settled Failed with its retry budget spent or with a failure class other than transient, when the engine applies the compensation policy of model/workflows/debt-review.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and the failure class, the outputs already recorded stay in place as evidence and RunControlService/RunFailed is published exactly once (recovery, not replay, ADR-0014).",
        "AC5: Given the recorded fixture inputs of model/workflows/debt-review.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml",
        "model/agents/engineering/code-reviewer.yaml",
        "model/agents/engineering/tech-lead.yaml",
        "docs/planes/agent-runtime/workflow-definitions/debt-review.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-398",
        "AIFACTORY-TASK-399",
        "AIFACTORY-TASK-400",
        "AIFACTORY-TASK-725"
      ],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13701,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "debt-review"
        ],
        "steps": [
          "debt-review/collect-signals",
          "debt-review/classify-debt",
          "debt-review/raise-findings"
        ],
        "agents": [
          "code-reviewer",
          "tech-lead"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "WorkflowEngineService/ReadinessSatisfied",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "artifact-v1",
          "change-set-v1",
          "findings-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0021",
          "ADR-0024",
          "ADR-0027"
        ],
        "requirements": [
          "FR-08",
          "XL-15"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1234",
        "AIFACTORY-US-1235",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-complete",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/debt-review.yaml",
        "model/agents/engineering/code-reviewer.yaml",
        "model/agents/engineering/tech-lead.yaml",
        "docs/planes/agent-runtime/workflow-definitions/debt-review.md"
      ],
      "titlePrefix": "[AIFACTORY-US-090]",
      "number": 90
    },
    {
      "id": "AIFACTORY-TASK-398",
      "type": "task",
      "parent": "AIFACTORY-US-090",
      "title": "Author, submit and publish the release of the workflow definition debt-review with its agent releases",
      "sequence": "19.15.01.01",
      "description": "Author, submit and publish the release of the workflow definition debt-review with its agent releases. Expected output: The release of debt-review (workflow-definition-v1) authored with its activation block of three required members, its 3 steps, input mappings, retry policies, timeouts and compensation policy as in model/workflows/debt-review.yaml, the failure_policy Retry of every step copied as it stands, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases code-reviewer and tech-lead of AIFACTORY-TASK-399 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of debt-review (workflow-definition-v1) authored with its activation block of three required members, its 3 steps, input mappings, retry policies, timeouts and compensation policy as in model/workflows/debt-review.yaml, the failure_policy Retry of every step copied as it stands, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases code-reviewer and tech-lead of AIFACTORY-TASK-399 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-398]",
      "number": 398
    },
    {
      "id": "AIFACTORY-TASK-399",
      "type": "task",
      "parent": "AIFACTORY-US-090",
      "title": "Author the agent releases code-reviewer and tech-lead with their prompts and skills",
      "sequence": "19.15.01.02",
      "description": "Author the agent releases code-reviewer and tech-lead with their prompts and skills. Expected output: Draft releases of code-reviewer (the fourteen bound skills of model/agents/engineering/code-reviewer.yaml, model profile code-agent-strong) and tech-lead (the three bound skills of model/agents/engineering/tech-lead.yaml, model profile reasoning-high) with their instructions and tool bindings; each is evaluated with the suite engineering-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-398 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of code-reviewer (the fourteen bound skills of model/agents/engineering/code-reviewer.yaml, model profile code-agent-strong) and tech-lead (the three bound skills of model/agents/engineering/tech-lead.yaml, model profile reasoning-high) with their instructions and tool bindings; each is evaluated with the suite engineering-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-398 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13701,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-399]",
      "number": 399
    },
    {
      "id": "AIFACTORY-TASK-400",
      "type": "task",
      "parent": "AIFACTORY-US-090",
      "title": "Fixture run of debt-review against recorded inputs",
      "sequence": "19.15.01.03",
      "description": "Fixture run of debt-review against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-398; every step output validates against its descriptor and debt-findings matches the recorded one field by field (AC1, AC2, AC3 and AC5 of AIFACTORY-US-090).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-398; every step output validates against its descriptor and debt-findings matches the recorded one field by field (AC1, AC2, AC3 and AC5 of AIFACTORY-US-090)."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-400]",
      "number": 400
    },
    {
      "id": "AIFACTORY-TASK-725",
      "type": "task",
      "parent": "AIFACTORY-US-090",
      "title": "Verify debt-review-runs-from-its-definition by running the declared command",
      "sequence": "19.15.01.04",
      "description": "Verify debt-review-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-090, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, and the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of debt-review, code-reviewer and tech-lead that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-090, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, and the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of debt-review, code-reviewer and tech-lead that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13701,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-725]",
      "number": 725
    },
    {
      "id": "AIFACTORY-US-1234",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-118",
      "title": "The reviewer collects the debt signals of a pipeline run and the tech lead classifies them as debt items",
      "sequence": "19.15.02",
      "description": "As a reviewer, I want the shortcuts and deferred work named by analyzers and reviews gathered and classified with category, severity, owner and remedy, so that debt is visible as items someone owns instead of comments nobody follows up. The first two steps of `debt-review`. When the engine marks `collect-signals` ready it resolves `change-set`, `analysis-results` and, when the run carries it, `review-comments` from the run inputs. The `code-reviewer` release runs in read class with the tools its card allows for reading (list-files, search-text, read-range, get-git-diff, knowledge-search) and skills such as `code-reviewer-architecture-violation-detector` and `code-reviewer-refactor-strategy-advisor`: it gathers every analyzer result and review comment of the merged change that names a shortcut or deferred work and writes `signals`, citing each source. When `classify-debt` becomes ready it receives `recipe` and `review-findings` from `steps.collect-signals.signals`; the `tech-lead` release, read class, with the skill `tech-lead-escalation-decisions`, gives each item a category, a severity, an owner and a suggested remedy, weighing the template and library versions the recipe pins, and writes `debt-items`. Neither step changes the change set or the recipe or needs an approval. Both declare `failure_policy` Retry, exponential, 3 attempts, backoff 30s; a Failed attempt of failure class transient is retried, any other failure class is not, and a step that exceeds PT30M or spends its budget fails the run with the evidence. Kind: behavior. Traces: workflows: debt-review; steps: debt-review/collect-signals, debt-review/classify-debt; agents: code-reviewer, tech-lead; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: artifact-v1, change-set-v1; scenarios: SCN-debt-review-001, SCN-debt-review-002; adrs: ADR-0014; requirements: FR-08, XL-15. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/debt-review.yaml, model/agents/engineering/code-reviewer.yaml, model/agents/engineering/tech-lead.yaml, model/scenarios/debt-review.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `analysis-results` (artifact-v1), `change-set` (change-set-v1) and `recipe`, when `code-reviewer` executes debt-review/collect-signals, then the output `signals` (artifact-v1) is recorded once under the run envelope, lists every analyzer result and review comment that names a shortcut or deferred work with its source, and an absent `review-comments` input yields signals from the analyzer results alone (SCN-debt-review-001).",
        "AC2: Given `steps.collect-signals.signals` is recorded, when `tech-lead` executes debt-review/classify-debt with `recipe` and `review-findings`, then the output `debt-items` (artifact-v1) is recorded once and every item carries a category, a severity, an owner and a suggested remedy and cites the signal it comes from (SCN-debt-review-002).",
        "AC3: Given an attempt of debt-review/collect-signals or debt-review/classify-debt exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/debt-review.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-debt-review-001, SCN-debt-review-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml",
        "model/agents/engineering/code-reviewer.yaml",
        "model/agents/engineering/tech-lead.yaml",
        "model/scenarios/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4930",
        "AIFACTORY-TASK-4931",
        "AIFACTORY-TASK-4932"
      ],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13702,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "debt-review"
        ],
        "steps": [
          "debt-review/collect-signals",
          "debt-review/classify-debt"
        ],
        "agents": [
          "code-reviewer",
          "tech-lead"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "change-set-v1"
        ],
        "scenarios": [
          "SCN-debt-review-001",
          "SCN-debt-review-002"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "XL-15"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/debt-review.yaml",
        "model/agents/engineering/code-reviewer.yaml",
        "model/agents/engineering/tech-lead.yaml",
        "model/scenarios/debt-review.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1234]",
      "number": 1234
    },
    {
      "id": "AIFACTORY-TASK-4930",
      "type": "task",
      "parent": "AIFACTORY-US-1234",
      "title": "Recorded fixture of a merged change with debt signals",
      "sequence": "19.15.02.01",
      "description": "Recorded fixture of a merged change with debt signals. Expected output: A fixture merged change set, its analyzer results with two suppressed warnings and one deferred-work marker, an approved recipe, the expected signals artifact and the expected debt-items artifact with category, severity, owner and remedy per item, as the oracle of SCN-debt-review-001 and SCN-debt-review-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture merged change set, its analyzer results with two suppressed warnings and one deferred-work marker, an approved recipe, the expected signals artifact and the expected debt-items artifact with category, severity, owner and remedy per item, as the oracle of SCN-debt-review-001 and SCN-debt-review-002."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13702,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4930]",
      "number": 4930
    },
    {
      "id": "AIFACTORY-TASK-4931",
      "type": "task",
      "parent": "AIFACTORY-US-1234",
      "title": "Verify the input mappings of collect-signals and classify-debt in the Draft release",
      "sequence": "19.15.02.02",
      "description": "Verify the input mappings of collect-signals and classify-debt in the Draft release. Expected output: The steps collect-signals and classify-debt of the Draft release authored by AIFACTORY-TASK-398 resolve change-set, analysis-results, the optional review-comments, recipe and review-findings exactly as mapped in model/workflows/debt-review.yaml, are announced with actionClass read, and an absent optional input resolves to nothing rather than failing the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps collect-signals and classify-debt of the Draft release authored by AIFACTORY-TASK-398 resolve change-set, analysis-results, the optional review-comments, recipe and review-findings exactly as mapped in model/workflows/debt-review.yaml, are announced with actionClass read, and an absent optional input resolves to nothing rather than failing the step."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4931]",
      "number": 4931
    },
    {
      "id": "AIFACTORY-TASK-4932",
      "type": "task",
      "parent": "AIFACTORY-US-1234",
      "title": "Prove the collection and the classification on the fixture",
      "sequence": "19.15.02.03",
      "description": "Prove the collection and the classification on the fixture. Expected output: A fixture run proves SCN-debt-review-001 and SCN-debt-review-002 (AC1 to AC3 of AIFACTORY-US-1234), including a run without review-comments and the retry exhaustion path ending in a WorkflowRunFailed that names the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-debt-review-001 and SCN-debt-review-002 (AC1 to AC3 of AIFACTORY-US-1234), including a run without review-comments and the retry exhaustion path ending in a WorkflowRunFailed that names the step."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13702,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4932]",
      "number": 4932
    },
    {
      "id": "AIFACTORY-US-1235",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-118",
      "title": "The tech lead raises the classified debt items as findings with evidence and the run completes",
      "sequence": "19.15.03",
      "description": "As a reviewer, I want the classified debt items recorded as findings with their evidence, so that the debt of a pipeline run can be followed up from one recorded output. The last step of `debt-review`. When `classify-debt` succeeded the engine marks `raise-findings` ready and resolves `recipe` from the run input, `review-findings` from `steps.collect-signals.signals` and `debt-items` from `steps.classify-debt.debt-items`. The `tech-lead` release runs in shared-write class and turns every debt item into a finding with its id, category, severity, owner, evidence references (the signal that justifies it) and a redacted summary carrying the remedy, returned as `debt-findings` (findings-v1) with the member `critical`, the count of the findings of severity critical, and recorded once under the run envelope (D133). The findings are raised through `Audit.RaiseFindings` of AuditService (scope factory.audit.write), which records each finding as an open finding with one audit entry for the call and publishes `FindingRaised` once per recorded finding; the step declares `idempotency_key` finding id, so a retried attempt raises no finding twice, and a document whose `critical` count differs from the findings of severity critical it lists is refused with nothing recorded. The step binds no tool that reaches `Audit.RaiseFindings`, which is reported as an open question. The run then completes with `debt-findings` as its output and Run Control records exactly one Completed outcome. The step declares `failure_policy` Retry, exponential, 3 attempts, backoff 30s: a Failed attempt of failure class transient is retried, which holds for this shared-write step because it declares an idempotency key (D114), any other failure class is not, and a step that exceeds PT30M or spends its budget fails the run with the evidence while the signals and the debt items stay in place. Kind: behavior. Traces: workflows: debt-review; steps: debt-review/raise-findings; agents: tech-lead; services: WorkflowEngineService, AuditService; aggregates: AuditService/Finding; apis: AuditService/Audit.RaiseFindings; events: AuditService/FindingRaised, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: artifact-v1, findings-v1; scenarios: SCN-debt-review-003; adrs: ADR-0014, ADR-0027; requirements: FR-08, XL-15. Depends on: AIFACTORY-US-1234, feature:workflow-engine-service, feature:run-control-service, feature:audit-service-complete. Sources: model/workflows/debt-review.yaml, model/agents/engineering/tech-lead.yaml, model/services/governance/AuditService.yaml, docs/reference/schemas/findings.schema.json, model/scenarios/debt-review.yaml.",
      "acceptanceCriteria": [
        "AC1: Given debt-review/classify-debt succeeded, when `tech-lead` executes debt-review/raise-findings with `recipe`, `review-findings` and `debt-items`, then the output `debt-findings` (findings-v1) is recorded once under the run envelope with exactly one attempt outcome, every debt item carries its id, category, severity, owner, evidence references and summary, and `critical` equals the count of the findings of severity critical (SCN-debt-review-003, ADR-0027, D133).",
        "AC2: Given the output is recorded, when the findings are raised through AuditService/Audit.RaiseFindings and the step completes, then each finding is recorded once as an open finding of AuditService/Finding, AuditService/FindingRaised is published once per recorded finding, a retried attempt under `idempotency_key` finding id raises no finding twice, WorkflowEngineService/WorkflowRunCompleted is emitted once with `debt-findings` as the run output and RunControlService/RunCompleted follows exactly once (SCN-debt-review-003, ADR-0014, D133).",
        "AC3: Given an attempt of debt-review/raise-findings exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/debt-review.yaml, then WorkflowEngineService/WorkflowRunFailed names the step, `signals` and `debt-items` stay in place as evidence and RunControlService/RunFailed is published exactly once (SCN-debt-review-003, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml",
        "model/agents/engineering/tech-lead.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/findings.schema.json",
        "model/scenarios/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4933",
        "AIFACTORY-TASK-4934",
        "AIFACTORY-TASK-4935"
      ],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13703,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "debt-review"
        ],
        "steps": [
          "debt-review/raise-findings"
        ],
        "agents": [
          "tech-lead"
        ],
        "services": [
          "WorkflowEngineService",
          "AuditService"
        ],
        "aggregates": [
          "AuditService/Finding"
        ],
        "apis": [
          "AuditService/Audit.RaiseFindings"
        ],
        "events": [
          "AuditService/FindingRaised",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "artifact-v1",
          "findings-v1"
        ],
        "scenarios": [
          "SCN-debt-review-003"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-08",
          "XL-15"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1234",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:audit-service-complete"
      ],
      "source": [
        "model/workflows/debt-review.yaml",
        "model/agents/engineering/tech-lead.yaml",
        "model/services/governance/AuditService.yaml",
        "docs/reference/schemas/findings.schema.json",
        "model/scenarios/debt-review.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1235]",
      "number": 1235
    },
    {
      "id": "AIFACTORY-TASK-4933",
      "type": "task",
      "parent": "AIFACTORY-US-1235",
      "title": "Fixture expected debt findings of the recorded debt items",
      "sequence": "19.15.03.01",
      "description": "Fixture expected debt findings of the recorded debt items. Expected output: The expected debt-findings output of the fixture debt items of AIFACTORY-TASK-4930 valid against findings-v1, with the id, category, severity, owner, evidence references and summary of each item, its critical count and the expected FindingRaised per finding, as the oracle of SCN-debt-review-003.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected debt-findings output of the fixture debt items of AIFACTORY-TASK-4930 valid against findings-v1, with the id, category, severity, owner, evidence references and summary of each item, its critical count and the expected FindingRaised per finding, as the oracle of SCN-debt-review-003."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13703,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4933]",
      "number": 4933
    },
    {
      "id": "AIFACTORY-TASK-4934",
      "type": "task",
      "parent": "AIFACTORY-US-1235",
      "title": "Map the raise-findings output to the run output of the Draft release",
      "sequence": "19.15.03.02",
      "description": "Map the raise-findings output to the run output of the Draft release. Expected output: The step raise-findings of the Draft release maps recipe, review-findings and debt-items as declared in model/workflows/debt-review.yaml with side-effect class shared-write and idempotency_key finding id, its recorded output debt-findings (findings-v1) is raised through Audit.RaiseFindings and set as the run output debt-findings when the run completes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The step raise-findings of the Draft release maps recipe, review-findings and debt-items as declared in model/workflows/debt-review.yaml with side-effect class shared-write and idempotency_key finding id, its recorded output debt-findings (findings-v1) is raised through Audit.RaiseFindings and set as the run output debt-findings when the run completes."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13703,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4934]",
      "number": 4934
    },
    {
      "id": "AIFACTORY-TASK-4935",
      "type": "task",
      "parent": "AIFACTORY-US-1235",
      "title": "Prove the raised debt findings and the run completion on the fixture",
      "sequence": "19.15.03.03",
      "description": "Prove the raised debt findings and the run completion on the fixture. Expected output: A fixture run proves SCN-debt-review-003 (AC1 to AC3 of AIFACTORY-US-1235); one FindingRaised per finding with none raised twice under a retried attempt, WorkflowRunCompleted and RunCompleted exactly once on success, and the retry exhaustion path ending in WorkflowRunFailed and RunFailed once with the earlier outputs kept.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-debt-review-003 (AC1 to AC3 of AIFACTORY-US-1235); one FindingRaised per finding with none raised twice under a retried attempt, WorkflowRunCompleted and RunCompleted exactly once on success, and the retry exhaustion path ending in WorkflowRunFailed and RunFailed once with the earlier outputs kept."
      ],
      "sourceArtifacts": [
        "model/workflows/debt-review.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 137,
      "phase": "factory",
      "stackRank": 13703,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4935]",
      "number": 4935
    },
    {
      "id": "AIFACTORY-FEAT-119",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Behaviour simulation",
      "sequence": "19.16",
      "description": "The workflow definition behaviour-simulation as a published asset: Runs the acceptance scenarios of a generated product end to end in the sandbox with agents, scores the results into evaluation records and stores the validated results. It has 4 steps, names the agents e2e-testing, qa-engineer and the tools shell-sandbox, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I4: Trust and accountability. Build order 138 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-091",
        "AIFACTORY-US-1236",
        "AIFACTORY-US-1237"
      ],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13800,
      "titlePrefix": "[AIFACTORY-FEAT-119]",
      "number": 119
    },
    {
      "id": "AIFACTORY-US-091",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-119",
      "title": "The Behaviour simulation workflow runs from its published definition",
      "sequence": "19.16.01",
      "description": "As a requester, I want the behaviour simulation workflow to run from its published definition with the agents, tools and gates it declares, so that simulation-results are produced the same way on every run, with evidence. The integration PBI of the definition `behaviour-simulation`. The definition is readiness-activated with four required members of one project: the validated Test, Service and Module Blueprints (`BlueprintValidated` with `passed` true and the matching kind) and the generation run (`GenerationCompleted` of GenerationRecipeService with at least one module). When every member is satisfied the `ReadinessCorrelator` of WorkflowEngineService submits exactly one run through `SubmitRun` of RunControlService with its service token naming the project and the bundle idempotency key; a newer member version supersedes the open correlation. On `RunAccepted` the engine loads the Published release the run pinned through AgentRegistryService and marks the four steps ready in order: the tool step `prepare-sandbox` on `shell-sandbox`, `run-scenarios` on the `e2e-testing` release, then `score` and `store-results` on the `qa-engineer` release. Every step declares `failure_policy` Retry, applied by Run Control only to a Failed attempt of failure class transient, the steps being of read and sandbox class; the simulation never touches a shared or production system. No step declares a compensation, so a failed run leaves its sandbox outputs as evidence (ADR-0014). The run reports exactly one outcome within its budget. Before any run, the definition release and the agent releases of `e2e-testing` and `qa-engineer`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release. In I4 the evaluation gate of the complete delivery applies: where an evaluation suite exists for the asset kind, a release is published only with a passed evaluation record (ADR-0021), and an agent release published before I4 without one is resubmitted through the gate as a new version; the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1236 and AIFACTORY-US-1237; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: behaviour-simulation; steps: behaviour-simulation/prepare-sandbox, behaviour-simulation/run-scenarios, behaviour-simulation/score, behaviour-simulation/store-results; agents: e2e-testing, qa-engineer; tools: shell-sandbox; services: WorkflowEngineService, RunControlService, AgentRegistryService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, WorkflowEngineService/ReadinessSatisfied, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-test-v1, blueprint-service-v1, blueprint-module-v1, change-set-v1, artifact-v1; adrs: ADR-0014, ADR-0021, ADR-0027; requirements: FR-08, FUX-10, XL-08, XL-09. Depends on: AIFACTORY-US-1236, AIFACTORY-US-1237, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-complete, feature:agent-registry-service-publication. Sources: model/workflows/behaviour-simulation.yaml, model/agents/qa/e2e-testing.yaml, model/agents/qa/qa-engineer.yaml, docs/planes/agent-runtime/workflow-definitions/behaviour-simulation.md.",
      "acceptanceCriteria": [
        "AC1: Given the Published release of `behaviour-simulation`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter and with a passed evaluation record where an evaluation suite exists for its asset kind (ADR-0021, D140), carries the activation block, the 4 steps, input mappings, retry policies, timeouts and the `failure_policy` Retry of every step exactly as in model/workflows/behaviour-simulation.yaml, when the last required member of an open WorkflowEngineService/ReadinessCorrelation of the project is satisfied, then one run is submitted through RunControlService/SubmitRun with the service token of the engine naming the project and the bundle idempotency key after WorkflowEngineService/ReadinessSatisfied, and WorkflowEngineService/ReadinessRunSubmitted names the returned run; a repeated submission with the same key and body returns the same run; the same key with a different body is answered 409 by RunControlService/SubmitRun and the correlation becomes Superseded with reason conflict, publishing WorkflowEngineService/ReadinessSuperseded and no run; and a newer member version publishes WorkflowEngineService/ReadinessSuperseded instead of a second run (ADR-0014).",
        "AC2: Given RunControlService/RunAccepted for that release with the inputs `test-blueprint`, `generated-outputs`, `service-blueprint` and `module-blueprints`, when the engine opens its projection, then WorkflowEngineService/WorkflowRunStarted is emitted and behaviour-simulation/prepare-sandbox, behaviour-simulation/run-scenarios, behaviour-simulation/score and behaviour-simulation/store-results become ready in that order on the tool `shell-sandbox` and the pinned Published releases of `e2e-testing` and `qa-engineer`, and no Draft release is loaded (D140).",
        "AC3: Given every step succeeds, when the run completes, then `simulation-results` (artifact-v1) is recorded as the run output under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC4: Given a step is settled Failed with its retry budget spent or with a failure class other than transient, when the engine applies the compensation policy of model/workflows/behaviour-simulation.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and the failure class, the sandbox outputs stay in place as evidence and RunControlService/RunFailed is published exactly once (recovery, not replay, ADR-0014).",
        "AC5: Given the recorded fixture inputs of model/workflows/behaviour-simulation.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0021)."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml",
        "model/agents/qa/e2e-testing.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/behaviour-simulation.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-401",
        "AIFACTORY-TASK-402",
        "AIFACTORY-TASK-403",
        "AIFACTORY-TASK-722"
      ],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13801,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "behaviour-simulation"
        ],
        "steps": [
          "behaviour-simulation/prepare-sandbox",
          "behaviour-simulation/run-scenarios",
          "behaviour-simulation/score",
          "behaviour-simulation/store-results"
        ],
        "agents": [
          "e2e-testing",
          "qa-engineer"
        ],
        "tools": [
          "shell-sandbox"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "WorkflowEngineService/ReadinessSatisfied",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-test-v1",
          "blueprint-service-v1",
          "blueprint-module-v1",
          "change-set-v1",
          "artifact-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0021",
          "ADR-0027"
        ],
        "requirements": [
          "FR-08",
          "FUX-10",
          "XL-08",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1236",
        "AIFACTORY-US-1237",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-complete",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/behaviour-simulation.yaml",
        "model/agents/qa/e2e-testing.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/behaviour-simulation.md"
      ],
      "titlePrefix": "[AIFACTORY-US-091]",
      "number": 91
    },
    {
      "id": "AIFACTORY-TASK-401",
      "type": "task",
      "parent": "AIFACTORY-US-091",
      "title": "Author, submit and publish the release of the workflow definition behaviour-simulation with its agent releases",
      "sequence": "19.16.01.01",
      "description": "Author, submit and publish the release of the workflow definition behaviour-simulation with its agent releases. Expected output: The release of behaviour-simulation (workflow-definition-v1) authored with its activation block of four required members, its 4 steps, input mappings, retry policies, timeouts and compensation policy as in model/workflows/behaviour-simulation.yaml, the failure_policy Retry of every step copied as it stands, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases e2e-testing and qa-engineer of AIFACTORY-TASK-402 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of behaviour-simulation (workflow-definition-v1) authored with its activation block of four required members, its 4 steps, input mappings, retry policies, timeouts and compensation policy as in model/workflows/behaviour-simulation.yaml, the failure_policy Retry of every step copied as it stands, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases e2e-testing and qa-engineer of AIFACTORY-TASK-402 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-401]",
      "number": 401
    },
    {
      "id": "AIFACTORY-TASK-402",
      "type": "task",
      "parent": "AIFACTORY-US-091",
      "title": "Author the agent releases e2e-testing and qa-engineer with their prompts and skills",
      "sequence": "19.16.01.02",
      "description": "Author the agent releases e2e-testing and qa-engineer with their prompts and skills. Expected output: Draft releases of e2e-testing (the three bound skills of model/agents/qa/e2e-testing.yaml, model profile code-agent, with the browser-session and shell-sandbox bindings) and qa-engineer (the ten bound skills of model/agents/qa/qa-engineer.yaml, model profile code-agent) with their instructions; each is evaluated with the suite qa-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-401 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of e2e-testing (the three bound skills of model/agents/qa/e2e-testing.yaml, model profile code-agent, with the browser-session and shell-sandbox bindings) and qa-engineer (the ten bound skills of model/agents/qa/qa-engineer.yaml, model profile code-agent) with their instructions; each is evaluated with the suite qa-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-401 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13801,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-402]",
      "number": 402
    },
    {
      "id": "AIFACTORY-TASK-403",
      "type": "task",
      "parent": "AIFACTORY-US-091",
      "title": "Fixture run of behaviour-simulation against recorded inputs",
      "sequence": "19.16.01.03",
      "description": "Fixture run of behaviour-simulation against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-401; every step output validates against its descriptor and simulation-results matches the recorded one field by field (AC1, AC2, AC3 and AC5 of AIFACTORY-US-091).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-401; every step output validates against its descriptor and simulation-results matches the recorded one field by field (AC1, AC2, AC3 and AC5 of AIFACTORY-US-091)."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-403]",
      "number": 403
    },
    {
      "id": "AIFACTORY-TASK-722",
      "type": "task",
      "parent": "AIFACTORY-US-091",
      "title": "Verify behaviour-simulation-runs-from-its-definition by running the declared command",
      "sequence": "19.16.01.04",
      "description": "Verify behaviour-simulation-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-091, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, and the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of behaviour-simulation, e2e-testing and qa-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-091, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, and the failure path of AC4 (WorkflowRunFailed then RunFailed exactly once); the output names the Published release ids of behaviour-simulation, e2e-testing and qa-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13801,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-722]",
      "number": 722
    },
    {
      "id": "AIFACTORY-US-1236",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-119",
      "title": "The generated product is started in the sandbox and the end-to-end role drives its acceptance scenarios",
      "sequence": "19.16.02",
      "description": "As a requester, I want the acceptance scenarios of my generated product driven end to end through its UI and APIs in an isolated sandbox, so that the behaviour of the product is observed with a trace per step before anything reaches a shared environment. The first two steps of `behaviour-simulation`. When the engine marks `prepare-sandbox` ready it resolves `generated-outputs` from the run input and emits `StepReady` with `actionClass` sandbox; Run Control dispatches the attempt and the tool `shell-sandbox` of ToolAdapterService builds and starts the generated product in the sandbox pool with seeded data, its commands audited with commandLine, exitCode, durationMs and sandbox as the tool card declares. The step returns `environment` (execution-scope-v1) naming the sandbox the product runs in. It declares `failure_policy` Retry with a fixed budget of 2 attempts and backoff 10s and a timeout PT30M. When `run-scenarios` becomes ready it receives `automation` from `input.generated-outputs`, `environment` from `steps.prepare-sandbox.environment` and `test-blueprint`; the `e2e-testing` release, sandbox class, with the skills `e2e-testing-journey-suites`, `e2e-testing-browser-sessions-in-sandbox-pools` and `e2e-testing-typed-results` and the tools browser-session and build-and-test, drives every acceptance scenario of the Test Blueprint through the UI and the APIs of the running product; every scenario step leaves a trace. It writes `scenario-results` with the verdict and trace of each scenario. A failing scenario is a result, not a step failure. The step declares `failure_policy` Retry, exponential, 3 attempts, timeout PT2H. Neither step touches a shared system. Kind: behavior. Traces: workflows: behaviour-simulation; steps: behaviour-simulation/prepare-sandbox, behaviour-simulation/run-scenarios; agents: e2e-testing; tools: shell-sandbox; services: WorkflowEngineService, ToolAdapterService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: change-set-v1, execution-scope-v1, blueprint-test-v1, artifact-v1; scenarios: SCN-behaviour-simulation-001, SCN-behaviour-simulation-002; adrs: ADR-0014; requirements: FR-08, FUX-10, XL-08. Depends on: feature:workflow-engine-service, feature:run-control-service, feature:tool-adapter-service. Sources: model/workflows/behaviour-simulation.yaml, model/tools/shell-sandbox.yaml, model/agents/qa/e2e-testing.yaml, model/scenarios/behaviour-simulation.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `generated-outputs` (change-set-v1), when behaviour-simulation/prepare-sandbox runs `shell-sandbox`, then the product is built and started in the sandbox pool with seeded data, the output `environment` (execution-scope-v1) is recorded once under the run envelope and every command is audited with the fields of model/tools/shell-sandbox.yaml (SCN-behaviour-simulation-001).",
        "AC2: Given an attempt of behaviour-simulation/prepare-sandbox settles Failed with failure class transient, when Run Control evaluates the step, then it is retried under the fixed budget of 2 attempts with backoff 10s; given the budget is spent, the attempt exceeds PT30M or fails with any other failure class, then WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-behaviour-simulation-001, ADR-0014).",
        "AC3: Given `steps.prepare-sandbox.environment` is recorded, when `e2e-testing` executes behaviour-simulation/run-scenarios with `automation`, `environment` and `test-blueprint`, then every acceptance scenario of the Test Blueprint is driven through the UI or the APIs of the sandboxed product, the output `scenario-results` (artifact-v1) is recorded once with a verdict and a trace per scenario, and a failed scenario is recorded as a result while the step succeeds (SCN-behaviour-simulation-002).",
        "AC4: Given an attempt of behaviour-simulation/run-scenarios exceeds its timeout PT2H, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/behaviour-simulation.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and the sandbox output stays in place as evidence (SCN-behaviour-simulation-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml",
        "model/tools/shell-sandbox.yaml",
        "model/agents/qa/e2e-testing.yaml",
        "model/scenarios/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4936",
        "AIFACTORY-TASK-4937",
        "AIFACTORY-TASK-4938"
      ],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13802,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "behaviour-simulation"
        ],
        "steps": [
          "behaviour-simulation/prepare-sandbox",
          "behaviour-simulation/run-scenarios"
        ],
        "agents": [
          "e2e-testing"
        ],
        "tools": [
          "shell-sandbox"
        ],
        "services": [
          "WorkflowEngineService",
          "ToolAdapterService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "change-set-v1",
          "execution-scope-v1",
          "blueprint-test-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-behaviour-simulation-001",
          "SCN-behaviour-simulation-002"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-08",
          "FUX-10",
          "XL-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/workflows/behaviour-simulation.yaml",
        "model/tools/shell-sandbox.yaml",
        "model/agents/qa/e2e-testing.yaml",
        "model/scenarios/behaviour-simulation.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1236]",
      "number": 1236
    },
    {
      "id": "AIFACTORY-TASK-4936",
      "type": "task",
      "parent": "AIFACTORY-US-1236",
      "title": "Recorded fixture product with acceptance scenarios and seeded data",
      "sequence": "19.16.02.01",
      "description": "Recorded fixture product with acceptance scenarios and seeded data. Expected output: A fixture generated output that builds and starts in the sandbox, its seeded data, a Test Blueprint with three acceptance scenarios of which one is expected to fail, the expected environment (execution-scope-v1) and the expected scenario-results with a verdict and a trace per scenario, as the oracle of SCN-behaviour-simulation-001 and SCN-behaviour-simulation-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture generated output that builds and starts in the sandbox, its seeded data, a Test Blueprint with three acceptance scenarios of which one is expected to fail, the expected environment (execution-scope-v1) and the expected scenario-results with a verdict and a trace per scenario, as the oracle of SCN-behaviour-simulation-001 and SCN-behaviour-simulation-002."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13802,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4936]",
      "number": 4936
    },
    {
      "id": "AIFACTORY-TASK-4937",
      "type": "task",
      "parent": "AIFACTORY-US-1236",
      "title": "Bind prepare-sandbox to shell-sandbox and map the run-scenarios inputs in the Draft release",
      "sequence": "19.16.02.02",
      "description": "Bind prepare-sandbox to shell-sandbox and map the run-scenarios inputs in the Draft release. Expected output: The tool step prepare-sandbox of the Draft release calls shell-sandbox with generated-outputs and returns environment as execution-scope-v1, announced with actionClass sandbox and the fixed retry of model/workflows/behaviour-simulation.yaml; the agent step run-scenarios maps automation, environment and test-blueprint as declared there.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The tool step prepare-sandbox of the Draft release calls shell-sandbox with generated-outputs and returns environment as execution-scope-v1, announced with actionClass sandbox and the fixed retry of model/workflows/behaviour-simulation.yaml; the agent step run-scenarios maps automation, environment and test-blueprint as declared there."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13802,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4937]",
      "number": 4937
    },
    {
      "id": "AIFACTORY-TASK-4938",
      "type": "task",
      "parent": "AIFACTORY-US-1236",
      "title": "Prove the sandbox preparation and the scenario run on the fixture",
      "sequence": "19.16.02.03",
      "description": "Prove the sandbox preparation and the scenario run on the fixture. Expected output: A fixture run proves SCN-behaviour-simulation-001 and SCN-behaviour-simulation-002 (AC1 to AC4 of AIFACTORY-US-1236); the expected failing scenario is recorded as a result while run-scenarios succeeds, and the retry exhaustion of prepare-sandbox ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-behaviour-simulation-001 and SCN-behaviour-simulation-002 (AC1 to AC4 of AIFACTORY-US-1236); the expected failing scenario is recorded as a result while run-scenarios succeeds, and the retry exhaustion of prepare-sandbox ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13802,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4938]",
      "number": 4938
    },
    {
      "id": "AIFACTORY-US-1237",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-119",
      "title": "The QA role scores the scenario results into evaluation records and stores them with lineage",
      "sequence": "19.16.03",
      "description": "As a requester, I want the scenario results of a simulation scored for task success, regressions and flakiness and stored with their lineage, so that the quality of a generated product is recorded as evidence that later gates and reviews can read. The last two steps of `behaviour-simulation`. When `run-scenarios` succeeded the engine marks `score` ready and resolves `service-blueprint`, `module-blueprints`, `test-blueprint` and `scenario-results` from `steps.run-scenarios.scenario-results`. The `qa-engineer` release runs in read class with the skills `qa-engineer-detect-regression`, `qa-engineer-analyze-coverage` and `qa-engineer-compute-confidence-score`: it scores task success, regressions against the quality constraints of the Service Blueprint and flakiness of each scenario into `evaluation-records`. When `store-results` becomes ready it receives `service-blueprint`, `module-blueprints` and `evaluation-records` from `steps.score.evaluation-records`; the `qa-engineer` release, sandbox class, with the skill `qa-engineer-tag-output-with-trace`, writes the validated results and returns `simulation-results` as its step output. AgentRuntimeService records that output through `Artifacts.Store` of ArtifactService with the producer run, attempt and agent, ArtifactService being the one writer of artifacts. Three points are open and reported to the owner. First, the step summary asks to store the results and the evaluation records with lineage to the generated outputs, but the mappings of `store-results` carry no generated-outputs input, so a lineage edge to the generated outputs would need a run-input edge the step does not receive; whether the edge goes to the generated outputs or to the evaluation records the step receives, and whether the evaluation records are stored by this step as well, is an owner decision. Second, the definition declares `emits: ArtifactValidated, EvaluationCompleted`: ArtifactValidated is the validator verdict of ArtifactService behind the validated results and EvaluationCompleted is an event of QualityScoreService (quality-score-service-complete, I4), but no step of the definition calls an operation that produces either. Third, how the evaluation records reach QualityScoreService is not modelled. Both steps declare `failure_policy` Retry, exponential, 3 attempts, backoff 30s, timeout PT30M; the run then completes with `simulation-results` as its output. Kind: behavior. Traces: workflows: behaviour-simulation; steps: behaviour-simulation/score, behaviour-simulation/store-results; agents: qa-engineer; services: WorkflowEngineService, AgentRuntimeService, ArtifactService; aggregates: ArtifactService/Artifact; apis: ArtifactService/Artifacts.Store; events: ArtifactService/ArtifactStored, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCompleted; descriptors: blueprint-service-v1, blueprint-module-v1, blueprint-test-v1, artifact-v1; scenarios: SCN-behaviour-simulation-003, SCN-behaviour-simulation-004; adrs: ADR-0014, ADR-0021; requirements: FR-08, XL-09. Depends on: AIFACTORY-US-1236, feature:workflow-engine-service, feature:run-control-service, feature:artifact-service, feature:agent-runtime-service. Sources: model/workflows/behaviour-simulation.yaml, model/agents/qa/qa-engineer.yaml, model/services/knowledge/ArtifactService.yaml, model/scenarios/behaviour-simulation.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.run-scenarios.scenario-results` is recorded, when `qa-engineer` executes behaviour-simulation/score with the Service, Module and Test Blueprints, then the output `evaluation-records` (artifact-v1) is recorded once under the run envelope with task success, regressions and flakiness per scenario, each citing the scenario result it scores (SCN-behaviour-simulation-003).",
        "AC2: Given `steps.score.evaluation-records` is recorded, when `qa-engineer` executes behaviour-simulation/store-results, then AgentRuntimeService records `simulation-results` (artifact-v1) through ArtifactService/Artifacts.Store with the producer run, attempt and agent and exactly one new ArtifactService/ArtifactStored is emitted for it; the lineage edge it carries (to the generated outputs, as the step summary says, or to the evaluation records the step receives) and whether the evaluation records are stored as well are asserted only once the owner decides them (SCN-behaviour-simulation-004).",
        "AC3: Given the results are stored, when the step completes, then the run output `simulation-results` is set, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (SCN-behaviour-simulation-004, ADR-0014).",
        "AC4: Given an attempt of behaviour-simulation/score or behaviour-simulation/store-results exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/behaviour-simulation.yaml, then WorkflowEngineService/WorkflowRunFailed names the step, the earlier outputs stay in place and no artifact is written twice on recovery, ArtifactService/Artifacts.Store being idempotent on tenant and hash (SCN-behaviour-simulation-003, SCN-behaviour-simulation-004, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/scenarios/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4939",
        "AIFACTORY-TASK-4940",
        "AIFACTORY-TASK-4941"
      ],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13803,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "behaviour-simulation"
        ],
        "steps": [
          "behaviour-simulation/score",
          "behaviour-simulation/store-results"
        ],
        "agents": [
          "qa-engineer"
        ],
        "services": [
          "WorkflowEngineService",
          "AgentRuntimeService",
          "ArtifactService"
        ],
        "aggregates": [
          "ArtifactService/Artifact"
        ],
        "apis": [
          "ArtifactService/Artifacts.Store"
        ],
        "events": [
          "ArtifactService/ArtifactStored",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCompleted"
        ],
        "descriptors": [
          "blueprint-service-v1",
          "blueprint-module-v1",
          "blueprint-test-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-behaviour-simulation-003",
          "SCN-behaviour-simulation-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0021"
        ],
        "requirements": [
          "FR-08",
          "XL-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1236",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:artifact-service",
        "feature:agent-runtime-service"
      ],
      "source": [
        "model/workflows/behaviour-simulation.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "model/services/knowledge/ArtifactService.yaml",
        "model/scenarios/behaviour-simulation.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1237]",
      "number": 1237
    },
    {
      "id": "AIFACTORY-TASK-4939",
      "type": "task",
      "parent": "AIFACTORY-US-1237",
      "title": "Fixture expected evaluation records and stored simulation results",
      "sequence": "19.16.03.01",
      "description": "Fixture expected evaluation records and stored simulation results. Expected output: The expected evaluation-records of the fixture scenario results of AIFACTORY-TASK-4936 (task success, one regression, flakiness per scenario) and the expected simulation-results artifact with its producer run, with the expectation of exactly one new ArtifactStored for it, as the oracle of SCN-behaviour-simulation-003 and SCN-behaviour-simulation-004; the expected lineage edge and any stored evaluation records are added once the owner decides them.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "The expected evaluation-records of the fixture scenario results of AIFACTORY-TASK-4936 (task success, one regression, flakiness per scenario) and the expected simulation-results artifact with its producer run, with the expectation of exactly one new ArtifactStored for it, as the oracle of SCN-behaviour-simulation-003 and SCN-behaviour-simulation-004; the expected lineage edge and any stored evaluation records are added once the owner decides them."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13803,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4939]",
      "number": 4939
    },
    {
      "id": "AIFACTORY-TASK-4940",
      "type": "task",
      "parent": "AIFACTORY-US-1237",
      "title": "Map the score and store-results steps and the run output in the Draft release",
      "sequence": "19.16.03.02",
      "description": "Map the score and store-results steps and the run output in the Draft release. Expected output: The steps score and store-results of the Draft release authored by AIFACTORY-TASK-401 map their inputs exactly as declared in model/workflows/behaviour-simulation.yaml, and the recorded output simulation-results is set as the run output simulation-results when the run completes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps score and store-results of the Draft release authored by AIFACTORY-TASK-401 map their inputs exactly as declared in model/workflows/behaviour-simulation.yaml, and the recorded output simulation-results is set as the run output simulation-results when the run completes."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13803,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4940]",
      "number": 4940
    },
    {
      "id": "AIFACTORY-TASK-4941",
      "type": "task",
      "parent": "AIFACTORY-US-1237",
      "title": "Prove the scoring, the stored results and the run completion on the fixture",
      "sequence": "19.16.03.03",
      "description": "Prove the scoring, the stored results and the run completion on the fixture. Expected output: A fixture run proves SCN-behaviour-simulation-003 and SCN-behaviour-simulation-004 (AC1 to AC4 of AIFACTORY-US-1237); exactly one new ArtifactStored for simulation-results, WorkflowRunCompleted and RunCompleted exactly once, and the timeout path ending Failed without a second write; the lineage edge is checked once the owner decides it.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-behaviour-simulation-003 and SCN-behaviour-simulation-004 (AC1 to AC4 of AIFACTORY-US-1237); exactly one new ArtifactStored for simulation-results, WorkflowRunCompleted and RunCompleted exactly once, and the timeout path ending Failed without a second write; the lineage edge is checked once the owner decides it."
      ],
      "sourceArtifacts": [
        "model/workflows/behaviour-simulation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 138,
      "phase": "factory",
      "stackRank": 13803,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4941]",
      "number": 4941
    },
    {
      "id": "AIFACTORY-FEAT-120",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Test plan",
      "sequence": "19.17",
      "description": "The workflow definition test-plan as a published asset: Builds the Test Blueprint from the service and module blueprints: scenarios from features and invariants, a coverage matrix and the quality constraints, validated against the DSL. It has 6 steps, names the agents qa-engineer, test-generator and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I4: Trust and accountability. Build order 139 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-092",
        "AIFACTORY-US-1238",
        "AIFACTORY-US-1239",
        "AIFACTORY-US-1240"
      ],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13900,
      "titlePrefix": "[AIFACTORY-FEAT-120]",
      "number": 120
    },
    {
      "id": "AIFACTORY-US-092",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-120",
      "title": "The Test plan workflow runs from its published definition",
      "sequence": "19.17.01",
      "description": "As a requester, I want the test plan workflow to run from its published definition with the agents, tools and gates it declares, so that test-blueprint, validation-receipt are produced the same way on every run, with evidence. The integration PBI of the definition `test-plan`. The definition is readiness-activated with two required members of one project, the validated Service and Module Blueprints (`BlueprintValidated` with `passed` true and the matching kind). When both are satisfied the `ReadinessCorrelator` of WorkflowEngineService submits exactly one run through `SubmitRun` of RunControlService with its service token naming the project and the bundle idempotency key; a newer member version supersedes the open correlation. On `RunAccepted` the engine loads the Published release the run pinned through AgentRegistryService and marks the six steps ready in order: `derive-scenarios` on the `test-generator` release, `coverage-matrix` and `draft-test-blueprint` on the `qa-engineer` release, the tool steps `submit-version` and `validate`, and the condition `check-valid`, which loops back to the draft at most twice. Every agent and tool step declares `failure_policy` Retry; the one shared-write step, `submit-version`, also declares `idempotency_key` documentHash, which is what lets its Retry hold under ADR-0014. The shared write is autonomous unless the project policy gates blueprint drafts, in which case the run waits for an approval bound to the request hash (D64). No step declares a compensation. The run completes with the outputs `test-blueprint`, bound to the validated BlueprintVersion that `steps.submit-version.version-ref` names (D133, AIFACTORY-US-1240), and `validation-receipt`, and reports exactly one outcome within its budget. Before any run, the definition release and the agent releases of `test-generator` and `qa-engineer`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release. In I4 the evaluation gate of the complete delivery applies: where an evaluation suite exists for the asset kind, a release is published only with a passed evaluation record (ADR-0021), and an agent release published before I4 without one is resubmitted through the gate as a new version; the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1238 to AIFACTORY-US-1240; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: test-plan; steps: test-plan/derive-scenarios, test-plan/coverage-matrix, test-plan/draft-test-blueprint, test-plan/submit-version, test-plan/validate, test-plan/check-valid; agents: qa-engineer, test-generator; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, WorkflowEngineService/ReadinessSatisfied, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-service-v1, blueprint-module-v1, blueprint-test-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0021, ADR-0024, ADR-0026; requirements: FR-08, FUX-10, XL-08. Depends on: AIFACTORY-US-1238, AIFACTORY-US-1239, AIFACTORY-US-1240, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-complete, feature:agent-registry-service-publication. Sources: model/workflows/test-plan.yaml, model/agents/qa/test-generator.yaml, model/agents/qa/qa-engineer.yaml, docs/planes/agent-runtime/workflow-definitions/test-plan.md.",
      "acceptanceCriteria": [
        "AC1: Given the Published release of `test-plan`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter and with a passed evaluation record where an evaluation suite exists for its asset kind (ADR-0021, D140), carries the activation block, the 6 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid, the `failure_policy` Retry of the five agent and tool steps and the `idempotency_key` documentHash of test-plan/submit-version exactly as in model/workflows/test-plan.yaml, when the last required member of an open WorkflowEngineService/ReadinessCorrelation is satisfied, then WorkflowEngineService/ReadinessSatisfied is published, one run is submitted through RunControlService/SubmitRun with the service token of the engine naming the project and the bundle idempotency key and WorkflowEngineService/ReadinessRunSubmitted names it; a repeated submission with the same key and body returns the same run; the same key with a different body is answered 409 by RunControlService/SubmitRun and the correlation becomes Superseded with reason conflict, publishing WorkflowEngineService/ReadinessSuperseded and no run; a newer member version publishes WorkflowEngineService/ReadinessSuperseded instead of a second run; and on RunControlService/RunAccepted WorkflowEngineService/WorkflowRunStarted is emitted and test-plan/derive-scenarios, test-plan/coverage-matrix, test-plan/draft-test-blueprint, test-plan/submit-version, test-plan/validate and test-plan/check-valid become ready in that order, each agent step on the pinned Published release of `test-generator` or `qa-engineer`, and no Draft release is loaded.",
        "AC2: Given every step succeeds and test-plan/check-valid holds, when the run completes, then `test-blueprint` (blueprint-test-v1, the validated BlueprintVersion that `steps.submit-version.version-ref` names, D133) and `validation-receipt` (blueprint-validation-receipt-v1) are recorded as the run outputs under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC3: Given a step is settled Failed with its retry budget spent or with a failure class that is not retried, or test-plan/check-valid reaches its iteration limit, when the engine applies the compensation policy of model/workflows/test-plan.yaml, then WorkflowEngineService/WorkflowRunFailed names the failed step and the failure class, every Draft version created stays a Draft and RunControlService/RunFailed is published exactly once (recovery, not replay, ADR-0014).",
        "AC4: Given the project policy gates blueprint drafts, when test-plan/submit-version is reached, then the run waits WaitingForApproval on a RunControlService/ApprovalRequested that names the run as its subject and resumes only on the matching RunControlService/ApprovalDecided, exactly as AIFACTORY-US-1239 AC3 specifies the gate (ADR-0026, D64, D129).",
        "AC5: Given the recorded fixture inputs of model/workflows/test-plan.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml",
        "model/agents/qa/test-generator.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/test-plan.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-404",
        "AIFACTORY-TASK-405",
        "AIFACTORY-TASK-406",
        "AIFACTORY-TASK-738"
      ],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13901,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "test-plan"
        ],
        "steps": [
          "test-plan/derive-scenarios",
          "test-plan/coverage-matrix",
          "test-plan/draft-test-blueprint",
          "test-plan/submit-version",
          "test-plan/validate",
          "test-plan/check-valid"
        ],
        "agents": [
          "qa-engineer",
          "test-generator"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "WorkflowEngineService/ReadinessSatisfied",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-service-v1",
          "blueprint-module-v1",
          "blueprint-test-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0021",
          "ADR-0024",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08",
          "FUX-10",
          "XL-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1238",
        "AIFACTORY-US-1239",
        "AIFACTORY-US-1240",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-complete",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/test-plan.yaml",
        "model/agents/qa/test-generator.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/test-plan.md"
      ],
      "titlePrefix": "[AIFACTORY-US-092]",
      "number": 92
    },
    {
      "id": "AIFACTORY-TASK-404",
      "type": "task",
      "parent": "AIFACTORY-US-092",
      "title": "Author, submit and publish the release of the workflow definition test-plan with its agent releases",
      "sequence": "19.17.01.01",
      "description": "Author, submit and publish the release of the workflow definition test-plan with its agent releases. Expected output: The release of test-plan (workflow-definition-v1) authored with its activation block, its 6 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid and the compensation policy as in model/workflows/test-plan.yaml, the failure_policy Retry of the five agent and tool steps copied as it stands and the idempotency_key documentHash of submit-version, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases test-generator and qa-engineer of AIFACTORY-TASK-405 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of test-plan (workflow-definition-v1) authored with its activation block, its 6 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid and the compensation policy as in model/workflows/test-plan.yaml, the failure_policy Retry of the five agent and tool steps copied as it stands and the idempotency_key documentHash of submit-version, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent releases test-generator and qa-engineer of AIFACTORY-TASK-405 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-404]",
      "number": 404
    },
    {
      "id": "AIFACTORY-TASK-405",
      "type": "task",
      "parent": "AIFACTORY-US-092",
      "title": "Author the agent releases qa-engineer and test-generator with their prompts and skills",
      "sequence": "19.17.01.02",
      "description": "Author the agent releases qa-engineer and test-generator with their prompts and skills. Expected output: Draft releases of test-generator (the forty-seven bound skills of model/agents/qa/test-generator.yaml, model profile code-agent) and qa-engineer (the ten bound skills of model/agents/qa/qa-engineer.yaml, model profile code-agent) with their instructions and tool bindings; each is evaluated with the suite qa-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-404 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "Draft releases of test-generator (the forty-seven bound skills of model/agents/qa/test-generator.yaml, model profile code-agent) and qa-engineer (the ten bound skills of model/agents/qa/qa-engineer.yaml, model profile code-agent) with their instructions and tool bindings; each is evaluated with the suite qa-core-v1 and carries a passed evaluation record before AIFACTORY-TASK-404 submits it for publication, and a release of either agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13901,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-405]",
      "number": 405
    },
    {
      "id": "AIFACTORY-TASK-406",
      "type": "task",
      "parent": "AIFACTORY-US-092",
      "title": "Fixture run of test-plan against recorded inputs",
      "sequence": "19.17.01.03",
      "description": "Fixture run of test-plan against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-404; every step output validates against its descriptor and test-blueprint and validation-receipt match the recorded ones field by field (AC1, AC2 and AC5 of AIFACTORY-US-092).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-404; every step output validates against its descriptor and test-blueprint and validation-receipt match the recorded ones field by field (AC1, AC2 and AC5 of AIFACTORY-US-092)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-406]",
      "number": 406
    },
    {
      "id": "AIFACTORY-TASK-738",
      "type": "task",
      "parent": "AIFACTORY-US-092",
      "title": "Verify test-plan-runs-from-its-definition by running the declared command",
      "sequence": "19.17.01.04",
      "description": "Verify test-plan-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-092, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, the failure path of AC3 and, at chain level, the wait of AC4 (the gate itself is proven by AIFACTORY-TASK-4947); the output names the Published release ids of test-plan, test-generator and qa-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-092, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, the failure path of AC3 and, at chain level, the wait of AC4 (the gate itself is proven by AIFACTORY-TASK-4947); the output names the Published release ids of test-plan, test-generator and qa-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-738]",
      "number": 738
    },
    {
      "id": "AIFACTORY-US-1238",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-120",
      "title": "Scenarios, a coverage matrix and the Test Blueprint draft are derived from the service and module blueprints",
      "sequence": "19.17.02",
      "description": "As a requester, I want acceptance scenarios derived from my features and invariants, mapped in a coverage matrix and written up as a Test Blueprint, so that the quality constraints of my product are planned before any test is generated. The three agent steps of `test-plan`. When the engine marks `derive-scenarios` ready it resolves `service-blueprint` and `module-blueprints` from the run inputs; the `test-generator` release runs in read class with skills such as `test-generator-generate-test-scenarios` and `test-generator-plan-failure-flow-scenarios` and writes `scenarios`, the acceptance scenarios of every feature, invariant and adverse branch. `coverage-matrix` receives the same blueprints and `steps.derive-scenarios.scenarios`; the `qa-engineer` release, read class, with the skill `qa-engineer-analyze-coverage`, maps every scenario to its context, operation and NFR target and names the gaps in `coverage-matrix`. `draft-test-blueprint` receives the blueprints and `steps.coverage-matrix.coverage-matrix`, and on a revision pass the findings of the last validation receipt as feedback; the `qa-engineer` release, sandbox class, writes the Test Blueprint with suites, data and environments against blueprint-test-v1 as `test-blueprint-draft`. No step touches a shared system or needs an approval. All three declare `failure_policy` Retry, exponential, 3 attempts, backoff 30s, timeout PT30M: a Failed attempt of failure class transient is retried, any other is not, and a step that spends its budget fails the run. Kind: behavior. Traces: workflows: test-plan; steps: test-plan/derive-scenarios, test-plan/coverage-matrix, test-plan/draft-test-blueprint; agents: test-generator, qa-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-service-v1, blueprint-module-v1, blueprint-test-v1, artifact-v1; scenarios: SCN-test-plan-001, SCN-test-plan-002, SCN-test-plan-003; adrs: ADR-0014, ADR-0026; requirements: FR-08, FUX-10. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/test-plan.yaml, model/agents/qa/test-generator.yaml, model/agents/qa/qa-engineer.yaml, model/scenarios/test-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `service-blueprint` (blueprint-service-v1) and `module-blueprints` (blueprint-module-v1), when `test-generator` executes test-plan/derive-scenarios, then the output `scenarios` (artifact-v1) is recorded once under the run envelope with at least one scenario for every feature, invariant and adverse branch of the blueprints (SCN-test-plan-001).",
        "AC2: Given `steps.derive-scenarios.scenarios` is recorded, when `qa-engineer` executes test-plan/coverage-matrix, then the output `coverage-matrix` (artifact-v1) maps every scenario to a context, an operation and an NFR target and names every operation or target without a scenario as a gap (SCN-test-plan-002).",
        "AC3: Given `steps.coverage-matrix.coverage-matrix` is recorded, when `qa-engineer` executes test-plan/draft-test-blueprint, then the output `test-blueprint-draft` (blueprint-test-v1) with suites, data and environments is recorded once; on a revision pass after test-plan/check-valid took its false branch the findings of the last receipt are in its context as feedback and the new draft addresses each by rule id (TST-001 to TST-003 or the schema path) (SCN-test-plan-003, ADR-0026).",
        "AC4: Given an attempt of one of the three steps exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/test-plan.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-test-plan-001, SCN-test-plan-002, SCN-test-plan-003, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml",
        "model/agents/qa/test-generator.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "model/scenarios/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4942",
        "AIFACTORY-TASK-4943",
        "AIFACTORY-TASK-4944"
      ],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13902,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "test-plan"
        ],
        "steps": [
          "test-plan/derive-scenarios",
          "test-plan/coverage-matrix",
          "test-plan/draft-test-blueprint"
        ],
        "agents": [
          "test-generator",
          "qa-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-service-v1",
          "blueprint-module-v1",
          "blueprint-test-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-test-plan-001",
          "SCN-test-plan-002",
          "SCN-test-plan-003"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08",
          "FUX-10"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/test-plan.yaml",
        "model/agents/qa/test-generator.yaml",
        "model/agents/qa/qa-engineer.yaml",
        "model/scenarios/test-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1238]",
      "number": 1238
    },
    {
      "id": "AIFACTORY-TASK-4942",
      "type": "task",
      "parent": "AIFACTORY-US-1238",
      "title": "Recorded fixture for the scenario derivation, the coverage matrix and the draft",
      "sequence": "19.17.02.01",
      "description": "Recorded fixture for the scenario derivation, the coverage matrix and the draft. Expected output: A fixture Service Blueprint with two features, one invariant and one adverse branch and its Module Blueprints, with the expected scenarios, the expected coverage-matrix naming one gap and the expected Test Blueprint draft (blueprint-test-v1), plus a receipt with TST-002 findings as feedback for the revision pass, as the oracle of SCN-test-plan-001 to SCN-test-plan-003.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture Service Blueprint with two features, one invariant and one adverse branch and its Module Blueprints, with the expected scenarios, the expected coverage-matrix naming one gap and the expected Test Blueprint draft (blueprint-test-v1), plus a receipt with TST-002 findings as feedback for the revision pass, as the oracle of SCN-test-plan-001 to SCN-test-plan-003."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13902,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4942]",
      "number": 4942
    },
    {
      "id": "AIFACTORY-TASK-4943",
      "type": "task",
      "parent": "AIFACTORY-US-1238",
      "title": "Verify the input mappings and action classes of the three agent steps in the Draft release",
      "sequence": "19.17.02.02",
      "description": "Verify the input mappings and action classes of the three agent steps in the Draft release. Expected output: The steps derive-scenarios, coverage-matrix and draft-test-blueprint of the Draft release authored by AIFACTORY-TASK-404 resolve their inputs exactly as mapped in model/workflows/test-plan.yaml and are announced with actionClass read, read and sandbox; the feedback attachment on the on_false branch is engine behaviour proven by AIFACTORY-TASK-4950 and is not repeated here.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps derive-scenarios, coverage-matrix and draft-test-blueprint of the Draft release authored by AIFACTORY-TASK-404 resolve their inputs exactly as mapped in model/workflows/test-plan.yaml and are announced with actionClass read, read and sandbox; the feedback attachment on the on_false branch is engine behaviour proven by AIFACTORY-TASK-4950 and is not repeated here."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4943]",
      "number": 4943
    },
    {
      "id": "AIFACTORY-TASK-4944",
      "type": "task",
      "parent": "AIFACTORY-US-1238",
      "title": "Prove the derivation, the coverage matrix and the draft on the fixture",
      "sequence": "19.17.02.03",
      "description": "Prove the derivation, the coverage matrix and the draft on the fixture. Expected output: A fixture run proves SCN-test-plan-001 to SCN-test-plan-003 (AC1 to AC4 of AIFACTORY-US-1238); the outputs validate against artifact-v1 and blueprint-test-v1, and the retry exhaustion path ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-test-plan-001 to SCN-test-plan-003 (AC1 to AC4 of AIFACTORY-US-1238); the outputs validate against artifact-v1 and blueprint-test-v1, and the retry exhaustion path ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4944]",
      "number": 4944
    },
    {
      "id": "AIFACTORY-US-1239",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-120",
      "title": "The Test Blueprint draft is stored as a project-scope Draft version and validated with a receipt",
      "sequence": "19.17.03",
      "description": "As a requester, I want the drafted Test Blueprint stored as a Draft version of my project and validated against its schema and the TST rules, so that a validation verdict with findings exists for every draft before anything is published. The two tool steps of `test-plan`. When `submit-version` becomes ready the engine resolves `document` from `steps.draft-test-blueprint.test-blueprint-draft` and emits `StepReady` with `actionClass` shared-write and `idempotent` true; Run Control dispatches the attempt and `blueprint-submit-version` goes through the fixed pipeline of ToolAdapterService. Draft versions are autonomous by default; when the project policy (BC-20) gates blueprint drafts the invocation waits AwaitingApproval for an approval requested through `RunControl.RequestApproval` that names the run as its subject and is bound to the invocation request hash, which covers the document hash, with proposalKind tool-invocation (D64, D129). The tool calls `Blueprints.SubmitDraftVersion` of BlueprintService under the run's workload identity: the document becomes a project-scope Draft `BlueprintVersion` of kind Test, idempotent on its document hash, which the step declares as its `idempotency_key`. A rejected or expired decision denies the invocation and the attempt fails policy-denied. An attempt whose effect cannot be confirmed settles Uncertain and is never retried automatically. When `validate` becomes ready `blueprint-validate` calls `Blueprints.Validate` with the version reference; BlueprintService validates against blueprint-test-v1 and the rules TST-001 to TST-003, returns a receipt, moves the version to Validated only when the receipt passed, and emits `BlueprintValidated`. A receipt with `passed` false is a successful step output. A version reference of another tenant is answered NOT_FOUND and the attempt takes the failure class permanent (ADR-0015). Kind: behavior. Traces: workflows: test-plan; steps: test-plan/submit-version, test-plan/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, WorkflowEngineService, ToolAdapterService, RunControlService; aggregates: BlueprintService/BlueprintVersion, ToolAdapterService/ToolInvocation; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, RunControlService/RunControl.RequestApproval, ToolAdapterService/ConfirmToolEffect; events: BlueprintService/BlueprintValidated, WorkflowEngineService/StepReady, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain; descriptors: blueprint-test-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-test-plan-004, SCN-test-plan-005; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-08, XL-08. Depends on: AIFACTORY-US-1238, feature:blueprint-service, feature:workflow-engine-service, feature:run-control-service, feature:tool-adapter-service. Sources: model/workflows/test-plan.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/services/template-library/BlueprintService.yaml, model/scenarios/test-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-test-blueprint.test-blueprint-draft` is recorded and the project policy does not gate blueprint drafts, when test-plan/submit-version runs `blueprint-submit-version` through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Test exists in project scope, the output `version-ref` (blueprint-version-ref-v1) is recorded once under the run envelope, no approval is requested, and a resubmission of the same document hash returns the same version (SCN-test-plan-004, D64).",
        "AC2: Given `steps.submit-version.version-ref` is recorded, when test-plan/validate runs `blueprint-validate` through BlueprintService/Blueprints.Validate, then the output `validation-receipt` (blueprint-validation-receipt-v1) with findings by rule id (TST-001 to TST-003) or schema path is recorded once whether it passed or not, BlueprintService/BlueprintValidated is emitted with `passed` and the document hash, and the version moves to Validated only for a passed receipt; a version reference of another tenant is answered NOT_FOUND with no receipt and the attempt takes the failure class permanent and is not retried (SCN-test-plan-005, ADR-0015).",
        "AC3: Given the project policy gates blueprint drafts, when test-plan/submit-version is reached, then the ToolAdapterService/ToolInvocation of `blueprint-submit-version` is held AwaitingApproval, an approval naming the run as its subject is requested through RunControlService/RunControl.RequestApproval bound to the request hash with proposalKind tool-invocation, RunControlService/ApprovalRequested is published before any write, and BlueprintService/Blueprints.SubmitDraftVersion is called only on an approving RunControlService/ApprovalDecided for that hash; a rejected or expired decision publishes ToolAdapterService/ToolInvocationDenied and the attempt fails policy-denied without a Draft version (SCN-test-plan-004, ADR-0026, D129).",
        "AC4: Given an attempt of test-plan/submit-version settles Failed with failure class transient, when Run Control evaluates the step, then it is retried under the fixed budget of 2 attempts with backoff 10s, which holds for this shared-write step because it declares `idempotency_key` documentHash, and on exhaustion it fails with evidence; given any other failure class it is not retried; given the attempt settles Uncertain (timeout PT2M after dispatch), then ToolAdapterService/ToolEffectUncertain is published and the attempt waits for an operator to settle it through ToolAdapterService/ConfirmToolEffect, the document hash ensuring that a confirmed effect is never duplicated; an attempt of test-plan/validate that exceeds PT5M or fails transient is retried under its fixed budget and then fails with evidence (SCN-test-plan-004, SCN-test-plan-005, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/scenarios/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4945",
        "AIFACTORY-TASK-4946",
        "AIFACTORY-TASK-4947"
      ],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13903,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "test-plan"
        ],
        "steps": [
          "test-plan/submit-version",
          "test-plan/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "WorkflowEngineService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion",
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "RunControlService/RunControl.RequestApproval",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/StepReady",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "blueprint-test-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-test-plan-004",
          "SCN-test-plan-005"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08",
          "XL-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1238",
        "feature:blueprint-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/workflows/test-plan.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/scenarios/test-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1239]",
      "number": 1239
    },
    {
      "id": "AIFACTORY-TASK-4945",
      "type": "task",
      "parent": "AIFACTORY-US-1239",
      "title": "Fixture Test Blueprint documents with their expected receipts",
      "sequence": "19.17.03.01",
      "description": "Fixture Test Blueprint documents with their expected receipts. Expected output: One fixture Test Blueprint document that passes TST-001 to TST-003 and one that fails TST-002, each with its expected blueprint-version-ref-v1, blueprint-validation-receipt-v1 and the version state after the verdict, plus a version reference of another tenant with the expected NOT_FOUND and no receipt, as the oracle of SCN-test-plan-004 and SCN-test-plan-005.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture Test Blueprint document that passes TST-001 to TST-003 and one that fails TST-002, each with its expected blueprint-version-ref-v1, blueprint-validation-receipt-v1 and the version state after the verdict, plus a version reference of another tenant with the expected NOT_FOUND and no receipt, as the oracle of SCN-test-plan-004 and SCN-test-plan-005."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13903,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4945]",
      "number": 4945
    },
    {
      "id": "AIFACTORY-TASK-4946",
      "type": "task",
      "parent": "AIFACTORY-US-1239",
      "title": "Bind the submit and validate tool steps of the Draft release with the Test kind",
      "sequence": "19.17.03.02",
      "description": "Bind the submit and validate tool steps of the Draft release with the Test kind. Expected output: The tool steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate with document and version-ref mapped as in model/workflows/test-plan.yaml, submit-version is announced shared-write with idempotent true and the fixed retry of 2 attempts, validate sandbox with the same budget, and the bindings of model/tools/blueprint-submit-version.yaml and model/tools/blueprint-validate.yaml are reused unchanged for the kind Test.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The tool steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate with document and version-ref mapped as in model/workflows/test-plan.yaml, submit-version is announced shared-write with idempotent true and the fixed retry of 2 attempts, validate sandbox with the same budget, and the bindings of model/tools/blueprint-submit-version.yaml and model/tools/blueprint-validate.yaml are reused unchanged for the kind Test."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13903,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4946]",
      "number": 4946
    },
    {
      "id": "AIFACTORY-TASK-4947",
      "type": "task",
      "parent": "AIFACTORY-US-1239",
      "title": "Prove the submit and validate steps on the fixture",
      "sequence": "19.17.03.03",
      "description": "Prove the submit and validate steps on the fixture. Expected output: A fixture run proves SCN-test-plan-004 and SCN-test-plan-005 (AC1 to AC4 of AIFACTORY-US-1239), including the idempotent resubmission, the gated path with an approval naming the run as its subject, the denial on rejection, the transient retry under the idempotency key, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the NOT_FOUND answer for another tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-test-plan-004 and SCN-test-plan-005 (AC1 to AC4 of AIFACTORY-US-1239), including the idempotent resubmission, the gated path with an approval naming the run as its subject, the denial on rejection, the transient retry under the idempotency key, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the NOT_FOUND answer for another tenant."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4947]",
      "number": 4947
    },
    {
      "id": "AIFACTORY-US-1240",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-120",
      "title": "The engine checks the Test Blueprint receipt and sends findings back to the draft at most twice",
      "sequence": "19.17.04",
      "description": "As a requester, I want a failed validation of my Test Blueprint sent back to the draft a bounded number of times and then the run failed with the report, so that the Test Blueprint improves on real findings without looping forever or hiding the verdict. The condition step of `test-plan`, its last step. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; a condition step never retries, never calls a service and completes within PT1M. When the receipt passed, the condition completes with one outcome and the run completes. The run output `test-blueprint` (blueprint-test-v1) binds to the validated BlueprintVersion that `steps.submit-version.version-ref` of the passing iteration names, and to no draft and no other version (D133); `validation-receipt` binds to the receipt of that iteration, never to an earlier failed one. When it did not, the engine takes the `on_false` branch to `draft-test-blueprint` with `steps.validate.validation-receipt` as feedback: the draft, submit and validate steps re-run in order, the revised document gets its own Draft version and receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the last iteration the run fails with the validation report as its evidence, `WorkflowRunFailed` names `check-valid` with the failure class validation, Run Control records Failed exactly once and every Draft version created on the way stays a Draft. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026). Kind: behavior. Traces: workflows: test-plan; steps: test-plan/check-valid, test-plan/draft-test-blueprint; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1, blueprint-test-v1, blueprint-version-ref-v1; scenarios: SCN-test-plan-006, SCN-test-plan-007; adrs: ADR-0014, ADR-0026; requirements: FR-08. Depends on: AIFACTORY-US-1239, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/test-plan.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/test-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates test-plan/check-valid, then the condition completes with exactly one outcome, no service is called, the run output `test-blueprint` is the validated BlueprintVersion that `steps.submit-version.version-ref` of that iteration names and `validation-receipt` its receipt, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (SCN-test-plan-006, D133).",
        "AC2: Given the recorded receipt has `passed` false and fewer than 2 iterations were counted on the run, when the engine evaluates test-plan/check-valid, then it takes the false branch to test-plan/draft-test-blueprint with the receipt as feedback, the steps test-plan/submit-version and test-plan/validate re-run on the revised draft and the iteration count rises by one (SCN-test-plan-007).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates test-plan/check-valid, then the run fails with the validation report as evidence, WorkflowEngineService/WorkflowRunFailed names `check-valid` with failure class validation, RunControlService/RunFailed is published exactly once and no Draft version is promoted (SCN-test-plan-007, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable, or the evaluation exceeds its timeout PT1M, when the engine evaluates test-plan/check-valid, then the condition is not retried (none, 0 attempts), it fails with evidence and the run follows the compensation policy of model/workflows/test-plan.yaml (SCN-test-plan-006, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4948",
        "AIFACTORY-TASK-4949",
        "AIFACTORY-TASK-4950"
      ],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13904,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "test-plan"
        ],
        "steps": [
          "test-plan/check-valid",
          "test-plan/draft-test-blueprint"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1",
          "blueprint-test-v1",
          "blueprint-version-ref-v1"
        ],
        "scenarios": [
          "SCN-test-plan-006",
          "SCN-test-plan-007"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-08"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1239",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/test-plan.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/test-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1240]",
      "number": 1240
    },
    {
      "id": "AIFACTORY-TASK-4948",
      "type": "task",
      "parent": "AIFACTORY-US-1240",
      "title": "Fixture receipt sequences for the pass, loop and limit paths of test-plan",
      "sequence": "19.17.04.01",
      "description": "Fixture receipt sequences for the pass, loop and limit paths of test-plan. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count, as the oracle of SCN-test-plan-006 and SCN-test-plan-007.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count, as the oracle of SCN-test-plan-006 and SCN-test-plan-007."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13904,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4948]",
      "number": 4948
    },
    {
      "id": "AIFACTORY-TASK-4949",
      "type": "task",
      "parent": "AIFACTORY-US-1240",
      "title": "Bind the test-plan run outputs to the validated version",
      "sequence": "19.17.04.02",
      "description": "Bind the test-plan run outputs to the validated version. Expected output: When check-valid holds the run output test-blueprint is bound to the validated BlueprintVersion that steps.submit-version.version-ref of the passing iteration names and validation-receipt to the receipt of that iteration, never to a draft or to an earlier failed iteration, as model/workflows/test-plan.yaml declares (D133).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "When check-valid holds the run output test-blueprint is bound to the validated BlueprintVersion that steps.submit-version.version-ref of the passing iteration names and validation-receipt to the receipt of that iteration, never to a draft or to an earlier failed iteration, as model/workflows/test-plan.yaml declares (D133)."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13904,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4949]",
      "number": 4949
    },
    {
      "id": "AIFACTORY-TASK-4950",
      "type": "task",
      "parent": "AIFACTORY-US-1240",
      "title": "Prove the condition and the bounded loop of test-plan on the fixture",
      "sequence": "19.17.04.03",
      "description": "Prove the condition and the bounded loop of test-plan on the fixture. Expected output: A fixture run proves SCN-test-plan-006 and SCN-test-plan-007 (AC1 to AC4 of AIFACTORY-US-1240); one outcome and a completed run on pass with test-blueprint bound to the validated version of the passing iteration, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-test-plan-006 and SCN-test-plan-007 (AC1 to AC4 of AIFACTORY-US-1240); one outcome and a completed run on pass with test-blueprint bound to the validated version of the passing iteration, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/test-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 139,
      "phase": "factory",
      "stackRank": 13904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4950]",
      "number": 4950
    },
    {
      "id": "AIFACTORY-FEAT-121",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Plan a run",
      "sequence": "19.18",
      "description": "The workflow definition plan-run as a published asset: Turns an accepted run submission into a workflow-definition instance: classifies the intent, selects a Published definition or composes a plan validated against the DSL, and hands the first steps to the engine. It has 5 steps, names the agents factory-workflow-orchestrator and the tools knowledge-search, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I4: Trust and accountability. Build order 140 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-093",
        "AIFACTORY-US-1241",
        "AIFACTORY-US-1242",
        "AIFACTORY-US-1243"
      ],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14000,
      "titlePrefix": "[AIFACTORY-FEAT-121]",
      "number": 121
    },
    {
      "id": "AIFACTORY-US-093",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-121",
      "title": "The Plan a run workflow runs from its published definition",
      "sequence": "19.18.01",
      "description": "As a requester, I want the plan a run workflow to run from its published definition with the agents, tools and gates it declares, so that plan are produced the same way on every run, with evidence. The integration PBI of the definition `plan-run`, one of the four definitions a person submits rather than a readiness bundle (ADR-0026, D63). A requester submits a run whose release pins the definition through `SubmitRun` of RunControlService; Run Control accepts it and publishes `RunAccepted` with the inputs `run-submission` (run-submission-v1) and `vision-blueprint` (blueprint-vision-v1). WorkflowEngineService loads the Published release the run pinned through AgentRegistryService and marks the five steps ready in order: `classify-intent` on the `factory-workflow-orchestrator` release, the condition `select-definition`, `compose-plan` on the same release under its `when` guard, the condition `validate-plan` and `start-steps`, declared as a read-class tool step bound to `knowledge-search`. The two agent steps declare `failure_policy` Retry, applied by Run Control only to a Failed attempt of failure class transient, the steps being of read class; `start-steps` declares Fail and is never retried. Every step reads or writes inside the run envelope only, and no approval is needed. No step declares a compensation (ADR-0014). The run reports exactly one outcome within its budget. Before any run, the definition release and the agent release of `factory-workflow-orchestrator`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release. In I4 the evaluation gate of the complete delivery applies: where an evaluation suite exists for the asset kind, a release is published only with a passed evaluation record (ADR-0021), and an agent release published before I4 without one is resubmitted through the gate as a new version; the runs pin the Published release, never a Draft one (D140). Under the model as it stands only the unmatched branch can reach `start-steps`: on the matched branch `compose-plan` is skipped and `validate-plan` reads an absent plan and fails the run (AIFACTORY-US-1241), and on the unmatched branch the verdict `valid` that `validate-plan` reads is set by no act of the model (AIFACTORY-US-1242); both are open questions for the owner. The step behaviour is specified in AIFACTORY-US-1241 to AIFACTORY-US-1243; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: plan-run; steps: plan-run/classify-intent, plan-run/select-definition, plan-run/compose-plan, plan-run/validate-plan, plan-run/start-steps; agents: factory-workflow-orchestrator; tools: knowledge-search; services: WorkflowEngineService, RunControlService, AgentRegistryService; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: workflow-definition-v1, run-submission-v1, blueprint-vision-v1; adrs: ADR-0014, ADR-0021, ADR-0024, ADR-0026, ADR-0027; requirements: FR-02, FR-03, FUX-03, XL-03. Depends on: AIFACTORY-US-1241, AIFACTORY-US-1242, AIFACTORY-US-1243, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-complete, feature:agent-registry-service-publication, feature:vector-memory-service-thin. Sources: model/workflows/plan-run.yaml, model/agents/vision-planning/factory-workflow-orchestrator.yaml, docs/planes/agent-runtime/workflow-definitions/plan-run.md.",
      "acceptanceCriteria": [
        "AC1: Given the Published release of `plan-run`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter and with a passed evaluation record where an evaluation suite exists for its asset kind (ADR-0021, D140), carries the 5 steps, input mappings, the `when` guard of plan-run/compose-plan, the conditions, retry policies, timeouts, the `failure_policy` Retry of the two agent steps and Fail of plan-run/start-steps exactly as in model/workflows/plan-run.yaml, when RunControlService/RunAccepted arrives for a run that a requester submitted through RunControlService/SubmitRun with the inputs `run-submission` and `vision-blueprint`, then WorkflowEngineService/WorkflowRunStarted is emitted and, on the unmatched branch of plan-run/select-definition, plan-run/classify-intent, plan-run/select-definition, plan-run/compose-plan, plan-run/validate-plan and plan-run/start-steps become ready in that order on the pinned Published release of `factory-workflow-orchestrator`, no Draft release being loaded; this declared order covers the unmatched branch only, the matched branch ending at plan-run/validate-plan as AC3 states.",
        "AC2: Given the unmatched branch, the owner's decision on which act sets the verdict `valid` read by plan-run/validate-plan, and every step succeeding, when the run completes, then `plan` (workflow-definition-v1) is recorded as the run output under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014); this Completed outcome covers the unmatched branch only and is not proven on the fixture until that decision (AIFACTORY-US-1242).",
        "AC3: Given an agent step is settled Failed with its retry budget spent or with a failure class that is not retried, plan-run/validate-plan reads an absent or unreadable verdict (on the matched branch, where plan-run/compose-plan was skipped and no plan is recorded, and under the model as it stands on the unmatched branch too), or plan-run/start-steps fails under its policy Fail, when the engine applies the compensation policy of model/workflows/plan-run.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and the failure class, the recorded outputs stay in place as evidence and RunControlService/RunFailed is published exactly once (recovery, not replay, ADR-0014).",
        "AC4: Given the recorded fixture inputs of model/workflows/plan-run.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml",
        "model/agents/vision-planning/factory-workflow-orchestrator.yaml",
        "docs/planes/agent-runtime/workflow-definitions/plan-run.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-407",
        "AIFACTORY-TASK-408",
        "AIFACTORY-TASK-409",
        "AIFACTORY-TASK-733"
      ],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14001,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "plan-run"
        ],
        "steps": [
          "plan-run/classify-intent",
          "plan-run/select-definition",
          "plan-run/compose-plan",
          "plan-run/validate-plan",
          "plan-run/start-steps"
        ],
        "agents": [
          "factory-workflow-orchestrator"
        ],
        "tools": [
          "knowledge-search"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "run-submission-v1",
          "blueprint-vision-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0021",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027"
        ],
        "requirements": [
          "FR-02",
          "FR-03",
          "FUX-03",
          "XL-03"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1241",
        "AIFACTORY-US-1242",
        "AIFACTORY-US-1243",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-complete",
        "feature:agent-registry-service-publication",
        "feature:vector-memory-service-thin"
      ],
      "source": [
        "model/workflows/plan-run.yaml",
        "model/agents/vision-planning/factory-workflow-orchestrator.yaml",
        "docs/planes/agent-runtime/workflow-definitions/plan-run.md"
      ],
      "titlePrefix": "[AIFACTORY-US-093]",
      "number": 93
    },
    {
      "id": "AIFACTORY-TASK-407",
      "type": "task",
      "parent": "AIFACTORY-US-093",
      "title": "Author, submit and publish the release of the workflow definition plan-run with its agent release",
      "sequence": "19.18.01.01",
      "description": "Author, submit and publish the release of the workflow definition plan-run with its agent release. Expected output: The release of plan-run (workflow-definition-v1) authored with its 5 steps, input mappings, the when guard of compose-plan, the conditions of select-definition and validate-plan, retry policies, timeouts and the compensation policy as in model/workflows/plan-run.yaml, the failure_policy of every agent and tool step copied as it stands (Retry on classify-intent and compose-plan, Fail on start-steps), and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent release factory-workflow-orchestrator of AIFACTORY-TASK-408 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of plan-run (workflow-definition-v1) authored with its 5 steps, input mappings, the when guard of compose-plan, the conditions of select-definition and validate-plan, retry policies, timeouts and the compensation policy as in model/workflows/plan-run.yaml, the failure_policy of every agent and tool step copied as it stands (Retry on classify-intent and compose-plan, Fail on start-steps), and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent release factory-workflow-orchestrator of AIFACTORY-TASK-408 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-407]",
      "number": 407
    },
    {
      "id": "AIFACTORY-TASK-408",
      "type": "task",
      "parent": "AIFACTORY-US-093",
      "title": "Author the agent release factory-workflow-orchestrator with its prompts and skills",
      "sequence": "19.18.01.02",
      "description": "Author the agent release factory-workflow-orchestrator with its prompts and skills. Expected output: A Draft release of factory-workflow-orchestrator with its instructions, the three bound skills of model/agents/vision-planning/factory-workflow-orchestrator.yaml, the tool bindings and the model profile reasoning; the release is evaluated with the suite vision-planning-core-v1 on a fixture submission and carries a passed evaluation record before AIFACTORY-TASK-407 submits it for publication, and a release of the agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of factory-workflow-orchestrator with its instructions, the three bound skills of model/agents/vision-planning/factory-workflow-orchestrator.yaml, the tool bindings and the model profile reasoning; the release is evaluated with the suite vision-planning-core-v1 on a fixture submission and carries a passed evaluation record before AIFACTORY-TASK-407 submits it for publication, and a release of the agent published before I4 without an evaluation record is resubmitted through the evaluation gate as a new version (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14001,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-408]",
      "number": 408
    },
    {
      "id": "AIFACTORY-TASK-409",
      "type": "task",
      "parent": "AIFACTORY-US-093",
      "title": "Fixture run of plan-run against recorded inputs",
      "sequence": "19.18.01.03",
      "description": "Fixture run of plan-run against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from RunAccepted to its one outcome for a matched and an unmatched submission on the Published releases of AIFACTORY-TASK-407; every step output validates against its descriptor, the matched submission ends Failed at validate-plan, and the recorded outputs match the recorded ones field by field (AC1, AC3 and AC4 of AIFACTORY-US-093); the Completed run of AC2 is added once the owner decides which act sets the verdict valid.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from RunAccepted to its one outcome for a matched and an unmatched submission on the Published releases of AIFACTORY-TASK-407; every step output validates against its descriptor, the matched submission ends Failed at validate-plan, and the recorded outputs match the recorded ones field by field (AC1, AC3 and AC4 of AIFACTORY-US-093); the Completed run of AC2 is added once the owner decides which act sets the verdict valid."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-409]",
      "number": 409
    },
    {
      "id": "AIFACTORY-TASK-733",
      "type": "task",
      "parent": "AIFACTORY-US-093",
      "title": "Verify plan-run-runs-from-its-definition by running the declared command",
      "sequence": "19.18.01.04",
      "description": "Verify plan-run-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1, AC3 and AC4 of AIFACTORY-US-093, including the matched submission failing at validate-plan and the failure path of AC3 (WorkflowRunFailed then RunFailed exactly once); AC2 is proven once the owner decides which act sets the verdict valid; the output names the Published release ids of plan-run and factory-workflow-orchestrator that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1, AC3 and AC4 of AIFACTORY-US-093, including the matched submission failing at validate-plan and the failure path of AC3 (WorkflowRunFailed then RunFailed exactly once); AC2 is proven once the owner decides which act sets the verdict valid; the output names the Published release ids of plan-run and factory-workflow-orchestrator that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-733]",
      "number": 733
    },
    {
      "id": "AIFACTORY-US-1241",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-121",
      "title": "The orchestrator classifies the intent of a submission and the engine checks for a matching Published definition",
      "sequence": "19.18.02",
      "description": "As a requester, I want my submission classified into an intent class with the candidate definitions that could serve it, so that a Published definition is reused unchanged when one fits, and a plan is composed only when none does. The first two steps of `plan-run`. When the engine marks `classify-intent` ready it resolves `goal` from `input.run-submission` and `vision-blueprint` from the run input. The `factory-workflow-orchestrator` release runs in read class with the reasoning profile, the skill `factory-workflow-orchestrator-propose-workflow-definitions` and only the tools of its card without side effects (knowledge-search, graph-query, list-files, read-range); it names the intent class, the candidate definitions with the reason for each, and `matchedDefinition` when a Published definition matches the intent class and the scope, and writes `intent`. It declares `failure_policy` Retry, exponential, 3 attempts, backoff 30s, timeout PT30M. When `classify-intent` succeeded the engine evaluates the condition `select-definition`, `steps.classify-intent.intent.matchedDefinition != null`, over the recorded output without a service call and within PT1M. When it holds, the summary says a Published definition fits and the run instantiates it unchanged; the guard of `compose-plan` does not hold and the engine records that step Skipped (ADR-0027). The model declares no step that instantiates the matched definition, and `validate-plan` depends on `compose-plan` and reads `steps.compose-plan.plan.valid`, while `start-steps` maps `plan` from `steps.compose-plan.plan`; under the model as it stands every run of the matched branch therefore reaches `validate-plan` with no recorded plan and fails there with evidence. How a matched definition is instantiated is an open question for the owner. When the condition does not hold `compose-plan` runs. The condition never retries; a missing or unreadable intent fails it with evidence instead of being read as a match. Kind: behavior. Traces: workflows: plan-run; steps: plan-run/classify-intent, plan-run/select-definition, plan-run/compose-plan; agents: factory-workflow-orchestrator; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: run-submission-v1, blueprint-vision-v1, artifact-v1; scenarios: SCN-plan-run-001, SCN-plan-run-002; adrs: ADR-0014, ADR-0027; requirements: FR-02, FUX-03. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/plan-run.yaml, model/agents/vision-planning/factory-workflow-orchestrator.yaml, model/scenarios/plan-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `run-submission` (run-submission-v1) and `vision-blueprint` (blueprint-vision-v1), when `factory-workflow-orchestrator` executes plan-run/classify-intent, then the output `intent` (artifact-v1) is recorded once under the run envelope with the intent class, the candidate definitions with their reasons and `matchedDefinition` set or empty, and no tool with side effects is called (SCN-plan-run-001).",
        "AC2: Given an attempt of plan-run/classify-intent exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/plan-run.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-plan-run-001, ADR-0014).",
        "AC3: Given `steps.classify-intent.intent` names a matched Published definition, when the engine evaluates plan-run/select-definition, then the condition holds with exactly one outcome and no service call, and the guard of plan-run/compose-plan does not hold, so that step is recorded Skipped (SCN-plan-run-002, ADR-0027).",
        "AC4: Given the recorded intent names no matched definition, when the engine evaluates plan-run/select-definition, then the condition completes with one outcome and plan-run/compose-plan becomes ready; given the intent is missing or unreadable or the evaluation exceeds PT1M, then the condition is not retried, it fails with evidence and WorkflowEngineService/WorkflowRunFailed names it (SCN-plan-run-002).",
        "AC5: Given plan-run/select-definition held and plan-run/compose-plan was recorded Skipped, when the engine evaluates plan-run/validate-plan, then under the model as it stands it reads an absent `steps.compose-plan.plan` and fails with evidence without a retry, WorkflowEngineService/WorkflowRunFailed names `validate-plan` and RunControlService/RunFailed is published exactly once; how a matched Published definition is instantiated instead is an open question for the owner (SCN-plan-run-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml",
        "model/agents/vision-planning/factory-workflow-orchestrator.yaml",
        "model/scenarios/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4951",
        "AIFACTORY-TASK-4952",
        "AIFACTORY-TASK-4953"
      ],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14002,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "plan-run"
        ],
        "steps": [
          "plan-run/classify-intent",
          "plan-run/select-definition",
          "plan-run/compose-plan"
        ],
        "agents": [
          "factory-workflow-orchestrator"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "run-submission-v1",
          "blueprint-vision-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-plan-run-001",
          "SCN-plan-run-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027"
        ],
        "requirements": [
          "FR-02",
          "FUX-03"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/plan-run.yaml",
        "model/agents/vision-planning/factory-workflow-orchestrator.yaml",
        "model/scenarios/plan-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1241]",
      "number": 1241
    },
    {
      "id": "AIFACTORY-TASK-4951",
      "type": "task",
      "parent": "AIFACTORY-US-1241",
      "title": "Recorded fixture submissions with and without a matching definition",
      "sequence": "19.18.02.01",
      "description": "Recorded fixture submissions with and without a matching definition. Expected output: Two fixture submissions with their Vision Blueprint, one whose intent matches a Published fixture definition and one whose intent matches none, each with the expected intent artifact (intent class, candidates with reasons, matchedDefinition set or empty), the expected outcome of select-definition and, for the matched submission, the expected run outcome Failed with WorkflowRunFailed naming validate-plan after compose-plan was recorded Skipped, as the oracle of SCN-plan-run-001 and SCN-plan-run-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Two fixture submissions with their Vision Blueprint, one whose intent matches a Published fixture definition and one whose intent matches none, each with the expected intent artifact (intent class, candidates with reasons, matchedDefinition set or empty), the expected outcome of select-definition and, for the matched submission, the expected run outcome Failed with WorkflowRunFailed naming validate-plan after compose-plan was recorded Skipped, as the oracle of SCN-plan-run-001 and SCN-plan-run-002."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14002,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4951]",
      "number": 4951
    },
    {
      "id": "AIFACTORY-TASK-4952",
      "type": "task",
      "parent": "AIFACTORY-US-1241",
      "title": "Load select-definition and the when guard of compose-plan in the Draft release",
      "sequence": "19.18.02.02",
      "description": "Load select-definition and the when guard of compose-plan in the Draft release. Expected output: The condition select-definition and the when guard of compose-plan of the Draft release read only the recorded intent, as model/workflows/plan-run.yaml declares; a guard that does not hold records compose-plan Skipped and its dependants treat it as satisfied (ADR-0027).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The condition select-definition and the when guard of compose-plan of the Draft release read only the recorded intent, as model/workflows/plan-run.yaml declares; a guard that does not hold records compose-plan Skipped and its dependants treat it as satisfied (ADR-0027)."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14002,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4952]",
      "number": 4952
    },
    {
      "id": "AIFACTORY-TASK-4953",
      "type": "task",
      "parent": "AIFACTORY-US-1241",
      "title": "Prove the classification and the definition check on the fixture",
      "sequence": "19.18.02.03",
      "description": "Prove the classification and the definition check on the fixture. Expected output: A fixture run proves SCN-plan-run-001 and SCN-plan-run-002 (AC1 to AC5 of AIFACTORY-US-1241); the matched submission records compose-plan Skipped and then ends Failed with WorkflowRunFailed naming validate-plan and RunFailed once, the unmatched one makes compose-plan ready, and an unreadable intent fails select-definition with evidence.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-plan-run-001 and SCN-plan-run-002 (AC1 to AC5 of AIFACTORY-US-1241); the matched submission records compose-plan Skipped and then ends Failed with WorkflowRunFailed naming validate-plan and RunFailed once, the unmatched one makes compose-plan ready, and an unreadable intent fails select-definition with evidence."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4953]",
      "number": 4953
    },
    {
      "id": "AIFACTORY-US-1242",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-121",
      "title": "The orchestrator composes a plan from Published agent releases and the engine checks it against the DSL",
      "sequence": "19.18.03",
      "description": "As a requester, I want a plan composed for my intent when no Published definition fits, with every step on a Published agent release, so that a run without a ready-made definition still executes a validated graph and never an ad hoc one. The composing branch of `plan-run`. When the guard `steps.classify-intent.intent.matchedDefinition == null` holds the engine marks `compose-plan` ready and resolves `goal` from `input.run-submission` and `intent` from `steps.classify-intent.intent`. The `factory-workflow-orchestrator` release runs in read class with the skill `factory-workflow-orchestrator-decompose-goals-into-steps-with-gates`: from the intent, the blueprint and the agent catalog it composes a plan as a workflow-definition instance in which every step names a Published agent release, declares its action class and failure policy, and records it as `plan`. It writes nothing outside the run envelope and declares `failure_policy` Retry, exponential, 3 attempts, backoff 30s, timeout PT30M. When `compose-plan` succeeded the engine evaluates the condition `validate-plan`, `steps.compose-plan.plan.valid == true`, which the summary describes as the validation of the instance against workflow-definition-v1, the release states of the agents it names and the budget of the run; a condition reads recorded outputs only, never calls a service and completes within PT1M. workflow-definition-v1 has no `valid` member and no act of the model sets the verdict the condition reads, so which act sets it (for example an in-process use of the rules of `ValidateWorkflowDefinition` of WorkflowEngineService before the condition runs) is an open question for the owner. Until that decision the condition reads an absent member and fails the run with evidence under the missing-or-unreadable rule. Once it is decided, a valid plan lets `start-steps` become ready and an invalid plan fails the run with the validation report as evidence and the failure class validation. The definition declares no false branch, so an invalid plan is never revised in the same run. Kind: behavior. Traces: workflows: plan-run; steps: plan-run/compose-plan, plan-run/validate-plan; agents: factory-workflow-orchestrator; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunFailed; descriptors: run-submission-v1, artifact-v1, workflow-definition-v1; scenarios: SCN-plan-run-003, SCN-plan-run-004; adrs: ADR-0014, ADR-0024; requirements: FR-02, FR-03, XL-03. Depends on: AIFACTORY-US-1241, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/plan-run.yaml, model/agents/vision-planning/factory-workflow-orchestrator.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/plan-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given plan-run/select-definition found no matched definition, when `factory-workflow-orchestrator` executes plan-run/compose-plan with `goal` and `intent`, then the output `plan` (workflow-definition-v1) is recorded once under the run envelope and every step of it names a Published agent release, an action class and a failure policy (SCN-plan-run-003).",
        "AC2: Given an attempt of plan-run/compose-plan exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/plan-run.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and the recorded intent stays in place (SCN-plan-run-003, ADR-0014).",
        "AC3: Given `steps.compose-plan.plan` is recorded as workflow-definition-v1, which has no `valid` member, when the engine evaluates plan-run/validate-plan, then the condition reads the recorded plan only, without a service call, finds the member absent and fails with evidence instead of being read as valid, without a retry, WorkflowEngineService/WorkflowRunFailed names `validate-plan` and RunControlService/RunFailed is published exactly once; the same holds for a missing plan or an evaluation over PT1M (SCN-plan-run-004, ADR-0014).",
        "AC4: Given the owner has decided which act sets the verdict `valid` before the condition runs, when the engine evaluates plan-run/validate-plan, then a valid plan completes the condition with exactly one outcome and makes plan-run/start-steps ready, and an invalid plan (a step names an agent release that is not Published, a step without an action class or failure policy, or a plan over the run budget) fails the run with the validation report as evidence, WorkflowEngineService/WorkflowRunFailed naming `validate-plan` with failure class validation and RunControlService/RunFailed published exactly once; this criterion depends on that decision and is not proven on the fixture until then (SCN-plan-run-004, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml",
        "model/agents/vision-planning/factory-workflow-orchestrator.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4954",
        "AIFACTORY-TASK-4955",
        "AIFACTORY-TASK-4956"
      ],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14003,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "plan-run"
        ],
        "steps": [
          "plan-run/compose-plan",
          "plan-run/validate-plan"
        ],
        "agents": [
          "factory-workflow-orchestrator"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "run-submission-v1",
          "artifact-v1",
          "workflow-definition-v1"
        ],
        "scenarios": [
          "SCN-plan-run-003",
          "SCN-plan-run-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FR-02",
          "FR-03",
          "XL-03"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1241",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/plan-run.yaml",
        "model/agents/vision-planning/factory-workflow-orchestrator.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/plan-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1242]",
      "number": 1242
    },
    {
      "id": "AIFACTORY-TASK-4954",
      "type": "task",
      "parent": "AIFACTORY-US-1242",
      "title": "Fixture plans that pass and fail the DSL check",
      "sequence": "19.18.03.01",
      "description": "Fixture plans that pass and fail the DSL check. Expected output: A fixture intent with no matched definition, the expected valid plan (workflow-definition-v1) whose steps name Published fixture agent releases, and three invalid plans (an InReview agent release, a step without failure policy, a plan over budget) with the expected validation report, as the oracle of SCN-plan-run-003 and SCN-plan-run-004; under the model as it stands the expected outcome of validate-plan is Failed for every plan, the verdict valid being absent, and the expected verdicts per plan are asserted once the owner decides which act sets it.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "A fixture intent with no matched definition, the expected valid plan (workflow-definition-v1) whose steps name Published fixture agent releases, and three invalid plans (an InReview agent release, a step without failure policy, a plan over budget) with the expected validation report, as the oracle of SCN-plan-run-003 and SCN-plan-run-004; under the model as it stands the expected outcome of validate-plan is Failed for every plan, the verdict valid being absent, and the expected verdicts per plan are asserted once the owner decides which act sets it."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14003,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4954]",
      "number": 4954
    },
    {
      "id": "AIFACTORY-TASK-4955",
      "type": "task",
      "parent": "AIFACTORY-US-1242",
      "title": "Load validate-plan and the compose-plan mappings in the Draft release",
      "sequence": "19.18.03.02",
      "description": "Load validate-plan and the compose-plan mappings in the Draft release. Expected output: The agent step compose-plan of the Draft release maps goal and intent as declared in model/workflows/plan-run.yaml, and the condition validate-plan reads the recorded plan only, without a service call; an absent valid member, a missing plan or an unreadable one fails the condition with evidence and is never read as valid; the act that sets the verdict is added once the owner decides it.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The agent step compose-plan of the Draft release maps goal and intent as declared in model/workflows/plan-run.yaml, and the condition validate-plan reads the recorded plan only, without a service call; an absent valid member, a missing plan or an unreadable one fails the condition with evidence and is never read as valid; the act that sets the verdict is added once the owner decides it."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14003,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4955]",
      "number": 4955
    },
    {
      "id": "AIFACTORY-TASK-4956",
      "type": "task",
      "parent": "AIFACTORY-US-1242",
      "title": "Prove the composition and the DSL check on the fixture",
      "sequence": "19.18.03.03",
      "description": "Prove the composition and the DSL check on the fixture. Expected output: A fixture run proves SCN-plan-run-003 and SCN-plan-run-004 (AC1 to AC3 of AIFACTORY-US-1242); every recorded plan reaches validate-plan, which reads the absent verdict and ends in WorkflowRunFailed naming validate-plan and RunFailed once; AC4 (the valid plan making start-steps ready and the invalid plans failing with failure class validation) is proven once the owner decides which act sets the verdict.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-plan-run-003 and SCN-plan-run-004 (AC1 to AC3 of AIFACTORY-US-1242); every recorded plan reaches validate-plan, which reads the absent verdict and ends in WorkflowRunFailed naming validate-plan and RunFailed once; AC4 (the valid plan making start-steps ready and the invalid plans failing with failure class validation) is proven once the owner decides which act sets the verdict."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4956]",
      "number": 4956
    },
    {
      "id": "AIFACTORY-US-1243",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-121",
      "title": "The engine records the validated plan and announces its first steps for Run Control to dispatch",
      "sequence": "19.18.04",
      "description": "As a requester, I want the validated plan recorded and its first steps handed to Run Control, so that the work I asked for starts on a graph that was checked before any step ran. The last step of `plan-run`. When `validate-plan` held the engine marks `start-steps` ready and resolves `plan` from `steps.compose-plan.plan`. The step is declared `kind: tool` with `tool: knowledge-search` and `failure_policy` Fail. Under the StepKind rule of WorkflowEngineService an Agent or Tool step becomes an attempt that Run Control dispatches and the engine does not run, so the engine emits `StepReady` for `start-steps` with `actionClass` read, Run Control dispatches an attempt of the tool `knowledge-search` (VectorMemoryService, read class, delivered thin in I1 with an empty, well-formed result), and when Run Control settles that step the engine records the plan and, as the summary says, announces the steps of the plan without dependencies; the engine itself never owns run authority (ADR-0014). The step writes nothing outside the run envelope and needs no approval. It declares no retry and a timeout PT1M, so any Failed attempt fails the step at once and the engine reports `WorkflowRunFailed` with the plan kept as evidence. Four points are open and reported to the owner: the double reading of the step, an engine action in the summary against a dispatched `knowledge-search` attempt in the declaration; how the engine executes a composed plan that is not a loaded release; why the run completes with `plan` as its output once the plan's first steps are announced; and how a matched Published definition is instantiated when `compose-plan` was skipped. This PBI delivers the step exactly as the definition declares it. Kind: behavior. Traces: workflows: plan-run; steps: plan-run/start-steps; tools: knowledge-search; services: WorkflowEngineService, RunControlService; events: WorkflowEngineService/StepReady, RunControlService/StepSettled, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: workflow-definition-v1; scenarios: SCN-plan-run-005; adrs: ADR-0014, ADR-0024; requirements: FR-03, XL-03. Depends on: AIFACTORY-US-1242, feature:workflow-engine-service, feature:run-control-service, feature:vector-memory-service-thin. Sources: model/workflows/plan-run.yaml, model/tools/knowledge-search.yaml, model/scenarios/plan-run.yaml.",
      "acceptanceCriteria": [
        "AC1: Given plan-run/validate-plan held and `plan` resolves from `steps.compose-plan.plan`, when the engine marks plan-run/start-steps ready, then WorkflowEngineService/StepReady for start-steps is emitted with actionClass read, Run Control dispatches an attempt of the tool `knowledge-search`, and when that step is settled (RunControlService/StepSettled) the engine records the plan under the run envelope and emits WorkflowEngineService/StepReady once for each root step of the plan, the steps without dependencies, and for no other step (SCN-plan-run-005).",
        "AC2: Given the step succeeded, when the run completes, then the run output `plan` (workflow-definition-v1) is set, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once, as the definition declares; why the run completes once the plan's first steps are announced is an open question for the owner (SCN-plan-run-005, ADR-0014).",
        "AC3: Given an attempt of plan-run/start-steps settles Failed with any failure class or exceeds its timeout PT1M, when the engine applies its `failure_policy` Fail from model/workflows/plan-run.yaml, then the step is not retried, WorkflowEngineService/WorkflowRunFailed names `start-steps`, the recorded plan stays as evidence and RunControlService/RunFailed is published exactly once (SCN-plan-run-005, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml",
        "model/tools/knowledge-search.yaml",
        "model/scenarios/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4957",
        "AIFACTORY-TASK-4958",
        "AIFACTORY-TASK-4959"
      ],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14004,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "plan-run"
        ],
        "steps": [
          "plan-run/start-steps"
        ],
        "tools": [
          "knowledge-search"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "RunControlService/StepSettled",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1"
        ],
        "scenarios": [
          "SCN-plan-run-005"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0024"
        ],
        "requirements": [
          "FR-03",
          "XL-03"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1242",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:vector-memory-service-thin"
      ],
      "source": [
        "model/workflows/plan-run.yaml",
        "model/tools/knowledge-search.yaml",
        "model/scenarios/plan-run.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1243]",
      "number": 1243
    },
    {
      "id": "AIFACTORY-TASK-4957",
      "type": "task",
      "parent": "AIFACTORY-US-1243",
      "title": "Fixture validated plan with its expected first steps",
      "sequence": "19.18.04.01",
      "description": "Fixture validated plan with its expected first steps. Expected output: The valid fixture plan of AIFACTORY-TASK-4954 with the expected set of steps without dependencies that are announced, the expected run output plan and a fixture attempt that fails start-steps, as the oracle of SCN-plan-run-005.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The valid fixture plan of AIFACTORY-TASK-4954 with the expected set of steps without dependencies that are announced, the expected run output plan and a fixture attempt that fails start-steps, as the oracle of SCN-plan-run-005."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14004,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4957]",
      "number": 4957
    },
    {
      "id": "AIFACTORY-TASK-4958",
      "type": "task",
      "parent": "AIFACTORY-US-1243",
      "title": "Load start-steps with its failure policy Fail and map the run output",
      "sequence": "19.18.04.02",
      "description": "Load start-steps with its failure policy Fail and map the run output. Expected output: The tool step start-steps of the Draft release is loaded with tool knowledge-search, actionClass read, failure_policy Fail, no retry and timeout PT1M as in model/workflows/plan-run.yaml, maps plan from steps.compose-plan.plan, and the recorded plan is set as the run output plan when the run completes.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The tool step start-steps of the Draft release is loaded with tool knowledge-search, actionClass read, failure_policy Fail, no retry and timeout PT1M as in model/workflows/plan-run.yaml, maps plan from steps.compose-plan.plan, and the recorded plan is set as the run output plan when the run completes."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14004,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4958]",
      "number": 4958
    },
    {
      "id": "AIFACTORY-TASK-4959",
      "type": "task",
      "parent": "AIFACTORY-US-1243",
      "title": "Prove the start of the first steps and the run completion on the fixture",
      "sequence": "19.18.04.03",
      "description": "Prove the start of the first steps and the run completion on the fixture. Expected output: A fixture run proves SCN-plan-run-005 (AC1 to AC3 of AIFACTORY-US-1243), starting from a recorded run state in which validate-plan held, since no act of the model sets its verdict until the owner decides; StepReady for start-steps with actionClass read, one dispatched knowledge-search attempt, StepReady exactly once for each root step of the plan, WorkflowRunCompleted and RunCompleted exactly once, and a failed attempt ending in WorkflowRunFailed naming start-steps without a retry.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-plan-run-005 (AC1 to AC3 of AIFACTORY-US-1243), starting from a recorded run state in which validate-plan held, since no act of the model sets its verdict until the owner decides; StepReady for start-steps with actionClass read, one dispatched knowledge-search attempt, StepReady exactly once for each root step of the plan, WorkflowRunCompleted and RunCompleted exactly once, and a failed attempt ending in WorkflowRunFailed naming start-steps without a retry."
      ],
      "sourceArtifacts": [
        "model/workflows/plan-run.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 140,
      "phase": "factory",
      "stackRank": 14004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4959]",
      "number": 4959
    },
    {
      "id": "AIFACTORY-FEAT-148",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Pipeline blueprint",
      "sequence": "19.19",
      "description": "The workflow definition pipeline-blueprint as a published asset: Builds the Pipeline Blueprint from the Module, Test and Security Blueprints: build, test, scan and packaging stages per module with their gates, and the artefacts a release takes; deployment stays a promotion and is not a pipeline stage. Validated against the DSL. It has 5 steps, names the agents devops-engineer and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Depends on: AIFACTORY-FEAT-189. Increment I4: Trust and accountability. Build order 141 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-094",
        "AIFACTORY-US-1244",
        "AIFACTORY-US-1245",
        "AIFACTORY-US-1246"
      ],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14100,
      "titlePrefix": "[AIFACTORY-FEAT-148]",
      "number": 148
    },
    {
      "id": "AIFACTORY-US-094",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-148",
      "title": "The Pipeline blueprint workflow runs from its published definition",
      "sequence": "19.19.01",
      "description": "As an operator, I want the pipeline blueprint workflow to run from its published definition with the agents, tools and gates it declares, so that pipeline-blueprint, validation-receipt are produced the same way on every run, with evidence. The integration PBI of the definition `pipeline-blueprint`, the producing definition of the Pipeline kind (ADR-0030). It is readiness-activated with three required members of one project, the validated Module, Test and Security Blueprints (`BlueprintValidated` with `passed` true and the matching kind). When all three are satisfied the `ReadinessCorrelator` of WorkflowEngineService submits exactly one run through `SubmitRun` of RunControlService with its service token naming the project, the code-agent model profile and the bundle idempotency key; a newer member version supersedes the open correlation. On `RunAccepted` the engine loads the Published release the run pinned through AgentRegistryService and marks the five steps ready in order: `derive-stages` and `draft-pipeline-blueprint` on the `devops-engineer` release, the tool steps `submit-version` and `validate`, and the condition `check-valid`, which loops back to the draft at most twice. Every agent and tool step declares `failure_policy` Retry; the shared-write step `submit-version` also declares `idempotency_key` documentHash, which is what lets its Retry hold under ADR-0014. The shared write is autonomous unless the project policy gates blueprint drafts, in which case the run waits for an approval (D64). Deployment stays a promotion and is never a pipeline stage. No step declares a compensation. The run reports exactly one outcome within its budget. Before any run, the definition release and the agent release of `devops-engineer`, with any skill, tool or model profile release they need that is not yet Published, are submitted through `SubmitRelease` and published through `PublishRelease` of AgentRegistryService (feature agent-registry-service-publication); each publication is approved by a Reviewer who is not the submitter, a Platform admin for a model profile release. In I4 the evaluation gate of the complete delivery applies: where an evaluation suite exists for the asset kind, a release is published only with a passed evaluation record (ADR-0021), and a release of `devops-engineer` published in I2 without one is resubmitted through the gate as a new version; the runs pin the Published release, never a Draft one (D140). The step behaviour is specified in AIFACTORY-US-1244 to AIFACTORY-US-1246; this PBI proves the chain on the recorded fixture. Kind: behavior. Traces: workflows: pipeline-blueprint; steps: pipeline-blueprint/derive-stages, pipeline-blueprint/draft-pipeline-blueprint, pipeline-blueprint/submit-version, pipeline-blueprint/validate, pipeline-blueprint/check-valid; agents: devops-engineer; tools: blueprint-submit-version, blueprint-validate; services: WorkflowEngineService, RunControlService, AgentRegistryService; aggregates: WorkflowEngineService/ReadinessCorrelation; apis: RunControlService/SubmitRun, AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease; events: AgentRegistryService/AssetReleasePublished, WorkflowEngineService/ReadinessSatisfied, WorkflowEngineService/ReadinessRunSubmitted, WorkflowEngineService/ReadinessSuperseded, RunControlService/RunAccepted, RunControlService/RunCompleted, RunControlService/RunFailed, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, WorkflowEngineService/WorkflowRunStarted, WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed; descriptors: workflow-definition-v1, readiness-bundle-v1, blueprint-module-v1, blueprint-test-v1, blueprint-security-v1, blueprint-pipeline-v1, blueprint-validation-receipt-v1; adrs: ADR-0014, ADR-0021, ADR-0024, ADR-0026, ADR-0027, ADR-0030; requirements: FR-05, FR-06, FUX-05, XL-10, XL-11. Depends on: AIFACTORY-US-1244, AIFACTORY-US-1245, AIFACTORY-US-1246, feature:workflow-engine-service, feature:run-control-service, feature:agent-registry-service-complete, feature:agent-registry-service-publication. Sources: model/workflows/pipeline-blueprint.yaml, model/agents/devops-delivery/devops-engineer.yaml, docs/planes/agent-runtime/workflow-definitions/pipeline-blueprint.md.",
      "acceptanceCriteria": [
        "AC1: Given the Published release of `pipeline-blueprint`, submitted through AgentRegistryService/SubmitRelease and published through AgentRegistryService/PublishRelease after an approval by a Reviewer who is not the submitter and with a passed evaluation record where an evaluation suite exists for its asset kind (ADR-0021, D140), carries the activation block, the 5 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid, the `failure_policy` Retry of the four agent and tool steps and the `idempotency_key` documentHash of pipeline-blueprint/submit-version exactly as in model/workflows/pipeline-blueprint.yaml, when the last required member of an open WorkflowEngineService/ReadinessCorrelation is satisfied, then WorkflowEngineService/ReadinessSatisfied is published, one run is submitted through RunControlService/SubmitRun with the service token of the engine naming the project and the bundle idempotency key and WorkflowEngineService/ReadinessRunSubmitted names it; a repeated submission with the same key and body returns the same run; the same key with a different body is answered 409 by RunControlService/SubmitRun and the correlation becomes Superseded with reason conflict, publishing WorkflowEngineService/ReadinessSuperseded and no run; a newer member version publishes WorkflowEngineService/ReadinessSuperseded instead of a second run; and on RunControlService/RunAccepted WorkflowEngineService/WorkflowRunStarted is emitted and pipeline-blueprint/derive-stages, pipeline-blueprint/draft-pipeline-blueprint, pipeline-blueprint/submit-version, pipeline-blueprint/validate and pipeline-blueprint/check-valid become ready in that order on the pinned Published release of `devops-engineer`, and no Draft release is loaded.",
        "AC2: Given every step succeeds and pipeline-blueprint/check-valid holds, when the run completes, then `pipeline-blueprint` (blueprint-pipeline-v1, the validated BlueprintVersion that `steps.submit-version.version-ref` names, D133) and `validation-receipt` (blueprint-validation-receipt-v1) are recorded as the run outputs under the run envelope, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (ADR-0014).",
        "AC3: Given a step is settled Failed with its retry budget spent or with a failure class that is not retried, or pipeline-blueprint/check-valid reaches its iteration limit, when the engine applies the compensation policy of model/workflows/pipeline-blueprint.yaml, then WorkflowEngineService/WorkflowRunFailed names the failed step and the failure class, every Draft version created stays a Draft and RunControlService/RunFailed is published exactly once (recovery, not replay, ADR-0014).",
        "AC4: Given the project policy gates blueprint drafts, when pipeline-blueprint/submit-version is reached, then the run waits WaitingForApproval on a RunControlService/ApprovalRequested that names the run as its subject and resumes only on the matching RunControlService/ApprovalDecided, exactly as AIFACTORY-US-1245 AC3 specifies the gate (ADR-0026, D64, D129).",
        "AC5: Given the recorded fixture inputs of model/workflows/pipeline-blueprint.yaml, when the fixture run executes in the pipeline, then its outputs match the recorded ones field by field, every step output validates against its descriptor and the run stays within the declared budget (ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/agents/devops-delivery/devops-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/pipeline-blueprint.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-410",
        "AIFACTORY-TASK-411",
        "AIFACTORY-TASK-412",
        "AIFACTORY-TASK-732"
      ],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14101,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "pipeline-blueprint"
        ],
        "steps": [
          "pipeline-blueprint/derive-stages",
          "pipeline-blueprint/draft-pipeline-blueprint",
          "pipeline-blueprint/submit-version",
          "pipeline-blueprint/validate",
          "pipeline-blueprint/check-valid"
        ],
        "agents": [
          "devops-engineer"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "WorkflowEngineService",
          "RunControlService",
          "AgentRegistryService"
        ],
        "aggregates": [
          "WorkflowEngineService/ReadinessCorrelation"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "AgentRegistryService/AssetReleasePublished",
          "WorkflowEngineService/ReadinessSatisfied",
          "WorkflowEngineService/ReadinessRunSubmitted",
          "WorkflowEngineService/ReadinessSuperseded",
          "RunControlService/RunAccepted",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "WorkflowEngineService/WorkflowRunStarted",
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "workflow-definition-v1",
          "readiness-bundle-v1",
          "blueprint-module-v1",
          "blueprint-test-v1",
          "blueprint-security-v1",
          "blueprint-pipeline-v1",
          "blueprint-validation-receipt-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0021",
          "ADR-0024",
          "ADR-0026",
          "ADR-0027",
          "ADR-0030"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "FUX-05",
          "XL-10",
          "XL-11"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1244",
        "AIFACTORY-US-1245",
        "AIFACTORY-US-1246",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:agent-registry-service-complete",
        "feature:agent-registry-service-publication"
      ],
      "source": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/agents/devops-delivery/devops-engineer.yaml",
        "docs/planes/agent-runtime/workflow-definitions/pipeline-blueprint.md"
      ],
      "titlePrefix": "[AIFACTORY-US-094]",
      "number": 94
    },
    {
      "id": "AIFACTORY-TASK-410",
      "type": "task",
      "parent": "AIFACTORY-US-094",
      "title": "Author, submit and publish the release of the workflow definition pipeline-blueprint with its agent release",
      "sequence": "19.19.01.01",
      "description": "Author, submit and publish the release of the workflow definition pipeline-blueprint with its agent release. Expected output: The release of pipeline-blueprint (workflow-definition-v1) authored with its activation block, its 5 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid and the compensation policy as in model/workflows/pipeline-blueprint.yaml, the failure_policy Retry of the four agent and tool steps copied as it stands and the idempotency_key documentHash of submit-version, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent release devops-engineer of AIFACTORY-TASK-411 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "The release of pipeline-blueprint (workflow-definition-v1) authored with its activation block, its 5 steps, input mappings, retry policies, timeouts, the on_false loop of check-valid and the compensation policy as in model/workflows/pipeline-blueprint.yaml, the failure_policy Retry of the four agent and tool steps copied as it stands and the idempotency_key documentHash of submit-version, and accepted by ValidateWorkflowDefinition of WorkflowEngineService; it is submitted through SubmitRelease of AgentRegistryService together with the agent release devops-engineer of AIFACTORY-TASK-411 and any skill, tool or model profile release of their closure that is not yet Published, each publication is approved, through the approval that RunControlService opens with the subject kind asset-release, by a Reviewer who is not the submitter (a Platform admin for a model profile release), and each release is published through PublishRelease with the alias latest moved to it (feature agent-registry-service-publication, D140); the evaluation gate of the complete delivery applies, so a release of an asset kind with an evaluation suite is published only with a passed evaluation record, and the Published release ids are recorded for the fixture run, which pins them."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-410]",
      "number": 410
    },
    {
      "id": "AIFACTORY-TASK-411",
      "type": "task",
      "parent": "AIFACTORY-US-094",
      "title": "Author the agent release devops-engineer with its prompts and skills",
      "sequence": "19.19.01.02",
      "description": "Author the agent release devops-engineer with its prompts and skills. Expected output: A Draft release of devops-engineer with its instructions, the fifteen bound skills of model/agents/devops-delivery/devops-engineer.yaml, the tool bindings and the model profile code-agent, as a new version of the agent, since the releases published in I2 carry no evaluation record; the release is evaluated with the suite devops-delivery-core-v1 on a fixture input and carries a passed evaluation record before AIFACTORY-TASK-410 submits it for publication through the evaluation gate (D140).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate. Verification: dotnet test -c Release.",
      "acceptanceCriteria": [
        "A Draft release of devops-engineer with its instructions, the fifteen bound skills of model/agents/devops-delivery/devops-engineer.yaml, the tool bindings and the model profile code-agent, as a new version of the agent, since the releases published in I2 carry no evaluation record; the release is evaluated with the suite devops-delivery-core-v1 on a fixture input and carries a passed evaluation record before AIFACTORY-TASK-410 submits it for publication through the evaluation gate (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14101,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-411]",
      "number": 411
    },
    {
      "id": "AIFACTORY-TASK-412",
      "type": "task",
      "parent": "AIFACTORY-US-094",
      "title": "Fixture run of pipeline-blueprint against recorded inputs",
      "sequence": "19.19.01.03",
      "description": "Fixture run of pipeline-blueprint against recorded inputs. Expected output: The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-410; every step output validates against its descriptor and pipeline-blueprint and validation-receipt match the recorded ones field by field (AC1, AC2 and AC5 of AIFACTORY-US-094).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService. Verification: dotnet test -c Release --filter Category=WorkflowFixture.",
      "acceptanceCriteria": [
        "The definition runs end to end on a fixture project in the acceptance environment from a satisfied readiness bundle to RunCompleted on the Published releases of AIFACTORY-TASK-410; every step output validates against its descriptor and pipeline-blueprint and validation-receipt match the recorded ones field by field (AC1, AC2 and AC5 of AIFACTORY-US-094)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-412]",
      "number": 412
    },
    {
      "id": "AIFACTORY-TASK-732",
      "type": "task",
      "parent": "AIFACTORY-US-094",
      "title": "Verify pipeline-blueprint-runs-from-its-definition by running the declared command",
      "sequence": "19.19.01.04",
      "description": "Verify pipeline-blueprint-runs-from-its-definition by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-094, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, the failure path of AC3 and, at chain level, the wait of AC4 (the gate itself is proven by AIFACTORY-TASK-4965); the output names the Published release ids of pipeline-blueprint and devops-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=WorkflowFixture`; it passes and proves AC1 to AC5 of AIFACTORY-US-094, including the same-key replay, the 409 conflict with the correlation Superseded with reason conflict and no run, the failure path of AC3 and, at chain level, the wait of AC4 (the gate itself is proven by AIFACTORY-TASK-4965); the output names the Published release ids of pipeline-blueprint and devops-engineer that the run pinned, as AgentRegistryService/GetRelease reports them with their approval by a Reviewer who is not the submitter and their evaluation record (D140)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-732]",
      "number": 732
    },
    {
      "id": "AIFACTORY-US-1244",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-148",
      "title": "The DevOps role derives the stages per module and drafts the Pipeline Blueprint with gates and artefacts",
      "sequence": "19.19.02",
      "description": "As an operator, I want build, test, scan and packaging stages per module derived from the Module, Test and Security Blueprints and written up as a Pipeline Blueprint, so that every module's pipeline runs the suites and scan gates its blueprints demand, and deployment stays a promotion. The two agent steps of `pipeline-blueprint`. When the engine marks `derive-stages` ready it resolves `module-blueprints`, `test-blueprint` and `security-blueprint` from the run inputs; the `devops-engineer` release runs in read class with skills such as `devops-engineer-strategy-composer` and `devops-engineer-template-resolver` and writes `stage-plan`: the build, test, scan and packaging stages of every module, the suites of the Test Blueprint each stage runs and the scan gates the Security Blueprint demands. When `draft-pipeline-blueprint` becomes ready it receives the same three blueprints, `stage-plan` from `steps.derive-stages.stage-plan` and, on a revision pass, the findings of the last validation receipt as feedback; the `devops-engineer` release, sandbox class, with the skills `devops-engineer-pipeline-renderer` and `devops-engineer-artifact-emitter`, writes the Pipeline Blueprint against blueprint-pipeline-v1 with stages, gates and thresholds, the pipeline templates of the house library (ConnectSoft.AzurePipelines), the produced artefacts and their provenance attestations, and no deployment stage and no credential, as `pipeline-blueprint-draft`. Neither step touches a shared system. Both declare `failure_policy` Retry, exponential, 3 attempts, backoff 30s, timeout PT30M: a Failed attempt of failure class transient is retried, any other is not, and a step that spends its budget fails the run with the evidence. Kind: behavior. Traces: workflows: pipeline-blueprint; steps: pipeline-blueprint/derive-stages, pipeline-blueprint/draft-pipeline-blueprint; agents: devops-engineer; services: WorkflowEngineService; events: WorkflowEngineService/StepReady, WorkflowEngineService/WorkflowRunFailed; descriptors: blueprint-module-v1, blueprint-test-v1, blueprint-security-v1, blueprint-pipeline-v1, artifact-v1; scenarios: SCN-pipeline-blueprint-001, SCN-pipeline-blueprint-002; adrs: ADR-0014, ADR-0026, ADR-0030; requirements: FR-05, FR-06, FUX-05. Depends on: feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/pipeline-blueprint.yaml, model/agents/devops-delivery/devops-engineer.yaml, model/scenarios/pipeline-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a run accepted with `module-blueprints` (blueprint-module-v1), `test-blueprint` (blueprint-test-v1) and `security-blueprint` (blueprint-security-v1), when `devops-engineer` executes pipeline-blueprint/derive-stages, then the output `stage-plan` (artifact-v1) is recorded once under the run envelope with the build, test, scan and packaging stages of every module, the test suites each stage runs and the scan gates of the Security Blueprint (SCN-pipeline-blueprint-001).",
        "AC2: Given `steps.derive-stages.stage-plan` is recorded, when `devops-engineer` executes pipeline-blueprint/draft-pipeline-blueprint, then the output `pipeline-blueprint-draft` (blueprint-pipeline-v1) is recorded once with stages, gates and thresholds, pipeline templates of the house library, the produced artefacts with their provenance attestations, no deployment stage and no credential (SCN-pipeline-blueprint-002).",
        "AC3: Given a revision pass after pipeline-blueprint/check-valid took its false branch, when pipeline-blueprint/draft-pipeline-blueprint re-runs, then the findings of `steps.validate.validation-receipt` are in its context as feedback and the new draft addresses each finding by rule id (PIPE-001 to PIPE-003 or the schema path) (SCN-pipeline-blueprint-002, ADR-0026).",
        "AC4: Given an attempt of pipeline-blueprint/derive-stages or pipeline-blueprint/draft-pipeline-blueprint exceeds its timeout PT30M, settles Failed with a failure class other than transient, or settles Failed with failure class transient until the exponential budget of 3 attempts is spent, when the engine applies the policy of model/workflows/pipeline-blueprint.yaml, then WorkflowEngineService/WorkflowRunFailed names the step and no shared system is changed (SCN-pipeline-blueprint-001, SCN-pipeline-blueprint-002, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/agents/devops-delivery/devops-engineer.yaml",
        "model/scenarios/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4960",
        "AIFACTORY-TASK-4961",
        "AIFACTORY-TASK-4962"
      ],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14102,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "pipeline-blueprint"
        ],
        "steps": [
          "pipeline-blueprint/derive-stages",
          "pipeline-blueprint/draft-pipeline-blueprint"
        ],
        "agents": [
          "devops-engineer"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/StepReady",
          "WorkflowEngineService/WorkflowRunFailed"
        ],
        "descriptors": [
          "blueprint-module-v1",
          "blueprint-test-v1",
          "blueprint-security-v1",
          "blueprint-pipeline-v1",
          "artifact-v1"
        ],
        "scenarios": [
          "SCN-pipeline-blueprint-001",
          "SCN-pipeline-blueprint-002"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026",
          "ADR-0030"
        ],
        "requirements": [
          "FR-05",
          "FR-06",
          "FUX-05"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/agents/devops-delivery/devops-engineer.yaml",
        "model/scenarios/pipeline-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1244]",
      "number": 1244
    },
    {
      "id": "AIFACTORY-TASK-4960",
      "type": "task",
      "parent": "AIFACTORY-US-1244",
      "title": "Recorded fixture for the stage derivation and the Pipeline Blueprint draft",
      "sequence": "19.19.02.01",
      "description": "Recorded fixture for the stage derivation and the Pipeline Blueprint draft. Expected output: Fixture Module Blueprints of two modules, a Test Blueprint and a Security Blueprint with one scan gate, with the expected stage-plan and the expected Pipeline Blueprint draft (blueprint-pipeline-v1) without a deployment stage, plus a receipt with a PIPE-002 finding as feedback for the revision pass, as the oracle of SCN-pipeline-blueprint-001 and SCN-pipeline-blueprint-002.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.AgentTemplate.",
      "acceptanceCriteria": [
        "Fixture Module Blueprints of two modules, a Test Blueprint and a Security Blueprint with one scan gate, with the expected stage-plan and the expected Pipeline Blueprint draft (blueprint-pipeline-v1) without a deployment stage, plus a receipt with a PIPE-002 finding as feedback for the revision pass, as the oracle of SCN-pipeline-blueprint-001 and SCN-pipeline-blueprint-002."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentTemplate"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14102,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4960]",
      "number": 4960
    },
    {
      "id": "AIFACTORY-TASK-4961",
      "type": "task",
      "parent": "AIFACTORY-US-1244",
      "title": "Verify the input mappings and action classes of the two agent steps in the Draft release",
      "sequence": "19.19.02.02",
      "description": "Verify the input mappings and action classes of the two agent steps in the Draft release. Expected output: The steps derive-stages and draft-pipeline-blueprint of the Draft release authored by AIFACTORY-TASK-410 resolve module-blueprints, test-blueprint, security-blueprint and stage-plan exactly as mapped in model/workflows/pipeline-blueprint.yaml and are announced with actionClass read and sandbox; the feedback attachment on the on_false branch is engine behaviour proven by AIFACTORY-TASK-4968.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The steps derive-stages and draft-pipeline-blueprint of the Draft release authored by AIFACTORY-TASK-410 resolve module-blueprints, test-blueprint, security-blueprint and stage-plan exactly as mapped in model/workflows/pipeline-blueprint.yaml and are announced with actionClass read and sandbox; the feedback attachment on the on_false branch is engine behaviour proven by AIFACTORY-TASK-4968."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4961]",
      "number": 4961
    },
    {
      "id": "AIFACTORY-TASK-4962",
      "type": "task",
      "parent": "AIFACTORY-US-1244",
      "title": "Prove the stage derivation and the draft on the fixture",
      "sequence": "19.19.02.03",
      "description": "Prove the stage derivation and the draft on the fixture. Expected output: A fixture run proves SCN-pipeline-blueprint-001 and SCN-pipeline-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1244); the outputs validate against artifact-v1 and blueprint-pipeline-v1, the draft carries no deployment stage, and the retry exhaustion path ends in WorkflowRunFailed naming the step.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-pipeline-blueprint-001 and SCN-pipeline-blueprint-002 (AC1 to AC4 of AIFACTORY-US-1244); the outputs validate against artifact-v1 and blueprint-pipeline-v1, the draft carries no deployment stage, and the retry exhaustion path ends in WorkflowRunFailed naming the step."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4962]",
      "number": 4962
    },
    {
      "id": "AIFACTORY-US-1245",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-148",
      "title": "The Pipeline Blueprint draft is stored as a project-scope Draft version and validated with a receipt",
      "sequence": "19.19.03",
      "description": "As an operator, I want the drafted Pipeline Blueprint stored as a Draft version of the project and validated against its schema and the PIPE rules, so that a validation verdict with findings exists for every draft before a pipeline is generated from it. The two tool steps of `pipeline-blueprint`. When `submit-version` becomes ready the engine resolves `document` from `steps.draft-pipeline-blueprint.pipeline-blueprint-draft` and emits `StepReady` with `actionClass` shared-write and `idempotent` true; Run Control dispatches the attempt and `blueprint-submit-version` goes through the fixed pipeline of ToolAdapterService. Draft versions are autonomous by default; when the project policy (BC-20) gates blueprint drafts the invocation waits AwaitingApproval for an approval requested through `RunControl.RequestApproval` that names the run as its subject and is bound to the invocation request hash, which covers the document hash, with proposalKind tool-invocation (D64, D129). The tool calls `Blueprints.SubmitDraftVersion` of BlueprintService under the run's workload identity: the document becomes a project-scope Draft `BlueprintVersion` of kind Pipeline, idempotent on its document hash, which the step declares as its `idempotency_key`. A rejected or expired decision denies the invocation and the attempt fails policy-denied. An attempt whose effect cannot be confirmed settles Uncertain and is never retried automatically. When `validate` becomes ready `blueprint-validate` calls `Blueprints.Validate`; BlueprintService validates against blueprint-pipeline-v1 and the rules PIPE-001 to PIPE-003, returns a receipt, moves the version to Validated only when the receipt passed, and emits `BlueprintValidated`. A receipt with `passed` false is a successful step output. A version reference of another tenant is answered NOT_FOUND and the attempt takes the failure class permanent (ADR-0015). Kind: behavior. Traces: workflows: pipeline-blueprint; steps: pipeline-blueprint/submit-version, pipeline-blueprint/validate; tools: blueprint-submit-version, blueprint-validate; services: BlueprintService, WorkflowEngineService, ToolAdapterService, RunControlService; aggregates: BlueprintService/BlueprintVersion, ToolAdapterService/ToolInvocation; apis: BlueprintService/Blueprints.SubmitDraftVersion, BlueprintService/Blueprints.Validate, RunControlService/RunControl.RequestApproval, ToolAdapterService/ConfirmToolEffect; events: BlueprintService/BlueprintValidated, WorkflowEngineService/StepReady, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided, ToolAdapterService/ToolInvocationDenied, ToolAdapterService/ToolEffectUncertain; descriptors: blueprint-pipeline-v1, blueprint-version-ref-v1, blueprint-validation-receipt-v1; scenarios: SCN-pipeline-blueprint-003, SCN-pipeline-blueprint-004; adrs: ADR-0014, ADR-0015, ADR-0026; requirements: FR-05, FR-06. Depends on: AIFACTORY-US-1244, feature:blueprint-service, feature:workflow-engine-service, feature:run-control-service, feature:tool-adapter-service. Sources: model/workflows/pipeline-blueprint.yaml, model/tools/blueprint-submit-version.yaml, model/tools/blueprint-validate.yaml, model/services/template-library/BlueprintService.yaml, model/scenarios/pipeline-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.draft-pipeline-blueprint.pipeline-blueprint-draft` is recorded and the project policy does not gate blueprint drafts, when pipeline-blueprint/submit-version runs `blueprint-submit-version` through BlueprintService/Blueprints.SubmitDraftVersion, then a Draft BlueprintService/BlueprintVersion of kind Pipeline exists in project scope, the output `version-ref` (blueprint-version-ref-v1) is recorded once under the run envelope, no approval is requested, and a resubmission of the same document hash returns the same version (SCN-pipeline-blueprint-003, D64).",
        "AC2: Given `steps.submit-version.version-ref` is recorded, when pipeline-blueprint/validate runs `blueprint-validate` through BlueprintService/Blueprints.Validate, then the output `validation-receipt` (blueprint-validation-receipt-v1) with findings by rule id (PIPE-001 to PIPE-003) or schema path is recorded once whether it passed or not, BlueprintService/BlueprintValidated is emitted with `passed` and the document hash, and the version moves to Validated only for a passed receipt; a version reference of another tenant is answered NOT_FOUND with no receipt and the attempt takes the failure class permanent and is not retried (SCN-pipeline-blueprint-004, ADR-0015).",
        "AC3: Given the project policy gates blueprint drafts, when pipeline-blueprint/submit-version is reached, then the ToolAdapterService/ToolInvocation of `blueprint-submit-version` is held AwaitingApproval, an approval naming the run as its subject is requested through RunControlService/RunControl.RequestApproval bound to the request hash with proposalKind tool-invocation, RunControlService/ApprovalRequested is published before any write, and BlueprintService/Blueprints.SubmitDraftVersion is called only on an approving RunControlService/ApprovalDecided for that hash; a rejected or expired decision publishes ToolAdapterService/ToolInvocationDenied and the attempt fails policy-denied without a Draft version (SCN-pipeline-blueprint-003, ADR-0026, D129).",
        "AC4: Given an attempt of pipeline-blueprint/submit-version settles Failed with failure class transient, when Run Control evaluates the step, then it is retried under the fixed budget of 2 attempts with backoff 10s, which holds for this shared-write step because it declares `idempotency_key` documentHash, and on exhaustion it fails with evidence; given any other failure class it is not retried; given the attempt settles Uncertain (timeout PT2M after dispatch), then ToolAdapterService/ToolEffectUncertain is published and the attempt waits for an operator to settle it through ToolAdapterService/ConfirmToolEffect, the document hash ensuring that a confirmed effect is never duplicated; an attempt of pipeline-blueprint/validate that exceeds PT5M or fails transient is retried under its fixed budget and then fails with evidence (SCN-pipeline-blueprint-003, SCN-pipeline-blueprint-004, ADR-0014)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/scenarios/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4963",
        "AIFACTORY-TASK-4964",
        "AIFACTORY-TASK-4965"
      ],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14103,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "pipeline-blueprint"
        ],
        "steps": [
          "pipeline-blueprint/submit-version",
          "pipeline-blueprint/validate"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "services": [
          "BlueprintService",
          "WorkflowEngineService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "aggregates": [
          "BlueprintService/BlueprintVersion",
          "ToolAdapterService/ToolInvocation"
        ],
        "apis": [
          "BlueprintService/Blueprints.SubmitDraftVersion",
          "BlueprintService/Blueprints.Validate",
          "RunControlService/RunControl.RequestApproval",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "events": [
          "BlueprintService/BlueprintValidated",
          "WorkflowEngineService/StepReady",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided",
          "ToolAdapterService/ToolInvocationDenied",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "descriptors": [
          "blueprint-pipeline-v1",
          "blueprint-version-ref-v1",
          "blueprint-validation-receipt-v1"
        ],
        "scenarios": [
          "SCN-pipeline-blueprint-003",
          "SCN-pipeline-blueprint-004"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0026"
        ],
        "requirements": [
          "FR-05",
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1244",
        "feature:blueprint-service",
        "feature:workflow-engine-service",
        "feature:run-control-service",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/tools/blueprint-submit-version.yaml",
        "model/tools/blueprint-validate.yaml",
        "model/services/template-library/BlueprintService.yaml",
        "model/scenarios/pipeline-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1245]",
      "number": 1245
    },
    {
      "id": "AIFACTORY-TASK-4963",
      "type": "task",
      "parent": "AIFACTORY-US-1245",
      "title": "Fixture Pipeline Blueprint documents with their expected receipts",
      "sequence": "19.19.03.01",
      "description": "Fixture Pipeline Blueprint documents with their expected receipts. Expected output: One fixture Pipeline Blueprint document that passes PIPE-001 to PIPE-003 and one that fails PIPE-002 with a deployment stage, each with its expected blueprint-version-ref-v1, blueprint-validation-receipt-v1 and the version state after the verdict, plus a version reference of another tenant with the expected NOT_FOUND and no receipt, as the oracle of SCN-pipeline-blueprint-003 and SCN-pipeline-blueprint-004.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.BlueprintService.",
      "acceptanceCriteria": [
        "One fixture Pipeline Blueprint document that passes PIPE-001 to PIPE-003 and one that fails PIPE-002 with a deployment stage, each with its expected blueprint-version-ref-v1, blueprint-validation-receipt-v1 and the version state after the verdict, plus a version reference of another tenant with the expected NOT_FOUND and no receipt, as the oracle of SCN-pipeline-blueprint-003 and SCN-pipeline-blueprint-004."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.BlueprintService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14103,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4963]",
      "number": 4963
    },
    {
      "id": "AIFACTORY-TASK-4964",
      "type": "task",
      "parent": "AIFACTORY-US-1245",
      "title": "Bind the submit and validate tool steps of the Draft release with the Pipeline kind",
      "sequence": "19.19.03.02",
      "description": "Bind the submit and validate tool steps of the Draft release with the Pipeline kind. Expected output: The tool steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate with document and version-ref mapped as in model/workflows/pipeline-blueprint.yaml, submit-version is announced shared-write with idempotent true and the fixed retry of 2 attempts, validate sandbox with the same budget, and the bindings of model/tools/blueprint-submit-version.yaml and model/tools/blueprint-validate.yaml are reused unchanged for the kind Pipeline.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "The tool steps submit-version and validate of the Draft release call blueprint-submit-version and blueprint-validate with document and version-ref mapped as in model/workflows/pipeline-blueprint.yaml, submit-version is announced shared-write with idempotent true and the fixed retry of 2 attempts, validate sandbox with the same budget, and the bindings of model/tools/blueprint-submit-version.yaml and model/tools/blueprint-validate.yaml are reused unchanged for the kind Pipeline."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14103,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4964]",
      "number": 4964
    },
    {
      "id": "AIFACTORY-TASK-4965",
      "type": "task",
      "parent": "AIFACTORY-US-1245",
      "title": "Prove the submit and validate steps of pipeline-blueprint on the fixture",
      "sequence": "19.19.03.03",
      "description": "Prove the submit and validate steps of pipeline-blueprint on the fixture. Expected output: A fixture run proves SCN-pipeline-blueprint-003 and SCN-pipeline-blueprint-004 (AC1 to AC4 of AIFACTORY-US-1245), including the idempotent resubmission, the gated path with an approval naming the run as its subject, the denial on rejection, the transient retry under the idempotency key, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the NOT_FOUND answer for another tenant.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-pipeline-blueprint-003 and SCN-pipeline-blueprint-004 (AC1 to AC4 of AIFACTORY-US-1245), including the idempotent resubmission, the gated path with an approval naming the run as its subject, the denial on rejection, the transient retry under the idempotency key, the Uncertain path settled through ConfirmToolEffect, a failed receipt recorded as a step output and the NOT_FOUND answer for another tenant."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4965]",
      "number": 4965
    },
    {
      "id": "AIFACTORY-US-1246",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-148",
      "title": "The engine checks the Pipeline Blueprint receipt and sends findings back to the draft at most twice",
      "sequence": "19.19.04",
      "description": "As an operator, I want a failed validation of the Pipeline Blueprint sent back to the draft a bounded number of times and then the run failed with the report, so that the Pipeline Blueprint improves on real findings without looping forever or hiding the verdict. The condition step of `pipeline-blueprint`, its last step. When `check-valid` becomes ready the engine evaluates `steps.validate.validation-receipt.passed == true` over the recorded receipt; a condition step never retries, never calls a service and completes within PT1M. When the receipt passed, the condition completes with one outcome and the run completes. The run output `pipeline-blueprint` (blueprint-pipeline-v1) binds to the validated BlueprintVersion that `steps.submit-version.version-ref` of the passing iteration names, and to no draft and no other version (D133); `validation-receipt` binds to the receipt of that iteration, never to an earlier failed one. When it did not, the engine takes the `on_false` branch to `draft-pipeline-blueprint` with `steps.validate.validation-receipt` as feedback: the draft, submit and validate steps re-run in order, the revised document gets its own Draft version and receipt, and the iteration count of the run rises by one. The branch is taken at most 2 times; when the receipt is still failed after the last iteration the run fails with the validation report as its evidence, `WorkflowRunFailed` names `check-valid` with the failure class validation, Run Control records Failed exactly once and every Draft version created on the way stays a Draft. A missing or unreadable receipt fails the condition with evidence instead of being read as passed (ADR-0026). Kind: behavior. Traces: workflows: pipeline-blueprint; steps: pipeline-blueprint/check-valid, pipeline-blueprint/draft-pipeline-blueprint; services: WorkflowEngineService; events: WorkflowEngineService/WorkflowRunCompleted, WorkflowEngineService/WorkflowRunFailed, RunControlService/RunCompleted, RunControlService/RunFailed; descriptors: blueprint-validation-receipt-v1, blueprint-pipeline-v1, blueprint-version-ref-v1; scenarios: SCN-pipeline-blueprint-005, SCN-pipeline-blueprint-006; adrs: ADR-0014, ADR-0026; requirements: FR-06. Depends on: AIFACTORY-US-1245, feature:workflow-engine-service, feature:run-control-service. Sources: model/workflows/pipeline-blueprint.yaml, model/services/agent-mesh/WorkflowEngineService.yaml, model/scenarios/pipeline-blueprint.yaml.",
      "acceptanceCriteria": [
        "AC1: Given `steps.validate.validation-receipt` is recorded with `passed` true, when the engine evaluates pipeline-blueprint/check-valid, then the condition completes with exactly one outcome, no service is called, the run output `pipeline-blueprint` is the validated BlueprintVersion that `steps.submit-version.version-ref` of that iteration names and `validation-receipt` its receipt, WorkflowEngineService/WorkflowRunCompleted is emitted once and RunControlService/RunCompleted follows exactly once (SCN-pipeline-blueprint-005, D133).",
        "AC2: Given the recorded receipt has `passed` false and fewer than 2 iterations were counted on the run, when the engine evaluates pipeline-blueprint/check-valid, then it takes the false branch to pipeline-blueprint/draft-pipeline-blueprint with the receipt as feedback, the steps pipeline-blueprint/submit-version and pipeline-blueprint/validate re-run on the revised draft and the iteration count rises by one (SCN-pipeline-blueprint-006).",
        "AC3: Given the receipt is still `passed` false after the second iteration, when the engine evaluates pipeline-blueprint/check-valid, then the run fails with the validation report as evidence, WorkflowEngineService/WorkflowRunFailed names `check-valid` with failure class validation, RunControlService/RunFailed is published exactly once and no Draft version is promoted (SCN-pipeline-blueprint-006, ADR-0014).",
        "AC4: Given the receipt is missing or unreadable, or the evaluation exceeds its timeout PT1M, when the engine evaluates pipeline-blueprint/check-valid, then the condition is not retried (none, 0 attempts), it fails with evidence and the run follows the compensation policy of model/workflows/pipeline-blueprint.yaml (SCN-pipeline-blueprint-005, ADR-0026)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:pbi",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:behavior"
      ],
      "children": [
        "AIFACTORY-TASK-4966",
        "AIFACTORY-TASK-4967",
        "AIFACTORY-TASK-4968"
      ],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14104,
      "kind": "behavior",
      "traces": {
        "workflows": [
          "pipeline-blueprint"
        ],
        "steps": [
          "pipeline-blueprint/check-valid",
          "pipeline-blueprint/draft-pipeline-blueprint"
        ],
        "services": [
          "WorkflowEngineService"
        ],
        "events": [
          "WorkflowEngineService/WorkflowRunCompleted",
          "WorkflowEngineService/WorkflowRunFailed",
          "RunControlService/RunCompleted",
          "RunControlService/RunFailed"
        ],
        "descriptors": [
          "blueprint-validation-receipt-v1",
          "blueprint-pipeline-v1",
          "blueprint-version-ref-v1"
        ],
        "scenarios": [
          "SCN-pipeline-blueprint-005",
          "SCN-pipeline-blueprint-006"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0026"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1245",
        "feature:workflow-engine-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/workflows/pipeline-blueprint.yaml",
        "model/services/agent-mesh/WorkflowEngineService.yaml",
        "model/scenarios/pipeline-blueprint.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1246]",
      "number": 1246
    },
    {
      "id": "AIFACTORY-TASK-4966",
      "type": "task",
      "parent": "AIFACTORY-US-1246",
      "title": "Fixture receipt sequences for the pass, loop and limit paths of pipeline-blueprint",
      "sequence": "19.19.04.01",
      "description": "Fixture receipt sequences for the pass, loop and limit paths of pipeline-blueprint. Expected output: Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count, as the oracle of SCN-pipeline-blueprint-005 and SCN-pipeline-blueprint-006.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "Recorded receipt sequences (passed true; passed false then true; passed false three times) that drive check-valid through the pass, the single loop and the iteration limit, each with the expected run outcome and iteration count, as the oracle of SCN-pipeline-blueprint-005 and SCN-pipeline-blueprint-006."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14104,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-4966]",
      "number": 4966
    },
    {
      "id": "AIFACTORY-TASK-4967",
      "type": "task",
      "parent": "AIFACTORY-US-1246",
      "title": "Bind the pipeline-blueprint run outputs to the validated version",
      "sequence": "19.19.04.02",
      "description": "Bind the pipeline-blueprint run outputs to the validated version. Expected output: When check-valid holds the run output pipeline-blueprint is bound to the validated BlueprintVersion that steps.submit-version.version-ref of the passing iteration names and validation-receipt to the receipt of that iteration, never to a draft or to an earlier failed iteration, as model/workflows/pipeline-blueprint.yaml declares (D133).. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "When check-valid holds the run output pipeline-blueprint is bound to the validated BlueprintVersion that steps.submit-version.version-ref of the passing iteration names and validation-receipt to the receipt of that iteration, never to a draft or to an earlier failed iteration, as model/workflows/pipeline-blueprint.yaml declares (D133)."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14104,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-4967]",
      "number": 4967
    },
    {
      "id": "AIFACTORY-TASK-4968",
      "type": "task",
      "parent": "AIFACTORY-US-1246",
      "title": "Prove the condition and the bounded loop of pipeline-blueprint on the fixture",
      "sequence": "19.19.04.03",
      "description": "Prove the condition and the bounded loop of pipeline-blueprint on the fixture. Expected output: A fixture run proves SCN-pipeline-blueprint-005 and SCN-pipeline-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1246); one outcome and a completed run on pass with pipeline-blueprint bound to the validated version of the passing iteration, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.WorkflowEngineService.",
      "acceptanceCriteria": [
        "A fixture run proves SCN-pipeline-blueprint-005 and SCN-pipeline-blueprint-006 (AC1 to AC4 of AIFACTORY-US-1246); one outcome and a completed run on pass with pipeline-blueprint bound to the validated version of the passing iteration, a loop back with feedback and iteration count on a failed receipt, and WorkflowRunFailed naming check-valid with failure class validation after the second iteration."
      ],
      "sourceArtifacts": [
        "model/workflows/pipeline-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:task",
        "route:solution-architect",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.WorkflowEngineService"
      ],
      "children": [],
      "buildOrder": 141,
      "phase": "factory",
      "stackRank": 14104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-4968]",
      "number": 4968
    },
    {
      "id": "AIFACTORY-FEAT-122",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Capability gap analysis",
      "sequence": "19.20",
      "description": "The workflow definition capability-gap-analysis as a published asset: Finds the APIs, data and templates a Service Blueprint needs but the estate lacks, by querying the template catalog, the knowledge platform and repository intelligence, and classifies each gap as build, reuse or defer. It has 4 steps, names the agents enterprise-architect and the tools knowledge-search, and is executed by WorkflowEngineService under Run Control. Increment I5: Knowledge and connections. Build order 153 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/capability-gap-analysis.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 153,
      "phase": "factory",
      "stackRank": 15300,
      "titlePrefix": "[AIFACTORY-FEAT-122]",
      "number": 122
    },
    {
      "id": "AIFACTORY-FEAT-123",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Documentation sync",
      "sequence": "19.21",
      "description": "The workflow definition documentation-sync as a published asset: Regenerates a product's documentation site from the model after a merged change, writes the narrative deltas, validates the build and proposes the documentation change set. It has 5 steps, names the agents documentation-site-generator, documentation-writer and the tools build-and-test, propose-change-set, and is executed by WorkflowEngineService under Run Control. Increment I5: Knowledge and connections. Build order 154 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/documentation-sync.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 154,
      "phase": "factory",
      "stackRank": 15400,
      "titlePrefix": "[AIFACTORY-FEAT-123]",
      "number": 123
    },
    {
      "id": "AIFACTORY-FEAT-124",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Guides generation",
      "sequence": "19.22",
      "description": "The workflow definition guides-generation as a published asset: Drafts guides and tutorials for a generated product as artifacts for human review; nothing is published by the run. It has 4 steps, names the agents documentation-writer and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I5: Knowledge and connections. Build order 155 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/guides-generation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 155,
      "phase": "factory",
      "stackRank": 15500,
      "titlePrefix": "[AIFACTORY-FEAT-124]",
      "number": 124
    },
    {
      "id": "AIFACTORY-FEAT-149",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Documentation blueprint",
      "sequence": "19.23",
      "description": "The workflow definition documentation-blueprint as a published asset: Builds the Documentation Blueprint from the Service and Module Blueprints: the documentation site structure, the page families per module, the audiences and the sources each page is generated from; validated against the DSL. It has 5 steps, names the agents documentation-writer and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I5: Knowledge and connections. Build order 156 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/documentation-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 156,
      "phase": "factory",
      "stackRank": 15600,
      "titlePrefix": "[AIFACTORY-FEAT-149]",
      "number": 149
    },
    {
      "id": "AIFACTORY-FEAT-125",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Product plan",
      "sequence": "19.24",
      "description": "The workflow definition product-plan as a published asset: Builds the feature hierarchy, the edition scope and the roadmap-free dependency view from a validated Vision Blueprint, as artifacts for review. It has 4 steps, names the agents product-manager and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 160 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/product-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 160,
      "phase": "factory",
      "stackRank": 16000,
      "titlePrefix": "[AIFACTORY-FEAT-125]",
      "number": 125
    },
    {
      "id": "AIFACTORY-FEAT-126",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Requirements alignment",
      "sequence": "19.25",
      "description": "The workflow definition requirements-alignment as a published asset: Elicits requirements, refines the backlog and records the stakeholder alignment memo that names the exact agreed versions; a Reviewer approves the memo by hash (publication class) before any final UX run can use it. It has 4 steps, names the agents business-analyst, product-owner, stakeholder-alignment and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 161 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/requirements-alignment.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 161,
      "phase": "factory",
      "stackRank": 16100,
      "titlePrefix": "[AIFACTORY-FEAT-126]",
      "number": 126
    },
    {
      "id": "AIFACTORY-FEAT-127",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: UX discovery",
      "sequence": "19.26",
      "description": "The workflow definition ux-discovery as a published asset: Early UX pass on a validated Vision Blueprint: synthesises research, extracts actors, builds personas and seeds journeys and hypotheses as typed artifacts that architecture and the final UX pass read; no blueprint version is produced. It has 4 steps, names the agents persona-builder, user-researcher and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 162 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/ux-discovery.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 162,
      "phase": "factory",
      "stackRank": 16200,
      "titlePrefix": "[AIFACTORY-FEAT-127]",
      "number": 127
    },
    {
      "id": "AIFACTORY-FEAT-128",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: UX Blueprint",
      "sequence": "19.27",
      "description": "The workflow definition ux-blueprint as a published asset: Final UX pass on the typed, aligned input bundle: journeys and screens bound to the Service Blueprint's operations, the UX Blueprint version validated with a receipt, the coverage matrix against the agreed stories and the Claude Design handoff pack. It has 8 steps, names the agents ux-designer and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 163 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/ux-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 163,
      "phase": "factory",
      "stackRank": 16300,
      "titlePrefix": "[AIFACTORY-FEAT-128]",
      "number": 128
    },
    {
      "id": "AIFACTORY-FEAT-129",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Frontend blueprint",
      "sequence": "19.28",
      "description": "The workflow definition frontend-blueprint as a published asset: Builds the Frontend Blueprint from the Service and UX Blueprints: the shell, the microfrontends per work area, routes, state families, locales and the API bindings; validated against the DSL. It runs only for a product whose UX Blueprint exists. It has 5 steps, names the agents frontend-developer and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 164 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/frontend-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 164,
      "phase": "factory",
      "stackRank": 16400,
      "titlePrefix": "[AIFACTORY-FEAT-129]",
      "number": 129
    },
    {
      "id": "AIFACTORY-FEAT-130",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: API contracts",
      "sequence": "19.29",
      "description": "The workflow definition api-contracts as a published asset: Generates the OpenAPI and gRPC contracts of a validated Service Blueprint's operations, lints them against the API governance rules and stores them as artifacts. It has 4 steps, names the agents api-designer and the tools shell-sandbox, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 165 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/api-contracts.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 165,
      "phase": "factory",
      "stackRank": 16500,
      "titlePrefix": "[AIFACTORY-FEAT-130]",
      "number": 130
    },
    {
      "id": "AIFACTORY-FEAT-131",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Gateway generation",
      "sequence": "19.30",
      "description": "The workflow definition gateway-generation as a published asset: Generates the product's API gateway (GW-07) from the API Gateway Blueprint on the ConnectSoft API gateway template, validates it and records the output. It has 4 steps, names the agents api-designer, api-gateway-generator and the tools build-and-test, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 166 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/gateway-generation.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 166,
      "phase": "factory",
      "stackRank": 16600,
      "titlePrefix": "[AIFACTORY-FEAT-131]",
      "number": 131
    },
    {
      "id": "AIFACTORY-FEAT-132",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Generate libraries",
      "sequence": "19.31",
      "description": "The workflow definition generate-libraries as a published asset: Scaffolds shared-kernel and client libraries from Backend Library Blueprints, implements the shared kernel, validates by build and test and records the outputs. It has 4 steps, names the agents backend-developer, library-generator and the tools build-and-test, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 167 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/generate-libraries.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 167,
      "phase": "factory",
      "stackRank": 16700,
      "titlePrefix": "[AIFACTORY-FEAT-132]",
      "number": 132
    },
    {
      "id": "AIFACTORY-FEAT-133",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Saga design as workflow definitions",
      "sequence": "19.32",
      "description": "The workflow definition saga-design as a published asset: Finds the long-running flows in a derived domain model and designs each as a workflow definition with compensation, validated against the DSL, instead of an ad-hoc saga. It has 4 steps, names the agents enterprise-architect, event-driven-architect and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 168 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/saga-design.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 168,
      "phase": "factory",
      "stackRank": 16800,
      "titlePrefix": "[AIFACTORY-FEAT-133]",
      "number": 133
    },
    {
      "id": "AIFACTORY-FEAT-135",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Milestone lifecycle",
      "sequence": "19.33",
      "description": "The workflow definition milestone-lifecycle as a published asset: Validates a milestone's runs, tests and evidence before release packaging: collects the runs, verifies tests and evidence, and creates the release through ReleaseService when all pass. It has 4 steps, names the agents product-owner, qa-engineer, release-manager and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 169 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/milestone-lifecycle.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 169,
      "phase": "factory",
      "stackRank": 16900,
      "titlePrefix": "[AIFACTORY-FEAT-135]",
      "number": 135
    },
    {
      "id": "AIFACTORY-FEAT-136",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Sprint execution",
      "sequence": "19.34",
      "description": "The workflow definition sprint-execution as a published asset: Runs a sprint's planned items as child runs in order, reviews each item's outcome against its acceptance criteria and closes the sprint with the evidence. It has 4 steps, names the agents product-owner, work-preparation-orchestrator and the tools none, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 170 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/sprint-execution.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 170,
      "phase": "factory",
      "stackRank": 17000,
      "titlePrefix": "[AIFACTORY-FEAT-136]",
      "number": 136
    },
    {
      "id": "AIFACTORY-FEAT-150",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: API gateway blueprint",
      "sequence": "19.35",
      "description": "The workflow definition api-gateway-blueprint as a published asset: Builds the API Gateway Blueprint from the Service and Security Blueprints: one route per published operation, token validation and audience, rate limits per route class and no business logic in the gateway; validated against the DSL. It has 5 steps, names the agents api-designer and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 171 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/api-gateway-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 171,
      "phase": "factory",
      "stackRank": 17100,
      "titlePrefix": "[AIFACTORY-FEAT-150]",
      "number": 150
    },
    {
      "id": "AIFACTORY-FEAT-151",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-019",
      "title": "Workflow definition: Backend library blueprint",
      "sequence": "19.36",
      "description": "The workflow definition backend-library-blueprint as a published asset: Builds the Backend Library Blueprint from the Service Blueprint and the derived domain model: the shared kernels more than one context needs, their layer, capability area and public surface. A product without a shared kernel yields a blueprint that declares no library. It has 5 steps, names the agents solution-architect and the tools blueprint-submit-version, blueprint-validate, and is executed by WorkflowEngineService under Run Control. Increment I6: Full product generation. Build order 172 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/workflows/backend-library-blueprint.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:assets",
        "type:feature",
        "route:solution-architect",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 172,
      "phase": "factory",
      "stackRank": 17200,
      "titlePrefix": "[AIFACTORY-FEAT-151]",
      "number": 151
    },
    {
      "id": "AIFACTORY-EPIC-020",
      "type": "epic",
      "parent": null,
      "title": "Outcome verification",
      "sequence": "20",
      "description": "One feature per increment that demonstrates the increment's outcome end to end with recorded evidence. An increment is finished when its verification feature passes, not when its services are deployed. Done when: Each increment from I0 to I8 has its demonstrable outcome recorded with the evidence its verification feature names, in the order of the build order.",
      "acceptanceCriteria": [
        "Each increment from I0 to I8 has its demonstrable outcome recorded with the evidence its verification feature names, in the order of the build order."
      ],
      "sourceArtifacts": [],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:epic",
        "route:qa-engineer",
        "slice:program",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-FEAT-138",
        "AIFACTORY-FEAT-139",
        "AIFACTORY-FEAT-140",
        "AIFACTORY-FEAT-141",
        "AIFACTORY-FEAT-142",
        "AIFACTORY-FEAT-143",
        "AIFACTORY-FEAT-144",
        "AIFACTORY-FEAT-145",
        "AIFACTORY-FEAT-146"
      ],
      "stackRank": 4999,
      "titlePrefix": "[AIFACTORY-EPIC-020]",
      "number": 20
    },
    {
      "id": "AIFACTORY-FEAT-138",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I0: Readiness",
      "sequence": "20.01",
      "description": "The outcome of increment I0 is demonstrated end to end and the evidence is recorded: Every repository of the first outcome scaffolds from its template and builds, and one call chain carries a trusted tenant and project scope from the edge to a service. Demonstrations: Each first-outcome repository exists, builds and runs its template tests in its pipeline. A request with a token of the Identity Platform reaches a service with tenant and project scope, and a request without scope is refused. The contracts package is published and consumed by two services. Increment I0: Readiness. Build order 50 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1336",
        "AIFACTORY-US-1337",
        "AIFACTORY-US-1338",
        "AIFACTORY-US-004"
      ],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5000,
      "titlePrefix": "[AIFACTORY-FEAT-138]",
      "number": 138
    },
    {
      "id": "AIFACTORY-US-1336",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-138",
      "title": "Readiness proof: every repository of the first outcome is scaffolded from the template of its kind and passes its template tests in its own pipeline",
      "sequence": "20.01.01",
      "description": "As an operator, I want a recorded run in which every repository of the first outcome is created, scaffolded and built by its own pipeline, so that the first outcome starts from repositories that are known to build and test before any Factory code is written. This PBI proves the first demonstration of increment I0: each first-outcome repository exists, builds and runs its template tests in its pipeline. An operator takes the list of first-outcome repositories from the services the increment page docs/backlog/increments/generate-a-microservice.md names, one repository and one deployable per service as ADR-0028 decision 1 requires, and checks each one against the checklist of the feature `repository-and-pipeline-conventions`: the name `ConnectSoft.AI.SoftwareFactory.<ServiceId>`, the template of its kind scaffolded with the Factory profile switch of that template, the branch policy, and a pipeline built from the shared pipeline templates that builds, tests and packs with no script of its own. The run is recorded, not asserted: each repository has the identifier of one green pipeline run on its default branch, the version of the template it was scaffolded from and the result of the conformance check that reports every name, template, pipeline and feed deviation. A repository that is missing, does not build or deviates is recorded by name with the failing check; it blocks the readiness proof and is never waived by this feature. The proof exercises only the I0 work it depends on and adds no repository of its own. Every repository of the list is created in I0 by feature `repository-and-pipeline-conventions` (D140): RunControlService by AIFACTORY-TASK-190, ControlPlaneApi by AIFACTORY-TASK-1514, AgentRuntimeService by AIFACTORY-TASK-146 of the durable execution spike, and the thirty repositories of the I1 features by the tasks of AIFACTORY-US-1596 to AIFACTORY-US-1601, grouped by plane and with their identifiers kept; none of them waits for its I1 feature, so the demonstration can pass in I0, and a first-outcome repository that a task of an I1 feature would still have to create is a gap that blocks this proof. Kind: evidence. Traces: adrs: ADR-0028. Depends on: feature:repository-and-pipeline-conventions, feature:durable-execution-spike. Sources: model/backlog/increments.yaml, model/backlog/pbis/engineering-readiness/repository-and-pipeline-conventions.yaml, docs/backlog/increments/generate-a-microservice.md, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md.",
      "acceptanceCriteria": [
        "AC1: Given the services the increment page docs/backlog/increments/generate-a-microservice.md lists for the first outcome, when the operator compares them with the repositories of the organisation, then each service has exactly one repository named after it and scaffolded from the template of its kind with the Factory profile switch, and the list with the template version of each repository is recorded (ADR-0028 decision 1).",
        "AC2: Given each repository of that list, when its pipeline runs on the default branch, then it restores from the ConnectSoft feed, builds in Release and passes the tests the template generated, and the identifier of the green run is recorded beside the repository (ADR-0028).",
        "AC3: Given the conformance check of the feature `repository-and-pipeline-conventions`, when it runs over every repository of the list, then it reports no deviation of name, template, pipeline or feed, and a repository with a deviation is recorded by name and blocks the readiness proof instead of being waived (ADR-0028, docs/architecture/adr/0028-one-repository-and-deployable-per-service.md).",
        "AC4: Given the repository list, when each row is compared with the task that created it, then every first-outcome repository was created in I0 by a task of feature `repository-and-pipeline-conventions`, AIFACTORY-TASK-190, AIFACTORY-TASK-1514, AIFACTORY-TASK-146 or a task of AIFACTORY-US-1596 to AIFACTORY-US-1601, and none is left to an I1 feature (ADR-0028 decision 1, D140, model/backlog/pbis/engineering-readiness/repository-and-pipeline-conventions.yaml)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/backlog/pbis/engineering-readiness/repository-and-pipeline-conventions.yaml",
        "docs/backlog/increments/generate-a-microservice.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5381",
        "AIFACTORY-TASK-5382",
        "AIFACTORY-TASK-5383"
      ],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5001,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:repository-and-pipeline-conventions",
        "feature:durable-execution-spike"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/backlog/pbis/engineering-readiness/repository-and-pipeline-conventions.yaml",
        "docs/backlog/increments/generate-a-microservice.md",
        "docs/architecture/adr/0028-one-repository-and-deployable-per-service.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1336]",
      "number": 1336
    },
    {
      "id": "AIFACTORY-TASK-5381",
      "type": "task",
      "parent": "AIFACTORY-US-1336",
      "title": "Repository list of the first outcome with template versions",
      "sequence": "20.01.01.01",
      "description": "Repository list of the first outcome with template versions. Expected output: A recorded list of every first-outcome repository with the service it holds, the template of its kind, the template version, the Factory profile switch it was scaffolded with and the I0 task of feature `repository-and-pipeline-conventions` that created it (AIFACTORY-TASK-190, AIFACTORY-TASK-1514, AIFACTORY-TASK-146 or a task of AIFACTORY-US-1596 to AIFACTORY-US-1601, D140), taken from docs/backlog/increments/generate-a-microservice.md and checked against the repositories of the organisation.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model check.",
      "acceptanceCriteria": [
        "A recorded list of every first-outcome repository with the service it holds, the template of its kind, the template version, the Factory profile switch it was scaffolded with and the I0 task of feature `repository-and-pipeline-conventions` that created it (AIFACTORY-TASK-190, AIFACTORY-TASK-1514, AIFACTORY-TASK-146 or a task of AIFACTORY-US-1596 to AIFACTORY-US-1601, D140), taken from docs/backlog/increments/generate-a-microservice.md and checked against the repositories of the organisation."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5001,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-5381]",
      "number": 5381
    },
    {
      "id": "AIFACTORY-TASK-5382",
      "type": "task",
      "parent": "AIFACTORY-US-1336",
      "title": "Green pipeline run and conformance result per first-outcome repository",
      "sequence": "20.01.01.02",
      "description": "Green pipeline run and conformance result per first-outcome repository. Expected output: For every repository of the list one green pipeline run on the default branch that restores from the ConnectSoft feed, builds in Release and runs the template tests, and one run of the conformance check of the feature `repository-and-pipeline-conventions` with no deviation; each run identifier is recorded beside its repository.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "For every repository of the list one green pipeline run on the default branch that restores from the ConnectSoft feed, builds in Release and runs the template tests, and one run of the conformance check of the feature `repository-and-pipeline-conventions` with no deviation; each run identifier is recorded beside its repository."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5001,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5382]",
      "number": 5382
    },
    {
      "id": "AIFACTORY-TASK-5383",
      "type": "task",
      "parent": "AIFACTORY-US-1336",
      "title": "Verify the repository proof against its criteria",
      "sequence": "20.01.01.03",
      "description": "Verify the repository proof against its criteria. Expected output: The recorded list, the run identifiers and the conformance results are compared with AC1 to AC4 of AIFACTORY-US-1336: every service of docs/backlog/increments/generate-a-microservice.md has a repository created by an I0 task of feature `repository-and-pipeline-conventions`, a green run and no deviation, and `python -I tools/docs_model check` passes on the evidence page.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded list, the run identifiers and the conformance results are compared with AC1 to AC4 of AIFACTORY-US-1336: every service of docs/backlog/increments/generate-a-microservice.md has a repository created by an I0 task of feature `repository-and-pipeline-conventions`, a green run and no deviation, and `python -I tools/docs_model check` passes on the evidence page."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5001,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5383]",
      "number": 5383
    },
    {
      "id": "AIFACTORY-US-1337",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-138",
      "title": "Readiness proof: a token of the Identity Platform carries tenant and project scope through the control plane gateway to a service, and a call without scope is refused",
      "sequence": "20.01.02",
      "description": "As an operator, I want a recorded call chain in which a scoped call reaches a service with the scope its token grants and every unscoped call is refused, so that no Factory service of the first outcome is built on a scope a caller merely claims. This PBI proves the second demonstration of increment I0: a request with a token of the Identity Platform reaches a service with tenant and project scope, and a request without scope is refused. A member of a project signs in with the command-line client against the Factory instance of the Identity Platform, by the authorization code flow with PKCE, and calls the control plane gateway in the acceptance environment. The gateway establishes tenant and project once from the validated token and forwards them together with the unchanged user token to the probe service it fronts, which reads them from the scope accessor of the pinned Factory abstractions package (ADR-0015 decision 2, descriptor `execution-scope-v1`). The refusals are those ADR-0015 and its amendments decide: a call without a token or with the token of another audience is answered 401 by the gateway, a token without the scope or project the operation names is answered 403, and a resource of another tenant is answered 404, never 403, so the answer does not confirm that the resource exists. That last refusal has two cases: a route that addresses another tenant by its tenant identifier is answered 404 by the gateway, NOT_FOUND over gRPC, and nothing is forwarded; a resource identifier of another tenant is forwarded under the tenant of the caller and answered 404 by the tenant row filter of the probe service. A typed tenant or project header changes nothing. The proof records the trace identifier of each call, the answer and what the probe service logged; it relies on the refusal matrix of the feature `trusted-scope-chain` and does not restate it. Kind: evidence. Traces: descriptors: execution-scope-v1; adrs: ADR-0015; requirements: FR-01. Depends on: feature:trusted-scope-chain, feature:command-line-client, feature:local-development-environment. Sources: model/backlog/increments.yaml, docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md.",
      "acceptanceCriteria": [
        "AC1: Given a member signed in with the command-line client against the Factory instance of the Identity Platform, when the member calls the control plane gateway for a project the token grants, then the probe service reads from the scope accessor the tenant of the token and the project of the route, both equal what the token grants, and the trace identifier of the call is recorded (ADR-0015 decision 2, FR-01, descriptor `execution-scope-v1`).",
        "AC2: Given the same gateway, when a call arrives without a token, with the token of another audience or for a project the token does not grant, then the gateway answers 401 or 403, the probe service records no call, and each refusal is recorded with its trace identifier (ADR-0015 decision 3, FR-01).",
        "AC3: Given two tenants with one resource each in the probe service, when a member of the first tenant addresses the second tenant by its tenant identifier in a route, then the gateway answers 404, NOT_FOUND over gRPC, and the probe service records no call; and when the member requests the resource identifier of the second tenant, then the call is forwarded under the tenant of the caller and the probe service answers 404 with the body of an unknown identifier, never 403, and a typed tenant or project header changes nothing (ADR-0015 amendment on a resource of another tenant; docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5384",
        "AIFACTORY-TASK-5385",
        "AIFACTORY-TASK-5386"
      ],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5002,
      "kind": "evidence",
      "traces": {
        "descriptors": [
          "execution-scope-v1"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-01"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:trusted-scope-chain",
        "feature:command-line-client",
        "feature:local-development-environment"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0015-factory-tenancy-under-canonical-adr-0100.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1337]",
      "number": 1337
    },
    {
      "id": "AIFACTORY-TASK-5384",
      "type": "task",
      "parent": "AIFACTORY-US-1337",
      "title": "Scoped and unscoped calls through the running gateway in the acceptance environment",
      "sequence": "20.01.02.01",
      "description": "Scoped and unscoped calls through the running gateway in the acceptance environment. Expected output: A replayable sequence of calls in the acceptance environment: a sign-in of a project member with the command-line client, a scoped call through the control plane gateway, a call without a token, a call with the token of another audience, a call for an ungranted project, a route that addresses another tenant by its tenant identifier (answered 404 by the gateway, NOT_FOUND over gRPC, with no call on the probe service) and a call for the resource identifier of another tenant, each with its trace identifier, answer and the log line of the probe service.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A replayable sequence of calls in the acceptance environment: a sign-in of a project member with the command-line client, a scoped call through the control plane gateway, a call without a token, a call with the token of another audience, a call for an ungranted project, a route that addresses another tenant by its tenant identifier (answered 404 by the gateway, NOT_FOUND over gRPC, with no call on the probe service) and a call for the resource identifier of another tenant, each with its trace identifier, answer and the log line of the probe service."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5002,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5384]",
      "number": 5384
    },
    {
      "id": "AIFACTORY-TASK-5385",
      "type": "task",
      "parent": "AIFACTORY-US-1337",
      "title": "Two-tenant fixture of the scope demonstration",
      "sequence": "20.01.02.02",
      "description": "Two-tenant fixture of the scope demonstration. Expected output: Two tenants of the Factory instance of the Identity Platform, one member each with a role in one project, and one resource per tenant in the probe service, created from documented steps so that the scope demonstration can be replayed on a fresh acceptance environment.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Two tenants of the Factory instance of the Identity Platform, one member each with a role in one project, and one resource per tenant in the probe service, created from documented steps so that the scope demonstration can be replayed on a fresh acceptance environment."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5002,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5385]",
      "number": 5385
    },
    {
      "id": "AIFACTORY-TASK-5386",
      "type": "task",
      "parent": "AIFACTORY-US-1337",
      "title": "Verify the scope proof against its criteria",
      "sequence": "20.01.02.03",
      "description": "Verify the scope proof against its criteria. Expected output: The recorded answers and probe-service logs are compared with AC1 to AC3 of AIFACTORY-US-1337: the scoped call carries the granted scope, the 401 and 403 refusals leave no call on the probe service, a route naming another tenant is answered 404 by the gateway with no call on the probe service, and the resource identifier of another tenant is answered 404 under the tenant of the caller (ADR-0015, FR-01).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded answers and probe-service logs are compared with AC1 to AC3 of AIFACTORY-US-1337: the scoped call carries the granted scope, the 401 and 403 refusals leave no call on the probe service, a route naming another tenant is answered 404 by the gateway with no call on the probe service, and the resource identifier of another tenant is answered 404 under the tenant of the caller (ADR-0015, FR-01)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5002,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5386]",
      "number": 5386
    },
    {
      "id": "AIFACTORY-US-1338",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-138",
      "title": "Readiness proof: the contracts package is on the ConnectSoft feed and two services build against the same version and exchange one run event envelope",
      "sequence": "20.01.03",
      "description": "As an operator, I want a recorded proof that two services pin the same published version of the contracts package and read each other's envelope, so that no Factory service of the first outcome copies a contract. This PBI proves the third demonstration of increment I0: the contracts package is published and consumed by two services. The feature `contracts-package` publishes the package to the ConnectSoft feed and records its version on docs/reference/schemas/index.md, and its probe consumer restores it from the feed alone; the feature leaves the demonstration with two consuming services to this proof. The two services are the probe service behind the control plane gateway and the second service of the scope chain of the feature `trusted-scope-chain`, whose handler reads the scope from the envelope. The operator records the version each service pins, the restore of each from the ConnectSoft feed with no project reference, and one event that the first service writes in the run event envelope `run-event-envelope-v1` of the package and the second handles with the same tenant and project. A service that pins another version, restores the package from a local source or defines a contract type of its own fails the proof and is recorded by name. The proof adds no type to the package and changes neither service. Kind: evidence. Traces: descriptors: run-event-envelope-v1; adrs: ADR-0014, ADR-0028. Depends on: feature:contracts-package, feature:trusted-scope-chain. Sources: model/backlog/increments.yaml, docs/reference/schemas/index.md, docs/architecture/adr/0014-run-and-lifecycle-envelopes.md.",
      "acceptanceCriteria": [
        "AC1: Given the version of the contracts package recorded on docs/reference/schemas/index.md, when the pins of the probe service and of the handler service are read, then both pin that version, both restore it from the ConnectSoft feed with no project reference, and neither defines a contract type the package holds (ADR-0028, ADR-0014).",
        "AC2: Given a scoped call that reaches the probe service, when it publishes an event in the run event envelope `run-event-envelope-v1` of the package, then the handler service reads the same tenant and project from the envelope through its scope accessor, and the event identifier and both build run identifiers are recorded (ADR-0014 decision 1).",
        "AC3: Given a planted pin of another version in one of the two services, when the proof is replayed, then the comparison fails and names the service and the version, which shows that the proof would catch a drift (ADR-0028)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "docs/reference/schemas/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5387",
        "AIFACTORY-TASK-5388"
      ],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5003,
      "kind": "evidence",
      "traces": {
        "descriptors": [
          "run-event-envelope-v1"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0028"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:contracts-package",
        "feature:trusted-scope-chain"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "docs/reference/schemas/index.md",
        "docs/architecture/adr/0014-run-and-lifecycle-envelopes.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1338]",
      "number": 1338
    },
    {
      "id": "AIFACTORY-TASK-5387",
      "type": "task",
      "parent": "AIFACTORY-US-1338",
      "title": "Pins, restores and one exchanged envelope of the two consuming services",
      "sequence": "20.01.03.01",
      "description": "Pins, restores and one exchanged envelope of the two consuming services. Expected output: The recorded pins of the contracts package in the probe service and the handler service, the build run of each that restored it from the ConnectSoft feed alone, and one event written by the probe service in `run-event-envelope-v1` and handled by the handler service with the same tenant and project, each with its identifier.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded pins of the contracts package in the probe service and the handler service, the build run of each that restored it from the ConnectSoft feed alone, and one event written by the probe service in `run-event-envelope-v1` and handled by the handler service with the same tenant and project, each with its identifier."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5003,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5387]",
      "number": 5387
    },
    {
      "id": "AIFACTORY-TASK-5388",
      "type": "task",
      "parent": "AIFACTORY-US-1338",
      "title": "Verify the consumer proof against its criteria",
      "sequence": "20.01.03.02",
      "description": "Verify the consumer proof against its criteria. Expected output: The recorded pins, restores and envelope are compared with AC1 to AC3 of AIFACTORY-US-1338 and with the version on docs/reference/schemas/index.md; a replay with a planted pin of another version fails and names the service.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded pins, restores and envelope are compared with AC1 to AC3 of AIFACTORY-US-1338 and with the version on docs/reference/schemas/index.md; a replay with a planted pin of another version fails and names the service."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5003,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5388]",
      "number": 5388
    },
    {
      "id": "AIFACTORY-US-004",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-138",
      "title": "Readiness is demonstrated with evidence",
      "sequence": "20.01.04",
      "description": "As an operator, I want to see the three readiness demonstrations pass and their evidence recorded, so that the first outcome starts from a foundation that is known to work. This is the integration PBI of the feature and the closing proof of increment I0. Increment I0 is finished when this proof passes, not when its features are accepted one by one: every repository of the first outcome scaffolds from its template and builds, and one call chain carries a trusted tenant and project scope from the edge to a service, as model/backlog/increments.yaml states the outcome. An operator replays the three demonstrations of AIFACTORY-US-1336, AIFACTORY-US-1337 and AIFACTORY-US-1338 in one recorded acceptance run on the acceptance environment, so that the evidence of each comes from the same estate, and records an evidence pack: the repository list with its pipeline run identifiers, every repository of it created in I0 by feature `repository-and-pipeline-conventions`, the thirty of the I1 features by AIFACTORY-US-1596 to AIFACTORY-US-1601 (D140), the trace identifiers of the scoped and refused calls, and the package version with the pins of the two consuming services. The pack is the evidence the epic outcome-verification names in its done_when for I0, and the done_when of the epic engineering-readiness, which closes on the readiness demonstration, reads it. A demonstration that fails is recorded with its failing step and the increment stays open; nothing is waived. Kind: evidence. Traces: adrs: ADR-0014, ADR-0015, ADR-0028, ADR-0029. Depends on: AIFACTORY-US-1336, AIFACTORY-US-1337, AIFACTORY-US-1338. Sources: model/backlog/increments.yaml, model/backlog/epics.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the first-outcome repositories, all created in I0 by feature `repository-and-pipeline-conventions` (D140), when each pipeline runs in the recorded acceptance run, then every one is green and the list with its run identifiers and the I0 task that created each repository is in the evidence pack, as AIFACTORY-US-1336 proves it (ADR-0028).",
        "AC2: Given a token of the Identity Platform, when a scoped call and an unscoped call are made in the same run, then the first reaches the service with the granted scope, the second is refused, and both trace identifiers are in the evidence pack, as AIFACTORY-US-1337 proves it (ADR-0015).",
        "AC3: Given the contracts package, when the two consuming services are built in the same run, then both build against the same published version and exchange one run event envelope, and the version and pins are in the evidence pack, as AIFACTORY-US-1338 proves it (ADR-0014).",
        "AC4: Given the evidence pack, when it is reviewed against the outcome of I0 in model/backlog/increments.yaml and the done_when of the epics outcome-verification and engineering-readiness in model/backlog/epics.yaml, then every demonstration has its evidence and a failed one is recorded with its failing step instead of being waived (ADR-0029)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-193",
        "AIFACTORY-TASK-184",
        "AIFACTORY-TASK-777"
      ],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5004,
      "kind": "evidence",
      "traces": {
        "adrs": [
          "ADR-0014",
          "ADR-0015",
          "ADR-0028",
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1336",
        "AIFACTORY-US-1337",
        "AIFACTORY-US-1338"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-004]",
      "number": 4
    },
    {
      "id": "AIFACTORY-TASK-193",
      "type": "task",
      "parent": "AIFACTORY-US-004",
      "title": "Run the three demonstrations and record the evidence",
      "sequence": "20.01.04.01",
      "description": "Run the three demonstrations and record the evidence. Expected output: An evidence page with pipeline run identifiers, trace identifiers and package versions from one recorded acceptance run of the three demonstrations of AIFACTORY-US-1336, AIFACTORY-US-1337 and AIFACTORY-US-1338.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "An evidence page with pipeline run identifiers, trace identifiers and package versions from one recorded acceptance run of the three demonstrations of AIFACTORY-US-1336, AIFACTORY-US-1337 and AIFACTORY-US-1338."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5004,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-193]",
      "number": 193
    },
    {
      "id": "AIFACTORY-TASK-184",
      "type": "task",
      "parent": "AIFACTORY-US-004",
      "title": "Evidence pack for increment I0",
      "sequence": "20.01.04.02",
      "description": "Evidence pack for increment I0. Expected output: A recorded run of every demonstration below with its run identifiers, artifacts and logs: Each first-outcome repository exists, builds and runs its template tests in its pipeline. A request with a token of the Identity Platform reaches a service with tenant and project scope, and a request without scope is refused. The contracts package is published and consumed by two services.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A recorded run of every demonstration below with its run identifiers, artifacts and logs: Each first-outcome repository exists, builds and runs its template tests in its pipeline. A request with a token of the Identity Platform reaches a service with tenant and project scope, and a request without scope is refused. The contracts package is published and consumed by two services."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5004,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-184]",
      "number": 184
    },
    {
      "id": "AIFACTORY-TASK-777",
      "type": "task",
      "parent": "AIFACTORY-US-004",
      "title": "Verify readiness-demonstrated against the recorded acceptance run",
      "sequence": "20.01.04.03",
      "description": "Verify readiness-demonstrated against the recorded acceptance run. Expected output: The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-004 and with the outcome of I0 in model/backlog/increments.yaml; every demonstration has its run identifiers, and `python -I tools/docs_model validate` passes with the evidence page in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-004 and with the outcome of I0 in model/backlog/increments.yaml; every demonstration has its run identifiers, and `python -I tools/docs_model validate` passes with the evidence page in place."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i0-readiness",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 50,
      "phase": "factory",
      "stackRank": 5004,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-777]",
      "number": 777
    },
    {
      "id": "AIFACTORY-FEAT-139",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I1: Generate a microservice",
      "sequence": "20.02",
      "description": "The outcome of increment I1 is demonstrated end to end and the evidence is recorded: A vision submitted through the API or the command-line client ends as an approved change proposal that contains a generated, built and tested microservice (decision D65); the run is audited from its first command and stops at its budget cap (decision D80). Demonstrations: A person submits a vision; the chain of six workflows runs without a manual start between them. A person approves the recipe and, later, the exact change set. The change proposal is open in the system of record with provenance and validation results. Every command, decision, approval and tool effect of the run is in the audit trail and the hash chain verifies. A run with a budget below its need stops at the cap, and the usage of a finished run reconciles with its receipts. Increment I1: Generate a microservice. Build order 91 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1339",
        "AIFACTORY-US-1340",
        "AIFACTORY-US-1341",
        "AIFACTORY-US-018"
      ],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9100,
      "titlePrefix": "[AIFACTORY-FEAT-139]",
      "number": 139
    },
    {
      "id": "AIFACTORY-US-1339",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-139",
      "title": "First-outcome proof: the decided blockers are aligned before the run, and a replayable demonstration script and fixture vision brief exist",
      "sequence": "20.02.01",
      "description": "As a requester, I want the first-outcome demonstration to start only when every decided blocker of the chain is aligned, from a script and a brief anyone can replay, so that a failed demonstration names a defect of the Factory and never a gap the owner already decided to close. The first outcome rests on four links that the owner decided and the model now carries, so this PBI names them as preconditions of the proof and checks before the run that each is still in place. First, the change set reaches the system of record through the tool step `propose-change-set` of `generate-product`, which needs a short-lived credential issued by SecretBrokerService through `SecretBroker.Issue` after a decision of PolicyEngineService through `Policy.Decide`; the request `policy-decision-request-v1` carries the action kind credential-issuance with its platform rule (D127). Second, the repository connection of the project is used under a grant of IntegrationService, set through `SetGrant`, under the action kind connection-grant and its platform rule (D129). Third, the step `record-outputs` of `generate-product`, of the class shared-write, records every generated output through the tool `record-generated-output` that calls `Recipes.RecordOutput` of GenerationRecipeService (D133, model/tools/record-generated-output.yaml). Fourth, AuditService consumes `RunAccepted` of RunControlService and appends it through `RecordEvidence` as the evidence of the submission, so the first command of the run is audited (D126, D135, model/services/governance/AuditService.yaml). The proof does not borrow another action kind and does not record outputs or submissions by another path: a precondition found missing from the model at the check is recorded as the blocker and the run is not started. In the same PBI the demonstration is made replayable: a written script of the command-line client commands and a fixture vision brief for a small product with one backend microservice. Because the change set reaches Azure DevOps through the repository connection, and D129 moved the integration gateway to I1, the script starts with a Workspace admin of the fixture project who registers, verifies and grants that connection through IntegrationHost; a grant attempted by a member without that role is refused. The register holds a second kind of precondition, the inputs of the owner (D140): every value an I1 service refuses to start without, or without which it discovers nothing, is an entry that the owner supplies before the I1 run and that is checked before the run, namely the values of `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod` and `Usage:Budgets:PlatformLimitUsd`, the section `Usage:Estimates` and the pricing revisions of the meters of CostUsageService, the values of the Sandbox pool of ExecutionCapacityService (its security boundary, its internet egress, its region, its size and the medium of the run workspace), the template-feed project of the platform tenant that TemplateRegistryService discovers under, and the source of the tenant region that ProjectService reads. Each entry names the service, the key or the value it needs and the PBI that states it as an input of the owner, and records whether the deployment of the acceptance environment carries a value; the register never states the value itself. An entry without a value at the check is recorded as the blocker and the run is not started. Kind: enabling. Traces: services: PolicyEngineService, SecretBrokerService, IntegrationService, IntegrationHost, GenerationRecipeService, AuditService, CostUsageService, ExecutionCapacityService, TemplateRegistryService, ProjectService; workflows: generate-product; steps: generate-product/record-outputs, generate-product/propose-change-set; tools: propose-change-set, record-generated-output; apis: IntegrationService/RegisterConnection, IntegrationService/VerifyConnection, IntegrationService/SetGrant; descriptors: policy-decision-request-v1, policy-decision-v1; adrs: ADR-0027. Depends on: feature:policy-engine-service, feature:secret-broker-service, feature:integration-service-thin, feature:integration-host, feature:governance-host, feature:audit-service-complete, feature:generation-recipe-service, feature:wf-generate-product, feature:command-line-client-commands, feature:cost-usage-service-complete, feature:execution-capacity-service-thin, feature:template-registry-service, feature:project-service. Sources: model/backlog/increments.yaml, model/workflows/generate-product.yaml, model/services/governance/AuditService.yaml, model/services/integration/IntegrationService.yaml, model/services/control-plane/CostUsageService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/template-library/TemplateRegistryService.yaml, model/services/control-plane/ProjectService.yaml, model/tools/record-generated-output.yaml, docs/reference/schemas/policy-decision.schema.json, docs/reference/schemas/policy-decision-request.schema.json, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given docs/reference/schemas/policy-decision-request.schema.json and the platform rules of PolicyEngineService, when the preconditions are checked before the run, then the action kinds credential-issuance of SecretBrokerService (D127) and connection-grant of IntegrationService (D129) are present with their platform rules, and one found missing is recorded as the blocker and the run is not started; no other action kind is borrowed (descriptors `policy-decision-request-v1`, `policy-decision-v1`).",
        "AC2: Given model/workflows/generate-product.yaml and model/services/governance/AuditService.yaml, when the preconditions are checked, then the step `record-outputs`, of the class shared-write, records the generated outputs through the tool `record-generated-output` that calls `Recipes.RecordOutput` of GenerationRecipeService (D133), and AuditService records the submission of a run from `RunAccepted` through `RecordEvidence` (D126, D135); one found missing from the model at the check stops the run and is recorded as the blocker (model/tools/record-generated-output.yaml).",
        "AC3: Given the written demonstration script and the fixture vision brief, when a person who did not write them replays them on the acceptance environment with the command-line client, then a Workspace admin of the fixture project registers, verifies and grants the repository connection through IntegrationHost, the run is submitted for that project without any other instruction, and the six workflows of model/backlog/increments.yaml for I1 are the ones it exercises (IntegrationService/RegisterConnection, IntegrationService/VerifyConnection, IntegrationService/SetGrant, ADR-0027).",
        "AC4: Given the registered connection of the fixture project, when a member of the project without the role Workspace admin attempts the grant through IntegrationHost, then the grant is answered 403, no grant is recorded and the refusal is in the evidence (IntegrationService/SetGrant, D129).",
        "AC5: Given the inputs of the owner that D140 enters in the register, `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod`, `Usage:Budgets:PlatformLimitUsd`, the section `Usage:Estimates` and the pricing revisions of CostUsageService, the Sandbox pool values of ExecutionCapacityService (boundary, egress, region, size, workspace medium), the template-feed project of the platform tenant of TemplateRegistryService and the source of the tenant region of ProjectService, when the preconditions are checked before the run, then each entry names its service, its key and the PBI that states it, the deployment of the acceptance environment carries a value for each, no value is written into the register, and an entry without a value is recorded as the blocker and the run is not started (model/services/control-plane/CostUsageService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/template-library/TemplateRegistryService.yaml, model/services/control-plane/ProjectService.yaml)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/workflows/generate-product.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/tools/record-generated-output.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:enabling"
      ],
      "children": [
        "AIFACTORY-TASK-229",
        "AIFACTORY-TASK-5389",
        "AIFACTORY-TASK-5390",
        "AIFACTORY-TASK-5391"
      ],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9101,
      "kind": "enabling",
      "traces": {
        "services": [
          "PolicyEngineService",
          "SecretBrokerService",
          "IntegrationService",
          "IntegrationHost",
          "GenerationRecipeService",
          "AuditService",
          "CostUsageService",
          "ExecutionCapacityService",
          "TemplateRegistryService",
          "ProjectService"
        ],
        "workflows": [
          "generate-product"
        ],
        "steps": [
          "generate-product/record-outputs",
          "generate-product/propose-change-set"
        ],
        "tools": [
          "propose-change-set",
          "record-generated-output"
        ],
        "apis": [
          "IntegrationService/RegisterConnection",
          "IntegrationService/VerifyConnection",
          "IntegrationService/SetGrant"
        ],
        "descriptors": [
          "policy-decision-request-v1",
          "policy-decision-v1"
        ],
        "adrs": [
          "ADR-0027"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:policy-engine-service",
        "feature:secret-broker-service",
        "feature:integration-service-thin",
        "feature:integration-host",
        "feature:governance-host",
        "feature:audit-service-complete",
        "feature:generation-recipe-service",
        "feature:wf-generate-product",
        "feature:command-line-client-commands",
        "feature:cost-usage-service-complete",
        "feature:execution-capacity-service-thin",
        "feature:template-registry-service",
        "feature:project-service"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/workflows/generate-product.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/integration/IntegrationService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/runtime-cloud/ExecutionCapacityService.yaml",
        "model/services/template-library/TemplateRegistryService.yaml",
        "model/services/control-plane/ProjectService.yaml",
        "model/tools/record-generated-output.yaml",
        "docs/reference/schemas/policy-decision.schema.json",
        "docs/reference/schemas/policy-decision-request.schema.json",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1339]",
      "number": 1339
    },
    {
      "id": "AIFACTORY-TASK-229",
      "type": "task",
      "parent": "AIFACTORY-US-1339",
      "title": "Demonstration script and fixture vision brief",
      "sequence": "20.02.01.01",
      "description": "Demonstration script and fixture vision brief. Expected output: A written script and a fixture vision brief for a small product with one backend microservice that anyone can replay in the acceptance environment; the script names each command of the command-line client, the person who runs it and the answer it expects, starting with the registration, verification and grant of the repository connection of the fixture project by a Workspace admin and the refused grant of a member without that role.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A written script and a fixture vision brief for a small product with one backend microservice that anyone can replay in the acceptance environment; the script names each command of the command-line client, the person who runs it and the answer it expects, starting with the registration, verification and grant of the repository connection of the fixture project by a Workspace admin and the refused grant of a member without that role."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9101,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-229]",
      "number": 229
    },
    {
      "id": "AIFACTORY-TASK-5389",
      "type": "task",
      "parent": "AIFACTORY-US-1339",
      "title": "Command sequence of the command-line client for the first-outcome demonstration",
      "sequence": "20.02.01.02",
      "description": "Command sequence of the command-line client for the first-outcome demonstration. Expected output: A replayable command sequence in the command-line client repository that signs in, creates the project, registers, verifies and grants the repository connection of the project through IntegrationHost as a Workspace admin, attempts the same grant as a member without that role and expects 403, submits the fixture vision brief, follows the run, approves the recipe and approves the change proposal, each step printing the identifier or the answer it produced.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Cli.",
      "acceptanceCriteria": [
        "A replayable command sequence in the command-line client repository that signs in, creates the project, registers, verifies and grants the repository connection of the project through IntegrationHost as a Workspace admin, attempts the same grant as a member without that role and expects 403, submits the fixture vision brief, follows the run, approves the recipe and approves the change proposal, each step printing the identifier or the answer it produced."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Cli"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9101,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5389]",
      "number": 5389
    },
    {
      "id": "AIFACTORY-TASK-5390",
      "type": "task",
      "parent": "AIFACTORY-US-1339",
      "title": "Precondition register of the first-outcome proof",
      "sequence": "20.02.01.03",
      "description": "Precondition register of the first-outcome proof. Expected output: A precondition register on the evidence page that lists the four decided links with the decision that settles each (D127 for the action kind credential-issuance, D129 for the action kind connection-grant, D133 for the tool `record-generated-output`, D126 and D135 for the audit of `RunAccepted`), the model file that holds it (docs/reference/schemas/policy-decision-request.schema.json, model/tools/record-generated-output.yaml, model/workflows/generate-product.yaml, model/services/governance/AuditService.yaml) and its state at the check, aligned or blocking; and, as its second part, one entry per input of the owner that D140 enters: `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod`, `Usage:Budgets:PlatformLimitUsd`, the section `Usage:Estimates` and the pricing revisions of the meters of CostUsageService, the Sandbox pool boundary, egress, region, size and workspace medium of ExecutionCapacityService, the template-feed project of the platform tenant of TemplateRegistryService and the source of the tenant region of ProjectService, each with its service, its key, the PBI that states it as an input of the owner and its state at the check, supplied or blocking, and none with its value.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A precondition register on the evidence page that lists the four decided links with the decision that settles each (D127 for the action kind credential-issuance, D129 for the action kind connection-grant, D133 for the tool `record-generated-output`, D126 and D135 for the audit of `RunAccepted`), the model file that holds it (docs/reference/schemas/policy-decision-request.schema.json, model/tools/record-generated-output.yaml, model/workflows/generate-product.yaml, model/services/governance/AuditService.yaml) and its state at the check, aligned or blocking; and, as its second part, one entry per input of the owner that D140 enters: `Usage:Budgets:DefaultLimitUsd`, `Usage:Budgets:DefaultPeriod`, `Usage:Budgets:PlatformLimitUsd`, the section `Usage:Estimates` and the pricing revisions of the meters of CostUsageService, the Sandbox pool boundary, egress, region, size and workspace medium of ExecutionCapacityService, the template-feed project of the platform tenant of TemplateRegistryService and the source of the tenant region of ProjectService, each with its service, its key, the PBI that states it as an input of the owner and its state at the check, supplied or blocking, and none with its value."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9101,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-5390]",
      "number": 5390
    },
    {
      "id": "AIFACTORY-TASK-5391",
      "type": "task",
      "parent": "AIFACTORY-US-1339",
      "title": "Verify the preconditions and the replay of the script",
      "sequence": "20.02.01.04",
      "description": "Verify the preconditions and the replay of the script. Expected output: The register is compared with docs/reference/schemas/policy-decision-request.schema.json, model/tools/record-generated-output.yaml, model/workflows/generate-product.yaml and model/services/governance/AuditService.yaml and proves AC1 and AC2 of AIFACTORY-US-1339; a replay of the script by a second person on a fresh acceptance environment grants the connection, records the refused grant (IntegrationService/SetGrant) and submits the run, which proves AC3 and AC4; the owner-input entries of the register are compared with model/services/control-plane/CostUsageService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/template-library/TemplateRegistryService.yaml and model/services/control-plane/ProjectService.yaml and with the configuration of the acceptance environment, every entry is supplied and none carries its value, which proves AC5; `python -I tools/docs_model validate` passes.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The register is compared with docs/reference/schemas/policy-decision-request.schema.json, model/tools/record-generated-output.yaml, model/workflows/generate-product.yaml and model/services/governance/AuditService.yaml and proves AC1 and AC2 of AIFACTORY-US-1339; a replay of the script by a second person on a fresh acceptance environment grants the connection, records the refused grant (IntegrationService/SetGrant) and submits the run, which proves AC3 and AC4; the owner-input entries of the register are compared with model/services/control-plane/CostUsageService.yaml, model/services/runtime-cloud/ExecutionCapacityService.yaml, model/services/template-library/TemplateRegistryService.yaml and model/services/control-plane/ProjectService.yaml and with the configuration of the acceptance environment, every entry is supplied and none carries its value, which proves AC5; `python -I tools/docs_model validate` passes."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9101,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5391]",
      "number": 5391
    },
    {
      "id": "AIFACTORY-US-1340",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-139",
      "title": "First-outcome proof: one submitted vision runs the six workflows without a manual start and ends as an approved, open change proposal whose service builds outside the Factory",
      "sequence": "20.02.02",
      "description": "As a requester, I want one vision submitted from the command-line client to end as an open change proposal for a generated, built and tested microservice, so that the Factory has proven its first outcome on a real product idea. This PBI proves the first three demonstrations of increment I1 (decision D65). A requester submits the fixture vision brief from the command-line client; the call passes the control plane gateway with the user token and reaches `SubmitRun` of RunControlService. That submission is the run of `vision-to-blueprint`, the only workflow of the chain a person submits. From there no workflow is started by hand: each of `architecture-decomposition`, `module-blueprints`, `application-design`, `database-blueprint` and `generate-product` is then submitted by WorkflowEngineService when its readiness bundle is satisfied, which `ReadinessRunSubmitted` records. Two people decide. An asset maintainer approves the validated recipe through `ApproveRecipe` of GenerationRecipeService, which publishes `RecipeApproved` and is the single gate of the generation run (ADR-0027 decision 2). Later a reviewer, never the requester of the run, approves the exact change set at the step `approve-proposal` through `DecideApproval`, bound to the hash of the proposal (FR-06, ADR-0015). The generation run records each output with its provenance, which `GeneratedOutputRecorded` carries, and the tool of the step `propose-change-set` opens the pull request in the system of record through the connection and records it through `Pipelines.RecordProposal` of PipelineExecutionService with the run, the attempt, the agent release, the pull-request reference and the tool receipt (D135), which `ChangeProposalOpened` records, with the provenance and the validation results attached. The proof ends outside the Factory: the branch of the proposal is cloned and built by a person, and the service builds and its tests pass. Kind: evidence. Traces: services: ControlPlaneApi, RunControlService, WorkflowEngineService, GenerationRecipeService, PipelineExecutionService; workflows: vision-to-blueprint, architecture-decomposition, module-blueprints, application-design, database-blueprint, generate-product; steps: generate-product/approve-proposal, generate-product/propose-change-set; apis: RunControlService/SubmitRun, RunControlService/DecideApproval, GenerationRecipeService/ApproveRecipe, PipelineExecutionService/Pipelines.RecordProposal; events: WorkflowEngineService/ReadinessRunSubmitted, GenerationRecipeService/RecipeApproved, GenerationRecipeService/GeneratedOutputRecorded, RunControlService/ApprovalDecided, PipelineExecutionService/ChangeProposalOpened; adrs: ADR-0015, ADR-0027; descriptors: change-proposal-record-v1; requirements: FR-06. Depends on: AIFACTORY-US-1339, feature:command-line-client-commands, feature:control-plane-api, feature:run-control-service, feature:workflow-engine-service, feature:generation-recipe-service, feature:pipeline-execution-service-thin, feature:wf-vision-to-blueprint, feature:wf-architecture-decomposition, feature:wf-module-blueprints, feature:wf-application-design, feature:wf-database-blueprint, feature:wf-generate-product. Sources: model/backlog/increments.yaml, model/workflows/generate-product.yaml, docs/architecture/adr/0027-generation-input-contract.md.",
      "acceptanceCriteria": [
        "AC1: Given a new project and the fixture vision brief, when the requester submits it from the command-line client through `SubmitRun` of RunControlService, then the six workflows run in the order of model/backlog/increments.yaml and each later run is submitted by WorkflowEngineService, as `ReadinessRunSubmitted` records, with no workflow started by hand (RunControlService/SubmitRun, WorkflowEngineService/ReadinessRunSubmitted).",
        "AC2: Given the validated recipe, when the asset maintainer approves it, then `RecipeApproved` names the approved version and the generation run reads its pins from it; and given the change set, when a reviewer who is not the requester approves it at the step `generate-product/approve-proposal`, then the decision is bound to the proposal hash (GenerationRecipeService/RecipeApproved, RunControlService/ApprovalDecided, FR-06, ADR-0027).",
        "AC3: Given the approved change set, when the step `generate-product/propose-change-set` runs, then the change proposal is open in the system of record with the provenance of every generated output and the validation results attached, recorded through `Pipelines.RecordProposal` with the run, the attempt, the agent release, the pull-request reference and the tool receipt, as `GeneratedOutputRecorded` and `ChangeProposalOpened` record them (GenerationRecipeService/GeneratedOutputRecorded, PipelineExecutionService/Pipelines.RecordProposal, PipelineExecutionService/ChangeProposalOpened, D135).",
        "AC4: Given the open proposal, when its branch is cloned and built by a person outside the Factory, then the service builds in Release and its generated tests pass, and the build log is recorded (ADR-0027, docs/architecture/adr/0027-generation-input-contract.md)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-230",
        "AIFACTORY-TASK-5392",
        "AIFACTORY-TASK-5393"
      ],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9102,
      "kind": "evidence",
      "traces": {
        "services": [
          "ControlPlaneApi",
          "RunControlService",
          "WorkflowEngineService",
          "GenerationRecipeService",
          "PipelineExecutionService"
        ],
        "workflows": [
          "vision-to-blueprint",
          "architecture-decomposition",
          "module-blueprints",
          "application-design",
          "database-blueprint",
          "generate-product"
        ],
        "steps": [
          "generate-product/approve-proposal",
          "generate-product/propose-change-set"
        ],
        "apis": [
          "RunControlService/SubmitRun",
          "RunControlService/DecideApproval",
          "GenerationRecipeService/ApproveRecipe",
          "PipelineExecutionService/Pipelines.RecordProposal"
        ],
        "events": [
          "WorkflowEngineService/ReadinessRunSubmitted",
          "GenerationRecipeService/RecipeApproved",
          "GenerationRecipeService/GeneratedOutputRecorded",
          "RunControlService/ApprovalDecided",
          "PipelineExecutionService/ChangeProposalOpened"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0027"
        ],
        "descriptors": [
          "change-proposal-record-v1"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1339",
        "feature:command-line-client-commands",
        "feature:control-plane-api",
        "feature:run-control-service",
        "feature:workflow-engine-service",
        "feature:generation-recipe-service",
        "feature:pipeline-execution-service-thin",
        "feature:wf-vision-to-blueprint",
        "feature:wf-architecture-decomposition",
        "feature:wf-module-blueprints",
        "feature:wf-application-design",
        "feature:wf-database-blueprint",
        "feature:wf-generate-product"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/workflows/generate-product.yaml",
        "docs/architecture/adr/0027-generation-input-contract.md"
      ],
      "titlePrefix": "[AIFACTORY-US-1340]",
      "number": 1340
    },
    {
      "id": "AIFACTORY-TASK-230",
      "type": "task",
      "parent": "AIFACTORY-US-1340",
      "title": "Recorded evidence of one full run",
      "sequence": "20.02.02.01",
      "description": "Recorded evidence of one full run. Expected output: Run identifiers of the six workflow runs, the approved recipe version, the approval decision of the change set with its proposal hash and the reference of the change proposal on the evidence page, all from one replay of the script of AIFACTORY-TASK-229.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Run identifiers of the six workflow runs, the approved recipe version, the approval decision of the change set with its proposal hash and the reference of the change proposal on the evidence page, all from one replay of the script of AIFACTORY-TASK-229."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9102,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-230]",
      "number": 230
    },
    {
      "id": "AIFACTORY-TASK-5392",
      "type": "task",
      "parent": "AIFACTORY-US-1340",
      "title": "Out-of-Factory build of the proposal branch",
      "sequence": "20.02.02.02",
      "description": "Out-of-Factory build of the proposal branch. Expected output: A clone of the branch of the change proposal built in Release and tested by a person on a machine with only the ConnectSoft feed as package source, with the build and test log recorded beside the reference of the proposal.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A clone of the branch of the change proposal built in Release and tested by a person on a machine with only the ConnectSoft feed as package source, with the build and test log recorded beside the reference of the proposal."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9102,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5392]",
      "number": 5392
    },
    {
      "id": "AIFACTORY-TASK-5393",
      "type": "task",
      "parent": "AIFACTORY-US-1340",
      "title": "Verify the chain run against its criteria",
      "sequence": "20.02.02.03",
      "description": "Verify the chain run against its criteria. Expected output: The recorded run identifiers, approvals, proposal and build log are compared with AC1 to AC4 of AIFACTORY-US-1340: six runs with no manual start (WorkflowEngineService/ReadinessRunSubmitted), the recipe approval and the change-set approval by two people bound to the proposal hash (RunControlService/ApprovalDecided), an open proposal (PipelineExecutionService/ChangeProposalOpened) and a green build outside the Factory.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded run identifiers, approvals, proposal and build log are compared with AC1 to AC4 of AIFACTORY-US-1340: six runs with no manual start (WorkflowEngineService/ReadinessRunSubmitted), the recipe approval and the change-set approval by two people bound to the proposal hash (RunControlService/ApprovalDecided), an open proposal (PipelineExecutionService/ChangeProposalOpened) and a green build outside the Factory."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9102,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5393]",
      "number": 5393
    },
    {
      "id": "AIFACTORY-US-1341",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-139",
      "title": "First-outcome proof: every act of the run is in the audit trail with a verified hash chain, a run under budget stops at its cap and usage reconciles with receipts",
      "sequence": "20.02.03",
      "description": "As an observer, I want the run of the first outcome audited from its first command and bounded by its budget, so that the first outcome is accountable and cannot spend beyond what the project allowed. This PBI proves the last two demonstrations of increment I1, which decision D80 makes part of the first outcome by delivering AuditService and CostUsageService complete in I1, and the completeness of the run record. For the run of AIFACTORY-US-1340 an observer exports the audit trail of the project through `ExportAudit` and checks that each family of acts of the run has its entries, each one recorded by `AuditEntryRecorded`: the submission of the run, the policy decisions, the approval requests and decisions, the tool invocations and, for a cancelled run, the cancellation; and that the chain verifies, which `AuditChainVerified` reports with valid true. The submission entry comes from `RunAccepted`, which AuditService appends through `RecordEvidence` (D126, D135), a precondition checked by AIFACTORY-US-1339; a missing submission entry fails the proof and is recorded with the run identifier. The observer then reads the run record: `GetRun` of RunControlService, the model receipts of `ListRunReceipts` of ModelRouterService and the tool receipts of `ListRunToolReceipts` of ToolAdapterService, and checks that every step has an attempt with one outcome, every model call a receipt and every tool call an invocation (ADR-0014). A second run of the same brief is submitted under a project budget set through `SetProjectBudget` whose limit and approval threshold are both above the estimate CostUsageService reserves for the run, so the reservation succeeds and no spend approval opens, while the limit is below the usage the run observes. When the observed usage takes the committed amount above the limit, CostUsageService publishes `BudgetExceeded` for that run only; RunControlService records the cancellation with the reason budget-exceeded and the run ends Cancelled, which `RunCancelled` records, never Failed. The refusal case is a third submission under a budget whose limit is below the estimate: the reservation is denied, which `BudgetReservationDenied` records, and the run ends Failed with the failure class policy-denied, which `RunFailed` records (model/services/control-plane/CostUsageService.yaml). For the finished first run the usage that `GetRunUsage` reports reconciles with its invocation receipts, and the reservation is settled, which `ReservationSettled` records. A missing entry, a broken chain, an incomplete run record or a usage that does not match its receipts fails the proof and is recorded with the run identifier. Kind: evidence. Traces: services: AuditService, CostUsageService, ModelRouterService, ToolAdapterService, RunControlService; apis: AuditService/ExportAudit, CostUsageService/SetProjectBudget, CostUsageService/GetRunUsage, ModelRouterService/ListRunReceipts, ToolAdapterService/ListRunToolReceipts, RunControlService/GetRun; events: AuditService/AuditEntryRecorded, AuditService/AuditChainVerified, CostUsageService/BudgetExceeded, CostUsageService/BudgetReservationDenied, CostUsageService/ReservationSettled, RunControlService/RunAccepted, RunControlService/RunCancelled, RunControlService/RunFailed; adrs: ADR-0014; requirements: FR-09. Depends on: AIFACTORY-US-1339, AIFACTORY-US-1340, feature:audit-service-complete, feature:cost-usage-service-complete, feature:model-router-service, feature:tool-adapter-service, feature:run-control-service. Sources: model/backlog/increments.yaml, model/services/governance/AuditService.yaml, model/services/control-plane/CostUsageService.yaml, model/services/control-plane/RunControlService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the finished run of AIFACTORY-US-1340, when the observer exports the audit trail of its project, then the submission of the run, every policy decision, every approval request and decision, every tool invocation and, for the capped run, the cancellation have an entry, and the chain verification reports valid for the head sequence of the tenant; the submission entry is the one appended from `RunAccepted` (D126, D135), and a missing one fails the proof and is recorded with the run identifier (AuditService/ExportAudit, AuditService/AuditEntryRecorded, AuditService/AuditChainVerified, RunControlService/RunAccepted).",
        "AC2: Given the finished run, when `GetRun`, the model receipts and the tool receipts of the run are read, then every step has an attempt with exactly one outcome, every model call a receipt and every tool call an invocation, and a step, call or invocation without its record is named (RunControlService/GetRun, ModelRouterService/ListRunReceipts, ToolAdapterService/ListRunToolReceipts, ADR-0014).",
        "AC3: Given a project budget whose limit and approval threshold are above the reserved estimate of the run and whose limit is below the usage the run observes, when the observed usage crosses the limit, then the reservation was granted with no spend approval, CostUsageService publishes `BudgetExceeded` for that run only, the run ends Cancelled with the reason budget-exceeded and not Failed, and the next reservation of the budget is denied (CostUsageService/SetProjectBudget, CostUsageService/BudgetExceeded, RunControlService/RunCancelled, FR-09).",
        "AC4: Given a project budget whose limit is below the estimate of the run, when the run is accepted, then the reservation is denied and the run ends Failed with the failure class policy-denied, and nothing is reserved (CostUsageService/BudgetReservationDenied, RunControlService/RunFailed, model/services/control-plane/CostUsageService.yaml).",
        "AC5: Given the finished first run, when its usage is read and compared with its model invocation receipts, then the input and output tokens and the cost reported for the run equal the sum of its receipts, and the reservation of the run is settled (CostUsageService/GetRunUsage, ModelRouterService/ListRunReceipts, CostUsageService/ReservationSettled, FR-09)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5394",
        "AIFACTORY-TASK-5395",
        "AIFACTORY-TASK-5396"
      ],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9103,
      "kind": "evidence",
      "traces": {
        "services": [
          "AuditService",
          "CostUsageService",
          "ModelRouterService",
          "ToolAdapterService",
          "RunControlService"
        ],
        "apis": [
          "AuditService/ExportAudit",
          "CostUsageService/SetProjectBudget",
          "CostUsageService/GetRunUsage",
          "ModelRouterService/ListRunReceipts",
          "ToolAdapterService/ListRunToolReceipts",
          "RunControlService/GetRun"
        ],
        "events": [
          "AuditService/AuditEntryRecorded",
          "AuditService/AuditChainVerified",
          "CostUsageService/BudgetExceeded",
          "CostUsageService/BudgetReservationDenied",
          "CostUsageService/ReservationSettled",
          "RunControlService/RunAccepted",
          "RunControlService/RunCancelled",
          "RunControlService/RunFailed"
        ],
        "adrs": [
          "ADR-0014"
        ],
        "requirements": [
          "FR-09"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1339",
        "AIFACTORY-US-1340",
        "feature:audit-service-complete",
        "feature:cost-usage-service-complete",
        "feature:model-router-service",
        "feature:tool-adapter-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/services/governance/AuditService.yaml",
        "model/services/control-plane/CostUsageService.yaml",
        "model/services/control-plane/RunControlService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1341]",
      "number": 1341
    },
    {
      "id": "AIFACTORY-TASK-5394",
      "type": "task",
      "parent": "AIFACTORY-US-1341",
      "title": "Audit export, chain verification and run record of the demonstrated run",
      "sequence": "20.02.03.01",
      "description": "Audit export, chain verification and run record of the demonstrated run. Expected output: The exported audit trail of the project of the demonstrated run, a list that maps the submission, every policy decision, approval request and decision, tool invocation and cancellation of the run to its audit entry, the chain verification result with its head sequence, and the run record read through `GetRun`, `ListRunReceipts` and `ListRunToolReceipts` with every step, attempt, model receipt and tool invocation matched, recorded on the evidence page.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The exported audit trail of the project of the demonstrated run, a list that maps the submission, every policy decision, approval request and decision, tool invocation and cancellation of the run to its audit entry, the chain verification result with its head sequence, and the run record read through `GetRun`, `ListRunReceipts` and `ListRunToolReceipts` with every step, attempt, model receipt and tool invocation matched, recorded on the evidence page."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9103,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5394]",
      "number": 5394
    },
    {
      "id": "AIFACTORY-TASK-5395",
      "type": "task",
      "parent": "AIFACTORY-US-1341",
      "title": "Budget-capped run, denied reservation and usage reconciliation",
      "sequence": "20.02.03.02",
      "description": "Budget-capped run, denied reservation and usage reconciliation. Expected output: A second run of the fixture brief under a budget whose limit and threshold are above its estimate and below its observed usage, recorded with its granted reservation, its `BudgetExceeded` event and its Cancelled state with the reason budget-exceeded; a third run under a limit below its estimate, recorded with its denied reservation and its Failed state with the failure class policy-denied; and for the first run the usage per meter beside the sum of its model invocation receipts and its settled reservation.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A second run of the fixture brief under a budget whose limit and threshold are above its estimate and below its observed usage, recorded with its granted reservation, its `BudgetExceeded` event and its Cancelled state with the reason budget-exceeded; a third run under a limit below its estimate, recorded with its denied reservation and its Failed state with the failure class policy-denied; and for the first run the usage per meter beside the sum of its model invocation receipts and its settled reservation."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9103,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5395]",
      "number": 5395
    },
    {
      "id": "AIFACTORY-TASK-5396",
      "type": "task",
      "parent": "AIFACTORY-US-1341",
      "title": "Verify the audit, run record and budget proof against its criteria",
      "sequence": "20.02.03.03",
      "description": "Verify the audit, run record and budget proof against its criteria. Expected output: The recorded audit export, chain result, run record, capped run, denied run and reconciliation are compared with AC1 to AC5 of AIFACTORY-US-1341 (AuditService/AuditChainVerified, RunControlService/GetRun, ToolAdapterService/ListRunToolReceipts, CostUsageService/BudgetExceeded, CostUsageService/BudgetReservationDenied, RunControlService/RunCancelled, ModelRouterService/ListRunReceipts); any unmatched entry, attempt or receipt fails the check and is named.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded audit export, chain result, run record, capped run, denied run and reconciliation are compared with AC1 to AC5 of AIFACTORY-US-1341 (AuditService/AuditChainVerified, RunControlService/GetRun, ToolAdapterService/ListRunToolReceipts, CostUsageService/BudgetExceeded, CostUsageService/BudgetReservationDenied, RunControlService/RunCancelled, ModelRouterService/ListRunReceipts); any unmatched entry, attempt or receipt fails the check and is named."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9103,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5396]",
      "number": 5396
    },
    {
      "id": "AIFACTORY-US-018",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-139",
      "title": "The first outcome is demonstrated end to end",
      "sequence": "20.02.04",
      "description": "As a requester, I want to submit one vision and end with an open change proposal for a generated, built and tested microservice, so that the Factory has proven its first outcome on a real product idea. This is the integration PBI of the feature and the closing proof of increment I1. The outcome of I1, as model/backlog/increments.yaml states it, is that a vision submitted through the API or the command-line client ends as an approved change proposal that contains a generated, built and tested microservice (decision D65), and that the run is audited from its first command and stops at its budget cap (decision D80). The increment is finished when this proof passes, not when its services are deployed. The preconditions of AIFACTORY-US-1339 are checked first: the action kinds credential-issuance (D127) and connection-grant (D129) with their platform rules, the tool `record-generated-output` (D133) and the audit of `RunAccepted` by AuditService (D126, D135), all decided and carried by the model, and the inputs of the owner that D140 enters in the same register, which the owner supplies before the run; one found missing at the check stops the run and its blocker is the evidence. Then the five demonstrations are replayed in one recorded acceptance run from the script and the fixture brief, after a Workspace admin of the fixture project has granted its repository connection through IntegrationHost: the chain and the two approvals of AIFACTORY-US-1340, and the audit chain, the run record, the budget cap and the reconciliation of AIFACTORY-US-1341. The evidence pack holds every run identifier, approval, receipt, audit export and the reference of the change proposal. Kind: evidence. Traces: services: RunControlService, WorkflowEngineService, GenerationRecipeService, PipelineExecutionService; workflows: vision-to-blueprint, architecture-decomposition, module-blueprints, application-design, database-blueprint, generate-product; adrs: ADR-0014, ADR-0027, ADR-0029. Depends on: AIFACTORY-US-1339, AIFACTORY-US-1340, AIFACTORY-US-1341. Sources: model/backlog/increments.yaml, model/backlog/epics.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the preconditions of AIFACTORY-US-1339 are aligned, when the script is replayed in the recorded acceptance run, then the six workflows run in order with no workflow started by hand and the run identifiers are in the evidence pack (WorkflowEngineService, RunControlService, ADR-0027).",
        "AC2: Given the recipe and the change set of that run, when the asset maintainer and the reviewer approve them, then the change proposal is open in the system of record with provenance and validation results, and its branch builds and tests outside the Factory, as AIFACTORY-US-1340 proves it (GenerationRecipeService, PipelineExecutionService).",
        "AC3: Given the run ended, when its record and its audit trail are read, then every step has an attempt, every model call a receipt and every tool call an invocation, the audit chain verifies from the submission of the run, and a run whose observed usage crossed its budget stopped at the cap, as AIFACTORY-US-1341 proves it (RunControlService, ADR-0014).",
        "AC4: Given the evidence pack, when it is reviewed against the outcome of I1 in model/backlog/increments.yaml and the done_when of the epic outcome-verification in model/backlog/epics.yaml, then each of the five demonstrations has its evidence, and a failed demonstration or an unaligned precondition is recorded instead of being waived (ADR-0029)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-185",
        "AIFACTORY-TASK-776"
      ],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9104,
      "kind": "evidence",
      "traces": {
        "services": [
          "RunControlService",
          "WorkflowEngineService",
          "GenerationRecipeService",
          "PipelineExecutionService"
        ],
        "workflows": [
          "vision-to-blueprint",
          "architecture-decomposition",
          "module-blueprints",
          "application-design",
          "database-blueprint",
          "generate-product"
        ],
        "adrs": [
          "ADR-0014",
          "ADR-0027",
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1339",
        "AIFACTORY-US-1340",
        "AIFACTORY-US-1341"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-018]",
      "number": 18
    },
    {
      "id": "AIFACTORY-TASK-185",
      "type": "task",
      "parent": "AIFACTORY-US-018",
      "title": "Evidence pack for increment I1",
      "sequence": "20.02.04.01",
      "description": "Evidence pack for increment I1. Expected output: A recorded run of every demonstration below with its run identifiers, artifacts and logs: A person submits a vision; the chain of six workflows runs without a manual start between them. A person approves the recipe and, later, the exact change set. The change proposal is open in the system of record with provenance and validation results. Every command, decision, approval and tool effect of the run is in the audit trail and the hash chain verifies. A run with a budget below its need stops at the cap, and the usage of a finished run reconciles with its receipts.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A recorded run of every demonstration below with its run identifiers, artifacts and logs: A person submits a vision; the chain of six workflows runs without a manual start between them. A person approves the recipe and, later, the exact change set. The change proposal is open in the system of record with provenance and validation results. Every command, decision, approval and tool effect of the run is in the audit trail and the hash chain verifies. A run with a budget below its need stops at the cap, and the usage of a finished run reconciles with its receipts."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9104,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-185]",
      "number": 185
    },
    {
      "id": "AIFACTORY-TASK-776",
      "type": "task",
      "parent": "AIFACTORY-US-018",
      "title": "Verify first-outcome-demonstrated against the recorded acceptance run",
      "sequence": "20.02.04.02",
      "description": "Verify first-outcome-demonstrated against the recorded acceptance run. Expected output: The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-018 and with the outcome of I1 in model/backlog/increments.yaml; every demonstration and every precondition has its evidence, and `python -I tools/docs_model validate` passes with the evidence page in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-018 and with the outcome of I1 in model/backlog/increments.yaml; every demonstration and every precondition has its evidence, and `python -I tools/docs_model validate` passes with the evidence page in place."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i1-generate-a-microservice",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 91,
      "phase": "factory",
      "stackRank": 9104,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-776]",
      "number": 776
    },
    {
      "id": "AIFACTORY-FEAT-140",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I2: Deliver it",
      "sequence": "20.03",
      "description": "The outcome of increment I2 is demonstrated end to end and the evidence is recorded: The merged service is built by a pipeline, deployed to a preview environment and promoted under approval; the infrastructure it runs on is planned by the Factory from the design. Demonstrations: The merged change triggers a pipeline run whose results are recorded. The Security, Observability and Infrastructure Blueprints of the product are produced and validated without a person writing them. A preview environment is provisioned, used and torn down. A promotion to the next environment waits for an approval bound to the exact release. Increment I2: Deliver it. Build order 109 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1342",
        "AIFACTORY-US-1343",
        "AIFACTORY-US-1344",
        "AIFACTORY-US-030"
      ],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10900,
      "titlePrefix": "[AIFACTORY-FEAT-140]",
      "number": 140
    },
    {
      "id": "AIFACTORY-US-1342",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-140",
      "title": "Delivery proof: the merged change triggers a recorded pipeline run, becomes a ready release and is promoted to production only after the one approval bound to that release and environment",
      "sequence": "20.03.01",
      "description": "As an operator, I want the merged service of the replayed first-outcome chain built by a pipeline, released and promoted under the one production approval bound to that release and environment, so that no release of a generated service reaches production without recorded results and a decision on that exact release. This PBI proves two demonstrations of increment I2: the merged change triggers a pipeline run whose results are recorded, and a promotion waits for an approval bound to the exact release. Decision D132 records that the chain is not yet closed in the model, so the proof first checks an I2 precondition register, in the shape of the register of AIFACTORY-US-1339. Its entries are: the pipeline of the generated repository, since no operation creates the repository or the pipeline of a generated product (model/workflows/project-bootstrap.yaml); the inbound deliveries of Azure DevOps, which the feature connector-registry-service-deliveries delivers in I2 so that `DeliveryReceived` brings the review states, merges and pipeline runs to PipelineExecutionService (D135, model/services/integration/ConnectorRegistryService.yaml); the tool of `delivery-run/prepare-release` that calls `CreateProductRelease` of ReleaseService and readies the release so that `ReleaseReady` is published (model/workflows/delivery-run.yaml); the tool of `release/promote-staging` that calls `RequestPromotion` of EnvironmentPromotionService (model/workflows/release.yaml); the action kind `promotion` with which the Policy gate of EnvironmentPromotionService asks `Policy.Decide` with the class of the target environment, allowed by the platform bundle for an Operator or a Workspace admin of the project and answered allow-with-approval by the seeded tenant bundle for the class production, whose approval is the one production approval (D140, model/services/governance/PolicyEngineService.yaml), entered as aligned, which does not cover the creation of a preview environment, so the action kind of that entry of AIFACTORY-US-1344 stays open; the publication of the I2 definitions, by which `delivery-run`, `release`, `preview-environment` and the blueprint workflows of I2 with their agents and any new skill, tool and model profile release are loadable, because each I2 workflow feature submits and publishes them through the publication path that feature `agent-registry-service-publication` delivers in I2, approved by a Reviewer who is not the submitter and without an evaluation verdict before I4, and the runs pin the Published release (D140, model/services/control-plane/AgentRegistryService.yaml), entered as aligned; and the preview entries of AIFACTORY-US-1344. While an entry is open the run is not started and the blocker is the evidence. The wait of `release/approve-production` and `delivery-run/approve-production` on the gate of EnvironmentPromotionService is decided and in the model (D133, D135), and so is the order of `release`, in which `promote-production` requests the production promotion first, which opens the gate, `approve-production` then waits on that gate and `verify` follows, so the promotion is handed off to production only after the approval (D139); neither is an entry of the register. When the register is aligned, the run starts from the change proposal of the replayed I1 chain, after its preview. A reviewer merges it; PipelineExecutionService records the merge, which `ChangeProposalMerged` carries, and the typed results of the pipeline run of the merged commit, which `PipelineRunCompleted` carries. The workflow `delivery-run` evaluates them and, in `prepare-release`, creates the release through `CreateProductRelease`, which `ReleaseCreated` records, and readies it, which `ReleaseReady` records; together with the pipeline results that event activates `release`. Its step `promote-staging` requests the staging promotion; the bake window then passes as a timer, because no I2 service evaluates the SLO guards (model/scenarios/release.yaml, SCN-release-003). A person gives one production approval (D133): after the gates of the production promotion pass, its Policy gate answered allow-with-approval for the class production among them (D140), EnvironmentPromotionService requests the approval of class production with the subject kind Promotion and the promotion id as subject (D135), bound to the release id and the target environment, decided by someone other than the requester, and the decision returns to EnvironmentPromotionService; `release/approve-production` waits on that approval and requests none of its own, and no approval opens through `delivery-run/approve-production`. On an approving decision `PromotionApproved` and `PromotionCompleted` are recorded and `GetCurrentRelease` returns the release; a decision bound to another release id or another environment, a rejection or an expiry leaves the environment on its earlier release. Kind: evidence. Traces: services: PipelineExecutionService, ReleaseService, EnvironmentPromotionService, RunControlService, ConnectorRegistryService, PolicyEngineService, AgentRegistryService; workflows: delivery-run, release; steps: delivery-run/prepare-release, release/promote-staging, release/bake, release/approve-production, release/promote-production, release/verify; apis: ReleaseService/CreateProductRelease, EnvironmentPromotionService/RequestPromotion, EnvironmentPromotionService/GetCurrentRelease, PolicyEngineService/Policy.Decide, AgentRegistryService/PublishRelease; events: ConnectorRegistryService/DeliveryReceived, AgentRegistryService/AssetReleasePublished, PipelineExecutionService/ChangeProposalMerged, PipelineExecutionService/PipelineRunCompleted, ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady, RunControlService/ApprovalRequested, EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/PromotionCompleted; adrs: ADR-0015; requirements: FR-06. Depends on: feature:verify-generate-a-microservice, feature:pipeline-execution-service-complete, feature:release-service, feature:environment-promotion-service, feature:delivery-host, feature:run-control-service, feature:connector-registry-service-deliveries, feature:agent-registry-service-publication, feature:policy-engine-service, feature:wf-project-bootstrap, feature:wf-delivery-run, feature:wf-release. Sources: model/backlog/increments.yaml, model/workflows/delivery-run.yaml, model/workflows/release.yaml, model/workflows/project-bootstrap.yaml, model/services/devops-gitops/EnvironmentPromotionService.yaml, model/services/integration/ConnectorRegistryService.yaml, model/services/governance/PolicyEngineService.yaml, model/services/control-plane/AgentRegistryService.yaml, model/scenarios/release.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the I2 precondition register, when it is checked before the run, then the pipeline of the generated repository, the inbound deliveries of the feature connector-registry-service-deliveries, the tool of `delivery-run/prepare-release` that calls `CreateProductRelease` and readies the release and the tool of `release/promote-staging` that calls `RequestPromotion` each name the model file that closes it and its state, the action kind `promotion` of the Policy gate and the publication of the I2 definitions through the I2 publication path, with `AssetReleasePublished` recorded for each definition the runs pin, are listed as aligned, and while an entry is open the run is not started and the blocker is recorded as the evidence (D132, D135, D140, ConnectorRegistryService/DeliveryReceived, AgentRegistryService/PublishRelease, AgentRegistryService/AssetReleasePublished, model/services/governance/PolicyEngineService.yaml, model/workflows/delivery-run.yaml, model/workflows/release.yaml).",
        "AC2: Given the change proposal of the replayed I1 chain after its preview, when a reviewer merges it, then the merge and the pipeline run of the merged commit are recorded with their typed results, and the run identifier and results are in the evidence (PipelineExecutionService/ChangeProposalMerged, PipelineExecutionService/PipelineRunCompleted).",
        "AC3: Given the recorded results with no blocking failure, when `delivery-run` reaches `prepare-release`, then the release is created through `CreateProductRelease` and readied, `ReleaseCreated` and `ReleaseReady` are recorded, `release` is activated by `ReleaseReady` with the pipeline results, `promote-staging` requests the staging promotion and the bake passes as a timer with the SLO guard evaluation recorded as a stated gap of I2 (ReleaseService/CreateProductRelease, ReleaseService/ReleaseCreated, ReleaseService/ReleaseReady, delivery-run/prepare-release, release/promote-staging, release/bake).",
        "AC4: Given `release/promote-production` requested the production promotion and its gates passed, the Policy gate with a decision of `PolicyEngineService/Policy.Decide` of the action kind `promotion` that answered allow-with-approval for the class production, when EnvironmentPromotionService requests its approval, then exactly one approval of class production is open, with the subject kind Promotion and the promotion id as subject, bound to the release id and the target environment, `release/approve-production` waits on it without a request of its own, `release/verify` runs only after the promotion was handed off, and a decision by the requester of the run is refused (EnvironmentPromotionService/RequestPromotion, RunControlService/ApprovalRequested, release/approve-production, D133, D135, D139, D140, ADR-0015).",
        "AC5: Given an approving decision on that approval, when the promotion completes, then `PromotionApproved` and `PromotionCompleted` are recorded and `GetCurrentRelease` of the target environment returns that release; a decision bound to another release id or another environment, a rejection or an expiry leaves `GetCurrentRelease` on the earlier release (EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/PromotionCompleted, EnvironmentPromotionService/GetCurrentRelease, release/promote-production)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/workflows/delivery-run.yaml",
        "model/workflows/release.yaml",
        "model/workflows/project-bootstrap.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/scenarios/release.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5416",
        "AIFACTORY-TASK-5397",
        "AIFACTORY-TASK-5398",
        "AIFACTORY-TASK-5399"
      ],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10901,
      "kind": "evidence",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ReleaseService",
          "EnvironmentPromotionService",
          "RunControlService",
          "ConnectorRegistryService",
          "PolicyEngineService",
          "AgentRegistryService"
        ],
        "workflows": [
          "delivery-run",
          "release"
        ],
        "steps": [
          "delivery-run/prepare-release",
          "release/promote-staging",
          "release/bake",
          "release/approve-production",
          "release/promote-production",
          "release/verify"
        ],
        "apis": [
          "ReleaseService/CreateProductRelease",
          "EnvironmentPromotionService/RequestPromotion",
          "EnvironmentPromotionService/GetCurrentRelease",
          "PolicyEngineService/Policy.Decide",
          "AgentRegistryService/PublishRelease"
        ],
        "events": [
          "ConnectorRegistryService/DeliveryReceived",
          "AgentRegistryService/AssetReleasePublished",
          "PipelineExecutionService/ChangeProposalMerged",
          "PipelineExecutionService/PipelineRunCompleted",
          "ReleaseService/ReleaseCreated",
          "ReleaseService/ReleaseReady",
          "RunControlService/ApprovalRequested",
          "EnvironmentPromotionService/PromotionApproved",
          "EnvironmentPromotionService/PromotionCompleted"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:verify-generate-a-microservice",
        "feature:pipeline-execution-service-complete",
        "feature:release-service",
        "feature:environment-promotion-service",
        "feature:delivery-host",
        "feature:run-control-service",
        "feature:connector-registry-service-deliveries",
        "feature:agent-registry-service-publication",
        "feature:policy-engine-service",
        "feature:wf-project-bootstrap",
        "feature:wf-delivery-run",
        "feature:wf-release"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/workflows/delivery-run.yaml",
        "model/workflows/release.yaml",
        "model/workflows/project-bootstrap.yaml",
        "model/services/devops-gitops/EnvironmentPromotionService.yaml",
        "model/services/integration/ConnectorRegistryService.yaml",
        "model/services/governance/PolicyEngineService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/scenarios/release.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1342]",
      "number": 1342
    },
    {
      "id": "AIFACTORY-TASK-5416",
      "type": "task",
      "parent": "AIFACTORY-US-1342",
      "title": "Precondition register of the delivery proof",
      "sequence": "20.03.01.01",
      "description": "Precondition register of the delivery proof. Expected output: A precondition register on the evidence page that lists each open link of D132 with the model file that closes it and its state, aligned or blocking: the pipeline of the generated repository (model/workflows/project-bootstrap.yaml), the inbound deliveries of the feature connector-registry-service-deliveries (model/services/integration/ConnectorRegistryService.yaml, D135), the tool of `prepare-release` that calls `CreateProductRelease` and readies the release (model/workflows/delivery-run.yaml), the tool of `promote-staging` that calls `RequestPromotion` (model/workflows/release.yaml), the action kind promotion of the Policy gate of EnvironmentPromotionService, aligned (model/services/governance/PolicyEngineService.yaml, D140), the publication of the I2 workflow definitions and their agents through the publication path of feature agent-registry-service-publication with the Published release each run pins, aligned (model/services/control-plane/AgentRegistryService.yaml, D140), and the preview entries of AIFACTORY-US-1344, whose action kind for creating a non-production environment the action kind promotion does not cover.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A precondition register on the evidence page that lists each open link of D132 with the model file that closes it and its state, aligned or blocking: the pipeline of the generated repository (model/workflows/project-bootstrap.yaml), the inbound deliveries of the feature connector-registry-service-deliveries (model/services/integration/ConnectorRegistryService.yaml, D135), the tool of `prepare-release` that calls `CreateProductRelease` and readies the release (model/workflows/delivery-run.yaml), the tool of `promote-staging` that calls `RequestPromotion` (model/workflows/release.yaml), the action kind promotion of the Policy gate of EnvironmentPromotionService, aligned (model/services/governance/PolicyEngineService.yaml, D140), the publication of the I2 workflow definitions and their agents through the publication path of feature agent-registry-service-publication with the Published release each run pins, aligned (model/services/control-plane/AgentRegistryService.yaml, D140), and the preview entries of AIFACTORY-US-1344, whose action kind for creating a non-production environment the action kind promotion does not cover."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10901,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-5416]",
      "number": 5416
    },
    {
      "id": "AIFACTORY-TASK-5397",
      "type": "task",
      "parent": "AIFACTORY-US-1342",
      "title": "Merge, pipeline run, release and promotion of the generated service",
      "sequence": "20.03.01.02",
      "description": "Merge, pipeline run, release and promotion of the generated service. Expected output: One recorded pass on the acceptance environment from the merge of the change proposal of the replayed chain to the completed production promotion: the merged commit, the pipeline run identifier and its typed results, the release identifier with `ReleaseCreated` and `ReleaseReady`, the run of `release`, the staging promotion, the bake timer, the one production approval with its release id and environment and the decision.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One recorded pass on the acceptance environment from the merge of the change proposal of the replayed chain to the completed production promotion: the merged commit, the pipeline run identifier and its typed results, the release identifier with `ReleaseCreated` and `ReleaseReady`, the run of `release`, the staging promotion, the bake timer, the one production approval with its release id and environment and the decision."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10901,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5397]",
      "number": 5397
    },
    {
      "id": "AIFACTORY-TASK-5398",
      "type": "task",
      "parent": "AIFACTORY-US-1342",
      "title": "Refused, mismatched, rejected and expired production decisions",
      "sequence": "20.03.01.03",
      "description": "Refused, mismatched, rejected and expired production decisions. Expected output: Recorded refusals on the production approval: a decision by the requester of the run, which is refused; a decision bound to another release id and one bound to another environment, which do not promote; and a rejection and an expiry on separate promotions; `GetCurrentRelease` of the target environment keeps its earlier release in every case.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "Recorded refusals on the production approval: a decision by the requester of the run, which is refused; a decision bound to another release id and one bound to another environment, which do not promote; and a rejection and an expiry on separate promotions; `GetCurrentRelease` of the target environment keeps its earlier release in every case."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10901,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5398]",
      "number": 5398
    },
    {
      "id": "AIFACTORY-TASK-5399",
      "type": "task",
      "parent": "AIFACTORY-US-1342",
      "title": "Verify the delivery and promotion proof against its criteria",
      "sequence": "20.03.01.04",
      "description": "Verify the delivery and promotion proof against its criteria. Expected output: The register, recorded runs, release, approval and current release are compared with AC1 to AC5 of AIFACTORY-US-1342 (PipelineExecutionService/PipelineRunCompleted, ReleaseService/ReleaseReady, EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/GetCurrentRelease); a second production approval, an open register entry presented as passed, or a mismatch is named with its run identifier.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The register, recorded runs, release, approval and current release are compared with AC1 to AC5 of AIFACTORY-US-1342 (PipelineExecutionService/PipelineRunCompleted, ReleaseService/ReleaseReady, EnvironmentPromotionService/PromotionApproved, EnvironmentPromotionService/GetCurrentRelease); a second production approval, an open register entry presented as passed, or a mismatch is named with its run identifier."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10901,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5399]",
      "number": 5399
    },
    {
      "id": "AIFACTORY-US-1343",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-140",
      "title": "Delivery proof: the Security, Observability and Infrastructure Blueprints of the product are produced and validated by their workflows with no person writing them",
      "sequence": "20.03.02",
      "description": "As an operator, I want the three blueprints the product needs to run produced and validated by the Factory from its design, so that the infrastructure of a generated service is planned by the Factory and not written by hand. This PBI proves the demonstration of increment I2 that the Security, Observability and Infrastructure Blueprints of the product are produced and validated without a person writing them. The recorded run replays the I1 chain from the fixture brief on the I2 estate, after the I2 definitions are published, so that the readiness events of the replayed design arrive when the I2 definitions can hear them; the blueprints are the first part of the recorded run, before the preview, the merge and the promotion. Each blueprint has its producing workflow, as ADR-0030 requires of every blueprint kind: `security-blueprint` and `observability-blueprint` start when their readiness members are satisfied, and `infrastructure-plan` starts when the module, database, security and observability blueprints its activation names are recorded (model/workflows/infrastructure-plan.yaml). The fixture product has persistence, so it has a Database Blueprint and the database member is satisfied; under the D133 reading a product without persistence gets none. Each workflow drafts its blueprint with its agent, submits the draft through the tool step `submit-version`, which BlueprintService records as `BlueprintSubmitted`, and validates it through the tool step `validate`, which BlueprintService records as `BlueprintValidated` with the result. A person may decide an approval a step asks for, but no person writes or edits a blueprint version: the evidence shows that each version was submitted by the run that produced it. The infrastructure plan also generates its Pulumi program and a preview of it in a sandbox. A blueprint that fails validation fails its run with the issues as evidence, and the proof is recorded as failed. Kind: evidence. Traces: services: BlueprintService; workflows: security-blueprint, observability-blueprint, infrastructure-plan; steps: security-blueprint/validate, observability-blueprint/validate, infrastructure-plan/validate, infrastructure-plan/preview; tools: blueprint-submit-version, blueprint-validate; events: BlueprintService/BlueprintSubmitted, BlueprintService/BlueprintValidated; descriptors: blueprint-security-v1, blueprint-observability-v1, blueprint-infrastructure-v1; adrs: ADR-0030. Depends on: feature:verify-generate-a-microservice, feature:blueprint-service, feature:wf-security-blueprint, feature:wf-observability-blueprint, feature:wf-infrastructure-plan. Sources: model/backlog/increments.yaml, docs/architecture/adr/0030-a-producing-workflow-for-every-blueprint-kind.md, model/workflows/infrastructure-plan.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the I1 chain replayed from the fixture brief on the I2 estate with a product that has persistence, when the workflows `security-blueprint`, `observability-blueprint` and `infrastructure-plan` run, then each starts without a manual submission once the readiness members of model/workflows/infrastructure-plan.yaml and of its own definition are recorded, the database member is satisfied, and the run identifiers are in the evidence (ADR-0030, docs/architecture/adr/0030-a-producing-workflow-for-every-blueprint-kind.md).",
        "AC2: Given each of the three runs, when its steps `submit-version` and `validate` complete, then a blueprint version of the kinds `blueprint-security-v1`, `blueprint-observability-v1` and `blueprint-infrastructure-v1` is submitted and validated as passed (BlueprintService/BlueprintSubmitted, BlueprintService/BlueprintValidated, security-blueprint/validate, observability-blueprint/validate, infrastructure-plan/validate).",
        "AC3: Given the three validated versions, when their provenance is read, then each was submitted by the run that produced it and no version was created or edited by a person, and the infrastructure plan holds its generated program and the result of its preview (infrastructure-plan/preview, ADR-0030)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0030-a-producing-workflow-for-every-blueprint-kind.md",
        "model/workflows/infrastructure-plan.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5400",
        "AIFACTORY-TASK-5401"
      ],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10902,
      "kind": "evidence",
      "traces": {
        "services": [
          "BlueprintService"
        ],
        "workflows": [
          "security-blueprint",
          "observability-blueprint",
          "infrastructure-plan"
        ],
        "steps": [
          "security-blueprint/validate",
          "observability-blueprint/validate",
          "infrastructure-plan/validate",
          "infrastructure-plan/preview"
        ],
        "tools": [
          "blueprint-submit-version",
          "blueprint-validate"
        ],
        "events": [
          "BlueprintService/BlueprintSubmitted",
          "BlueprintService/BlueprintValidated"
        ],
        "descriptors": [
          "blueprint-security-v1",
          "blueprint-observability-v1",
          "blueprint-infrastructure-v1"
        ],
        "adrs": [
          "ADR-0030"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:verify-generate-a-microservice",
        "feature:blueprint-service",
        "feature:wf-security-blueprint",
        "feature:wf-observability-blueprint",
        "feature:wf-infrastructure-plan"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0030-a-producing-workflow-for-every-blueprint-kind.md",
        "model/workflows/infrastructure-plan.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1343]",
      "number": 1343
    },
    {
      "id": "AIFACTORY-TASK-5400",
      "type": "task",
      "parent": "AIFACTORY-US-1343",
      "title": "Runs of the three blueprint workflows with the provenance of each version",
      "sequence": "20.03.02.01",
      "description": "Runs of the three blueprint workflows with the provenance of each version. Expected output: The run identifiers of `security-blueprint`, `observability-blueprint` and `infrastructure-plan` from the replayed chain on the acceptance environment, the satisfied readiness members including the database member, the three blueprint versions with their validation results and the submitter of each version, the generated Pulumi program and the result of its sandbox preview.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The run identifiers of `security-blueprint`, `observability-blueprint` and `infrastructure-plan` from the replayed chain on the acceptance environment, the satisfied readiness members including the database member, the three blueprint versions with their validation results and the submitter of each version, the generated Pulumi program and the result of its sandbox preview."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10902,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5400]",
      "number": 5400
    },
    {
      "id": "AIFACTORY-TASK-5401",
      "type": "task",
      "parent": "AIFACTORY-US-1343",
      "title": "Verify the blueprint proof against its criteria",
      "sequence": "20.03.02.02",
      "description": "Verify the blueprint proof against its criteria. Expected output: The recorded runs and versions are compared with AC1 to AC3 of AIFACTORY-US-1343 (BlueprintService/BlueprintValidated, infrastructure-plan/preview, ADR-0030); a version with a person as its author or a failed validation fails the check and is named.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded runs and versions are compared with AC1 to AC3 of AIFACTORY-US-1343 (BlueprintService/BlueprintValidated, infrastructure-plan/preview, ADR-0030); a version with a person as its author or a failed validation fails the check and is named."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10902,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5401]",
      "number": 5401
    },
    {
      "id": "AIFACTORY-US-1344",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-140",
      "title": "Delivery proof: a preview environment is created from the change proposal after its approval, used while its fixed time to live runs and torn down with its lifetime recorded",
      "sequence": "20.03.03",
      "description": "As an operator, I want a preview environment of the change proposal approved, created, used and torn down by the Factory, so that a preview never outlives its purpose and is never created without a decision. This PBI proves the demonstration of increment I2 that a preview environment is provisioned, used and torn down. Decision D132 records three open links, entered in the precondition register of AIFACTORY-US-1342: RuntimeEnvironmentService models no operation that creates an environment (model/scenarios/preview-environment.yaml, SCN-preview-environment-003), `policy-decision-v1` has no action kind for creating a non-production environment, and there is no source of the cost figure of a preview. While the operation or the action kind is missing the run is not started and the blocker is the evidence; no other action kind is borrowed. The missing cost source does not block: the teardown records the lifetime and marks the cost as unknown. The recorded run replays the I1 chain on the I2 estate, so `preview-environment` is activated by the new change proposal together with the passed Infrastructure Blueprint, after the three blueprints and before the merge. It resolves the proposal to a buildable change set. In I2 the step `approve-preview` always opens its approval request, because a policy guard on a Human step arrives only in I4 (D133): action class shared-write, proposal kind deployment-manifest, the change-set hash as proposal hash and the role Reviewer in project scope, never the requester of the run. A rejection or an expiry fails the run (ApprovalRejectedOrExpired) and no environment is created. On approval `request-preview` asks RuntimeEnvironmentService for the environment and the run output names its identity and address. A person uses it: the service answers its health route and one endpoint. The time to live is fixed once the timer of `time-to-live` is stored, since no signal extends a timer (SCN-preview-environment-004). The step `teardown` removes the environment and the inventory no longer lists it; a failed teardown ends the run Failed with an operator follow-up. Kind: evidence. Traces: services: RuntimeEnvironmentService, RunControlService; workflows: preview-environment; steps: preview-environment/approve-preview, preview-environment/request-preview, preview-environment/time-to-live, preview-environment/teardown; apis: RuntimeEnvironmentService/GetRuntimeInventory; events: RuntimeEnvironmentService/ObservedStateChanged, RunControlService/ApprovalRequested, RunControlService/RunFailed; adrs: ADR-0015. Depends on: AIFACTORY-US-1342, feature:verify-generate-a-microservice, feature:runtime-environment-service, feature:wf-preview-environment, feature:run-control-service. Sources: model/backlog/increments.yaml, model/workflows/preview-environment.yaml, model/scenarios/preview-environment.yaml, model/services/runtime-cloud/RuntimeEnvironmentService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the preview entries of the precondition register of AIFACTORY-US-1342, when they are checked before the run, then an operation of RuntimeEnvironmentService that creates an environment and an action kind for creating a non-production environment exist, and while either is missing the run is not started and the blocker is recorded; the missing source of the cost figure is recorded and does not block (D132, model/services/runtime-cloud/RuntimeEnvironmentService.yaml, model/scenarios/preview-environment.yaml).",
        "AC2: Given the change proposal of the replayed chain and the passed Infrastructure Blueprint, when `preview-environment` reaches `preview-environment/approve-preview`, then an approval request opens with action class shared-write, proposal kind deployment-manifest, the change-set hash and the role Reviewer in project scope, and on an approving decision by a reviewer who is not the requester `preview-environment/request-preview` creates the environment and its observed state is recorded (RunControlService/ApprovalRequested, RuntimeEnvironmentService/ObservedStateChanged, RuntimeEnvironmentService/GetRuntimeInventory, D133).",
        "AC3: Given the approval request of a second preview run, when it is rejected or expires, then the run ends Failed through ApprovalRejectedOrExpired and the inventory shows that no environment was created (RunControlService/RunFailed, RuntimeEnvironmentService/GetRuntimeInventory, preview-environment/approve-preview).",
        "AC4: Given the created environment, when a person calls the health route and one endpoint of the service on its address, then both answer and the calls are recorded with the environment identity (preview-environment/request-preview).",
        "AC5: Given the time to live fixed when its timer was stored, when it passes and the step `preview-environment/teardown` runs, then the environment is removed, its lifetime is recorded with the cost marked unknown while no cost source exists, and the inventory no longer lists it; a failed teardown ends the run Failed with an operator follow-up (preview-environment/time-to-live, RuntimeEnvironmentService/GetRuntimeInventory)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/workflows/preview-environment.yaml",
        "model/scenarios/preview-environment.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5402",
        "AIFACTORY-TASK-5403"
      ],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10903,
      "kind": "evidence",
      "traces": {
        "services": [
          "RuntimeEnvironmentService",
          "RunControlService"
        ],
        "workflows": [
          "preview-environment"
        ],
        "steps": [
          "preview-environment/approve-preview",
          "preview-environment/request-preview",
          "preview-environment/time-to-live",
          "preview-environment/teardown"
        ],
        "apis": [
          "RuntimeEnvironmentService/GetRuntimeInventory"
        ],
        "events": [
          "RuntimeEnvironmentService/ObservedStateChanged",
          "RunControlService/ApprovalRequested",
          "RunControlService/RunFailed"
        ],
        "adrs": [
          "ADR-0015"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1342",
        "feature:verify-generate-a-microservice",
        "feature:runtime-environment-service",
        "feature:wf-preview-environment",
        "feature:run-control-service"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/workflows/preview-environment.yaml",
        "model/scenarios/preview-environment.yaml",
        "model/services/runtime-cloud/RuntimeEnvironmentService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1344]",
      "number": 1344
    },
    {
      "id": "AIFACTORY-TASK-5402",
      "type": "task",
      "parent": "AIFACTORY-US-1344",
      "title": "Lifecycle of one preview environment on the acceptance environment",
      "sequence": "20.03.03.01",
      "description": "Lifecycle of one preview environment on the acceptance environment. Expected output: One recorded run of `preview-environment` from the replayed chain with its approval request and decision, the identity and address of the environment, two calls of a person to the service on that address, the inventory before and after the teardown and the lifetime the teardown recorded with the cost marked unknown; and a second run whose approval is rejected or expires, with no environment in the inventory.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One recorded run of `preview-environment` from the replayed chain with its approval request and decision, the identity and address of the environment, two calls of a person to the service on that address, the inventory before and after the teardown and the lifetime the teardown recorded with the cost marked unknown; and a second run whose approval is rejected or expires, with no environment in the inventory."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10903,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5402]",
      "number": 5402
    },
    {
      "id": "AIFACTORY-TASK-5403",
      "type": "task",
      "parent": "AIFACTORY-US-1344",
      "title": "Verify the preview proof against its criteria",
      "sequence": "20.03.03.02",
      "description": "Verify the preview proof against its criteria. Expected output: The register entries, recorded runs, calls and inventory are compared with AC1 to AC5 of AIFACTORY-US-1344 (preview-environment/approve-preview, preview-environment/request-preview, preview-environment/teardown, RuntimeEnvironmentService/GetRuntimeInventory); an environment created without an approving decision, or still listed after the teardown, fails the check.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The register entries, recorded runs, calls and inventory are compared with AC1 to AC5 of AIFACTORY-US-1344 (preview-environment/approve-preview, preview-environment/request-preview, preview-environment/teardown, RuntimeEnvironmentService/GetRuntimeInventory); an environment created without an approving decision, or still listed after the teardown, fails the check."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10903,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5403]",
      "number": 5403
    },
    {
      "id": "AIFACTORY-US-030",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-140",
      "title": "Delivery is demonstrated with evidence",
      "sequence": "20.03.04",
      "description": "As an operator, I want to see the generated service built by a pipeline, running in a preview environment and promoted under approval, with the evidence recorded, so that the second outcome is accepted on facts. This is the integration PBI of the feature and the closing proof of increment I2. The outcome of I2, as model/backlog/increments.yaml states it, is that the merged service is built by a pipeline, deployed to a preview environment and promoted under approval, and that the infrastructure it runs on is planned by the Factory from the design. The increment is finished when this proof passes, not when its services are deployed. The precondition register of AIFACTORY-US-1342 is checked first, including the inbound deliveries of the feature connector-registry-service-deliveries (D135); while an entry of D132 is open the run is not started and the blocker is the evidence. The change proposal and the blueprints of the proof of I1 were published before the I2 definitions existed, so they cannot open readiness correlations of I2. The recorded acceptance run therefore replays the I1 chain from the fixture brief on the I2 estate, so that its readiness events arrive after the I2 definitions are published, and runs the demonstrations in this order: the Security, Observability and Infrastructure Blueprints of AIFACTORY-US-1343, then the preview of the new change proposal of AIFACTORY-US-1344, then its merge, then the pipeline run, the release and the promotion under the one production approval of AIFACTORY-US-1342. The evidence pack holds the run identifiers in that order, the pipeline and release references, the approval with its release id and environment, the blueprint versions and the environment inventory. A demonstration that fails is recorded with its failing step and the increment stays open; nothing is waived. The done_when of the epics devops-gitops and runtime-cloud reads this proof as the outcome verification of I2. Kind: evidence. Traces: services: PipelineExecutionService, ReleaseService, EnvironmentPromotionService, RuntimeEnvironmentService; workflows: delivery-run, security-blueprint, observability-blueprint, infrastructure-plan, preview-environment, release; adrs: ADR-0029. Depends on: AIFACTORY-US-1342, AIFACTORY-US-1343, AIFACTORY-US-1344. Sources: model/backlog/increments.yaml, model/backlog/epics.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the precondition register and the I1 chain replayed from the fixture brief on the I2 estate, when the recorded acceptance run is read by its run identifiers, then the blueprint runs precede the preview run, the preview run precedes the merge of the same change proposal, and the merge precedes the pipeline run, the release and the promotion, as AIFACTORY-US-1342, AIFACTORY-US-1343 and AIFACTORY-US-1344 record them (preview-environment, delivery-run, release, model/backlog/increments.yaml).",
        "AC2: Given the merged change of the replayed chain, when its pipeline runs, then the recorded results and the ready release are linked from the evidence, as AIFACTORY-US-1342 proves it (PipelineExecutionService, ReleaseService).",
        "AC3: Given the design of the product, when the security, observability and infrastructure workflows run, then three validated blueprints exist and no person wrote one of them, as AIFACTORY-US-1343 proves it (security-blueprint, observability-blueprint, infrastructure-plan).",
        "AC4: Given the change proposal, when a preview environment is approved, created and its time to live passes, then creation, use and teardown are recorded, as AIFACTORY-US-1344 proves it (preview-environment, RuntimeEnvironmentService).",
        "AC5: Given the ready release, when it is promoted to production, then the one approval names the release id and the environment and the current release of the target environment is that release; and the evidence pack, reviewed against the outcome of I2 in model/backlog/increments.yaml, has every demonstration or its recorded failure or blocker (EnvironmentPromotionService, ADR-0029)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-342",
        "AIFACTORY-TASK-305",
        "AIFACTORY-TASK-775"
      ],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10904,
      "kind": "evidence",
      "traces": {
        "services": [
          "PipelineExecutionService",
          "ReleaseService",
          "EnvironmentPromotionService",
          "RuntimeEnvironmentService"
        ],
        "workflows": [
          "delivery-run",
          "security-blueprint",
          "observability-blueprint",
          "infrastructure-plan",
          "preview-environment",
          "release"
        ],
        "adrs": [
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1342",
        "AIFACTORY-US-1343",
        "AIFACTORY-US-1344"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-030]",
      "number": 30
    },
    {
      "id": "AIFACTORY-TASK-342",
      "type": "task",
      "parent": "AIFACTORY-US-030",
      "title": "Run the four demonstrations and record the evidence",
      "sequence": "20.03.04.01",
      "description": "Run the four demonstrations and record the evidence. Expected output: An evidence page with the precondition register, the run identifiers in the order of the recorded run, pipeline and release references, the approval with its release id and environment, the blueprint versions and the environment inventory, from one recorded acceptance run of AIFACTORY-US-1343, AIFACTORY-US-1344 and AIFACTORY-US-1342.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "An evidence page with the precondition register, the run identifiers in the order of the recorded run, pipeline and release references, the approval with its release id and environment, the blueprint versions and the environment inventory, from one recorded acceptance run of AIFACTORY-US-1343, AIFACTORY-US-1344 and AIFACTORY-US-1342."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10904,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-342]",
      "number": 342
    },
    {
      "id": "AIFACTORY-TASK-305",
      "type": "task",
      "parent": "AIFACTORY-US-030",
      "title": "Evidence pack for increment I2",
      "sequence": "20.03.04.02",
      "description": "Evidence pack for increment I2. Expected output: A recorded run of every demonstration below with its run identifiers, artifacts and logs: The merged change triggers a pipeline run whose results are recorded. The Security, Observability and Infrastructure Blueprints of the product are produced and validated without a person writing them. A preview environment is provisioned, used and torn down. A promotion to the next environment waits for an approval bound to the exact release.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A recorded run of every demonstration below with its run identifiers, artifacts and logs: The merged change triggers a pipeline run whose results are recorded. The Security, Observability and Infrastructure Blueprints of the product are produced and validated without a person writing them. A preview environment is provisioned, used and torn down. A promotion to the next environment waits for an approval bound to the exact release."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10904,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-305]",
      "number": 305
    },
    {
      "id": "AIFACTORY-TASK-775",
      "type": "task",
      "parent": "AIFACTORY-US-030",
      "title": "Verify delivery-demonstrated against the recorded acceptance run",
      "sequence": "20.03.04.03",
      "description": "Verify delivery-demonstrated against the recorded acceptance run. Expected output: The evidence pack is compared with AC1 to AC5 of AIFACTORY-US-030 and with the outcome of I2 in model/backlog/increments.yaml; the run identifiers show the order blueprints, preview, merge, pipeline run, release and promotion, every demonstration has its evidence or its blocker, and `python -I tools/docs_model validate` passes with the evidence page in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The evidence pack is compared with AC1 to AC5 of AIFACTORY-US-030 and with the outcome of I2 in model/backlog/increments.yaml; the run identifiers show the order blueprints, preview, merge, pipeline run, release and promotion, every demonstration has its evidence or its blocker, and `python -I tools/docs_model validate` passes with the evidence page in place."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i2-deliver-it",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 109,
      "phase": "factory",
      "stackRank": 10904,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-775]",
      "number": 775
    },
    {
      "id": "AIFACTORY-FEAT-141",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I3: Studio",
      "sequence": "20.04",
      "description": "The outcome of increment I3 is demonstrated end to end and the evidence is recorded: The same chain is submitted, watched and decided in Factory Studio. Demonstrations: A requester submits a run and follows it live in the Studio. A reviewer decides approvals from the approval inbox. Every work area renders from the platform read models through the backend-for-frontend. Increment I3: Studio. Build order 123 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-1345",
        "AIFACTORY-US-1346",
        "AIFACTORY-US-1347",
        "AIFACTORY-US-040"
      ],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12300,
      "titlePrefix": "[AIFACTORY-FEAT-141]",
      "number": 141
    },
    {
      "id": "AIFACTORY-US-1345",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-141",
      "title": "Studio proof: a requester submits the vision of the first outcome in the Studio and follows the run live to its change proposal",
      "sequence": "20.04.01",
      "description": "As a requester, I want to submit the vision of the first outcome from the Studio and watch the run progress without reloading, so that the Studio replaces the command-line client for the chain of the first outcome. This PBI proves the first demonstration of increment I3: a requester submits a run and follows it live in the Studio. The requester signs in to the Studio, chooses the project in the scope switcher and submits the fixture vision brief of the proof of I1 on the screen `run-submit` of the Workspace work area. The Studio front end calls only the backend-for-frontend: StudioBff forwards the submission through `ForwardCommand` with the user token of the requester to `SubmitRun` of RunControlService, and the scope of the call is the scope of the token, never a value the page typed. The screen `run-detail` then follows the run live: it subscribes through `Realtime.Subscribe` of StudioRealtimeGateway, and the state changes that RunControlService records reach the open page without a reload through the stream bridge of StudioRealtimeGateway, until the chain of six workflows ends with the open change proposal. The gateway does not consume `RunStateChanged` itself; StudioBff does, and the proof compares the states the page showed with the `RunStateChanged` records of RunControlService. A dropped realtime connection is resumed and the page catches up from the screen model of StudioBff without losing a state. The proof records the run identifier, the sequence of states the page showed beside the states RunControlService recorded, and the reference of the change proposal. Kind: evidence. Traces: services: StudioBff, StudioRealtimeGateway, RunControlService; apis: StudioBff/ForwardCommand, StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe, RunControlService/SubmitRun; events: RunControlService/RunStateChanged; requirements: FR-12. Relates: screens: run-submit, run-detail. Depends on: feature:verify-generate-a-microservice, feature:studio-bff, feature:studio-realtime-gateway, feature:studio-workspace, feature:component-blazor-shell-template-studio, feature:run-control-service. Sources: model/backlog/increments.yaml, model/services/factory-studio/StudioBff.yaml, model/services/factory-studio/StudioRealtimeGateway.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a requester signed in to the Studio with the project chosen, when the requester submits the fixture vision brief on the screen `run-submit`, then StudioBff forwards it with the user token of the requester and RunControlService accepts the run in the scope of that token, and the run identifier is recorded (StudioBff/ForwardCommand, RunControlService/SubmitRun, FR-12).",
        "AC2: Given the screen `run-detail` open on that run, when RunControlService records each state change of the chain of six workflows, then the change reaches the page without a reload through the stream bridge of StudioRealtimeGateway and its realtime subscription, and the states the page showed equal the `RunStateChanged` records of RunControlService (StudioRealtimeGateway/Realtime.Subscribe, RunControlService/RunStateChanged).",
        "AC3: Given the realtime connection is dropped while the run is in progress, when it is resumed, then the page catches up from the screen model of StudioBff and shows no gap in the states, and the run ends on the screen with the reference of its open change proposal (StudioBff/GetScreenModel)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5404",
        "AIFACTORY-TASK-5405"
      ],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12301,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "RunControlService"
        ],
        "apis": [
          "StudioBff/ForwardCommand",
          "StudioBff/GetScreenModel",
          "StudioRealtimeGateway/Realtime.Subscribe",
          "RunControlService/SubmitRun"
        ],
        "events": [
          "RunControlService/RunStateChanged"
        ],
        "requirements": [
          "FR-12"
        ]
      },
      "relates": {
        "screens": [
          "run-submit",
          "run-detail"
        ]
      },
      "dependsOn": [
        "feature:verify-generate-a-microservice",
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:studio-workspace",
        "feature:component-blazor-shell-template-studio",
        "feature:run-control-service"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/services/factory-studio/StudioBff.yaml",
        "model/services/factory-studio/StudioRealtimeGateway.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1345]",
      "number": 1345
    },
    {
      "id": "AIFACTORY-TASK-5404",
      "type": "task",
      "parent": "AIFACTORY-US-1345",
      "title": "Submission and live follow of one run in the Studio",
      "sequence": "20.04.01.01",
      "description": "Submission and live follow of one run in the Studio. Expected output: One recorded session in the Studio on the acceptance environment: the submission of the fixture vision brief on `run-submit`, the run identifier, the states shown on `run-detail` beside the states RunControlService recorded, one dropped and resumed realtime connection and the reference of the change proposal at the end.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One recorded session in the Studio on the acceptance environment: the submission of the fixture vision brief on `run-submit`, the run identifier, the states shown on `run-detail` beside the states RunControlService recorded, one dropped and resumed realtime connection and the reference of the change proposal at the end."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12301,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5404]",
      "number": 5404
    },
    {
      "id": "AIFACTORY-TASK-5405",
      "type": "task",
      "parent": "AIFACTORY-US-1345",
      "title": "Verify the submit and follow proof against its criteria",
      "sequence": "20.04.01.02",
      "description": "Verify the submit and follow proof against its criteria. Expected output: The recorded session is compared with AC1 to AC3 of AIFACTORY-US-1345 (StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe, RunControlService/RunStateChanged); a state recorded by RunControlService that the page did not show fails the check.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded session is compared with AC1 to AC3 of AIFACTORY-US-1345 (StudioBff/ForwardCommand, StudioRealtimeGateway/Realtime.Subscribe, RunControlService/RunStateChanged); a state recorded by RunControlService that the page did not show fails the check."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12301,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5405]",
      "number": 5405
    },
    {
      "id": "AIFACTORY-US-1346",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-141",
      "title": "Studio proof: a reviewer is notified and decides the approvals of the run from the approval inbox, each decision bound to the exact proposal version",
      "sequence": "20.04.02",
      "description": "As a reviewer, I want to decide the approvals of a run from the inbox of the Studio on the exact version I was shown, so that no decision of mine applies to a proposal I did not see. This PBI proves the second demonstration of increment I3: a reviewer decides approvals from the approval inbox. When the run of AIFACTORY-US-1345 reaches the step that approves the change set, RunControlService opens an approval request bound to the proposal hash with the role Reviewer in project scope as approver rule. StudioNotificationService notifies the eligible reviewer, which `NotificationCreated` records, and the request appears on the screen `approvals-list` of the Workspace work area. The reviewer opens it on `approval-card`, sees the proposal version and its evidence, and decides; StudioBff forwards the decision through `ForwardCommand` with the user token of the reviewer to `DecideApproval`, quoting the request version, and RunControlService records it, which `ApprovalDecided` carries. The refusals are the decided ones: a decision by the requester of the run is answered 403, and a decision on a request that went Stale because the proposal was regenerated, or that another decision already settled, is answered 409; in each case the request keeps its state and the Studio shows the answer. The proof records each decision with the proposal hash it names. Kind: evidence. Traces: services: StudioBff, StudioNotificationService, RunControlService; apis: StudioBff/ForwardCommand, RunControlService/DecideApproval; events: StudioNotificationService/NotificationCreated, RunControlService/ApprovalRequested, RunControlService/ApprovalDecided; adrs: ADR-0015; requirements: FR-06. Relates: screens: approvals-list, approval-card. Depends on: AIFACTORY-US-1345, feature:studio-bff, feature:studio-notification-service, feature:studio-workspace, feature:run-control-service. Sources: model/backlog/increments.yaml, model/services/control-plane/RunControlService.yaml, model/services/factory-studio/StudioNotificationService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the approval request of the run, when it is opened, then the eligible reviewer is notified and the request is listed on the screen `approvals-list` with its proposal version (StudioNotificationService/NotificationCreated, RunControlService/ApprovalRequested).",
        "AC2: Given the reviewer opens the request on `approval-card`, when the reviewer approves it, then StudioBff forwards the decision with the request version, RunControlService records it bound to the proposal hash the card showed, and the run continues (StudioBff/ForwardCommand, RunControlService/DecideApproval, RunControlService/ApprovalDecided, FR-06).",
        "AC3: Given the requester of the run, or a request that went Stale or was already decided, when a decision is sent from the Studio, then RunControlService answers 403 for the requester and 409 for the stale or settled request, the request keeps its state and the Studio shows the answer (RunControlService/DecideApproval, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5406",
        "AIFACTORY-TASK-5407"
      ],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12302,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff",
          "StudioNotificationService",
          "RunControlService"
        ],
        "apis": [
          "StudioBff/ForwardCommand",
          "RunControlService/DecideApproval"
        ],
        "events": [
          "StudioNotificationService/NotificationCreated",
          "RunControlService/ApprovalRequested",
          "RunControlService/ApprovalDecided"
        ],
        "adrs": [
          "ADR-0015"
        ],
        "requirements": [
          "FR-06"
        ]
      },
      "relates": {
        "screens": [
          "approvals-list",
          "approval-card"
        ]
      },
      "dependsOn": [
        "AIFACTORY-US-1345",
        "feature:studio-bff",
        "feature:studio-notification-service",
        "feature:studio-workspace",
        "feature:run-control-service"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/services/factory-studio/StudioNotificationService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1346]",
      "number": 1346
    },
    {
      "id": "AIFACTORY-TASK-5406",
      "type": "task",
      "parent": "AIFACTORY-US-1346",
      "title": "Inbox decisions and refusals of the run approvals in the Studio",
      "sequence": "20.04.02.01",
      "description": "Inbox decisions and refusals of the run approvals in the Studio. Expected output: One recorded reviewer session on the acceptance environment: the notification, the request on `approvals-list`, the approving decision on `approval-card` with the proposal hash it names, and the refused decisions of the requester (403) and on a stale request (409) with the answer the Studio showed.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One recorded reviewer session on the acceptance environment: the notification, the request on `approvals-list`, the approving decision on `approval-card` with the proposal hash it names, and the refused decisions of the requester (403) and on a stale request (409) with the answer the Studio showed."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12302,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5406]",
      "number": 5406
    },
    {
      "id": "AIFACTORY-TASK-5407",
      "type": "task",
      "parent": "AIFACTORY-US-1346",
      "title": "Verify the inbox proof against its criteria",
      "sequence": "20.04.02.02",
      "description": "Verify the inbox proof against its criteria. Expected output: The recorded decisions and refusals are compared with AC1 to AC3 of AIFACTORY-US-1346 (StudioNotificationService/NotificationCreated, RunControlService/DecideApproval, RunControlService/ApprovalDecided); a decision bound to another hash than the one shown fails the check.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded decisions and refusals are compared with AC1 to AC3 of AIFACTORY-US-1346 (StudioNotificationService/NotificationCreated, RunControlService/DecideApproval, RunControlService/ApprovalDecided); a decision bound to another hash than the one shown fails the check."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12302,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5407]",
      "number": 5407
    },
    {
      "id": "AIFACTORY-US-1347",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-141",
      "title": "Studio proof: every screen of the seven work areas renders from the platform read models through the backend-for-frontend for every Factory role",
      "sequence": "20.04.03",
      "description": "As an observer, I want every work area of the Studio to render from the read models of the platform for my role, so that the Studio shows the state of the Factory and never a mock or a direct call around the backend-for-frontend. This PBI proves the third demonstration of increment I3: every work area renders from the platform read models through the backend-for-frontend. The Studio has seven work areas: Workspace, Software Factory, Assets, Intelligence, Quality & releases, Operations & usage, and Governance & administration, with the screens model/ux/screens.yaml lists. A render check signs in once with each of the seven Factory roles. Each screen of model/ux/screens.yaml has its own `roles` list, so for each role the check opens the screens whose list names that role and asserts that they render, and for each screen whose list does not name the role it asserts that the screen is not offered and that `GetScreenModel` refuses it with 403; `run-submit`, for example, is offered to a Requester only. For each screen that renders it asserts that the page renders from the screen model `GetScreenModel` of StudioBff, that the browser called no address other than StudioBff and StudioRealtimeGateway, that the screen shows the state families of model/ux/states.yaml from real read models and never from a mock, and that the actions a role may not take are not offered to it, as the observer persona of model/ux/personas.yaml asks. A screen whose source is not yet delivered in I3 shows that source as degraded or unknown in the freshness family, never hidden, and is listed by name. The record of the check, per role and per screen, is the evidence; a screen that fails to render or calls a service directly fails the proof. Kind: evidence. Traces: services: StudioBff, StudioRealtimeGateway; apis: StudioBff/GetScreenModel, StudioBff/GetStudioSession, StudioRealtimeGateway/Realtime.Subscribe; requirements: FR-12. Depends on: feature:studio-bff, feature:studio-realtime-gateway, feature:studio-workspace, feature:studio-software-factory, feature:studio-assets, feature:studio-intelligence, feature:studio-quality-releases, feature:studio-operations-usage, feature:studio-governance-administration, feature:component-blazor-shell-template-studio. Sources: model/backlog/increments.yaml, model/ux/screens.yaml, model/services/factory-studio/StudioBff.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the screens of model/ux/screens.yaml with their `roles` lists, when the render check signs in with each of the seven Factory roles, then every screen whose list names the role renders from the screen model of StudioBff, every screen whose list does not name it is not offered and `GetScreenModel` refuses it with 403, and the record holds one line per role and screen with the expected and the observed result (StudioBff/GetScreenModel, FR-12).",
        "AC2: Given the network log of the render check, when it is read, then the browser called no address other than StudioBff and StudioRealtimeGateway, and no screen rendered from a mock or a static fallback (StudioBff/GetScreenModel, StudioRealtimeGateway/Realtime.Subscribe).",
        "AC3: Given a role without the right to an action of a screen, when the screen renders for that role, then the action is not offered, and a screen whose source is not delivered in I3 shows that source as degraded or unknown in the freshness family of model/ux/states.yaml and is listed by name (StudioBff/GetStudioSession, FR-12)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5408",
        "AIFACTORY-TASK-5409",
        "AIFACTORY-TASK-5410"
      ],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12303,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway"
        ],
        "apis": [
          "StudioBff/GetScreenModel",
          "StudioBff/GetStudioSession",
          "StudioRealtimeGateway/Realtime.Subscribe"
        ],
        "requirements": [
          "FR-12"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:studio-bff",
        "feature:studio-realtime-gateway",
        "feature:studio-workspace",
        "feature:studio-software-factory",
        "feature:studio-assets",
        "feature:studio-intelligence",
        "feature:studio-quality-releases",
        "feature:studio-operations-usage",
        "feature:studio-governance-administration",
        "feature:component-blazor-shell-template-studio"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/ux/screens.yaml",
        "model/services/factory-studio/StudioBff.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1347]",
      "number": 1347
    },
    {
      "id": "AIFACTORY-TASK-5408",
      "type": "task",
      "parent": "AIFACTORY-US-1347",
      "title": "Render check over every screen and role",
      "sequence": "20.04.03.01",
      "description": "Render check over every screen and role. Expected output: A browser-driven render check in the Studio repository that signs in with each of the seven Factory roles, opens the screens of model/ux/screens.yaml whose `roles` list names the role and records the state each rendered, the screen model it read, the addresses the browser called and the actions it showed, asserts for every other screen that it is not offered and that `GetScreenModel` answers 403, and fails on a direct service call, a mock, or a screen rendered for a role its list does not name.. Kind: fixture. Repository: ConnectSoft.AI.SoftwareFactory.Studio.",
      "acceptanceCriteria": [
        "A browser-driven render check in the Studio repository that signs in with each of the seven Factory roles, opens the screens of model/ux/screens.yaml whose `roles` list names the role and records the state each rendered, the screen model it read, the addresses the browser called and the actions it showed, asserts for every other screen that it is not offered and that `GetScreenModel` answers 403, and fails on a direct service call, a mock, or a screen rendered for a role its list does not name."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:fixture",
        "repo:ConnectSoft.AI.SoftwareFactory.Studio"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12303,
      "kind": "fixture",
      "titlePrefix": "[AIFACTORY-TASK-5408]",
      "number": 5408
    },
    {
      "id": "AIFACTORY-TASK-5409",
      "type": "task",
      "parent": "AIFACTORY-US-1347",
      "title": "Render check run on the acceptance environment",
      "sequence": "20.04.03.02",
      "description": "Render check run on the acceptance environment. Expected output: One run of the render check against the acceptance environment with its record per role and screen, the network log and the list of screens that showed a degraded or unknown source, kept with the evidence of increment I3.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One run of the render check against the acceptance environment with its record per role and screen, the network log and the list of screens that showed a degraded or unknown source, kept with the evidence of increment I3."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12303,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5409]",
      "number": 5409
    },
    {
      "id": "AIFACTORY-TASK-5410",
      "type": "task",
      "parent": "AIFACTORY-US-1347",
      "title": "Verify the render proof against its criteria",
      "sequence": "20.04.03.03",
      "description": "Verify the render proof against its criteria. Expected output: The record of the render check is compared with AC1 to AC3 of AIFACTORY-US-1347 and with the screens of model/ux/screens.yaml; every screen has a line for every role with its expected result, rendered where the `roles` list names the role and refused with 403 where it does not, and no line names a direct service call or a mock (StudioBff/GetScreenModel).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The record of the render check is compared with AC1 to AC3 of AIFACTORY-US-1347 and with the screens of model/ux/screens.yaml; every screen has a line for every role with its expected result, rendered where the `roles` list names the role and refused with 403 where it does not, and no line names a direct service call or a mock (StudioBff/GetScreenModel)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12303,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5410]",
      "number": 5410
    },
    {
      "id": "AIFACTORY-US-040",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-141",
      "title": "The Studio outcome is demonstrated with evidence",
      "sequence": "20.04.04",
      "description": "As an operator, I want to see the chain of the first outcome submitted, followed and decided in the Studio, with the evidence recorded, so that the third outcome is accepted on facts. This is the integration PBI of the feature and the closing proof of increment I3. The outcome of I3, as model/backlog/increments.yaml states it, is that the same chain as the first outcome is submitted, watched and decided in Factory Studio. The increment is finished when this proof passes, not when the Studio is deployed. An operator replays the three demonstrations in one recorded acceptance run: the requester submits the fixture vision brief and follows the run live of AIFACTORY-US-1345, the reviewer decides its approvals from the inbox of AIFACTORY-US-1346, and the render check of every work area for every role of AIFACTORY-US-1347 runs on the same estate. The evidence pack holds the run identifier, the states shown and recorded, the decisions with the proposal hashes they name, and the record of the render check. The done_when of the epic factory-studio reads this proof as the outcome verification of I3, together with the epics agent-mesh and template-library whose done_when name I3. A demonstration that fails is recorded with its failing step and the increment stays open; nothing is waived. Kind: evidence. Traces: services: StudioBff, StudioRealtimeGateway, StudioNotificationService, RunControlService; workflows: vision-to-blueprint, generate-product; adrs: ADR-0029. Depends on: AIFACTORY-US-1345, AIFACTORY-US-1346, AIFACTORY-US-1347. Sources: model/backlog/increments.yaml, model/backlog/epics.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a requester in the Studio, when they submit a vision in the recorded acceptance run, then the run is followed live to its change proposal and the run identifier is in the evidence, as AIFACTORY-US-1345 proves it (StudioBff, StudioRealtimeGateway, RunControlService).",
        "AC2: Given the approvals of that run, when a reviewer decides them from the inbox, then each decision names the exact proposal version, as AIFACTORY-US-1346 proves it (StudioNotificationService, RunControlService).",
        "AC3: Given the seven work areas, when the render check runs with every role, then its record is part of the evidence, as AIFACTORY-US-1347 proves it (StudioBff).",
        "AC4: Given the evidence pack, when it is reviewed against the outcome of I3 in model/backlog/increments.yaml and the done_when of the epic outcome-verification in model/backlog/epics.yaml, then every demonstration has its evidence or its recorded failure (ADR-0029)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-536",
        "AIFACTORY-TASK-507",
        "AIFACTORY-TASK-778"
      ],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12304,
      "kind": "evidence",
      "traces": {
        "services": [
          "StudioBff",
          "StudioRealtimeGateway",
          "StudioNotificationService",
          "RunControlService"
        ],
        "workflows": [
          "vision-to-blueprint",
          "generate-product"
        ],
        "adrs": [
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-1345",
        "AIFACTORY-US-1346",
        "AIFACTORY-US-1347"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-040]",
      "number": 40
    },
    {
      "id": "AIFACTORY-TASK-536",
      "type": "task",
      "parent": "AIFACTORY-US-040",
      "title": "Run the three demonstrations and record the evidence",
      "sequence": "20.04.04.01",
      "description": "Run the three demonstrations and record the evidence. Expected output: An evidence page with the run identifiers, the approval decisions with their proposal hashes and the render record, from one recorded acceptance run of AIFACTORY-US-1345, AIFACTORY-US-1346 and AIFACTORY-US-1347.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "An evidence page with the run identifiers, the approval decisions with their proposal hashes and the render record, from one recorded acceptance run of AIFACTORY-US-1345, AIFACTORY-US-1346 and AIFACTORY-US-1347."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12304,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-536]",
      "number": 536
    },
    {
      "id": "AIFACTORY-TASK-507",
      "type": "task",
      "parent": "AIFACTORY-US-040",
      "title": "Evidence pack for increment I3",
      "sequence": "20.04.04.02",
      "description": "Evidence pack for increment I3. Expected output: A recorded run of every demonstration below with its run identifiers, artifacts and logs: A requester submits a run and follows it live in the Studio. A reviewer decides approvals from the approval inbox. Every work area renders from the platform read models through the backend-for-frontend.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A recorded run of every demonstration below with its run identifiers, artifacts and logs: A requester submits a run and follows it live in the Studio. A reviewer decides approvals from the approval inbox. Every work area renders from the platform read models through the backend-for-frontend."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12304,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-507]",
      "number": 507
    },
    {
      "id": "AIFACTORY-TASK-778",
      "type": "task",
      "parent": "AIFACTORY-US-040",
      "title": "Verify studio-demonstrated against the recorded acceptance run",
      "sequence": "20.04.04.03",
      "description": "Verify studio-demonstrated against the recorded acceptance run. Expected output: The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-040 and with the outcome of I3 in model/backlog/increments.yaml; every demonstration has its evidence, and `python -I tools/docs_model validate` passes with the evidence page in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-040 and with the outcome of I3 in model/backlog/increments.yaml; every demonstration has its evidence, and `python -I tools/docs_model validate` passes with the evidence page in place."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i3-studio",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 123,
      "phase": "factory",
      "stackRank": 12304,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-778]",
      "number": 778
    },
    {
      "id": "AIFACTORY-FEAT-142",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I4: Trust and accountability",
      "sequence": "20.05",
      "description": "The outcome of increment I4 is demonstrated end to end and the evidence is recorded: A release publishes only with evaluation evidence, approvals follow the rules of the project, and a run recovers after a worker is killed. Demonstrations: A workflow or agent release without evaluation evidence cannot be published. An approval is routed to the reviewers the rule names, and the requester can never decide it. A killed worker is replaced and the run resumes from its journal. A breached service level objective raises its alert and is visible on the operations views. Increment I4: Trust and accountability. Build order 142 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development"
      ],
      "children": [
        "AIFACTORY-US-050",
        "AIFACTORY-US-1348",
        "AIFACTORY-US-1349",
        "AIFACTORY-US-051"
      ],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14200,
      "titlePrefix": "[AIFACTORY-FEAT-142]",
      "number": 142
    },
    {
      "id": "AIFACTORY-US-050",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-142",
      "title": "A run survives the loss of the worker that executes it",
      "sequence": "20.05.01",
      "description": "As an operator, I want a run to continue after the worker that executes an attempt is killed, so that a failure of infrastructure costs time and never correctness. This PBI proves the demonstration of increment I4 that a killed worker is replaced and the run resumes from its journal. A scripted drill on the acceptance environment starts a run of the first-outcome chain and, while an attempt holds its lease, kills the replica of AgentRuntimeService that executes it. The platform does what ADR-0024 decides. The lease the attempt acquired through `RunControl.AcquireLease` is not renewed and expires, which `LeaseExpired` of RunControlService records; the attempt is reconciled before any retry, and the replica range of the service brings a new replica up. The retry is dispatched as a new attempt, which `AttemptDispatched` records, and the new replica starts it from the last compatible checkpoint of the attempt, which `AttemptStarted` and `AttemptCheckpointed` carry and `ListCheckpoints` lists; a checkpoint whose adapter version is not compatible is not resumed, and Run Control starts the attempt afresh instead (ADR-0024 decision 2); the run journal of RunControlService is the restore anchor (ADR-0024 decision 5), so no step that already succeeded runs again. A second drill kills the replica between a tool effect and its receipt. ToolAdapterService cannot know whether the effect happened, records it as uncertain, which `ToolEffectUncertain` carries, and the attempt outcome is Uncertain. No retry happens on its own: an operator decision through `DecideApproval` must carry a finding, recorded in ToolAdapterService through `ConfirmToolEffect`, and the choice retry is accepted only with the finding not-applied. Each drill record names the killed replica, the expired lease and the resumed or held attempt. Kind: evidence. Traces: services: RunControlService, AgentRuntimeService, ToolAdapterService; events: RunControlService/LeaseExpired, RunControlService/AttemptDispatched, AgentRuntimeService/AttemptCheckpointed, AgentRuntimeService/AttemptStarted, ToolAdapterService/ToolEffectUncertain; apis: RunControlService/RunControl.AcquireLease, RunControlService/RunControl.ReportAttemptOutcome, RunControlService/DecideApproval, AgentRuntimeService/ListCheckpoints, ToolAdapterService/ConfirmToolEffect; adrs: ADR-0024, ADR-0014. Depends on: feature:run-control-service, feature:agent-runtime-service, feature:tool-adapter-service. Sources: model/backlog/increments.yaml, docs/architecture/adr/0024-durable-execution-substrate.md.",
      "acceptanceCriteria": [
        "AC1: Given an attempt in progress that holds its lease, when the replica of AgentRuntimeService that executes it is killed, then the lease expires and the attempt is reconciled before any retry, and a new replica comes up within the replica range of the service (RunControlService/RunControl.AcquireLease, RunControlService/LeaseExpired, ADR-0024).",
        "AC2: Given the reconciled attempt, when the step is retried, then a new attempt is dispatched and resumes from the last compatible checkpoint, or starts afresh when no checkpoint is compatible, the run continues from its journal, and no step that already succeeded runs again (RunControlService/AttemptDispatched, AgentRuntimeService/AttemptStarted, AgentRuntimeService/AttemptCheckpointed, AgentRuntimeService/ListCheckpoints, ADR-0024 decisions 2 and 5).",
        "AC3: Given a tool effect that may have happened, when the replica died before the receipt, then the effect is recorded as uncertain and no retry happens on its own; an operator decision without a finding is refused, and the choice retry is accepted only with the finding not-applied (ToolAdapterService/ToolEffectUncertain, ToolAdapterService/ConfirmToolEffect, RunControlService/DecideApproval, RunControlService/RunControl.ReportAttemptOutcome).",
        "AC4: Given each drill ended, when its record is stored, then it names the killed replica, the expired lease and the resumed or held attempt with their identifiers, and the record is part of the evidence of I4 (ADR-0014, ADR-0024)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-564",
        "AIFACTORY-TASK-565",
        "AIFACTORY-TASK-779",
        "AIFACTORY-TASK-5417"
      ],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14201,
      "kind": "evidence",
      "traces": {
        "services": [
          "RunControlService",
          "AgentRuntimeService",
          "ToolAdapterService"
        ],
        "events": [
          "RunControlService/LeaseExpired",
          "RunControlService/AttemptDispatched",
          "AgentRuntimeService/AttemptCheckpointed",
          "AgentRuntimeService/AttemptStarted",
          "ToolAdapterService/ToolEffectUncertain"
        ],
        "apis": [
          "RunControlService/RunControl.AcquireLease",
          "RunControlService/RunControl.ReportAttemptOutcome",
          "RunControlService/DecideApproval",
          "AgentRuntimeService/ListCheckpoints",
          "ToolAdapterService/ConfirmToolEffect"
        ],
        "adrs": [
          "ADR-0024",
          "ADR-0014"
        ]
      },
      "relates": {},
      "dependsOn": [
        "feature:run-control-service",
        "feature:agent-runtime-service",
        "feature:tool-adapter-service"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0024-durable-execution-substrate.md"
      ],
      "titlePrefix": "[AIFACTORY-US-050]",
      "number": 50
    },
    {
      "id": "AIFACTORY-TASK-564",
      "type": "task",
      "parent": "AIFACTORY-US-050",
      "title": "Recovery drill in the acceptance environment",
      "sequence": "20.05.01.01",
      "description": "Recovery drill in the acceptance environment. Expected output: A scripted drill kills the replica of AgentRuntimeService that holds an attempt and records the expired lease, the reconciliation, the new replica, the new attempt and the checkpoint it resumed from.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "A scripted drill kills the replica of AgentRuntimeService that holds an attempt and records the expired lease, the reconciliation, the new replica, the new attempt and the checkpoint it resumed from."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-564]",
      "number": 564
    },
    {
      "id": "AIFACTORY-TASK-565",
      "type": "task",
      "parent": "AIFACTORY-US-050",
      "title": "Uncertain-effect path of the drill",
      "sequence": "20.05.01.02",
      "description": "Uncertain-effect path of the drill. Expected output: A second drill kills the replica between a tool effect and its receipt and proves that no retry happens before an operator decision with the finding not-applied is recorded.. Kind: implementation. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "A second drill kills the replica between a tool effect and its receipt and proves that no retry happens before an operator decision with the finding not-applied is recorded."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:implementation",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14201,
      "kind": "implementation",
      "titlePrefix": "[AIFACTORY-TASK-565]",
      "number": 565
    },
    {
      "id": "AIFACTORY-TASK-779",
      "type": "task",
      "parent": "AIFACTORY-US-050",
      "title": "Verify run-recovers-after-worker-kill by running the declared command",
      "sequence": "20.05.01.03",
      "description": "Verify run-recovers-after-worker-kill by running the declared command. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` with the recovery drill; a zero-match filter counts as a failure; it passes and proves AC1, AC2 and AC4 of AIFACTORY-US-050 (RunControlService/LeaseExpired, AgentRuntimeService/ListCheckpoints).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.AgentRuntimeService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` with the recovery drill; a zero-match filter counts as a failure; it passes and proves AC1, AC2 and AC4 of AIFACTORY-US-050 (RunControlService/LeaseExpired, AgentRuntimeService/ListCheckpoints)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.AgentRuntimeService"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-779]",
      "number": 779
    },
    {
      "id": "AIFACTORY-TASK-5417",
      "type": "task",
      "parent": "AIFACTORY-US-050",
      "title": "Verify the uncertain-effect drill in the tool adapter acceptance suite",
      "sequence": "20.05.01.04",
      "description": "Verify the uncertain-effect drill in the tool adapter acceptance suite. Expected output: Run `dotnet test -c Release --filter Category=Acceptance` in ConnectSoft.AI.SoftwareFactory.ToolAdapterService with the uncertain-effect drill of AIFACTORY-TASK-565; a zero-match filter counts as a failure; it passes and proves AC3 of AIFACTORY-US-050 (ToolAdapterService/ToolEffectUncertain, ToolAdapterService/ConfirmToolEffect).. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.ToolAdapterService.",
      "acceptanceCriteria": [
        "Run `dotnet test -c Release --filter Category=Acceptance` in ConnectSoft.AI.SoftwareFactory.ToolAdapterService with the uncertain-effect drill of AIFACTORY-TASK-565; a zero-match filter counts as a failure; it passes and proves AC3 of AIFACTORY-US-050 (ToolAdapterService/ToolEffectUncertain, ToolAdapterService/ConfirmToolEffect)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.ToolAdapterService"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14201,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5417]",
      "number": 5417
    },
    {
      "id": "AIFACTORY-US-1348",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-142",
      "title": "Trust proof: a workflow or agent release without evaluation evidence is not published, and an approval is routed to the reviewers the rule names and never decided by its requester",
      "sequence": "20.05.02",
      "description": "As an observer, I want to see the publication gate refuse a release without evaluation evidence and an approval reach only the reviewers its rule names, so that what the Factory runs and what it changes is decided by the evidence and the people the rules require. This PBI proves two demonstrations of increment I4, after an I4 precondition register is checked; while an entry is open, the demonstration that needs it is not run and the blocker is recorded as the evidence. The register has one open entry: on a deployed installation neither the approval rule source port nor the membership port of ApprovalPolicyService has a production binding until the owner names the operations behind them (AIFACTORY-US-923, AIFACTORY-US-925); in that state no approval rule is in force and every routing answers FAILED_PRECONDITION. Two former entries are decided and in the model and are checked as aligned. The subject of a request is a kind and an id from the closed list of `ApprovalSubjectKind`: Run, ProvisioningRun, EvaluationRun, AssetRelease and Promotion, and the service that owns the subject receives the decision (D135, which closes D129 and D131); the publication approval names the subject kind AssetRelease and the release id, and its decision returns to AgentRegistryService. RunControlService calls `ApprovalPolicy.Route` when a request is made and `ApprovalPolicy.ValidateDecision` at decision time from I4 (D126, D127). The first demonstration is that a workflow or agent release without evaluation evidence cannot be published, which ADR-0021 decision 2 requires. An asset maintainer submits a candidate release through `SubmitRelease` of AgentRegistryService for an asset kind that has an evaluation suite, so the submission itself triggers the evaluation (D117); the gate applies only to such asset kinds. Publication requested through `PublishRelease` before `EvaluationCompleted` is answered 412 naming the failing gate and nothing is published. The evaluation completes with a passed verdict, a Reviewer who did not submit the release grants the publication approval of subject kind AssetRelease, and the release is published, which `AssetReleasePublished` records. The second demonstration is that approvals follow the rules of the project. The rule in force has a quorum of one, because RunControlService holds one decider per request and answers an approve under a quorum above one with 409 (D127). ApprovalPolicyService routes the change-set approval of a run through `ApprovalPolicy.Route`, which `ApprovalRouted` records with the eligible approvers. The requester of the run is answered 403 through `DecideApproval`, whatever role the requester holds; a reviewer the rule names decides, validated through `ApprovalPolicy.ValidateDecision`. Kind: evidence. Traces: services: AgentRegistryService, QualityScoreService, ApprovalPolicyService, RunControlService; apis: AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease, ApprovalPolicyService/ApprovalPolicy.Route, ApprovalPolicyService/ApprovalPolicy.ValidateDecision, RunControlService/DecideApproval; events: QualityScoreService/EvaluationCompleted, AgentRegistryService/AssetReleasePublished, ApprovalPolicyService/ApprovalRouted, RunControlService/ApprovalRequested; adrs: ADR-0015, ADR-0021; requirements: FR-02, FR-06. Relates: screens: release-evidence, approval-policy. Depends on: feature:agent-registry-service-publication, feature:agent-registry-service-complete, feature:quality-score-service-complete, feature:approval-policy-service, feature:run-control-service. Sources: model/backlog/increments.yaml, docs/architecture/adr/0021-quality-gates.md, model/services/governance/ApprovalPolicyService.yaml, model/services/control-plane/AgentRegistryService.yaml, model/services/control-plane/RunControlService.yaml, model/backlog/pbis/governance/approval-policy-service.yaml.",
      "acceptanceCriteria": [
        "AC1: Given the I4 precondition register, when it is checked before the run, then the production bindings of the approval rule source port and the membership port of ApprovalPolicyService (AIFACTORY-US-923, AIFACTORY-US-925) have their state, and while either is open the demonstration that needs it is not run and the blocker is recorded; the closed list of approval subjects with AssetRelease for a publication (D135) and the dependency of RunControlService on `ApprovalPolicy.Route` and `ApprovalPolicy.ValidateDecision` (D126) are recorded as aligned (model/services/governance/ApprovalPolicyService.yaml, model/services/control-plane/RunControlService.yaml).",
        "AC2: Given a candidate agent release submitted through `SubmitRelease` for an asset kind that has an evaluation suite, when its publication is requested before `EvaluationCompleted`, then the answer is 412 naming the failing gate, the release keeps its state and no `AssetReleasePublished` is recorded (AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease, ADR-0021 decision 2, FR-02).",
        "AC3: Given the evaluation the submission started, when it completes with a passed verdict and a Reviewer who did not submit the release grants the publication approval, whose request names the subject kind AssetRelease and the release id, then the decision returns to AgentRegistryService, the publication requested again is accepted, `AssetReleasePublished` is recorded and the evaluation record is referenced from its manifest (RunControlService/ApprovalRequested, QualityScoreService/EvaluationCompleted, AgentRegistryService/AssetReleasePublished, ADR-0021 decision 3, D135).",
        "AC4: Given a rule in force for the class shared-write in the project with a quorum of one, when the change-set approval of a run is routed, then the eligible approvers are those the rule names, without the requester, and the routing is recorded (ApprovalPolicyService/ApprovalPolicy.Route, ApprovalPolicyService/ApprovalRouted, FR-06).",
        "AC5: Given that request, when the requester of the run decides it, then the decision is answered 403 whatever role the requester holds and the request keeps its state, and when a reviewer the rule names approves it, then the decision is validated with the quorum met and recorded (RunControlService/DecideApproval, ApprovalPolicyService/ApprovalPolicy.ValidateDecision, ADR-0015)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/backlog/pbis/governance/approval-policy-service.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5418",
        "AIFACTORY-TASK-5411",
        "AIFACTORY-TASK-5412",
        "AIFACTORY-TASK-5413"
      ],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14202,
      "kind": "evidence",
      "traces": {
        "services": [
          "AgentRegistryService",
          "QualityScoreService",
          "ApprovalPolicyService",
          "RunControlService"
        ],
        "apis": [
          "AgentRegistryService/SubmitRelease",
          "AgentRegistryService/PublishRelease",
          "ApprovalPolicyService/ApprovalPolicy.Route",
          "ApprovalPolicyService/ApprovalPolicy.ValidateDecision",
          "RunControlService/DecideApproval"
        ],
        "events": [
          "QualityScoreService/EvaluationCompleted",
          "AgentRegistryService/AssetReleasePublished",
          "ApprovalPolicyService/ApprovalRouted",
          "RunControlService/ApprovalRequested"
        ],
        "adrs": [
          "ADR-0015",
          "ADR-0021"
        ],
        "requirements": [
          "FR-02",
          "FR-06"
        ]
      },
      "relates": {
        "screens": [
          "release-evidence",
          "approval-policy"
        ]
      },
      "dependsOn": [
        "feature:agent-registry-service-publication",
        "feature:agent-registry-service-complete",
        "feature:quality-score-service-complete",
        "feature:approval-policy-service",
        "feature:run-control-service"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "docs/architecture/adr/0021-quality-gates.md",
        "model/services/governance/ApprovalPolicyService.yaml",
        "model/services/control-plane/AgentRegistryService.yaml",
        "model/services/control-plane/RunControlService.yaml",
        "model/backlog/pbis/governance/approval-policy-service.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1348]",
      "number": 1348
    },
    {
      "id": "AIFACTORY-TASK-5418",
      "type": "task",
      "parent": "AIFACTORY-US-1348",
      "title": "Precondition register of the trust proof",
      "sequence": "20.05.02.01",
      "description": "Precondition register of the trust proof. Expected output: A precondition register on the evidence page that lists the production bindings of the approval rule source port and the membership port of ApprovalPolicyService (AIFACTORY-US-923, AIFACTORY-US-925), the closed list of approval subjects with AssetRelease for a publication (D135) and the dependency of RunControlService on `ApprovalPolicy.Route` and `ApprovalPolicy.ValidateDecision` (D126), each with the model file that closes it and its state, aligned or blocking.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "A precondition register on the evidence page that lists the production bindings of the approval rule source port and the membership port of ApprovalPolicyService (AIFACTORY-US-923, AIFACTORY-US-925), the closed list of approval subjects with AssetRelease for a publication (D135) and the dependency of RunControlService on `ApprovalPolicy.Route` and `ApprovalPolicy.ValidateDecision` (D126), each with the model file that closes it and its state, aligned or blocking."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14202,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-5418]",
      "number": 5418
    },
    {
      "id": "AIFACTORY-TASK-5411",
      "type": "task",
      "parent": "AIFACTORY-US-1348",
      "title": "Refused and granted publication of one agent release",
      "sequence": "20.05.02.02",
      "description": "Refused and granted publication of one agent release. Expected output: One recorded sequence on the acceptance environment: the submission through `SubmitRelease` of a candidate agent release of an asset kind with an evaluation suite, its publication requested before `EvaluationCompleted` and answered 412 with the failing gate, the evaluation started by the submission with its passed verdict, the publication approval of subject kind AssetRelease by a Reviewer who did not submit the release and the published release with the evaluation record in its manifest.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One recorded sequence on the acceptance environment: the submission through `SubmitRelease` of a candidate agent release of an asset kind with an evaluation suite, its publication requested before `EvaluationCompleted` and answered 412 with the failing gate, the evaluation started by the submission with its passed verdict, the publication approval of subject kind AssetRelease by a Reviewer who did not submit the release and the published release with the evaluation record in its manifest."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14202,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5411]",
      "number": 5411
    },
    {
      "id": "AIFACTORY-TASK-5412",
      "type": "task",
      "parent": "AIFACTORY-US-1348",
      "title": "Routing and refused requester decision of one run approval",
      "sequence": "20.05.02.03",
      "description": "Routing and refused requester decision of one run approval. Expected output: One recorded routing of the change-set approval of a run under the rule in force for the class shared-write with a quorum of one and its eligible approvers, the decision of the requester answered 403, and the validated decision of a reviewer the rule names.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One recorded routing of the change-set approval of a run under the rule in force for the class shared-write with a quorum of one and its eligible approvers, the decision of the requester answered 403, and the validated decision of a reviewer the rule names."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14202,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5412]",
      "number": 5412
    },
    {
      "id": "AIFACTORY-TASK-5413",
      "type": "task",
      "parent": "AIFACTORY-US-1348",
      "title": "Verify the publication gate and approval rule proof against its criteria",
      "sequence": "20.05.02.04",
      "description": "Verify the publication gate and approval rule proof against its criteria. Expected output: The register, recorded refusals, routing and decisions are compared with AC1 to AC5 of AIFACTORY-US-1348 (AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease, ApprovalPolicyService/ApprovalRouted, RunControlService/DecideApproval, ADR-0021); a publication without a passed verdict, a decision by the requester, or an open precondition presented as passed fails the check.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The register, recorded refusals, routing and decisions are compared with AC1 to AC5 of AIFACTORY-US-1348 (AgentRegistryService/SubmitRelease, AgentRegistryService/PublishRelease, ApprovalPolicyService/ApprovalRouted, RunControlService/DecideApproval, ADR-0021); a publication without a passed verdict, a decision by the requester, or an open precondition presented as passed fails the check."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14202,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5413]",
      "number": 5413
    },
    {
      "id": "AIFACTORY-US-1349",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-142",
      "title": "Trust proof: a breached service level objective raises its alert, which the operations views show until the objective recovers",
      "sequence": "20.05.03",
      "description": "As an operator, I want a breached objective of a Factory service to raise its alert and appear on the operations views, so that a degradation is seen and acted on before a person reports it. This PBI proves the demonstration of increment I4 that a breached service level objective raises its alert and is visible on the operations views. An operator sets, through `SetSlo` of SloService, an objective on a Factory service of the first outcome on the acceptance environment that the planned load of the drill cannot meet, and an alert rule for it through `SetAlertRule` of AlertRuleService. The drill applies the load. When the error budget of the objective is spent, SloService records the breach, which `SloBreached` carries, and AlertRuleService raises the alert of the rule, which `AlertFired` carries. The alert appears on the screen `alerts` and the breached objective on `status-objectives` of the Operations & usage work area, read through the gateway ObservabilityHost from `ListAlerts` of AlertRuleService and `ListSlos` of SloService, and the project overview on the screen `overview` from `GetOverview` of DashboardService, the overview kind DashboardService serves in I4 (D131); the freshness of each source is shown and a degraded source is never hidden. When the load stops and the objective recovers, `SloRecovered` and `AlertResolved` are recorded and the views show the recovery. The record names the objective, the alert, the times the views showed each state and the identifiers of the events. Kind: evidence. Traces: services: SloService, AlertRuleService, DashboardService, ObservabilityHost; apis: SloService/SetSlo, AlertRuleService/SetAlertRule, AlertRuleService/ListAlerts, SloService/ListSlos, DashboardService/GetOverview; events: SloService/SloBreached, SloService/SloRecovered, AlertRuleService/AlertFired, AlertRuleService/AlertResolved; adrs: ADR-0018. Relates: screens: alerts, status-objectives, overview; nfrs: NFR-10. Depends on: feature:slo-service, feature:alert-rule-service, feature:dashboard-service, feature:observability-host, feature:studio-operations-usage. Sources: model/backlog/increments.yaml, model/services/observability/SloService.yaml, model/services/observability/AlertRuleService.yaml.",
      "acceptanceCriteria": [
        "AC1: Given an objective and its alert rule set on a Factory service of the acceptance environment, when the drill load spends its error budget, then the breach and the alert are recorded with their identifiers (SloService/SetSlo, AlertRuleService/SetAlertRule, SloService/SloBreached, AlertRuleService/AlertFired, NFR-10).",
        "AC2: Given the fired alert, when an operator opens the operations views read through ObservabilityHost, then the alert is listed on `alerts`, the breached objective on `status-objectives` and the project overview on `overview`, each with the freshness of its source (AlertRuleService/ListAlerts, SloService/ListSlos, DashboardService/GetOverview, D131).",
        "AC3: Given the load stops, when the objective recovers, then the recovery and the resolved alert are recorded and the views show them, and the record of the drill is part of the evidence of I4 (SloService/SloRecovered, AlertRuleService/AlertResolved)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/services/observability/SloService.yaml",
        "model/services/observability/AlertRuleService.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-5414",
        "AIFACTORY-TASK-5415"
      ],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14203,
      "kind": "evidence",
      "traces": {
        "services": [
          "SloService",
          "AlertRuleService",
          "DashboardService",
          "ObservabilityHost"
        ],
        "apis": [
          "SloService/SetSlo",
          "AlertRuleService/SetAlertRule",
          "AlertRuleService/ListAlerts",
          "SloService/ListSlos",
          "DashboardService/GetOverview"
        ],
        "events": [
          "SloService/SloBreached",
          "SloService/SloRecovered",
          "AlertRuleService/AlertFired",
          "AlertRuleService/AlertResolved"
        ],
        "adrs": [
          "ADR-0018"
        ]
      },
      "relates": {
        "screens": [
          "alerts",
          "status-objectives",
          "overview"
        ],
        "nfrs": [
          "NFR-10"
        ]
      },
      "dependsOn": [
        "feature:slo-service",
        "feature:alert-rule-service",
        "feature:dashboard-service",
        "feature:observability-host",
        "feature:studio-operations-usage"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/services/observability/SloService.yaml",
        "model/services/observability/AlertRuleService.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-1349]",
      "number": 1349
    },
    {
      "id": "AIFACTORY-TASK-5414",
      "type": "task",
      "parent": "AIFACTORY-US-1349",
      "title": "Breach drill of one objective with its alert and views",
      "sequence": "20.05.03.01",
      "description": "Breach drill of one objective with its alert and views. Expected output: One recorded drill on the acceptance environment: the objective and the alert rule set for a Factory service, the load applied, the breach and the fired alert with their identifiers, screenshots of `alerts`, `status-objectives` and the project overview on `overview` with the freshness of each source, and the recovery with the resolved alert.. Kind: operations. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "One recorded drill on the acceptance environment: the objective and the alert rule set for a Factory service, the load applied, the breach and the fired alert with their identifiers, screenshots of `alerts`, `status-objectives` and the project overview on `overview` with the freshness of each source, and the recovery with the resolved alert."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:operations",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14203,
      "kind": "operations",
      "titlePrefix": "[AIFACTORY-TASK-5414]",
      "number": 5414
    },
    {
      "id": "AIFACTORY-TASK-5415",
      "type": "task",
      "parent": "AIFACTORY-US-1349",
      "title": "Verify the breach proof against its criteria",
      "sequence": "20.05.03.02",
      "description": "Verify the breach proof against its criteria. Expected output: The recorded drill is compared with AC1 to AC3 of AIFACTORY-US-1349 (SloService/SloBreached, AlertRuleService/AlertFired, AlertRuleService/ListAlerts, SloService/ListSlos, DashboardService/GetOverview, SloService/SloRecovered); a breach without an alert, an alert missing from `alerts` or an objective missing from `status-objectives` fails the check.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The recorded drill is compared with AC1 to AC3 of AIFACTORY-US-1349 (SloService/SloBreached, AlertRuleService/AlertFired, AlertRuleService/ListAlerts, SloService/ListSlos, DashboardService/GetOverview, SloService/SloRecovered); a breach without an alert, an alert missing from `alerts` or an objective missing from `status-objectives` fails the check."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14203,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-5415]",
      "number": 5415
    },
    {
      "id": "AIFACTORY-US-051",
      "type": "pbi",
      "parent": "AIFACTORY-FEAT-142",
      "title": "Trust and accountability are demonstrated with evidence",
      "sequence": "20.05.04",
      "description": "As an observer, I want to see that a release needs evidence, that approvals follow the rules, that a run recovers and that a breach raises its alert, so that the fourth outcome is accepted on facts. This is the integration PBI of the feature and the closing proof of increment I4. The outcome of I4, as model/backlog/increments.yaml states it, is that a release publishes only with evaluation evidence, that approvals follow the rules of the project and that a run recovers after a worker is killed; the fourth demonstration adds that a breached service level objective raises its alert and is visible on the operations views. The increment is finished when this proof passes, not when its services are deployed. An observer replays the four demonstrations in one recorded acceptance run: the publication gate and the approval routing of AIFACTORY-US-1348, the two recovery drills of AIFACTORY-US-050 and the breach drill of AIFACTORY-US-1349. The evidence pack holds the refusals with their gates, the routing and the decisions, the drill records with the killed replicas, expired leases and resumed attempts, and the alert with its place on the operations views. The done_when of the epics governance, observability and data-event reads this proof as the outcome verification of I4. A demonstration that fails is recorded with its failing step and the increment stays open; nothing is waived. Kind: evidence. Traces: services: AgentRegistryService, QualityScoreService, ApprovalPolicyService, AgentRuntimeService, SloService, AlertRuleService, DashboardService; adrs: ADR-0021, ADR-0024, ADR-0029. Depends on: AIFACTORY-US-050, AIFACTORY-US-1348, AIFACTORY-US-1349. Sources: model/backlog/increments.yaml, model/backlog/epics.yaml.",
      "acceptanceCriteria": [
        "AC1: Given a release without evaluation evidence, when its publication is requested in the recorded acceptance run, then the refusal of AgentRegistryService is in the evidence, as AIFACTORY-US-1348 proves it (AgentRegistryService, QualityScoreService, ADR-0021).",
        "AC2: Given an approval request, when it is routed and the requester tries to decide it, then the routing and the refusal are in the evidence, as AIFACTORY-US-1348 proves it (ApprovalPolicyService).",
        "AC3: Given the recovery drills, when they end, then their records are in the evidence, as AIFACTORY-US-050 proves it (AgentRuntimeService, ADR-0024).",
        "AC4: Given a breached objective, when its alert fires, then the alert and its place on the operations views are in the evidence, as AIFACTORY-US-1349 proves it, and the pack reviewed against the outcome of I4 in model/backlog/increments.yaml has every demonstration, its recorded failure or the blocker of its open precondition (SloService, AlertRuleService, DashboardService, ADR-0029)."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:pbi",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:evidence"
      ],
      "children": [
        "AIFACTORY-TASK-566",
        "AIFACTORY-TASK-508",
        "AIFACTORY-TASK-780"
      ],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14204,
      "kind": "evidence",
      "traces": {
        "services": [
          "AgentRegistryService",
          "QualityScoreService",
          "ApprovalPolicyService",
          "AgentRuntimeService",
          "SloService",
          "AlertRuleService",
          "DashboardService"
        ],
        "adrs": [
          "ADR-0021",
          "ADR-0024",
          "ADR-0029"
        ]
      },
      "relates": {},
      "dependsOn": [
        "AIFACTORY-US-050",
        "AIFACTORY-US-1348",
        "AIFACTORY-US-1349"
      ],
      "source": [
        "model/backlog/increments.yaml",
        "model/backlog/epics.yaml"
      ],
      "titlePrefix": "[AIFACTORY-US-051]",
      "number": 51
    },
    {
      "id": "AIFACTORY-TASK-566",
      "type": "task",
      "parent": "AIFACTORY-US-051",
      "title": "Run the four demonstrations and record the evidence",
      "sequence": "20.05.04.01",
      "description": "Run the four demonstrations and record the evidence. Expected output: An evidence page with the refusal and its gate, the routing and the decisions, the drill records and the alert with its place on the operations views, from one recorded acceptance run of AIFACTORY-US-1348, AIFACTORY-US-050 and AIFACTORY-US-1349.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "An evidence page with the refusal and its gate, the routing and the decisions, the drill records and the alert with its place on the operations views, from one recorded acceptance run of AIFACTORY-US-1348, AIFACTORY-US-050 and AIFACTORY-US-1349."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14204,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-566]",
      "number": 566
    },
    {
      "id": "AIFACTORY-TASK-508",
      "type": "task",
      "parent": "AIFACTORY-US-051",
      "title": "Evidence pack for increment I4",
      "sequence": "20.05.04.02",
      "description": "Evidence pack for increment I4. Expected output: A recorded run of every demonstration below with its run identifiers, artifacts and logs: A workflow or agent release without evaluation evidence cannot be published. An approval is routed to the reviewers the rule names, and the requester can never decide it. A killed worker is replaced and the run resumes from its journal. A breached service level objective raises its alert and is visible on the operations views.. Kind: documentation. Repository: ConnectSoft.AI.SoftwareFactory.Documentation. Verification: python -I tools/docs_model validate.",
      "acceptanceCriteria": [
        "A recorded run of every demonstration below with its run identifiers, artifacts and logs: A workflow or agent release without evaluation evidence cannot be published. An approval is routed to the reviewers the rule names, and the requester can never decide it. A killed worker is replaced and the run resumes from its journal. A breached service level objective raises its alert and is visible on the operations views."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:documentation",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14204,
      "kind": "documentation",
      "titlePrefix": "[AIFACTORY-TASK-508]",
      "number": 508
    },
    {
      "id": "AIFACTORY-TASK-780",
      "type": "task",
      "parent": "AIFACTORY-US-051",
      "title": "Verify trust-demonstrated against the recorded acceptance run",
      "sequence": "20.05.04.03",
      "description": "Verify trust-demonstrated against the recorded acceptance run. Expected output: The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-051 and with the outcome of I4 in model/backlog/increments.yaml; every demonstration has its evidence, and `python -I tools/docs_model validate` passes with the evidence page in place.. Kind: verification. Repository: ConnectSoft.AI.SoftwareFactory.Documentation.",
      "acceptanceCriteria": [
        "The evidence pack is compared with AC1 to AC4 of AIFACTORY-US-051 and with the outcome of I4 in model/backlog/increments.yaml; every demonstration has its evidence, and `python -I tools/docs_model validate` passes with the evidence page in place."
      ],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:task",
        "route:qa-engineer",
        "slice:i4-trust-and-accountability",
        "phase:development",
        "kind:verification",
        "repo:ConnectSoft.AI.SoftwareFactory.Documentation"
      ],
      "children": [],
      "buildOrder": 142,
      "phase": "factory",
      "stackRank": 14204,
      "kind": "verification",
      "titlePrefix": "[AIFACTORY-TASK-780]",
      "number": 780
    },
    {
      "id": "AIFACTORY-FEAT-143",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I5: Knowledge and connections",
      "sequence": "20.06",
      "description": "The outcome of increment I5 is demonstrated end to end and the evidence is recorded: A run on an existing repository uses scoped retrieval with citations, and external systems connect through governed connectors. Demonstrations: An ingested repository is searchable only inside its tenant and project scope. An agent answer cites the retrieved sources. A webhook from an external system is verified, deduplicated and delivered. Increment I5: Knowledge and connections. Build order 157 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i5-knowledge-and-connections",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 157,
      "phase": "factory",
      "stackRank": 15700,
      "titlePrefix": "[AIFACTORY-FEAT-143]",
      "number": 143
    },
    {
      "id": "AIFACTORY-FEAT-144",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I6: Full product generation",
      "sequence": "20.07",
      "description": "The outcome of increment I6 is demonstrated end to end and the evidence is recorded: A multi-module product with a user interface, a gateway and shared libraries is generated from a vision. Demonstrations: The requirements, alignment and UX workflows produce an approved UX Blueprint. The frontend branch of generation runs because the recipe has a shell or microfrontend module. Gateway, libraries, tests and documentation are generated for the product. Increment I6: Full product generation. Build order 173 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i6-full-product-generation",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 173,
      "phase": "factory",
      "stackRank": 17300,
      "titlePrefix": "[AIFACTORY-FEAT-144]",
      "number": 144
    },
    {
      "id": "AIFACTORY-FEAT-145",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I7: Operate and commercialise",
      "sequence": "20.08",
      "description": "The outcome of increment I7 is demonstrated end to end and the evidence is recorded: Generated products are inventoried, upgraded and off-boarded, and Factory usage is billed by edition. Demonstrations: The fleet inventory lists every generated product with its template and library versions. A template upgrade rolls out in waves with a rollback. Usage is metered and billed according to the edition of the tenant. Increment I7: Operate and commercialise. Build order 179 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i7-operate-and-commercialise",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 179,
      "phase": "factory",
      "stackRank": 17900,
      "titlePrefix": "[AIFACTORY-FEAT-145]",
      "number": 145
    },
    {
      "id": "AIFACTORY-FEAT-146",
      "type": "feature",
      "parent": "AIFACTORY-EPIC-020",
      "title": "Demonstrate I8: Expansion",
      "sequence": "20.09",
      "description": "The outcome of increment I8 is demonstrated end to end and the evidence is recorded: Marketplace distribution, self-hosted models and agent-to-agent delegation. Demonstrations: A qualified asset release is listed and licensed in the marketplace. A model profile resolves to an endpoint on a self-hosted compute pool. An agent delegates to another agent through an agent card under the run's authority. Increment I8: Expansion. Build order 185 of 185 (phase: Factory code).",
      "acceptanceCriteria": [],
      "sourceArtifacts": [
        "model/backlog/increments.yaml"
      ],
      "tags": [
        "system:aifactory",
        "project:connectsoft",
        "domain:verification",
        "type:feature",
        "route:qa-engineer",
        "slice:i8-expansion",
        "phase:development"
      ],
      "children": [],
      "buildOrder": 185,
      "phase": "factory",
      "stackRank": 18500,
      "titlePrefix": "[AIFACTORY-FEAT-146]",
      "number": 146
    }
  ]
}
